@sigmashake/ssg 0.29.70 → 0.29.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var te=/\/+/g;function k(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function A(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 ne(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,ne(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+k(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(te,`$&/`)+`/`),ne(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(te,`$&/`)+`/`)+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+k(a,u),c+=ne(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+k(a,u++),c+=ne(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ne(A(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 re(e,t,n){if(e==null)return e;var r=[],i=0;return ne(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ie(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 j=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)},M={map:re,forEach:function(e,t,n){re(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return re(e,function(){t++}),t},toArray:function(e){return re(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=M,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ie}},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,j)}catch(e){j(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.4`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&k(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&k(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,te=ee.port2;ee.port1.onmessage=D,O=function(){te.postMessage(null)}}else O=function(){_(D,0)};function k(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,k(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.4`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),te=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||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 y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?re(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}var ie=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},oe=[],se=-1;function N(e){return{current:e}}function P(e){0>se||(e.current=oe[se],oe[se]=null,se--)}function F(e,t){se++,oe[se]=e.current,e.current=t}var ce=N(null),I=N(null),le=N(null),ue=N(null);function de(e,t){switch(F(le,t),F(I,e),F(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}P(ce),F(ce,e)}function fe(){P(ce),P(I),P(le)}function pe(e){e.memoizedState!==null&&F(ue,e);var t=ce.current,n=Hd(t,e.type);t!==n&&(F(I,e),F(ce,n))}function me(e){I.current===e&&(P(ce),P(I)),ue.current===e&&(P(ue),Qf._currentValue=ae)}var he,L;function ge(e){if(he===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);he=t&&t[1]||``,L=-1<e.stack.indexOf(`
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function j(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 te(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,te(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),te(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+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+A(a,u),c+=te(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+A(a,u++),c+=te(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return te(j(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 ne(e,t,n){if(e==null)return e;var r=[],i=0;return te(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function re(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 M=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)},N={map:ne,forEach:function(e,t,n){ne(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ne(e,function(){t++}),t},toArray:function(e){return ne(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=N,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:re}},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,M)}catch(e){M(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.4`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,k=ee.port2;ee.port1.onmessage=D,O=function(){k.postMessage(null)}}else O=function(){_(D,0)};function A(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,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.4`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var te=Symbol.for(`react.client.reference`);function ne(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?ne(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ne(e(t))}catch{}}return null}var re=Array.isArray,M=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ae=[],oe=-1;function P(e){return{current:e}}function F(e){0>oe||(e.current=ae[oe],ae[oe]=null,oe--)}function I(e,t){oe++,ae[oe]=e.current,e.current=t}var se=P(null),L=P(null),ce=P(null),le=P(null);function ue(e,t){switch(I(ce,t),I(L,e),I(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}F(se),I(se,e)}function de(){F(se),F(L),F(ce)}function fe(e){e.memoizedState!==null&&I(le,e);var t=se.current,n=Hd(t,e.type);t!==n&&(I(L,e),I(se,n))}function pe(e){L.current===e&&(F(se),F(L)),le.current===e&&(F(le),Qf._currentValue=ie)}var me,R;function he(e){if(me===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);me=t&&t[1]||``,R=-1<e.stack.indexOf(`
2
2
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
- `+he+e+L}var _e=!1;function ve(e,t){if(!e||_e)return``;_e=!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(`
3
+ `+me+e+R}var ge=!1;function _e(e,t){if(!e||ge)return``;ge=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
4
  `),l=s.split(`
5
5
  `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
6
- `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{_e=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ge(n):``}function ye(e,t){switch(e.tag){case 26:case 27:case 5:return ge(e.type);case 16:return ge(`Lazy`);case 13:return e.child!==t&&t!==null?ge(`Suspense Fallback`):ge(`Suspense`);case 19:return ge(`SuspenseList`);case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return ge(`Activity`);default:return``}}function be(e){try{var t=``,n=null;do t+=ye(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
6
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ge=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?he(n):``}function ve(e,t){switch(e.tag){case 26:case 27:case 5:return he(e.type);case 16:return he(`Lazy`);case 13:return e.child!==t&&t!==null?he(`Suspense Fallback`):he(`Suspense`);case 19:return he(`SuspenseList`);case 0:case 15:return _e(e.type,!1);case 11:return _e(e.type.render,!1);case 1:return _e(e.type,!0);case 31:return he(`Activity`);default:return``}}function ye(e){try{var t=``,n=null;do t+=ve(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
7
  Error generating stack: `+e.message+`
8
- `+e.stack}}var R=Object.prototype.hasOwnProperty,xe=t.unstable_scheduleCallback,Se=t.unstable_cancelCallback,Ce=t.unstable_shouldYield,we=t.unstable_requestPaint,Te=t.unstable_now,Ee=t.unstable_getCurrentPriorityLevel,De=t.unstable_ImmediatePriority,Oe=t.unstable_UserBlockingPriority,ke=t.unstable_NormalPriority,z=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,B=t.log,je=t.unstable_setDisableYieldValue,Me=null,Ne=null;function Pe(e){if(typeof B==`function`&&je(e),Ne&&typeof Ne.setStrictMode==`function`)try{Ne.setStrictMode(Me,e)}catch{}}var Fe=Math.clz32?Math.clz32:Re,Ie=Math.log,Le=Math.LN2;function Re(e){return e>>>=0,e===0?32:31-(Ie(e)/Le|0)|0}var ze=256,Be=262144,Ve=4194304;function He(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 Ue(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=He(n))):i=He(o):i=He(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=He(n))):i=He(o)):i=He(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 We(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ge(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 Ke(){var e=Ve;return Ve<<=1,!(Ve&62914560)&&(Ve=4194304),e}function qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ye(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-Fe(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&&Xe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Xe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Fe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ze(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Fe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Qe(e,t){var n=t&-t;return n=n&42?1:$e(n),(n&(e.suspendedLanes|t))===0?n:0}function $e(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 et(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function tt(){var e=M.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function nt(e,t){var n=M.p;try{return M.p=e,t()}finally{M.p=n}}var rt=Math.random().toString(36).slice(2),it=`__reactFiber$`+rt,at=`__reactProps$`+rt,ot=`__reactContainer$`+rt,st=`__reactEvents$`+rt,ct=`__reactListeners$`+rt,lt=`__reactHandles$`+rt,ut=`__reactResources$`+rt,dt=`__reactMarker$`+rt;function ft(e){delete e[it],delete e[at],delete e[st],delete e[ct],delete e[lt]}function pt(e){var t=e[it];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ot]||n[it]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[it])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function mt(e){if(e=e[it]||e[ot]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ht(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function gt(e){var t=e[ut];return t||=e[ut]={hoistableStyles:new Map,hoistableScripts:new Map},t}function _t(e){e[dt]=!0}var vt=new Set,yt={};function bt(e,t){xt(e,t),xt(e+`Capture`,t)}function xt(e,t){for(yt[e]=t,e=0;e<t.length;e++)vt.add(t[e])}var St=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]*$`),Ct={},wt={};function Tt(e){return R.call(wt,e)?!0:R.call(Ct,e)?!1:St.test(e)?wt[e]=!0:(Ct[e]=!0,!1)}function Et(e,t,n){if(Tt(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 Dt(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 Ot(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 kt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function At(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function jt(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 Mt(e){if(!e._valueTracker){var t=At(e)?`checked`:`value`;e._valueTracker=jt(e,t,``+e[t])}}function Nt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=At(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Pt(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 Ft=/[\n"\\]/g;function It(e){return e.replace(Ft,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Lt(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=``+kt(t)):e.value!==``+kt(t)&&(e.value=``+kt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):zt(e,o,kt(n)):zt(e,o,kt(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=``+kt(s):e.removeAttribute(`name`)}function Rt(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)){Mt(e);return}n=n==null?``:``+kt(n),t=t==null?n:``+kt(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),Mt(e)}function zt(e,t,n){t===`number`&&Pt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Bt(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=``+kt(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 Vt(e,t,n){if(t!=null&&(t=``+kt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+kt(n)}function Ht(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=kt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Mt(e)}function Ut(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Wt=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 Gt(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||Wt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Kt(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&&Gt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Gt(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 Jt=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`]]),Yt=/^[\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 Xt(e){return Yt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Zt(){}var Qt=null;function $t(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var en=null,tn=null;function nn(e){var t=mt(e);if(t&&(e=t.stateNode)){var n=e[at]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Lt(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="`+It(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[at]||null;if(!a)throw Error(i(90));Lt(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&&Nt(r)}break a;case`textarea`:Vt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Bt(e,!!n.multiple,t,!1)}}}var rn=!1;function an(e,t,n){if(rn)return e(t,n);rn=!0;try{return e(t)}finally{if(rn=!1,(en!==null||tn!==null)&&(vu(),en&&(t=en,e=tn,tn=en=null,nn(t),e)))for(t=0;t<e.length;t++)nn(e[t])}}function on(e,t){var n=e.stateNode;if(n===null)return null;var r=n[at]||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 sn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),cn=!1;if(sn)try{var ln={};Object.defineProperty(ln,`passive`,{get:function(){cn=!0}}),window.addEventListener(`test`,ln,ln),window.removeEventListener(`test`,ln,ln)}catch{cn=!1}var un=null,dn=null,fn=null;function pn(){if(fn)return fn;var e,t=dn,n=t.length,r,i=`value`in un?un.value:un.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 fn=i.slice(e,1<r?1-r:void 0)}function mn(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 hn(){return!0}function gn(){return!1}function _n(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)?hn:gn,this.isPropagationStopped=gn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=hn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=hn)},persist:function(){},isPersistent:hn}),t}var vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yn=_n(vn),bn=h({},vn,{view:0,detail:0}),V=_n(bn),xn,Sn,Cn,wn=h({},bn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pn,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!==Cn&&(Cn&&e.type===`mousemove`?(xn=e.screenX-Cn.screenX,Sn=e.screenY-Cn.screenY):Sn=xn=0,Cn=e),xn)},movementY:function(e){return`movementY`in e?e.movementY:Sn}}),Tn=_n(wn),En=_n(h({},wn,{dataTransfer:0})),Dn=_n(h({},bn,{relatedTarget:0})),On=_n(h({},vn,{animationName:0,elapsedTime:0,pseudoElement:0})),kn=_n(h({},vn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),An=_n(h({},vn,{data:0})),H={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},jn={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`},Mn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Nn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Mn[e])?!!t[e]:!1}function Pn(){return Nn}var Fn=_n(h({},bn,{key:function(e){if(e.key){var t=H[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=mn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pn,charCode:function(e){return e.type===`keypress`?mn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?mn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),In=_n(h({},wn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ln=_n(h({},bn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pn})),U=_n(h({},vn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=_n(h({},wn,{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})),zn=_n(h({},vn,{newState:0,oldState:0})),Bn=[9,13,27,32],Vn=sn&&`CompositionEvent`in window,Hn=null;sn&&`documentMode`in document&&(Hn=document.documentMode);var Un=sn&&`TextEvent`in window&&!Hn,Wn=sn&&(!Vn||Hn&&8<Hn&&11>=Hn),Gn=` `,Kn=!1;function qn(e,t){switch(e){case`keyup`:return Bn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Jn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Yn=!1;function Xn(e,t){switch(e){case`compositionend`:return Jn(t);case`keypress`:return t.which===32?(Kn=!0,Gn):null;case`textInput`:return e=t.data,e===Gn&&Kn?null:e;default:return null}}function Zn(e,t){if(Yn)return e===`compositionend`||!Vn&&qn(e,t)?(e=pn(),fn=dn=un=null,Yn=!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 Wn&&t.locale!==`ko`?null:t.data;default:return null}}var Qn={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 $n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Qn[e.type]:t===`textarea`}function er(e,t,n,r){en?tn?tn.push(r):tn=[r]:en=r,t=Td(t,`onChange`),0<t.length&&(n=new yn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var tr=null,W=null;function nr(e){vd(e,0)}function rr(e){if(Nt(ht(e)))return e}function ir(e,t){if(e===`change`)return t}var ar=!1;if(sn){var G;if(sn){var or=`oninput`in document;if(!or){var K=document.createElement(`div`);K.setAttribute(`oninput`,`return;`),or=typeof K.oninput==`function`}G=or}else G=!1;ar=G&&(!document.documentMode||9<document.documentMode)}function q(){tr&&(tr.detachEvent(`onpropertychange`,J),W=tr=null)}function J(e){if(e.propertyName===`value`&&rr(W)){var t=[];er(t,W,e,$t(e)),an(nr,t)}}function sr(e,t,n){e===`focusin`?(q(),tr=t,W=n,tr.attachEvent(`onpropertychange`,J)):e===`focusout`&&q()}function cr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return rr(W)}function lr(e,t){if(e===`click`)return rr(t)}function ur(e,t){if(e===`input`||e===`change`)return rr(t)}function Y(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var dr=typeof Object.is==`function`?Object.is:Y;function fr(e,t){if(dr(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(!R.call(t,i)||!dr(e[i],t[i]))return!1}return!0}function pr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function mr(e,t){var n=pr(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=pr(n)}}function hr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?hr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function gr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pt(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=Pt(e.document)}return t}function _r(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 vr=sn&&`documentMode`in document&&11>=document.documentMode,yr=null,br=null,xr=null,Sr=!1;function Cr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Sr||yr==null||yr!==Pt(r)||(r=yr,`selectionStart`in r&&_r(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}),xr&&fr(xr,r)||(xr=r,r=Td(br,`onSelect`),0<r.length&&(t=new yn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=yr)))}function wr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Tr={animationend:wr(`Animation`,`AnimationEnd`),animationiteration:wr(`Animation`,`AnimationIteration`),animationstart:wr(`Animation`,`AnimationStart`),transitionrun:wr(`Transition`,`TransitionRun`),transitionstart:wr(`Transition`,`TransitionStart`),transitioncancel:wr(`Transition`,`TransitionCancel`),transitionend:wr(`Transition`,`TransitionEnd`)},Er={},Dr={};sn&&(Dr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Tr.animationend.animation,delete Tr.animationiteration.animation,delete Tr.animationstart.animation),`TransitionEvent`in window||delete Tr.transitionend.transition);function Or(e){if(Er[e])return Er[e];if(!Tr[e])return e;var t=Tr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Dr)return Er[e]=t[n];return e}var kr=Or(`animationend`),Ar=Or(`animationiteration`),jr=Or(`animationstart`),Mr=Or(`transitionrun`),Nr=Or(`transitionstart`),Pr=Or(`transitioncancel`),Fr=Or(`transitionend`),Ir=new Map,Lr=`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(` `);Lr.push(`scrollEnd`);function Rr(e,t){Ir.set(e,t),bt(t,[e])}var zr=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)},Br=[],Vr=0,Hr=0;function Ur(){for(var e=Vr,t=Hr=Vr=0;t<e;){var n=Br[t];Br[t++]=null;var r=Br[t];Br[t++]=null;var i=Br[t];Br[t++]=null;var a=Br[t];if(Br[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&qr(n,i,a)}}function Wr(e,t,n,r){Br[Vr++]=e,Br[Vr++]=t,Br[Vr++]=n,Br[Vr++]=r,Hr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Gr(e,t,n,r){return Wr(e,t,n,r),Jr(e)}function Kr(e,t){return Wr(e,null,null,t),Jr(e)}function qr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Fe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Jr(e){if(50<lu)throw lu=0,uu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yr={};function Xr(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 Zr(e,t,n,r){return new Xr(e,t,n,r)}function Qr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $r(e,t){var n=e.alternate;return n===null?(n=Zr(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 ei(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 ti(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)Qr(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,ce.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ee:return e=Zr(31,n,t,a),e.elementType=ee,e.lanes=o,e;case y:return ni(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=Zr(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=Zr(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=Zr(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Zr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ni(e,t,n,r){return e=Zr(7,e,r,t),e.lanes=n,e}function ri(e,t,n){return e=Zr(6,e,null,t),e.lanes=n,e}function ii(e){var t=Zr(18,null,null,0);return t.stateNode=e,t}function ai(e,t,n){return t=Zr(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var oi=new WeakMap;function si(e,t){if(typeof e==`object`&&e){var n=oi.get(e);return n===void 0?(t={value:e,source:t,stack:be(t)},oi.set(e,t),t):n}return{value:e,source:t,stack:be(t)}}var ci=[],li=0,ui=null,di=0,fi=[],pi=0,mi=null,hi=1,gi=``;function _i(e,t){ci[li++]=di,ci[li++]=ui,ui=e,di=t}function vi(e,t,n){fi[pi++]=hi,fi[pi++]=gi,fi[pi++]=mi,mi=e;var r=hi;e=gi;var i=32-Fe(r)-1;r&=~(1<<i),n+=1;var a=32-Fe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,hi=1<<32-Fe(t)+i|n<<i|r,gi=a+e}else hi=1<<a|n<<i|r,gi=e}function yi(e){e.return!==null&&(_i(e,1),vi(e,1,0))}function bi(e){for(;e===ui;)ui=ci[--li],ci[li]=null,di=ci[--li],ci[li]=null;for(;e===mi;)mi=fi[--pi],fi[pi]=null,gi=fi[--pi],fi[pi]=null,hi=fi[--pi],fi[pi]=null}function xi(e,t){fi[pi++]=hi,fi[pi++]=gi,fi[pi++]=mi,hi=t.id,gi=t.overflow,mi=e}var Si=null,Ci=null,wi=!1,Ti=null,Ei=!1,Di=Error(i(519));function Oi(e){throw Pi(si(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Di}function ki(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[it]=e,t[at]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<gd.length;n++)$(gd[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),Rt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),Ht(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||jd(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=Zt),t=!0):t=!1,t||Oi(e,!0)}function Ai(e){for(Si=e.return;Si;)switch(Si.tag){case 5:case 31:case 13:Ei=!1;return;case 27:case 3:Ei=!0;return;default:Si=Si.return}}function ji(e){if(e!==Si)return!1;if(!wi)return Ai(e),wi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Ud(e.type,e.memoizedProps)),n=!n),n&&Ci&&Oi(e),Ai(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ci=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ci=uf(e)}else t===27?(t=Ci,Zd(e.type)?(e=lf,lf=null,Ci=e):Ci=t):Ci=Si?cf(e.stateNode.nextSibling):null;return!0}function Mi(){Ci=Si=null,wi=!1}function Ni(){var e=Ti;return e!==null&&(Yl===null?Yl=e:Yl.push.apply(Yl,e),Ti=null),e}function Pi(e){Ti===null?Ti=[e]:Ti.push(e)}var Fi=N(null),Ii=null,Li=null;function Ri(e,t,n){F(Fi,t._currentValue),t._currentValue=n}function zi(e){e._currentValue=Fi.current,P(Fi)}function Bi(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 Vi(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),Bi(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),Bi(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 Hi(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;dr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ue.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}a=a.return}e!==null&&Vi(t,e,n,r),t.flags|=262144}function Ui(e){for(e=e.firstContext;e!==null;){if(!dr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Wi(e){Ii=e,Li=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Gi(e){return qi(Ii,e)}function Ki(e,t){return Ii===null&&Wi(e),qi(e,t)}function qi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Li===null){if(e===null)throw Error(i(308));Li=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Li=Li.next=t;return n}var Ji=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()})}},Yi=t.unstable_scheduleCallback,Xi=t.unstable_NormalPriority,Zi={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qi(){return{controller:new Ji,data:new Map,refCount:0}}function $i(e){e.refCount--,e.refCount===0&&Yi(Xi,function(){e.controller.abort()})}var ea=null,ta=0,na=0,ra=null;function ia(e,t){if(ea===null){var n=ea=[];ta=0,na=ud(),ra={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ta++,t.then(aa,aa),t}function aa(){if(--ta===0&&ea!==null){ra!==null&&(ra.status=`fulfilled`);var e=ea;ea=null,na=0,ra=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function oa(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 sa=j.S;j.S=function(e,t){Ql=Te(),typeof t==`object`&&t&&typeof t.then==`function`&&ia(e,t),sa!==null&&sa(e,t)};var ca=N(null);function la(){var e=ca.current;return e===null?Fl.pooledCache:e}function ua(e,t){t===null?F(ca,ca.current):F(ca,t.pool)}function da(){var e=la();return e===null?null:{parent:Zi._currentValue,pool:e}}var fa=Error(i(460)),pa=Error(i(474)),ma=Error(i(542)),ha={then:function(){}};function ga(e){return e=e.status,e===`fulfilled`||e===`rejected`}function _a(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Zt,Zt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,xa(e),e;default:if(typeof t.status==`string`)t.then(Zt,Zt);else{if(e=Fl,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,xa(e),e}throw ya=t,fa}}function va(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ya=e,fa):e}}var ya=null;function ba(){if(ya===null)throw Error(i(459));var e=ya;return ya=null,e}function xa(e){if(e===fa||e===ma)throw Error(i(483))}var Sa=null,Ca=0;function wa(e){var t=Ca;return Ca+=1,Sa===null&&(Sa=[]),_a(Sa,e,t)}function Ta(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ea(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Da(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=$r(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=ri(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&va(i)===t.type)?(t=a(t,n.props),Ta(t,n),t.return=e,t):(t=ti(n.type,n.key,n.props,null,e.mode,r),Ta(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=ai(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=ni(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=ri(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ti(t.type,t.key,t.props,null,e.mode,n),Ta(n,t),n.return=e,n;case v:return t=ai(t,e.mode,n),t.return=e,t;case O:return t=va(t),f(e,t,n)}if(ie(t)||A(t))return t=ni(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,wa(t),n);if(t.$$typeof===C)return f(e,Ki(e,t),n);Ea(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=va(n),p(e,t,n,r)}if(ie(n)||A(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,wa(n),r);if(n.$$typeof===C)return p(e,t,Ki(e,n),r);Ea(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=va(r),m(e,t,n,r,i)}if(ie(r)||A(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,wa(r),i);if(r.$$typeof===C)return m(e,t,n,Ki(t,r),i);Ea(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),wi&&_i(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 wi&&_i(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)}),wi&&_i(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),wi&&_i(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 wi&&_i(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)}),wi&&_i(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&va(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ta(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=ni(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ti(o.type,o.key,o.props,null,e.mode,c),Ta(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ai(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=va(o),b(e,r,o,c)}if(ie(o))return h(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,wa(o),c);if(o.$$typeof===C)return b(e,r,Ki(e,o),c);Ea(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=ri(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ca=0;var i=b(e,t,n,r);return Sa=null,i}catch(t){if(t===fa||t===ma)throw t;var a=Zr(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Oa=Da(!0),ka=Da(!1),Aa=!1;function ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ma(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 Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Jr(e),qr(e,null,n),t}return Wr(e,r,t,n),Jr(e)}function Fa(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,Ze(e,n)}}function Ia(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 La=!1;function Ra(){if(La){var e=ra;if(e!==null)throw e}}function za(e,t,n,r){La=!1;var i=e.updateQueue;Aa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Q&f)===f:(r&f)===f){f!==0&&f===na&&(La=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Aa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function Ba(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Va(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ba(n[e],t)}var Ha=N(null),Ua=N(0);function Wa(e,t){e=Vl,F(Ua,e),F(Ha,t),Vl=e|t.baseLanes}function Ga(){F(Ua,Vl),F(Ha,Ha.current)}function Ka(){Vl=Ua.current,P(Ha),P(Ua)}var qa=N(null),Ja=null;function Ya(e){var t=e.alternate;F(eo,eo.current&1),F(qa,e),Ja===null&&(t===null||Ha.current!==null||t.memoizedState!==null)&&(Ja=e)}function Xa(e){F(eo,eo.current),F(qa,e),Ja===null&&(Ja=e)}function Za(e){e.tag===22?(F(eo,eo.current),F(qa,e),Ja===null&&(Ja=e)):Qa(e)}function Qa(){F(eo,eo.current),F(qa,qa.current)}function $a(e){P(qa),Ja===e&&(Ja=null),P(eo)}var eo=N(0);function to(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(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 no=0,X=null,ro=null,io=null,ao=!1,oo=!1,so=!1,co=0,lo=0,uo=null,fo=0;function po(){throw Error(i(321))}function mo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!dr(e[n],t[n]))return!1;return!0}function ho(e,t,n,r,i,a){return no=a,X=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?Ms:Ns,so=!1,a=n(r,i),so=!1,oo&&(a=_o(t,n,r,i)),go(e),a}function go(e){j.H=js;var t=ro!==null&&ro.next!==null;if(no=0,io=ro=X=null,ao=!1,lo=0,uo=null,t)throw Error(i(300));e===null||Xs||(e=e.dependencies,e!==null&&Ui(e)&&(Xs=!0))}function _o(e,t,n,r){X=e;var a=0;do{if(oo&&(uo=null),lo=0,oo=!1,25<=a)throw Error(i(301));if(a+=1,io=ro=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}j.H=Ps,o=t(n,r)}while(oo);return o}function vo(){var e=j.H,t=e.useState()[0];return t=typeof t.then==`function`?To(t):t,e=e.useState()[0],(ro===null?null:ro.memoizedState)!==e&&(X.flags|=1024),t}function yo(){var e=co!==0;return co=0,e}function bo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function xo(e){if(ao){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ao=!1}no=0,io=ro=X=null,oo=!1,lo=co=0,uo=null}function So(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return io===null?X.memoizedState=io=e:io=io.next=e,io}function Co(){if(ro===null){var e=X.alternate;e=e===null?null:e.memoizedState}else e=ro.next;var t=io===null?X.memoizedState:io.next;if(t!==null)io=t,ro=e;else{if(e===null)throw X.alternate===null?Error(i(467)):Error(i(310));ro=e,e={memoizedState:ro.memoizedState,baseState:ro.baseState,baseQueue:ro.baseQueue,queue:ro.queue,next:null},io===null?X.memoizedState=io=e:io=io.next=e}return io}function wo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function To(e){var t=lo;return lo+=1,uo===null&&(uo=[]),e=_a(uo,e,t),t=X,(io===null?t.memoizedState:io.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?Ms:Ns),e}function Eo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return To(e);if(e.$$typeof===C)return Gi(e)}throw Error(i(438,String(e)))}function Do(e){var t=null,n=X.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=X.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=wo(),X.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 Oo(e,t){return typeof t==`function`?t(e):t}function ko(e){return Ao(Co(),ro,e)}function Ao(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?(no&f)===f:(Q&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===na&&(d=!0);else if((no&p)===p){u=u.next,p===na&&(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,X.lanes|=p,Ul|=p;f=u.action,so&&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,X.lanes|=f,Ul|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!dr(o,e.memoizedState)&&(Xs=!0,d&&(n=ra,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 jo(e){var t=Co(),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);dr(o,t.memoizedState)||(Xs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Mo(e,t,n){var r=X,a=Co(),o=wi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!dr((ro||a).memoizedState,n);if(s&&(a.memoizedState=n,Xs=!0),a=a.queue,rs(Fo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||io!==null&&io.memoizedState.tag&1){if(r.flags|=2048,Qo(9,{destroy:void 0},Po.bind(null,r,a,n,t),null),Fl===null)throw Error(i(349));o||no&127||No(r,t,n)}return n}function No(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=X.updateQueue,t===null?(t=wo(),X.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Po(e,t,n,r){t.value=n,t.getSnapshot=r,Io(t)&&Lo(e)}function Fo(e,t,n){return n(function(){Io(t)&&Lo(e)})}function Io(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!dr(e,n)}catch{return!0}}function Lo(e){var t=Kr(e,2);t!==null&&pu(t,e,2)}function Ro(e){var t=So();if(typeof e==`function`){var n=e;if(e=n(),so){Pe(!0);try{n()}finally{Pe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:e},t}function zo(e,t,n,r){return e.baseState=n,Ao(e,ro,typeof r==`function`?r:Oo)}function Bo(e,t,n,r,a){if(Os(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)}};j.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Vo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Vo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=j.T,o={};j.T=o;try{var s=n(i,r),c=j.S;c!==null&&c(o,s),Ho(e,t,s)}catch(n){Wo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),j.T=a}}else try{a=n(i,r),Ho(e,t,a)}catch(n){Wo(e,t,n)}}function Ho(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Uo(e,t,n)},function(n){return Wo(e,t,n)}):Uo(e,t,n)}function Uo(e,t,n){t.status=`fulfilled`,t.value=n,Go(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Vo(e,n)))}function Wo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Go(t),t=t.next;while(t!==r)}e.action=null}function Go(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ko(e,t){return t}function qo(e,t){if(wi){var n=Fl.formState;if(n!==null){a:{var r=X;if(wi){if(Ci){b:{for(var i=Ci,a=Ei;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ci=cf(i.nextSibling),r=i.data===`F!`;break a}}Oi(r)}r=!1}r&&(t=n[0])}}return n=So(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ko,lastRenderedState:t},n.queue=r,n=Ts.bind(null,X,r),r.dispatch=n,r=Ro(!1),a=Ds.bind(null,X,!1,r.queue),r=So(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Bo.bind(null,X,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Jo(e){return Yo(Co(),ro,e)}function Yo(e,t,n){if(t=Ao(e,t,Ko)[0],e=ko(Oo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=To(t)}catch(e){throw e===fa?ma:e}else r=t;t=Co();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(X.flags|=2048,Qo(9,{destroy:void 0},Xo.bind(null,i,n),null)),[r,a,e]}function Xo(e,t){e.action=t}function Zo(e){var t=Co(),n=ro;if(n!==null)return Yo(t,n,e);Co(),t=t.memoizedState,n=Co();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Qo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=X.updateQueue,t===null&&(t=wo(),X.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 $o(){return Co().memoizedState}function es(e,t,n,r){var i=So();X.flags|=e,i.memoizedState=Qo(1|t,{destroy:void 0},n,r===void 0?null:r)}function ts(e,t,n,r){var i=Co();r=r===void 0?null:r;var a=i.memoizedState.inst;ro!==null&&r!==null&&mo(r,ro.memoizedState.deps)?i.memoizedState=Qo(t,a,n,r):(X.flags|=e,i.memoizedState=Qo(1|t,a,n,r))}function ns(e,t){es(8390656,8,e,t)}function rs(e,t){ts(2048,8,e,t)}function is(e){X.flags|=4;var t=X.updateQueue;if(t===null)t=wo(),X.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function as(e){var t=Co().memoizedState;return is({ref:t,nextImpl:e}),function(){if(Pl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function os(e,t){return ts(4,2,e,t)}function ss(e,t){return ts(4,4,e,t)}function cs(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 ls(e,t,n){n=n==null?null:n.concat([e]),ts(4,4,cs.bind(null,t,e),n)}function us(){}function ds(e,t){var n=Co();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&mo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function fs(e,t){var n=Co();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&mo(t,r[1]))return r[0];if(r=e(),so){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r}function ps(e,t,n){return n===void 0||no&1073741824&&!(Q&261930)?e.memoizedState=t:(e.memoizedState=n,e=fu(),X.lanes|=e,Ul|=e,n)}function ms(e,t,n,r){return dr(n,t)?n:Ha.current===null?!(no&42)||no&1073741824&&!(Q&261930)?(Xs=!0,e.memoizedState=n):(e=fu(),X.lanes|=e,Ul|=e,t):(e=ps(e,n,r),dr(e,t)||(Xs=!0),e)}function hs(e,t,n,r,i){var a=M.p;M.p=a!==0&&8>a?a:8;var o=j.T,s={};j.T=s,Ds(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Es(e,t,oa(c,r),du(e)):Es(e,t,r,du(e))}catch(n){Es(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function gs(){}function _s(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=vs(e).queue;hs(e,a,t,ae,n===null?gs:function(){return ys(e),n(r)})}function vs(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:Oo,lastRenderedState:ae},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ys(e){var t=vs(e);t.next===null&&(t=e.alternate.memoizedState),Es(e,t.next.queue,{},du())}function bs(){return Gi(Qf)}function xs(){return Co().memoizedState}function Ss(){return Co().memoizedState}function Cs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=Na(n);var r=Pa(t,e,n);r!==null&&(pu(r,t,n),Fa(r,t,n)),t={cache:Qi()},e.payload=t;return}t=t.return}}function ws(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Os(e)?ks(t,n):(n=Gr(e,t,n,r),n!==null&&(pu(n,e,r),As(n,t,r)))}function Ts(e,t,n){Es(e,t,n,du())}function Es(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Os(e))ks(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,dr(s,o))return Wr(e,t,i,0),Fl===null&&Ur(),!1}catch{}if(n=Gr(e,t,i,r),n!==null)return pu(n,e,r),As(n,t,r),!0}return!1}function Ds(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Os(e)){if(t)throw Error(i(479))}else t=Gr(e,n,r,2),t!==null&&pu(t,e,2)}function Os(e){var t=e.alternate;return e===X||t!==null&&t===X}function ks(e,t){oo=ao=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function As(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}var js={readContext:Gi,use:Eo,useCallback:po,useContext:po,useEffect:po,useImperativeHandle:po,useLayoutEffect:po,useInsertionEffect:po,useMemo:po,useReducer:po,useRef:po,useState:po,useDebugValue:po,useDeferredValue:po,useTransition:po,useSyncExternalStore:po,useId:po,useHostTransitionStatus:po,useFormState:po,useActionState:po,useOptimistic:po,useMemoCache:po,useCacheRefresh:po};js.useEffectEvent=po;var Ms={readContext:Gi,use:Eo,useCallback:function(e,t){return So().memoizedState=[e,t===void 0?null:t],e},useContext:Gi,useEffect:ns,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),es(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){es(4,2,e,t)},useMemo:function(e,t){var n=So();t=t===void 0?null:t;var r=e();if(so){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=So();if(n!==void 0){var i=n(t);if(so){Pe(!0);try{n(t)}finally{Pe(!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=ws.bind(null,X,e),[r.memoizedState,e]},useRef:function(e){var t=So();return e={current:e},t.memoizedState=e},useState:function(e){e=Ro(e);var t=e.queue,n=Ts.bind(null,X,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:us,useDeferredValue:function(e,t){return ps(So(),e,t)},useTransition:function(){var e=Ro(!1);return e=hs.bind(null,X,e.queue,!0,!1),So().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=X,a=So();if(wi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Fl===null)throw Error(i(349));Q&127||No(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ns(Fo.bind(null,r,o,e),[e]),r.flags|=2048,Qo(9,{destroy:void 0},Po.bind(null,r,o,n,t),null),n},useId:function(){var e=So(),t=Fl.identifierPrefix;if(wi){var n=gi,r=hi;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=co++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=fo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:bs,useFormState:qo,useActionState:qo,useOptimistic:function(e){var t=So();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ds.bind(null,X,!0,n),n.dispatch=t,[e,t]},useMemoCache:Do,useCacheRefresh:function(){return So().memoizedState=Cs.bind(null,X)},useEffectEvent:function(e){var t=So(),n={impl:e};return t.memoizedState=n,function(){if(Pl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ns={readContext:Gi,use:Eo,useCallback:ds,useContext:Gi,useEffect:rs,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:ko,useRef:$o,useState:function(){return ko(Oo)},useDebugValue:us,useDeferredValue:function(e,t){return ms(Co(),ro.memoizedState,e,t)},useTransition:function(){var e=ko(Oo)[0],t=Co().memoizedState;return[typeof e==`boolean`?e:To(e),t]},useSyncExternalStore:Mo,useId:xs,useHostTransitionStatus:bs,useFormState:Jo,useActionState:Jo,useOptimistic:function(e,t){return zo(Co(),ro,e,t)},useMemoCache:Do,useCacheRefresh:Ss};Ns.useEffectEvent=as;var Ps={readContext:Gi,use:Eo,useCallback:ds,useContext:Gi,useEffect:rs,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:jo,useRef:$o,useState:function(){return jo(Oo)},useDebugValue:us,useDeferredValue:function(e,t){var n=Co();return ro===null?ps(n,e,t):ms(n,ro.memoizedState,e,t)},useTransition:function(){var e=jo(Oo)[0],t=Co().memoizedState;return[typeof e==`boolean`?e:To(e),t]},useSyncExternalStore:Mo,useId:xs,useHostTransitionStatus:bs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){var n=Co();return ro===null?(n.baseState=e,[e,n.queue.dispatch]):zo(n,ro,e,t)},useMemoCache:Do,useCacheRefresh:Ss};Ps.useEffectEvent=as;function Fs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Is={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=du(),i=Na(r);i.payload=t,n!=null&&(i.callback=n),t=Pa(e,i,r),t!==null&&(pu(t,e,r),Fa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=du(),i=Na(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Pa(e,i,r),t!==null&&(pu(t,e,r),Fa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=du(),r=Na(n);r.tag=2,t!=null&&(r.callback=t),t=Pa(e,r,n),t!==null&&(pu(t,e,n),Fa(t,e,n))}};function Ls(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?!fr(n,r)||!fr(i,a):!0}function Rs(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&&Is.enqueueReplaceState(t,t.state,null)}function zs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Bs(e){zr(e)}function Vs(e){console.error(e)}function Hs(e){zr(e)}function Us(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ws(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 Gs(e,t,n){return n=Na(n),n.tag=3,n.payload={element:null},n.callback=function(){Us(e,t)},n}function Ks(e){return e=Na(e),e.tag=3,e}function qs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ws(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ws(t,n,r),typeof i!=`function`&&(tu===null?tu=new Set([this]):tu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Js(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Hi(t,n,a,!0),n=qa.current,n!==null){switch(n.tag){case 31:case 13:return Ja===null?Tu():n.alternate===null&&Hl===0&&(Hl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ha?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Wu(e,r,a)),!1;case 22:return n.flags|=65536,r===ha?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)),Wu(e,r,a)),!1}throw Error(i(435,n.tag))}return Wu(e,r,a),Tu(),!1}if(wi)return t=qa.current,t===null?(r!==Di&&(t=Error(i(423),{cause:r}),Pi(si(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=si(r,n),a=Gs(e.stateNode,r,a),Ia(e,a),Hl!==4&&(Hl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Di&&(e=Error(i(422),{cause:r}),Pi(si(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=si(o,n),Jl===null?Jl=[o]:Jl.push(o),Hl!==4&&(Hl=2),t===null)return!0;r=si(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Gs(n.stateNode,r,e),Ia(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`&&(tu===null||!tu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ks(a),qs(a,e,n,r),Ia(n,a),!1}n=n.return}while(n!==null);return!1}var Ys=Error(i(461)),Xs=!1;function Zs(e,t,n,r){t.child=e===null?ka(t,null,n,r):Oa(t,e.child,n,r)}function Qs(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 Wi(t),r=ho(e,t,n,o,a,i),s=yo(),e!==null&&!Xs?(bo(e,t,i),Sc(e,t,i)):(wi&&s&&yi(t),t.flags|=1,Zs(e,t,r,i),t.child)}function $s(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Qr(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ec(e,t,a,r,i)):(e=ti(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Cc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?fr:n,n(o,r)&&e.ref===t.ref)return Sc(e,t,i)}return t.flags|=1,e=$r(a,r),e.ref=t.ref,e.return=t,t.child=e}function ec(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(fr(a,r)&&e.ref===t.ref)if(Xs=!1,t.pendingProps=r=a,Cc(e,i))e.flags&131072&&(Xs=!0);else return t.lanes=e.lanes,Sc(e,t,i)}return cc(e,t,n,r,i)}function tc(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 rc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ua(t,a===null?null:a.cachePool),a===null?Ga():Wa(t,a),Za(t);else return r=t.lanes=536870912,rc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ua(t,null),Ga(),Qa(t)):(ua(t,a.cachePool),Wa(t,a),Qa(t),t.memoizedState=null);return Zs(e,t,i,n),t.child}function nc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function rc(e,t,n,r,i){var a=la();return a=a===null?null:{parent:Zi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ua(t,null),Ga(),Za(t),e!==null&&Hi(e,t,r,!0),t.childLanes=i,null}function ic(e,t){return t=_c({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ac(e,t,n){return Oa(t,e.child,null,n),e=ic(t,t.pendingProps),e.flags|=2,$a(t),t.memoizedState=null,e}function oc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(wi){if(r.mode===`hidden`)return e=ic(t,r),t.lanes=536870912,nc(null,e);if(Xa(t),(e=Ci)?(e=rf(e,Ei),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mi===null?null:{id:hi,overflow:gi},retryLane:536870912,hydrationErrors:null},n=ii(e),n.return=t,t.child=n,Si=t,Ci=null)):e=null,e===null)throw Oi(t);return t.lanes=536870912,null}return ic(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Xa(t),a)if(t.flags&256)t.flags&=-257,t=ac(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(Xs||Hi(e,t,n,!1),a=(n&e.childLanes)!==0,Xs||a){if(r=Fl,r!==null&&(s=Qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Kr(e,s),pu(r,e,s),Ys;Tu(),t=ac(e,t,n)}else e=o.treeContext,Ci=cf(s.nextSibling),Si=t,wi=!0,Ti=null,Ei=!1,e!==null&&xi(t,e),t=ic(t,r),t.flags|=4096;return t}return e=$r(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function sc(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 cc(e,t,n,r,i){return Wi(t),n=ho(e,t,n,r,void 0,i),r=yo(),e!==null&&!Xs?(bo(e,t,i),Sc(e,t,i)):(wi&&r&&yi(t),t.flags|=1,Zs(e,t,n,i),t.child)}function lc(e,t,n,r,i,a){return Wi(t),t.updateQueue=null,n=_o(t,r,n,i),go(e),r=yo(),e!==null&&!Xs?(bo(e,t,a),Sc(e,t,a)):(wi&&r&&yi(t),t.flags|=1,Zs(e,t,n,a),t.child)}function uc(e,t,n,r,i){if(Wi(t),t.stateNode===null){var a=Yr,o=n.contextType;typeof o==`object`&&o&&(a=Gi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Is,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ja(t),o=n.contextType,a.context=typeof o==`object`&&o?Gi(o):Yr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Fs(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&&Is.enqueueReplaceState(a,a.state,null),za(t,r,a,i),Ra(),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=zs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Yr,typeof u==`object`&&u&&(o=Gi(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)&&Rs(t,a,r,o),Aa=!1;var f=t.memoizedState;a.state=f,za(t,r,a,i),Ra(),l=t.memoizedState,s||f!==l||Aa?(typeof d==`function`&&(Fs(t,n,d,r),l=t.memoizedState),(c=Aa||Ls(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,Ma(e,t),o=t.memoizedProps,u=zs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Yr,typeof l==`object`&&l&&(c=Gi(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)&&Rs(t,a,r,c),Aa=!1,f=t.memoizedState,a.state=f,za(t,r,a,i),Ra();var p=t.memoizedState;o!==d||f!==p||Aa||e!==null&&e.dependencies!==null&&Ui(e.dependencies)?(typeof s==`function`&&(Fs(t,n,s,r),p=t.memoizedState),(u=Aa||Ls(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ui(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,sc(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=Oa(t,e.child,null,i),t.child=Oa(t,null,n,i)):Zs(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Sc(e,t,i),e}function dc(e,t,n,r){return Mi(),t.flags|=256,Zs(e,t,n,r),t.child}var fc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function pc(e){return{baseLanes:e,cachePool:da()}}function mc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Kl),e}function hc(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:(eo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(wi){if(a?Ya(t):Qa(t),(e=Ci)?(e=rf(e,Ei),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mi===null?null:{id:hi,overflow:gi},retryLane:536870912,hydrationErrors:null},n=ii(e),n.return=t,t.child=n,Si=t,Ci=null)):e=null,e===null)throw Oi(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(Qa(t),a=t.mode,c=_c({mode:`hidden`,children:c},a),r=ni(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,s,n),t.memoizedState=fc,nc(null,r)):(Ya(t),gc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Ya(t),t.flags&=-257,t=vc(e,t,n)):t.memoizedState===null?(Qa(t),c=r.fallback,a=t.mode,r=_c({mode:`visible`,children:r.children},a),c=ni(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Oa(t,e.child,null,n),r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,s,n),t.memoizedState=fc,t=nc(null,r)):(Qa(t),t.child=e.child,t.flags|=128,t=null);else if(Ya(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Pi({value:r,source:null,stack:null}),t=vc(e,t,n)}else if(Xs||Hi(e,t,n,!1),s=(n&e.childLanes)!==0,Xs||s){if(s=Fl,s!==null&&(r=Qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Kr(e,r),pu(s,e,r),Ys;af(c)||Tu(),t=vc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ci=cf(c.nextSibling),Si=t,wi=!0,Ti=null,Ei=!1,e!==null&&xi(t,e),t=gc(t,r.children),t.flags|=4096);return t}return a?(Qa(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=$r(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ni(c,a,n,null),c.flags|=2):c=$r(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,nc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=pc(n):(a=c.cachePool,a===null?a=da():(l=Zi._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=mc(e,s,n),t.memoizedState=fc,nc(e.child,r)):(Ya(t),n=e.child,e=n.sibling,n=$r(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 gc(e,t){return t=_c({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function _c(e,t){return e=Zr(22,e,null,t),e.lanes=0,e}function vc(e,t,n){return Oa(t,e.child,null,n),e=gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Bi(e.return,t,n)}function bc(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 xc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=eo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,F(eo,o),Zs(e,t,r,n),r=wi?di:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yc(e,n,t);else if(e.tag===19)yc(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&&to(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),bc(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&&to(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}bc(t,!0,n,null,a,r);break;case`together`:bc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Sc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ul|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Hi(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=$r(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=$r(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Ui(e))):!0}function wc(e,t,n){switch(t.tag){case 3:de(t,t.stateNode.containerInfo),Ri(t,Zi,e.memoizedState.cache),Mi();break;case 27:case 5:pe(t);break;case 4:de(t,t.stateNode.containerInfo);break;case 10:Ri(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Xa(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ya(t),e=Sc(e,t,n),e===null?null:e.sibling):hc(e,t,n):(Ya(t),t.flags|=128,null);Ya(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Hi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return xc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),F(eo,eo.current),r)break;return null;case 22:return t.lanes=0,tc(e,t,n,t.pendingProps);case 24:Ri(t,Zi,e.memoizedState.cache)}return Sc(e,t,n)}function Tc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Xs=!0;else{if(!Cc(e,n)&&!(t.flags&128))return Xs=!1,wc(e,t,n);Xs=!!(e.flags&131072)}else Xs=!1,wi&&t.flags&1048576&&vi(t,di,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=va(t.elementType),t.type=e,typeof e==`function`)Qr(e)?(r=zs(e,r),t.tag=1,t=uc(null,t,e,r,n)):(t.tag=0,t=cc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=Qs(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=$s(null,t,e,r,n);break a}}throw t=re(e)||e,Error(i(306,t,``))}}return t;case 0:return cc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=zs(r,t.pendingProps),uc(e,t,r,a,n);case 3:a:{if(de(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ma(e,t),za(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ri(t,Zi,r),r!==o.cache&&Vi(t,[Zi],n,!0),Ra(),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=dc(e,t,r,n);break a}else if(r!==a){a=si(Error(i(424)),t),Pi(a),t=dc(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(Ci=cf(e.firstChild),Si=t,wi=!0,Ti=null,Ei=!0,n=ka(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Mi(),r===a){t=Sc(e,t,n);break a}Zs(e,t,r,n)}t=t.child}return t;case 26:return sc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:wi||(n=t.type,e=t.pendingProps,r=Bd(le.current).createElement(n),r[it]=t,r[at]=e,Pd(r,n,e),_t(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pe(t),e===null&&wi&&(r=t.stateNode=ff(t.type,t.pendingProps,le.current),Si=t,Ei=!0,a=Ci,Zd(t.type)?(lf=a,Ci=cf(r.firstChild)):Ci=a),Zs(e,t,t.pendingProps.children,n),sc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&wi&&((a=r=Ci)&&(r=tf(r,t.type,t.pendingProps,Ei),r===null?a=!1:(t.stateNode=r,Si=t,Ci=cf(r.firstChild),Ei=!1,a=!0)),a||Oi(t)),pe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(a,o)?r=null:s!==null&&Ud(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=ho(e,t,vo,null,null,n),Qf._currentValue=a),sc(e,t),Zs(e,t,r,n),t.child;case 6:return e===null&&wi&&((e=n=Ci)&&(n=nf(n,t.pendingProps,Ei),n===null?e=!1:(t.stateNode=n,Si=t,Ci=null,e=!0)),e||Oi(t)),null;case 13:return hc(e,t,n);case 4:return de(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Oa(t,null,r,n):Zs(e,t,r,n),t.child;case 11:return Qs(e,t,t.type,t.pendingProps,n);case 7:return Zs(e,t,t.pendingProps,n),t.child;case 8:return Zs(e,t,t.pendingProps.children,n),t.child;case 12:return Zs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ri(t,t.type,r.value),Zs(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Wi(t),a=Gi(a),r=r(a),t.flags|=1,Zs(e,t,r,n),t.child;case 14:return $s(e,t,t.type,t.pendingProps,n);case 15:return ec(e,t,t.type,t.pendingProps,n);case 19:return xc(e,t,n);case 31:return oc(e,t,n);case 22:return tc(e,t,n,t.pendingProps);case 24:return Wi(t),r=Gi(Zi),e===null?(a=la(),a===null&&(a=Fl,o=Qi(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ja(t),Ri(t,Zi,a)):((e.lanes&n)!==0&&(Ma(e,t),za(t,null,null,n),Ra()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ri(t,Zi,r),r!==a.cache&&Vi(t,[Zi],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ri(t,Zi,r))),Zs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ec(e){e.flags|=4}function Dc(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(Su())e.flags|=8192;else throw ya=ha,pa}else e.flags&=-16777217}function Oc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(Su())e.flags|=8192;else throw ya=ha,pa}function kc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ke(),e.lanes|=t,ql|=t)}function Ac(e,t){if(!wi)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 jc(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 Mc(e,t,n){var r=t.pendingProps;switch(bi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jc(t),null;case 1:return jc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),zi(Zi),fe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ji(t)?Ec(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ni())),jc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Ec(t),o===null?(jc(t),Dc(t,a,null,r,n)):(jc(t),Oc(t,o))):o?o===e.memoizedState?(jc(t),t.flags&=-16777217):(Ec(t),jc(t),Oc(t,o)):(e=e.memoizedProps,e!==r&&Ec(t),jc(t),Dc(t,a,e,r,n)),null;case 27:if(me(t),n=le.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return jc(t),null}e=ce.current,ji(t)?ki(t,e):(e=ff(a,r,n),t.stateNode=e,Ec(t))}return jc(t),null;case 5:if(me(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return jc(t),null}if(o=ce.current,ji(t))ki(t,o);else{var s=Bd(le.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[it]=t,o[at]=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(Pd(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&&Ec(t)}}return jc(t),Dc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=le.current,ji(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Si,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Oi(t,!0)}else e=Bd(e).createTextNode(r),e[it]=t,t.stateNode=e}return jc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ji(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[it]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),e=!1}else n=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?($a(t),t):($a(t),null);if(t.flags&128)throw Error(i(558))}return jc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ji(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[it]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),a=!1}else a=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?($a(t),t):($a(t),null)}return $a(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),kc(t,t.updateQueue),jc(t),null);case 4:return fe(),e===null&&xd(t.stateNode.containerInfo),jc(t),null;case 10:return zi(t.type),jc(t),null;case 19:if(P(eo),r=t.memoizedState,r===null)return jc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Ac(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=to(e),o!==null){for(t.flags|=128,Ac(r,!1),e=o.updateQueue,t.updateQueue=e,kc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ei(n,e),n=n.sibling;return F(eo,eo.current&1|2),wi&&_i(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Te()>$l&&(t.flags|=128,a=!0,Ac(r,!1),t.lanes=4194304)}else{if(!a)if(e=to(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,kc(t,e),Ac(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!wi)return jc(t),null}else 2*Te()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,a=!0,Ac(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?(jc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Te(),e.sibling=null,n=eo.current,F(eo,a?n&1|2:n&1),wi&&_i(t,r.treeForkCount),e);case 22:case 23:return $a(t),Ka(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(jc(t),t.subtreeFlags&6&&(t.flags|=8192)):jc(t),n=t.updateQueue,n!==null&&kc(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&&P(ca),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),zi(Zi),jc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Nc(e,t){switch(bi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zi(Zi),fe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return me(t),null;case 31:if(t.memoizedState!==null){if($a(t),t.alternate===null)throw Error(i(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if($a(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return P(eo),null;case 4:return fe(),null;case 10:return zi(t.type),null;case 22:case 23:return $a(t),Ka(),e!==null&&P(ca),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return zi(Zi),null;case 25:return null;default:return null}}function Pc(e,t){switch(bi(t),t.tag){case 3:zi(Zi),fe();break;case 26:case 27:case 5:me(t);break;case 4:fe();break;case 31:t.memoizedState!==null&&$a(t);break;case 13:$a(t);break;case 19:P(eo);break;case 10:zi(t.type);break;case 22:case 23:$a(t),Ka(),e!==null&&P(ca);break;case 24:zi(Zi)}}function Fc(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){Uu(t,t.return,e)}}function Ic(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){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function Lc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Va(t,n)}catch(t){Uu(e,e.return,t)}}}function Rc(e,t,n){n.props=zs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function zc(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){Uu(e,t,n)}}function Bc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Uu(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){Uu(e,t,n)}else n.current=null}function Vc(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){Uu(e,e.return,t)}}function Hc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[at]=t}catch(t){Uu(e,e.return,t)}}function Uc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Wc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Uc(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&&Zd(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 Gc(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=Zt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function Kc(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&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Kc(e,t,n),e=e.sibling;e!==null;)Kc(e,t,n),e=e.sibling}function qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[it]=e,t[at]=n}catch(t){Uu(e,e.return,t)}}var Jc=!1,Yc=!1,Xc=!1,Zc=typeof WeakSet==`function`?WeakSet:Set,Qc=null;function $c(e,t){if(e=e.containerInfo,Rd=sp,e=gr(e),_r(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(zd={focusedElem:e,selectionRange:n},sp=!1,Qc=t;Qc!==null;)if(t=Qc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Qc=e;else for(;Qc!==null;){switch(t=Qc,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=zs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Uu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(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,Qc=e;break}Qc=t.return}}function el(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:hl(e,n),r&4&&Fc(5,n);break;case 1:if(hl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Uu(n,n.return,e)}else{var i=zs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Uu(n,n.return,e)}}r&64&&Lc(n),r&512&&zc(n,n.return);break;case 3:if(hl(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{Va(e,t)}catch(e){Uu(n,n.return,e)}}break;case 27:t===null&&r&4&&qc(n);case 26:case 5:hl(e,n),t===null&&r&4&&Vc(n),r&512&&zc(n,n.return);break;case 12:hl(e,n);break;case 31:hl(e,n),r&4&&ol(e,n);break;case 13:hl(e,n),r&4&&sl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qu.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Jc,!r){t=t!==null&&t.memoizedState!==null||Yc,i=Jc;var a=Yc;Jc=r,(Yc=t)&&!a?_l(e,n,(n.subtreeFlags&8772)!=0):hl(e,n),Jc=i,Yc=a}break;case 30:break;default:hl(e,n)}}function tl(e){var t=e.alternate;t!==null&&(e.alternate=null,tl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ft(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 nl=null,rl=!1;function il(e,t,n){for(n=n.child;n!==null;)al(e,t,n),n=n.sibling}function al(e,t,n){if(Ne&&typeof Ne.onCommitFiberUnmount==`function`)try{Ne.onCommitFiberUnmount(Me,n)}catch{}switch(n.tag){case 26:Yc||Bc(n,t),il(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Yc||Bc(n,t);var r=nl,i=rl;Zd(n.type)&&(nl=n.stateNode,rl=!1),il(e,t,n),pf(n.stateNode),nl=r,rl=i;break;case 5:Yc||Bc(n,t);case 6:if(r=nl,i=rl,nl=null,il(e,t,n),nl=r,rl=i,nl!==null)if(rl)try{(nl.nodeType===9?nl.body:nl.nodeName===`HTML`?nl.ownerDocument.body:nl).removeChild(n.stateNode)}catch(e){Uu(n,t,e)}else try{nl.removeChild(n.stateNode)}catch(e){Uu(n,t,e)}break;case 18:nl!==null&&(rl?(e=nl,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(nl,n.stateNode));break;case 4:r=nl,i=rl,nl=n.stateNode.containerInfo,rl=!0,il(e,t,n),nl=r,rl=i;break;case 0:case 11:case 14:case 15:Ic(2,n,t),Yc||Ic(4,n,t),il(e,t,n);break;case 1:Yc||(Bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Rc(n,t,r)),il(e,t,n);break;case 21:il(e,t,n);break;case 22:Yc=(r=Yc)||n.memoizedState!==null,il(e,t,n),Yc=r;break;default:il(e,t,n)}}function ol(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Uu(t,t.return,e)}}}function sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Uu(t,t.return,e)}}function cl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zc),t;default:throw Error(i(435,e.tag))}}function ll(e,t){var n=cl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ju.bind(null,e,t);t.then(r,r)}})}function ul(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(Zd(c.type)){nl=c.stateNode,rl=!1;break a}break;case 5:nl=c.stateNode,rl=!1;break a;case 3:case 4:nl=c.stateNode.containerInfo,rl=!0;break a}c=c.return}if(nl===null)throw Error(i(160));al(o,s,a),nl=null,rl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)fl(t,e),t=t.sibling}var dl=null;function fl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ul(t,e),pl(e),r&4&&(Ic(3,e,e.return),Fc(3,e),Ic(5,e,e.return));break;case 1:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&64&&Jc&&(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=dl;if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(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[dt]||o[it]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Pd(o,r,n),o[it]=e,_t(o),r=o;break a;case`link`:var s=Vf(`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),Pd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Vf(`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),Pd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[it]=e,_t(o),r=o}e.stateNode=r}else Hf(a,e.type,e.stateNode);else e.stateNode=If(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Hc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(a,e.type,e.stateNode):If(a,r,e.memoizedProps))}break;case 27:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),n!==null&&r&4&&Hc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),e.flags&32){a=e.stateNode;try{Ut(a,``)}catch(t){Uu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Hc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Xc=!0);break;case 6:if(ul(t,e),pl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Uu(e,e.return,t)}}break;case 3:if(Bf=null,a=dl,dl=gf(t.containerInfo),ul(t,e),dl=a,pl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Uu(e,e.return,t)}Xc&&(Xc=!1,ml(e));break;case 4:r=dl,dl=gf(e.stateNode.containerInfo),ul(t,e),pl(e),dl=r;break;case 12:ul(t,e),pl(e);break;case 31:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 13:ul(t,e),pl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Zl=Te()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Jc,d=Yc;if(Jc=u||a,Yc=d||l,ul(t,e),Yc=d,Jc=u,pl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Jc||Yc||gl(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){Uu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Uu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?$d(m,!0):$d(l.stateNode,!1)}catch(e){Uu(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,ll(e,n))));break;case 19:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 30:break;case 21:break;default:ul(t,e),pl(e)}}function pl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Uc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Kc(e,Wc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Ut(o,``),n.flags&=-33),Kc(e,Wc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Gc(e,Wc(e),s);break;default:throw Error(i(161))}}catch(t){Uu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ml(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ml(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function hl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)el(e,t.alternate,t),t=t.sibling}function gl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ic(4,t,t.return),gl(t);break;case 1:Bc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Rc(t,t.return,n),gl(t);break;case 27:pf(t.stateNode);case 26:case 5:Bc(t,t.return),gl(t);break;case 22:t.memoizedState===null&&gl(t);break;case 30:gl(t);break;default:gl(t)}e=e.sibling}}function _l(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:_l(i,a,n),Fc(4,a);break;case 1:if(_l(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Uu(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++)Ba(c[i],s)}catch(e){Uu(r,r.return,e)}}n&&o&64&&Lc(a),zc(a,a.return);break;case 27:qc(a);case 26:case 5:_l(i,a,n),n&&r===null&&o&4&&Vc(a),zc(a,a.return);break;case 12:_l(i,a,n);break;case 31:_l(i,a,n),n&&o&4&&ol(i,a);break;case 13:_l(i,a,n),n&&o&4&&sl(i,a);break;case 22:a.memoizedState===null&&_l(i,a,n),zc(a,a.return);break;case 30:break;default:_l(i,a,n)}t=t.sibling}}function vl(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&&$i(n))}function yl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&$i(e))}function bl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xl(e,t,n,r),t=t.sibling}function xl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:bl(e,t,n,r),i&2048&&Fc(9,t);break;case 1:bl(e,t,n,r);break;case 3:bl(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&&$i(e)));break;case 12:if(i&2048){bl(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){Uu(t,t.return,e)}}else bl(e,t,n,r);break;case 31:bl(e,t,n,r);break;case 13:bl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?bl(e,t,n,r):(a._visibility|=2,Sl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?bl(e,t,n,r):Cl(e,t),i&2048&&vl(o,t);break;case 24:bl(e,t,n,r),i&2048&&yl(t.alternate,t);break;default:bl(e,t,n,r)}}function Sl(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:Sl(a,o,s,c,i),Fc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Sl(a,o,s,c,i)):u._visibility&2?Sl(a,o,s,c,i):Cl(a,o),i&&l&2048&&vl(o.alternate,o);break;case 24:Sl(a,o,s,c,i),i&&l&2048&&yl(o.alternate,o);break;default:Sl(a,o,s,c,i)}t=t.sibling}}function Cl(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:Cl(n,r),i&2048&&vl(r.alternate,r);break;case 24:Cl(n,r),i&2048&&yl(r.alternate,r);break;default:Cl(n,r)}t=t.sibling}}var wl=8192;function Tl(e,t,n){if(e.subtreeFlags&wl)for(e=e.child;e!==null;)El(e,t,n),e=e.sibling}function El(e,t,n){switch(e.tag){case 26:Tl(e,t,n),e.flags&wl&&e.memoizedState!==null&&Gf(n,dl,e.memoizedState,e.memoizedProps);break;case 5:Tl(e,t,n);break;case 3:case 4:var r=dl;dl=gf(e.stateNode.containerInfo),Tl(e,t,n),dl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=wl,wl=16777216,Tl(e,t,n),wl=r):Tl(e,t,n));break;default:Tl(e,t,n)}}function Dl(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 Ol(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)kl(e),e=e.sibling}function kl(e){switch(e.tag){case 0:case 11:case 15:Ol(e),e.flags&2048&&Ic(9,e,e.return);break;case 3:Ol(e);break;case 12:Ol(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Al(e)):Ol(e);break;default:Ol(e)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ic(8,t,t.return),Al(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Al(t));break;default:Al(t)}e=e.sibling}}function jl(e,t){for(;Qc!==null;){var n=Qc;switch(n.tag){case 0:case 11:case 15:Ic(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:$i(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Qc=r;else a:for(n=e;Qc!==null;){r=Qc;var i=r.sibling,a=r.return;if(tl(r),r===n){Qc=null;break a}if(i!==null){i.return=a,Qc=i;break a}Qc=a}}}var Ml={getCacheForType:function(e){var t=Gi(Zi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Gi(Zi).controller.signal}},Nl=typeof WeakMap==`function`?WeakMap:Map,Pl=0,Fl=null,Z=null,Q=0,Il=0,Ll=null,Rl=!1,zl=!1,Bl=!1,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=null,Yl=null,Xl=!1,Zl=0,Ql=0,$l=1/0,eu=null,tu=null,nu=0,ru=null,iu=null,au=0,ou=0,su=null,cu=null,lu=0,uu=null;function du(){return Pl&2&&Q!==0?Q&-Q:j.T===null?tt():ud()}function fu(){if(Kl===0)if(!(Q&536870912)||wi){var e=Be;Be<<=1,!(Be&3932160)&&(Be=262144),Kl=e}else Kl=536870912;return e=qa.current,e!==null&&(e.flags|=32),Kl}function pu(e,t,n){(e===Fl&&(Il===2||Il===9)||e.cancelPendingCommit!==null)&&(bu(e,0),_u(e,Q,Kl,!1)),Je(e,n),(!(Pl&2)||e!==Fl)&&(e===Fl&&(!(Pl&2)&&(Wl|=n),Hl===4&&_u(e,Q,Kl,!1)),nd(e))}function mu(e,t,n){if(Pl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||We(e,t),a=r?Ou(e,t):Eu(e,t,!0),o=r;do{if(a===0){zl&&!r&&_u(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!gu(n)){a=Eu(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=Jl;var l=c.current.memoizedState.isDehydrated;if(l&&(bu(c,s).flags|=256),s=Eu(c,s,!1),s!==2){if(Bl&&!l){c.errorRecoveryDisabledLanes|=o,Wl|=o,a=4;break a}o=Yl,Yl=a,o!==null&&(Yl===null?Yl=o:Yl.push.apply(Yl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){bu(e,0),_u(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:_u(r,t,Kl,!Rl);break a;case 2:Yl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Zl+300-Te(),10<a)){if(_u(r,t,Kl,!Rl),Ue(r,0,!0)!==0)break a;au=t,r.timeoutHandle=Kd(hu.bind(null,r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,o,`Throttled`,-0,0),a);break a}hu(r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,o,null,-0,0)}}break}while(1);nd(e)}function hu(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:Zt},El(t,a,d);var m=(a&62914560)===a?Zl-Te():(a&4194048)===a?Ql-Te():0;if(m=qf(d,m),m!==null){au=a,e.cancelPendingCommit=m(Fu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),_u(e,a,o,!l);return}}Fu(e,t,a,n,r,i,o,s,c)}function gu(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(!dr(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 _u(e,t,n,r){t&=~Gl,t&=~Wl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Fe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Xe(e,n,t)}function vu(){return Pl&6?!0:(rd(0,!1),!1)}function yu(){if(Z!==null){if(Il===0)var e=Z.return;else e=Z,Li=Ii=null,xo(e),Sa=null,Ca=0,e=Z;for(;e!==null;)Pc(e.alternate,e),e=e.return;Z=null}}function bu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),au=0,yu(),Fl=e,Z=n=$r(e.current,null),Q=t,Il=0,Ll=null,Rl=!1,zl=We(e,t),Bl=!1,ql=Kl=Gl=Wl=Ul=Hl=0,Yl=Jl=null,Xl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Fe(r),a=1<<i;t|=e[i],r&=~a}return Vl=t,Ur(),n}function xu(e,t){X=null,j.H=js,t===fa||t===ma?(t=ba(),Il=3):t===pa?(t=ba(),Il=4):Il=t===Ys?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ll=t,Z===null&&(Hl=1,Us(e,si(t,e.current)))}function Su(){var e=qa.current;return e===null?!0:(Q&4194048)===Q?Ja===null:(Q&62914560)===Q||Q&536870912?e===Ja:!1}function Cu(){var e=j.H;return j.H=js,e===null?js:e}function wu(){var e=j.A;return j.A=Ml,e}function Tu(){Hl=4,Rl||(Q&4194048)!==Q&&qa.current!==null||(zl=!0),!(Ul&134217727)&&!(Wl&134217727)||Fl===null||_u(Fl,Q,Kl,!1)}function Eu(e,t,n){var r=Pl;Pl|=2;var i=Cu(),a=wu();(Fl!==e||Q!==t)&&(eu=null,bu(e,t)),t=!1;var o=Hl;a:do try{if(Il!==0&&Z!==null){var s=Z,c=Ll;switch(Il){case 8:yu(),o=6;break a;case 3:case 2:case 9:case 6:qa.current===null&&(t=!0);var l=Il;if(Il=0,Ll=null,Mu(e,s,c,l),n&&zl){o=0;break a}break;default:l=Il,Il=0,Ll=null,Mu(e,s,c,l)}}Du(),o=Hl;break}catch(t){xu(e,t)}while(1);return t&&e.shellSuspendCounter++,Li=Ii=null,Pl=r,j.H=i,j.A=a,Z===null&&(Fl=null,Q=0,Ur()),o}function Du(){for(;Z!==null;)Au(Z)}function Ou(e,t){var n=Pl;Pl|=2;var r=Cu(),a=wu();Fl!==e||Q!==t?(eu=null,$l=Te()+500,bu(e,t)):zl=We(e,t);a:do try{if(Il!==0&&Z!==null){t=Z;var o=Ll;b:switch(Il){case 1:Il=0,Ll=null,Mu(e,t,o,1);break;case 2:case 9:if(ga(o)){Il=0,Ll=null,ju(t);break}t=function(){Il!==2&&Il!==9||Fl!==e||(Il=7),nd(e)},o.then(t,t);break a;case 3:Il=7;break a;case 4:Il=5;break a;case 7:ga(o)?(Il=0,Ll=null,ju(t)):(Il=0,Ll=null,Mu(e,t,o,7));break;case 5:var s=null;switch(Z.tag){case 26:s=Z.memoizedState;case 5:case 27:var c=Z;if(s?Wf(s):c.stateNode.complete){Il=0,Ll=null;var l=c.sibling;if(l!==null)Z=l;else{var u=c.return;u===null?Z=null:(Z=u,Nu(u))}break b}}Il=0,Ll=null,Mu(e,t,o,5);break;case 6:Il=0,Ll=null,Mu(e,t,o,6);break;case 8:yu(),Hl=6;break a;default:throw Error(i(462))}}ku();break}catch(t){xu(e,t)}while(1);return Li=Ii=null,j.H=r,j.A=a,Pl=n,Z===null?(Fl=null,Q=0,Ur(),Hl):0}function ku(){for(;Z!==null&&!Ce();)Au(Z)}function Au(e){var t=Tc(e.alternate,e,Vl);e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=lc(n,t,t.pendingProps,t.type,void 0,Q);break;case 11:t=lc(n,t,t.pendingProps,t.type.render,t.ref,Q);break;case 5:xo(t);default:Pc(n,t),t=Z=ei(t,Vl),t=Tc(n,t,Vl)}e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function Mu(e,t,n,r){Li=Ii=null,xo(t),Sa=null,Ca=0;var i=t.return;try{if(Js(e,i,t,n,Q)){Hl=1,Us(e,si(n,e.current)),Z=null;return}}catch(t){if(i!==null)throw Z=i,t;Hl=1,Us(e,si(n,e.current)),Z=null;return}t.flags&32768?(wi||r===1?e=!0:zl||Q&536870912?e=!1:(Rl=e=!0,(r===2||r===9||r===3||r===6)&&(r=qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Pu(t,e)):Nu(t)}function Nu(e){var t=e;do{if(t.flags&32768){Pu(t,Rl);return}e=t.return;var n=Mc(t.alternate,t,Vl);if(n!==null){Z=n;return}if(t=t.sibling,t!==null){Z=t;return}Z=t=e}while(t!==null);Hl===0&&(Hl=5)}function Pu(e,t){do{var n=Nc(e.alternate,e);if(n!==null){n.flags&=32767,Z=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Z=e;return}Z=e=n}while(e!==null);Hl=6,Z=null}function Fu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Bu();while(nu!==0);if(Pl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Hr,Ye(e,n,o,s,c,l),e===Fl&&(Z=Fl=null,Q=0),iu=t,ru=e,au=n,ou=o,su=a,cu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yu(ke,function(){return Vu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=j.T,j.T=null,a=M.p,M.p=2,s=Pl,Pl|=4;try{$c(e,t,n)}finally{Pl=s,M.p=a,j.T=r}}nu=1,Iu(),Lu(),Ru()}}function Iu(){if(nu===1){nu=0;var e=ru,t=iu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=j.T,j.T=null;var r=M.p;M.p=2;var i=Pl;Pl|=4;try{fl(t,e);var a=zd,o=gr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&hr(s.ownerDocument.documentElement,s)){if(c!==null&&_r(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 _=mr(s,h),v=mr(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}}sp=!!Rd,zd=Rd=null}finally{Pl=i,M.p=r,j.T=n}}e.current=t,nu=2}}function Lu(){if(nu===2){nu=0;var e=ru,t=iu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=j.T,j.T=null;var r=M.p;M.p=2;var i=Pl;Pl|=4;try{el(e,t.alternate,t)}finally{Pl=i,M.p=r,j.T=n}}nu=3}}function Ru(){if(nu===4||nu===3){nu=0,we();var e=ru,t=iu,n=au,r=cu;t.subtreeFlags&10256||t.flags&10256?nu=5:(nu=0,iu=ru=null,zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(tu=null),et(n),t=t.stateNode,Ne&&typeof Ne.onCommitFiberRoot==`function`)try{Ne.onCommitFiberRoot(Me,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=j.T,i=M.p,M.p=2,j.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{j.T=t,M.p=i}}au&3&&Bu(),nd(e),i=e.pendingLanes,n&261930&&i&42?e===uu?lu++:(lu=0,uu=e):lu=0,rd(0,!1)}}function zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,$i(t)))}function Bu(){return Iu(),Lu(),Ru(),Vu()}function Vu(){if(nu!==5)return!1;var e=ru,t=ou;ou=0;var n=et(au),r=j.T,a=M.p;try{M.p=32>n?32:n,j.T=null,n=su,su=null;var o=ru,s=au;if(nu=0,iu=ru=null,au=0,Pl&6)throw Error(i(331));var c=Pl;if(Pl|=4,kl(o.current),xl(o,o.current,s,n),Pl=c,rd(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot==`function`)try{Ne.onPostCommitFiberRoot(Me,o)}catch{}return!0}finally{M.p=a,j.T=r,zu(e,t)}}function Hu(e,t,n){t=si(n,t),t=Gs(e.stateNode,t,2),e=Pa(e,t,2),e!==null&&(Je(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=si(n,e),n=Ks(2),r=Pa(t,n,2),r!==null&&(qs(n,r,t,e),Je(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Nl;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)||(Bl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Fl===e&&(Q&n)===n&&(Hl===4||Hl===3&&(Q&62914560)===Q&&300>Te()-Zl?!(Pl&2)&&bu(e,0):Gl|=n,ql===Q&&(ql=0)),nd(e)}function Ku(e,t){t===0&&(t=Ke()),e=Kr(e,t),e!==null&&(Je(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(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),Ku(e,n)}function Yu(e,t){return xe(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;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-Fe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Q,a=Ue(r,r===Fl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||We(r,a)||(n=!0,cd(r,a));r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=Te(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}nu!==0&&nu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Fe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ge(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Fl,n=Q,n=Ue(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Il===2||Il===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Se(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||We(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Se(r),et(n)){case 2:case 8:n=Oe;break;case 32:n=ke;break;case 268435456:n=Ae;break;default:n=ke}return r=sd.bind(null,e),n=xe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Se(r),e.callbackPriority=2,e.callbackNode=null,2}function sd(e,t){if(nu!==0&&nu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Bu()&&e.callbackNode!==n)return null;var r=Q;return r=Ue(e,e===Fl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(mu(e,r,t),od(e,Te()),e.callbackNode!=null&&e.callbackNode===n?sd.bind(null,e):null)}function cd(e,t){if(Bu())return null;mu(e,t,!0)}function ld(){Yd(function(){Pl&6?xe(De,id):ad()})}function ud(){if(td===0){var e=na;e===0&&(e=ze,ze<<=1,!(ze&261888)&&(ze=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Xt(``+e)}function fd(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 pd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=dd((i[at]||null).action),o=r.submitter;o&&(t=(t=o[at]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new yn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(td!==0){var e=o?fd(i,o):new FormData(i);_s(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?fd(i,o):new FormData(i),_s(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var md=0;md<Lr.length;md++){var hd=Lr[md];Rr(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Rr(kr,`onAnimationEnd`),Rr(Ar,`onAnimationIteration`),Rr(jr,`onAnimationStart`),Rr(`dblclick`,`onDoubleClick`),Rr(`focusin`,`onFocus`),Rr(`focusout`,`onBlur`),Rr(Mr,`onTransitionRun`),Rr(Nr,`onTransitionStart`),Rr(Pr,`onTransitionCancel`),Rr(Fr,`onTransitionEnd`),xt(`onMouseEnter`,[`mouseout`,`mouseover`]),xt(`onMouseLeave`,[`mouseout`,`mouseover`]),xt(`onPointerEnter`,[`pointerout`,`pointerover`]),xt(`onPointerLeave`,[`pointerout`,`pointerover`]),bt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),bt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),bt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),bt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var gd=`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(` `),_d=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(gd));function vd(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){zr(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){zr(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[st];n===void 0&&(n=t[st]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,vt.forEach(function(t){t!==`selectionchange`&&(_d.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!cn||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 Cd(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=pt(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}an(function(){var r=a,i=$t(n),s=[];a:{var c=Ir.get(e);if(c!==void 0){var l=yn,u=e;switch(e){case`keypress`:if(mn(n)===0)break a;case`keydown`:case`keyup`:l=Fn;break;case`focusin`:u=`focus`,l=Dn;break;case`focusout`:u=`blur`,l=Dn;break;case`beforeblur`:case`afterblur`:l=Dn;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=Tn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=En;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Ln;break;case kr:case Ar:case jr:l=On;break;case Fr:l=U;break;case`scroll`:case`scrollend`:l=V;break;case`wheel`:l=Rn;break;case`copy`:case`cut`:case`paste`:l=kn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=In;break;case`toggle`:case`beforetoggle`:l=zn}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=on(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Qt&&(u=n.relatedTarget||n.fromElement)&&(pt(u)||u[ot]))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?pt(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=Tn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=In,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ht(l),h=u==null?c:ht(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,pt(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=Ed,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&&Dd(s,c,l,d,!1),u!==null&&f!==null&&Dd(s,f,u,d,!0)}}a:{if(c=r?ht(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ir;else if($n(c))if(ar)v=ur;else{v=cr;var y=sr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&qt(r.elementType)&&(v=ir):v=lr;if(v&&=v(e,r)){er(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&zt(c,`number`,c.value)}switch(y=r?ht(r):window,e){case`focusin`:($n(y)||y.contentEditable===`true`)&&(yr=y,br=r,xr=null);break;case`focusout`:xr=br=yr=null;break;case`mousedown`:Sr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Sr=!1,Cr(s,n,i);break;case`selectionchange`:if(vr)break;case`keydown`:case`keyup`:Cr(s,n,i)}var b;if(Vn)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 Yn?qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Wn&&n.locale!==`ko`&&(Yn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Yn&&(b=pn()):(un=i,dn=`value`in un?un.value:un.textContent,Yn=!0)),y=Td(r,x),0<y.length&&(x=new An(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Jn(n),b!==null&&(x.data=b)))),(b=Un?Xn(e,n):Zn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new An(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),pd(s,e,r,n,i)}vd(s,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(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=on(e,n),i!=null&&r.unshift(wd(e,i,a)),i=on(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(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=on(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=on(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
9
- `).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ut(e,``+r);break;case`className`:Dt(e,`class`,r);break;case`tabIndex`:Dt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Dt(e,n,r);break;case`style`:Kt(e,r,o);break;case`data`:if(t!==`object`){Dt(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=Xt(``+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`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Xt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Zt);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`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=Xt(``+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`:$(`beforetoggle`,e),$(`toggle`,e),Et(e,`popover`,r);break;case`xlinkActuate`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Et(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=Jt.get(n)||n,Et(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:Kt(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`?Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ut(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Zt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!yt.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[at]||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,``):Et(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`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:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`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:Md(e,t,r,d,n,null)}}Rt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`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:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Bt(e,!!r,n,!0):Bt(e,!!r,t,!1);return;case`textarea`:for(s in $(`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:Md(e,t,s,c,n,null)}Ht(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:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`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:Md(e,t,u,r,n,null)}return;default:if(qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(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)||Md(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&&Md(e,t,p,m,r,f)}}Lt(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)||Md(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&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Bt(e,!!n,n?[]:``,!1):Bt(e,!!n,t,!0)):Bt(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:Md(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&&Md(e,t,s,a,r,o)}Vt(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:Md(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:Md(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)&&Md(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:Md(e,t,u,p,r,m)}return;default:if(qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(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||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(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||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){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&&Id(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&&Id(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 Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(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 Hd(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 Ud(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 Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(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),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[dt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(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 ef(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`:ef(n),ft(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(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[dt])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=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(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 cf(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 lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(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 ff(e,t,n){switch(t=Bd(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 pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ft(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=M.d;M.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=vu();return e||t}function yf(e){var t=mt(e);t!==null&&t.tag===5&&t.type===`form`?ys(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=It(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+It(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+It(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+It(n.imageSizes)+`"]`)):i+=`[href="`+It(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+It(r)+`"][href="`+It(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),_t(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=gt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);_t(c),Pd(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,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=gt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),_t(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=gt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),_t(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=le.current)?gf(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=Af(n.href),n=gt(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=Af(n.href);var o=gt(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(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.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},mf.set(e,n),o||Nf(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=Pf(n),n=gt(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 Af(e){return`href="`+It(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(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}),Pd(t,`link`,n),_t(t),e.head.appendChild(t))}function Pf(e){return`[src="`+It(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+It(n.href)+`"]`);if(r)return t.instance=r,_t(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),_t(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,_t(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),_t(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,_t(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),_t(a),Pd(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,Lf(r,n.precedence,e));return t.instance}function Lf(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 Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,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[dt]||a[it]||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 Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(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 Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(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=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,_t(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),_t(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(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=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.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=Jf.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 Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function $f(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=qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qe(0),this.hiddenUpdates=qe(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 ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Zr(3,null,null,t),e.current=a,a.stateNode=e,t=Qi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ja(a),e}function tp(e){return e?(e=Yr,e):Yr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Na(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Pa(e,r,t),n!==null&&(pu(n,e,t),Fa(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Kr(e,67108864);t!==null&&pu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=du();t=$e(t);var n=Kr(e,t);n!==null&&pu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=2,up(e,t,n,r)}finally{M.p=a,j.T=i}}function lp(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=8,up(e,t,n,r)}finally{M.p=a,j.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=He(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Fe(o);s.entanglements[1]|=c,o&=~c}nd(a),!(Pl&6)&&($l=Te()+500,rd(0,!1))}}break;case 31:case 13:s=Kr(a,2),s!==null&&pu(s,a,2),vu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=$t(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=pt(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 fp=e,null}function mp(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(Ee()){case De:return 2;case Oe:return 8;case ke:case z:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`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 Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(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=mt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=pt(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,nt(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,nt(e.priority,function(){op(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 Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Qt=r,n.target.dispatchEvent(r),Qt=null}else return t=mt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=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(pp(r||n)===null)continue;break}var a=mt(n);a!==null&&(e.splice(t,3),t-=3,_s(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.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[at]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[at]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){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 Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,du(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),vu(),t[ot]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=tt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.4`)throw Error(i(527,Lp,`19.2.4`));M.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:j,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Me=zp.inject(Rp),Ne=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Bs,s=Vs,c=Hs;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=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[ot]=t.current,xd(e),new Fp(t)}})),g=c(o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()}))(),1),_=c(u(),1),v=500,y=200,b=3e3,x=1e3,S=3e4,C=Object.freeze({counters:Object.freeze({}),latestBurst:null,burstRing:Object.freeze([]),burstSeq:0,lifecycleRing:Object.freeze([]),connectionSeq:0,connected:!1,reconnectAttempts:0,lastErrorAt:null,reconnectDelayMs:x}),w=new Set,T={},E=[],D=[],O=[],ee=!1,te=!1,k=null,A=null,ne=null,re=!1,ie=typeof localStorage<`u`&&localStorage.getItem(`DEBUG_SSE`)===`1`;function j(e,t){ie&&(t?console.debug(`[ssg-sse] ${e}`,t):console.debug(`[ssg-sse] ${e}`))}function M(){re||(re=!0,queueMicrotask(ae))}function ae(){re=!1;let e=Object.keys(T),t=E,n=D,r=O,i=ee,a=k!==null||A!==null||ne!==null;if(e.length===0&&t.length===0&&n.length===0&&r.length===0&&!i&&!a)return;let o=C.counters;if(e.length>0){let t={...C.counters};for(let n of e)t[n]=(t[n]??0)+(T[n]??0);o=Object.freeze(t),T={}}let s=C.burstRing,c=C.latestBurst,l=C.burstSeq;if(t.length>0){let e=C.burstRing.length+t.length>v?[...C.burstRing,...t].slice(-v):[...C.burstRing,...t];s=Object.freeze(e),c=t[t.length-1]??c,l=C.burstSeq+t.length,E=[]}if(n.length>0){let e=new Map;for(let t of n)e.set(t.tool_use_id,t);let t=!1,r=s.map(n=>{if(!n.tool_use_id)return n;let r=e.get(n.tool_use_id);if(!r)return n;t=!0;let i=n.output_tokens??0,a=n.complete_ts_ms??0,o=Math.max(i,r.output_tokens),s=Math.max(a,r.ts_ms),c=Math.max(n.complete_duration_ms??0,r.duration_ms??0);return{...n,output_tokens:o,complete_ts_ms:s,...c>0?{complete_duration_ms:c}:{}}});t&&(s=Object.freeze(r),l=C.burstSeq+1),D=[]}let u=C.lifecycleRing;if(r.length>0){let e=C.lifecycleRing.length+r.length>y?[...C.lifecycleRing,...r].slice(-y):[...C.lifecycleRing,...r];u=Object.freeze(e),O=[]}let d=C.connected,f=C.connectionSeq;i&&(d=te,f=C.connectionSeq+1,ee=!1);let p=C.reconnectAttempts,m=C.lastErrorAt,h=C.reconnectDelayMs;k!==null&&(p=k,k=null),A!==null&&(m=A,A=null),ne!==null&&(h=ne,ne=null),C=Object.freeze({counters:o,latestBurst:c,burstRing:s,burstSeq:l,lifecycleRing:u,connectionSeq:f,connected:d,reconnectAttempts:p,lastErrorAt:m,reconnectDelayMs:h});for(let e of w)e()}var oe=null,se=0,N=new Set,P=new Map,F=null,ce=x,I=null;function le(e,t){if(e===`eval-burst`){try{let e=JSON.parse(t.data);Array.isArray(e?.bursts)&&(E.push(...e.bursts),M())}catch{}return}if(e===`eval-burst-complete`){try{let e=JSON.parse(t.data);if(e&&typeof e.tool_use_id==`string`&&e.tool_use_id.length>0&&typeof e.output_tokens==`number`&&Number.isFinite(e.output_tokens)&&typeof e.ts_ms==`number`&&Number.isFinite(e.ts_ms)){let t={ts_ms:e.ts_ms,tool_use_id:e.tool_use_id,output_tokens:Math.max(0,e.output_tokens),...typeof e.duration_ms==`number`&&Number.isFinite(e.duration_ms)?{duration_ms:e.duration_ms}:{}};D.push(t),M()}}catch{}return}if(e===`session-lifecycle`){try{let e=JSON.parse(t.data);Array.isArray(e?.events)&&e.events.length>0&&(O.push(...e.events),M())}catch{}return}T[e]=(T[e]??0)+1,M()}function ue(e){if(!oe||P.has(e))return;let t=t=>le(e,t);oe.addEventListener(e,t),P.set(e,t)}var de=0,fe=0,pe=2e3;function me(){if(oe)return;j(`opening EventSource`,{url:`/api/events`}),fe=Date.now();let e=new EventSource(`/api/events`);oe=e,P.clear();for(let e of N)ue(e);e.onopen=()=>{let e=C.lastErrorAt!==null;ce=x,de=0,k=0,ne=x,ee=!0,te=!0,M(),e&&Ce(`reconnect`),j(`connected`)},e.onerror=()=>{e.close(),oe=null,P.clear(),ee=!0,te=!1,A=Date.now(),M(),de===0&&Date.now()-fe<pe?j(`first-open interrupted (page-load race) — reconnect in ${ce}ms`):console.warn(`[ssg-sse] EventSource error — reconnect in ${ce}ms (attempt ${de+1})`),se>0&&(F=setTimeout(()=>{F=null,se>0&&me()},ce),de++,k=de,ce=Math.min(ce*2,S),ne=ce,M())}}function he(){F&&=(clearTimeout(F),null),oe?.close(),oe=null,P.clear(),ce=x,de=0,k=0,ne=x,ee=!0,te=!1,M()}typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&se!==0&&(oe||(F&&=(clearTimeout(F),null),j(`visibilitychange → reconnecting`),me()))});function L(){for(let e of N)e!==`eval-burst`&&(T[e]=(T[e]??0)+1);M()}function ge(e){return w.add(e),()=>{w.delete(e)}}function _e(){return C}var ve=2e3,ye=1e4,be=1440*60*1e3,R=500,xe=0,Se=null;function Ce(e){let t=Date.now();if(t-xe<ye){j(`hydrate skipped (cooldown)`,{reason:e});return}if(Se)return;let n=t-be,r=C.burstRing[C.burstRing.length-1],i=C.burstRing.length>0&&r!==void 0?r.ts_ms+1:n,a=e===`reconnect`?Math.max(i,n):n,o=t;if(a>=o)return;xe=t;let s=new AbortController;Se=s,j(`hydrate start`,{reason:e,since:a,until:o,ringLen:C.burstRing.length}),(async()=>{let t=a,n=0;try{for(;n<ve&&t<o&&!s.signal.aborted;){let r=Math.min(R,ve-n),i=await fetch(`/api/json/graph/backfill?since_ms=${t}&until_ms=${o}&limit=${r}`,{signal:s.signal,credentials:`same-origin`});if(!i.ok)break;let a=await i.json();if(!Array.isArray(a.bursts)||a.bursts.length===0||(E.push(...a.bursts),M(),n+=a.bursts.length,j(`hydrate page`,{reason:e,page:n,count:a.bursts.length}),a.bursts.length<r))break;let c=a.bursts[a.bursts.length-1];if(c===void 0)break;t=c.ts_ms+1}j(`hydrate done`,{reason:e,fetched:n})}catch(t){t.name!==`AbortError`&&console.warn(`[ssg-sse] ring hydration failed (${e})`,t)}finally{Se=null}})()}function we(e){for(let t of e)N.add(t),ue(t);return se++,se===1&&(Ce(`initial`),me(),I=setInterval(L,b)),()=>{se--,se===0&&(he(),I&&=(clearInterval(I),null))}}var Te=Object.freeze([`eval-burst`,`eval-burst-complete`,`counters-updated`]);function Ee(){(0,_.useEffect)(()=>we(Te),[])}function De(){return Ee(),(0,_.useSyncExternalStore)(ge,_e).latestBurst}function Oe(){return Ee(),(0,_.useSyncExternalStore)(ge,_e).burstRing}function ke(){return Ee(),(0,_.useSyncExternalStore)(ge,_e).burstSeq}function z(){let e=document.querySelector(`meta[name="ssg-csrf"]`)?.content??``;return e?{"X-SigmaShake-Token":e}:{}}function Ae(e){let t=(0,_.useSyncExternalStore)(ge,_e),n=e.join(`,`);(0,_.useEffect)(()=>we(e),[n]);let r=(0,_.useRef)({});return(0,_.useMemo)(()=>{let n={},i=!1;for(let a of e){let e=t.counters[a]??0;n[a]=e,r.current[a]!==e&&(i=!0)}return!i&&Object.keys(r.current).length===e.length?r.current:(r.current=n,n)},[t,n])}function B(e,t=[]){let[n,r]=(0,_.useState)({data:null,loading:!0,error:null}),[i,a]=(0,_.useState)(0),o=(0,_.useRef)(null),s=(0,_.useCallback)(()=>{a(e=>e+1)},[]);return(0,_.useEffect)(()=>{let t=new AbortController;return o.current=t,r(e=>({...e,loading:!0,error:null})),fetch(e,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t.signal.aborted||r({data:e,loading:!1,error:null})}).catch(e=>{if(t.signal.aborted)return;let n=e instanceof Error?e.message:String(e);r(e=>({...e,loading:!1,error:n}))}),()=>{t.abort()}},[e,i,...t]),{...n,refetch:s}}var je=e=>e,Me=e=>({in:t=>t**+e,out:t=>1-(1-t)**e,inOut:t=>t<.5?(2*t)**e/2:1-(-2*t+2)**e/2}),Ne=Me(2),Pe=Me(3),Fe=Me(4),Ie=Me(5),Le={in:e=>1-Math.cos(e*Math.PI/2),out:e=>Math.sin(e*Math.PI/2),inOut:e=>-(Math.cos(Math.PI*e)-1)/2},Re={in:e=>e===0?0:2**(10*e-10),out:e=>e===1?1:1-2**(-10*e),inOut:e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2},ze={in:e=>1-Math.sqrt(1-e**2),out:e=>Math.sqrt(1-(e-1)**2),inOut:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2};function Be(e=1.70158){let t=e;return e=>e*e*((t+1)*e-t)}function Ve(e=1.70158){let t=e;return e=>{let n=e-1;return n*n*((t+1)*n+t)+1}}function He(e=1.70158){let t=e*1.525;return e=>e<.5?(2*e)**2*((t+1)*2*e-t)/2:((2*e-2)**2*((t+1)*(e*2-2)+t)+2)/2}function Ue(e=1,t=.3){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>e===0?0:e===1?1:n*2**(-10*e)*Math.sin((e-i)*(Math.PI*2)/r)+1}function We(e=1,t=.3){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>e===0?0:e===1?1:-(n*2**(10*(e-1))*Math.sin((e-1-i)*(Math.PI*2)/r))}function Ge(e=1,t=.45){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>{if(e===0)return 0;if(e===1)return 1;let t=e*2;return t<1?-.5*(n*2**(10*(t-1))*Math.sin((t-1-i)*(Math.PI*2)/r)):n*2**(-10*(t-1))*Math.sin((t-1-i)*(Math.PI*2)/r)*.5+1}}var Ke=7.5625,qe=2.75,Je=e=>{if(e<1/qe)return Ke*e*e;if(e<2/qe){let t=e-1.5/qe;return Ke*t*t+.75}if(e<2.5/qe){let t=e-2.25/qe;return Ke*t*t+.9375}let t=e-2.625/qe;return Ke*t*t+.984375},Ye=e=>1-Je(1-e),Xe=e=>e<.5?(1-Je(1-2*e))/2:(1+Je(2*e-1))/2;function Ze(e){let t=Math.max(1,Math.floor(e));return e=>e>=1?1:e<=0?0:Math.floor(e*t)/t}function Qe(e,t,n,r){let i=3*e,a=3*(n-e)-i,o=1-i-a,s=3*t,c=3*(r-t)-s,l=1-s-c,u=e=>((o*e+a)*e+i)*e,d=e=>((l*e+c)*e+s)*e,f=e=>(3*o*e+2*a)*e+i,p=e=>{let t=e;for(let n=0;n<8;n++){let n=u(t)-e;if(Math.abs(n)<1e-5)return t;let r=f(t);if(Math.abs(r)<1e-6)break;t-=n/r}let n=0,r=1;for(t=e;n<r;){let i=u(t);if(Math.abs(i-e)<1e-5)return t;e>i?n=t:r=t,t=(n+r)/2}return t};return e=>e<=0?0:e>=1?1:d(p(e))}function $e(e={}){let t=Math.max(1,e.stiffness??100),n=Math.max(0,e.damping??10),r=Math.max(.01,e.mass??1),i=e.velocity??0,a=Math.sqrt(t/r),o=n/(2*Math.sqrt(t*r)),s;if(o<1){let e=a*Math.sqrt(1-o*o),t=(o*a+-i)/e;s=n=>1-Math.exp(-o*a*n)*(1*Math.cos(e*n)+t*Math.sin(e*n))}else if(o===1){let e=a+-i;s=t=>1-Math.exp(-a*t)*(1+e*t)}else{let e=Math.sqrt(o*o-1),t=-a*(o-e),n=-a*(o+e),r=(n- -i)/(n-t),c=1-r;s=e=>1-(r*Math.exp(t*e)+c*Math.exp(n*e))}let c=400;for(let e=16;e<=4e3;e+=16){let t=s(e/1e3);if(Math.abs(1-t)<.005){let t=s((e-16)/1e3);if(Math.abs(1-t)<.005){c=e;break}}c=e}let l=c/1e3;return{duration:c,fn:e=>s(Math.max(0,Math.min(1,e))*l)}}var et={linear:je,inQuad:Ne.in,outQuad:Ne.out,inOutQuad:Ne.inOut,inCubic:Pe.in,outCubic:Pe.out,inOutCubic:Pe.inOut,inQuart:Fe.in,outQuart:Fe.out,inOutQuart:Fe.inOut,inQuint:Ie.in,outQuint:Ie.out,inOutQuint:Ie.inOut,inSine:Le.in,outSine:Le.out,inOutSine:Le.inOut,inExpo:Re.in,outExpo:Re.out,inOutExpo:Re.inOut,inCirc:ze.in,outCirc:ze.out,inOutCirc:ze.inOut,inBack:Be(),outBack:Ve(),inOutBack:He(),inElastic:We(),outElastic:Ue(),inOutElastic:Ge(),inBounce:Ye,outBounce:Je,inOutBounce:Xe};function tt(e){if(typeof e==`function`)return e;if(e===void 0)return et.outCubic;let t=et[e];if(t)return t;let n=e.match(/^(\w+)\(([^)]*)\)$/);if(n){let e=n[1],t=n[2].split(`,`).map(e=>parseFloat(e.trim())).filter(e=>!Number.isNaN(e));switch(e){case`outElastic`:return Ue(t[0],t[1]);case`inElastic`:return We(t[0],t[1]);case`inOutElastic`:return Ge(t[0],t[1]);case`outBack`:return Ve(t[0]);case`inBack`:return Be(t[0]);case`inOutBack`:return He(t[0]);case`steps`:return Ze(t[0]??4);case`cubicBezier`:return t.length>=4?Qe(t[0],t[1],t[2],t[3]):et.outCubic;default:return et.outCubic}}return et.outCubic}function nt(e,t){if(t<=1||e===void 0||e===`first`)return 0;if(e===`last`)return t-1;if(e===`center`)return(t-1)/2;let n=Math.floor(e);return n<0?0:n>t-1?t-1:n}function rt(e,t={}){let n=t.start??0,r=t.direction===`reverse`;return(i,a)=>{if(a<=0)return n;let o=nt(t.from,a),s=Math.abs(i-o),c=Math.max(o,a-1-o),l=c===0?0:s/c,u=r?1-l:l,d;if(Array.isArray(e)){let[t,n]=e;d=t+u*(n-t)}else d=(r?c-s:s)*e;return n+d}}var it=new Set([`duration`,`delay`,`ease`,`loop`,`alternate`,`onBegin`,`onUpdate`,`onComplete`]);function at(e){if(typeof e==`number`||typeof e==`string`)return e;if(Array.isArray(e)&&e.length===2){let[t,n]=e;if((typeof t==`number`||typeof t==`string`)&&(typeof n==`number`||typeof n==`string`))return[t,n]}return null}function ot(e){return e?typeof e==`string`?typeof document>`u`?[]:Array.from(document.querySelectorAll(e)):e instanceof Element?[e]:`length`in e?Array.from(e):[]:[]}function st(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var ct=/^(-?\d*\.?\d+)([a-z%]*)$/i;function lt(e){if(typeof e==`number`)return{value:e,unit:``};let t=e.trim().match(ct);return t?{value:parseFloat(t[1]),unit:t[2]??``}:{value:0,unit:``}}function ut(e){return e.unit===``?`${e.value}`:`${e.value}${e.unit}`}var dt=new Set([`translate`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`]),ft=new WeakMap;function pt(e){let t=ft.get(e);return t||(t={values:{}},ft.set(e,t)),t}function mt(e){let t=[];for(let[n,r]of Object.entries(e.values)){let e=r.unit||(n.startsWith(`rotate`)||n.startsWith(`skew`)?`deg`:n.startsWith(`translate`)?`px`:``);t.push(`${n}(${r.value}${e})`)}return t.join(` `)}function ht(e,t,n){if(dt.has(t)){let r=pt(e);r.values[t]=n,e.style.transform=mt(r);return}if(t===`opacity`){e.style.opacity=`${n.value}`;return}e.style.setProperty(t,ut(n))}function gt(e,t){return dt.has(t)?pt(e).values[t]||{value:t.startsWith(`scale`)?1:0,unit:``}:lt(e.style.getPropertyValue(t)||(typeof window<`u`?window.getComputedStyle(e).getPropertyValue(t):``)||(t===`opacity`?`1`:`0`))}function _t(e,t,n){return e+(t-e)*n}function vt(e,t,n){return e===void 0?0:typeof e==`number`?e:e(t,n)}function yt(e){if(e&&typeof e==`object`&&`spring`in e){let t=$e(e.spring);return{ease:t.fn,duration:t.duration}}return{ease:tt(e),duration:null}}var bt=0,xt=new Set;function St(e){for(let t of xt){if(t.done||e<t.start)continue;let{target:n,options:r}=t,i=e-t.start,a=Math.max(1,n.duration),o=r.loop??!1,s=r.alternate===!0,c=o===!0?1/0:typeof o==`number`?Math.max(1,o):1,l=Math.floor(i/a),u=(i-l*a)/a,d=s&&l%2==1?1-u:u;if(l>=c){for(let e of n.props)ht(n.el,e.name,Ct(e.from,e.to,s&&c%2==0?0:1));r.onUpdate?.(1,n.el,n.index),r.onComplete?.(n.el,n.index),t.done=!0;continue}for(let e of n.props){let t=e.ease(Math.max(0,Math.min(1,d)));n.el!==null&&ht(n.el,e.name,Ct(e.from,e.to,t))}n.el!==null&&r.onUpdate?.(d,n.el,n.index)}for(let e of[...xt])e.done&&xt.delete(e);if(xt.size===0){bt=0;return}bt=requestAnimationFrame(St)}function Ct(e,t,n){let r=e.unit||t.unit;return{value:_t(e.value,t.value,n),unit:r}}function wt(){bt===0&&(typeof requestAnimationFrame>`u`||(bt=requestAnimationFrame(St)))}function Tt(e,t){let n=ot(e),r=n.length,i=Object.keys(t).filter(e=>!it.has(e)),a=st(),{ease:o,duration:s}=yt(t.ease),c=t.duration??s??400,l=[],u=[],d=typeof performance<`u`?performance.now():Date.now(),f=(e,n)=>{let a=[];for(let n of i){let r=t[n];if(r===void 0)continue;let i=at(r);if(i===null)continue;let s,c;Array.isArray(i)?(s=lt(i[0]),c=lt(i[1])):(s=gt(e,n),c=lt(i)),a.push({name:n,from:s,to:c,ease:o})}return{el:e,index:n,props:a,duration:c,delay:vt(t.delay,n,r)}};if(n.length===0)return{cancel:()=>{},finished:Promise.resolve(),get done(){return!0}};let p=!1;for(let e=0;e<n.length;e++){let r=n[e],i=f(r,e),o=d+i.delay;if(t.onBegin?.(r,e),a){for(let e of i.props)ht(r,e.name,e.to);t.onUpdate?.(1,r,e),t.onComplete?.(r,e),u.push(Promise.resolve());continue}for(let e of i.props)ht(r,e.name,e.from);let s={target:i,start:o,options:t,done:!1};l.push(s),xt.add(s),u.push(new Promise(e=>{let n=t.onComplete,r=(t,r)=>{try{n?.(t,r)}finally{e()}};s.options={...t,onComplete:r}}))}return wt(),{cancel(){if(!p){p=!0;for(let e of l)e.done=!0,xt.delete(e)}},finished:Promise.all(u).then(()=>void 0),get done(){return p||l.every(e=>e.done)}}}function Et(e={}){let t=(0,_.useRef)(null),n=(0,_.useRef)(!1),r=(0,_.useCallback)(()=>{if(n.current)return;let r=t.current;if(!r)return;let i=r.querySelectorAll(`[data-reveal]`);if(i.length===0)return;if(n.current=!0,st()){i.forEach(e=>{e.style.opacity=`1`,e.style.transform=``});return}let a=e.staggerMs??40,o=e.maxStaggerMs??320,s=Math.min(a,Math.max(10,o/i.length)),c=e.translateY??14,l=e.durationMs??520,u=e.from??`center`;i.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(${c}px)`,e.style.willChange=`transform, opacity`}),Tt(Array.from(i),{opacity:[0,1],translateY:[c,0],duration:l,ease:`outBack(1.2)`,delay:rt(s,{from:u}),onComplete:e=>{e.style.willChange=``}})},[e.staggerMs,e.maxStaggerMs,e.durationMs,e.translateY,e.from]);return(0,_.useEffect)(()=>{let n=t.current;if(!n)return;if(typeof IntersectionObserver>`u`){r();return}let i=!1,a=new IntersectionObserver(e=>{for(let t of e)if(t.isIntersecting&&!i){r(),a.disconnect();return}},{threshold:.08});a.observe(n);let o=n.querySelectorAll(`[data-reveal]`);if(!st()){let t=e.translateY??14;o.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(${t}px)`})}let s=n.getBoundingClientRect();return s.top<(window.innerHeight||document.documentElement.clientHeight)&&s.bottom>0&&(r(),a.disconnect()),()=>{i=!0,a.disconnect()}},[r,e.translateY]),t}function Dt(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Dt(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Ot(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Dt(e))&&(r&&(r+=` `),r+=t);return r}var kt=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,At=Ot,jt=(e,t)=>n=>{if(t?.variants==null)return At(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=kt(t)||kt(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return At(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Mt=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Nt=(e,t)=>({classGroupId:e,validator:t}),Pt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Ft=`-`,It=[],Lt=`arbitrary..`,Rt=e=>{let t=Vt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Bt(e);let n=e.split(Ft);return zt(n,n[0]===``&&n.length>1?1:0,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Mt(i,t):t:i||It}return n[e]||It}}},zt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=zt(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Ft):e.slice(t).join(Ft),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Bt=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Lt+r:void 0})(),Vt=e=>{let{theme:t,classGroups:n}=e;return Ht(n,t)},Ht=(e,t)=>{let n=Pt();for(let r in e){let i=e[r];Ut(i,n,r,t)}return n},Ut=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Wt(i,t,n,r)}},Wt=(e,t,n,r)=>{if(typeof e==`string`){Gt(e,t,n);return}if(typeof e==`function`){Kt(e,t,n,r);return}qt(e,t,n,r)},Gt=(e,t,n)=>{let r=e===``?t:Jt(t,e);r.classGroupId=n},Kt=(e,t,n,r)=>{if(Yt(e)){Ut(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Nt(n,e))},qt=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Ut(o,Jt(t,a),n,r)}},Jt=(e,t)=>{let n=e,r=t.split(Ft),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Pt(),n.nextPart.set(t,i)),n=i}return n},Yt=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Xt=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Zt=`!`,Qt=`:`,$t=[],en=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),tn=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Qt){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Zt)?(c=s.slice(0,-1),l=!0):s.startsWith(Zt)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return en(t,l,c,u)};if(t){let e=t+Qt,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):en($t,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},nn=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},rn=e=>({cache:Xt(e.cacheSize),parseClassName:tn(e),sortModifiers:nn(e),...Rt(e)}),an=/\s+/,on=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(an),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Zt:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},sn=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=cn(n))&&(i&&(i+=` `),i+=r);return i},cn=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=cn(e[r]))&&(n&&(n+=` `),n+=t);return n},ln=(e,...t)=>{let n,r,i,a,o=o=>(n=rn(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=on(e,n);return i(e,a),a};return a=o,(...e)=>a(sn(...e))},un=[],dn=e=>{let t=t=>t[e]||un;return t.isThemeGetter=!0,t},fn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pn=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,hn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,_n=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,vn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bn=e=>mn.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),xn=e=>!!e&&Number.isInteger(Number(e)),Sn=e=>e.endsWith(`%`)&&V(e.slice(0,-1)),Cn=e=>hn.test(e),wn=()=>!0,Tn=e=>gn.test(e)&&!_n.test(e),En=()=>!1,Dn=e=>vn.test(e),On=e=>yn.test(e),kn=e=>!H(e)&&!U(e),An=e=>Gn(e,Yn,En),H=e=>fn.test(e),jn=e=>Gn(e,Xn,Tn),Mn=e=>Gn(e,Zn,V),Nn=e=>Gn(e,$n,wn),Pn=e=>Gn(e,Qn,En),Fn=e=>Gn(e,qn,En),In=e=>Gn(e,Jn,On),Ln=e=>Gn(e,er,Dn),U=e=>pn.test(e),Rn=e=>Kn(e,Xn),zn=e=>Kn(e,Qn),Bn=e=>Kn(e,qn),Vn=e=>Kn(e,Yn),Hn=e=>Kn(e,Jn),Un=e=>Kn(e,er,!0),Wn=e=>Kn(e,$n,!0),Gn=(e,t,n)=>{let r=fn.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Kn=(e,t,n=!1)=>{let r=pn.exec(e);return r?r[1]?t(r[1]):n:!1},qn=e=>e===`position`||e===`percentage`,Jn=e=>e===`image`||e===`url`,Yn=e=>e===`length`||e===`size`||e===`bg-size`,Xn=e=>e===`length`,Zn=e=>e===`number`,Qn=e=>e===`family-name`,$n=e=>e===`number`||e===`weight`,er=e=>e===`shadow`,tr=ln(()=>{let e=dn(`color`),t=dn(`font`),n=dn(`text`),r=dn(`font-weight`),i=dn(`tracking`),a=dn(`leading`),o=dn(`breakpoint`),s=dn(`container`),c=dn(`spacing`),l=dn(`radius`),u=dn(`shadow`),d=dn(`inset-shadow`),f=dn(`text-shadow`),p=dn(`drop-shadow`),m=dn(`blur`),h=dn(`perspective`),g=dn(`aspect`),_=dn(`ease`),v=dn(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),U,H],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[U,H,c],T=()=>[bn,`full`,`auto`,...w()],E=()=>[xn,`none`,`subgrid`,U,H],D=()=>[`auto`,{span:[`full`,xn,U,H]},xn,U,H],O=()=>[xn,`auto`,U,H],ee=()=>[`auto`,`min`,`max`,`fr`,U,H],te=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],k=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],A=()=>[`auto`,...w()],ne=()=>[bn,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],re=()=>[bn,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ie=()=>[bn,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],j=()=>[e,U,H],M=()=>[...b(),Bn,Fn,{position:[U,H]}],ae=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],oe=()=>[`auto`,`cover`,`contain`,Vn,An,{size:[U,H]}],se=()=>[Sn,Rn,jn],N=()=>[``,`none`,`full`,l,U,H],P=()=>[``,V,Rn,jn],F=()=>[`solid`,`dashed`,`dotted`,`double`],ce=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],I=()=>[V,Sn,Bn,Fn],le=()=>[``,`none`,m,U,H],ue=()=>[`none`,V,U,H],de=()=>[`none`,V,U,H],fe=()=>[V,U,H],pe=()=>[bn,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Cn],breakpoint:[Cn],color:[wn],container:[Cn],"drop-shadow":[Cn],ease:[`in`,`out`,`in-out`],font:[kn],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Cn],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Cn],shadow:[Cn],spacing:[`px`,V],text:[Cn],"text-shadow":[Cn],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,bn,H,U,g]}],container:[`container`],columns:[{columns:[V,H,U,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[xn,`auto`,U,H]}],basis:[{basis:[bn,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[V,bn,`auto`,`initial`,`none`,H]}],grow:[{grow:[``,V,U,H]}],shrink:[{shrink:[``,V,U,H]}],order:[{order:[xn,`first`,`last`,`none`,U,H]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...te(),`normal`]}],"justify-items":[{"justify-items":[...k(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...k()]}],"align-content":[{content:[`normal`,...te()]}],"align-items":[{items:[...k(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...k(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...k(),`baseline`]}],"place-self":[{"place-self":[`auto`,...k()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ne()}],"inline-size":[{inline:[`auto`,...re()]}],"min-inline-size":[{"min-inline":[`auto`,...re()]}],"max-inline-size":[{"max-inline":[`none`,...re()]}],"block-size":[{block:[`auto`,...ie()]}],"min-block-size":[{"min-block":[`auto`,...ie()]}],"max-block-size":[{"max-block":[`none`,...ie()]}],w:[{w:[s,`screen`,...ne()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ne()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ne()]}],h:[{h:[`screen`,`lh`,...ne()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ne()]}],"max-h":[{"max-h":[`screen`,`lh`,...ne()]}],"font-size":[{text:[`base`,n,Rn,jn]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Wn,Nn]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Sn,H]}],"font-family":[{font:[zn,Pn,t]}],"font-features":[{"font-features":[H]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,U,H]}],"line-clamp":[{"line-clamp":[V,`none`,U,Mn]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,U,H]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,U,H]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:j()}],"text-color":[{text:j()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...F(),`wavy`]}],"text-decoration-thickness":[{decoration:[V,`from-font`,`auto`,U,jn]}],"text-decoration-color":[{decoration:j()}],"underline-offset":[{"underline-offset":[V,`auto`,U,H]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,U,H]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,U,H]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},xn,U,H],radial:[``,U,H],conic:[xn,U,H]},Hn,In]}],"bg-color":[{bg:j()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:j()}],"gradient-via":[{via:j()}],"gradient-to":[{to:j()}],rounded:[{rounded:N()}],"rounded-s":[{"rounded-s":N()}],"rounded-e":[{"rounded-e":N()}],"rounded-t":[{"rounded-t":N()}],"rounded-r":[{"rounded-r":N()}],"rounded-b":[{"rounded-b":N()}],"rounded-l":[{"rounded-l":N()}],"rounded-ss":[{"rounded-ss":N()}],"rounded-se":[{"rounded-se":N()}],"rounded-ee":[{"rounded-ee":N()}],"rounded-es":[{"rounded-es":N()}],"rounded-tl":[{"rounded-tl":N()}],"rounded-tr":[{"rounded-tr":N()}],"rounded-br":[{"rounded-br":N()}],"rounded-bl":[{"rounded-bl":N()}],"border-w":[{border:P()}],"border-w-x":[{"border-x":P()}],"border-w-y":[{"border-y":P()}],"border-w-s":[{"border-s":P()}],"border-w-e":[{"border-e":P()}],"border-w-bs":[{"border-bs":P()}],"border-w-be":[{"border-be":P()}],"border-w-t":[{"border-t":P()}],"border-w-r":[{"border-r":P()}],"border-w-b":[{"border-b":P()}],"border-w-l":[{"border-l":P()}],"divide-x":[{"divide-x":P()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":P()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...F(),`hidden`,`none`]}],"divide-style":[{divide:[...F(),`hidden`,`none`]}],"border-color":[{border:j()}],"border-color-x":[{"border-x":j()}],"border-color-y":[{"border-y":j()}],"border-color-s":[{"border-s":j()}],"border-color-e":[{"border-e":j()}],"border-color-bs":[{"border-bs":j()}],"border-color-be":[{"border-be":j()}],"border-color-t":[{"border-t":j()}],"border-color-r":[{"border-r":j()}],"border-color-b":[{"border-b":j()}],"border-color-l":[{"border-l":j()}],"divide-color":[{divide:j()}],"outline-style":[{outline:[...F(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[V,U,H]}],"outline-w":[{outline:[``,V,Rn,jn]}],"outline-color":[{outline:j()}],shadow:[{shadow:[``,`none`,u,Un,Ln]}],"shadow-color":[{shadow:j()}],"inset-shadow":[{"inset-shadow":[`none`,d,Un,Ln]}],"inset-shadow-color":[{"inset-shadow":j()}],"ring-w":[{ring:P()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:j()}],"ring-offset-w":[{"ring-offset":[V,jn]}],"ring-offset-color":[{"ring-offset":j()}],"inset-ring-w":[{"inset-ring":P()}],"inset-ring-color":[{"inset-ring":j()}],"text-shadow":[{"text-shadow":[`none`,f,Un,Ln]}],"text-shadow-color":[{"text-shadow":j()}],opacity:[{opacity:[V,U,H]}],"mix-blend":[{"mix-blend":[...ce(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[V]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":j()}],"mask-image-linear-to-color":[{"mask-linear-to":j()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":j()}],"mask-image-t-to-color":[{"mask-t-to":j()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":j()}],"mask-image-r-to-color":[{"mask-r-to":j()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":j()}],"mask-image-b-to-color":[{"mask-b-to":j()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":j()}],"mask-image-l-to-color":[{"mask-l-to":j()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":j()}],"mask-image-x-to-color":[{"mask-x-to":j()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":j()}],"mask-image-y-to-color":[{"mask-y-to":j()}],"mask-image-radial":[{"mask-radial":[U,H]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":j()}],"mask-image-radial-to-color":[{"mask-radial-to":j()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[V]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":j()}],"mask-image-conic-to-color":[{"mask-conic-to":j()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,U,H]}],filter:[{filter:[``,`none`,U,H]}],blur:[{blur:le()}],brightness:[{brightness:[V,U,H]}],contrast:[{contrast:[V,U,H]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Un,Ln]}],"drop-shadow-color":[{"drop-shadow":j()}],grayscale:[{grayscale:[``,V,U,H]}],"hue-rotate":[{"hue-rotate":[V,U,H]}],invert:[{invert:[``,V,U,H]}],saturate:[{saturate:[V,U,H]}],sepia:[{sepia:[``,V,U,H]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,U,H]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[V,U,H]}],"backdrop-contrast":[{"backdrop-contrast":[V,U,H]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,V,U,H]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,U,H]}],"backdrop-invert":[{"backdrop-invert":[``,V,U,H]}],"backdrop-opacity":[{"backdrop-opacity":[V,U,H]}],"backdrop-saturate":[{"backdrop-saturate":[V,U,H]}],"backdrop-sepia":[{"backdrop-sepia":[``,V,U,H]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,U,H]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[V,`initial`,U,H]}],ease:[{ease:[`linear`,`initial`,_,U,H]}],delay:[{delay:[V,U,H]}],animate:[{animate:[`none`,v,U,H]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,U,H]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":[`scale-3d`],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[U,H,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":[`translate-none`],accent:[{accent:j()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:j()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,U,H]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,U,H]}],fill:[{fill:[`none`,...j()]}],"stroke-w":[{stroke:[V,Rn,jn,Mn]}],stroke:[{stroke:[`none`,...j()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function W(...e){return tr(Ot(e))}function nr(e){let t=Math.max(0,Math.floor((Date.now()-e*1e3)/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);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}function rr(e){return new Date(e*1e3).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function ir(e,t){try{let e=JSON.parse(t);if(!e||typeof e!=`object`)return t;for(let t of[`command`,`CommandLine`,`Input`,`query`,`Task`,`Prompt`])if(typeof e[t]==`string`&&e[t].length>0)return e[t];for(let t of[`file_path`,`path`,`TargetFile`,`AbsolutePath`,`SearchPath`,`DirectoryPath`,`Url`,`ImageName`])if(typeof e[t]==`string`&&e[t].length>0)return e[t];for(let t of Object.values(e))if(typeof t==`string`&&t.length>0)return t;return``}catch{return t}}var ar=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})),G=o(((e,t)=>{t.exports=ar()}))(),or=jt(`hig-card flex flex-col min-h-0 overflow-hidden`,{variants:{variant:{default:``,interactive:`hover:border-[var(--color-line-2)] hover:shadow-[var(--hig-shadow-2)] transition-all cursor-pointer`,flush:`bg-transparent border-[var(--color-line-0)] shadow-none`}},defaultVariants:{variant:`default`}});function K({className:e,variant:t,...n}){return(0,G.jsx)(`div`,{className:W(or({variant:t,className:e})),...n})}function q({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`flex items-center justify-between gap-2 px-4 pt-3 pb-2 shrink-0`,e),...t})}function J({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`px-4 py-3 flex-1 min-h-0 overflow-auto`,e),...t})}var sr=jt(`inline-flex items-center gap-1 rounded-sm px-1.5 py-0.5 text-[10px] font-mono font-medium leading-none tracking-wide uppercase border whitespace-nowrap`,{variants:{variant:{green:`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`,red:`bg-red-500/8 text-red-300 border-red-500/25`,amber:`bg-amber-500/10 text-amber-300 border-amber-500/30`,blue:`bg-sky-500/8 text-sky-300 border-sky-500/25`,gray:`bg-[var(--color-surface-2)] text-[var(--color-fg-3)] border-[var(--color-line-1)]`,purple:`bg-violet-500/8 text-violet-300 border-violet-500/25`,outline:`bg-transparent text-[var(--color-fg-3)] border-[var(--color-line-1)]`}},defaultVariants:{variant:`outline`}});function cr({className:e,variant:t,...n}){return(0,G.jsx)(`span`,{className:W(sr({variant:t,className:e})),...n})}var lr=jt(`hig-button relative overflow-hidden focus-visible:outline-none disabled:pointer-events-none disabled:opacity-45`,{variants:{variant:{primary:`hig-button-primary`,secondary:``,ghost:`hig-button-plain`,danger:`hig-button-destructive`},size:{sm:`hig-button-small`,md:``,icon:`!w-7 !h-7 !min-w-0 !p-0`}},defaultVariants:{variant:`primary`,size:`md`}});function ur(e,t){if(st())return;let n=e.getBoundingClientRect(),r=Math.hypot(n.width,n.height),i=document.createElement(`span`);i.style.position=`absolute`,i.style.left=`${t.clientX-n.left-r/2}px`,i.style.top=`${t.clientY-n.top-r/2}px`,i.style.width=`${r}px`,i.style.height=`${r}px`,i.style.borderRadius=`50%`,i.style.pointerEvents=`none`,i.style.background=`currentColor`,i.style.opacity=`0.22`,i.style.transform=`scale(0)`,i.style.mixBlendMode=`screen`,e.appendChild(i),Tt(i,{scale:[0,1],opacity:[.22,0],duration:540,ease:`outExpo`,onComplete:()=>{i.remove()}})}var Y=_.forwardRef(({className:e,variant:t,size:n,onMouseDown:r,onClick:i,...a},o)=>(0,G.jsx)(`button`,{ref:o,className:W(lr({variant:t,size:n,className:e})),onMouseDown:e=>{ur(e.currentTarget,e),r?.(e)},onClick:i,...a}));Y.displayName=`Button`;var dr=e=>Math.round(e).toLocaleString(void 0,{useGrouping:!0});function fr(e){return{ease:Pe.out,durationMs:e}}function pr({value:e,duration:t=320,format:n=dr,className:r}){let[i,a]=(0,_.useState)(e),o=(0,_.useRef)(e),s=(0,_.useRef)(e),c=(0,_.useRef)(0),l=(0,_.useRef)(null),u=(0,_.useRef)(st()),d=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(s.current===e)return;let n=d.current;if(n&&!u.current){for(let e of n.getAnimations())e.id===`lc-value-pulse`&&e.cancel();let e=n.animate([{textShadow:`0 0 0 rgba(245, 158, 11, 0)`},{textShadow:`0 0 10px rgba(245, 158, 11, 0.55)`,offset:.2},{textShadow:`0 0 0 rgba(245, 158, 11, 0)`}],{duration:520,easing:`ease-out`});e.id=`lc-value-pulse`}if(u.current){s.current=e,o.current=e,a(e);return}o.current=i,s.current=e,c.current=performance.now(),l.current!==null&&cancelAnimationFrame(l.current);let{ease:r,durationMs:f}=fr(t),p=e=>{let t=Math.min(1,(e-c.current)/f),n=r(t);a(o.current+(s.current-o.current)*n),t<1?l.current=requestAnimationFrame(p):l.current=null};return l.current=requestAnimationFrame(p),()=>{l.current!==null&&(cancelAnimationFrame(l.current),l.current=null)}},[e,t]),(0,G.jsx)(`span`,{ref:d,className:W(`tabular-nums`,r),children:n(i)})}function mr({data:e,width:t=80,height:n=24,color:r=`#38bdf8`,threshold:i,maxValue:a}){if(e.length<2)return(0,G.jsx)(`svg`,{width:t,height:n,className:`shrink-0`,children:(0,G.jsx)(`line`,{x1:0,y1:n/2,x2:t,y2:n/2,stroke:`var(--color-line-2)`,strokeWidth:1})});let o=a??Math.max(...e,1),s=t-2,c=n-2,l=e.map((t,n)=>{let r=1+n/(e.length-1)*s,i=1+c-t/o*c;return`${r.toFixed(1)},${i.toFixed(1)}`}),u=i===void 0?null:1+c-Math.min(i,o)/o*c;return(0,G.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,children:[(0,G.jsx)(`polyline`,{points:l.join(` `),fill:`none`,stroke:r,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`}),u!==null&&(0,G.jsx)(`line`,{x1:1,y1:u,x2:t-1,y2:u,stroke:`var(--color-brand)`,strokeWidth:1,strokeDasharray:`3,2`,opacity:.7})]})}var hr=new Set,gr=0,_r=0;function vr(){for(let e of hr)e();hr.size>0&&(gr=requestAnimationFrame(vr))}function yr(e){let t=_r++;return hr.add(e),hr.size===1&&(gr=requestAnimationFrame(vr)),[()=>{hr.delete(e),hr.size===0&&(cancelAnimationFrame(gr),gr=0)},t]}function br(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function xr({value:e,samples:t,maxValue:n,width:r=320,height:i=64,windowMs:a=6e4,color:o=`var(--color-brand)`,fillColor:s=`rgba(245, 158, 11, 0.12)`,className:c}){let l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useRef)([]),f=(0,_.useRef)(t??null),p=(0,_.useRef)(e??0),m=(0,_.useRef)(br());return(0,_.useEffect)(()=>{f.current=t??null},[t]),(0,_.useEffect)(()=>{t===void 0&&e!==void 0&&e!==p.current&&(p.current=e,d.current.push({ts:Date.now(),v:e}),d.current.length>600&&d.current.splice(0,d.current.length-600))},[e,t]),(0,_.useEffect)(()=>{let e=()=>{let e=Date.now(),t=e-a,o;if(f.current){let e=f.current;o=[];for(let n of e)n.ts>=t&&o.push(n)}else{let n=d.current;for(;n.length>1&&n[1].ts<t;)n.shift();(n.length===0||n[n.length-1].ts<e-200)&&n.push({ts:e,v:p.current}),o=n.filter(e=>e.ts>=t)}if(o.length<2)l.current&&l.current.setAttribute(`points`,``),u.current&&u.current.setAttribute(`points`,``);else{let e=n??Math.max(1,...o.map(e=>e.v)),s=[];for(let n of o){let o=(n.ts-t)/a*r,c=i-n.v/e*(i-2)-1;s.push(`${o.toFixed(1)},${c.toFixed(1)}`)}let c=s.join(` `);if(l.current&&l.current.setAttribute(`points`,c),u.current){let e=s[0].split(`,`),t=s[s.length-1].split(`,`),n=`${e[0]},${i} ${c} ${t[0]},${i}`;u.current.setAttribute(`points`,n)}}};if(m.current){let t=window.setInterval(e,500);return()=>clearInterval(t)}let[t]=yr(e);return t},[r,i,a,n]),(0,G.jsxs)(`svg`,{width:`100%`,height:i,viewBox:`0 0 ${r} ${i}`,className:W(`block`,c),preserveAspectRatio:`none`,children:[(0,G.jsx)(`polygon`,{ref:u,fill:s,stroke:`none`}),(0,G.jsx)(`polyline`,{ref:l,fill:`none`,stroke:o,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`})]})}var Sr=jt(`hero-metric relative flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] px-4 py-3 overflow-hidden`,{variants:{tone:{neutral:`hero-metric--neutral`,amber:`hero-metric--amber`,green:`hero-metric--green`,red:`hero-metric--red`,blue:`hero-metric--blue`,purple:`hero-metric--purple`,gray:`hero-metric--gray`}},defaultVariants:{tone:`neutral`}}),Cr={neutral:`var(--color-fg-1)`,amber:`var(--color-decision-ask)`,green:`var(--color-decision-allow)`,red:`var(--color-decision-block)`,blue:`var(--color-decision-force)`,purple:`var(--color-decision-log)`,gray:`var(--color-fg-3)`},wr={neutral:`color-mix(in srgb, var(--color-fg-1) 10%, transparent)`,amber:`color-mix(in srgb, var(--color-decision-ask) 14%, transparent)`,green:`color-mix(in srgb, var(--color-decision-allow) 14%, transparent)`,red:`color-mix(in srgb, var(--color-decision-block) 14%, transparent)`,blue:`color-mix(in srgb, var(--color-decision-force) 14%, transparent)`,purple:`color-mix(in srgb, var(--color-decision-log) 14%, transparent)`,gray:`color-mix(in srgb, var(--color-fg-3) 10%, transparent)`},Tr={neutral:`text-[var(--color-fg-0)]`,amber:`text-amber-300`,green:`text-emerald-300`,red:`text-red-300`,blue:`text-sky-300`,purple:`text-violet-300`,gray:`text-[var(--color-fg-2)]`},Er=1e3,Dr=.35;function Or(e,t,n){let r=Date.now(),i=r-n,a=Math.max(2,Math.floor(n/Er)),o=Array(a).fill(0);for(let n of e){if(t&&!t(n)||n.ts_ms<i||n.ts_ms>r)continue;let e=a-1-Math.floor((r-n.ts_ms)/Er);e>=0&&e<a&&o[e]++}let s=Array(a),c=o[0];for(let e=0;e<a;e++)c=Dr*o[e]+(1-Dr)*c,s[e]={ts:i+(e+1)*Er,v:c};return s}function kr({label:e,value:t,series:n,burstRing:r,filter:i,sparkWindowMs:a=6e4,sub:o,tone:s,format:c,className:l,...u}){let d=s??`neutral`,f=Cr[d]??Cr.neutral,p=wr[d]??wr.neutral,m=Tr[d]??Tr.neutral,h=(0,_.useRef)(null),g=(0,_.useRef)(t);(0,_.useEffect)(()=>{if(g.current===t)return;g.current=t;let e=h.current;e&&Tt(e,{"--tick":[0,1],duration:160,ease:`outCubic`,onComplete:()=>{Tt(e,{"--tick":[1,0],duration:520,ease:`outCubic`,onComplete:e=>{e.style.removeProperty(`--tick`)}})}})},[t]);let v=(0,_.useMemo)(()=>r?Or(r,i,a):null,[r,i,a]),y=v!==null,b=!y&&n&&n.length>=2;return(0,G.jsxs)(`div`,{ref:h,className:W(Sr({tone:s,className:l})),...u,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:e}),o?(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:o}):null]}),(0,G.jsxs)(`div`,{className:`flex items-end justify-between gap-3`,children:[(0,G.jsx)(pr,{value:t,format:c,className:W(`text-[2.4rem] leading-none font-semibold tracking-tight`,m)}),y?(0,G.jsx)(xr,{samples:v,width:108,height:36,windowMs:a,color:f,fillColor:p,className:`shrink-0`}):b?(0,G.jsx)(mr,{data:n,width:96,height:28,color:f}):null]})]})}var Ar=135,jr=405,Mr=jr-Ar,Nr=`#34d399`,Pr=`#f59e0b`,Fr=`#ef4444`;function Ir(e,t,n,r){let i=(r-90)*(Math.PI/180);return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function Lr(e,t,n,r,i){let a=Ir(e,t,n,r),o=Ir(e,t,n,i),s=i-r>180?1:0;return`M ${a.x.toFixed(2)} ${a.y.toFixed(2)} A ${n} ${n} 0 ${s} 1 ${o.x.toFixed(2)} ${o.y.toFixed(2)}`}function Rr(e,t){return Ar+Math.max(0,Math.min(1,e/Math.max(t,1e-9)))*Mr}function zr(e,t,n){return e+(t-e)*n}function Br(e){let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]}function Vr(e,t,n){let[r,i,a]=Br(e),[o,s,c]=Br(t);return`rgb(${Math.round(zr(r,o,n))},${Math.round(zr(i,s,n))},${Math.round(zr(a,c,n))})`}function Hr(e,t,n){let r=.04;return e<t-r?Nr:e<t+r?Vr(Nr,Pr,(e-(t-r))/(r*2)):e<n-r?Pr:e<n+r?Vr(Pr,Fr,(e-(n-r))/(r*2)):Fr}function Ur(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Wr=0;function Gr(){return Wr=Wr+1|0,Wr.toString(36)}function Kr({value:e,max:t,warnAt:n=.7,critAt:r=.9,marker50:i,marker99:a,label:o,display:s,displayFormat:c,scaleLabels:l,mode:u=`needle`,size:d=180,className:f,revLights:p=!0,revLightCount:m=20}){let h=Math.ceil(u===`needle`&&l!==void 0?d*.2:d*.08),g=-h,v=-h,y=d+h*2,b=d+h*2,x=d/2,S=d/2,C=d*.42,w=Math.max(0,Math.min(1,e/Math.max(t,1e-9))),T=(0,_.useMemo)(()=>Lr(x,S,C,Ar,jr),[x,S,C]),E=(0,_.useMemo)(()=>Lr(x,S,C-8,Ar,jr),[x,S,C]),D=Ar+n*Mr,O=Ar+r*Mr,ee=(0,_.useMemo)(()=>Lr(x,S,C,Ar,D),[x,S,C,D]),te=(0,_.useMemo)(()=>Lr(x,S,C,D,O),[x,S,C,D,O]),k=(0,_.useMemo)(()=>Lr(x,S,C,O,jr),[x,S,C,O]),A=(0,_.useMemo)(()=>Lr(x,S,C-14,300,420),[x,S,C]),ne=Ar+w*Mr,re=(0,_.useMemo)(()=>Lr(x,S,C,Ar,Math.max(Ar+.01,ne)),[x,S,C,ne]),ie=Hr(w,n,r),j=(0,_.useMemo)(()=>Gr(),[]),M=`lgf-${j}`,ae=`lgb-${j}`,oe=`lgd-${j}`,se=`lgh-${j}`,N=`lgg-${j}`,P=`lgl-${j}`,F=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=10;t++)e.push(Ar+t/10*Mr);return e},[u]),ce=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=40;t++)t%4!=0&&e.push(Ar+t/40*Mr);return e},[u]),I=(0,_.useRef)(null),le=(0,_.useRef)(null),ue=(0,_.useRef)(null),de=(0,_.useRef)(null),fe=(0,_.useRef)(null),pe=(0,_.useRef)(null),me=(0,_.useRef)(null),he=(0,_.useRef)(null),L=(0,_.useRef)([]),ge=(0,_.useRef)(e),_e=(0,_.useRef)(t),ve=(0,_.useRef)(n),ye=(0,_.useRef)(r);(0,_.useEffect)(()=>{ge.current=e,_e.current=t,ve.current=n,ye.current=r},[e,t,n,r]);let be=(0,_.useMemo)(()=>{if(!p||u!==`needle`)return[];let e=Math.max(4,m),t=C-11,n=[];for(let r=0;r<e;r++){let i=Ar+(r+.5)/e*Mr;n.push(Ir(x,S,t,i))}return n},[p,m,u,x,S,C]);L.current.length!==be.length&&(L.current.length=be.length);let R=x+C-6,xe=x+d*.04,Se=Math.max(2,d*.016),Ce=`${R},${S} ${xe},${S-Se} ${xe},${S+Se}`,we=x-d*.04,Te=x-C*.24,Ee=Math.max(1.4,d*.012),De=`${Te},${S} ${we},${S-Ee} ${we},${S+Ee}`,Oe=d*.48,ke=d*.17,z=x-Oe/2,Ae=S+d*.16,B=Ae+ke*.68;return(0,_.useEffect)(()=>{let e=Ur(),t=performance.now(),n=ge.current,r=0,i=ge.current,a=0,o=ge.current,s=``,l=``,d=``,f=-1,m=``,h=``,[g]=yr(()=>{let g=performance.now(),_=(g-t)/1e3;t=g;let v=Math.min(.04,Math.max(.001,_)),y=ge.current,b=_e.current,w=ve.current,T=ye.current,E=Math.max(b,1e-9),D=y;if(e)n=y,i=y,o=y,r=0,a=0;else{let e=v/2;for(let t=0;t<2;t++){let t=-210*(n-D)-22*r;r+=t*e,n+=r*e;let o=-55*(i-n)-13*a;a+=o*e,i+=a*e}let t=1-Math.exp(-v*8);o+=(y-o)*t,Math.abs(n-y)<E*1e-5&&Math.abs(r)<1e-4&&(n=y,r=0),Math.abs(o-y)<E*1e-5&&(o=y)}let O=Math.max(0,Math.min(1,n/Math.max(b,1e-9))),ee=Ar+O*Mr,te=Ar+Math.max(0,Math.min(1,i/Math.max(b,1e-9)))*Mr,k=Hr(O,w,T),A=`rotate(${(ee-90).toFixed(3)} ${x} ${S})`;I.current&&A!==s&&(I.current.setAttribute(`transform`,A),s=A),k!==d&&(le.current&&le.current.setAttribute(`fill`,k),ue.current&&ue.current.setAttribute(`fill`,k),de.current&&de.current.setAttribute(`stroke`,k),pe.current&&pe.current.setAttribute(`fill`,k),d=k);let ne=`rotate(${(te-90).toFixed(3)} ${x} ${S})`;if(fe.current&&ne!==l&&(fe.current.setAttribute(`transform`,ne),l=ne),me.current&&c){let e=c(o);e!==h&&(me.current.textContent=e,h=e)}if(he.current&&u===`ring`){let e=Lr(x,S,C,Ar,Math.max(Ar+.01,ee));e!==m&&(he.current.setAttribute(`d`,e),m=e)}if(p&&u===`needle`){let e=Math.round(O*1e3)/1e3;if(e!==f){f=e;let t=L.current,n=t.length;if(n>0){let e=1/n;for(let r=0;r<n;r++){let i=t[r];if(!i)continue;let a=(r+.5)/n,o=O-a,s=Math.max(0,Math.min(1,.5+o/e));i.setAttribute(`fill`,Hr(a,w,T)),i.setAttribute(`opacity`,s.toFixed(3))}}}}});return g},[x,S,C,u,p,c]),(0,G.jsxs)(`div`,{className:W(`flex flex-col items-center justify-center gap-1 min-h-0 min-w-0`,f),children:[(0,G.jsxs)(`svg`,{width:y,height:b,viewBox:`${g} ${v} ${y} ${b}`,preserveAspectRatio:`xMidYMid meet`,className:`block max-w-full max-h-full min-h-0`,children:[(0,G.jsxs)(`defs`,{children:[(0,G.jsxs)(`filter`,{id:M,x:`-40%`,y:`-40%`,width:`180%`,height:`180%`,children:[(0,G.jsx)(`feGaussianBlur`,{stdDeviation:`1.2`,result:`blur`}),(0,G.jsxs)(`feMerge`,{children:[(0,G.jsx)(`feMergeNode`,{in:`blur`}),(0,G.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,G.jsxs)(`radialGradient`,{id:ae,cx:`50%`,cy:`32%`,r:`80%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#4e535d`}),(0,G.jsx)(`stop`,{offset:`55%`,stopColor:`#2a2e36`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#0b0d11`})]}),(0,G.jsxs)(`radialGradient`,{id:oe,cx:`50%`,cy:`45%`,r:`75%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#1b1f27`}),(0,G.jsx)(`stop`,{offset:`80%`,stopColor:`#0a0c10`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#05060a`})]}),(0,G.jsxs)(`radialGradient`,{id:se,cx:`40%`,cy:`30%`,r:`70%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#f4f5f8`}),(0,G.jsx)(`stop`,{offset:`45%`,stopColor:`#aab1bd`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#1c1f26`})]}),(0,G.jsxs)(`linearGradient`,{id:N,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.22`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#ffffff`,stopOpacity:`0`})]}),(0,G.jsxs)(`linearGradient`,{id:P,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#0a0c11`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#15181f`})]})]}),u===`needle`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`circle`,{cx:x,cy:S,r:C+12,fill:`url(#${ae})`,stroke:`#000`,strokeOpacity:.55,strokeWidth:1}),(0,G.jsx)(`circle`,{cx:x,cy:S,r:C+5,fill:`none`,stroke:`#0a0c11`,strokeWidth:1}),(0,G.jsx)(`circle`,{cx:x,cy:S,r:C-2,fill:`url(#${oe})`})]}):null,(0,G.jsx)(`path`,{d:T,fill:`none`,stroke:`var(--color-line-1)`,strokeWidth:u===`ring`?12:3,strokeLinecap:`round`,opacity:u===`ring`?1:.35}),u===`needle`?(0,G.jsx)(`path`,{d:E,fill:`none`,stroke:`var(--color-line-0)`,strokeWidth:1,strokeLinecap:`round`,opacity:.55}):null,u===`needle`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`path`,{d:ee,fill:`none`,stroke:Nr,strokeWidth:5,strokeLinecap:`round`,opacity:.78}),(0,G.jsx)(`path`,{d:te,fill:`none`,stroke:Pr,strokeWidth:5,strokeLinecap:`round`,opacity:.82}),(0,G.jsx)(`path`,{d:k,fill:`none`,stroke:Fr,strokeWidth:5,strokeLinecap:`round`,opacity:.9}),ce.map((e,t)=>{let n=Ir(x,S,C-4,e),r=Ir(x,S,C+2,e);return(0,G.jsx)(`line`,{x1:n.x,y1:n.y,x2:r.x,y2:r.y,stroke:`var(--color-fg-4)`,strokeWidth:.9,strokeLinecap:`round`,opacity:.7},`mi-${t}`)}),F.map((e,t)=>{let n=Ir(x,S,C-8,e),r=Ir(x,S,C+4,e);return(0,G.jsx)(`line`,{x1:n.x,y1:n.y,x2:r.x,y2:r.y,stroke:`var(--color-fg-2)`,strokeWidth:1.8,strokeLinecap:`round`},`ma-${t}`)}),p?be.map((e,t)=>(0,G.jsx)(`circle`,{ref:e=>{L.current[t]=e},cx:e.x,cy:e.y,r:Math.max(1.6,d*.013),fill:Nr,opacity:0,filter:`url(#${M})`},t)):null,i===void 0?null:(0,G.jsx)(qr,{cx:x,cy:S,r:C,angle:Rr(i,t),emphasis:!0}),a===void 0?null:(0,G.jsx)(qr,{cx:x,cy:S,r:C,angle:Rr(a,t),emphasis:!0}),l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Jr,{cx:x,cy:S,r:C,angle:D,text:l(n),size:d}),(0,G.jsx)(Jr,{cx:x,cy:S,r:C,angle:O,text:l(r),size:d}),(0,G.jsx)(Jr,{cx:x,cy:S,r:C,angle:jr,text:l(1),size:d})]}):null,(0,G.jsx)(`path`,{d:A,fill:`none`,stroke:`url(#${N})`,strokeWidth:d*.14,strokeLinecap:`butt`}),c||s!==void 0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`rect`,{x:z,y:Ae,width:Oe,height:ke,rx:d*.022,ry:d*.022,fill:`url(#${P})`,stroke:`#242a33`,strokeWidth:1}),(0,G.jsx)(`rect`,{x:z+1,y:Ae+1,width:Oe-2,height:1,fill:`#ffffff`,opacity:.08})]}):null,(0,G.jsx)(`g`,{ref:fe,opacity:.28,children:(0,G.jsx)(`polygon`,{ref:pe,points:Ce,fill:ie})}),(0,G.jsxs)(`g`,{ref:I,children:[(0,G.jsx)(`polygon`,{ref:le,points:Ce,fill:ie,stroke:`#05070a`,strokeWidth:.6}),(0,G.jsx)(`polygon`,{ref:ue,points:De,fill:ie,opacity:.7})]}),(0,G.jsx)(`circle`,{cx:x,cy:S,r:d*.06,fill:`url(#${se})`,stroke:`#06080c`,strokeWidth:1}),(0,G.jsx)(`circle`,{ref:de,cx:x,cy:S,r:d*.036,fill:`#0a0c11`,stroke:ie,strokeWidth:1.4}),(0,G.jsx)(`circle`,{cx:x,cy:S,r:d*.012,fill:`#f5f7fb`,opacity:.9})]}):(0,G.jsx)(`path`,{ref:he,d:re,fill:`none`,stroke:ie,strokeWidth:12,strokeLinecap:`round`}),u===`needle`&&(c||s!==void 0)?c?(0,G.jsx)(`text`,{ref:me,x,y:B,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:c(e)}):(0,G.jsx)(`text`,{x,y:B,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:s}):c?(0,G.jsx)(`text`,{ref:me,x,y:S+4,textAnchor:`middle`,className:`font-mono tabular-nums`,fontSize:d*.13,fill:`var(--color-fg-0)`,children:c(e)}):s===void 0?null:(0,G.jsx)(`text`,{x,y:S+4,textAnchor:`middle`,className:`font-mono tabular-nums`,fontSize:d*.13,fill:`var(--color-fg-0)`,children:s})]}),o?(0,G.jsx)(`span`,{className:`overline shrink-0 tracking-[0.12em] uppercase`,children:o}):null]})}function qr({cx:e,cy:t,r:n,angle:r,emphasis:i=!1}){let a=Ir(e,t,n-(i?10:6),r),o=Ir(e,t,n+(i?8:6),r);return(0,G.jsx)(`line`,{x1:a.x,y1:a.y,x2:o.x,y2:o.y,stroke:i?`var(--color-fg-1)`:`var(--color-fg-2)`,strokeWidth:i?2:1.5,strokeLinecap:`round`})}function Jr({cx:e,cy:t,r:n,angle:r,text:i,size:a}){let o=Ir(e,t,n+Math.max(16,a*.1),r),s=r>=135&&r<215?`end`:r>=325?`start`:`middle`;return(0,G.jsx)(`text`,{x:o.x,y:o.y,textAnchor:s,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:a*.062,fontWeight:600,fill:`var(--color-fg-2)`,stroke:`var(--color-bg-0)`,strokeWidth:3,paintOrder:`stroke`,children:i})}var Yr={containerPaddingY:24,containerPaddingX:24,topToTrendGap:12,scatterHeaderH:18,scatterLegendH:16,scatterInnerGap:8,trendRowH:28,trendRowGap:6,trendTopPad:9,scatterAbsoluteMin:60,scatterAcceptableMin:70,gaugeFootprintFactor:1.36,gaugeAbsoluteMin:84,gaugeAbsoluteMax:240};function Xr(e,t,n=200){let r=Math.max(0,Math.floor(e)),i=Math.max(0,Math.floor(t)),a=Math.max(0,r-Yr.containerPaddingX),o=Math.max(0,i-Yr.containerPaddingY),s=o-(Yr.trendRowH*3+Yr.trendRowGap*2+Yr.trendTopPad+Yr.topToTrendGap),c=s-Yr.scatterHeaderH-Yr.scatterLegendH-Yr.scatterInnerGap>=Yr.scatterAcceptableMin,l=c?s:o,u=l-Yr.scatterHeaderH-Yr.scatterLegendH-Yr.scatterInnerGap,d=u>=Yr.scatterAbsoluteMin,f=u>=Yr.scatterAbsoluteMin&&l>=140,p=Math.floor(l/Yr.gaugeFootprintFactor),m=Math.floor(a*.45/Yr.gaugeFootprintFactor),h=Math.max(Yr.gaugeAbsoluteMin,Math.min(Yr.gaugeAbsoluteMax,n,p,m)),g=Math.ceil(h*Yr.gaugeFootprintFactor+8),_=l-(d?Yr.scatterHeaderH:0)-(f?Yr.scatterLegendH:0)-Yr.scatterInnerGap;return{gaugeSize:h,gaugeColumnMaxWidth:g,scatterMinHeight:Math.max(Yr.scatterAbsoluteMin,Math.min(160,_)),showTrendRows:c,showScatterHeader:d,showLegend:f,variant:o>=480?`wide`:o>=300?`normal`:`compact`}}var Zr={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`};function Qr(e){return!Number.isFinite(e)||e<=0?`—`:e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:`${(e/1e6).toFixed(2)} ms`}function $r({latency:e,bursts:t,gaugeMaxMs:n=10,windowMs:r=3e4,trendWindowSec:i=60,gaugeSize:a=200,compact:o=!1,className:s}){let c=e?e.p50_ns/1e6:0,l=e?e.p95_ns/1e6:0,u=e?e.p99_ns/1e6:0,d=(0,_.useRef)(null),[f,p]=(0,_.useState)((0,_.useMemo)(()=>Xr(a*2,a*2,a),[a]));(0,_.useEffect)(()=>{let e=d.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=0,r=0,i=e=>{let t=Math.round(e.width/4)*4,i=Math.round(e.height/4)*4;t===n&&i===r||(n=t,r=i,p(Xr(t,i,a)))};i(e.getBoundingClientRect());let o=new ResizeObserver(e=>{let n=e[0];n&&(t&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{i(n.contentRect)}))});return o.observe(e),()=>{t&&cancelAnimationFrame(t),o.disconnect()}},[a]);let m=(0,_.useRef)(null),h=(0,_.useRef)([]),g=(0,_.useRef)(0);(0,_.useEffect)(()=>{if(t.length===0)return;let e=h.current,n=g.current,i=n;for(let r of t)r.ts_ms<=n||(e.push({ts:r.ts_ms,durationNs:r.duration_ns,color:Zr[r.decision]??`#6e7076`}),r.ts_ms>i&&(i=r.ts_ms));g.current=i;let a=Date.now()-r*2;for(;e.length&&e[0].ts<a;)e.shift()},[t,r]),(0,_.useEffect)(()=>{let e=m.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let i=0,a=0,o=0,s=8e3,c=.25,l=1e3,u=n*1e6,d=Math.log10(l),f=Math.log10(u),[p]=yr(()=>{let n=window.devicePixelRatio||1,p=e.clientWidth,m=e.clientHeight;if(p===0||m===0)return;(p!==a||m!==o||n!==i)&&(e.width=Math.floor(p*n),e.height=Math.floor(m*n),t.setTransform(n,0,0,n,0,0),a=p,o=m,i=n),t.clearRect(0,0,p,m),t.strokeStyle=`rgba(110, 112, 118, 0.18)`,t.lineWidth=1,t.setLineDash([2,4]);let g=[{ns:1e5,label:`100µs`},{ns:1e6,label:`1ms`},{ns:1e7,label:`10ms`}];t.font=`9px ui-monospace, SFMono-Regular, Menlo, monospace`,t.textBaseline=`middle`,t.fillStyle=`rgba(110, 112, 118, 0.7)`;for(let e of g){if(e.ns<l||e.ns>u)continue;let n=m-(Math.log10(e.ns)-d)/(f-d)*m;t.beginPath(),t.moveTo(0,n),t.lineTo(p-28,n),t.stroke(),t.fillText(e.label,p-26,n)}t.setLineDash([]);let _=Date.now(),v=_-r,y=h.current;for(;y.length&&y[0].ts<v;)y.shift();t.globalCompositeOperation=`source-over`;for(let e of y){let n=(e.ts-v)/r*p,i=Math.max(l,Math.min(u,e.durationNs)),a=m-(Math.log10(i)-d)/(f-d)*m,o=_-e.ts,h;if(o<=s)h=1-o/s*(1-c);else{let e=r-s;h=e>0?Math.max(0,c*(1-(o-s)/e)):0}h<=0||(t.globalAlpha=h,t.fillStyle=e.color,t.beginPath(),t.arc(n,a,2.5,0,Math.PI*2),t.fill())}t.globalAlpha=1,t.fillStyle=`rgba(110, 112, 118, 0.55)`,t.font=`9px ui-monospace, SFMono-Regular, Menlo, monospace`,t.textBaseline=`bottom`,t.textAlign=`left`,t.fillText(`← ${Math.round(r/1e3)} s ago`,4,m-2),t.textAlign=`right`,t.fillText(`now →`,p-4,m-2),t.textAlign=`left`});return p},[r,n]);let v=(0,_.useRef)({p50:[],p95:[],p99:[]});(0,_.useEffect)(()=>{if(!e)return;let t=v.current,n=Date.now(),r=n-i*1e3,a=(e,t)=>{let i=t/1e6;for(e.length===0&&e.push({ts:r,v:i}),e.push({ts:n,v:i});e.length>1&&e[0].ts<r;)e.shift()};a(t.p50,e.p50_ns),a(t.p95,e.p95_ns),a(t.p99,e.p99_ns)},[e,i]);let y=(0,_.useMemo)(()=>{let e=v.current;return{p50:[...e.p50],p95:[...e.p95],p99:[...e.p99]}},[e]);return(0,G.jsxs)(`div`,{ref:d,"data-lt-variant":f.variant,className:W(`flex h-full min-h-0 flex-col gap-3 overflow-hidden rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] p-3`,s),children:[(0,G.jsxs)(`div`,{className:W(`grid gap-3 min-h-0 flex-1`,`grid-cols-[auto_1fr]`),children:[(0,G.jsx)(`div`,{className:`flex items-stretch justify-center overflow-hidden min-h-0 min-w-0`,style:{maxWidth:f.gaugeColumnMaxWidth},children:(0,G.jsx)(Kr,{value:l,max:n,warnAt:Math.min(.85,.5/n),critAt:Math.min(.92,2/n),marker50:c,marker99:u,displayFormat:e=>Qr(e*1e6),scaleLabels:f.gaugeSize>=130?e=>Qr(e*n*1e6):void 0,size:f.gaugeSize,label:`p95 latency`})}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0 min-h-0 flex-1`,children:[f.showScatterHeader?(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 shrink-0 min-w-0`,children:[(0,G.jsx)(`span`,{className:`overline truncate min-w-0`,children:`live trace · 30 s scatter`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] shrink min-w-0 truncate text-right`,children:[h.current.length,` live · log-Y`]})]}):null,f.showLegend?(0,G.jsx)(`div`,{className:`shrink-0`,children:(0,G.jsx)(ei,{})}):null,(0,G.jsx)(`canvas`,{ref:m,"data-testid":`latency-scatter-canvas`,className:`block w-full flex-1 min-h-0 rounded-sm bg-[var(--color-surface-0)] border border-[var(--color-line-0)]`,style:{minHeight:f.scatterMinHeight}})]})]}),f.showTrendRows?(0,G.jsxs)(`div`,{"data-testid":`latency-trend-rows`,className:`grid grid-cols-1 gap-1.5 pt-2 border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(ti,{label:`p50 · median`,value:Qr(e?.p50_ns??0),color:`#34d399`,fill:`rgba(52, 211, 153, 0.14)`,samples:y.p50,windowMs:i*1e3}),(0,G.jsx)(ti,{label:`p95 · 95th`,value:Qr(e?.p95_ns??0),color:`#38bdf8`,fill:`rgba(56, 189, 248, 0.14)`,samples:y.p95,windowMs:i*1e3}),(0,G.jsx)(ti,{label:`p99 · 99th`,value:Qr(e?.p99_ns??0),color:`#6366f1`,fill:`rgba(99, 102, 241, 0.14)`,samples:y.p99,windowMs:i*1e3})]}):null]})}function ei(){return(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[{key:`allow`,color:Zr.allow},{key:`ask`,color:Zr.ask},{key:`block`,color:Zr.block},{key:`force`,color:Zr.force},{key:`log`,color:Zr.log},{key:`shadow`,color:Zr.shadow}].map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full`,style:{background:e.color}}),(0,G.jsx)(`span`,{className:`uppercase tracking-wide`,children:e.key})]},e.key))})}function ti({label:e,value:t,color:n,fill:r,samples:i,windowMs:a}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)_92px] items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`overline text-right truncate min-w-0`,children:e}),(0,G.jsx)(xr,{samples:i,width:1200,height:28,windowMs:a,color:n,fillColor:r,className:`w-full h-7`}),(0,G.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-right truncate min-w-0`,style:{color:n},title:t,children:t})]})}function ni({counters:e,className:t,showLegend:n=!0}){let r=[{key:`allow`,label:`Allow`,value:e.allow,color:`var(--color-decision-allow)`,textClass:`text-emerald-300`},{key:`ask`,label:`Ask`,value:e.ask,color:`var(--color-decision-ask)`,textClass:`text-amber-300`},{key:`block`,label:`Block`,value:e.block,color:`var(--color-decision-block)`,textClass:`text-red-300`},{key:`force`,label:`Force`,value:e.force,color:`var(--color-decision-force)`,textClass:`text-sky-300`},{key:`log`,label:`Log`,value:e.log,color:`var(--color-decision-log)`,textClass:`text-violet-300`},{key:`shadow`,label:`Shadow`,value:e.shadow,color:`var(--color-decision-shadow)`,textClass:`text-[var(--color-fg-3)]`}],i=r.reduce((e,t)=>e+t.value,0),a=(0,_.useRef)(null),o=(0,_.useRef)({});return(0,_.useEffect)(()=>{let e=a.current;if(!e)return;let t=e.querySelectorAll(`[data-seg]`);if(t.length===0)return;let n=st();t.forEach(e=>{let t=e.dataset.seg,a=r.find(e=>e.key===t);if(!a)return;let s=i===0?0:a.value/i*100,c=o.current[t]??0;n||Math.abs(c-s)<.01?e.style.width=`${s}%`:Tt(e,{width:[`${c}%`,`${s}%`],duration:480,ease:`outExpo`}),o.current[t]=s})},[e,i]),(0,G.jsxs)(`div`,{className:W(`flex flex-col gap-2`,t),children:[(0,G.jsx)(`div`,{ref:a,className:`flex h-3 w-full overflow-hidden rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-2)]`,children:i===0?(0,G.jsx)(`div`,{className:`w-full bg-[var(--color-surface-3)]`}):r.map(e=>(0,G.jsx)(`div`,{"data-seg":e.key,style:{width:`${i===0?0:e.value/i*100}%`,background:e.color}},e.key))}),n?(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-[11px] font-mono`,children:r.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 min-w-0`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,G.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-sm`,style:{background:e.color}}),(0,G.jsx)(`span`,{className:W(`uppercase tracking-wide truncate`,e.textClass),children:e.label})]}),(0,G.jsx)(pr,{value:e.value,className:`shrink-0 tabular-nums text-[var(--color-fg-1)]`})]},e.key))}):null]})}function ri(e){return e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m ${Math.floor(e%60)}s`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function ii(e,t){if(t===void 0||t<=0)return`var(--color-brand)`;let n=e/t;return n>=.9?`var(--color-decision-block)`:n>=.7?`var(--color-decision-ask)`:`var(--color-decision-allow)`}function ai(e){return e===`var(--color-decision-block)`?`color-mix(in srgb, var(--color-decision-block) 14%, transparent)`:e===`var(--color-decision-ask)`?`color-mix(in srgb, var(--color-decision-ask) 14%, transparent)`:e===`var(--color-decision-allow)`?`color-mix(in srgb, var(--color-decision-allow) 14%, transparent)`:e===`var(--color-decision-log)`?`color-mix(in srgb, var(--color-decision-log) 14%, transparent)`:`color-mix(in srgb, var(--color-brand) 12%, transparent)`}function oi(e,t){if(e.length===0)return[];let n=Date.now(),r=t/Math.max(1,e.length),i=Array(e.length);for(let t=0;t<e.length;t++)i[t]={ts:n-(e.length-1-t)*r,v:e[t]};return i}function si({cpuPct:e,cpuSeries:t,cpuLimit:n,memMb:r,memSeries:i,memLimit:a,heapUsedMb:o,heapTotalMb:s,heapSeries:c,uptimeSec:l,className:u}){let d=6e4,f=ii(e,n),p=ii(r,a),m=`var(--color-decision-log)`,h=(0,_.useMemo)(()=>oi(t,d),[t]),g=(0,_.useMemo)(()=>oi(i,d),[i]),v=(0,_.useMemo)(()=>oi(c,d),[c]),y=(0,_.useRef)([]);(0,_.useEffect)(()=>{let e=y.current.filter(e=>!!e);if(e.length===0)return;e.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(28px) scale(0.94)`});let t=Tt(e,{translateY:[28,0],scale:[.94,1],opacity:[0,1],duration:720,delay:rt(140),ease:`outBack(1.25)`,onComplete:e=>{e.style.transform=``}});return()=>t.cancel()},[]);let b=n!==void 0&&n>0&&e>=n*.9,x=a!==void 0&&a>0&&r>=a*.9;return(0,G.jsx)(`div`,{className:W(`rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] p-3`,u),children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:[(0,G.jsx)(ci,{registerRef:e=>y.current[0]=e,label:`CPU`,color:f,fill:ai(f),pulse:b,valueNode:(0,G.jsxs)(`span`,{children:[(0,G.jsx)(pr,{value:e,format:e=>e.toFixed(1),className:`text-[var(--color-fg-0)]`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:`%`})]}),subText:n?`limit ${n}%`:void 0,samples:h,maxValue:100,windowMs:d}),(0,G.jsx)(ci,{registerRef:e=>y.current[1]=e,label:`Memory`,color:p,fill:ai(p),pulse:x,valueNode:(0,G.jsxs)(`span`,{children:[(0,G.jsx)(pr,{value:r,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:`MB`})]}),subText:a?`limit ${a} MB`:void 0,samples:g,maxValue:a?a*1.1:void 0,windowMs:d}),(0,G.jsx)(ci,{registerRef:e=>y.current[2]=e,label:`Heap`,color:m,fill:ai(m),valueNode:(0,G.jsxs)(`span`,{children:[(0,G.jsx)(pr,{value:o,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:[`/ `,s.toFixed(0),` MB`]})]}),subText:s>0?`${(o/s*100).toFixed(0)}% used`:void 0,samples:v,maxValue:s>0?s:void 0,windowMs:d}),(0,G.jsx)(ci,{registerRef:e=>y.current[3]=e,label:`Uptime`,color:`var(--color-fg-2)`,fill:`rgba(214, 215, 217, 0.04)`,valueNode:(0,G.jsx)(`span`,{className:`text-[var(--color-fg-0)] tabular-nums`,children:ri(l)}),subText:`since daemon start`})]})})}function ci({label:e,valueNode:t,subText:n,color:r,fill:i,samples:a,maxValue:o,windowMs:s,pulse:c,registerRef:l}){let u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!c||!u.current)return;let e=!1,t=null,n=()=>{e||!u.current||(t=Tt(u.current,{"--breach":[0,1],duration:420,ease:`outCubic`,onComplete:()=>{e||!u.current||(t=Tt(u.current,{"--breach":[1,0],duration:560,ease:`outCubic`,onComplete:()=>{e||n()}}))}}))};return n(),()=>{e=!0,t?.cancel();let n=u.current;n&&n.style.removeProperty(`--breach`)}},[c]),(0,G.jsxs)(`div`,{ref:e=>{u.current=e,l(e)},className:`flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-0)] border-[var(--color-line-1)] px-4 py-3 min-h-[140px] system-pulse__tile`,"data-breach":c?`true`:void 0,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:e}),n?(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:n}):null]}),(0,G.jsx)(`span`,{className:`text-[1.9rem] leading-none font-semibold tracking-tight font-mono`,style:{color:r},children:t}),a&&a.length>=2?(0,G.jsx)(`div`,{className:`mt-auto`,children:(0,G.jsx)(xr,{samples:a,width:320,height:64,windowMs:s??6e4,color:r,fillColor:i,maxValue:o,className:`w-full`})}):(0,G.jsx)(`div`,{className:`mt-auto h-[64px] flex items-end`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`— no series —`})})]})}var li={__daemon:`SigmaShake itself`,bash:`Run a terminal command`,shell:`Run a terminal command`,run_command:`Run a terminal command`,exec:`Run a terminal command`,run_shell_command:`Run a terminal command`,read:`Read a file`,read_file:`Read a file`,view_file:`Read a file`,cat:`Read a file`,view:`Read a file`,write:`Save changes to a file`,write_to_file:`Save changes to a file`,create_file:`Create a new file`,edit:`Edit an existing file`,multiedit:`Edit several spots in a file`,patch:`Edit an existing file`,apply_patch:`Edit an existing file`,replace:`Edit an existing file`,grep:`Search the codebase`,ripgrep:`Search the codebase`,search:`Search the codebase`,search_codebase:`Search the codebase`,glob:`Find files by name`,find:`Find files by name`,list_files:`List files in a folder`,ls:`List files in a folder`,webfetch:`Read a webpage`,fetch:`Read a webpage`,websearch:`Search the web`,search_web:`Search the web`,browser_action:`Use a web browser`,agent:`Ask a helper AI to investigate`,spawn:`Ask a helper AI to investigate`,task:`Update its to-do list`,todowrite:`Update its to-do list`,todo_write:`Update its to-do list`,notebookedit:`Edit a Jupyter notebook`,notebook_edit:`Edit a Jupyter notebook`};function ui(e){return e?li[e.toLowerCase()]||`Use the ${e.replace(/^_+/,``)} tool`:`Take an action`}function di(e){return e?{"claude-code":`Claude Code`,claudecode:`Claude Code`,cursor:`Cursor`,copilot:`GitHub Copilot`,codex:`OpenAI Codex`,gemini:`Gemini`,antigravity:`Antigravity`,pi:`Pi`,generic:`AI agent`,daemon:`SigmaShake`}[e.toLowerCase()]??e:`AI agent`}function fi(e){return e?e.startsWith(`__`):!1}function pi(e){for(let t of[`file_path`,`path`,`TargetFile`,`AbsolutePath`,`filename`,`file`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function mi(e){for(let t of[`command`,`CommandLine`,`cmd`,`Input`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function hi(e){for(let t of[`query`,`pattern`,`Query`,`q`,`search`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function gi(e){for(let t of[`url`,`URL`,`Url`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function _i(e){let t=e.replace(/[\\/]+$/,``),n=t.lastIndexOf(`/`),r=t.lastIndexOf(`\\`),i=Math.max(n,r);return i>=0?t.slice(i+1):t}function vi(e){let t=e.trim(),n=(t.split(/[|;&]/)[0]?.trim()??t).split(/\s+/),r=n[0]?.toLowerCase()??``,i=n[1]?.toLowerCase()??``,a=(e,t)=>({headline:e,detail:t});if(r===`rm`)return a(`Delete files`,`Deleting files from disk: \`${t}\``);if(r===`mkdir`)return a(`Create a folder`,`Creating a new folder: \`${t}\``);if(r===`mv`)return a(`Move or rename a file`,`Moving or renaming: \`${t}\``);if(r===`cp`)return a(`Copy a file`,`Copying files: \`${t}\``);if(r===`cat`||r===`head`||r===`tail`||r===`less`)return a(`Show file contents`,`Printing file contents: \`${t}\``);if(r===`ls`||r===`tree`||r===`find`)return a(`List files`,`Listing files: \`${t}\``);if(r===`cd`||r===`pwd`)return a(`Check the working folder`,`Checking or changing the current folder: \`${t}\``);if(r===`echo`||r===`printf`)return a(`Print a message`,`Printing a message: \`${t}\``);if(r===`curl`||r===`wget`)return a(`Download from the internet`,`Downloading something from the internet: \`${t}\``);if(r===`kill`||r===`pkill`)return a(`Stop a running program`,`Stopping a running program: \`${t}\``);if(r===`git`)return new Set([`status`,`log`,`diff`,`show`,`branch`,`remote`,`blame`,`config`]).has(i)?a(`Check git history`,`Reading git information (\`git ${i}\`) — no changes are made.`):i===`add`||i===`restore`||i===`reset`?a(`Stage or unstage changes`,`Preparing changes for commit (\`git ${i}\`).`):i===`commit`?a(`Save a checkpoint`,`Saving a snapshot of your changes to git history.`):i===`push`?a(`Send code to the remote`,`Uploading your commits to the remote git repository (e.g. GitHub).`):i===`pull`||i===`fetch`?a(`Get latest from the remote`,`Downloading the newest commits from the remote repository.`):i===`checkout`||i===`switch`?a(`Switch git branch`,`Switching which version of the code is loaded (\`git ${i}\`).`):i===`merge`||i===`rebase`?a(`Combine git branches`,`Combining changes from another branch (\`git ${i}\`).`):a(`Use git`,`Running a git command: \`${t}\``);if(r===`npm`||r===`bun`||r===`pnpm`||r===`yarn`){if(i===`install`||i===`i`||i===`add`)return a(`Install packages`,`Downloading project dependencies from the internet (\`${r} ${i}\`).`);if(i===`run`)return a(`Run a project script`,`Running a project script: \`${t}\``);if(i===`test`)return a(`Run automated tests`,`Running the project's automated tests.`);if(i===`build`)return a(`Build the project`,`Compiling the project for release.`)}return r===`pip`||r===`pip3`||r===`uv`?a(`Install Python packages`,`Installing Python packages: \`${t}\``):r===`pytest`||r===`jest`||r===`vitest`||r===`mocha`||r===`bun`&&i===`test`?a(`Run automated tests`,`Running automated tests: \`${t}\``):r===`docker`||r===`podman`?a(`Use Docker`,`Running a container command: \`${t}\``):r===`ssh`||r===`scp`||r===`rsync`?a(`Talk to another machine`,`Connecting to another computer over the network: \`${t}\``):a(`Run a terminal command`,`Running in the terminal: \`${t}\``)}function yi(e,t){let n=e??``,r=n.toLowerCase(),i=ui(n),a=null;try{let e=JSON.parse(t);e&&typeof e==`object`&&!Array.isArray(e)&&(a=e)}catch{}if(r===`__daemon`){let e=a?.event,t=a?.detail;return typeof e==`string`&&e.length>0?{headline:`SigmaShake itself`,detail:`SigmaShake ${e===`start`?`started`:e===`stop`?`stopped`:e}${typeof t==`string`&&t.length>0?` — ${t}`:``}.`}:{headline:`SigmaShake itself`,detail:`A SigmaShake lifecycle event.`}}if(!a)return{headline:i,detail:`${i}.`};if(r===`bash`||r===`shell`||r===`run_command`||r===`exec`||r===`run_shell_command`){let e=mi(a);return e?vi(e):{headline:i,detail:`Running a terminal command.`}}if(r===`read`||r===`read_file`||r===`view_file`||r===`cat`||r===`view`){let e=pi(a);return e?{headline:i,detail:`Reading the file \`${_i(e)}\` so it can understand the current code. No changes are made.`}:{headline:i,detail:`Reading a file. No changes are made.`}}if(r===`write`||r===`write_to_file`||r===`create_file`){let e=pi(a);return e?{headline:`Save changes to a file`,detail:`Creating or overwriting the file \`${_i(e)}\`. This will replace anything that was there before.`}:{headline:i,detail:`Creating or overwriting a file.`}}if(r===`edit`||r===`multiedit`||r===`patch`||r===`apply_patch`||r===`replace`){let e=pi(a);return e?{headline:i,detail:`Editing the file \`${_i(e)}\` — changing specific parts of it without rewriting the whole thing.`}:{headline:i,detail:`Editing a file in place.`}}if(r===`grep`||r===`ripgrep`||r===`search`||r===`search_codebase`){let e=hi(a);return e?{headline:i,detail:`Searching the project for the text "${e}".`}:{headline:i,detail:`Searching the project for matching text.`}}if(r===`glob`||r===`find`||r===`list_files`||r===`ls`){let e=hi(a)??pi(a);return e?{headline:i,detail:`Looking for files matching "${e}".`}:{headline:i,detail:`Looking for files in the project.`}}if(r===`webfetch`||r===`fetch`||r===`browser_action`){let e=gi(a);return e?{headline:i,detail:`Reading a webpage from the internet: ${e}`}:{headline:i,detail:`Reading a webpage from the internet.`}}if(r===`websearch`||r===`search_web`){let e=hi(a);return e?{headline:i,detail:`Searching the web for "${e}".`}:{headline:i,detail:`Searching the web.`}}return r===`agent`||r===`spawn`?{headline:i,detail:`Asking a separate helper AI to investigate something on its own, then report back. Helps keep this conversation focused.`}:r===`task`||r===`todowrite`||r===`todo_write`?{headline:i,detail:`Updating its internal to-do list so it can keep track of progress on a multi-step task.`}:{headline:i,detail:`${i}.`}}var bi=jt(`relative font-mono text-[11px] overflow-hidden border bg-[var(--color-surface-1)] border-[var(--color-line-1)] rounded-sm`,{variants:{density:{compact:``,roomy:`text-[12px]`}},defaultVariants:{density:`compact`}}),xi={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`},Si={allow:`text-emerald-300`,block:`text-red-300`,ask:`text-amber-300`,log:`text-violet-300`,force:`text-sky-300`,shadow:`text-[var(--color-fg-3)]`};function Ci(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function wi(e){return e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:e<1e9?`${(e/1e6).toFixed(2)} ms`:`${(e/1e9).toFixed(2)} s`}function Ti(e){return e.variant===`raw`?(0,G.jsx)(Di,{...e}):(0,G.jsx)(Ei,{...e})}function Ei({bursts:e,windowSize:t=60,filterDecision:n,filterClient:r,className:i,density:a,height:o=260}){let[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),u=(0,_.useMemo)(()=>{let i=e;n&&(i=i.filter(e=>e.decision===n)),r&&(i=i.filter(e=>e.client===r));let a=i.slice(-t),o=Array(a.length);for(let e=0;e<a.length;e++)o[e]=a[a.length-1-e];return o},[e,n,r,t]);s?l.current===null&&(l.current=u):l.current=null;let d=s&&l.current?l.current:u,f=(0,_.useRef)(null),p=(0,_.useRef)(0);return(0,_.useLayoutEffect)(()=>{if(s)return;let e=d[0];if(!e||e.ts_ms===p.current)return;p.current=e.ts_ms;let t=f.current;t&&(st()||Tt(t,{translateX:[-10,0],opacity:[0,1],duration:220,ease:`outExpo`}))},[d,s]),(0,G.jsxs)(`div`,{className:W(bi({density:a,className:i})),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,G.jsx)(`div`,{className:`overflow-auto`,style:{height:o},children:d.length===0?(0,G.jsx)(`div`,{className:`px-3 py-4 text-[var(--color-fg-4)]`,children:`— waiting for events —`}):d.map((e,t)=>{let n=e.input_preview&&e.input_preview.length>0?e.input_preview:e.rule_id?`rule: ${e.rule_id}`:`—`;return(0,G.jsxs)(`div`,{ref:t===0?f:void 0,className:`telemetry-row grid items-center gap-2 px-3 py-1 border-b border-[var(--color-line-0)] last:border-b-0 hover:bg-[var(--color-surface-2)]`,style:{gridTemplateColumns:`90px 56px minmax(80px, 130px) minmax(0, 1fr) 70px 80px`,borderLeft:`3px solid ${xi[e.decision]??`#666`}`},children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:Ci(e.ts_ms)}),(0,G.jsx)(`span`,{className:W(`uppercase tracking-wide font-medium`,Si[e.decision]??`text-[var(--color-fg-2)]`),children:e.decision}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,title:e.tool?`${e.tool} — ${ui(e.tool)}`:`unknown tool`,children:e.tool||`—`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] truncate`,title:n,children:n}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums text-right`,children:wi(e.duration_ns)}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-right`,title:e.client,children:e.client})]},e.audit_id??`${e.ts_ms}:${e.tool}`)})}),s?(0,G.jsx)(Oi,{}):null]})}function Di({lines:e,windowSize:t=300,className:n,density:r,height:i=260}){let[a,o]=(0,_.useState)(!1),s=(0,_.useRef)(null),c=(0,_.useMemo)(()=>{let n=e.slice(-t),r=Array(n.length);for(let e=0;e<n.length;e++)r[e]=n[n.length-1-e];return r},[e,t]);a?s.current===null&&(s.current=c):s.current=null;let l=a&&s.current?s.current:c;return(0,G.jsxs)(`div`,{className:W(bi({density:r,className:n})),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,G.jsx)(`div`,{className:`overflow-auto px-3 py-2 leading-relaxed text-[var(--color-fg-2)] whitespace-pre`,style:{height:i},children:l.length===0?(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`— empty —`}):l.map((e,t)=>(0,G.jsx)(`div`,{className:`hover:bg-[var(--color-surface-2)]`,children:e},`${t}:${e.slice(0,40)}`))}),a?(0,G.jsx)(Oi,{}):null]})}function Oi(){return(0,G.jsx)(`span`,{className:`absolute top-1 right-2 text-[10px] uppercase tracking-wider font-mono text-[var(--color-brand)] bg-[var(--color-surface-0)] px-1.5 py-0.5 border border-[var(--color-brand)]/40 rounded-sm`,children:`paused`})}var ki=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Ai=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ji=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Mi=e=>{let t=ji(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ni={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Pi=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Fi=(0,_.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,_.createElement)(`svg`,{ref:c,...Ni,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ki(`lucide`,i),...!a&&!Pi(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(a)?a:[a]])),Ii=(e,t)=>{let n=(0,_.forwardRef)(({className:n,...r},i)=>(0,_.createElement)(Fi,{ref:i,iconNode:t,className:ki(`lucide-${Ai(Mi(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Mi(e),n},Li=Ii(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ri=Ii(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),zi=Ii(`grip-horizontal`,[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]),Bi=Ii(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Vi=Ii(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Hi=Ii(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Ui=Ii(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Wi=Ii(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Gi=Ii(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ki=[`hero-metrics`,`graph`,`latency-trace`,`throughput`,`decision-mix`,`telemetry-feed`,`system-pulse`,`pending-approvals`,`recent-blocks`],qi={"hero-metrics":`Hero metrics`,graph:`Graph intelligence`,"latency-trace":`Latency trace`,throughput:`Throughput`,"decision-mix":`Decision mix`,"telemetry-feed":`Telemetry feed`,"system-pulse":`System pulse`,"pending-approvals":`Pending approvals`,"recent-blocks":`Recent blocks`},Ji={"hero-metrics":{minW:6,minH:2,defaultW:12,defaultH:2},graph:{minW:4,minH:3,defaultW:8,defaultH:5},"latency-trace":{minW:4,minH:3,defaultW:8,defaultH:4},throughput:{minW:2,minH:2,defaultW:4,defaultH:2},"decision-mix":{minW:2,minH:2,defaultW:4,defaultH:2},"telemetry-feed":{minW:6,minH:3,defaultW:12,defaultH:4},"system-pulse":{minW:4,minH:3,defaultW:12,defaultH:3},"pending-approvals":{minW:3,minH:2,defaultW:6,defaultH:3},"recent-blocks":{minW:3,minH:2,defaultW:6,defaultH:3}};function Yi({panel:e,isEditing:t,children:n,drag:r}){let i=(0,_.useRef)(null),a={gridColumn:`${e.x+1} / span ${e.w}`,gridRow:`${e.y+1} / span ${e.h}`};return(0,G.jsxs)(`div`,{ref:i,className:`grid-panel ${t?`grid-panel--edit`:``}`,style:a,role:t?`region`:void 0,"aria-label":t?qi[e.id]:void 0,tabIndex:t?0:void 0,onKeyDown:t?t=>r.onPanelKeyDown(t,e.id):void 0,"data-panel-id":e.id,children:[t&&(0,G.jsx)(`button`,{type:`button`,className:`grid-panel__drag-handle`,title:`Drag ${qi[e.id]} (or Arrow keys)`,"aria-label":`Drag ${qi[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onDragPointerDown(t,e.id,n)},children:(0,G.jsx)(zi,{size:12,strokeWidth:2})}),(0,G.jsx)(`div`,{className:`grid-panel__content`,"data-reveal":t?void 0:``,children:n}),t&&(0,G.jsx)(`button`,{type:`button`,className:`grid-panel__resize-handle`,title:`Resize ${qi[e.id]} (or Shift+Arrow keys)`,"aria-label":`Resize ${qi[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onResizePointerDown(t,e.id,n)},children:(0,G.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,"aria-hidden":!0,children:[(0,G.jsx)(`path`,{d:`M10 0 L10 10 L0 10 Z`,fill:`currentColor`,fillOpacity:`0.4`}),(0,G.jsx)(`path`,{d:`M3 10 L10 3 M6 10 L10 6 M9 10 L10 9`,stroke:`currentColor`,strokeWidth:`0.8`,fill:`none`})]})})]})}var Xi=(0,_.memo)(Yi);function Zi(e){let t=getComputedStyle(e),n=e.getBoundingClientRect(),r=parseFloat(t.rowGap||t.gap||`0`)||0,i=r*11;return{cellWidthPx:(n.width-i)/12+r,cellHeightPx:72+r}}function Qi(e){let t=(0,_.useRef)(null),n=(0,_.useRef)(e);n.current=e;let r=(0,_.useCallback)(()=>{let e=t.current;if(e){e.element.style.transform=``,e.element.style.width=``,e.element.style.height=``,e.element.style.zIndex=``,e.element.classList.remove(`grid-panel--dragging`),e.element.classList.remove(`grid-panel--resizing`);try{e.element.releasePointerCapture(e.pointerId)}catch{}t.current=null}},[]);(0,_.useEffect)(()=>{function e(e){let n=t.current;if(!n||e.pointerId!==n.pointerId)return;let r=e.clientX-n.startPointerX,i=e.clientY-n.startPointerY;if(n.mode===`drag`)n.element.style.transform=`translate3d(${r}px, ${i}px, 0)`;else{let e=Ji[n.startPanel.id],t=e.minW*n.cellWidthPx-n.cellWidthPx+40,a=e.minH*n.cellHeightPx-n.cellHeightPx+40,o=Math.max(t,n.startRectW+r),s=Math.max(a,n.startRectH+i);n.element.style.width=`${o}px`,n.element.style.height=`${s}px`}}function i(e,t,n){let r=Ji[e.startPanel.id];if(e.mode===`drag`){let r=Math.round(t/e.cellWidthPx),i=Math.round(n/e.cellHeightPx),a=e.startPanel.x+r,o=e.startPanel.y+i;return a<0&&(a=0),a+e.startPanel.w>12&&(a=12-e.startPanel.w),o<0&&(o=0),{id:e.id,x:a,y:o,w:e.startPanel.w,h:e.startPanel.h}}let i=Math.round(t/e.cellWidthPx),a=Math.round(n/e.cellHeightPx),o=e.startPanel.w+i,s=e.startPanel.h+a;return o<r.minW&&(o=r.minW),s<r.minH&&(s=r.minH),e.startPanel.x+o>12&&(o=12-e.startPanel.x),{id:e.id,x:e.startPanel.x,y:e.startPanel.y,w:o,h:s}}function a(e){let a=t.current;if(!a||e.pointerId!==a.pointerId)return;let o=i(a,e.clientX-a.startPointerX,e.clientY-a.startPointerY);r(),o.x===a.startPanel.x&&o.y===a.startPanel.y&&o.w===a.startPanel.w&&o.h===a.startPanel.h||n.current.onCommit(o)}function o(e){let n=t.current;!n||e.pointerId!==n.pointerId||r()}function s(e){e.key===`Escape`&&t.current&&r()}function c(){document.visibilityState===`hidden`&&t.current&&r()}return document.addEventListener(`pointermove`,e),document.addEventListener(`pointerup`,a),document.addEventListener(`pointercancel`,o),document.addEventListener(`keydown`,s),document.addEventListener(`visibilitychange`,c),()=>{document.removeEventListener(`pointermove`,e),document.removeEventListener(`pointerup`,a),document.removeEventListener(`pointercancel`,o),document.removeEventListener(`keydown`,s),document.removeEventListener(`visibilitychange`,c),t.current&&r()}},[r]);let i=(0,_.useCallback)((e,r,i,a)=>{if(!n.current.enabled||t.current)return;let o=n.current.getPanel(r),s=n.current.gridRef.current;if(!o||!s)return;e.preventDefault(),e.stopPropagation();let{cellWidthPx:c,cellHeightPx:l}=Zi(s),u=i.getBoundingClientRect();t.current={id:r,mode:a,startPointerX:e.clientX,startPointerY:e.clientY,startPanel:o,element:i,cellWidthPx:c,cellHeightPx:l,pointerId:e.pointerId,startRectW:u.width,startRectH:u.height},i.classList.add(a===`drag`?`grid-panel--dragging`:`grid-panel--resizing`),i.style.zIndex=`10`;try{i.setPointerCapture(e.pointerId)}catch{}},[]);return{onDragPointerDown:(0,_.useCallback)((e,t,n)=>i(e,t,n,`drag`),[i]),onResizePointerDown:(0,_.useCallback)((e,t,n)=>i(e,t,n,`resize`),[i]),onPanelKeyDown:(0,_.useCallback)((e,t)=>{if(!n.current.enabled)return;let r=n.current.getPanel(t);if(!r)return;let i=e.shiftKey,a=0,o=0;switch(e.key){case`ArrowLeft`:a=-1;break;case`ArrowRight`:a=1;break;case`ArrowUp`:o=-1;break;case`ArrowDown`:o=1;break;default:return}e.preventDefault(),e.stopPropagation();let s=Ji[t];if(i){let e=r.w+a,i=r.h+o;if(e<s.minW&&(e=s.minW),i<s.minH&&(i=s.minH),r.x+e>12&&(e=12-r.x),e===r.w&&i===r.h)return;n.current.onCommit({id:t,x:r.x,y:r.y,w:e,h:i})}else{let e=r.x+a,i=r.y+o;if(e<0&&(e=0),e+r.w>12&&(e=12-r.w),i<0&&(i=0),e===r.x&&i===r.y)return;n.current.onCommit({id:t,x:e,y:i,w:r.w,h:r.h})}},[]),isGesturing:(0,_.useCallback)(()=>t.current!==null,[])}}function $i(e,t){return e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y}function ea(e){return{id:e.id,x:e.x,y:e.y,w:e.w,h:e.h}}function ta(e,t){let n=[ea(e)],r=t.map(ea);r.sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y);for(let e of r){for(;;){let t=!1;for(let r of n)if($i(e,r)){let n=r.y+r.h;n>e.y&&(e.y=n,t=!0)}if(!t)break}n.push(e)}return n}function na(e){if(e.length===0)return[];let t=[...e].map(ea).sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y),n=[];for(let e of t){let t=!0;for(;t;){t=!1;for(let r of n)$i(e,r)&&(e.y=r.y+r.h,t=!0)}n.push(e)}return n}function ra(e,t,n){let r=e.findIndex(e=>e.id===t);if(r===-1)return{panels:e.map(ea)};let i=ta({id:e[r].id,x:n.x,y:n.y,w:n.w,h:n.h},e.filter((e,t)=>t!==r)),a=new Map(i.map(e=>[e.id,e]));return{panels:na(e.map(e=>a.get(e.id)).filter(Boolean))}}function ia({panels:e,isEditing:t,renderers:n,onPanelsChange:r}){let i=(0,_.useRef)(null),a=(0,_.useRef)(e);a.current=e;let o=(0,_.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n);return t},[e]),s=Qi({gridRef:i,getPanel:(0,_.useCallback)(e=>o.get(e),[o]),onCommit:(0,_.useCallback)(e=>{let t=a.current,{panels:n}=ra(t,e.id,{x:e.x,y:e.y,w:e.w,h:e.h});r(n)},[r]),enabled:t});return(0,G.jsx)(`div`,{ref:i,className:`grid-layout ${t?`grid-layout--editing`:``}`,"aria-live":t?`polite`:void 0,children:e.map(e=>(0,G.jsx)(Xi,{panel:e,isEditing:t,drag:s,children:n[e.id]()},e.id))})}function aa({manager:e,isEditing:t,onToggleEditing:n}){let{config:r,activeLayout:i,canAddUserLayout:a,saveError:o,selectLayout:s,saveAs:c,renameActive:l,deleteLayout:u,resetActive:d,exportConfig:f,importConfig:p}=e,[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(``),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(i.name),[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(!1),ee=(0,_.useRef)(null);(0,_.useEffect)(()=>{w(i.name)},[i.name]),(0,_.useEffect)(()=>{o&&h(o)},[o]),(0,_.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>h(null),4e3);return()=>clearTimeout(e)},[m]);function te(){y.trim()&&(c(y.trim()),b(``),v(!1),h(`Saved "${y.trim()}"`))}function k(){C.trim()&&(l(C.trim()),S(!1),h(`Renamed`))}function A(){let e=i.name;u(i.id),O(!1),h(`Deleted "${e}"`)}function ne(){d(),E(!1),h(`Reset to default`)}function re(){let e=f(),t=new Blob([e],{type:`application/json`}),n=URL.createObjectURL(t),r=new Date().toISOString().slice(0,10),i=document.createElement(`a`);i.href=n,i.download=`ssg-layout-${r}.json`,i.click(),URL.revokeObjectURL(n),h(`Layout exported`)}function ie(e){let t=e.target.files?.[0];e.target.value=``,t&&t.text().then(e=>{h(p(e).message)}).catch(()=>h(`Import failed: could not read file`))}return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`overline shrink-0`,children:`layout`}),(0,G.jsxs)(`select`,{value:r.activeLayoutId,onChange:e=>s(e.target.value),className:`bg-[var(--color-surface-2)] border border-[var(--color-line-1)] rounded-sm px-2 py-1 text-[11px] font-mono text-[var(--color-fg-1)] hover:border-[var(--color-line-2)] focus:outline-none focus:ring-1 focus:ring-[var(--color-brand)] cursor-pointer`,"aria-label":`Select layout`,children:[(0,G.jsx)(`optgroup`,{label:`Built-in`,children:r.layouts.filter(e=>e.builtIn).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))}),r.layouts.some(e=>!e.builtIn)&&(0,G.jsx)(`optgroup`,{label:`Your layouts`,children:r.layouts.filter(e=>!e.builtIn).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),i.builtIn&&(0,G.jsx)(`span`,{className:`chip text-[var(--color-fg-3)]`,title:`Built-in preset`,children:`built-in`})]}),(0,G.jsx)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>v(!0),disabled:!a,title:a?`Save the current arrangement as a new preset`:`Layout limit reached — delete one first`,children:[(0,G.jsx)(Hi,{size:11,strokeWidth:2.25}),`Save as`]}),!i.builtIn&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>{w(i.name),S(!0)},children:[(0,G.jsx)(Bi,{size:11,strokeWidth:2.25}),`Rename`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>O(!0),children:[(0,G.jsx)(Ui,{size:11,strokeWidth:2.25}),`Delete`]})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>E(!0),title:`Replace the current layout with the Default preset`,children:[(0,G.jsx)(Vi,{size:11,strokeWidth:2.25}),`Reset`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:re,title:`Download current layouts as JSON`,children:[(0,G.jsx)(Ri,{size:11,strokeWidth:2.25}),`Export`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>ee.current?.click(),title:`Load layouts from a JSON file`,children:[(0,G.jsx)(Wi,{size:11,strokeWidth:2.25}),`Import`]}),(0,G.jsx)(`input`,{ref:ee,type:`file`,accept:`application/json,.json`,onChange:ie,className:`hidden`,"aria-hidden":!0}),(0,G.jsxs)(Y,{variant:`primary`,size:`sm`,onClick:()=>n(!1),children:[(0,G.jsx)(Li,{size:11,strokeWidth:2.5}),`Done`]})]}):(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>n(!0),children:[(0,G.jsx)(Bi,{size:11,strokeWidth:2.25}),`Edit layout`]})}),g&&(0,G.jsx)(oa,{title:`Save layout as`,value:y,placeholder:`My dashboard`,onChange:b,onConfirm:te,onCancel:()=>{v(!1),b(``)},confirmLabel:`Save`}),x&&(0,G.jsx)(oa,{title:`Rename layout`,value:C,placeholder:i.name,onChange:w,onConfirm:k,onCancel:()=>S(!1),confirmLabel:`Rename`}),T&&(0,G.jsx)(sa,{title:`Reset this layout?`,body:`The current arrangement will be replaced with the Default preset. Saved layouts are not affected.`,confirmLabel:`Reset`,onConfirm:ne,onCancel:()=>E(!1),destructive:!1}),D&&(0,G.jsx)(sa,{title:`Delete "${i.name}"?`,body:`This layout will be removed. You can always recreate it via Save as.`,confirmLabel:`Delete`,onConfirm:A,onCancel:()=>O(!1),destructive:!0}),m&&(0,G.jsx)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 -translate-x-1/2 z-50 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-3)] px-3 py-2 text-[11px] font-mono text-[var(--color-fg-1)] shadow-lg`,children:m})]})}function oa({title:e,value:t,placeholder:n,onChange:r,onConfirm:i,onCancel:a,confirmLabel:o}){return(0,G.jsx)(`div`,{role:`dialog`,"aria-modal":!0,"aria-label":e,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:a,children:(0,G.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`w-80 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-2)] p-4`,children:[(0,G.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,G.jsx)(`input`,{value:t,onChange:e=>r(e.target.value),placeholder:n,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&i(),e.key===`Escape`&&a()},className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] rounded-sm px-2 py-1.5 text-[13px] font-mono text-[var(--color-fg-1)] focus:outline-none focus:border-[var(--color-brand)]`}),(0,G.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:a,children:[(0,G.jsx)(Gi,{size:11,strokeWidth:2.25}),`Cancel`]}),(0,G.jsx)(Y,{variant:`primary`,size:`sm`,onClick:i,children:o})]})]})})}function sa({title:e,body:t,confirmLabel:n,destructive:r,onConfirm:i,onCancel:a}){return(0,G.jsx)(`div`,{role:`dialog`,"aria-modal":!0,"aria-label":e,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:a,children:(0,G.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`w-96 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-2)] p-4`,children:[(0,G.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:t}),(0,G.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),(0,G.jsx)(Y,{variant:r?`danger`:`primary`,size:`sm`,onClick:i,children:n})]})]})})}var ca={default:`builtin-default`,focusLatency:`builtin-focus-latency`,focusApprovals:`builtin-focus-approvals`,compact:`builtin-compact`},la={id:ca.default,name:`Default`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`graph`,x:0,y:2,w:8,h:5},{id:`latency-trace`,x:8,y:2,w:4,h:3},{id:`throughput`,x:8,y:5,w:2,h:2},{id:`decision-mix`,x:10,y:5,w:2,h:2},{id:`telemetry-feed`,x:0,y:7,w:12,h:3},{id:`system-pulse`,x:0,y:10,w:12,h:3},{id:`pending-approvals`,x:0,y:13,w:6,h:3},{id:`recent-blocks`,x:6,y:13,w:6,h:3}]},ua={id:ca.focusLatency,name:`Focus · Latency`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`latency-trace`,x:0,y:2,w:8,h:5},{id:`graph`,x:8,y:2,w:4,h:5},{id:`throughput`,x:0,y:7,w:6,h:2},{id:`decision-mix`,x:6,y:7,w:6,h:2},{id:`system-pulse`,x:0,y:9,w:12,h:3},{id:`telemetry-feed`,x:0,y:12,w:12,h:3},{id:`pending-approvals`,x:0,y:15,w:6,h:2},{id:`recent-blocks`,x:6,y:15,w:6,h:2}]},da={id:ca.focusApprovals,name:`Focus · Approvals`,builtIn:!0,panels:[{id:`pending-approvals`,x:0,y:0,w:8,h:4},{id:`graph`,x:8,y:0,w:4,h:4},{id:`recent-blocks`,x:0,y:4,w:12,h:3},{id:`hero-metrics`,x:0,y:7,w:12,h:2},{id:`latency-trace`,x:0,y:9,w:6,h:3},{id:`telemetry-feed`,x:6,y:9,w:6,h:3},{id:`system-pulse`,x:0,y:12,w:12,h:3},{id:`throughput`,x:0,y:15,w:6,h:2},{id:`decision-mix`,x:6,y:15,w:6,h:2}]},fa={id:ca.compact,name:`Compact`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`graph`,x:0,y:2,w:8,h:3},{id:`latency-trace`,x:8,y:2,w:4,h:3},{id:`system-pulse`,x:0,y:5,w:12,h:3},{id:`throughput`,x:0,y:8,w:4,h:2},{id:`decision-mix`,x:4,y:8,w:4,h:2},{id:`telemetry-feed`,x:0,y:10,w:12,h:3},{id:`pending-approvals`,x:0,y:13,w:6,h:2},{id:`recent-blocks`,x:6,y:13,w:6,h:2}]},pa=Object.freeze([la,ua,da,fa]);function ma(){return pa.map(e=>({...e,panels:e.panels.map(e=>({...e}))}))}function ha(){return{version:1,activeLayoutId:ca.default,layouts:ma()}}function ga(e){return Object.values(ca).includes(e)}var _a=new Set(Ki),va=new Set(pa.map(e=>e.id));function ya(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ba(e,t,n,r){if(typeof e!=`number`||!Number.isFinite(e))return r;let i=Math.floor(e);return i<t?t:i>n?n:i}function xa(e,t){let n=(typeof e==`string`?e:``).replace(/[\u0000-\u001F\u007F]/g,``).trim();return n.length===0?t:n.slice(0,40)}function Sa(e){let t=e.find(e=>e.id===`system-pulse`);if(!t||t.h>=3)return e;let n=3-t.h,r=t.y+t.h;return e.map(e=>e.id===`system-pulse`?{...e,h:3}:e.y>=r?{...e,y:e.y+n}:e)}function Ca(e){for(let t=0;t<e.length;t++){let n=e[t];for(let r=t+1;r<e.length;r++){let t=e[r];if(n.x<t.x+t.w&&n.x+n.w>t.x&&n.y<t.y+t.h&&n.y+n.h>t.y)return!0}}return!1}function wa(e){if(!ya(e))return null;let{id:t}=e;if(typeof t!=`string`||!_a.has(t))return null;let n=t,r=Ji[n],i=ba(e.x,0,11,0),a=ba(e.w,r.minW,12,r.defaultW);return{id:n,x:i+a>12?12-a:i,y:ba(e.y,0,999,0),w:a,h:ba(e.h,r.minH,99,r.defaultH)}}function Ta(e,t){if(!ya(e))return{layout:null,droppedPanels:0};let n=typeof e.id==`string`&&e.id.length>0?e.id:null;if(!n)return{layout:null,droppedPanels:0};let r=xa(e.name,t),i=va.has(n),a=e.panels;if(!Array.isArray(a))return{layout:null,droppedPanels:0};let o=new Set,s=[],c=0;for(let e of a){let t=wa(e);if(!t){c+=1;continue}if(o.has(t.id)){c+=1;continue}o.add(t.id),s.push(t)}return s.length===0?{layout:null,droppedPanels:c}:{layout:{id:n,name:r,builtIn:i,panels:Sa(s)},droppedPanels:c}}function Ea(e){if(!ya(e)||e.version!==1)return{config:ha(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let t=e.layouts;if(!Array.isArray(t)||t.length===0)return{config:ha(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let n=[],r=0,i=0,a=0;for(let e of t){let{layout:t,droppedPanels:o}=Ta(e,`Layout ${n.length+1}`);if(r+=o,t){if(!t.builtIn){if(i>=12){a+=1;continue}i+=1}n.push(t)}}if(n.length===0)return{config:ha(),droppedPanels:r,prunedLayouts:a,fellBackToDefault:!0};let o=new Set(n.map(e=>e.id));for(let e of pa)o.has(e.id)||n.push({...e,panels:e.panels.map(e=>({...e}))});let s=new Map(pa.map(e=>[e.id,e])),c=0,l=0;for(let e=0;e<n.length;e++){let t=n[e],r=s.get(t.id);if(!r)continue;if(Ca(t.panels)){n[e]={...r,panels:r.panels.map(e=>({...e}))},l+=1;continue}let i=new Set(t.panels.map(e=>e.id)),a=r.panels.filter(e=>!i.has(e.id));if(a.length===0)continue;let o=t.panels.reduce((e,t)=>Math.max(e,t.y+t.h),0);for(let e of a)t.panels.push({id:e.id,x:0,y:o,w:e.w,h:e.h}),o+=e.h,c+=1}let u=e.activeLayoutId;return{config:{version:1,activeLayoutId:typeof u==`string`&&n.some(e=>e.id===u)?u:pa[0].id,layouts:n},droppedPanels:r,prunedLayouts:a,fellBackToDefault:!1,backfilledPanels:c,refreshedBuiltins:l}}var Da=`ssg:dashboard-layout:v1`,Oa=300;function ka(){if(typeof localStorage>`u`)return null;try{let e=`__ssg_probe__`;return localStorage.setItem(e,`1`),localStorage.removeItem(e),localStorage}catch{return null}}var Aa;function ja(){return Aa===void 0&&(Aa=ka()),Aa}function Ma(){let e=ja();if(!e)return{config:ha(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let t=null;try{t=e.getItem(Da)}catch{t=null}if(t===null)return{config:ha(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let n=null;try{n=JSON.parse(t)}catch{return{config:ha(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0}}return Ea(n)}var Na=null,Pa=null,Fa=null;function Ia(e){return Fa=e,()=>{Fa===e&&(Fa=null)}}function La(e){Fa?Fa(e):typeof console<`u`&&console.warn(`[ssg-layout]`,e)}function Ra(){if(Pa=null,!Na)return;let e=ja();if(!e){Na=null;return}let t=Na;Na=null;try{e.setItem(Da,JSON.stringify(t))}catch(e){e instanceof Error&&e.name===`QuotaExceededError`?La(`Layout storage full — save skipped`):La(`Layout save failed: ${e instanceof Error?e.message:String(e)}`)}}function za(e){Na=e,Pa===null&&(Pa=setTimeout(Ra,Oa))}function Ba(e){Na=e,Pa!==null&&(clearTimeout(Pa),Pa=null),Ra()}function Va(e){let t=0;for(let n of e.layouts)n.builtIn||(t+=1);return t}function Ha(e){return e.map(e=>({...e}))}function Ua(){return`user-`+Math.random().toString(16).slice(2,11)}function Wa(){let[e,t]=(0,_.useState)(()=>Ma().config),[n,r]=(0,_.useState)(null);(0,_.useEffect)(()=>Ia(e=>r(e)),[]),(0,_.useEffect)(()=>{za(e)},[e]);let i=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0]??ma()[0],a=Va(e)<12,o=(0,_.useCallback)(e=>{t(t=>t.layouts.some(t=>t.id===e)?{...t,activeLayoutId:e}:t)},[]),s=(0,_.useCallback)(e=>{t(t=>{let n=t.activeLayoutId;return{...t,layouts:t.layouts.map(t=>t.id===n?{...t,panels:Ha(e)}:t)}})},[]),c=(0,_.useCallback)(e=>{let n=e.trim();n&&t(e=>{if(Va(e)>=12)return e;let t=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0];if(!t)return e;let r={id:Ua(),name:n,builtIn:!1,panels:Ha(t.panels)};return{...e,activeLayoutId:r.id,layouts:[...e.layouts,r]}})},[]),l=(0,_.useCallback)(e=>{let n=e.trim();n&&t(e=>({...e,layouts:e.layouts.map(t=>t.id===e.activeLayoutId&&!t.builtIn?{...t,name:n}:t)}))},[]),u=(0,_.useCallback)(e=>{t(t=>{let n=t.layouts.find(t=>t.id===e);if(!n||n.builtIn)return t;let r=t.layouts.filter(t=>t.id!==e),i=t.activeLayoutId===e?r[0]?.id??pa[0].id:t.activeLayoutId;return{...t,activeLayoutId:i,layouts:r}})},[]),d=(0,_.useCallback)(()=>{t(e=>{let t=e.layouts.find(t=>t.id===e.activeLayoutId);if(!t)return e;let n=ga(t.id)?pa.find(e=>e.id===t.id):pa[0];return n?{...e,layouts:e.layouts.map(e=>e.id===t.id?{...e,panels:Ha(n.panels)}:e)}:e})},[]),f=(0,_.useCallback)(()=>JSON.stringify(e,null,2),[e]),p=(0,_.useCallback)(e=>{let n;try{n=JSON.parse(e)}catch{return{ok:!1,message:`Import failed: not valid JSON`}}let r=Ea(n);if(r.fellBackToDefault)return{ok:!1,message:`Import rejected: schema invalid, no changes applied`};t(r.config),Ba(r.config);let i=[`Layout imported`];return r.droppedPanels>0&&i.push(`${r.droppedPanels} unrecognized panel(s) dropped`),r.prunedLayouts>0&&i.push(`${r.prunedLayouts} excess layout(s) pruned`),{ok:!0,message:i.join(` · `)}},[]);return(0,_.useEffect)(()=>{e.layouts.length===0&&t(ha())},[e.layouts.length]),{config:e,activeLayout:i,canAddUserLayout:a,saveError:n,selectLayout:o,updateActivePanels:s,saveAs:c,renameActive:l,deleteLayout:u,resetActive:d,exportConfig:f,importConfig:p}}var Ga=new Set([`compact`,`end`,`stop`,`subagent-stop`,`close`]),Ka=Object.freeze([`session-lifecycle`]);function qa(e){(0,_.useEffect)(()=>we(Ka),[]);let t=(0,_.useSyncExternalStore)(ge,_e),[n,r]=(0,_.useState)(new Map),i=(0,_.useRef)(0);(0,_.useEffect)(()=>{let e=t.lifecycleRing;if(e.length<=i.current)return;let n=e.slice(i.current);i.current=e.length,Ja(n,r)},[t.lifecycleRing]);let a=(0,_.useRef)(void 0);return(0,_.useEffect)(()=>{!e||e===a.current||(a.current=e,Ja(e,r))},[e]),{closedAt:n,isBurstActive(e,t){let r=n.get(e);return r===void 0||t>r}}}function Ja(e,t){let n=e.filter(e=>Ga.has(e.event));n.length!==0&&t(e=>{let t=!1,r=new Map(e);for(let e of n){let n=r.get(e.session_key);(n===void 0||e.ts_ms>n)&&(r.set(e.session_key,e.ts_ms),t=!0)}return t?r:e})}function Ya(e){return`${e.client}:${e.agent_id??`solo`}`}var Xa=Object.freeze({allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`}),Za=5*6e4,Qa=1200,$a=30*6e4,eo=1.4;function to(e){let t=(e.input_tokens??0)+(e.output_tokens??0);if(t<=0)return 6;let n=6+Math.log2(1+t/50)*eo;return n<4?4:n>16?16:n}function no(e){let t=(e.input_tokens??0)+(e.output_tokens??0);if(t<=0)return 0;let n=Math.log2(1+t/50)*eo/10;return n<=0?0:n>=1?1:n}function X(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function ro(e,t){if(t<=0)return e;let n=e.startsWith(`#`)?e.slice(1):e;if(n.length!==6)return e;let r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);if(Number.isNaN(r)||Number.isNaN(i)||Number.isNaN(a))return e;let o=Math.max(r,i,a);if(o===0)return e;let s=t>1?1:t,c=(255-o)*s,l=Math.round(r+r/o*c),u=Math.round(i+i/o*c),d=Math.round(a+a/o*c),f=e=>(e<0?0:e>255?255:e).toString(16).padStart(2,`0`);return`#${f(l)}${f(u)}${f(d)}`}var io=1440*60*1e3,ao=1800*1e3,oo=3e3;function so(e,t){if(e.length===0)return t.slice();if(t.length===0)return e.slice();let n=new Set,r=[],i=0,a=0;for(;i<e.length&&a<t.length;){let o=e[i].ts_ms<=t[a].ts_ms?e[i++]:t[a++],s=co(o);n.has(s)||(n.add(s),r.push(o))}for(;i<e.length;i++){let t=co(e[i]);n.has(t)||(n.add(t),r.push(e[i]))}for(;a<t.length;a++){let e=co(t[a]);n.has(e)||(n.add(e),r.push(t[a]))}return r}function co(e){return e.audit_id??`${e.ts_ms}:${e.tool}:${e.client}`}function lo(e,t){if(e.length===0)return t.slice();if(t.length===0)return e.slice();let n=new Set,r=[];for(let i of[...e,...t]){let e=`${i.session_key}:${i.ts_ms}:${i.event}`;n.has(e)||(n.add(e),r.push(i))}return r}function uo(e,t,n,r=200,i=$a,a=12){let o=new Map,s=new Map;for(let r of e){if(r.ts_ms>n)break;let e=Ya(r);if(!t(e,r.ts_ms))continue;let i=o.get(e);i?i.push(r):o.set(e,[r]);let a=s.get(e);(a===void 0||r.ts_ms>a)&&s.set(e,r.ts_ms)}let c=n-i,l=[];for(let[e,t]of s)t<c&&l.push(e);for(let e of l)o.delete(e),s.delete(e);if(o.size>a){let e=new Set(Array.from(s.entries()).sort((e,t)=>t[1]-e[1]).slice(0,a).map(([e])=>e));for(let t of[...o.keys()])e.has(t)||o.delete(t)}let u=[];for(let e of o.values()){let t=e.length>r?e.slice(-r):e;u.push(...t)}return u.sort((e,t)=>e.ts_ms-t.ts_ms),u}function fo(e={}){let t=e.windowMs??12e4,n=Oe(),[r,i]=(0,_.useState)(()=>({mode:`live`,playhead_ms:Date.now(),window_ms:t})),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(!1);(0,_.useEffect)(()=>{p.current=n.length>0||a.length>0},[n,a]),(0,_.useEffect)(()=>{if(r.mode!==`live`)return;let e=()=>{if(!p.current)return;let e=Date.now();i(t=>t.mode===`live`?t.playhead_ms===e?t:{...t,playhead_ms:e}:t)};e();let t=setInterval(e,500);return()=>clearInterval(t)},[r.mode]);let m=(0,_.useMemo)(()=>so(a,n),[a,n]),{isBurstActive:h}=qa(s),g=(0,_.useMemo)(()=>uo(m,h,r.playhead_ms),[m,h,r.playhead_ms]),v=m.length>0?m[0].ts_ms:r.playhead_ms,y=m.length>0?m[m.length-1].ts_ms:r.playhead_ms,b=(0,_.useCallback)(async e=>{if(f.current)return;let t=v,n=Math.min(t,(d.current??Date.now())-e);if(n>=t)return;let r=new AbortController;f.current=r,u(!0);try{let e=await fetch(`/api/json/graph/backfill?since_ms=${n}&until_ms=${t}&limit=500`,{signal:r.signal,credentials:`same-origin`});if(!e.ok)throw Error(`backfill ${e.status}`);let i=await e.json();Array.isArray(i.bursts)&&i.bursts.length>0&&o(e=>{let t=so(e,i.bursts);return t.length>oo?t.slice(-oo):t}),Array.isArray(i.lifecycle)&&i.lifecycle.length>0&&c(e=>lo(e,i.lifecycle)),d.current=n}catch(e){e.name!==`AbortError`&&console.warn(`[graph] backfill failed`,e)}finally{f.current=null,u(!1)}},[v]);(0,_.useEffect)(()=>{r.playhead_ms-v<r.window_ms*.5&&b(Za)},[r.mode,r.playhead_ms,r.window_ms,v,b]);let x=(0,_.useRef)(!1);(0,_.useEffect)(()=>{x.current||(x.current=!0,b(ao))},[]),(0,_.useEffect)(()=>()=>{f.current?.abort(),f.current=null},[]);let S=(0,_.useCallback)(e=>{i(t=>e===`live`?{...t,mode:`live`}:{...t,mode:e})},[]),C=(0,_.useCallback)(e=>{i(t=>({...t,mode:t.mode===`live`?`scrubbing`:t.mode,playhead_ms:e}))},[]),w=(0,_.useCallback)(e=>{i(t=>({...t,window_ms:Math.max(1e3,e)}))},[]),T=(0,_.useCallback)(()=>{i(e=>({...e,mode:`live`,playhead_ms:Date.now()}))},[]),E=(0,_.useCallback)(()=>{i(e=>({...e,mode:`live`,playhead_ms:Date.now(),window_ms:io})),b(io)},[b]);return{snapshot:(0,_.useMemo)(()=>({bursts:g,playback:r,oldest_known_ms:v,newest_known_ms:y,loading_backfill:l}),[g,r,v,y,l]),allBursts:m,setMode:S,setPlayhead:C,setWindow:w,jumpToLive:T,requestBackfill:b,jumpTo24h:E}}var po=2*Math.PI/6e4,mo=2.3999632297286535,ho=16,go=22,_o=.4,vo=14,yo=8,bo=24;function xo(e,t,n){let r=new Map;for(let t of e){if(t.exitingAt!=null)continue;let e=r.get(t.session);e?e.push(t):r.set(t.session,[t])}if(r.size===0)return;for(let e of r.values())e.sort((e,t)=>e.ts_ms-t.ts_ms);let i=Math.min(t,n)-bo,a=Array.from(r.keys()).sort(),o=a.length,s=0;for(let e of r.values())e.length>s&&(s=e.length);let c=Math.max(1,Math.min(go,(i-ho)/Math.max(1,s-1))),l=ho,u=ho+c,d=(l*l+u*u-vo*vo)/(2*l*u),f=Math.max(_o,Math.acos(Math.min(1,Math.max(-1,d))));if(o<=yo)for(let e=0;e<o;e++){let t=a[e];if(t===void 0)continue;let n=r.get(t);if(!n)continue;let i=e*2*Math.PI/o;for(let e=0;e<n.length;e++){let t=n[e];t&&(t.slotPhi=i+e*f,t.slotR=ho+e*c)}}else{let e=[];for(let t of r.values())for(let n of t)e.push(n);e.sort((e,t)=>e.ts_ms-t.ts_ms);let t=Math.max(1,Math.min(go,(i-ho)/Math.max(1,e.length-1)));for(let n=0;n<e.length;n++){let r=e[n];r&&(r.slotPhi=n*mo,r.slotR=ho+n*t)}}}function So(e,t,n,r){for(let i of e)i.exitingAt??(i.slotR==null||i.slotPhi==null||(i.x=t+i.slotR*Math.cos(i.slotPhi+r),i.y=n+i.slotR*Math.sin(i.slotPhi+r)))}function Co(e){let t=new Map;for(let n of e){let e=t.get(n.session);e?(e.x+=n.x,e.y+=n.y,e.n+=1):t.set(n.session,{x:n.x,y:n.y,n:1})}for(let e of t.values())e.x/=e.n,e.y/=e.n;return t}function wo(e,t){let n=[],r=new Map;for(let t of e){let e=r.get(t.session);e?e.push(t):r.set(t.session,[t])}for(let e of r.values()){e.sort((e,t)=>e.ts_ms-t.ts_ms);for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r];!i||!a||a.ts_ms-i.ts_ms<=t&&n.push({source:i.id,target:a.id,kind:`session`})}}return n}var To=`SSG_AUDIO`,Eo=`SSG_AUDIO_VOLUME`,Do=12,Oo=null,ko=null,Ao=!1,jo=.18,Mo=[],No=!1;function Po(){if(typeof localStorage>`u`)return{enabled:!1,volume:.18};let e=localStorage.getItem(To)===`1`,t=localStorage.getItem(Eo);return{enabled:e,volume:t?Math.max(0,Math.min(1,parseFloat(t))):.18}}function Fo(){typeof localStorage>`u`||(localStorage.setItem(To,Ao?`1`:`0`),localStorage.setItem(Eo,jo.toString()))}function Io(){if(typeof window>`u`)return null;if(Oo)return Oo;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;try{Oo=new e,ko=Oo.createGain(),ko.gain.value=jo,ko.connect(Oo.destination),typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{Oo&&(document.visibilityState===`hidden`?Oo.suspend():Oo.resume())})}catch{Oo=null,ko=null}return Oo}function Lo(){if(No)return;No=!0;let{enabled:e,volume:t}=Po();Ao=e,jo=t}function Ro(){return Lo(),Ao}function zo(e){if(Lo(),Ao=e,Fo(),e){let e=Io();e&&e.state===`suspended`&&e.resume()}}function Bo(){return Lo(),jo}function Vo(e){Lo(),jo=Math.max(0,Math.min(1,e)),Fo(),ko&&(ko.gain.value=jo)}function Ho(e){for(;Mo.length>0&&e-Mo[0]>1e3;)Mo.shift();return Mo.length>=Do?!1:(Mo.push(e),!0)}var Uo={allow:{type:`sine`,freq:660,durationMs:90,peak:.6},block:{type:`square`,freq:110,durationMs:130,peak:1},force:{type:`sawtooth`,freq:220,freqSweep:440,durationMs:170,peak:.8},ask:{type:`triangle`,freq:880,durationMs:110,peak:.55},log:{type:`sine`,freq:1320,durationMs:30,peak:.35},shadow:{type:`sine`,freq:220,durationMs:60,peak:.18}};function Wo(e){if(Lo(),!Ao||typeof document<`u`&&document.visibilityState===`hidden`)return;let t=Io();if(!t||!ko)return;t.state===`suspended`&&t.resume().catch(()=>{});let n=t.currentTime;if(!Ho(performance.now()))return;let r=Uo[e],i=t.createOscillator();i.type=r.type,i.frequency.value=r.freq,r.freqSweep!==void 0&&(i.frequency.setValueAtTime(r.freq,n),i.frequency.exponentialRampToValueAtTime(Math.max(1,r.freqSweep),n+r.durationMs/1e3));let a=t.createGain();a.gain.setValueAtTime(0,n),a.gain.linearRampToValueAtTime(r.peak,n+.005),a.gain.exponentialRampToValueAtTime(1e-4,n+r.durationMs/1e3),i.connect(a),a.connect(ko),i.start(n),i.stop(n+r.durationMs/1e3+.05),i.onended=()=>{try{i.disconnect(),a.disconnect()}catch{}}}function Go(e){let t=e|0;return()=>{t=t+1831565813|0;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}var Ko={"claude-code":`C`,"claude-code-ide":`C`,cursor:`>`,copilot:`H`,codex:`X`,pi:`P`,gemini:`G`,antigravity:`A`};function qo(e){return Ko[e.toLowerCase()]??`.`}function Jo(e){let t=0;for(let n=0;n<e.length;n++)t=Math.imul(t,31)+e.charCodeAt(n)|0;return(t>>>0)%360}function Yo(e,t,n){for(let[r,i]of t){let{x:t,y:a,n:o}=i,s=50+Math.min(o,12)*7,c=Jo(r),l=n.get(r),u;l&&Math.abs(l.x-t)<2&&Math.abs(l.y-a)<2&&l.r===s?u=l.grad:(u=e.createRadialGradient(t,a,0,t,a,s),u.addColorStop(0,`hsla(${c},80%,55%,0.10)`),u.addColorStop(1,`hsla(${c},80%,55%,0)`),n.set(r,{grad:u,x:t,y:a,r:s})),e.fillStyle=u,e.beginPath(),e.arc(t,a,s,0,Math.PI*2),e.fill()}for(let e of n.keys())t.has(e)||n.delete(e)}function Xo(e,t,n,r,i,a,o){let s=8+a*r,c=Math.max(0,1-r)*o;c<=0||(e.save(),e.globalAlpha=c,e.fillStyle=i,e.beginPath(),e.arc(t,n,s,0,Math.PI*2),e.fill(),e.restore())}var Zo=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,Qo=`bold 10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,$o=new Map,es=256;function ts(e,t){let n=$o.get(t);if(n!==void 0)return n;let r=e.measureText(t).width;if($o.size>=es){let e=$o.keys().next().value;e!==void 0&&$o.delete(e)}return $o.set(t,r),r}function ns(e,t,n,r,i,a,o){let s=(r.split(`:`)[0]??r).slice(0,18),c=qo(s),l=Jo(r),u=Xa[o]??`#6b7280`;e.save(),e.textAlign=`center`;let d=`[${c}] ${s}`,f=`${i.length>14?i.slice(0,14):i} · ${a}`;e.font=Qo;let p=ts(e,d);e.font=Zo;let m=ts(e,f),h=Math.max(p,m)+10;e.globalAlpha=.82,e.fillStyle=`hsla(${l},25%,5%,0.92)`,e.fillRect(t-h/2,n-2,h,28),e.globalAlpha=.92,e.fillStyle=`hsla(${l},78%,70%,1)`,e.font=Qo,e.fillText(d,t,n+10),e.globalAlpha=.72,e.fillStyle=u,e.font=Zo,e.fillText(f,t,n+21),e.restore()}var rs=`bold 13px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,is=`bold 10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;function as(e){if((!Number.isFinite(e)||e<0)&&(e=0),e<6e4)return`${(e/1e3).toFixed(3)}s`;if(e<36e5)return`${Math.floor(e/6e4)}:${(e%6e4/1e3).toFixed(3).padStart(6,`0`)}`;let t=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4),r=(e%6e4/1e3).toFixed(1).padStart(4,`0`);return`${t}:${String(n).padStart(2,`0`)}:${r}`}function os(e,t,n,r,i){e.save(),e.textAlign=`center`,e.font=is,e.globalAlpha=.7,e.fillStyle=`hsla(${i},78%,72%,0.55)`,e.fillText(`uptime`,t,n),e.font=rs,e.globalAlpha=.96,e.fillStyle=`hsla(${i},78%,82%,1)`,e.fillText(as(r),t,n+13),e.restore()}function ss(e,t,n,r){e.save(),e.textAlign=`right`,e.font=is,e.fillStyle=`rgba(148, 163, 184, 0.55)`,e.globalAlpha=.85,e.fillText(`LIVE`,t,n),e.font=`bold 16px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,e.fillStyle=`#e0e7ff`,e.globalAlpha=.92,e.fillText(as(r),t,n+16),e.restore()}function cs(e,t,n,r,i,a,o){let s=r-t,c=i-n;if(Math.sqrt(s*s+c*c)<24)return;let l=Math.atan2(c,s),u=3.5,d=r-Math.cos(l)*9,f=i-Math.sin(l)*9;e.save(),e.globalAlpha=o*.85,e.fillStyle=a,e.translate(d,f),e.rotate(l),e.beginPath(),e.moveTo(0,0),e.lineTo(-6,-u),e.lineTo(-6,u),e.closePath(),e.fill(),e.restore()}var ls={Read:`▣`,Write:`✎`,Edit:`✎`,MultiEdit:`✎`,NotebookEdit:`✎`,NotebookRead:`▣`,Glob:`✦`,Grep:`✦`,LS:`⊞`,Find:`✦`,ToolSearch:`⊕`,Bash:`$`,Skill:`◈`,WebFetch:`⌬`,WebSearch:`⌬`,Agent:`◇`,Task:`⌘`,TaskCreate:`⌘`,TaskUpdate:`⌘`,TaskList:`⌘`,TaskGet:`⌘`,TaskOutput:`⌘`,TaskStop:`⌘`,TodoWrite:`✓`,TodoRead:`✓`,AskUserQuestion:`?`,EnterPlanMode:`◐`,ExitPlanMode:`◑`,EnterWorktree:`⎇`,ExitWorktree:`⎇`,PushNotification:`⏰`,ScheduleWakeup:`⏰`,CronCreate:`⏰`,CronList:`⏰`,CronDelete:`⏰`,RemoteTrigger:`↗`,Monitor:`◉`};function us(e){if(!e)return`·`;let t=e.lastIndexOf(`__`);return ls[t>=0?e.slice(t+2):e]??ls[e]??`·`}var ds=820,fs=e=>Math.min(1,e),ps=620,ms=e=>1-(1-e)**3,hs=$e({stiffness:120,damping:22,mass:1}),gs=1800;function _s(e){return e<=2?Math.min(window.devicePixelRatio,2):e<=4?Math.min(window.devicePixelRatio,1.5):Math.min(window.devicePixelRatio,1)}function vs(e){return e<=2?1:e<=4?2:3}function ys(e){return e<=2?24:e<=4?12:6}function bs(e){return e<=4}var xs=!1,Ss=!1;function Cs(){if(Ss||typeof window>`u`)return;Ss=!0;let e=navigator;typeof e.getBattery==`function`&&e.getBattery().then(e=>{let t=()=>{xs=!e.charging&&e.level<.2};t(),e.addEventListener(`chargingchange`,t),e.addEventListener(`levelchange`,t)}).catch(()=>{})}function ws(){return typeof window>`u`?!1:window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches||navigator.connection?.saveData?!0:xs}var Ts=typeof window<`u`&&new URLSearchParams(window.location.search).get(`fullrate`)===`1`,Es=typeof window<`u`&&new URLSearchParams(window.location.search).get(`rotate`)!==`0`,Ds=typeof window<`u`&&new URLSearchParams(window.location.search).get(`probe`)===`1`;function Os(e,t,n,r){let i=new Map;for(let t of e)i.set(t.id,t);let a=new Set,o=[];for(let e=0;e<t.length;e++){let s=t[e],c=s.audit_id??`${s.ts_ms}:${s.tool}:${e}`;a.add(c);let l=i.get(c);if(l)l.burst=s,l.exitingAt=void 0,o.push(l);else{let t=Go(s.ts_ms^e),i=n*.6+(t()-.5)*60,a=r/2+(t()-.5)*40,l=Ya(s);o.push({id:c,burst:s,ts_ms:s.ts_ms,session:l,x:i,y:a,vx:0,vy:0,age:0,tx:i,ty:a})}}let s=performance.now();for(let t of e)a.has(t.id)||(t.exitingAt??=s,s-t.exitingAt<1200&&o.push(t));return o}function ks(e){let{bursts:t,paused:n,selectedId:r,onSelect:i,burstSeq:a,compact:o=!1,activePanelCount:s=1,labelDensity:c=`normal`,onFrameTime:l}=e,u=(0,_.useRef)(l);u.current=l;let d=(0,_.useRef)(c);d.current=c;let f=(0,_.useRef)(null),p=(0,_.useRef)([]),m=(0,_.useRef)([]),h=(0,_.useRef)(null),g=(0,_.useRef)(null),v=(0,_.useRef)(0),y=(0,_.useRef)(0),b=(0,_.useRef)(0),x=(0,_.useRef)(new Map),S=(0,_.useRef)(new Set),C=(0,_.useRef)(new Set),w=(0,_.useRef)(new Set),[T,E]=(0,_.useState)({w:0,h:0}),D=(0,_.useRef)(0),O=(0,_.useRef)(0),ee=(0,_.useRef)(null),te=(0,_.useRef)(Date.now()),k=(0,_.useRef)(new Map),A=(0,_.useRef)({frame:0,cache:null});(0,_.useLayoutEffect)(()=>{let e=f.current?.parentElement;if(!e)return;let t=e.getBoundingClientRect();t.width>0&&t.height>0&&E({w:Math.max(40,t.width),h:Math.max(40,t.height)});let n=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;e<=0||n<=0||E({w:Math.max(40,e),h:Math.max(40,n)})}});return n.observe(e),()=>n.disconnect()},[]),(0,_.useEffect)(()=>{if(T.w<=0||T.h<=0)return;A.current.frame=0;let e=new Map;for(let t of p.current)e.set(t.id,t);p.current=Os(p.current,t,T.w,T.h),xo(p.current,T.w/2,T.h/2);let n=Es&&!st()?performance.now()*po:0;for(let t of p.current){if(t.slotR==null||t.slotPhi==null)continue;let r=T.w/2+t.slotR*Math.cos(t.slotPhi+n),i=T.h/2+t.slotR*Math.sin(t.slotPhi+n),a=!e.has(t.id),o=Math.hypot(t.x-r,t.y-i);(a||o>40)&&(t.x=r,t.y=i,t.vx=0,t.vy=0)}if(m.current=wo(p.current,1/0),!st())for(let t=0;t<p.current.length;t++){let n=p.current[t];!n||e.has(n.id)||Wo(n.burst.decision)}let r=p.current.reduce((e,t)=>t.ts_ms>e?t.ts_ms:e,0);y.current=Math.max(performance.now()+ds,performance.now()+Qa,r+1500),v.current=performance.now()},[t,T.w,T.h,a]),(0,_.useEffect)(()=>{let e=f.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;Cs();let i=performance.now(),a=0,c=0,l=0,g=.1,[_,E]=yr(()=>{let f=performance.now();if(!Ts&&ws()){if(a^=1,a===1)return}else a!==0&&(a=0);if(!Ts){let e=vs(s);if(e>1&&(O.current=(O.current+1)%e,O.current!==0))return}let _=performance.now(),E=_<y.current,D=_-v.current<200,ne=_-b.current>500,re=st(),ie=Es&&!re;if(!ie&&!E&&!D&&!ne)return;b.current=_;let j=f,M=Math.min(50,j-i);i=j;let ae=p.current,oe=m.current,se=ie?performance.now()*po:0;So(ae,T.w/2,T.h/2,se);for(let e of ae)e.age<1&&(e.age=Math.min(1,e.age+M/ds));let N=typeof window<`u`?_s(s):1,P=T.w,F=T.h;(e.width!==P*N||e.height!==F*N)&&(e.width=P*N,e.height=F*N,e.style.width=`${P}px`,e.style.height=`${F}px`,t.scale(N,N)),t.fillStyle=`#0a0a0f`,t.fillRect(0,0,P,F);let ce=`${P}x${F}`,I=ee.current?.key===ce?ee.current.grad:null;if(I||(I=t.createRadialGradient(P/2,F/2,0,P/2,F/2,Math.max(P,F)/1.2),I.addColorStop(0,`rgba(56, 189, 248, 0.06)`),I.addColorStop(1,`rgba(0, 0, 0, 0)`),ee.current={key:ce,grad:I}),t.fillStyle=I,t.fillRect(0,0,P,F),!o){let e=A.current;(e.frame++%6==0||e.cache===null)&&(e.cache=Co(ae));let n=e.cache;if(Yo(t,n,k.current),!re){let e=new Map,r=new Map;for(let t of ae)t.exitingAt??(r.set(t.session,(r.get(t.session)??0)+1),e.set(t.session,t));let i=new Map;for(let e of ae){if(e.exitingAt!=null)continue;let t=i.get(e.session);(t===void 0||e.ts_ms<t)&&i.set(e.session,e.ts_ms)}let a=Date.now();for(let[o,s]of n){let n=e.get(o),c=r.get(o)??0;if(!n||c===0)continue;let l=50+Math.min(s.n,12)*7;ns(t,s.x,s.y-l-34,o,n.burst.tool,c,n.burst.decision);let u=i.get(o);if(u!==void 0){let e=Math.max(0,a-u);os(t,s.x,s.y+l+12,e,Jo(o))}}}}let le=e=>e.exitingAt==null?1:Math.max(0,1-(j-e.exitingAt)/Qa),ue=ys(s),de=bs(s)&&!re,fe=S.current;if(fe.clear(),n)for(let e of ae)fe.add(e.id);else{let e=0;for(let t=ae.length-1;t>=0&&e<ue;t--){let n=ae[t];!n||n.exitingAt!=null||(fe.add(n.id),e++)}}let pe=x.current;pe.clear();for(let e of ae)pe.set(e.id,e);t.lineWidth=2,t.lineCap=`round`,t.lineJoin=`round`;for(let e=0;e<oe.length;e++){let n=oe[e],r=pe.get(n.source),i=pe.get(n.target);if(!r||!i||fe.has(r.id)||fe.has(i.id))continue;let a=Math.min(le(r),le(i));a<=0||(t.globalAlpha=a,t.strokeStyle=(Xa[i.burst.decision]??`#6b7280`)+`aa`,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(i.x,i.y),t.stroke())}t.globalAlpha=1;let me=d.current===`large`,he=me?`10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`8px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;for(let e=0;e<oe.length;e++){let n=oe[e],r=pe.get(n.source),i=pe.get(n.target);if(!r||!i||!fe.has(r.id)&&!fe.has(i.id))continue;let a=Xa[i.burst.decision]??`#6b7280`,o=Math.min(le(r),le(i));if(o<=0)continue;if(t.globalAlpha=o,t.strokeStyle=a+`aa`,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(i.x,i.y),t.stroke(),t.globalAlpha=1,de){let n=(j/gs+e*.618033)%1,s=r.x+(i.x-r.x)*n,c=r.y+(i.y-r.y)*n;t.save(),t.globalAlpha=o*Math.sin(n*Math.PI)*.9,t.fillStyle=a,t.beginPath(),t.arc(s,c,2.5,0,Math.PI*2),t.fill(),t.restore(),cs(t,r.x,r.y,i.x,i.y,a,o)}let s=i.ts_ms-r.ts_ms,c=s<1e3?`${s}ms`:s<6e4?`${(s/1e3).toFixed(1)}s`:`${Math.floor(s/6e4)}m${Math.floor(s%6e4/1e3)}s`,l=(r.x+i.x)/2,u=(r.y+i.y)/2;t.save(),t.globalAlpha=o*.65,t.font=he,t.fillStyle=`#94a3b8`,t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(`${e+1} · ${c}`,l,u-(me?8:7)),t.restore()}t.globalAlpha=1;let L=C.current;L.clear();let ge=w.current;ge.clear();let _e=d.current===`large`?10:5;{let e=0;for(let t=ae.length-1;t>=0;t--){let r=ae[t];!r||r.exitingAt!=null||(!n&&e<3&&L.add(r.id),e<_e&&ge.add(r.id),e++)}}let ve=r,ye=h.current;for(let e of ae){let r=le(e);if(r<=0)continue;t.globalAlpha=r;let i=Math.min(1,e.age),a=fs(i);e.displayedRadius=o?4:to(e.burst);let s=e.displayedRadius,c=o?s*a:(s+2*Math.min(1,e.age))*a,l=Xa[e.burst.decision]??`#6b7280`,u=ro(l,no(e.burst));if((e.id===ve||e.id===ye)&&(t.beginPath(),t.arc(e.x,e.y,c+6,0,Math.PI*2),t.fillStyle=u+`33`,t.fill()),de&&(e.burst.decision===`allow`?Xo(t,e.x,e.y,i,`#22c55e`,14,.3):e.burst.decision===`ask`&&Xo(t,e.x,e.y,i,`#f59e0b`,14,.45)),de&&(e.burst.decision===`block`||e.burst.decision===`force`)){let n=i*ds;if(n<ps){let r=n/ps,i=c+16*ms(r),a=Math.max(0,1-r)*.75;t.beginPath(),t.arc(e.x,e.y,i,0,Math.PI*2),t.strokeStyle=u+Math.floor(a*255).toString(16).padStart(2,`0`),t.lineWidth=1.5,t.stroke()}}if(!re&&L.has(e.id)&&(t.beginPath(),t.arc(e.x,e.y,c+2,0,Math.PI*2),t.fillStyle=u+`33`,t.fill()),t.beginPath(),t.arc(e.x,e.y,Math.max(.1,c),0,Math.PI*2),t.fillStyle=u,t.fill(),t.strokeStyle=l,t.lineWidth=1.5,t.beginPath(),t.arc(e.x,e.y,Math.max(.1,c),0,Math.PI*2),t.stroke(),ge.has(e.id)&&(n||fe.has(e.id))){let n=d.current===`large`;t.font=n?`11px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.textAlign=`center`,t.fillStyle=u+`cc`,t.fillText(qo(e.burst.client),e.x,e.y-c-(n?4:3));let i=n?16:12,a=e.burst.tool.length>i?e.burst.tool.slice(0,i):e.burst.tool,o=us(e.burst.tool),s=o===`·`?a:`${o} ${a}`;t.fillStyle=u+`88`,t.fillText(s,e.x,e.y+c+(n?13:11));let l=e.burst.input_tokens??0,f=e.burst.output_tokens??0;(l>0||f>0)&&(t.globalAlpha=r*(fe.has(e.id)?.8:.35),t.font=n?`10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`8px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.fillStyle=`#94a3b8`,t.textAlign=`center`,t.fillText(`↓${X(l)} ↑${X(f)}`,e.x,e.y+c+(n?25:21)),t.globalAlpha=r),t.textAlign=`left`}(e.id===ve||e.id===ye)&&(t.font=`11px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.fillStyle=`#e0e7ff`,t.fillText(e.burst.tool,e.x+c+6,e.y+3))}if(t.globalAlpha=1,de&&ae.length>0){let e=null;for(let t=ae.length-1;t>=0;t--)if(ae[t].exitingAt==null){e=ae[t];break}let n=e?Date.now()-e.ts_ms:1/0,r=5e3;if(e&&n<=r){let i=Math.max(0,1-n/r),a=1100,o=j%a/a,s=14+hs.fn(o)*8,c=Math.max(0,1-o)*.85*i,l=Math.floor(c*255).toString(16).padStart(2,`0`);t.beginPath(),t.arc(e.x,e.y,s,0,Math.PI*2),t.strokeStyle=`#38bdf8${l}`,t.lineWidth=2,t.stroke();let u=j%800/800*Math.PI*2,d=100/360*Math.PI*2,f=.85*i,p=Math.floor(f*255).toString(16).padStart(2,`0`);t.save(),t.beginPath(),t.arc(e.x,e.y,22,u,u+d),t.strokeStyle=`#38bdf8${p}`,t.lineWidth=2.5,t.lineCap=`round`,t.stroke(),t.restore()}}if(!o&&P>220&&ss(t,P-12,12,Date.now()-te.current),Ds){let t,n=0;for(let e of ae)e.exitingAt??(n++,t||=e);e.dataset.probeCount=String(n),e.dataset.probeX0=(t?.x??0).toFixed(2),e.dataset.probeY0=(t?.y??0).toFixed(2)}c=c===0?M:c*(1-g)+M*g;let be=u.current;be&&j-l>250&&(l=j,be(c))});return D.current=E,O.current=E,_},[n,r,T.w,T.h,o,s]);function ne(e,t){let n=f.current;if(!n)return null;let r=n.getBoundingClientRect(),i=e-r.left,a=t-r.top,o=null,s=200;for(let e of p.current){let t=e.x-i,n=e.y-a,r=t*t+n*n;r<s&&(s=r,o=e.id)}return o}return(0,G.jsxs)(`div`,{className:`relative w-full h-full rounded-sm border border-[var(--color-line-1)] overflow-hidden bg-black`,children:[(0,G.jsx)(`canvas`,{ref:f,className:`block w-full h-full cursor-crosshair`,onMouseMove:e=>{let t=ne(e.clientX,e.clientY);h.current=t;let n=g.current;if(!n)return;if(!t){n.style.display=`none`;return}let r=p.current.find(e=>e.id===t);if(!r){n.style.display=`none`;return}let i=r.burst,a=Xa[i.decision]??`#6b7280`,o;if(i.complete_duration_ms!=null&&i.complete_duration_ms>0){let e=i.complete_duration_ms;o=e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(0)}ms`}else{let e=i.duration_ns/1e6;o=e<1?`${(e*1e3).toFixed(0)}µs`:`${e.toFixed(1)}ms`}let s=[];i.input_tokens!=null&&s.push(`↓${X(i.input_tokens)}`),i.output_tokens!=null&&s.push(`↑${X(i.output_tokens)}`);let c=i.input_preview?` · "${i.input_preview.length>45?i.input_preview.slice(0,45)+`…`:i.input_preview}"`:``,l=s.length>0?` · ${s.join(` `)}`:``;n.textContent=`${i.decision} ${i.tool} · ${o}${l}${c}`,n.style.borderColor=a,n.style.color=a;let u=Math.min(e.clientX+14,window.innerWidth-420),d=Math.max(8,e.clientY-36);n.style.left=`${u}px`,n.style.top=`${d}px`,n.style.display=`block`},onMouseLeave:()=>{h.current=null,g.current&&(g.current.style.display=`none`)},onClick:e=>{i(ne(e.clientX,e.clientY),{x:e.clientX,y:e.clientY})}}),t.length===0&&(0,G.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center pointer-events-none px-4 text-center`,children:[(0,G.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`graph · idle`}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] max-w-[260px]`,children:[`Each dot = one tool call an AI agent made.`,(0,G.jsx)(`br`,{}),`Color = the ssg rule decision · line = same agent's sequence.`]})]}),(0,G.jsx)(`div`,{ref:g,style:{display:`none`,position:`fixed`,zIndex:45,fontSize:`11px`,fontFamily:`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,padding:`4px 10px`,background:`rgba(10, 10, 15, 0.92)`,border:`1px solid`,borderRadius:`4px`,pointerEvents:`none`,whiteSpace:`nowrap`,maxWidth:`500px`,overflow:`hidden`,textOverflow:`ellipsis`}})]})}var As=3e4,js=6e4,Ms=5e3;function Ns(e,t){let n=t?e.filter(e=>Ya(e)===t):e,r=Date.now(),i=n.length>0?n[n.length-1]:null;if(!i||r-i.ts_ms>Ms||!i)return{idle:!0,client:``,tool:``,ruleId:null,decision:``,evalsPerSec:`0.0`,allowPct:0,agents:0,topRules:[]};let a=n.filter(e=>r-e.ts_ms<=As),o=a.filter(e=>e.decision===`allow`).length,s=a.length>0?Math.round(o/a.length*100):0,c=(a.length/(As/1e3)).toFixed(1),l=new Set(a.map(e=>`${e.client}:${e.agent_id??`solo`}`)).size,u=n.filter(e=>r-e.ts_ms<=js&&e.rule_id),d=new Map;for(let e of u){let t=e.rule_id;t&&d.set(t,(d.get(t)??0)+1)}let f=[...d.entries()].sort((e,t)=>t[1]-e[1]).slice(0,4).map(([e])=>e);return{idle:!1,client:i.client,tool:i.tool,ruleId:i.rule_id,decision:i.decision,evalsPerSec:c,allowPct:s,agents:l,topRules:f}}var Ps={allow:`ALLOW`,block:`BLOCK`,ask:`ASK`,log:`LOG`,force:`FORCE`,shadow:`SHADOW`},Fs={allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`};function Is({className:e,sessionKey:t}){let n=Oe(),r=ke(),i=(0,_.useRef)(-1),a=(0,_.useRef)(null),o=(0,_.useMemo)(()=>{if(i.current===r&&a.current)return a.current;i.current=r;let e=Ns(n,t);return a.current=e,e},[n,r,t]),s=o.decision?Fs[o.decision]??`#6b7280`:`#6b7280`,c=o.decision?Ps[o.decision]??o.decision:``,l=o.client?qo(o.client):``;return o.idle?(0,G.jsxs)(`div`,{className:W(`pointer-events-none select-none`,`flex items-center justify-center gap-2`,`px-4 py-2 rounded-sm`,`bg-[#0a0a0f]/95`,`border border-[var(--color-line-1,#242424)]`,`font-mono text-[11px] text-[var(--color-fg-4,#5a6071)]`,e),children:[(0,G.jsx)(`span`,{className:`status-dot bg-[var(--color-fg-4)] pulse-soft`}),(0,G.jsx)(`span`,{className:`uppercase tracking-wider`,children:`waiting for activity`})]}):(0,G.jsxs)(`div`,{className:W(`pointer-events-none select-none`,`flex flex-col gap-1 px-4 py-2.5 rounded-sm`,`bg-[#0a0a0f]/96`,`border border-[var(--color-line-1,#242424)]`,`font-mono`,!t&&`min-w-[280px] max-w-[460px]`,e),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-widest text-[var(--color-fg-4,#5a6071)]`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),(0,G.jsx)(`span`,{children:`now evaluating`}),(0,G.jsxs)(`span`,{className:`ml-auto tabular-nums`,children:[o.evalsPerSec,`/s · `,o.allowPct,`% allow · `,o.agents,` `,o.agents===1?`agent`:`agents`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px] text-[var(--color-fg-0,#f5f5f5)] tracking-tight`,children:[(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] tabular-nums`,children:[`[`,l,`]`]}),(0,G.jsx)(`span`,{className:`text-sky-300`,children:o.client}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`·`}),(0,G.jsx)(`span`,{className:`text-white font-semibold`,children:o.tool}),o.ruleId&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`->`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] text-[12px]`,children:o.ruleId})]}),(0,G.jsx)(`span`,{className:`ml-auto text-[13px] font-bold tabular-nums`,style:{color:s},children:c})]}),o.topRules.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-[var(--color-fg-4)]`,children:[(0,G.jsx)(`span`,{className:`uppercase tracking-wider text-[9px]`,children:`rules`}),o.topRules.map(e=>(0,G.jsx)(`span`,{className:`px-1 py-0.5 rounded-sm bg-[var(--color-surface-2,#121212)] text-[var(--color-fg-3)]`,children:e},e))]})]})}var Ls=(0,_.memo)(function({sessionKey:e,bursts:t,activePanelCount:n,selectedId:r,onSelect:i}){let a=t.length>0?t[t.length-1]?.ts_ms??0:0,o=e.indexOf(`:`),s=o>=0?e.slice(0,o):e,c=o>=0?e.slice(o+1):``,l=c!==``&&c!==`solo`,u=t[t.length-1],d=u?Xa[u.decision]??`#6b7280`:`#6b7280`,f=(0,_.useMemo)(()=>t.length>24?t.slice(t.length-24):t,[t]);return(0,G.jsxs)(`div`,{className:`flex flex-col min-h-0 min-w-0 rounded-sm border border-[var(--color-line-1)] bg-black/30 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1 border-b border-[var(--color-line-1)] text-[10px] font-mono shrink-0`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{background:d},title:u?`latest decision: ${u.decision}`:``}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider truncate`,children:s}),l&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate`,children:c})]}),(0,G.jsxs)(`span`,{className:`ml-auto text-[var(--color-fg-4)] tabular-nums shrink-0`,children:[t.length,`n`]})]}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0 relative`,children:(0,G.jsx)(ks,{bursts:f,paused:!1,selectedId:r,onSelect:i,burstSeq:a,compact:!0,activePanelCount:n})})]})});function Rs(e){return e<=1?1:e<=4?2:3}function zs(){let e=Oe(),t=ke(),[n,r]=(0,_.useState)(null),{isBurstActive:i}=qa(),a=(0,_.useMemo)(()=>uo(e,i,Date.now()),[e,i,t]),o=(0,_.useRef)(new Map),s=(0,_.useMemo)(()=>{let e=new Map;for(let t of a){let n=Ya(t),r=e.get(n);r?r.push(t):e.set(n,[t])}let t=o.current;for(let[n,r]of e){let i=t.get(n);i&&i.length===r.length&&i[i.length-1]===r[r.length-1]&&e.set(n,i)}return o.current=e,Array.from(e.entries()).sort((e,t)=>{let n=e[1][e[1].length-1]?.ts_ms??0;return(t[1][t[1].length-1]?.ts_ms??0)-n})},[a]),c=(0,_.useMemo)(()=>{let e=new Map;for(let t of a){let n=`${t.client}:${t.agent_id??`solo`}`,r=e.get(n);r?r.count+=1:e.set(n,{client:t.client,count:1})}return e},[a]),l=(0,_.useMemo)(()=>{let e={allow:0,block:0,ask:0,other:0};for(let t of a)t.decision===`allow`?e.allow++:t.decision===`block`||t.decision===`force`?e.block++:t.decision===`ask`?e.ask++:e.other++;return e},[a]),u=(0,_.useMemo)(()=>{let e=new Set,t=0;for(let n of a)n.rule_id&&(e.add(n.rule_id),t+=1);return{distinct:e.size,matched:t,topRule:e.values().next().value}},[a]),d=Rs(s.length);return(0,G.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,children:[(0,G.jsxs)(`header`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-[var(--color-line-1)]`,children:[(0,G.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`graph · live`}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),a.length]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] font-mono`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:Xa.allow}}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.allow}),(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Xa.block}}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.block}),(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Xa.ask}}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.ask})]}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsxs)(`span`,{className:`chip text-violet-300 border-violet-500/30`,title:`${u.matched} tool calls matched ${u.distinct} ssg ${u.distinct===1?`rule`:`rules`} in active sessions`,children:[u.distinct,` `,u.distinct===1?`rule`:`rules`]}),(0,G.jsxs)(`span`,{className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)]`,title:c.size===0?`no active agents`:Array.from(c.entries()).map(([e,t])=>`${e}: ${t.count}`).join(`
10
- `),children:[c.size,` `,c.size===1?`agent`:`agents`]}),(0,G.jsx)(`a`,{href:`/graph`,className:`text-[10px] font-mono uppercase tracking-wider text-sky-300 hover:text-sky-200`,title:`Open full /graph page`,children:`expand ↗`})]}),(0,G.jsxs)(`div`,{className:`flex-1 min-h-0 relative`,children:[s.length===0?(0,G.jsx)(ks,{bursts:a,paused:!1,selectedId:n,onSelect:r,burstSeq:t}):(0,G.jsx)(`div`,{className:`absolute inset-0 grid gap-1 p-1`,style:{gridTemplateColumns:`repeat(${d}, minmax(0, 1fr))`,gridAutoRows:`1fr`},children:s.map(([e,t])=>(0,G.jsx)(Ls,{sessionKey:e,bursts:t,activePanelCount:s.length,selectedId:n,onSelect:r},e))}),(0,G.jsx)(Is,{className:`absolute bottom-2 left-2 z-10 max-w-[calc(100%-1rem)]`})]})]})}var Bs=`ssg.sfx.enabled`;function Vs(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(Bs)===`true`}catch{return!1}}function Hs(e){if(!(typeof window>`u`))try{window.localStorage.setItem(Bs,String(e))}catch{}}function Us(e,t,n,r,i,a,o=`sine`){try{let s=e.createOscillator(),c=e.createGain(),l=i/1e3;s.type=o,s.frequency.setValueAtTime(n,e.currentTime),s.frequency.exponentialRampToValueAtTime(Math.max(1,r),e.currentTime+l),c.gain.setValueAtTime(a,e.currentTime),c.gain.exponentialRampToValueAtTime(.001,e.currentTime+l),s.connect(c),c.connect(t),s.start(e.currentTime),s.stop(e.currentTime+l+.02)}catch{}}function Ws(){let[e,t]=(0,_.useState)(Vs),n=(0,_.useRef)(null),r=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=()=>{let t=n.current;t&&(document.hidden?t.suspend().catch(()=>{}):e&&t.resume().catch(()=>{}))};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e]),{enabled:e,toggle:(0,_.useCallback)(()=>{t(e=>{let t=!e;if(Hs(t),t){if(!n.current)try{let e=new AudioContext,t=e.createGain();t.gain.value=.8,t.connect(e.destination),n.current=e,r.current=t}catch{}n.current?.resume().catch(()=>{})}else n.current?.suspend().catch(()=>{});return t})},[]),play:(0,_.useCallback)(t=>{if(!e)return;let i=n.current,a=r.current;if(!(!i||!a||i.state===`suspended`))switch(t){case`block`:Us(i,a,110,55,150,.08);break;case`force`:Us(i,a,80,40,200,.1),Us(i,a,160,80,200,.05,`square`);break;case`milestone`:{Us(i,a,660,880,100,.06);let e=i,t=a;setTimeout(()=>{e.state!==`suspended`&&Us(e,t,880,1320,100,.05)},115);break}case`record`:Us(i,a,880,1320,350,.07);break}},[e])}}var Gs=[`rules-changed`,`activity-updated`,`pending-changed`,`runtime-tick`,`limits-breach`],Ks={critical:{border:`border-l-red-500/70`,iconBg:`bg-red-500/15`,iconFg:`text-red-400`,chipBg:`bg-red-500/10`,chipFg:`text-red-300`,label:`Critical`},warning:{border:`border-l-amber-400/70`,iconBg:`bg-amber-500/15`,iconFg:`text-amber-300`,chipBg:`bg-amber-500/10`,chipFg:`text-amber-200`,label:`Heads up`},info:{border:`border-l-sky-500/70`,iconBg:`bg-sky-500/15`,iconFg:`text-sky-300`,chipBg:`bg-sky-500/10`,chipFg:`text-sky-200`,label:`Tip`}};function qs({severity:e}){return e===`critical`?(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,G.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,G.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}):e===`warning`?(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),(0,G.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}):(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,G.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`12`}),(0,G.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12.01`,y2:`8`})]})}function Js({notification:e,onAction:t}){let[n,r]=(0,_.useState)(`idle`),[i,a]=(0,_.useState)(null),o=Ks[e.severity],s=async()=>{if(e.action&&!(e.action.confirm&&!confirm(e.action.confirm))){r(`loading`),a(null);try{await t(e),r(`done`)}catch(e){r(`error`),a(e instanceof Error?e.message:String(e))}}};return(0,G.jsxs)(`div`,{className:`hig-card border-l-2 ${o.border} flex items-start gap-3 px-3 py-2.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0 mt-0.5 inline-flex items-center justify-center w-6 h-6 rounded-full ${o.iconBg} ${o.iconFg}`,"aria-hidden":!0,children:(0,G.jsx)(qs,{severity:e.severity})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`text-[9px] font-mono font-medium uppercase tracking-wider px-1.5 py-0.5 rounded ${o.chipBg} ${o.chipFg}`,children:o.label}),(0,G.jsx)(`h3`,{className:`text-[13px] font-medium text-[var(--color-fg-0)] leading-tight`,children:e.title})]}),(0,G.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:e.detail}),n===`error`&&i&&(0,G.jsxs)(`p`,{className:`mt-1.5 text-[11px] font-mono text-red-300`,children:[`Failed: `,i]}),n===`done`&&(0,G.jsx)(`p`,{className:`mt-1.5 text-[11px] font-mono text-emerald-300`,children:`✓ Done — refreshing…`})]}),(0,G.jsx)(`div`,{className:`shrink-0 self-center`,children:e.action?(0,G.jsx)(`button`,{type:`button`,onClick:s,disabled:n===`loading`||n===`done`,className:`inline-flex items-center gap-1 h-8 px-3 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-[var(--color-surface-2)] text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:bg-[var(--color-surface-3)] hover:border-[var(--color-line-2)] transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,children:n===`loading`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`animate-spin`,children:`⟳`}),` working…`]}):n===`done`?(0,G.jsx)(G.Fragment,{children:`✓ done`}):e.action.label}):e.link?(0,G.jsxs)(`a`,{href:e.link.href,className:`inline-flex items-center gap-1 h-8 px-3 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-[var(--color-surface-2)] text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:bg-[var(--color-surface-3)] hover:border-[var(--color-line-2)] transition-colors whitespace-nowrap`,children:[e.link.label,` →`]}):null})]})}function Ys({showEmptyState:e=!1,hideHeader:t=!1}={}){let n=Ae(Gs),{data:r,refetch:i}=B(`/api/json/maintenance`,[n[`rules-changed`],n[`activity-updated`],n[`pending-changed`],n[`runtime-tick`],n[`limits-breach`]]),a=async e=>{if(!e.action)return;let t=await fetch(e.action.url,{method:e.action.method,headers:{Accept:`application/json`,"Content-Type":`application/json`,...z()}});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(e||`HTTP ${t.status}`)}setTimeout(()=>i(),600)},o=r?.notifications??[];return o.length===0&&!e?null:(0,G.jsxs)(`section`,{"data-reveal":!0,children:[!t&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,G.jsx)(`h2`,{className:`overline text-[11px]`,children:o.length===0?`maintenance · all clear`:`maintenance · ${o.length} item${o.length===1?``:`s`}`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>i(),className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] transition-colors cursor-pointer`,title:`Re-check now`,children:`refresh`})]}),o.length===0?(0,G.jsxs)(`div`,{className:`hig-card border-l-2 border-l-emerald-500/60 px-4 py-5 flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`inline-flex items-center justify-center w-8 h-8 rounded-full bg-emerald-500/15 text-emerald-300 shrink-0`,children:(0,G.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M20 6L9 17l-5-5`})})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-[13px] font-medium text-[var(--color-fg-0)] leading-tight`,children:`Everything looks good`}),(0,G.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:`No drift, no capacity warnings, no stalled daemons. We'll let you know if anything changes.`})]})]}):(0,G.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,G.jsx)(Js,{notification:e,onAction:a},e.id))})]})}function Xs(e){return!Number.isFinite(e)||e<=0?`—`:e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:`${(e/1e6).toFixed(2)} ms`}async function Zs(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:z()})}var Qs=e=>!0,$s=e=>e.decision===`allow`,ec=e=>e.decision===`block`,tc=e=>e.decision===`ask`,nc=e=>e.decision===`force`,rc=e=>e.decision===`log`;function ic(){let e=new Date;return e.setHours(0,0,0,0),e.getTime()}function ac(){let e=Ae([`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`]),t=De(),n=ke(),r=Oe(),i=Ws();(0,_.useEffect)(()=>{t&&(t.decision===`block`?i.play(`block`):t.decision===`force`&&i.play(`force`))},[n]);let[a,o]=(0,_.useState)(()=>ic());(0,_.useEffect)(()=>{let e=()=>{if(document.visibilityState!==`visible`)return;let e=ic();o(t=>e===t?t:e)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let{data:s}=B(`/api/state/counters?since_ms=${a}`,[e[`counters-updated`],a]),{data:c}=B(`/api/state/runtime`,[e[`runtime-tick`]]),{data:l}=B(`/api/json/limits`,[e[`runtime-tick`]]),{data:u,refetch:d}=B(`/api/json/pending`,[e[`pending-changed`]]),{data:f}=B(`/api/json/blocked`,[e[`activity-updated`]]),p=Wa(),[m,h]=(0,_.useState)(!1),g=(0,_.useMemo)(()=>{let e=s?.allow??0,n=s?.block??0,r=s?.ask??0,i=s?.log??0,a=s?.force??0,o=e+n+r+i+a,c=t?.counters.total??0;return t&&c>=o&&t?{allow:t.counters.allow,block:t.counters.block,ask:t.counters.ask,log:t.counters.log,force:t.counters.force,shadow:t.counters.shadow,total:t.counters.total}:{allow:e,block:n,ask:r,log:i,force:a,shadow:0,total:o}},[t,s]),v=(0,_.useMemo)(()=>{if(r.length===0)return 0;let e=Date.now()-1e4;return r.filter(t=>t.ts_ms>=e).length/10},[r]),y=c?.history?.cpu_pct??[],b=c?.history?.memory_rss_mb??[],x=[],S=c?.latency,C=(0,_.useMemo)(()=>({"hero-metrics":()=>(0,G.jsx)(`div`,{className:`grid-bleed rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 h-full`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 h-full`,children:[(0,G.jsx)(kr,{label:`Total`,value:g.total,tone:`amber`,sub:t?Xs(t.duration_ns):void 0,burstRing:r,filter:Qs}),(0,G.jsx)(kr,{label:`Allow`,value:g.allow,tone:`green`,burstRing:r,filter:$s}),(0,G.jsx)(kr,{label:`Block`,value:g.block,tone:`red`,burstRing:r,filter:ec}),(0,G.jsx)(kr,{label:`Ask`,value:g.ask,tone:`amber`,burstRing:r,filter:tc}),(0,G.jsx)(kr,{label:`Force`,value:g.force,tone:`blue`,burstRing:r,filter:nc}),(0,G.jsx)(kr,{label:`Log`,value:g.log,tone:`purple`,burstRing:r,filter:rc})]})}),graph:()=>(0,G.jsx)(zs,{}),"latency-trace":()=>(0,G.jsx)($r,{latency:S,bursts:r,gaugeMaxMs:10,windowMs:3e4,trendWindowSec:60,gaugeSize:200}),throughput:()=>(0,G.jsxs)(K,{className:`h-full`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline`,children:`throughput · evals/s`}),(0,G.jsxs)(cr,{variant:`blue`,children:[v.toFixed(1),`/s`]})]}),(0,G.jsxs)(J,{children:[(0,G.jsx)(xr,{value:v,width:360,height:96,windowMs:6e4,className:`w-full`}),(0,G.jsx)(`p`,{className:`overline mt-2 text-center`,children:`60-second rolling window`})]})]}),"decision-mix":()=>(0,G.jsxs)(K,{className:`h-full`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline`,children:`decision mix`}),(0,G.jsx)(cr,{variant:`gray`,children:g.total.toLocaleString()})]}),(0,G.jsx)(J,{children:(0,G.jsx)(ni,{counters:{allow:g.allow,block:g.block,ask:g.ask,log:g.log,force:g.force,shadow:g.shadow}})})]}),"telemetry-feed":()=>(0,G.jsxs)(K,{variant:`flush`,className:`h-full flex flex-col`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline`,children:`telemetry · live · newest first`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:[`hover to pause · scroll for history · `,r.length,` events buffered`]})]}),(0,G.jsx)(J,{className:`p-0 flex-1 min-h-0`,children:(0,G.jsx)(Ti,{variant:`decision`,bursts:r,windowSize:80,height:360,className:`border-0 rounded-none`})})]}),"system-pulse":()=>(0,G.jsx)(si,{cpuPct:c?.cpu_pct??0,cpuSeries:y,cpuLimit:l?.config.cpuLimitPct,memMb:c?.memory_rss_mb??0,memSeries:b,memLimit:l?.config.memoryLimitMb,heapUsedMb:c?.heap_used_mb??0,heapTotalMb:c?.heap_total_mb??0,heapSeries:x,uptimeSec:(c?.uptime_ms??0)/1e3}),"pending-approvals":()=>(0,G.jsxs)(K,{className:`h-full`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline`,children:`pending approvals`}),(0,G.jsx)(cr,{variant:u&&u.length>0?`amber`:`gray`,children:u?.length??0})]}),(0,G.jsx)(J,{children:u&&u.length>0?(0,G.jsx)(`ul`,{className:`space-y-2`,children:u.slice(0,5).map(e=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-2 border-b border-[var(--color-line-0)] last:border-b-0 py-1.5 text-[12px] font-mono`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`text-[var(--color-fg-1)] truncate`,children:[e.toolCall.tool,` · `,e.ruleId]}),(0,G.jsx)(`div`,{className:`text-[var(--color-fg-3)] text-[11px] truncate`,children:ir(e.toolCall.tool,JSON.stringify(e.toolCall.input??{}))})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 shrink-0`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`primary`,onClick:()=>Zs(e.id,`allow`).then(d),children:`allow`}),(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,onClick:()=>Zs(e.id,`block`).then(d),children:`block`})]})]},e.id))}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no pending approvals —`})})]}),"recent-blocks":()=>(0,G.jsxs)(K,{className:`h-full`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline`,children:`recent blocks & forces`}),(0,G.jsx)(cr,{variant:f&&f.length>0?`red`:`gray`,children:f?.length??0})]}),(0,G.jsx)(J,{children:f&&f.length>0?(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:f.slice(0,6).map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-center gap-2 text-[12px] font-mono border-b border-[var(--color-line-0)] last:border-b-0 py-1.5`,children:[(0,G.jsx)(cr,{variant:e.decision===`force`?`amber`:`red`,children:e.decision}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate flex-1`,children:ir(e.tool,e.input)}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-[11px] max-w-[120px]`,children:e.rule_id??`—`})]},`${e.timestamp}-${t}`))}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no recent blocks —`})})]})}),[g,t,r,S,v,c,y,b,x,l,u,f,d]),w=Et({from:`first`,translateY:22,durationMs:640,staggerMs:80,maxStaggerMs:520});return(0,G.jsxs)(`div`,{ref:m?void 0:w,className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex-1`,children:(0,G.jsx)(aa,{manager:p,isEditing:m,onToggleEditing:h})}),(0,G.jsx)(`button`,{type:`button`,onClick:i.toggle,className:`chip cursor-pointer hover:border-sky-500/50 hover:text-sky-300 transition-colors shrink-0`,title:i.enabled?`Mute stream sounds`:`Enable stream sounds`,children:i.enabled?`SFX ON`:`SFX OFF`})]}),(0,G.jsx)(Ys,{}),(0,G.jsx)(ia,{panels:p.activeLayout.panels,isEditing:m,renderers:C,onPanelsChange:p.updateActivePanels})]})}function oc({val:e}){return e==null?(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic font-mono text-xs`,children:`null`}):typeof e==`boolean`?(0,G.jsx)(`span`,{className:`inline-block font-mono text-[10px] font-medium uppercase tracking-wider px-1.5 py-0.5 rounded-sm border ${e?`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`:`bg-red-500/8 text-red-300 border-red-500/25`}`,children:e.toString()}):typeof e==`number`?(0,G.jsx)(`span`,{className:`font-mono tabular-nums text-violet-300 text-xs`,children:e}):typeof e==`string`?e.length===0?(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic text-xs font-mono`,children:`empty string`}):e.length>200?(0,G.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 max-h-40 overflow-y-auto`,children:e}):(0,G.jsx)(`span`,{className:`font-mono text-xs text-[var(--color-fg-1)] break-all`,children:e}):(0,G.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 max-h-40 overflow-y-auto`,children:JSON.stringify(e,null,2)})}function sc({inputJson:e}){let t=[];try{let n=JSON.parse(e);n&&typeof n==`object`&&!Array.isArray(n)&&(t=Object.entries(n))}catch{return(0,G.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2`,children:e})}return t.length===0?(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs italic font-mono`,children:`no input fields`}):(0,G.jsx)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] overflow-hidden text-xs`,children:t.map(([e,t],n)=>(0,G.jsxs)(`div`,{className:`flex gap-0 ${n>0?`border-t border-[var(--color-line-0)]`:``}`,children:[(0,G.jsx)(`div`,{className:`w-40 shrink-0 px-3 py-2 bg-[var(--color-surface-0)] text-[var(--color-fg-3)] font-mono text-[11px] border-r border-[var(--color-line-0)] select-none`,children:e}),(0,G.jsx)(`div`,{className:`flex-1 min-w-0 px-3 py-2 leading-relaxed`,children:(0,G.jsx)(oc,{val:t})})]},e))})}var cc={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},lc={allow:`Allowed`,block:`Blocked`,force:`Forced`,ask:`Held`,log:`Logged`},uc={allow:`border-l-emerald-500/60`,block:`border-l-red-500/60`,force:`border-l-amber-400/60`,ask:`border-l-sky-500/60`,log:`border-l-[var(--color-line-2)]`};function dc(e){return e==null?null:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}function fc({label:e,value:t,mono:n,children:r}){return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline mb-1`,children:e}),r??(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] text-xs ${n?`font-mono`:``} break-all`,children:t??`—`})]})}function pc({text:e}){let[t,n]=(0,_.useState)(!1);return(0,G.jsx)(`button`,{onClick:async t=>{t.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:border-[var(--color-line-2)] rounded-sm px-2 py-1 transition-colors cursor-pointer`,children:t?`✓ copied`:`copy json`})}function mc({row:e,defaultExpanded:t=!1}){let[n,r]=(0,_.useState)(t),i=(0,_.useRef)(null),a=(0,_.useRef)(!0),o=ir(e.tool,e.input),s=o&&o.length>0?o:e.input&&e.input!==`{}`&&e.input!==``?e.input:`—`,c=cc[e.decision]??`gray`,l=uc[e.decision]??`border-l-[var(--color-line-2)]`,u=rr(e.timestamp),d=dc(e.duration_ns),f=yi(e.tool,e.input);(0,_.useEffect)(()=>{let e=i.current;if(e){if(a.current){a.current=!1,n||(e.style.maxHeight=`0`,e.style.opacity=`0`);return}if(st()){e.style.maxHeight=n?`none`:`0`,e.style.opacity=n?`1`:`0`;return}if(n){let t=e.scrollHeight;Tt(e,{"max-height":[`0px`,`${t}px`],opacity:[0,1],translateY:[-6,0],duration:260,ease:`outCubic`,onComplete:()=>{e.style.maxHeight=`none`}})}else{let t=e.scrollHeight;Tt(e,{"max-height":[`${t}px`,`0px`],opacity:[1,0],duration:180,ease:`outCubic`})}}},[n]);let p=(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})();return(0,G.jsxs)(`div`,{className:`border border-[var(--color-line-1)] border-l-2 ${l} rounded-sm bg-[var(--color-surface-1)] overflow-hidden transition-colors hover:border-[var(--color-line-2)] hover:border-l-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer select-none group`,onClick:()=>r(e=>!e),role:`button`,"aria-expanded":n,children:[(0,G.jsx)(`svg`,{className:`shrink-0 w-3 text-[var(--color-fg-4)] group-hover:text-[var(--color-fg-2)] transition-all ${n?`rotate-90`:``}`,width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),(0,G.jsx)(`time`,{className:`shrink-0 font-mono text-[11px] text-[var(--color-fg-3)] w-14 tabular-nums`,title:u,dateTime:new Date(e.timestamp*1e3).toISOString(),children:nr(e.timestamp)}),(0,G.jsx)(cr,{variant:c,className:`shrink-0 w-20 justify-center`,children:lc[e.decision]??e.decision}),(0,G.jsxs)(`span`,{className:`flex-1 min-w-0 flex items-baseline gap-2`,title:`${f.headline} · ${e.tool}`,children:[(0,G.jsx)(`span`,{className:`text-[12px] text-[var(--color-fg-0)] font-medium truncate`,children:f.headline}),!fi(e.tool)&&s!==`—`&&(0,G.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)] font-mono truncate hidden sm:inline`,title:s,children:s})]}),d&&(0,G.jsx)(`span`,{className:`shrink-0 hidden md:inline w-12 text-right font-mono text-[10px] text-[var(--color-fg-4)] tabular-nums`,title:`Eval latency: ${d}`,children:d}),(0,G.jsx)(`span`,{className:`shrink-0 w-24 text-right text-[10px] text-[var(--color-fg-3)] truncate`,title:e.client?`Adapter: ${e.client}`:`Unidentified caller`,children:di(e.client)})]}),(0,G.jsx)(`div`,{ref:i,className:`border-t border-[var(--color-line-0)] overflow-hidden`,style:{maxHeight:n?`none`:`0`,opacity:n?1:0},"aria-hidden":!n,children:n&&(0,G.jsxs)(`div`,{className:`px-3 py-3 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-3`,children:[(0,G.jsx)(fc,{label:`When`,value:u}),(0,G.jsx)(fc,{label:`Decision`,children:(0,G.jsx)(cr,{variant:c,children:lc[e.decision]??e.decision})}),(0,G.jsx)(fc,{label:`Action`,children:(0,G.jsxs)(`span`,{className:`text-xs text-[var(--color-fg-1)]`,children:[f.headline,(0,G.jsxs)(`span`,{className:`ml-2 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`(`,e.tool,`)`]})]})}),e.client&&(0,G.jsx)(fc,{label:`AI agent`,value:di(e.client)}),e.rule_id&&(0,G.jsx)(fc,{label:`Rule ID`,children:(0,G.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-xs text-[var(--color-brand)] hover:underline font-mono`,onClick:e=>e.stopPropagation(),children:e.rule_id})}),e.source_file&&(0,G.jsx)(fc,{label:`Source File`,value:e.source_file,mono:!0}),d&&(0,G.jsx)(fc,{label:`Latency`,value:d,mono:!0}),e.rules_evaluated!=null&&(0,G.jsx)(fc,{label:`Rules Evaluated`,value:`${e.rules_evaluated}`,mono:!0})]}),(0,G.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-3 py-2.5`,children:[(0,G.jsx)(`div`,{className:`overline mb-1`,children:`In plain English`}),(0,G.jsx)(`div`,{className:`text-xs font-medium text-[var(--color-fg-1)] mb-1`,children:f.headline}),(0,G.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] leading-relaxed`,children:f.detail})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline mb-2`,children:`Tool Input`}),(0,G.jsx)(sc,{inputJson:e.input})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.rule_id?(0,G.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-brand)]/70 hover:text-[var(--color-brand)] transition-colors`,onClick:e=>e.stopPropagation(),children:`→ view rule`}):(0,G.jsx)(`span`,{}),(0,G.jsx)(pc,{text:p})]})]})})]})}function hc({className:e,children:t,...n}){return(0,G.jsx)(`pre`,{className:W(`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-3 py-2 text-[11px] leading-relaxed font-mono text-[var(--color-fg-1)] overflow-x-auto whitespace-pre-wrap break-all`,e),...n,children:t})}var gc={neutral:`text-[var(--color-fg-0)]`,green:`text-emerald-300`,red:`text-red-300`,amber:`text-amber-300`,blue:`text-sky-300`,purple:`text-violet-300`,gray:`text-[var(--color-fg-3)]`},_c={neutral:`bg-[var(--color-fg-3)]`,green:`bg-emerald-500`,red:`bg-red-500`,amber:`bg-[var(--color-brand)]`,blue:`bg-sky-500`,purple:`bg-violet-500`,gray:`bg-[var(--color-line-2)]`},vc=[{label:`User code`,color:`#451a03`},{label:`Runtime (bun:/node:)`,color:`#172554`},{label:`Native/other`,color:`#1f2937`},{label:`GC/idle`,color:`#450a0a`}],yc={neutral:`#d0d0d0`,green:`#34d399`,red:`#f87171`,amber:`#fbbf24`,blue:`#38bdf8`,purple:`#a78bfa`,gray:`#6e7076`};function bc({label:e,value:t,sub:n,tone:r=`neutral`,align:i=`left`,labelPlacement:a=`above`,labelClassName:o,valueClassName:s,subClassName:c,trend:l,trendColor:u}){let d=(0,G.jsx)(`div`,{className:W(a===`above`?`overline mb-1.5`:`mt-1 text-[11px] text-[var(--color-fg-3)]`,o),children:e}),f=(0,G.jsx)(`div`,{className:W(`font-mono font-medium tabular-nums`,i===`center`&&`text-center`,gc[r],s),children:t}),p=l&&l.length>1,m=u??yc[r];return(0,G.jsxs)(G.Fragment,{children:[a===`above`&&d,p?(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[f,(0,G.jsx)(mr,{data:l,width:48,height:18,color:m})]}):f,a===`below`&&d,n&&(0,G.jsx)(`div`,{className:W(`mt-1 text-[10px] font-mono text-[var(--color-fg-3)]`,i===`center`&&`text-center`,c),children:n})]})}function xc({className:e,contentClassName:t,label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u,trend:d,trendColor:f,...p}){return(0,G.jsx)(K,{className:e,...p,children:(0,G.jsx)(J,{className:W(`py-3`,o===`center`&&`text-center`,t),children:(0,G.jsx)(bc,{label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u,trend:d,trendColor:f})})})}function Sc({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)] p-3`,t.align===`center`&&`text-center`,e),children:(0,G.jsx)(bc,{...t})})}function Cc({pct:e,tone:t=`green`,markerPct:n,className:r,barClassName:i,markerTitle:a}){let o=Math.max(0,Math.min(100,e)),s=n===void 0?null:Math.max(0,Math.min(100,n));return(0,G.jsxs)(`div`,{className:W(`relative w-full overflow-hidden rounded-sm bg-[var(--color-surface-3)]`,r),children:[(0,G.jsx)(`div`,{className:W(`h-full rounded-sm transition-all duration-500`,_c[t],i),style:{width:`${o}%`}}),s!==null&&(0,G.jsx)(`div`,{className:`absolute top-0 h-full w-0.5 bg-[var(--color-brand)]/70`,style:{left:`${s}%`},title:a})]})}function wc({label:e,value:t,tone:n=`neutral`,breached:r=!1,breachLabel:i=`limit exceeded`,trendData:a,trendColor:o,threshold:s,maxValue:c,footer:l,className:u,valueClassName:d}){return(0,G.jsxs)(K,{className:u,children:[(0,G.jsxs)(q,{className:`py-2`,children:[(0,G.jsx)(`span`,{className:`overline`,children:e}),r&&(0,G.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300`,children:i})]}),(0,G.jsxs)(J,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:W(`text-2xl font-mono font-medium tabular-nums`,gc[n],d),children:t}),(a?.length??0)>1&&o&&(0,G.jsx)(mr,{data:a??[],width:80,height:28,color:o,threshold:s,maxValue:c})]}),l]})]})}function Tc({profile:e,children:t}){return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,G.jsxs)(`span`,{children:[`nodes:`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.nodes.length})]}),(0,G.jsxs)(`span`,{children:[`duration:`,` `,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-1)]`,children:[((e.endTime-e.startTime)/1e3).toFixed(0),`ms`]})]}),(0,G.jsxs)(`span`,{children:[`samples:`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.samples?.length??0})]})]}),(0,G.jsx)(`div`,{className:`flex gap-3 text-[10px] font-mono text-[var(--color-fg-3)]`,children:vc.map(e=>(0,G.jsxs)(`span`,{className:`flex items-center`,children:[(0,G.jsx)(`span`,{className:`mr-1 inline-block h-2.5 w-2.5 rounded-[1px]`,style:{background:e.color}}),e.label]},e.label))}),t]})}function Ec({memory:e,formatValue:t}){return(0,G.jsx)(`div`,{className:`grid grid-cols-4 gap-3`,children:[{label:`RSS`,value:t(e.rss)},{label:`Heap Total`,value:t(e.heapTotal)},{label:`Heap Used`,value:t(e.heapUsed)},{label:`External`,value:t(e.external)}].map(e=>(0,G.jsx)(Sc,{align:`center`,label:e.label,value:e.value,valueClassName:`text-lg font-medium text-[var(--color-fg-0)]`},e.label))})}function Dc(e,t){let n=Array(t).fill(0);if(e.length===0)return n;let r=Date.now()-t*1e3;for(let i=e.length-1;i>=0;i--){let a=e[i];if(!a)continue;if(a.ts_ms<r)break;let o=Math.floor((a.ts_ms-r)/1e3);o>=0&&o<t&&n[o]++}return n}function Oc({bins:e=60,height:t=38,className:n}){let r=Oe(),i=(0,_.useRef)(null),a=(0,_.useRef)([]),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=i.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let s=Math.min(window.devicePixelRatio??1,2),c=st(),l=()=>{let i=Dc(r,e);if(a.current.length!==e)a.current=i.slice();else if(c)a.current=i;else for(let t=0;t<e;t++){let e=a.current[t]??0,n=i[t]??0;a.current[t]=e+(n-e)*.18}let u=t.clientWidth,d=t.clientHeight;(t.width!==u*s||t.height!==d*s)&&(t.width=u*s,t.height=d*s,n.scale(s,s)),n.clearRect(0,0,u,d);let f=Math.max(1,...a.current),p=u/e;for(let t=0;t<e;t++){let e=a.current[t]??0,r=e/f*d,i=t*p,o=e/f;n.fillStyle=`rgba(${Math.round(56+o*199)},${Math.round(189-o*100)},${Math.round(248-o*200)},${.4+o*.55})`,n.fillRect(i+.5,d-r,Math.max(1,p-1),r)}n.strokeStyle=`rgba(148, 163, 184, 0.1)`,n.lineWidth=1,n.beginPath(),n.moveTo(0,d-.5),n.lineTo(u,d-.5),n.stroke(),o.current=requestAnimationFrame(l)};return o.current=requestAnimationFrame(l),()=>{o.current!==null&&cancelAnimationFrame(o.current),o.current=null}},[r,e]),(0,G.jsxs)(`div`,{className:W(`relative w-full`,n),style:{height:t},children:[(0,G.jsx)(`canvas`,{ref:i,className:`block w-full h-full`,style:{width:`100%`,height:`100%`}}),(0,G.jsxs)(`span`,{className:`absolute top-1 left-2 text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)] pointer-events-none`,children:[`bursts/sec · `,e,`s window`]})]})}var kc=8,Ac=6,jc=Math.PI*.75,Mc=Math.PI*2.25;function Nc({size:e=110,className:t}){let n=Oe(),r=(0,_.useRef)(null),i=(0,_.useRef)(0),a=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=r.current;if(!t)return;let o=t.getContext(`2d`);if(!o)return;let s=Math.min(window.devicePixelRatio??1,2),c=st(),l=()=>{let r=Date.now()-1500,u=0;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){if(t.ts_ms<r)break;u++}}let d=u/1.5,f=Math.min(1,d/kc);c?i.current=f:i.current+=(f-i.current)*.16;let p=e,m=e;(t.width!==p*s||t.height!==m*s)&&(t.width=p*s,t.height=m*s,t.style.width=`${p}px`,t.style.height=`${m}px`,o.scale(s,s)),o.clearRect(0,0,p,m);let h=p/2,g=m/2+4,_=p/2-8;o.lineWidth=6,o.lineCap=`round`,o.strokeStyle=`rgba(148, 163, 184, 0.18)`,o.beginPath(),o.arc(h,g,_,jc,Mc),o.stroke();let v=jc+Ac/kc*(Mc-jc);o.strokeStyle=`rgba(239, 68, 68, 0.45)`,o.beginPath(),o.arc(h,g,_,v,Mc),o.stroke();let y=jc+i.current*(Mc-jc),b=i.current*kc>=Ac;o.strokeStyle=b?`rgba(239, 68, 68, 0.95)`:`rgba(56, 189, 248, 0.92)`,o.lineWidth=6,o.beginPath(),o.arc(h,g,_,jc,y),o.stroke();let x=h+Math.cos(y)*(_-2),S=g+Math.sin(y)*(_-2);o.strokeStyle=b?`#fca5a5`:`#e0e7ff`,o.lineWidth=2,o.beginPath(),o.moveTo(h,g),o.lineTo(x,S),o.stroke(),o.fillStyle=b?`#fca5a5`:`#e0e7ff`,o.beginPath(),o.arc(h,g,3,0,Math.PI*2),o.fill(),o.fillStyle=b?`#fca5a5`:`#e0e7ff`,o.font=`bold 20px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,o.textAlign=`center`,o.fillText(d.toFixed(1),h,g+_*.55),o.fillStyle=`rgba(148, 163, 184, 0.85)`,o.font=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,o.fillText(`eps`,h,g+_*.55+12),a.current=requestAnimationFrame(l)};return a.current=requestAnimationFrame(l),()=>{a.current!==null&&cancelAnimationFrame(a.current),a.current=null}},[n,e]),(0,G.jsx)(`canvas`,{ref:r,className:W(`block`,t),style:{width:e,height:e}})}var Pc={allow:`#22c55e`,block:`#ef4444`,force:`#a855f7`,ask:`#f59e0b`,log:`#60a5fa`,shadow:`#6b7280`},Fc=[`allow`,`block`,`force`,`ask`,`log`];function Ic({windowSec:e=30,height:t=14,className:n}){let r=Oe(),[i,a]=(0,_.useState)({}),o=(0,_.useRef)(null);(0,_.useEffect)(()=>{let t=st(),n=()=>{let i=Date.now()-e*1e3,s={},c=0;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t){if(t.ts_ms<i)break;s[t.decision]=(s[t.decision]??0)+1,c++}}let l={};for(let e of Fc)l[e]=c===0?0:(s[e]??0)/c;if(t){a(l);return}a(e=>{let t={};for(let n of Fc){let r=e[n]??0;t[n]=r+((l[n]??0)-r)*.22}return t}),o.current=requestAnimationFrame(n)};return o.current=requestAnimationFrame(n),()=>{o.current!==null&&cancelAnimationFrame(o.current),o.current=null}},[r,e]);let s=Fc.map(e=>({key:e,color:Pc[e]??`#6b7280`,pct:Math.max(0,i[e]??0)})),c=s.reduce((e,t)=>e+t.pct,0)===0;return(0,G.jsxs)(`div`,{className:W(`w-full`,n),children:[(0,G.jsx)(`div`,{className:`flex w-full overflow-hidden rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,style:{height:t},title:`decision mix · last ${e}s`,children:c?(0,G.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)]`,children:`— idle —`}):s.map(e=>(0,G.jsx)(`div`,{style:{width:`${e.pct*100}%`,background:e.color,transition:`width 240ms ease-out`},title:`${e.key} · ${(e.pct*100).toFixed(1)}%`},e.key))}),(0,G.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-0.5 text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)]`,children:s.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e.color}}),e.key,` · `,(e.pct*100).toFixed(0),`%`]},e.key))})]})}var Lc=3;function Rc(e){return e===null?`—`:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}var zc=[`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`,`limits-breach`];function Bc({info:e}){let t=e.tier===`pro`||e.tier===`enterprise`,n=e.status===`needs_reauth`,r=e.pct_used??0,i=r>=90?`bg-red-500`:r>=70?`bg-amber-500`:`bg-emerald-500`;return(0,G.jsxs)(K,{className:n?`border-l-2 border-l-amber-500/70`:t?`border-l-2 border-l-emerald-500/70`:`border-l-2 border-l-sky-500/70`,children:[(0,G.jsxs)(q,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`license`}),(0,G.jsx)(cr,{variant:t?`green`:n?`amber`:`blue`,children:e.tier_label}),e.fleet_enrolled&&(0,G.jsx)(cr,{variant:`gray`,children:`fleet`})]}),e.email&&(0,G.jsx)(`span`,{className:`text-xs text-[var(--color-fg-3)]`,children:e.email})]}),(0,G.jsxs)(J,{className:`space-y-3`,children:[n&&e.detail&&(0,G.jsxs)(`div`,{className:`rounded border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:[e.detail,` — run `,(0,G.jsx)(`code`,{className:`font-mono`,children:`ssg auth login`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs text-[var(--color-fg-2)]`,children:[(0,G.jsx)(`span`,{children:`evals today`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(pr,{value:e.evals_today,curve:`spring`}),e.eval_daily_limit!==null&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` / `}),e.eval_daily_limit.toLocaleString()]}),e.eval_daily_limit===null&&(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` · unlimited`})]})]}),e.eval_daily_limit!==null&&(0,G.jsx)(`div`,{className:`mt-1 h-1.5 w-full overflow-hidden rounded-full bg-[var(--color-bg-2)]`,children:(0,G.jsx)(`div`,{className:`h-full transition-all duration-700 ease-out ${i}`,style:{width:`${r}%`}})})]}),!t&&(0,G.jsxs)(`a`,{href:e.upgrade_url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-[var(--color-brand)] hover:underline`,children:[`Upgrade to Pro · $`,e.pricing.pro_monthly_usd,`/mo →`]}),t&&e.retention_days>0&&(0,G.jsxs)(`div`,{className:`text-[10px] text-[var(--color-fg-3)] font-mono uppercase tracking-wider`,children:[`cloud retention: `,e.retention_days,` days`]})]})]})}function Vc(e){return new Date(e*1e3).toLocaleTimeString()}function Hc(e,t=24){let n=(0,_.useRef)(null),[r,i]=(0,_.useState)([]);return(0,_.useEffect)(()=>{let r=n.current;if(n.current=e,r===null)return;let a=Math.max(0,e-r);i(e=>{let n=e.length>=t?e.slice(-(t-1)):e.slice();return n.push(a),n})},[e,t]),r}async function Uc(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:z()})}async function Wc(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...z()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function Gc(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...z()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function Kc(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({ruleId:e,file:t,decision:`ask`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}async function qc(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({ruleId:e,file:t,decision:`block`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}function Jc({ruleId:e}){return e?(0,G.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e)}`,className:`text-[var(--color-brand)] hover:underline text-xs font-mono break-all`,title:`Go to rule: ${e}`,children:e}):(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`—`})}function Yc({title:e,right:t}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,G.jsx)(`h2`,{className:`overline text-[11px]`,children:e}),t]})}function Xc({children:e}){return(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:e})}function Zc({item:e,onDisable:t,onChangeToAsk:n,onUndo:r}){let[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(`idle`),[c,l]=(0,_.useState)(!1),u=ir(e.tool,e.input),d=e.rule_id&&e.source_file,f=e.decision===`force`?`force`:`block`,p=f===`force`?`amber`:`red`,m=async()=>{s(`loading`);try{await n(),s(`done-ask`)}catch{s(`error`)}},h=async()=>{s(`loading`);try{await t(),s(`done-disable`)}catch{s(`error`)}},g=async()=>{l(!0);try{await r(o===`done-disable`?`disable`:`ask`),s(`idle`)}catch{}finally{l(!1)}},v=o===`done-ask`||o===`done-disable`;return(0,G.jsx)(K,{className:`border-l-2 ${v?`border-l-[var(--color-line-1)]`:f===`force`?`border-l-amber-400/60`:`border-l-red-500/60`} ${v?`opacity-60`:``}`,children:(0,G.jsxs)(`div`,{className:`px-3 py-3`,children:[v&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm px-2.5 py-1.5 mb-3 text-[11px] font-mono ${o===`done-ask`?`bg-sky-500/5 border border-sky-500/25 text-sky-300`:`bg-amber-500/5 border border-amber-500/25 text-amber-300`}`,children:[(0,G.jsx)(`span`,{className:`truncate`,children:o===`done-ask`?`✓ rule "${e.rule_id}" → ask · prompts next time`:`✓ rule "${e.rule_id}" disabled · no longer blocks`}),(0,G.jsx)(`button`,{onClick:g,disabled:c,className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-current/40 hover:bg-white/5 transition-colors cursor-pointer disabled:opacity-50 uppercase tracking-wider text-[10px]`,children:c?`…`:`↩ undo`})]}),o===`error`&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm px-2.5 py-1.5 mb-3 text-[11px] font-mono bg-red-500/5 border border-red-500/25 text-red-300`,children:[(0,G.jsx)(`span`,{children:`failed to update rule — check server logs`}),(0,G.jsx)(`button`,{onClick:()=>s(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-current/40 hover:bg-white/5 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`retry`})]}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5 flex-wrap`,children:[(0,G.jsx)(cr,{variant:v?o===`done-ask`?`blue`:`gray`:p,children:v?o===`done-ask`?`ask`:`disabled`:f}),(0,G.jsx)(`code`,{className:`text-[var(--color-brand)] text-xs font-mono`,children:e.tool}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs`,children:`·`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] font-mono tabular-nums`,children:Vc(e.timestamp)}),e.repeat_count>1&&(0,G.jsxs)(cr,{variant:`gray`,children:[`×`,e.repeat_count]})]}),(0,G.jsx)(`div`,{className:`text-xs font-mono truncate cursor-pointer hover:text-[var(--color-fg-0)] transition-colors ${v?`text-[var(--color-fg-4)] line-through`:`text-[var(--color-fg-1)]`}`,title:u,onClick:()=>a(e=>!e),children:u})]}),d&&!v&&o!==`error`&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pt-0.5`,children:[(0,G.jsxs)(`button`,{onClick:m,disabled:o===`loading`,className:`inline-flex items-center gap-1 h-7 px-2.5 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-sky-500/8 text-sky-300 border border-sky-500/25 hover:bg-sky-500/15 hover:border-sky-500/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,children:[o===`loading`?(0,G.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,G.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,G.jsx)(`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),`ask instead`]}),(0,G.jsxs)(`button`,{onClick:h,disabled:o===`loading`,className:`inline-flex items-center gap-1 h-7 px-2.5 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-red-500/8 text-red-300 border border-red-500/25 hover:bg-red-500/15 hover:border-red-500/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,children:[o===`loading`?(0,G.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,G.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,G.jsx)(`line`,{x1:`15`,y1:`9`,x2:`9`,y2:`15`}),(0,G.jsx)(`line`,{x1:`9`,y1:`9`,x2:`15`,y2:`15`})]}),`disable rule`]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-[11px] font-mono`,children:[e.rule_id&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),(0,G.jsx)(Jc,{ruleId:e.rule_id})]}),e.source_file&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`src`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:e.source_file})]}),e.rules_evaluated!==null&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`evals`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:e.rules_evaluated})]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`latency`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:Rc(e.duration_ns)})]}),(0,G.jsx)(`button`,{onClick:()=>a(e=>!e),className:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-0)] transition-colors ml-auto cursor-pointer uppercase tracking-wider text-[10px]`,children:i?`▾ hide`:`▸ details`})]}),i&&(0,G.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(`div`,{className:`overline mb-2`,children:`full input`}),(0,G.jsx)(hc,{children:(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})()})]})]})})}function Qc(){let e=Ae(zc),t=[e[`counters-updated`],e[`activity-updated`],e[`pending-changed`]],{data:n}=B(`/api/state/counters`,t),{data:r,refetch:i}=B(`/api/json/pending`,t),{data:a,refetch:o}=B(`/api/json/blocked`,t),{data:s}=B(`/api/state/activity`,t),{data:c}=B(`/api/state/runtime`,[e[`runtime-tick`]]),{data:l}=B(`/api/json/limits`,[e[`limits-breach`]]),{data:u}=B(`/api/json/license`,[e[`activity-updated`]]),[d,f]=(0,_.useState)(!1),p=a?.reduce((e,t)=>e+t.repeat_count,0)??0,m=n?.allow??0,h=(n?.block??0)+(n?.force??0),g=n?.force??0,v=n?.pending??0,y=n?.log??0,b=Hc(m),x=Hc(h),S=Hc(g),C=Hc(v),w=Hc(y),T=[{label:`allow`,value:m,tone:`green`,trend:b},{label:`block`,value:h,tone:`red`,trend:x},{label:`force`,value:g,tone:`amber`,trend:S},{label:`pending`,value:v,tone:`blue`,trend:C},{label:`log`,value:y,tone:`gray`,trend:w}];return(0,G.jsxs)(`div`,{ref:Et({from:`first`}),className:`space-y-8`,children:[(0,G.jsx)(Ys,{}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-5 gap-2`,children:T.map(e=>(0,G.jsx)(xc,{align:`left`,label:e.label,value:(0,G.jsx)(pr,{value:e.value,curve:`spring`}),tone:e.tone,labelPlacement:`above`,contentClassName:`py-3`,valueClassName:`text-2xl font-medium`,trend:e.trend,"data-reveal":!0},e.label))}),(0,G.jsxs)(`div`,{"data-reveal":!0,className:`grid grid-cols-12 gap-2 items-stretch`,children:[(0,G.jsxs)(`div`,{className:`col-span-12 md:col-span-7 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2 flex flex-col gap-2`,children:[(0,G.jsx)(Oc,{bins:60,height:42}),(0,G.jsx)(Ic,{windowSec:60,height:12})]}),(0,G.jsx)(`div`,{className:`col-span-12 md:col-span-5 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2 flex items-center justify-center`,children:(0,G.jsx)(Nc,{size:130})})]}),u&&(0,G.jsx)(`div`,{"data-reveal":!0,children:(0,G.jsx)(Bc,{info:u})}),c&&(0,G.jsxs)(`div`,{"data-reveal":!0,className:`grid grid-cols-2 gap-2`,children:[(0,G.jsx)(wc,{label:`cpu`,value:c.cpu_pct==null?`—`:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pr,{value:c.cpu_pct,format:e=>Math.round(e).toString()}),`%`]}),tone:l?.breaches.cpu?`red`:(c.cpu_pct??0)>=60?`amber`:`green`,breached:l?.breaches.cpu??!1,trendData:c.history?.cpu_pct,trendColor:l?.breaches.cpu?`#f87171`:`#34d399`,threshold:l?.config.cpuLimitPct,maxValue:100,className:l?.breaches.cpu?`border-red-500/40`:``,footer:(0,G.jsx)(`a`,{href:`/monitor`,className:`mt-1 block text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`view details →`})}),(0,G.jsx)(wc,{label:`memory rss`,value:c.memory_rss_mb==null?`—`:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pr,{value:c.memory_rss_mb,format:e=>Math.round(e).toString()}),(0,G.jsx)(`span`,{className:`ml-1 text-sm text-[var(--color-fg-3)]`,children:`MB`})]}),tone:l?.breaches.memory?`red`:`neutral`,breached:l?.breaches.memory??!1,trendData:c.history?.memory_rss_mb,trendColor:l?.breaches.memory?`#f87171`:`#38bdf8`,threshold:l?.config.memoryLimitMb,className:l?.breaches.memory?`border-red-500/40`:``,footer:(0,G.jsx)(`a`,{href:`/monitor`,className:`mt-1 block text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`view details →`})})]}),(0,G.jsxs)(`section`,{"data-reveal":!0,children:[(0,G.jsx)(Yc,{title:`pending approvals`}),!r||r.length===0?(0,G.jsx)(Xc,{children:`no pending approvals`}):(0,G.jsx)(`div`,{className:`space-y-2`,children:r.map(e=>(0,G.jsxs)(K,{className:`border-l-2 border-l-sky-500/50`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`primary`,onClick:async()=>{await Uc(e.id,`allow`),i()},children:`approve`}),(0,G.jsx)(Y,{size:`sm`,variant:`danger`,onClick:async()=>{await Uc(e.id,`block`),i()},children:`deny`})]})]}),(0,G.jsxs)(J,{className:`space-y-2 text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`tool`}),(0,G.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool})]}),e.prompt&&(0,G.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,G.jsx)(`span`,{className:`overline pt-0.5`,children:`prompt`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,children:e.prompt})]}),(0,G.jsx)(hc,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id))})]}),a&&a.length>0&&(0,G.jsxs)(`section`,{"data-reveal":!0,children:[(0,G.jsx)(Yc,{title:`blocked actions`,right:(0,G.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:[a.length,` active`,p>a.length?` · ${p} total hits`:``]})}),(0,G.jsx)(`div`,{className:`space-y-2`,children:(d?a:a.slice(0,Lc)).map(e=>(0,G.jsx)(Zc,{item:e,onDisable:async()=>{await Wc(e.rule_id,e.source_file),o()},onChangeToAsk:async()=>{await Kc(e.rule_id,e.source_file),o()},onUndo:async t=>{t===`disable`?await Gc(e.rule_id,e.source_file):await qc(e.rule_id,e.source_file),o()}},`${e.decision}:${e.rule_id??`none`}:${e.tool}:${e.timestamp}:${e.input}`))}),a.length>Lc&&(0,G.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,G.jsx)(Y,{size:`sm`,variant:`secondary`,onClick:()=>f(e=>!e),children:d?`↑ show less`:`↓ show ${a.length-Lc} more`})})]}),(0,G.jsxs)(`section`,{"data-reveal":!0,children:[(0,G.jsx)(Yc,{title:`recent audit log`,right:s&&s.length>0?(0,G.jsx)(`a`,{href:`/audit`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors`,children:`view all →`}):void 0}),!s||s.length===0?(0,G.jsx)(Xc,{children:`no audit entries yet`}):(0,G.jsx)(`div`,{className:`space-y-1.5`,children:s.slice(0,15).map(e=>(0,G.jsx)(mc,{row:e},e.id))})]})]})}function $c({checked:e,onChange:t,disabled:n,size:r=`md`,tone:i=`brand`,label:a}){return(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":a,disabled:n,onClick:()=>t(!e),className:`ss-toggle ${r===`sm`?`ss-toggle--sm`:``} ${i===`danger`?`ss-toggle--danger`:``}`,children:(0,G.jsx)(`span`,{className:`ss-toggle-thumb`,"aria-hidden":`true`})})}var el=new Map;async function tl(e){let t=el.get(e);if(t)return t.status===`ok`?t.data:t.status===`error`?null:t.promise;let n=(async()=>{try{let t=await fetch(`/api/json/rule-explain?ruleId=${encodeURIComponent(e)}`,{headers:{Accept:`application/json`}});if(!t.ok)return el.set(e,{status:`error`,error:`HTTP ${t.status}`}),null;let n=await t.json();return el.set(e,{status:`ok`,data:n}),n}catch(t){return el.set(e,{status:`error`,error:String(t)}),null}})();return el.set(e,{status:`loading`,promise:n}),n}var nl=220,rl=90;function il({ruleId:e,children:t,className:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=()=>{u.current&&clearTimeout(u.current),d.current&&clearTimeout(d.current),u.current=null,d.current=null},p=(0,_.useCallback)(()=>{let e=l.current;if(!e)return;let t=e.getBoundingClientRect(),n=t.left;n+320>window.innerWidth-12&&(n=Math.max(12,window.innerWidth-320-12));let r=t.bottom+8;r+200>window.innerHeight-12&&(r=Math.max(12,t.top-200-8)),c({top:r,left:n})},[]),m=(0,_.useCallback)(()=>{f(),u.current=setTimeout(()=>{p(),i(!0),tl(e).then(e=>{e&&o(e)});let t=el.get(e);t&&t.status===`ok`&&o(t.data)},nl)},[e,p]),h=(0,_.useCallback)(()=>{f(),d.current=setTimeout(()=>{i(!1)},rl)},[]);return(0,_.useEffect)(()=>{if(!r)return;let e=()=>p(),t=()=>p(),n=e=>{e.key===`Escape`&&i(!1)};return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,t),window.addEventListener(`keydown`,n),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,t),window.removeEventListener(`keydown`,n)}},[r,p]),(0,_.useEffect)(()=>()=>f(),[]),(0,G.jsxs)(`span`,{ref:l,className:`ss-rule-trigger${n?` `+n:``}`,onMouseEnter:m,onMouseLeave:h,onFocus:m,onBlur:h,tabIndex:0,"aria-describedby":r?`rule-popover-${e}`:void 0,children:[t,r&&s&&(0,G.jsx)(`span`,{id:`rule-popover-${e}`,role:`tooltip`,className:`ss-rule-popover`,style:{top:s.top,left:s.left},onMouseEnter:()=>f(),onMouseLeave:h,children:a?(0,G.jsx)(al,{data:a}):(0,G.jsx)(`span`,{className:`ss-rule-popover__loading`,children:`loading rule…`})})]})}function al({data:e}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`ss-rule-popover__head`,children:[(0,G.jsx)(`code`,{className:`ss-rule-popover__id`,children:e.ruleId}),(0,G.jsx)(`span`,{className:`ss-rule-popover__pill ss-rule-popover__pill--${e.decision}`,children:e.decision}),(0,G.jsx)(`span`,{className:`ss-rule-popover__state ss-rule-popover__state--${e.enabled?`on`:`off`}`,children:e.enabled?`ON`:`OFF`})]}),(0,G.jsx)(`strong`,{className:`ss-rule-popover__headline`,children:e.headline}),(0,G.jsx)(`span`,{className:`ss-rule-popover__summary`,children:e.summary}),e.conditions.length>1&&(0,G.jsxs)(`span`,{className:`ss-rule-popover__section`,children:[(0,G.jsx)(`span`,{className:`ss-rule-popover__label`,children:`Matches when`}),(0,G.jsx)(`ul`,{className:`ss-rule-popover__list`,children:e.conditions.map((e,t)=>(0,G.jsx)(`li`,{children:e},t))})]}),e.hints.length>0&&(0,G.jsx)(`span`,{className:`ss-rule-popover__hints`,children:e.hints.map((e,t)=>(0,G.jsx)(`span`,{className:`ss-rule-popover__hint`,children:e},t))}),(0,G.jsx)(`span`,{className:`ss-rule-popover__foot`,children:(0,G.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.ruleId)}`,className:`ss-rule-popover__link`,children:`Open in Rules →`})})]})}var ol=[`rules-changed`],sl=[`block`,`ask`,`log`,`allow`,`force`,`shadow`],cl={block:`text-red-300`,deny:`text-red-300`,ask:`text-sky-300`,allow:`text-emerald-300`,log:`text-[var(--color-fg-3)]`,force:`text-amber-300`,shadow:`text-violet-300`};async function ll(e,t){await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...z()},body:JSON.stringify({ruleId:e,file:t})})}async function ul(e,t,n){await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({ruleId:e,file:t,decision:n})})}function dl({rule:e,file:t,onToggle:n}){let[r,i]=(0,_.useState)(!1);return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider ${e.enabled?`text-[var(--color-fg-1)]`:`text-[var(--color-fg-4)]`}`,children:e.enabled?`on`:`off`}),(0,G.jsx)($c,{size:`sm`,checked:e.enabled,disabled:r,label:`${e.enabled?`Disable`:`Enable`} rule ${e.id}`,onChange:async()=>{i(!0);try{await n()}finally{i(!1)}}})]})}function fl(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await fetch(`/api/json/rule-write-enforcement`,{headers:{Accept:`application/json`}});if(!n.ok)return;let r=await n.json();!e&&typeof r.enforced==`boolean`&&t(r.enforced)}catch{}})(),()=>{e=!0}},[]);async function o(e){r(!0);try{let n=await fetch(`/api/json/rule-write-enforcement`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({enforced:e})});if(n.ok){let e=await n.json();typeof e.enforced==`boolean`&&t(e.enforced)}}finally{r(!1),a(!1)}}if(e===null)return null;let s=!e;return(0,G.jsx)(K,{className:s?`border-amber-500/40 bg-amber-500/5`:`border-[var(--color-line-1)]`,children:(0,G.jsx)(J,{className:`px-3 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`rule-write protection`}),(0,G.jsx)(`span`,{className:`text-[11px] font-mono uppercase tracking-wider ${s?`text-amber-300`:`text-emerald-300`}`,children:s?`disabled`:`enforced`})]}),(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] mt-1 leading-snug`,children:s?`Agents can currently Write/Edit .rules files. Turn this back on when you finish authoring.`:`Agents cannot Write/Edit/MultiEdit any .sigmashake/rules/**/*.rules file. Disable only when curating rulesets.`})]}),(0,G.jsx)(`div`,{className:`shrink-0`,children:i?(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`button`,{onClick:()=>o(!1),disabled:n,className:`text-[11px] font-mono uppercase tracking-wider bg-amber-500/10 border border-amber-500/40 text-amber-200 hover:bg-amber-500/20 rounded-sm px-2 py-0.5 cursor-pointer transition-colors disabled:opacity-50`,children:`disable`}),(0,G.jsx)(`button`,{onClick:()=>a(!1),disabled:n,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer disabled:opacity-50`,children:`cancel`})]}):(0,G.jsx)(`button`,{onClick:()=>{e?a(!0):o(!0)},disabled:n,className:`text-[11px] font-mono uppercase tracking-wider border rounded-sm px-2.5 py-0.5 cursor-pointer transition-colors disabled:opacity-50 ${s?`bg-emerald-500/10 border-emerald-500/40 text-emerald-200 hover:bg-emerald-500/20`:`bg-[var(--color-surface-1)] border-[var(--color-line-1)] text-[var(--color-fg-1)] hover:bg-[var(--color-surface-2)]`}`,children:s?`enable`:`disable`})})]})})})}function pl(){let{data:e,refetch:t}=B(`/api/json/rules`,[Ae(ol)[`rules-changed`]]),[n,r]=(0,_.useState)(``),i=new URLSearchParams(window.location.search).get(`highlight`)??``,a=(0,_.useRef)(null);if((0,_.useEffect)(()=>{a.current&&a.current.scrollIntoView({behavior:`smooth`,block:`center`})},[e,i]),!e)return(0,G.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading rules…`});if(e.rulesets.length===0)return(0,G.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 p-10 text-center`,children:[(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-2)] mb-2`,children:`No .rules files found.`}),(0,G.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline`,children:`→ browse hub to install rulesets`})]});let o=n.toLowerCase(),s=e.rulesets.map(e=>({...e,rules:o?e.rules.filter(e=>e.id.toLowerCase().includes(o)||e.message.toLowerCase().includes(o)):e.rules})).filter(e=>!o||e.rules.length>0),c=e.rulesets.reduce((e,t)=>e+t.rules.length,0),l=e.rulesets.reduce((e,t)=>e+t.rules.filter(e=>e.enabled).length,0);return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`overline text-[11px]`,children:`rules`}),(0,G.jsxs)(`div`,{className:`flex items-baseline gap-3 mt-1`,children:[(0,G.jsxs)(`span`,{className:`font-mono text-sm text-[var(--color-fg-0)] tabular-nums`,children:[l,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`/`,c]}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-[11px] uppercase tracking-wider`,children:`active`})]}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsxs)(`span`,{className:`font-mono text-[11px] text-[var(--color-fg-3)] uppercase tracking-wider`,children:[e.files.length,` file`,e.files.length===1?``:`s`]})]})]}),(0,G.jsx)(`div`,{className:`ml-auto relative`,children:(0,G.jsx)(`input`,{type:`text`,placeholder:`search rules…`,value:n,onChange:e=>r(e.target.value),className:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-xs rounded-sm px-2.5 py-1.5 w-56 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})})]}),(0,G.jsx)(fl,{}),s.length===0&&(0,G.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:[`no rules match "`,n,`"`]}),(0,G.jsx)(`div`,{className:`space-y-3`,children:s.map(e=>{let n=e.rules.some(e=>e.id===i),r=e.rules.filter(e=>e.enabled).length;return(0,G.jsx)(K,{children:(0,G.jsxs)(`details`,{open:n||!o,children:[(0,G.jsxs)(`summary`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer list-none select-none hover:bg-[var(--color-surface-2)]/70 border-b border-[var(--color-line-0)]`,children:[(0,G.jsxs)(`svg`,{className:`text-[var(--color-fg-3)] shrink-0`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,G.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),(0,G.jsx)(`code`,{className:`text-xs text-[var(--color-fg-0)] font-mono`,children:e.file}),(0,G.jsxs)(`span`,{className:`ml-auto font-mono text-[11px] text-[var(--color-fg-3)] tabular-nums`,children:[r,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`/`,e.rules.length]})]})]}),(0,G.jsxs)(J,{className:`py-0`,children:[e.rules.length===0?(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] py-3`,children:`no rules in this file`}):(0,G.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:e.rules.map(n=>{let r=n.id===i;return(0,G.jsxs)(`div`,{ref:r?a:null,className:`py-2.5 flex items-start justify-between gap-4 ${r?`bg-amber-400/8 border-l-2 border-l-amber-400/60 -mx-3 px-3 -my-px`:``}`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1 flex-wrap`,children:[(0,G.jsx)(`select`,{value:n.decision,onChange:async r=>{await ul(n.id,e.file,r.target.value),t()},className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-1.5 py-0.5 text-[11px] font-mono uppercase tracking-wider cursor-pointer focus:outline-none focus:border-[var(--color-brand)]/50 ${cl[n.decision]??`text-[var(--color-fg-2)]`}`,children:sl.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))}),(0,G.jsx)(il,{ruleId:n.id,children:(0,G.jsx)(`code`,{className:`text-xs font-mono text-[var(--color-fg-0)] break-all`,children:n.id})})]}),(0,G.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] truncate`,children:n.message})]}),(0,G.jsx)(dl,{rule:n,file:e.file,onToggle:async()=>{await ll(n.id,e.file),t()}})]},n.id)})}),e.content&&(0,G.jsxs)(`details`,{className:`mt-3 pb-3`,children:[(0,G.jsx)(`summary`,{className:`overline cursor-pointer hover:text-[var(--color-fg-1)] select-none`,children:`raw source`}),(0,G.jsx)(`pre`,{className:`mt-2 p-3 bg-[var(--color-surface-0)] border border-[var(--color-line-0)] rounded-sm text-[11px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-words font-mono`,children:e.content})]})]})]})},e.file)})})]})}var ml=[``,`allow`,`block`,`force`,`ask`,`log`],hl=[``,`claude-code`,`gemini`,`antigravity`,`cursor`,`copilot`,`codex`,`pi`,`generic`],gl=50;function _l(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(gl),u=Ae([`activity-updated`]),d=new URLSearchParams;e&&d.set(`decision`,e),n&&d.set(`tool`,n),i&&d.set(`client`,i);let{data:f,loading:p,error:m}=B(`/api/state/activity${d.size?`?`+d:``}`,[u[`activity-updated`],e,n,i]),h=e=>t=>{e(t.target.value),l(gl)},g=(0,_.useMemo)(()=>{if(!f)return[];let e=o.trim().toLowerCase();return e?f.filter(t=>t.tool.toLowerCase().includes(e)||t.decision.toLowerCase().includes(e)||(t.rule_id??``).toLowerCase().includes(e)||(t.client??``).toLowerCase().includes(e)||(t.source_file??``).toLowerCase().includes(e)||t.input.toLowerCase().includes(e)):f},[f,o]),v=g.slice(0,c),y=g.length>c,b=f?.length??0,x=g.length,S=`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] font-mono rounded-sm px-2 py-1.5 focus:outline-none focus:border-[var(--color-brand)]/50 cursor-pointer`;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-[20px] font-semibold tracking-tight text-[var(--color-fg-0)] leading-tight`,children:`What your AI tried to do`}),(0,G.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-3)] mt-1 leading-relaxed`,children:[`Every move your AI agent made — and what SigmaShake decided.`,f&&(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] tabular-nums ml-1.5`,children:o&&x!==b?`· ${x}/${b} match`:`· ${b} actions`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`select`,{id:`audit-filter-decision`,value:e,onChange:h(t),className:S,children:ml.map(e=>(0,G.jsx)(`option`,{value:e,children:e===``?`All decisions`:e===`allow`?`Allowed`:e===`block`?`Blocked`:e===`force`?`Forced`:e===`ask`?`Held`:`Logged`},e))}),(0,G.jsx)(`select`,{id:`audit-filter-client`,value:i,onChange:h(a),className:S,children:hl.map(e=>(0,G.jsx)(`option`,{value:e,children:e===``?`All AI agents`:e===`claude-code`?`Claude Code`:e===`copilot`?`GitHub Copilot`:e===`codex`?`OpenAI Codex`:e.charAt(0).toUpperCase()+e.slice(1)},e))}),(0,G.jsx)(`input`,{id:`audit-filter-tool`,type:`text`,placeholder:`Filter by tool…`,value:n,onChange:h(r),className:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] rounded-sm px-2.5 py-1.5 w-36 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)]`})]})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`svg`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)] pointer-events-none`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,G.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,G.jsx)(`input`,{id:`audit-search`,type:`text`,placeholder:`Search by command, file path, rule, or text…`,value:o,onChange:e=>{s(e.target.value),l(gl)},className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-sm rounded-sm pl-9 pr-10 py-2.5 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] transition-colors`}),o&&(0,G.jsx)(`button`,{onClick:()=>{s(``),l(gl)},className:`absolute right-3 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] transition-colors cursor-pointer`,title:`Clear search`,children:(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),f&&f.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-[10px] uppercase tracking-widest text-[var(--color-fg-4)] select-none`,children:[(0,G.jsx)(`span`,{className:`w-3`}),(0,G.jsx)(`span`,{className:`w-14`,children:`When`}),(0,G.jsx)(`span`,{className:`w-20`,children:`Decision`}),(0,G.jsx)(`span`,{className:`flex-1 min-w-0`,children:`Action`}),(0,G.jsx)(`span`,{className:`hidden md:inline w-12 text-right`,children:`Time`}),(0,G.jsx)(`span`,{className:`w-24 text-right`,children:`AI agent`})]}),m&&(0,G.jsxs)(`p`,{className:`text-sm text-red-300 font-mono`,children:[`failed to load audit log: `,m]}),p&&!f&&(0,G.jsx)(`div`,{className:`space-y-1.5`,children:Array.from({length:10}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-9 bg-[var(--color-surface-1)] rounded-sm border border-[var(--color-line-0)] border-l-2 border-l-[var(--color-line-2)] shimmer`},t))}),!p&&!m&&g.length===0&&(0,G.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] py-16 flex flex-col items-center justify-center text-center`,children:[(0,G.jsxs)(`svg`,{className:`text-[var(--color-fg-4)] mb-3`,width:`32`,height:`32`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,G.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)]`,children:o?`No actions match your search.`:`Nothing yet — connect an AI agent and its actions will show up here.`}),o&&(0,G.jsx)(`button`,{onClick:()=>s(``),className:`mt-3 text-[11.5px] text-[var(--color-brand)] hover:underline cursor-pointer`,children:`Clear search`})]}),v.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`space-y-1.5`,children:v.map(e=>(0,G.jsx)(mc,{row:e},e.id))}),y&&(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-4 pt-2`,children:[(0,G.jsxs)(`button`,{onClick:()=>l(e=>e+gl),className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-2)] hover:text-[var(--color-fg-0)] border border-[var(--color-line-1)] hover:border-[var(--color-line-2)] rounded-sm px-4 py-1.5 transition-colors cursor-pointer`,children:[`show`,` `,Math.min(gl,g.length-c),` more`]}),(0,G.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:[c,` / `,g.length]})]})]})]})}function vl({open:e,onClose:t,title:n,subtitle:r,children:i,footer:a,size:o=`md`}){let s=(0,_.useRef)(null),c=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!e)return;c.current=document.activeElement;let n=document.body.style.overflow;document.body.style.overflow=`hidden`;let r=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,r),s.current?.focus(),()=>{document.removeEventListener(`keydown`,r),document.body.style.overflow=n,c.current?.focus?.()}},[e,t]),e?(0,G.jsx)(`div`,{className:`ss-sheet-backdrop`,onClick:e=>{e.target===e.currentTarget&&t()},role:`presentation`,children:(0,G.jsxs)(`div`,{ref:s,className:`ss-sheet ss-sheet--${o}`,role:`dialog`,"aria-modal":`true`,"aria-label":n??`Detail`,tabIndex:-1,children:[(0,G.jsx)(`button`,{className:`ss-sheet-handle`,onClick:t,"aria-label":`Close`,type:`button`}),(0,G.jsxs)(`div`,{className:`ss-sheet-head`,children:[(0,G.jsxs)(`div`,{className:`ss-sheet-head-text`,children:[n&&(0,G.jsx)(`h2`,{className:`ss-sheet-title`,children:n}),r&&(0,G.jsx)(`p`,{className:`ss-sheet-subtitle`,children:r})]}),(0,G.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close`,className:`ss-sheet-close`,children:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`}),(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`})]})})]}),(0,G.jsx)(`div`,{className:`ss-sheet-body`,children:i}),a&&(0,G.jsx)(`div`,{className:`ss-sheet-footer`,children:a})]})}):null}var yl={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},bl=[`all`,`allow`,`block`,`force`,`log`],xl={allow:`text-emerald-300`,block:`text-red-300`,force:`text-amber-300`,log:`text-[var(--color-fg-3)]`};function Sl(e){return new Date(e*1e3).toLocaleString()}function Cl(e,t){if(!t)return``;let n=t-e;return n<60?`${n}s`:`${Math.round(n/60)}m`}async function wl(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:z()})}async function Tl(e,t){try{return await(await fetch(`/api/rules/set-enabled`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...z()},body:JSON.stringify({ruleId:e,enabled:t})})).json()}catch(e){return{error:String(e)}}}function El(e){try{let t=JSON.parse(e).input;return t&&typeof t==`object`?ir(``,JSON.stringify(t)):ir(``,e)}catch{return e.slice(0,80)}}function Dl(e){try{let t=JSON.parse(e);return t.input===void 0?JSON.stringify(JSON.parse(e),null,2):JSON.stringify(t.input,null,2)}catch{return e}}function Ol({label:e,value:t,tone:n}){return(0,G.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm tabular-nums ${n??`text-[var(--color-fg-0)]`}`,children:t}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-[var(--color-fg-3)]`,children:e})]})}function kl(e,t){let n=Math.floor(Date.now()/1e3),r=n-86400,i=new Map;for(let t of e){if(t.decision!==`ask`||t.created_at<r||!t.rule_id)continue;let e=i.get(t.rule_id);e?(e.count+=1,t.created_at>e.lastSeen&&(e.lastSeen=t.created_at)):i.set(t.rule_id,{ruleId:t.rule_id,ruleMessage:t.rule_message||t.rule_id,count:1,lastSeen:t.created_at})}for(let e of t){if(!e.ruleId)continue;let t=i.get(e.ruleId);t?(t.count+=1,t.lastSeen=n):i.set(e.ruleId,{ruleId:e.ruleId,ruleMessage:e.ruleMessage||e.ruleId,count:1,lastSeen:n})}return Array.from(i.values()).filter(e=>e.count>=3).sort((e,t)=>t.count-e.count||t.lastSeen-e.lastSeen).slice(0,5)}function Al(e){let t=Math.max(0,Math.floor(Date.now()/1e3)-e);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function jl({ruleId:e,ruleMessage:t,onDismiss:n,onUndo:r}){let[i,a]=(0,_.useState)(!1),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>(o.current=setTimeout(n,6e3),()=>{o.current&&clearTimeout(o.current)}),[n]),(0,G.jsxs)(`div`,{className:`fixed bottom-5 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 px-4 py-2.5 rounded-full border border-[var(--color-line-2)] bg-[var(--color-surface-1)] backdrop-blur-md shadow-lg`,children:[(0,G.jsxs)(`span`,{className:`text-xs text-[var(--color-fg-1)]`,children:[`Silenced `,(0,G.jsx)(`span`,{className:`font-mono text-[var(--color-fg-0)]`,children:t})]}),(0,G.jsx)(`button`,{type:`button`,disabled:i,onClick:async()=>{a(!0),await r(),n()},className:`text-[11px] font-mono uppercase tracking-wider px-2.5 py-1 rounded-full border border-[var(--color-brand)]/40 text-[var(--color-brand)] hover:bg-[var(--color-brand)]/10 cursor-pointer disabled:opacity-50`,"aria-label":`Undo silencing ${e}`,children:`undo`}),(0,G.jsx)(`button`,{type:`button`,onClick:n,className:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer`,"aria-label":`Dismiss`,children:(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`}),(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`})]})})]})}function Ml({target:e,onClose:t,onConfirm:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null);return(0,_.useEffect)(()=>{o(null)},[e]),e?(0,G.jsxs)(vl,{open:!!e,onClose:t,size:`sm`,title:`Silence this rule?`,subtitle:`It won't ask for approval again until you re-enable it on the Rules page.`,footer:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--secondary`,disabled:r,onClick:t,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--primary`,style:{"--tone":`#ff6f6f`},disabled:r,onClick:async()=>{i(!0),o(null);let r=await n(e);if(i(!1),!r.ok){o(r.message??`Could not silence rule.`);return}t()},children:r?`Silencing…`:`Disable rule`})]}),children:[(0,G.jsxs)(`div`,{className:`ss-list`,children:[(0,G.jsx)(`div`,{className:`ss-list-row`,style:{cursor:`default`},children:(0,G.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(`div`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-1`,children:`rule`}),(0,G.jsx)(`div`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,G.jsx)(il,{ruleId:e.ruleId,children:(0,G.jsx)(`code`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] block mt-1 break-all`,children:e.ruleId})})]})}),(0,G.jsx)(`div`,{className:`ss-list-row`,style:{cursor:`default`},children:(0,G.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(`div`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-1`,children:`recent activity`}),(0,G.jsxs)(`div`,{className:`text-sm text-[var(--color-fg-1)]`,children:[`Triggered`,` `,(0,G.jsx)(`strong`,{className:`text-[var(--color-fg-0)] tabular-nums`,children:e.fireCount}),` `,e.fireCount===1?`time`:`times`,` in the last 24 hours.`]})]})})]}),(0,G.jsxs)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-3 leading-relaxed`,children:[`Disabling a rule is fully reversible — head to`,` `,(0,G.jsx)(`a`,{href:`/rules`,className:`text-[var(--color-brand)] hover:underline`,children:`Rules`}),` `,`to switch it back on.`]}),a&&(0,G.jsx)(`p`,{className:`mt-3 text-xs text-red-300`,role:`alert`,children:a})]}):null}function Nl(){let e=Ae([`pending-changed`,`rules-changed`]),{data:t,refetch:n}=B(`/api/json/pending`,[e[`pending-changed`]]),{data:r}=B(`/api/json/approvals`,[e[`pending-changed`]]),[i,a]=(0,_.useState)(`all`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(new Set),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=(0,_.useMemo)(()=>kl(r??[],t??[]),[r,t]),h=(0,_.useMemo)(()=>{let e=new Map;for(let t of m)e.set(t.ruleId,t.count);return e},[m]),g=Math.floor(Date.now()/1e3),v=(r??[]).filter(e=>e.created_at>=g-86400).length,y=(r??[]).reduce((e,t)=>(e[t.decision]=(e[t.decision]??0)+1,e),{}),b=(r??[]).filter(e=>{if(i!==`all`&&e.decision!==i)return!1;if(o){let t=o.toLowerCase(),n=El(e.input).toLowerCase();if(!e.tool.toLowerCase().includes(t)&&!e.rule_id.toLowerCase().includes(t)&&!(e.rule_message??``).toLowerCase().includes(t)&&!n.includes(t))return!1}return!0});function x(e){l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function S(e){let t=await Tl(e.ruleId,!1);return t.error||t.ok===!1?{ok:!1,message:t.error??`Server rejected the request.`}:(e.pendingId&&await wl(e.pendingId,`block`),p({ruleId:e.ruleId,ruleMessage:e.ruleMessage}),n(),{ok:!0})}async function C(e){await Tl(e,!0),n()}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`overline text-[11px]`,children:`approvals`}),(0,G.jsx)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-1 font-mono`,children:`approve or deny pending tool calls · review past decisions · silence noisy rules`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 px-3 py-2.5 rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)]/60`,children:[(0,G.jsx)(Ol,{label:`pending`,value:t?.length??0,tone:`text-amber-300`}),(0,G.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),[`allow`,`block`,`force`,`log`].map(e=>(0,G.jsx)(Ol,{label:e,value:y[e]??0,tone:xl[e]},e)),(0,G.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),(0,G.jsx)(Ol,{label:`last 24h`,value:v})]}),m.length>0&&(0,G.jsxs)(`section`,{className:`ss-noisy-card`,"aria-label":`Noisy rules`,children:[(0,G.jsxs)(`div`,{className:`ss-noisy-card-head`,children:[(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M12 9v4`}),(0,G.jsx)(`path`,{d:`M12 17h.01`}),(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`})]}),`asking too often · last 24h`]}),m.map(e=>(0,G.jsxs)(`div`,{className:`ss-noisy-row`,children:[(0,G.jsx)(`span`,{className:`ss-noisy-count`,"aria-label":`${e.count} fires`,children:e.count}),(0,G.jsxs)(`div`,{className:`ss-noisy-text`,children:[(0,G.jsx)(`span`,{className:`ss-noisy-title`,children:e.ruleMessage}),(0,G.jsxs)(`span`,{className:`ss-noisy-sub`,children:[(0,G.jsx)(il,{ruleId:e.ruleId,children:(0,G.jsx)(`code`,{className:`font-mono`,children:e.ruleId})}),(0,G.jsx)(`span`,{style:{margin:`0 6px`},children:`·`}),`last fired `,Al(e.lastSeen)]})]}),(0,G.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger`,onClick:()=>d({ruleId:e.ruleId,ruleMessage:e.ruleMessage,fireCount:e.count}),"aria-label":`Silence rule ${e.ruleId}`,children:[(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,G.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,G.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Silence`]})]},e.ruleId))]}),t&&t.length>0&&(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,G.jsxs)(`h2`,{className:`overline text-[11px]`,children:[`pending · `,t.length]})}),(0,G.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>{let t=h.get(e.ruleId)??0;return(0,G.jsxs)(K,{className:`border-l-2 border-l-amber-400/60`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,G.jsxs)(`div`,{className:`flex gap-2 flex-wrap items-center`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`primary`,onClick:async()=>{await wl(e.id,`allow`),n()},children:`approve`}),(0,G.jsx)(Y,{size:`sm`,variant:`danger`,onClick:async()=>{await wl(e.id,`block`),n()},children:`deny`}),(0,G.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger`,onClick:()=>d({ruleId:e.ruleId,ruleMessage:e.ruleMessage,fireCount:t||1,pendingId:e.id}),"aria-label":`Disable rule ${e.ruleId}`,children:[(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,G.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,G.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Disable rule`]})]})]}),(0,G.jsxs)(J,{className:`space-y-2 text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex gap-3 flex-wrap items-center`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`tool`}),(0,G.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool}),(0,G.jsx)(`span`,{className:`overline ml-2`,children:`rule`}),(0,G.jsx)(il,{ruleId:e.ruleId,children:(0,G.jsx)(`span`,{className:`font-mono text-[var(--color-fg-2)]`,children:e.ruleId})}),t>=3&&(0,G.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded-full`,style:{background:`color-mix(in oklab, #ffa657 14%, transparent)`,color:`#ffb27d`,border:`1px solid color-mix(in oklab, #ffa657 28%, transparent)`},title:`Fired ${t} times in the last 24h`,children:[`asks often · `,t,`×`]})]}),e.prompt&&(0,G.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,G.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,G.jsx)(hc,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id)})})]}),(0,G.jsxs)(`section`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-3 gap-3 flex-wrap`,children:[(0,G.jsx)(`h2`,{className:`overline text-[11px]`,children:`history`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`div`,{className:`flex gap-0.5 rounded-sm border border-[var(--color-line-1)] p-0.5 bg-[var(--color-surface-1)]`,children:bl.map(e=>(0,G.jsx)(`button`,{onClick:()=>a(e),className:`px-2 py-0.5 rounded-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer ${i===e?`bg-[var(--color-brand)]/10 text-[var(--color-brand)] border border-[var(--color-brand)]/30`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-transparent`}`,children:e},e))}),(0,G.jsx)(`input`,{type:`text`,placeholder:`search tool, rule, command…`,value:o,onChange:e=>s(e.target.value),className:`text-xs font-mono bg-[var(--color-surface-1)] border border-[var(--color-line-1)] rounded-sm px-2.5 py-1 text-[var(--color-fg-1)] placeholder-[var(--color-fg-4)] focus:outline-none focus:border-[var(--color-brand)]/50 w-48`})]})]}),!r||r.length===0?(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:`no approval history yet`}):b.length===0?(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:`no results match your filter`}):(0,G.jsx)(K,{children:(0,G.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:b.map(e=>{let t=c.has(e.id),n=El(e.input),r=Cl(e.created_at,e.resolved_at);return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`button`,{onClick:()=>x(e.id),className:`w-full text-left px-3 py-2 hover:bg-[var(--color-surface-2)]/60 transition-colors cursor-pointer flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-[10px] w-2.5 shrink-0 mt-1`,children:t?`▼`:`▶`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] whitespace-nowrap tabular-nums`,children:Sl(e.resolved_at??e.created_at)}),(0,G.jsx)(cr,{variant:yl[e.decision]??`gray`,children:e.decision}),(0,G.jsx)(`code`,{className:`text-xs text-[var(--color-brand)] font-mono`,children:e.tool}),r&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] ml-auto`,children:[`Δ`,r]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-xs text-[var(--color-fg-2)] truncate flex-1 min-w-0`,children:e.rule_message||e.rule_id||`—`}),n&&(0,G.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)] font-mono truncate flex-1 min-w-0 hidden md:block`,children:n})]})]})]}),t&&(0,G.jsxs)(`div`,{className:`px-3 pb-3 pt-1 space-y-2 bg-[var(--color-surface-0)]`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs font-mono items-center`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),` `,e.rule_id?(0,G.jsx)(il,{ruleId:e.rule_id,children:(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.rule_id})}):(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:`—`})]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`created`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Sl(e.created_at)})]}),e.resolved_at&&(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`resolved`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Sl(e.resolved_at)})]}),e.rule_id&&(0,G.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger ml-auto`,onClick:()=>d({ruleId:e.rule_id,ruleMessage:e.rule_message||e.rule_id,fireCount:h.get(e.rule_id)??1}),"aria-label":`Silence rule ${e.rule_id}`,children:[(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,G.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,G.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Silence rule`]})]}),e.prompt&&(0,G.jsxs)(`div`,{className:`text-xs flex gap-2 items-start`,children:[(0,G.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,G.jsx)(hc,{children:Dl(e.input)})]})]},e.id)})})})]}),(0,G.jsx)(Ml,{target:u,onClose:()=>d(null),onConfirm:S}),f&&(0,G.jsx)(jl,{ruleId:f.ruleId,ruleMessage:f.ruleMessage,onDismiss:()=>p(null),onUndo:()=>C(f.ruleId)})]})}function Pl(){let{data:e,refetch:t}=B(`/api/json/inspector-targets`),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(1),u=(0,_.useRef)(new Map),d=(0,_.useRef)(new Map),f=(0,_.useCallback)(()=>{let e=c.current;if(c.current=null,e)try{e.close()}catch{}r(!1),a(!1),s(null)},[]),p=(0,_.useCallback)(e=>{c.current&&f(),a(!0),s(null);let t=new WebSocket(`/ws/inspector?target=${encodeURIComponent(e)}`);c.current=t,t.onopen=()=>{r(!0),a(!1),s(null)},t.onclose=()=>{c.current=null,r(!1),a(!1)},t.onerror=()=>{a(!1),s(`Connection failed — is the inspector running with the correct target ID?`)},t.onmessage=e=>{try{let t=JSON.parse(e.data);if(t.id!=null){let e=u.current.get(t.id);e&&(u.current.delete(t.id),e(t.result))}else if(t.method){let e=d.current.get(t.method);if(e)for(let n of e)n(t.params)}}catch{}}},[f]),m=(0,_.useCallback)((e,t)=>new Promise((n,r)=>{let i=c.current;if(!i||i.readyState!==WebSocket.OPEN){r(Error(`Not connected`));return}let a=l.current++;u.current.set(a,e=>n(e)),i.send(JSON.stringify({id:a,method:e,params:t})),setTimeout(()=>{u.current.has(a)&&(u.current.delete(a),r(Error(`Command timed out`)))},1e4)}),[]),h=(0,_.useCallback)((e,t)=>{let n=d.current.get(e);return n||(n=new Set,d.current.set(e,n)),n.add(t),()=>{d.current.get(e)?.delete(t)}},[]),g=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{e?.active&&e?.target&&!n&&!i&&!g.current&&(g.current=!0,p(e.target.id))},[e?.active,e?.target?.id,n,i,p]),(0,_.useEffect)(()=>()=>{f()},[f]),{active:e?.active??!1,bunVersion:e?.version?.[`Bun-Version`]??null,preconfiguredTarget:e?.target??null,connected:n,connecting:i,error:o,connect:p,disconnect:f,sendCommand:m,onEvent:h,refetch:t}}var Fl=18,Z=5e-4;function Q(e,t){return t===`(garbage collector)`||t===`(idle)`?`#450a0a`:e?e.startsWith(`node:`)||e.startsWith(`bun:`)?`#172554`:e.startsWith(`file:`)||e.startsWith(`/`)||e.includes(`.ts`)||e.includes(`.js`)?`#451a03`:`#1f2937`:`#1f2937`}function Il(e,t){return t===`(garbage collector)`||t===`(idle)`?`#fca5a5`:e?e.startsWith(`node:`)||e.startsWith(`bun:`)?`#93c5fd`:e.startsWith(`file:`)||e.startsWith(`/`)||e.includes(`.ts`)||e.includes(`.js`)?`#fbbf24`:`#6b7280`:`#6b7280`}function Ll(e,t){let n=new Map;for(let t of e.nodes)n.set(t.id,t);let r=new Map;function i(e){let t=n.get(e);if(!t)return 0;let a=t.hitCount??0;for(let e of t.children??[])a+=i(e);return r.set(e,a),a}let a=e.nodes[0];if(!a)return[];i(a.id);let o=t??a.id,s=r.get(o)??0;if(s===0)return[];let c=[];function l(e,t,i){let a=n.get(e);if(!a)return;let o=r.get(e)??0,u=o/s;if(u<Z)return;c.push({x:i,width:u,depth:t,node:a,subtreeHits:o});let d=i;for(let e of a.children??[]){let n=(r.get(e)??0)/s;l(e,t+1,d),d+=n}}return l(o,0,0),c}function Rl(e){return e<1e3?`${e}µs`:e<1e6?`${(e/1e3).toFixed(1)}ms`:`${(e/1e6).toFixed(2)}s`}function zl({profile:e}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(800),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=t.current;if(!e)return;let n=new ResizeObserver(e=>{let t=e[0]?.contentRect.width;t&&r(t)});return n.observe(e),r(e.clientWidth||800),()=>n.disconnect()},[]);let c=Ll(e,i),l=(c.reduce((e,t)=>Math.max(e,t.depth),0)+1)*Fl+4,u=e.endTime-e.startTime,d=(0,_.useCallback)(e=>{a(t=>t===e.node.id?null:e.node.id),s(null)},[]);return c.length===0?(0,G.jsx)(`p`,{className:`text-xs text-[#555] py-2`,children:`No samples — profile may be empty.`}):(0,G.jsxs)(`div`,{className:`relative select-none`,children:[i!==null&&(0,G.jsx)(`button`,{onClick:()=>a(null),className:`mb-2 text-xs text-amber-400 hover:underline`,children:`← Reset zoom`}),(0,G.jsx)(`div`,{ref:t,className:`overflow-x-hidden`,children:(0,G.jsx)(`svg`,{width:n,height:l,onMouseLeave:()=>s(null),children:c.map((e,t)=>{let r=e.x*n,a=Math.max(e.width*n,1),o=e.depth*Fl+1,c=e.node.callFrame.functionName||`(anonymous)`,l=e.node.callFrame.url,f=i===e.node.id;return(0,G.jsxs)(`g`,{children:[(0,G.jsx)(`rect`,{x:r,y:o,width:a,height:Fl-1,fill:f?`#92400e`:Q(l,c),stroke:`#080808`,strokeWidth:.5,style:{cursor:`pointer`},onClick:()=>d(e),onMouseMove:t=>s({clientX:t.clientX,clientY:t.clientY,rect:e,totalDuration:u})}),a>24&&(0,G.jsx)(`text`,{x:r+2,y:o+Fl-5,fontSize:9,fill:Il(l,c),style:{pointerEvents:`none`,userSelect:`none`},clipPath:`url(#fc-clip-${t})`,children:c}),a>24&&(0,G.jsx)(`clipPath`,{id:`fc-clip-${t}`,children:(0,G.jsx)(`rect`,{x:r,y:o,width:a,height:Fl})})]},t)})})}),o&&(0,G.jsxs)(`div`,{className:`fixed z-50 bg-[#111] border border-[#2a2a2a] rounded-lg p-2.5 text-xs shadow-xl pointer-events-none`,style:{left:o.clientX+14,top:o.clientY-8,maxWidth:320},children:[(0,G.jsx)(`div`,{className:`font-mono text-amber-400 truncate font-medium`,children:o.rect.node.callFrame.functionName||`(anonymous)`}),o.rect.node.callFrame.url&&(0,G.jsxs)(`div`,{className:`text-[#666] truncate mt-0.5 text-[10px]`,children:[o.rect.node.callFrame.url,`:`,o.rect.node.callFrame.lineNumber]}),(0,G.jsxs)(`div`,{className:`mt-1.5 space-y-0.5 text-[#aaa]`,children:[(0,G.jsxs)(`div`,{children:[`Samples:`,` `,(0,G.jsx)(`span`,{className:`text-white tabular-nums`,children:o.rect.subtreeHits})]}),(0,G.jsxs)(`div`,{children:[`Time share:`,` `,(0,G.jsxs)(`span`,{className:`text-white tabular-nums`,children:[(o.rect.width*100).toFixed(1),`%`]})]}),u>0&&(0,G.jsxs)(`div`,{children:[`Est. duration:`,` `,(0,G.jsx)(`span`,{className:`text-white tabular-nums`,children:Rl(Math.round(o.rect.width*u))})]})]}),o.rect.node.deoptReason&&(0,G.jsxs)(`div`,{className:`text-red-400 mt-1.5 text-[10px]`,children:[`⚠ `,o.rect.node.deoptReason]}),(0,G.jsx)(`div`,{className:`text-[#555] mt-1.5 text-[10px]`,children:`Click to zoom · click again to reset`})]})]})}function Bl(e){return e<1e6?`${(e/1e3).toFixed(0)}µs`:e<1e9?`${(e/1e6).toFixed(1)}ms`:`${(e/1e9).toFixed(2)}s`}function Vl(e){return new Date(e*1e3).toLocaleString()}var Hl={critical:`red`,high:`red`,medium:`amber`,low:`blue`},Ul={critical:`border-l-red-500/70`,high:`border-l-red-500/50`,medium:`border-l-amber-400/60`,low:`border-l-sky-400/50`};function Wl(){let{data:e}=B(`/api/json/profile`);if(!e)return(0,G.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading profile…`});let{diagnosis:t,sessions:n}=e;return!t||t.analyzed_evals===0?(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center`,children:(0,G.jsxs)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] font-mono`,children:[`no eval data yet — run`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg eval`}),` to start recording`]})}):(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-2`,children:[{label:`evals analyzed`,value:String(t.analyzed_evals)},{label:`median (inside)`,value:Bl(t.median_eval_ns)},{label:`p99 (inside)`,value:Bl(t.p99_eval_ns)},{label:`bottleneck`,value:t.bottleneck??`—`}].map(e=>(0,G.jsx)(xc,{label:e.label,value:e.value,labelPlacement:`above`,valueClassName:`text-xl font-medium tabular-nums text-[var(--color-fg-0)]`},e.label))}),t.phases.length>0&&(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`phase breakdown`})}),(0,G.jsx)(J,{children:(0,G.jsx)(`div`,{className:`space-y-2`,children:t.phases.filter(e=>e.median_ns>0).map(e=>{let n=e.name===t.bottleneck;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,G.jsx)(`span`,{className:`w-28 font-mono truncate ${n?`text-[var(--color-brand)] font-medium`:`text-[var(--color-fg-2)]`}`,title:n?`bottleneck`:void 0,children:e.name}),(0,G.jsx)(Cc,{pct:Math.min(e.pct_of_total,100),tone:n?`amber`:`gray`,className:`h-1 flex-1`}),(0,G.jsx)(`span`,{className:`w-16 text-right text-[var(--color-fg-1)] tabular-nums font-mono`,children:Bl(e.median_ns)}),(0,G.jsxs)(`span`,{className:`w-10 text-right text-[var(--color-fg-3)] tabular-nums font-mono`,children:[e.pct_of_total,`%`]}),(0,G.jsxs)(`span`,{className:`w-20 text-right text-[var(--color-fg-4)] tabular-nums font-mono text-[10px]`,children:[`p95 `,Bl(e.p95_ns)]})]},e.name)})})})]}),t.recommendations.length>0&&(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsxs)(`span`,{className:`overline`,children:[`recommendations · `,t.recommendations.length]})}),(0,G.jsx)(J,{className:`space-y-2`,children:t.recommendations.map((e,t)=>(0,G.jsxs)(`div`,{className:`border border-[var(--color-line-1)] bg-[var(--color-surface-0)] rounded-sm px-3 py-2.5 border-l-2 ${Ul[e.severity]??`border-l-[var(--color-line-2)]`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,G.jsx)(cr,{variant:Hl[e.severity]??`gray`,children:e.severity}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:e.type})]}),(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-1)] leading-relaxed`,children:e.message}),e.fix_command&&(0,G.jsxs)(`code`,{className:`text-[11px] text-[var(--color-brand)] font-mono mt-1.5 block`,children:[`$ `,e.fix_command]})]},t))})]}),t.anomalies.length>0&&(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsxs)(`span`,{className:`overline`,children:[`anomalies · `,t.anomalies.length]})}),(0,G.jsx)(J,{children:(0,G.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:t.anomalies.map((e,t)=>(0,G.jsxs)(`div`,{className:`py-2 flex items-center gap-4 text-xs font-mono`,children:[(0,G.jsx)(`span`,{className:`w-24 text-[var(--color-brand)] uppercase tracking-wider text-[10px]`,children:e.type}),(0,G.jsxs)(`span`,{className:`w-10 tabular-nums text-[var(--color-fg-1)]`,children:[e.count,`×`]}),(0,G.jsxs)(`span`,{className:`w-20 tabular-nums text-[var(--color-fg-1)]`,children:[e.max_ms,`ms max`]}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:e.likely_cause})]},t))})})]}),n.length>0&&(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`session history`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[n.length,` session`,n.length===1?``:`s`]})]}),(0,G.jsx)(J,{className:`p-0`,children:(0,G.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:[...n].reverse().map((e,t)=>(0,G.jsxs)(`div`,{className:`px-4 py-2.5 flex flex-wrap items-center gap-x-5 gap-y-1 text-xs ${e.is_current?`bg-amber-400/[0.04] border-l-2 border-l-amber-400/60`:``}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 w-48 shrink-0`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums font-mono`,children:Vl(e.start_ts)}),e.is_current&&(0,G.jsx)(cr,{variant:`amber`,children:`current`})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums font-mono w-20`,children:[e.evals,` eval`,e.evals===1?``:`s`]}),(0,G.jsxs)(`span`,{className:`text-emerald-300 tabular-nums font-mono`,children:[e.allowed,` allow`]}),e.blocked>0&&(0,G.jsxs)(`span`,{className:`text-red-300 tabular-nums font-mono`,children:[e.blocked,` block (`,e.block_rate_pct,`%)`]}),e.asked>0&&(0,G.jsxs)(`span`,{className:`text-sky-300 tabular-nums font-mono`,children:[e.asked,` ask`]}),e.forced>0&&(0,G.jsxs)(`span`,{className:`text-violet-300 tabular-nums font-mono`,children:[e.forced,` force`]}),e.avg_ns>0&&(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums ml-auto font-mono`,children:[`avg `,Bl(e.avg_ns)]}),e.top_rule&&(0,G.jsxs)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.top_rule)}`,className:`text-[var(--color-fg-4)] hover:text-[var(--color-brand)] font-mono truncate max-w-xs transition-colors w-full pl-48`,title:`most blocked rule: ${e.top_rule}`,children:[`top block: `,e.top_rule]})]},t))})})]})]})}var Gl={log:`text-[var(--color-fg-1)]`,info:`text-sky-300`,warn:`text-amber-300`,error:`text-red-300`,debug:`text-[var(--color-fg-3)]`};function Kl(e){return e.value==null?e.description?e.description:`[${e.type}]`:String(e.value)}function ql(){let e=Pl(),[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(0);(0,_.useEffect)(()=>{d.current?.scrollIntoView({behavior:`smooth`})},[a]),(0,_.useEffect)(()=>{if(e.connected)return e.sendCommand(`Runtime.enable`).catch(()=>{}),e.onEvent(`Runtime.consoleAPICalled`,e=>{let t=e;o(e=>{let n=[...e,{id:f.current++,type:t.type??`log`,args:t.args??[],timestamp:t.timestamp??Date.now()}];return n.length>500?n.slice(-500):n})})},[e.connected]);let p=(0,_.useCallback)(()=>{e.preconfiguredTarget&&e.connect(e.preconfiguredTarget.id)},[e]),m=(0,_.useCallback)(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),i(null)}catch(e){console.error(`Profiler.start failed:`,e)}},[e]),h=(0,_.useCallback)(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch(e){console.error(`Profiler.stop failed:`,e),n(!1)}},[e]),g=(0,_.useCallback)(async()=>{u(!0);try{let t=await e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0});c(JSON.parse(t.result.value))}catch{}finally{u(!1)}},[e]);function v(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}let y=e.connected?`connected${e.bunVersion?` · bun v${e.bunVersion}`:``}`:e.connecting?`connecting…`:e.active?`inspector active, connecting…`:`inspector not available`,b=e.connected?`bg-emerald-400`:e.connecting?`bg-amber-400 pulse-soft`:e.active?`bg-sky-400`:`bg-[var(--color-line-2)]`;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono text-[var(--color-fg-2)]`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${b}`}),y]}),e.connected?(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:e.disconnect,children:`disconnect`}):(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:e.preconfiguredTarget?p:e.refetch,disabled:e.connecting,children:e.preconfiguredTarget?`reconnect`:`refresh`})]})]}),e.error&&(0,G.jsx)(J,{children:(0,G.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:e.error})})]}),e.connected&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`cpu profiler`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300 flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-400 pulse-soft`}),`recording`]}),t?(0,G.jsx)(Y,{variant:`danger`,size:`sm`,onClick:h,children:`stop & render`}):(0,G.jsx)(Y,{variant:`primary`,size:`sm`,onClick:m,children:`start recording`})]})]}),(0,G.jsx)(J,{children:r?(0,G.jsx)(Tc,{profile:r,children:(0,G.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 overflow-x-hidden`,children:(0,G.jsx)(zl,{profile:r})})}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:t?`recording… perform actions in ssg, then stop.`:`click start recording, perform actions, then stop.`})})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`memory`}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:g,disabled:l,children:l?`…`:`refresh`})]}),(0,G.jsx)(J,{children:s?(0,G.jsx)(Ec,{memory:s,formatValue:v}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:`click refresh to fetch process.memoryUsage().`})})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`console`}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>o([]),children:`clear`})]}),(0,G.jsx)(J,{children:(0,G.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 h-56 overflow-y-auto font-mono text-[11px]`,children:[a.length===0?(0,G.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`console output will appear here…`}):a.map(e=>(0,G.jsxs)(`div`,{className:`py-0.5 border-b border-[var(--color-line-0)] ${Gl[e.type]??`text-[var(--color-fg-1)]`}`,children:[(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)] mr-2 uppercase tracking-wider`,children:[`[`,e.type,`]`]}),e.args.map(Kl).join(` `)]},e.id)),(0,G.jsx)(`div`,{ref:d})]})})]})]}),!e.connected&&!e.connecting&&(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center`,children:(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:e.active?`waiting for inspector connection…`:`inspector auto-starts with ssg serve. profiler, memory, and console appear here once connected.`})})]})}function Jl({active:e,onClick:t,children:n}){return(0,G.jsxs)(`button`,{onClick:t,className:`relative px-3 h-9 text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer ${e?`text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,children:[n,e&&(0,G.jsx)(`span`,{className:`absolute inset-x-2 -bottom-px h-px bg-[var(--color-brand)]`})]})}function Yl(){let[e,t]=(0,_.useState)(`eval`);return(0,G.jsxs)(`div`,{className:`space-y-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center border-b border-[var(--color-line-0)] mb-5`,children:[(0,G.jsx)(Jl,{active:e===`eval`,onClick:()=>t(`eval`),children:`eval profile`}),(0,G.jsx)(Jl,{active:e===`inspector`,onClick:()=>t(`inspector`),children:`runtime inspector`})]}),e===`eval`?(0,G.jsx)(Wl,{}):(0,G.jsx)(ql,{})]})}var Xl=`ssg:ui:mode:v1`,Zl=`ssg:ui:mode:seeded`,Ql=`ssg:ui-mode-change`,$l=new Set([`professional`,`enterprise`,`agent-dev`]);function eu(){try{let e=localStorage.getItem(Xl);if(e===`newcomer`||e===`pro`)return e}catch{}return null}function tu(e){try{localStorage.setItem(Xl,e)}catch{}}async function nu(){if(eu()===null){try{if(localStorage.getItem(Zl))return;localStorage.setItem(Zl,`1`)}catch{return}try{let e=await fetch(`/api/json/wizard-state`);if(!e.ok){tu(`newcomer`);return}let t=await e.json(),n=$l.has(t.profile??``)?`pro`:`newcomer`;tu(n),window.dispatchEvent(new CustomEvent(Ql,{detail:n}))}catch{tu(`newcomer`)}}}function ru(){let[e,t]=(0,_.useState)(()=>eu()??`newcomer`);return(0,_.useEffect)(()=>{nu().then(()=>{let n=eu();n&&n!==e&&t(n)});let n=e=>{let n=e.detail;(n===`newcomer`||n===`pro`)&&t(n)};return window.addEventListener(Ql,n),()=>window.removeEventListener(Ql,n)},[]),{mode:e,setMode:(0,_.useCallback)(e=>{t(e),tu(e),window.dispatchEvent(new CustomEvent(Ql,{detail:e}))},[])}}var iu=[{id:`safe-writes`,title:`Protect your files from accidents`,plainDescription:`Asks before AI overwrites or erases anything important — so you stay in control of what changes.`,example:`If AI tries to overwrite a config file, you get to approve it first.`,hubRulesetId:`safe-writes`,scenario:`any`,emoji:`🛡️`},{id:`no-destructive-fs`,title:`Stop AI from erasing files`,plainDescription:`Blocks the kind of filesystem operations that can permanently delete your work.`,example:`If AI tries to wipe a folder, SSG blocks it automatically.`,hubRulesetId:`no-destructive-fs`,scenario:`coding`,emoji:`🗑️`},{id:`secrets-guard`,title:`Keep secrets and credentials safe`,plainDescription:`Watches for AI trying to read or write your passwords, API keys, and private keys.`,example:`Reading your .env file, SSH keys, or .netrc triggers an approval request.`,hubRulesetId:`secrets-guard`,scenario:`any`,emoji:`🔑`},{id:`email-guardrails`,title:`Ask before AI sends emails`,plainDescription:`Makes sure AI never sends a message on your behalf without your explicit OK.`,example:`Any outbound email action is queued for your approval before it goes.`,hubRulesetId:`email-guardrails`,scenario:`knowledge-work`,emoji:`📧`},{id:`no-paid-apis`,title:`Block surprise charges from paid APIs`,plainDescription:`Blocks AI from calling APIs that can rack up unexpected bills — cloud storage, AI providers, payment services.`,example:`A call to OpenAI, AWS S3, or Stripe triggers a block until you allow it.`,hubRulesetId:`no-paid-apis`,scenario:`any`,emoji:`💳`},{id:`read-only-mode`,title:`Read-only mode (maximum safety)`,plainDescription:`AI can look but not touch — all write operations are blocked. Great when you just want to explore safely.`,example:`AI can read your codebase and answer questions but cannot change any files.`,hubRulesetId:`read-only`,scenario:`any`,emoji:`🔒`}];function au(e){return e?iu.filter(t=>t.scenario===`any`||t.scenario===e):iu}function ou({pack:e,installed:t,state:n,onInstall:r,onUninstall:i}){let a=n!==`idle`;return(0,G.jsxs)(`div`,{className:`ss-list-row ss-list-row--pack`,style:{cursor:`default`,background:t?`linear-gradient(180deg, color-mix(in oklab, var(--color-hig-green) 8%, transparent) 0%, transparent 60%), var(--color-surface-1)`:`var(--color-surface-1)`,borderColor:t?`color-mix(in oklab, var(--color-hig-green) 28%, var(--color-line-1))`:`var(--color-line-1)`},children:[(0,G.jsx)(`span`,{className:`ss-pack-emoji`,"aria-hidden":`true`,children:e.emoji}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`h3`,{className:`ss-pack-title`,children:e.title}),t&&(0,G.jsxs)(`span`,{className:`agent-badge agent-badge--detected`,title:`This pack is currently active.`,children:[(0,G.jsx)(`span`,{className:`agent-badge-dot`}),`Installed`]})]}),(0,G.jsx)(`p`,{className:`ss-pack-desc`,children:e.plainDescription}),(0,G.jsxs)(`p`,{className:`ss-pack-example`,children:[(0,G.jsx)(`span`,{className:`ss-pack-example__label`,children:`Example`}),e.example]})]}),(0,G.jsx)(`div`,{className:`ss-pack-action`,children:t?(0,G.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>i(e.id),className:`ss-btn ss-btn--secondary`,style:{height:30,padding:`0 12px`,fontSize:11},title:`Remove this pack from your machine.`,children:n===`uninstalling`?`Removing…`:`Remove`}):(0,G.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>r(e.id),className:`ss-btn ss-btn--primary`,style:{height:30,padding:`0 14px`,fontSize:11},title:`Install this guardrail pack.`,children:n===`installing`?`Installing…`:`Install`})})]})}function su(){let e=new URLSearchParams(window.location.search).get(`starter`),t=au(e),[n,r]=(0,_.useState)(new Set),[i,a]=(0,_.useState)({}),[o,s]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=!1;return fetch(`/api/json/hub/installed`).then(e=>e.json()).then(t=>{e||r(new Set(t.installed))}).catch(()=>{}),()=>{e=!0}},[]);function c(e,t){s({msg:e,type:t}),setTimeout(()=>s(null),5e3)}async function l(){try{let e=await(await fetch(`/api/json/hub/installed`)).json();r(new Set(e.installed))}catch{}}async function u(e){let t=iu.find(t=>t.id===e);if(t){a(t=>({...t,[e]:`installing`}));try{let n=await fetch(`/api/hub/install`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...z()},body:JSON.stringify({id:t.hubRulesetId})}),i=await n.text(),a=n.headers.get(`Content-Type`)??``,o=null;if(a.includes(`application/json`))try{o=JSON.parse(i)}catch{}o?.ok?(r(t=>new Set([...t,e])),c(o.already_installed?`${t.title} — already installed`:`${t.title} — installed`,`ok`)):c(o?o.error??`Could not install ${t.title}`:i.replace(/<[^>]+>/g,``).trim()||`Could not install ${t.title} (HTTP ${n.status})`,`error`)}catch(e){c(`Could not reach the dashboard server (${e instanceof Error?e.message:String(e)})`,`error`)}finally{a(t=>({...t,[e]:`idle`})),l()}}}async function d(e){let t=iu.find(t=>t.id===e);if(t&&window.confirm(`Remove “${t.title}”?\n\nThe rules in this pack stop applying. You can install it again any time.`)){a(t=>({...t,[e]:`uninstalling`}));try{let n=await fetch(`/api/hub/uninstall`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...z()},body:JSON.stringify({id:t.hubRulesetId})}),i=await n.text(),a=n.headers.get(`Content-Type`)??``,o=null;if(a.includes(`application/json`))try{o=JSON.parse(i)}catch{}o?.ok||n.ok&&!o?(r(t=>{let n=new Set(t);return n.delete(e),n}),c(`${t.title} — removed`,`ok`)):c(o?o.error??`Could not remove ${t.title}`:i.replace(/<[^>]+>/g,``).trim()||`Could not remove ${t.title} (HTTP ${n.status})`,`error`)}catch(e){c(`Could not reach the dashboard server (${e instanceof Error?e.message:String(e)})`,`error`)}finally{a(t=>({...t,[e]:`idle`})),l()}}}let f={coding:`for coding with AI`,"knowledge-work":`for email and docs`},p=t.filter(e=>n.has(e.id)).length;return(0,G.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,G.jsxs)(`section`,{className:`rounded-2xl p-5`,style:{border:`1px solid var(--color-line-1)`,background:`var(--color-surface-1)`},children:[(0,G.jsx)(`p`,{className:`ss-list-section-title`,style:{padding:0,marginBottom:8},children:`Guardrails`}),(0,G.jsxs)(`h1`,{className:`text-[18px] font-semibold text-[var(--color-fg-0)] tracking-tight`,children:[`One-tap protection`,e&&f[e]?` ${f[e]}`:``]}),(0,G.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] mt-1.5 leading-relaxed`,children:[`Each pack is a small set of rules that guard against a specific AI risk. Toggle them on and off — installing or removing only touches rule files in `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`.sigmashake/`}),`.`]}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mt-3`,children:[p,` of `,t.length,` active`]})]}),o&&(0,G.jsx)(`div`,{className:`rounded-xl px-4 py-2.5 text-[12px]`,style:{border:`1px solid ${o.type===`ok`?`color-mix(in oklab, var(--color-hig-green) 36%, transparent)`:`color-mix(in oklab, var(--color-hig-red) 36%, transparent)`}`,background:o.type===`ok`?`color-mix(in oklab, var(--color-hig-green) 12%, var(--color-surface-1))`:`color-mix(in oklab, var(--color-hig-red) 12%, var(--color-surface-1))`,color:o.type===`ok`?`var(--color-hig-green)`:`var(--color-hig-red)`,backdropFilter:`saturate(180%) blur(10px)`},children:o.msg}),(0,G.jsx)(`div`,{className:`ss-list`,children:t.map(e=>(0,G.jsx)(ou,{pack:e,installed:n.has(e.id),state:i[e.id]??`idle`,onInstall:u,onUninstall:d},e.id))}),(0,G.jsx)(`div`,{className:`rounded-xl p-4`,style:{border:`1px dashed var(--color-line-1)`,background:`color-mix(in oklab, var(--color-surface-1) 50%, transparent)`},children:(0,G.jsxs)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:[`Want more control? The`,` `,(0,G.jsx)(`a`,{href:`/hub`,className:`text-[var(--color-brand)] hover:underline`,children:`advanced library`}),` `,`has the full set of community rulesets and lets you preview every rule before installing.`]})})]})}function cu(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function lu(e){let t=e;if(t.endsWith(`/.sigmashake/rules`)&&(t=t.slice(0,-18)),t.endsWith(`\\.sigmashake\\rules`)&&(t=t.slice(0,-18)),t.startsWith(`/home/`)){let e=t.slice(6),n=e.indexOf(`/`);return n>=0?`~/${e.slice(n+1)}`:`~`}if(t.startsWith(`C:\\Users\\`)){let e=t.slice(9),n=e.indexOf(`\\`);return n>=0?`~\\${e.slice(n+1)}`:`~`}if(t.length>40){let e=t.split(/[/\\]/);if(e.length>2)return`…/${e[e.length-1]}`}return t}var uu=[{value:`downloads`,label:`most downloaded`},{value:`newest`,label:`newest`},{value:`rules`,label:`most rules`}],du=[``,`critical`,`high`,`medium`,`low`],fu=[``,`deny`,`ask`,`allow`,`log`];function pu(){return(0,G.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)] p-4 space-y-3 shimmer`,children:[(0,G.jsx)(`div`,{className:`h-4 bg-[var(--color-surface-3)] rounded-sm w-2/3`}),(0,G.jsx)(`div`,{className:`h-3 bg-[var(--color-surface-2)] rounded-sm w-1/3`}),(0,G.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,G.jsx)(`div`,{className:`h-5 bg-[var(--color-surface-3)] rounded-sm w-14`}),(0,G.jsx)(`div`,{className:`h-5 bg-[var(--color-surface-3)] rounded-sm w-10`})]}),(0,G.jsx)(`div`,{className:`h-7 bg-[var(--color-surface-3)] rounded-sm`})]})}function mu({tech:e}){return(0,G.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded-sm text-[10px] font-mono uppercase tracking-wider border ${{typescript:`bg-sky-500/8 text-sky-300 border-sky-500/25`,ts:`bg-sky-500/8 text-sky-300 border-sky-500/25`,javascript:`bg-amber-500/8 text-amber-300 border-amber-500/25`,js:`bg-amber-500/8 text-amber-300 border-amber-500/25`,python:`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`,rust:`bg-orange-500/8 text-orange-300 border-orange-500/25`,go:`bg-cyan-500/8 text-cyan-300 border-cyan-500/25`,bash:`bg-violet-500/8 text-violet-300 border-violet-500/25`}[e.toLowerCase()]??`bg-[var(--color-surface-2)] text-[var(--color-fg-3)] border-[var(--color-line-1)]`}`,children:e})}function hu({install:e,onRemove:t,removing:n}){let r=lu(e.path),i=e.in_sync?`bg-emerald-400`:`bg-amber-400 animate-pulse`;return(0,G.jsxs)(`div`,{className:`group/chip inline-flex items-center gap-1.5 max-w-full pl-1.5 pr-0.5 py-0.5 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)] text-[10px] font-mono text-[var(--color-fg-2)]`,title:e.in_sync?`In sync — files present in ${e.path}`:`Drift — ${e.drift_reason??`files missing or empty`} (${e.path})`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${i}`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`truncate`,title:e.path,children:r}),(0,G.jsx)(`button`,{type:`button`,onClick:r=>{r.preventDefault(),r.stopPropagation(),n||t(e.path)},disabled:n,title:`Remove from this location`,"aria-label":`Uninstall from ${e.path}`,className:`shrink-0 inline-flex items-center justify-center w-4 h-4 rounded-sm text-[var(--color-fg-4)] hover:text-red-300 hover:bg-red-500/10 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed`,children:n?(0,G.jsx)(`svg`,{className:`animate-spin`,width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,G.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}):(0,G.jsxs)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,children:[(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function gu({isInstalling:e,hasInstalls:t,onInstallDefault:n,onPickPath:r}){let[i,a]=(0,_.useState)(!1),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!i)return;function e(e){o.current&&(o.current.contains(e.target)||a(!1))}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]),(0,G.jsxs)(`div`,{ref:o,className:`relative flex w-full`,children:[(0,G.jsx)(`button`,{onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},disabled:e,className:`flex-1 h-7 rounded-l-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer
8
+ `+e.stack}}var z=Object.prototype.hasOwnProperty,be=t.unstable_scheduleCallback,xe=t.unstable_cancelCallback,Se=t.unstable_shouldYield,Ce=t.unstable_requestPaint,we=t.unstable_now,Te=t.unstable_getCurrentPriorityLevel,Ee=t.unstable_ImmediatePriority,De=t.unstable_UserBlockingPriority,Oe=t.unstable_NormalPriority,ke=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,B=t.log,je=t.unstable_setDisableYieldValue,Me=null,Ne=null;function Pe(e){if(typeof B==`function`&&je(e),Ne&&typeof Ne.setStrictMode==`function`)try{Ne.setStrictMode(Me,e)}catch{}}var Fe=Math.clz32?Math.clz32:Re,Ie=Math.log,Le=Math.LN2;function Re(e){return e>>>=0,e===0?32:31-(Ie(e)/Le|0)|0}var ze=256,Be=262144,Ve=4194304;function He(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 Ue(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=He(n))):i=He(o):i=He(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=He(n))):i=He(o)):i=He(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 We(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ge(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 Ke(){var e=Ve;return Ve<<=1,!(Ve&62914560)&&(Ve=4194304),e}function qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ye(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-Fe(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&&Xe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Xe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Fe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ze(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Fe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Qe(e,t){var n=t&-t;return n=n&42?1:$e(n),(n&(e.suspendedLanes|t))===0?n:0}function $e(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 et(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function tt(){var e=N.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function nt(e,t){var n=N.p;try{return N.p=e,t()}finally{N.p=n}}var rt=Math.random().toString(36).slice(2),it=`__reactFiber$`+rt,at=`__reactProps$`+rt,ot=`__reactContainer$`+rt,st=`__reactEvents$`+rt,ct=`__reactListeners$`+rt,lt=`__reactHandles$`+rt,ut=`__reactResources$`+rt,dt=`__reactMarker$`+rt;function ft(e){delete e[it],delete e[at],delete e[st],delete e[ct],delete e[lt]}function pt(e){var t=e[it];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ot]||n[it]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[it])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function mt(e){if(e=e[it]||e[ot]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ht(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function gt(e){var t=e[ut];return t||=e[ut]={hoistableStyles:new Map,hoistableScripts:new Map},t}function _t(e){e[dt]=!0}var vt=new Set,yt={};function bt(e,t){xt(e,t),xt(e+`Capture`,t)}function xt(e,t){for(yt[e]=t,e=0;e<t.length;e++)vt.add(t[e])}var St=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]*$`),Ct={},wt={};function Tt(e){return z.call(wt,e)?!0:z.call(Ct,e)?!1:St.test(e)?wt[e]=!0:(Ct[e]=!0,!1)}function Et(e,t,n){if(Tt(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 Dt(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 Ot(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 kt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function At(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function jt(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 Mt(e){if(!e._valueTracker){var t=At(e)?`checked`:`value`;e._valueTracker=jt(e,t,``+e[t])}}function Nt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=At(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Pt(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 Ft=/[\n"\\]/g;function It(e){return e.replace(Ft,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Lt(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=``+kt(t)):e.value!==``+kt(t)&&(e.value=``+kt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):zt(e,o,kt(n)):zt(e,o,kt(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=``+kt(s):e.removeAttribute(`name`)}function Rt(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)){Mt(e);return}n=n==null?``:``+kt(n),t=t==null?n:``+kt(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),Mt(e)}function zt(e,t,n){t===`number`&&Pt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Bt(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=``+kt(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 Vt(e,t,n){if(t!=null&&(t=``+kt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+kt(n)}function Ht(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(re(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=kt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Mt(e)}function Ut(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Wt=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 Gt(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||Wt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Kt(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&&Gt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Gt(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 Jt=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`]]),Yt=/^[\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 Xt(e){return Yt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Zt(){}var Qt=null;function $t(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var en=null,tn=null;function nn(e){var t=mt(e);if(t&&(e=t.stateNode)){var n=e[at]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Lt(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="`+It(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[at]||null;if(!a)throw Error(i(90));Lt(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&&Nt(r)}break a;case`textarea`:Vt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Bt(e,!!n.multiple,t,!1)}}}var rn=!1;function an(e,t,n){if(rn)return e(t,n);rn=!0;try{return e(t)}finally{if(rn=!1,(en!==null||tn!==null)&&(vu(),en&&(t=en,e=tn,tn=en=null,nn(t),e)))for(t=0;t<e.length;t++)nn(e[t])}}function on(e,t){var n=e.stateNode;if(n===null)return null;var r=n[at]||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 sn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),cn=!1;if(sn)try{var ln={};Object.defineProperty(ln,`passive`,{get:function(){cn=!0}}),window.addEventListener(`test`,ln,ln),window.removeEventListener(`test`,ln,ln)}catch{cn=!1}var un=null,dn=null,fn=null;function pn(){if(fn)return fn;var e,t=dn,n=t.length,r,i=`value`in un?un.value:un.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 fn=i.slice(e,1<r?1-r:void 0)}function mn(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 hn(){return!0}function gn(){return!1}function _n(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)?hn:gn,this.isPropagationStopped=gn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=hn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=hn)},persist:function(){},isPersistent:hn}),t}var vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yn=_n(vn),bn=h({},vn,{view:0,detail:0}),V=_n(bn),xn,Sn,Cn,wn=h({},bn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pn,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!==Cn&&(Cn&&e.type===`mousemove`?(xn=e.screenX-Cn.screenX,Sn=e.screenY-Cn.screenY):Sn=xn=0,Cn=e),xn)},movementY:function(e){return`movementY`in e?e.movementY:Sn}}),Tn=_n(wn),En=_n(h({},wn,{dataTransfer:0})),Dn=_n(h({},bn,{relatedTarget:0})),On=_n(h({},vn,{animationName:0,elapsedTime:0,pseudoElement:0})),kn=_n(h({},vn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),An=_n(h({},vn,{data:0})),H={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},jn={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`},Mn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Nn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Mn[e])?!!t[e]:!1}function Pn(){return Nn}var Fn=_n(h({},bn,{key:function(e){if(e.key){var t=H[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=mn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pn,charCode:function(e){return e.type===`keypress`?mn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?mn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),In=_n(h({},wn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ln=_n(h({},bn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pn})),U=_n(h({},vn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=_n(h({},wn,{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})),zn=_n(h({},vn,{newState:0,oldState:0})),Bn=[9,13,27,32],Vn=sn&&`CompositionEvent`in window,Hn=null;sn&&`documentMode`in document&&(Hn=document.documentMode);var Un=sn&&`TextEvent`in window&&!Hn,Wn=sn&&(!Vn||Hn&&8<Hn&&11>=Hn),Gn=` `,Kn=!1;function qn(e,t){switch(e){case`keyup`:return Bn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Jn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Yn=!1;function Xn(e,t){switch(e){case`compositionend`:return Jn(t);case`keypress`:return t.which===32?(Kn=!0,Gn):null;case`textInput`:return e=t.data,e===Gn&&Kn?null:e;default:return null}}function Zn(e,t){if(Yn)return e===`compositionend`||!Vn&&qn(e,t)?(e=pn(),fn=dn=un=null,Yn=!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 Wn&&t.locale!==`ko`?null:t.data;default:return null}}var Qn={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 $n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Qn[e.type]:t===`textarea`}function er(e,t,n,r){en?tn?tn.push(r):tn=[r]:en=r,t=Td(t,`onChange`),0<t.length&&(n=new yn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var tr=null,W=null;function nr(e){vd(e,0)}function rr(e){if(Nt(ht(e)))return e}function ir(e,t){if(e===`change`)return t}var ar=!1;if(sn){var G;if(sn){var or=`oninput`in document;if(!or){var K=document.createElement(`div`);K.setAttribute(`oninput`,`return;`),or=typeof K.oninput==`function`}G=or}else G=!1;ar=G&&(!document.documentMode||9<document.documentMode)}function q(){tr&&(tr.detachEvent(`onpropertychange`,J),W=tr=null)}function J(e){if(e.propertyName===`value`&&rr(W)){var t=[];er(t,W,e,$t(e)),an(nr,t)}}function sr(e,t,n){e===`focusin`?(q(),tr=t,W=n,tr.attachEvent(`onpropertychange`,J)):e===`focusout`&&q()}function cr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return rr(W)}function lr(e,t){if(e===`click`)return rr(t)}function ur(e,t){if(e===`input`||e===`change`)return rr(t)}function Y(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var dr=typeof Object.is==`function`?Object.is:Y;function fr(e,t){if(dr(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(!z.call(t,i)||!dr(e[i],t[i]))return!1}return!0}function pr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function mr(e,t){var n=pr(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=pr(n)}}function hr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?hr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function gr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pt(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=Pt(e.document)}return t}function _r(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 vr=sn&&`documentMode`in document&&11>=document.documentMode,yr=null,br=null,xr=null,Sr=!1;function Cr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Sr||yr==null||yr!==Pt(r)||(r=yr,`selectionStart`in r&&_r(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}),xr&&fr(xr,r)||(xr=r,r=Td(br,`onSelect`),0<r.length&&(t=new yn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=yr)))}function wr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Tr={animationend:wr(`Animation`,`AnimationEnd`),animationiteration:wr(`Animation`,`AnimationIteration`),animationstart:wr(`Animation`,`AnimationStart`),transitionrun:wr(`Transition`,`TransitionRun`),transitionstart:wr(`Transition`,`TransitionStart`),transitioncancel:wr(`Transition`,`TransitionCancel`),transitionend:wr(`Transition`,`TransitionEnd`)},Er={},Dr={};sn&&(Dr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Tr.animationend.animation,delete Tr.animationiteration.animation,delete Tr.animationstart.animation),`TransitionEvent`in window||delete Tr.transitionend.transition);function Or(e){if(Er[e])return Er[e];if(!Tr[e])return e;var t=Tr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Dr)return Er[e]=t[n];return e}var kr=Or(`animationend`),Ar=Or(`animationiteration`),jr=Or(`animationstart`),Mr=Or(`transitionrun`),Nr=Or(`transitionstart`),Pr=Or(`transitioncancel`),Fr=Or(`transitionend`),Ir=new Map,Lr=`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(` `);Lr.push(`scrollEnd`);function Rr(e,t){Ir.set(e,t),bt(t,[e])}var zr=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)},Br=[],Vr=0,Hr=0;function Ur(){for(var e=Vr,t=Hr=Vr=0;t<e;){var n=Br[t];Br[t++]=null;var r=Br[t];Br[t++]=null;var i=Br[t];Br[t++]=null;var a=Br[t];if(Br[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&qr(n,i,a)}}function Wr(e,t,n,r){Br[Vr++]=e,Br[Vr++]=t,Br[Vr++]=n,Br[Vr++]=r,Hr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Gr(e,t,n,r){return Wr(e,t,n,r),Jr(e)}function Kr(e,t){return Wr(e,null,null,t),Jr(e)}function qr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Fe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Jr(e){if(50<lu)throw lu=0,uu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yr={};function Xr(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 Zr(e,t,n,r){return new Xr(e,t,n,r)}function Qr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $r(e,t){var n=e.alternate;return n===null?(n=Zr(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 ei(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 ti(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)Qr(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,se.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ee:return e=Zr(31,n,t,a),e.elementType=ee,e.lanes=o,e;case y:return ni(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=Zr(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=Zr(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=Zr(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Zr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ni(e,t,n,r){return e=Zr(7,e,r,t),e.lanes=n,e}function ri(e,t,n){return e=Zr(6,e,null,t),e.lanes=n,e}function ii(e){var t=Zr(18,null,null,0);return t.stateNode=e,t}function ai(e,t,n){return t=Zr(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var oi=new WeakMap;function si(e,t){if(typeof e==`object`&&e){var n=oi.get(e);return n===void 0?(t={value:e,source:t,stack:ye(t)},oi.set(e,t),t):n}return{value:e,source:t,stack:ye(t)}}var ci=[],li=0,ui=null,di=0,fi=[],pi=0,mi=null,hi=1,gi=``;function _i(e,t){ci[li++]=di,ci[li++]=ui,ui=e,di=t}function vi(e,t,n){fi[pi++]=hi,fi[pi++]=gi,fi[pi++]=mi,mi=e;var r=hi;e=gi;var i=32-Fe(r)-1;r&=~(1<<i),n+=1;var a=32-Fe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,hi=1<<32-Fe(t)+i|n<<i|r,gi=a+e}else hi=1<<a|n<<i|r,gi=e}function yi(e){e.return!==null&&(_i(e,1),vi(e,1,0))}function bi(e){for(;e===ui;)ui=ci[--li],ci[li]=null,di=ci[--li],ci[li]=null;for(;e===mi;)mi=fi[--pi],fi[pi]=null,gi=fi[--pi],fi[pi]=null,hi=fi[--pi],fi[pi]=null}function xi(e,t){fi[pi++]=hi,fi[pi++]=gi,fi[pi++]=mi,hi=t.id,gi=t.overflow,mi=e}var Si=null,Ci=null,wi=!1,Ti=null,Ei=!1,Di=Error(i(519));function Oi(e){throw Pi(si(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Di}function ki(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[it]=e,t[at]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<gd.length;n++)$(gd[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),Rt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),Ht(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||jd(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=Zt),t=!0):t=!1,t||Oi(e,!0)}function Ai(e){for(Si=e.return;Si;)switch(Si.tag){case 5:case 31:case 13:Ei=!1;return;case 27:case 3:Ei=!0;return;default:Si=Si.return}}function ji(e){if(e!==Si)return!1;if(!wi)return Ai(e),wi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Ud(e.type,e.memoizedProps)),n=!n),n&&Ci&&Oi(e),Ai(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ci=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ci=uf(e)}else t===27?(t=Ci,Zd(e.type)?(e=lf,lf=null,Ci=e):Ci=t):Ci=Si?cf(e.stateNode.nextSibling):null;return!0}function Mi(){Ci=Si=null,wi=!1}function Ni(){var e=Ti;return e!==null&&(Yl===null?Yl=e:Yl.push.apply(Yl,e),Ti=null),e}function Pi(e){Ti===null?Ti=[e]:Ti.push(e)}var Fi=P(null),Ii=null,Li=null;function Ri(e,t,n){I(Fi,t._currentValue),t._currentValue=n}function zi(e){e._currentValue=Fi.current,F(Fi)}function Bi(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 Vi(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),Bi(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),Bi(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 Hi(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;dr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===le.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}a=a.return}e!==null&&Vi(t,e,n,r),t.flags|=262144}function Ui(e){for(e=e.firstContext;e!==null;){if(!dr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Wi(e){Ii=e,Li=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Gi(e){return qi(Ii,e)}function Ki(e,t){return Ii===null&&Wi(e),qi(e,t)}function qi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Li===null){if(e===null)throw Error(i(308));Li=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Li=Li.next=t;return n}var Ji=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()})}},Yi=t.unstable_scheduleCallback,Xi=t.unstable_NormalPriority,Zi={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qi(){return{controller:new Ji,data:new Map,refCount:0}}function $i(e){e.refCount--,e.refCount===0&&Yi(Xi,function(){e.controller.abort()})}var ea=null,ta=0,na=0,ra=null;function ia(e,t){if(ea===null){var n=ea=[];ta=0,na=ud(),ra={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ta++,t.then(aa,aa),t}function aa(){if(--ta===0&&ea!==null){ra!==null&&(ra.status=`fulfilled`);var e=ea;ea=null,na=0,ra=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function oa(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 sa=M.S;M.S=function(e,t){Ql=we(),typeof t==`object`&&t&&typeof t.then==`function`&&ia(e,t),sa!==null&&sa(e,t)};var ca=P(null);function la(){var e=ca.current;return e===null?Fl.pooledCache:e}function ua(e,t){t===null?I(ca,ca.current):I(ca,t.pool)}function da(){var e=la();return e===null?null:{parent:Zi._currentValue,pool:e}}var fa=Error(i(460)),pa=Error(i(474)),ma=Error(i(542)),ha={then:function(){}};function ga(e){return e=e.status,e===`fulfilled`||e===`rejected`}function _a(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Zt,Zt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,xa(e),e;default:if(typeof t.status==`string`)t.then(Zt,Zt);else{if(e=Fl,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,xa(e),e}throw ya=t,fa}}function va(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ya=e,fa):e}}var ya=null;function ba(){if(ya===null)throw Error(i(459));var e=ya;return ya=null,e}function xa(e){if(e===fa||e===ma)throw Error(i(483))}var Sa=null,Ca=0;function wa(e){var t=Ca;return Ca+=1,Sa===null&&(Sa=[]),_a(Sa,e,t)}function Ta(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ea(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Da(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=$r(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=ri(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&va(i)===t.type)?(t=a(t,n.props),Ta(t,n),t.return=e,t):(t=ti(n.type,n.key,n.props,null,e.mode,r),Ta(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=ai(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=ni(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=ri(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ti(t.type,t.key,t.props,null,e.mode,n),Ta(n,t),n.return=e,n;case v:return t=ai(t,e.mode,n),t.return=e,t;case O:return t=va(t),f(e,t,n)}if(re(t)||j(t))return t=ni(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,wa(t),n);if(t.$$typeof===C)return f(e,Ki(e,t),n);Ea(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=va(n),p(e,t,n,r)}if(re(n)||j(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,wa(n),r);if(n.$$typeof===C)return p(e,t,Ki(e,n),r);Ea(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=va(r),m(e,t,n,r,i)}if(re(r)||j(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,wa(r),i);if(r.$$typeof===C)return m(e,t,n,Ki(t,r),i);Ea(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),wi&&_i(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 wi&&_i(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)}),wi&&_i(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),wi&&_i(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 wi&&_i(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)}),wi&&_i(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&va(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ta(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=ni(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ti(o.type,o.key,o.props,null,e.mode,c),Ta(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ai(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=va(o),b(e,r,o,c)}if(re(o))return h(e,r,o,c);if(j(o)){if(l=j(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,wa(o),c);if(o.$$typeof===C)return b(e,r,Ki(e,o),c);Ea(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=ri(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ca=0;var i=b(e,t,n,r);return Sa=null,i}catch(t){if(t===fa||t===ma)throw t;var a=Zr(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Oa=Da(!0),ka=Da(!1),Aa=!1;function ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ma(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 Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Jr(e),qr(e,null,n),t}return Wr(e,r,t,n),Jr(e)}function Fa(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,Ze(e,n)}}function Ia(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 La=!1;function Ra(){if(La){var e=ra;if(e!==null)throw e}}function za(e,t,n,r){La=!1;var i=e.updateQueue;Aa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Q&f)===f:(r&f)===f){f!==0&&f===na&&(La=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Aa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function Ba(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Va(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ba(n[e],t)}var Ha=P(null),Ua=P(0);function Wa(e,t){e=Vl,I(Ua,e),I(Ha,t),Vl=e|t.baseLanes}function Ga(){I(Ua,Vl),I(Ha,Ha.current)}function Ka(){Vl=Ua.current,F(Ha),F(Ua)}var qa=P(null),Ja=null;function Ya(e){var t=e.alternate;I(eo,eo.current&1),I(qa,e),Ja===null&&(t===null||Ha.current!==null||t.memoizedState!==null)&&(Ja=e)}function Xa(e){I(eo,eo.current),I(qa,e),Ja===null&&(Ja=e)}function Za(e){e.tag===22?(I(eo,eo.current),I(qa,e),Ja===null&&(Ja=e)):Qa(e)}function Qa(){I(eo,eo.current),I(qa,qa.current)}function $a(e){F(qa),Ja===e&&(Ja=null),F(eo)}var eo=P(0);function to(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(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 no=0,X=null,ro=null,io=null,ao=!1,oo=!1,so=!1,co=0,lo=0,uo=null,fo=0;function po(){throw Error(i(321))}function mo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!dr(e[n],t[n]))return!1;return!0}function ho(e,t,n,r,i,a){return no=a,X=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?Ms:Ns,so=!1,a=n(r,i),so=!1,oo&&(a=_o(t,n,r,i)),go(e),a}function go(e){M.H=js;var t=ro!==null&&ro.next!==null;if(no=0,io=ro=X=null,ao=!1,lo=0,uo=null,t)throw Error(i(300));e===null||Xs||(e=e.dependencies,e!==null&&Ui(e)&&(Xs=!0))}function _o(e,t,n,r){X=e;var a=0;do{if(oo&&(uo=null),lo=0,oo=!1,25<=a)throw Error(i(301));if(a+=1,io=ro=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}M.H=Ps,o=t(n,r)}while(oo);return o}function vo(){var e=M.H,t=e.useState()[0];return t=typeof t.then==`function`?To(t):t,e=e.useState()[0],(ro===null?null:ro.memoizedState)!==e&&(X.flags|=1024),t}function yo(){var e=co!==0;return co=0,e}function bo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function xo(e){if(ao){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ao=!1}no=0,io=ro=X=null,oo=!1,lo=co=0,uo=null}function So(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return io===null?X.memoizedState=io=e:io=io.next=e,io}function Co(){if(ro===null){var e=X.alternate;e=e===null?null:e.memoizedState}else e=ro.next;var t=io===null?X.memoizedState:io.next;if(t!==null)io=t,ro=e;else{if(e===null)throw X.alternate===null?Error(i(467)):Error(i(310));ro=e,e={memoizedState:ro.memoizedState,baseState:ro.baseState,baseQueue:ro.baseQueue,queue:ro.queue,next:null},io===null?X.memoizedState=io=e:io=io.next=e}return io}function wo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function To(e){var t=lo;return lo+=1,uo===null&&(uo=[]),e=_a(uo,e,t),t=X,(io===null?t.memoizedState:io.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?Ms:Ns),e}function Eo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return To(e);if(e.$$typeof===C)return Gi(e)}throw Error(i(438,String(e)))}function Do(e){var t=null,n=X.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=X.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=wo(),X.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]=k;return t.index++,n}function Oo(e,t){return typeof t==`function`?t(e):t}function ko(e){return Ao(Co(),ro,e)}function Ao(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?(no&f)===f:(Q&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===na&&(d=!0);else if((no&p)===p){u=u.next,p===na&&(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,X.lanes|=p,Ul|=p;f=u.action,so&&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,X.lanes|=f,Ul|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!dr(o,e.memoizedState)&&(Xs=!0,d&&(n=ra,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 jo(e){var t=Co(),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);dr(o,t.memoizedState)||(Xs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Mo(e,t,n){var r=X,a=Co(),o=wi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!dr((ro||a).memoizedState,n);if(s&&(a.memoizedState=n,Xs=!0),a=a.queue,rs(Fo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||io!==null&&io.memoizedState.tag&1){if(r.flags|=2048,Qo(9,{destroy:void 0},Po.bind(null,r,a,n,t),null),Fl===null)throw Error(i(349));o||no&127||No(r,t,n)}return n}function No(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=X.updateQueue,t===null?(t=wo(),X.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Po(e,t,n,r){t.value=n,t.getSnapshot=r,Io(t)&&Lo(e)}function Fo(e,t,n){return n(function(){Io(t)&&Lo(e)})}function Io(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!dr(e,n)}catch{return!0}}function Lo(e){var t=Kr(e,2);t!==null&&pu(t,e,2)}function Ro(e){var t=So();if(typeof e==`function`){var n=e;if(e=n(),so){Pe(!0);try{n()}finally{Pe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:e},t}function zo(e,t,n,r){return e.baseState=n,Ao(e,ro,typeof r==`function`?r:Oo)}function Bo(e,t,n,r,a){if(Os(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)}};M.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Vo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Vo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=M.T,o={};M.T=o;try{var s=n(i,r),c=M.S;c!==null&&c(o,s),Ho(e,t,s)}catch(n){Wo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),M.T=a}}else try{a=n(i,r),Ho(e,t,a)}catch(n){Wo(e,t,n)}}function Ho(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Uo(e,t,n)},function(n){return Wo(e,t,n)}):Uo(e,t,n)}function Uo(e,t,n){t.status=`fulfilled`,t.value=n,Go(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Vo(e,n)))}function Wo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Go(t),t=t.next;while(t!==r)}e.action=null}function Go(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ko(e,t){return t}function qo(e,t){if(wi){var n=Fl.formState;if(n!==null){a:{var r=X;if(wi){if(Ci){b:{for(var i=Ci,a=Ei;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ci=cf(i.nextSibling),r=i.data===`F!`;break a}}Oi(r)}r=!1}r&&(t=n[0])}}return n=So(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ko,lastRenderedState:t},n.queue=r,n=Ts.bind(null,X,r),r.dispatch=n,r=Ro(!1),a=Ds.bind(null,X,!1,r.queue),r=So(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Bo.bind(null,X,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Jo(e){return Yo(Co(),ro,e)}function Yo(e,t,n){if(t=Ao(e,t,Ko)[0],e=ko(Oo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=To(t)}catch(e){throw e===fa?ma:e}else r=t;t=Co();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(X.flags|=2048,Qo(9,{destroy:void 0},Xo.bind(null,i,n),null)),[r,a,e]}function Xo(e,t){e.action=t}function Zo(e){var t=Co(),n=ro;if(n!==null)return Yo(t,n,e);Co(),t=t.memoizedState,n=Co();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Qo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=X.updateQueue,t===null&&(t=wo(),X.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 $o(){return Co().memoizedState}function es(e,t,n,r){var i=So();X.flags|=e,i.memoizedState=Qo(1|t,{destroy:void 0},n,r===void 0?null:r)}function ts(e,t,n,r){var i=Co();r=r===void 0?null:r;var a=i.memoizedState.inst;ro!==null&&r!==null&&mo(r,ro.memoizedState.deps)?i.memoizedState=Qo(t,a,n,r):(X.flags|=e,i.memoizedState=Qo(1|t,a,n,r))}function ns(e,t){es(8390656,8,e,t)}function rs(e,t){ts(2048,8,e,t)}function is(e){X.flags|=4;var t=X.updateQueue;if(t===null)t=wo(),X.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function as(e){var t=Co().memoizedState;return is({ref:t,nextImpl:e}),function(){if(Pl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function os(e,t){return ts(4,2,e,t)}function ss(e,t){return ts(4,4,e,t)}function cs(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 ls(e,t,n){n=n==null?null:n.concat([e]),ts(4,4,cs.bind(null,t,e),n)}function us(){}function ds(e,t){var n=Co();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&mo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function fs(e,t){var n=Co();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&mo(t,r[1]))return r[0];if(r=e(),so){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r}function ps(e,t,n){return n===void 0||no&1073741824&&!(Q&261930)?e.memoizedState=t:(e.memoizedState=n,e=fu(),X.lanes|=e,Ul|=e,n)}function ms(e,t,n,r){return dr(n,t)?n:Ha.current===null?!(no&42)||no&1073741824&&!(Q&261930)?(Xs=!0,e.memoizedState=n):(e=fu(),X.lanes|=e,Ul|=e,t):(e=ps(e,n,r),dr(e,t)||(Xs=!0),e)}function hs(e,t,n,r,i){var a=N.p;N.p=a!==0&&8>a?a:8;var o=M.T,s={};M.T=s,Ds(e,!1,t,n);try{var c=i(),l=M.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Es(e,t,oa(c,r),du(e)):Es(e,t,r,du(e))}catch(n){Es(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{N.p=a,o!==null&&s.types!==null&&(o.types=s.types),M.T=o}}function gs(){}function _s(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=vs(e).queue;hs(e,a,t,ie,n===null?gs:function(){return ys(e),n(r)})}function vs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:ie},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ys(e){var t=vs(e);t.next===null&&(t=e.alternate.memoizedState),Es(e,t.next.queue,{},du())}function bs(){return Gi(Qf)}function xs(){return Co().memoizedState}function Ss(){return Co().memoizedState}function Cs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=Na(n);var r=Pa(t,e,n);r!==null&&(pu(r,t,n),Fa(r,t,n)),t={cache:Qi()},e.payload=t;return}t=t.return}}function ws(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Os(e)?ks(t,n):(n=Gr(e,t,n,r),n!==null&&(pu(n,e,r),As(n,t,r)))}function Ts(e,t,n){Es(e,t,n,du())}function Es(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Os(e))ks(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,dr(s,o))return Wr(e,t,i,0),Fl===null&&Ur(),!1}catch{}if(n=Gr(e,t,i,r),n!==null)return pu(n,e,r),As(n,t,r),!0}return!1}function Ds(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Os(e)){if(t)throw Error(i(479))}else t=Gr(e,n,r,2),t!==null&&pu(t,e,2)}function Os(e){var t=e.alternate;return e===X||t!==null&&t===X}function ks(e,t){oo=ao=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function As(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}var js={readContext:Gi,use:Eo,useCallback:po,useContext:po,useEffect:po,useImperativeHandle:po,useLayoutEffect:po,useInsertionEffect:po,useMemo:po,useReducer:po,useRef:po,useState:po,useDebugValue:po,useDeferredValue:po,useTransition:po,useSyncExternalStore:po,useId:po,useHostTransitionStatus:po,useFormState:po,useActionState:po,useOptimistic:po,useMemoCache:po,useCacheRefresh:po};js.useEffectEvent=po;var Ms={readContext:Gi,use:Eo,useCallback:function(e,t){return So().memoizedState=[e,t===void 0?null:t],e},useContext:Gi,useEffect:ns,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),es(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){es(4,2,e,t)},useMemo:function(e,t){var n=So();t=t===void 0?null:t;var r=e();if(so){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=So();if(n!==void 0){var i=n(t);if(so){Pe(!0);try{n(t)}finally{Pe(!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=ws.bind(null,X,e),[r.memoizedState,e]},useRef:function(e){var t=So();return e={current:e},t.memoizedState=e},useState:function(e){e=Ro(e);var t=e.queue,n=Ts.bind(null,X,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:us,useDeferredValue:function(e,t){return ps(So(),e,t)},useTransition:function(){var e=Ro(!1);return e=hs.bind(null,X,e.queue,!0,!1),So().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=X,a=So();if(wi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Fl===null)throw Error(i(349));Q&127||No(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ns(Fo.bind(null,r,o,e),[e]),r.flags|=2048,Qo(9,{destroy:void 0},Po.bind(null,r,o,n,t),null),n},useId:function(){var e=So(),t=Fl.identifierPrefix;if(wi){var n=gi,r=hi;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=co++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=fo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:bs,useFormState:qo,useActionState:qo,useOptimistic:function(e){var t=So();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ds.bind(null,X,!0,n),n.dispatch=t,[e,t]},useMemoCache:Do,useCacheRefresh:function(){return So().memoizedState=Cs.bind(null,X)},useEffectEvent:function(e){var t=So(),n={impl:e};return t.memoizedState=n,function(){if(Pl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ns={readContext:Gi,use:Eo,useCallback:ds,useContext:Gi,useEffect:rs,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:ko,useRef:$o,useState:function(){return ko(Oo)},useDebugValue:us,useDeferredValue:function(e,t){return ms(Co(),ro.memoizedState,e,t)},useTransition:function(){var e=ko(Oo)[0],t=Co().memoizedState;return[typeof e==`boolean`?e:To(e),t]},useSyncExternalStore:Mo,useId:xs,useHostTransitionStatus:bs,useFormState:Jo,useActionState:Jo,useOptimistic:function(e,t){return zo(Co(),ro,e,t)},useMemoCache:Do,useCacheRefresh:Ss};Ns.useEffectEvent=as;var Ps={readContext:Gi,use:Eo,useCallback:ds,useContext:Gi,useEffect:rs,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:jo,useRef:$o,useState:function(){return jo(Oo)},useDebugValue:us,useDeferredValue:function(e,t){var n=Co();return ro===null?ps(n,e,t):ms(n,ro.memoizedState,e,t)},useTransition:function(){var e=jo(Oo)[0],t=Co().memoizedState;return[typeof e==`boolean`?e:To(e),t]},useSyncExternalStore:Mo,useId:xs,useHostTransitionStatus:bs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){var n=Co();return ro===null?(n.baseState=e,[e,n.queue.dispatch]):zo(n,ro,e,t)},useMemoCache:Do,useCacheRefresh:Ss};Ps.useEffectEvent=as;function Fs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Is={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=du(),i=Na(r);i.payload=t,n!=null&&(i.callback=n),t=Pa(e,i,r),t!==null&&(pu(t,e,r),Fa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=du(),i=Na(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Pa(e,i,r),t!==null&&(pu(t,e,r),Fa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=du(),r=Na(n);r.tag=2,t!=null&&(r.callback=t),t=Pa(e,r,n),t!==null&&(pu(t,e,n),Fa(t,e,n))}};function Ls(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?!fr(n,r)||!fr(i,a):!0}function Rs(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&&Is.enqueueReplaceState(t,t.state,null)}function zs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Bs(e){zr(e)}function Vs(e){console.error(e)}function Hs(e){zr(e)}function Us(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ws(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 Gs(e,t,n){return n=Na(n),n.tag=3,n.payload={element:null},n.callback=function(){Us(e,t)},n}function Ks(e){return e=Na(e),e.tag=3,e}function qs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ws(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ws(t,n,r),typeof i!=`function`&&(tu===null?tu=new Set([this]):tu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Js(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Hi(t,n,a,!0),n=qa.current,n!==null){switch(n.tag){case 31:case 13:return Ja===null?Tu():n.alternate===null&&Hl===0&&(Hl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ha?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Wu(e,r,a)),!1;case 22:return n.flags|=65536,r===ha?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)),Wu(e,r,a)),!1}throw Error(i(435,n.tag))}return Wu(e,r,a),Tu(),!1}if(wi)return t=qa.current,t===null?(r!==Di&&(t=Error(i(423),{cause:r}),Pi(si(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=si(r,n),a=Gs(e.stateNode,r,a),Ia(e,a),Hl!==4&&(Hl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Di&&(e=Error(i(422),{cause:r}),Pi(si(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=si(o,n),Jl===null?Jl=[o]:Jl.push(o),Hl!==4&&(Hl=2),t===null)return!0;r=si(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Gs(n.stateNode,r,e),Ia(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`&&(tu===null||!tu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ks(a),qs(a,e,n,r),Ia(n,a),!1}n=n.return}while(n!==null);return!1}var Ys=Error(i(461)),Xs=!1;function Zs(e,t,n,r){t.child=e===null?ka(t,null,n,r):Oa(t,e.child,n,r)}function Qs(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 Wi(t),r=ho(e,t,n,o,a,i),s=yo(),e!==null&&!Xs?(bo(e,t,i),Sc(e,t,i)):(wi&&s&&yi(t),t.flags|=1,Zs(e,t,r,i),t.child)}function $s(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Qr(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ec(e,t,a,r,i)):(e=ti(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Cc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?fr:n,n(o,r)&&e.ref===t.ref)return Sc(e,t,i)}return t.flags|=1,e=$r(a,r),e.ref=t.ref,e.return=t,t.child=e}function ec(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(fr(a,r)&&e.ref===t.ref)if(Xs=!1,t.pendingProps=r=a,Cc(e,i))e.flags&131072&&(Xs=!0);else return t.lanes=e.lanes,Sc(e,t,i)}return cc(e,t,n,r,i)}function tc(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 rc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ua(t,a===null?null:a.cachePool),a===null?Ga():Wa(t,a),Za(t);else return r=t.lanes=536870912,rc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ua(t,null),Ga(),Qa(t)):(ua(t,a.cachePool),Wa(t,a),Qa(t),t.memoizedState=null);return Zs(e,t,i,n),t.child}function nc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function rc(e,t,n,r,i){var a=la();return a=a===null?null:{parent:Zi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ua(t,null),Ga(),Za(t),e!==null&&Hi(e,t,r,!0),t.childLanes=i,null}function ic(e,t){return t=_c({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ac(e,t,n){return Oa(t,e.child,null,n),e=ic(t,t.pendingProps),e.flags|=2,$a(t),t.memoizedState=null,e}function oc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(wi){if(r.mode===`hidden`)return e=ic(t,r),t.lanes=536870912,nc(null,e);if(Xa(t),(e=Ci)?(e=rf(e,Ei),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mi===null?null:{id:hi,overflow:gi},retryLane:536870912,hydrationErrors:null},n=ii(e),n.return=t,t.child=n,Si=t,Ci=null)):e=null,e===null)throw Oi(t);return t.lanes=536870912,null}return ic(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Xa(t),a)if(t.flags&256)t.flags&=-257,t=ac(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(Xs||Hi(e,t,n,!1),a=(n&e.childLanes)!==0,Xs||a){if(r=Fl,r!==null&&(s=Qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Kr(e,s),pu(r,e,s),Ys;Tu(),t=ac(e,t,n)}else e=o.treeContext,Ci=cf(s.nextSibling),Si=t,wi=!0,Ti=null,Ei=!1,e!==null&&xi(t,e),t=ic(t,r),t.flags|=4096;return t}return e=$r(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function sc(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 cc(e,t,n,r,i){return Wi(t),n=ho(e,t,n,r,void 0,i),r=yo(),e!==null&&!Xs?(bo(e,t,i),Sc(e,t,i)):(wi&&r&&yi(t),t.flags|=1,Zs(e,t,n,i),t.child)}function lc(e,t,n,r,i,a){return Wi(t),t.updateQueue=null,n=_o(t,r,n,i),go(e),r=yo(),e!==null&&!Xs?(bo(e,t,a),Sc(e,t,a)):(wi&&r&&yi(t),t.flags|=1,Zs(e,t,n,a),t.child)}function uc(e,t,n,r,i){if(Wi(t),t.stateNode===null){var a=Yr,o=n.contextType;typeof o==`object`&&o&&(a=Gi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Is,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ja(t),o=n.contextType,a.context=typeof o==`object`&&o?Gi(o):Yr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Fs(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&&Is.enqueueReplaceState(a,a.state,null),za(t,r,a,i),Ra(),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=zs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Yr,typeof u==`object`&&u&&(o=Gi(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)&&Rs(t,a,r,o),Aa=!1;var f=t.memoizedState;a.state=f,za(t,r,a,i),Ra(),l=t.memoizedState,s||f!==l||Aa?(typeof d==`function`&&(Fs(t,n,d,r),l=t.memoizedState),(c=Aa||Ls(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,Ma(e,t),o=t.memoizedProps,u=zs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Yr,typeof l==`object`&&l&&(c=Gi(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)&&Rs(t,a,r,c),Aa=!1,f=t.memoizedState,a.state=f,za(t,r,a,i),Ra();var p=t.memoizedState;o!==d||f!==p||Aa||e!==null&&e.dependencies!==null&&Ui(e.dependencies)?(typeof s==`function`&&(Fs(t,n,s,r),p=t.memoizedState),(u=Aa||Ls(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ui(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,sc(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=Oa(t,e.child,null,i),t.child=Oa(t,null,n,i)):Zs(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Sc(e,t,i),e}function dc(e,t,n,r){return Mi(),t.flags|=256,Zs(e,t,n,r),t.child}var fc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function pc(e){return{baseLanes:e,cachePool:da()}}function mc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Kl),e}function hc(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:(eo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(wi){if(a?Ya(t):Qa(t),(e=Ci)?(e=rf(e,Ei),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mi===null?null:{id:hi,overflow:gi},retryLane:536870912,hydrationErrors:null},n=ii(e),n.return=t,t.child=n,Si=t,Ci=null)):e=null,e===null)throw Oi(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(Qa(t),a=t.mode,c=_c({mode:`hidden`,children:c},a),r=ni(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,s,n),t.memoizedState=fc,nc(null,r)):(Ya(t),gc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Ya(t),t.flags&=-257,t=vc(e,t,n)):t.memoizedState===null?(Qa(t),c=r.fallback,a=t.mode,r=_c({mode:`visible`,children:r.children},a),c=ni(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Oa(t,e.child,null,n),r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,s,n),t.memoizedState=fc,t=nc(null,r)):(Qa(t),t.child=e.child,t.flags|=128,t=null);else if(Ya(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Pi({value:r,source:null,stack:null}),t=vc(e,t,n)}else if(Xs||Hi(e,t,n,!1),s=(n&e.childLanes)!==0,Xs||s){if(s=Fl,s!==null&&(r=Qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Kr(e,r),pu(s,e,r),Ys;af(c)||Tu(),t=vc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ci=cf(c.nextSibling),Si=t,wi=!0,Ti=null,Ei=!1,e!==null&&xi(t,e),t=gc(t,r.children),t.flags|=4096);return t}return a?(Qa(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=$r(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ni(c,a,n,null),c.flags|=2):c=$r(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,nc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=pc(n):(a=c.cachePool,a===null?a=da():(l=Zi._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=mc(e,s,n),t.memoizedState=fc,nc(e.child,r)):(Ya(t),n=e.child,e=n.sibling,n=$r(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 gc(e,t){return t=_c({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function _c(e,t){return e=Zr(22,e,null,t),e.lanes=0,e}function vc(e,t,n){return Oa(t,e.child,null,n),e=gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Bi(e.return,t,n)}function bc(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 xc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=eo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,I(eo,o),Zs(e,t,r,n),r=wi?di:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yc(e,n,t);else if(e.tag===19)yc(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&&to(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),bc(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&&to(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}bc(t,!0,n,null,a,r);break;case`together`:bc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Sc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ul|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Hi(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=$r(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=$r(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Ui(e))):!0}function wc(e,t,n){switch(t.tag){case 3:ue(t,t.stateNode.containerInfo),Ri(t,Zi,e.memoizedState.cache),Mi();break;case 27:case 5:fe(t);break;case 4:ue(t,t.stateNode.containerInfo);break;case 10:Ri(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Xa(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ya(t),e=Sc(e,t,n),e===null?null:e.sibling):hc(e,t,n):(Ya(t),t.flags|=128,null);Ya(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Hi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return xc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),I(eo,eo.current),r)break;return null;case 22:return t.lanes=0,tc(e,t,n,t.pendingProps);case 24:Ri(t,Zi,e.memoizedState.cache)}return Sc(e,t,n)}function Tc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Xs=!0;else{if(!Cc(e,n)&&!(t.flags&128))return Xs=!1,wc(e,t,n);Xs=!!(e.flags&131072)}else Xs=!1,wi&&t.flags&1048576&&vi(t,di,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=va(t.elementType),t.type=e,typeof e==`function`)Qr(e)?(r=zs(e,r),t.tag=1,t=uc(null,t,e,r,n)):(t.tag=0,t=cc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=Qs(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=$s(null,t,e,r,n);break a}}throw t=ne(e)||e,Error(i(306,t,``))}}return t;case 0:return cc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=zs(r,t.pendingProps),uc(e,t,r,a,n);case 3:a:{if(ue(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ma(e,t),za(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ri(t,Zi,r),r!==o.cache&&Vi(t,[Zi],n,!0),Ra(),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=dc(e,t,r,n);break a}else if(r!==a){a=si(Error(i(424)),t),Pi(a),t=dc(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(Ci=cf(e.firstChild),Si=t,wi=!0,Ti=null,Ei=!0,n=ka(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Mi(),r===a){t=Sc(e,t,n);break a}Zs(e,t,r,n)}t=t.child}return t;case 26:return sc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:wi||(n=t.type,e=t.pendingProps,r=Bd(ce.current).createElement(n),r[it]=t,r[at]=e,Pd(r,n,e),_t(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return fe(t),e===null&&wi&&(r=t.stateNode=ff(t.type,t.pendingProps,ce.current),Si=t,Ei=!0,a=Ci,Zd(t.type)?(lf=a,Ci=cf(r.firstChild)):Ci=a),Zs(e,t,t.pendingProps.children,n),sc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&wi&&((a=r=Ci)&&(r=tf(r,t.type,t.pendingProps,Ei),r===null?a=!1:(t.stateNode=r,Si=t,Ci=cf(r.firstChild),Ei=!1,a=!0)),a||Oi(t)),fe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(a,o)?r=null:s!==null&&Ud(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=ho(e,t,vo,null,null,n),Qf._currentValue=a),sc(e,t),Zs(e,t,r,n),t.child;case 6:return e===null&&wi&&((e=n=Ci)&&(n=nf(n,t.pendingProps,Ei),n===null?e=!1:(t.stateNode=n,Si=t,Ci=null,e=!0)),e||Oi(t)),null;case 13:return hc(e,t,n);case 4:return ue(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Oa(t,null,r,n):Zs(e,t,r,n),t.child;case 11:return Qs(e,t,t.type,t.pendingProps,n);case 7:return Zs(e,t,t.pendingProps,n),t.child;case 8:return Zs(e,t,t.pendingProps.children,n),t.child;case 12:return Zs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ri(t,t.type,r.value),Zs(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Wi(t),a=Gi(a),r=r(a),t.flags|=1,Zs(e,t,r,n),t.child;case 14:return $s(e,t,t.type,t.pendingProps,n);case 15:return ec(e,t,t.type,t.pendingProps,n);case 19:return xc(e,t,n);case 31:return oc(e,t,n);case 22:return tc(e,t,n,t.pendingProps);case 24:return Wi(t),r=Gi(Zi),e===null?(a=la(),a===null&&(a=Fl,o=Qi(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ja(t),Ri(t,Zi,a)):((e.lanes&n)!==0&&(Ma(e,t),za(t,null,null,n),Ra()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ri(t,Zi,r),r!==a.cache&&Vi(t,[Zi],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ri(t,Zi,r))),Zs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ec(e){e.flags|=4}function Dc(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(Su())e.flags|=8192;else throw ya=ha,pa}else e.flags&=-16777217}function Oc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(Su())e.flags|=8192;else throw ya=ha,pa}function kc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ke(),e.lanes|=t,ql|=t)}function Ac(e,t){if(!wi)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 jc(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 Mc(e,t,n){var r=t.pendingProps;switch(bi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jc(t),null;case 1:return jc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),zi(Zi),de(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ji(t)?Ec(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ni())),jc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Ec(t),o===null?(jc(t),Dc(t,a,null,r,n)):(jc(t),Oc(t,o))):o?o===e.memoizedState?(jc(t),t.flags&=-16777217):(Ec(t),jc(t),Oc(t,o)):(e=e.memoizedProps,e!==r&&Ec(t),jc(t),Dc(t,a,e,r,n)),null;case 27:if(pe(t),n=ce.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return jc(t),null}e=se.current,ji(t)?ki(t,e):(e=ff(a,r,n),t.stateNode=e,Ec(t))}return jc(t),null;case 5:if(pe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return jc(t),null}if(o=se.current,ji(t))ki(t,o);else{var s=Bd(ce.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[it]=t,o[at]=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(Pd(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&&Ec(t)}}return jc(t),Dc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ce.current,ji(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Si,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Oi(t,!0)}else e=Bd(e).createTextNode(r),e[it]=t,t.stateNode=e}return jc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ji(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[it]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),e=!1}else n=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?($a(t),t):($a(t),null);if(t.flags&128)throw Error(i(558))}return jc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ji(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[it]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),a=!1}else a=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?($a(t),t):($a(t),null)}return $a(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),kc(t,t.updateQueue),jc(t),null);case 4:return de(),e===null&&xd(t.stateNode.containerInfo),jc(t),null;case 10:return zi(t.type),jc(t),null;case 19:if(F(eo),r=t.memoizedState,r===null)return jc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Ac(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=to(e),o!==null){for(t.flags|=128,Ac(r,!1),e=o.updateQueue,t.updateQueue=e,kc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ei(n,e),n=n.sibling;return I(eo,eo.current&1|2),wi&&_i(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&we()>$l&&(t.flags|=128,a=!0,Ac(r,!1),t.lanes=4194304)}else{if(!a)if(e=to(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,kc(t,e),Ac(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!wi)return jc(t),null}else 2*we()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,a=!0,Ac(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?(jc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=we(),e.sibling=null,n=eo.current,I(eo,a?n&1|2:n&1),wi&&_i(t,r.treeForkCount),e);case 22:case 23:return $a(t),Ka(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(jc(t),t.subtreeFlags&6&&(t.flags|=8192)):jc(t),n=t.updateQueue,n!==null&&kc(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&&F(ca),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),zi(Zi),jc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Nc(e,t){switch(bi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zi(Zi),de(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pe(t),null;case 31:if(t.memoizedState!==null){if($a(t),t.alternate===null)throw Error(i(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if($a(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return F(eo),null;case 4:return de(),null;case 10:return zi(t.type),null;case 22:case 23:return $a(t),Ka(),e!==null&&F(ca),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return zi(Zi),null;case 25:return null;default:return null}}function Pc(e,t){switch(bi(t),t.tag){case 3:zi(Zi),de();break;case 26:case 27:case 5:pe(t);break;case 4:de();break;case 31:t.memoizedState!==null&&$a(t);break;case 13:$a(t);break;case 19:F(eo);break;case 10:zi(t.type);break;case 22:case 23:$a(t),Ka(),e!==null&&F(ca);break;case 24:zi(Zi)}}function Fc(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){Uu(t,t.return,e)}}function Ic(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){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function Lc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Va(t,n)}catch(t){Uu(e,e.return,t)}}}function Rc(e,t,n){n.props=zs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function zc(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){Uu(e,t,n)}}function Bc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Uu(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){Uu(e,t,n)}else n.current=null}function Vc(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){Uu(e,e.return,t)}}function Hc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[at]=t}catch(t){Uu(e,e.return,t)}}function Uc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Wc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Uc(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&&Zd(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 Gc(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=Zt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function Kc(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&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Kc(e,t,n),e=e.sibling;e!==null;)Kc(e,t,n),e=e.sibling}function qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[it]=e,t[at]=n}catch(t){Uu(e,e.return,t)}}var Jc=!1,Yc=!1,Xc=!1,Zc=typeof WeakSet==`function`?WeakSet:Set,Qc=null;function $c(e,t){if(e=e.containerInfo,Rd=sp,e=gr(e),_r(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(zd={focusedElem:e,selectionRange:n},sp=!1,Qc=t;Qc!==null;)if(t=Qc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Qc=e;else for(;Qc!==null;){switch(t=Qc,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=zs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Uu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(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,Qc=e;break}Qc=t.return}}function el(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:hl(e,n),r&4&&Fc(5,n);break;case 1:if(hl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Uu(n,n.return,e)}else{var i=zs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Uu(n,n.return,e)}}r&64&&Lc(n),r&512&&zc(n,n.return);break;case 3:if(hl(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{Va(e,t)}catch(e){Uu(n,n.return,e)}}break;case 27:t===null&&r&4&&qc(n);case 26:case 5:hl(e,n),t===null&&r&4&&Vc(n),r&512&&zc(n,n.return);break;case 12:hl(e,n);break;case 31:hl(e,n),r&4&&ol(e,n);break;case 13:hl(e,n),r&4&&sl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qu.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Jc,!r){t=t!==null&&t.memoizedState!==null||Yc,i=Jc;var a=Yc;Jc=r,(Yc=t)&&!a?_l(e,n,(n.subtreeFlags&8772)!=0):hl(e,n),Jc=i,Yc=a}break;case 30:break;default:hl(e,n)}}function tl(e){var t=e.alternate;t!==null&&(e.alternate=null,tl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ft(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 nl=null,rl=!1;function il(e,t,n){for(n=n.child;n!==null;)al(e,t,n),n=n.sibling}function al(e,t,n){if(Ne&&typeof Ne.onCommitFiberUnmount==`function`)try{Ne.onCommitFiberUnmount(Me,n)}catch{}switch(n.tag){case 26:Yc||Bc(n,t),il(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Yc||Bc(n,t);var r=nl,i=rl;Zd(n.type)&&(nl=n.stateNode,rl=!1),il(e,t,n),pf(n.stateNode),nl=r,rl=i;break;case 5:Yc||Bc(n,t);case 6:if(r=nl,i=rl,nl=null,il(e,t,n),nl=r,rl=i,nl!==null)if(rl)try{(nl.nodeType===9?nl.body:nl.nodeName===`HTML`?nl.ownerDocument.body:nl).removeChild(n.stateNode)}catch(e){Uu(n,t,e)}else try{nl.removeChild(n.stateNode)}catch(e){Uu(n,t,e)}break;case 18:nl!==null&&(rl?(e=nl,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(nl,n.stateNode));break;case 4:r=nl,i=rl,nl=n.stateNode.containerInfo,rl=!0,il(e,t,n),nl=r,rl=i;break;case 0:case 11:case 14:case 15:Ic(2,n,t),Yc||Ic(4,n,t),il(e,t,n);break;case 1:Yc||(Bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Rc(n,t,r)),il(e,t,n);break;case 21:il(e,t,n);break;case 22:Yc=(r=Yc)||n.memoizedState!==null,il(e,t,n),Yc=r;break;default:il(e,t,n)}}function ol(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Uu(t,t.return,e)}}}function sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Uu(t,t.return,e)}}function cl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zc),t;default:throw Error(i(435,e.tag))}}function ll(e,t){var n=cl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ju.bind(null,e,t);t.then(r,r)}})}function ul(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(Zd(c.type)){nl=c.stateNode,rl=!1;break a}break;case 5:nl=c.stateNode,rl=!1;break a;case 3:case 4:nl=c.stateNode.containerInfo,rl=!0;break a}c=c.return}if(nl===null)throw Error(i(160));al(o,s,a),nl=null,rl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)fl(t,e),t=t.sibling}var dl=null;function fl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ul(t,e),pl(e),r&4&&(Ic(3,e,e.return),Fc(3,e),Ic(5,e,e.return));break;case 1:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&64&&Jc&&(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=dl;if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(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[dt]||o[it]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Pd(o,r,n),o[it]=e,_t(o),r=o;break a;case`link`:var s=Vf(`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),Pd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Vf(`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),Pd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[it]=e,_t(o),r=o}e.stateNode=r}else Hf(a,e.type,e.stateNode);else e.stateNode=If(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Hc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(a,e.type,e.stateNode):If(a,r,e.memoizedProps))}break;case 27:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),n!==null&&r&4&&Hc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),e.flags&32){a=e.stateNode;try{Ut(a,``)}catch(t){Uu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Hc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Xc=!0);break;case 6:if(ul(t,e),pl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Uu(e,e.return,t)}}break;case 3:if(Bf=null,a=dl,dl=gf(t.containerInfo),ul(t,e),dl=a,pl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Uu(e,e.return,t)}Xc&&(Xc=!1,ml(e));break;case 4:r=dl,dl=gf(e.stateNode.containerInfo),ul(t,e),pl(e),dl=r;break;case 12:ul(t,e),pl(e);break;case 31:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 13:ul(t,e),pl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Zl=we()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Jc,d=Yc;if(Jc=u||a,Yc=d||l,ul(t,e),Yc=d,Jc=u,pl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Jc||Yc||gl(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){Uu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Uu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?$d(m,!0):$d(l.stateNode,!1)}catch(e){Uu(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,ll(e,n))));break;case 19:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 30:break;case 21:break;default:ul(t,e),pl(e)}}function pl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Uc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Kc(e,Wc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Ut(o,``),n.flags&=-33),Kc(e,Wc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Gc(e,Wc(e),s);break;default:throw Error(i(161))}}catch(t){Uu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ml(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ml(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function hl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)el(e,t.alternate,t),t=t.sibling}function gl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ic(4,t,t.return),gl(t);break;case 1:Bc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Rc(t,t.return,n),gl(t);break;case 27:pf(t.stateNode);case 26:case 5:Bc(t,t.return),gl(t);break;case 22:t.memoizedState===null&&gl(t);break;case 30:gl(t);break;default:gl(t)}e=e.sibling}}function _l(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:_l(i,a,n),Fc(4,a);break;case 1:if(_l(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Uu(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++)Ba(c[i],s)}catch(e){Uu(r,r.return,e)}}n&&o&64&&Lc(a),zc(a,a.return);break;case 27:qc(a);case 26:case 5:_l(i,a,n),n&&r===null&&o&4&&Vc(a),zc(a,a.return);break;case 12:_l(i,a,n);break;case 31:_l(i,a,n),n&&o&4&&ol(i,a);break;case 13:_l(i,a,n),n&&o&4&&sl(i,a);break;case 22:a.memoizedState===null&&_l(i,a,n),zc(a,a.return);break;case 30:break;default:_l(i,a,n)}t=t.sibling}}function vl(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&&$i(n))}function yl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&$i(e))}function bl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xl(e,t,n,r),t=t.sibling}function xl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:bl(e,t,n,r),i&2048&&Fc(9,t);break;case 1:bl(e,t,n,r);break;case 3:bl(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&&$i(e)));break;case 12:if(i&2048){bl(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){Uu(t,t.return,e)}}else bl(e,t,n,r);break;case 31:bl(e,t,n,r);break;case 13:bl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?bl(e,t,n,r):(a._visibility|=2,Sl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?bl(e,t,n,r):Cl(e,t),i&2048&&vl(o,t);break;case 24:bl(e,t,n,r),i&2048&&yl(t.alternate,t);break;default:bl(e,t,n,r)}}function Sl(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:Sl(a,o,s,c,i),Fc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Sl(a,o,s,c,i)):u._visibility&2?Sl(a,o,s,c,i):Cl(a,o),i&&l&2048&&vl(o.alternate,o);break;case 24:Sl(a,o,s,c,i),i&&l&2048&&yl(o.alternate,o);break;default:Sl(a,o,s,c,i)}t=t.sibling}}function Cl(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:Cl(n,r),i&2048&&vl(r.alternate,r);break;case 24:Cl(n,r),i&2048&&yl(r.alternate,r);break;default:Cl(n,r)}t=t.sibling}}var wl=8192;function Tl(e,t,n){if(e.subtreeFlags&wl)for(e=e.child;e!==null;)El(e,t,n),e=e.sibling}function El(e,t,n){switch(e.tag){case 26:Tl(e,t,n),e.flags&wl&&e.memoizedState!==null&&Gf(n,dl,e.memoizedState,e.memoizedProps);break;case 5:Tl(e,t,n);break;case 3:case 4:var r=dl;dl=gf(e.stateNode.containerInfo),Tl(e,t,n),dl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=wl,wl=16777216,Tl(e,t,n),wl=r):Tl(e,t,n));break;default:Tl(e,t,n)}}function Dl(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 Ol(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)kl(e),e=e.sibling}function kl(e){switch(e.tag){case 0:case 11:case 15:Ol(e),e.flags&2048&&Ic(9,e,e.return);break;case 3:Ol(e);break;case 12:Ol(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Al(e)):Ol(e);break;default:Ol(e)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ic(8,t,t.return),Al(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Al(t));break;default:Al(t)}e=e.sibling}}function jl(e,t){for(;Qc!==null;){var n=Qc;switch(n.tag){case 0:case 11:case 15:Ic(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:$i(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Qc=r;else a:for(n=e;Qc!==null;){r=Qc;var i=r.sibling,a=r.return;if(tl(r),r===n){Qc=null;break a}if(i!==null){i.return=a,Qc=i;break a}Qc=a}}}var Ml={getCacheForType:function(e){var t=Gi(Zi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Gi(Zi).controller.signal}},Nl=typeof WeakMap==`function`?WeakMap:Map,Pl=0,Fl=null,Z=null,Q=0,Il=0,Ll=null,Rl=!1,zl=!1,Bl=!1,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=null,Yl=null,Xl=!1,Zl=0,Ql=0,$l=1/0,eu=null,tu=null,nu=0,ru=null,iu=null,au=0,ou=0,su=null,cu=null,lu=0,uu=null;function du(){return Pl&2&&Q!==0?Q&-Q:M.T===null?tt():ud()}function fu(){if(Kl===0)if(!(Q&536870912)||wi){var e=Be;Be<<=1,!(Be&3932160)&&(Be=262144),Kl=e}else Kl=536870912;return e=qa.current,e!==null&&(e.flags|=32),Kl}function pu(e,t,n){(e===Fl&&(Il===2||Il===9)||e.cancelPendingCommit!==null)&&(bu(e,0),_u(e,Q,Kl,!1)),Je(e,n),(!(Pl&2)||e!==Fl)&&(e===Fl&&(!(Pl&2)&&(Wl|=n),Hl===4&&_u(e,Q,Kl,!1)),nd(e))}function mu(e,t,n){if(Pl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||We(e,t),a=r?Ou(e,t):Eu(e,t,!0),o=r;do{if(a===0){zl&&!r&&_u(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!gu(n)){a=Eu(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=Jl;var l=c.current.memoizedState.isDehydrated;if(l&&(bu(c,s).flags|=256),s=Eu(c,s,!1),s!==2){if(Bl&&!l){c.errorRecoveryDisabledLanes|=o,Wl|=o,a=4;break a}o=Yl,Yl=a,o!==null&&(Yl===null?Yl=o:Yl.push.apply(Yl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){bu(e,0),_u(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:_u(r,t,Kl,!Rl);break a;case 2:Yl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Zl+300-we(),10<a)){if(_u(r,t,Kl,!Rl),Ue(r,0,!0)!==0)break a;au=t,r.timeoutHandle=Kd(hu.bind(null,r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,o,`Throttled`,-0,0),a);break a}hu(r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,o,null,-0,0)}}break}while(1);nd(e)}function hu(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:Zt},El(t,a,d);var m=(a&62914560)===a?Zl-we():(a&4194048)===a?Ql-we():0;if(m=qf(d,m),m!==null){au=a,e.cancelPendingCommit=m(Fu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),_u(e,a,o,!l);return}}Fu(e,t,a,n,r,i,o,s,c)}function gu(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(!dr(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 _u(e,t,n,r){t&=~Gl,t&=~Wl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Fe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Xe(e,n,t)}function vu(){return Pl&6?!0:(rd(0,!1),!1)}function yu(){if(Z!==null){if(Il===0)var e=Z.return;else e=Z,Li=Ii=null,xo(e),Sa=null,Ca=0,e=Z;for(;e!==null;)Pc(e.alternate,e),e=e.return;Z=null}}function bu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),au=0,yu(),Fl=e,Z=n=$r(e.current,null),Q=t,Il=0,Ll=null,Rl=!1,zl=We(e,t),Bl=!1,ql=Kl=Gl=Wl=Ul=Hl=0,Yl=Jl=null,Xl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Fe(r),a=1<<i;t|=e[i],r&=~a}return Vl=t,Ur(),n}function xu(e,t){X=null,M.H=js,t===fa||t===ma?(t=ba(),Il=3):t===pa?(t=ba(),Il=4):Il=t===Ys?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ll=t,Z===null&&(Hl=1,Us(e,si(t,e.current)))}function Su(){var e=qa.current;return e===null?!0:(Q&4194048)===Q?Ja===null:(Q&62914560)===Q||Q&536870912?e===Ja:!1}function Cu(){var e=M.H;return M.H=js,e===null?js:e}function wu(){var e=M.A;return M.A=Ml,e}function Tu(){Hl=4,Rl||(Q&4194048)!==Q&&qa.current!==null||(zl=!0),!(Ul&134217727)&&!(Wl&134217727)||Fl===null||_u(Fl,Q,Kl,!1)}function Eu(e,t,n){var r=Pl;Pl|=2;var i=Cu(),a=wu();(Fl!==e||Q!==t)&&(eu=null,bu(e,t)),t=!1;var o=Hl;a:do try{if(Il!==0&&Z!==null){var s=Z,c=Ll;switch(Il){case 8:yu(),o=6;break a;case 3:case 2:case 9:case 6:qa.current===null&&(t=!0);var l=Il;if(Il=0,Ll=null,Mu(e,s,c,l),n&&zl){o=0;break a}break;default:l=Il,Il=0,Ll=null,Mu(e,s,c,l)}}Du(),o=Hl;break}catch(t){xu(e,t)}while(1);return t&&e.shellSuspendCounter++,Li=Ii=null,Pl=r,M.H=i,M.A=a,Z===null&&(Fl=null,Q=0,Ur()),o}function Du(){for(;Z!==null;)Au(Z)}function Ou(e,t){var n=Pl;Pl|=2;var r=Cu(),a=wu();Fl!==e||Q!==t?(eu=null,$l=we()+500,bu(e,t)):zl=We(e,t);a:do try{if(Il!==0&&Z!==null){t=Z;var o=Ll;b:switch(Il){case 1:Il=0,Ll=null,Mu(e,t,o,1);break;case 2:case 9:if(ga(o)){Il=0,Ll=null,ju(t);break}t=function(){Il!==2&&Il!==9||Fl!==e||(Il=7),nd(e)},o.then(t,t);break a;case 3:Il=7;break a;case 4:Il=5;break a;case 7:ga(o)?(Il=0,Ll=null,ju(t)):(Il=0,Ll=null,Mu(e,t,o,7));break;case 5:var s=null;switch(Z.tag){case 26:s=Z.memoizedState;case 5:case 27:var c=Z;if(s?Wf(s):c.stateNode.complete){Il=0,Ll=null;var l=c.sibling;if(l!==null)Z=l;else{var u=c.return;u===null?Z=null:(Z=u,Nu(u))}break b}}Il=0,Ll=null,Mu(e,t,o,5);break;case 6:Il=0,Ll=null,Mu(e,t,o,6);break;case 8:yu(),Hl=6;break a;default:throw Error(i(462))}}ku();break}catch(t){xu(e,t)}while(1);return Li=Ii=null,M.H=r,M.A=a,Pl=n,Z===null?(Fl=null,Q=0,Ur(),Hl):0}function ku(){for(;Z!==null&&!Se();)Au(Z)}function Au(e){var t=Tc(e.alternate,e,Vl);e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=lc(n,t,t.pendingProps,t.type,void 0,Q);break;case 11:t=lc(n,t,t.pendingProps,t.type.render,t.ref,Q);break;case 5:xo(t);default:Pc(n,t),t=Z=ei(t,Vl),t=Tc(n,t,Vl)}e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function Mu(e,t,n,r){Li=Ii=null,xo(t),Sa=null,Ca=0;var i=t.return;try{if(Js(e,i,t,n,Q)){Hl=1,Us(e,si(n,e.current)),Z=null;return}}catch(t){if(i!==null)throw Z=i,t;Hl=1,Us(e,si(n,e.current)),Z=null;return}t.flags&32768?(wi||r===1?e=!0:zl||Q&536870912?e=!1:(Rl=e=!0,(r===2||r===9||r===3||r===6)&&(r=qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Pu(t,e)):Nu(t)}function Nu(e){var t=e;do{if(t.flags&32768){Pu(t,Rl);return}e=t.return;var n=Mc(t.alternate,t,Vl);if(n!==null){Z=n;return}if(t=t.sibling,t!==null){Z=t;return}Z=t=e}while(t!==null);Hl===0&&(Hl=5)}function Pu(e,t){do{var n=Nc(e.alternate,e);if(n!==null){n.flags&=32767,Z=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Z=e;return}Z=e=n}while(e!==null);Hl=6,Z=null}function Fu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Bu();while(nu!==0);if(Pl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Hr,Ye(e,n,o,s,c,l),e===Fl&&(Z=Fl=null,Q=0),iu=t,ru=e,au=n,ou=o,su=a,cu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yu(Oe,function(){return Vu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=M.T,M.T=null,a=N.p,N.p=2,s=Pl,Pl|=4;try{$c(e,t,n)}finally{Pl=s,N.p=a,M.T=r}}nu=1,Iu(),Lu(),Ru()}}function Iu(){if(nu===1){nu=0;var e=ru,t=iu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=Pl;Pl|=4;try{fl(t,e);var a=zd,o=gr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&hr(s.ownerDocument.documentElement,s)){if(c!==null&&_r(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 _=mr(s,h),v=mr(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}}sp=!!Rd,zd=Rd=null}finally{Pl=i,N.p=r,M.T=n}}e.current=t,nu=2}}function Lu(){if(nu===2){nu=0;var e=ru,t=iu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=Pl;Pl|=4;try{el(e,t.alternate,t)}finally{Pl=i,N.p=r,M.T=n}}nu=3}}function Ru(){if(nu===4||nu===3){nu=0,Ce();var e=ru,t=iu,n=au,r=cu;t.subtreeFlags&10256||t.flags&10256?nu=5:(nu=0,iu=ru=null,zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(tu=null),et(n),t=t.stateNode,Ne&&typeof Ne.onCommitFiberRoot==`function`)try{Ne.onCommitFiberRoot(Me,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=M.T,i=N.p,N.p=2,M.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{M.T=t,N.p=i}}au&3&&Bu(),nd(e),i=e.pendingLanes,n&261930&&i&42?e===uu?lu++:(lu=0,uu=e):lu=0,rd(0,!1)}}function zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,$i(t)))}function Bu(){return Iu(),Lu(),Ru(),Vu()}function Vu(){if(nu!==5)return!1;var e=ru,t=ou;ou=0;var n=et(au),r=M.T,a=N.p;try{N.p=32>n?32:n,M.T=null,n=su,su=null;var o=ru,s=au;if(nu=0,iu=ru=null,au=0,Pl&6)throw Error(i(331));var c=Pl;if(Pl|=4,kl(o.current),xl(o,o.current,s,n),Pl=c,rd(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot==`function`)try{Ne.onPostCommitFiberRoot(Me,o)}catch{}return!0}finally{N.p=a,M.T=r,zu(e,t)}}function Hu(e,t,n){t=si(n,t),t=Gs(e.stateNode,t,2),e=Pa(e,t,2),e!==null&&(Je(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=si(n,e),n=Ks(2),r=Pa(t,n,2),r!==null&&(qs(n,r,t,e),Je(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Nl;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)||(Bl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Fl===e&&(Q&n)===n&&(Hl===4||Hl===3&&(Q&62914560)===Q&&300>we()-Zl?!(Pl&2)&&bu(e,0):Gl|=n,ql===Q&&(ql=0)),nd(e)}function Ku(e,t){t===0&&(t=Ke()),e=Kr(e,t),e!==null&&(Je(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(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),Ku(e,n)}function Yu(e,t){return be(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;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-Fe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Q,a=Ue(r,r===Fl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||We(r,a)||(n=!0,cd(r,a));r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=we(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}nu!==0&&nu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Fe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ge(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Fl,n=Q,n=Ue(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Il===2||Il===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&xe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||We(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&xe(r),et(n)){case 2:case 8:n=De;break;case 32:n=Oe;break;case 268435456:n=Ae;break;default:n=Oe}return r=sd.bind(null,e),n=be(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&xe(r),e.callbackPriority=2,e.callbackNode=null,2}function sd(e,t){if(nu!==0&&nu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Bu()&&e.callbackNode!==n)return null;var r=Q;return r=Ue(e,e===Fl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(mu(e,r,t),od(e,we()),e.callbackNode!=null&&e.callbackNode===n?sd.bind(null,e):null)}function cd(e,t){if(Bu())return null;mu(e,t,!0)}function ld(){Yd(function(){Pl&6?be(Ee,id):ad()})}function ud(){if(td===0){var e=na;e===0&&(e=ze,ze<<=1,!(ze&261888)&&(ze=256)),td=e}return td}function dd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Xt(``+e)}function fd(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 pd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=dd((i[at]||null).action),o=r.submitter;o&&(t=(t=o[at]||null)?dd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new yn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(td!==0){var e=o?fd(i,o):new FormData(i);_s(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?fd(i,o):new FormData(i),_s(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var md=0;md<Lr.length;md++){var hd=Lr[md];Rr(hd.toLowerCase(),`on`+(hd[0].toUpperCase()+hd.slice(1)))}Rr(kr,`onAnimationEnd`),Rr(Ar,`onAnimationIteration`),Rr(jr,`onAnimationStart`),Rr(`dblclick`,`onDoubleClick`),Rr(`focusin`,`onFocus`),Rr(`focusout`,`onBlur`),Rr(Mr,`onTransitionRun`),Rr(Nr,`onTransitionStart`),Rr(Pr,`onTransitionCancel`),Rr(Fr,`onTransitionEnd`),xt(`onMouseEnter`,[`mouseout`,`mouseover`]),xt(`onMouseLeave`,[`mouseout`,`mouseover`]),xt(`onPointerEnter`,[`pointerout`,`pointerover`]),xt(`onPointerLeave`,[`pointerout`,`pointerover`]),bt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),bt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),bt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),bt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var gd=`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(` `),_d=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(gd));function vd(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){zr(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){zr(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[st];n===void 0&&(n=t[st]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,vt.forEach(function(t){t!==`selectionchange`&&(_d.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!cn||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 Cd(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=pt(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}an(function(){var r=a,i=$t(n),s=[];a:{var c=Ir.get(e);if(c!==void 0){var l=yn,u=e;switch(e){case`keypress`:if(mn(n)===0)break a;case`keydown`:case`keyup`:l=Fn;break;case`focusin`:u=`focus`,l=Dn;break;case`focusout`:u=`blur`,l=Dn;break;case`beforeblur`:case`afterblur`:l=Dn;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=Tn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=En;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Ln;break;case kr:case Ar:case jr:l=On;break;case Fr:l=U;break;case`scroll`:case`scrollend`:l=V;break;case`wheel`:l=Rn;break;case`copy`:case`cut`:case`paste`:l=kn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=In;break;case`toggle`:case`beforetoggle`:l=zn}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=on(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Qt&&(u=n.relatedTarget||n.fromElement)&&(pt(u)||u[ot]))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?pt(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=Tn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=In,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ht(l),h=u==null?c:ht(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,pt(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=Ed,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&&Dd(s,c,l,d,!1),u!==null&&f!==null&&Dd(s,f,u,d,!0)}}a:{if(c=r?ht(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ir;else if($n(c))if(ar)v=ur;else{v=cr;var y=sr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&qt(r.elementType)&&(v=ir):v=lr;if(v&&=v(e,r)){er(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&zt(c,`number`,c.value)}switch(y=r?ht(r):window,e){case`focusin`:($n(y)||y.contentEditable===`true`)&&(yr=y,br=r,xr=null);break;case`focusout`:xr=br=yr=null;break;case`mousedown`:Sr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Sr=!1,Cr(s,n,i);break;case`selectionchange`:if(vr)break;case`keydown`:case`keyup`:Cr(s,n,i)}var b;if(Vn)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 Yn?qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Wn&&n.locale!==`ko`&&(Yn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Yn&&(b=pn()):(un=i,dn=`value`in un?un.value:un.textContent,Yn=!0)),y=Td(r,x),0<y.length&&(x=new An(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Jn(n),b!==null&&(x.data=b)))),(b=Un?Xn(e,n):Zn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new An(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),pd(s,e,r,n,i)}vd(s,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(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=on(e,n),i!=null&&r.unshift(wd(e,i,a)),i=on(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(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=on(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=on(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
9
+ `).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ut(e,``+r);break;case`className`:Dt(e,`class`,r);break;case`tabIndex`:Dt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Dt(e,n,r);break;case`style`:Kt(e,r,o);break;case`data`:if(t!==`object`){Dt(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=Xt(``+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`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Xt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Zt);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`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=Xt(``+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`:$(`beforetoggle`,e),$(`toggle`,e),Et(e,`popover`,r);break;case`xlinkActuate`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Et(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=Jt.get(n)||n,Et(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:Kt(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`?Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ut(e,``+r);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Zt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!yt.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[at]||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,``):Et(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`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:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:$(`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:Md(e,t,r,d,n,null)}}Rt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`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:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Bt(e,!!r,n,!0):Bt(e,!!r,t,!1);return;case`textarea`:for(s in $(`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:Md(e,t,s,c,n,null)}Ht(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:Md(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<gd.length;r++)$(gd[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`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:Md(e,t,u,r,n,null)}return;default:if(qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(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)||Md(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&&Md(e,t,p,m,r,f)}}Lt(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)||Md(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&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Bt(e,!!n,n?[]:``,!1):Bt(e,!!n,t,!0)):Bt(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:Md(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&&Md(e,t,s,a,r,o)}Vt(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:Md(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:Md(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)&&Md(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:Md(e,t,u,p,r,m)}return;default:if(qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(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||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(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||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){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&&Id(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&&Id(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 Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(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 Hd(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 Ud(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 Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(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),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[dt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(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 ef(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`:ef(n),ft(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(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[dt])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=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(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 cf(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 lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(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 ff(e,t,n){switch(t=Bd(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 pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ft(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=N.d;N.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=vu();return e||t}function yf(e){var t=mt(e);t!==null&&t.tag===5&&t.type===`form`?ys(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=It(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+It(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+It(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+It(n.imageSizes)+`"]`)):i+=`[href="`+It(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+It(r)+`"][href="`+It(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),_t(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=gt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);_t(c),Pd(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,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=gt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),_t(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=gt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),_t(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=ce.current)?gf(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=Af(n.href),n=gt(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=Af(n.href);var o=gt(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(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.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},mf.set(e,n),o||Nf(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=Pf(n),n=gt(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 Af(e){return`href="`+It(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(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}),Pd(t,`link`,n),_t(t),e.head.appendChild(t))}function Pf(e){return`[src="`+It(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+It(n.href)+`"]`);if(r)return t.instance=r,_t(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),_t(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,_t(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),_t(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,_t(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),_t(a),Pd(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,Lf(r,n.precedence,e));return t.instance}function Lf(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 Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,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[dt]||a[it]||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 Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(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 Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(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=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,_t(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),_t(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(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=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.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=Jf.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 Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function $f(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=qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qe(0),this.hiddenUpdates=qe(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 ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Zr(3,null,null,t),e.current=a,a.stateNode=e,t=Qi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ja(a),e}function tp(e){return e?(e=Yr,e):Yr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Na(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Pa(e,r,t),n!==null&&(pu(n,e,t),Fa(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Kr(e,67108864);t!==null&&pu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=du();t=$e(t);var n=Kr(e,t);n!==null&&pu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=2,up(e,t,n,r)}finally{N.p=a,M.T=i}}function lp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=8,up(e,t,n,r)}finally{N.p=a,M.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=He(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Fe(o);s.entanglements[1]|=c,o&=~c}nd(a),!(Pl&6)&&($l=we()+500,rd(0,!1))}}break;case 31:case 13:s=Kr(a,2),s!==null&&pu(s,a,2),vu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=$t(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=pt(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 fp=e,null}function mp(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(Te()){case Ee:return 2;case De:return 8;case Oe:case ke:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`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 Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(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=mt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=pt(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,nt(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,nt(e.priority,function(){op(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 Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Qt=r,n.target.dispatchEvent(r),Qt=null}else return t=mt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=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(pp(r||n)===null)continue;break}var a=mt(n);a!==null&&(e.splice(t,3),t-=3,_s(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.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[at]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[at]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){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 Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,du(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),vu(),t[ot]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=tt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.4`)throw Error(i(527,Lp,`19.2.4`));N.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:M,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Me=zp.inject(Rp),Ne=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Bs,s=Vs,c=Hs;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=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[ot]=t.current,xd(e),new Fp(t)}})),g=c(o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()}))(),1),_=c(u(),1),v=500,y=200,b=3e3,x=1e3,S=3e4,C=Object.freeze({counters:Object.freeze({}),latestBurst:null,burstRing:Object.freeze([]),burstSeq:0,lifecycleRing:Object.freeze([]),connectionSeq:0,connected:!1,reconnectAttempts:0,lastErrorAt:null,reconnectDelayMs:x}),w=new Set,T={},E=[],D=[],O=[],ee=!1,k=!1,A=null,j=null,te=null,ne=!1,re=typeof localStorage<`u`&&localStorage.getItem(`DEBUG_SSE`)===`1`;function M(e,t){re&&(t?console.debug(`[ssg-sse] ${e}`,t):console.debug(`[ssg-sse] ${e}`))}function N(){ne||(ne=!0,queueMicrotask(ie))}function ie(){ne=!1;let e=Object.keys(T),t=E,n=D,r=O,i=ee,a=A!==null||j!==null||te!==null;if(e.length===0&&t.length===0&&n.length===0&&r.length===0&&!i&&!a)return;let o=C.counters;if(e.length>0){let t={...C.counters};for(let n of e)t[n]=(t[n]??0)+(T[n]??0);o=Object.freeze(t),T={}}let s=C.burstRing,c=C.latestBurst,l=C.burstSeq;if(t.length>0){let e=C.burstRing.length+t.length>v?[...C.burstRing,...t].slice(-v):[...C.burstRing,...t];s=Object.freeze(e),c=t[t.length-1]??c,l=C.burstSeq+t.length,E=[]}if(n.length>0){let e=new Map;for(let t of n)e.set(t.tool_use_id,t);let t=!1,r=s.map(n=>{if(!n.tool_use_id)return n;let r=e.get(n.tool_use_id);if(!r)return n;t=!0;let i=n.output_tokens??0,a=n.complete_ts_ms??0,o=Math.max(i,r.output_tokens),s=Math.max(a,r.ts_ms),c=Math.max(n.complete_duration_ms??0,r.duration_ms??0);return{...n,output_tokens:o,complete_ts_ms:s,...c>0?{complete_duration_ms:c}:{}}});t&&(s=Object.freeze(r),l=C.burstSeq+1),D=[]}let u=C.lifecycleRing;if(r.length>0){let e=C.lifecycleRing.length+r.length>y?[...C.lifecycleRing,...r].slice(-y):[...C.lifecycleRing,...r];u=Object.freeze(e),O=[]}let d=C.connected,f=C.connectionSeq;i&&(d=k,f=C.connectionSeq+1,ee=!1);let p=C.reconnectAttempts,m=C.lastErrorAt,h=C.reconnectDelayMs;A!==null&&(p=A,A=null),j!==null&&(m=j,j=null),te!==null&&(h=te,te=null),C=Object.freeze({counters:o,latestBurst:c,burstRing:s,burstSeq:l,lifecycleRing:u,connectionSeq:f,connected:d,reconnectAttempts:p,lastErrorAt:m,reconnectDelayMs:h});for(let e of w)e()}var ae=null,oe=0,P=new Set,F=new Map,I=null,se=x,L=null;function ce(e,t){if(e===`eval-burst`){try{let e=JSON.parse(t.data);Array.isArray(e?.bursts)&&(E.push(...e.bursts),N())}catch{}return}if(e===`eval-burst-complete`){try{let e=JSON.parse(t.data);if(e&&typeof e.tool_use_id==`string`&&e.tool_use_id.length>0&&typeof e.output_tokens==`number`&&Number.isFinite(e.output_tokens)&&typeof e.ts_ms==`number`&&Number.isFinite(e.ts_ms)){let t={ts_ms:e.ts_ms,tool_use_id:e.tool_use_id,output_tokens:Math.max(0,e.output_tokens),...typeof e.duration_ms==`number`&&Number.isFinite(e.duration_ms)?{duration_ms:e.duration_ms}:{}};D.push(t),N()}}catch{}return}if(e===`session-lifecycle`){try{let e=JSON.parse(t.data);Array.isArray(e?.events)&&e.events.length>0&&(O.push(...e.events),N())}catch{}return}T[e]=(T[e]??0)+1,N()}function le(e){if(!ae||F.has(e))return;let t=t=>ce(e,t);ae.addEventListener(e,t),F.set(e,t)}var ue=0,de=0,fe=2e3;function pe(){if(ae)return;M(`opening EventSource`,{url:`/api/events`}),de=Date.now();let e=new EventSource(`/api/events`);ae=e,F.clear();for(let e of P)le(e);e.onopen=()=>{let e=C.lastErrorAt!==null;se=x,ue=0,A=0,te=x,ee=!0,k=!0,N(),e&&Se(`reconnect`),M(`connected`)},e.onerror=()=>{e.close(),ae=null,F.clear(),ee=!0,k=!1,j=Date.now(),N(),ue===0&&Date.now()-de<fe?M(`first-open interrupted (page-load race) — reconnect in ${se}ms`):console.warn(`[ssg-sse] EventSource error — reconnect in ${se}ms (attempt ${ue+1})`),oe>0&&(I=setTimeout(()=>{I=null,oe>0&&pe()},se),ue++,A=ue,se=Math.min(se*2,S),te=se,N())}}function me(){I&&=(clearTimeout(I),null),ae?.close(),ae=null,F.clear(),se=x,ue=0,A=0,te=x,ee=!0,k=!1,N()}typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&oe!==0&&(ae||(I&&=(clearTimeout(I),null),M(`visibilitychange → reconnecting`),pe()))});function R(){for(let e of P)e!==`eval-burst`&&(T[e]=(T[e]??0)+1);N()}function he(e){return w.add(e),()=>{w.delete(e)}}function ge(){return C}var _e=2e3,ve=1e4,ye=1440*60*1e3,z=500,be=0,xe=null;function Se(e){let t=Date.now();if(t-be<ve){M(`hydrate skipped (cooldown)`,{reason:e});return}if(xe)return;let n=t-ye,r=C.burstRing[C.burstRing.length-1],i=C.burstRing.length>0&&r!==void 0?r.ts_ms+1:n,a=e===`reconnect`?Math.max(i,n):n,o=t;if(a>=o)return;be=t;let s=new AbortController;xe=s,M(`hydrate start`,{reason:e,since:a,until:o,ringLen:C.burstRing.length}),(async()=>{let t=a,n=0;try{for(;n<_e&&t<o&&!s.signal.aborted;){let r=Math.min(z,_e-n),i=await fetch(`/api/json/graph/backfill?since_ms=${t}&until_ms=${o}&limit=${r}`,{signal:s.signal,credentials:`same-origin`});if(!i.ok)break;let a=await i.json();if(!Array.isArray(a.bursts)||a.bursts.length===0||(E.push(...a.bursts),N(),n+=a.bursts.length,M(`hydrate page`,{reason:e,page:n,count:a.bursts.length}),a.bursts.length<r))break;let c=a.bursts[a.bursts.length-1];if(c===void 0)break;t=c.ts_ms+1}M(`hydrate done`,{reason:e,fetched:n})}catch(t){t.name!==`AbortError`&&console.warn(`[ssg-sse] ring hydration failed (${e})`,t)}finally{xe=null}})()}function Ce(e){for(let t of e)P.add(t),le(t);return oe++,oe===1&&(Se(`initial`),pe(),L=setInterval(R,b)),()=>{oe--,oe===0&&(me(),L&&=(clearInterval(L),null))}}var we=Object.freeze([`eval-burst`,`eval-burst-complete`,`counters-updated`]);function Te(){(0,_.useEffect)(()=>Ce(we),[])}function Ee(){return Te(),(0,_.useSyncExternalStore)(he,ge).latestBurst}function De(){return Te(),(0,_.useSyncExternalStore)(he,ge).burstRing}function Oe(){return Te(),(0,_.useSyncExternalStore)(he,ge).burstSeq}function ke(){let e=document.querySelector(`meta[name="ssg-csrf"]`)?.content??``;return e?{"X-SigmaShake-Token":e}:{}}function Ae(e){let t=(0,_.useSyncExternalStore)(he,ge),n=e.join(`,`);(0,_.useEffect)(()=>Ce(e),[n]);let r=(0,_.useRef)({});return(0,_.useMemo)(()=>{let n={},i=!1;for(let a of e){let e=t.counters[a]??0;n[a]=e,r.current[a]!==e&&(i=!0)}return!i&&Object.keys(r.current).length===e.length?r.current:(r.current=n,n)},[t,n])}function B(e,t=[]){let[n,r]=(0,_.useState)({data:null,loading:!0,error:null}),[i,a]=(0,_.useState)(0),o=(0,_.useRef)(null),s=(0,_.useCallback)(()=>{a(e=>e+1)},[]);return(0,_.useEffect)(()=>{let t=new AbortController;return o.current=t,r(e=>({...e,loading:!0,error:null})),fetch(e,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t.signal.aborted||r({data:e,loading:!1,error:null})}).catch(e=>{if(t.signal.aborted)return;let n=e instanceof Error?e.message:String(e);r(e=>({...e,loading:!1,error:n}))}),()=>{t.abort()}},[e,i,...t]),{...n,refetch:s}}var je=e=>e,Me=e=>({in:t=>t**+e,out:t=>1-(1-t)**e,inOut:t=>t<.5?(2*t)**e/2:1-(-2*t+2)**e/2}),Ne=Me(2),Pe=Me(3),Fe=Me(4),Ie=Me(5),Le={in:e=>1-Math.cos(e*Math.PI/2),out:e=>Math.sin(e*Math.PI/2),inOut:e=>-(Math.cos(Math.PI*e)-1)/2},Re={in:e=>e===0?0:2**(10*e-10),out:e=>e===1?1:1-2**(-10*e),inOut:e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2},ze={in:e=>1-Math.sqrt(1-e**2),out:e=>Math.sqrt(1-(e-1)**2),inOut:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2};function Be(e=1.70158){let t=e;return e=>e*e*((t+1)*e-t)}function Ve(e=1.70158){let t=e;return e=>{let n=e-1;return n*n*((t+1)*n+t)+1}}function He(e=1.70158){let t=e*1.525;return e=>e<.5?(2*e)**2*((t+1)*2*e-t)/2:((2*e-2)**2*((t+1)*(e*2-2)+t)+2)/2}function Ue(e=1,t=.3){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>e===0?0:e===1?1:n*2**(-10*e)*Math.sin((e-i)*(Math.PI*2)/r)+1}function We(e=1,t=.3){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>e===0?0:e===1?1:-(n*2**(10*(e-1))*Math.sin((e-1-i)*(Math.PI*2)/r))}function Ge(e=1,t=.45){let n=Math.max(e,1),r=Math.max(t,.08),i=r/(Math.PI*2)*Math.asin(1/n);return e=>{if(e===0)return 0;if(e===1)return 1;let t=e*2;return t<1?-.5*(n*2**(10*(t-1))*Math.sin((t-1-i)*(Math.PI*2)/r)):n*2**(-10*(t-1))*Math.sin((t-1-i)*(Math.PI*2)/r)*.5+1}}var Ke=7.5625,qe=2.75,Je=e=>{if(e<1/qe)return Ke*e*e;if(e<2/qe){let t=e-1.5/qe;return Ke*t*t+.75}if(e<2.5/qe){let t=e-2.25/qe;return Ke*t*t+.9375}let t=e-2.625/qe;return Ke*t*t+.984375},Ye=e=>1-Je(1-e),Xe=e=>e<.5?(1-Je(1-2*e))/2:(1+Je(2*e-1))/2;function Ze(e){let t=Math.max(1,Math.floor(e));return e=>e>=1?1:e<=0?0:Math.floor(e*t)/t}function Qe(e,t,n,r){let i=3*e,a=3*(n-e)-i,o=1-i-a,s=3*t,c=3*(r-t)-s,l=1-s-c,u=e=>((o*e+a)*e+i)*e,d=e=>((l*e+c)*e+s)*e,f=e=>(3*o*e+2*a)*e+i,p=e=>{let t=e;for(let n=0;n<8;n++){let n=u(t)-e;if(Math.abs(n)<1e-5)return t;let r=f(t);if(Math.abs(r)<1e-6)break;t-=n/r}let n=0,r=1;for(t=e;n<r;){let i=u(t);if(Math.abs(i-e)<1e-5)return t;e>i?n=t:r=t,t=(n+r)/2}return t};return e=>e<=0?0:e>=1?1:d(p(e))}function $e(e={}){let t=Math.max(1,e.stiffness??100),n=Math.max(0,e.damping??10),r=Math.max(.01,e.mass??1),i=e.velocity??0,a=Math.sqrt(t/r),o=n/(2*Math.sqrt(t*r)),s;if(o<1){let e=a*Math.sqrt(1-o*o),t=(o*a+-i)/e;s=n=>1-Math.exp(-o*a*n)*(1*Math.cos(e*n)+t*Math.sin(e*n))}else if(o===1){let e=a+-i;s=t=>1-Math.exp(-a*t)*(1+e*t)}else{let e=Math.sqrt(o*o-1),t=-a*(o-e),n=-a*(o+e),r=(n- -i)/(n-t),c=1-r;s=e=>1-(r*Math.exp(t*e)+c*Math.exp(n*e))}let c=400;for(let e=16;e<=4e3;e+=16){let t=s(e/1e3);if(Math.abs(1-t)<.005){let t=s((e-16)/1e3);if(Math.abs(1-t)<.005){c=e;break}}c=e}let l=c/1e3;return{duration:c,fn:e=>s(Math.max(0,Math.min(1,e))*l)}}var et={linear:je,inQuad:Ne.in,outQuad:Ne.out,inOutQuad:Ne.inOut,inCubic:Pe.in,outCubic:Pe.out,inOutCubic:Pe.inOut,inQuart:Fe.in,outQuart:Fe.out,inOutQuart:Fe.inOut,inQuint:Ie.in,outQuint:Ie.out,inOutQuint:Ie.inOut,inSine:Le.in,outSine:Le.out,inOutSine:Le.inOut,inExpo:Re.in,outExpo:Re.out,inOutExpo:Re.inOut,inCirc:ze.in,outCirc:ze.out,inOutCirc:ze.inOut,inBack:Be(),outBack:Ve(),inOutBack:He(),inElastic:We(),outElastic:Ue(),inOutElastic:Ge(),inBounce:Ye,outBounce:Je,inOutBounce:Xe};function tt(e){if(typeof e==`function`)return e;if(e===void 0)return et.outCubic;let t=et[e];if(t)return t;let n=e.match(/^(\w+)\(([^)]*)\)$/);if(n){let e=n[1],t=n[2].split(`,`).map(e=>parseFloat(e.trim())).filter(e=>!Number.isNaN(e));switch(e){case`outElastic`:return Ue(t[0],t[1]);case`inElastic`:return We(t[0],t[1]);case`inOutElastic`:return Ge(t[0],t[1]);case`outBack`:return Ve(t[0]);case`inBack`:return Be(t[0]);case`inOutBack`:return He(t[0]);case`steps`:return Ze(t[0]??4);case`cubicBezier`:return t.length>=4?Qe(t[0],t[1],t[2],t[3]):et.outCubic;default:return et.outCubic}}return et.outCubic}function nt(e,t){if(t<=1||e===void 0||e===`first`)return 0;if(e===`last`)return t-1;if(e===`center`)return(t-1)/2;let n=Math.floor(e);return n<0?0:n>t-1?t-1:n}function rt(e,t={}){let n=t.start??0,r=t.direction===`reverse`;return(i,a)=>{if(a<=0)return n;let o=nt(t.from,a),s=Math.abs(i-o),c=Math.max(o,a-1-o),l=c===0?0:s/c,u=r?1-l:l,d;if(Array.isArray(e)){let[t,n]=e;d=t+u*(n-t)}else d=(r?c-s:s)*e;return n+d}}var it=new Set([`duration`,`delay`,`ease`,`loop`,`alternate`,`onBegin`,`onUpdate`,`onComplete`]);function at(e){if(typeof e==`number`||typeof e==`string`)return e;if(Array.isArray(e)&&e.length===2){let[t,n]=e;if((typeof t==`number`||typeof t==`string`)&&(typeof n==`number`||typeof n==`string`))return[t,n]}return null}function ot(e){return e?typeof e==`string`?typeof document>`u`?[]:Array.from(document.querySelectorAll(e)):e instanceof Element?[e]:`length`in e?Array.from(e):[]:[]}function st(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var ct=/^(-?\d*\.?\d+)([a-z%]*)$/i;function lt(e){if(typeof e==`number`)return{value:e,unit:``};let t=e.trim().match(ct);return t?{value:parseFloat(t[1]),unit:t[2]??``}:{value:0,unit:``}}function ut(e){return e.unit===``?`${e.value}`:`${e.value}${e.unit}`}var dt=new Set([`translate`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`]),ft=new WeakMap;function pt(e){let t=ft.get(e);return t||(t={values:{}},ft.set(e,t)),t}function mt(e){let t=[];for(let[n,r]of Object.entries(e.values)){let e=r.unit||(n.startsWith(`rotate`)||n.startsWith(`skew`)?`deg`:n.startsWith(`translate`)?`px`:``);t.push(`${n}(${r.value}${e})`)}return t.join(` `)}function ht(e,t,n){if(dt.has(t)){let r=pt(e);r.values[t]=n,e.style.transform=mt(r);return}if(t===`opacity`){e.style.opacity=`${n.value}`;return}e.style.setProperty(t,ut(n))}function gt(e,t){return dt.has(t)?pt(e).values[t]||{value:t.startsWith(`scale`)?1:0,unit:``}:lt(e.style.getPropertyValue(t)||(typeof window<`u`?window.getComputedStyle(e).getPropertyValue(t):``)||(t===`opacity`?`1`:`0`))}function _t(e,t,n){return e+(t-e)*n}function vt(e,t,n){return e===void 0?0:typeof e==`number`?e:e(t,n)}function yt(e){if(e&&typeof e==`object`&&`spring`in e){let t=$e(e.spring);return{ease:t.fn,duration:t.duration}}return{ease:tt(e),duration:null}}var bt=0,xt=new Set;function St(e){for(let t of xt){if(t.done||e<t.start)continue;let{target:n,options:r}=t,i=e-t.start,a=Math.max(1,n.duration),o=r.loop??!1,s=r.alternate===!0,c=o===!0?1/0:typeof o==`number`?Math.max(1,o):1,l=Math.floor(i/a),u=(i-l*a)/a,d=s&&l%2==1?1-u:u;if(l>=c){for(let e of n.props)ht(n.el,e.name,Ct(e.from,e.to,s&&c%2==0?0:1));r.onUpdate?.(1,n.el,n.index),r.onComplete?.(n.el,n.index),t.done=!0;continue}for(let e of n.props){let t=e.ease(Math.max(0,Math.min(1,d)));n.el!==null&&ht(n.el,e.name,Ct(e.from,e.to,t))}n.el!==null&&r.onUpdate?.(d,n.el,n.index)}for(let e of[...xt])e.done&&xt.delete(e);if(xt.size===0){bt=0;return}bt=requestAnimationFrame(St)}function Ct(e,t,n){let r=e.unit||t.unit;return{value:_t(e.value,t.value,n),unit:r}}function wt(){bt===0&&(typeof requestAnimationFrame>`u`||(bt=requestAnimationFrame(St)))}function Tt(e,t){let n=ot(e),r=n.length,i=Object.keys(t).filter(e=>!it.has(e)),a=st(),{ease:o,duration:s}=yt(t.ease),c=t.duration??s??400,l=[],u=[],d=typeof performance<`u`?performance.now():Date.now(),f=(e,n)=>{let a=[];for(let n of i){let r=t[n];if(r===void 0)continue;let i=at(r);if(i===null)continue;let s,c;Array.isArray(i)?(s=lt(i[0]),c=lt(i[1])):(s=gt(e,n),c=lt(i)),a.push({name:n,from:s,to:c,ease:o})}return{el:e,index:n,props:a,duration:c,delay:vt(t.delay,n,r)}};if(n.length===0)return{cancel:()=>{},finished:Promise.resolve(),get done(){return!0}};let p=!1;for(let e=0;e<n.length;e++){let r=n[e],i=f(r,e),o=d+i.delay;if(t.onBegin?.(r,e),a){for(let e of i.props)ht(r,e.name,e.to);t.onUpdate?.(1,r,e),t.onComplete?.(r,e),u.push(Promise.resolve());continue}for(let e of i.props)ht(r,e.name,e.from);let s={target:i,start:o,options:t,done:!1};l.push(s),xt.add(s),u.push(new Promise(e=>{let n=t.onComplete,r=(t,r)=>{try{n?.(t,r)}finally{e()}};s.options={...t,onComplete:r}}))}return wt(),{cancel(){if(!p){p=!0;for(let e of l)e.done=!0,xt.delete(e)}},finished:Promise.all(u).then(()=>void 0),get done(){return p||l.every(e=>e.done)}}}function Et(e={}){let t=(0,_.useRef)(null),n=(0,_.useRef)(!1),r=(0,_.useCallback)(()=>{if(n.current)return;let r=t.current;if(!r)return;let i=r.querySelectorAll(`[data-reveal]`);if(i.length===0)return;if(n.current=!0,st()){i.forEach(e=>{e.style.opacity=`1`,e.style.transform=``});return}let a=e.staggerMs??40,o=e.maxStaggerMs??320,s=Math.min(a,Math.max(10,o/i.length)),c=e.translateY??14,l=e.durationMs??520,u=e.from??`center`;i.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(${c}px)`,e.style.willChange=`transform, opacity`}),Tt(Array.from(i),{opacity:[0,1],translateY:[c,0],duration:l,ease:`outBack(1.2)`,delay:rt(s,{from:u}),onComplete:e=>{e.style.willChange=``}})},[e.staggerMs,e.maxStaggerMs,e.durationMs,e.translateY,e.from]);return(0,_.useEffect)(()=>{let n=t.current;if(!n)return;if(typeof IntersectionObserver>`u`){r();return}let i=!1,a=new IntersectionObserver(e=>{for(let t of e)if(t.isIntersecting&&!i){r(),a.disconnect();return}},{threshold:.08});a.observe(n);let o=n.querySelectorAll(`[data-reveal]`);if(!st()){let t=e.translateY??14;o.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(${t}px)`})}let s=n.getBoundingClientRect();return s.top<(window.innerHeight||document.documentElement.clientHeight)&&s.bottom>0&&(r(),a.disconnect()),()=>{i=!0,a.disconnect()}},[r,e.translateY]),t}function Dt(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Dt(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Ot(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Dt(e))&&(r&&(r+=` `),r+=t);return r}var kt=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,At=Ot,jt=(e,t)=>n=>{if(t?.variants==null)return At(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=kt(t)||kt(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return At(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Mt=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Nt=(e,t)=>({classGroupId:e,validator:t}),Pt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Ft=`-`,It=[],Lt=`arbitrary..`,Rt=e=>{let t=Vt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Bt(e);let n=e.split(Ft);return zt(n,n[0]===``&&n.length>1?1:0,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Mt(i,t):t:i||It}return n[e]||It}}},zt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=zt(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Ft):e.slice(t).join(Ft),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Bt=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Lt+r:void 0})(),Vt=e=>{let{theme:t,classGroups:n}=e;return Ht(n,t)},Ht=(e,t)=>{let n=Pt();for(let r in e){let i=e[r];Ut(i,n,r,t)}return n},Ut=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Wt(i,t,n,r)}},Wt=(e,t,n,r)=>{if(typeof e==`string`){Gt(e,t,n);return}if(typeof e==`function`){Kt(e,t,n,r);return}qt(e,t,n,r)},Gt=(e,t,n)=>{let r=e===``?t:Jt(t,e);r.classGroupId=n},Kt=(e,t,n,r)=>{if(Yt(e)){Ut(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Nt(n,e))},qt=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Ut(o,Jt(t,a),n,r)}},Jt=(e,t)=>{let n=e,r=t.split(Ft),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Pt(),n.nextPart.set(t,i)),n=i}return n},Yt=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Xt=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Zt=`!`,Qt=`:`,$t=[],en=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),tn=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Qt){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Zt)?(c=s.slice(0,-1),l=!0):s.startsWith(Zt)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return en(t,l,c,u)};if(t){let e=t+Qt,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):en($t,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},nn=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},rn=e=>({cache:Xt(e.cacheSize),parseClassName:tn(e),sortModifiers:nn(e),...Rt(e)}),an=/\s+/,on=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(an),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Zt:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},sn=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=cn(n))&&(i&&(i+=` `),i+=r);return i},cn=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=cn(e[r]))&&(n&&(n+=` `),n+=t);return n},ln=(e,...t)=>{let n,r,i,a,o=o=>(n=rn(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=on(e,n);return i(e,a),a};return a=o,(...e)=>a(sn(...e))},un=[],dn=e=>{let t=t=>t[e]||un;return t.isThemeGetter=!0,t},fn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pn=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,hn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,_n=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,vn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bn=e=>mn.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),xn=e=>!!e&&Number.isInteger(Number(e)),Sn=e=>e.endsWith(`%`)&&V(e.slice(0,-1)),Cn=e=>hn.test(e),wn=()=>!0,Tn=e=>gn.test(e)&&!_n.test(e),En=()=>!1,Dn=e=>vn.test(e),On=e=>yn.test(e),kn=e=>!H(e)&&!U(e),An=e=>Gn(e,Yn,En),H=e=>fn.test(e),jn=e=>Gn(e,Xn,Tn),Mn=e=>Gn(e,Zn,V),Nn=e=>Gn(e,$n,wn),Pn=e=>Gn(e,Qn,En),Fn=e=>Gn(e,qn,En),In=e=>Gn(e,Jn,On),Ln=e=>Gn(e,er,Dn),U=e=>pn.test(e),Rn=e=>Kn(e,Xn),zn=e=>Kn(e,Qn),Bn=e=>Kn(e,qn),Vn=e=>Kn(e,Yn),Hn=e=>Kn(e,Jn),Un=e=>Kn(e,er,!0),Wn=e=>Kn(e,$n,!0),Gn=(e,t,n)=>{let r=fn.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Kn=(e,t,n=!1)=>{let r=pn.exec(e);return r?r[1]?t(r[1]):n:!1},qn=e=>e===`position`||e===`percentage`,Jn=e=>e===`image`||e===`url`,Yn=e=>e===`length`||e===`size`||e===`bg-size`,Xn=e=>e===`length`,Zn=e=>e===`number`,Qn=e=>e===`family-name`,$n=e=>e===`number`||e===`weight`,er=e=>e===`shadow`,tr=ln(()=>{let e=dn(`color`),t=dn(`font`),n=dn(`text`),r=dn(`font-weight`),i=dn(`tracking`),a=dn(`leading`),o=dn(`breakpoint`),s=dn(`container`),c=dn(`spacing`),l=dn(`radius`),u=dn(`shadow`),d=dn(`inset-shadow`),f=dn(`text-shadow`),p=dn(`drop-shadow`),m=dn(`blur`),h=dn(`perspective`),g=dn(`aspect`),_=dn(`ease`),v=dn(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),U,H],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[U,H,c],T=()=>[bn,`full`,`auto`,...w()],E=()=>[xn,`none`,`subgrid`,U,H],D=()=>[`auto`,{span:[`full`,xn,U,H]},xn,U,H],O=()=>[xn,`auto`,U,H],ee=()=>[`auto`,`min`,`max`,`fr`,U,H],k=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],A=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],j=()=>[`auto`,...w()],te=()=>[bn,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ne=()=>[bn,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],re=()=>[bn,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[e,U,H],N=()=>[...b(),Bn,Fn,{position:[U,H]}],ie=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ae=()=>[`auto`,`cover`,`contain`,Vn,An,{size:[U,H]}],oe=()=>[Sn,Rn,jn],P=()=>[``,`none`,`full`,l,U,H],F=()=>[``,V,Rn,jn],I=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],L=()=>[V,Sn,Bn,Fn],ce=()=>[``,`none`,m,U,H],le=()=>[`none`,V,U,H],ue=()=>[`none`,V,U,H],de=()=>[V,U,H],fe=()=>[bn,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Cn],breakpoint:[Cn],color:[wn],container:[Cn],"drop-shadow":[Cn],ease:[`in`,`out`,`in-out`],font:[kn],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Cn],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Cn],shadow:[Cn],spacing:[`px`,V],text:[Cn],"text-shadow":[Cn],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,bn,H,U,g]}],container:[`container`],columns:[{columns:[V,H,U,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[xn,`auto`,U,H]}],basis:[{basis:[bn,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[V,bn,`auto`,`initial`,`none`,H]}],grow:[{grow:[``,V,U,H]}],shrink:[{shrink:[``,V,U,H]}],order:[{order:[xn,`first`,`last`,`none`,U,H]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...k(),`normal`]}],"justify-items":[{"justify-items":[...A(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...A()]}],"align-content":[{content:[`normal`,...k()]}],"align-items":[{items:[...A(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...A(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":k()}],"place-items":[{"place-items":[...A(),`baseline`]}],"place-self":[{"place-self":[`auto`,...A()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:te()}],"inline-size":[{inline:[`auto`,...ne()]}],"min-inline-size":[{"min-inline":[`auto`,...ne()]}],"max-inline-size":[{"max-inline":[`none`,...ne()]}],"block-size":[{block:[`auto`,...re()]}],"min-block-size":[{"min-block":[`auto`,...re()]}],"max-block-size":[{"max-block":[`none`,...re()]}],w:[{w:[s,`screen`,...te()]}],"min-w":[{"min-w":[s,`screen`,`none`,...te()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...te()]}],h:[{h:[`screen`,`lh`,...te()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...te()]}],"max-h":[{"max-h":[`screen`,`lh`,...te()]}],"font-size":[{text:[`base`,n,Rn,jn]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Wn,Nn]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Sn,H]}],"font-family":[{font:[zn,Pn,t]}],"font-features":[{"font-features":[H]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,U,H]}],"line-clamp":[{"line-clamp":[V,`none`,U,Mn]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,U,H]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,U,H]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...I(),`wavy`]}],"text-decoration-thickness":[{decoration:[V,`from-font`,`auto`,U,jn]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[V,`auto`,U,H]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,U,H]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,U,H]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:N()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:ae()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},xn,U,H],radial:[``,U,H],conic:[xn,U,H]},Hn,In]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:oe()}],"gradient-via-pos":[{via:oe()}],"gradient-to-pos":[{to:oe()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-bs":[{"border-bs":F()}],"border-w-be":[{"border-be":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":F()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...I(),`hidden`,`none`]}],"divide-style":[{divide:[...I(),`hidden`,`none`]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...I(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[V,U,H]}],"outline-w":[{outline:[``,V,Rn,jn]}],"outline-color":[{outline:M()}],shadow:[{shadow:[``,`none`,u,Un,Ln]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":[`none`,d,Un,Ln]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:F()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[V,jn]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":[`none`,f,Un,Ln]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[V,U,H]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[V]}],"mask-image-linear-from-pos":[{"mask-linear-from":L()}],"mask-image-linear-to-pos":[{"mask-linear-to":L()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":L()}],"mask-image-t-to-pos":[{"mask-t-to":L()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":L()}],"mask-image-r-to-pos":[{"mask-r-to":L()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":L()}],"mask-image-b-to-pos":[{"mask-b-to":L()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":L()}],"mask-image-l-to-pos":[{"mask-l-to":L()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":L()}],"mask-image-x-to-pos":[{"mask-x-to":L()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":L()}],"mask-image-y-to-pos":[{"mask-y-to":L()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[U,H]}],"mask-image-radial-from-pos":[{"mask-radial-from":L()}],"mask-image-radial-to-pos":[{"mask-radial-to":L()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[V]}],"mask-image-conic-from-pos":[{"mask-conic-from":L()}],"mask-image-conic-to-pos":[{"mask-conic-to":L()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:N()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:ae()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,U,H]}],filter:[{filter:[``,`none`,U,H]}],blur:[{blur:ce()}],brightness:[{brightness:[V,U,H]}],contrast:[{contrast:[V,U,H]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Un,Ln]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:[``,V,U,H]}],"hue-rotate":[{"hue-rotate":[V,U,H]}],invert:[{invert:[``,V,U,H]}],saturate:[{saturate:[V,U,H]}],sepia:[{sepia:[``,V,U,H]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,U,H]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[V,U,H]}],"backdrop-contrast":[{"backdrop-contrast":[V,U,H]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,V,U,H]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,U,H]}],"backdrop-invert":[{"backdrop-invert":[``,V,U,H]}],"backdrop-opacity":[{"backdrop-opacity":[V,U,H]}],"backdrop-saturate":[{"backdrop-saturate":[V,U,H]}],"backdrop-sepia":[{"backdrop-sepia":[``,V,U,H]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,U,H]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[V,`initial`,U,H]}],ease:[{ease:[`linear`,`initial`,_,U,H]}],delay:[{delay:[V,U,H]}],animate:[{animate:[`none`,v,U,H]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,U,H]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":[`scale-3d`],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[U,H,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":[`translate-none`],accent:[{accent:M()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,U,H]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,U,H]}],fill:[{fill:[`none`,...M()]}],"stroke-w":[{stroke:[V,Rn,jn,Mn]}],stroke:[{stroke:[`none`,...M()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function W(...e){return tr(Ot(e))}function nr(e){let t=Math.max(0,Math.floor((Date.now()-e*1e3)/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);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}function rr(e){return new Date(e*1e3).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function ir(e,t){try{let e=JSON.parse(t);if(!e||typeof e!=`object`)return t;for(let t of[`command`,`CommandLine`,`Input`,`query`,`Task`,`Prompt`])if(typeof e[t]==`string`&&e[t].length>0)return e[t];for(let t of[`file_path`,`path`,`TargetFile`,`AbsolutePath`,`SearchPath`,`DirectoryPath`,`Url`,`ImageName`])if(typeof e[t]==`string`&&e[t].length>0)return e[t];for(let t of Object.values(e))if(typeof t==`string`&&t.length>0)return t;return``}catch{return t}}var ar=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})),G=o(((e,t)=>{t.exports=ar()}))(),or=jt(`hig-card flex flex-col min-h-0 overflow-hidden`,{variants:{variant:{default:``,interactive:`hover:border-[var(--color-line-2)] hover:shadow-[var(--hig-shadow-2)] transition-all cursor-pointer`,flush:`bg-transparent border-[var(--color-line-0)] shadow-none`}},defaultVariants:{variant:`default`}});function K({className:e,variant:t,...n}){return(0,G.jsx)(`div`,{className:W(or({variant:t,className:e})),...n})}function q({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`flex items-center justify-between gap-2 px-4 pt-3 pb-2 shrink-0`,e),...t})}function J({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`px-4 py-3 flex-1 min-h-0 overflow-auto`,e),...t})}var sr=jt(`inline-flex items-center gap-1 rounded-sm px-1.5 py-0.5 text-[10px] font-mono font-medium leading-none tracking-wide uppercase border whitespace-nowrap`,{variants:{variant:{green:`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`,red:`bg-red-500/8 text-red-300 border-red-500/25`,amber:`bg-amber-500/10 text-amber-300 border-amber-500/30`,blue:`bg-sky-500/8 text-sky-300 border-sky-500/25`,gray:`bg-[var(--color-surface-2)] text-[var(--color-fg-3)] border-[var(--color-line-1)]`,purple:`bg-violet-500/8 text-violet-300 border-violet-500/25`,outline:`bg-transparent text-[var(--color-fg-3)] border-[var(--color-line-1)]`}},defaultVariants:{variant:`outline`}});function cr({className:e,variant:t,...n}){return(0,G.jsx)(`span`,{className:W(sr({variant:t,className:e})),...n})}var lr=jt(`hig-button relative overflow-hidden focus-visible:outline-none disabled:pointer-events-none disabled:opacity-45`,{variants:{variant:{primary:`hig-button-primary`,secondary:``,ghost:`hig-button-plain`,danger:`hig-button-destructive`},size:{sm:`hig-button-small`,md:``,icon:`!w-7 !h-7 !min-w-0 !p-0`}},defaultVariants:{variant:`primary`,size:`md`}});function ur(e,t){if(st())return;let n=e.getBoundingClientRect(),r=Math.hypot(n.width,n.height),i=document.createElement(`span`);i.style.position=`absolute`,i.style.left=`${t.clientX-n.left-r/2}px`,i.style.top=`${t.clientY-n.top-r/2}px`,i.style.width=`${r}px`,i.style.height=`${r}px`,i.style.borderRadius=`50%`,i.style.pointerEvents=`none`,i.style.background=`currentColor`,i.style.opacity=`0.22`,i.style.transform=`scale(0)`,i.style.mixBlendMode=`screen`,e.appendChild(i),Tt(i,{scale:[0,1],opacity:[.22,0],duration:540,ease:`outExpo`,onComplete:()=>{i.remove()}})}var Y=_.forwardRef(({className:e,variant:t,size:n,onMouseDown:r,onClick:i,...a},o)=>(0,G.jsx)(`button`,{ref:o,className:W(lr({variant:t,size:n,className:e})),onMouseDown:e=>{ur(e.currentTarget,e),r?.(e)},onClick:i,...a}));Y.displayName=`Button`;var dr=e=>Math.round(e).toLocaleString(void 0,{useGrouping:!0});function fr(e,t){if(e===`spring`){let e=$e();return{ease:e.fn,durationMs:e.duration}}return e===`quart`?{ease:Fe.out,durationMs:t}:{ease:Pe.out,durationMs:t}}function pr({value:e,duration:t=320,format:n=dr,className:r,curve:i=`cubic`}){let[a,o]=(0,_.useState)(e),s=(0,_.useRef)(e),c=(0,_.useRef)(e),l=(0,_.useRef)(0),u=(0,_.useRef)(null),d=(0,_.useRef)(st()),f=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(c.current===e)return;let n=f.current;if(n&&!d.current){for(let e of n.getAnimations())e.id===`lc-value-pulse`&&e.cancel();let e=n.animate([{textShadow:`0 0 0 rgba(245, 158, 11, 0)`},{textShadow:`0 0 10px rgba(245, 158, 11, 0.55)`,offset:.2},{textShadow:`0 0 0 rgba(245, 158, 11, 0)`}],{duration:520,easing:`ease-out`});e.id=`lc-value-pulse`}if(d.current){c.current=e,s.current=e,o(e);return}s.current=a,c.current=e,l.current=performance.now(),u.current!==null&&cancelAnimationFrame(u.current);let{ease:r,durationMs:p}=fr(i,t),m=e=>{let t=Math.min(1,(e-l.current)/p),n=r(t);o(s.current+(c.current-s.current)*n),t<1?u.current=requestAnimationFrame(m):u.current=null};return u.current=requestAnimationFrame(m),()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null)}},[e,t,i]),(0,G.jsx)(`span`,{ref:f,className:W(`tabular-nums`,r),children:n(a)})}function mr({data:e,width:t=80,height:n=24,color:r=`#38bdf8`,threshold:i,maxValue:a}){if(e.length<2)return(0,G.jsx)(`svg`,{width:t,height:n,className:`shrink-0`,children:(0,G.jsx)(`line`,{x1:0,y1:n/2,x2:t,y2:n/2,stroke:`var(--color-line-2)`,strokeWidth:1})});let o=a??Math.max(...e,1),s=t-2,c=n-2,l=e.map((t,n)=>{let r=1+n/(e.length-1)*s,i=1+c-t/o*c;return`${r.toFixed(1)},${i.toFixed(1)}`}),u=i===void 0?null:1+c-Math.min(i,o)/o*c;return(0,G.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,children:[(0,G.jsx)(`polyline`,{points:l.join(` `),fill:`none`,stroke:r,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`}),u!==null&&(0,G.jsx)(`line`,{x1:1,y1:u,x2:t-1,y2:u,stroke:`var(--color-brand)`,strokeWidth:1,strokeDasharray:`3,2`,opacity:.7})]})}var hr=new Set,gr=0,_r=0;function vr(){for(let e of hr)e();hr.size>0&&(gr=requestAnimationFrame(vr))}function yr(e){let t=_r++;return hr.add(e),hr.size===1&&(gr=requestAnimationFrame(vr)),[()=>{hr.delete(e),hr.size===0&&(cancelAnimationFrame(gr),gr=0)},t]}function br(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function xr({value:e,samples:t,maxValue:n,width:r=320,height:i=64,windowMs:a=6e4,color:o=`var(--color-brand)`,fillColor:s=`rgba(245, 158, 11, 0.12)`,className:c}){let l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useRef)([]),f=(0,_.useRef)(t??null),p=(0,_.useRef)(e??0),m=(0,_.useRef)(br());return(0,_.useEffect)(()=>{f.current=t??null},[t]),(0,_.useEffect)(()=>{t===void 0&&e!==void 0&&e!==p.current&&(p.current=e,d.current.push({ts:Date.now(),v:e}),d.current.length>600&&d.current.splice(0,d.current.length-600))},[e,t]),(0,_.useEffect)(()=>{let e=()=>{let e=Date.now(),t=e-a,o;if(f.current){let e=f.current;o=[];for(let n of e)n.ts>=t&&o.push(n)}else{let n=d.current;for(;n.length>1&&n[1].ts<t;)n.shift();(n.length===0||n[n.length-1].ts<e-200)&&n.push({ts:e,v:p.current}),o=n.filter(e=>e.ts>=t)}if(o.length<2)l.current&&l.current.setAttribute(`points`,``),u.current&&u.current.setAttribute(`points`,``);else{let e=n??Math.max(1,...o.map(e=>e.v)),s=[];for(let n of o){let o=(n.ts-t)/a*r,c=i-n.v/e*(i-2)-1;s.push(`${o.toFixed(1)},${c.toFixed(1)}`)}let c=s.join(` `);if(l.current&&l.current.setAttribute(`points`,c),u.current){let e=s[0].split(`,`),t=s[s.length-1].split(`,`),n=`${e[0]},${i} ${c} ${t[0]},${i}`;u.current.setAttribute(`points`,n)}}};if(m.current){let t=window.setInterval(e,500);return()=>clearInterval(t)}let[t]=yr(e);return t},[r,i,a,n]),(0,G.jsxs)(`svg`,{width:`100%`,height:i,viewBox:`0 0 ${r} ${i}`,className:W(`block`,c),preserveAspectRatio:`none`,children:[(0,G.jsx)(`polygon`,{ref:u,fill:s,stroke:`none`}),(0,G.jsx)(`polyline`,{ref:l,fill:`none`,stroke:o,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`})]})}var Sr=jt(`hero-metric relative flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] px-4 py-3 overflow-hidden`,{variants:{tone:{neutral:`hero-metric--neutral`,amber:`hero-metric--amber`,green:`hero-metric--green`,red:`hero-metric--red`,blue:`hero-metric--blue`,purple:`hero-metric--purple`,gray:`hero-metric--gray`}},defaultVariants:{tone:`neutral`}}),Cr={neutral:`var(--color-fg-1)`,amber:`var(--color-decision-ask)`,green:`var(--color-decision-allow)`,red:`var(--color-decision-block)`,blue:`var(--color-decision-force)`,purple:`var(--color-decision-log)`,gray:`var(--color-fg-3)`},wr={neutral:`color-mix(in srgb, var(--color-fg-1) 10%, transparent)`,amber:`color-mix(in srgb, var(--color-decision-ask) 14%, transparent)`,green:`color-mix(in srgb, var(--color-decision-allow) 14%, transparent)`,red:`color-mix(in srgb, var(--color-decision-block) 14%, transparent)`,blue:`color-mix(in srgb, var(--color-decision-force) 14%, transparent)`,purple:`color-mix(in srgb, var(--color-decision-log) 14%, transparent)`,gray:`color-mix(in srgb, var(--color-fg-3) 10%, transparent)`},Tr={neutral:`text-[var(--color-fg-0)]`,amber:`text-amber-300`,green:`text-emerald-300`,red:`text-red-300`,blue:`text-sky-300`,purple:`text-violet-300`,gray:`text-[var(--color-fg-2)]`},Er=1e3,Dr=.35;function Or(e,t,n){let r=Date.now(),i=r-n,a=Math.max(2,Math.floor(n/Er)),o=Array(a).fill(0);for(let n of e){if(t&&!t(n)||n.ts_ms<i||n.ts_ms>r)continue;let e=a-1-Math.floor((r-n.ts_ms)/Er);e>=0&&e<a&&o[e]++}let s=Array(a),c=o[0];for(let e=0;e<a;e++)c=Dr*o[e]+(1-Dr)*c,s[e]={ts:i+(e+1)*Er,v:c};return s}function kr({label:e,value:t,series:n,burstRing:r,filter:i,sparkWindowMs:a=6e4,sub:o,tone:s,format:c,className:l,...u}){let d=s??`neutral`,f=Cr[d]??Cr.neutral,p=wr[d]??wr.neutral,m=Tr[d]??Tr.neutral,h=(0,_.useRef)(null),g=(0,_.useRef)(t);(0,_.useEffect)(()=>{if(g.current===t)return;g.current=t;let e=h.current;e&&Tt(e,{"--tick":[0,1],duration:160,ease:`outCubic`,onComplete:()=>{Tt(e,{"--tick":[1,0],duration:520,ease:`outCubic`,onComplete:e=>{e.style.removeProperty(`--tick`)}})}})},[t]);let v=(0,_.useMemo)(()=>r?Or(r,i,a):null,[r,i,a]),y=v!==null,b=!y&&n&&n.length>=2;return(0,G.jsxs)(`div`,{ref:h,className:W(Sr({tone:s,className:l})),...u,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:e}),o?(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:o}):null]}),(0,G.jsxs)(`div`,{className:`flex items-end justify-between gap-3`,children:[(0,G.jsx)(pr,{value:t,format:c,className:W(`text-[2.4rem] leading-none font-semibold tracking-tight`,m)}),y?(0,G.jsx)(xr,{samples:v,width:108,height:36,windowMs:a,color:f,fillColor:p,className:`shrink-0`}):b?(0,G.jsx)(mr,{data:n,width:96,height:28,color:f}):null]})]})}var Ar=135,jr=405,Mr=jr-Ar,Nr=`#34d399`,Pr=`#f59e0b`,Fr=`#ef4444`;function Ir(e,t,n,r){let i=(r-90)*(Math.PI/180);return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function Lr(e,t,n,r,i){let a=Ir(e,t,n,r),o=Ir(e,t,n,i),s=i-r>180?1:0;return`M ${a.x.toFixed(2)} ${a.y.toFixed(2)} A ${n} ${n} 0 ${s} 1 ${o.x.toFixed(2)} ${o.y.toFixed(2)}`}function Rr(e,t){return Ar+Math.max(0,Math.min(1,e/Math.max(t,1e-9)))*Mr}function zr(e,t,n){return e+(t-e)*n}function Br(e){let t=parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]}function Vr(e,t,n){let[r,i,a]=Br(e),[o,s,c]=Br(t);return`rgb(${Math.round(zr(r,o,n))},${Math.round(zr(i,s,n))},${Math.round(zr(a,c,n))})`}function Hr(e,t,n){let r=.04;return e<t-r?Nr:e<t+r?Vr(Nr,Pr,(e-(t-r))/(r*2)):e<n-r?Pr:e<n+r?Vr(Pr,Fr,(e-(n-r))/(r*2)):Fr}function Ur(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Wr=0;function Gr(){return Wr=Wr+1|0,Wr.toString(36)}function Kr({value:e,max:t,warnAt:n=.7,critAt:r=.9,marker50:i,marker99:a,label:o,display:s,displayFormat:c,scaleLabels:l,mode:u=`needle`,size:d=180,className:f,revLights:p=!0,revLightCount:m=20}){let h=Math.ceil(u===`needle`&&l!==void 0?d*.2:d*.08),g=-h,v=-h,y=d+h*2,b=d+h*2,x=d/2,S=d/2,C=d*.42,w=Math.max(0,Math.min(1,e/Math.max(t,1e-9))),T=(0,_.useMemo)(()=>Lr(x,S,C,Ar,jr),[x,S,C]),E=(0,_.useMemo)(()=>Lr(x,S,C-8,Ar,jr),[x,S,C]),D=Ar+n*Mr,O=Ar+r*Mr,ee=(0,_.useMemo)(()=>Lr(x,S,C,Ar,D),[x,S,C,D]),k=(0,_.useMemo)(()=>Lr(x,S,C,D,O),[x,S,C,D,O]),A=(0,_.useMemo)(()=>Lr(x,S,C,O,jr),[x,S,C,O]),j=(0,_.useMemo)(()=>Lr(x,S,C-14,300,420),[x,S,C]),te=Ar+w*Mr,ne=(0,_.useMemo)(()=>Lr(x,S,C,Ar,Math.max(Ar+.01,te)),[x,S,C,te]),re=Hr(w,n,r),M=(0,_.useMemo)(()=>Gr(),[]),N=`lgf-${M}`,ie=`lgb-${M}`,ae=`lgd-${M}`,oe=`lgh-${M}`,P=`lgg-${M}`,F=`lgl-${M}`,I=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=10;t++)e.push(Ar+t/10*Mr);return e},[u]),se=(0,_.useMemo)(()=>{if(u!==`needle`)return[];let e=[];for(let t=0;t<=40;t++)t%4!=0&&e.push(Ar+t/40*Mr);return e},[u]),L=(0,_.useRef)(null),ce=(0,_.useRef)(null),le=(0,_.useRef)(null),ue=(0,_.useRef)(null),de=(0,_.useRef)(null),fe=(0,_.useRef)(null),pe=(0,_.useRef)(null),me=(0,_.useRef)(null),R=(0,_.useRef)([]),he=(0,_.useRef)(e),ge=(0,_.useRef)(t),_e=(0,_.useRef)(n),ve=(0,_.useRef)(r);(0,_.useEffect)(()=>{he.current=e,ge.current=t,_e.current=n,ve.current=r},[e,t,n,r]);let ye=(0,_.useMemo)(()=>{if(!p||u!==`needle`)return[];let e=Math.max(4,m),t=C-11,n=[];for(let r=0;r<e;r++){let i=Ar+(r+.5)/e*Mr;n.push(Ir(x,S,t,i))}return n},[p,m,u,x,S,C]);R.current.length!==ye.length&&(R.current.length=ye.length);let z=x+C-6,be=x+d*.04,xe=Math.max(2,d*.016),Se=`${z},${S} ${be},${S-xe} ${be},${S+xe}`,Ce=x-d*.04,we=x-C*.24,Te=Math.max(1.4,d*.012),Ee=`${we},${S} ${Ce},${S-Te} ${Ce},${S+Te}`,De=d*.48,Oe=d*.17,ke=x-De/2,Ae=S+d*.16,B=Ae+Oe*.68;return(0,_.useEffect)(()=>{let e=Ur(),t=performance.now(),n=he.current,r=0,i=he.current,a=0,o=he.current,s=``,l=``,d=``,f=-1,m=``,h=``,[g]=yr(()=>{let g=performance.now(),_=(g-t)/1e3;t=g;let v=Math.min(.04,Math.max(.001,_)),y=he.current,b=ge.current,w=_e.current,T=ve.current,E=Math.max(b,1e-9),D=y;if(e)n=y,i=y,o=y,r=0,a=0;else{let e=v/2;for(let t=0;t<2;t++){let t=-210*(n-D)-22*r;r+=t*e,n+=r*e;let o=-55*(i-n)-13*a;a+=o*e,i+=a*e}let t=1-Math.exp(-v*8);o+=(y-o)*t,Math.abs(n-y)<E*1e-5&&Math.abs(r)<1e-4&&(n=y,r=0),Math.abs(o-y)<E*1e-5&&(o=y)}let O=Math.max(0,Math.min(1,n/Math.max(b,1e-9))),ee=Ar+O*Mr,k=Ar+Math.max(0,Math.min(1,i/Math.max(b,1e-9)))*Mr,A=Hr(O,w,T),j=`rotate(${(ee-90).toFixed(3)} ${x} ${S})`;L.current&&j!==s&&(L.current.setAttribute(`transform`,j),s=j),A!==d&&(ce.current&&ce.current.setAttribute(`fill`,A),le.current&&le.current.setAttribute(`fill`,A),ue.current&&ue.current.setAttribute(`stroke`,A),fe.current&&fe.current.setAttribute(`fill`,A),d=A);let te=`rotate(${(k-90).toFixed(3)} ${x} ${S})`;if(de.current&&te!==l&&(de.current.setAttribute(`transform`,te),l=te),pe.current&&c){let e=c(o);e!==h&&(pe.current.textContent=e,h=e)}if(me.current&&u===`ring`){let e=Lr(x,S,C,Ar,Math.max(Ar+.01,ee));e!==m&&(me.current.setAttribute(`d`,e),m=e)}if(p&&u===`needle`){let e=Math.round(O*1e3)/1e3;if(e!==f){f=e;let t=R.current,n=t.length;if(n>0){let e=1/n;for(let r=0;r<n;r++){let i=t[r];if(!i)continue;let a=(r+.5)/n,o=O-a,s=Math.max(0,Math.min(1,.5+o/e));i.setAttribute(`fill`,Hr(a,w,T)),i.setAttribute(`opacity`,s.toFixed(3))}}}}});return g},[x,S,C,u,p,c]),(0,G.jsxs)(`div`,{className:W(`flex flex-col items-center justify-center gap-1 min-h-0 min-w-0`,f),children:[(0,G.jsxs)(`svg`,{width:y,height:b,viewBox:`${g} ${v} ${y} ${b}`,preserveAspectRatio:`xMidYMid meet`,className:`block max-w-full max-h-full min-h-0`,children:[(0,G.jsxs)(`defs`,{children:[(0,G.jsxs)(`filter`,{id:N,x:`-40%`,y:`-40%`,width:`180%`,height:`180%`,children:[(0,G.jsx)(`feGaussianBlur`,{stdDeviation:`1.2`,result:`blur`}),(0,G.jsxs)(`feMerge`,{children:[(0,G.jsx)(`feMergeNode`,{in:`blur`}),(0,G.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]}),(0,G.jsxs)(`radialGradient`,{id:ie,cx:`50%`,cy:`32%`,r:`80%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#4e535d`}),(0,G.jsx)(`stop`,{offset:`55%`,stopColor:`#2a2e36`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#0b0d11`})]}),(0,G.jsxs)(`radialGradient`,{id:ae,cx:`50%`,cy:`45%`,r:`75%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#1b1f27`}),(0,G.jsx)(`stop`,{offset:`80%`,stopColor:`#0a0c10`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#05060a`})]}),(0,G.jsxs)(`radialGradient`,{id:oe,cx:`40%`,cy:`30%`,r:`70%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#f4f5f8`}),(0,G.jsx)(`stop`,{offset:`45%`,stopColor:`#aab1bd`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#1c1f26`})]}),(0,G.jsxs)(`linearGradient`,{id:P,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#ffffff`,stopOpacity:`0.22`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#ffffff`,stopOpacity:`0`})]}),(0,G.jsxs)(`linearGradient`,{id:F,x1:`50%`,y1:`0%`,x2:`50%`,y2:`100%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#0a0c11`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#15181f`})]})]}),u===`needle`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`circle`,{cx:x,cy:S,r:C+12,fill:`url(#${ie})`,stroke:`#000`,strokeOpacity:.55,strokeWidth:1}),(0,G.jsx)(`circle`,{cx:x,cy:S,r:C+5,fill:`none`,stroke:`#0a0c11`,strokeWidth:1}),(0,G.jsx)(`circle`,{cx:x,cy:S,r:C-2,fill:`url(#${ae})`})]}):null,(0,G.jsx)(`path`,{d:T,fill:`none`,stroke:`var(--color-line-1)`,strokeWidth:u===`ring`?12:3,strokeLinecap:`round`,opacity:u===`ring`?1:.35}),u===`needle`?(0,G.jsx)(`path`,{d:E,fill:`none`,stroke:`var(--color-line-0)`,strokeWidth:1,strokeLinecap:`round`,opacity:.55}):null,u===`needle`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`path`,{d:ee,fill:`none`,stroke:Nr,strokeWidth:5,strokeLinecap:`round`,opacity:.78}),(0,G.jsx)(`path`,{d:k,fill:`none`,stroke:Pr,strokeWidth:5,strokeLinecap:`round`,opacity:.82}),(0,G.jsx)(`path`,{d:A,fill:`none`,stroke:Fr,strokeWidth:5,strokeLinecap:`round`,opacity:.9}),se.map((e,t)=>{let n=Ir(x,S,C-4,e),r=Ir(x,S,C+2,e);return(0,G.jsx)(`line`,{x1:n.x,y1:n.y,x2:r.x,y2:r.y,stroke:`var(--color-fg-4)`,strokeWidth:.9,strokeLinecap:`round`,opacity:.7},`mi-${t}`)}),I.map((e,t)=>{let n=Ir(x,S,C-8,e),r=Ir(x,S,C+4,e);return(0,G.jsx)(`line`,{x1:n.x,y1:n.y,x2:r.x,y2:r.y,stroke:`var(--color-fg-2)`,strokeWidth:1.8,strokeLinecap:`round`},`ma-${t}`)}),p?ye.map((e,t)=>(0,G.jsx)(`circle`,{ref:e=>{R.current[t]=e},cx:e.x,cy:e.y,r:Math.max(1.6,d*.013),fill:Nr,opacity:0,filter:`url(#${N})`},t)):null,i===void 0?null:(0,G.jsx)(qr,{cx:x,cy:S,r:C,angle:Rr(i,t),emphasis:!0}),a===void 0?null:(0,G.jsx)(qr,{cx:x,cy:S,r:C,angle:Rr(a,t),emphasis:!0}),l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Jr,{cx:x,cy:S,r:C,angle:D,text:l(n),size:d}),(0,G.jsx)(Jr,{cx:x,cy:S,r:C,angle:O,text:l(r),size:d}),(0,G.jsx)(Jr,{cx:x,cy:S,r:C,angle:jr,text:l(1),size:d})]}):null,(0,G.jsx)(`path`,{d:j,fill:`none`,stroke:`url(#${P})`,strokeWidth:d*.14,strokeLinecap:`butt`}),c||s!==void 0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`rect`,{x:ke,y:Ae,width:De,height:Oe,rx:d*.022,ry:d*.022,fill:`url(#${F})`,stroke:`#242a33`,strokeWidth:1}),(0,G.jsx)(`rect`,{x:ke+1,y:Ae+1,width:De-2,height:1,fill:`#ffffff`,opacity:.08})]}):null,(0,G.jsx)(`g`,{ref:de,opacity:.28,children:(0,G.jsx)(`polygon`,{ref:fe,points:Se,fill:re})}),(0,G.jsxs)(`g`,{ref:L,children:[(0,G.jsx)(`polygon`,{ref:ce,points:Se,fill:re,stroke:`#05070a`,strokeWidth:.6}),(0,G.jsx)(`polygon`,{ref:le,points:Ee,fill:re,opacity:.7})]}),(0,G.jsx)(`circle`,{cx:x,cy:S,r:d*.06,fill:`url(#${oe})`,stroke:`#06080c`,strokeWidth:1}),(0,G.jsx)(`circle`,{ref:ue,cx:x,cy:S,r:d*.036,fill:`#0a0c11`,stroke:re,strokeWidth:1.4}),(0,G.jsx)(`circle`,{cx:x,cy:S,r:d*.012,fill:`#f5f7fb`,opacity:.9})]}):(0,G.jsx)(`path`,{ref:me,d:ne,fill:`none`,stroke:re,strokeWidth:12,strokeLinecap:`round`}),u===`needle`&&(c||s!==void 0)?c?(0,G.jsx)(`text`,{ref:pe,x,y:B,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:c(e)}):(0,G.jsx)(`text`,{x,y:B,textAnchor:`middle`,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:d*.1,fontWeight:600,fill:`#e8ecf3`,children:s}):c?(0,G.jsx)(`text`,{ref:pe,x,y:S+4,textAnchor:`middle`,className:`font-mono tabular-nums`,fontSize:d*.13,fill:`var(--color-fg-0)`,children:c(e)}):s===void 0?null:(0,G.jsx)(`text`,{x,y:S+4,textAnchor:`middle`,className:`font-mono tabular-nums`,fontSize:d*.13,fill:`var(--color-fg-0)`,children:s})]}),o?(0,G.jsx)(`span`,{className:`overline shrink-0 tracking-[0.12em] uppercase`,children:o}):null]})}function qr({cx:e,cy:t,r:n,angle:r,emphasis:i=!1}){let a=Ir(e,t,n-(i?10:6),r),o=Ir(e,t,n+(i?8:6),r);return(0,G.jsx)(`line`,{x1:a.x,y1:a.y,x2:o.x,y2:o.y,stroke:i?`var(--color-fg-1)`:`var(--color-fg-2)`,strokeWidth:i?2:1.5,strokeLinecap:`round`})}function Jr({cx:e,cy:t,r:n,angle:r,text:i,size:a}){let o=Ir(e,t,n+Math.max(16,a*.1),r),s=r>=135&&r<215?`end`:r>=325?`start`:`middle`;return(0,G.jsx)(`text`,{x:o.x,y:o.y,textAnchor:s,dominantBaseline:`middle`,className:`font-mono tabular-nums`,fontSize:a*.062,fontWeight:600,fill:`var(--color-fg-2)`,stroke:`var(--color-bg-0)`,strokeWidth:3,paintOrder:`stroke`,children:i})}var Yr={containerPaddingY:24,containerPaddingX:24,topToTrendGap:12,scatterHeaderH:18,scatterLegendH:16,scatterInnerGap:8,trendRowH:28,trendRowGap:6,trendTopPad:9,scatterAbsoluteMin:60,scatterAcceptableMin:70,gaugeFootprintFactor:1.36,gaugeAbsoluteMin:84,gaugeAbsoluteMax:240};function Xr(e,t,n=200){let r=Math.max(0,Math.floor(e)),i=Math.max(0,Math.floor(t)),a=Math.max(0,r-Yr.containerPaddingX),o=Math.max(0,i-Yr.containerPaddingY),s=o-(Yr.trendRowH*3+Yr.trendRowGap*2+Yr.trendTopPad+Yr.topToTrendGap),c=s-Yr.scatterHeaderH-Yr.scatterLegendH-Yr.scatterInnerGap>=Yr.scatterAcceptableMin,l=c?s:o,u=l-Yr.scatterHeaderH-Yr.scatterLegendH-Yr.scatterInnerGap,d=u>=Yr.scatterAbsoluteMin,f=u>=Yr.scatterAbsoluteMin&&l>=140,p=Math.floor(l/Yr.gaugeFootprintFactor),m=Math.floor(a*.45/Yr.gaugeFootprintFactor),h=Math.max(Yr.gaugeAbsoluteMin,Math.min(Yr.gaugeAbsoluteMax,n,p,m)),g=Math.ceil(h*Yr.gaugeFootprintFactor+8),_=l-(d?Yr.scatterHeaderH:0)-(f?Yr.scatterLegendH:0)-Yr.scatterInnerGap;return{gaugeSize:h,gaugeColumnMaxWidth:g,scatterMinHeight:Math.max(Yr.scatterAbsoluteMin,Math.min(160,_)),showTrendRows:c,showScatterHeader:d,showLegend:f,variant:o>=480?`wide`:o>=300?`normal`:`compact`}}var Zr={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`};function Qr(e){return!Number.isFinite(e)||e<=0?`—`:e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:`${(e/1e6).toFixed(2)} ms`}function $r({latency:e,bursts:t,gaugeMaxMs:n=10,windowMs:r=3e4,trendWindowSec:i=60,gaugeSize:a=200,compact:o=!1,className:s}){let c=e?e.p50_ns/1e6:0,l=e?e.p95_ns/1e6:0,u=e?e.p99_ns/1e6:0,d=(0,_.useRef)(null),[f,p]=(0,_.useState)((0,_.useMemo)(()=>Xr(a*2,a*2,a),[a]));(0,_.useEffect)(()=>{let e=d.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=0,r=0,i=e=>{let t=Math.round(e.width/4)*4,i=Math.round(e.height/4)*4;t===n&&i===r||(n=t,r=i,p(Xr(t,i,a)))};i(e.getBoundingClientRect());let o=new ResizeObserver(e=>{let n=e[0];n&&(t&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{i(n.contentRect)}))});return o.observe(e),()=>{t&&cancelAnimationFrame(t),o.disconnect()}},[a]);let m=(0,_.useRef)(null),h=(0,_.useRef)([]),g=(0,_.useRef)(0);(0,_.useEffect)(()=>{if(t.length===0)return;let e=h.current,n=g.current,i=n;for(let r of t)r.ts_ms<=n||(e.push({ts:r.ts_ms,durationNs:r.duration_ns,color:Zr[r.decision]??`#6e7076`}),r.ts_ms>i&&(i=r.ts_ms));g.current=i;let a=Date.now()-r*2;for(;e.length&&e[0].ts<a;)e.shift()},[t,r]),(0,_.useEffect)(()=>{let e=m.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let i=0,a=0,o=0,s=8e3,c=.25,l=1e3,u=n*1e6,d=Math.log10(l),f=Math.log10(u),[p]=yr(()=>{let n=window.devicePixelRatio||1,p=e.clientWidth,m=e.clientHeight;if(p===0||m===0)return;(p!==a||m!==o||n!==i)&&(e.width=Math.floor(p*n),e.height=Math.floor(m*n),t.setTransform(n,0,0,n,0,0),a=p,o=m,i=n),t.clearRect(0,0,p,m),t.strokeStyle=`rgba(110, 112, 118, 0.18)`,t.lineWidth=1,t.setLineDash([2,4]);let g=[{ns:1e5,label:`100µs`},{ns:1e6,label:`1ms`},{ns:1e7,label:`10ms`}];t.font=`9px ui-monospace, SFMono-Regular, Menlo, monospace`,t.textBaseline=`middle`,t.fillStyle=`rgba(110, 112, 118, 0.7)`;for(let e of g){if(e.ns<l||e.ns>u)continue;let n=m-(Math.log10(e.ns)-d)/(f-d)*m;t.beginPath(),t.moveTo(0,n),t.lineTo(p-28,n),t.stroke(),t.fillText(e.label,p-26,n)}t.setLineDash([]);let _=Date.now(),v=_-r,y=h.current;for(;y.length&&y[0].ts<v;)y.shift();t.globalCompositeOperation=`source-over`;for(let e of y){let n=(e.ts-v)/r*p,i=Math.max(l,Math.min(u,e.durationNs)),a=m-(Math.log10(i)-d)/(f-d)*m,o=_-e.ts,h;if(o<=s)h=1-o/s*(1-c);else{let e=r-s;h=e>0?Math.max(0,c*(1-(o-s)/e)):0}h<=0||(t.globalAlpha=h,t.fillStyle=e.color,t.beginPath(),t.arc(n,a,2.5,0,Math.PI*2),t.fill())}t.globalAlpha=1,t.fillStyle=`rgba(110, 112, 118, 0.55)`,t.font=`9px ui-monospace, SFMono-Regular, Menlo, monospace`,t.textBaseline=`bottom`,t.textAlign=`left`,t.fillText(`← ${Math.round(r/1e3)} s ago`,4,m-2),t.textAlign=`right`,t.fillText(`now →`,p-4,m-2),t.textAlign=`left`});return p},[r,n]);let v=(0,_.useRef)({p50:[],p95:[],p99:[]});(0,_.useEffect)(()=>{if(!e)return;let t=v.current,n=Date.now(),r=n-i*1e3,a=(e,t)=>{let i=t/1e6;for(e.length===0&&e.push({ts:r,v:i}),e.push({ts:n,v:i});e.length>1&&e[0].ts<r;)e.shift()};a(t.p50,e.p50_ns),a(t.p95,e.p95_ns),a(t.p99,e.p99_ns)},[e,i]);let y=(0,_.useMemo)(()=>{let e=v.current;return{p50:[...e.p50],p95:[...e.p95],p99:[...e.p99]}},[e]);return(0,G.jsxs)(`div`,{ref:d,"data-lt-variant":f.variant,className:W(`flex h-full min-h-0 flex-col gap-3 overflow-hidden rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] p-3`,s),children:[(0,G.jsxs)(`div`,{className:W(`grid gap-3 min-h-0 flex-1`,`grid-cols-[auto_1fr]`),children:[(0,G.jsx)(`div`,{className:`flex items-stretch justify-center overflow-hidden min-h-0 min-w-0`,style:{maxWidth:f.gaugeColumnMaxWidth},children:(0,G.jsx)(Kr,{value:l,max:n,warnAt:Math.min(.85,.5/n),critAt:Math.min(.92,2/n),marker50:c,marker99:u,displayFormat:e=>Qr(e*1e6),scaleLabels:f.gaugeSize>=130?e=>Qr(e*n*1e6):void 0,size:f.gaugeSize,label:`p95 latency`})}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0 min-h-0 flex-1`,children:[f.showScatterHeader?(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 shrink-0 min-w-0`,children:[(0,G.jsx)(`span`,{className:`overline truncate min-w-0`,children:`live trace · 30 s scatter`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] shrink min-w-0 truncate text-right`,children:[h.current.length,` live · log-Y`]})]}):null,f.showLegend?(0,G.jsx)(`div`,{className:`shrink-0`,children:(0,G.jsx)(ei,{})}):null,(0,G.jsx)(`canvas`,{ref:m,"data-testid":`latency-scatter-canvas`,className:`block w-full flex-1 min-h-0 rounded-sm bg-[var(--color-surface-0)] border border-[var(--color-line-0)]`,style:{minHeight:f.scatterMinHeight}})]})]}),f.showTrendRows?(0,G.jsxs)(`div`,{"data-testid":`latency-trend-rows`,className:`grid grid-cols-1 gap-1.5 pt-2 border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(ti,{label:`p50 · median`,value:Qr(e?.p50_ns??0),color:`#34d399`,fill:`rgba(52, 211, 153, 0.14)`,samples:y.p50,windowMs:i*1e3}),(0,G.jsx)(ti,{label:`p95 · 95th`,value:Qr(e?.p95_ns??0),color:`#38bdf8`,fill:`rgba(56, 189, 248, 0.14)`,samples:y.p95,windowMs:i*1e3}),(0,G.jsx)(ti,{label:`p99 · 99th`,value:Qr(e?.p99_ns??0),color:`#6366f1`,fill:`rgba(99, 102, 241, 0.14)`,samples:y.p99,windowMs:i*1e3})]}):null]})}function ei(){return(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[{key:`allow`,color:Zr.allow},{key:`ask`,color:Zr.ask},{key:`block`,color:Zr.block},{key:`force`,color:Zr.force},{key:`log`,color:Zr.log},{key:`shadow`,color:Zr.shadow}].map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full`,style:{background:e.color}}),(0,G.jsx)(`span`,{className:`uppercase tracking-wide`,children:e.key})]},e.key))})}function ti({label:e,value:t,color:n,fill:r,samples:i,windowMs:a}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)_92px] items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`overline text-right truncate min-w-0`,children:e}),(0,G.jsx)(xr,{samples:i,width:1200,height:28,windowMs:a,color:n,fillColor:r,className:`w-full h-7`}),(0,G.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-right truncate min-w-0`,style:{color:n},title:t,children:t})]})}function ni({counters:e,className:t,showLegend:n=!0}){let r=[{key:`allow`,label:`Allow`,value:e.allow,color:`var(--color-decision-allow)`,textClass:`text-emerald-300`},{key:`ask`,label:`Ask`,value:e.ask,color:`var(--color-decision-ask)`,textClass:`text-amber-300`},{key:`block`,label:`Block`,value:e.block,color:`var(--color-decision-block)`,textClass:`text-red-300`},{key:`force`,label:`Force`,value:e.force,color:`var(--color-decision-force)`,textClass:`text-sky-300`},{key:`log`,label:`Log`,value:e.log,color:`var(--color-decision-log)`,textClass:`text-violet-300`},{key:`shadow`,label:`Shadow`,value:e.shadow,color:`var(--color-decision-shadow)`,textClass:`text-[var(--color-fg-3)]`}],i=r.reduce((e,t)=>e+t.value,0),a=(0,_.useRef)(null),o=(0,_.useRef)({});return(0,_.useEffect)(()=>{let e=a.current;if(!e)return;let t=e.querySelectorAll(`[data-seg]`);if(t.length===0)return;let n=st();t.forEach(e=>{let t=e.dataset.seg,a=r.find(e=>e.key===t);if(!a)return;let s=i===0?0:a.value/i*100,c=o.current[t]??0;n||Math.abs(c-s)<.01?e.style.width=`${s}%`:Tt(e,{width:[`${c}%`,`${s}%`],duration:480,ease:`outExpo`}),o.current[t]=s})},[e,i]),(0,G.jsxs)(`div`,{className:W(`flex flex-col gap-2`,t),children:[(0,G.jsx)(`div`,{ref:a,className:`flex h-3 w-full overflow-hidden rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-2)]`,children:i===0?(0,G.jsx)(`div`,{className:`w-full bg-[var(--color-surface-3)]`}):r.map(e=>(0,G.jsx)(`div`,{"data-seg":e.key,style:{width:`${i===0?0:e.value/i*100}%`,background:e.color}},e.key))}),n?(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-[11px] font-mono`,children:r.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 min-w-0`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,G.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-sm`,style:{background:e.color}}),(0,G.jsx)(`span`,{className:W(`uppercase tracking-wide truncate`,e.textClass),children:e.label})]}),(0,G.jsx)(pr,{value:e.value,className:`shrink-0 tabular-nums text-[var(--color-fg-1)]`})]},e.key))}):null]})}function ri(e){return e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m ${Math.floor(e%60)}s`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function ii(e,t){if(t===void 0||t<=0)return`var(--color-brand)`;let n=e/t;return n>=.9?`var(--color-decision-block)`:n>=.7?`var(--color-decision-ask)`:`var(--color-decision-allow)`}function ai(e){return e===`var(--color-decision-block)`?`color-mix(in srgb, var(--color-decision-block) 14%, transparent)`:e===`var(--color-decision-ask)`?`color-mix(in srgb, var(--color-decision-ask) 14%, transparent)`:e===`var(--color-decision-allow)`?`color-mix(in srgb, var(--color-decision-allow) 14%, transparent)`:e===`var(--color-decision-log)`?`color-mix(in srgb, var(--color-decision-log) 14%, transparent)`:`color-mix(in srgb, var(--color-brand) 12%, transparent)`}function oi(e,t){if(e.length===0)return[];let n=Date.now(),r=t/Math.max(1,e.length),i=Array(e.length);for(let t=0;t<e.length;t++)i[t]={ts:n-(e.length-1-t)*r,v:e[t]};return i}function si({cpuPct:e,cpuSeries:t,cpuLimit:n,memMb:r,memSeries:i,memLimit:a,heapUsedMb:o,heapTotalMb:s,heapSeries:c,uptimeSec:l,className:u}){let d=6e4,f=ii(e,n),p=ii(r,a),m=`var(--color-decision-log)`,h=(0,_.useMemo)(()=>oi(t,d),[t]),g=(0,_.useMemo)(()=>oi(i,d),[i]),v=(0,_.useMemo)(()=>oi(c,d),[c]),y=(0,_.useRef)([]);(0,_.useEffect)(()=>{let e=y.current.filter(e=>!!e);if(e.length===0)return;e.forEach(e=>{e.style.opacity=`0`,e.style.transform=`translateY(28px) scale(0.94)`});let t=Tt(e,{translateY:[28,0],scale:[.94,1],opacity:[0,1],duration:720,delay:rt(140),ease:`outBack(1.25)`,onComplete:e=>{e.style.transform=``}});return()=>t.cancel()},[]);let b=n!==void 0&&n>0&&e>=n*.9,x=a!==void 0&&a>0&&r>=a*.9;return(0,G.jsx)(`div`,{className:W(`rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] p-3`,u),children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:[(0,G.jsx)(ci,{registerRef:e=>y.current[0]=e,label:`CPU`,color:f,fill:ai(f),pulse:b,valueNode:(0,G.jsxs)(`span`,{children:[(0,G.jsx)(pr,{value:e,format:e=>e.toFixed(1),className:`text-[var(--color-fg-0)]`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:`%`})]}),subText:n?`limit ${n}%`:void 0,samples:h,maxValue:100,windowMs:d}),(0,G.jsx)(ci,{registerRef:e=>y.current[1]=e,label:`Memory`,color:p,fill:ai(p),pulse:x,valueNode:(0,G.jsxs)(`span`,{children:[(0,G.jsx)(pr,{value:r,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:`MB`})]}),subText:a?`limit ${a} MB`:void 0,samples:g,maxValue:a?a*1.1:void 0,windowMs:d}),(0,G.jsx)(ci,{registerRef:e=>y.current[2]=e,label:`Heap`,color:m,fill:ai(m),valueNode:(0,G.jsxs)(`span`,{children:[(0,G.jsx)(pr,{value:o,format:e=>e.toFixed(0),className:`text-[var(--color-fg-0)]`}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-base`,children:[`/ `,s.toFixed(0),` MB`]})]}),subText:s>0?`${(o/s*100).toFixed(0)}% used`:void 0,samples:v,maxValue:s>0?s:void 0,windowMs:d}),(0,G.jsx)(ci,{registerRef:e=>y.current[3]=e,label:`Uptime`,color:`var(--color-fg-2)`,fill:`rgba(214, 215, 217, 0.04)`,valueNode:(0,G.jsx)(`span`,{className:`text-[var(--color-fg-0)] tabular-nums`,children:ri(l)}),subText:`since daemon start`})]})})}function ci({label:e,valueNode:t,subText:n,color:r,fill:i,samples:a,maxValue:o,windowMs:s,pulse:c,registerRef:l}){let u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!c||!u.current)return;let e=!1,t=null,n=()=>{e||!u.current||(t=Tt(u.current,{"--breach":[0,1],duration:420,ease:`outCubic`,onComplete:()=>{e||!u.current||(t=Tt(u.current,{"--breach":[1,0],duration:560,ease:`outCubic`,onComplete:()=>{e||n()}}))}}))};return n(),()=>{e=!0,t?.cancel();let n=u.current;n&&n.style.removeProperty(`--breach`)}},[c]),(0,G.jsxs)(`div`,{ref:e=>{u.current=e,l(e)},className:`flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-0)] border-[var(--color-line-1)] px-4 py-3 min-h-[140px] system-pulse__tile`,"data-breach":c?`true`:void 0,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:e}),n?(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:n}):null]}),(0,G.jsx)(`span`,{className:`text-[1.9rem] leading-none font-semibold tracking-tight font-mono`,style:{color:r},children:t}),a&&a.length>=2?(0,G.jsx)(`div`,{className:`mt-auto`,children:(0,G.jsx)(xr,{samples:a,width:320,height:64,windowMs:s??6e4,color:r,fillColor:i,maxValue:o,className:`w-full`})}):(0,G.jsx)(`div`,{className:`mt-auto h-[64px] flex items-end`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`— no series —`})})]})}var li={__daemon:`SigmaShake itself`,bash:`Run a terminal command`,shell:`Run a terminal command`,run_command:`Run a terminal command`,exec:`Run a terminal command`,run_shell_command:`Run a terminal command`,read:`Read a file`,read_file:`Read a file`,view_file:`Read a file`,cat:`Read a file`,view:`Read a file`,write:`Save changes to a file`,write_to_file:`Save changes to a file`,create_file:`Create a new file`,edit:`Edit an existing file`,multiedit:`Edit several spots in a file`,patch:`Edit an existing file`,apply_patch:`Edit an existing file`,replace:`Edit an existing file`,grep:`Search the codebase`,ripgrep:`Search the codebase`,search:`Search the codebase`,search_codebase:`Search the codebase`,glob:`Find files by name`,find:`Find files by name`,list_files:`List files in a folder`,ls:`List files in a folder`,webfetch:`Read a webpage`,fetch:`Read a webpage`,websearch:`Search the web`,search_web:`Search the web`,browser_action:`Use a web browser`,agent:`Ask a helper AI to investigate`,spawn:`Ask a helper AI to investigate`,task:`Update its to-do list`,todowrite:`Update its to-do list`,todo_write:`Update its to-do list`,notebookedit:`Edit a Jupyter notebook`,notebook_edit:`Edit a Jupyter notebook`};function ui(e){return e?li[e.toLowerCase()]||`Use the ${e.replace(/^_+/,``)} tool`:`Take an action`}function di(e){return e?{"claude-code":`Claude Code`,claudecode:`Claude Code`,cursor:`Cursor`,copilot:`GitHub Copilot`,codex:`OpenAI Codex`,gemini:`Gemini`,antigravity:`Antigravity`,pi:`Pi`,generic:`AI agent`,daemon:`SigmaShake`}[e.toLowerCase()]??e:`AI agent`}function fi(e){return e?e.startsWith(`__`):!1}function pi(e){for(let t of[`file_path`,`path`,`TargetFile`,`AbsolutePath`,`filename`,`file`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function mi(e){for(let t of[`command`,`CommandLine`,`cmd`,`Input`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function hi(e){for(let t of[`query`,`pattern`,`Query`,`q`,`search`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function gi(e){for(let t of[`url`,`URL`,`Url`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function _i(e){let t=e.replace(/[\\/]+$/,``),n=t.lastIndexOf(`/`),r=t.lastIndexOf(`\\`),i=Math.max(n,r);return i>=0?t.slice(i+1):t}function vi(e){let t=e.trim(),n=(t.split(/[|;&]/)[0]?.trim()??t).split(/\s+/),r=n[0]?.toLowerCase()??``,i=n[1]?.toLowerCase()??``,a=(e,t)=>({headline:e,detail:t});if(r===`rm`)return a(`Delete files`,`Deleting files from disk: \`${t}\``);if(r===`mkdir`)return a(`Create a folder`,`Creating a new folder: \`${t}\``);if(r===`mv`)return a(`Move or rename a file`,`Moving or renaming: \`${t}\``);if(r===`cp`)return a(`Copy a file`,`Copying files: \`${t}\``);if(r===`cat`||r===`head`||r===`tail`||r===`less`)return a(`Show file contents`,`Printing file contents: \`${t}\``);if(r===`ls`||r===`tree`||r===`find`)return a(`List files`,`Listing files: \`${t}\``);if(r===`cd`||r===`pwd`)return a(`Check the working folder`,`Checking or changing the current folder: \`${t}\``);if(r===`echo`||r===`printf`)return a(`Print a message`,`Printing a message: \`${t}\``);if(r===`curl`||r===`wget`)return a(`Download from the internet`,`Downloading something from the internet: \`${t}\``);if(r===`kill`||r===`pkill`)return a(`Stop a running program`,`Stopping a running program: \`${t}\``);if(r===`git`)return new Set([`status`,`log`,`diff`,`show`,`branch`,`remote`,`blame`,`config`]).has(i)?a(`Check git history`,`Reading git information (\`git ${i}\`) — no changes are made.`):i===`add`||i===`restore`||i===`reset`?a(`Stage or unstage changes`,`Preparing changes for commit (\`git ${i}\`).`):i===`commit`?a(`Save a checkpoint`,`Saving a snapshot of your changes to git history.`):i===`push`?a(`Send code to the remote`,`Uploading your commits to the remote git repository (e.g. GitHub).`):i===`pull`||i===`fetch`?a(`Get latest from the remote`,`Downloading the newest commits from the remote repository.`):i===`checkout`||i===`switch`?a(`Switch git branch`,`Switching which version of the code is loaded (\`git ${i}\`).`):i===`merge`||i===`rebase`?a(`Combine git branches`,`Combining changes from another branch (\`git ${i}\`).`):a(`Use git`,`Running a git command: \`${t}\``);if(r===`npm`||r===`bun`||r===`pnpm`||r===`yarn`){if(i===`install`||i===`i`||i===`add`)return a(`Install packages`,`Downloading project dependencies from the internet (\`${r} ${i}\`).`);if(i===`run`)return a(`Run a project script`,`Running a project script: \`${t}\``);if(i===`test`)return a(`Run automated tests`,`Running the project's automated tests.`);if(i===`build`)return a(`Build the project`,`Compiling the project for release.`)}return r===`pip`||r===`pip3`||r===`uv`?a(`Install Python packages`,`Installing Python packages: \`${t}\``):r===`pytest`||r===`jest`||r===`vitest`||r===`mocha`||r===`bun`&&i===`test`?a(`Run automated tests`,`Running automated tests: \`${t}\``):r===`docker`||r===`podman`?a(`Use Docker`,`Running a container command: \`${t}\``):r===`ssh`||r===`scp`||r===`rsync`?a(`Talk to another machine`,`Connecting to another computer over the network: \`${t}\``):a(`Run a terminal command`,`Running in the terminal: \`${t}\``)}function yi(e,t){let n=e??``,r=n.toLowerCase(),i=ui(n),a=null;try{let e=JSON.parse(t);e&&typeof e==`object`&&!Array.isArray(e)&&(a=e)}catch{}if(r===`__daemon`){let e=a?.event,t=a?.detail;return typeof e==`string`&&e.length>0?{headline:`SigmaShake itself`,detail:`SigmaShake ${e===`start`?`started`:e===`stop`?`stopped`:e}${typeof t==`string`&&t.length>0?` — ${t}`:``}.`}:{headline:`SigmaShake itself`,detail:`A SigmaShake lifecycle event.`}}if(!a)return{headline:i,detail:`${i}.`};if(r===`bash`||r===`shell`||r===`run_command`||r===`exec`||r===`run_shell_command`){let e=mi(a);return e?vi(e):{headline:i,detail:`Running a terminal command.`}}if(r===`read`||r===`read_file`||r===`view_file`||r===`cat`||r===`view`){let e=pi(a);return e?{headline:i,detail:`Reading the file \`${_i(e)}\` so it can understand the current code. No changes are made.`}:{headline:i,detail:`Reading a file. No changes are made.`}}if(r===`write`||r===`write_to_file`||r===`create_file`){let e=pi(a);return e?{headline:`Save changes to a file`,detail:`Creating or overwriting the file \`${_i(e)}\`. This will replace anything that was there before.`}:{headline:i,detail:`Creating or overwriting a file.`}}if(r===`edit`||r===`multiedit`||r===`patch`||r===`apply_patch`||r===`replace`){let e=pi(a);return e?{headline:i,detail:`Editing the file \`${_i(e)}\` — changing specific parts of it without rewriting the whole thing.`}:{headline:i,detail:`Editing a file in place.`}}if(r===`grep`||r===`ripgrep`||r===`search`||r===`search_codebase`){let e=hi(a);return e?{headline:i,detail:`Searching the project for the text "${e}".`}:{headline:i,detail:`Searching the project for matching text.`}}if(r===`glob`||r===`find`||r===`list_files`||r===`ls`){let e=hi(a)??pi(a);return e?{headline:i,detail:`Looking for files matching "${e}".`}:{headline:i,detail:`Looking for files in the project.`}}if(r===`webfetch`||r===`fetch`||r===`browser_action`){let e=gi(a);return e?{headline:i,detail:`Reading a webpage from the internet: ${e}`}:{headline:i,detail:`Reading a webpage from the internet.`}}if(r===`websearch`||r===`search_web`){let e=hi(a);return e?{headline:i,detail:`Searching the web for "${e}".`}:{headline:i,detail:`Searching the web.`}}return r===`agent`||r===`spawn`?{headline:i,detail:`Asking a separate helper AI to investigate something on its own, then report back. Helps keep this conversation focused.`}:r===`task`||r===`todowrite`||r===`todo_write`?{headline:i,detail:`Updating its internal to-do list so it can keep track of progress on a multi-step task.`}:{headline:i,detail:`${i}.`}}var bi=jt(`relative font-mono text-[11px] overflow-hidden border bg-[var(--color-surface-1)] border-[var(--color-line-1)] rounded-sm`,{variants:{density:{compact:``,roomy:`text-[12px]`}},defaultVariants:{density:`compact`}}),xi={allow:`#34d399`,block:`#ef4444`,ask:`#f59e0b`,log:`#a78bfa`,force:`#38bdf8`,shadow:`#6e7076`},Si={allow:`text-emerald-300`,block:`text-red-300`,ask:`text-amber-300`,log:`text-violet-300`,force:`text-sky-300`,shadow:`text-[var(--color-fg-3)]`};function Ci(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function wi(e){return e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:e<1e9?`${(e/1e6).toFixed(2)} ms`:`${(e/1e9).toFixed(2)} s`}function Ti(e){return e.variant===`raw`?(0,G.jsx)(Di,{...e}):(0,G.jsx)(Ei,{...e})}function Ei({bursts:e,windowSize:t=60,filterDecision:n,filterClient:r,className:i,density:a,height:o=260}){let[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),u=(0,_.useMemo)(()=>{let i=e;n&&(i=i.filter(e=>e.decision===n)),r&&(i=i.filter(e=>e.client===r));let a=i.slice(-t),o=Array(a.length);for(let e=0;e<a.length;e++)o[e]=a[a.length-1-e];return o},[e,n,r,t]);s?l.current===null&&(l.current=u):l.current=null;let d=s&&l.current?l.current:u,f=(0,_.useRef)(null),p=(0,_.useRef)(0);return(0,_.useLayoutEffect)(()=>{if(s)return;let e=d[0];if(!e||e.ts_ms===p.current)return;p.current=e.ts_ms;let t=f.current;t&&(st()||Tt(t,{translateX:[-10,0],opacity:[0,1],duration:220,ease:`outExpo`}))},[d,s]),(0,G.jsxs)(`div`,{className:W(bi({density:a,className:i})),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,G.jsx)(`div`,{className:`overflow-auto`,style:{height:o},children:d.length===0?(0,G.jsx)(`div`,{className:`px-3 py-4 text-[var(--color-fg-4)]`,children:`— waiting for events —`}):d.map((e,t)=>{let n=e.input_preview&&e.input_preview.length>0?e.input_preview:e.rule_id?`rule: ${e.rule_id}`:`—`;return(0,G.jsxs)(`div`,{ref:t===0?f:void 0,className:`telemetry-row grid items-center gap-2 px-3 py-1 border-b border-[var(--color-line-0)] last:border-b-0 hover:bg-[var(--color-surface-2)]`,style:{gridTemplateColumns:`90px 56px minmax(80px, 130px) minmax(0, 1fr) 70px 80px`,borderLeft:`3px solid ${xi[e.decision]??`#666`}`},children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:Ci(e.ts_ms)}),(0,G.jsx)(`span`,{className:W(`uppercase tracking-wide font-medium`,Si[e.decision]??`text-[var(--color-fg-2)]`),children:e.decision}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,title:e.tool?`${e.tool} — ${ui(e.tool)}`:`unknown tool`,children:e.tool||`—`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] truncate`,title:n,children:n}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums text-right`,children:wi(e.duration_ns)}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-right`,title:e.client,children:e.client})]},e.audit_id??`${e.ts_ms}:${e.tool}`)})}),s?(0,G.jsx)(Oi,{}):null]})}function Di({lines:e,windowSize:t=300,className:n,density:r,height:i=260}){let[a,o]=(0,_.useState)(!1),s=(0,_.useRef)(null),c=(0,_.useMemo)(()=>{let n=e.slice(-t),r=Array(n.length);for(let e=0;e<n.length;e++)r[e]=n[n.length-1-e];return r},[e,t]);a?s.current===null&&(s.current=c):s.current=null;let l=a&&s.current?s.current:c;return(0,G.jsxs)(`div`,{className:W(bi({density:r,className:n})),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,G.jsx)(`div`,{className:`overflow-auto px-3 py-2 leading-relaxed text-[var(--color-fg-2)] whitespace-pre`,style:{height:i},children:l.length===0?(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`— empty —`}):l.map((e,t)=>(0,G.jsx)(`div`,{className:`hover:bg-[var(--color-surface-2)]`,children:e},`${t}:${e.slice(0,40)}`))}),a?(0,G.jsx)(Oi,{}):null]})}function Oi(){return(0,G.jsx)(`span`,{className:`absolute top-1 right-2 text-[10px] uppercase tracking-wider font-mono text-[var(--color-brand)] bg-[var(--color-surface-0)] px-1.5 py-0.5 border border-[var(--color-brand)]/40 rounded-sm`,children:`paused`})}var ki=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Ai=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ji=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Mi=e=>{let t=ji(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ni={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Pi=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Fi=(0,_.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,_.createElement)(`svg`,{ref:c,...Ni,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ki(`lucide`,i),...!a&&!Pi(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(a)?a:[a]])),Ii=(e,t)=>{let n=(0,_.forwardRef)(({className:n,...r},i)=>(0,_.createElement)(Fi,{ref:i,iconNode:t,className:ki(`lucide-${Ai(Mi(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Mi(e),n},Li=Ii(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ri=Ii(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),zi=Ii(`grip-horizontal`,[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]),Bi=Ii(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Vi=Ii(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Hi=Ii(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Ui=Ii(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Wi=Ii(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Gi=Ii(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ki=[`hero-metrics`,`graph`,`latency-trace`,`throughput`,`decision-mix`,`telemetry-feed`,`system-pulse`,`pending-approvals`,`recent-blocks`],qi={"hero-metrics":`Hero metrics`,graph:`Graph intelligence`,"latency-trace":`Latency trace`,throughput:`Throughput`,"decision-mix":`Decision mix`,"telemetry-feed":`Telemetry feed`,"system-pulse":`System pulse`,"pending-approvals":`Pending approvals`,"recent-blocks":`Recent blocks`},Ji={"hero-metrics":{minW:6,minH:2,defaultW:12,defaultH:2},graph:{minW:4,minH:3,defaultW:8,defaultH:5},"latency-trace":{minW:4,minH:3,defaultW:8,defaultH:4},throughput:{minW:2,minH:2,defaultW:4,defaultH:2},"decision-mix":{minW:2,minH:2,defaultW:4,defaultH:2},"telemetry-feed":{minW:6,minH:3,defaultW:12,defaultH:4},"system-pulse":{minW:4,minH:3,defaultW:12,defaultH:3},"pending-approvals":{minW:3,minH:2,defaultW:6,defaultH:3},"recent-blocks":{minW:3,minH:2,defaultW:6,defaultH:3}};function Yi({panel:e,isEditing:t,children:n,drag:r}){let i=(0,_.useRef)(null),a={gridColumn:`${e.x+1} / span ${e.w}`,gridRow:`${e.y+1} / span ${e.h}`};return(0,G.jsxs)(`div`,{ref:i,className:`grid-panel ${t?`grid-panel--edit`:``}`,style:a,role:t?`region`:void 0,"aria-label":t?qi[e.id]:void 0,tabIndex:t?0:void 0,onKeyDown:t?t=>r.onPanelKeyDown(t,e.id):void 0,"data-panel-id":e.id,children:[t&&(0,G.jsx)(`button`,{type:`button`,className:`grid-panel__drag-handle`,title:`Drag ${qi[e.id]} (or Arrow keys)`,"aria-label":`Drag ${qi[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onDragPointerDown(t,e.id,n)},children:(0,G.jsx)(zi,{size:12,strokeWidth:2})}),(0,G.jsx)(`div`,{className:`grid-panel__content`,"data-reveal":t?void 0:``,children:n}),t&&(0,G.jsx)(`button`,{type:`button`,className:`grid-panel__resize-handle`,title:`Resize ${qi[e.id]} (or Shift+Arrow keys)`,"aria-label":`Resize ${qi[e.id]}`,onPointerDown:t=>{let n=i.current;n&&r.onResizePointerDown(t,e.id,n)},children:(0,G.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,"aria-hidden":!0,children:[(0,G.jsx)(`path`,{d:`M10 0 L10 10 L0 10 Z`,fill:`currentColor`,fillOpacity:`0.4`}),(0,G.jsx)(`path`,{d:`M3 10 L10 3 M6 10 L10 6 M9 10 L10 9`,stroke:`currentColor`,strokeWidth:`0.8`,fill:`none`})]})})]})}var Xi=(0,_.memo)(Yi);function Zi(e){let t=getComputedStyle(e),n=e.getBoundingClientRect(),r=parseFloat(t.rowGap||t.gap||`0`)||0,i=r*11;return{cellWidthPx:(n.width-i)/12+r,cellHeightPx:72+r}}function Qi(e){let t=(0,_.useRef)(null),n=(0,_.useRef)(e);n.current=e;let r=(0,_.useCallback)(()=>{let e=t.current;if(e){e.element.style.transform=``,e.element.style.width=``,e.element.style.height=``,e.element.style.zIndex=``,e.element.classList.remove(`grid-panel--dragging`),e.element.classList.remove(`grid-panel--resizing`);try{e.element.releasePointerCapture(e.pointerId)}catch{}t.current=null}},[]);(0,_.useEffect)(()=>{function e(e){let n=t.current;if(!n||e.pointerId!==n.pointerId)return;let r=e.clientX-n.startPointerX,i=e.clientY-n.startPointerY;if(n.mode===`drag`)n.element.style.transform=`translate3d(${r}px, ${i}px, 0)`;else{let e=Ji[n.startPanel.id],t=e.minW*n.cellWidthPx-n.cellWidthPx+40,a=e.minH*n.cellHeightPx-n.cellHeightPx+40,o=Math.max(t,n.startRectW+r),s=Math.max(a,n.startRectH+i);n.element.style.width=`${o}px`,n.element.style.height=`${s}px`}}function i(e,t,n){let r=Ji[e.startPanel.id];if(e.mode===`drag`){let r=Math.round(t/e.cellWidthPx),i=Math.round(n/e.cellHeightPx),a=e.startPanel.x+r,o=e.startPanel.y+i;return a<0&&(a=0),a+e.startPanel.w>12&&(a=12-e.startPanel.w),o<0&&(o=0),{id:e.id,x:a,y:o,w:e.startPanel.w,h:e.startPanel.h}}let i=Math.round(t/e.cellWidthPx),a=Math.round(n/e.cellHeightPx),o=e.startPanel.w+i,s=e.startPanel.h+a;return o<r.minW&&(o=r.minW),s<r.minH&&(s=r.minH),e.startPanel.x+o>12&&(o=12-e.startPanel.x),{id:e.id,x:e.startPanel.x,y:e.startPanel.y,w:o,h:s}}function a(e){let a=t.current;if(!a||e.pointerId!==a.pointerId)return;let o=i(a,e.clientX-a.startPointerX,e.clientY-a.startPointerY);r(),o.x===a.startPanel.x&&o.y===a.startPanel.y&&o.w===a.startPanel.w&&o.h===a.startPanel.h||n.current.onCommit(o)}function o(e){let n=t.current;!n||e.pointerId!==n.pointerId||r()}function s(e){e.key===`Escape`&&t.current&&r()}function c(){document.visibilityState===`hidden`&&t.current&&r()}return document.addEventListener(`pointermove`,e),document.addEventListener(`pointerup`,a),document.addEventListener(`pointercancel`,o),document.addEventListener(`keydown`,s),document.addEventListener(`visibilitychange`,c),()=>{document.removeEventListener(`pointermove`,e),document.removeEventListener(`pointerup`,a),document.removeEventListener(`pointercancel`,o),document.removeEventListener(`keydown`,s),document.removeEventListener(`visibilitychange`,c),t.current&&r()}},[r]);let i=(0,_.useCallback)((e,r,i,a)=>{if(!n.current.enabled||t.current)return;let o=n.current.getPanel(r),s=n.current.gridRef.current;if(!o||!s)return;e.preventDefault(),e.stopPropagation();let{cellWidthPx:c,cellHeightPx:l}=Zi(s),u=i.getBoundingClientRect();t.current={id:r,mode:a,startPointerX:e.clientX,startPointerY:e.clientY,startPanel:o,element:i,cellWidthPx:c,cellHeightPx:l,pointerId:e.pointerId,startRectW:u.width,startRectH:u.height},i.classList.add(a===`drag`?`grid-panel--dragging`:`grid-panel--resizing`),i.style.zIndex=`10`;try{i.setPointerCapture(e.pointerId)}catch{}},[]);return{onDragPointerDown:(0,_.useCallback)((e,t,n)=>i(e,t,n,`drag`),[i]),onResizePointerDown:(0,_.useCallback)((e,t,n)=>i(e,t,n,`resize`),[i]),onPanelKeyDown:(0,_.useCallback)((e,t)=>{if(!n.current.enabled)return;let r=n.current.getPanel(t);if(!r)return;let i=e.shiftKey,a=0,o=0;switch(e.key){case`ArrowLeft`:a=-1;break;case`ArrowRight`:a=1;break;case`ArrowUp`:o=-1;break;case`ArrowDown`:o=1;break;default:return}e.preventDefault(),e.stopPropagation();let s=Ji[t];if(i){let e=r.w+a,i=r.h+o;if(e<s.minW&&(e=s.minW),i<s.minH&&(i=s.minH),r.x+e>12&&(e=12-r.x),e===r.w&&i===r.h)return;n.current.onCommit({id:t,x:r.x,y:r.y,w:e,h:i})}else{let e=r.x+a,i=r.y+o;if(e<0&&(e=0),e+r.w>12&&(e=12-r.w),i<0&&(i=0),e===r.x&&i===r.y)return;n.current.onCommit({id:t,x:e,y:i,w:r.w,h:r.h})}},[]),isGesturing:(0,_.useCallback)(()=>t.current!==null,[])}}function $i(e,t){return e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y}function ea(e){return{id:e.id,x:e.x,y:e.y,w:e.w,h:e.h}}function ta(e,t){let n=[ea(e)],r=t.map(ea);r.sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y);for(let e of r){for(;;){let t=!1;for(let r of n)if($i(e,r)){let n=r.y+r.h;n>e.y&&(e.y=n,t=!0)}if(!t)break}n.push(e)}return n}function na(e){if(e.length===0)return[];let t=[...e].map(ea).sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y),n=[];for(let e of t){let t=!0;for(;t;){t=!1;for(let r of n)$i(e,r)&&(e.y=r.y+r.h,t=!0)}n.push(e)}return n}function ra(e,t,n){let r=e.findIndex(e=>e.id===t);if(r===-1)return{panels:e.map(ea)};let i=ta({id:e[r].id,x:n.x,y:n.y,w:n.w,h:n.h},e.filter((e,t)=>t!==r)),a=new Map(i.map(e=>[e.id,e]));return{panels:na(e.map(e=>a.get(e.id)).filter(Boolean))}}function ia({panels:e,isEditing:t,renderers:n,onPanelsChange:r}){let i=(0,_.useRef)(null),a=(0,_.useRef)(e);a.current=e;let o=(0,_.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n);return t},[e]),s=Qi({gridRef:i,getPanel:(0,_.useCallback)(e=>o.get(e),[o]),onCommit:(0,_.useCallback)(e=>{let t=a.current,{panels:n}=ra(t,e.id,{x:e.x,y:e.y,w:e.w,h:e.h});r(n)},[r]),enabled:t});return(0,G.jsx)(`div`,{ref:i,className:`grid-layout ${t?`grid-layout--editing`:``}`,"aria-live":t?`polite`:void 0,children:e.map(e=>(0,G.jsx)(Xi,{panel:e,isEditing:t,drag:s,children:n[e.id]()},e.id))})}function aa({manager:e,isEditing:t,onToggleEditing:n}){let{config:r,activeLayout:i,canAddUserLayout:a,saveError:o,selectLayout:s,saveAs:c,renameActive:l,deleteLayout:u,resetActive:d,exportConfig:f,importConfig:p}=e,[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(``),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(i.name),[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(!1),ee=(0,_.useRef)(null);(0,_.useEffect)(()=>{w(i.name)},[i.name]),(0,_.useEffect)(()=>{o&&h(o)},[o]),(0,_.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>h(null),4e3);return()=>clearTimeout(e)},[m]);function k(){y.trim()&&(c(y.trim()),b(``),v(!1),h(`Saved "${y.trim()}"`))}function A(){C.trim()&&(l(C.trim()),S(!1),h(`Renamed`))}function j(){let e=i.name;u(i.id),O(!1),h(`Deleted "${e}"`)}function te(){d(),E(!1),h(`Reset to default`)}function ne(){let e=f(),t=new Blob([e],{type:`application/json`}),n=URL.createObjectURL(t),r=new Date().toISOString().slice(0,10),i=document.createElement(`a`);i.href=n,i.download=`ssg-layout-${r}.json`,i.click(),URL.revokeObjectURL(n),h(`Layout exported`)}function re(e){let t=e.target.files?.[0];e.target.value=``,t&&t.text().then(e=>{h(p(e).message)}).catch(()=>h(`Import failed: could not read file`))}return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`overline shrink-0`,children:`layout`}),(0,G.jsxs)(`select`,{value:r.activeLayoutId,onChange:e=>s(e.target.value),className:`bg-[var(--color-surface-2)] border border-[var(--color-line-1)] rounded-sm px-2 py-1 text-[11px] font-mono text-[var(--color-fg-1)] hover:border-[var(--color-line-2)] focus:outline-none focus:ring-1 focus:ring-[var(--color-brand)] cursor-pointer`,"aria-label":`Select layout`,children:[(0,G.jsx)(`optgroup`,{label:`Built-in`,children:r.layouts.filter(e=>e.builtIn).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))}),r.layouts.some(e=>!e.builtIn)&&(0,G.jsx)(`optgroup`,{label:`Your layouts`,children:r.layouts.filter(e=>!e.builtIn).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),i.builtIn&&(0,G.jsx)(`span`,{className:`chip text-[var(--color-fg-3)]`,title:`Built-in preset`,children:`built-in`})]}),(0,G.jsx)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>v(!0),disabled:!a,title:a?`Save the current arrangement as a new preset`:`Layout limit reached — delete one first`,children:[(0,G.jsx)(Hi,{size:11,strokeWidth:2.25}),`Save as`]}),!i.builtIn&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>{w(i.name),S(!0)},children:[(0,G.jsx)(Bi,{size:11,strokeWidth:2.25}),`Rename`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>O(!0),children:[(0,G.jsx)(Ui,{size:11,strokeWidth:2.25}),`Delete`]})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>E(!0),title:`Replace the current layout with the Default preset`,children:[(0,G.jsx)(Vi,{size:11,strokeWidth:2.25}),`Reset`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:ne,title:`Download current layouts as JSON`,children:[(0,G.jsx)(Ri,{size:11,strokeWidth:2.25}),`Export`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>ee.current?.click(),title:`Load layouts from a JSON file`,children:[(0,G.jsx)(Wi,{size:11,strokeWidth:2.25}),`Import`]}),(0,G.jsx)(`input`,{ref:ee,type:`file`,accept:`application/json,.json`,onChange:re,className:`hidden`,"aria-hidden":!0}),(0,G.jsxs)(Y,{variant:`primary`,size:`sm`,onClick:()=>n(!1),children:[(0,G.jsx)(Li,{size:11,strokeWidth:2.5}),`Done`]})]}):(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>n(!0),children:[(0,G.jsx)(Bi,{size:11,strokeWidth:2.25}),`Edit layout`]})}),g&&(0,G.jsx)(oa,{title:`Save layout as`,value:y,placeholder:`My dashboard`,onChange:b,onConfirm:k,onCancel:()=>{v(!1),b(``)},confirmLabel:`Save`}),x&&(0,G.jsx)(oa,{title:`Rename layout`,value:C,placeholder:i.name,onChange:w,onConfirm:A,onCancel:()=>S(!1),confirmLabel:`Rename`}),T&&(0,G.jsx)(sa,{title:`Reset this layout?`,body:`The current arrangement will be replaced with the Default preset. Saved layouts are not affected.`,confirmLabel:`Reset`,onConfirm:te,onCancel:()=>E(!1),destructive:!1}),D&&(0,G.jsx)(sa,{title:`Delete "${i.name}"?`,body:`This layout will be removed. You can always recreate it via Save as.`,confirmLabel:`Delete`,onConfirm:j,onCancel:()=>O(!1),destructive:!0}),m&&(0,G.jsx)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 -translate-x-1/2 z-50 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-3)] px-3 py-2 text-[11px] font-mono text-[var(--color-fg-1)] shadow-lg`,children:m})]})}function oa({title:e,value:t,placeholder:n,onChange:r,onConfirm:i,onCancel:a,confirmLabel:o}){return(0,G.jsx)(`div`,{role:`dialog`,"aria-modal":!0,"aria-label":e,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:a,children:(0,G.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`w-80 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-2)] p-4`,children:[(0,G.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,G.jsx)(`input`,{value:t,onChange:e=>r(e.target.value),placeholder:n,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&i(),e.key===`Escape`&&a()},className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] rounded-sm px-2 py-1.5 text-[13px] font-mono text-[var(--color-fg-1)] focus:outline-none focus:border-[var(--color-brand)]`}),(0,G.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:a,children:[(0,G.jsx)(Gi,{size:11,strokeWidth:2.25}),`Cancel`]}),(0,G.jsx)(Y,{variant:`primary`,size:`sm`,onClick:i,children:o})]})]})})}function sa({title:e,body:t,confirmLabel:n,destructive:r,onConfirm:i,onCancel:a}){return(0,G.jsx)(`div`,{role:`dialog`,"aria-modal":!0,"aria-label":e,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:a,children:(0,G.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`w-96 rounded-sm border border-[var(--color-line-2)] bg-[var(--color-surface-2)] p-4`,children:[(0,G.jsx)(`div`,{className:`overline mb-2`,children:e}),(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:t}),(0,G.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),(0,G.jsx)(Y,{variant:r?`danger`:`primary`,size:`sm`,onClick:i,children:n})]})]})})}var ca={default:`builtin-default`,focusLatency:`builtin-focus-latency`,focusApprovals:`builtin-focus-approvals`,compact:`builtin-compact`},la={id:ca.default,name:`Default`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`graph`,x:0,y:2,w:8,h:5},{id:`latency-trace`,x:8,y:2,w:4,h:3},{id:`throughput`,x:8,y:5,w:2,h:2},{id:`decision-mix`,x:10,y:5,w:2,h:2},{id:`telemetry-feed`,x:0,y:7,w:12,h:3},{id:`system-pulse`,x:0,y:10,w:12,h:3},{id:`pending-approvals`,x:0,y:13,w:6,h:3},{id:`recent-blocks`,x:6,y:13,w:6,h:3}]},ua={id:ca.focusLatency,name:`Focus · Latency`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`latency-trace`,x:0,y:2,w:8,h:5},{id:`graph`,x:8,y:2,w:4,h:5},{id:`throughput`,x:0,y:7,w:6,h:2},{id:`decision-mix`,x:6,y:7,w:6,h:2},{id:`system-pulse`,x:0,y:9,w:12,h:3},{id:`telemetry-feed`,x:0,y:12,w:12,h:3},{id:`pending-approvals`,x:0,y:15,w:6,h:2},{id:`recent-blocks`,x:6,y:15,w:6,h:2}]},da={id:ca.focusApprovals,name:`Focus · Approvals`,builtIn:!0,panels:[{id:`pending-approvals`,x:0,y:0,w:8,h:4},{id:`graph`,x:8,y:0,w:4,h:4},{id:`recent-blocks`,x:0,y:4,w:12,h:3},{id:`hero-metrics`,x:0,y:7,w:12,h:2},{id:`latency-trace`,x:0,y:9,w:6,h:3},{id:`telemetry-feed`,x:6,y:9,w:6,h:3},{id:`system-pulse`,x:0,y:12,w:12,h:3},{id:`throughput`,x:0,y:15,w:6,h:2},{id:`decision-mix`,x:6,y:15,w:6,h:2}]},fa={id:ca.compact,name:`Compact`,builtIn:!0,panels:[{id:`hero-metrics`,x:0,y:0,w:12,h:2},{id:`graph`,x:0,y:2,w:8,h:3},{id:`latency-trace`,x:8,y:2,w:4,h:3},{id:`system-pulse`,x:0,y:5,w:12,h:3},{id:`throughput`,x:0,y:8,w:4,h:2},{id:`decision-mix`,x:4,y:8,w:4,h:2},{id:`telemetry-feed`,x:0,y:10,w:12,h:3},{id:`pending-approvals`,x:0,y:13,w:6,h:2},{id:`recent-blocks`,x:6,y:13,w:6,h:2}]},pa=Object.freeze([la,ua,da,fa]);function ma(){return pa.map(e=>({...e,panels:e.panels.map(e=>({...e}))}))}function ha(){return{version:1,activeLayoutId:ca.default,layouts:ma()}}function ga(e){return Object.values(ca).includes(e)}var _a=new Set(Ki),va=new Set(pa.map(e=>e.id));function ya(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ba(e,t,n,r){if(typeof e!=`number`||!Number.isFinite(e))return r;let i=Math.floor(e);return i<t?t:i>n?n:i}function xa(e,t){let n=(typeof e==`string`?e:``).replace(/[\u0000-\u001F\u007F]/g,``).trim();return n.length===0?t:n.slice(0,40)}function Sa(e){let t=e.find(e=>e.id===`system-pulse`);if(!t||t.h>=3)return e;let n=3-t.h,r=t.y+t.h;return e.map(e=>e.id===`system-pulse`?{...e,h:3}:e.y>=r?{...e,y:e.y+n}:e)}function Ca(e){for(let t=0;t<e.length;t++){let n=e[t];for(let r=t+1;r<e.length;r++){let t=e[r];if(n.x<t.x+t.w&&n.x+n.w>t.x&&n.y<t.y+t.h&&n.y+n.h>t.y)return!0}}return!1}function wa(e){if(!ya(e))return null;let{id:t}=e;if(typeof t!=`string`||!_a.has(t))return null;let n=t,r=Ji[n],i=ba(e.x,0,11,0),a=ba(e.w,r.minW,12,r.defaultW);return{id:n,x:i+a>12?12-a:i,y:ba(e.y,0,999,0),w:a,h:ba(e.h,r.minH,99,r.defaultH)}}function Ta(e,t){if(!ya(e))return{layout:null,droppedPanels:0};let n=typeof e.id==`string`&&e.id.length>0?e.id:null;if(!n)return{layout:null,droppedPanels:0};let r=xa(e.name,t),i=va.has(n),a=e.panels;if(!Array.isArray(a))return{layout:null,droppedPanels:0};let o=new Set,s=[],c=0;for(let e of a){let t=wa(e);if(!t){c+=1;continue}if(o.has(t.id)){c+=1;continue}o.add(t.id),s.push(t)}return s.length===0?{layout:null,droppedPanels:c}:{layout:{id:n,name:r,builtIn:i,panels:Sa(s)},droppedPanels:c}}function Ea(e){if(!ya(e)||e.version!==1)return{config:ha(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let t=e.layouts;if(!Array.isArray(t)||t.length===0)return{config:ha(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0};let n=[],r=0,i=0,a=0;for(let e of t){let{layout:t,droppedPanels:o}=Ta(e,`Layout ${n.length+1}`);if(r+=o,t){if(!t.builtIn){if(i>=12){a+=1;continue}i+=1}n.push(t)}}if(n.length===0)return{config:ha(),droppedPanels:r,prunedLayouts:a,fellBackToDefault:!0};let o=new Set(n.map(e=>e.id));for(let e of pa)o.has(e.id)||n.push({...e,panels:e.panels.map(e=>({...e}))});let s=new Map(pa.map(e=>[e.id,e])),c=0,l=0;for(let e=0;e<n.length;e++){let t=n[e],r=s.get(t.id);if(!r)continue;if(Ca(t.panels)){n[e]={...r,panels:r.panels.map(e=>({...e}))},l+=1;continue}let i=new Set(t.panels.map(e=>e.id)),a=r.panels.filter(e=>!i.has(e.id));if(a.length===0)continue;let o=t.panels.reduce((e,t)=>Math.max(e,t.y+t.h),0);for(let e of a)t.panels.push({id:e.id,x:0,y:o,w:e.w,h:e.h}),o+=e.h,c+=1}let u=e.activeLayoutId;return{config:{version:1,activeLayoutId:typeof u==`string`&&n.some(e=>e.id===u)?u:pa[0].id,layouts:n},droppedPanels:r,prunedLayouts:a,fellBackToDefault:!1,backfilledPanels:c,refreshedBuiltins:l}}var Da=`ssg:dashboard-layout:v1`,Oa=300;function ka(){if(typeof localStorage>`u`)return null;try{let e=`__ssg_probe__`;return localStorage.setItem(e,`1`),localStorage.removeItem(e),localStorage}catch{return null}}var Aa;function ja(){return Aa===void 0&&(Aa=ka()),Aa}function Ma(){let e=ja();if(!e)return{config:ha(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let t=null;try{t=e.getItem(Da)}catch{t=null}if(t===null)return{config:ha(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!1};let n=null;try{n=JSON.parse(t)}catch{return{config:ha(),droppedPanels:0,prunedLayouts:0,fellBackToDefault:!0}}return Ea(n)}var Na=null,Pa=null,Fa=null;function Ia(e){return Fa=e,()=>{Fa===e&&(Fa=null)}}function La(e){Fa?Fa(e):typeof console<`u`&&console.warn(`[ssg-layout]`,e)}function Ra(){if(Pa=null,!Na)return;let e=ja();if(!e){Na=null;return}let t=Na;Na=null;try{e.setItem(Da,JSON.stringify(t))}catch(e){e instanceof Error&&e.name===`QuotaExceededError`?La(`Layout storage full — save skipped`):La(`Layout save failed: ${e instanceof Error?e.message:String(e)}`)}}function za(e){Na=e,Pa===null&&(Pa=setTimeout(Ra,Oa))}function Ba(e){Na=e,Pa!==null&&(clearTimeout(Pa),Pa=null),Ra()}function Va(e){let t=0;for(let n of e.layouts)n.builtIn||(t+=1);return t}function Ha(e){return e.map(e=>({...e}))}function Ua(){return`user-`+Math.random().toString(16).slice(2,11)}function Wa(){let[e,t]=(0,_.useState)(()=>Ma().config),[n,r]=(0,_.useState)(null);(0,_.useEffect)(()=>Ia(e=>r(e)),[]),(0,_.useEffect)(()=>{za(e)},[e]);let i=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0]??ma()[0],a=Va(e)<12,o=(0,_.useCallback)(e=>{t(t=>t.layouts.some(t=>t.id===e)?{...t,activeLayoutId:e}:t)},[]),s=(0,_.useCallback)(e=>{t(t=>{let n=t.activeLayoutId;return{...t,layouts:t.layouts.map(t=>t.id===n?{...t,panels:Ha(e)}:t)}})},[]),c=(0,_.useCallback)(e=>{let n=e.trim();n&&t(e=>{if(Va(e)>=12)return e;let t=e.layouts.find(t=>t.id===e.activeLayoutId)??e.layouts[0];if(!t)return e;let r={id:Ua(),name:n,builtIn:!1,panels:Ha(t.panels)};return{...e,activeLayoutId:r.id,layouts:[...e.layouts,r]}})},[]),l=(0,_.useCallback)(e=>{let n=e.trim();n&&t(e=>({...e,layouts:e.layouts.map(t=>t.id===e.activeLayoutId&&!t.builtIn?{...t,name:n}:t)}))},[]),u=(0,_.useCallback)(e=>{t(t=>{let n=t.layouts.find(t=>t.id===e);if(!n||n.builtIn)return t;let r=t.layouts.filter(t=>t.id!==e),i=t.activeLayoutId===e?r[0]?.id??pa[0].id:t.activeLayoutId;return{...t,activeLayoutId:i,layouts:r}})},[]),d=(0,_.useCallback)(()=>{t(e=>{let t=e.layouts.find(t=>t.id===e.activeLayoutId);if(!t)return e;let n=ga(t.id)?pa.find(e=>e.id===t.id):pa[0];return n?{...e,layouts:e.layouts.map(e=>e.id===t.id?{...e,panels:Ha(n.panels)}:e)}:e})},[]),f=(0,_.useCallback)(()=>JSON.stringify(e,null,2),[e]),p=(0,_.useCallback)(e=>{let n;try{n=JSON.parse(e)}catch{return{ok:!1,message:`Import failed: not valid JSON`}}let r=Ea(n);if(r.fellBackToDefault)return{ok:!1,message:`Import rejected: schema invalid, no changes applied`};t(r.config),Ba(r.config);let i=[`Layout imported`];return r.droppedPanels>0&&i.push(`${r.droppedPanels} unrecognized panel(s) dropped`),r.prunedLayouts>0&&i.push(`${r.prunedLayouts} excess layout(s) pruned`),{ok:!0,message:i.join(` · `)}},[]);return(0,_.useEffect)(()=>{e.layouts.length===0&&t(ha())},[e.layouts.length]),{config:e,activeLayout:i,canAddUserLayout:a,saveError:n,selectLayout:o,updateActivePanels:s,saveAs:c,renameActive:l,deleteLayout:u,resetActive:d,exportConfig:f,importConfig:p}}var Ga=new Set([`compact`,`end`,`stop`,`subagent-stop`,`close`]),Ka=Object.freeze([`session-lifecycle`]);function qa(e){(0,_.useEffect)(()=>Ce(Ka),[]);let t=(0,_.useSyncExternalStore)(he,ge),[n,r]=(0,_.useState)(new Map),i=(0,_.useRef)(0);(0,_.useEffect)(()=>{let e=t.lifecycleRing;if(e.length<=i.current)return;let n=e.slice(i.current);i.current=e.length,Ja(n,r)},[t.lifecycleRing]);let a=(0,_.useRef)(void 0);return(0,_.useEffect)(()=>{!e||e===a.current||(a.current=e,Ja(e,r))},[e]),{closedAt:n,isBurstActive(e,t){let r=n.get(e);return r===void 0||t>r}}}function Ja(e,t){let n=e.filter(e=>Ga.has(e.event));n.length!==0&&t(e=>{let t=!1,r=new Map(e);for(let e of n){let n=r.get(e.session_key);(n===void 0||e.ts_ms>n)&&(r.set(e.session_key,e.ts_ms),t=!0)}return t?r:e})}function Ya(e){return`${e.client}:${e.agent_id??`solo`}`}var Xa=Object.freeze({allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`}),Za=5*6e4,Qa=1200,$a=30*6e4,eo=1.4;function to(e){let t=(e.input_tokens??0)+(e.output_tokens??0);if(t<=0)return 6;let n=6+Math.log2(1+t/50)*eo;return n<4?4:n>16?16:n}function no(e){let t=(e.input_tokens??0)+(e.output_tokens??0);if(t<=0)return 0;let n=Math.log2(1+t/50)*eo/10;return n<=0?0:n>=1?1:n}function X(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function ro(e,t){if(t<=0)return e;let n=e.startsWith(`#`)?e.slice(1):e;if(n.length!==6)return e;let r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);if(Number.isNaN(r)||Number.isNaN(i)||Number.isNaN(a))return e;let o=Math.max(r,i,a);if(o===0)return e;let s=t>1?1:t,c=(255-o)*s,l=Math.round(r+r/o*c),u=Math.round(i+i/o*c),d=Math.round(a+a/o*c),f=e=>(e<0?0:e>255?255:e).toString(16).padStart(2,`0`);return`#${f(l)}${f(u)}${f(d)}`}var io=1440*60*1e3,ao=1800*1e3,oo=3e3;function so(e,t){if(e.length===0)return t.slice();if(t.length===0)return e.slice();let n=new Set,r=[],i=0,a=0;for(;i<e.length&&a<t.length;){let o=e[i].ts_ms<=t[a].ts_ms?e[i++]:t[a++],s=co(o);n.has(s)||(n.add(s),r.push(o))}for(;i<e.length;i++){let t=co(e[i]);n.has(t)||(n.add(t),r.push(e[i]))}for(;a<t.length;a++){let e=co(t[a]);n.has(e)||(n.add(e),r.push(t[a]))}return r}function co(e){return e.audit_id??`${e.ts_ms}:${e.tool}:${e.client}`}function lo(e,t){if(e.length===0)return t.slice();if(t.length===0)return e.slice();let n=new Set,r=[];for(let i of[...e,...t]){let e=`${i.session_key}:${i.ts_ms}:${i.event}`;n.has(e)||(n.add(e),r.push(i))}return r}function uo(e,t,n,r=200,i=$a,a=12){let o=new Map,s=new Map;for(let r of e){if(r.ts_ms>n)break;let e=Ya(r);if(!t(e,r.ts_ms))continue;let i=o.get(e);i?i.push(r):o.set(e,[r]);let a=s.get(e);(a===void 0||r.ts_ms>a)&&s.set(e,r.ts_ms)}let c=n-i,l=[];for(let[e,t]of s)t<c&&l.push(e);for(let e of l)o.delete(e),s.delete(e);if(o.size>a){let e=new Set(Array.from(s.entries()).sort((e,t)=>t[1]-e[1]).slice(0,a).map(([e])=>e));for(let t of[...o.keys()])e.has(t)||o.delete(t)}let u=[];for(let e of o.values()){let t=e.length>r?e.slice(-r):e;u.push(...t)}return u.sort((e,t)=>e.ts_ms-t.ts_ms),u}function fo(e={}){let t=e.windowMs??12e4,n=De(),[r,i]=(0,_.useState)(()=>({mode:`live`,playhead_ms:Date.now(),window_ms:t})),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(!1);(0,_.useEffect)(()=>{p.current=n.length>0||a.length>0},[n,a]),(0,_.useEffect)(()=>{if(r.mode!==`live`)return;let e=()=>{if(!p.current)return;let e=Date.now();i(t=>t.mode===`live`?t.playhead_ms===e?t:{...t,playhead_ms:e}:t)};e();let t=setInterval(e,500);return()=>clearInterval(t)},[r.mode]);let m=(0,_.useMemo)(()=>so(a,n),[a,n]),{isBurstActive:h}=qa(s),g=(0,_.useMemo)(()=>uo(m,h,r.playhead_ms),[m,h,r.playhead_ms]),v=m.length>0?m[0].ts_ms:r.playhead_ms,y=m.length>0?m[m.length-1].ts_ms:r.playhead_ms,b=(0,_.useCallback)(async e=>{if(f.current)return;let t=v,n=Math.min(t,(d.current??Date.now())-e);if(n>=t)return;let r=new AbortController;f.current=r,u(!0);try{let e=await fetch(`/api/json/graph/backfill?since_ms=${n}&until_ms=${t}&limit=500`,{signal:r.signal,credentials:`same-origin`});if(!e.ok)throw Error(`backfill ${e.status}`);let i=await e.json();Array.isArray(i.bursts)&&i.bursts.length>0&&o(e=>{let t=so(e,i.bursts);return t.length>oo?t.slice(-oo):t}),Array.isArray(i.lifecycle)&&i.lifecycle.length>0&&c(e=>lo(e,i.lifecycle)),d.current=n}catch(e){e.name!==`AbortError`&&console.warn(`[graph] backfill failed`,e)}finally{f.current=null,u(!1)}},[v]);(0,_.useEffect)(()=>{r.playhead_ms-v<r.window_ms*.5&&b(Za)},[r.mode,r.playhead_ms,r.window_ms,v,b]);let x=(0,_.useRef)(!1);(0,_.useEffect)(()=>{x.current||(x.current=!0,b(ao))},[]),(0,_.useEffect)(()=>()=>{f.current?.abort(),f.current=null},[]);let S=(0,_.useCallback)(e=>{i(t=>e===`live`?{...t,mode:`live`}:{...t,mode:e})},[]),C=(0,_.useCallback)(e=>{i(t=>({...t,mode:t.mode===`live`?`scrubbing`:t.mode,playhead_ms:e}))},[]),w=(0,_.useCallback)(e=>{i(t=>({...t,window_ms:Math.max(1e3,e)}))},[]),T=(0,_.useCallback)(()=>{i(e=>({...e,mode:`live`,playhead_ms:Date.now()}))},[]),E=(0,_.useCallback)(()=>{i(e=>({...e,mode:`live`,playhead_ms:Date.now(),window_ms:io})),b(io)},[b]);return{snapshot:(0,_.useMemo)(()=>({bursts:g,playback:r,oldest_known_ms:v,newest_known_ms:y,loading_backfill:l}),[g,r,v,y,l]),allBursts:m,setMode:S,setPlayhead:C,setWindow:w,jumpToLive:T,requestBackfill:b,jumpTo24h:E}}var po=2*Math.PI/6e4,mo=2.3999632297286535,ho=16,go=22,_o=.4,vo=14,yo=8,bo=24;function xo(e,t,n){let r=new Map;for(let t of e){if(t.exitingAt!=null)continue;let e=r.get(t.session);e?e.push(t):r.set(t.session,[t])}if(r.size===0)return;for(let e of r.values())e.sort((e,t)=>e.ts_ms-t.ts_ms);let i=Math.min(t,n)-bo,a=Array.from(r.keys()).sort(),o=a.length,s=0;for(let e of r.values())e.length>s&&(s=e.length);let c=Math.max(1,Math.min(go,(i-ho)/Math.max(1,s-1))),l=ho,u=ho+c,d=(l*l+u*u-vo*vo)/(2*l*u),f=Math.max(_o,Math.acos(Math.min(1,Math.max(-1,d))));if(o<=yo)for(let e=0;e<o;e++){let t=a[e];if(t===void 0)continue;let n=r.get(t);if(!n)continue;let i=e*2*Math.PI/o;for(let e=0;e<n.length;e++){let t=n[e];t&&(t.slotPhi=i+e*f,t.slotR=ho+e*c)}}else{let e=[];for(let t of r.values())for(let n of t)e.push(n);e.sort((e,t)=>e.ts_ms-t.ts_ms);let t=Math.max(1,Math.min(go,(i-ho)/Math.max(1,e.length-1)));for(let n=0;n<e.length;n++){let r=e[n];r&&(r.slotPhi=n*mo,r.slotR=ho+n*t)}}}function So(e,t,n,r){for(let i of e)i.exitingAt??(i.slotR==null||i.slotPhi==null||(i.x=t+i.slotR*Math.cos(i.slotPhi+r),i.y=n+i.slotR*Math.sin(i.slotPhi+r)))}function Co(e){let t=new Map;for(let n of e){let e=t.get(n.session);e?(e.x+=n.x,e.y+=n.y,e.n+=1):t.set(n.session,{x:n.x,y:n.y,n:1})}for(let e of t.values())e.x/=e.n,e.y/=e.n;return t}function wo(e,t){let n=[],r=new Map;for(let t of e){let e=r.get(t.session);e?e.push(t):r.set(t.session,[t])}for(let e of r.values()){e.sort((e,t)=>e.ts_ms-t.ts_ms);for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r];!i||!a||a.ts_ms-i.ts_ms<=t&&n.push({source:i.id,target:a.id,kind:`session`})}}return n}var To=`SSG_AUDIO`,Eo=`SSG_AUDIO_VOLUME`,Do=12,Oo=null,ko=null,Ao=!1,jo=.18,Mo=[],No=!1;function Po(){if(typeof localStorage>`u`)return{enabled:!1,volume:.18};let e=localStorage.getItem(To)===`1`,t=localStorage.getItem(Eo);return{enabled:e,volume:t?Math.max(0,Math.min(1,parseFloat(t))):.18}}function Fo(){typeof localStorage>`u`||(localStorage.setItem(To,Ao?`1`:`0`),localStorage.setItem(Eo,jo.toString()))}function Io(){if(typeof window>`u`)return null;if(Oo)return Oo;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;try{Oo=new e,ko=Oo.createGain(),ko.gain.value=jo,ko.connect(Oo.destination),typeof document<`u`&&document.addEventListener(`visibilitychange`,()=>{Oo&&(document.visibilityState===`hidden`?Oo.suspend():Oo.resume())})}catch{Oo=null,ko=null}return Oo}function Lo(){if(No)return;No=!0;let{enabled:e,volume:t}=Po();Ao=e,jo=t}function Ro(){return Lo(),Ao}function zo(e){if(Lo(),Ao=e,Fo(),e){let e=Io();e&&e.state===`suspended`&&e.resume()}}function Bo(){return Lo(),jo}function Vo(e){Lo(),jo=Math.max(0,Math.min(1,e)),Fo(),ko&&(ko.gain.value=jo)}function Ho(e){for(;Mo.length>0&&e-Mo[0]>1e3;)Mo.shift();return Mo.length>=Do?!1:(Mo.push(e),!0)}var Uo={allow:{type:`sine`,freq:660,durationMs:90,peak:.6},block:{type:`square`,freq:110,durationMs:130,peak:1},force:{type:`sawtooth`,freq:220,freqSweep:440,durationMs:170,peak:.8},ask:{type:`triangle`,freq:880,durationMs:110,peak:.55},log:{type:`sine`,freq:1320,durationMs:30,peak:.35},shadow:{type:`sine`,freq:220,durationMs:60,peak:.18}};function Wo(e){if(Lo(),!Ao||typeof document<`u`&&document.visibilityState===`hidden`)return;let t=Io();if(!t||!ko)return;t.state===`suspended`&&t.resume().catch(()=>{});let n=t.currentTime;if(!Ho(performance.now()))return;let r=Uo[e],i=t.createOscillator();i.type=r.type,i.frequency.value=r.freq,r.freqSweep!==void 0&&(i.frequency.setValueAtTime(r.freq,n),i.frequency.exponentialRampToValueAtTime(Math.max(1,r.freqSweep),n+r.durationMs/1e3));let a=t.createGain();a.gain.setValueAtTime(0,n),a.gain.linearRampToValueAtTime(r.peak,n+.005),a.gain.exponentialRampToValueAtTime(1e-4,n+r.durationMs/1e3),i.connect(a),a.connect(ko),i.start(n),i.stop(n+r.durationMs/1e3+.05),i.onended=()=>{try{i.disconnect(),a.disconnect()}catch{}}}function Go(e){let t=e|0;return()=>{t=t+1831565813|0;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}var Ko={"claude-code":`C`,"claude-code-ide":`C`,cursor:`>`,copilot:`H`,codex:`X`,pi:`P`,gemini:`G`,antigravity:`A`};function qo(e){return Ko[e.toLowerCase()]??`.`}function Jo(e){let t=0;for(let n=0;n<e.length;n++)t=Math.imul(t,31)+e.charCodeAt(n)|0;return(t>>>0)%360}function Yo(e,t,n){for(let[r,i]of t){let{x:t,y:a,n:o}=i,s=50+Math.min(o,12)*7,c=Jo(r),l=n.get(r),u;l&&Math.abs(l.x-t)<2&&Math.abs(l.y-a)<2&&l.r===s?u=l.grad:(u=e.createRadialGradient(t,a,0,t,a,s),u.addColorStop(0,`hsla(${c},80%,55%,0.10)`),u.addColorStop(1,`hsla(${c},80%,55%,0)`),n.set(r,{grad:u,x:t,y:a,r:s})),e.fillStyle=u,e.beginPath(),e.arc(t,a,s,0,Math.PI*2),e.fill()}for(let e of n.keys())t.has(e)||n.delete(e)}function Xo(e,t,n,r,i,a,o){let s=8+a*r,c=Math.max(0,1-r)*o;c<=0||(e.save(),e.globalAlpha=c,e.fillStyle=i,e.beginPath(),e.arc(t,n,s,0,Math.PI*2),e.fill(),e.restore())}var Zo=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,Qo=`bold 10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,$o=new Map,es=256;function ts(e,t){let n=$o.get(t);if(n!==void 0)return n;let r=e.measureText(t).width;if($o.size>=es){let e=$o.keys().next().value;e!==void 0&&$o.delete(e)}return $o.set(t,r),r}function ns(e,t,n,r,i,a,o){let s=(r.split(`:`)[0]??r).slice(0,18),c=qo(s),l=Jo(r),u=Xa[o]??`#6b7280`;e.save(),e.textAlign=`center`;let d=`[${c}] ${s}`,f=`${i.length>14?i.slice(0,14):i} · ${a}`;e.font=Qo;let p=ts(e,d);e.font=Zo;let m=ts(e,f),h=Math.max(p,m)+10;e.globalAlpha=.82,e.fillStyle=`hsla(${l},25%,5%,0.92)`,e.fillRect(t-h/2,n-2,h,28),e.globalAlpha=.92,e.fillStyle=`hsla(${l},78%,70%,1)`,e.font=Qo,e.fillText(d,t,n+10),e.globalAlpha=.72,e.fillStyle=u,e.font=Zo,e.fillText(f,t,n+21),e.restore()}var rs=`bold 13px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,is=`bold 10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;function as(e){if((!Number.isFinite(e)||e<0)&&(e=0),e<6e4)return`${(e/1e3).toFixed(3)}s`;if(e<36e5)return`${Math.floor(e/6e4)}:${(e%6e4/1e3).toFixed(3).padStart(6,`0`)}`;let t=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4),r=(e%6e4/1e3).toFixed(1).padStart(4,`0`);return`${t}:${String(n).padStart(2,`0`)}:${r}`}function os(e,t,n,r,i){e.save(),e.textAlign=`center`,e.font=is,e.globalAlpha=.7,e.fillStyle=`hsla(${i},78%,72%,0.55)`,e.fillText(`uptime`,t,n),e.font=rs,e.globalAlpha=.96,e.fillStyle=`hsla(${i},78%,82%,1)`,e.fillText(as(r),t,n+13),e.restore()}function ss(e,t,n,r){e.save(),e.textAlign=`right`,e.font=is,e.fillStyle=`rgba(148, 163, 184, 0.55)`,e.globalAlpha=.85,e.fillText(`LIVE`,t,n),e.font=`bold 16px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,e.fillStyle=`#e0e7ff`,e.globalAlpha=.92,e.fillText(as(r),t,n+16),e.restore()}function cs(e,t,n,r,i,a,o){let s=r-t,c=i-n;if(Math.sqrt(s*s+c*c)<24)return;let l=Math.atan2(c,s),u=3.5,d=r-Math.cos(l)*9,f=i-Math.sin(l)*9;e.save(),e.globalAlpha=o*.85,e.fillStyle=a,e.translate(d,f),e.rotate(l),e.beginPath(),e.moveTo(0,0),e.lineTo(-6,-u),e.lineTo(-6,u),e.closePath(),e.fill(),e.restore()}var ls={Read:`▣`,Write:`✎`,Edit:`✎`,MultiEdit:`✎`,NotebookEdit:`✎`,NotebookRead:`▣`,Glob:`✦`,Grep:`✦`,LS:`⊞`,Find:`✦`,ToolSearch:`⊕`,Bash:`$`,Skill:`◈`,WebFetch:`⌬`,WebSearch:`⌬`,Agent:`◇`,Task:`⌘`,TaskCreate:`⌘`,TaskUpdate:`⌘`,TaskList:`⌘`,TaskGet:`⌘`,TaskOutput:`⌘`,TaskStop:`⌘`,TodoWrite:`✓`,TodoRead:`✓`,AskUserQuestion:`?`,EnterPlanMode:`◐`,ExitPlanMode:`◑`,EnterWorktree:`⎇`,ExitWorktree:`⎇`,PushNotification:`⏰`,ScheduleWakeup:`⏰`,CronCreate:`⏰`,CronList:`⏰`,CronDelete:`⏰`,RemoteTrigger:`↗`,Monitor:`◉`};function us(e){if(!e)return`·`;let t=e.lastIndexOf(`__`);return ls[t>=0?e.slice(t+2):e]??ls[e]??`·`}var ds=820,fs=e=>Math.min(1,e),ps=620,ms=e=>1-(1-e)**3,hs=$e({stiffness:120,damping:22,mass:1}),gs=1800;function _s(e){return e<=2?Math.min(window.devicePixelRatio,2):e<=4?Math.min(window.devicePixelRatio,1.5):Math.min(window.devicePixelRatio,1)}function vs(e){return e<=2?1:e<=4?2:3}function ys(e){return e<=2?24:e<=4?12:6}function bs(e){return e<=4}var xs=!1,Ss=!1;function Cs(){if(Ss||typeof window>`u`)return;Ss=!0;let e=navigator;typeof e.getBattery==`function`&&e.getBattery().then(e=>{let t=()=>{xs=!e.charging&&e.level<.2};t(),e.addEventListener(`chargingchange`,t),e.addEventListener(`levelchange`,t)}).catch(()=>{})}function ws(){return typeof window>`u`?!1:window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches||navigator.connection?.saveData?!0:xs}var Ts=typeof window<`u`&&new URLSearchParams(window.location.search).get(`fullrate`)===`1`,Es=typeof window<`u`&&new URLSearchParams(window.location.search).get(`rotate`)!==`0`,Ds=typeof window<`u`&&new URLSearchParams(window.location.search).get(`probe`)===`1`;function Os(e,t,n,r){let i=new Map;for(let t of e)i.set(t.id,t);let a=new Set,o=[];for(let e=0;e<t.length;e++){let s=t[e],c=s.audit_id??`${s.ts_ms}:${s.tool}:${e}`;a.add(c);let l=i.get(c);if(l)l.burst=s,l.exitingAt=void 0,o.push(l);else{let t=Go(s.ts_ms^e),i=n*.6+(t()-.5)*60,a=r/2+(t()-.5)*40,l=Ya(s);o.push({id:c,burst:s,ts_ms:s.ts_ms,session:l,x:i,y:a,vx:0,vy:0,age:0,tx:i,ty:a})}}let s=performance.now();for(let t of e)a.has(t.id)||(t.exitingAt??=s,s-t.exitingAt<1200&&o.push(t));return o}function ks(e){let{bursts:t,paused:n,selectedId:r,onSelect:i,burstSeq:a,compact:o=!1,activePanelCount:s=1,labelDensity:c=`normal`,onFrameTime:l}=e,u=(0,_.useRef)(l);u.current=l;let d=(0,_.useRef)(c);d.current=c;let f=(0,_.useRef)(null),p=(0,_.useRef)([]),m=(0,_.useRef)([]),h=(0,_.useRef)(null),g=(0,_.useRef)(null),v=(0,_.useRef)(0),y=(0,_.useRef)(0),b=(0,_.useRef)(0),x=(0,_.useRef)(new Map),S=(0,_.useRef)(new Set),C=(0,_.useRef)(new Set),w=(0,_.useRef)(new Set),[T,E]=(0,_.useState)({w:0,h:0}),D=(0,_.useRef)(0),O=(0,_.useRef)(0),ee=(0,_.useRef)(null),k=(0,_.useRef)(Date.now()),A=(0,_.useRef)(new Map),j=(0,_.useRef)({frame:0,cache:null});(0,_.useLayoutEffect)(()=>{let e=f.current?.parentElement;if(!e)return;let t=e.getBoundingClientRect();t.width>0&&t.height>0&&E({w:Math.max(40,t.width),h:Math.max(40,t.height)});let n=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;e<=0||n<=0||E({w:Math.max(40,e),h:Math.max(40,n)})}});return n.observe(e),()=>n.disconnect()},[]),(0,_.useEffect)(()=>{if(T.w<=0||T.h<=0)return;j.current.frame=0;let e=new Map;for(let t of p.current)e.set(t.id,t);p.current=Os(p.current,t,T.w,T.h),xo(p.current,T.w/2,T.h/2);let n=Es&&!st()?performance.now()*po:0;for(let t of p.current){if(t.slotR==null||t.slotPhi==null)continue;let r=T.w/2+t.slotR*Math.cos(t.slotPhi+n),i=T.h/2+t.slotR*Math.sin(t.slotPhi+n),a=!e.has(t.id),o=Math.hypot(t.x-r,t.y-i);(a||o>40)&&(t.x=r,t.y=i,t.vx=0,t.vy=0)}if(m.current=wo(p.current,1/0),!st())for(let t=0;t<p.current.length;t++){let n=p.current[t];!n||e.has(n.id)||Wo(n.burst.decision)}let r=p.current.reduce((e,t)=>t.ts_ms>e?t.ts_ms:e,0);y.current=Math.max(performance.now()+ds,performance.now()+Qa,r+1500),v.current=performance.now()},[t,T.w,T.h,a]),(0,_.useEffect)(()=>{let e=f.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;Cs();let i=performance.now(),a=0,c=0,l=0,g=.1,[_,E]=yr(()=>{let f=performance.now();if(!Ts&&ws()){if(a^=1,a===1)return}else a!==0&&(a=0);if(!Ts){let e=vs(s);if(e>1&&(O.current=(O.current+1)%e,O.current!==0))return}let _=performance.now(),E=_<y.current,D=_-v.current<200,te=_-b.current>500,ne=st(),re=Es&&!ne;if(!re&&!E&&!D&&!te)return;b.current=_;let M=f,N=Math.min(50,M-i);i=M;let ie=p.current,ae=m.current,oe=re?performance.now()*po:0;So(ie,T.w/2,T.h/2,oe);for(let e of ie)e.age<1&&(e.age=Math.min(1,e.age+N/ds));let P=typeof window<`u`?_s(s):1,F=T.w,I=T.h;(e.width!==F*P||e.height!==I*P)&&(e.width=F*P,e.height=I*P,e.style.width=`${F}px`,e.style.height=`${I}px`,t.scale(P,P)),t.fillStyle=`#0a0a0f`,t.fillRect(0,0,F,I);let se=`${F}x${I}`,L=ee.current?.key===se?ee.current.grad:null;if(L||(L=t.createRadialGradient(F/2,I/2,0,F/2,I/2,Math.max(F,I)/1.2),L.addColorStop(0,`rgba(56, 189, 248, 0.06)`),L.addColorStop(1,`rgba(0, 0, 0, 0)`),ee.current={key:se,grad:L}),t.fillStyle=L,t.fillRect(0,0,F,I),!o){let e=j.current;(e.frame++%6==0||e.cache===null)&&(e.cache=Co(ie));let n=e.cache;if(Yo(t,n,A.current),!ne){let e=new Map,r=new Map;for(let t of ie)t.exitingAt??(r.set(t.session,(r.get(t.session)??0)+1),e.set(t.session,t));let i=new Map;for(let e of ie){if(e.exitingAt!=null)continue;let t=i.get(e.session);(t===void 0||e.ts_ms<t)&&i.set(e.session,e.ts_ms)}let a=Date.now();for(let[o,s]of n){let n=e.get(o),c=r.get(o)??0;if(!n||c===0)continue;let l=50+Math.min(s.n,12)*7;ns(t,s.x,s.y-l-34,o,n.burst.tool,c,n.burst.decision);let u=i.get(o);if(u!==void 0){let e=Math.max(0,a-u);os(t,s.x,s.y+l+12,e,Jo(o))}}}}let ce=e=>e.exitingAt==null?1:Math.max(0,1-(M-e.exitingAt)/Qa),le=ys(s),ue=bs(s)&&!ne,de=S.current;if(de.clear(),n)for(let e of ie)de.add(e.id);else{let e=0;for(let t=ie.length-1;t>=0&&e<le;t--){let n=ie[t];!n||n.exitingAt!=null||(de.add(n.id),e++)}}let fe=x.current;fe.clear();for(let e of ie)fe.set(e.id,e);t.lineWidth=2,t.lineCap=`round`,t.lineJoin=`round`;for(let e=0;e<ae.length;e++){let n=ae[e],r=fe.get(n.source),i=fe.get(n.target);if(!r||!i||de.has(r.id)||de.has(i.id))continue;let a=Math.min(ce(r),ce(i));a<=0||(t.globalAlpha=a,t.strokeStyle=(Xa[i.burst.decision]??`#6b7280`)+`aa`,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(i.x,i.y),t.stroke())}t.globalAlpha=1;let pe=d.current===`large`,me=pe?`10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`8px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`;for(let e=0;e<ae.length;e++){let n=ae[e],r=fe.get(n.source),i=fe.get(n.target);if(!r||!i||!de.has(r.id)&&!de.has(i.id))continue;let a=Xa[i.burst.decision]??`#6b7280`,o=Math.min(ce(r),ce(i));if(o<=0)continue;if(t.globalAlpha=o,t.strokeStyle=a+`aa`,t.beginPath(),t.moveTo(r.x,r.y),t.lineTo(i.x,i.y),t.stroke(),t.globalAlpha=1,ue){let n=(M/gs+e*.618033)%1,s=r.x+(i.x-r.x)*n,c=r.y+(i.y-r.y)*n;t.save(),t.globalAlpha=o*Math.sin(n*Math.PI)*.9,t.fillStyle=a,t.beginPath(),t.arc(s,c,2.5,0,Math.PI*2),t.fill(),t.restore(),cs(t,r.x,r.y,i.x,i.y,a,o)}let s=i.ts_ms-r.ts_ms,c=s<1e3?`${s}ms`:s<6e4?`${(s/1e3).toFixed(1)}s`:`${Math.floor(s/6e4)}m${Math.floor(s%6e4/1e3)}s`,l=(r.x+i.x)/2,u=(r.y+i.y)/2;t.save(),t.globalAlpha=o*.65,t.font=me,t.fillStyle=`#94a3b8`,t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(`${e+1} · ${c}`,l,u-(pe?8:7)),t.restore()}t.globalAlpha=1;let R=C.current;R.clear();let he=w.current;he.clear();let ge=d.current===`large`?10:5;{let e=0;for(let t=ie.length-1;t>=0;t--){let r=ie[t];!r||r.exitingAt!=null||(!n&&e<3&&R.add(r.id),e<ge&&he.add(r.id),e++)}}let _e=r,ve=h.current;for(let e of ie){let r=ce(e);if(r<=0)continue;t.globalAlpha=r;let i=Math.min(1,e.age),a=fs(i);e.displayedRadius=o?4:to(e.burst);let s=e.displayedRadius,c=o?s*a:(s+2*Math.min(1,e.age))*a,l=Xa[e.burst.decision]??`#6b7280`,u=ro(l,no(e.burst));if((e.id===_e||e.id===ve)&&(t.beginPath(),t.arc(e.x,e.y,c+6,0,Math.PI*2),t.fillStyle=u+`33`,t.fill()),ue&&(e.burst.decision===`allow`?Xo(t,e.x,e.y,i,`#22c55e`,14,.3):e.burst.decision===`ask`&&Xo(t,e.x,e.y,i,`#f59e0b`,14,.45)),ue&&(e.burst.decision===`block`||e.burst.decision===`force`)){let n=i*ds;if(n<ps){let r=n/ps,i=c+16*ms(r),a=Math.max(0,1-r)*.75;t.beginPath(),t.arc(e.x,e.y,i,0,Math.PI*2),t.strokeStyle=u+Math.floor(a*255).toString(16).padStart(2,`0`),t.lineWidth=1.5,t.stroke()}}if(!ne&&R.has(e.id)&&(t.beginPath(),t.arc(e.x,e.y,c+2,0,Math.PI*2),t.fillStyle=u+`33`,t.fill()),t.beginPath(),t.arc(e.x,e.y,Math.max(.1,c),0,Math.PI*2),t.fillStyle=u,t.fill(),t.strokeStyle=l,t.lineWidth=1.5,t.beginPath(),t.arc(e.x,e.y,Math.max(.1,c),0,Math.PI*2),t.stroke(),he.has(e.id)&&(n||de.has(e.id))){let n=d.current===`large`;t.font=n?`11px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.textAlign=`center`,t.fillStyle=u+`cc`,t.fillText(qo(e.burst.client),e.x,e.y-c-(n?4:3));let i=n?16:12,a=e.burst.tool.length>i?e.burst.tool.slice(0,i):e.burst.tool,o=us(e.burst.tool),s=o===`·`?a:`${o} ${a}`;t.fillStyle=u+`88`,t.fillText(s,e.x,e.y+c+(n?13:11));let l=e.burst.input_tokens??0,f=e.burst.output_tokens??0;(l>0||f>0)&&(t.globalAlpha=r*(de.has(e.id)?.8:.35),t.font=n?`10px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`:`8px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.fillStyle=`#94a3b8`,t.textAlign=`center`,t.fillText(`↓${X(l)} ↑${X(f)}`,e.x,e.y+c+(n?25:21)),t.globalAlpha=r),t.textAlign=`left`}(e.id===_e||e.id===ve)&&(t.font=`11px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,t.fillStyle=`#e0e7ff`,t.fillText(e.burst.tool,e.x+c+6,e.y+3))}if(t.globalAlpha=1,ue&&ie.length>0){let e=null;for(let t=ie.length-1;t>=0;t--)if(ie[t].exitingAt==null){e=ie[t];break}let n=e?Date.now()-e.ts_ms:1/0,r=5e3;if(e&&n<=r){let i=Math.max(0,1-n/r),a=1100,o=M%a/a,s=14+hs.fn(o)*8,c=Math.max(0,1-o)*.85*i,l=Math.floor(c*255).toString(16).padStart(2,`0`);t.beginPath(),t.arc(e.x,e.y,s,0,Math.PI*2),t.strokeStyle=`#38bdf8${l}`,t.lineWidth=2,t.stroke();let u=M%800/800*Math.PI*2,d=100/360*Math.PI*2,f=.85*i,p=Math.floor(f*255).toString(16).padStart(2,`0`);t.save(),t.beginPath(),t.arc(e.x,e.y,22,u,u+d),t.strokeStyle=`#38bdf8${p}`,t.lineWidth=2.5,t.lineCap=`round`,t.stroke(),t.restore()}}if(!o&&F>220&&ss(t,F-12,12,Date.now()-k.current),Ds){let t,n=0;for(let e of ie)e.exitingAt??(n++,t||=e);e.dataset.probeCount=String(n),e.dataset.probeX0=(t?.x??0).toFixed(2),e.dataset.probeY0=(t?.y??0).toFixed(2)}c=c===0?N:c*(1-g)+N*g;let ye=u.current;ye&&M-l>250&&(l=M,ye(c))});return D.current=E,O.current=E,_},[n,r,T.w,T.h,o,s]);function te(e,t){let n=f.current;if(!n)return null;let r=n.getBoundingClientRect(),i=e-r.left,a=t-r.top,o=null,s=200;for(let e of p.current){let t=e.x-i,n=e.y-a,r=t*t+n*n;r<s&&(s=r,o=e.id)}return o}return(0,G.jsxs)(`div`,{className:`relative w-full h-full rounded-sm border border-[var(--color-line-1)] overflow-hidden bg-black`,children:[(0,G.jsx)(`canvas`,{ref:f,className:`block w-full h-full cursor-crosshair`,onMouseMove:e=>{let t=te(e.clientX,e.clientY);h.current=t;let n=g.current;if(!n)return;if(!t){n.style.display=`none`;return}let r=p.current.find(e=>e.id===t);if(!r){n.style.display=`none`;return}let i=r.burst,a=Xa[i.decision]??`#6b7280`,o;if(i.complete_duration_ms!=null&&i.complete_duration_ms>0){let e=i.complete_duration_ms;o=e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(0)}ms`}else{let e=i.duration_ns/1e6;o=e<1?`${(e*1e3).toFixed(0)}µs`:`${e.toFixed(1)}ms`}let s=[];i.input_tokens!=null&&s.push(`↓${X(i.input_tokens)}`),i.output_tokens!=null&&s.push(`↑${X(i.output_tokens)}`);let c=i.input_preview?` · "${i.input_preview.length>45?i.input_preview.slice(0,45)+`…`:i.input_preview}"`:``,l=s.length>0?` · ${s.join(` `)}`:``;n.textContent=`${i.decision} ${i.tool} · ${o}${l}${c}`,n.style.borderColor=a,n.style.color=a;let u=Math.min(e.clientX+14,window.innerWidth-420),d=Math.max(8,e.clientY-36);n.style.left=`${u}px`,n.style.top=`${d}px`,n.style.display=`block`},onMouseLeave:()=>{h.current=null,g.current&&(g.current.style.display=`none`)},onClick:e=>{i(te(e.clientX,e.clientY),{x:e.clientX,y:e.clientY})}}),t.length===0&&(0,G.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center pointer-events-none px-4 text-center`,children:[(0,G.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`graph · idle`}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] max-w-[260px]`,children:[`Each dot = one tool call an AI agent made.`,(0,G.jsx)(`br`,{}),`Color = the ssg rule decision · line = same agent's sequence.`]})]}),(0,G.jsx)(`div`,{ref:g,style:{display:`none`,position:`fixed`,zIndex:45,fontSize:`11px`,fontFamily:`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,padding:`4px 10px`,background:`rgba(10, 10, 15, 0.92)`,border:`1px solid`,borderRadius:`4px`,pointerEvents:`none`,whiteSpace:`nowrap`,maxWidth:`500px`,overflow:`hidden`,textOverflow:`ellipsis`}})]})}var As=3e4,js=6e4,Ms=5e3;function Ns(e,t){let n=t?e.filter(e=>Ya(e)===t):e,r=Date.now(),i=n.length>0?n[n.length-1]:null;if(!i||r-i.ts_ms>Ms||!i)return{idle:!0,client:``,tool:``,ruleId:null,decision:``,evalsPerSec:`0.0`,allowPct:0,agents:0,topRules:[]};let a=n.filter(e=>r-e.ts_ms<=As),o=a.filter(e=>e.decision===`allow`).length,s=a.length>0?Math.round(o/a.length*100):0,c=(a.length/(As/1e3)).toFixed(1),l=new Set(a.map(e=>`${e.client}:${e.agent_id??`solo`}`)).size,u=n.filter(e=>r-e.ts_ms<=js&&e.rule_id),d=new Map;for(let e of u){let t=e.rule_id;t&&d.set(t,(d.get(t)??0)+1)}let f=[...d.entries()].sort((e,t)=>t[1]-e[1]).slice(0,4).map(([e])=>e);return{idle:!1,client:i.client,tool:i.tool,ruleId:i.rule_id,decision:i.decision,evalsPerSec:c,allowPct:s,agents:l,topRules:f}}var Ps={allow:`ALLOW`,block:`BLOCK`,ask:`ASK`,log:`LOG`,force:`FORCE`,shadow:`SHADOW`},Fs={allow:`#22c55e`,block:`#ef4444`,ask:`#f59e0b`,log:`#60a5fa`,force:`#a855f7`,shadow:`#6b7280`};function Is({className:e,sessionKey:t}){let n=De(),r=Oe(),i=(0,_.useRef)(-1),a=(0,_.useRef)(null),o=(0,_.useMemo)(()=>{if(i.current===r&&a.current)return a.current;i.current=r;let e=Ns(n,t);return a.current=e,e},[n,r,t]),s=o.decision?Fs[o.decision]??`#6b7280`:`#6b7280`,c=o.decision?Ps[o.decision]??o.decision:``,l=o.client?qo(o.client):``;return o.idle?(0,G.jsxs)(`div`,{className:W(`pointer-events-none select-none`,`flex items-center justify-center gap-2`,`px-4 py-2 rounded-sm`,`bg-[#0a0a0f]/95`,`border border-[var(--color-line-1,#242424)]`,`font-mono text-[11px] text-[var(--color-fg-4,#5a6071)]`,e),children:[(0,G.jsx)(`span`,{className:`status-dot bg-[var(--color-fg-4)] pulse-soft`}),(0,G.jsx)(`span`,{className:`uppercase tracking-wider`,children:`waiting for activity`})]}):(0,G.jsxs)(`div`,{className:W(`pointer-events-none select-none`,`flex flex-col gap-1 px-4 py-2.5 rounded-sm`,`bg-[#0a0a0f]/96`,`border border-[var(--color-line-1,#242424)]`,`font-mono`,!t&&`min-w-[280px] max-w-[460px]`,e),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-widest text-[var(--color-fg-4,#5a6071)]`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),(0,G.jsx)(`span`,{children:`now evaluating`}),(0,G.jsxs)(`span`,{className:`ml-auto tabular-nums`,children:[o.evalsPerSec,`/s · `,o.allowPct,`% allow · `,o.agents,` `,o.agents===1?`agent`:`agents`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px] text-[var(--color-fg-0,#f5f5f5)] tracking-tight`,children:[(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] tabular-nums`,children:[`[`,l,`]`]}),(0,G.jsx)(`span`,{className:`text-sky-300`,children:o.client}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`·`}),(0,G.jsx)(`span`,{className:`text-white font-semibold`,children:o.tool}),o.ruleId&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`->`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] text-[12px]`,children:o.ruleId})]}),(0,G.jsx)(`span`,{className:`ml-auto text-[13px] font-bold tabular-nums`,style:{color:s},children:c})]}),o.topRules.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-[var(--color-fg-4)]`,children:[(0,G.jsx)(`span`,{className:`uppercase tracking-wider text-[9px]`,children:`rules`}),o.topRules.map(e=>(0,G.jsx)(`span`,{className:`px-1 py-0.5 rounded-sm bg-[var(--color-surface-2,#121212)] text-[var(--color-fg-3)]`,children:e},e))]})]})}var Ls=(0,_.memo)(function({sessionKey:e,bursts:t,activePanelCount:n,selectedId:r,onSelect:i}){let a=t.length>0?t[t.length-1]?.ts_ms??0:0,o=e.indexOf(`:`),s=o>=0?e.slice(0,o):e,c=o>=0?e.slice(o+1):``,l=c!==``&&c!==`solo`,u=t[t.length-1],d=u?Xa[u.decision]??`#6b7280`:`#6b7280`,f=(0,_.useMemo)(()=>t.length>24?t.slice(t.length-24):t,[t]);return(0,G.jsxs)(`div`,{className:`flex flex-col min-h-0 min-w-0 rounded-sm border border-[var(--color-line-1)] bg-black/30 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1 border-b border-[var(--color-line-1)] text-[10px] font-mono shrink-0`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{background:d},title:u?`latest decision: ${u.decision}`:``}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider truncate`,children:s}),l&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate`,children:c})]}),(0,G.jsxs)(`span`,{className:`ml-auto text-[var(--color-fg-4)] tabular-nums shrink-0`,children:[t.length,`n`]})]}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0 relative`,children:(0,G.jsx)(ks,{bursts:f,paused:!1,selectedId:r,onSelect:i,burstSeq:a,compact:!0,activePanelCount:n})})]})});function Rs(e){return e<=1?1:e<=4?2:3}function zs(){let e=De(),t=Oe(),[n,r]=(0,_.useState)(null),{isBurstActive:i}=qa(),a=(0,_.useMemo)(()=>uo(e,i,Date.now()),[e,i,t]),o=(0,_.useRef)(new Map),s=(0,_.useMemo)(()=>{let e=new Map;for(let t of a){let n=Ya(t),r=e.get(n);r?r.push(t):e.set(n,[t])}let t=o.current;for(let[n,r]of e){let i=t.get(n);i&&i.length===r.length&&i[i.length-1]===r[r.length-1]&&e.set(n,i)}return o.current=e,Array.from(e.entries()).sort((e,t)=>{let n=e[1][e[1].length-1]?.ts_ms??0;return(t[1][t[1].length-1]?.ts_ms??0)-n})},[a]),c=(0,_.useMemo)(()=>{let e=new Map;for(let t of a){let n=`${t.client}:${t.agent_id??`solo`}`,r=e.get(n);r?r.count+=1:e.set(n,{client:t.client,count:1})}return e},[a]),l=(0,_.useMemo)(()=>{let e={allow:0,block:0,ask:0,other:0};for(let t of a)t.decision===`allow`?e.allow++:t.decision===`block`||t.decision===`force`?e.block++:t.decision===`ask`?e.ask++:e.other++;return e},[a]),u=(0,_.useMemo)(()=>{let e=new Set,t=0;for(let n of a)n.rule_id&&(e.add(n.rule_id),t+=1);return{distinct:e.size,matched:t,topRule:e.values().next().value}},[a]),d=Rs(s.length);return(0,G.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,children:[(0,G.jsxs)(`header`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-[var(--color-line-1)]`,children:[(0,G.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`graph · live`}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),a.length]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] font-mono`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:Xa.allow}}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.allow}),(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Xa.block}}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.block}),(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ml-1`,style:{background:Xa.ask}}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums`,children:l.ask})]}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsxs)(`span`,{className:`chip text-violet-300 border-violet-500/30`,title:`${u.matched} tool calls matched ${u.distinct} ssg ${u.distinct===1?`rule`:`rules`} in active sessions`,children:[u.distinct,` `,u.distinct===1?`rule`:`rules`]}),(0,G.jsxs)(`span`,{className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)]`,title:c.size===0?`no active agents`:Array.from(c.entries()).map(([e,t])=>`${e}: ${t.count}`).join(`
10
+ `),children:[c.size,` `,c.size===1?`agent`:`agents`]}),(0,G.jsx)(`a`,{href:`/graph`,className:`text-[10px] font-mono uppercase tracking-wider text-sky-300 hover:text-sky-200`,title:`Open full /graph page`,children:`expand ↗`})]}),(0,G.jsxs)(`div`,{className:`flex-1 min-h-0 relative`,children:[s.length===0?(0,G.jsx)(ks,{bursts:a,paused:!1,selectedId:n,onSelect:r,burstSeq:t}):(0,G.jsx)(`div`,{className:`absolute inset-0 grid gap-1 p-1`,style:{gridTemplateColumns:`repeat(${d}, minmax(0, 1fr))`,gridAutoRows:`1fr`},children:s.map(([e,t])=>(0,G.jsx)(Ls,{sessionKey:e,bursts:t,activePanelCount:s.length,selectedId:n,onSelect:r},e))}),(0,G.jsx)(Is,{className:`absolute bottom-2 left-2 z-10 max-w-[calc(100%-1rem)]`})]})]})}var Bs=`ssg.sfx.enabled`;function Vs(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(Bs)===`true`}catch{return!1}}function Hs(e){if(!(typeof window>`u`))try{window.localStorage.setItem(Bs,String(e))}catch{}}function Us(e,t,n,r,i,a,o=`sine`){try{let s=e.createOscillator(),c=e.createGain(),l=i/1e3;s.type=o,s.frequency.setValueAtTime(n,e.currentTime),s.frequency.exponentialRampToValueAtTime(Math.max(1,r),e.currentTime+l),c.gain.setValueAtTime(a,e.currentTime),c.gain.exponentialRampToValueAtTime(.001,e.currentTime+l),s.connect(c),c.connect(t),s.start(e.currentTime),s.stop(e.currentTime+l+.02)}catch{}}function Ws(){let[e,t]=(0,_.useState)(Vs),n=(0,_.useRef)(null),r=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=()=>{let t=n.current;t&&(document.hidden?t.suspend().catch(()=>{}):e&&t.resume().catch(()=>{}))};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e]),{enabled:e,toggle:(0,_.useCallback)(()=>{t(e=>{let t=!e;if(Hs(t),t){if(!n.current)try{let e=new AudioContext,t=e.createGain();t.gain.value=.8,t.connect(e.destination),n.current=e,r.current=t}catch{}n.current?.resume().catch(()=>{})}else n.current?.suspend().catch(()=>{});return t})},[]),play:(0,_.useCallback)(t=>{if(!e)return;let i=n.current,a=r.current;if(!(!i||!a||i.state===`suspended`))switch(t){case`block`:Us(i,a,110,55,150,.08);break;case`force`:Us(i,a,80,40,200,.1),Us(i,a,160,80,200,.05,`square`);break;case`milestone`:{Us(i,a,660,880,100,.06);let e=i,t=a;setTimeout(()=>{e.state!==`suspended`&&Us(e,t,880,1320,100,.05)},115);break}case`record`:Us(i,a,880,1320,350,.07);break}},[e])}}var Gs=[`rules-changed`,`activity-updated`,`pending-changed`,`runtime-tick`,`limits-breach`],Ks={critical:{border:`border-l-red-500/70`,iconBg:`bg-red-500/15`,iconFg:`text-red-400`,chipBg:`bg-red-500/10`,chipFg:`text-red-300`,label:`Critical`},warning:{border:`border-l-amber-400/70`,iconBg:`bg-amber-500/15`,iconFg:`text-amber-300`,chipBg:`bg-amber-500/10`,chipFg:`text-amber-200`,label:`Heads up`},info:{border:`border-l-sky-500/70`,iconBg:`bg-sky-500/15`,iconFg:`text-sky-300`,chipBg:`bg-sky-500/10`,chipFg:`text-sky-200`,label:`Tip`}};function qs({severity:e}){return e===`critical`?(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,G.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,G.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}):e===`warning`?(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),(0,G.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}):(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,G.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`12`}),(0,G.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12.01`,y2:`8`})]})}function Js({notification:e,onAction:t}){let[n,r]=(0,_.useState)(`idle`),[i,a]=(0,_.useState)(null),o=Ks[e.severity],s=async()=>{if(e.action&&!(e.action.confirm&&!confirm(e.action.confirm))){r(`loading`),a(null);try{await t(e),r(`done`)}catch(e){r(`error`),a(e instanceof Error?e.message:String(e))}}};return(0,G.jsxs)(`div`,{className:`hig-card border-l-2 ${o.border} flex items-start gap-3 px-3 py-2.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0 mt-0.5 inline-flex items-center justify-center w-6 h-6 rounded-full ${o.iconBg} ${o.iconFg}`,"aria-hidden":!0,children:(0,G.jsx)(qs,{severity:e.severity})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`text-[9px] font-mono font-medium uppercase tracking-wider px-1.5 py-0.5 rounded ${o.chipBg} ${o.chipFg}`,children:o.label}),(0,G.jsx)(`h3`,{className:`text-[13px] font-medium text-[var(--color-fg-0)] leading-tight`,children:e.title})]}),(0,G.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:e.detail}),n===`error`&&i&&(0,G.jsxs)(`p`,{className:`mt-1.5 text-[11px] font-mono text-red-300`,children:[`Failed: `,i]}),n===`done`&&(0,G.jsx)(`p`,{className:`mt-1.5 text-[11px] font-mono text-emerald-300`,children:`✓ Done — refreshing…`})]}),(0,G.jsx)(`div`,{className:`shrink-0 self-center`,children:e.action?(0,G.jsx)(`button`,{type:`button`,onClick:s,disabled:n===`loading`||n===`done`,className:`inline-flex items-center gap-1 h-8 px-3 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-[var(--color-surface-2)] text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:bg-[var(--color-surface-3)] hover:border-[var(--color-line-2)] transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,children:n===`loading`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`animate-spin`,children:`⟳`}),` working…`]}):n===`done`?(0,G.jsx)(G.Fragment,{children:`✓ done`}):e.action.label}):e.link?(0,G.jsxs)(`a`,{href:e.link.href,className:`inline-flex items-center gap-1 h-8 px-3 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-[var(--color-surface-2)] text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:bg-[var(--color-surface-3)] hover:border-[var(--color-line-2)] transition-colors whitespace-nowrap`,children:[e.link.label,` →`]}):null})]})}function Ys({showEmptyState:e=!1,hideHeader:t=!1}={}){let n=Ae(Gs),{data:r,refetch:i}=B(`/api/json/maintenance`,[n[`rules-changed`],n[`activity-updated`],n[`pending-changed`],n[`runtime-tick`],n[`limits-breach`]]),a=async e=>{if(!e.action)return;let t=await fetch(e.action.url,{method:e.action.method,headers:{Accept:`application/json`,"Content-Type":`application/json`,...ke()}});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(e||`HTTP ${t.status}`)}setTimeout(()=>i(),600)},o=r?.notifications??[];return o.length===0&&!e?null:(0,G.jsxs)(`section`,{"data-reveal":!0,children:[!t&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,G.jsx)(`h2`,{className:`overline text-[11px]`,children:o.length===0?`maintenance · all clear`:`maintenance · ${o.length} item${o.length===1?``:`s`}`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>i(),className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] transition-colors cursor-pointer`,title:`Re-check now`,children:`refresh`})]}),o.length===0?(0,G.jsxs)(`div`,{className:`hig-card border-l-2 border-l-emerald-500/60 px-4 py-5 flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`inline-flex items-center justify-center w-8 h-8 rounded-full bg-emerald-500/15 text-emerald-300 shrink-0`,children:(0,G.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M20 6L9 17l-5-5`})})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-[13px] font-medium text-[var(--color-fg-0)] leading-tight`,children:`Everything looks good`}),(0,G.jsx)(`p`,{className:`mt-1 text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:`No drift, no capacity warnings, no stalled daemons. We'll let you know if anything changes.`})]})]}):(0,G.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,G.jsx)(Js,{notification:e,onAction:a},e.id))})]})}function Xs(e){return!Number.isFinite(e)||e<=0?`—`:e<1e3?`${e} ns`:e<1e6?`${(e/1e3).toFixed(1)} µs`:`${(e/1e6).toFixed(2)} ms`}async function Zs(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:ke()})}var Qs=e=>!0,$s=e=>e.decision===`allow`,ec=e=>e.decision===`block`,tc=e=>e.decision===`ask`,nc=e=>e.decision===`force`,rc=e=>e.decision===`log`;function ic(){let e=new Date;return e.setHours(0,0,0,0),e.getTime()}function ac(){let e=Ae([`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`]),t=Ee(),n=Oe(),r=De(),i=Ws();(0,_.useEffect)(()=>{t&&(t.decision===`block`?i.play(`block`):t.decision===`force`&&i.play(`force`))},[n]);let[a,o]=(0,_.useState)(()=>ic());(0,_.useEffect)(()=>{let e=()=>{if(document.visibilityState!==`visible`)return;let e=ic();o(t=>e===t?t:e)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);let{data:s}=B(`/api/state/counters?since_ms=${a}`,[e[`counters-updated`],a]),{data:c}=B(`/api/state/runtime`,[e[`runtime-tick`]]),{data:l}=B(`/api/json/limits`,[e[`runtime-tick`]]),{data:u,refetch:d}=B(`/api/json/pending`,[e[`pending-changed`]]),{data:f}=B(`/api/json/blocked`,[e[`activity-updated`]]),p=Wa(),[m,h]=(0,_.useState)(!1),g=(0,_.useMemo)(()=>{let e=s?.allow??0,n=s?.block??0,r=s?.ask??0,i=s?.log??0,a=s?.force??0,o=e+n+r+i+a,c=t?.counters.total??0;return t&&c>=o&&t?{allow:t.counters.allow,block:t.counters.block,ask:t.counters.ask,log:t.counters.log,force:t.counters.force,shadow:t.counters.shadow,total:t.counters.total}:{allow:e,block:n,ask:r,log:i,force:a,shadow:0,total:o}},[t,s]),v=(0,_.useMemo)(()=>{if(r.length===0)return 0;let e=Date.now()-1e4;return r.filter(t=>t.ts_ms>=e).length/10},[r]),y=c?.history?.cpu_pct??[],b=c?.history?.memory_rss_mb??[],x=[],S=c?.latency,C=(0,_.useMemo)(()=>({"hero-metrics":()=>(0,G.jsx)(`div`,{className:`grid-bleed rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 h-full`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 h-full`,children:[(0,G.jsx)(kr,{label:`Total`,value:g.total,tone:`amber`,sub:t?Xs(t.duration_ns):void 0,burstRing:r,filter:Qs}),(0,G.jsx)(kr,{label:`Allow`,value:g.allow,tone:`green`,burstRing:r,filter:$s}),(0,G.jsx)(kr,{label:`Block`,value:g.block,tone:`red`,burstRing:r,filter:ec}),(0,G.jsx)(kr,{label:`Ask`,value:g.ask,tone:`amber`,burstRing:r,filter:tc}),(0,G.jsx)(kr,{label:`Force`,value:g.force,tone:`blue`,burstRing:r,filter:nc}),(0,G.jsx)(kr,{label:`Log`,value:g.log,tone:`purple`,burstRing:r,filter:rc})]})}),graph:()=>(0,G.jsx)(zs,{}),"latency-trace":()=>(0,G.jsx)($r,{latency:S,bursts:r,gaugeMaxMs:10,windowMs:3e4,trendWindowSec:60,gaugeSize:200}),throughput:()=>(0,G.jsxs)(K,{className:`h-full`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline`,children:`throughput · evals/s`}),(0,G.jsxs)(cr,{variant:`blue`,children:[v.toFixed(1),`/s`]})]}),(0,G.jsxs)(J,{children:[(0,G.jsx)(xr,{value:v,width:360,height:96,windowMs:6e4,className:`w-full`}),(0,G.jsx)(`p`,{className:`overline mt-2 text-center`,children:`60-second rolling window`})]})]}),"decision-mix":()=>(0,G.jsxs)(K,{className:`h-full`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline`,children:`decision mix`}),(0,G.jsx)(cr,{variant:`gray`,children:g.total.toLocaleString()})]}),(0,G.jsx)(J,{children:(0,G.jsx)(ni,{counters:{allow:g.allow,block:g.block,ask:g.ask,log:g.log,force:g.force,shadow:g.shadow}})})]}),"telemetry-feed":()=>(0,G.jsxs)(K,{variant:`flush`,className:`h-full flex flex-col`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline`,children:`telemetry · live · newest first`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:[`hover to pause · scroll for history · `,r.length,` events buffered`]})]}),(0,G.jsx)(J,{className:`p-0 flex-1 min-h-0`,children:(0,G.jsx)(Ti,{variant:`decision`,bursts:r,windowSize:80,height:360,className:`border-0 rounded-none`})})]}),"system-pulse":()=>(0,G.jsx)(si,{cpuPct:c?.cpu_pct??0,cpuSeries:y,cpuLimit:l?.config.cpuLimitPct,memMb:c?.memory_rss_mb??0,memSeries:b,memLimit:l?.config.memoryLimitMb,heapUsedMb:c?.heap_used_mb??0,heapTotalMb:c?.heap_total_mb??0,heapSeries:x,uptimeSec:(c?.uptime_ms??0)/1e3}),"pending-approvals":()=>(0,G.jsxs)(K,{className:`h-full`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline`,children:`pending approvals`}),(0,G.jsx)(cr,{variant:u&&u.length>0?`amber`:`gray`,children:u?.length??0})]}),(0,G.jsx)(J,{children:u&&u.length>0?(0,G.jsx)(`ul`,{className:`space-y-2`,children:u.slice(0,5).map(e=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-2 border-b border-[var(--color-line-0)] last:border-b-0 py-1.5 text-[12px] font-mono`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`text-[var(--color-fg-1)] truncate`,children:[e.toolCall.tool,` · `,e.ruleId]}),(0,G.jsx)(`div`,{className:`text-[var(--color-fg-3)] text-[11px] truncate`,children:ir(e.toolCall.tool,JSON.stringify(e.toolCall.input??{}))})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 shrink-0`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`primary`,onClick:()=>Zs(e.id,`allow`).then(d),children:`allow`}),(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,onClick:()=>Zs(e.id,`block`).then(d),children:`block`})]})]},e.id))}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no pending approvals —`})})]}),"recent-blocks":()=>(0,G.jsxs)(K,{className:`h-full`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline`,children:`recent blocks & forces`}),(0,G.jsx)(cr,{variant:f&&f.length>0?`red`:`gray`,children:f?.length??0})]}),(0,G.jsx)(J,{children:f&&f.length>0?(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:f.slice(0,6).map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-center gap-2 text-[12px] font-mono border-b border-[var(--color-line-0)] last:border-b-0 py-1.5`,children:[(0,G.jsx)(cr,{variant:e.decision===`force`?`amber`:`red`,children:e.decision}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate flex-1`,children:ir(e.tool,e.input)}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate text-[11px] max-w-[120px]`,children:e.rule_id??`—`})]},`${e.timestamp}-${t}`))}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] py-3 text-center`,children:`— no recent blocks —`})})]})}),[g,t,r,S,v,c,y,b,x,l,u,f,d]),w=Et({from:`first`,translateY:22,durationMs:640,staggerMs:80,maxStaggerMs:520});return(0,G.jsxs)(`div`,{ref:m?void 0:w,className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex-1`,children:(0,G.jsx)(aa,{manager:p,isEditing:m,onToggleEditing:h})}),(0,G.jsx)(`button`,{type:`button`,onClick:i.toggle,className:`chip cursor-pointer hover:border-sky-500/50 hover:text-sky-300 transition-colors shrink-0`,title:i.enabled?`Mute stream sounds`:`Enable stream sounds`,children:i.enabled?`SFX ON`:`SFX OFF`})]}),(0,G.jsx)(Ys,{}),(0,G.jsx)(ia,{panels:p.activeLayout.panels,isEditing:m,renderers:C,onPanelsChange:p.updateActivePanels})]})}function oc({val:e}){return e==null?(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic font-mono text-xs`,children:`null`}):typeof e==`boolean`?(0,G.jsx)(`span`,{className:`inline-block font-mono text-[10px] font-medium uppercase tracking-wider px-1.5 py-0.5 rounded-sm border ${e?`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`:`bg-red-500/8 text-red-300 border-red-500/25`}`,children:e.toString()}):typeof e==`number`?(0,G.jsx)(`span`,{className:`font-mono tabular-nums text-violet-300 text-xs`,children:e}):typeof e==`string`?e.length===0?(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] italic text-xs font-mono`,children:`empty string`}):e.length>200?(0,G.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 max-h-40 overflow-y-auto`,children:e}):(0,G.jsx)(`span`,{className:`font-mono text-xs text-[var(--color-fg-1)] break-all`,children:e}):(0,G.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 max-h-40 overflow-y-auto`,children:JSON.stringify(e,null,2)})}function sc({inputJson:e}){let t=[];try{let n=JSON.parse(e);n&&typeof n==`object`&&!Array.isArray(n)&&(t=Object.entries(n))}catch{return(0,G.jsx)(`pre`,{className:`text-[11px] font-mono text-[var(--color-fg-1)] whitespace-pre-wrap break-all bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2`,children:e})}return t.length===0?(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs italic font-mono`,children:`no input fields`}):(0,G.jsx)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] overflow-hidden text-xs`,children:t.map(([e,t],n)=>(0,G.jsxs)(`div`,{className:`flex gap-0 ${n>0?`border-t border-[var(--color-line-0)]`:``}`,children:[(0,G.jsx)(`div`,{className:`w-40 shrink-0 px-3 py-2 bg-[var(--color-surface-0)] text-[var(--color-fg-3)] font-mono text-[11px] border-r border-[var(--color-line-0)] select-none`,children:e}),(0,G.jsx)(`div`,{className:`flex-1 min-w-0 px-3 py-2 leading-relaxed`,children:(0,G.jsx)(oc,{val:t})})]},e))})}var cc={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},lc={allow:`Allowed`,block:`Blocked`,force:`Forced`,ask:`Held`,log:`Logged`},uc={allow:`border-l-emerald-500/60`,block:`border-l-red-500/60`,force:`border-l-amber-400/60`,ask:`border-l-sky-500/60`,log:`border-l-[var(--color-line-2)]`};function dc(e){return e==null?null:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}function fc({label:e,value:t,mono:n,children:r}){return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline mb-1`,children:e}),r??(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] text-xs ${n?`font-mono`:``} break-all`,children:t??`—`})]})}function pc({text:e}){let[t,n]=(0,_.useState)(!1);return(0,G.jsx)(`button`,{onClick:async t=>{t.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-[var(--color-line-1)] hover:border-[var(--color-line-2)] rounded-sm px-2 py-1 transition-colors cursor-pointer`,children:t?`✓ copied`:`copy json`})}function mc({row:e,defaultExpanded:t=!1}){let[n,r]=(0,_.useState)(t),i=(0,_.useRef)(null),a=(0,_.useRef)(!0),o=ir(e.tool,e.input),s=o&&o.length>0?o:e.input&&e.input!==`{}`&&e.input!==``?e.input:`—`,c=cc[e.decision]??`gray`,l=uc[e.decision]??`border-l-[var(--color-line-2)]`,u=rr(e.timestamp),d=dc(e.duration_ns),f=yi(e.tool,e.input);(0,_.useEffect)(()=>{let e=i.current;if(e){if(a.current){a.current=!1,n||(e.style.maxHeight=`0`,e.style.opacity=`0`);return}if(st()){e.style.maxHeight=n?`none`:`0`,e.style.opacity=n?`1`:`0`;return}if(n){let t=e.scrollHeight;Tt(e,{"max-height":[`0px`,`${t}px`],opacity:[0,1],translateY:[-6,0],duration:260,ease:`outCubic`,onComplete:()=>{e.style.maxHeight=`none`}})}else{let t=e.scrollHeight;Tt(e,{"max-height":[`${t}px`,`0px`],opacity:[1,0],duration:180,ease:`outCubic`})}}},[n]);let p=(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})();return(0,G.jsxs)(`div`,{className:`border border-[var(--color-line-1)] border-l-2 ${l} rounded-sm bg-[var(--color-surface-1)] overflow-hidden transition-colors hover:border-[var(--color-line-2)] hover:border-l-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer select-none group`,onClick:()=>r(e=>!e),role:`button`,"aria-expanded":n,children:[(0,G.jsx)(`svg`,{className:`shrink-0 w-3 text-[var(--color-fg-4)] group-hover:text-[var(--color-fg-2)] transition-all ${n?`rotate-90`:``}`,width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),(0,G.jsx)(`time`,{className:`shrink-0 font-mono text-[11px] text-[var(--color-fg-3)] w-14 tabular-nums`,title:u,dateTime:new Date(e.timestamp*1e3).toISOString(),children:nr(e.timestamp)}),(0,G.jsx)(cr,{variant:c,className:`shrink-0 w-20 justify-center`,children:lc[e.decision]??e.decision}),(0,G.jsxs)(`span`,{className:`flex-1 min-w-0 flex items-baseline gap-2`,title:`${f.headline} · ${e.tool}`,children:[(0,G.jsx)(`span`,{className:`text-[12px] text-[var(--color-fg-0)] font-medium truncate`,children:f.headline}),!fi(e.tool)&&s!==`—`&&(0,G.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)] font-mono truncate hidden sm:inline`,title:s,children:s})]}),d&&(0,G.jsx)(`span`,{className:`shrink-0 hidden md:inline w-12 text-right font-mono text-[10px] text-[var(--color-fg-4)] tabular-nums`,title:`Eval latency: ${d}`,children:d}),(0,G.jsx)(`span`,{className:`shrink-0 w-24 text-right text-[10px] text-[var(--color-fg-3)] truncate`,title:e.client?`Adapter: ${e.client}`:`Unidentified caller`,children:di(e.client)})]}),(0,G.jsx)(`div`,{ref:i,className:`border-t border-[var(--color-line-0)] overflow-hidden`,style:{maxHeight:n?`none`:`0`,opacity:n?1:0},"aria-hidden":!n,children:n&&(0,G.jsxs)(`div`,{className:`px-3 py-3 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-3`,children:[(0,G.jsx)(fc,{label:`When`,value:u}),(0,G.jsx)(fc,{label:`Decision`,children:(0,G.jsx)(cr,{variant:c,children:lc[e.decision]??e.decision})}),(0,G.jsx)(fc,{label:`Action`,children:(0,G.jsxs)(`span`,{className:`text-xs text-[var(--color-fg-1)]`,children:[f.headline,(0,G.jsxs)(`span`,{className:`ml-2 text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`(`,e.tool,`)`]})]})}),e.client&&(0,G.jsx)(fc,{label:`AI agent`,value:di(e.client)}),e.rule_id&&(0,G.jsx)(fc,{label:`Rule ID`,children:(0,G.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-xs text-[var(--color-brand)] hover:underline font-mono`,onClick:e=>e.stopPropagation(),children:e.rule_id})}),e.source_file&&(0,G.jsx)(fc,{label:`Source File`,value:e.source_file,mono:!0}),d&&(0,G.jsx)(fc,{label:`Latency`,value:d,mono:!0}),e.rules_evaluated!=null&&(0,G.jsx)(fc,{label:`Rules Evaluated`,value:`${e.rules_evaluated}`,mono:!0})]}),(0,G.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-3 py-2.5`,children:[(0,G.jsx)(`div`,{className:`overline mb-1`,children:`In plain English`}),(0,G.jsx)(`div`,{className:`text-xs font-medium text-[var(--color-fg-1)] mb-1`,children:f.headline}),(0,G.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] leading-relaxed`,children:f.detail})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline mb-2`,children:`Tool Input`}),(0,G.jsx)(sc,{inputJson:e.input})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.rule_id?(0,G.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-brand)]/70 hover:text-[var(--color-brand)] transition-colors`,onClick:e=>e.stopPropagation(),children:`→ view rule`}):(0,G.jsx)(`span`,{}),(0,G.jsx)(pc,{text:p})]})]})})]})}function hc({className:e,children:t,...n}){return(0,G.jsx)(`pre`,{className:W(`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-3 py-2 text-[11px] leading-relaxed font-mono text-[var(--color-fg-1)] overflow-x-auto whitespace-pre-wrap break-all`,e),...n,children:t})}var gc={neutral:`text-[var(--color-fg-0)]`,green:`text-emerald-300`,red:`text-red-300`,amber:`text-amber-300`,blue:`text-sky-300`,purple:`text-violet-300`,gray:`text-[var(--color-fg-3)]`},_c={neutral:`bg-[var(--color-fg-3)]`,green:`bg-emerald-500`,red:`bg-red-500`,amber:`bg-[var(--color-brand)]`,blue:`bg-sky-500`,purple:`bg-violet-500`,gray:`bg-[var(--color-line-2)]`},vc=[{label:`User code`,color:`#451a03`},{label:`Runtime (bun:/node:)`,color:`#172554`},{label:`Native/other`,color:`#1f2937`},{label:`GC/idle`,color:`#450a0a`}],yc={neutral:`#d0d0d0`,green:`#34d399`,red:`#f87171`,amber:`#fbbf24`,blue:`#38bdf8`,purple:`#a78bfa`,gray:`#6e7076`};function bc({label:e,value:t,sub:n,tone:r=`neutral`,align:i=`left`,labelPlacement:a=`above`,labelClassName:o,valueClassName:s,subClassName:c,trend:l,trendColor:u}){let d=(0,G.jsx)(`div`,{className:W(a===`above`?`overline mb-1.5`:`mt-1 text-[11px] text-[var(--color-fg-3)]`,o),children:e}),f=(0,G.jsx)(`div`,{className:W(`font-mono font-medium tabular-nums`,i===`center`&&`text-center`,gc[r],s),children:t}),p=l&&l.length>1,m=u??yc[r];return(0,G.jsxs)(G.Fragment,{children:[a===`above`&&d,p?(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[f,(0,G.jsx)(mr,{data:l,width:48,height:18,color:m})]}):f,a===`below`&&d,n&&(0,G.jsx)(`div`,{className:W(`mt-1 text-[10px] font-mono text-[var(--color-fg-3)]`,i===`center`&&`text-center`,c),children:n})]})}function xc({className:e,contentClassName:t,label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u,trend:d,trendColor:f,...p}){return(0,G.jsx)(K,{className:e,...p,children:(0,G.jsx)(J,{className:W(`py-3`,o===`center`&&`text-center`,t),children:(0,G.jsx)(bc,{label:n,value:r,sub:i,tone:a,align:o,labelPlacement:s,labelClassName:c,valueClassName:l,subClassName:u,trend:d,trendColor:f})})})}function Sc({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)] p-3`,t.align===`center`&&`text-center`,e),children:(0,G.jsx)(bc,{...t})})}function Cc({pct:e,tone:t=`green`,markerPct:n,className:r,barClassName:i,markerTitle:a}){let o=Math.max(0,Math.min(100,e)),s=n===void 0?null:Math.max(0,Math.min(100,n));return(0,G.jsxs)(`div`,{className:W(`relative w-full overflow-hidden rounded-sm bg-[var(--color-surface-3)]`,r),children:[(0,G.jsx)(`div`,{className:W(`h-full rounded-sm transition-all duration-500`,_c[t],i),style:{width:`${o}%`}}),s!==null&&(0,G.jsx)(`div`,{className:`absolute top-0 h-full w-0.5 bg-[var(--color-brand)]/70`,style:{left:`${s}%`},title:a})]})}function wc({label:e,value:t,tone:n=`neutral`,breached:r=!1,breachLabel:i=`limit exceeded`,trendData:a,trendColor:o,threshold:s,maxValue:c,footer:l,className:u,valueClassName:d}){return(0,G.jsxs)(K,{className:u,children:[(0,G.jsxs)(q,{className:`py-2`,children:[(0,G.jsx)(`span`,{className:`overline`,children:e}),r&&(0,G.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300`,children:i})]}),(0,G.jsxs)(J,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:W(`text-2xl font-mono font-medium tabular-nums`,gc[n],d),children:t}),(a?.length??0)>1&&o&&(0,G.jsx)(mr,{data:a??[],width:80,height:28,color:o,threshold:s,maxValue:c})]}),l]})]})}function Tc({profile:e,children:t}){return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,G.jsxs)(`span`,{children:[`nodes:`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.nodes.length})]}),(0,G.jsxs)(`span`,{children:[`duration:`,` `,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-1)]`,children:[((e.endTime-e.startTime)/1e3).toFixed(0),`ms`]})]}),(0,G.jsxs)(`span`,{children:[`samples:`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.samples?.length??0})]})]}),(0,G.jsx)(`div`,{className:`flex gap-3 text-[10px] font-mono text-[var(--color-fg-3)]`,children:vc.map(e=>(0,G.jsxs)(`span`,{className:`flex items-center`,children:[(0,G.jsx)(`span`,{className:`mr-1 inline-block h-2.5 w-2.5 rounded-[1px]`,style:{background:e.color}}),e.label]},e.label))}),t]})}function Ec({memory:e,formatValue:t}){return(0,G.jsx)(`div`,{className:`grid grid-cols-4 gap-3`,children:[{label:`RSS`,value:t(e.rss)},{label:`Heap Total`,value:t(e.heapTotal)},{label:`Heap Used`,value:t(e.heapUsed)},{label:`External`,value:t(e.external)}].map(e=>(0,G.jsx)(Sc,{align:`center`,label:e.label,value:e.value,valueClassName:`text-lg font-medium text-[var(--color-fg-0)]`},e.label))})}function Dc(e,t){let n=Array(t).fill(0);if(e.length===0)return n;let r=Date.now()-t*1e3;for(let i=e.length-1;i>=0;i--){let a=e[i];if(!a)continue;if(a.ts_ms<r)break;let o=Math.floor((a.ts_ms-r)/1e3);o>=0&&o<t&&n[o]++}return n}function Oc({bins:e=60,height:t=38,className:n}){let r=De(),i=(0,_.useRef)(null),a=(0,_.useRef)([]),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=i.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let s=Math.min(window.devicePixelRatio??1,2),c=st(),l=()=>{let i=Dc(r,e);if(a.current.length!==e)a.current=i.slice();else if(c)a.current=i;else for(let t=0;t<e;t++){let e=a.current[t]??0,n=i[t]??0;a.current[t]=e+(n-e)*.18}let u=t.clientWidth,d=t.clientHeight;(t.width!==u*s||t.height!==d*s)&&(t.width=u*s,t.height=d*s,n.scale(s,s)),n.clearRect(0,0,u,d);let f=Math.max(1,...a.current),p=u/e;for(let t=0;t<e;t++){let e=a.current[t]??0,r=e/f*d,i=t*p,o=e/f;n.fillStyle=`rgba(${Math.round(56+o*199)},${Math.round(189-o*100)},${Math.round(248-o*200)},${.4+o*.55})`,n.fillRect(i+.5,d-r,Math.max(1,p-1),r)}n.strokeStyle=`rgba(148, 163, 184, 0.1)`,n.lineWidth=1,n.beginPath(),n.moveTo(0,d-.5),n.lineTo(u,d-.5),n.stroke(),o.current=requestAnimationFrame(l)};return o.current=requestAnimationFrame(l),()=>{o.current!==null&&cancelAnimationFrame(o.current),o.current=null}},[r,e]),(0,G.jsxs)(`div`,{className:W(`relative w-full`,n),style:{height:t},children:[(0,G.jsx)(`canvas`,{ref:i,className:`block w-full h-full`,style:{width:`100%`,height:`100%`}}),(0,G.jsxs)(`span`,{className:`absolute top-1 left-2 text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)] pointer-events-none`,children:[`bursts/sec · `,e,`s window`]})]})}var kc=8,Ac=6,jc=Math.PI*.75,Mc=Math.PI*2.25;function Nc({size:e=110,className:t}){let n=De(),r=(0,_.useRef)(null),i=(0,_.useRef)(0),a=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=r.current;if(!t)return;let o=t.getContext(`2d`);if(!o)return;let s=Math.min(window.devicePixelRatio??1,2),c=st(),l=()=>{let r=Date.now()-1500,u=0;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){if(t.ts_ms<r)break;u++}}let d=u/1.5,f=Math.min(1,d/kc);c?i.current=f:i.current+=(f-i.current)*.16;let p=e,m=e;(t.width!==p*s||t.height!==m*s)&&(t.width=p*s,t.height=m*s,t.style.width=`${p}px`,t.style.height=`${m}px`,o.scale(s,s)),o.clearRect(0,0,p,m);let h=p/2,g=m/2+4,_=p/2-8;o.lineWidth=6,o.lineCap=`round`,o.strokeStyle=`rgba(148, 163, 184, 0.18)`,o.beginPath(),o.arc(h,g,_,jc,Mc),o.stroke();let v=jc+Ac/kc*(Mc-jc);o.strokeStyle=`rgba(239, 68, 68, 0.45)`,o.beginPath(),o.arc(h,g,_,v,Mc),o.stroke();let y=jc+i.current*(Mc-jc),b=i.current*kc>=Ac;o.strokeStyle=b?`rgba(239, 68, 68, 0.95)`:`rgba(56, 189, 248, 0.92)`,o.lineWidth=6,o.beginPath(),o.arc(h,g,_,jc,y),o.stroke();let x=h+Math.cos(y)*(_-2),S=g+Math.sin(y)*(_-2);o.strokeStyle=b?`#fca5a5`:`#e0e7ff`,o.lineWidth=2,o.beginPath(),o.moveTo(h,g),o.lineTo(x,S),o.stroke(),o.fillStyle=b?`#fca5a5`:`#e0e7ff`,o.beginPath(),o.arc(h,g,3,0,Math.PI*2),o.fill(),o.fillStyle=b?`#fca5a5`:`#e0e7ff`,o.font=`bold 20px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,o.textAlign=`center`,o.fillText(d.toFixed(1),h,g+_*.55),o.fillStyle=`rgba(148, 163, 184, 0.85)`,o.font=`9px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,o.fillText(`eps`,h,g+_*.55+12),a.current=requestAnimationFrame(l)};return a.current=requestAnimationFrame(l),()=>{a.current!==null&&cancelAnimationFrame(a.current),a.current=null}},[n,e]),(0,G.jsx)(`canvas`,{ref:r,className:W(`block`,t),style:{width:e,height:e}})}var Pc={allow:`#22c55e`,block:`#ef4444`,force:`#a855f7`,ask:`#f59e0b`,log:`#60a5fa`,shadow:`#6b7280`},Fc=[`allow`,`block`,`force`,`ask`,`log`];function Ic({windowSec:e=30,height:t=14,className:n}){let r=De(),[i,a]=(0,_.useState)({}),o=(0,_.useRef)(null);(0,_.useEffect)(()=>{let t=st(),n=()=>{let i=Date.now()-e*1e3,s={},c=0;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t){if(t.ts_ms<i)break;s[t.decision]=(s[t.decision]??0)+1,c++}}let l={};for(let e of Fc)l[e]=c===0?0:(s[e]??0)/c;if(t){a(l);return}a(e=>{let t={};for(let n of Fc){let r=e[n]??0;t[n]=r+((l[n]??0)-r)*.22}return t}),o.current=requestAnimationFrame(n)};return o.current=requestAnimationFrame(n),()=>{o.current!==null&&cancelAnimationFrame(o.current),o.current=null}},[r,e]);let s=Fc.map(e=>({key:e,color:Pc[e]??`#6b7280`,pct:Math.max(0,i[e]??0)})),c=s.reduce((e,t)=>e+t.pct,0)===0;return(0,G.jsxs)(`div`,{className:W(`w-full`,n),children:[(0,G.jsx)(`div`,{className:`flex w-full overflow-hidden rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,style:{height:t},title:`decision mix · last ${e}s`,children:c?(0,G.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)]`,children:`— idle —`}):s.map(e=>(0,G.jsx)(`div`,{style:{width:`${e.pct*100}%`,background:e.color,transition:`width 240ms ease-out`},title:`${e.key} · ${(e.pct*100).toFixed(1)}%`},e.key))}),(0,G.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-0.5 text-[9px] font-mono uppercase tracking-widest text-[var(--color-fg-4)]`,children:s.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e.color}}),e.key,` · `,(e.pct*100).toFixed(0),`%`]},e.key))})]})}var Lc=3;function Rc(e){return e===null?`—`:e<1e6?`${(e/1e3).toFixed(0)}µs`:`${(e/1e6).toFixed(1)}ms`}var zc=[`counters-updated`,`activity-updated`,`pending-changed`,`runtime-tick`,`limits-breach`];function Bc({info:e}){let t=e.tier===`pro`||e.tier===`enterprise`,n=e.status===`needs_reauth`,r=e.pct_used??0,i=r>=90?`bg-red-500`:r>=70?`bg-amber-500`:`bg-emerald-500`;return(0,G.jsxs)(K,{className:n?`border-l-2 border-l-amber-500/70`:t?`border-l-2 border-l-emerald-500/70`:`border-l-2 border-l-sky-500/70`,children:[(0,G.jsxs)(q,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`license`}),(0,G.jsx)(cr,{variant:t?`green`:n?`amber`:`blue`,children:e.tier_label}),e.fleet_enrolled&&(0,G.jsx)(cr,{variant:`gray`,children:`fleet`})]}),e.email&&(0,G.jsx)(`span`,{className:`text-xs text-[var(--color-fg-3)]`,children:e.email})]}),(0,G.jsxs)(J,{className:`space-y-3`,children:[n&&e.detail&&(0,G.jsxs)(`div`,{className:`rounded border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:[e.detail,` — run `,(0,G.jsx)(`code`,{className:`font-mono`,children:`ssg auth login`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs text-[var(--color-fg-2)]`,children:[(0,G.jsx)(`span`,{children:`evals today`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(pr,{value:e.evals_today,curve:`spring`}),e.eval_daily_limit!==null&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` / `}),e.eval_daily_limit.toLocaleString()]}),e.eval_daily_limit===null&&(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:` · unlimited`})]})]}),e.eval_daily_limit!==null&&(0,G.jsx)(`div`,{className:`mt-1 h-1.5 w-full overflow-hidden rounded-full bg-[var(--color-bg-2)]`,children:(0,G.jsx)(`div`,{className:`h-full transition-all duration-700 ease-out ${i}`,style:{width:`${r}%`}})})]}),!t&&(0,G.jsxs)(`a`,{href:e.upgrade_url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-[var(--color-brand)] hover:underline`,children:[`Upgrade to Pro · $`,e.pricing.pro_monthly_usd,`/mo →`]}),t&&e.retention_days>0&&(0,G.jsxs)(`div`,{className:`text-[10px] text-[var(--color-fg-3)] font-mono uppercase tracking-wider`,children:[`cloud retention: `,e.retention_days,` days`]})]})]})}function Vc(e){return new Date(e*1e3).toLocaleTimeString()}function Hc(e,t=24){let n=(0,_.useRef)(null),[r,i]=(0,_.useState)([]);return(0,_.useEffect)(()=>{let r=n.current;if(n.current=e,r===null)return;let a=Math.max(0,e-r);i(e=>{let n=e.length>=t?e.slice(-(t-1)):e.slice();return n.push(a),n})},[e,t]),r}async function Uc(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:ke()})}async function Wc(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...ke()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function Gc(e,t){let n=await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...ke()},body:JSON.stringify({ruleId:e,file:t})});if(!n.ok)throw Error(`Toggle failed: ${n.status}`)}async function Kc(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({ruleId:e,file:t,decision:`ask`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}async function qc(e,t){let n=await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({ruleId:e,file:t,decision:`block`})});if(!n.ok)throw Error(`Update decision failed: ${n.status}`)}function Jc({ruleId:e}){return e?(0,G.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e)}`,className:`text-[var(--color-brand)] hover:underline text-xs font-mono break-all`,title:`Go to rule: ${e}`,children:e}):(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`—`})}function Yc({title:e,right:t}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,G.jsx)(`h2`,{className:`overline text-[11px]`,children:e}),t]})}function Xc({children:e}){return(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:e})}function Zc({item:e,onDisable:t,onChangeToAsk:n,onUndo:r}){let[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(`idle`),[c,l]=(0,_.useState)(!1),u=ir(e.tool,e.input),d=e.rule_id&&e.source_file,f=e.decision===`force`?`force`:`block`,p=f===`force`?`amber`:`red`,m=async()=>{s(`loading`);try{await n(),s(`done-ask`)}catch{s(`error`)}},h=async()=>{s(`loading`);try{await t(),s(`done-disable`)}catch{s(`error`)}},g=async()=>{l(!0);try{await r(o===`done-disable`?`disable`:`ask`),s(`idle`)}catch{}finally{l(!1)}},v=o===`done-ask`||o===`done-disable`;return(0,G.jsx)(K,{className:`border-l-2 ${v?`border-l-[var(--color-line-1)]`:f===`force`?`border-l-amber-400/60`:`border-l-red-500/60`} ${v?`opacity-60`:``}`,children:(0,G.jsxs)(`div`,{className:`px-3 py-3`,children:[v&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm px-2.5 py-1.5 mb-3 text-[11px] font-mono ${o===`done-ask`?`bg-sky-500/5 border border-sky-500/25 text-sky-300`:`bg-amber-500/5 border border-amber-500/25 text-amber-300`}`,children:[(0,G.jsx)(`span`,{className:`truncate`,children:o===`done-ask`?`✓ rule "${e.rule_id}" → ask · prompts next time`:`✓ rule "${e.rule_id}" disabled · no longer blocks`}),(0,G.jsx)(`button`,{onClick:g,disabled:c,className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-current/40 hover:bg-white/5 transition-colors cursor-pointer disabled:opacity-50 uppercase tracking-wider text-[10px]`,children:c?`…`:`↩ undo`})]}),o===`error`&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm px-2.5 py-1.5 mb-3 text-[11px] font-mono bg-red-500/5 border border-red-500/25 text-red-300`,children:[(0,G.jsx)(`span`,{children:`failed to update rule — check server logs`}),(0,G.jsx)(`button`,{onClick:()=>s(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-current/40 hover:bg-white/5 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`retry`})]}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5 flex-wrap`,children:[(0,G.jsx)(cr,{variant:v?o===`done-ask`?`blue`:`gray`:p,children:v?o===`done-ask`?`ask`:`disabled`:f}),(0,G.jsx)(`code`,{className:`text-[var(--color-brand)] text-xs font-mono`,children:e.tool}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-xs`,children:`·`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] text-[11px] font-mono tabular-nums`,children:Vc(e.timestamp)}),e.repeat_count>1&&(0,G.jsxs)(cr,{variant:`gray`,children:[`×`,e.repeat_count]})]}),(0,G.jsx)(`div`,{className:`text-xs font-mono truncate cursor-pointer hover:text-[var(--color-fg-0)] transition-colors ${v?`text-[var(--color-fg-4)] line-through`:`text-[var(--color-fg-1)]`}`,title:u,onClick:()=>a(e=>!e),children:u})]}),d&&!v&&o!==`error`&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pt-0.5`,children:[(0,G.jsxs)(`button`,{onClick:m,disabled:o===`loading`,className:`inline-flex items-center gap-1 h-7 px-2.5 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-sky-500/8 text-sky-300 border border-sky-500/25 hover:bg-sky-500/15 hover:border-sky-500/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,children:[o===`loading`?(0,G.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,G.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,G.jsx)(`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),`ask instead`]}),(0,G.jsxs)(`button`,{onClick:h,disabled:o===`loading`,className:`inline-flex items-center gap-1 h-7 px-2.5 rounded-sm text-[11px] font-medium uppercase tracking-wider bg-red-500/8 text-red-300 border border-red-500/25 hover:bg-red-500/15 hover:border-red-500/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,children:[o===`loading`?(0,G.jsx)(`span`,{className:`animate-spin`,children:`⟳`}):(0,G.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,G.jsx)(`line`,{x1:`15`,y1:`9`,x2:`9`,y2:`15`}),(0,G.jsx)(`line`,{x1:`9`,y1:`9`,x2:`15`,y2:`15`})]}),`disable rule`]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 mt-2 text-[11px] font-mono`,children:[e.rule_id&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),(0,G.jsx)(Jc,{ruleId:e.rule_id})]}),e.source_file&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`src`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:e.source_file})]}),e.rules_evaluated!==null&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`evals`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:e.rules_evaluated})]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`latency`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums`,children:Rc(e.duration_ns)})]}),(0,G.jsx)(`button`,{onClick:()=>a(e=>!e),className:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-0)] transition-colors ml-auto cursor-pointer uppercase tracking-wider text-[10px]`,children:i?`▾ hide`:`▸ details`})]}),i&&(0,G.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(`div`,{className:`overline mb-2`,children:`full input`}),(0,G.jsx)(hc,{children:(()=>{try{return JSON.stringify(JSON.parse(e.input),null,2)}catch{return e.input}})()})]})]})})}function Qc(){let e=Ae(zc),t=[e[`counters-updated`],e[`activity-updated`],e[`pending-changed`]],{data:n}=B(`/api/state/counters`,t),{data:r,refetch:i}=B(`/api/json/pending`,t),{data:a,refetch:o}=B(`/api/json/blocked`,t),{data:s}=B(`/api/state/activity`,t),{data:c}=B(`/api/state/runtime`,[e[`runtime-tick`]]),{data:l}=B(`/api/json/limits`,[e[`limits-breach`]]),{data:u}=B(`/api/json/license`,[e[`activity-updated`]]),[d,f]=(0,_.useState)(!1),p=a?.reduce((e,t)=>e+t.repeat_count,0)??0,m=n?.allow??0,h=(n?.block??0)+(n?.force??0),g=n?.force??0,v=n?.pending??0,y=n?.log??0,b=Hc(m),x=Hc(h),S=Hc(g),C=Hc(v),w=Hc(y),T=[{label:`allow`,value:m,tone:`green`,trend:b},{label:`block`,value:h,tone:`red`,trend:x},{label:`force`,value:g,tone:`amber`,trend:S},{label:`pending`,value:v,tone:`blue`,trend:C},{label:`log`,value:y,tone:`gray`,trend:w}];return(0,G.jsxs)(`div`,{ref:Et({from:`first`}),className:`space-y-8`,children:[(0,G.jsx)(Ys,{}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-5 gap-2`,children:T.map(e=>(0,G.jsx)(xc,{align:`left`,label:e.label,value:(0,G.jsx)(pr,{value:e.value,curve:`spring`}),tone:e.tone,labelPlacement:`above`,contentClassName:`py-3`,valueClassName:`text-2xl font-medium`,trend:e.trend,"data-reveal":!0},e.label))}),(0,G.jsxs)(`div`,{"data-reveal":!0,className:`grid grid-cols-12 gap-2 items-stretch`,children:[(0,G.jsxs)(`div`,{className:`col-span-12 md:col-span-7 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2 flex flex-col gap-2`,children:[(0,G.jsx)(Oc,{bins:60,height:42}),(0,G.jsx)(Ic,{windowSec:60,height:12})]}),(0,G.jsx)(`div`,{className:`col-span-12 md:col-span-5 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-3 py-2 flex items-center justify-center`,children:(0,G.jsx)(Nc,{size:130})})]}),u&&(0,G.jsx)(`div`,{"data-reveal":!0,children:(0,G.jsx)(Bc,{info:u})}),c&&(0,G.jsxs)(`div`,{"data-reveal":!0,className:`grid grid-cols-2 gap-2`,children:[(0,G.jsx)(wc,{label:`cpu`,value:c.cpu_pct==null?`—`:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pr,{value:c.cpu_pct,format:e=>Math.round(e).toString()}),`%`]}),tone:l?.breaches.cpu?`red`:(c.cpu_pct??0)>=60?`amber`:`green`,breached:l?.breaches.cpu??!1,trendData:c.history?.cpu_pct,trendColor:l?.breaches.cpu?`#f87171`:`#34d399`,threshold:l?.config.cpuLimitPct,maxValue:100,className:l?.breaches.cpu?`border-red-500/40`:``,footer:(0,G.jsx)(`a`,{href:`/monitor`,className:`mt-1 block text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`view details →`})}),(0,G.jsx)(wc,{label:`memory rss`,value:c.memory_rss_mb==null?`—`:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pr,{value:c.memory_rss_mb,format:e=>Math.round(e).toString()}),(0,G.jsx)(`span`,{className:`ml-1 text-sm text-[var(--color-fg-3)]`,children:`MB`})]}),tone:l?.breaches.memory?`red`:`neutral`,breached:l?.breaches.memory??!1,trendData:c.history?.memory_rss_mb,trendColor:l?.breaches.memory?`#f87171`:`#38bdf8`,threshold:l?.config.memoryLimitMb,className:l?.breaches.memory?`border-red-500/40`:``,footer:(0,G.jsx)(`a`,{href:`/monitor`,className:`mt-1 block text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`view details →`})})]}),(0,G.jsxs)(`section`,{"data-reveal":!0,children:[(0,G.jsx)(Yc,{title:`pending approvals`}),!r||r.length===0?(0,G.jsx)(Xc,{children:`no pending approvals`}):(0,G.jsx)(`div`,{className:`space-y-2`,children:r.map(e=>(0,G.jsxs)(K,{className:`border-l-2 border-l-sky-500/50`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`primary`,onClick:async()=>{await Uc(e.id,`allow`),i()},children:`approve`}),(0,G.jsx)(Y,{size:`sm`,variant:`danger`,onClick:async()=>{await Uc(e.id,`block`),i()},children:`deny`})]})]}),(0,G.jsxs)(J,{className:`space-y-2 text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`tool`}),(0,G.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool})]}),e.prompt&&(0,G.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,G.jsx)(`span`,{className:`overline pt-0.5`,children:`prompt`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] truncate`,children:e.prompt})]}),(0,G.jsx)(hc,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id))})]}),a&&a.length>0&&(0,G.jsxs)(`section`,{"data-reveal":!0,children:[(0,G.jsx)(Yc,{title:`blocked actions`,right:(0,G.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:[a.length,` active`,p>a.length?` · ${p} total hits`:``]})}),(0,G.jsx)(`div`,{className:`space-y-2`,children:(d?a:a.slice(0,Lc)).map(e=>(0,G.jsx)(Zc,{item:e,onDisable:async()=>{await Wc(e.rule_id,e.source_file),o()},onChangeToAsk:async()=>{await Kc(e.rule_id,e.source_file),o()},onUndo:async t=>{t===`disable`?await Gc(e.rule_id,e.source_file):await qc(e.rule_id,e.source_file),o()}},`${e.decision}:${e.rule_id??`none`}:${e.tool}:${e.timestamp}:${e.input}`))}),a.length>Lc&&(0,G.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,G.jsx)(Y,{size:`sm`,variant:`secondary`,onClick:()=>f(e=>!e),children:d?`↑ show less`:`↓ show ${a.length-Lc} more`})})]}),(0,G.jsxs)(`section`,{"data-reveal":!0,children:[(0,G.jsx)(Yc,{title:`recent audit log`,right:s&&s.length>0?(0,G.jsx)(`a`,{href:`/audit`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors`,children:`view all →`}):void 0}),!s||s.length===0?(0,G.jsx)(Xc,{children:`no audit entries yet`}):(0,G.jsx)(`div`,{className:`space-y-1.5`,children:s.slice(0,15).map(e=>(0,G.jsx)(mc,{row:e},e.id))})]})]})}function $c({checked:e,onChange:t,disabled:n,size:r=`md`,tone:i=`brand`,label:a}){return(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":a,disabled:n,onClick:()=>t(!e),className:`ss-toggle ${r===`sm`?`ss-toggle--sm`:``} ${i===`danger`?`ss-toggle--danger`:``}`,children:(0,G.jsx)(`span`,{className:`ss-toggle-thumb`,"aria-hidden":`true`})})}var el=new Map;async function tl(e){let t=el.get(e);if(t)return t.status===`ok`?t.data:t.status===`error`?null:t.promise;let n=(async()=>{try{let t=await fetch(`/api/json/rule-explain?ruleId=${encodeURIComponent(e)}`,{headers:{Accept:`application/json`}});if(!t.ok)return el.set(e,{status:`error`,error:`HTTP ${t.status}`}),null;let n=await t.json();return el.set(e,{status:`ok`,data:n}),n}catch(t){return el.set(e,{status:`error`,error:String(t)}),null}})();return el.set(e,{status:`loading`,promise:n}),n}var nl=220,rl=90;function il({ruleId:e,children:t,className:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=()=>{u.current&&clearTimeout(u.current),d.current&&clearTimeout(d.current),u.current=null,d.current=null},p=(0,_.useCallback)(()=>{let e=l.current;if(!e)return;let t=e.getBoundingClientRect(),n=t.left;n+320>window.innerWidth-12&&(n=Math.max(12,window.innerWidth-320-12));let r=t.bottom+8;r+200>window.innerHeight-12&&(r=Math.max(12,t.top-200-8)),c({top:r,left:n})},[]),m=(0,_.useCallback)(()=>{f(),u.current=setTimeout(()=>{p(),i(!0),tl(e).then(e=>{e&&o(e)});let t=el.get(e);t&&t.status===`ok`&&o(t.data)},nl)},[e,p]),h=(0,_.useCallback)(()=>{f(),d.current=setTimeout(()=>{i(!1)},rl)},[]);return(0,_.useEffect)(()=>{if(!r)return;let e=()=>p(),t=()=>p(),n=e=>{e.key===`Escape`&&i(!1)};return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,t),window.addEventListener(`keydown`,n),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,t),window.removeEventListener(`keydown`,n)}},[r,p]),(0,_.useEffect)(()=>()=>f(),[]),(0,G.jsxs)(`span`,{ref:l,className:`ss-rule-trigger${n?` `+n:``}`,onMouseEnter:m,onMouseLeave:h,onFocus:m,onBlur:h,tabIndex:0,"aria-describedby":r?`rule-popover-${e}`:void 0,children:[t,r&&s&&(0,G.jsx)(`span`,{id:`rule-popover-${e}`,role:`tooltip`,className:`ss-rule-popover`,style:{top:s.top,left:s.left},onMouseEnter:()=>f(),onMouseLeave:h,children:a?(0,G.jsx)(al,{data:a}):(0,G.jsx)(`span`,{className:`ss-rule-popover__loading`,children:`loading rule…`})})]})}function al({data:e}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`ss-rule-popover__head`,children:[(0,G.jsx)(`code`,{className:`ss-rule-popover__id`,children:e.ruleId}),(0,G.jsx)(`span`,{className:`ss-rule-popover__pill ss-rule-popover__pill--${e.decision}`,children:e.decision}),(0,G.jsx)(`span`,{className:`ss-rule-popover__state ss-rule-popover__state--${e.enabled?`on`:`off`}`,children:e.enabled?`ON`:`OFF`})]}),(0,G.jsx)(`strong`,{className:`ss-rule-popover__headline`,children:e.headline}),(0,G.jsx)(`span`,{className:`ss-rule-popover__summary`,children:e.summary}),e.conditions.length>1&&(0,G.jsxs)(`span`,{className:`ss-rule-popover__section`,children:[(0,G.jsx)(`span`,{className:`ss-rule-popover__label`,children:`Matches when`}),(0,G.jsx)(`ul`,{className:`ss-rule-popover__list`,children:e.conditions.map((e,t)=>(0,G.jsx)(`li`,{children:e},t))})]}),e.hints.length>0&&(0,G.jsx)(`span`,{className:`ss-rule-popover__hints`,children:e.hints.map((e,t)=>(0,G.jsx)(`span`,{className:`ss-rule-popover__hint`,children:e},t))}),(0,G.jsx)(`span`,{className:`ss-rule-popover__foot`,children:(0,G.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.ruleId)}`,className:`ss-rule-popover__link`,children:`Open in Rules →`})})]})}var ol=[`rules-changed`],sl=[`block`,`ask`,`log`,`allow`,`force`,`shadow`],cl={block:`text-red-300`,deny:`text-red-300`,ask:`text-sky-300`,allow:`text-emerald-300`,log:`text-[var(--color-fg-3)]`,force:`text-amber-300`,shadow:`text-violet-300`};async function ll(e,t){await fetch(`/api/rules/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...ke()},body:JSON.stringify({ruleId:e,file:t})})}async function ul(e,t,n){await fetch(`/api/rules/update-decision`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({ruleId:e,file:t,decision:n})})}function dl({rule:e,file:t,onToggle:n}){let[r,i]=(0,_.useState)(!1);return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider ${e.enabled?`text-[var(--color-fg-1)]`:`text-[var(--color-fg-4)]`}`,children:e.enabled?`on`:`off`}),(0,G.jsx)($c,{size:`sm`,checked:e.enabled,disabled:r,label:`${e.enabled?`Disable`:`Enable`} rule ${e.id}`,onChange:async()=>{i(!0);try{await n()}finally{i(!1)}}})]})}function fl(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await fetch(`/api/json/rule-write-enforcement`,{headers:{Accept:`application/json`}});if(!n.ok)return;let r=await n.json();!e&&typeof r.enforced==`boolean`&&t(r.enforced)}catch{}})(),()=>{e=!0}},[]);async function o(e){r(!0);try{let n=await fetch(`/api/json/rule-write-enforcement`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({enforced:e})});if(n.ok){let e=await n.json();typeof e.enforced==`boolean`&&t(e.enforced)}}finally{r(!1),a(!1)}}if(e===null)return null;let s=!e;return(0,G.jsx)(K,{className:s?`border-amber-500/40 bg-amber-500/5`:`border-[var(--color-line-1)]`,children:(0,G.jsx)(J,{className:`px-3 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`rule-write protection`}),(0,G.jsx)(`span`,{className:`text-[11px] font-mono uppercase tracking-wider ${s?`text-amber-300`:`text-emerald-300`}`,children:s?`disabled`:`enforced`})]}),(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] mt-1 leading-snug`,children:s?`Agents can currently Write/Edit .rules files. Turn this back on when you finish authoring.`:`Agents cannot Write/Edit/MultiEdit any .sigmashake/rules/**/*.rules file. Disable only when curating rulesets.`})]}),(0,G.jsx)(`div`,{className:`shrink-0`,children:i?(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`button`,{onClick:()=>o(!1),disabled:n,className:`text-[11px] font-mono uppercase tracking-wider bg-amber-500/10 border border-amber-500/40 text-amber-200 hover:bg-amber-500/20 rounded-sm px-2 py-0.5 cursor-pointer transition-colors disabled:opacity-50`,children:`disable`}),(0,G.jsx)(`button`,{onClick:()=>a(!1),disabled:n,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer disabled:opacity-50`,children:`cancel`})]}):(0,G.jsx)(`button`,{onClick:()=>{e?a(!0):o(!0)},disabled:n,className:`text-[11px] font-mono uppercase tracking-wider border rounded-sm px-2.5 py-0.5 cursor-pointer transition-colors disabled:opacity-50 ${s?`bg-emerald-500/10 border-emerald-500/40 text-emerald-200 hover:bg-emerald-500/20`:`bg-[var(--color-surface-1)] border-[var(--color-line-1)] text-[var(--color-fg-1)] hover:bg-[var(--color-surface-2)]`}`,children:s?`enable`:`disable`})})]})})})}function pl(){let{data:e,refetch:t}=B(`/api/json/rules`,[Ae(ol)[`rules-changed`]]),[n,r]=(0,_.useState)(``),i=new URLSearchParams(window.location.search).get(`highlight`)??``,a=(0,_.useRef)(null);if((0,_.useEffect)(()=>{a.current&&a.current.scrollIntoView({behavior:`smooth`,block:`center`})},[e,i]),!e)return(0,G.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading rules…`});if(e.rulesets.length===0)return(0,G.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 p-10 text-center`,children:[(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-2)] mb-2`,children:`No .rules files found.`}),(0,G.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline`,children:`→ browse hub to install rulesets`})]});let o=n.toLowerCase(),s=e.rulesets.map(e=>({...e,rules:o?e.rules.filter(e=>e.id.toLowerCase().includes(o)||e.message.toLowerCase().includes(o)):e.rules})).filter(e=>!o||e.rules.length>0),c=e.rulesets.reduce((e,t)=>e+t.rules.length,0),l=e.rulesets.reduce((e,t)=>e+t.rules.filter(e=>e.enabled).length,0);return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`overline text-[11px]`,children:`rules`}),(0,G.jsxs)(`div`,{className:`flex items-baseline gap-3 mt-1`,children:[(0,G.jsxs)(`span`,{className:`font-mono text-sm text-[var(--color-fg-0)] tabular-nums`,children:[l,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`/`,c]}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1.5 text-[11px] uppercase tracking-wider`,children:`active`})]}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsxs)(`span`,{className:`font-mono text-[11px] text-[var(--color-fg-3)] uppercase tracking-wider`,children:[e.files.length,` file`,e.files.length===1?``:`s`]})]})]}),(0,G.jsx)(`div`,{className:`ml-auto relative`,children:(0,G.jsx)(`input`,{type:`text`,placeholder:`search rules…`,value:n,onChange:e=>r(e.target.value),className:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-xs rounded-sm px-2.5 py-1.5 w-56 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})})]}),(0,G.jsx)(fl,{}),s.length===0&&(0,G.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:[`no rules match "`,n,`"`]}),(0,G.jsx)(`div`,{className:`space-y-3`,children:s.map(e=>{let n=e.rules.some(e=>e.id===i),r=e.rules.filter(e=>e.enabled).length;return(0,G.jsx)(K,{children:(0,G.jsxs)(`details`,{open:n||!o,children:[(0,G.jsxs)(`summary`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer list-none select-none hover:bg-[var(--color-surface-2)]/70 border-b border-[var(--color-line-0)]`,children:[(0,G.jsxs)(`svg`,{className:`text-[var(--color-fg-3)] shrink-0`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,G.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),(0,G.jsx)(`code`,{className:`text-xs text-[var(--color-fg-0)] font-mono`,children:e.file}),(0,G.jsxs)(`span`,{className:`ml-auto font-mono text-[11px] text-[var(--color-fg-3)] tabular-nums`,children:[r,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`/`,e.rules.length]})]})]}),(0,G.jsxs)(J,{className:`py-0`,children:[e.rules.length===0?(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] py-3`,children:`no rules in this file`}):(0,G.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:e.rules.map(n=>{let r=n.id===i;return(0,G.jsxs)(`div`,{ref:r?a:null,className:`py-2.5 flex items-start justify-between gap-4 ${r?`bg-amber-400/8 border-l-2 border-l-amber-400/60 -mx-3 px-3 -my-px`:``}`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1 flex-wrap`,children:[(0,G.jsx)(`select`,{value:n.decision,onChange:async r=>{await ul(n.id,e.file,r.target.value),t()},className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-1.5 py-0.5 text-[11px] font-mono uppercase tracking-wider cursor-pointer focus:outline-none focus:border-[var(--color-brand)]/50 ${cl[n.decision]??`text-[var(--color-fg-2)]`}`,children:sl.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))}),(0,G.jsx)(il,{ruleId:n.id,children:(0,G.jsx)(`code`,{className:`text-xs font-mono text-[var(--color-fg-0)] break-all`,children:n.id})})]}),(0,G.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] truncate`,children:n.message})]}),(0,G.jsx)(dl,{rule:n,file:e.file,onToggle:async()=>{await ll(n.id,e.file),t()}})]},n.id)})}),e.content&&(0,G.jsxs)(`details`,{className:`mt-3 pb-3`,children:[(0,G.jsx)(`summary`,{className:`overline cursor-pointer hover:text-[var(--color-fg-1)] select-none`,children:`raw source`}),(0,G.jsx)(`pre`,{className:`mt-2 p-3 bg-[var(--color-surface-0)] border border-[var(--color-line-0)] rounded-sm text-[11px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-words font-mono`,children:e.content})]})]})]})},e.file)})})]})}var ml=[``,`allow`,`block`,`force`,`ask`,`log`],hl=[``,`claude-code`,`gemini`,`antigravity`,`cursor`,`copilot`,`codex`,`pi`,`generic`],gl=50;function _l(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(gl),u=Ae([`activity-updated`]),d=new URLSearchParams;e&&d.set(`decision`,e),n&&d.set(`tool`,n),i&&d.set(`client`,i);let{data:f,loading:p,error:m}=B(`/api/state/activity${d.size?`?`+d:``}`,[u[`activity-updated`],e,n,i]),h=e=>t=>{e(t.target.value),l(gl)},g=(0,_.useMemo)(()=>{if(!f)return[];let e=o.trim().toLowerCase();return e?f.filter(t=>t.tool.toLowerCase().includes(e)||t.decision.toLowerCase().includes(e)||(t.rule_id??``).toLowerCase().includes(e)||(t.client??``).toLowerCase().includes(e)||(t.source_file??``).toLowerCase().includes(e)||t.input.toLowerCase().includes(e)):f},[f,o]),v=g.slice(0,c),y=g.length>c,b=f?.length??0,x=g.length,S=`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] font-mono rounded-sm px-2 py-1.5 focus:outline-none focus:border-[var(--color-brand)]/50 cursor-pointer`;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-[20px] font-semibold tracking-tight text-[var(--color-fg-0)] leading-tight`,children:`What your AI tried to do`}),(0,G.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-3)] mt-1 leading-relaxed`,children:[`Every move your AI agent made — and what SigmaShake decided.`,f&&(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] tabular-nums ml-1.5`,children:o&&x!==b?`· ${x}/${b} match`:`· ${b} actions`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`select`,{id:`audit-filter-decision`,value:e,onChange:h(t),className:S,children:ml.map(e=>(0,G.jsx)(`option`,{value:e,children:e===``?`All decisions`:e===`allow`?`Allowed`:e===`block`?`Blocked`:e===`force`?`Forced`:e===`ask`?`Held`:`Logged`},e))}),(0,G.jsx)(`select`,{id:`audit-filter-client`,value:i,onChange:h(a),className:S,children:hl.map(e=>(0,G.jsx)(`option`,{value:e,children:e===``?`All AI agents`:e===`claude-code`?`Claude Code`:e===`copilot`?`GitHub Copilot`:e===`codex`?`OpenAI Codex`:e.charAt(0).toUpperCase()+e.slice(1)},e))}),(0,G.jsx)(`input`,{id:`audit-filter-tool`,type:`text`,placeholder:`Filter by tool…`,value:n,onChange:h(r),className:`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] rounded-sm px-2.5 py-1.5 w-36 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)]`})]})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`svg`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)] pointer-events-none`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,G.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,G.jsx)(`input`,{id:`audit-search`,type:`text`,placeholder:`Search by command, file path, rule, or text…`,value:o,onChange:e=>{s(e.target.value),l(gl)},className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-sm rounded-sm pl-9 pr-10 py-2.5 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] transition-colors`}),o&&(0,G.jsx)(`button`,{onClick:()=>{s(``),l(gl)},className:`absolute right-3 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] transition-colors cursor-pointer`,title:`Clear search`,children:(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),f&&f.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-3 text-[10px] uppercase tracking-widest text-[var(--color-fg-4)] select-none`,children:[(0,G.jsx)(`span`,{className:`w-3`}),(0,G.jsx)(`span`,{className:`w-14`,children:`When`}),(0,G.jsx)(`span`,{className:`w-20`,children:`Decision`}),(0,G.jsx)(`span`,{className:`flex-1 min-w-0`,children:`Action`}),(0,G.jsx)(`span`,{className:`hidden md:inline w-12 text-right`,children:`Time`}),(0,G.jsx)(`span`,{className:`w-24 text-right`,children:`AI agent`})]}),m&&(0,G.jsxs)(`p`,{className:`text-sm text-red-300 font-mono`,children:[`failed to load audit log: `,m]}),p&&!f&&(0,G.jsx)(`div`,{className:`space-y-1.5`,children:Array.from({length:10}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-9 bg-[var(--color-surface-1)] rounded-sm border border-[var(--color-line-0)] border-l-2 border-l-[var(--color-line-2)] shimmer`},t))}),!p&&!m&&g.length===0&&(0,G.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] py-16 flex flex-col items-center justify-center text-center`,children:[(0,G.jsxs)(`svg`,{className:`text-[var(--color-fg-4)] mb-3`,width:`32`,height:`32`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,G.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)]`,children:o?`No actions match your search.`:`Nothing yet — connect an AI agent and its actions will show up here.`}),o&&(0,G.jsx)(`button`,{onClick:()=>s(``),className:`mt-3 text-[11.5px] text-[var(--color-brand)] hover:underline cursor-pointer`,children:`Clear search`})]}),v.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`space-y-1.5`,children:v.map(e=>(0,G.jsx)(mc,{row:e},e.id))}),y&&(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-4 pt-2`,children:[(0,G.jsxs)(`button`,{onClick:()=>l(e=>e+gl),className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-2)] hover:text-[var(--color-fg-0)] border border-[var(--color-line-1)] hover:border-[var(--color-line-2)] rounded-sm px-4 py-1.5 transition-colors cursor-pointer`,children:[`show`,` `,Math.min(gl,g.length-c),` more`]}),(0,G.jsxs)(`span`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:[c,` / `,g.length]})]})]})]})}function vl({open:e,onClose:t,title:n,subtitle:r,children:i,footer:a,size:o=`md`}){let s=(0,_.useRef)(null),c=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!e)return;c.current=document.activeElement;let n=document.body.style.overflow;document.body.style.overflow=`hidden`;let r=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,r),s.current?.focus(),()=>{document.removeEventListener(`keydown`,r),document.body.style.overflow=n,c.current?.focus?.()}},[e,t]),e?(0,G.jsx)(`div`,{className:`ss-sheet-backdrop`,onClick:e=>{e.target===e.currentTarget&&t()},role:`presentation`,children:(0,G.jsxs)(`div`,{ref:s,className:`ss-sheet ss-sheet--${o}`,role:`dialog`,"aria-modal":`true`,"aria-label":n??`Detail`,tabIndex:-1,children:[(0,G.jsx)(`button`,{className:`ss-sheet-handle`,onClick:t,"aria-label":`Close`,type:`button`}),(0,G.jsxs)(`div`,{className:`ss-sheet-head`,children:[(0,G.jsxs)(`div`,{className:`ss-sheet-head-text`,children:[n&&(0,G.jsx)(`h2`,{className:`ss-sheet-title`,children:n}),r&&(0,G.jsx)(`p`,{className:`ss-sheet-subtitle`,children:r})]}),(0,G.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close`,className:`ss-sheet-close`,children:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`}),(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`})]})})]}),(0,G.jsx)(`div`,{className:`ss-sheet-body`,children:i}),a&&(0,G.jsx)(`div`,{className:`ss-sheet-footer`,children:a})]})}):null}var yl={allow:`green`,block:`red`,force:`amber`,ask:`blue`,log:`gray`},bl=[`all`,`allow`,`block`,`force`,`log`],xl={allow:`text-emerald-300`,block:`text-red-300`,force:`text-amber-300`,log:`text-[var(--color-fg-3)]`};function Sl(e){return new Date(e*1e3).toLocaleString()}function Cl(e,t){if(!t)return``;let n=t-e;return n<60?`${n}s`:`${Math.round(n/60)}m`}async function wl(e,t){await fetch(`/api/decide/${e}?decision=${t}`,{method:`POST`,headers:ke()})}async function Tl(e,t){try{return await(await fetch(`/api/rules/set-enabled`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...ke()},body:JSON.stringify({ruleId:e,enabled:t})})).json()}catch(e){return{error:String(e)}}}function El(e){try{let t=JSON.parse(e).input;return t&&typeof t==`object`?ir(``,JSON.stringify(t)):ir(``,e)}catch{return e.slice(0,80)}}function Dl(e){try{let t=JSON.parse(e);return t.input===void 0?JSON.stringify(JSON.parse(e),null,2):JSON.stringify(t.input,null,2)}catch{return e}}function Ol({label:e,value:t,tone:n}){return(0,G.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm tabular-nums ${n??`text-[var(--color-fg-0)]`}`,children:t}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-[var(--color-fg-3)]`,children:e})]})}function kl(e,t){let n=Math.floor(Date.now()/1e3),r=n-86400,i=new Map;for(let t of e){if(t.decision!==`ask`||t.created_at<r||!t.rule_id)continue;let e=i.get(t.rule_id);e?(e.count+=1,t.created_at>e.lastSeen&&(e.lastSeen=t.created_at)):i.set(t.rule_id,{ruleId:t.rule_id,ruleMessage:t.rule_message||t.rule_id,count:1,lastSeen:t.created_at})}for(let e of t){if(!e.ruleId)continue;let t=i.get(e.ruleId);t?(t.count+=1,t.lastSeen=n):i.set(e.ruleId,{ruleId:e.ruleId,ruleMessage:e.ruleMessage||e.ruleId,count:1,lastSeen:n})}return Array.from(i.values()).filter(e=>e.count>=3).sort((e,t)=>t.count-e.count||t.lastSeen-e.lastSeen).slice(0,5)}function Al(e){let t=Math.max(0,Math.floor(Date.now()/1e3)-e);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function jl({ruleId:e,ruleMessage:t,onDismiss:n,onUndo:r}){let[i,a]=(0,_.useState)(!1),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>(o.current=setTimeout(n,6e3),()=>{o.current&&clearTimeout(o.current)}),[n]),(0,G.jsxs)(`div`,{className:`fixed bottom-5 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 px-4 py-2.5 rounded-full border border-[var(--color-line-2)] bg-[var(--color-surface-1)] backdrop-blur-md shadow-lg`,children:[(0,G.jsxs)(`span`,{className:`text-xs text-[var(--color-fg-1)]`,children:[`Silenced `,(0,G.jsx)(`span`,{className:`font-mono text-[var(--color-fg-0)]`,children:t})]}),(0,G.jsx)(`button`,{type:`button`,disabled:i,onClick:async()=>{a(!0),await r(),n()},className:`text-[11px] font-mono uppercase tracking-wider px-2.5 py-1 rounded-full border border-[var(--color-brand)]/40 text-[var(--color-brand)] hover:bg-[var(--color-brand)]/10 cursor-pointer disabled:opacity-50`,"aria-label":`Undo silencing ${e}`,children:`undo`}),(0,G.jsx)(`button`,{type:`button`,onClick:n,className:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer`,"aria-label":`Dismiss`,children:(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`}),(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`})]})})]})}function Ml({target:e,onClose:t,onConfirm:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null);return(0,_.useEffect)(()=>{o(null)},[e]),e?(0,G.jsxs)(vl,{open:!!e,onClose:t,size:`sm`,title:`Silence this rule?`,subtitle:`It won't ask for approval again until you re-enable it on the Rules page.`,footer:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--secondary`,disabled:r,onClick:t,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--primary`,style:{"--tone":`#ff6f6f`},disabled:r,onClick:async()=>{i(!0),o(null);let r=await n(e);if(i(!1),!r.ok){o(r.message??`Could not silence rule.`);return}t()},children:r?`Silencing…`:`Disable rule`})]}),children:[(0,G.jsxs)(`div`,{className:`ss-list`,children:[(0,G.jsx)(`div`,{className:`ss-list-row`,style:{cursor:`default`},children:(0,G.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(`div`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-1`,children:`rule`}),(0,G.jsx)(`div`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,G.jsx)(il,{ruleId:e.ruleId,children:(0,G.jsx)(`code`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] block mt-1 break-all`,children:e.ruleId})})]})}),(0,G.jsx)(`div`,{className:`ss-list-row`,style:{cursor:`default`},children:(0,G.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,G.jsx)(`div`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-1`,children:`recent activity`}),(0,G.jsxs)(`div`,{className:`text-sm text-[var(--color-fg-1)]`,children:[`Triggered`,` `,(0,G.jsx)(`strong`,{className:`text-[var(--color-fg-0)] tabular-nums`,children:e.fireCount}),` `,e.fireCount===1?`time`:`times`,` in the last 24 hours.`]})]})})]}),(0,G.jsxs)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-3 leading-relaxed`,children:[`Disabling a rule is fully reversible — head to`,` `,(0,G.jsx)(`a`,{href:`/rules`,className:`text-[var(--color-brand)] hover:underline`,children:`Rules`}),` `,`to switch it back on.`]}),a&&(0,G.jsx)(`p`,{className:`mt-3 text-xs text-red-300`,role:`alert`,children:a})]}):null}function Nl(){let e=Ae([`pending-changed`,`rules-changed`]),{data:t,refetch:n}=B(`/api/json/pending`,[e[`pending-changed`]]),{data:r}=B(`/api/json/approvals`,[e[`pending-changed`]]),[i,a]=(0,_.useState)(`all`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(new Set),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=(0,_.useMemo)(()=>kl(r??[],t??[]),[r,t]),h=(0,_.useMemo)(()=>{let e=new Map;for(let t of m)e.set(t.ruleId,t.count);return e},[m]),g=Math.floor(Date.now()/1e3),v=(r??[]).filter(e=>e.created_at>=g-86400).length,y=(r??[]).reduce((e,t)=>(e[t.decision]=(e[t.decision]??0)+1,e),{}),b=(r??[]).filter(e=>{if(i!==`all`&&e.decision!==i)return!1;if(o){let t=o.toLowerCase(),n=El(e.input).toLowerCase();if(!e.tool.toLowerCase().includes(t)&&!e.rule_id.toLowerCase().includes(t)&&!(e.rule_message??``).toLowerCase().includes(t)&&!n.includes(t))return!1}return!0});function x(e){l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function S(e){let t=await Tl(e.ruleId,!1);return t.error||t.ok===!1?{ok:!1,message:t.error??`Server rejected the request.`}:(e.pendingId&&await wl(e.pendingId,`block`),p({ruleId:e.ruleId,ruleMessage:e.ruleMessage}),n(),{ok:!0})}async function C(e){await Tl(e,!0),n()}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`overline text-[11px]`,children:`approvals`}),(0,G.jsx)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-1 font-mono`,children:`approve or deny pending tool calls · review past decisions · silence noisy rules`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5 px-3 py-2.5 rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)]/60`,children:[(0,G.jsx)(Ol,{label:`pending`,value:t?.length??0,tone:`text-amber-300`}),(0,G.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),[`allow`,`block`,`force`,`log`].map(e=>(0,G.jsx)(Ol,{label:e,value:y[e]??0,tone:xl[e]},e)),(0,G.jsx)(`span`,{className:`text-[var(--color-line-2)]`,children:`|`}),(0,G.jsx)(Ol,{label:`last 24h`,value:v})]}),m.length>0&&(0,G.jsxs)(`section`,{className:`ss-noisy-card`,"aria-label":`Noisy rules`,children:[(0,G.jsxs)(`div`,{className:`ss-noisy-card-head`,children:[(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M12 9v4`}),(0,G.jsx)(`path`,{d:`M12 17h.01`}),(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`})]}),`asking too often · last 24h`]}),m.map(e=>(0,G.jsxs)(`div`,{className:`ss-noisy-row`,children:[(0,G.jsx)(`span`,{className:`ss-noisy-count`,"aria-label":`${e.count} fires`,children:e.count}),(0,G.jsxs)(`div`,{className:`ss-noisy-text`,children:[(0,G.jsx)(`span`,{className:`ss-noisy-title`,children:e.ruleMessage}),(0,G.jsxs)(`span`,{className:`ss-noisy-sub`,children:[(0,G.jsx)(il,{ruleId:e.ruleId,children:(0,G.jsx)(`code`,{className:`font-mono`,children:e.ruleId})}),(0,G.jsx)(`span`,{style:{margin:`0 6px`},children:`·`}),`last fired `,Al(e.lastSeen)]})]}),(0,G.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger`,onClick:()=>d({ruleId:e.ruleId,ruleMessage:e.ruleMessage,fireCount:e.count}),"aria-label":`Silence rule ${e.ruleId}`,children:[(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,G.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,G.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Silence`]})]},e.ruleId))]}),t&&t.length>0&&(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between mb-3`,children:(0,G.jsxs)(`h2`,{className:`overline text-[11px]`,children:[`pending · `,t.length]})}),(0,G.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>{let t=h.get(e.ruleId)??0;return(0,G.jsxs)(K,{className:`border-l-2 border-l-amber-400/60`,children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`text-sm text-[var(--color-fg-0)]`,children:e.ruleMessage}),(0,G.jsxs)(`div`,{className:`flex gap-2 flex-wrap items-center`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`primary`,onClick:async()=>{await wl(e.id,`allow`),n()},children:`approve`}),(0,G.jsx)(Y,{size:`sm`,variant:`danger`,onClick:async()=>{await wl(e.id,`block`),n()},children:`deny`}),(0,G.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger`,onClick:()=>d({ruleId:e.ruleId,ruleMessage:e.ruleMessage,fireCount:t||1,pendingId:e.id}),"aria-label":`Disable rule ${e.ruleId}`,children:[(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,G.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,G.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Disable rule`]})]})]}),(0,G.jsxs)(J,{className:`space-y-2 text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex gap-3 flex-wrap items-center`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`tool`}),(0,G.jsx)(`code`,{className:`text-[var(--color-brand)] font-mono`,children:e.toolCall.tool}),(0,G.jsx)(`span`,{className:`overline ml-2`,children:`rule`}),(0,G.jsx)(il,{ruleId:e.ruleId,children:(0,G.jsx)(`span`,{className:`font-mono text-[var(--color-fg-2)]`,children:e.ruleId})}),t>=3&&(0,G.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded-full`,style:{background:`color-mix(in oklab, #ffa657 14%, transparent)`,color:`#ffb27d`,border:`1px solid color-mix(in oklab, #ffa657 28%, transparent)`},title:`Fired ${t} times in the last 24h`,children:[`asks often · `,t,`×`]})]}),e.prompt&&(0,G.jsxs)(`div`,{className:`flex gap-2 items-start`,children:[(0,G.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,G.jsx)(hc,{children:JSON.stringify(e.toolCall.input,null,2)})]})]},e.id)})})]}),(0,G.jsxs)(`section`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-3 gap-3 flex-wrap`,children:[(0,G.jsx)(`h2`,{className:`overline text-[11px]`,children:`history`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`div`,{className:`flex gap-0.5 rounded-sm border border-[var(--color-line-1)] p-0.5 bg-[var(--color-surface-1)]`,children:bl.map(e=>(0,G.jsx)(`button`,{onClick:()=>a(e),className:`px-2 py-0.5 rounded-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer ${i===e?`bg-[var(--color-brand)]/10 text-[var(--color-brand)] border border-[var(--color-brand)]/30`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] border border-transparent`}`,children:e},e))}),(0,G.jsx)(`input`,{type:`text`,placeholder:`search tool, rule, command…`,value:o,onChange:e=>s(e.target.value),className:`text-xs font-mono bg-[var(--color-surface-1)] border border-[var(--color-line-1)] rounded-sm px-2.5 py-1 text-[var(--color-fg-1)] placeholder-[var(--color-fg-4)] focus:outline-none focus:border-[var(--color-brand)]/50 w-48`})]})]}),!r||r.length===0?(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:`no approval history yet`}):b.length===0?(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] px-4 py-6 text-center text-[11px] font-mono text-[var(--color-fg-3)]`,children:`no results match your filter`}):(0,G.jsx)(K,{children:(0,G.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:b.map(e=>{let t=c.has(e.id),n=El(e.input),r=Cl(e.created_at,e.resolved_at);return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`button`,{onClick:()=>x(e.id),className:`w-full text-left px-3 py-2 hover:bg-[var(--color-surface-2)]/60 transition-colors cursor-pointer flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] text-[10px] w-2.5 shrink-0 mt-1`,children:t?`▼`:`▶`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] whitespace-nowrap tabular-nums`,children:Sl(e.resolved_at??e.created_at)}),(0,G.jsx)(cr,{variant:yl[e.decision]??`gray`,children:e.decision}),(0,G.jsx)(`code`,{className:`text-xs text-[var(--color-brand)] font-mono`,children:e.tool}),r&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] ml-auto`,children:[`Δ`,r]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-xs text-[var(--color-fg-2)] truncate flex-1 min-w-0`,children:e.rule_message||e.rule_id||`—`}),n&&(0,G.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)] font-mono truncate flex-1 min-w-0 hidden md:block`,children:n})]})]})]}),t&&(0,G.jsxs)(`div`,{className:`px-3 pb-3 pt-1 space-y-2 bg-[var(--color-surface-0)]`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs font-mono items-center`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`rule`}),` `,e.rule_id?(0,G.jsx)(il,{ruleId:e.rule_id,children:(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.rule_id})}):(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:`—`})]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`created`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Sl(e.created_at)})]}),e.resolved_at&&(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] uppercase tracking-wider text-[10px]`,children:`resolved`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Sl(e.resolved_at)})]}),e.rule_id&&(0,G.jsxs)(`button`,{type:`button`,className:`ss-pill ss-pill--danger ml-auto`,onClick:()=>d({ruleId:e.rule_id,ruleMessage:e.rule_message||e.rule_id,fireCount:h.get(e.rule_id)??1}),"aria-label":`Silence rule ${e.rule_id}`,children:[(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,G.jsx)(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),(0,G.jsx)(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`})]}),`Silence rule`]})]}),e.prompt&&(0,G.jsxs)(`div`,{className:`text-xs flex gap-2 items-start`,children:[(0,G.jsx)(`span`,{className:`overline pt-0.5 shrink-0`,children:`why`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:e.prompt})]}),(0,G.jsx)(hc,{children:Dl(e.input)})]})]},e.id)})})})]}),(0,G.jsx)(Ml,{target:u,onClose:()=>d(null),onConfirm:S}),f&&(0,G.jsx)(jl,{ruleId:f.ruleId,ruleMessage:f.ruleMessage,onDismiss:()=>p(null),onUndo:()=>C(f.ruleId)})]})}function Pl(){let{data:e,refetch:t}=B(`/api/json/inspector-targets`),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(1),u=(0,_.useRef)(new Map),d=(0,_.useRef)(new Map),f=(0,_.useCallback)(()=>{let e=c.current;if(c.current=null,e)try{e.close()}catch{}r(!1),a(!1),s(null)},[]),p=(0,_.useCallback)(e=>{c.current&&f(),a(!0),s(null);let t=new WebSocket(`/ws/inspector?target=${encodeURIComponent(e)}`);c.current=t,t.onopen=()=>{r(!0),a(!1),s(null)},t.onclose=()=>{c.current=null,r(!1),a(!1)},t.onerror=()=>{a(!1),s(`Connection failed — is the inspector running with the correct target ID?`)},t.onmessage=e=>{try{let t=JSON.parse(e.data);if(t.id!=null){let e=u.current.get(t.id);e&&(u.current.delete(t.id),e(t.result))}else if(t.method){let e=d.current.get(t.method);if(e)for(let n of e)n(t.params)}}catch{}}},[f]),m=(0,_.useCallback)((e,t)=>new Promise((n,r)=>{let i=c.current;if(!i||i.readyState!==WebSocket.OPEN){r(Error(`Not connected`));return}let a=l.current++;u.current.set(a,e=>n(e)),i.send(JSON.stringify({id:a,method:e,params:t})),setTimeout(()=>{u.current.has(a)&&(u.current.delete(a),r(Error(`Command timed out`)))},1e4)}),[]),h=(0,_.useCallback)((e,t)=>{let n=d.current.get(e);return n||(n=new Set,d.current.set(e,n)),n.add(t),()=>{d.current.get(e)?.delete(t)}},[]),g=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{e?.active&&e?.target&&!n&&!i&&!g.current&&(g.current=!0,p(e.target.id))},[e?.active,e?.target?.id,n,i,p]),(0,_.useEffect)(()=>()=>{f()},[f]),{active:e?.active??!1,bunVersion:e?.version?.[`Bun-Version`]??null,preconfiguredTarget:e?.target??null,connected:n,connecting:i,error:o,connect:p,disconnect:f,sendCommand:m,onEvent:h,refetch:t}}var Fl=18,Z=5e-4;function Q(e,t){return t===`(garbage collector)`||t===`(idle)`?`#450a0a`:e?e.startsWith(`node:`)||e.startsWith(`bun:`)?`#172554`:e.startsWith(`file:`)||e.startsWith(`/`)||e.includes(`.ts`)||e.includes(`.js`)?`#451a03`:`#1f2937`:`#1f2937`}function Il(e,t){return t===`(garbage collector)`||t===`(idle)`?`#fca5a5`:e?e.startsWith(`node:`)||e.startsWith(`bun:`)?`#93c5fd`:e.startsWith(`file:`)||e.startsWith(`/`)||e.includes(`.ts`)||e.includes(`.js`)?`#fbbf24`:`#6b7280`:`#6b7280`}function Ll(e,t){let n=new Map;for(let t of e.nodes)n.set(t.id,t);let r=new Map;function i(e){let t=n.get(e);if(!t)return 0;let a=t.hitCount??0;for(let e of t.children??[])a+=i(e);return r.set(e,a),a}let a=e.nodes[0];if(!a)return[];i(a.id);let o=t??a.id,s=r.get(o)??0;if(s===0)return[];let c=[];function l(e,t,i){let a=n.get(e);if(!a)return;let o=r.get(e)??0,u=o/s;if(u<Z)return;c.push({x:i,width:u,depth:t,node:a,subtreeHits:o});let d=i;for(let e of a.children??[]){let n=(r.get(e)??0)/s;l(e,t+1,d),d+=n}}return l(o,0,0),c}function Rl(e){return e<1e3?`${e}µs`:e<1e6?`${(e/1e3).toFixed(1)}ms`:`${(e/1e6).toFixed(2)}s`}function zl({profile:e}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(800),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=t.current;if(!e)return;let n=new ResizeObserver(e=>{let t=e[0]?.contentRect.width;t&&r(t)});return n.observe(e),r(e.clientWidth||800),()=>n.disconnect()},[]);let c=Ll(e,i),l=(c.reduce((e,t)=>Math.max(e,t.depth),0)+1)*Fl+4,u=e.endTime-e.startTime,d=(0,_.useCallback)(e=>{a(t=>t===e.node.id?null:e.node.id),s(null)},[]);return c.length===0?(0,G.jsx)(`p`,{className:`text-xs text-[#555] py-2`,children:`No samples — profile may be empty.`}):(0,G.jsxs)(`div`,{className:`relative select-none`,children:[i!==null&&(0,G.jsx)(`button`,{onClick:()=>a(null),className:`mb-2 text-xs text-amber-400 hover:underline`,children:`← Reset zoom`}),(0,G.jsx)(`div`,{ref:t,className:`overflow-x-hidden`,children:(0,G.jsx)(`svg`,{width:n,height:l,onMouseLeave:()=>s(null),children:c.map((e,t)=>{let r=e.x*n,a=Math.max(e.width*n,1),o=e.depth*Fl+1,c=e.node.callFrame.functionName||`(anonymous)`,l=e.node.callFrame.url,f=i===e.node.id;return(0,G.jsxs)(`g`,{children:[(0,G.jsx)(`rect`,{x:r,y:o,width:a,height:Fl-1,fill:f?`#92400e`:Q(l,c),stroke:`#080808`,strokeWidth:.5,style:{cursor:`pointer`},onClick:()=>d(e),onMouseMove:t=>s({clientX:t.clientX,clientY:t.clientY,rect:e,totalDuration:u})}),a>24&&(0,G.jsx)(`text`,{x:r+2,y:o+Fl-5,fontSize:9,fill:Il(l,c),style:{pointerEvents:`none`,userSelect:`none`},clipPath:`url(#fc-clip-${t})`,children:c}),a>24&&(0,G.jsx)(`clipPath`,{id:`fc-clip-${t}`,children:(0,G.jsx)(`rect`,{x:r,y:o,width:a,height:Fl})})]},t)})})}),o&&(0,G.jsxs)(`div`,{className:`fixed z-50 bg-[#111] border border-[#2a2a2a] rounded-lg p-2.5 text-xs shadow-xl pointer-events-none`,style:{left:o.clientX+14,top:o.clientY-8,maxWidth:320},children:[(0,G.jsx)(`div`,{className:`font-mono text-amber-400 truncate font-medium`,children:o.rect.node.callFrame.functionName||`(anonymous)`}),o.rect.node.callFrame.url&&(0,G.jsxs)(`div`,{className:`text-[#666] truncate mt-0.5 text-[10px]`,children:[o.rect.node.callFrame.url,`:`,o.rect.node.callFrame.lineNumber]}),(0,G.jsxs)(`div`,{className:`mt-1.5 space-y-0.5 text-[#aaa]`,children:[(0,G.jsxs)(`div`,{children:[`Samples:`,` `,(0,G.jsx)(`span`,{className:`text-white tabular-nums`,children:o.rect.subtreeHits})]}),(0,G.jsxs)(`div`,{children:[`Time share:`,` `,(0,G.jsxs)(`span`,{className:`text-white tabular-nums`,children:[(o.rect.width*100).toFixed(1),`%`]})]}),u>0&&(0,G.jsxs)(`div`,{children:[`Est. duration:`,` `,(0,G.jsx)(`span`,{className:`text-white tabular-nums`,children:Rl(Math.round(o.rect.width*u))})]})]}),o.rect.node.deoptReason&&(0,G.jsxs)(`div`,{className:`text-red-400 mt-1.5 text-[10px]`,children:[`⚠ `,o.rect.node.deoptReason]}),(0,G.jsx)(`div`,{className:`text-[#555] mt-1.5 text-[10px]`,children:`Click to zoom · click again to reset`})]})]})}function Bl(e){return e<1e6?`${(e/1e3).toFixed(0)}µs`:e<1e9?`${(e/1e6).toFixed(1)}ms`:`${(e/1e9).toFixed(2)}s`}function Vl(e){return new Date(e*1e3).toLocaleString()}var Hl={critical:`red`,high:`red`,medium:`amber`,low:`blue`},Ul={critical:`border-l-red-500/70`,high:`border-l-red-500/50`,medium:`border-l-amber-400/60`,low:`border-l-sky-400/50`};function Wl(){let{data:e}=B(`/api/json/profile`);if(!e)return(0,G.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading profile…`});let{diagnosis:t,sessions:n}=e;return!t||t.analyzed_evals===0?(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center`,children:(0,G.jsxs)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] font-mono`,children:[`no eval data yet — run`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg eval`}),` to start recording`]})}):(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-2`,children:[{label:`evals analyzed`,value:String(t.analyzed_evals)},{label:`median (inside)`,value:Bl(t.median_eval_ns)},{label:`p99 (inside)`,value:Bl(t.p99_eval_ns)},{label:`bottleneck`,value:t.bottleneck??`—`}].map(e=>(0,G.jsx)(xc,{label:e.label,value:e.value,labelPlacement:`above`,valueClassName:`text-xl font-medium tabular-nums text-[var(--color-fg-0)]`},e.label))}),t.phases.length>0&&(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`phase breakdown`})}),(0,G.jsx)(J,{children:(0,G.jsx)(`div`,{className:`space-y-2`,children:t.phases.filter(e=>e.median_ns>0).map(e=>{let n=e.name===t.bottleneck;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,G.jsx)(`span`,{className:`w-28 font-mono truncate ${n?`text-[var(--color-brand)] font-medium`:`text-[var(--color-fg-2)]`}`,title:n?`bottleneck`:void 0,children:e.name}),(0,G.jsx)(Cc,{pct:Math.min(e.pct_of_total,100),tone:n?`amber`:`gray`,className:`h-1 flex-1`}),(0,G.jsx)(`span`,{className:`w-16 text-right text-[var(--color-fg-1)] tabular-nums font-mono`,children:Bl(e.median_ns)}),(0,G.jsxs)(`span`,{className:`w-10 text-right text-[var(--color-fg-3)] tabular-nums font-mono`,children:[e.pct_of_total,`%`]}),(0,G.jsxs)(`span`,{className:`w-20 text-right text-[var(--color-fg-4)] tabular-nums font-mono text-[10px]`,children:[`p95 `,Bl(e.p95_ns)]})]},e.name)})})})]}),t.recommendations.length>0&&(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsxs)(`span`,{className:`overline`,children:[`recommendations · `,t.recommendations.length]})}),(0,G.jsx)(J,{className:`space-y-2`,children:t.recommendations.map((e,t)=>(0,G.jsxs)(`div`,{className:`border border-[var(--color-line-1)] bg-[var(--color-surface-0)] rounded-sm px-3 py-2.5 border-l-2 ${Ul[e.severity]??`border-l-[var(--color-line-2)]`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,G.jsx)(cr,{variant:Hl[e.severity]??`gray`,children:e.severity}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:e.type})]}),(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-1)] leading-relaxed`,children:e.message}),e.fix_command&&(0,G.jsxs)(`code`,{className:`text-[11px] text-[var(--color-brand)] font-mono mt-1.5 block`,children:[`$ `,e.fix_command]})]},t))})]}),t.anomalies.length>0&&(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsxs)(`span`,{className:`overline`,children:[`anomalies · `,t.anomalies.length]})}),(0,G.jsx)(J,{children:(0,G.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:t.anomalies.map((e,t)=>(0,G.jsxs)(`div`,{className:`py-2 flex items-center gap-4 text-xs font-mono`,children:[(0,G.jsx)(`span`,{className:`w-24 text-[var(--color-brand)] uppercase tracking-wider text-[10px]`,children:e.type}),(0,G.jsxs)(`span`,{className:`w-10 tabular-nums text-[var(--color-fg-1)]`,children:[e.count,`×`]}),(0,G.jsxs)(`span`,{className:`w-20 tabular-nums text-[var(--color-fg-1)]`,children:[e.max_ms,`ms max`]}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:e.likely_cause})]},t))})})]}),n.length>0&&(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`session history`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[n.length,` session`,n.length===1?``:`s`]})]}),(0,G.jsx)(J,{className:`p-0`,children:(0,G.jsx)(`div`,{className:`divide-y divide-[var(--color-line-0)]`,children:[...n].reverse().map((e,t)=>(0,G.jsxs)(`div`,{className:`px-4 py-2.5 flex flex-wrap items-center gap-x-5 gap-y-1 text-xs ${e.is_current?`bg-amber-400/[0.04] border-l-2 border-l-amber-400/60`:``}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 w-48 shrink-0`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums font-mono`,children:Vl(e.start_ts)}),e.is_current&&(0,G.jsx)(cr,{variant:`amber`,children:`current`})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-2)] tabular-nums font-mono w-20`,children:[e.evals,` eval`,e.evals===1?``:`s`]}),(0,G.jsxs)(`span`,{className:`text-emerald-300 tabular-nums font-mono`,children:[e.allowed,` allow`]}),e.blocked>0&&(0,G.jsxs)(`span`,{className:`text-red-300 tabular-nums font-mono`,children:[e.blocked,` block (`,e.block_rate_pct,`%)`]}),e.asked>0&&(0,G.jsxs)(`span`,{className:`text-sky-300 tabular-nums font-mono`,children:[e.asked,` ask`]}),e.forced>0&&(0,G.jsxs)(`span`,{className:`text-violet-300 tabular-nums font-mono`,children:[e.forced,` force`]}),e.avg_ns>0&&(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)] tabular-nums ml-auto font-mono`,children:[`avg `,Bl(e.avg_ns)]}),e.top_rule&&(0,G.jsxs)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.top_rule)}`,className:`text-[var(--color-fg-4)] hover:text-[var(--color-brand)] font-mono truncate max-w-xs transition-colors w-full pl-48`,title:`most blocked rule: ${e.top_rule}`,children:[`top block: `,e.top_rule]})]},t))})})]})]})}var Gl={log:`text-[var(--color-fg-1)]`,info:`text-sky-300`,warn:`text-amber-300`,error:`text-red-300`,debug:`text-[var(--color-fg-3)]`};function Kl(e){return e.value==null?e.description?e.description:`[${e.type}]`:String(e.value)}function ql(){let e=Pl(),[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(0);(0,_.useEffect)(()=>{d.current?.scrollIntoView({behavior:`smooth`})},[a]),(0,_.useEffect)(()=>{if(e.connected)return e.sendCommand(`Runtime.enable`).catch(()=>{}),e.onEvent(`Runtime.consoleAPICalled`,e=>{let t=e;o(e=>{let n=[...e,{id:f.current++,type:t.type??`log`,args:t.args??[],timestamp:t.timestamp??Date.now()}];return n.length>500?n.slice(-500):n})})},[e.connected]);let p=(0,_.useCallback)(()=>{e.preconfiguredTarget&&e.connect(e.preconfiguredTarget.id)},[e]),m=(0,_.useCallback)(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),i(null)}catch(e){console.error(`Profiler.start failed:`,e)}},[e]),h=(0,_.useCallback)(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch(e){console.error(`Profiler.stop failed:`,e),n(!1)}},[e]),g=(0,_.useCallback)(async()=>{u(!0);try{let t=await e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0});c(JSON.parse(t.result.value))}catch{}finally{u(!1)}},[e]);function v(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}let y=e.connected?`connected${e.bunVersion?` · bun v${e.bunVersion}`:``}`:e.connecting?`connecting…`:e.active?`inspector active, connecting…`:`inspector not available`,b=e.connected?`bg-emerald-400`:e.connecting?`bg-amber-400 pulse-soft`:e.active?`bg-sky-400`:`bg-[var(--color-line-2)]`;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono text-[var(--color-fg-2)]`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${b}`}),y]}),e.connected?(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:e.disconnect,children:`disconnect`}):(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:e.preconfiguredTarget?p:e.refetch,disabled:e.connecting,children:e.preconfiguredTarget?`reconnect`:`refresh`})]})]}),e.error&&(0,G.jsx)(J,{children:(0,G.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:e.error})})]}),e.connected&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`cpu profiler`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300 flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-400 pulse-soft`}),`recording`]}),t?(0,G.jsx)(Y,{variant:`danger`,size:`sm`,onClick:h,children:`stop & render`}):(0,G.jsx)(Y,{variant:`primary`,size:`sm`,onClick:m,children:`start recording`})]})]}),(0,G.jsx)(J,{children:r?(0,G.jsx)(Tc,{profile:r,children:(0,G.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 overflow-x-hidden`,children:(0,G.jsx)(zl,{profile:r})})}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:t?`recording… perform actions in ssg, then stop.`:`click start recording, perform actions, then stop.`})})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`memory`}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:g,disabled:l,children:l?`…`:`refresh`})]}),(0,G.jsx)(J,{children:s?(0,G.jsx)(Ec,{memory:s,formatValue:v}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:`click refresh to fetch process.memoryUsage().`})})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`console`}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>o([]),children:`clear`})]}),(0,G.jsx)(J,{children:(0,G.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 h-56 overflow-y-auto font-mono text-[11px]`,children:[a.length===0?(0,G.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`console output will appear here…`}):a.map(e=>(0,G.jsxs)(`div`,{className:`py-0.5 border-b border-[var(--color-line-0)] ${Gl[e.type]??`text-[var(--color-fg-1)]`}`,children:[(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)] mr-2 uppercase tracking-wider`,children:[`[`,e.type,`]`]}),e.args.map(Kl).join(` `)]},e.id)),(0,G.jsx)(`div`,{ref:d})]})})]})]}),!e.connected&&!e.connecting&&(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-1)]/50 px-4 py-6 text-center`,children:(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:e.active?`waiting for inspector connection…`:`inspector auto-starts with ssg serve. profiler, memory, and console appear here once connected.`})})]})}function Jl({active:e,onClick:t,children:n}){return(0,G.jsxs)(`button`,{onClick:t,className:`relative px-3 h-9 text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer ${e?`text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,children:[n,e&&(0,G.jsx)(`span`,{className:`absolute inset-x-2 -bottom-px h-px bg-[var(--color-brand)]`})]})}function Yl(){let[e,t]=(0,_.useState)(`eval`);return(0,G.jsxs)(`div`,{className:`space-y-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center border-b border-[var(--color-line-0)] mb-5`,children:[(0,G.jsx)(Jl,{active:e===`eval`,onClick:()=>t(`eval`),children:`eval profile`}),(0,G.jsx)(Jl,{active:e===`inspector`,onClick:()=>t(`inspector`),children:`runtime inspector`})]}),e===`eval`?(0,G.jsx)(Wl,{}):(0,G.jsx)(ql,{})]})}var Xl=`ssg:ui:mode:v1`,Zl=`ssg:ui:mode:seeded`,Ql=`ssg:ui-mode-change`,$l=new Set([`professional`,`enterprise`,`agent-dev`]);function eu(){try{let e=localStorage.getItem(Xl);if(e===`newcomer`||e===`pro`)return e}catch{}return null}function tu(e){try{localStorage.setItem(Xl,e)}catch{}}async function nu(){if(eu()===null){try{if(localStorage.getItem(Zl))return;localStorage.setItem(Zl,`1`)}catch{return}try{let e=await fetch(`/api/json/wizard-state`);if(!e.ok){tu(`newcomer`);return}let t=await e.json(),n=$l.has(t.profile??``)?`pro`:`newcomer`;tu(n),window.dispatchEvent(new CustomEvent(Ql,{detail:n}))}catch{tu(`newcomer`)}}}function ru(){let[e,t]=(0,_.useState)(()=>eu()??`newcomer`);return(0,_.useEffect)(()=>{nu().then(()=>{let n=eu();n&&n!==e&&t(n)});let n=e=>{let n=e.detail;(n===`newcomer`||n===`pro`)&&t(n)};return window.addEventListener(Ql,n),()=>window.removeEventListener(Ql,n)},[]),{mode:e,setMode:(0,_.useCallback)(e=>{t(e),tu(e),window.dispatchEvent(new CustomEvent(Ql,{detail:e}))},[])}}var iu=[{id:`safe-writes`,title:`Protect your files from accidents`,plainDescription:`Asks before AI overwrites or erases anything important — so you stay in control of what changes.`,example:`If AI tries to overwrite a config file, you get to approve it first.`,hubRulesetId:`safe-writes`,scenario:`any`,emoji:`🛡️`},{id:`no-destructive-fs`,title:`Stop AI from erasing files`,plainDescription:`Blocks the kind of filesystem operations that can permanently delete your work.`,example:`If AI tries to wipe a folder, SSG blocks it automatically.`,hubRulesetId:`no-destructive-fs`,scenario:`coding`,emoji:`🗑️`},{id:`secrets-guard`,title:`Keep secrets and credentials safe`,plainDescription:`Watches for AI trying to read or write your passwords, API keys, and private keys.`,example:`Reading your .env file, SSH keys, or .netrc triggers an approval request.`,hubRulesetId:`secrets-guard`,scenario:`any`,emoji:`🔑`},{id:`email-guardrails`,title:`Ask before AI sends emails`,plainDescription:`Makes sure AI never sends a message on your behalf without your explicit OK.`,example:`Any outbound email action is queued for your approval before it goes.`,hubRulesetId:`email-guardrails`,scenario:`knowledge-work`,emoji:`📧`},{id:`no-paid-apis`,title:`Block surprise charges from paid APIs`,plainDescription:`Blocks AI from calling APIs that can rack up unexpected bills — cloud storage, AI providers, payment services.`,example:`A call to OpenAI, AWS S3, or Stripe triggers a block until you allow it.`,hubRulesetId:`no-paid-apis`,scenario:`any`,emoji:`💳`},{id:`read-only-mode`,title:`Read-only mode (maximum safety)`,plainDescription:`AI can look but not touch — all write operations are blocked. Great when you just want to explore safely.`,example:`AI can read your codebase and answer questions but cannot change any files.`,hubRulesetId:`read-only`,scenario:`any`,emoji:`🔒`}];function au(e){return e?iu.filter(t=>t.scenario===`any`||t.scenario===e):iu}function ou({pack:e,installed:t,state:n,onInstall:r,onUninstall:i}){let a=n!==`idle`;return(0,G.jsxs)(`div`,{className:`ss-list-row ss-list-row--pack`,style:{cursor:`default`,background:t?`linear-gradient(180deg, color-mix(in oklab, var(--color-hig-green) 8%, transparent) 0%, transparent 60%), var(--color-surface-1)`:`var(--color-surface-1)`,borderColor:t?`color-mix(in oklab, var(--color-hig-green) 28%, var(--color-line-1))`:`var(--color-line-1)`},children:[(0,G.jsx)(`span`,{className:`ss-pack-emoji`,"aria-hidden":`true`,children:e.emoji}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`h3`,{className:`ss-pack-title`,children:e.title}),t&&(0,G.jsxs)(`span`,{className:`agent-badge agent-badge--detected`,title:`This pack is currently active.`,children:[(0,G.jsx)(`span`,{className:`agent-badge-dot`}),`Installed`]})]}),(0,G.jsx)(`p`,{className:`ss-pack-desc`,children:e.plainDescription}),(0,G.jsxs)(`p`,{className:`ss-pack-example`,children:[(0,G.jsx)(`span`,{className:`ss-pack-example__label`,children:`Example`}),e.example]})]}),(0,G.jsx)(`div`,{className:`ss-pack-action`,children:t?(0,G.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>i(e.id),className:`ss-btn ss-btn--secondary`,style:{height:30,padding:`0 12px`,fontSize:11},title:`Remove this pack from your machine.`,children:n===`uninstalling`?`Removing…`:`Remove`}):(0,G.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>r(e.id),className:`ss-btn ss-btn--primary`,style:{height:30,padding:`0 14px`,fontSize:11},title:`Install this guardrail pack.`,children:n===`installing`?`Installing…`:`Install`})})]})}function su(){let e=new URLSearchParams(window.location.search).get(`starter`),t=au(e),[n,r]=(0,_.useState)(new Set),[i,a]=(0,_.useState)({}),[o,s]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=!1;return fetch(`/api/json/hub/installed`).then(e=>e.json()).then(t=>{e||r(new Set(t.installed))}).catch(()=>{}),()=>{e=!0}},[]);function c(e,t){s({msg:e,type:t}),setTimeout(()=>s(null),5e3)}async function l(){try{let e=await(await fetch(`/api/json/hub/installed`)).json();r(new Set(e.installed))}catch{}}async function u(e){let t=iu.find(t=>t.id===e);if(t){a(t=>({...t,[e]:`installing`}));try{let n=await fetch(`/api/hub/install`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...ke()},body:JSON.stringify({id:t.hubRulesetId})}),i=await n.text(),a=n.headers.get(`Content-Type`)??``,o=null;if(a.includes(`application/json`))try{o=JSON.parse(i)}catch{}o?.ok?(r(t=>new Set([...t,e])),c(o.already_installed?`${t.title} — already installed`:`${t.title} — installed`,`ok`)):c(o?o.error??`Could not install ${t.title}`:i.replace(/<[^>]+>/g,``).trim()||`Could not install ${t.title} (HTTP ${n.status})`,`error`)}catch(e){c(`Could not reach the dashboard server (${e instanceof Error?e.message:String(e)})`,`error`)}finally{a(t=>({...t,[e]:`idle`})),l()}}}async function d(e){let t=iu.find(t=>t.id===e);if(t&&window.confirm(`Remove “${t.title}”?\n\nThe rules in this pack stop applying. You can install it again any time.`)){a(t=>({...t,[e]:`uninstalling`}));try{let n=await fetch(`/api/hub/uninstall`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...ke()},body:JSON.stringify({id:t.hubRulesetId})}),i=await n.text(),a=n.headers.get(`Content-Type`)??``,o=null;if(a.includes(`application/json`))try{o=JSON.parse(i)}catch{}o?.ok||n.ok&&!o?(r(t=>{let n=new Set(t);return n.delete(e),n}),c(`${t.title} — removed`,`ok`)):c(o?o.error??`Could not remove ${t.title}`:i.replace(/<[^>]+>/g,``).trim()||`Could not remove ${t.title} (HTTP ${n.status})`,`error`)}catch(e){c(`Could not reach the dashboard server (${e instanceof Error?e.message:String(e)})`,`error`)}finally{a(t=>({...t,[e]:`idle`})),l()}}}let f={coding:`for coding with AI`,"knowledge-work":`for email and docs`},p=t.filter(e=>n.has(e.id)).length;return(0,G.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,G.jsxs)(`section`,{className:`rounded-2xl p-5`,style:{border:`1px solid var(--color-line-1)`,background:`var(--color-surface-1)`},children:[(0,G.jsx)(`p`,{className:`ss-list-section-title`,style:{padding:0,marginBottom:8},children:`Guardrails`}),(0,G.jsxs)(`h1`,{className:`text-[18px] font-semibold text-[var(--color-fg-0)] tracking-tight`,children:[`One-tap protection`,e&&f[e]?` ${f[e]}`:``]}),(0,G.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] mt-1.5 leading-relaxed`,children:[`Each pack is a small set of rules that guard against a specific AI risk. Toggle them on and off — installing or removing only touches rule files in `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`.sigmashake/`}),`.`]}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mt-3`,children:[p,` of `,t.length,` active`]})]}),o&&(0,G.jsx)(`div`,{className:`rounded-xl px-4 py-2.5 text-[12px]`,style:{border:`1px solid ${o.type===`ok`?`color-mix(in oklab, var(--color-hig-green) 36%, transparent)`:`color-mix(in oklab, var(--color-hig-red) 36%, transparent)`}`,background:o.type===`ok`?`color-mix(in oklab, var(--color-hig-green) 12%, var(--color-surface-1))`:`color-mix(in oklab, var(--color-hig-red) 12%, var(--color-surface-1))`,color:o.type===`ok`?`var(--color-hig-green)`:`var(--color-hig-red)`,backdropFilter:`saturate(180%) blur(10px)`},children:o.msg}),(0,G.jsx)(`div`,{className:`ss-list`,children:t.map(e=>(0,G.jsx)(ou,{pack:e,installed:n.has(e.id),state:i[e.id]??`idle`,onInstall:u,onUninstall:d},e.id))}),(0,G.jsx)(`div`,{className:`rounded-xl p-4`,style:{border:`1px dashed var(--color-line-1)`,background:`color-mix(in oklab, var(--color-surface-1) 50%, transparent)`},children:(0,G.jsxs)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:[`Want more control? The`,` `,(0,G.jsx)(`a`,{href:`/hub`,className:`text-[var(--color-brand)] hover:underline`,children:`advanced library`}),` `,`has the full set of community rulesets and lets you preview every rule before installing.`]})})]})}function cu(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function lu(e){let t=e;if(t.endsWith(`/.sigmashake/rules`)&&(t=t.slice(0,-18)),t.endsWith(`\\.sigmashake\\rules`)&&(t=t.slice(0,-18)),t.startsWith(`/home/`)){let e=t.slice(6),n=e.indexOf(`/`);return n>=0?`~/${e.slice(n+1)}`:`~`}if(t.startsWith(`C:\\Users\\`)){let e=t.slice(9),n=e.indexOf(`\\`);return n>=0?`~\\${e.slice(n+1)}`:`~`}if(t.length>40){let e=t.split(/[/\\]/);if(e.length>2)return`…/${e[e.length-1]}`}return t}var uu=[{value:`downloads`,label:`most downloaded`},{value:`newest`,label:`newest`},{value:`rules`,label:`most rules`}],du=[``,`critical`,`high`,`medium`,`low`],fu=[``,`deny`,`ask`,`allow`,`log`];function pu(){return(0,G.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-1)] p-4 space-y-3 shimmer`,children:[(0,G.jsx)(`div`,{className:`h-4 bg-[var(--color-surface-3)] rounded-sm w-2/3`}),(0,G.jsx)(`div`,{className:`h-3 bg-[var(--color-surface-2)] rounded-sm w-1/3`}),(0,G.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,G.jsx)(`div`,{className:`h-5 bg-[var(--color-surface-3)] rounded-sm w-14`}),(0,G.jsx)(`div`,{className:`h-5 bg-[var(--color-surface-3)] rounded-sm w-10`})]}),(0,G.jsx)(`div`,{className:`h-7 bg-[var(--color-surface-3)] rounded-sm`})]})}function mu({tech:e}){return(0,G.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded-sm text-[10px] font-mono uppercase tracking-wider border ${{typescript:`bg-sky-500/8 text-sky-300 border-sky-500/25`,ts:`bg-sky-500/8 text-sky-300 border-sky-500/25`,javascript:`bg-amber-500/8 text-amber-300 border-amber-500/25`,js:`bg-amber-500/8 text-amber-300 border-amber-500/25`,python:`bg-emerald-500/8 text-emerald-300 border-emerald-500/25`,rust:`bg-orange-500/8 text-orange-300 border-orange-500/25`,go:`bg-cyan-500/8 text-cyan-300 border-cyan-500/25`,bash:`bg-violet-500/8 text-violet-300 border-violet-500/25`}[e.toLowerCase()]??`bg-[var(--color-surface-2)] text-[var(--color-fg-3)] border-[var(--color-line-1)]`}`,children:e})}function hu({install:e,onRemove:t,removing:n}){let r=lu(e.path),i=e.in_sync?`bg-emerald-400`:`bg-amber-400 animate-pulse`;return(0,G.jsxs)(`div`,{className:`group/chip inline-flex items-center gap-1.5 max-w-full pl-1.5 pr-0.5 py-0.5 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)] text-[10px] font-mono text-[var(--color-fg-2)]`,title:e.in_sync?`In sync — files present in ${e.path}`:`Drift — ${e.drift_reason??`files missing or empty`} (${e.path})`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${i}`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`truncate`,title:e.path,children:r}),(0,G.jsx)(`button`,{type:`button`,onClick:r=>{r.preventDefault(),r.stopPropagation(),n||t(e.path)},disabled:n,title:`Remove from this location`,"aria-label":`Uninstall from ${e.path}`,className:`shrink-0 inline-flex items-center justify-center w-4 h-4 rounded-sm text-[var(--color-fg-4)] hover:text-red-300 hover:bg-red-500/10 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed`,children:n?(0,G.jsx)(`svg`,{className:`animate-spin`,width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,G.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}):(0,G.jsxs)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,children:[(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function gu({isInstalling:e,hasInstalls:t,onInstallDefault:n,onPickPath:r}){let[i,a]=(0,_.useState)(!1),o=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!i)return;function e(e){o.current&&(o.current.contains(e.target)||a(!1))}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]),(0,G.jsxs)(`div`,{ref:o,className:`relative flex w-full`,children:[(0,G.jsx)(`button`,{onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},disabled:e,className:`flex-1 h-7 rounded-l-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer
11
11
  bg-[var(--color-brand)]/8 text-[var(--color-brand)] border border-[var(--color-brand)]/30 border-r-0
12
12
  hover:bg-[var(--color-brand)]/15 hover:border-[var(--color-brand)]/50
13
13
  disabled:opacity-40 disabled:cursor-not-allowed`,children:e?(0,G.jsxs)(`span`,{className:`flex items-center justify-center gap-1.5`,children:[(0,G.jsx)(`svg`,{className:`animate-spin`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,G.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),`installing…`]}):t?`install elsewhere`:`install`}),(0,G.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),a(e=>!e)},disabled:e,title:`Install to another folder`,"aria-label":`Install to a custom folder`,className:`shrink-0 w-7 h-7 rounded-r-sm flex items-center justify-center cursor-pointer
@@ -16,19 +16,22 @@ Error generating stack: `+e.message+`
16
16
  disabled:opacity-40 disabled:cursor-not-allowed`,children:(0,G.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,G.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})}),i&&(0,G.jsxs)(`div`,{className:`absolute z-20 bottom-full right-0 mb-1 min-w-[180px] rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-2)] shadow-lg overflow-hidden`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),a(!1),n()},className:`w-full text-left px-3 py-2 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-1)] hover:bg-[var(--color-surface-3)] cursor-pointer`,children:`default rules dir`}),(0,G.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),a(!1),r()},className:`w-full text-left px-3 py-2 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-1)] hover:bg-[var(--color-surface-3)] cursor-pointer border-t border-[var(--color-line-1)]`,children:`pick folder…`})]})]})}function _u({rs:e,installs:t,installingId:n,uninstallingKey:r,onInstall:i,onUninstall:a,onPickAndInstall:o,flashId:s}){let c=n===e.id,l=s===e.id,u=t.length,d=t.some(e=>!e.in_sync);return(0,G.jsxs)(`div`,{className:`group relative flex flex-col rounded-sm border bg-[var(--color-surface-1)] transition-colors overflow-hidden
17
17
  ${d?`border-amber-500/40 hover:border-amber-500/60`:u>0?`border-emerald-500/25 hover:border-emerald-500/40`:`border-[var(--color-line-1)] hover:border-[var(--color-line-2)]`}
18
18
  ${l?`ring-1 ring-emerald-500/40`:``}`,children:[u>0&&(0,G.jsxs)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-1 px-1.5 py-0.5 rounded-sm border text-[10px] font-mono uppercase tracking-wider
19
- ${d?`bg-amber-500/10 border-amber-500/30 text-amber-300`:`bg-emerald-500/10 border-emerald-500/30 text-emerald-300`}`,title:d?`At least one install has drifted from the recorded files`:`All installs are in sync with the database`,children:[d?(0,G.jsxs)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,children:[(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),(0,G.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}):(0,G.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,children:(0,G.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),u===1?`installed`:`${u}× installed`]}),(0,G.jsxs)(`a`,{href:`/hub/${e.id}`,className:`block p-3 flex-1 min-h-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 pr-20`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-[var(--color-fg-0)] leading-snug`,children:e.title}),e.tested_versions&&e.tested_versions.length>0&&(0,G.jsx)(`span`,{title:`Certified ruleset`,className:`text-[var(--color-brand)] text-[11px]`,children:`★`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] mt-0.5 font-mono`,children:[`@`,e.author]})]}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] shrink-0 mt-0.5`,children:[`v`,e.version]})]}),e.technologies.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 mb-3`,children:[e.technologies.slice(0,4).map(e=>(0,G.jsx)(mu,{tech:e},e)),e.technologies.length>4&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] self-center`,children:[`+`,e.technologies.length-4]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,G.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),(0,G.jsx)(`span`,{className:`tabular-nums`,children:e.rule_count}),(0,G.jsx)(`span`,{className:`uppercase tracking-wider text-[10px] text-[var(--color-fg-4)]`,children:`rules`})]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`polyline`,{points:`8 17 12 21 16 17`}),(0,G.jsx)(`line`,{x1:`12`,y1:`12`,x2:`12`,y2:`21`}),(0,G.jsx)(`path`,{d:`M20.88 18.09A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.29`})]}),(0,G.jsx)(`span`,{className:`tabular-nums`,children:cu(e.download_count)})]})]})]}),u>0&&(0,G.jsx)(`div`,{className:`px-3 pb-2 flex flex-wrap gap-1`,children:t.map(t=>(0,G.jsx)(hu,{install:t,onRemove:t=>a(e.id,t),removing:r===`${e.id}::${t.path}`},t.path))}),(0,G.jsx)(`div`,{className:`px-3 pb-3 pt-0`,children:(0,G.jsx)(gu,{isInstalling:c,hasInstalls:u>0,onInstallDefault:()=>i(e.id),onPickPath:()=>o(e.id)})})]})}function vu(){let{mode:e}=ru();return e===`newcomer`?(0,G.jsx)(su,{}):(0,G.jsx)(yu,{})}function yu(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(`downloads`),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(`all`),[u,d]=(0,_.useState)([]),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(0),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)({}),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(null),[D,O]=(0,_.useState)(null),ee=(0,_.useCallback)((t=0)=>{let r=new URLSearchParams({page:String(t)});return e&&r.set(`search`,e),n&&n!==`downloads`&&r.set(`sort`,n),i&&r.set(`decision`,i),o&&r.set(`severity`,o),r},[e,n,i,o]),te=(0,_.useCallback)(async()=>{try{let e=await fetch(`/api/json/hub/installed`);if(!e.ok)return;let t=await e.json(),n={};for(let e of t.installs??[])n[e.id]||(n[e.id]=[]),n[e.id].push(e);b(n)}catch{}},[]);(0,_.useEffect)(()=>{te()},[te]),(0,_.useEffect)(()=>{let e=!1;return v(!0),h(0),fetch(`/api/json/hub?${ee(0)}`).then(e=>e.json()).then(t=>{e||(d(t.data),p(t.has_more),h(0))}).catch(()=>{}).finally(()=>{e||v(!1)}),()=>{e=!0}},[ee]);async function k(){let e=m+1;v(!0);try{let t=await fetch(`/api/json/hub?${ee(e)}`);if(!t.ok)return;let n=await t.json();d(e=>[...e,...n.data]),p(n.has_more),h(e)}catch{}finally{v(!1)}}async function A(){let e=await fetch(`/api/json/hub?${ee(0)}`);if(!e.ok)return;let t=await e.json();d(t.data),p(t.has_more),h(0)}async function ne(e,t){S(e);try{let n={id:e};t&&(n.path=t);let r=await(await fetch(`/api/hub/install`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...z()},body:JSON.stringify(n)})).json();r.ok?(E(e),setTimeout(()=>E(null),2e3),O({msg:r.already_installed?`${r.title??e} — already installed${r.path?` at ${lu(r.path)}`:``}`:`installed ${r.title??e}${r.path?` → ${lu(r.path)}`:``}`,type:`ok`}),await Promise.all([te(),A()])):O({msg:r.error??`install failed`,type:`error`})}catch(e){O({msg:e instanceof Error?e.message:`network error`,type:`error`})}finally{S(null),setTimeout(()=>O(null),5e3)}}async function re(e){await ne(e)}async function ie(e){let t=null;try{let e=await fetch(`/api/json/pick-dir`,{method:`POST`});if(e.ok){let n=await e.json();if(n.ok&&n.path)t=n.path;else if(n.reason===`user_cancelled`)return;else if(n.reason===`no_display`||n.reason===`no_picker_found`){let e=prompt(`Folder picker is unavailable on this host. Type the absolute path to install to:`);e&&e.trim()&&(t=e.trim())}else{O({msg:n.error??`could not open folder picker`,type:`error`}),setTimeout(()=>O(null),5e3);return}}}catch{let e=prompt(`Folder picker is unavailable. Type the absolute path to install to:`);e&&e.trim()&&(t=e.trim())}t&&await ne(e,t)}async function j(e,t){w(`${e}::${t}`);try{let n=await(await fetch(`/api/hub/uninstall`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...z()},body:JSON.stringify({id:e,path:t})})).json();n.ok?(O({msg:`removed ${e} from ${lu(t)}`,type:`ok`}),await Promise.all([te(),A()])):O({msg:n.error??`uninstall failed`,type:`error`})}catch(e){O({msg:e instanceof Error?e.message:`network error`,type:`error`})}finally{w(null),setTimeout(()=>O(null),5e3)}}let M=c===`installed`?u.filter(e=>(y[e.id]?.length??0)>0):u,ae=u.filter(e=>(y[e.id]?.length??0)>0).length,oe=`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-2)] text-[11px] font-mono rounded-sm px-2.5 h-8 focus:outline-none focus:border-[var(--color-brand)]/50 cursor-pointer`;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`overline text-[11px]`,children:`hub`}),(0,G.jsx)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-1 font-mono`,children:`install community rule packs from hub.sigmashake.com`})]}),(0,G.jsxs)(`a`,{href:`/hub/connect`,className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-2)] hover:text-[var(--color-brand)] transition-colors border border-[var(--color-line-1)] hover:border-[var(--color-brand)]/40 rounded-sm px-3 h-7`,children:[(0,G.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,G.jsx)(`path`,{d:`M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22`})}),`connect github`]})]}),D&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm px-3 py-2 text-[11px] font-mono border
19
+ ${d?`bg-amber-500/10 border-amber-500/30 text-amber-300`:`bg-emerald-500/10 border-emerald-500/30 text-emerald-300`}`,title:d?`At least one install has drifted from the recorded files`:`All installs are in sync with the database`,children:[d?(0,G.jsxs)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,children:[(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),(0,G.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}):(0,G.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,children:(0,G.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),u===1?`installed`:`${u}× installed`]}),(0,G.jsxs)(`a`,{href:`/hub/${e.id}`,className:`block p-3 flex-1 min-h-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 pr-20`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-[var(--color-fg-0)] leading-snug`,children:e.title}),e.tested_versions&&e.tested_versions.length>0&&(0,G.jsx)(`span`,{title:`Certified ruleset`,className:`text-[var(--color-brand)] text-[11px]`,children:`★`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] mt-0.5 font-mono`,children:[`@`,e.author]})]}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] shrink-0 mt-0.5`,children:[`v`,e.version]})]}),e.technologies.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 mb-3`,children:[e.technologies.slice(0,4).map(e=>(0,G.jsx)(mu,{tech:e},e)),e.technologies.length>4&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] self-center`,children:[`+`,e.technologies.length-4]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,G.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),(0,G.jsx)(`span`,{className:`tabular-nums`,children:e.rule_count}),(0,G.jsx)(`span`,{className:`uppercase tracking-wider text-[10px] text-[var(--color-fg-4)]`,children:`rules`})]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`polyline`,{points:`8 17 12 21 16 17`}),(0,G.jsx)(`line`,{x1:`12`,y1:`12`,x2:`12`,y2:`21`}),(0,G.jsx)(`path`,{d:`M20.88 18.09A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.29`})]}),(0,G.jsx)(`span`,{className:`tabular-nums`,children:cu(e.download_count)})]})]})]}),u>0&&(0,G.jsx)(`div`,{className:`px-3 pb-2 flex flex-wrap gap-1`,children:t.map(t=>(0,G.jsx)(hu,{install:t,onRemove:t=>a(e.id,t),removing:r===`${e.id}::${t.path}`},t.path))}),(0,G.jsx)(`div`,{className:`px-3 pb-3 pt-0`,children:(0,G.jsx)(gu,{isInstalling:c,hasInstalls:u>0,onInstallDefault:()=>i(e.id),onPickPath:()=>o(e.id)})})]})}function vu(){let{mode:e}=ru();return e===`newcomer`?(0,G.jsx)(su,{}):(0,G.jsx)(yu,{})}function yu(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(`downloads`),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(`all`),[u,d]=(0,_.useState)([]),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(0),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)({}),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(null),[D,O]=(0,_.useState)(null),ee=(0,_.useCallback)((t=0)=>{let r=new URLSearchParams({page:String(t)});return e&&r.set(`search`,e),n&&n!==`downloads`&&r.set(`sort`,n),i&&r.set(`decision`,i),o&&r.set(`severity`,o),r},[e,n,i,o]),k=(0,_.useCallback)(async()=>{try{let e=await fetch(`/api/json/hub/installed`);if(!e.ok)return;let t=await e.json(),n={};for(let e of t.installs??[])n[e.id]||(n[e.id]=[]),n[e.id].push(e);b(n)}catch{}},[]);(0,_.useEffect)(()=>{k()},[k]),(0,_.useEffect)(()=>{let e=!1;return v(!0),h(0),fetch(`/api/json/hub?${ee(0)}`).then(e=>e.json()).then(t=>{e||(d(t.data),p(t.has_more),h(0))}).catch(()=>{}).finally(()=>{e||v(!1)}),()=>{e=!0}},[ee]);async function A(){let e=m+1;v(!0);try{let t=await fetch(`/api/json/hub?${ee(e)}`);if(!t.ok)return;let n=await t.json();d(e=>[...e,...n.data]),p(n.has_more),h(e)}catch{}finally{v(!1)}}async function j(){let e=await fetch(`/api/json/hub?${ee(0)}`);if(!e.ok)return;let t=await e.json();d(t.data),p(t.has_more),h(0)}async function te(e,t){S(e);try{let n={id:e};t&&(n.path=t);let r=await(await fetch(`/api/hub/install`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...ke()},body:JSON.stringify(n)})).json();r.ok?(E(e),setTimeout(()=>E(null),2e3),O({msg:r.already_installed?`${r.title??e} — already installed${r.path?` at ${lu(r.path)}`:``}`:`installed ${r.title??e}${r.path?` → ${lu(r.path)}`:``}`,type:`ok`}),await Promise.all([k(),j()])):O({msg:r.error??`install failed`,type:`error`})}catch(e){O({msg:e instanceof Error?e.message:`network error`,type:`error`})}finally{S(null),setTimeout(()=>O(null),5e3)}}async function ne(e){await te(e)}async function re(e){let t=null;try{let e=await fetch(`/api/json/pick-dir`,{method:`POST`});if(e.ok){let n=await e.json();if(n.ok&&n.path)t=n.path;else if(n.reason===`user_cancelled`)return;else if(n.reason===`no_display`||n.reason===`no_picker_found`){let e=prompt(`Folder picker is unavailable on this host. Type the absolute path to install to:`);e&&e.trim()&&(t=e.trim())}else{O({msg:n.error??`could not open folder picker`,type:`error`}),setTimeout(()=>O(null),5e3);return}}}catch{let e=prompt(`Folder picker is unavailable. Type the absolute path to install to:`);e&&e.trim()&&(t=e.trim())}t&&await te(e,t)}async function M(e,t){w(`${e}::${t}`);try{let n=await(await fetch(`/api/hub/uninstall`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,...ke()},body:JSON.stringify({id:e,path:t})})).json();n.ok?(O({msg:`removed ${e} from ${lu(t)}`,type:`ok`}),await Promise.all([k(),j()])):O({msg:n.error??`uninstall failed`,type:`error`})}catch(e){O({msg:e instanceof Error?e.message:`network error`,type:`error`})}finally{w(null),setTimeout(()=>O(null),5e3)}}let N=c===`installed`?u.filter(e=>(y[e.id]?.length??0)>0):u,ie=u.filter(e=>(y[e.id]?.length??0)>0).length,ae=`bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-2)] text-[11px] font-mono rounded-sm px-2.5 h-8 focus:outline-none focus:border-[var(--color-brand)]/50 cursor-pointer`;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`overline text-[11px]`,children:`hub`}),(0,G.jsx)(`p`,{className:`text-xs text-[var(--color-fg-3)] mt-1 font-mono`,children:`install community rule packs from hub.sigmashake.com`})]}),(0,G.jsxs)(`a`,{href:`/hub/connect`,className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-2)] hover:text-[var(--color-brand)] transition-colors border border-[var(--color-line-1)] hover:border-[var(--color-brand)]/40 rounded-sm px-3 h-7`,children:[(0,G.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,G.jsx)(`path`,{d:`M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22`})}),`connect github`]})]}),D&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm px-3 py-2 text-[11px] font-mono border
20
20
  ${D.type===`ok`?`bg-emerald-500/5 border-emerald-500/25 text-emerald-300`:`bg-red-500/5 border-red-500/25 text-red-300`}`,children:[(0,G.jsxs)(`span`,{children:[D.type===`ok`?`✓ `:`✗ `,D.msg]}),(0,G.jsx)(`button`,{onClick:()=>O(null),className:`ml-3 opacity-60 hover:opacity-100 cursor-pointer`,children:`✕`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center bg-[var(--color-surface-1)] border border-[var(--color-line-1)] rounded-sm p-0.5 shrink-0`,children:[(0,G.jsx)(`button`,{onClick:()=>l(`all`),className:`px-3 h-6 rounded-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer
21
21
  ${c===`all`?`bg-[var(--color-surface-3)] text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,children:`all`}),(0,G.jsxs)(`button`,{onClick:()=>l(`installed`),className:`px-3 h-6 rounded-sm text-[11px] font-mono uppercase tracking-wider transition-colors cursor-pointer flex items-center gap-1.5
22
- ${c===`installed`?`bg-[var(--color-surface-3)] text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,children:[`installed`,ae>0&&(0,G.jsx)(`span`,{className:`text-[9px] bg-emerald-500/15 text-emerald-300 rounded-sm px-1 py-0.5 font-medium tabular-nums`,children:ae})]})]}),(0,G.jsxs)(`div`,{className:`relative flex-1 min-w-[160px]`,children:[(0,G.jsxs)(`svg`,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)]`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,G.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,G.jsx)(`input`,{type:`text`,placeholder:`search rulesets…`,value:e,onChange:e=>t(e.target.value),className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-xs rounded-sm pl-8 pr-3 h-8 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})]}),(0,G.jsx)(`select`,{value:n,onChange:e=>r(e.target.value),className:oe,children:uu.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,G.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),className:oe,children:[(0,G.jsx)(`option`,{value:``,children:`any decision`}),fu.filter(Boolean).map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),className:oe,children:[(0,G.jsx)(`option`,{value:``,children:`any severity`}),du.filter(Boolean).map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]})]}),g&&u.length===0?(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,G.jsx)(pu,{},t))}):M.length===0?(0,G.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] py-16 flex flex-col items-center justify-center text-center`,children:[(0,G.jsxs)(`svg`,{className:`text-[var(--color-fg-4)] mb-3`,width:`36`,height:`36`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,G.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,G.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,G.jsx)(`p`,{className:`text-xs font-mono text-[var(--color-fg-3)] uppercase tracking-wider`,children:c===`installed`?`no rulesets installed yet — browse and click install`:`no rulesets found${e?` matching "${e}"`:``}`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:M.map(e=>(0,G.jsx)(_u,{rs:e,installs:y[e.id]??[],installingId:x,uninstallingKey:C,onInstall:re,onUninstall:j,onPickAndInstall:ie,flashId:T},e.id))}),f&&c===`all`&&(0,G.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,G.jsx)(`button`,{onClick:k,disabled:g,className:`h-8 px-5 rounded-sm text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-2)] border border-[var(--color-line-1)] hover:text-[var(--color-fg-0)] hover:border-[var(--color-line-2)] transition-colors cursor-pointer disabled:opacity-40`,children:g?`loading…`:`load more`})})]})]})}var bu={deny:`red`,block:`red`,ask:`amber`,allow:`green`,log:`gray`,force:`blue`};function xu({id:e}){let{data:t,error:n}=B(`/api/json/hub/${e}`),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1);if(n)return(0,G.jsxs)(`div`,{className:`text-sm text-red-300 font-mono`,children:[(0,G.jsx)(`p`,{children:n}),(0,G.jsx)(`a`,{href:`/hub`,className:`text-[var(--color-brand)] hover:underline mt-3 block text-[11px] uppercase tracking-wider`,children:`← back to hub`})]});if(!t)return(0,G.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading ruleset…`});async function s(){o(!0);try{(await fetch(`/api/hub/install`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({id:e})})).ok&&i(!0)}finally{o(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`← hub`}),(0,G.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-1.5 text-[var(--color-fg-0)]`,children:t.title}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-1 tabular-nums`,children:[`@`,t.author,` · v`,t.version,` · `,t.rule_count,` rule`,t.rule_count===1?``:`s`]})]}),(0,G.jsx)(Y,{variant:r?`secondary`:`primary`,onClick:s,disabled:a||r,children:r?`✓ installed`:a?`installing…`:`install`})]}),t.technologies.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.technologies.map(e=>(0,G.jsx)(cr,{variant:`blue`,children:e},e))}),t.github_repo&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`source`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:t.github_repo})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsxs)(`span`,{className:`overline`,children:[`rules · `,t.rules.length]})}),(0,G.jsx)(J,{className:`space-y-4`,children:t.rules.map((e,t)=>(0,G.jsxs)(`div`,{className:t>0?`border-t border-[var(--color-line-0)] pt-4`:void 0,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 flex-wrap`,children:[(0,G.jsx)(cr,{variant:bu[e.decision]??`gray`,children:e.decision}),(0,G.jsx)(`code`,{className:`text-xs text-[var(--color-brand)] font-mono`,children:e.name}),e.capability&&(0,G.jsx)(cr,{variant:`gray`,children:e.capability})]}),(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-1)] mb-2`,children:e.message}),(0,G.jsx)(hc,{children:e.raw_text})]},e.id))})]})]})}function Su(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(`idle`),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!1);async function u(){l(!0),a(``);try{let e=await fetch(`/api/hub/device-start`,{method:`POST`,headers:{Accept:`application/json`,...z()}}),n=await e.json();if(!e.ok){let t=n;t.error===`not_configured`?(r(`not_configured`),s(t.setup_steps??[]),a(t.message??`GitHub OAuth not configured.`)):(a(n.error??`HTTP ${e.status}`),r(`error`));return}t(n),r(`polling`)}catch(e){a(e instanceof Error?e.message:`Failed to start`),r(`error`)}finally{l(!1)}}return(0,_.useEffect)(()=>{if(n!==`polling`||!e)return;let t=setInterval(async()=>{try{let n=await(await fetch(`/api/hub/device-poll?flow=${e.flow_id}`,{headers:{Accept:`application/json`}})).json();n.status===`complete`?(clearInterval(t),r(`done`),a(`connected as @${n.session?.login??`GitHub`} — you can now publish rulesets`)):(n.status===`expired`||n.status===`error`)&&(clearInterval(t),r(`error`),a(n.error??`Authentication failed`))}catch{}},3e3);return()=>clearInterval(t)},[n,e]),(0,G.jsxs)(`div`,{className:`max-w-lg mx-auto space-y-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`a`,{href:`/hub`,className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors`,children:[(0,G.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,G.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),`back to hub`]}),(0,G.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-2 text-[var(--color-fg-0)]`,children:`Connect GitHub`}),(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-3)] mt-1 font-mono`,children:`authenticate with github to publish rulesets to the hub`})]}),n===`not_configured`&&(0,G.jsx)(K,{children:(0,G.jsxs)(J,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`text-amber-300 shrink-0 mt-0.5`,children:(0,G.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,G.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,G.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-[var(--color-fg-0)]`,children:`GitHub OAuth not configured`}),(0,G.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] mt-1 leading-relaxed`,children:i})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-[var(--color-line-0)] pt-4`,children:[(0,G.jsx)(`div`,{className:`overline mb-3`,children:`setup steps`}),(0,G.jsx)(`ol`,{className:`space-y-2`,children:o.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2.5 text-xs text-[var(--color-fg-1)]`,children:[(0,G.jsx)(`span`,{className:`shrink-0 w-5 h-5 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)] text-[var(--color-fg-3)] text-[10px] font-mono flex items-center justify-center tabular-nums`,children:t+1}),(0,G.jsx)(`span`,{className:`mt-0.5 leading-relaxed`,children:e.replace(/^\d+\.\s+/,``)})]},t))})]}),(0,G.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-3`,children:[(0,G.jsx)(`div`,{className:`overline mb-1.5`,children:`quick start`}),(0,G.jsx)(`code`,{className:`text-[11px] text-[var(--color-brand)]/90 font-mono`,children:`export SSG_GITHUB_CLIENT_ID=<your-client-id>`}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-1`,children:[`then restart:`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-fg-1)]`,children:`ssg serve`})]})]}),(0,G.jsx)(`a`,{href:`https://github.com/settings/applications/new`,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline`,children:`create github oauth app →`})]})}),n===`idle`&&(0,G.jsx)(K,{children:(0,G.jsxs)(J,{children:[(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] mb-4 leading-relaxed`,children:`This uses GitHub's device authorization flow — no redirect URIs needed. You'll be shown a code to enter at github.com.`}),(0,G.jsx)(Y,{onClick:u,disabled:c,variant:`primary`,children:c?`starting…`:`connect with github`})]})}),e&&n===`polling`&&(0,G.jsx)(K,{children:(0,G.jsxs)(J,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(`div`,{className:`overline mb-2`,children:`open this url in your browser`}),(0,G.jsx)(`a`,{href:e.verification_uri,target:`_blank`,rel:`noreferrer`,className:`text-sm text-[var(--color-brand)] hover:underline font-mono`,children:e.verification_uri})]}),(0,G.jsxs)(`div`,{className:`border border-[var(--color-line-1)] bg-[var(--color-surface-0)] rounded-sm py-5 text-center`,children:[(0,G.jsx)(`div`,{className:`overline mb-3`,children:`enter this code`}),(0,G.jsx)(`div`,{className:`text-4xl font-mono font-bold tracking-[0.3em] text-[var(--color-fg-0)]`,children:e.user_code})]}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] text-center flex items-center justify-center gap-2`,children:[(0,G.jsx)(`svg`,{className:`animate-spin`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,G.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),`waiting for github authorization…`]})]})}),n===`done`&&(0,G.jsxs)(`div`,{className:`rounded-sm border border-emerald-500/25 bg-emerald-500/5 p-4 text-sm text-emerald-200 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,G.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),(0,G.jsx)(`span`,{className:`font-mono text-xs`,children:i})]}),(0,G.jsx)(`a`,{href:`/hub/publish`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline block mt-1`,children:`publish a ruleset →`})]}),n===`error`&&i&&(0,G.jsxs)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/5 p-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-red-200 font-mono`,children:i}),(0,G.jsx)(`button`,{onClick:()=>{r(`idle`),a(``)},className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] mt-3 cursor-pointer uppercase tracking-wider`,children:`← try again`})]})]})}function Cu(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null);async function o(t){if(t.preventDefault(),e.trim()){r(!0),a(null);try{a(await(await fetch(`/api/hub/publish`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({repo_url:e.trim()})})).json())}catch(e){a({ok:!1,error:e instanceof Error?e.message:`Unknown error`})}finally{r(!1)}}}return(0,G.jsxs)(`div`,{className:`max-w-md mx-auto space-y-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`← hub`}),(0,G.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-2 text-[var(--color-fg-0)]`,children:`Publish Ruleset`}),(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-3)] mt-1 font-mono`,children:`publish a github repository containing .rules files to the hub`})]}),(0,G.jsx)(K,{children:(0,G.jsx)(J,{children:(0,G.jsxs)(`form`,{onSubmit:o,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block overline mb-1.5`,children:`github repository url`}),(0,G.jsx)(`input`,{type:`url`,placeholder:`https://github.com/owner/repo`,value:e,onChange:e=>t(e.target.value),required:!0,className:`w-full bg-[var(--color-surface-0)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-sm rounded-sm px-3 py-2 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})]}),(0,G.jsx)(Y,{type:`submit`,variant:`primary`,disabled:n,children:n?`publishing…`:`publish to hub`})]})})}),i&&(0,G.jsx)(`div`,{className:`rounded-sm border px-3 py-2 text-xs font-mono ${i.ok?`border-emerald-500/25 bg-emerald-500/5 text-emerald-300`:`border-red-500/25 bg-red-500/5 text-red-300`}`,children:i.ok?(0,G.jsxs)(G.Fragment,{children:[`✓ published!`,` `,i.id&&(0,G.jsx)(`a`,{href:`/hub/${i.id}`,className:`text-[var(--color-brand)] hover:underline uppercase tracking-wider text-[11px] ml-2`,children:`view ruleset →`})]}):i.error??`publish failed`})]})}function wu(e){return e===0?`—`:e<1e3?`${e}ns`:e<1e6?`${(e/1e3).toFixed(1)}µs`:`${(e/1e6).toFixed(1)}ms`}function Tu(e){let t=Math.floor(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 Eu(e){let t=e<1e10?e*1e3:e,n=new Date(t);return`${String(n.getHours()).padStart(2,`0`)}:${String(n.getMinutes()).padStart(2,`0`)}:${String(n.getSeconds()).padStart(2,`0`)}`}function Du(e){let t=Math.round((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}var Ou={allow:`text-emerald-300`,block:`text-red-300`,force:`text-violet-300`,log:`text-amber-300`,ask:`text-sky-300`,shadow:`text-[var(--color-fg-3)]`},ku={allow:`✓`,block:`✗`,force:`→`,log:`·`,ask:`?`,shadow:`~`};function Au({label:e,ns:t,maxNs:n}){let r=n>0?Math.min(100,t/n*100):0;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] w-8 text-right font-mono uppercase tracking-wider text-[10px]`,children:e}),(0,G.jsx)(Cc,{pct:r,tone:t<1e5?`green`:t<1e6?`amber`:`red`,className:`h-1 flex-1`}),(0,G.jsx)(`span`,{className:`font-mono text-[var(--color-fg-1)] tabular-nums w-14 text-right`,children:wu(t)})]})}function ju({value:e,max:t,threshold:n,breached:r}){let i=t>0?Math.min(100,e/t*100):0,a=t>0?Math.min(100,n/t*100):0;return(0,G.jsx)(Cc,{pct:i,tone:r?`red`:e/t>=.6?`amber`:`green`,markerPct:a,markerTitle:`limit: ${n}`,className:`h-1`})}function Mu({limitsData:e,onSaved:t}){let[n,r]=(0,_.useState)(String(e.config.cpuLimitPct)),[i,a]=(0,_.useState)(String(e.config.memoryLimitMb)),[o,s]=(0,_.useState)(e.config.breachAction),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null);async function f(){l(!0),d(null);try{let e=await fetch(`/api/json/limits`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({cpu_limit_pct:parseFloat(n),memory_limit_mb:parseFloat(i),breach_action:o})});e.ok?t():d((await e.json()).error??`save failed`)}catch{d(`network error`)}finally{l(!1)}}let p=`w-full bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-2 py-1.5 text-[var(--color-fg-1)] font-mono text-xs focus:outline-none focus:border-[var(--color-brand)]/50`;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`overline block mb-1.5`,children:`cpu limit (%)`}),(0,G.jsx)(`input`,{type:`number`,min:1,max:100,value:n,onChange:e=>r(e.target.value),className:p})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`overline block mb-1.5`,children:`memory limit (mb)`}),(0,G.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(e.target.value),className:p})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`overline block mb-1.5`,children:`on breach`}),(0,G.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),className:p,children:[(0,G.jsx)(`option`,{value:`warn`,children:`warn in ui only`}),(0,G.jsx)(`option`,{value:`log`,children:`warn + write to audit log`})]})]}),u&&(0,G.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:u}),(0,G.jsx)(Y,{onClick:f,disabled:c,variant:`primary`,size:`sm`,children:c?`saving…`:`save limits`})]})}var Nu={running:`green`,hibernating:`amber`,exhausted:`red`,stopped:`gray`,idle:`gray`};function Pu(e,t){let n=e-t;if(n<=0)return`any moment`;let r=Math.round(n/1e3);if(r<60)return`in ${r}s`;let i=Math.floor(r/60);return i<60?`in ${i}m ${r%60}s`:`in ${Math.floor(i/60)}h ${i%60}m`}function Fu({supervisors:e}){let[t,n]=(0,_.useState)(Date.now());return(0,_.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2 overline`,children:[`supervisor health`,e.some(e=>e.state===`hibernating`||e.state===`exhausted`)&&(0,G.jsx)(cr,{variant:`amber`,children:`degraded`})]}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono tabular-nums text-[var(--color-fg-4)]`,children:[e.length,` supervisor`,e.length===1?``:`s`]})]}),(0,G.jsx)(J,{children:e.length===0?(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no supervisors registered yet`}):(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-xs font-mono`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider text-[var(--color-fg-4)]`,children:[(0,G.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`name`}),(0,G.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`kind`}),(0,G.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`state`}),(0,G.jsx)(`th`,{className:`text-right font-normal pb-1.5`,children:`restarts`}),(0,G.jsx)(`th`,{className:`text-left font-normal pb-1.5 pl-4`,children:`last restart`}),(0,G.jsx)(`th`,{className:`text-left font-normal pb-1.5 pl-4`,children:`next retry`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsxs)(`tr`,{className:`border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(`td`,{className:`py-1.5 text-[var(--color-fg-1)]`,children:e.name}),(0,G.jsx)(`td`,{className:`py-1.5 text-[var(--color-fg-3)]`,children:e.kind===`single`?`single`:`tree`}),(0,G.jsx)(`td`,{className:`py-1.5`,children:(0,G.jsx)(cr,{variant:Nu[e.state],children:e.state})}),(0,G.jsx)(`td`,{className:`py-1.5 text-right tabular-nums text-[var(--color-fg-1)]`,children:e.restarts}),(0,G.jsx)(`td`,{className:`py-1.5 pl-4 tabular-nums text-[var(--color-fg-3)]`,children:e.lastRestartAt>0?Du(e.lastRestartAt):`—`}),(0,G.jsx)(`td`,{className:`py-1.5 pl-4 tabular-nums text-[var(--color-fg-3)]`,children:e.nextRetryAt>0?(0,G.jsx)(`span`,{title:e.hibernateReason?`reason: ${e.hibernateReason}`:void 0,children:Pu(e.nextRetryAt,t)}):`—`})]},e.name))})]})})})]})}function Iu(){let e=Ae([`runtime-tick`,`activity-updated`,`limits-breach`,`supervisor-changed`]),t=Oe(),[n,r]=(0,_.useState)(Date.now()),[i,a]=(0,_.useState)(0),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(0),[u,d]=(0,_.useState)(!1),f=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(e)},[]);let{data:p}=B(`/api/state/runtime`,[e[`runtime-tick`]]),{data:m,refetch:h}=B(`/api/json/limits`,[e[`limits-breach`]]),{data:g}=B(`/api/state/activity-tail?after=${i}&limit=50`,[e[`activity-updated`]]),{data:v}=B(`/api/json/supervisors`,[e[`supervisor-changed`],e[`runtime-tick`]]);(0,_.useEffect)(()=>{g&&g.rows.length>0&&(a(e=>Math.max(e,g.maxId)),s(e=>{let t=new Set(e.map(e=>e.id));return[...g.rows.filter(e=>!t.has(e.id)),...e].slice(0,100)}))},[g]),(0,_.useEffect)(()=>{let e=p!==null;f.current===!1&&e&&l(e=>e+1),f.current=e},[p]);let y=p?Tu(p.uptime_ms):null,b=p&&p.last_eval_at>0?Du(p.last_eval_at):null,x=m?.breaches.cpu??!1,S=m?.breaches.memory??!1,C=p?x?`text-red-300`:(p.cpu_pct??0)>=60?`text-amber-300`:`text-emerald-300`:`text-[var(--color-fg-1)]`,w=S?`text-red-300`:`text-[var(--color-fg-1)]`;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-xl font-medium tracking-tight text-[var(--color-fg-0)]`,children:`Daemon Monitor`}),(0,G.jsx)(`p`,{className:`text-[12px] font-mono text-[var(--color-fg-3)] mt-0.5`,children:`live metrics · audit tail · resource limits`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[c>0&&(0,G.jsxs)(cr,{variant:`amber`,children:[c,` restart`,c===1?``:`s`]}),(0,G.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-[var(--color-fg-3)]`,children:Eu(n)})]})]}),(0,G.jsx)(Lu,{cpuPct:p?.cpu_pct??0,cpuLimit:m?.config.cpuLimitPct,memMb:p?.memory_rss_mb??0,memLimit:m?.config.memoryLimitMb,decisions:p?.decisions,latency:p?.latency,burstBuffer:t,evalsTotal:p?.evals_total??0}),m&&(x||S)&&(0,G.jsxs)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/[0.06] border-l-2 border-l-red-500/70 px-3 py-2.5 flex items-start gap-2.5`,children:[(0,G.jsx)(`span`,{className:`text-red-300 shrink-0 mt-0.5`,children:(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z`}),(0,G.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]})}),(0,G.jsxs)(`div`,{className:`space-y-0.5 text-xs font-mono`,children:[x&&(0,G.jsxs)(`div`,{className:`text-red-200`,children:[`cpu limit exceeded: `,p?.cpu_pct??`?`,`% >`,` `,m.config.cpuLimitPct,`%`]}),S&&(0,G.jsxs)(`div`,{className:`text-red-200`,children:[`memory limit exceeded: `,p?.memory_rss_mb??`?`,`mb >`,` `,m.config.memoryLimitMb,`mb`]})]})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`daemon status`})}),(0,G.jsx)(J,{children:p===null?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-500 shrink-0`}),(0,G.jsx)(`span`,{className:`text-red-300 font-mono uppercase tracking-wider text-xs`,children:`down`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] text-xs font-mono`,children:`— socket not reachable`})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-5 flex-wrap text-xs font-mono`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-emerald-400 pulse-soft shrink-0`}),(0,G.jsx)(`span`,{className:`text-emerald-300 uppercase tracking-wider`,children:`up`})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`pid`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:p.pid})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`uptime`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:y})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`mem`,` `,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:[p.memory_rss_mb,`MB`]})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`cpu`,` `,(0,G.jsxs)(`span`,{className:`${C} tabular-nums`,children:[p.cpu_pct,`%`]})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`last eval`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:b??`—`})]})]})})]}),(0,G.jsx)(Fu,{supervisors:v?.supervisors??[]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2 overline`,children:[`system resources`,m&&(x||S)&&(0,G.jsx)(cr,{variant:`red`,children:`limit exceeded`})]}),(0,G.jsx)(`button`,{onClick:()=>d(e=>!e),className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors cursor-pointer`,children:u?`hide limits`:`configure limits`})]}),(0,G.jsxs)(J,{children:[p===null?(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data — daemon not running`}):(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`cpu`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(p.history.cpu_pct.length??0)>1&&(0,G.jsx)(mr,{data:p.history.cpu_pct,width:80,height:20,color:x?`#f87171`:`#34d399`,threshold:m?.config.cpuLimitPct,maxValue:100}),(0,G.jsxs)(`span`,{className:`font-mono font-medium w-12 text-right tabular-nums ${C}`,children:[p.cpu_pct,`%`]})]})]}),(0,G.jsx)(ju,{value:p.cpu_pct,max:100,threshold:m?.config.cpuLimitPct??90,breached:x}),m&&(0,G.jsxs)(`div`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`limit: `,m.config.cpuLimitPct,`%`]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`memory rss`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(p.history.memory_rss_mb.length??0)>1&&(0,G.jsx)(mr,{data:p.history.memory_rss_mb,width:80,height:20,color:S?`#f87171`:`#38bdf8`,threshold:m?.config.memoryLimitMb}),(0,G.jsxs)(`span`,{className:`font-mono font-medium w-16 text-right tabular-nums ${w}`,children:[p.memory_rss_mb,`MB`]})]})]}),(0,G.jsx)(ju,{value:p.memory_rss_mb,max:Math.max(p.memory_rss_mb*1.5,m?.config.memoryLimitMb??512),threshold:m?.config.memoryLimitMb??512,breached:S}),m&&(0,G.jsxs)(`div`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`limit: `,m.config.memoryLimitMb,`MB`]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`heap`}),(0,G.jsxs)(`span`,{className:`font-mono text-[var(--color-fg-1)] tabular-nums`,children:[p.heap_used_mb,`MB / `,p.heap_total_mb,`MB`]})]}),(0,G.jsx)(Cc,{pct:p.heap_total_mb>0?Math.min(100,p.heap_used_mb/p.heap_total_mb*100):0,tone:`blue`,className:`h-1`})]})]}),u&&m&&(0,G.jsxs)(`div`,{className:`mt-5 pt-4 border-t border-[var(--color-line-0)]`,children:[(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-3 leading-relaxed`,children:[`thresholds trigger ui warnings. values are persisted to`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-fg-1)]`,children:`.sigmashake/config.toml`}),`.`]}),(0,G.jsx)(Mu,{limitsData:m,onSaved:()=>{h(),d(!1)}})]})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-2`,children:[(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`total evals`,value:p?.evals_total??`—`,valueClassName:`text-xl font-medium tabular-nums text-[var(--color-fg-0)]`}),(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`allow`,value:p?.decisions.allow??`—`,valueClassName:`text-xl font-medium tabular-nums text-emerald-300`}),(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`block`,value:p?.decisions.block??`—`,valueClassName:`text-xl font-medium tabular-nums text-red-300`}),(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`force`,value:p?.decisions.force??`—`,valueClassName:`text-xl font-medium tabular-nums text-violet-300`}),(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`log`,value:p?.decisions.log??`—`,valueClassName:`text-xl font-medium tabular-nums text-amber-300`}),(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`ask`,value:p?.decisions.ask??`—`,valueClassName:`text-xl font-medium tabular-nums text-sky-300`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`eval latency`}),p&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[p.latency.samples,` samples`]})]}),(0,G.jsx)(J,{children:p===null?(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data`}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Au,{label:`p50`,ns:p.latency.p50_ns,maxNs:p.latency.max_ns}),(0,G.jsx)(Au,{label:`p95`,ns:p.latency.p95_ns,maxNs:p.latency.max_ns}),(0,G.jsx)(Au,{label:`p99`,ns:p.latency.p99_ns,maxNs:p.latency.max_ns}),(0,G.jsx)(Au,{label:`max`,ns:p.latency.max_ns,maxNs:p.latency.max_ns})]})})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`engine`})}),(0,G.jsx)(J,{children:p===null?(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data`}):(0,G.jsx)(`div`,{className:`space-y-1.5 text-xs font-mono`,children:[[`native evals`,p.engine.native_evals],[`ts evals`,p.engine.ts_evals],[`native %`,`${p.engine.native_pct}%`],[`rule reloads`,p.rule_reloads],[`rate limit trips`,p.rate_limit_trips],[`loop guard blocks`,p.loop_guard_blocks],[`connection errors`,p.connection_errors]].map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex justify-between py-0.5 border-b border-[var(--color-line-0)] last:border-0`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:e}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:t})]},e))})})]})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`live event tail`}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`newest first · auto-updating`})]}),(0,G.jsx)(J,{children:o.length===0?(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-4 py-6 text-center`,children:(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no events yet`})}):(0,G.jsx)(`div`,{className:`font-mono text-[11px] max-h-96 overflow-y-auto divide-y divide-[var(--color-line-0)]`,children:o.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] shrink-0 w-16 tabular-nums`,children:Eu(e.timestamp)}),e.tool===`__daemon`?(0,G.jsxs)(`span`,{className:`text-sky-400`,children:[`daemon`,` `,(()=>{try{let t=JSON.parse(e.input??`{}`);return`${t.event??e.decision}${t.detail?` (${t.detail})`:``}`}catch{return e.decision}})()]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`shrink-0 w-16 uppercase tracking-wider text-[10px] ${Ou[e.decision]??`text-[var(--color-fg-3)]`}`,children:[ku[e.decision]??`·`,` `,e.decision]}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] shrink-0 w-24 truncate`,children:e.tool}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] shrink-0 w-14 text-right tabular-nums`,children:wu(e.duration_ns)}),e.rule_id&&(0,G.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] truncate transition-colors`,title:e.rule_id,children:e.rule_id})]})]},e.id))})})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`ai agent debug endpoints`})}),(0,G.jsxs)(J,{children:[(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-2.5`,children:`agents can query these endpoints directly for automated triage:`}),(0,G.jsx)(`div`,{className:`space-y-1 font-mono text-[11px]`,children:[[`/api/state/runtime`,`full metrics snapshot (cpu, memory, history, latency)`],[`/api/json/limits`,`resource limits config + breach state`],[`/api/state/activity-tail?after=0&limit=20`,`recent eval events`],[`/api/json/daemon-status`,`status, pid, log tail`],[`/healthz`,`process uptime`]].map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`GET`}),(0,G.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] transition-colors`,children:e}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`— `,t]})]},e))})]})]})]})}function Lu({cpuPct:e,cpuLimit:t,memMb:n,memLimit:r,decisions:i,latency:a,evalsTotal:o,burstBuffer:s}){let c=(0,_.useMemo)(()=>{if(s.length===0)return 0;let e=Date.now()-1e4;return s.filter(t=>t.ts_ms>=e).length/10},[s]);return(a?.p95_ns??0)/1e6,(a?.p50_ns??0)/1e6,(a?.p99_ns??0)/1e6,(0,G.jsxs)(`div`,{className:`grid-bleed rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,style:{contain:`layout paint`},children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-4 lg:min-h-[320px]`,children:[(0,G.jsxs)(`div`,{className:`lg:col-span-3 flex flex-col items-center justify-start gap-2 lg:max-h-[320px]`,children:[(0,G.jsx)(Kr,{mode:`ring`,value:e,max:100,warnAt:(t??90)/100*.7,critAt:(t??90)/100,display:`${e.toFixed(1)}%`,label:`cpu`,size:220,className:`max-h-[240px]`}),(0,G.jsx)(xr,{value:e,width:260,height:56,windowMs:6e4,color:`#34d399`,fillColor:`rgba(52, 211, 153, 0.14)`,maxValue:100,className:`w-full`})]}),(0,G.jsxs)(`div`,{className:`lg:col-span-3 flex flex-col items-center justify-start gap-2 lg:max-h-[320px]`,children:[(0,G.jsx)(Kr,{mode:`ring`,value:n,max:r??1024,warnAt:.7,critAt:.9,display:`${n.toFixed(0)} MB`,label:`memory`,size:220,className:`max-h-[240px]`}),(0,G.jsx)(xr,{value:n,width:260,height:56,windowMs:6e4,color:`#38bdf8`,fillColor:`rgba(56, 189, 248, 0.14)`,maxValue:r?r*1.1:void 0,className:`w-full`})]}),(0,G.jsx)(`div`,{className:`lg:col-span-6 lg:max-h-[320px]`,children:(0,G.jsx)($r,{latency:a,bursts:s,gaugeMaxMs:10,windowMs:3e4,trendWindowSec:60,gaugeSize:200})})]}),(0,G.jsxs)(`div`,{className:`mt-4 grid grid-cols-1 lg:grid-cols-2 gap-3`,children:[(0,G.jsx)(kr,{label:`Total Evals`,value:o,tone:`amber`,sub:`${c.toFixed(1)}/s`,burstRing:s}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`throughput · 60 s`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[c.toFixed(1),`/s`]})]}),(0,G.jsx)(xr,{value:c,width:420,height:56,windowMs:6e4,className:`w-full`})]})]}),i?(0,G.jsx)(`div`,{className:`mt-4 pt-3 border-t border-[var(--color-line-0)]`,children:(0,G.jsx)(ni,{counters:{allow:i.allow,block:i.block,ask:i.ask,log:i.log,force:i.force,shadow:i.shadow}})}):null,(0,G.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`live event stream · newest first`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:[s.length,` buffered · hover to pause`]})]}),(0,G.jsx)(Ti,{variant:`decision`,bursts:s,windowSize:300,height:260})]})]})}var Ru={ok:`green`,warn:`amber`,error:`red`,unknown:`gray`},zu={ok:`OK`,warn:`Warn`,error:`Error`,unknown:`Idle`};function Bu({title:e,status:t=`unknown`,statusLabel:n,className:r,children:i}){return(0,G.jsxs)(K,{className:W(`flex flex-col`,r),children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline text-[var(--color-fg-2)]`,children:e}),(0,G.jsx)(cr,{variant:Ru[t],children:n??zu[t]})]}),(0,G.jsx)(J,{className:`flex flex-col gap-2 text-[12px]`,children:i})]})}function Vu({label:e,value:t,mono:n=!1,tone:r}){return(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 border-b border-[var(--color-line-0)] last:border-b-0 py-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] uppercase tracking-wider text-[10px] font-mono`,children:e}),(0,G.jsx)(`span`,{className:W(n?`font-mono`:`font-sans`,`tabular-nums text-right truncate`,r===`good`?`text-emerald-300`:r===`warn`?`text-amber-300`:r===`bad`?`text-red-300`:`text-[var(--color-fg-1)]`),children:t})]})}function Hu(e){return e===0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(2)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Uu(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function Wu(e){let t=Math.floor(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 Gu(e){return e?new Date(e*1e3).toLocaleString():`—`}function Ku(e){if(!e||e===0)return`never`;let t=Math.round((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}function qu({children:e,className:t}){return(0,G.jsx)(`div`,{className:`overline mb-2.5 ${t??``}`,children:e})}function Ju({label:e,value:t,mono:n=!0,accent:r}){return(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 py-1.5 border-b border-[var(--color-line-0)] last:border-0`,children:[(0,G.jsx)(`span`,{className:`text-xs text-[var(--color-fg-3)] shrink-0 font-mono`,children:e}),(0,G.jsx)(`span`,{className:`text-xs text-right truncate max-w-[65%] ${n?`font-mono tabular-nums`:``} ${r??`text-[var(--color-fg-1)]`}`,children:t})]})}function Yu({ok:e,label:t,badLabel:n}){return e?(0,G.jsx)(cr,{variant:`green`,children:t}):(0,G.jsx)(cr,{variant:`red`,children:n??t})}function Xu({pct:e,total:t,max:n}){let r=e<60?`green`:e<85?`amber`:`red`,i=e>=85?`text-red-300`:e>=60?`text-amber-300`:`text-emerald-300`;return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs font-mono tabular-nums`,children:[(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[t.toLocaleString(),` / `,n.toLocaleString(),` rows`]}),(0,G.jsxs)(`span`,{className:i,children:[e,`%`]})]}),(0,G.jsx)(Cc,{pct:e,tone:r,className:`h-1.5`})]})}var Zu=3e3,Qu={log:`text-[var(--color-fg-1)]`,info:`text-sky-300`,warn:`text-amber-300`,error:`text-red-300`,debug:`text-[var(--color-fg-3)]`};function $u(e){return e.value==null?e.description?e.description:`[${e.type}]`:String(e.value)}function ed(){let e=Pl(),[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1),p=(0,_.useRef)(null),m=(0,_.useRef)(0),h=(0,_.useRef)(!0);(0,_.useEffect)(()=>{if(h.current){h.current=!1;return}let e=p.current;if(!e)return;let t=e.parentElement;t&&(t.scrollTop=t.scrollHeight)},[a]),(0,_.useEffect)(()=>{if(e.connected)return e.sendCommand(`Runtime.enable`).catch(()=>{}),e.onEvent(`Runtime.consoleAPICalled`,e=>{let t=e;o(e=>{let n=[...e,{id:m.current++,type:t.type??`log`,args:t.args??[],timestamp:t.timestamp??Date.now()}];return n.length>500?n.slice(-500):n})})},[e.connected]),(0,_.useEffect)(()=>{e.preconfiguredTarget&&!e.connected&&!e.connecting&&e.connect(e.preconfiguredTarget.id)},[e]),(0,_.useEffect)(()=>{!e.connected||d||t||r||(f(!0),(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),setTimeout(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch{n(!1)}},Zu)}catch{}})(),e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0}).then(e=>{c(JSON.parse(e.result.value))}).catch(()=>{}))},[e.connected,d,t,r]);let g=(0,_.useCallback)(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),i(null)}catch(e){console.error(`Profiler.start failed:`,e)}},[e]),v=(0,_.useCallback)(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch(e){console.error(`Profiler.stop failed:`,e),n(!1)}},[e]),y=(0,_.useCallback)(async()=>{u(!0);try{let t=await e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0});c(JSON.parse(t.result.value))}catch{}finally{u(!1)}},[e]),b=(0,_.useCallback)(()=>{e.preconfiguredTarget&&e.connect(e.preconfiguredTarget.id)},[e]);return e.active?e.connected?(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono text-[var(--color-fg-2)]`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-emerald-400`}),`connected`,e.bunVersion?` · bun v${e.bunVersion}`:``]}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:e.disconnect,children:`disconnect`})]})]}),e.error&&(0,G.jsx)(J,{children:(0,G.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:e.error})})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`cpu profiler`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300 flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-400 pulse-soft`}),`recording`]}),t?(0,G.jsx)(Y,{variant:`danger`,size:`sm`,onClick:v,children:`stop & render`}):(0,G.jsx)(Y,{variant:`primary`,size:`sm`,onClick:g,children:`start recording`})]})]}),(0,G.jsx)(J,{children:r?(0,G.jsx)(Tc,{profile:r,children:(0,G.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 overflow-x-hidden`,children:(0,G.jsx)(zl,{profile:r})})}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:t?`recording cpu profile (auto-captures ${Zu/1e3}s)… perform actions in ssg to generate data.`:`click start recording, or wait for auto-capture on page load.`})})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`memory`}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:y,disabled:l,children:l?`…`:`refresh`})]}),(0,G.jsx)(J,{children:s?(0,G.jsx)(Ec,{memory:s,formatValue:Uu}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:d?`fetching memory metrics…`:`click refresh to fetch process.memoryUsage().`})})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`console`}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>o([]),children:`clear`})]}),(0,G.jsx)(J,{children:(0,G.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 h-40 overflow-y-auto font-mono text-[11px]`,children:[a.length===0?(0,G.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`console output will appear here…`}):a.map(e=>(0,G.jsxs)(`div`,{className:`py-0.5 border-b border-[var(--color-line-0)] ${Qu[e.type]??`text-[var(--color-fg-1)]`}`,children:[(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)] mr-2 uppercase tracking-wider`,children:[`[`,e.type,`]`]}),e.args.map($u).join(` `)]},e.id)),(0,G.jsx)(`div`,{ref:p})]})})]})]}):(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(cr,{variant:`amber`,children:e.connecting?`connecting…`:`available`}),!e.connecting&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:b,children:`connect`})]})]}),(0,G.jsx)(J,{children:(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:e.connecting?`establishing websocket connection to bun inspector…`:`inspector is active but not connected. click connect to start profiling.`})})]}):(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,G.jsx)(cr,{variant:`outline`,children:`inactive`})]}),(0,G.jsx)(J,{children:(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[`the bun inspector is not active. restart`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg serve`}),` to enable it automatically.`]})})]})}function td(){let[e,t]=(0,_.useState)(0),{data:n}=B(`/api/json/evald-log`,[e]),r=(0,_.useRef)(null),i=(0,_.useRef)(!0);(0,_.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),5e3);return()=>clearInterval(e)},[]),(0,_.useEffect)(()=>{if(i.current){i.current=!1;return}let e=r.current;if(!e)return;let t=e.parentElement;t&&(t.scrollTop=t.scrollHeight)},[n?.lines.length]);let a=n?.lines??[];return(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`daemon log`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] truncate max-w-[60%]`,children:[n?.path?n.path:`loading…`,` · last 200 lines · 5s refresh`]})]}),(0,G.jsxs)(J,{children:[n?.error&&(0,G.jsx)(`p`,{className:`text-xs text-red-300 font-mono mb-2`,children:n.error}),a.length===0&&!n?.error&&(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-4 py-6 text-center`,children:(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[`no log entries yet. start the daemon with`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg serve`}),` to generate log output.`]})}),a.length>0&&(0,G.jsxs)(`pre`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-3 text-[10px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-all max-h-80 overflow-y-auto font-mono leading-relaxed`,children:[a.join(`
23
- `),(0,G.jsx)(`div`,{ref:r})]})]})]})}function nd(){let e=Ae([`runtime-tick`,`rules-changed`]),{data:t,refetch:n}=B(`/api/json/observability`,[e[`runtime-tick`],e[`rules-changed`]]),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(Date.now()),[l,u]=(0,_.useState)(`idle`),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(`idle`);(0,_.useEffect)(()=>{t&&c(Date.now())},[t]);let h=(0,_.useCallback)(async()=>{u(`loading`);try{let e=await(await fetch(`/api/rules/sync-to-db`,{method:`POST`,headers:z()})).json();if(e.ok){u(`done`);let t=(e.pruned_count??0)>0?` (${e.pruned_count} orphan(s) pruned)`:``;f((e.message??`synced ${e.synced} rules`)+t),n()}else u(`error`),f(e.error??`sync failed`)}catch(e){u(`error`),f(String(e))}},[n]),g=(0,_.useCallback)(async()=>{m(`loading`);try{await fetch(`/api/rules/force-reload`,{method:`POST`,headers:z()}),m(`done`),n(),setTimeout(()=>m(`idle`),3e3)}catch{m(`idle`)}},[n]),v=t?.db,y=t?.rules,b=t?.audit,x=t?.process,S=t?.flight_recorder,C=y?.drift_detected??!1;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-xl font-medium tracking-tight text-[var(--color-fg-0)]`,children:`Observability`}),(0,G.jsx)(`p`,{className:`text-[12px] font-mono text-[var(--color-fg-3)] mt-0.5`,children:`sqlite health · rule drift · runtime profiler · diagnostics`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:[`refreshed `,Ku(s)]}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:n,children:`refresh`})]})]}),(0,G.jsx)(rd,{db:v,audit:b,proc:x,flight:S,driftDetected:C}),(0,G.jsxs)(K,{className:C?`border-red-500/30 border-l-2 border-l-red-500/70`:`border-emerald-500/20 border-l-2 border-l-emerald-500/60`,children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`rule drift detector`}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`— .rules files vs sqlite`}),(0,G.jsx)(`button`,{onClick:()=>o(e=>!e),"aria-expanded":a,"aria-label":`Explain these counts`,title:`Why do these numbers differ?`,className:`text-[10px] font-mono text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)] border border-[var(--color-line-1)] rounded-sm px-1.5 py-0.5 transition-colors cursor-pointer`,children:a?`× close`:`? why these numbers`})]}),y&&(C?(0,G.jsx)(cr,{variant:`red`,children:`⚠ drift detected`}):(0,G.jsx)(cr,{variant:`green`,children:`✓ in sync`}))]}),(0,G.jsxs)(J,{children:[a&&(0,G.jsxs)(`div`,{className:`mb-4 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-3 py-2.5 space-y-2 text-[11px] font-mono leading-relaxed text-[var(--color-fg-3)]`,children:[(0,G.jsxs)(`div`,{className:`text-[var(--color-fg-2)]`,children:[(0,G.jsx)(`code`,{children:`.rules files`}),` and `,(0,G.jsx)(`code`,{children:`db rules`}),` are`,` `,(0,G.jsx)(`span`,{className:`text-amber-300`,children:`not auto-synced`}),`. A mismatch is usually expected:`]}),(0,G.jsxs)(`ul`,{className:`space-y-1 pl-3 list-disc marker:text-[var(--color-fg-4)]`,children:[(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`one file can hold many rules`}),` `,`— compare `,(0,G.jsx)(`code`,{children:`db rules`}),` against`,` `,(0,G.jsx)(`code`,{children:`file_rule_count`}),`, not `,(0,G.jsx)(`code`,{children:`file_count`}),`.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in files`}),` `,`means unsynced edits — run`,` `,(0,G.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`}),` or click`,` `,(0,G.jsx)(`code`,{children:`↑ sync files → db`}),`.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in db`}),` `,`with `,(0,G.jsx)(`code`,{children:`source_file IS NULL`}),` is healthy — hub, fleet, or cloud-synced rules legitimately live only in the db.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in db`}),` `,`with `,(0,G.jsx)(`code`,{children:`source_file`}),` set means an orphan from a deleted file — `,(0,G.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`}),` `,`prunes it.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`db rules`}),` `,`includes disabled rows; `,(0,G.jsx)(`code`,{children:`db_enabled_count`}),` `,`excludes them.`]})]}),(0,G.jsxs)(`div`,{className:`pt-1.5 border-t border-[var(--color-line-0)]`,children:[`full reference:`,` `,(0,G.jsx)(`a`,{href:`https://docs.sigmashake.com/rule-storage`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--color-fg-2)] underline decoration-dotted underline-offset-2 hover:text-amber-300 transition-colors`,children:`docs.sigmashake.com/rule-storage ↗`})]})]}),y?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[{label:`.rules files`,value:y.file_count,sub:`${y.file_rule_count} rules total`,tone:`neutral`},{label:`db rules`,value:y.db_rule_count,sub:`${y.db_enabled_count} enabled`,tone:`neutral`},{label:`only in files`,value:y.drift_details.only_in_files.length,tone:y.drift_details.only_in_files.length>0?`amber`:`gray`},{label:`only in db`,value:y.drift_details.only_in_db.length,tone:y.drift_details.only_in_db.length>0?`red`:`gray`}].map(({label:e,value:t,sub:n,tone:r})=>(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)]`,label:e,value:t,sub:n,tone:r,labelPlacement:`above`,subClassName:`text-[var(--color-fg-4)]`,valueClassName:`text-xl font-medium tabular-nums`},e))}),C&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`button`,{onClick:()=>i(e=>!e),className:`text-[10px] font-mono uppercase tracking-wider text-amber-300 hover:text-amber-200 flex items-center gap-1 transition-colors cursor-pointer`,children:[r?`▾`:`▸`,` view drift details`]}),r&&(0,G.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[y.drift_details.only_in_files.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`text-[10px] font-mono uppercase tracking-wider text-amber-300/80 mb-1.5`,children:[`in .rules files but not in db — run`,` `,(0,G.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`})]}),(0,G.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-amber-400/20 rounded-sm p-2 space-y-0.5 max-h-40 overflow-y-auto`,children:y.drift_details.only_in_files.map(e=>(0,G.jsxs)(`div`,{className:`font-mono text-[11px] text-amber-200/80`,children:[`+ `,e]},e))})]}),y.drift_details.only_in_db.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300/80 mb-1.5`,children:`in db but not in any .rules file — orphaned rules`}),(0,G.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-red-400/20 rounded-sm p-2 space-y-0.5 max-h-40 overflow-y-auto`,children:y.drift_details.only_in_db.map(e=>(0,G.jsxs)(`div`,{className:`font-mono text-[11px] text-red-200/80`,children:[`− `,e]},e))})]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(Y,{variant:`primary`,size:`sm`,onClick:h,disabled:l===`loading`,children:l===`loading`?`syncing…`:`↑ sync files → db`}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:g,disabled:p===`loading`,children:p===`loading`?`…`:p===`done`?`✓ reloaded`:`↻ force reload`}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] ml-auto`,children:y.db_rule_count===0?`⚠ db empty — daemon falls back to file-based loading`:`db has ${y.db_rule_count} rules — indexed queries`})]}),l===`done`&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm border border-emerald-500/25 bg-emerald-500/[0.06] px-3 py-2 text-xs font-mono text-emerald-200`,children:[(0,G.jsxs)(`span`,{children:[`✓ `,d]}),(0,G.jsx)(`button`,{onClick:()=>u(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-emerald-500/30 hover:bg-emerald-500/10 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`dismiss`})]}),l===`error`&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm border border-red-500/25 bg-red-500/[0.06] px-3 py-2 text-xs font-mono text-red-200`,children:[(0,G.jsxs)(`span`,{children:[`✗ `,d]}),(0,G.jsx)(`button`,{onClick:()=>u(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-red-500/30 hover:bg-red-500/10 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`dismiss`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-[var(--color-fg-4)] pt-2 border-t border-[var(--color-line-0)]`,children:[(0,G.jsxs)(`span`,{children:[`rules dir:`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:y.rules_dir})]}),(0,G.jsxs)(`span`,{className:`ml-auto`,children:[`last reload:`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:Ku(y.last_reload_at)})]})]})]}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-5`,children:[(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`sqlite database`}),v&&!v.error&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Yu,{ok:v.journal_mode===`wal`,label:`wal`,badLabel:`no wal`}),(0,G.jsx)(Yu,{ok:v.synchronous===`NORMAL`,label:`normal`,badLabel:v.synchronous})]})]}),(0,G.jsx)(J,{children:v?v.error?(0,G.jsx)(`div`,{className:`text-xs text-red-300 font-mono bg-red-500/[0.06] border border-red-500/25 rounded-sm p-2`,children:v.error}):(0,G.jsxs)(`div`,{children:[(0,G.jsx)(qu,{children:`storage`}),(0,G.jsx)(Ju,{label:`file path`,value:v.path}),(0,G.jsx)(Ju,{label:`file size`,value:Hu(v.file_size_bytes)}),(0,G.jsx)(Ju,{label:`allocated`,value:`${Hu(v.allocated_bytes)} (${v.page_count.toLocaleString()} pages × ${v.page_size}B)`}),(0,G.jsx)(qu,{className:`mt-4`,children:`pragma configuration`}),(0,G.jsx)(Ju,{label:`journal_mode`,value:v.journal_mode,accent:v.journal_mode===`wal`?`text-emerald-300`:`text-amber-300`}),(0,G.jsx)(Ju,{label:`synchronous`,value:v.synchronous,accent:v.synchronous===`NORMAL`?`text-emerald-300`:`text-amber-300`}),(0,G.jsx)(Ju,{label:`cache_size`,value:`${v.cache_size_kb.toLocaleString()} KB (${Math.round(v.cache_size_kb/1024)} MB)`}),(0,G.jsx)(Ju,{label:`page_size`,value:`${v.page_size.toLocaleString()} B`}),v.wal_checkpoint&&(0,G.jsx)(Ju,{label:`wal checkpoint`,value:`log ${v.wal_checkpoint.log}, checkpointed ${v.wal_checkpoint.checkpointed}, busy ${v.wal_checkpoint.busy}`}),(0,G.jsx)(qu,{className:`mt-4`,children:`table row counts`}),v.tables.map(e=>(0,G.jsx)(Ju,{label:e.name,value:e.row_count>=0?e.row_count.toLocaleString():`error`,accent:e.row_count<0?`text-red-300`:`text-[var(--color-fg-1)]`},e.name))]}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`audit log capacity`})}),(0,G.jsx)(J,{children:b?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Xu,{pct:b.utilization_pct,total:b.total_rows,max:b.max_rows}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Ju,{label:`total rows`,value:b.total_rows.toLocaleString()}),(0,G.jsx)(Ju,{label:`rotation limit`,value:b.max_rows.toLocaleString()}),(0,G.jsx)(Ju,{label:`utilization`,value:`${b.utilization_pct}%`,accent:b.utilization_pct>=85?`text-red-300`:b.utilization_pct>=60?`text-amber-300`:`text-emerald-300`}),(0,G.jsx)(Ju,{label:`oldest entry`,value:Gu(b.oldest_timestamp)}),(0,G.jsx)(Ju,{label:`newest entry`,value:Gu(b.newest_timestamp)})]}),b.utilization_pct>=85&&(0,G.jsx)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/[0.06] px-3 py-2 text-[11px] font-mono text-red-200`,children:`⚠ audit log nearing rotation limit. oldest entries will be purged automatically.`})]}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`process & runtime`})}),(0,G.jsx)(J,{children:x?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Ju,{label:`pid`,value:x.pid}),(0,G.jsx)(Ju,{label:`uptime`,value:Wu(x.uptime_ms)}),(0,G.jsx)(Ju,{label:`memory (rss)`,value:`${x.memory_rss_mb} MB`}),(0,G.jsx)(Ju,{label:`bun version`,value:x.bun_version}),(0,G.jsx)(Ju,{label:`node compat`,value:x.node_version}),(0,G.jsx)(Ju,{label:`platform`,value:`${x.platform} / ${x.arch}`})]}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]})]})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`flight recorder`})}),(0,G.jsx)(J,{children:S?(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline mb-1.5`,children:`log file`}),(0,G.jsx)(`div`,{className:`text-xs font-mono text-[var(--color-fg-1)] truncate`,children:`…${S.path.slice(-50)}`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline mb-1.5`,children:`file size`}),(0,G.jsx)(`div`,{className:`text-xs font-mono tabular-nums ${S.file_size_bytes===0?`text-[var(--color-fg-4)]`:`text-[var(--color-fg-1)]`}`,children:Hu(S.file_size_bytes)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline mb-1.5`,children:`approx. entries`}),(0,G.jsx)(`div`,{className:`text-xs font-mono tabular-nums ${S.approx_entries===0?`text-[var(--color-fg-4)]`:`text-[var(--color-fg-1)]`}`,children:S.approx_entries===0?`—`:S.approx_entries.toLocaleString()})]})]}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,G.jsx)(ed,{}),(0,G.jsx)(td,{}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`observability api`})}),(0,G.jsxs)(J,{children:[(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-2.5`,children:`machine-readable endpoints for automated monitoring and ai agent triage:`}),(0,G.jsx)(`div`,{className:`space-y-1 font-mono text-[11px]`,children:[[`/api/json/observability`,`sqlite health, rule drift, process info`],[`/api/state/runtime`,`eval latency, decision counters, memory`],[`/api/state/activity-tail?after=0&limit=20`,`recent eval events (live feed)`],[`/api/json/daemon-status`,`daemon pid, status, log tail`],[`/api/json/evald-log`,`last 200 lines of evald.log (daemon stderr)`],[`/healthz`,`process liveness`],[`/readyz`,`sqlite liveness`]].map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`GET`}),(0,G.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] transition-colors`,children:e}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)] hidden sm:inline`,children:[`— `,t]})]},e))})]})]})]})}function rd({db:e,audit:t,proc:n,flight:r,driftDetected:i}){let a=e?e.error?`error`:e.journal_mode===`wal`&&e.synchronous===`NORMAL`?`ok`:`warn`:`unknown`,o=t?t.utilization_pct>=85?`error`:t.utilization_pct>=60?`warn`:`ok`:`unknown`,s=n?n.memory_rss_mb>600?`warn`:`ok`:`unknown`;return(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,G.jsxs)(Bu,{title:`sqlite`,status:a,statusLabel:e?.journal_mode?.toUpperCase()??`idle`,children:[(0,G.jsx)(Vu,{label:`size`,value:e?(0,G.jsx)(pr,{value:e.file_size_bytes,format:e=>Uu(e)}):`—`,mono:!0}),(0,G.jsx)(Vu,{label:`journal`,value:e?.journal_mode??`—`,mono:!0}),(0,G.jsx)(Vu,{label:`sync`,value:e?.synchronous??`—`,mono:!0}),(0,G.jsx)(Vu,{label:`tables`,value:e?.tables.length??0,tone:i?`warn`:`neutral`})]}),(0,G.jsxs)(Bu,{title:`audit log`,status:o,statusLabel:t?`${t.utilization_pct}%`:`idle`,children:[(0,G.jsx)(Vu,{label:`rows`,value:t?(0,G.jsx)(pr,{value:t.total_rows}):`—`}),(0,G.jsx)(Vu,{label:`capacity`,value:t?`${(t.total_rows/Math.max(1,t.max_rows)*100).toFixed(1)}%`:`—`,tone:t&&t.utilization_pct>=85?`bad`:t&&t.utilization_pct>=60?`warn`:`good`}),(0,G.jsx)(Vu,{label:`oldest`,value:Gu(t?.oldest_timestamp??null),mono:!0}),(0,G.jsx)(Vu,{label:`newest`,value:Gu(t?.newest_timestamp??null),mono:!0})]}),(0,G.jsxs)(Bu,{title:`process`,status:s,statusLabel:n?`pid ${n.pid}`:`idle`,children:[(0,G.jsx)(Vu,{label:`uptime`,value:n?Wu(n.uptime_ms):`—`,mono:!0}),(0,G.jsx)(Vu,{label:`rss`,value:n?(0,G.jsxs)(`span`,{children:[(0,G.jsx)(pr,{value:n.memory_rss_mb,format:e=>e.toFixed(0)}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1`,children:`MB`})]}):`—`}),(0,G.jsx)(Vu,{label:`bun`,value:n?.bun_version??`—`,mono:!0}),(0,G.jsx)(Vu,{label:`platform`,value:n?`${n.platform}/${n.arch}`:`—`,mono:!0})]}),(0,G.jsxs)(Bu,{title:`flight recorder`,status:r&&r.file_size_bytes>0?`ok`:`unknown`,statusLabel:r?`${r.approx_entries.toLocaleString()} entries`:`idle`,children:[(0,G.jsx)(Vu,{label:`size`,value:r?(0,G.jsx)(pr,{value:r.file_size_bytes,format:e=>Uu(e)}):`—`,mono:!0}),(0,G.jsx)(Vu,{label:`entries`,value:r?(0,G.jsx)(pr,{value:r.approx_entries}):`—`})]})]})}var id=900,ad=180,od=320,sd=800,cd=4;function ld({sessionKey:e}={}){let t=De(),n=ke(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(`idle`),s=(0,_.useRef)([]),c=(0,_.useRef)(-1),l=(0,_.useRef)(0),u=(0,_.useRef)(null);if((0,_.useEffect)(()=>{if(!t||n===c.current||(c.current=n,t.decision!==`block`&&t.decision!==`force`)||e&&Ya(t)!==e)return;let u=Date.now(),d=s.current,f=d[0];if(f&&u-l.current<sd){f.extra+=1,f.burst=t,f.seq=n,l.current=u;return}if(d.length>=cd&&d.shift(),d.push({seq:n,burst:t,extra:0}),l.current=u,a===`idle`&&!r){let e=d.shift()??null;e&&(i(e),o(`in`))}},[n]),(0,_.useEffect)(()=>{if(a===`idle`)return;let e=null;return a===`in`?e=setTimeout(()=>o(`visible`),ad):a===`visible`?e=setTimeout(()=>o(`out`),id):a===`out`&&(e=setTimeout(()=>{let e=s.current.shift()??null;e?(i(e),o(`in`)):(i(null),o(`idle`))},od)),u.current=e,()=>{e&&clearTimeout(e)}},[a]),!r)return null;let{burst:d,extra:f}=r,p=Xa[d.decision]??`#ef4444`,m=st(),h=a===`in`||a===`visible`?1:0,g=m||a===`in`||a===`visible`?0:-8,v=d.rule_id??`rule`,y=d.decision===`block`?`BLOCKED`:`FORCED`,b=f>0?`${d.tool} · +${f} more in this burst`:`${d.tool} · ${d.client}${d.agent_id?`:${d.agent_id}`:``}`;return(0,G.jsx)(`div`,{className:e?`pointer-events-none absolute top-2 left-1/2 z-30 select-none`:`pointer-events-none fixed top-20 left-1/2 z-40 select-none`,style:{transform:`translateX(-50%) translateY(${g}px) scale(1)`,opacity:h,transition:m?`opacity ${ad}ms ease-out`:`opacity ${ad}ms ease-out, transform ${ad}ms cubic-bezier(0.34, 1.56, 0.64, 1)`},"aria-live":`polite`,"aria-atomic":`true`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-3 rounded-md border bg-black/95 shadow-2xl`,style:{borderColor:p},children:[(0,G.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full shrink-0`,style:{background:p,boxShadow:m?`none`:`0 0 16px ${p}`}}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`text-[11px] font-mono uppercase tracking-[0.18em]`,style:{color:p},children:[y,` BY SSG`]}),(0,G.jsx)(`div`,{className:`text-[14px] font-mono text-[var(--color-fg-1)] truncate max-w-[420px]`,children:v}),(0,G.jsx)(`div`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] truncate max-w-[420px]`,children:b})]})]})})}var ud=(0,_.memo)(function(e){let{sessionKey:t,bursts:n,paused:r,selectedId:i,onSelect:a,burstSeq:o,isStale:s,isFadingOut:c,minHeight:l,pinned:u,minimized:d,isFullscreen:f,viewMode:p=`full`,thumbnail:m=!1,onPromote:h,activePanelCount:g=1,onTogglePin:v,onToggleMinimize:y,onToggleFullscreen:b,onClose:x,onFrameTime:S}=e,C=p===`broadcast`,w=!m&&(p===`stream`||p===`broadcast`||f)?`large`:`normal`,T=t.indexOf(`:`),E=T>=0?t.slice(0,T):t,D=T>=0?t.slice(T+1):``,O=(0,_.useRef)(null),[ee,te]=(0,_.useState)(!0),[k,A]=(0,_.useState)(null),ne=()=>{let e=O.current;if(!e)return;let t=e.querySelector(`canvas`);t instanceof HTMLCanvasElement&&A(t.toDataURL(`image/png`))},re=()=>{if(!k)return;let e=document.createElement(`a`),n=t.replace(/[^a-z0-9._-]+/gi,`-`);e.href=k,e.download=`ssg-graph-${n}-${Date.now()}.png`,document.body.appendChild(e),e.click(),e.remove()},ie=()=>{!k||!navigator.clipboard?.write||fetch(k).then(e=>e.blob()).then(e=>{let t=new ClipboardItem({"image/png":e});return navigator.clipboard.write([t])}).catch(()=>{})},j=typeof navigator<`u`&&typeof navigator.clipboard?.write==`function`&&typeof ClipboardItem<`u`;(0,_.useEffect)(()=>{if(f){te(!0);return}let e=O.current;if(!e)return;let t=new IntersectionObserver(e=>{for(let t of e)te(t.isIntersecting)},{threshold:.01});return t.observe(e),()=>t.disconnect()},[f]);let M=n.length>0?n[n.length-1]:null,ae=M?Xa[M.decision]??`#6b7280`:`#6b7280`,oe=M?.decision??null,se=M?.tool??null,N=r||!ee||d,P=(0,_.useMemo)(()=>n.length>24?n.slice(n.length-24):n,[n]);return(0,G.jsxs)(`div`,{ref:O,className:`relative flex flex-col shrink-0 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] overflow-hidden transition-opacity duration-1000${f?` flex-1 min-h-0`:``}`,style:{minHeight:d||f?void 0:l,opacity:c?0:1},children:[!C&&(0,G.jsxs)(`header`,{className:`group flex items-center justify-between px-3 py-1.5 border-b border-[var(--color-line-1)] bg-black/30 shrink-0 gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono min-w-0`,children:[u&&(0,G.jsx)(`span`,{className:`text-amber-300`,title:`Pinned`,children:`▲`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider`,children:E}),D&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate`,children:D})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono text-[var(--color-fg-4)]`,children:[se&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 max-w-[180px]`,title:oe?`latest: ${se} → ${oe}`:`latest: ${se}`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{background:ae}}),(0,G.jsx)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:se})]}),(0,G.jsxs)(`span`,{className:`hidden md:inline opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity`,children:[n.length,`n`]}),s?(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-amber-300`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-amber-400`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:`idle`})]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-emerald-300`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:`live`})]}),!m&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1 ml-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity duration-150`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:v,className:`px-1.5 py-0.5 rounded border text-[10px] uppercase tracking-wider transition-colors ${u?`border-amber-500/60 text-amber-300`:`border-[var(--color-line-1)] text-[var(--color-fg-3)] hover:text-amber-300 hover:border-amber-500/40`}`,title:u?`Unpin`:`Pin to top`,children:`pin`}),(0,G.jsx)(`button`,{type:`button`,onClick:y,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,title:d?`Expand`:`Minimize`,children:d?`+`:`–`}),(0,G.jsx)(`button`,{type:`button`,onClick:ne,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,title:`Preview PNG snapshot of this panel`,children:`▣`}),(0,G.jsx)(`button`,{type:`button`,onClick:b,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,title:f?`Exit fullscreen`:`Fullscreen`,children:f?`×`:`⛶`}),x&&(0,G.jsx)(`button`,{type:`button`,onClick:x,"aria-label":`Close session ${t}`,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-rose-300 hover:border-rose-500/40 transition-colors`,title:`End this session on the graph`,children:`╳`})]})]})]}),!d&&!m&&!C&&(0,G.jsx)(Is,{sessionKey:t,className:`rounded-none border-x-0 border-t-0 border-b border-[var(--color-line-1)] shrink-0`}),k&&(0,G.jsxs)(`div`,{className:`absolute inset-0 z-40 flex flex-col items-center justify-center gap-3 bg-black/80 backdrop-blur-sm p-4`,children:[(0,G.jsx)(`img`,{src:k,alt:`Panel snapshot`,className:`max-w-full max-h-[60%] rounded-sm border border-[var(--color-line-1)] object-contain`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j&&(0,G.jsx)(`button`,{type:`button`,onClick:ie,className:`px-3 py-1.5 rounded border border-[var(--color-line-1)] text-[11px] font-mono text-[var(--color-fg-2)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,children:`copy`}),(0,G.jsx)(`button`,{type:`button`,onClick:re,className:`px-3 py-1.5 rounded border border-[var(--color-line-1)] text-[11px] font-mono text-[var(--color-fg-2)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,children:`download`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>A(null),className:`px-3 py-1.5 rounded border border-[var(--color-line-1)] text-[11px] font-mono text-[var(--color-fg-3)] hover:text-rose-300 hover:border-rose-500/40 transition-colors`,children:`close`})]})]}),!d&&(0,G.jsxs)(`div`,{className:`flex-1 min-h-0 relative`,children:[(0,G.jsx)(ld,{sessionKey:t}),(0,G.jsx)(ks,{bursts:P,paused:N,selectedId:i,onSelect:a,burstSeq:o,compact:!0,activePanelCount:g,labelDensity:w,onFrameTime:S}),m&&(0,G.jsx)(`button`,{type:`button`,onClick:h,"aria-label":`Promote ${E} to spotlight`,title:`Spotlight ${E}${D?` · ${D}`:``}`,className:`absolute inset-0 cursor-pointer bg-transparent hover:bg-sky-400/5 transition-colors`})]})]})}),dd=200;function fd(e){let t=Date.now()-e;return t<2e3?`now`:t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function pd(e){let t=e/1e6;return t<1e3?`${Math.round(t)}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:`${Math.floor(t/6e4)}m${Math.floor(t%6e4/1e3)}s`}function md(e){let{bursts:t,selectedId:n,onSelect:r}=e,i=(0,_.useMemo)(()=>{let e=new Map;for(let n of t){if(fi(n.tool))continue;let t=Ya(n),r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}let n=Array.from(e.entries());return n.sort((e,t)=>{let n=e[1][e[1].length-1]?.ts_ms??0;return(t[1][t[1].length-1]?.ts_ms??0)-n}),n},[t]);return t.length===0?(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center px-4`,children:[(0,G.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`feed · idle`}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] max-w-[260px]`,children:[`Each entry is one tool call your AI agent made.`,(0,G.jsx)(`br`,{}),`Color = the ssg rule decision.`]})]}):(0,G.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-3 py-3 space-y-5`,children:i.map(([e,t])=>{let i=e.indexOf(`:`),a=i>=0?e.slice(0,i):e;i>=0&&e.slice(i+1);let o=t[t.length-1],s=o?Xa[o.decision]??`#6b7280`:`#6b7280`,c=t.slice(-dd).reverse();return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 pb-1 border-b border-[var(--color-line-1)] text-[11px]`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:s}}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] font-medium`,children:di(a)}),(0,G.jsxs)(`span`,{className:`ml-auto text-[10px] text-[var(--color-fg-4)]`,children:[t.length,` `,t.length===1?`action`:`actions`]})]}),(0,G.jsxs)(`div`,{className:`relative pl-4`,children:[(0,G.jsx)(`div`,{className:`absolute left-[7px] top-0 bottom-0 w-px`,style:{background:`${s}33`}}),(0,G.jsx)(`div`,{className:`space-y-1.5`,children:c.map(e=>{let t=e.audit_id??`${e.ts_ms}:${e.tool}`,i=t===n,a=Xa[e.decision]??`#6b7280`,o=e.input_tokens??0,s=e.output_tokens??0,c=o>0||s>0;return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`span`,{className:`absolute -left-[9px] top-1/2 -translate-y-1/2 w-[6px] h-[6px] rounded-full border border-[var(--color-surface-1)]`,style:{background:a}}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(i?null:t),className:`w-full text-left flex items-center gap-2 px-2.5 py-1.5 rounded-sm border text-[11.5px] transition-colors ${i?`border-sky-500/50 bg-sky-500/5 text-[var(--color-fg-1)]`:`border-[var(--color-line-1)] bg-[var(--color-surface-1)] text-[var(--color-fg-2)] hover:bg-white/3 hover:border-[var(--color-line-2)]`}`,children:[(0,G.jsx)(`span`,{className:`flex-1 font-medium truncate text-[var(--color-fg-1)]`,title:e.tool,children:ui(e.tool)}),(0,G.jsxs)(`span`,{className:`shrink-0 flex items-center gap-2 text-[9px] text-[var(--color-fg-4)]`,children:[c&&(0,G.jsxs)(`span`,{className:`font-mono`,title:`Input: ${o} tokens · Output: ${s} tokens`,children:[`↓`,X(o),` `,`↑`,X(s)]}),e.duration_ns>0&&(0,G.jsx)(`span`,{children:pd(e.duration_ns)}),(0,G.jsx)(`span`,{className:`px-1.5 py-px rounded text-[9px] font-semibold tracking-wide`,style:{color:a,background:`${a}22`},children:e.decision===`allow`?`Allowed`:e.decision===`block`?`Blocked`:e.decision===`ask`?`Held`:e.decision===`force`?`Forced`:e.decision===`log`?`Logged`:e.decision}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:fd(e.ts_ms)})]})]})]},t)})})]})]},e)})})}function hd(e){let{playback:t,bursts:n,rangeStart:r,rangeEnd:i,loading:a,onPlayhead:o,onLive:s,onPause:c,onResume:l,on24h:u}=e,d=(0,_.useRef)(null),f=(0,_.useRef)(!1),p=Math.max(1,i-r),m=(t.playhead_ms-r)/p*100,h=Math.max(0,Math.min(100,m)),g=(0,_.useMemo)(()=>{let e=[];for(let t=0;t<200;t++)e.push({allow:0,block:0,ask:0,other:0});for(let t of n){let n=t.ts_ms;if(n<r||n>i)continue;let a=e[Math.floor((n-r)/p*199)];t.decision===`allow`?a.allow++:t.decision===`block`||t.decision===`force`?a.block++:t.decision===`ask`?a.ask++:a.other++}return e},[n,r,i,p]),v=(0,_.useCallback)(e=>{let t=d.current;if(!t)return;let n=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e-n.left)/n.width));if(i>=.98){s();return}o(r+i*p)},[r,p,o,s]);(0,_.useEffect)(()=>{let e=e=>{f.current&&v(e.clientX)},t=()=>{f.current=!1};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[v]);let y=t.mode===`live`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono uppercase tracking-wider`,children:[(0,G.jsx)(`button`,{onClick:()=>y?c():l(),className:`px-2.5 py-1 rounded-sm border transition-colors cursor-pointer ${y?`border-emerald-500/40 text-emerald-300 hover:bg-emerald-500/10`:`border-amber-500/40 text-amber-300 hover:bg-amber-500/10`}`,title:y?`Pause the live stream`:`Resume updates at this playhead`,children:y?`⏸ pause`:`▶ resume`}),(0,G.jsx)(`button`,{onClick:s,disabled:y,className:`px-2.5 py-1 rounded-sm border transition-colors cursor-pointer ${y?`border-[var(--color-line-1)] text-[var(--color-fg-4)] opacity-50`:`border-sky-500/40 text-sky-300 hover:bg-sky-500/10`}`,title:`Jump to live (now)`,children:`⏭ live`}),(0,G.jsx)(`button`,{onClick:u,className:`px-2.5 py-1 rounded-sm border border-violet-500/40 text-violet-300 hover:bg-violet-500/10 transition-colors cursor-pointer`,title:`Expand to last 24h — window covers now−24h through now. Backfills audit_log so the scrubber shows all recent evals.`,children:`◉ 24h`}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`mode`}),(0,G.jsx)(`span`,{className:y?`text-emerald-300`:t.mode===`paused`?`text-amber-300`:`text-violet-300`,children:t.mode}),a&&(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] animate-pulse`,children:`· backfilling`}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`· t=`,gd(t.playhead_ms)]})]}),(0,G.jsxs)(`div`,{ref:d,className:`relative h-10 w-full rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] cursor-pointer overflow-hidden select-none`,onPointerDown:e=>{f.current=!0,e.target.setPointerCapture?.(e.pointerId),v(e.clientX)},children:[(0,G.jsx)(`svg`,{viewBox:`0 0 200 40`,preserveAspectRatio:`none`,className:`absolute inset-0 w-full h-full`,"aria-hidden":!0,children:g.map((e,t)=>{let n=e.allow+e.block+e.ask+e.other;if(n===0)return null;let r=Math.min(32,n*3),i=e.block>0?Xa.block:e.ask>0?Xa.ask:Xa.allow;return(0,G.jsx)(`rect`,{x:t,y:40-r,width:.9,height:r,fill:i,opacity:.7},t)})}),(0,G.jsx)(`div`,{className:`absolute top-0 bottom-0 w-px bg-sky-300 pointer-events-none`,style:{left:`${h}%`},children:(0,G.jsx)(`div`,{className:`absolute -top-0.5 -translate-x-1/2 w-2 h-2 rotate-45 bg-sky-300`})}),y&&(0,G.jsx)(`div`,{className:`absolute top-0 right-0 bottom-0 w-[2px] bg-emerald-400 animate-pulse pointer-events-none`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] font-mono text-[var(--color-fg-4)]`,children:[(0,G.jsx)(`span`,{children:_d(r)}),(0,G.jsxs)(`span`,{className:`uppercase tracking-wider`,children:[vd(t.window_ms),` window`]}),(0,G.jsx)(`span`,{children:_d(i)})]})]})}function gd(e){let t=Date.now()-e;if(Math.abs(t)<1500)return`live`;let n=Math.round(t/1e3);if(n<60)return`−${n}s`;let r=Math.floor(n/60);return r<60?`−${r}m${n%60}s`:`−${Math.floor(r/60)}h${r%60}m`}function _d(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function vd(e){return e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${Math.round(e/36e5)}h`}var $=320,yd=8,bd=12;function xd(e){let{burst:t,anchor:n,onClose:r}=e,i=(0,_.useRef)(null),[a,o]=(0,_.useState)({left:-9999,top:-9999});if((0,_.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&r()},n=e=>{i.current&&!i.current.contains(e.target)&&r()};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,n),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,n)}},[t,r]),(0,_.useLayoutEffect)(()=>{if(!t||!n||!i.current)return;let e=i.current.getBoundingClientRect(),r=window.innerWidth,a=window.innerHeight,s=e.height>0?e.height:280,c=n.x+bd+$>r?n.x-bd-$:n.x+bd,l=n.y+bd+s>a?n.y-bd-s:n.y+bd;c=Math.min(Math.max(yd,c),r-$-yd),l=Math.min(Math.max(yd,l),a-s-yd),o({left:c,top:l})},[t,n]),(0,_.useEffect)(()=>{o({left:-9999,top:-9999})},[t]),!t||!n)return null;let s=Xa[t.decision]??`#6b7280`,c=t.duration_ns/1e6,l=Date.now()-t.ts_ms;return(0,G.jsxs)(`div`,{ref:i,className:`fixed z-50 flex flex-col gap-3 text-[12px] font-mono rounded-md border border-[var(--color-line-1)] bg-[var(--color-surface-1)] shadow-2xl p-4`,style:{left:a.left,top:a.top,width:$,maxHeight:`80vh`,overflowY:`auto`},children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`node · inspect`}),(0,G.jsx)(`button`,{onClick:r,className:`text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] cursor-pointer`,title:`Close inspector`,children:`✕`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{background:s},"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`uppercase tracking-wider`,style:{color:s},children:t.decision}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:t.tool})]}),(0,G.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[11px]`,children:[(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`rule`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-all`,children:t.rule_id??`—`}),(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`client`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.client}),(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`agent`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.agent_id?(0,G.jsx)(`span`,{className:`chip text-violet-300 border-violet-500/30`,children:t.agent_id}):(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`—`})}),(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`eval duration`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:c<1?`${(c*1e3).toFixed(0)}µs`:`${c.toFixed(2)}ms`}),t.complete_duration_ms!=null&&t.complete_duration_ms>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`tool duration`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.complete_duration_ms>=1e3?`${(t.complete_duration_ms/1e3).toFixed(2)}s`:`${t.complete_duration_ms.toFixed(0)}ms`})]}),t.message&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`reason`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-words`,children:t.message})]}),(t.input_tokens!=null||t.output_tokens!=null)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`tokens`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:wd(t.input_tokens,t.output_tokens)})]}),(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`age`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:Sd(l)}),(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`timestamp`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:new Date(t.ts_ms).toLocaleString()})]}),t.input_preview&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:`input`}),(0,G.jsx)(`pre`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-0)] rounded-sm p-2 text-[10px] text-[var(--color-fg-2)] whitespace-pre-wrap break-all max-h-48 overflow-y-auto`,children:t.input_preview})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[t.audit_id&&(0,G.jsx)(`a`,{href:`/audit?id=${encodeURIComponent(t.audit_id)}`,className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)] hover:text-[var(--color-fg-1)]`,title:`Open full audit record`,children:`audit ↗`}),t.rule_id&&(0,G.jsx)(`a`,{href:`/rules#${encodeURIComponent(t.rule_id)}`,className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)] hover:text-[var(--color-fg-1)]`,title:`Jump to rule`,children:`rule ↗`})]})]})}function Sd(e){if(e<1500)return`just now`;let t=Math.floor(e/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m${t%60}s ago`:`${Math.floor(n/60)}h${n%60}m ago`}function Cd(e){return e<1e3?String(e):e<1e4?`${(e/1e3).toFixed(1)}K`:e<1e6?`${Math.round(e/1e3)}K`:`${(e/1e6).toFixed(1)}M`}function wd(e,t){let n=[];return e!=null&&n.push(`${Cd(e)} in`),t!=null&&n.push(`${Cd(t)} out`),n.length>0?n.join(` · `):`—`}function Td(e){let t=new Map;for(let n of e){let e=`${n.client}:${n.agent_id??`solo`}`,r=t.get(e);r?(r.count+=1,n.ts_ms>r.newest_ts_ms&&(r.newest_ts_ms=n.ts_ms)):t.set(e,{client:n.client,agent_id:n.agent_id??`solo`,count:1,newest_ts_ms:n.ts_ms})}return Array.from(t.values()).sort((e,t)=>t.newest_ts_ms===e.newest_ts_ms?t.count-e.count:t.newest_ts_ms-e.newest_ts_ms)}function Ed(e){let{bursts:t,allBursts:n}=e,r=n??t,{toolCounts:i,decisionCounts:a,ruleCounts:o,unmatchedCount:s}=(0,_.useMemo)(()=>{let e=new Map,n=new Map,r=new Map,i=0;for(let a of t)if(e.set(a.tool,(e.get(a.tool)??0)+1),n.set(a.decision,(n.get(a.decision)??0)+1),a.rule_id){let e=r.get(a.rule_id);e?(e.count+=1,e.decisions.add(a.decision)):r.set(a.rule_id,{count:1,decisions:new Set([a.decision])})}else i+=1;return{toolCounts:Array.from(e.entries()).sort((e,t)=>t[1]-e[1]),decisionCounts:Array.from(n.entries()),ruleCounts:Array.from(r.entries()).map(([e,t])=>({id:e,count:t.count,decisions:t.decisions})).sort((e,t)=>t.count-e.count),unmatchedCount:i}},[t]),c=(0,_.useMemo)(()=>Td(r),[r]),l=i[0]?.[1]??0,u=c[0]?.count??0,d=o[0]?.count??0,f=e=>{for(let t of[`block`,`ask`,`force`,`log`,`allow`,`shadow`])if(e.has(t))return Xa[t];return`#6b7280`};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 text-[11px] font-mono`,children:[(0,G.jsx)(`div`,{className:`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-0)] p-2 text-[10px] text-[var(--color-fg-3)] leading-relaxed`,children:`Each dot is one tool call by an AI agent. Color encodes the ssg rule decision; lines link calls from the same agent in time order.`}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`rules · `,o.length,` matched`,s>0&&(0,G.jsxs)(`span`,{className:`ml-2 text-[var(--color-fg-4)] normal-case tracking-normal`,children:[s,` unmatched`]})]}),o.length===0?(0,G.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no rules matched in window`}):(0,G.jsx)(`ul`,{className:`space-y-0.5`,children:o.slice(0,6).map(e=>{let t=d>0?e.count/d*100:0,n=f(e.decisions);return(0,G.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,title:`${e.id} — decisions: ${Array.from(e.decisions).join(`, `)}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:n},"aria-hidden":!0}),(0,G.jsx)(`a`,{href:`/rules#${encodeURIComponent(e.id)}`,className:`truncate text-[var(--color-fg-2)] hover:text-[var(--color-fg-1)]`,children:e.id}),(0,G.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full`,style:{background:n,width:`${t}%`,opacity:.6}})})]}),(0,G.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:e.count})]},e.id)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:`decisions`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[`allow`,`block`,`ask`,`log`,`force`,`shadow`].map(e=>{let t=a.find(([t])=>t===e)?.[1]??0;return(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:Xa[e]},"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider`,children:e}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] tabular-nums`,children:t})]},e)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`agents · `,c.length,` active`,n&&n!==t&&(0,G.jsx)(`span`,{className:`ml-2 text-[var(--color-fg-4)] normal-case tracking-normal`,children:`roster: today`})]}),c.length===0?(0,G.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no agents in window`}):(0,G.jsx)(`ul`,{className:`space-y-0.5`,children:c.slice(0,8).map(e=>{let t=u>0?e.count/u*100:0,n=`${e.client}:${e.agent_id}`,r=Date.now()-e.newest_ts_ms,i=r<5e3;return(0,G.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,title:`${n} — last eval ${Math.max(0,Math.round(r/1e3))}s ago`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i?(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft shrink-0`,"aria-hidden":!0}):(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-[var(--color-fg-4)]/40`,"aria-hidden":!0}),(0,G.jsxs)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:[e.client,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`:`,e.agent_id]})]}),(0,G.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full bg-violet-400/60`,style:{width:`${t}%`}})})]}),(0,G.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:e.count})]},n)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`tools · `,t.length,` in window`]}),i.length===0?(0,G.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no tool activity`}):(0,G.jsx)(`ul`,{className:`space-y-0.5`,children:i.slice(0,8).map(([e,t])=>{let n=l>0?t/l*100:0;return(0,G.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:e}),(0,G.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full bg-sky-400/60`,style:{width:`${n}%`}})})]}),(0,G.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:t})]},e)})})]})]})}var Dd=[100,500,1e3,5e3,1e4,1e5];function Od(e){return e>=1e5||e>=1e3?`${e/1e3|0}k`:String(e)}function kd(e){let t=Math.floor(e/100),n=Math.floor(t/600),r=Math.floor(t%600/10),i=t%10;return`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}.${i}`}function Ad(e){let t=Math.floor(e/100);return`${Math.floor(t/10)}.${t%10}s`}function jd({className:e,onMilestone:t,onRecord:n}){let r=(0,_.useRef)(null),i=(0,_.useRef)(null),[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(0),[l,u]=(0,_.useState)(0),[d,f]=(0,_.useState)(0),[p,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(``),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(!1),S=De(),C=ke(),w=Oe(),T=(0,_.useRef)(null),E=(0,_.useRef)(0),D=(0,_.useRef)(0),O=(0,_.useRef)(0),ee=(0,_.useRef)(0),te=(0,_.useRef)(new Set),k=(0,_.useRef)(performance.now());(0,_.useEffect)(()=>{let e=performance.now();if(st()){let t=setInterval(()=>{let t=performance.now();r.current&&(r.current.textContent=kd(t-e)),i.current&&(i.current.textContent=Ad(t-k.current))},1e3);return()=>clearInterval(t)}let[t]=yr(()=>{let t=performance.now();r.current&&(r.current.textContent=kd(t-e)),i.current&&(i.current.textContent=Ad(t-k.current))});return t},[]);let A=(0,_.useRef)(0);return(0,_.useEffect)(()=>{if(T.current===null){T.current=C,E.current=C;return}if(C<=E.current)return;let e=C-E.current;E.current=C,u(n=>{let r=n+e,i=Dd.find(e=>e>ee.current&&r>=e);return i&&(ee.current=i,g(Od(i)),x(!0),t?.(),setTimeout(()=>{g(``),x(!1)},700)),r});let r=Date.now();if(r-A.current>=1e3){A.current=r;let e=w.filter(e=>r-e.ts_ms<=6e4);f(new Set(e.map(e=>`${e.client}:${e.agent_id??`solo`}`)).size)}S?.rule_id&&te.current.add(S.rule_id),m(te.current.size),S&&(S.decision===`block`?(D.current=0,o(0),k.current=performance.now()):(D.current+=e,D.current>O.current&&(O.current=D.current,c(O.current),y(!0),n?.(),setTimeout(()=>y(!1),450)),o(D.current)))},[C,S,w,t,n]),(0,G.jsxs)(`div`,{className:W(`pointer-events-none select-none`,`flex flex-col gap-2 p-3 rounded-md`,`bg-[var(--color-bg-2,#0c0d12)]/95`,`border border-[var(--color-border-1,#1c1f26)]`,`shadow-lg shadow-black/40`,`min-w-[180px] font-mono text-[11px]`,`text-[var(--color-fg-2,#9aa1ad)]`,b&&`milestone-ring`,e),"aria-label":`Live engagement counters`,children:[(0,G.jsx)(Md,{label:`uptime`,children:(0,G.jsx)(`span`,{ref:r,className:`tabular-nums text-[var(--color-fg-0,#e6e8ed)] text-[15px] tracking-tight`,children:`00:00.0`})}),(0,G.jsx)(Md,{label:`evals`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(pr,{value:l,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`}),h&&(0,G.jsxs)(`span`,{className:`text-[10px] text-emerald-400 uppercase tracking-wide`,children:[`+`,h]})]})}),(0,G.jsx)(Md,{label:`since block`,children:(0,G.jsx)(`span`,{ref:i,className:`tabular-nums text-emerald-300 text-[15px]`,children:`0.0s`})}),(0,G.jsx)(Md,{label:`streak / best`,children:(0,G.jsxs)(`span`,{className:W(`tabular-nums text-[15px]`,v?`record-beat`:`text-[var(--color-fg-0,#e6e8ed)]`),children:[(0,G.jsx)(pr,{value:a,curve:`spring`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4,#5a6071)] mx-1`,children:`/`}),(0,G.jsx)(pr,{value:s})]})}),(0,G.jsx)(Md,{label:`agents`,children:(0,G.jsx)(pr,{value:d,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`})}),(0,G.jsx)(Md,{label:`rules`,children:(0,G.jsx)(pr,{value:p,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`})})]})}function Md({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`uppercase tracking-wider text-[10px] text-[var(--color-fg-4,#5a6071)]`,children:e}),t]})}var Nd=1200,Pd=3e4,Fd=3e3,Id=6,Ld=3,Rd=`graph.panelState.v1`,zd=14400*1e3;function Bd(e,t){let n=new Map;for(let t of e){let e=Ya(t),r=n.get(e);r?r.push(t):n.set(e,[t])}for(let[e,r]of n){let i=t.get(e);i&&i.length===r.length&&i[i.length-1]===r[r.length-1]&&n.set(e,i)}return n}function Vd(){if(typeof window>`u`)return new Map;try{let e=window.localStorage.getItem(Rd);if(!e)return new Map;let t=JSON.parse(e);return new Map(Object.entries(t))}catch{return new Map}}function Hd(e){if(!(typeof window>`u`))try{let t={};for(let[n,r]of e)t[n]=r;window.localStorage.setItem(Rd,JSON.stringify(t))}catch{}}function Ud(){let e=fo(),t=ke(),n=De(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),s=(0,_.useCallback)((e,t)=>{i(e),o(t??null)},[]),c=Ws();(0,_.useEffect)(()=>{n&&(n.decision===`block`?c.play(`block`):n.decision===`force`&&c.play(`force`))},[t]);let l=(0,_.useCallback)(()=>c.play(`milestone`),[c]),u=(0,_.useCallback)(()=>c.play(`record`),[c]),[d,f]=(0,_.useState)(()=>{if(typeof window>`u`)return`full`;try{let e=window.localStorage.getItem(`graph.viewMode.v1`);if(e===`full`||e===`feed`||e===`stream`||e===`broadcast`)return e}catch{}return`full`});(0,_.useEffect)(()=>{if(!(typeof window>`u`))try{window.localStorage.setItem(`graph.viewMode.v1`,d)}catch{}},[d]),(0,_.useEffect)(()=>{let e=e=>e===`full`?`feed`:e===`feed`?`stream`:e===`stream`?`broadcast`:`full`,t=t=>{if(t.key===`Escape`&&d!==`full`){f(`full`);return}if(t.key===`b`||t.key===`B`){let n=t.target?.tagName;if(n===`INPUT`||n===`TEXTAREA`)return;f(e)}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[d]);let p=d===`broadcast`,m=d===`stream`,h=d===`feed`,g=m||p,v=p,y=m,[b,x]=(0,_.useState)(()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(`ssg.sfx.enabled`)===null}catch{return!1}}),S=(0,_.useCallback)(()=>{c.toggle(),x(!1)},[c]),[C,w]=(0,_.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: 767px)`).matches);(0,_.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),t=e=>w(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let[T,E]=(0,_.useState)(!1),D=(0,_.useRef)(null),O=(0,_.useCallback)(async e=>{try{await fetch(`/api/json/graph/close-sessions`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`same-origin`,body:JSON.stringify(e.length>0?{session_keys:e}:{})})}catch{}E(!1),D.current&&clearTimeout(D.current)},[]),ee=(0,_.useCallback)(e=>{if(!T){E(!0),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>E(!1),3e3);return}O(e)},[T,O]);(0,_.useEffect)(()=>()=>{D.current&&clearTimeout(D.current)},[]);let te=(0,_.useRef)(new Map),k=(0,_.useRef)(0),[A,ne]=(0,_.useState)({fps:0,active:0,hitches:0}),re=(0,_.useCallback)((e,t)=>{te.current.set(e,t),t>33&&(k.current+=1)},[]);(0,_.useEffect)(()=>{let e=setInterval(()=>{let e=te.current,t=k.current;if(k.current=0,e.size===0){ne(e=>e.active===0?e:{fps:0,active:0,hitches:0});return}let n=0;for(let t of e.values())n+=t;let r=n/e.size,i=r>0?Math.max(1,Math.round(1e3/r)):0;ne(n=>n.fps===i&&n.active===e.size&&n.hitches===t?n:{fps:i,active:e.size,hitches:t})},1e3);return()=>clearInterval(e)},[]);let{bursts:ie,playback:j,oldest_known_ms:M,newest_known_ms:ae,loading_backfill:oe}=e.snapshot,se=(0,_.useRef)(new Map),N=(0,_.useMemo)(()=>{let e=Bd(ie,se.current);return se.current=e,e},[ie]),[P,F]=(0,_.useState)(()=>Vd()),[ce,I]=(0,_.useState)(null);(0,_.useEffect)(()=>{Hd(P)},[P]),(0,_.useEffect)(()=>{let e=Date.now(),t=!1,n=new Map(P);for(let r of N.keys())n.has(r)||(n.set(r,{pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:e}),t=!0);for(let[r,i]of n)N.has(r)||i.pinned||e-i.firstSeenAt<zd||(n.delete(r),t=!0);t&&F(n)},[N,P]);let le=(0,_.useRef)(new Map),ue=(0,_.useRef)(new Set),de=(0,_.useRef)(new Map),[,fe]=(0,_.useState)(0);(0,_.useEffect)(()=>{let e=performance.now(),t=le.current,n=ue.current,r=de.current,i=new Set;for(let[e,n]of N)i.add(e),r.set(e,n.slice()),t.delete(e);for(let a of n)if(!i.has(a)&&!t.has(a)){let n=r.get(a)??[],i=n[n.length-1]?.ts_ms??0;t.set(a,{bursts:n,diedAt:e,newestTs:i})}for(let[n,i]of t)e-i.diedAt>=Nd&&(t.delete(n),r.delete(n));if(ue.current=i,t.size>0){let n=1/0;for(let e of t.values())n=Math.min(n,e.diedAt+Nd);let r=Math.max(16,n-e+16),i=setTimeout(()=>fe(e=>e+1),r);return()=>clearTimeout(i)}},[N]);let pe=(0,_.useCallback)(e=>{F(t=>{let n=new Map(t),r=n.get(e)??{pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:Date.now()};return n.set(e,{...r,pinned:!r.pinned,pinnedAt:r.pinned?0:Date.now()}),n})},[]),me=(0,_.useCallback)(e=>{F(t=>{let n=new Map(t),r=n.get(e)??{pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:Date.now()};return n.set(e,{...r,minimized:!r.minimized}),n})},[]),he=(0,_.useCallback)(e=>{I(t=>t===e?null:e)},[]);(0,_.useEffect)(()=>{if(!ce)return;let e=e=>{e.key===`Escape`&&I(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ce]);let L=(0,_.useMemo)(()=>{let e={pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:Date.now()},t=[];for(let[n,r]of N){let i=r[r.length-1]?.ts_ms??0;t.push({key:n,bursts:r,newestTs:i,fadingOutAt:null,state:P.get(n)??e})}for(let[n,r]of le.current)N.has(n)||t.push({key:n,bursts:r.bursts,newestTs:r.newestTs,fadingOutAt:r.diedAt,state:P.get(n)??e});return t.sort((e,t)=>e.state.pinned===t.state.pinned?e.state.pinned&&t.state.pinned?e.state.pinnedAt-t.state.pinnedAt:e.state.firstSeenAt-t.state.firstSeenAt:e.state.pinned?-1:1),t},[N,P]),ge=(0,_.useMemo)(()=>{if(!r)return null;for(let e of ie)if((e.audit_id??`${e.ts_ms}:${e.tool}`)===r||r.startsWith(`${e.ts_ms}:${e.tool}`))return e;return null},[ie,r]),[_e,ve]=(0,_.useState)(null),ye=(0,_.useRef)(null),be=(0,_.useMemo)(()=>{if(L.length===0)return ye.current=null,null;if(_e!=null&&L.some(e=>e.key===_e))return ye.current=_e,_e;let e=L.filter(e=>e.state.pinned);if(e.length>0)return e.sort((e,t)=>t.state.pinnedAt-e.state.pinnedAt),ye.current=e[0].key,e[0].key;let t=L[0];for(let e of L)e.newestTs>t.newestTs&&(t=e);let n=ye.current;if(n!=null&&n!==t.key){let e=L.find(e=>e.key===n);if(e&&Date.now()-e.newestTs<Fd)return n}return ye.current=t.key,t.key},[L,_e]);(0,_.useEffect)(()=>{_e!=null&&(L.some(e=>e.key===_e)||ve(null))},[_e,L]),(0,_.useEffect)(()=>{ve(null)},[d]);let R=(0,_.useMemo)(()=>{if(L.length===0)return{hero:null,grid:[],rail:[],overflow:[]};if(d===`full`||d===`feed`)return{hero:null,grid:L.slice(0,Id),rail:L.slice(Id),overflow:[]};let e=L.find(e=>e.key===be)??L[L.length-1],t=L.filter(t=>t.key!==e.key);return d===`broadcast`?{hero:e,grid:[],rail:[],overflow:t}:{hero:e,grid:[],rail:t.slice(0,Ld),overflow:t.slice(Ld)}},[L,d,be]),xe=(0,_.useCallback)(e=>{ve(e)},[]),Se=(0,_.useCallback)(()=>{ve(null)},[]),Ce=(0,_.useMemo)(()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Map,a=new Map;for(let o of L){let s=o.key;e.set(s,()=>pe(s)),t.set(s,()=>me(s)),n.set(s,()=>he(s)),r.set(s,()=>void O([s])),i.set(s,e=>re(s,e)),a.set(s,()=>xe(s))}return{onTogglePin:e,onToggleMinimize:t,onToggleFullscreen:n,onClose:r,onFrameTime:i,onPromote:a}},[L.map(e=>e.key).join(`,`),pe,me,he,O,re,xe]);(0,_.useEffect)(()=>{let e=new Set(L.map(e=>e.key)),t=te.current;for(let n of Array.from(t.keys()))e.has(n)||t.delete(n)},[L]);let we=(0,_.useMemo)(()=>{let e=n?.counters,t=e?.total??0,r=(e?.block??0)+(e?.force??0),i=0;if(ie.length>0){let e=0,t=ie.slice(-100);for(let n of t)e+=n.duration_ns;i=e/t.length/1e6}return{evals:t,blocks:r,avgMs:i,agents:L.length}},[n,ie,L.length]),Te=Math.min(M,j.playhead_ms-j.window_ms),Ee=Math.max(ae,j.playhead_ms),Oe=R.grid.length,z=C||Oe<=1?1:Oe<=4?2:3,Ae=Math.max(1,Math.ceil(Math.max(1,Oe)/z)),B=Oe<=1||C?360:180,je=ce?L.find(e=>e.key===ce):null,Me=e=>e>=1e4?`${Math.round(e/1e3)}k`:e.toLocaleString();return(0,G.jsxs)(`div`,{className:`grid gap-3 md:h-[calc(100dvh-4.5rem)] md:min-h-[560px] ${g?`grid-rows-[auto_minmax(0,1fr)]`:`grid-rows-[auto_minmax(0,1fr)_auto]`} ${p?`bg-black`:``}`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between flex-wrap gap-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(`h1`,{className:`text-sm font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`graph intelligence`}),!p&&(0,G.jsx)(`span`,{className:`chip text-sky-300 border-sky-500/30`,children:`real-time tool-use`}),j.mode===`live`?(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-emerald-300`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),`streaming`]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-amber-300`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-amber-400`}),j.mode]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-x-3 gap-y-1 flex-wrap text-[11px] font-mono text-[var(--color-fg-3)] pl-3 border-l border-[var(--color-line-1)]`,children:[(0,G.jsxs)(`span`,{title:`Total evaluations since daemon start`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`↑`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Me(we.evals)}),` `,(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:`evals`})]}),(0,G.jsxs)(`span`,{title:`Block + force decisions — dangerous tool calls intercepted by SSG rules`,children:[(0,G.jsx)(`span`,{className:`text-rose-400`,children:`⛔`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Me(we.blocks)}),` `,(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:`blocks`})]}),(0,G.jsxs)(`span`,{className:`hidden md:inline`,title:`Mean eval latency over the last 100 bursts`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`⏱`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:we.avgMs<1?`${(we.avgMs*1e3).toFixed(0)}µs`:`${we.avgMs.toFixed(1)}ms`})]}),(0,G.jsxs)(`span`,{title:`Concurrent agent sessions in this window`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`⌥`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:we.agents}),` `,(0,G.jsxs)(`span`,{className:`hidden sm:inline`,children:[`agent`,we.agents===1?``:`s`]})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!p&&(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[ie.length,`n · window `,Math.round(j.window_ms/1e3),`s`]}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,title:`Average RAF interval across ${A.active} canvas${A.active===1?``:`es`}${A.hitches>0?` · ${A.hitches} hitch${A.hitches===1?``:`es`} (>33ms frames)`:``}`,children:[A.active===0?`—`:`${A.fps}fps${A.hitches>0?` (${A.hitches}h)`:``}`,` · `,A.active,`/`,L.length]}),(0,G.jsx)(`div`,{role:`group`,"aria-label":`Graph view mode`,className:`inline-flex items-stretch rounded border border-[var(--color-line-1)] overflow-hidden text-[10px] font-mono uppercase tracking-wider`,title:`View mode — B cycles, Esc returns to full`,children:[`full`,`feed`,`stream`,`broadcast`].map(e=>{let t=d===e,n=e===`broadcast`?`cast`:e,r=e===`full`?`Full dashboard — sidebar, timeline, all controls`:e===`feed`?`Feed mode — vertical timeline of tool calls for non-technical users`:e===`stream`?`Stream mode — spotlight layout for Twitch/YouTube viewers`:`Broadcast mode — pure canvas for OBS scenes (Esc to exit)`;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>f(e),"aria-pressed":t,title:r,className:`px-2 py-0.5 transition-colors cursor-pointer ${t?e===`broadcast`?`bg-amber-500/15 text-amber-300`:e===`stream`?`bg-sky-500/15 text-sky-300`:e===`feed`?`bg-emerald-500/15 text-emerald-300`:`bg-[var(--color-fg-4)]/10 text-[var(--color-fg-1)]`:`text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)] hover:bg-white/5`}`,children:n},e)})}),(0,G.jsx)(`button`,{type:`button`,onClick:S,className:`chip cursor-pointer transition-colors ${b&&!c.enabled?`border-amber-500/60 text-amber-300 animate-pulse`:`hover:border-sky-500/50 hover:text-sky-300`}`,title:c.enabled?`Mute stream sounds`:`Enable stream sounds`,children:c.enabled?`SFX ON`:b?`🔊 enable cues`:`SFX OFF`}),!p&&L.length>0&&(0,G.jsx)(`div`,{"aria-live":`polite`,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":`Clear all visible graph sessions`,onClick:()=>ee(L.filter(e=>!e.fadingOutAt).map(e=>e.key)),className:`chip cursor-pointer transition-colors ${T?`border-rose-500/60 text-rose-300`:`hover:border-rose-500/40 hover:text-rose-300`}`,title:`Close all active sessions on the graph — equivalent to /clear but reflects on the graph`,children:T?`confirm clear ${L.filter(e=>!e.fadingOutAt).length}`:`clear`})})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 ${v?``:y?`lg:grid-cols-[1fr_240px]`:`lg:grid-cols-[1fr_300px]`} gap-3 min-h-0 md:overflow-hidden`,children:[(0,G.jsx)(`div`,{className:`flex flex-col gap-3 min-h-0 min-w-0`,children:h?(0,G.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] overflow-hidden`,children:(0,G.jsx)(md,{bursts:ie,selectedId:r,onSelect:s})}):L.length===0?(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] text-center px-4`,style:{minHeight:240},children:[(0,G.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`graph · idle`}),(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] max-w-[280px]`,children:`No active sessions in the current window. Each session will render as its own tree as bursts arrive.`})]}):(0,G.jsxs)(G.Fragment,{children:[R.hero&&(ce==null||ce===R.hero.key)&&(0,G.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col gap-2`,children:[_e!=null&&(0,G.jsx)(`button`,{type:`button`,onClick:Se,className:`self-end chip text-amber-300 border-amber-500/40 hover:border-amber-400 cursor-pointer text-[10px]`,title:`Release manual spotlight — return to auto-follow`,children:`spotlight: locked · release ↺`}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,G.jsx)(ud,{sessionKey:R.hero.key,bursts:R.hero.bursts,paused:j.mode!==`live`||R.hero.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:R.hero.fadingOutAt!=null||j.playhead_ms-R.hero.newestTs>Pd,isFadingOut:R.hero.fadingOutAt!=null,minHeight:0,pinned:R.hero.state.pinned,minimized:R.hero.state.minimized,isFullscreen:!1,viewMode:d,activePanelCount:1,onTogglePin:Ce.onTogglePin.get(R.hero.key),onToggleMinimize:Ce.onToggleMinimize.get(R.hero.key),onToggleFullscreen:Ce.onToggleFullscreen.get(R.hero.key),onClose:Ce.onClose.get(R.hero.key),onFrameTime:Ce.onFrameTime.get(R.hero.key)},R.hero.key)})]}),R.grid.length>0&&(0,G.jsx)(`div`,{className:`flex-1 grid gap-3 min-h-0 min-w-0`,style:{gridTemplateColumns:`repeat(${z}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${Ae}, minmax(180px, 1fr))`},children:R.grid.map(e=>{let n=e.fadingOutAt!=null||j.playhead_ms-e.newestTs>Pd;return ce!=null&&ce!==e.key?null:(0,G.jsx)(ud,{sessionKey:e.key,bursts:e.bursts,paused:j.mode!==`live`||e.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:n,isFadingOut:e.fadingOutAt!=null,minHeight:B,pinned:e.state.pinned,minimized:e.state.minimized,isFullscreen:!1,viewMode:d,activePanelCount:R.grid.length,onTogglePin:Ce.onTogglePin.get(e.key),onToggleMinimize:Ce.onToggleMinimize.get(e.key),onToggleFullscreen:Ce.onToggleFullscreen.get(e.key),onClose:Ce.onClose.get(e.key),onFrameTime:Ce.onFrameTime.get(e.key)},e.key)})}),R.rail.length>0&&(0,G.jsxs)(`div`,{className:`shrink-0 flex flex-col gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between text-[10px] font-mono text-[var(--color-fg-4)] uppercase tracking-wider`,children:[(0,G.jsxs)(`span`,{children:[d===`full`?`overflow rail`:`spotlight rail`,` · `,R.rail.length,` session`,R.rail.length===1?``:`s`]}),R.overflow.length>0&&(0,G.jsxs)(`span`,{title:R.overflow.map(e=>e.key).join(`
24
- `),children:[`+`,R.overflow.length,` more`]})]}),(0,G.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(${Math.min(R.rail.length,4)}, minmax(0, 1fr))`,gridAutoRows:`110px`},children:R.rail.map(e=>{let n=e.fadingOutAt!=null||j.playhead_ms-e.newestTs>Pd;return ce!=null&&ce!==e.key?null:(0,G.jsx)(ud,{sessionKey:e.key,bursts:e.bursts,paused:j.mode!==`live`||e.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:n,isFadingOut:e.fadingOutAt!=null,minHeight:110,pinned:e.state.pinned,minimized:e.state.minimized,isFullscreen:!1,viewMode:d,thumbnail:!0,onPromote:Ce.onPromote.get(e.key),activePanelCount:R.rail.length+1,onTogglePin:Ce.onTogglePin.get(e.key),onToggleMinimize:Ce.onToggleMinimize.get(e.key),onToggleFullscreen:Ce.onToggleFullscreen.get(e.key),onClose:Ce.onClose.get(e.key),onFrameTime:Ce.onFrameTime.get(e.key)},e.key)})})]}),d===`broadcast`&&R.overflow.length>0&&(0,G.jsxs)(`div`,{className:`shrink-0 self-end pointer-events-none chip text-[var(--color-fg-3)] border-[var(--color-line-1)]`,children:[`+`,R.overflow.length,` more session`,R.overflow.length===1?``:`s`,` off-screen`]})]})}),!v&&(0,G.jsxs)(`aside`,{className:`flex flex-col gap-2 min-w-0 min-h-0 overflow-y-auto`,children:[(0,G.jsx)(jd,{onMilestone:l,onRecord:u}),!y&&(0,G.jsx)(`section`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:(0,G.jsx)(Ed,{bursts:ie,allBursts:e.allBursts})}),(0,G.jsx)(xd,{burst:ge,anchor:a,onClose:()=>{i(null),o(null)}})]})]}),!g&&(0,G.jsx)(`section`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:(0,G.jsx)(hd,{playback:j,bursts:ie,rangeStart:Te,rangeEnd:Ee,loading:oe,onPlayhead:t=>e.setPlayhead(t),onLive:()=>e.jumpToLive(),onPause:()=>e.setMode(`paused`),onResume:()=>e.setMode(`scrubbing`),on24h:()=>e.jumpTo24h()})}),p&&(0,G.jsxs)(`div`,{className:`pointer-events-none fixed bottom-3 right-4 flex flex-col items-end gap-1 z-30`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-mono uppercase tracking-[0.18em] text-[var(--color-fg-3)]`,children:`sigmashake gov`}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`broadcast mode · press B or Esc to exit`})]}),je&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/90 backdrop-blur-sm flex flex-col p-6`,children:(0,G.jsx)(ud,{sessionKey:je.key,bursts:je.bursts,paused:j.mode!==`live`||je.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:je.fadingOutAt!=null||j.playhead_ms-je.newestTs>Pd,isFadingOut:!1,minHeight:0,pinned:je.state.pinned,minimized:!1,isFullscreen:!0,viewMode:d,onTogglePin:()=>pe(je.key),onToggleMinimize:()=>me(je.key),onToggleFullscreen:()=>he(je.key)},`fs-${je.key}`)})]})}var Wd=[{id:`rca`,label:`rca`,hint:`pre-computed root cause`},{id:`timeline`,label:`timeline`,hint:`recent frames across traces`},{id:`watch`,label:`watch`,hint:`subscribe to any ssg:// URI`},{id:`state`,label:`state`,hint:`daemon runtime snapshot`},{id:`metrics`,label:`metrics`,hint:`latency + counters`}];function Gd(){let[e,t]=(0,_.useState)(`rca`);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 min-h-[70vh]`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`h1`,{className:`text-sm font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`ai-native debugger`}),(0,G.jsx)(`span`,{className:`chip text-sky-300 border-sky-500/30`,children:`ssg:// unified resolver`}),(0,G.jsx)(Kd,{})]}),(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`one surface · cli · mcp · dashboard`})]}),(0,G.jsx)(`nav`,{className:`flex items-center gap-1 border-b border-[var(--color-line-1)]`,children:Wd.map(n=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(n.id),title:n.hint,className:`px-3 py-1.5 text-[11px] font-mono uppercase tracking-wider border-b-2 transition-colors `+(e===n.id?`border-[var(--color-brand)] text-[var(--color-fg-1)]`:`border-transparent text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)]`),children:n.label},n.id))}),(0,G.jsxs)(`section`,{className:`flex-1 min-h-0`,children:[e===`rca`&&(0,G.jsx)(qd,{}),e===`timeline`&&(0,G.jsx)(Qd,{}),e===`watch`&&(0,G.jsx)(sf,{}),e===`state`&&(0,G.jsx)(cf,{uri:`ssg://daemon/state`}),e===`metrics`&&(0,G.jsx)(cf,{uri:`ssg://daemon/metrics`})]})]})}function Kd(){let e=Ae([`debug-frame`])[`debug-frame`]??0;return(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-emerald-300`,title:`${e} debug-frame bursts received`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),`live · `,e]})}function qd(){let e=Ae([`debug-frame`,`activity-updated`]),{data:t,loading:n,error:r,refetch:i}=B(`/api/json/debug?uri=ssg%3A%2F%2Frca%2Fcurrent`,[e[`debug-frame`],e[`activity-updated`]]),a=t?.data?.pack??null;return(0,G.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-[1fr_340px] gap-4`,children:[(0,G.jsxs)(`article`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-4 space-y-3`,children:[n&&!t&&(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`loading RCA pack…`}),r&&(0,G.jsxs)(`p`,{className:`text-sm text-rose-300`,children:[`rca fetch error: `,r]}),!n&&!a&&(0,G.jsxs)(`div`,{className:`text-sm text-[var(--color-fg-3)] space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-mono`,children:`no current RCA pack`}),(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)]`,children:`Packs are composed automatically when an eval errors, an ssqa finding arrives, or a daemon-level error fires. Nothing to diagnose yet — you're green.`})]}),a&&(0,G.jsx)(Yd,{pack:a})]}),(0,G.jsxs)(`aside`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 text-[11px] font-mono text-[var(--color-fg-4)] space-y-2`,children:[(0,G.jsx)(`p`,{className:`uppercase tracking-wider text-[var(--color-fg-2)]`,children:`how claude sees this`}),(0,G.jsxs)(`pre`,{className:`text-[10px] whitespace-pre-wrap leading-snug`,children:[`ssg debug rca --current --json`,`
22
+ ${c===`installed`?`bg-[var(--color-surface-3)] text-[var(--color-fg-0)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,children:[`installed`,ie>0&&(0,G.jsx)(`span`,{className:`text-[9px] bg-emerald-500/15 text-emerald-300 rounded-sm px-1 py-0.5 font-medium tabular-nums`,children:ie})]})]}),(0,G.jsxs)(`div`,{className:`relative flex-1 min-w-[160px]`,children:[(0,G.jsxs)(`svg`,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--color-fg-4)]`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,G.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,G.jsx)(`input`,{type:`text`,placeholder:`search rulesets…`,value:e,onChange:e=>t(e.target.value),className:`w-full bg-[var(--color-surface-1)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-xs rounded-sm pl-8 pr-3 h-8 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})]}),(0,G.jsx)(`select`,{value:n,onChange:e=>r(e.target.value),className:ae,children:uu.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,G.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),className:ae,children:[(0,G.jsx)(`option`,{value:``,children:`any decision`}),fu.filter(Boolean).map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),className:ae,children:[(0,G.jsx)(`option`,{value:``,children:`any severity`}),du.filter(Boolean).map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]})]}),g&&u.length===0?(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,G.jsx)(pu,{},t))}):N.length===0?(0,G.jsxs)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] py-16 flex flex-col items-center justify-center text-center`,children:[(0,G.jsxs)(`svg`,{className:`text-[var(--color-fg-4)] mb-3`,width:`36`,height:`36`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,G.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,G.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,G.jsx)(`p`,{className:`text-xs font-mono text-[var(--color-fg-3)] uppercase tracking-wider`,children:c===`installed`?`no rulesets installed yet — browse and click install`:`no rulesets found${e?` matching "${e}"`:``}`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:N.map(e=>(0,G.jsx)(_u,{rs:e,installs:y[e.id]??[],installingId:x,uninstallingKey:C,onInstall:ne,onUninstall:M,onPickAndInstall:re,flashId:T},e.id))}),f&&c===`all`&&(0,G.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,G.jsx)(`button`,{onClick:A,disabled:g,className:`h-8 px-5 rounded-sm text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-2)] border border-[var(--color-line-1)] hover:text-[var(--color-fg-0)] hover:border-[var(--color-line-2)] transition-colors cursor-pointer disabled:opacity-40`,children:g?`loading…`:`load more`})})]})]})}var bu={deny:`red`,block:`red`,ask:`amber`,allow:`green`,log:`gray`,force:`blue`};function xu({id:e}){let{data:t,error:n}=B(`/api/json/hub/${e}`),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1);if(n)return(0,G.jsxs)(`div`,{className:`text-sm text-red-300 font-mono`,children:[(0,G.jsx)(`p`,{children:n}),(0,G.jsx)(`a`,{href:`/hub`,className:`text-[var(--color-brand)] hover:underline mt-3 block text-[11px] uppercase tracking-wider`,children:`← back to hub`})]});if(!t)return(0,G.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading ruleset…`});async function s(){o(!0);try{(await fetch(`/api/hub/install`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({id:e})})).ok&&i(!0)}finally{o(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`← hub`}),(0,G.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-1.5 text-[var(--color-fg-0)]`,children:t.title}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-1 tabular-nums`,children:[`@`,t.author,` · v`,t.version,` · `,t.rule_count,` rule`,t.rule_count===1?``:`s`]})]}),(0,G.jsx)(Y,{variant:r?`secondary`:`primary`,onClick:s,disabled:a||r,children:r?`✓ installed`:a?`installing…`:`install`})]}),t.technologies.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.technologies.map(e=>(0,G.jsx)(cr,{variant:`blue`,children:e},e))}),t.github_repo&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`source`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:t.github_repo})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsxs)(`span`,{className:`overline`,children:[`rules · `,t.rules.length]})}),(0,G.jsx)(J,{className:`space-y-4`,children:t.rules.map((e,t)=>(0,G.jsxs)(`div`,{className:t>0?`border-t border-[var(--color-line-0)] pt-4`:void 0,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 flex-wrap`,children:[(0,G.jsx)(cr,{variant:bu[e.decision]??`gray`,children:e.decision}),(0,G.jsx)(`code`,{className:`text-xs text-[var(--color-brand)] font-mono`,children:e.name}),e.capability&&(0,G.jsx)(cr,{variant:`gray`,children:e.capability})]}),(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-1)] mb-2`,children:e.message}),(0,G.jsx)(hc,{children:e.raw_text})]},e.id))})]})]})}function Su(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(`idle`),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!1);async function u(){l(!0),a(``);try{let e=await fetch(`/api/hub/device-start`,{method:`POST`,headers:{Accept:`application/json`,...ke()}}),n=await e.json();if(!e.ok){let t=n;t.error===`not_configured`?(r(`not_configured`),s(t.setup_steps??[]),a(t.message??`GitHub OAuth not configured.`)):(a(n.error??`HTTP ${e.status}`),r(`error`));return}t(n),r(`polling`)}catch(e){a(e instanceof Error?e.message:`Failed to start`),r(`error`)}finally{l(!1)}}return(0,_.useEffect)(()=>{if(n!==`polling`||!e)return;let t=setInterval(async()=>{try{let n=await(await fetch(`/api/hub/device-poll?flow=${e.flow_id}`,{headers:{Accept:`application/json`}})).json();n.status===`complete`?(clearInterval(t),r(`done`),a(`connected as @${n.session?.login??`GitHub`} — you can now publish rulesets`)):(n.status===`expired`||n.status===`error`)&&(clearInterval(t),r(`error`),a(n.error??`Authentication failed`))}catch{}},3e3);return()=>clearInterval(t)},[n,e]),(0,G.jsxs)(`div`,{className:`max-w-lg mx-auto space-y-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`a`,{href:`/hub`,className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors`,children:[(0,G.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,G.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),`back to hub`]}),(0,G.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-2 text-[var(--color-fg-0)]`,children:`Connect GitHub`}),(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-3)] mt-1 font-mono`,children:`authenticate with github to publish rulesets to the hub`})]}),n===`not_configured`&&(0,G.jsx)(K,{children:(0,G.jsxs)(J,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`text-amber-300 shrink-0 mt-0.5`,children:(0,G.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,G.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,G.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-[var(--color-fg-0)]`,children:`GitHub OAuth not configured`}),(0,G.jsx)(`p`,{className:`text-xs text-[var(--color-fg-2)] mt-1 leading-relaxed`,children:i})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-[var(--color-line-0)] pt-4`,children:[(0,G.jsx)(`div`,{className:`overline mb-3`,children:`setup steps`}),(0,G.jsx)(`ol`,{className:`space-y-2`,children:o.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2.5 text-xs text-[var(--color-fg-1)]`,children:[(0,G.jsx)(`span`,{className:`shrink-0 w-5 h-5 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)] text-[var(--color-fg-3)] text-[10px] font-mono flex items-center justify-center tabular-nums`,children:t+1}),(0,G.jsx)(`span`,{className:`mt-0.5 leading-relaxed`,children:e.replace(/^\d+\.\s+/,``)})]},t))})]}),(0,G.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-3`,children:[(0,G.jsx)(`div`,{className:`overline mb-1.5`,children:`quick start`}),(0,G.jsx)(`code`,{className:`text-[11px] text-[var(--color-brand)]/90 font-mono`,children:`export SSG_GITHUB_CLIENT_ID=<your-client-id>`}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-1`,children:[`then restart:`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-fg-1)]`,children:`ssg serve`})]})]}),(0,G.jsx)(`a`,{href:`https://github.com/settings/applications/new`,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline`,children:`create github oauth app →`})]})}),n===`idle`&&(0,G.jsx)(K,{children:(0,G.jsxs)(J,{children:[(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] mb-4 leading-relaxed`,children:`This uses GitHub's device authorization flow — no redirect URIs needed. You'll be shown a code to enter at github.com.`}),(0,G.jsx)(Y,{onClick:u,disabled:c,variant:`primary`,children:c?`starting…`:`connect with github`})]})}),e&&n===`polling`&&(0,G.jsx)(K,{children:(0,G.jsxs)(J,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(`div`,{className:`overline mb-2`,children:`open this url in your browser`}),(0,G.jsx)(`a`,{href:e.verification_uri,target:`_blank`,rel:`noreferrer`,className:`text-sm text-[var(--color-brand)] hover:underline font-mono`,children:e.verification_uri})]}),(0,G.jsxs)(`div`,{className:`border border-[var(--color-line-1)] bg-[var(--color-surface-0)] rounded-sm py-5 text-center`,children:[(0,G.jsx)(`div`,{className:`overline mb-3`,children:`enter this code`}),(0,G.jsx)(`div`,{className:`text-4xl font-mono font-bold tracking-[0.3em] text-[var(--color-fg-0)]`,children:e.user_code})]}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] text-center flex items-center justify-center gap-2`,children:[(0,G.jsx)(`svg`,{className:`animate-spin`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,G.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),`waiting for github authorization…`]})]})}),n===`done`&&(0,G.jsxs)(`div`,{className:`rounded-sm border border-emerald-500/25 bg-emerald-500/5 p-4 text-sm text-emerald-200 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,G.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),(0,G.jsx)(`span`,{className:`font-mono text-xs`,children:i})]}),(0,G.jsx)(`a`,{href:`/hub/publish`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-brand)] hover:underline block mt-1`,children:`publish a ruleset →`})]}),n===`error`&&i&&(0,G.jsxs)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/5 p-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-red-200 font-mono`,children:i}),(0,G.jsx)(`button`,{onClick:()=>{r(`idle`),a(``)},className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] mt-3 cursor-pointer uppercase tracking-wider`,children:`← try again`})]})]})}function Cu(){let[e,t]=(0,_.useState)(``),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null);async function o(t){if(t.preventDefault(),e.trim()){r(!0),a(null);try{a(await(await fetch(`/api/hub/publish`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({repo_url:e.trim()})})).json())}catch(e){a({ok:!1,error:e instanceof Error?e.message:`Unknown error`})}finally{r(!1)}}}return(0,G.jsxs)(`div`,{className:`max-w-md mx-auto space-y-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`a`,{href:`/hub`,className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)]`,children:`← hub`}),(0,G.jsx)(`h1`,{className:`text-xl font-medium tracking-tight mt-2 text-[var(--color-fg-0)]`,children:`Publish Ruleset`}),(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-3)] mt-1 font-mono`,children:`publish a github repository containing .rules files to the hub`})]}),(0,G.jsx)(K,{children:(0,G.jsx)(J,{children:(0,G.jsxs)(`form`,{onSubmit:o,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block overline mb-1.5`,children:`github repository url`}),(0,G.jsx)(`input`,{type:`url`,placeholder:`https://github.com/owner/repo`,value:e,onChange:e=>t(e.target.value),required:!0,className:`w-full bg-[var(--color-surface-0)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-sm rounded-sm px-3 py-2 focus:outline-none focus:border-[var(--color-brand)]/50 placeholder:text-[var(--color-fg-4)] font-mono`})]}),(0,G.jsx)(Y,{type:`submit`,variant:`primary`,disabled:n,children:n?`publishing…`:`publish to hub`})]})})}),i&&(0,G.jsx)(`div`,{className:`rounded-sm border px-3 py-2 text-xs font-mono ${i.ok?`border-emerald-500/25 bg-emerald-500/5 text-emerald-300`:`border-red-500/25 bg-red-500/5 text-red-300`}`,children:i.ok?(0,G.jsxs)(G.Fragment,{children:[`✓ published!`,` `,i.id&&(0,G.jsx)(`a`,{href:`/hub/${i.id}`,className:`text-[var(--color-brand)] hover:underline uppercase tracking-wider text-[11px] ml-2`,children:`view ruleset →`})]}):i.error??`publish failed`})]})}function wu(e){return e===0?`—`:e<1e3?`${e}ns`:e<1e6?`${(e/1e3).toFixed(1)}µs`:`${(e/1e6).toFixed(1)}ms`}function Tu(e){let t=Math.floor(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 Eu(e){let t=e<1e10?e*1e3:e,n=new Date(t);return`${String(n.getHours()).padStart(2,`0`)}:${String(n.getMinutes()).padStart(2,`0`)}:${String(n.getSeconds()).padStart(2,`0`)}`}function Du(e){let t=Math.round((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}var Ou={allow:`text-emerald-300`,block:`text-red-300`,force:`text-violet-300`,log:`text-amber-300`,ask:`text-sky-300`,shadow:`text-[var(--color-fg-3)]`},ku={allow:`✓`,block:`✗`,force:`→`,log:`·`,ask:`?`,shadow:`~`};function Au({label:e,ns:t,maxNs:n}){let r=n>0?Math.min(100,t/n*100):0;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] w-8 text-right font-mono uppercase tracking-wider text-[10px]`,children:e}),(0,G.jsx)(Cc,{pct:r,tone:t<1e5?`green`:t<1e6?`amber`:`red`,className:`h-1 flex-1`}),(0,G.jsx)(`span`,{className:`font-mono text-[var(--color-fg-1)] tabular-nums w-14 text-right`,children:wu(t)})]})}function ju({value:e,max:t,threshold:n,breached:r}){let i=t>0?Math.min(100,e/t*100):0,a=t>0?Math.min(100,n/t*100):0;return(0,G.jsx)(Cc,{pct:i,tone:r?`red`:e/t>=.6?`amber`:`green`,markerPct:a,markerTitle:`limit: ${n}`,className:`h-1`})}function Mu({limitsData:e,onSaved:t}){let[n,r]=(0,_.useState)(String(e.config.cpuLimitPct)),[i,a]=(0,_.useState)(String(e.config.memoryLimitMb)),[o,s]=(0,_.useState)(e.config.breachAction),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null);async function f(){l(!0),d(null);try{let e=await fetch(`/api/json/limits`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({cpu_limit_pct:parseFloat(n),memory_limit_mb:parseFloat(i),breach_action:o})});e.ok?t():d((await e.json()).error??`save failed`)}catch{d(`network error`)}finally{l(!1)}}let p=`w-full bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm px-2 py-1.5 text-[var(--color-fg-1)] font-mono text-xs focus:outline-none focus:border-[var(--color-brand)]/50`;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`overline block mb-1.5`,children:`cpu limit (%)`}),(0,G.jsx)(`input`,{type:`number`,min:1,max:100,value:n,onChange:e=>r(e.target.value),className:p})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`overline block mb-1.5`,children:`memory limit (mb)`}),(0,G.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(e.target.value),className:p})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`overline block mb-1.5`,children:`on breach`}),(0,G.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),className:p,children:[(0,G.jsx)(`option`,{value:`warn`,children:`warn in ui only`}),(0,G.jsx)(`option`,{value:`log`,children:`warn + write to audit log`})]})]}),u&&(0,G.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:u}),(0,G.jsx)(Y,{onClick:f,disabled:c,variant:`primary`,size:`sm`,children:c?`saving…`:`save limits`})]})}var Nu={running:`green`,hibernating:`amber`,exhausted:`red`,stopped:`gray`,idle:`gray`};function Pu(e,t){let n=e-t;if(n<=0)return`any moment`;let r=Math.round(n/1e3);if(r<60)return`in ${r}s`;let i=Math.floor(r/60);return i<60?`in ${i}m ${r%60}s`:`in ${Math.floor(i/60)}h ${i%60}m`}function Fu({supervisors:e}){let[t,n]=(0,_.useState)(Date.now());return(0,_.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2 overline`,children:[`supervisor health`,e.some(e=>e.state===`hibernating`||e.state===`exhausted`)&&(0,G.jsx)(cr,{variant:`amber`,children:`degraded`})]}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono tabular-nums text-[var(--color-fg-4)]`,children:[e.length,` supervisor`,e.length===1?``:`s`]})]}),(0,G.jsx)(J,{children:e.length===0?(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no supervisors registered yet`}):(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-xs font-mono`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider text-[var(--color-fg-4)]`,children:[(0,G.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`name`}),(0,G.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`kind`}),(0,G.jsx)(`th`,{className:`text-left font-normal pb-1.5`,children:`state`}),(0,G.jsx)(`th`,{className:`text-right font-normal pb-1.5`,children:`restarts`}),(0,G.jsx)(`th`,{className:`text-left font-normal pb-1.5 pl-4`,children:`last restart`}),(0,G.jsx)(`th`,{className:`text-left font-normal pb-1.5 pl-4`,children:`next retry`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsxs)(`tr`,{className:`border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(`td`,{className:`py-1.5 text-[var(--color-fg-1)]`,children:e.name}),(0,G.jsx)(`td`,{className:`py-1.5 text-[var(--color-fg-3)]`,children:e.kind===`single`?`single`:`tree`}),(0,G.jsx)(`td`,{className:`py-1.5`,children:(0,G.jsx)(cr,{variant:Nu[e.state],children:e.state})}),(0,G.jsx)(`td`,{className:`py-1.5 text-right tabular-nums text-[var(--color-fg-1)]`,children:e.restarts}),(0,G.jsx)(`td`,{className:`py-1.5 pl-4 tabular-nums text-[var(--color-fg-3)]`,children:e.lastRestartAt>0?Du(e.lastRestartAt):`—`}),(0,G.jsx)(`td`,{className:`py-1.5 pl-4 tabular-nums text-[var(--color-fg-3)]`,children:e.nextRetryAt>0?(0,G.jsx)(`span`,{title:e.hibernateReason?`reason: ${e.hibernateReason}`:void 0,children:Pu(e.nextRetryAt,t)}):`—`})]},e.name))})]})})})]})}function Iu(){let e=Ae([`runtime-tick`,`activity-updated`,`limits-breach`,`supervisor-changed`]),t=De(),[n,r]=(0,_.useState)(Date.now()),[i,a]=(0,_.useState)(0),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(0),[u,d]=(0,_.useState)(!1),f=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(e)},[]);let{data:p}=B(`/api/state/runtime`,[e[`runtime-tick`]]),{data:m,refetch:h}=B(`/api/json/limits`,[e[`limits-breach`]]),{data:g}=B(`/api/state/activity-tail?after=${i}&limit=50`,[e[`activity-updated`]]),{data:v}=B(`/api/json/supervisors`,[e[`supervisor-changed`],e[`runtime-tick`]]);(0,_.useEffect)(()=>{g&&g.rows.length>0&&(a(e=>Math.max(e,g.maxId)),s(e=>{let t=new Set(e.map(e=>e.id));return[...g.rows.filter(e=>!t.has(e.id)),...e].slice(0,100)}))},[g]),(0,_.useEffect)(()=>{let e=p!==null;f.current===!1&&e&&l(e=>e+1),f.current=e},[p]);let y=p?Tu(p.uptime_ms):null,b=p&&p.last_eval_at>0?Du(p.last_eval_at):null,x=m?.breaches.cpu??!1,S=m?.breaches.memory??!1,C=p?x?`text-red-300`:(p.cpu_pct??0)>=60?`text-amber-300`:`text-emerald-300`:`text-[var(--color-fg-1)]`,w=S?`text-red-300`:`text-[var(--color-fg-1)]`;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-xl font-medium tracking-tight text-[var(--color-fg-0)]`,children:`Daemon Monitor`}),(0,G.jsx)(`p`,{className:`text-[12px] font-mono text-[var(--color-fg-3)] mt-0.5`,children:`live metrics · audit tail · resource limits`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[c>0&&(0,G.jsxs)(cr,{variant:`amber`,children:[c,` restart`,c===1?``:`s`]}),(0,G.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-[var(--color-fg-3)]`,children:Eu(n)})]})]}),(0,G.jsx)(Lu,{cpuPct:p?.cpu_pct??0,cpuLimit:m?.config.cpuLimitPct,memMb:p?.memory_rss_mb??0,memLimit:m?.config.memoryLimitMb,decisions:p?.decisions,latency:p?.latency,burstBuffer:t,evalsTotal:p?.evals_total??0}),m&&(x||S)&&(0,G.jsxs)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/[0.06] border-l-2 border-l-red-500/70 px-3 py-2.5 flex items-start gap-2.5`,children:[(0,G.jsx)(`span`,{className:`text-red-300 shrink-0 mt-0.5`,children:(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:[(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z`}),(0,G.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]})}),(0,G.jsxs)(`div`,{className:`space-y-0.5 text-xs font-mono`,children:[x&&(0,G.jsxs)(`div`,{className:`text-red-200`,children:[`cpu limit exceeded: `,p?.cpu_pct??`?`,`% >`,` `,m.config.cpuLimitPct,`%`]}),S&&(0,G.jsxs)(`div`,{className:`text-red-200`,children:[`memory limit exceeded: `,p?.memory_rss_mb??`?`,`mb >`,` `,m.config.memoryLimitMb,`mb`]})]})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`daemon status`})}),(0,G.jsx)(J,{children:p===null?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-500 shrink-0`}),(0,G.jsx)(`span`,{className:`text-red-300 font-mono uppercase tracking-wider text-xs`,children:`down`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] text-xs font-mono`,children:`— socket not reachable`})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-5 flex-wrap text-xs font-mono`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-emerald-400 pulse-soft shrink-0`}),(0,G.jsx)(`span`,{className:`text-emerald-300 uppercase tracking-wider`,children:`up`})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`pid`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:p.pid})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`uptime`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:y})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`mem`,` `,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:[p.memory_rss_mb,`MB`]})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`cpu`,` `,(0,G.jsxs)(`span`,{className:`${C} tabular-nums`,children:[p.cpu_pct,`%`]})]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`last eval`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:b??`—`})]})]})})]}),(0,G.jsx)(Fu,{supervisors:v?.supervisors??[]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2 overline`,children:[`system resources`,m&&(x||S)&&(0,G.jsx)(cr,{variant:`red`,children:`limit exceeded`})]}),(0,G.jsx)(`button`,{onClick:()=>d(e=>!e),className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-brand)] transition-colors cursor-pointer`,children:u?`hide limits`:`configure limits`})]}),(0,G.jsxs)(J,{children:[p===null?(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data — daemon not running`}):(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`cpu`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(p.history.cpu_pct.length??0)>1&&(0,G.jsx)(mr,{data:p.history.cpu_pct,width:80,height:20,color:x?`#f87171`:`#34d399`,threshold:m?.config.cpuLimitPct,maxValue:100}),(0,G.jsxs)(`span`,{className:`font-mono font-medium w-12 text-right tabular-nums ${C}`,children:[p.cpu_pct,`%`]})]})]}),(0,G.jsx)(ju,{value:p.cpu_pct,max:100,threshold:m?.config.cpuLimitPct??90,breached:x}),m&&(0,G.jsxs)(`div`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`limit: `,m.config.cpuLimitPct,`%`]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`memory rss`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(p.history.memory_rss_mb.length??0)>1&&(0,G.jsx)(mr,{data:p.history.memory_rss_mb,width:80,height:20,color:S?`#f87171`:`#38bdf8`,threshold:m?.config.memoryLimitMb}),(0,G.jsxs)(`span`,{className:`font-mono font-medium w-16 text-right tabular-nums ${w}`,children:[p.memory_rss_mb,`MB`]})]})]}),(0,G.jsx)(ju,{value:p.memory_rss_mb,max:Math.max(p.memory_rss_mb*1.5,m?.config.memoryLimitMb??512),threshold:m?.config.memoryLimitMb??512,breached:S}),m&&(0,G.jsxs)(`div`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`limit: `,m.config.memoryLimitMb,`MB`]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`heap`}),(0,G.jsxs)(`span`,{className:`font-mono text-[var(--color-fg-1)] tabular-nums`,children:[p.heap_used_mb,`MB / `,p.heap_total_mb,`MB`]})]}),(0,G.jsx)(Cc,{pct:p.heap_total_mb>0?Math.min(100,p.heap_used_mb/p.heap_total_mb*100):0,tone:`blue`,className:`h-1`})]})]}),u&&m&&(0,G.jsxs)(`div`,{className:`mt-5 pt-4 border-t border-[var(--color-line-0)]`,children:[(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-3 leading-relaxed`,children:[`thresholds trigger ui warnings. values are persisted to`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-fg-1)]`,children:`.sigmashake/config.toml`}),`.`]}),(0,G.jsx)(Mu,{limitsData:m,onSaved:()=>{h(),d(!1)}})]})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-2`,children:[(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`total evals`,value:p?.evals_total??`—`,valueClassName:`text-xl font-medium tabular-nums text-[var(--color-fg-0)]`}),(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`allow`,value:p?.decisions.allow??`—`,valueClassName:`text-xl font-medium tabular-nums text-emerald-300`}),(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`block`,value:p?.decisions.block??`—`,valueClassName:`text-xl font-medium tabular-nums text-red-300`}),(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`force`,value:p?.decisions.force??`—`,valueClassName:`text-xl font-medium tabular-nums text-violet-300`}),(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`log`,value:p?.decisions.log??`—`,valueClassName:`text-xl font-medium tabular-nums text-amber-300`}),(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)]`,labelPlacement:`above`,label:`ask`,value:p?.decisions.ask??`—`,valueClassName:`text-xl font-medium tabular-nums text-sky-300`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`eval latency`}),p&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[p.latency.samples,` samples`]})]}),(0,G.jsx)(J,{children:p===null?(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data`}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Au,{label:`p50`,ns:p.latency.p50_ns,maxNs:p.latency.max_ns}),(0,G.jsx)(Au,{label:`p95`,ns:p.latency.p95_ns,maxNs:p.latency.max_ns}),(0,G.jsx)(Au,{label:`p99`,ns:p.latency.p99_ns,maxNs:p.latency.max_ns}),(0,G.jsx)(Au,{label:`max`,ns:p.latency.max_ns,maxNs:p.latency.max_ns})]})})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`engine`})}),(0,G.jsx)(J,{children:p===null?(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no data`}):(0,G.jsx)(`div`,{className:`space-y-1.5 text-xs font-mono`,children:[[`native evals`,p.engine.native_evals],[`ts evals`,p.engine.ts_evals],[`native %`,`${p.engine.native_pct}%`],[`rule reloads`,p.rule_reloads],[`rate limit trips`,p.rate_limit_trips],[`loop guard blocks`,p.loop_guard_blocks],[`connection errors`,p.connection_errors]].map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex justify-between py-0.5 border-b border-[var(--color-line-0)] last:border-0`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:e}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] tabular-nums`,children:t})]},e))})})]})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`live event tail`}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`newest first · auto-updating`})]}),(0,G.jsx)(J,{children:o.length===0?(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-4 py-6 text-center`,children:(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`no events yet`})}):(0,G.jsx)(`div`,{className:`font-mono text-[11px] max-h-96 overflow-y-auto divide-y divide-[var(--color-line-0)]`,children:o.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] shrink-0 w-16 tabular-nums`,children:Eu(e.timestamp)}),e.tool===`__daemon`?(0,G.jsxs)(`span`,{className:`text-sky-400`,children:[`daemon`,` `,(()=>{try{let t=JSON.parse(e.input??`{}`);return`${t.event??e.decision}${t.detail?` (${t.detail})`:``}`}catch{return e.decision}})()]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`shrink-0 w-16 uppercase tracking-wider text-[10px] ${Ou[e.decision]??`text-[var(--color-fg-3)]`}`,children:[ku[e.decision]??`·`,` `,e.decision]}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] shrink-0 w-24 truncate`,children:e.tool}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] shrink-0 w-14 text-right tabular-nums`,children:wu(e.duration_ns)}),e.rule_id&&(0,G.jsx)(`a`,{href:`/rules?highlight=${encodeURIComponent(e.rule_id)}`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] truncate transition-colors`,title:e.rule_id,children:e.rule_id})]})]},e.id))})})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`ai agent debug endpoints`})}),(0,G.jsxs)(J,{children:[(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-2.5`,children:`agents can query these endpoints directly for automated triage:`}),(0,G.jsx)(`div`,{className:`space-y-1 font-mono text-[11px]`,children:[[`/api/state/runtime`,`full metrics snapshot (cpu, memory, history, latency)`],[`/api/json/limits`,`resource limits config + breach state`],[`/api/state/activity-tail?after=0&limit=20`,`recent eval events`],[`/api/json/daemon-status`,`status, pid, log tail`],[`/healthz`,`process uptime`]].map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`GET`}),(0,G.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] transition-colors`,children:e}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`— `,t]})]},e))})]})]})]})}function Lu({cpuPct:e,cpuLimit:t,memMb:n,memLimit:r,decisions:i,latency:a,evalsTotal:o,burstBuffer:s}){let c=(0,_.useMemo)(()=>{if(s.length===0)return 0;let e=Date.now()-1e4;return s.filter(t=>t.ts_ms>=e).length/10},[s]);return(a?.p95_ns??0)/1e6,(a?.p50_ns??0)/1e6,(a?.p99_ns??0)/1e6,(0,G.jsxs)(`div`,{className:`grid-bleed rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,style:{contain:`layout paint`},children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-4 lg:min-h-[320px]`,children:[(0,G.jsxs)(`div`,{className:`lg:col-span-3 flex flex-col items-center justify-start gap-2 lg:max-h-[320px]`,children:[(0,G.jsx)(Kr,{mode:`ring`,value:e,max:100,warnAt:(t??90)/100*.7,critAt:(t??90)/100,display:`${e.toFixed(1)}%`,label:`cpu`,size:220,className:`max-h-[240px]`}),(0,G.jsx)(xr,{value:e,width:260,height:56,windowMs:6e4,color:`#34d399`,fillColor:`rgba(52, 211, 153, 0.14)`,maxValue:100,className:`w-full`})]}),(0,G.jsxs)(`div`,{className:`lg:col-span-3 flex flex-col items-center justify-start gap-2 lg:max-h-[320px]`,children:[(0,G.jsx)(Kr,{mode:`ring`,value:n,max:r??1024,warnAt:.7,critAt:.9,display:`${n.toFixed(0)} MB`,label:`memory`,size:220,className:`max-h-[240px]`}),(0,G.jsx)(xr,{value:n,width:260,height:56,windowMs:6e4,color:`#38bdf8`,fillColor:`rgba(56, 189, 248, 0.14)`,maxValue:r?r*1.1:void 0,className:`w-full`})]}),(0,G.jsx)(`div`,{className:`lg:col-span-6 lg:max-h-[320px]`,children:(0,G.jsx)($r,{latency:a,bursts:s,gaugeMaxMs:10,windowMs:3e4,trendWindowSec:60,gaugeSize:200})})]}),(0,G.jsxs)(`div`,{className:`mt-4 grid grid-cols-1 lg:grid-cols-2 gap-3`,children:[(0,G.jsx)(kr,{label:`Total Evals`,value:o,tone:`amber`,sub:`${c.toFixed(1)}/s`,burstRing:s}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border bg-[var(--color-surface-1)] border-[var(--color-line-1)] px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`throughput · 60 s`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)] tabular-nums`,children:[c.toFixed(1),`/s`]})]}),(0,G.jsx)(xr,{value:c,width:420,height:56,windowMs:6e4,className:`w-full`})]})]}),i?(0,G.jsx)(`div`,{className:`mt-4 pt-3 border-t border-[var(--color-line-0)]`,children:(0,G.jsx)(ni,{counters:{allow:i.allow,block:i.block,ask:i.ask,log:i.log,force:i.force,shadow:i.shadow}})}):null,(0,G.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`live event stream · newest first`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:[s.length,` buffered · hover to pause`]})]}),(0,G.jsx)(Ti,{variant:`decision`,bursts:s,windowSize:300,height:260})]})]})}var Ru={ok:`green`,warn:`amber`,error:`red`,unknown:`gray`},zu={ok:`OK`,warn:`Warn`,error:`Error`,unknown:`Idle`};function Bu({title:e,status:t=`unknown`,statusLabel:n,className:r,children:i}){return(0,G.jsxs)(K,{className:W(`flex flex-col`,r),children:[(0,G.jsxs)(q,{children:[(0,G.jsx)(`span`,{className:`overline text-[var(--color-fg-2)]`,children:e}),(0,G.jsx)(cr,{variant:Ru[t],children:n??zu[t]})]}),(0,G.jsx)(J,{className:`flex flex-col gap-2 text-[12px]`,children:i})]})}function Vu({label:e,value:t,mono:n=!1,tone:r}){return(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 border-b border-[var(--color-line-0)] last:border-b-0 py-1`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] uppercase tracking-wider text-[10px] font-mono`,children:e}),(0,G.jsx)(`span`,{className:W(n?`font-mono`:`font-sans`,`tabular-nums text-right truncate`,r===`good`?`text-emerald-300`:r===`warn`?`text-amber-300`:r===`bad`?`text-red-300`:`text-[var(--color-fg-1)]`),children:t})]})}function Hu(e){return e===0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(2)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Uu(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function Wu(e){let t=Math.floor(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 Gu(e){return e?new Date(e*1e3).toLocaleString():`—`}function Ku(e){if(!e||e===0)return`never`;let t=Math.round((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}function qu({children:e,className:t}){return(0,G.jsx)(`div`,{className:`overline mb-2.5 ${t??``}`,children:e})}function Ju({label:e,value:t,mono:n=!0,accent:r}){return(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 py-1.5 border-b border-[var(--color-line-0)] last:border-0`,children:[(0,G.jsx)(`span`,{className:`text-xs text-[var(--color-fg-3)] shrink-0 font-mono`,children:e}),(0,G.jsx)(`span`,{className:`text-xs text-right truncate max-w-[65%] ${n?`font-mono tabular-nums`:``} ${r??`text-[var(--color-fg-1)]`}`,children:t})]})}function Yu({ok:e,label:t,badLabel:n}){return e?(0,G.jsx)(cr,{variant:`green`,children:t}):(0,G.jsx)(cr,{variant:`red`,children:n??t})}function Xu({pct:e,total:t,max:n}){let r=e<60?`green`:e<85?`amber`:`red`,i=e>=85?`text-red-300`:e>=60?`text-amber-300`:`text-emerald-300`;return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs font-mono tabular-nums`,children:[(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[t.toLocaleString(),` / `,n.toLocaleString(),` rows`]}),(0,G.jsxs)(`span`,{className:i,children:[e,`%`]})]}),(0,G.jsx)(Cc,{pct:e,tone:r,className:`h-1.5`})]})}var Zu=3e3,Qu={log:`text-[var(--color-fg-1)]`,info:`text-sky-300`,warn:`text-amber-300`,error:`text-red-300`,debug:`text-[var(--color-fg-3)]`};function $u(e){return e.value==null?e.description?e.description:`[${e.type}]`:String(e.value)}function ed(){let e=Pl(),[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1),p=(0,_.useRef)(null),m=(0,_.useRef)(0),h=(0,_.useRef)(!0);(0,_.useEffect)(()=>{if(h.current){h.current=!1;return}let e=p.current;if(!e)return;let t=e.parentElement;t&&(t.scrollTop=t.scrollHeight)},[a]),(0,_.useEffect)(()=>{if(e.connected)return e.sendCommand(`Runtime.enable`).catch(()=>{}),e.onEvent(`Runtime.consoleAPICalled`,e=>{let t=e;o(e=>{let n=[...e,{id:m.current++,type:t.type??`log`,args:t.args??[],timestamp:t.timestamp??Date.now()}];return n.length>500?n.slice(-500):n})})},[e.connected]),(0,_.useEffect)(()=>{e.preconfiguredTarget&&!e.connected&&!e.connecting&&e.connect(e.preconfiguredTarget.id)},[e]),(0,_.useEffect)(()=>{!e.connected||d||t||r||(f(!0),(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),setTimeout(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch{n(!1)}},Zu)}catch{}})(),e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0}).then(e=>{c(JSON.parse(e.result.value))}).catch(()=>{}))},[e.connected,d,t,r]);let g=(0,_.useCallback)(async()=>{try{await e.sendCommand(`Profiler.enable`),await e.sendCommand(`Profiler.start`),n(!0),i(null)}catch(e){console.error(`Profiler.start failed:`,e)}},[e]),v=(0,_.useCallback)(async()=>{try{let t=await e.sendCommand(`Profiler.stop`);n(!1),i(t.profile)}catch(e){console.error(`Profiler.stop failed:`,e),n(!1)}},[e]),y=(0,_.useCallback)(async()=>{u(!0);try{let t=await e.sendCommand(`Runtime.evaluate`,{expression:`JSON.stringify(process.memoryUsage())`,returnByValue:!0});c(JSON.parse(t.result.value))}catch{}finally{u(!1)}},[e]),b=(0,_.useCallback)(()=>{e.preconfiguredTarget&&e.connect(e.preconfiguredTarget.id)},[e]);return e.active?e.connected?(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono text-[var(--color-fg-2)]`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-emerald-400`}),`connected`,e.bunVersion?` · bun v${e.bunVersion}`:``]}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:e.disconnect,children:`disconnect`})]})]}),e.error&&(0,G.jsx)(J,{children:(0,G.jsx)(`p`,{className:`text-xs text-red-300 font-mono`,children:e.error})})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`cpu profiler`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300 flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-400 pulse-soft`}),`recording`]}),t?(0,G.jsx)(Y,{variant:`danger`,size:`sm`,onClick:v,children:`stop & render`}):(0,G.jsx)(Y,{variant:`primary`,size:`sm`,onClick:g,children:`start recording`})]})]}),(0,G.jsx)(J,{children:r?(0,G.jsx)(Tc,{profile:r,children:(0,G.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 overflow-x-hidden`,children:(0,G.jsx)(zl,{profile:r})})}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:t?`recording cpu profile (auto-captures ${Zu/1e3}s)… perform actions in ssg to generate data.`:`click start recording, or wait for auto-capture on page load.`})})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`memory`}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:y,disabled:l,children:l?`…`:`refresh`})]}),(0,G.jsx)(J,{children:s?(0,G.jsx)(Ec,{memory:s,formatValue:Uu}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)]`,children:d?`fetching memory metrics…`:`click refresh to fetch process.memoryUsage().`})})]}),(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`console`}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>o([]),children:`clear`})]}),(0,G.jsx)(J,{children:(0,G.jsxs)(`div`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-2 h-40 overflow-y-auto font-mono text-[11px]`,children:[a.length===0?(0,G.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`console output will appear here…`}):a.map(e=>(0,G.jsxs)(`div`,{className:`py-0.5 border-b border-[var(--color-line-0)] ${Qu[e.type]??`text-[var(--color-fg-1)]`}`,children:[(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)] mr-2 uppercase tracking-wider`,children:[`[`,e.type,`]`]}),e.args.map($u).join(` `)]},e.id)),(0,G.jsx)(`div`,{ref:p})]})})]})]}):(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(cr,{variant:`amber`,children:e.connecting?`connecting…`:`available`}),!e.connecting&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:b,children:`connect`})]})]}),(0,G.jsx)(J,{children:(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:e.connecting?`establishing websocket connection to bun inspector…`:`inspector is active but not connected. click connect to start profiling.`})})]}):(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`runtime inspector`}),(0,G.jsx)(cr,{variant:`outline`,children:`inactive`})]}),(0,G.jsx)(J,{children:(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[`the bun inspector is not active. restart`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg serve`}),` to enable it automatically.`]})})]})}function td(){let[e,t]=(0,_.useState)(0),{data:n}=B(`/api/json/evald-log`,[e]),r=(0,_.useRef)(null),i=(0,_.useRef)(!0);(0,_.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),5e3);return()=>clearInterval(e)},[]),(0,_.useEffect)(()=>{if(i.current){i.current=!1;return}let e=r.current;if(!e)return;let t=e.parentElement;t&&(t.scrollTop=t.scrollHeight)},[n?.lines.length]);let a=n?.lines??[];return(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`daemon log`}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] truncate max-w-[60%]`,children:[n?.path?n.path:`loading…`,` · last 200 lines · 5s refresh`]})]}),(0,G.jsxs)(J,{children:[n?.error&&(0,G.jsx)(`p`,{className:`text-xs text-red-300 font-mono mb-2`,children:n.error}),a.length===0&&!n?.error&&(0,G.jsx)(`div`,{className:`rounded-sm border border-dashed border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-4 py-6 text-center`,children:(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[`no log entries yet. start the daemon with`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg serve`}),` to generate log output.`]})}),a.length>0&&(0,G.jsxs)(`pre`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] rounded-sm p-3 text-[10px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-all max-h-80 overflow-y-auto font-mono leading-relaxed`,children:[a.join(`
23
+ `),(0,G.jsx)(`div`,{ref:r})]})]})]})}function nd(){let e=Ae([`runtime-tick`,`rules-changed`]),{data:t,refetch:n}=B(`/api/json/observability`,[e[`runtime-tick`],e[`rules-changed`]]),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(Date.now()),[l,u]=(0,_.useState)(`idle`),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(`idle`);(0,_.useEffect)(()=>{t&&c(Date.now())},[t]);let h=(0,_.useCallback)(async()=>{u(`loading`);try{let e=await(await fetch(`/api/rules/sync-to-db`,{method:`POST`,headers:ke()})).json();if(e.ok){u(`done`);let t=(e.pruned_count??0)>0?` (${e.pruned_count} orphan(s) pruned)`:``;f((e.message??`synced ${e.synced} rules`)+t),n()}else u(`error`),f(e.error??`sync failed`)}catch(e){u(`error`),f(String(e))}},[n]),g=(0,_.useCallback)(async()=>{m(`loading`);try{await fetch(`/api/rules/force-reload`,{method:`POST`,headers:ke()}),m(`done`),n(),setTimeout(()=>m(`idle`),3e3)}catch{m(`idle`)}},[n]),v=t?.db,y=t?.rules,b=t?.audit,x=t?.process,S=t?.flight_recorder,C=y?.drift_detected??!1;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-xl font-medium tracking-tight text-[var(--color-fg-0)]`,children:`Observability`}),(0,G.jsx)(`p`,{className:`text-[12px] font-mono text-[var(--color-fg-3)] mt-0.5`,children:`sqlite health · rule drift · runtime profiler · diagnostics`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,children:[`refreshed `,Ku(s)]}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:n,children:`refresh`})]})]}),(0,G.jsx)(rd,{db:v,audit:b,proc:x,flight:S,driftDetected:C}),(0,G.jsxs)(K,{className:C?`border-red-500/30 border-l-2 border-l-red-500/70`:`border-emerald-500/20 border-l-2 border-l-emerald-500/60`,children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`rule drift detector`}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`— .rules files vs sqlite`}),(0,G.jsx)(`button`,{onClick:()=>o(e=>!e),"aria-expanded":a,"aria-label":`Explain these counts`,title:`Why do these numbers differ?`,className:`text-[10px] font-mono text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)] border border-[var(--color-line-1)] rounded-sm px-1.5 py-0.5 transition-colors cursor-pointer`,children:a?`× close`:`? why these numbers`})]}),y&&(C?(0,G.jsx)(cr,{variant:`red`,children:`⚠ drift detected`}):(0,G.jsx)(cr,{variant:`green`,children:`✓ in sync`}))]}),(0,G.jsxs)(J,{children:[a&&(0,G.jsxs)(`div`,{className:`mb-4 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)] px-3 py-2.5 space-y-2 text-[11px] font-mono leading-relaxed text-[var(--color-fg-3)]`,children:[(0,G.jsxs)(`div`,{className:`text-[var(--color-fg-2)]`,children:[(0,G.jsx)(`code`,{children:`.rules files`}),` and `,(0,G.jsx)(`code`,{children:`db rules`}),` are`,` `,(0,G.jsx)(`span`,{className:`text-amber-300`,children:`not auto-synced`}),`. A mismatch is usually expected:`]}),(0,G.jsxs)(`ul`,{className:`space-y-1 pl-3 list-disc marker:text-[var(--color-fg-4)]`,children:[(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`one file can hold many rules`}),` `,`— compare `,(0,G.jsx)(`code`,{children:`db rules`}),` against`,` `,(0,G.jsx)(`code`,{children:`file_rule_count`}),`, not `,(0,G.jsx)(`code`,{children:`file_count`}),`.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in files`}),` `,`means unsynced edits — run`,` `,(0,G.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`}),` or click`,` `,(0,G.jsx)(`code`,{children:`↑ sync files → db`}),`.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in db`}),` `,`with `,(0,G.jsx)(`code`,{children:`source_file IS NULL`}),` is healthy — hub, fleet, or cloud-synced rules legitimately live only in the db.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`only in db`}),` `,`with `,(0,G.jsx)(`code`,{children:`source_file`}),` set means an orphan from a deleted file — `,(0,G.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`}),` `,`prunes it.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:`db rules`}),` `,`includes disabled rows; `,(0,G.jsx)(`code`,{children:`db_enabled_count`}),` `,`excludes them.`]})]}),(0,G.jsxs)(`div`,{className:`pt-1.5 border-t border-[var(--color-line-0)]`,children:[`full reference:`,` `,(0,G.jsx)(`a`,{href:`https://docs.sigmashake.com/rule-storage`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--color-fg-2)] underline decoration-dotted underline-offset-2 hover:text-amber-300 transition-colors`,children:`docs.sigmashake.com/rule-storage ↗`})]})]}),y?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[{label:`.rules files`,value:y.file_count,sub:`${y.file_rule_count} rules total`,tone:`neutral`},{label:`db rules`,value:y.db_rule_count,sub:`${y.db_enabled_count} enabled`,tone:`neutral`},{label:`only in files`,value:y.drift_details.only_in_files.length,tone:y.drift_details.only_in_files.length>0?`amber`:`gray`},{label:`only in db`,value:y.drift_details.only_in_db.length,tone:y.drift_details.only_in_db.length>0?`red`:`gray`}].map(({label:e,value:t,sub:n,tone:r})=>(0,G.jsx)(Sc,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-0)]`,label:e,value:t,sub:n,tone:r,labelPlacement:`above`,subClassName:`text-[var(--color-fg-4)]`,valueClassName:`text-xl font-medium tabular-nums`},e))}),C&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`button`,{onClick:()=>i(e=>!e),className:`text-[10px] font-mono uppercase tracking-wider text-amber-300 hover:text-amber-200 flex items-center gap-1 transition-colors cursor-pointer`,children:[r?`▾`:`▸`,` view drift details`]}),r&&(0,G.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[y.drift_details.only_in_files.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`text-[10px] font-mono uppercase tracking-wider text-amber-300/80 mb-1.5`,children:[`in .rules files but not in db — run`,` `,(0,G.jsx)(`code`,{className:`text-amber-300`,children:`ssg sync`})]}),(0,G.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-amber-400/20 rounded-sm p-2 space-y-0.5 max-h-40 overflow-y-auto`,children:y.drift_details.only_in_files.map(e=>(0,G.jsxs)(`div`,{className:`font-mono text-[11px] text-amber-200/80`,children:[`+ `,e]},e))})]}),y.drift_details.only_in_db.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] font-mono uppercase tracking-wider text-red-300/80 mb-1.5`,children:`in db but not in any .rules file — orphaned rules`}),(0,G.jsx)(`div`,{className:`bg-[var(--color-surface-0)] border border-red-400/20 rounded-sm p-2 space-y-0.5 max-h-40 overflow-y-auto`,children:y.drift_details.only_in_db.map(e=>(0,G.jsxs)(`div`,{className:`font-mono text-[11px] text-red-200/80`,children:[`− `,e]},e))})]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-3 border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(Y,{variant:`primary`,size:`sm`,onClick:h,disabled:l===`loading`,children:l===`loading`?`syncing…`:`↑ sync files → db`}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:g,disabled:p===`loading`,children:p===`loading`?`…`:p===`done`?`✓ reloaded`:`↻ force reload`}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] ml-auto`,children:y.db_rule_count===0?`⚠ db empty — daemon falls back to file-based loading`:`db has ${y.db_rule_count} rules — indexed queries`})]}),l===`done`&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm border border-emerald-500/25 bg-emerald-500/[0.06] px-3 py-2 text-xs font-mono text-emerald-200`,children:[(0,G.jsxs)(`span`,{children:[`✓ `,d]}),(0,G.jsx)(`button`,{onClick:()=>u(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-emerald-500/30 hover:bg-emerald-500/10 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`dismiss`})]}),l===`error`&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-sm border border-red-500/25 bg-red-500/[0.06] px-3 py-2 text-xs font-mono text-red-200`,children:[(0,G.jsxs)(`span`,{children:[`✗ `,d]}),(0,G.jsx)(`button`,{onClick:()=>u(`idle`),className:`ml-3 shrink-0 px-2 py-0.5 rounded-sm border border-red-500/30 hover:bg-red-500/10 transition-colors cursor-pointer uppercase tracking-wider text-[10px]`,children:`dismiss`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px] font-mono text-[var(--color-fg-4)] pt-2 border-t border-[var(--color-line-0)]`,children:[(0,G.jsxs)(`span`,{children:[`rules dir:`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:y.rules_dir})]}),(0,G.jsxs)(`span`,{className:`ml-auto`,children:[`last reload:`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)]`,children:Ku(y.last_reload_at)})]})]})]}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-5`,children:[(0,G.jsxs)(K,{children:[(0,G.jsxs)(q,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`sqlite database`}),v&&!v.error&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Yu,{ok:v.journal_mode===`wal`,label:`wal`,badLabel:`no wal`}),(0,G.jsx)(Yu,{ok:v.synchronous===`NORMAL`,label:`normal`,badLabel:v.synchronous})]})]}),(0,G.jsx)(J,{children:v?v.error?(0,G.jsx)(`div`,{className:`text-xs text-red-300 font-mono bg-red-500/[0.06] border border-red-500/25 rounded-sm p-2`,children:v.error}):(0,G.jsxs)(`div`,{children:[(0,G.jsx)(qu,{children:`storage`}),(0,G.jsx)(Ju,{label:`file path`,value:v.path}),(0,G.jsx)(Ju,{label:`file size`,value:Hu(v.file_size_bytes)}),(0,G.jsx)(Ju,{label:`allocated`,value:`${Hu(v.allocated_bytes)} (${v.page_count.toLocaleString()} pages × ${v.page_size}B)`}),(0,G.jsx)(qu,{className:`mt-4`,children:`pragma configuration`}),(0,G.jsx)(Ju,{label:`journal_mode`,value:v.journal_mode,accent:v.journal_mode===`wal`?`text-emerald-300`:`text-amber-300`}),(0,G.jsx)(Ju,{label:`synchronous`,value:v.synchronous,accent:v.synchronous===`NORMAL`?`text-emerald-300`:`text-amber-300`}),(0,G.jsx)(Ju,{label:`cache_size`,value:`${v.cache_size_kb.toLocaleString()} KB (${Math.round(v.cache_size_kb/1024)} MB)`}),(0,G.jsx)(Ju,{label:`page_size`,value:`${v.page_size.toLocaleString()} B`}),v.wal_checkpoint&&(0,G.jsx)(Ju,{label:`wal checkpoint`,value:`log ${v.wal_checkpoint.log}, checkpointed ${v.wal_checkpoint.checkpointed}, busy ${v.wal_checkpoint.busy}`}),(0,G.jsx)(qu,{className:`mt-4`,children:`table row counts`}),v.tables.map(e=>(0,G.jsx)(Ju,{label:e.name,value:e.row_count>=0?e.row_count.toLocaleString():`error`,accent:e.row_count<0?`text-red-300`:`text-[var(--color-fg-1)]`},e.name))]}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`audit log capacity`})}),(0,G.jsx)(J,{children:b?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Xu,{pct:b.utilization_pct,total:b.total_rows,max:b.max_rows}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Ju,{label:`total rows`,value:b.total_rows.toLocaleString()}),(0,G.jsx)(Ju,{label:`rotation limit`,value:b.max_rows.toLocaleString()}),(0,G.jsx)(Ju,{label:`utilization`,value:`${b.utilization_pct}%`,accent:b.utilization_pct>=85?`text-red-300`:b.utilization_pct>=60?`text-amber-300`:`text-emerald-300`}),(0,G.jsx)(Ju,{label:`oldest entry`,value:Gu(b.oldest_timestamp)}),(0,G.jsx)(Ju,{label:`newest entry`,value:Gu(b.newest_timestamp)})]}),b.utilization_pct>=85&&(0,G.jsx)(`div`,{className:`rounded-sm border border-red-500/25 bg-red-500/[0.06] px-3 py-2 text-[11px] font-mono text-red-200`,children:`⚠ audit log nearing rotation limit. oldest entries will be purged automatically.`})]}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`process & runtime`})}),(0,G.jsx)(J,{children:x?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Ju,{label:`pid`,value:x.pid}),(0,G.jsx)(Ju,{label:`uptime`,value:Wu(x.uptime_ms)}),(0,G.jsx)(Ju,{label:`memory (rss)`,value:`${x.memory_rss_mb} MB`}),(0,G.jsx)(Ju,{label:`bun version`,value:x.bun_version}),(0,G.jsx)(Ju,{label:`node compat`,value:x.node_version}),(0,G.jsx)(Ju,{label:`platform`,value:`${x.platform} / ${x.arch}`})]}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]})]})]}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`flight recorder`})}),(0,G.jsx)(J,{children:S?(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline mb-1.5`,children:`log file`}),(0,G.jsx)(`div`,{className:`text-xs font-mono text-[var(--color-fg-1)] truncate`,children:`…${S.path.slice(-50)}`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline mb-1.5`,children:`file size`}),(0,G.jsx)(`div`,{className:`text-xs font-mono tabular-nums ${S.file_size_bytes===0?`text-[var(--color-fg-4)]`:`text-[var(--color-fg-1)]`}`,children:Hu(S.file_size_bytes)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline mb-1.5`,children:`approx. entries`}),(0,G.jsx)(`div`,{className:`text-xs font-mono tabular-nums ${S.approx_entries===0?`text-[var(--color-fg-4)]`:`text-[var(--color-fg-1)]`}`,children:S.approx_entries===0?`—`:S.approx_entries.toLocaleString()})]})]}):(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`loading…`})})]}),(0,G.jsx)(ed,{}),(0,G.jsx)(td,{}),(0,G.jsxs)(K,{children:[(0,G.jsx)(q,{children:(0,G.jsx)(`span`,{className:`overline`,children:`observability api`})}),(0,G.jsxs)(J,{children:[(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mb-2.5`,children:`machine-readable endpoints for automated monitoring and ai agent triage:`}),(0,G.jsx)(`div`,{className:`space-y-1 font-mono text-[11px]`,children:[[`/api/json/observability`,`sqlite health, rule drift, process info`],[`/api/state/runtime`,`eval latency, decision counters, memory`],[`/api/state/activity-tail?after=0&limit=20`,`recent eval events (live feed)`],[`/api/json/daemon-status`,`daemon pid, status, log tail`],[`/api/json/evald-log`,`last 200 lines of evald.log (daemon stderr)`],[`/healthz`,`process liveness`],[`/readyz`,`sqlite liveness`]].map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`GET`}),(0,G.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-[var(--color-brand)]/80 hover:text-[var(--color-brand)] transition-colors`,children:e}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)] hidden sm:inline`,children:[`— `,t]})]},e))})]})]})]})}function rd({db:e,audit:t,proc:n,flight:r,driftDetected:i}){let a=e?e.error?`error`:e.journal_mode===`wal`&&e.synchronous===`NORMAL`?`ok`:`warn`:`unknown`,o=t?t.utilization_pct>=85?`error`:t.utilization_pct>=60?`warn`:`ok`:`unknown`,s=n?n.memory_rss_mb>600?`warn`:`ok`:`unknown`;return(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,G.jsxs)(Bu,{title:`sqlite`,status:a,statusLabel:e?.journal_mode?.toUpperCase()??`idle`,children:[(0,G.jsx)(Vu,{label:`size`,value:e?(0,G.jsx)(pr,{value:e.file_size_bytes,format:e=>Uu(e)}):`—`,mono:!0}),(0,G.jsx)(Vu,{label:`journal`,value:e?.journal_mode??`—`,mono:!0}),(0,G.jsx)(Vu,{label:`sync`,value:e?.synchronous??`—`,mono:!0}),(0,G.jsx)(Vu,{label:`tables`,value:e?.tables.length??0,tone:i?`warn`:`neutral`})]}),(0,G.jsxs)(Bu,{title:`audit log`,status:o,statusLabel:t?`${t.utilization_pct}%`:`idle`,children:[(0,G.jsx)(Vu,{label:`rows`,value:t?(0,G.jsx)(pr,{value:t.total_rows}):`—`}),(0,G.jsx)(Vu,{label:`capacity`,value:t?`${(t.total_rows/Math.max(1,t.max_rows)*100).toFixed(1)}%`:`—`,tone:t&&t.utilization_pct>=85?`bad`:t&&t.utilization_pct>=60?`warn`:`good`}),(0,G.jsx)(Vu,{label:`oldest`,value:Gu(t?.oldest_timestamp??null),mono:!0}),(0,G.jsx)(Vu,{label:`newest`,value:Gu(t?.newest_timestamp??null),mono:!0})]}),(0,G.jsxs)(Bu,{title:`process`,status:s,statusLabel:n?`pid ${n.pid}`:`idle`,children:[(0,G.jsx)(Vu,{label:`uptime`,value:n?Wu(n.uptime_ms):`—`,mono:!0}),(0,G.jsx)(Vu,{label:`rss`,value:n?(0,G.jsxs)(`span`,{children:[(0,G.jsx)(pr,{value:n.memory_rss_mb,format:e=>e.toFixed(0)}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] ml-1`,children:`MB`})]}):`—`}),(0,G.jsx)(Vu,{label:`bun`,value:n?.bun_version??`—`,mono:!0}),(0,G.jsx)(Vu,{label:`platform`,value:n?`${n.platform}/${n.arch}`:`—`,mono:!0})]}),(0,G.jsxs)(Bu,{title:`flight recorder`,status:r&&r.file_size_bytes>0?`ok`:`unknown`,statusLabel:r?`${r.approx_entries.toLocaleString()} entries`:`idle`,children:[(0,G.jsx)(Vu,{label:`size`,value:r?(0,G.jsx)(pr,{value:r.file_size_bytes,format:e=>Uu(e)}):`—`,mono:!0}),(0,G.jsx)(Vu,{label:`entries`,value:r?(0,G.jsx)(pr,{value:r.approx_entries}):`—`})]})]})}var id=900,ad=180,od=320,sd=800,cd=4;function ld({sessionKey:e}={}){let t=Ee(),n=Oe(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(`idle`),s=(0,_.useRef)([]),c=(0,_.useRef)(-1),l=(0,_.useRef)(0),u=(0,_.useRef)(null);if((0,_.useEffect)(()=>{if(!t||n===c.current||(c.current=n,t.decision!==`block`&&t.decision!==`force`)||e&&Ya(t)!==e)return;let u=Date.now(),d=s.current,f=d[0];if(f&&u-l.current<sd){f.extra+=1,f.burst=t,f.seq=n,l.current=u;return}if(d.length>=cd&&d.shift(),d.push({seq:n,burst:t,extra:0}),l.current=u,a===`idle`&&!r){let e=d.shift()??null;e&&(i(e),o(`in`))}},[n]),(0,_.useEffect)(()=>{if(a===`idle`)return;let e=null;return a===`in`?e=setTimeout(()=>o(`visible`),ad):a===`visible`?e=setTimeout(()=>o(`out`),id):a===`out`&&(e=setTimeout(()=>{let e=s.current.shift()??null;e?(i(e),o(`in`)):(i(null),o(`idle`))},od)),u.current=e,()=>{e&&clearTimeout(e)}},[a]),!r)return null;let{burst:d,extra:f}=r,p=Xa[d.decision]??`#ef4444`,m=st(),h=a===`in`||a===`visible`?1:0,g=m||a===`in`||a===`visible`?0:-8,v=d.rule_id??`rule`,y=d.decision===`block`?`BLOCKED`:`FORCED`,b=f>0?`${d.tool} · +${f} more in this burst`:`${d.tool} · ${d.client}${d.agent_id?`:${d.agent_id}`:``}`;return(0,G.jsx)(`div`,{className:e?`pointer-events-none absolute top-2 left-1/2 z-30 select-none`:`pointer-events-none fixed top-20 left-1/2 z-40 select-none`,style:{transform:`translateX(-50%) translateY(${g}px) scale(1)`,opacity:h,transition:m?`opacity ${ad}ms ease-out`:`opacity ${ad}ms ease-out, transform ${ad}ms cubic-bezier(0.34, 1.56, 0.64, 1)`},"aria-live":`polite`,"aria-atomic":`true`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-3 rounded-md border bg-black/95 shadow-2xl`,style:{borderColor:p},children:[(0,G.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full shrink-0`,style:{background:p,boxShadow:m?`none`:`0 0 16px ${p}`}}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`text-[11px] font-mono uppercase tracking-[0.18em]`,style:{color:p},children:[y,` BY SSG`]}),(0,G.jsx)(`div`,{className:`text-[14px] font-mono text-[var(--color-fg-1)] truncate max-w-[420px]`,children:v}),(0,G.jsx)(`div`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] truncate max-w-[420px]`,children:b})]})]})})}var ud=(0,_.memo)(function(e){let{sessionKey:t,bursts:n,paused:r,selectedId:i,onSelect:a,burstSeq:o,isStale:s,isFadingOut:c,minHeight:l,pinned:u,minimized:d,isFullscreen:f,viewMode:p=`full`,thumbnail:m=!1,onPromote:h,activePanelCount:g=1,onTogglePin:v,onToggleMinimize:y,onToggleFullscreen:b,onClose:x,onFrameTime:S}=e,C=p===`broadcast`,w=!m&&(p===`stream`||p===`broadcast`||f)?`large`:`normal`,T=t.indexOf(`:`),E=T>=0?t.slice(0,T):t,D=T>=0?t.slice(T+1):``,O=(0,_.useRef)(null),[ee,k]=(0,_.useState)(!0),[A,j]=(0,_.useState)(null),te=()=>{let e=O.current;if(!e)return;let t=e.querySelector(`canvas`);t instanceof HTMLCanvasElement&&j(t.toDataURL(`image/png`))},ne=()=>{if(!A)return;let e=document.createElement(`a`),n=t.replace(/[^a-z0-9._-]+/gi,`-`);e.href=A,e.download=`ssg-graph-${n}-${Date.now()}.png`,document.body.appendChild(e),e.click(),e.remove()},re=()=>{!A||!navigator.clipboard?.write||fetch(A).then(e=>e.blob()).then(e=>{let t=new ClipboardItem({"image/png":e});return navigator.clipboard.write([t])}).catch(()=>{})},M=typeof navigator<`u`&&typeof navigator.clipboard?.write==`function`&&typeof ClipboardItem<`u`;(0,_.useEffect)(()=>{if(f){k(!0);return}let e=O.current;if(!e)return;let t=new IntersectionObserver(e=>{for(let t of e)k(t.isIntersecting)},{threshold:.01});return t.observe(e),()=>t.disconnect()},[f]);let N=n.length>0?n[n.length-1]:null,ie=N?Xa[N.decision]??`#6b7280`:`#6b7280`,ae=N?.decision??null,oe=N?.tool??null,P=r||!ee||d,F=(0,_.useMemo)(()=>n.length>24?n.slice(n.length-24):n,[n]);return(0,G.jsxs)(`div`,{ref:O,className:`relative flex flex-col shrink-0 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] overflow-hidden transition-opacity duration-1000${f?` flex-1 min-h-0`:``}`,style:{minHeight:d||f?void 0:l,opacity:c?0:1},children:[!C&&(0,G.jsxs)(`header`,{className:`group flex items-center justify-between px-3 py-1.5 border-b border-[var(--color-line-1)] bg-black/30 shrink-0 gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono min-w-0`,children:[u&&(0,G.jsx)(`span`,{className:`text-amber-300`,title:`Pinned`,children:`▲`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider`,children:E}),D&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] truncate`,children:D})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono text-[var(--color-fg-4)]`,children:[oe&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 max-w-[180px]`,title:ae?`latest: ${oe} → ${ae}`:`latest: ${oe}`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{background:ie}}),(0,G.jsx)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:oe})]}),(0,G.jsxs)(`span`,{className:`hidden md:inline opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity`,children:[n.length,`n`]}),s?(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-amber-300`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-amber-400`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:`idle`})]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-emerald-300`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:`live`})]}),!m&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1 ml-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity duration-150`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:v,className:`px-1.5 py-0.5 rounded border text-[10px] uppercase tracking-wider transition-colors ${u?`border-amber-500/60 text-amber-300`:`border-[var(--color-line-1)] text-[var(--color-fg-3)] hover:text-amber-300 hover:border-amber-500/40`}`,title:u?`Unpin`:`Pin to top`,children:`pin`}),(0,G.jsx)(`button`,{type:`button`,onClick:y,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,title:d?`Expand`:`Minimize`,children:d?`+`:`–`}),(0,G.jsx)(`button`,{type:`button`,onClick:te,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,title:`Preview PNG snapshot of this panel`,children:`▣`}),(0,G.jsx)(`button`,{type:`button`,onClick:b,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,title:f?`Exit fullscreen`:`Fullscreen`,children:f?`×`:`⛶`}),x&&(0,G.jsx)(`button`,{type:`button`,onClick:x,"aria-label":`Close session ${t}`,className:`px-1.5 py-0.5 rounded border border-[var(--color-line-1)] text-[10px] text-[var(--color-fg-3)] hover:text-rose-300 hover:border-rose-500/40 transition-colors`,title:`End this session on the graph`,children:`╳`})]})]})]}),!d&&!m&&!C&&(0,G.jsx)(Is,{sessionKey:t,className:`rounded-none border-x-0 border-t-0 border-b border-[var(--color-line-1)] shrink-0`}),A&&(0,G.jsxs)(`div`,{className:`absolute inset-0 z-40 flex flex-col items-center justify-center gap-3 bg-black/80 backdrop-blur-sm p-4`,children:[(0,G.jsx)(`img`,{src:A,alt:`Panel snapshot`,className:`max-w-full max-h-[60%] rounded-sm border border-[var(--color-line-1)] object-contain`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[M&&(0,G.jsx)(`button`,{type:`button`,onClick:re,className:`px-3 py-1.5 rounded border border-[var(--color-line-1)] text-[11px] font-mono text-[var(--color-fg-2)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,children:`copy`}),(0,G.jsx)(`button`,{type:`button`,onClick:ne,className:`px-3 py-1.5 rounded border border-[var(--color-line-1)] text-[11px] font-mono text-[var(--color-fg-2)] hover:text-sky-300 hover:border-sky-500/40 transition-colors`,children:`download`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>j(null),className:`px-3 py-1.5 rounded border border-[var(--color-line-1)] text-[11px] font-mono text-[var(--color-fg-3)] hover:text-rose-300 hover:border-rose-500/40 transition-colors`,children:`close`})]})]}),!d&&(0,G.jsxs)(`div`,{className:`flex-1 min-h-0 relative`,children:[(0,G.jsx)(ld,{sessionKey:t}),(0,G.jsx)(ks,{bursts:F,paused:P,selectedId:i,onSelect:a,burstSeq:o,compact:!0,activePanelCount:g,labelDensity:w,onFrameTime:S}),m&&(0,G.jsx)(`button`,{type:`button`,onClick:h,"aria-label":`Promote ${E} to spotlight`,title:`Spotlight ${E}${D?` · ${D}`:``}`,className:`absolute inset-0 cursor-pointer bg-transparent hover:bg-sky-400/5 transition-colors`})]})]})}),dd=200;function fd(e){let t=Date.now()-e;return t<2e3?`now`:t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function pd(e){let t=e/1e6;return t<1e3?`${Math.round(t)}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:`${Math.floor(t/6e4)}m${Math.floor(t%6e4/1e3)}s`}function md(e){let{bursts:t,selectedId:n,onSelect:r}=e,i=(0,_.useMemo)(()=>{let e=new Map;for(let n of t){if(fi(n.tool))continue;let t=Ya(n),r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}let n=Array.from(e.entries());return n.sort((e,t)=>{let n=e[1][e[1].length-1]?.ts_ms??0;return(t[1][t[1].length-1]?.ts_ms??0)-n}),n},[t]);return t.length===0?(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center px-4`,children:[(0,G.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`feed · idle`}),(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] max-w-[260px]`,children:[`Each entry is one tool call your AI agent made.`,(0,G.jsx)(`br`,{}),`Color = the ssg rule decision.`]})]}):(0,G.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-3 py-3 space-y-5`,children:i.map(([e,t])=>{let i=e.indexOf(`:`),a=i>=0?e.slice(0,i):e;i>=0&&e.slice(i+1);let o=t[t.length-1],s=o?Xa[o.decision]??`#6b7280`:`#6b7280`,c=t.slice(-dd).reverse();return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 pb-1 border-b border-[var(--color-line-1)] text-[11px]`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:s}}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)] font-medium`,children:di(a)}),(0,G.jsxs)(`span`,{className:`ml-auto text-[10px] text-[var(--color-fg-4)]`,children:[t.length,` `,t.length===1?`action`:`actions`]})]}),(0,G.jsxs)(`div`,{className:`relative pl-4`,children:[(0,G.jsx)(`div`,{className:`absolute left-[7px] top-0 bottom-0 w-px`,style:{background:`${s}33`}}),(0,G.jsx)(`div`,{className:`space-y-1.5`,children:c.map(e=>{let t=e.audit_id??`${e.ts_ms}:${e.tool}`,i=t===n,a=Xa[e.decision]??`#6b7280`,o=e.input_tokens??0,s=e.output_tokens??0,c=o>0||s>0;return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`span`,{className:`absolute -left-[9px] top-1/2 -translate-y-1/2 w-[6px] h-[6px] rounded-full border border-[var(--color-surface-1)]`,style:{background:a}}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(i?null:t),className:`w-full text-left flex items-center gap-2 px-2.5 py-1.5 rounded-sm border text-[11.5px] transition-colors ${i?`border-sky-500/50 bg-sky-500/5 text-[var(--color-fg-1)]`:`border-[var(--color-line-1)] bg-[var(--color-surface-1)] text-[var(--color-fg-2)] hover:bg-white/3 hover:border-[var(--color-line-2)]`}`,children:[(0,G.jsx)(`span`,{className:`flex-1 font-medium truncate text-[var(--color-fg-1)]`,title:e.tool,children:ui(e.tool)}),(0,G.jsxs)(`span`,{className:`shrink-0 flex items-center gap-2 text-[9px] text-[var(--color-fg-4)]`,children:[c&&(0,G.jsxs)(`span`,{className:`font-mono`,title:`Input: ${o} tokens · Output: ${s} tokens`,children:[`↓`,X(o),` `,`↑`,X(s)]}),e.duration_ns>0&&(0,G.jsx)(`span`,{children:pd(e.duration_ns)}),(0,G.jsx)(`span`,{className:`px-1.5 py-px rounded text-[9px] font-semibold tracking-wide`,style:{color:a,background:`${a}22`},children:e.decision===`allow`?`Allowed`:e.decision===`block`?`Blocked`:e.decision===`ask`?`Held`:e.decision===`force`?`Forced`:e.decision===`log`?`Logged`:e.decision}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:fd(e.ts_ms)})]})]})]},t)})})]})]},e)})})}function hd(e){let{playback:t,bursts:n,rangeStart:r,rangeEnd:i,loading:a,onPlayhead:o,onLive:s,onPause:c,onResume:l,on24h:u}=e,d=(0,_.useRef)(null),f=(0,_.useRef)(!1),p=Math.max(1,i-r),m=(t.playhead_ms-r)/p*100,h=Math.max(0,Math.min(100,m)),g=(0,_.useMemo)(()=>{let e=[];for(let t=0;t<200;t++)e.push({allow:0,block:0,ask:0,other:0});for(let t of n){let n=t.ts_ms;if(n<r||n>i)continue;let a=e[Math.floor((n-r)/p*199)];t.decision===`allow`?a.allow++:t.decision===`block`||t.decision===`force`?a.block++:t.decision===`ask`?a.ask++:a.other++}return e},[n,r,i,p]),v=(0,_.useCallback)(e=>{let t=d.current;if(!t)return;let n=t.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e-n.left)/n.width));if(i>=.98){s();return}o(r+i*p)},[r,p,o,s]);(0,_.useEffect)(()=>{let e=e=>{f.current&&v(e.clientX)},t=()=>{f.current=!1};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[v]);let y=t.mode===`live`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-mono uppercase tracking-wider`,children:[(0,G.jsx)(`button`,{onClick:()=>y?c():l(),className:`px-2.5 py-1 rounded-sm border transition-colors cursor-pointer ${y?`border-emerald-500/40 text-emerald-300 hover:bg-emerald-500/10`:`border-amber-500/40 text-amber-300 hover:bg-amber-500/10`}`,title:y?`Pause the live stream`:`Resume updates at this playhead`,children:y?`⏸ pause`:`▶ resume`}),(0,G.jsx)(`button`,{onClick:s,disabled:y,className:`px-2.5 py-1 rounded-sm border transition-colors cursor-pointer ${y?`border-[var(--color-line-1)] text-[var(--color-fg-4)] opacity-50`:`border-sky-500/40 text-sky-300 hover:bg-sky-500/10`}`,title:`Jump to live (now)`,children:`⏭ live`}),(0,G.jsx)(`button`,{onClick:u,className:`px-2.5 py-1 rounded-sm border border-violet-500/40 text-violet-300 hover:bg-violet-500/10 transition-colors cursor-pointer`,title:`Expand to last 24h — window covers now−24h through now. Backfills audit_log so the scrubber shows all recent evals.`,children:`◉ 24h`}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`mode`}),(0,G.jsx)(`span`,{className:y?`text-emerald-300`:t.mode===`paused`?`text-amber-300`:`text-violet-300`,children:t.mode}),a&&(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] animate-pulse`,children:`· backfilling`}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`· t=`,gd(t.playhead_ms)]})]}),(0,G.jsxs)(`div`,{ref:d,className:`relative h-10 w-full rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] cursor-pointer overflow-hidden select-none`,onPointerDown:e=>{f.current=!0,e.target.setPointerCapture?.(e.pointerId),v(e.clientX)},children:[(0,G.jsx)(`svg`,{viewBox:`0 0 200 40`,preserveAspectRatio:`none`,className:`absolute inset-0 w-full h-full`,"aria-hidden":!0,children:g.map((e,t)=>{let n=e.allow+e.block+e.ask+e.other;if(n===0)return null;let r=Math.min(32,n*3),i=e.block>0?Xa.block:e.ask>0?Xa.ask:Xa.allow;return(0,G.jsx)(`rect`,{x:t,y:40-r,width:.9,height:r,fill:i,opacity:.7},t)})}),(0,G.jsx)(`div`,{className:`absolute top-0 bottom-0 w-px bg-sky-300 pointer-events-none`,style:{left:`${h}%`},children:(0,G.jsx)(`div`,{className:`absolute -top-0.5 -translate-x-1/2 w-2 h-2 rotate-45 bg-sky-300`})}),y&&(0,G.jsx)(`div`,{className:`absolute top-0 right-0 bottom-0 w-[2px] bg-emerald-400 animate-pulse pointer-events-none`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] font-mono text-[var(--color-fg-4)]`,children:[(0,G.jsx)(`span`,{children:_d(r)}),(0,G.jsxs)(`span`,{className:`uppercase tracking-wider`,children:[vd(t.window_ms),` window`]}),(0,G.jsx)(`span`,{children:_d(i)})]})]})}function gd(e){let t=Date.now()-e;if(Math.abs(t)<1500)return`live`;let n=Math.round(t/1e3);if(n<60)return`−${n}s`;let r=Math.floor(n/60);return r<60?`−${r}m${n%60}s`:`−${Math.floor(r/60)}h${r%60}m`}function _d(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function vd(e){return e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${Math.round(e/36e5)}h`}var $=320,yd=8,bd=12;function xd(e){let{burst:t,anchor:n,onClose:r}=e,i=(0,_.useRef)(null),[a,o]=(0,_.useState)({left:-9999,top:-9999});if((0,_.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&r()},n=e=>{i.current&&!i.current.contains(e.target)&&r()};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,n),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,n)}},[t,r]),(0,_.useLayoutEffect)(()=>{if(!t||!n||!i.current)return;let e=i.current.getBoundingClientRect(),r=window.innerWidth,a=window.innerHeight,s=e.height>0?e.height:280,c=n.x+bd+$>r?n.x-bd-$:n.x+bd,l=n.y+bd+s>a?n.y-bd-s:n.y+bd;c=Math.min(Math.max(yd,c),r-$-yd),l=Math.min(Math.max(yd,l),a-s-yd),o({left:c,top:l})},[t,n]),(0,_.useEffect)(()=>{o({left:-9999,top:-9999})},[t]),!t||!n)return null;let s=Xa[t.decision]??`#6b7280`,c=t.duration_ns/1e6,l=Date.now()-t.ts_ms;return(0,G.jsxs)(`div`,{ref:i,className:`fixed z-50 flex flex-col gap-3 text-[12px] font-mono rounded-md border border-[var(--color-line-1)] bg-[var(--color-surface-1)] shadow-2xl p-4`,style:{left:a.left,top:a.top,width:$,maxHeight:`80vh`,overflowY:`auto`},children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`overline text-[var(--color-fg-3)]`,children:`node · inspect`}),(0,G.jsx)(`button`,{onClick:r,className:`text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] cursor-pointer`,title:`Close inspector`,children:`✕`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{background:s},"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`uppercase tracking-wider`,style:{color:s},children:t.decision}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:t.tool})]}),(0,G.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[11px]`,children:[(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`rule`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-all`,children:t.rule_id??`—`}),(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`client`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.client}),(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`agent`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.agent_id?(0,G.jsx)(`span`,{className:`chip text-violet-300 border-violet-500/30`,children:t.agent_id}):(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`—`})}),(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`eval duration`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:c<1?`${(c*1e3).toFixed(0)}µs`:`${c.toFixed(2)}ms`}),t.complete_duration_ms!=null&&t.complete_duration_ms>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`tool duration`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:t.complete_duration_ms>=1e3?`${(t.complete_duration_ms/1e3).toFixed(2)}s`:`${t.complete_duration_ms.toFixed(0)}ms`})]}),t.message&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`reason`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-words`,children:t.message})]}),(t.input_tokens!=null||t.output_tokens!=null)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`tokens`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:wd(t.input_tokens,t.output_tokens)})]}),(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`age`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:Sd(l)}),(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)]`,children:`timestamp`}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)]`,children:new Date(t.ts_ms).toLocaleString()})]}),t.input_preview&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:`input`}),(0,G.jsx)(`pre`,{className:`bg-[var(--color-surface-0)] border border-[var(--color-line-0)] rounded-sm p-2 text-[10px] text-[var(--color-fg-2)] whitespace-pre-wrap break-all max-h-48 overflow-y-auto`,children:t.input_preview})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[t.audit_id&&(0,G.jsx)(`a`,{href:`/audit?id=${encodeURIComponent(t.audit_id)}`,className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)] hover:text-[var(--color-fg-1)]`,title:`Open full audit record`,children:`audit ↗`}),t.rule_id&&(0,G.jsx)(`a`,{href:`/rules#${encodeURIComponent(t.rule_id)}`,className:`chip text-[var(--color-fg-3)] border-[var(--color-line-1)] hover:text-[var(--color-fg-1)]`,title:`Jump to rule`,children:`rule ↗`})]})]})}function Sd(e){if(e<1500)return`just now`;let t=Math.floor(e/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m${t%60}s ago`:`${Math.floor(n/60)}h${n%60}m ago`}function Cd(e){return e<1e3?String(e):e<1e4?`${(e/1e3).toFixed(1)}K`:e<1e6?`${Math.round(e/1e3)}K`:`${(e/1e6).toFixed(1)}M`}function wd(e,t){let n=[];return e!=null&&n.push(`${Cd(e)} in`),t!=null&&n.push(`${Cd(t)} out`),n.length>0?n.join(` · `):`—`}function Td(e){let t=new Map;for(let n of e){let e=`${n.client}:${n.agent_id??`solo`}`,r=t.get(e);r?(r.count+=1,n.ts_ms>r.newest_ts_ms&&(r.newest_ts_ms=n.ts_ms)):t.set(e,{client:n.client,agent_id:n.agent_id??`solo`,count:1,newest_ts_ms:n.ts_ms})}return Array.from(t.values()).sort((e,t)=>t.newest_ts_ms===e.newest_ts_ms?t.count-e.count:t.newest_ts_ms-e.newest_ts_ms)}function Ed(e){let{bursts:t,allBursts:n}=e,r=n??t,{toolCounts:i,decisionCounts:a,ruleCounts:o,unmatchedCount:s}=(0,_.useMemo)(()=>{let e=new Map,n=new Map,r=new Map,i=0;for(let a of t)if(e.set(a.tool,(e.get(a.tool)??0)+1),n.set(a.decision,(n.get(a.decision)??0)+1),a.rule_id){let e=r.get(a.rule_id);e?(e.count+=1,e.decisions.add(a.decision)):r.set(a.rule_id,{count:1,decisions:new Set([a.decision])})}else i+=1;return{toolCounts:Array.from(e.entries()).sort((e,t)=>t[1]-e[1]),decisionCounts:Array.from(n.entries()),ruleCounts:Array.from(r.entries()).map(([e,t])=>({id:e,count:t.count,decisions:t.decisions})).sort((e,t)=>t.count-e.count),unmatchedCount:i}},[t]),c=(0,_.useMemo)(()=>Td(r),[r]),l=i[0]?.[1]??0,u=c[0]?.count??0,d=o[0]?.count??0,f=e=>{for(let t of[`block`,`ask`,`force`,`log`,`allow`,`shadow`])if(e.has(t))return Xa[t];return`#6b7280`};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 text-[11px] font-mono`,children:[(0,G.jsx)(`div`,{className:`rounded-sm border border-[var(--color-line-0)] bg-[var(--color-surface-0)] p-2 text-[10px] text-[var(--color-fg-3)] leading-relaxed`,children:`Each dot is one tool call by an AI agent. Color encodes the ssg rule decision; lines link calls from the same agent in time order.`}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`rules · `,o.length,` matched`,s>0&&(0,G.jsxs)(`span`,{className:`ml-2 text-[var(--color-fg-4)] normal-case tracking-normal`,children:[s,` unmatched`]})]}),o.length===0?(0,G.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no rules matched in window`}):(0,G.jsx)(`ul`,{className:`space-y-0.5`,children:o.slice(0,6).map(e=>{let t=d>0?e.count/d*100:0,n=f(e.decisions);return(0,G.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,title:`${e.id} — decisions: ${Array.from(e.decisions).join(`, `)}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:n},"aria-hidden":!0}),(0,G.jsx)(`a`,{href:`/rules#${encodeURIComponent(e.id)}`,className:`truncate text-[var(--color-fg-2)] hover:text-[var(--color-fg-1)]`,children:e.id}),(0,G.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full`,style:{background:n,width:`${t}%`,opacity:.6}})})]}),(0,G.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:e.count})]},e.id)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:`decisions`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[`allow`,`block`,`ask`,`log`,`force`,`shadow`].map(e=>{let t=a.find(([t])=>t===e)?.[1]??0;return(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:Xa[e]},"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-2)] uppercase tracking-wider`,children:e}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)] tabular-nums`,children:t})]},e)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`agents · `,c.length,` active`,n&&n!==t&&(0,G.jsx)(`span`,{className:`ml-2 text-[var(--color-fg-4)] normal-case tracking-normal`,children:`roster: today`})]}),c.length===0?(0,G.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no agents in window`}):(0,G.jsx)(`ul`,{className:`space-y-0.5`,children:c.slice(0,8).map(e=>{let t=u>0?e.count/u*100:0,n=`${e.client}:${e.agent_id}`,r=Date.now()-e.newest_ts_ms,i=r<5e3;return(0,G.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,title:`${n} — last eval ${Math.max(0,Math.round(r/1e3))}s ago`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[i?(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft shrink-0`,"aria-hidden":!0}):(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-[var(--color-fg-4)]/40`,"aria-hidden":!0}),(0,G.jsxs)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:[e.client,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-4)]`,children:[`:`,e.agent_id]})]}),(0,G.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full bg-violet-400/60`,style:{width:`${t}%`}})})]}),(0,G.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:e.count})]},n)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`overline text-[var(--color-fg-3)] mb-1`,children:[`tools · `,t.length,` in window`]}),i.length===0?(0,G.jsx)(`p`,{className:`text-[var(--color-fg-4)]`,children:`no tool activity`}):(0,G.jsx)(`ul`,{className:`space-y-0.5`,children:i.slice(0,8).map(([e,t])=>{let n=l>0?t/l*100:0;return(0,G.jsxs)(`li`,{className:`grid grid-cols-[1fr_auto] items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`span`,{className:`truncate text-[var(--color-fg-2)]`,children:e}),(0,G.jsx)(`div`,{className:`flex-1 h-1 bg-[var(--color-surface-1)] rounded-sm overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full bg-sky-400/60`,style:{width:`${n}%`}})})]}),(0,G.jsx)(`span`,{className:`tabular-nums text-[var(--color-fg-4)]`,children:t})]},e)})})]})]})}var Dd=[100,500,1e3,5e3,1e4,1e5];function Od(e){return e>=1e5||e>=1e3?`${e/1e3|0}k`:String(e)}function kd(e){let t=Math.floor(e/100),n=Math.floor(t/600),r=Math.floor(t%600/10),i=t%10;return`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}.${i}`}function Ad(e){let t=Math.floor(e/100);return`${Math.floor(t/10)}.${t%10}s`}function jd({className:e,onMilestone:t,onRecord:n}){let r=(0,_.useRef)(null),i=(0,_.useRef)(null),[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(0),[l,u]=(0,_.useState)(0),[d,f]=(0,_.useState)(0),[p,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(``),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(!1),S=Ee(),C=Oe(),w=De(),T=(0,_.useRef)(null),E=(0,_.useRef)(0),D=(0,_.useRef)(0),O=(0,_.useRef)(0),ee=(0,_.useRef)(0),k=(0,_.useRef)(new Set),A=(0,_.useRef)(performance.now());(0,_.useEffect)(()=>{let e=performance.now();if(st()){let t=setInterval(()=>{let t=performance.now();r.current&&(r.current.textContent=kd(t-e)),i.current&&(i.current.textContent=Ad(t-A.current))},1e3);return()=>clearInterval(t)}let[t]=yr(()=>{let t=performance.now();r.current&&(r.current.textContent=kd(t-e)),i.current&&(i.current.textContent=Ad(t-A.current))});return t},[]);let j=(0,_.useRef)(0);return(0,_.useEffect)(()=>{if(T.current===null){T.current=C,E.current=C;return}if(C<=E.current)return;let e=C-E.current;E.current=C,u(n=>{let r=n+e,i=Dd.find(e=>e>ee.current&&r>=e);return i&&(ee.current=i,g(Od(i)),x(!0),t?.(),setTimeout(()=>{g(``),x(!1)},700)),r});let r=Date.now();if(r-j.current>=1e3){j.current=r;let e=w.filter(e=>r-e.ts_ms<=6e4);f(new Set(e.map(e=>`${e.client}:${e.agent_id??`solo`}`)).size)}S?.rule_id&&k.current.add(S.rule_id),m(k.current.size),S&&(S.decision===`block`?(D.current=0,o(0),A.current=performance.now()):(D.current+=e,D.current>O.current&&(O.current=D.current,c(O.current),y(!0),n?.(),setTimeout(()=>y(!1),450)),o(D.current)))},[C,S,w,t,n]),(0,G.jsxs)(`div`,{className:W(`pointer-events-none select-none`,`flex flex-col gap-2 p-3 rounded-md`,`bg-[var(--color-bg-2,#0c0d12)]/95`,`border border-[var(--color-border-1,#1c1f26)]`,`shadow-lg shadow-black/40`,`min-w-[180px] font-mono text-[11px]`,`text-[var(--color-fg-2,#9aa1ad)]`,b&&`milestone-ring`,e),"aria-label":`Live engagement counters`,children:[(0,G.jsx)(Md,{label:`uptime`,children:(0,G.jsx)(`span`,{ref:r,className:`tabular-nums text-[var(--color-fg-0,#e6e8ed)] text-[15px] tracking-tight`,children:`00:00.0`})}),(0,G.jsx)(Md,{label:`evals`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(pr,{value:l,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`}),h&&(0,G.jsxs)(`span`,{className:`text-[10px] text-emerald-400 uppercase tracking-wide`,children:[`+`,h]})]})}),(0,G.jsx)(Md,{label:`since block`,children:(0,G.jsx)(`span`,{ref:i,className:`tabular-nums text-emerald-300 text-[15px]`,children:`0.0s`})}),(0,G.jsx)(Md,{label:`streak / best`,children:(0,G.jsxs)(`span`,{className:W(`tabular-nums text-[15px]`,v?`record-beat`:`text-[var(--color-fg-0,#e6e8ed)]`),children:[(0,G.jsx)(pr,{value:a,curve:`spring`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4,#5a6071)] mx-1`,children:`/`}),(0,G.jsx)(pr,{value:s})]})}),(0,G.jsx)(Md,{label:`agents`,children:(0,G.jsx)(pr,{value:d,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`})}),(0,G.jsx)(Md,{label:`rules`,children:(0,G.jsx)(pr,{value:p,className:`text-[var(--color-fg-0,#e6e8ed)] text-[15px]`})})]})}function Md({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`uppercase tracking-wider text-[10px] text-[var(--color-fg-4,#5a6071)]`,children:e}),t]})}var Nd=1200,Pd=3e4,Fd=3e3,Id=6,Ld=3,Rd=`graph.panelState.v1`,zd=14400*1e3;function Bd(e,t){let n=new Map;for(let t of e){let e=Ya(t),r=n.get(e);r?r.push(t):n.set(e,[t])}for(let[e,r]of n){let i=t.get(e);i&&i.length===r.length&&i[i.length-1]===r[r.length-1]&&n.set(e,i)}return n}function Vd(){if(typeof window>`u`)return new Map;try{let e=window.localStorage.getItem(Rd);if(!e)return new Map;let t=JSON.parse(e);return new Map(Object.entries(t))}catch{return new Map}}function Hd(e){if(!(typeof window>`u`))try{let t={};for(let[n,r]of e)t[n]=r;window.localStorage.setItem(Rd,JSON.stringify(t))}catch{}}function Ud(){let e=fo(),t=Oe(),n=Ee(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),s=(0,_.useCallback)((e,t)=>{i(e),o(t??null)},[]),c=Ws();(0,_.useEffect)(()=>{n&&(n.decision===`block`?c.play(`block`):n.decision===`force`&&c.play(`force`))},[t]);let l=(0,_.useCallback)(()=>c.play(`milestone`),[c]),u=(0,_.useCallback)(()=>c.play(`record`),[c]),[d,f]=(0,_.useState)(()=>{if(typeof window>`u`)return`full`;try{let e=window.localStorage.getItem(`graph.viewMode.v1`);if(e===`full`||e===`feed`||e===`stream`||e===`broadcast`)return e}catch{}return`full`});(0,_.useEffect)(()=>{if(!(typeof window>`u`))try{window.localStorage.setItem(`graph.viewMode.v1`,d)}catch{}},[d]),(0,_.useEffect)(()=>{let e=e=>e===`full`?`feed`:e===`feed`?`stream`:e===`stream`?`broadcast`:`full`,t=t=>{if(t.key===`Escape`&&d!==`full`){f(`full`);return}if(t.key===`b`||t.key===`B`){let n=t.target?.tagName;if(n===`INPUT`||n===`TEXTAREA`)return;f(e)}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[d]);let p=d===`broadcast`,m=d===`stream`,h=d===`feed`,g=m||p,v=p,y=m,[b,x]=(0,_.useState)(()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(`ssg.sfx.enabled`)===null}catch{return!1}}),S=(0,_.useCallback)(()=>{c.toggle(),x(!1)},[c]),[C,w]=(0,_.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: 767px)`).matches);(0,_.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),t=e=>w(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let[T,E]=(0,_.useState)(!1),D=(0,_.useRef)(null),O=(0,_.useCallback)(async e=>{try{await fetch(`/api/json/graph/close-sessions`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`same-origin`,body:JSON.stringify(e.length>0?{session_keys:e}:{})})}catch{}E(!1),D.current&&clearTimeout(D.current)},[]),ee=(0,_.useCallback)(e=>{if(!T){E(!0),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>E(!1),3e3);return}O(e)},[T,O]);(0,_.useEffect)(()=>()=>{D.current&&clearTimeout(D.current)},[]);let k=(0,_.useRef)(new Map),A=(0,_.useRef)(0),[j,te]=(0,_.useState)({fps:0,active:0,hitches:0}),ne=(0,_.useCallback)((e,t)=>{k.current.set(e,t),t>33&&(A.current+=1)},[]);(0,_.useEffect)(()=>{let e=setInterval(()=>{let e=k.current,t=A.current;if(A.current=0,e.size===0){te(e=>e.active===0?e:{fps:0,active:0,hitches:0});return}let n=0;for(let t of e.values())n+=t;let r=n/e.size,i=r>0?Math.max(1,Math.round(1e3/r)):0;te(n=>n.fps===i&&n.active===e.size&&n.hitches===t?n:{fps:i,active:e.size,hitches:t})},1e3);return()=>clearInterval(e)},[]);let{bursts:re,playback:M,oldest_known_ms:N,newest_known_ms:ie,loading_backfill:ae}=e.snapshot,oe=(0,_.useRef)(new Map),P=(0,_.useMemo)(()=>{let e=Bd(re,oe.current);return oe.current=e,e},[re]),[F,I]=(0,_.useState)(()=>Vd()),[se,L]=(0,_.useState)(null);(0,_.useEffect)(()=>{Hd(F)},[F]),(0,_.useEffect)(()=>{let e=Date.now(),t=!1,n=new Map(F);for(let r of P.keys())n.has(r)||(n.set(r,{pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:e}),t=!0);for(let[r,i]of n)P.has(r)||i.pinned||e-i.firstSeenAt<zd||(n.delete(r),t=!0);t&&I(n)},[P,F]);let ce=(0,_.useRef)(new Map),le=(0,_.useRef)(new Set),ue=(0,_.useRef)(new Map),[,de]=(0,_.useState)(0);(0,_.useEffect)(()=>{let e=performance.now(),t=ce.current,n=le.current,r=ue.current,i=new Set;for(let[e,n]of P)i.add(e),r.set(e,n.slice()),t.delete(e);for(let a of n)if(!i.has(a)&&!t.has(a)){let n=r.get(a)??[],i=n[n.length-1]?.ts_ms??0;t.set(a,{bursts:n,diedAt:e,newestTs:i})}for(let[n,i]of t)e-i.diedAt>=Nd&&(t.delete(n),r.delete(n));if(le.current=i,t.size>0){let n=1/0;for(let e of t.values())n=Math.min(n,e.diedAt+Nd);let r=Math.max(16,n-e+16),i=setTimeout(()=>de(e=>e+1),r);return()=>clearTimeout(i)}},[P]);let fe=(0,_.useCallback)(e=>{I(t=>{let n=new Map(t),r=n.get(e)??{pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:Date.now()};return n.set(e,{...r,pinned:!r.pinned,pinnedAt:r.pinned?0:Date.now()}),n})},[]),pe=(0,_.useCallback)(e=>{I(t=>{let n=new Map(t),r=n.get(e)??{pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:Date.now()};return n.set(e,{...r,minimized:!r.minimized}),n})},[]),me=(0,_.useCallback)(e=>{L(t=>t===e?null:e)},[]);(0,_.useEffect)(()=>{if(!se)return;let e=e=>{e.key===`Escape`&&L(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[se]);let R=(0,_.useMemo)(()=>{let e={pinned:!1,pinnedAt:0,minimized:!1,firstSeenAt:Date.now()},t=[];for(let[n,r]of P){let i=r[r.length-1]?.ts_ms??0;t.push({key:n,bursts:r,newestTs:i,fadingOutAt:null,state:F.get(n)??e})}for(let[n,r]of ce.current)P.has(n)||t.push({key:n,bursts:r.bursts,newestTs:r.newestTs,fadingOutAt:r.diedAt,state:F.get(n)??e});return t.sort((e,t)=>e.state.pinned===t.state.pinned?e.state.pinned&&t.state.pinned?e.state.pinnedAt-t.state.pinnedAt:e.state.firstSeenAt-t.state.firstSeenAt:e.state.pinned?-1:1),t},[P,F]),he=(0,_.useMemo)(()=>{if(!r)return null;for(let e of re)if((e.audit_id??`${e.ts_ms}:${e.tool}`)===r||r.startsWith(`${e.ts_ms}:${e.tool}`))return e;return null},[re,r]),[ge,_e]=(0,_.useState)(null),ve=(0,_.useRef)(null),ye=(0,_.useMemo)(()=>{if(R.length===0)return ve.current=null,null;if(ge!=null&&R.some(e=>e.key===ge))return ve.current=ge,ge;let e=R.filter(e=>e.state.pinned);if(e.length>0)return e.sort((e,t)=>t.state.pinnedAt-e.state.pinnedAt),ve.current=e[0].key,e[0].key;let t=R[0];for(let e of R)e.newestTs>t.newestTs&&(t=e);let n=ve.current;if(n!=null&&n!==t.key){let e=R.find(e=>e.key===n);if(e&&Date.now()-e.newestTs<Fd)return n}return ve.current=t.key,t.key},[R,ge]);(0,_.useEffect)(()=>{ge!=null&&(R.some(e=>e.key===ge)||_e(null))},[ge,R]),(0,_.useEffect)(()=>{_e(null)},[d]);let z=(0,_.useMemo)(()=>{if(R.length===0)return{hero:null,grid:[],rail:[],overflow:[]};if(d===`full`||d===`feed`)return{hero:null,grid:R.slice(0,Id),rail:R.slice(Id),overflow:[]};let e=R.find(e=>e.key===ye)??R[R.length-1],t=R.filter(t=>t.key!==e.key);return d===`broadcast`?{hero:e,grid:[],rail:[],overflow:t}:{hero:e,grid:[],rail:t.slice(0,Ld),overflow:t.slice(Ld)}},[R,d,ye]),be=(0,_.useCallback)(e=>{_e(e)},[]),xe=(0,_.useCallback)(()=>{_e(null)},[]),Se=(0,_.useMemo)(()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Map,a=new Map;for(let o of R){let s=o.key;e.set(s,()=>fe(s)),t.set(s,()=>pe(s)),n.set(s,()=>me(s)),r.set(s,()=>void O([s])),i.set(s,e=>ne(s,e)),a.set(s,()=>be(s))}return{onTogglePin:e,onToggleMinimize:t,onToggleFullscreen:n,onClose:r,onFrameTime:i,onPromote:a}},[R.map(e=>e.key).join(`,`),fe,pe,me,O,ne,be]);(0,_.useEffect)(()=>{let e=new Set(R.map(e=>e.key)),t=k.current;for(let n of Array.from(t.keys()))e.has(n)||t.delete(n)},[R]);let Ce=(0,_.useMemo)(()=>{let e=n?.counters,t=e?.total??0,r=(e?.block??0)+(e?.force??0),i=0;if(re.length>0){let e=0,t=re.slice(-100);for(let n of t)e+=n.duration_ns;i=e/t.length/1e6}return{evals:t,blocks:r,avgMs:i,agents:R.length}},[n,re,R.length]),we=Math.min(N,M.playhead_ms-M.window_ms),Te=Math.max(ie,M.playhead_ms),De=z.grid.length,ke=C||De<=1?1:De<=4?2:3,Ae=Math.max(1,Math.ceil(Math.max(1,De)/ke)),B=De<=1||C?360:180,je=se?R.find(e=>e.key===se):null,Me=e=>e>=1e4?`${Math.round(e/1e3)}k`:e.toLocaleString();return(0,G.jsxs)(`div`,{className:`grid gap-3 md:h-[calc(100dvh-4.5rem)] md:min-h-[560px] ${g?`grid-rows-[auto_minmax(0,1fr)]`:`grid-rows-[auto_minmax(0,1fr)_auto]`} ${p?`bg-black`:``}`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between flex-wrap gap-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(`h1`,{className:`text-sm font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`graph intelligence`}),!p&&(0,G.jsx)(`span`,{className:`chip text-sky-300 border-sky-500/30`,children:`real-time tool-use`}),M.mode===`live`?(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-emerald-300`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),`streaming`]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-amber-300`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-amber-400`}),M.mode]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-x-3 gap-y-1 flex-wrap text-[11px] font-mono text-[var(--color-fg-3)] pl-3 border-l border-[var(--color-line-1)]`,children:[(0,G.jsxs)(`span`,{title:`Total evaluations since daemon start`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`↑`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Me(Ce.evals)}),` `,(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:`evals`})]}),(0,G.jsxs)(`span`,{title:`Block + force decisions — dangerous tool calls intercepted by SSG rules`,children:[(0,G.jsx)(`span`,{className:`text-rose-400`,children:`⛔`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Me(Ce.blocks)}),` `,(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:`blocks`})]}),(0,G.jsxs)(`span`,{className:`hidden md:inline`,title:`Mean eval latency over the last 100 bursts`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`⏱`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Ce.avgMs<1?`${(Ce.avgMs*1e3).toFixed(0)}µs`:`${Ce.avgMs.toFixed(1)}ms`})]}),(0,G.jsxs)(`span`,{title:`Concurrent agent sessions in this window`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`⌥`}),` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-1)]`,children:Ce.agents}),` `,(0,G.jsxs)(`span`,{className:`hidden sm:inline`,children:[`agent`,Ce.agents===1?``:`s`]})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!p&&(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:[re.length,`n · window `,Math.round(M.window_ms/1e3),`s`]}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)] tabular-nums`,title:`Average RAF interval across ${j.active} canvas${j.active===1?``:`es`}${j.hitches>0?` · ${j.hitches} hitch${j.hitches===1?``:`es`} (>33ms frames)`:``}`,children:[j.active===0?`—`:`${j.fps}fps${j.hitches>0?` (${j.hitches}h)`:``}`,` · `,j.active,`/`,R.length]}),(0,G.jsx)(`div`,{role:`group`,"aria-label":`Graph view mode`,className:`inline-flex items-stretch rounded border border-[var(--color-line-1)] overflow-hidden text-[10px] font-mono uppercase tracking-wider`,title:`View mode — B cycles, Esc returns to full`,children:[`full`,`feed`,`stream`,`broadcast`].map(e=>{let t=d===e,n=e===`broadcast`?`cast`:e,r=e===`full`?`Full dashboard — sidebar, timeline, all controls`:e===`feed`?`Feed mode — vertical timeline of tool calls for non-technical users`:e===`stream`?`Stream mode — spotlight layout for Twitch/YouTube viewers`:`Broadcast mode — pure canvas for OBS scenes (Esc to exit)`;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>f(e),"aria-pressed":t,title:r,className:`px-2 py-0.5 transition-colors cursor-pointer ${t?e===`broadcast`?`bg-amber-500/15 text-amber-300`:e===`stream`?`bg-sky-500/15 text-sky-300`:e===`feed`?`bg-emerald-500/15 text-emerald-300`:`bg-[var(--color-fg-4)]/10 text-[var(--color-fg-1)]`:`text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)] hover:bg-white/5`}`,children:n},e)})}),(0,G.jsx)(`button`,{type:`button`,onClick:S,className:`chip cursor-pointer transition-colors ${b&&!c.enabled?`border-amber-500/60 text-amber-300 animate-pulse`:`hover:border-sky-500/50 hover:text-sky-300`}`,title:c.enabled?`Mute stream sounds`:`Enable stream sounds`,children:c.enabled?`SFX ON`:b?`🔊 enable cues`:`SFX OFF`}),!p&&R.length>0&&(0,G.jsx)(`div`,{"aria-live":`polite`,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":`Clear all visible graph sessions`,onClick:()=>ee(R.filter(e=>!e.fadingOutAt).map(e=>e.key)),className:`chip cursor-pointer transition-colors ${T?`border-rose-500/60 text-rose-300`:`hover:border-rose-500/40 hover:text-rose-300`}`,title:`Close all active sessions on the graph — equivalent to /clear but reflects on the graph`,children:T?`confirm clear ${R.filter(e=>!e.fadingOutAt).length}`:`clear`})})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 ${v?``:y?`lg:grid-cols-[1fr_240px]`:`lg:grid-cols-[1fr_300px]`} gap-3 min-h-0 md:overflow-hidden`,children:[(0,G.jsx)(`div`,{className:`flex flex-col gap-3 min-h-0 min-w-0`,children:h?(0,G.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] overflow-hidden`,children:(0,G.jsx)(md,{bursts:re,selectedId:r,onSelect:s})}):R.length===0?(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] text-center px-4`,style:{minHeight:240},children:[(0,G.jsx)(`p`,{className:`overline mb-2 text-[var(--color-fg-3)]`,children:`graph · idle`}),(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] max-w-[280px]`,children:`No active sessions in the current window. Each session will render as its own tree as bursts arrive.`})]}):(0,G.jsxs)(G.Fragment,{children:[z.hero&&(se==null||se===z.hero.key)&&(0,G.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col gap-2`,children:[ge!=null&&(0,G.jsx)(`button`,{type:`button`,onClick:xe,className:`self-end chip text-amber-300 border-amber-500/40 hover:border-amber-400 cursor-pointer text-[10px]`,title:`Release manual spotlight — return to auto-follow`,children:`spotlight: locked · release ↺`}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,G.jsx)(ud,{sessionKey:z.hero.key,bursts:z.hero.bursts,paused:M.mode!==`live`||z.hero.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:z.hero.fadingOutAt!=null||M.playhead_ms-z.hero.newestTs>Pd,isFadingOut:z.hero.fadingOutAt!=null,minHeight:0,pinned:z.hero.state.pinned,minimized:z.hero.state.minimized,isFullscreen:!1,viewMode:d,activePanelCount:1,onTogglePin:Se.onTogglePin.get(z.hero.key),onToggleMinimize:Se.onToggleMinimize.get(z.hero.key),onToggleFullscreen:Se.onToggleFullscreen.get(z.hero.key),onClose:Se.onClose.get(z.hero.key),onFrameTime:Se.onFrameTime.get(z.hero.key)},z.hero.key)})]}),z.grid.length>0&&(0,G.jsx)(`div`,{className:`flex-1 grid gap-3 min-h-0 min-w-0`,style:{gridTemplateColumns:`repeat(${ke}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${Ae}, minmax(180px, 1fr))`},children:z.grid.map(e=>{let n=e.fadingOutAt!=null||M.playhead_ms-e.newestTs>Pd;return se!=null&&se!==e.key?null:(0,G.jsx)(ud,{sessionKey:e.key,bursts:e.bursts,paused:M.mode!==`live`||e.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:n,isFadingOut:e.fadingOutAt!=null,minHeight:B,pinned:e.state.pinned,minimized:e.state.minimized,isFullscreen:!1,viewMode:d,activePanelCount:z.grid.length,onTogglePin:Se.onTogglePin.get(e.key),onToggleMinimize:Se.onToggleMinimize.get(e.key),onToggleFullscreen:Se.onToggleFullscreen.get(e.key),onClose:Se.onClose.get(e.key),onFrameTime:Se.onFrameTime.get(e.key)},e.key)})}),z.rail.length>0&&(0,G.jsxs)(`div`,{className:`shrink-0 flex flex-col gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between text-[10px] font-mono text-[var(--color-fg-4)] uppercase tracking-wider`,children:[(0,G.jsxs)(`span`,{children:[d===`full`?`overflow rail`:`spotlight rail`,` · `,z.rail.length,` session`,z.rail.length===1?``:`s`]}),z.overflow.length>0&&(0,G.jsxs)(`span`,{title:z.overflow.map(e=>e.key).join(`
24
+ `),children:[`+`,z.overflow.length,` more`]})]}),(0,G.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(${Math.min(z.rail.length,4)}, minmax(0, 1fr))`,gridAutoRows:`110px`},children:z.rail.map(e=>{let n=e.fadingOutAt!=null||M.playhead_ms-e.newestTs>Pd;return se!=null&&se!==e.key?null:(0,G.jsx)(ud,{sessionKey:e.key,bursts:e.bursts,paused:M.mode!==`live`||e.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:n,isFadingOut:e.fadingOutAt!=null,minHeight:110,pinned:e.state.pinned,minimized:e.state.minimized,isFullscreen:!1,viewMode:d,thumbnail:!0,onPromote:Se.onPromote.get(e.key),activePanelCount:z.rail.length+1,onTogglePin:Se.onTogglePin.get(e.key),onToggleMinimize:Se.onToggleMinimize.get(e.key),onToggleFullscreen:Se.onToggleFullscreen.get(e.key),onClose:Se.onClose.get(e.key),onFrameTime:Se.onFrameTime.get(e.key)},e.key)})})]}),d===`broadcast`&&z.overflow.length>0&&(0,G.jsxs)(`div`,{className:`shrink-0 self-end pointer-events-none chip text-[var(--color-fg-3)] border-[var(--color-line-1)]`,children:[`+`,z.overflow.length,` more session`,z.overflow.length===1?``:`s`,` off-screen`]})]})}),!v&&(0,G.jsxs)(`aside`,{className:`flex flex-col gap-2 min-w-0 min-h-0 overflow-y-auto`,children:[(0,G.jsx)(jd,{onMilestone:l,onRecord:u}),!y&&(0,G.jsx)(`section`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:(0,G.jsx)(Ed,{bursts:re,allBursts:e.allBursts})}),(0,G.jsx)(xd,{burst:he,anchor:a,onClose:()=>{i(null),o(null)}})]})]}),!g&&(0,G.jsx)(`section`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:(0,G.jsx)(hd,{playback:M,bursts:re,rangeStart:we,rangeEnd:Te,loading:ae,onPlayhead:t=>e.setPlayhead(t),onLive:()=>e.jumpToLive(),onPause:()=>e.setMode(`paused`),onResume:()=>e.setMode(`scrubbing`),on24h:()=>e.jumpTo24h()})}),p&&(0,G.jsxs)(`div`,{className:`pointer-events-none fixed bottom-3 right-4 flex flex-col items-end gap-1 z-30`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-mono uppercase tracking-[0.18em] text-[var(--color-fg-3)]`,children:`sigmashake gov`}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`broadcast mode · press B or Esc to exit`})]}),je&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/90 backdrop-blur-sm flex flex-col p-6`,children:(0,G.jsx)(ud,{sessionKey:je.key,bursts:je.bursts,paused:M.mode!==`live`||je.fadingOutAt!=null,selectedId:r,onSelect:s,burstSeq:t,isStale:je.fadingOutAt!=null||M.playhead_ms-je.newestTs>Pd,isFadingOut:!1,minHeight:0,pinned:je.state.pinned,minimized:!1,isFullscreen:!0,viewMode:d,onTogglePin:()=>fe(je.key),onToggleMinimize:()=>pe(je.key),onToggleFullscreen:()=>me(je.key)},`fs-${je.key}`)})]})}var Wd=[{id:`rca`,label:`rca`,hint:`pre-computed root cause`},{id:`timeline`,label:`timeline`,hint:`recent frames across traces`},{id:`watch`,label:`watch`,hint:`subscribe to any ssg:// URI`},{id:`state`,label:`state`,hint:`daemon runtime snapshot`},{id:`metrics`,label:`metrics`,hint:`latency + counters`}];function Gd(){let[e,t]=(0,_.useState)(`rca`);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 min-h-[70vh]`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`h1`,{className:`text-sm font-mono uppercase tracking-wider text-[var(--color-fg-1)]`,children:`ai-native debugger`}),(0,G.jsx)(`span`,{className:`chip text-sky-300 border-sky-500/30`,children:`ssg:// unified resolver`}),(0,G.jsx)(Kd,{})]}),(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)]`,children:`one surface · cli · mcp · dashboard`})]}),(0,G.jsx)(`nav`,{className:`flex items-center gap-1 border-b border-[var(--color-line-1)]`,children:Wd.map(n=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(n.id),title:n.hint,className:`px-3 py-1.5 text-[11px] font-mono uppercase tracking-wider border-b-2 transition-colors `+(e===n.id?`border-[var(--color-brand)] text-[var(--color-fg-1)]`:`border-transparent text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)]`),children:n.label},n.id))}),(0,G.jsxs)(`section`,{className:`flex-1 min-h-0`,children:[e===`rca`&&(0,G.jsx)(qd,{}),e===`timeline`&&(0,G.jsx)(Qd,{}),e===`watch`&&(0,G.jsx)(sf,{}),e===`state`&&(0,G.jsx)(cf,{uri:`ssg://daemon/state`}),e===`metrics`&&(0,G.jsx)(cf,{uri:`ssg://daemon/metrics`})]})]})}function Kd(){let e=Ae([`debug-frame`])[`debug-frame`]??0;return(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-mono uppercase tracking-wider text-emerald-300`,title:`${e} debug-frame bursts received`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-emerald-400 pulse-soft`}),`live · `,e]})}function qd(){let e=Ae([`debug-frame`,`activity-updated`]),{data:t,loading:n,error:r,refetch:i}=B(`/api/json/debug?uri=ssg%3A%2F%2Frca%2Fcurrent`,[e[`debug-frame`],e[`activity-updated`]]),a=t?.data?.pack??null;return(0,G.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-[1fr_340px] gap-4`,children:[(0,G.jsxs)(`article`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-4 space-y-3`,children:[n&&!t&&(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`loading RCA pack…`}),r&&(0,G.jsxs)(`p`,{className:`text-sm text-rose-300`,children:[`rca fetch error: `,r]}),!n&&!a&&(0,G.jsxs)(`div`,{className:`text-sm text-[var(--color-fg-3)] space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-mono`,children:`no current RCA pack`}),(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)]`,children:`Packs are composed automatically when an eval errors, an ssqa finding arrives, or a daemon-level error fires. Nothing to diagnose yet — you're green.`})]}),a&&(0,G.jsx)(Yd,{pack:a})]}),(0,G.jsxs)(`aside`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 text-[11px] font-mono text-[var(--color-fg-4)] space-y-2`,children:[(0,G.jsx)(`p`,{className:`uppercase tracking-wider text-[var(--color-fg-2)]`,children:`how claude sees this`}),(0,G.jsxs)(`pre`,{className:`text-[10px] whitespace-pre-wrap leading-snug`,children:[`ssg debug rca --current --json`,`
25
25
  `,`# or via MCP:`,`
26
- `,`ssg_debug_rca(`,`{`,`auto_current:true`,`}`,`)`]}),(0,G.jsx)(`button`,{type:`button`,onClick:i,className:`w-full mt-2 px-2 py-1 border border-[var(--color-line-1)] rounded-sm hover:bg-[var(--color-surface-2)]`,children:`refresh`}),t?.snapshot_hash&&(0,G.jsxs)(`p`,{className:`text-[10px] opacity-60`,children:[`hash `,t.snapshot_hash.slice(0,12),`…`]})]})]})}function Jd(e){return e===`critical`?`text-rose-400 border-rose-500/40`:e===`high`?`text-amber-300 border-amber-500/40`:e===`medium`?`text-sky-300 border-sky-500/40`:`text-[var(--color-fg-3)] border-[var(--color-line-1)]`}function Yd({pack:e}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`header`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)]`,children:[`rca pack · `,new Date(e.ts_ms).toLocaleTimeString()]}),(0,G.jsx)(`h2`,{className:`text-[15px] font-medium text-[var(--color-fg-1)] mt-1`,children:e.summary}),e.trace_id&&(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] mt-1`,children:[`trace_id · `,e.trace_id]})]}),(0,G.jsx)(`span`,{className:`chip uppercase text-[10px] tracking-wider `+Jd(e.severity),children:e.severity})]}),e.hypothesis&&e.hypothesis.length>0&&(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`hypothesis`}),(0,G.jsx)(`ol`,{className:`space-y-2`,children:e.hypothesis.map((e,t)=>(0,G.jsxs)(`li`,{className:`p-2 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`p`,{className:`text-[13px] text-[var(--color-fg-1)]`,children:e.cause}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`conf `,(e.confidence*100).toFixed(0),`%`]})]}),e.evidence.length>0&&(0,G.jsx)(`ul`,{className:`mt-1 pl-3 text-[11px] text-[var(--color-fg-3)] list-disc list-inside space-y-0.5`,children:e.evidence.map((e,t)=>(0,G.jsx)(`li`,{children:e},t))})]},t))})]}),e.suggested_next_actions&&e.suggested_next_actions.length>0&&(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`suggested next actions`}),(0,G.jsx)(`ul`,{className:`space-y-1 text-[13px] text-[var(--color-fg-2)]`,children:e.suggested_next_actions.map((e,t)=>(0,G.jsxs)(`li`,{className:`font-mono text-[12px]`,children:[`→ `,e]},t))})]}),e.state_snapshot&&e.state_snapshot.length>0&&(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`expand`}),(0,G.jsx)(`ul`,{className:`space-y-1 text-[11px] font-mono`,children:e.state_snapshot.map(e=>(0,G.jsxs)(`li`,{className:`text-[var(--color-fg-3)]`,children:[(0,G.jsx)(`code`,{className:`text-sky-300`,children:e.uri}),(0,G.jsxs)(`span`,{className:`opacity-50 ml-2`,children:[e.hash.slice(0,10),`…`]})]},e.uri))})]})]})}var Xd=[`hook-ingress`,`parse`,`match`,`ffi-call`,`decide`,`audit`,`respond`],Zd={"hook-ingress":`#6ea8ff`,parse:`#a78bfa`,match:`#60d394`,"ffi-call":`#f59e0b`,decide:`#f472b6`,audit:`#94a3b8`,respond:`#22d3ee`};function Qd(){let{data:e,loading:t,error:n}=B(`/api/json/debug?uri=ssg%3A%2F%2Fframes%2Frecent%3Flimit%3D1024`,[Ae([`debug-frame`])[`debug-frame`]]),r=e?.data?.frames??[],i=e?.data?.dropped??0,[a,o]=(0,_.useState)(null);return(0,G.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-[1fr_320px] gap-4`,children:[(0,G.jsxs)(`article`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:[`frames · `,r.length,i>0&&(0,G.jsxs)(`span`,{className:`ml-2 text-amber-300`,children:[`dropped · `,i]})]}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`ssg://frames/recent`})]}),n&&(0,G.jsxs)(`p`,{className:`text-sm text-rose-300`,children:[`timeline fetch error: `,n]}),t&&r.length===0?(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`loading…`}):r.length===0?(0,G.jsx)($d,{}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(tf,{frames:r,onSelect:o}),(0,G.jsx)(ef,{})]})]}),(0,G.jsxs)(`aside`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,G.jsx)(`p`,{className:`uppercase tracking-wider text-[var(--color-fg-2)]`,children:`frame inspector`}),a?(0,G.jsx)(nf,{frame:a}):(0,G.jsx)(`p`,{className:`opacity-60`,children:`click a bar to inspect`})]})]})}function $d(){return(0,G.jsxs)(`div`,{className:`text-[12px] text-[var(--color-fg-3)] space-y-1 py-4`,children:[(0,G.jsx)(`p`,{children:`no frames yet`}),(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)] font-mono`,children:`SSG_DEBUG_ENABLED=1 ssg daemon`}),(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)]`,children:`then fire an eval — frames stream in live.`})]})}function ef(){return(0,G.jsx)(`div`,{className:`flex flex-wrap gap-3 text-[10px] font-mono text-[var(--color-fg-4)]`,children:Xd.map(e=>(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{background:Zd[e]}}),e]},e))})}function tf({frames:e,onSelect:t}){let n=(0,_.useRef)(null),r=(0,_.useRef)([]),[i,a]=(0,_.useState)(-1),{rows:o,tMin:s,tMax:c}=(0,_.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.trace_id)??[];e.push(n),t.set(n.trace_id,e)}let n=Array.from(t.entries()).map(([e,t])=>({trace_id:e,frames:t.slice().sort((e,t)=>af(e.ts_start_ns,t.ts_start_ns))}));n.sort((e,t)=>af(e.frames[0].ts_start_ns,t.frames[0].ts_start_ns));let r=null,i=null;for(let t of e){let e=BigInt(t.ts_start_ns),n=BigInt(t.ts_end_ns);(r===null||e<r)&&(r=e),(i===null||n>i)&&(i=n)}return{rows:n,tMin:r??0n,tMax:i??1n}},[e]);(0,_.useEffect)(()=>{let e=n.current;if(!e)return;let t=window.devicePixelRatio||1,a=e.clientWidth,l=Math.max(120,o.length*22+24);e.width=a*t,e.height=l*t,e.style.height=`${l}px`;let u=e.getContext(`2d`);if(!u)return;u.setTransform(t,0,0,t,0,0),u.clearRect(0,0,a,l),u.strokeStyle=`rgba(255,255,255,0.04)`,u.lineWidth=1;for(let e=1;e<4;e++){let t=e*a/4;u.beginPath(),u.moveTo(t,0),u.lineTo(t,l),u.stroke()}let d=c>s?Number(c-s):1,f=a-110-8;u.font=`10px ui-monospace, monospace`,u.textBaseline=`middle`;let p=[];if(o.forEach((e,t)=>{let n=8+t*22;u.fillStyle=`rgba(255,255,255,0.55)`,u.fillText(e.trace_id.slice(0,10),6,n+18/2);for(let t of e.frames){let e=Number(BigInt(t.ts_start_ns)-s),r=Number(BigInt(t.ts_end_ns)-s),i=110+e/d*f,a=Math.max(2,(r-e)/d*f);u.fillStyle=Zd[t.stage]??`#888`,u.globalAlpha=t.result===`error`?1:.82,u.fillRect(i,n,a,18),u.globalAlpha=1,t.result===`error`&&(u.strokeStyle=`#f43f5e`,u.lineWidth=1.5,u.strokeRect(i+.5,n+.5,a-1,17)),p.push({x:i,y:n,w:a,h:18,frame:t})}}),r.current=p,i>=0&&i<p.length){let e=p[i];u.strokeStyle=`#fff`,u.lineWidth=1.5,u.strokeRect(e.x+.5,e.y+.5,e.w-1,e.h-1)}},[o,s,c,i]);function l(e){let t=n.current;if(!t)return-1;let i=t.getBoundingClientRect(),a=e.clientX-i.left,o=e.clientY-i.top;for(let e=r.current.length-1;e>=0;e--){let t=r.current[e];if(a>=t.x&&a<=t.x+t.w&&o>=t.y&&o<=t.y+t.h)return e}return-1}return(0,G.jsx)(`canvas`,{ref:n,className:`w-full block cursor-crosshair`,onMouseMove:e=>a(l(e)),onMouseLeave:()=>a(-1),onClick:e=>{let n=l(e);t(n>=0?r.current[n].frame:null)}})}function nf({frame:e}){let t=Number(BigInt(e.ts_end_ns)-BigInt(e.ts_start_ns)),n=t>=1e6?`${(t/1e6).toFixed(2)}ms`:t>=1e3?`${(t/1e3).toFixed(1)}µs`:`${t}ns`;return(0,G.jsxs)(`dl`,{className:`space-y-1`,children:[(0,G.jsxs)(rf,{k:`stage`,children:[(0,G.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm mr-1 align-middle`,style:{background:Zd[e.stage]??`#888`}}),e.stage]}),(0,G.jsx)(rf,{k:`tool`,children:e.tool}),(0,G.jsx)(rf,{k:`result`,children:(0,G.jsx)(`span`,{className:e.result===`error`?`text-rose-300`:e.result===`skip`?`text-[var(--color-fg-4)]`:`text-emerald-300`,children:e.result})}),(0,G.jsx)(rf,{k:`dur`,children:n}),e.rule_id&&(0,G.jsx)(rf,{k:`rule`,children:e.rule_id}),e.error&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(rf,{k:`err.type`,children:(0,G.jsx)(`span`,{className:`text-rose-300`,children:e.error.type})}),(0,G.jsx)(rf,{k:`err.msg`,children:(0,G.jsx)(`span`,{className:`text-rose-200`,children:e.error.message})})]}),e.input_preview&&(0,G.jsx)(rf,{k:`input`,children:(0,G.jsx)(`code`,{className:`text-[10px] break-all`,children:e.input_preview})}),(0,G.jsx)(rf,{k:`trace`,children:(0,G.jsx)(`code`,{className:`text-[10px]`,children:e.trace_id})}),(0,G.jsx)(rf,{k:`frame`,children:(0,G.jsx)(`code`,{className:`text-[10px]`,children:e.frame_id})})]})}function rf({k:e,children:t}){return(0,G.jsxs)(`div`,{className:`flex gap-2 text-[11px] leading-tight`,children:[(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)] w-16 shrink-0 uppercase tracking-wider`,children:e}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-all min-w-0`,children:t})]})}function af(e,t){let n=BigInt(e),r=BigInt(t);return n<r?-1:n>r?1:0}var of=[`ssg://daemon/state`,`ssg://daemon/metrics`,`ssg://audit/recent?limit=10`,`ssg://frames/recent?limit=32`,`ssg://rules/list`,`ssg://rca/current`,`ssg://native/stats`];function sf(){let[e,t]=(0,_.useState)(`ssg://daemon/state`),[n,r]=(0,_.useState)(`ssg://daemon/state`);return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:of.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>{t(e),r(e)},className:`chip text-[10px] `+(n===e?`border-[var(--color-brand)] text-[var(--color-fg-1)]`:`text-[var(--color-fg-3)]`),children:e},e))}),(0,G.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault(),r(e)},children:[(0,G.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),placeholder:`ssg://source/path?k=v`,className:`flex-1 px-3 py-1.5 text-[12px] font-mono rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] text-[var(--color-fg-1)]`}),(0,G.jsx)(`button`,{type:`submit`,className:`px-3 py-1.5 text-[11px] font-mono uppercase tracking-wider border border-[var(--color-line-1)] rounded-sm hover:bg-[var(--color-surface-2)]`,children:`resolve`})]}),(0,G.jsx)(cf,{uri:n})]})}function cf({uri:e}){let t=Ae([`debug-frame`,`activity-updated`,`counters-updated`]),{data:n,loading:r,error:i,refetch:a}=B(`/api/json/debug?uri=${encodeURIComponent(e)}`,[t[`debug-frame`],t[`activity-updated`],t[`counters-updated`],e]),o=n?JSON.stringify(n.data,null,2):``;return(0,G.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:e}),n?.snapshot_hash&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`hash `,n.snapshot_hash.slice(0,10),`…`]}),n?.stale&&(0,G.jsxs)(`span`,{className:`chip text-amber-300 border-amber-500/40 text-[10px]`,children:[`stale `,n.age_ms?`${Math.round(n.age_ms/1e3)}s`:``]})]}),(0,G.jsx)(`button`,{type:`button`,onClick:a,className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`,children:`refresh`})]}),r&&!n&&(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`resolving…`}),i&&(0,G.jsx)(`p`,{className:`text-sm text-rose-300`,children:i}),o&&(0,G.jsx)(`pre`,{className:`text-[11px] leading-snug font-mono text-[var(--color-fg-2)] overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:o})]})}function lf(e){let t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}var uf={block:`var(--color-hig-red)`,ask:`var(--color-hig-orange)`,log:`var(--color-hig-blue)`,allow:`var(--color-hig-green)`,force:`var(--color-hig-purple)`};function df(e){switch(e){case`block`:return`Blocked`;case`ask`:return`Held for review`;case`log`:return`Logged`;case`force`:return`Force-allowed`;default:return`Allowed`}}function ff({type:e}){let t={fill:`none`,stroke:`currentColor`,strokeWidth:1.6,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`};return e===`code`?(0,G.jsxs)(`svg`,{...t,width:`22`,height:`22`,children:[(0,G.jsx)(`path`,{d:`M9 7l-5 5 5 5M15 7l5 5-5 5`}),(0,G.jsx)(`path`,{d:`M14 4l-4 16`,opacity:`0.55`})]}):e===`docs`?(0,G.jsxs)(`svg`,{...t,width:`22`,height:`22`,children:[(0,G.jsx)(`path`,{d:`M5 4h9l5 5v11a1 1 0 01-1 1H5a1 1 0 01-1-1V5a1 1 0 011-1z`}),(0,G.jsx)(`path`,{d:`M14 4v5h5`}),(0,G.jsx)(`path`,{d:`M8 13h8M8 17h5`,opacity:`0.7`})]}):(0,G.jsxs)(`svg`,{...t,width:`22`,height:`22`,children:[(0,G.jsx)(`path`,{d:`M3 12a9 9 0 109-9`}),(0,G.jsx)(`path`,{d:`M12 3v9l6 3`})]})}function pf(){let{data:e}=B(`/api/json/counters`,[Ae([`counters-updated`])[`counters-updated`]]),t=e?.evals_today??0,n=e?.blocked_today??0,r=e?.asked_today??0;return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,G.jsx)(mf,{value:t,label:`evaluated`,tone:`default`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsx)(mf,{value:n,label:`blocked`,tone:`red`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsx)(mf,{value:r,label:`held for you`,tone:`orange`}),(0,G.jsx)(`span`,{className:`text-[11px] ml-auto`,style:{color:`var(--color-fg-3)`},children:`Today`})]})}function mf({value:e,label:t,tone:n}){return(0,G.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-semibold tabular-nums`,style:{color:n===`red`?`var(--color-hig-red)`:n===`orange`?`var(--color-hig-orange)`:`var(--color-fg-0)`,fontSize:`20px`,lineHeight:1,letterSpacing:`-0.018em`},children:e.toLocaleString()}),(0,G.jsx)(`span`,{style:{color:`var(--color-fg-3)`,fontSize:`12px`,letterSpacing:`-0.005em`},children:t})]})}function hf({href:e,title:t,desc:n,tone:r,type:i,cta:a}){let o=r===`orange`?`var(--color-hig-orange)`:r===`indigo`?`var(--color-hig-indigo)`:`var(--color-hig-blue)`;return(0,G.jsx)(`a`,{href:e,className:`group block rounded-2xl px-4 py-4 transition-all`,style:{border:`0.5px solid var(--color-line-1)`,background:`var(--color-surface-1)`,textDecoration:`none`,color:`inherit`,boxShadow:`var(--hig-shadow-1)`},children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center rounded-xl shrink-0`,style:{width:`40px`,height:`40px`,color:o,background:`color-mix(in oklab, ${o} 14%, transparent)`},children:(0,G.jsx)(ff,{type:i})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-[14px] font-semibold leading-tight`,style:{color:`var(--color-fg-0)`,letterSpacing:`-0.005em`},children:t}),(0,G.jsx)(`div`,{className:`text-[12px] mt-1 leading-snug`,style:{color:`var(--color-fg-2)`},children:n}),(0,G.jsxs)(`div`,{className:`text-[11.5px] mt-2 font-medium inline-flex items-center gap-1 transition-all`,style:{color:o},children:[a,(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-hover:translate-x-0.5`,children:`→`})]})]})]})})}function gf(){let{data:e}=B(`/api/state/activity?limit=5`,[Ae([`activity-updated`])[`activity-updated`]]),[,t]=(0,_.useState)(0);return(0,_.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),6e4);return()=>clearInterval(e)},[]),!e||e.length===0?(0,G.jsxs)(`div`,{className:`py-6 text-center`,style:{color:`var(--color-fg-3)`},children:[(0,G.jsx)(`p`,{style:{fontSize:`12.5px`,color:`var(--color-fg-2)`},children:`Waiting for your first agent action.`}),(0,G.jsx)(`p`,{style:{fontSize:`11px`,color:`var(--color-fg-3)`,marginTop:`4px`},children:`Anything your AI tries — read, write, run — will appear here in real time.`})]}):(0,G.jsx)(`div`,{children:e.slice(0,5).map((e,t)=>(0,G.jsxs)(`div`,{className:`hig-feed-row`,children:[(0,G.jsx)(`span`,{className:`hig-feed-row-dot`,style:{background:uf[e.decision]??`var(--color-fg-3)`,boxShadow:`0 0 0 3px ${e.decision===`block`?`color-mix(in oklab, var(--color-hig-red) 22%, transparent)`:e.decision===`ask`?`color-mix(in oklab, var(--color-hig-orange) 22%, transparent)`:`transparent`}`}}),(0,G.jsx)(`span`,{className:`hig-feed-row-decision`,style:{color:uf[e.decision]??`var(--color-fg-2)`},children:df(e.decision)}),(0,G.jsx)(`span`,{style:{color:`var(--color-fg-3)`},children:`·`}),(0,G.jsx)(`span`,{className:`hig-feed-row-tool`,title:e.tool,children:ui(e.tool)}),(0,G.jsx)(`span`,{className:`hig-feed-row-time`,children:lf(e.timestamp)})]},e.id??t))})}function _f(){return(0,G.jsx)(`div`,{className:`relative`,children:(0,G.jsxs)(`div`,{className:`relative max-w-5xl mx-auto px-2 pt-6 pb-12 space-y-6`,children:[(0,G.jsxs)(`section`,{className:`rounded-2xl px-6 py-5 relative overflow-hidden`,style:{border:`0.5px solid var(--color-line-1)`,background:`radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--color-accent) 14%, transparent) 0%, transparent 55%), var(--color-surface-1)`,boxShadow:`var(--hig-shadow-1)`},children:[(0,G.jsx)(`div`,{className:`hig-eyebrow mb-2`,children:`SigmaShake · Guardrails for AI`}),(0,G.jsx)(`h1`,{className:`font-semibold tracking-tight leading-tight`,style:{color:`var(--color-fg-0)`,fontSize:`26px`,letterSpacing:`-0.018em`},children:`The seatbelt for AI agents.`}),(0,G.jsx)(`p`,{className:`mt-1.5 leading-relaxed`,style:{color:`var(--color-fg-2)`,fontSize:`13.5px`,maxWidth:`52ch`},children:`Watch every move your AI makes. Approve what matters, block what doesn't — without babysitting every step.`}),(0,G.jsx)(`div`,{className:`mt-4 pt-3`,style:{borderTop:`0.5px solid var(--color-line-0)`},children:(0,G.jsx)(pf,{})})]}),(0,G.jsx)(`section`,{children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-3`,children:[(0,G.jsx)(hf,{href:`/guardrails?starter=coding`,tone:`orange`,type:`code`,title:`Code safely with AI`,desc:`Protect files, secrets, and git history from coding agents.`,cta:`Install pack`}),(0,G.jsx)(hf,{href:`/guardrails?starter=knowledge-work`,tone:`indigo`,type:`docs`,title:`Guard sensitive content`,desc:`Watch outbound email, file shares, and document changes.`,cta:`Install pack`}),(0,G.jsx)(hf,{href:`/audit`,tone:`blue`,type:`review`,title:`Review what your AI did`,desc:`Every action, decision, and reason — in one place.`,cta:`Open activity`})]})}),(0,G.jsxs)(`a`,{href:`/try`,className:`group flex items-center justify-between gap-3 rounded-xl px-4 py-3 transition-all`,style:{border:`0.5px solid var(--color-line-1)`,background:`linear-gradient(90deg, color-mix(in oklab, var(--color-accent) 8%, transparent) 0%, transparent 60%), var(--color-surface-1)`,textDecoration:`none`,color:`inherit`},children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-full shrink-0`,style:{background:`linear-gradient(180deg, var(--color-accent) 0%, var(--color-brand-hover) 100%)`,color:`var(--color-accent-on)`,boxShadow:`inset 0 0.5px 0 rgba(255,255,255,0.30), 0 2px 8px color-mix(in oklab, var(--color-accent) 30%, transparent)`},children:(0,G.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`polygon`,{points:`6 4 20 12 6 20`,fill:`currentColor`,stroke:`none`})})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-semibold text-[13.5px] leading-tight`,style:{color:`var(--color-fg-0)`,letterSpacing:`-0.005em`},children:`Try a scenario — see SigmaShake decide`}),(0,G.jsx)(`div`,{className:`text-[12px] mt-0.5`,style:{color:`var(--color-fg-3)`},children:`30-second dry-run · nothing actually runs.`})]})]}),(0,G.jsxs)(`span`,{className:`text-[12.5px] font-medium shrink-0 inline-flex items-center gap-1 transition-all`,style:{color:`var(--color-accent)`},children:[`Try it`,(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-hover:translate-x-0.5`,children:`→`})]})]}),(0,G.jsxs)(`section`,{children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between mb-2`,children:[(0,G.jsx)(`h2`,{className:`font-semibold tracking-tight`,style:{color:`var(--color-fg-0)`,fontSize:`15px`,letterSpacing:`-0.008em`},children:`Recent activity`}),(0,G.jsx)(`a`,{href:`/audit`,style:{fontSize:`12px`,color:`var(--color-hig-blue)`,fontWeight:500},children:`View all →`})]}),(0,G.jsx)(`div`,{style:{background:`var(--color-surface-1)`,border:`0.5px solid var(--color-line-1)`,borderRadius:`14px`,padding:`4px 16px`,boxShadow:`var(--hig-shadow-1)`},children:(0,G.jsx)(gf,{})})]})]})})}var vf=[{id:`erase-folder`,label:`AI tries to erase a folder`,description:`A common accident when AI automates cleanup tasks.`,emoji:`🗑️`,toolCall:{tool:`Bash`,input:{command:`find ./output -type f -delete`}}},{id:`send-email`,label:`AI tries to send an email`,description:`Communication you did not review or approve.`,emoji:`📧`,toolCall:{tool:`Bash`,input:{command:`sendmail -t < message.txt`}}},{id:`read-ssh-key`,label:`AI tries to read your private key`,description:`AI peeking at credentials it should never see.`,emoji:`🔑`,toolCall:{tool:`Read`,input:{file_path:`~/.ssh/id_rsa`}}},{id:`install-package`,label:`AI tries to install a package`,description:`Pulling in unknown code without your knowledge.`,emoji:`📦`,toolCall:{tool:`Bash`,input:{command:`npm install some-package --save`}}},{id:`fetch-web`,label:`AI tries to fetch a URL`,description:`Outbound network request to an external service.`,emoji:`🌐`,toolCall:{tool:`WebFetch`,input:{url:`https://api.example.com/data`,prompt:``}}},{id:`write-env`,label:`AI tries to write your .env file`,description:`Overwriting the file that holds your app secrets.`,emoji:`⚠️`,toolCall:{tool:`Write`,input:{file_path:`.env`,content:`API_KEY=test`}}}],yf={allow:{label:`Allowed`,color:`text-emerald-300`,bg:`border-emerald-500/30 bg-emerald-500/5`,icon:`✓`,next:`SSG would let this through. No action needed.`},block:{label:`Blocked`,color:`text-red-300`,bg:`border-red-500/30 bg-red-500/5`,icon:`✕`,next:`SSG would stop the AI here. The action never happens.`},ask:{label:`Ask first`,color:`text-amber-300`,bg:`border-amber-500/30 bg-amber-500/5`,icon:`?`,next:`SSG would pause the AI and ask you on /approvals before proceeding.`},log:{label:`Logged`,color:`text-sky-300`,bg:`border-sky-500/30 bg-sky-500/5`,icon:`≡`,next:`SSG would allow this but record it in your activity log.`},force:{label:`Force-allow`,color:`text-violet-300`,bg:`border-violet-500/30 bg-violet-500/5`,icon:`→`,next:`A high-priority rule explicitly allows this.`}};function bf({scenario:e,selected:t,onClick:n}){return(0,G.jsxs)(`button`,{onClick:n,className:`flex items-center gap-2.5 rounded-xl border px-3 py-2.5 text-left cursor-pointer transition-all ${t?`border-[var(--color-brand)]/60 bg-[var(--color-brand)]/8 shadow-[0_0_0_3px_color-mix(in_oklab,var(--color-brand)_15%,transparent)]`:`border-[var(--color-line-1)] bg-[var(--color-surface-1)] hover:border-[var(--color-line-2)] hover:bg-[var(--color-surface-2)]/40`}`,children:[(0,G.jsx)(`span`,{className:`text-[18px] leading-none shrink-0`,children:e.emoji}),(0,G.jsx)(`span`,{className:`text-[12.5px] font-medium text-[var(--color-fg-0)] leading-snug flex-1 min-w-0`,children:e.label})]})}function xf(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(`Bash`),[f,p]=(0,_.useState)(`{"command": ""}`),m=vf.find(t=>t.id===e);async function h(e){a(!0),s(null),r(null);try{let t=await(await fetch(`/api/json/eval-dry-run`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify(e)})).json();t.error?s(t.error):r(t)}catch{s(`Could not reach the governance engine. Is SSG running?`)}finally{a(!1)}}function g(){m&&h(m.toolCall)}function v(){let e;try{e=JSON.parse(f)}catch{s(`Invalid JSON in input field.`);return}if(typeof e!=`object`||!e){s(`Input must be a JSON object.`);return}h({tool:u,input:e})}let y=n?yf[n.decision]??yf.allow:null;return(0,G.jsxs)(`div`,{className:`max-w-3xl mx-auto py-4 space-y-4`,children:[(0,G.jsxs)(`header`,{className:`flex items-baseline justify-between gap-4 flex-wrap`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-[22px] font-semibold text-[var(--color-fg-0)] tracking-tight leading-tight`,children:`Try it`}),(0,G.jsxs)(`p`,{className:`text-[13px] text-[var(--color-fg-2)] mt-0.5`,children:[`Pretend the AI tries something. See what your guardrails do —`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`nothing actually runs`}),`.`]})]}),(0,G.jsx)(`a`,{href:`/guardrails`,className:`text-[11.5px] font-medium text-[var(--color-brand)] hover:underline shrink-0`,children:`Install more guardrails →`})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:vf.map(n=>(0,G.jsx)(bf,{scenario:n,selected:e===n.id,onClick:()=>{t(n.id),r(null),s(null)}},n.id))}),m&&(0,G.jsxs)(`div`,{className:`rounded-xl border border-[var(--color-line-1)] bg-[var(--color-surface-1)] px-4 py-3 flex items-center gap-3 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`font-mono text-[12px] text-[var(--color-fg-2)] leading-snug flex-1 min-w-0 break-all`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-brand)] font-medium`,children:m.toolCall.tool}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`(`}),Object.entries(m.toolCall.input).map(([e,t],n,r)=>(0,G.jsxs)(`span`,{children:[(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[e,`:`]}),` `,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-1)]`,children:[`"`,String(t),`"`]}),n<r.length-1&&(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`, `})]},e)),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`)`})]}),(0,G.jsx)(`button`,{onClick:g,disabled:i,className:`inline-flex items-center gap-1.5 px-4 h-8 rounded-full text-[12px] font-medium cursor-pointer transition-colors
27
- bg-[var(--color-brand)] text-white hover:opacity-90
28
- disabled:opacity-40 disabled:cursor-not-allowed shrink-0`,children:i?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`svg`,{className:`animate-spin`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,G.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),`Running`]}):(0,G.jsxs)(G.Fragment,{children:[`Run`,(0,G.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M5 12h14M13 5l7 7-7 7`})})]})})]}),n&&y&&(0,G.jsxs)(`div`,{className:`rounded-xl border p-4 ${y.bg}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-full text-base font-bold border ${y.bg} ${y.color}`,children:y.icon}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-[15px] font-semibold ${y.color}`,children:y.label}),(0,G.jsxs)(`p`,{className:`text-[11px] text-[var(--color-fg-3)]`,children:[n.rules_evaluated,` rule`,n.rules_evaluated===1?``:`s`,` evaluated`,n.rule_id&&(0,G.jsxs)(G.Fragment,{children:[` `,`· matched `,(0,G.jsx)(`span`,{className:`font-mono`,children:n.rule_id})]})]})]})]}),(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-1)] mt-3 leading-relaxed`,children:n.reason??`No specific rule matched SSG defaults to allowing this action.`}),(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] mt-2 leading-relaxed`,children:y.next})]}),o&&(0,G.jsx)(`div`,{className:`rounded-xl border border-red-500/30 bg-red-500/5 px-4 py-3 text-[12px] text-red-300`,children:o}),(0,G.jsxs)(`div`,{className:`pt-2`,children:[(0,G.jsx)(`button`,{onClick:()=>l(e=>!e),className:`text-[11px] text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)] transition-colors`,children:c?`▲ Hide custom input`:`▼ Or paste your own tool call`}),c&&(0,G.jsxs)(`div`,{className:`mt-3 rounded-xl border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 flex items-end gap-2 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:`Tool`}),(0,G.jsx)(`select`,{value:u,onChange:e=>d(e.target.value),className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] font-mono rounded-md px-2 h-8 focus:outline-none`,children:[`Bash`,`Read`,`Write`,`Edit`,`WebFetch`,`WebSearch`,`Agent`,`Glob`,`Grep`].map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))})]}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-[200px] flex flex-col gap-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:`Input JSON`}),(0,G.jsx)(`input`,{type:`text`,value:f,onChange:e=>p(e.target.value),className:`w-full bg-[var(--color-surface-0)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] font-mono rounded-md px-2 h-8 focus:outline-none focus:border-[var(--color-brand)]/50`})]}),(0,G.jsx)(`button`,{onClick:v,disabled:i,className:`px-3 h-8 rounded-full text-[11px] font-medium cursor-pointer transition-colors
29
- bg-[var(--color-fg-1)] text-[var(--color-bg)] hover:opacity-90
30
- disabled:opacity-40 disabled:cursor-not-allowed`,children:`Run`})]})]})]})}var Sf=`http://www.w3.org/2000/svg`;function Cf({markup:e,size:t=22}){let n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=n.current;if(!t)return;for(;t.firstChild;)t.removeChild(t.firstChild);let r=`<svg xmlns="${Sf}">${e}</svg>`,i=new DOMParser().parseFromString(r,`image/svg+xml`).documentElement;for(let e of Array.from(i.childNodes))t.appendChild(t.ownerDocument.importNode(e,!0))},[e]),(0,G.jsx)(`svg`,{ref:n,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,width:t,height:t,"aria-hidden":`true`})}function wf({a:e,size:t=40}){return(0,G.jsx)(`div`,{className:`agent-card-icon shrink-0`,style:{width:t,height:t,color:e.accent,background:`color-mix(in oklab, ${e.accent} 16%, var(--color-surface-2))`,borderColor:`color-mix(in oklab, ${e.accent} 38%, var(--color-line-1))`},children:(0,G.jsx)(Cf,{markup:e.glyph,size:Math.round(t*.55)})})}function Tf({a:e}){return e.active?(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 16%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 38%, transparent)`},children:`Active`}):e.detected?(0,G.jsxs)(`span`,{className:`agent-badge agent-badge--detected`,children:[(0,G.jsx)(`span`,{className:`agent-badge-dot`}),`Detected`]}):e.recommended?(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 12%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 30%, transparent)`},children:`Recommended`}):null}function Ef(){return(0,G.jsx)(`svg`,{className:`ss-list-row-chevron`,viewBox:`0 0 16 16`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M5 3l5 5-5 5`})})}function Df({text:e}){let[t,n]=(0,_.useState)(!1);return(0,G.jsx)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},className:`ss-btn ss-btn--secondary`,style:{height:32,padding:`0 12px`,fontSize:12},"aria-label":t?`Copied`:`Copy`,children:t?`Copied ✓`:`Copy`})}function Of(e,t){return t&&e.startsWith(t)?`~`+e.slice(t.length):e}function kf({agent:e,ctx:t,onClose:n,onInstalled:r}){let[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),C=`ssg init --client=${e.id}`;async function w(){b(!0),S(null);try{let e=await(await fetch(`/api/json/pick-dir`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()}})).json();e.ok?a(e.path):e.reason===`user_cancelled`||(e.reason===`no_display`?S(`No graphical session — type the path manually instead.`):e.reason===`no_picker_found`?S("Folder picker not available. Install `zenity` (Linux), or type the path manually."):S(e.error||`Folder picker failed.`))}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}}(0,_.useEffect)(()=>{let e=!1;return fetch(`/api/json/adapters/recent`).then(e=>e.json()).then(t=>{e||(s(t.recents??[]),!i&&t.recents&&t.recents.length>0&&a(t.recents[0].path))}).catch(()=>{}),()=>{e=!0}},[]);async function T(){if(i.trim()){l(!0),h(null),v(!1);try{let t=await(await fetch(`/api/json/adapters/install`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({adapter:e.id,projectDir:i})})).json();h(t),t.ok&&(r(),fetch(`/api/json/adapters/recent`).then(e=>e.json()).then(e=>s(e.recents??[])).catch(()=>{}))}catch(t){h({ok:!1,exitCode:-1,adapter:e.id,projectDir:i,stdout:``,stderr:``,error:t instanceof Error?t.message:String(t)})}finally{l(!1)}}}async function E(e){d(!0),p(null);try{let t=await(await fetch(`/api/json/adapters/active`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({adapter:e})})).json();t.ok?r():p(t.error??`Failed to pin adapter.`)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}let D=c||!i.trim(),O=c?`Connecting…`:i.trim()?`Connect this project`:`Pick a project directory`,ee=u?`Saving…`:e.pinned?`Pinned ✓`:`Set as my agent`,te=u||e.pinned;return(0,G.jsxs)(vl,{open:!0,onClose:n,title:e.displayName,subtitle:e.vendor,size:`md`,footer:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--secondary`,disabled:D,onClick:()=>void T(),title:"Run `ssg init --client` in the chosen project directory.",children:O}),(0,G.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--primary`,disabled:te,onClick:()=>void E(e.id),style:{"--tone":e.accent},title:e.pinned?`Already pinned as your default agent.`:`Pin ${e.displayName} as the default — overrides auto-detection across SSG.`,children:ee})]}),children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-4 mb-4`,children:[(0,G.jsx)(wf,{a:e,size:56}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap mb-1.5`,children:[(0,G.jsx)(Tf,{a:e}),e.pinned&&(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 14%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 36%, transparent)`},title:`You pinned this agent as your default.`,children:`Pinned`}),e.healthy&&!e.active&&(0,G.jsx)(`span`,{className:`text-[10.5px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`healthy`})]}),(0,G.jsx)(`p`,{className:`text-[13px] text-[var(--color-fg-1)] leading-relaxed`,children:e.tagline}),e.pinned&&(0,G.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void E(null),className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-brand)] mt-2 cursor-pointer hover:underline`,children:u?`unpinning…`:`unpin & return to auto-detect`}),f&&(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-hig-red)] mt-2`,children:f})]})]}),(0,G.jsx)(`p`,{className:`ss-list-section-title`,children:`Install target`}),(0,G.jsxs)(`div`,{className:`ss-list mb-4`,children:[(0,G.jsx)(`div`,{className:`ss-list-row`,style:{cursor:`default`},onClick:e=>e.preventDefault(),children:(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-[12.5px] font-medium text-[var(--color-fg-1)]`,children:`Project directory`}),(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-0.5 truncate`,children:i.trim()?Of(i,t.home):`Type a path or pick from below.`})]})}),(0,G.jsxs)(`div`,{style:{padding:`10px 14px`,borderTop:`1px solid var(--color-line-0)`},children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),spellCheck:!1,placeholder:`Click Browse… or paste a path`,className:`flex-1 h-9 px-3 rounded-md text-[12px] font-mono`,style:{background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`,color:`var(--color-fg-1)`,outline:`none`}}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:y,className:`ss-btn ss-btn--secondary`,style:{height:36,padding:`0 14px`,fontSize:12},title:`Open the system folder picker.`,children:y?`Opening…`:`Browse…`})]}),x&&(0,G.jsx)(`p`,{className:`text-[11px] font-mono mt-2`,style:{color:`var(--color-hig-red)`},children:x}),o.length>0&&(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsx)(`p`,{className:`text-[10.5px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`Recent`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(e.path),className:`text-[11px] font-mono px-2 py-1 rounded-md cursor-pointer`,style:{background:i===e.path?`color-mix(in oklab, var(--color-brand) 14%, var(--color-surface-2))`:`var(--color-surface-2)`,border:`1px solid ${i===e.path?`color-mix(in oklab, var(--color-brand) 38%, var(--color-line-1))`:`var(--color-line-1)`}`,color:i===e.path?`var(--color-brand)`:`var(--color-fg-1)`},title:e.path,children:Of(e.path,t.home)},e.path))})]})]})]}),(0,G.jsx)(`p`,{className:`ss-list-section-title`,children:`Or run from terminal`}),(0,G.jsxs)(`div`,{className:`ss-list mb-4 p-3 flex items-center gap-2`,style:{padding:`12px 14px`},children:[(0,G.jsxs)(`code`,{className:`flex-1 text-[12px] font-mono text-[var(--color-brand)] overflow-x-auto whitespace-nowrap`,children:[`$ `,C]}),(0,G.jsx)(Df,{text:C})]}),m&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`ss-list-section-title`,children:m.ok?`Setup complete`:`Setup failed`}),(0,G.jsx)(Af,{result:m}),(m.stdout||m.stderr||m.error)&&(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsx)(`button`,{type:`button`,className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-brand)] cursor-pointer`,onClick:()=>v(e=>!e),children:g?`▾ Hide full log`:`▸ Show full log`}),g&&(0,G.jsx)(`pre`,{className:`text-[11px] font-mono rounded-md p-3 mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-all`,style:{background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`,color:`var(--color-fg-2)`},children:m.error?`${m.error}${m.detail?`
26
+ `,`ssg_debug_rca(`,`{`,`auto_current:true`,`}`,`)`]}),(0,G.jsx)(`button`,{type:`button`,onClick:i,className:`w-full mt-2 px-2 py-1 border border-[var(--color-line-1)] rounded-sm hover:bg-[var(--color-surface-2)]`,children:`refresh`}),t?.snapshot_hash&&(0,G.jsxs)(`p`,{className:`text-[10px] opacity-60`,children:[`hash `,t.snapshot_hash.slice(0,12),`…`]})]})]})}function Jd(e){return e===`critical`?`text-rose-400 border-rose-500/40`:e===`high`?`text-amber-300 border-amber-500/40`:e===`medium`?`text-sky-300 border-sky-500/40`:`text-[var(--color-fg-3)] border-[var(--color-line-1)]`}function Yd({pack:e}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`header`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-4)]`,children:[`rca pack · `,new Date(e.ts_ms).toLocaleTimeString()]}),(0,G.jsx)(`h2`,{className:`text-[15px] font-medium text-[var(--color-fg-1)] mt-1`,children:e.summary}),e.trace_id&&(0,G.jsxs)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-4)] mt-1`,children:[`trace_id · `,e.trace_id]})]}),(0,G.jsx)(`span`,{className:`chip uppercase text-[10px] tracking-wider `+Jd(e.severity),children:e.severity})]}),e.hypothesis&&e.hypothesis.length>0&&(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`hypothesis`}),(0,G.jsx)(`ol`,{className:`space-y-2`,children:e.hypothesis.map((e,t)=>(0,G.jsxs)(`li`,{className:`p-2 rounded-sm bg-[var(--color-surface-2)] border border-[var(--color-line-1)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`p`,{className:`text-[13px] text-[var(--color-fg-1)]`,children:e.cause}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`conf `,(e.confidence*100).toFixed(0),`%`]})]}),e.evidence.length>0&&(0,G.jsx)(`ul`,{className:`mt-1 pl-3 text-[11px] text-[var(--color-fg-3)] list-disc list-inside space-y-0.5`,children:e.evidence.map((e,t)=>(0,G.jsx)(`li`,{children:e},t))})]},t))})]}),e.suggested_next_actions&&e.suggested_next_actions.length>0&&(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`suggested next actions`}),(0,G.jsx)(`ul`,{className:`space-y-1 text-[13px] text-[var(--color-fg-2)]`,children:e.suggested_next_actions.map((e,t)=>(0,G.jsxs)(`li`,{className:`font-mono text-[12px]`,children:[`→ `,e]},t))})]}),e.state_snapshot&&e.state_snapshot.length>0&&(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`expand`}),(0,G.jsx)(`ul`,{className:`space-y-1 text-[11px] font-mono`,children:e.state_snapshot.map(e=>(0,G.jsxs)(`li`,{className:`text-[var(--color-fg-3)]`,children:[(0,G.jsx)(`code`,{className:`text-sky-300`,children:e.uri}),(0,G.jsxs)(`span`,{className:`opacity-50 ml-2`,children:[e.hash.slice(0,10),`…`]})]},e.uri))})]})]})}var Xd=[`hook-ingress`,`parse`,`match`,`ffi-call`,`decide`,`audit`,`respond`],Zd={"hook-ingress":`#6ea8ff`,parse:`#a78bfa`,match:`#60d394`,"ffi-call":`#f59e0b`,decide:`#f472b6`,audit:`#94a3b8`,respond:`#22d3ee`};function Qd(){let{data:e,loading:t,error:n}=B(`/api/json/debug?uri=ssg%3A%2F%2Fframes%2Frecent%3Flimit%3D1024`,[Ae([`debug-frame`])[`debug-frame`]]),r=e?.data?.frames??[],i=e?.data?.dropped??0,[a,o]=(0,_.useState)(null);return(0,G.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-[1fr_320px] gap-4`,children:[(0,G.jsxs)(`article`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:[`frames · `,r.length,i>0&&(0,G.jsxs)(`span`,{className:`ml-2 text-amber-300`,children:[`dropped · `,i]})]}),(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:`ssg://frames/recent`})]}),n&&(0,G.jsxs)(`p`,{className:`text-sm text-rose-300`,children:[`timeline fetch error: `,n]}),t&&r.length===0?(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`loading…`}):r.length===0?(0,G.jsx)($d,{}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(tf,{frames:r,onSelect:o}),(0,G.jsx)(ef,{})]})]}),(0,G.jsxs)(`aside`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2 text-[11px] font-mono text-[var(--color-fg-3)]`,children:[(0,G.jsx)(`p`,{className:`uppercase tracking-wider text-[var(--color-fg-2)]`,children:`frame inspector`}),a?(0,G.jsx)(nf,{frame:a}):(0,G.jsx)(`p`,{className:`opacity-60`,children:`click a bar to inspect`})]})]})}function $d(){return(0,G.jsxs)(`div`,{className:`text-[12px] text-[var(--color-fg-3)] space-y-1 py-4`,children:[(0,G.jsx)(`p`,{children:`no frames yet`}),(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)] font-mono`,children:`SSG_DEBUG_ENABLED=1 ssg daemon`}),(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)]`,children:`then fire an eval — frames stream in live.`})]})}function ef(){return(0,G.jsx)(`div`,{className:`flex flex-wrap gap-3 text-[10px] font-mono text-[var(--color-fg-4)]`,children:Xd.map(e=>(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{background:Zd[e]}}),e]},e))})}function tf({frames:e,onSelect:t}){let n=(0,_.useRef)(null),r=(0,_.useRef)([]),[i,a]=(0,_.useState)(-1),{rows:o,tMin:s,tMax:c}=(0,_.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.trace_id)??[];e.push(n),t.set(n.trace_id,e)}let n=Array.from(t.entries()).map(([e,t])=>({trace_id:e,frames:t.slice().sort((e,t)=>af(e.ts_start_ns,t.ts_start_ns))}));n.sort((e,t)=>af(e.frames[0].ts_start_ns,t.frames[0].ts_start_ns));let r=null,i=null;for(let t of e){let e=BigInt(t.ts_start_ns),n=BigInt(t.ts_end_ns);(r===null||e<r)&&(r=e),(i===null||n>i)&&(i=n)}return{rows:n,tMin:r??0n,tMax:i??1n}},[e]);(0,_.useEffect)(()=>{let e=n.current;if(!e)return;let t=window.devicePixelRatio||1,a=e.clientWidth,l=Math.max(120,o.length*22+24);e.width=a*t,e.height=l*t,e.style.height=`${l}px`;let u=e.getContext(`2d`);if(!u)return;u.setTransform(t,0,0,t,0,0),u.clearRect(0,0,a,l),u.strokeStyle=`rgba(255,255,255,0.04)`,u.lineWidth=1;for(let e=1;e<4;e++){let t=e*a/4;u.beginPath(),u.moveTo(t,0),u.lineTo(t,l),u.stroke()}let d=c>s?Number(c-s):1,f=a-110-8;u.font=`10px ui-monospace, monospace`,u.textBaseline=`middle`;let p=[];if(o.forEach((e,t)=>{let n=8+t*22;u.fillStyle=`rgba(255,255,255,0.55)`,u.fillText(e.trace_id.slice(0,10),6,n+18/2);for(let t of e.frames){let e=Number(BigInt(t.ts_start_ns)-s),r=Number(BigInt(t.ts_end_ns)-s),i=110+e/d*f,a=Math.max(2,(r-e)/d*f);u.fillStyle=Zd[t.stage]??`#888`,u.globalAlpha=t.result===`error`?1:.82,u.fillRect(i,n,a,18),u.globalAlpha=1,t.result===`error`&&(u.strokeStyle=`#f43f5e`,u.lineWidth=1.5,u.strokeRect(i+.5,n+.5,a-1,17)),p.push({x:i,y:n,w:a,h:18,frame:t})}}),r.current=p,i>=0&&i<p.length){let e=p[i];u.strokeStyle=`#fff`,u.lineWidth=1.5,u.strokeRect(e.x+.5,e.y+.5,e.w-1,e.h-1)}},[o,s,c,i]);function l(e){let t=n.current;if(!t)return-1;let i=t.getBoundingClientRect(),a=e.clientX-i.left,o=e.clientY-i.top;for(let e=r.current.length-1;e>=0;e--){let t=r.current[e];if(a>=t.x&&a<=t.x+t.w&&o>=t.y&&o<=t.y+t.h)return e}return-1}return(0,G.jsx)(`canvas`,{ref:n,className:`w-full block cursor-crosshair`,onMouseMove:e=>a(l(e)),onMouseLeave:()=>a(-1),onClick:e=>{let n=l(e);t(n>=0?r.current[n].frame:null)}})}function nf({frame:e}){let t=Number(BigInt(e.ts_end_ns)-BigInt(e.ts_start_ns)),n=t>=1e6?`${(t/1e6).toFixed(2)}ms`:t>=1e3?`${(t/1e3).toFixed(1)}µs`:`${t}ns`;return(0,G.jsxs)(`dl`,{className:`space-y-1`,children:[(0,G.jsxs)(rf,{k:`stage`,children:[(0,G.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm mr-1 align-middle`,style:{background:Zd[e.stage]??`#888`}}),e.stage]}),(0,G.jsx)(rf,{k:`tool`,children:e.tool}),(0,G.jsx)(rf,{k:`result`,children:(0,G.jsx)(`span`,{className:e.result===`error`?`text-rose-300`:e.result===`skip`?`text-[var(--color-fg-4)]`:`text-emerald-300`,children:e.result})}),(0,G.jsx)(rf,{k:`dur`,children:n}),e.rule_id&&(0,G.jsx)(rf,{k:`rule`,children:e.rule_id}),e.error&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(rf,{k:`err.type`,children:(0,G.jsx)(`span`,{className:`text-rose-300`,children:e.error.type})}),(0,G.jsx)(rf,{k:`err.msg`,children:(0,G.jsx)(`span`,{className:`text-rose-200`,children:e.error.message})})]}),e.input_preview&&(0,G.jsx)(rf,{k:`input`,children:(0,G.jsx)(`code`,{className:`text-[10px] break-all`,children:e.input_preview})}),(0,G.jsx)(rf,{k:`trace`,children:(0,G.jsx)(`code`,{className:`text-[10px]`,children:e.trace_id})}),(0,G.jsx)(rf,{k:`frame`,children:(0,G.jsx)(`code`,{className:`text-[10px]`,children:e.frame_id})})]})}function rf({k:e,children:t}){return(0,G.jsxs)(`div`,{className:`flex gap-2 text-[11px] leading-tight`,children:[(0,G.jsx)(`dt`,{className:`text-[var(--color-fg-4)] w-16 shrink-0 uppercase tracking-wider`,children:e}),(0,G.jsx)(`dd`,{className:`text-[var(--color-fg-2)] break-all min-w-0`,children:t})]})}function af(e,t){let n=BigInt(e),r=BigInt(t);return n<r?-1:n>r?1:0}var of=[`ssg://daemon/state`,`ssg://daemon/metrics`,`ssg://audit/recent?limit=10`,`ssg://frames/recent?limit=32`,`ssg://rules/list`,`ssg://rca/current`,`ssg://native/stats`];function sf(){let[e,t]=(0,_.useState)(`ssg://daemon/state`),[n,r]=(0,_.useState)(`ssg://daemon/state`);return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:of.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>{t(e),r(e)},className:`chip text-[10px] `+(n===e?`border-[var(--color-brand)] text-[var(--color-fg-1)]`:`text-[var(--color-fg-3)]`),children:e},e))}),(0,G.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault(),r(e)},children:[(0,G.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),placeholder:`ssg://source/path?k=v`,className:`flex-1 px-3 py-1.5 text-[12px] font-mono rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] text-[var(--color-fg-1)]`}),(0,G.jsx)(`button`,{type:`submit`,className:`px-3 py-1.5 text-[11px] font-mono uppercase tracking-wider border border-[var(--color-line-1)] rounded-sm hover:bg-[var(--color-surface-2)]`,children:`resolve`})]}),(0,G.jsx)(cf,{uri:n})]})}function cf({uri:e}){let t=Ae([`debug-frame`,`activity-updated`,`counters-updated`]),{data:n,loading:r,error:i,refetch:a}=B(`/api/json/debug?uri=${encodeURIComponent(e)}`,[t[`debug-frame`],t[`activity-updated`],t[`counters-updated`],e]),o=n?JSON.stringify(n.data,null,2):``;return(0,G.jsxs)(`div`,{className:`rounded-sm border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:e}),n?.snapshot_hash&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-4)]`,children:[`hash `,n.snapshot_hash.slice(0,10),`…`]}),n?.stale&&(0,G.jsxs)(`span`,{className:`chip text-amber-300 border-amber-500/40 text-[10px]`,children:[`stale `,n.age_ms?`${Math.round(n.age_ms/1e3)}s`:``]})]}),(0,G.jsx)(`button`,{type:`button`,onClick:a,className:`text-[10px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`,children:`refresh`})]}),r&&!n&&(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-4)]`,children:`resolving…`}),i&&(0,G.jsx)(`p`,{className:`text-sm text-rose-300`,children:i}),o&&(0,G.jsx)(`pre`,{className:`text-[11px] leading-snug font-mono text-[var(--color-fg-2)] overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:o})]})}function lf(e){let t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}var uf={block:`var(--color-hig-red)`,ask:`var(--color-hig-orange)`,log:`var(--color-hig-blue)`,allow:`var(--color-hig-green)`,force:`var(--color-hig-purple)`};function df(e){switch(e){case`block`:return`Blocked`;case`ask`:return`Held for review`;case`log`:return`Logged`;case`force`:return`Force-allowed`;default:return`Allowed`}}function ff({type:e}){let t={fill:`none`,stroke:`currentColor`,strokeWidth:1.6,strokeLinecap:`round`,strokeLinejoin:`round`,viewBox:`0 0 24 24`};return e===`code`?(0,G.jsxs)(`svg`,{...t,width:`22`,height:`22`,children:[(0,G.jsx)(`path`,{d:`M9 7l-5 5 5 5M15 7l5 5-5 5`}),(0,G.jsx)(`path`,{d:`M14 4l-4 16`,opacity:`0.55`})]}):e===`docs`?(0,G.jsxs)(`svg`,{...t,width:`22`,height:`22`,children:[(0,G.jsx)(`path`,{d:`M5 4h9l5 5v11a1 1 0 01-1 1H5a1 1 0 01-1-1V5a1 1 0 011-1z`}),(0,G.jsx)(`path`,{d:`M14 4v5h5`}),(0,G.jsx)(`path`,{d:`M8 13h8M8 17h5`,opacity:`0.7`})]}):(0,G.jsxs)(`svg`,{...t,width:`22`,height:`22`,children:[(0,G.jsx)(`path`,{d:`M3 12a9 9 0 109-9`}),(0,G.jsx)(`path`,{d:`M12 3v9l6 3`})]})}function pf(){let{data:e}=B(`/api/json/counters`,[Ae([`counters-updated`])[`counters-updated`]]),t=e?.evals_today??0,n=e?.blocked_today??0,r=e?.asked_today??0;return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,G.jsx)(mf,{value:t,label:`evaluated`,tone:`default`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsx)(mf,{value:n,label:`blocked`,tone:`red`}),(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`·`}),(0,G.jsx)(mf,{value:r,label:`held for you`,tone:`orange`}),(0,G.jsx)(`span`,{className:`text-[11px] ml-auto`,style:{color:`var(--color-fg-3)`},children:`Today`})]})}function mf({value:e,label:t,tone:n}){return(0,G.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-semibold tabular-nums`,style:{color:n===`red`?`var(--color-hig-red)`:n===`orange`?`var(--color-hig-orange)`:`var(--color-fg-0)`,fontSize:`20px`,lineHeight:1,letterSpacing:`-0.018em`},children:e.toLocaleString()}),(0,G.jsx)(`span`,{style:{color:`var(--color-fg-3)`,fontSize:`12px`,letterSpacing:`-0.005em`},children:t})]})}function hf({href:e,title:t,desc:n,tone:r,type:i,cta:a}){let o=r===`orange`?`var(--color-hig-orange)`:r===`indigo`?`var(--color-hig-indigo)`:`var(--color-hig-blue)`;return(0,G.jsx)(`a`,{href:e,className:`group block rounded-2xl px-4 py-4 transition-all`,style:{border:`0.5px solid var(--color-line-1)`,background:`var(--color-surface-1)`,textDecoration:`none`,color:`inherit`,boxShadow:`var(--hig-shadow-1)`},children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center rounded-xl shrink-0`,style:{width:`40px`,height:`40px`,color:o,background:`color-mix(in oklab, ${o} 14%, transparent)`},children:(0,G.jsx)(ff,{type:i})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-[14px] font-semibold leading-tight`,style:{color:`var(--color-fg-0)`,letterSpacing:`-0.005em`},children:t}),(0,G.jsx)(`div`,{className:`text-[12px] mt-1 leading-snug`,style:{color:`var(--color-fg-2)`},children:n}),(0,G.jsxs)(`div`,{className:`text-[11.5px] mt-2 font-medium inline-flex items-center gap-1 transition-all`,style:{color:o},children:[a,(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-hover:translate-x-0.5`,children:`→`})]})]})]})})}function gf(){let{data:e}=B(`/api/state/activity?limit=5`,[Ae([`activity-updated`])[`activity-updated`]]),[,t]=(0,_.useState)(0);return(0,_.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),6e4);return()=>clearInterval(e)},[]),!e||e.length===0?(0,G.jsxs)(`div`,{className:`py-6 text-center`,style:{color:`var(--color-fg-3)`},children:[(0,G.jsx)(`p`,{style:{fontSize:`12.5px`,color:`var(--color-fg-2)`},children:`Waiting for your first agent action.`}),(0,G.jsx)(`p`,{style:{fontSize:`11px`,color:`var(--color-fg-3)`,marginTop:`4px`},children:`Anything your AI tries — read, write, run — will appear here in real time.`})]}):(0,G.jsx)(`div`,{children:e.slice(0,5).map((e,t)=>(0,G.jsxs)(`div`,{className:`hig-feed-row`,children:[(0,G.jsx)(`span`,{className:`hig-feed-row-dot`,style:{background:uf[e.decision]??`var(--color-fg-3)`,boxShadow:`0 0 0 3px ${e.decision===`block`?`color-mix(in oklab, var(--color-hig-red) 22%, transparent)`:e.decision===`ask`?`color-mix(in oklab, var(--color-hig-orange) 22%, transparent)`:`transparent`}`}}),(0,G.jsx)(`span`,{className:`hig-feed-row-decision`,style:{color:uf[e.decision]??`var(--color-fg-2)`},children:df(e.decision)}),(0,G.jsx)(`span`,{style:{color:`var(--color-fg-3)`},children:`·`}),(0,G.jsx)(`span`,{className:`hig-feed-row-tool`,title:e.tool,children:ui(e.tool)}),(0,G.jsx)(`span`,{className:`hig-feed-row-time`,children:lf(e.timestamp)})]},e.id??t))})}function _f(){return(0,G.jsx)(`div`,{className:`relative`,children:(0,G.jsxs)(`div`,{className:`relative max-w-5xl mx-auto px-2 pt-6 pb-12 space-y-6`,children:[(0,G.jsxs)(`section`,{className:`rounded-2xl px-6 py-5 relative overflow-hidden`,style:{border:`0.5px solid var(--color-line-1)`,background:`radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--color-accent) 14%, transparent) 0%, transparent 55%), var(--color-surface-1)`,boxShadow:`var(--hig-shadow-1)`},children:[(0,G.jsx)(`div`,{className:`hig-eyebrow mb-2`,children:`SigmaShake · Guardrails for AI`}),(0,G.jsx)(`h1`,{className:`font-semibold tracking-tight leading-tight`,style:{color:`var(--color-fg-0)`,fontSize:`26px`,letterSpacing:`-0.018em`},children:`The seatbelt for AI agents.`}),(0,G.jsx)(`p`,{className:`mt-1.5 leading-relaxed`,style:{color:`var(--color-fg-2)`,fontSize:`13.5px`,maxWidth:`52ch`},children:`Watch every move your AI makes. Approve what matters, block what doesn't — without babysitting every step.`}),(0,G.jsx)(`div`,{className:`mt-4 pt-3`,style:{borderTop:`0.5px solid var(--color-line-0)`},children:(0,G.jsx)(pf,{})})]}),(0,G.jsx)(`section`,{children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-3`,children:[(0,G.jsx)(hf,{href:`/guardrails?starter=coding`,tone:`orange`,type:`code`,title:`Code safely with AI`,desc:`Protect files, secrets, and git history from coding agents.`,cta:`Install pack`}),(0,G.jsx)(hf,{href:`/guardrails?starter=knowledge-work`,tone:`indigo`,type:`docs`,title:`Guard sensitive content`,desc:`Watch outbound email, file shares, and document changes.`,cta:`Install pack`}),(0,G.jsx)(hf,{href:`/audit`,tone:`blue`,type:`review`,title:`Review what your AI did`,desc:`Every action, decision, and reason — in one place.`,cta:`Open activity`})]})}),(0,G.jsxs)(`a`,{href:`/try`,className:`group flex items-center justify-between gap-3 rounded-xl px-4 py-3 transition-all`,style:{border:`0.5px solid var(--color-line-1)`,background:`linear-gradient(90deg, color-mix(in oklab, var(--color-accent) 8%, transparent) 0%, transparent 60%), var(--color-surface-1)`,textDecoration:`none`,color:`inherit`},children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-full shrink-0`,style:{background:`linear-gradient(180deg, var(--color-accent) 0%, var(--color-brand-hover) 100%)`,color:`var(--color-accent-on)`,boxShadow:`inset 0 0.5px 0 rgba(255,255,255,0.30), 0 2px 8px color-mix(in oklab, var(--color-accent) 30%, transparent)`},children:(0,G.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`polygon`,{points:`6 4 20 12 6 20`,fill:`currentColor`,stroke:`none`})})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-semibold text-[13.5px] leading-tight`,style:{color:`var(--color-fg-0)`,letterSpacing:`-0.005em`},children:`Try a scenario — see SigmaShake decide`}),(0,G.jsx)(`div`,{className:`text-[12px] mt-0.5`,style:{color:`var(--color-fg-3)`},children:`30-second dry-run · nothing actually runs.`})]})]}),(0,G.jsxs)(`span`,{className:`text-[12.5px] font-medium shrink-0 inline-flex items-center gap-1 transition-all`,style:{color:`var(--color-accent)`},children:[`Try it`,(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-hover:translate-x-0.5`,children:`→`})]})]}),(0,G.jsxs)(`section`,{children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between mb-2`,children:[(0,G.jsx)(`h2`,{className:`font-semibold tracking-tight`,style:{color:`var(--color-fg-0)`,fontSize:`15px`,letterSpacing:`-0.008em`},children:`Recent activity`}),(0,G.jsx)(`a`,{href:`/audit`,style:{fontSize:`12px`,color:`var(--color-hig-blue)`,fontWeight:500},children:`View all →`})]}),(0,G.jsx)(`div`,{style:{background:`var(--color-surface-1)`,border:`0.5px solid var(--color-line-1)`,borderRadius:`14px`,padding:`4px 16px`,boxShadow:`var(--hig-shadow-1)`},children:(0,G.jsx)(gf,{})})]})]})})}var vf=[{id:`files`,label:`Files & folders`,blurb:`Deleting or changing things on your hard drive`},{id:`secrets`,label:`Secrets & keys`,blurb:`Reading or overwriting credentials and private files`},{id:`network`,label:`Network calls`,blurb:`Reaching out to websites and external APIs`},{id:`install`,label:`Installing software`,blurb:`Pulling new code or packages from the internet`},{id:`communication`,label:`Sending messages`,blurb:`Outgoing emails, posts, or chat messages`}],yf=[{id:`erase-folder`,label:`AI tries to erase a folder`,plainEffect:`Permanently deletes every file inside the "output" folder. Recovery is hard.`,category:`files`,emoji:`🗑️`,toolCall:{tool:`Bash`,input:{command:`find ./output -type f -delete`}},displayByOs:{windows:`Remove-Item .\\output -Recurse -Force`,macos:`find ./output -type f -delete`,linux:`find ./output -type f -delete`}},{id:`write-env`,label:`AI tries to write your .env file`,plainEffect:`Overwrites the file that holds your API keys, passwords, and other secrets.`,category:`secrets`,emoji:`⚠️`,toolCall:{tool:`Write`,input:{file_path:`.env`,content:`API_KEY=test`}}},{id:`read-ssh-key`,label:`AI tries to read your private key`,plainEffect:`Opens the SSH key that proves you are you on remote servers. Copying it is identity theft.`,category:`secrets`,emoji:`🔑`,toolCall:{tool:`Read`,input:{file_path:`~/.ssh/id_rsa`}},displayByOs:{windows:`Read C:\\Users\\You\\.ssh\\id_rsa`,macos:`Read ~/.ssh/id_rsa`,linux:`Read ~/.ssh/id_rsa`}},{id:`install-package`,label:`AI tries to install a package`,plainEffect:`Downloads code from a public registry and adds it to your project. The code runs with your permissions.`,category:`install`,emoji:`📦`,toolCall:{tool:`Bash`,input:{command:`npm install some-package --save`}}},{id:`fetch-web`,label:`AI tries to fetch a URL`,plainEffect:`Makes a web request to an outside service. Could leak data or pull in instructions.`,category:`network`,emoji:`🌐`,toolCall:{tool:`WebFetch`,input:{url:`https://api.example.com/data`,prompt:``}}},{id:`send-email`,label:`AI tries to send an email`,plainEffect:`Sends an email from your machine without your review. Anyone could end up CC’d.`,category:`communication`,emoji:`📧`,toolCall:{tool:`Bash`,input:{command:`sendmail -t < message.txt`}},displayByOs:{windows:`Send-MailMessage -To you@example.com -Subject "..." -Body (Get-Content message.txt)`,macos:`sendmail -t < message.txt`,linux:`sendmail -t < message.txt`}}],bf=`ssg.tryit.intro-dismissed.v1`,xf=`ssg.tryit.os.v1`,Sf={allow:{label:`Allowed`,color:`text-emerald-300`,bg:`border-emerald-500/30 bg-emerald-500/5`,icon:`✓`,headline:`SSG would let this happen.`,next:`In real life, the AI would go ahead. If you would rather it didn’t, add a rule on the Rules page.`},block:{label:`Blocked`,color:`text-red-300`,bg:`border-red-500/30 bg-red-500/5`,icon:`✕`,headline:`SSG would stop this from running.`,next:`The AI never gets to perform the action. No files change, no commands run, no requests go out.`},ask:{label:`Ask first`,color:`text-amber-300`,bg:`border-amber-500/30 bg-amber-500/5`,icon:`?`,headline:`SSG would pause and ask you first.`,next:`You’d get a prompt on the Approvals page. Nothing happens until you click Allow or Deny.`},log:{label:`Logged`,color:`text-sky-300`,bg:`border-sky-500/30 bg-sky-500/5`,icon:`≡`,headline:`SSG would allow it but write it down.`,next:`The AI proceeds, and the action gets recorded in your Activity log for later review.`},force:{label:`Force-allow`,color:`text-violet-300`,bg:`border-violet-500/30 bg-violet-500/5`,icon:`→`,headline:`A high-priority rule explicitly allows this.`,next:`A “force” rule overrides anything that would have blocked or paused this action.`}};function Cf(){if(typeof window>`u`)return`linux`;try{let e=window.localStorage.getItem(xf);if(e===`windows`||e===`macos`||e===`linux`)return e}catch{}let e=navigator.userAgent.toLowerCase();return e.includes(`win`)?`windows`:e.includes(`mac`)?`macos`:`linux`}function wf(e){return e===`windows`?`Windows`:e===`macos`?`Mac`:`Linux`}function Tf(e){return e===`windows`?`⊞`:e===`macos`?`🍎`:`🐧`}function Ef(e,t){let n=e.displayByOs?.[t];if(n)return n;let r=e.toolCall;return r.input.command?r.input.command:r.input.file_path?r.input.file_path:r.input.url?r.input.url:JSON.stringify(r.input)}function Df({n:e,label:t}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center w-5 h-5 rounded-full bg-[var(--color-brand)]/15 text-[var(--color-brand)] text-[10px] font-semibold shrink-0`,children:e}),(0,G.jsx)(`span`,{className:`text-[11.5px] text-[var(--color-fg-2)] truncate`,children:t})]})}function Of({os:e,setOs:t}){return(0,G.jsx)(`div`,{className:`inline-flex items-center gap-1 rounded-full border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-0.5`,children:[`windows`,`macos`,`linux`].map(n=>(0,G.jsxs)(`button`,{onClick:()=>t(n),className:`px-2.5 py-1 rounded-full text-[10.5px] font-medium cursor-pointer transition-colors ${n===e?`bg-[var(--color-brand)]/15 text-[var(--color-brand)]`:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)]`}`,title:`Show commands as they would look on ${wf(n)}`,children:[Tf(n),` `,wf(n)]},n))})}function kf({os:e,setOs:t,onDismiss:n}){return(0,G.jsxs)(`div`,{className:`rounded-2xl border border-[var(--color-brand)]/25 bg-[var(--color-brand)]/[0.04] p-4 sm:p-5 space-y-3.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-[15px] font-semibold text-[var(--color-fg-0)] leading-tight`,children:`What SSG does — and why this page is here`}),(0,G.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] mt-1 leading-relaxed max-w-[60ch]`,children:[`AI coding agents can run any command on your computer: delete files, read your secrets, send emails, install packages. SSG is the policy engine that decides which of those they’re actually allowed to do.`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-0)] font-medium`,children:`This sandbox shows SSG’s decisions in real time`}),`, without anything actually running. Pick a scenario, click Run, see what your guardrails would do.`]})]}),(0,G.jsx)(`button`,{onClick:n,className:`shrink-0 text-[var(--color-fg-4)] hover:text-[var(--color-fg-1)] cursor-pointer text-[14px] leading-none p-1 -m-1`,"aria-label":`Dismiss intro`,title:`Hide this primer`,children:`✕`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1.5 text-[11.5px]`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-emerald-300`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-emerald-400`}),`Nothing executes`]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-emerald-300`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-emerald-400`}),`No files modified`]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-emerald-300`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-emerald-400`}),`No network traffic`]})]}),(0,G.jsxs)(`div`,{className:`rounded-xl border border-[var(--color-line-1)]/60 bg-[var(--color-surface-1)]/40 p-3`,children:[(0,G.jsx)(`p`,{className:`text-[10.5px] uppercase tracking-wide text-[var(--color-fg-3)] font-semibold mb-2`,children:`How it works`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-3`,children:[(0,G.jsx)(Df,{n:1,label:`Pick a scenario below`}),(0,G.jsx)(Df,{n:2,label:`Click Run`}),(0,G.jsx)(Df,{n:3,label:`See the decision SSG would make`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[(0,G.jsx)(`span`,{className:`text-[11.5px] text-[var(--color-fg-3)]`,children:`Showing commands as they look on`}),(0,G.jsx)(Of,{os:e,setOs:t}),(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-4)]`,children:`(cosmetic — SSG’s decision is the same on every OS)`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap pt-1`,children:[(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)] italic max-w-[44ch] leading-snug`,children:`Every AI agent will need a policy layer. This is what one looks like.`}),(0,G.jsx)(`button`,{onClick:n,className:`text-[11.5px] font-medium text-[var(--color-fg-2)] hover:text-[var(--color-fg-0)] cursor-pointer underline-offset-2 hover:underline`,children:`Got it, hide this primer`})]})]})}function Af({scenario:e,selected:t,os:n,onClick:r}){return(0,G.jsxs)(`button`,{onClick:r,className:`flex flex-col gap-1.5 rounded-xl border px-3.5 py-3 text-left cursor-pointer transition-all ${t?`border-[var(--color-brand)]/60 bg-[var(--color-brand)]/8 shadow-[0_0_0_3px_color-mix(in_oklab,var(--color-brand)_15%,transparent)]`:`border-[var(--color-line-1)] bg-[var(--color-surface-1)] hover:border-[var(--color-line-2)] hover:bg-[var(--color-surface-2)]/40`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[18px] leading-none shrink-0`,children:e.emoji}),(0,G.jsx)(`span`,{className:`text-[13px] font-medium text-[var(--color-fg-0)] leading-snug flex-1 min-w-0`,children:e.label})]}),(0,G.jsx)(`p`,{className:`text-[11.5px] text-[var(--color-fg-3)] leading-snug`,children:e.plainEffect}),(0,G.jsx)(`p`,{className:`font-mono text-[10.5px] text-[var(--color-fg-4)] truncate`,children:Ef(e,n)})]})}function jf(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(`Bash`),[f,p]=(0,_.useState)(`{"command": ""}`),[m,h]=(0,_.useState)(()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(bf)===`1`}catch{return!1}}),[g,v]=(0,_.useState)(()=>Cf()),[y,b]=(0,_.useState)(!1);function x(e){v(e);try{window.localStorage.setItem(xf,e)}catch{}}function S(){h(!0);try{window.localStorage.setItem(bf,`1`)}catch{}}function C(){h(!1);try{window.localStorage.removeItem(bf)}catch{}}let w=yf.find(t=>t.id===e),T=(0,_.useMemo)(()=>{let e=new Map;for(let t of yf){let n=e.get(t.category)??[];n.push(t),e.set(t.category,n)}return vf.filter(t=>e.has(t.id)).map(t=>({...t,scenarios:e.get(t.id)}))},[]);(0,_.useEffect)(()=>{(n||o)&&window.scrollTo({top:(document.getElementById(`tryit-result`)?.offsetTop??0)-80,behavior:`smooth`})},[n,o]),(0,_.useEffect)(()=>{if(typeof window>`u`)return;let e=new URLSearchParams(window.location.search).get(`scenario`);e&&yf.some(t=>t.id===e)&&t(e)},[]),(0,_.useEffect)(()=>{if(typeof window>`u`)return;let t=new URL(window.location.href);e?t.searchParams.set(`scenario`,e):t.searchParams.delete(`scenario`),window.history.replaceState({},``,t.toString())},[e]);function E(){if(!e)return;let t=new URL(window.location.href);t.searchParams.set(`scenario`,e),navigator.clipboard.writeText(t.toString()).then(()=>{b(!0),setTimeout(()=>b(!1),2e3)}).catch(()=>{})}async function D(e){a(!0),s(null),r(null);try{let t=await(await fetch(`/api/json/eval-dry-run`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify(e)})).json();t.error?s(t.error):r(t)}catch{s(`Could not reach the governance engine. Is SSG running?`)}finally{a(!1)}}function O(){w&&D(w.toolCall)}function ee(){let e;try{e=JSON.parse(f)}catch{s(`Invalid JSON in input field.`);return}if(typeof e!=`object`||!e){s(`Input must be a JSON object.`);return}D({tool:u,input:e})}let k=n?Sf[n.decision]??Sf.allow:null;return(0,G.jsxs)(`div`,{className:`max-w-3xl mx-auto py-4 space-y-4`,children:[(0,G.jsxs)(`header`,{className:`flex items-baseline justify-between gap-4 flex-wrap`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-[22px] font-semibold text-[var(--color-fg-0)] tracking-tight leading-tight`,children:`Try it`}),(0,G.jsxs)(`p`,{className:`text-[13px] text-[var(--color-fg-2)] mt-0.5`,children:[`Your AI can run any command. SSG decides what it’s actually allowed to do.`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`Pick a scenario to see — nothing actually runs.`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[m&&(0,G.jsx)(`button`,{onClick:C,className:`text-[11.5px] font-medium text-[var(--color-fg-3)] hover:text-[var(--color-fg-0)] cursor-pointer`,title:`Show the introduction again`,children:`What is Try It? →`}),(0,G.jsx)(`a`,{href:`/guardrails`,className:`text-[11.5px] font-medium text-[var(--color-brand)] hover:underline`,children:`Install more guardrails →`})]})]}),!m&&(0,G.jsx)(kf,{os:g,setOs:x,onDismiss:S}),m&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1`,children:[(0,G.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-4)]`,children:`Commands shown as on`}),(0,G.jsx)(Of,{os:g,setOs:x})]}),(0,G.jsx)(`div`,{className:`space-y-4`,children:T.map(n=>(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 px-1`,children:[(0,G.jsx)(`h3`,{className:`text-[11px] uppercase tracking-wide text-[var(--color-fg-3)] font-semibold`,children:n.label}),(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-4)]`,children:n.blurb})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:n.scenarios.map(n=>(0,G.jsx)(Af,{scenario:n,selected:e===n.id,os:g,onClick:()=>{t(n.id),r(null),s(null)}},n.id))})]},n.id))}),w&&(0,G.jsxs)(`div`,{className:`rounded-xl border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`text-[22px] leading-none shrink-0`,children:w.emoji}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-[13.5px] font-medium text-[var(--color-fg-0)]`,children:w.label}),(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] mt-0.5 leading-relaxed`,children:w.plainEffect})]})]}),(0,G.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line-0)] bg-[var(--color-surface-0)] px-3 py-2`,children:[(0,G.jsxs)(`p`,{className:`text-[10px] uppercase tracking-wide text-[var(--color-fg-4)] font-semibold mb-1`,children:[`What the AI would run · `,wf(g)]}),(0,G.jsx)(`code`,{className:`font-mono text-[12px] text-[var(--color-fg-1)] break-all`,children:Ef(w,g)})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,G.jsxs)(`p`,{className:`text-[11.5px] text-[var(--color-fg-3)]`,children:[`Click Run to see what SSG would decide.`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-4)]`,children:`The command does not actually execute.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(`button`,{onClick:E,className:`inline-flex items-center gap-1 px-3 h-8 rounded-full text-[11.5px] font-medium cursor-pointer transition-colors
27
+ border border-[var(--color-line-1)] bg-[var(--color-surface-1)] text-[var(--color-fg-2)]
28
+ hover:bg-[var(--color-surface-2)]/40 hover:text-[var(--color-fg-0)]`,title:`Copy a deep-link to this exact scenario`,children:y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M20 6L9 17l-5-5`})}),`Link copied`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M10 13a5 5 0 0 0 7.07 0l3-3a5 5 0 0 0-7.07-7.07l-1.5 1.5M14 11a5 5 0 0 0-7.07 0l-3 3a5 5 0 0 0 7.07 7.07l1.5-1.5`})}),`Copy share link`]})}),(0,G.jsx)(`button`,{onClick:O,disabled:i,className:`inline-flex items-center gap-1.5 px-4 h-8 rounded-full text-[12px] font-medium cursor-pointer transition-colors
29
+ bg-[var(--color-brand)] text-white hover:opacity-90
30
+ disabled:opacity-40 disabled:cursor-not-allowed`,children:i?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`svg`,{className:`animate-spin`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:(0,G.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),`Running`]}):(0,G.jsxs)(G.Fragment,{children:[`Run simulation`,(0,G.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M5 12h14M13 5l7 7-7 7`})})]})})]})]})]}),n&&k&&(0,G.jsxs)(`div`,{id:`tryit-result`,className:`rounded-xl border p-4 ${k.bg} space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center w-9 h-9 rounded-full text-lg font-bold border ${k.bg} ${k.color}`,children:k.icon}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-[15px] font-semibold ${k.color}`,children:k.label}),(0,G.jsx)(`p`,{className:`text-[12.5px] mt-0.5 ${k.color} opacity-90`,children:k.headline})]})]}),(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-1)] leading-relaxed`,children:k.next}),(0,G.jsxs)(`div`,{className:`rounded-lg bg-[var(--color-surface-0)]/60 border border-[var(--color-line-0)] px-3 py-2 space-y-1`,children:[(0,G.jsx)(`p`,{className:`text-[10px] uppercase tracking-wide text-[var(--color-fg-4)] font-semibold`,children:`Why this decision`}),(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-1)] leading-relaxed`,children:n.reason??`No specific rule matched this action — SSG defaults to allowing things that aren’t covered by a rule.`}),(0,G.jsxs)(`p`,{className:`text-[10.5px] text-[var(--color-fg-3)] mt-1.5`,children:[n.rules_evaluated,` rule`,n.rules_evaluated===1?``:`s`,` checked`,n.rule_id&&(0,G.jsxs)(G.Fragment,{children:[` `,`· matched`,` `,(0,G.jsx)(`a`,{href:`/rules?focus=${encodeURIComponent(n.rule_id)}`,className:`font-mono text-[var(--color-brand)] hover:underline`,children:n.rule_id})]})]})]}),w&&(0,G.jsxs)(`div`,{className:`rounded-lg border border-[var(--color-line-0)] bg-[var(--color-surface-0)]/60 px-3 py-2.5 flex items-start gap-2.5`,children:[(0,G.jsx)(`span`,{className:`text-[15px] leading-none mt-0.5 shrink-0`,children:n.decision===`block`?`🛡️`:n.decision===`allow`?`⚠️`:n.decision===`ask`?`⏸️`:`ℹ️`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-[10.5px] uppercase tracking-wide text-[var(--color-fg-4)] font-semibold`,children:n.decision===`block`?`What you just avoided`:n.decision===`allow`?`What this would actually do`:n.decision===`ask`?`What you’d be asked to confirm`:`What gets recorded`}),(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-1)] leading-relaxed mt-0.5`,children:w.plainEffect})]})]}),n.decision===`allow`&&(0,G.jsxs)(`a`,{href:`/guardrails`,className:`inline-flex items-center gap-1.5 px-3.5 h-8 rounded-full text-[12px] font-medium
31
+ bg-[var(--color-brand)] text-white hover:opacity-90 transition-colors`,children:[`Add a rule to block this`,(0,G.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M5 12h14M13 5l7 7-7 7`})})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1.5 text-[11.5px] pt-1`,children:[n.decision===`block`&&(0,G.jsx)(`a`,{href:`/rules`,className:`font-medium text-[var(--color-brand)] hover:underline`,children:`See the rule that did this →`}),n.decision===`ask`&&(0,G.jsx)(`a`,{href:`/approvals`,className:`font-medium text-[var(--color-brand)] hover:underline`,children:`See where the prompt appears →`}),(0,G.jsx)(`a`,{href:`/audit`,className:`font-medium text-[var(--color-fg-2)] hover:text-[var(--color-fg-0)] hover:underline`,children:`See real decisions in your Activity log →`}),(0,G.jsx)(`a`,{href:`https://sigmashake.com`,target:`_blank`,rel:`noreferrer`,className:`font-medium text-[var(--color-fg-2)] hover:text-[var(--color-fg-0)] hover:underline`,children:`Tell a teammate about SSG ↗`})]})]}),o&&(0,G.jsx)(`div`,{className:`rounded-xl border border-red-500/30 bg-red-500/5 px-4 py-3 text-[12px] text-red-300`,children:o}),(0,G.jsxs)(`div`,{className:`pt-2`,children:[(0,G.jsx)(`button`,{onClick:()=>l(e=>!e),className:`text-[11px] text-[var(--color-fg-4)] hover:text-[var(--color-fg-2)] transition-colors cursor-pointer`,children:c?`▲ Hide custom input`:`▼ Advanced: write your own scenario`}),c&&(0,G.jsxs)(`div`,{className:`mt-3 rounded-xl border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3 space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-[11px] text-[var(--color-fg-3)] leading-relaxed`,children:`Pick a tool the AI would call, and the input it would pass. Same idea as the scenarios above — still a simulation, still nothing actually runs.`}),(0,G.jsxs)(`div`,{className:`flex items-end gap-2 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:`Tool`}),(0,G.jsx)(`select`,{value:u,onChange:e=>d(e.target.value),className:`bg-[var(--color-surface-0)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] font-mono rounded-md px-2 h-8 focus:outline-none`,children:[`Bash`,`Read`,`Write`,`Edit`,`WebFetch`,`WebSearch`,`Agent`,`Glob`,`Grep`].map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))})]}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-[200px] flex flex-col gap-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-mono text-[var(--color-fg-3)]`,children:`Input JSON`}),(0,G.jsx)(`input`,{type:`text`,value:f,onChange:e=>p(e.target.value),className:`w-full bg-[var(--color-surface-0)] border border-[var(--color-line-1)] text-[var(--color-fg-1)] text-[11px] font-mono rounded-md px-2 h-8 focus:outline-none focus:border-[var(--color-brand)]/50`})]}),(0,G.jsx)(`button`,{onClick:ee,disabled:i,className:`px-3 h-8 rounded-full text-[11px] font-medium cursor-pointer transition-colors
32
+ bg-[var(--color-fg-1)] text-[var(--color-bg)] hover:opacity-90
33
+ disabled:opacity-40 disabled:cursor-not-allowed`,children:`Run`})]})]})]})]})}var Mf=`http://www.w3.org/2000/svg`;function Nf({markup:e,size:t=22}){let n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=n.current;if(!t)return;for(;t.firstChild;)t.removeChild(t.firstChild);let r=`<svg xmlns="${Mf}">${e}</svg>`,i=new DOMParser().parseFromString(r,`image/svg+xml`).documentElement;for(let e of Array.from(i.childNodes))t.appendChild(t.ownerDocument.importNode(e,!0))},[e]),(0,G.jsx)(`svg`,{ref:n,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,width:t,height:t,"aria-hidden":`true`})}function Pf({a:e,size:t=40}){return(0,G.jsx)(`div`,{className:`agent-card-icon shrink-0`,style:{width:t,height:t,color:e.accent,background:`color-mix(in oklab, ${e.accent} 16%, var(--color-surface-2))`,borderColor:`color-mix(in oklab, ${e.accent} 38%, var(--color-line-1))`},children:(0,G.jsx)(Nf,{markup:e.glyph,size:Math.round(t*.55)})})}function Ff({a:e}){return e.active?(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 16%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 38%, transparent)`},children:`Active`}):e.detected?(0,G.jsxs)(`span`,{className:`agent-badge agent-badge--detected`,children:[(0,G.jsx)(`span`,{className:`agent-badge-dot`}),`Detected`]}):e.recommended?(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 12%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 30%, transparent)`},children:`Recommended`}):null}function If(){return(0,G.jsx)(`svg`,{className:`ss-list-row-chevron`,viewBox:`0 0 16 16`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M5 3l5 5-5 5`})})}function Lf({text:e}){let[t,n]=(0,_.useState)(!1);return(0,G.jsx)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},className:`ss-btn ss-btn--secondary`,style:{height:32,padding:`0 12px`,fontSize:12},"aria-label":t?`Copied`:`Copy`,children:t?`Copied ✓`:`Copy`})}function Rf(e,t){return t&&e.startsWith(t)?`~`+e.slice(t.length):e}function zf({agent:e,ctx:t,onClose:n,onInstalled:r}){let[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),C=`ssg init --client=${e.id}`;async function w(){b(!0),S(null);try{let e=await(await fetch(`/api/json/pick-dir`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()}})).json();e.ok?a(e.path):e.reason===`user_cancelled`||(e.reason===`no_display`?S(`No graphical session — type the path manually instead.`):e.reason===`no_picker_found`?S("Folder picker not available. Install `zenity` (Linux), or type the path manually."):S(e.error||`Folder picker failed.`))}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}}(0,_.useEffect)(()=>{let e=!1;return fetch(`/api/json/adapters/recent`).then(e=>e.json()).then(t=>{e||(s(t.recents??[]),!i&&t.recents&&t.recents.length>0&&a(t.recents[0].path))}).catch(()=>{}),()=>{e=!0}},[]);async function T(){if(i.trim()){l(!0),h(null),v(!1);try{let t=await(await fetch(`/api/json/adapters/install`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({adapter:e.id,projectDir:i})})).json();h(t),t.ok&&(r(),fetch(`/api/json/adapters/recent`).then(e=>e.json()).then(e=>s(e.recents??[])).catch(()=>{}))}catch(t){h({ok:!1,exitCode:-1,adapter:e.id,projectDir:i,stdout:``,stderr:``,error:t instanceof Error?t.message:String(t)})}finally{l(!1)}}}async function E(e){d(!0),p(null);try{let t=await(await fetch(`/api/json/adapters/active`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({adapter:e})})).json();t.ok?r():p(t.error??`Failed to pin adapter.`)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}let D=c||!i.trim(),O=c?`Connecting…`:i.trim()?`Connect this project`:`Pick a project directory`,ee=u?`Saving…`:e.pinned?`Pinned ✓`:`Set as my agent`,k=u||e.pinned;return(0,G.jsxs)(vl,{open:!0,onClose:n,title:e.displayName,subtitle:e.vendor,size:`md`,footer:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--secondary`,disabled:D,onClick:()=>void T(),title:"Run `ssg init --client` in the chosen project directory.",children:O}),(0,G.jsx)(`button`,{type:`button`,className:`ss-btn ss-btn--primary`,disabled:k,onClick:()=>void E(e.id),style:{"--tone":e.accent},title:e.pinned?`Already pinned as your default agent.`:`Pin ${e.displayName} as the default — overrides auto-detection across SSG.`,children:ee})]}),children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-4 mb-4`,children:[(0,G.jsx)(Pf,{a:e,size:56}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap mb-1.5`,children:[(0,G.jsx)(Ff,{a:e}),e.pinned&&(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 14%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 36%, transparent)`},title:`You pinned this agent as your default.`,children:`Pinned`}),e.healthy&&!e.active&&(0,G.jsx)(`span`,{className:`text-[10.5px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`healthy`})]}),(0,G.jsx)(`p`,{className:`text-[13px] text-[var(--color-fg-1)] leading-relaxed`,children:e.tagline}),e.pinned&&(0,G.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>void E(null),className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-brand)] mt-2 cursor-pointer hover:underline`,children:u?`unpinning…`:`unpin & return to auto-detect`}),f&&(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-hig-red)] mt-2`,children:f})]})]}),(0,G.jsx)(`p`,{className:`ss-list-section-title`,children:`Install target`}),(0,G.jsxs)(`div`,{className:`ss-list mb-4`,children:[(0,G.jsx)(`div`,{className:`ss-list-row`,style:{cursor:`default`},onClick:e=>e.preventDefault(),children:(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-[12.5px] font-medium text-[var(--color-fg-1)]`,children:`Project directory`}),(0,G.jsx)(`p`,{className:`text-[11px] font-mono text-[var(--color-fg-3)] mt-0.5 truncate`,children:i.trim()?Rf(i,t.home):`Type a path or pick from below.`})]})}),(0,G.jsxs)(`div`,{style:{padding:`10px 14px`,borderTop:`1px solid var(--color-line-0)`},children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),spellCheck:!1,placeholder:`Click Browse… or paste a path`,className:`flex-1 h-9 px-3 rounded-md text-[12px] font-mono`,style:{background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`,color:`var(--color-fg-1)`,outline:`none`}}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:y,className:`ss-btn ss-btn--secondary`,style:{height:36,padding:`0 14px`,fontSize:12},title:`Open the system folder picker.`,children:y?`Opening…`:`Browse…`})]}),x&&(0,G.jsx)(`p`,{className:`text-[11px] font-mono mt-2`,style:{color:`var(--color-hig-red)`},children:x}),o.length>0&&(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsx)(`p`,{className:`text-[10.5px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:`Recent`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(e.path),className:`text-[11px] font-mono px-2 py-1 rounded-md cursor-pointer`,style:{background:i===e.path?`color-mix(in oklab, var(--color-brand) 14%, var(--color-surface-2))`:`var(--color-surface-2)`,border:`1px solid ${i===e.path?`color-mix(in oklab, var(--color-brand) 38%, var(--color-line-1))`:`var(--color-line-1)`}`,color:i===e.path?`var(--color-brand)`:`var(--color-fg-1)`},title:e.path,children:Rf(e.path,t.home)},e.path))})]})]})]}),(0,G.jsx)(`p`,{className:`ss-list-section-title`,children:`Or run from terminal`}),(0,G.jsxs)(`div`,{className:`ss-list mb-4 p-3 flex items-center gap-2`,style:{padding:`12px 14px`},children:[(0,G.jsxs)(`code`,{className:`flex-1 text-[12px] font-mono text-[var(--color-brand)] overflow-x-auto whitespace-nowrap`,children:[`$ `,C]}),(0,G.jsx)(Lf,{text:C})]}),m&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`ss-list-section-title`,children:m.ok?`Setup complete`:`Setup failed`}),(0,G.jsx)(Bf,{result:m}),(m.stdout||m.stderr||m.error)&&(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsx)(`button`,{type:`button`,className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-brand)] cursor-pointer`,onClick:()=>v(e=>!e),children:g?`▾ Hide full log`:`▸ Show full log`}),g&&(0,G.jsx)(`pre`,{className:`text-[11px] font-mono rounded-md p-3 mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-all`,style:{background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`,color:`var(--color-fg-2)`},children:m.error?`${m.error}${m.detail?`
31
34
  `+m.detail:``}`:[m.stdout,m.stderr].filter(Boolean).join(`
32
- `)||`Exit code: ${m.exitCode}`})]})]})]})}function Af({result:e}){return(0,G.jsx)(`ul`,{className:`ss-install-checklist`,children:(e.steps&&e.steps.length>0?e.steps:[{label:e.ok?`Setup complete`:`Setup failed`,status:e.ok?`ok`:`error`,detail:e.error??void 0}]).map((e,t)=>(0,G.jsxs)(`li`,{className:`ss-install-step ss-install-step--${e.status}`,children:[(0,G.jsx)(`span`,{className:`ss-install-step__icon`,"aria-hidden":`true`,children:e.status===`ok`?`✓`:e.status===`error`?`✗`:`–`}),(0,G.jsxs)(`div`,{className:`ss-install-step__body`,children:[(0,G.jsx)(`span`,{className:`ss-install-step__label`,children:e.label}),e.detail&&(0,G.jsx)(`span`,{className:`ss-install-step__detail`,children:e.detail})]})]},t))})}function jf({a:e,onOpen:t}){return(0,G.jsxs)(`button`,{type:`button`,className:`ss-list-row`,onClick:t,"aria-label":`Open ${e.displayName} details`,children:[(0,G.jsx)(wf,{a:e,size:34}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`text-[13.5px] font-semibold text-[var(--color-fg-0)] truncate`,children:e.displayName}),(0,G.jsx)(Tf,{a:e}),e.pinned&&!e.active&&(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 12%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 30%, transparent)`},children:`Pinned`})]}),(0,G.jsx)(`p`,{className:`text-[10.5px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mt-0.5`,children:e.vendor})]}),(0,G.jsx)(Ef,{})]})}function Mf(){let{data:e,refetch:t}=B(`/api/json/adapters`),[n,r]=(0,_.useState)(`all`),[i,a]=(0,_.useState)(null),o=(0,_.useMemo)(()=>e?n===`detected`?e.adapters.filter(e=>e.detected):n===`available`?e.adapters.filter(e=>!e.detected):e.adapters:[],[e,n]);if(!e)return(0,G.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading adapters…`});let s=e.adapters.find(e=>e.active),c=e.adapters.filter(e=>e.detected).length,l=i?e.adapters.find(e=>e.id===i):null;return(0,G.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,G.jsxs)(`section`,{className:`rounded-2xl p-5 relative overflow-hidden`,style:{border:`1px solid var(--color-line-1)`,background:s?`linear-gradient(180deg, color-mix(in oklab, ${s.accent} 14%, transparent) 0%, transparent 70%), var(--color-surface-1)`:`var(--color-surface-1)`,boxShadow:s?`0 0 0 1px color-mix(in oklab, ${s.accent} 30%, transparent), 0 18px 40px color-mix(in oklab, ${s.accent} 14%, transparent)`:void 0},children:[(0,G.jsx)(`p`,{className:`ss-list-section-title`,style:{padding:0,marginBottom:12},children:`Connected agent`}),s?(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(wf,{a:s,size:56}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`h2`,{className:`text-[18px] font-semibold text-[var(--color-fg-0)] tracking-tight`,children:s.displayName}),(0,G.jsx)(Tf,{a:s}),s.pinned?(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:s.accent,background:`color-mix(in oklab, ${s.accent} 14%, transparent)`,borderColor:`color-mix(in oklab, ${s.accent} 36%, transparent)`},title:`You pinned this agent as your default — auto-detection is overridden.`,children:`Pinned`}):(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:`var(--color-fg-3)`,background:`var(--color-surface-2)`,borderColor:`var(--color-line-1)`},title:`SSG auto-detected this agent from process env and filesystem markers.`,children:`Auto-detected`})]}),(0,G.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mt-0.5`,children:s.vendor}),(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] mt-2 leading-relaxed`,children:s.pinned?`Pinned as your default agent — SSG will treat every tool call as ${s.displayName} regardless of auto-detection.`:s.id===`generic`?`No specific AI client detected — falling back to the generic adapter. Pick the agent you actually use and hit "Set as my agent" to override.`:s.healthy?`Auto-detected from process environment. If this isn't the agent you actually use, tap any other row and hit "Set as my agent" to pin it.`:`Forced via SSG_CLIENT — adapter is in use but its config dir is missing or incomplete.`}),s.pinned&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>{fetch(`/api/json/adapters/active`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({adapter:null})}).then(()=>t())},className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-brand)] mt-3 cursor-pointer hover:underline`,children:`↺ reset to auto-detect`})]})]}):(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-2)]`,children:`No active adapter resolved.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`p`,{className:`ss-list-section-title`,style:{padding:0,marginBottom:0},children:[`All supported agents · `,e.adapters.length]}),(0,G.jsx)(`div`,{className:`ss-segment`,role:`tablist`,"aria-label":`Filter`,children:[`all`,`detected`,`available`].map(e=>(0,G.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":n===e,className:`ss-segment-item`,onClick:()=>r(e),children:e===`all`?`All`:e===`detected`?`Detected${c>0?` · ${c}`:``}`:`Available`},e))})]}),o.length>0?(0,G.jsx)(`div`,{className:`ss-list`,children:o.map(e=>(0,G.jsx)(jf,{a:e,onOpen:()=>a(e.id)},e.id))}):(0,G.jsx)(`div`,{className:`rounded-2xl p-8 text-center`,style:{border:`1px dashed var(--color-line-1)`,background:`color-mix(in oklab, var(--color-surface-1) 50%, transparent)`},children:(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-3)] font-mono`,children:`no agents match this filter`})}),(0,G.jsx)(`div`,{className:`rounded-xl p-4`,style:{border:`1px dashed var(--color-line-1)`,background:`color-mix(in oklab, var(--color-surface-1) 50%, transparent)`},children:(0,G.jsxs)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:[`SSG picks the active adapter at runtime — either from`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`SSG_CLIENT`}),` `,`or by auto-detecting your tool. Tap any agent to wire it into a project from the dashboard, or copy the`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg init`}),` command and run it yourself.`]})}),(0,G.jsx)(Nf,{ctx:e.context,adapters:e.adapters}),(0,G.jsx)(Ff,{}),l&&(0,G.jsx)(kf,{agent:l,ctx:e.context,onClose:()=>a(null),onInstalled:()=>t()})]})}function Nf({ctx:e,adapters:t}){let{data:n}=B(`/api/json/adapters/recent`),r=t.find(e=>e.active)??null,i=t.filter(e=>e.detected);return(0,G.jsxs)(`section`,{className:`rounded-2xl p-5`,style:{border:`1px solid var(--color-line-1)`,background:`var(--color-surface-1)`},children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between mb-3`,children:[(0,G.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight text-[var(--color-fg-0)]`,children:`How SigmaShake is connected`}),(0,G.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)]`,children:`Overview`})]}),(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] leading-relaxed mb-4`,children:`Each AI agent on your machine has its own config file. SigmaShake adds a small hook to those files so it sees every tool call before it runs.`}),(0,G.jsxs)(`ul`,{className:`space-y-2`,children:[(0,G.jsx)(Pf,{label:`Daemon`,status:`on`,detail:`Running — watching tool calls in real time.`}),(0,G.jsx)(Pf,{label:`Active AI agent`,status:r?`on`:`off`,detail:r?`${r.displayName} (${r.vendor})`:`Nothing detected yet — install an adapter below.`}),(0,G.jsx)(Pf,{label:`Wired-in agents`,status:i.length>0?`on`:`off`,detail:i.length>0?i.map(e=>e.displayName).join(`, `):`No agents wired in yet.`})]}),n?.recents&&n.recents.length>0&&(0,G.jsxs)(`div`,{className:`mt-5`,children:[(0,G.jsxs)(`p`,{className:`text-[11px] uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:[`Projects connected (`,n.recents.length,`)`]}),(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:n.recents.map(t=>(0,G.jsxs)(`li`,{className:`flex items-center gap-3 rounded-lg px-3 py-2 text-[12px]`,style:{background:`var(--color-surface-2)`,border:`0.5px solid var(--color-line-1)`},children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{background:`var(--color-hig-green)`}}),(0,G.jsx)(`span`,{className:`font-mono text-[var(--color-fg-1)] truncate flex-1 min-w-0`,children:Of(t.path,e.home)}),(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)] shrink-0`,children:new Date(t.lastUsed).toLocaleDateString(void 0,{month:`short`,day:`numeric`})})]},t.path))})]})]})}function Pf({label:e,status:t,detail:n}){return(0,G.jsxs)(`li`,{className:`flex items-center gap-3 rounded-lg px-3 py-2`,style:{background:`var(--color-surface-2)`,border:`0.5px solid var(--color-line-1)`},children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:t===`on`?`var(--color-hig-green)`:`var(--color-fg-4)`,boxShadow:t===`on`?`0 0 0 3px color-mix(in oklab, var(--color-hig-green) 22%, transparent)`:void 0}}),(0,G.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--color-fg-0)] w-32 shrink-0`,children:e}),(0,G.jsx)(`span`,{className:`text-[12px] text-[var(--color-fg-2)] flex-1 min-w-0 truncate`,children:n})]})}function Ff(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!0),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null);async function c(){a(!0),s(null);try{s(await(await fetch(`/api/json/uninstall-everything`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({keepData:n})})).json())}catch(e){s({ok:!1,error:`Could not reach SigmaShake`,detail:e instanceof Error?e.message:String(e)})}finally{a(!1)}}return(0,G.jsxs)(`section`,{className:`rounded-2xl p-5`,style:{border:`1px solid color-mix(in oklab, var(--color-hig-red) 28%, var(--color-line-1))`,background:`linear-gradient(180deg, color-mix(in oklab, var(--color-hig-red) 6%, transparent) 0%, transparent 100%), var(--color-surface-1)`},children:[(0,G.jsx)(`div`,{className:`flex items-baseline justify-between gap-3 flex-wrap`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight text-[var(--color-fg-0)]`,children:`Uninstall SigmaShake`}),(0,G.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] leading-relaxed mt-1`,children:[`Removes the SigmaShake hook from every AI-agent config file on this machine and stops the daemon.`,` `,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`The`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg`}),` binary itself stays installed — remove it with your package manager.`]})]})]})}),!e&&!o&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:`mt-4 text-[12.5px] font-medium px-4 py-2 rounded-lg cursor-pointer transition-colors`,style:{color:`var(--color-hig-red)`,border:`1px solid color-mix(in oklab, var(--color-hig-red) 40%, transparent)`,background:`color-mix(in oklab, var(--color-hig-red) 8%, transparent)`},children:`Uninstall SigmaShake everywhere…`}),e&&!o&&(0,G.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,G.jsxs)(`label`,{className:`flex items-start gap-2 text-[12px] text-[var(--color-fg-1)] cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked),className:`mt-0.5`}),(0,G.jsxs)(`span`,{children:[`Keep my activity history and license`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`(~/.sigmashake/). Uncheck to wipe everything.`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>void c(),disabled:i,className:`text-[12.5px] font-medium px-4 py-2 rounded-lg cursor-pointer transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,style:{color:`white`,background:`var(--color-hig-red)`},children:i?`Uninstalling…`:`Yes — uninstall everywhere`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(!1),disabled:i,className:`text-[12.5px] font-medium px-4 py-2 rounded-lg cursor-pointer transition-colors`,style:{color:`var(--color-fg-1)`,background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`},children:`Cancel`})]})]}),o&&(0,G.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg px-4 py-3`,style:{border:`1px solid ${o.ok?`color-mix(in oklab, var(--color-hig-green) 38%, transparent)`:`color-mix(in oklab, var(--color-hig-red) 38%, transparent)`}`,background:o.ok?`color-mix(in oklab, var(--color-hig-green) 6%, transparent)`:`color-mix(in oklab, var(--color-hig-red) 6%, transparent)`},children:[(0,G.jsx)(`p`,{className:`text-[13px] font-semibold`,style:{color:o.ok?`var(--color-hig-green)`:`var(--color-hig-red)`},children:o.ok?`SigmaShake has been removed from this machine`:`Uninstall failed`}),(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] mt-1 leading-relaxed`,children:o.ok?(0,G.jsxs)(G.Fragment,{children:[`Hooks were stripped from every AI-agent config file. The daemon has stopped.`,o.packageManagerHint&&(0,G.jsxs)(G.Fragment,{children:[` `,`To also remove the`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg`}),` `,`binary, run:`,(0,G.jsx)(`code`,{className:`block mt-2 px-2 py-1.5 rounded bg-[var(--color-surface-2)] text-[var(--color-brand)] text-[11.5px] font-mono`,children:o.packageManagerHint})]})]}):(0,G.jsxs)(G.Fragment,{children:[o.error??`Unknown error.`,` `,o.detail&&(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:o.detail})]})})]}),(o.stdout||o.stderr)&&(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{className:`text-[11px] text-[var(--color-fg-3)] cursor-pointer hover:text-[var(--color-fg-1)]`,children:`Show full log`}),(0,G.jsx)(`pre`,{className:`text-[11px] font-mono rounded-md p-3 mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-all`,style:{background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`,color:`var(--color-fg-2)`},children:[o.stdout,o.stderr].filter(Boolean).join(`
33
- `)})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{s(null),t(!1)},className:`text-[11.5px] text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer`,children:`↺ Close`})]})]})}function If(){return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-[20px] font-semibold tracking-tight text-[var(--color-fg-0)] leading-tight`,children:`Notifications`}),(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-3)] mt-1 leading-relaxed`,children:`Things that need your attention — rule drift, audit log capacity, daemon health, noisy rules. We update this list whenever something changes.`})]}),(0,G.jsx)(Ys,{showEmptyState:!0,hideHeader:!0})]})}function Lf({status:e,className:t=``}){return(0,G.jsx)(`span`,{className:`status-dot ${e===`ok`?`bg-[var(--color-decision-allow)]`:e===`warn`?`bg-[var(--color-decision-ask)]`:e===`fail`?`bg-[var(--color-decision-block)]`:`bg-[var(--color-fg-3)]`} ${t}`})}function Rf({status:e}){let t=e===`ok`?`text-[var(--color-decision-allow)]`:e===`warn`?`text-[var(--color-decision-ask)]`:e===`fail`?`text-[var(--color-decision-block)]`:`text-[var(--color-fg-3)]`,n=e===`ok`?`OK`:e===`warn`?`Warn`:e===`fail`?`Fail`:`Skipped`;return(0,G.jsx)(`span`,{className:`text-[10.5px] font-medium uppercase tracking-wide ${t}`,children:n})}function zf(e){return e===void 0?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Bf(e){if(!e)return``;let t=Math.floor((Date.now()-e)/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Vf(e,t){return t&&e.startsWith(t+`/`)?`~/`+e.slice(t.length+1):e===t?`~`:e}function Hf({file:e,home:t,wired:n}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-1 border-b border-[var(--color-line-0)] last:border-0 text-[11.5px]`,children:[(0,G.jsx)(Lf,{status:e.exists?n===void 0||n?`ok`:`warn`:`skip`}),(0,G.jsx)(`code`,{className:`flex-1 truncate text-[var(--color-fg-1)]`,title:e.path,children:Vf(e.path,t)}),e.exists?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)]`,children:zf(e.size)}),(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)] min-w-[60px] text-right`,children:Bf(e.modified_at)}),n===!1&&(0,G.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wide text-[var(--color-decision-ask)]`,title:`File exists but does not appear to contain SSG wiring`,children:`no ssg`}),n===!0&&(0,G.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wide text-[var(--color-decision-allow)]`,title:`File contains SSG hook / MCP entries`,children:`wired`})]}):(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)]`,children:`missing`})]})}function Uf({title:e,status:t,children:n,hint:r}){return(0,G.jsxs)(`section`,{className:`hig-card hig-card-padded`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between mb-3`,children:[(0,G.jsxs)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-fg-0)] flex items-center gap-2`,children:[t!==void 0&&(0,G.jsx)(Lf,{status:t}),e]}),r&&(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)]`,children:r})]}),(0,G.jsx)(`div`,{children:n})]})}function Wf({k:e,v:t,mono:n=!1}){return(0,G.jsxs)(`div`,{className:`flex items-baseline gap-3 py-1 text-[11.5px] border-b border-[var(--color-line-0)] last:border-0`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] min-w-[110px]`,children:e}),(0,G.jsx)(`span`,{className:`flex-1 text-[var(--color-fg-1)] ${n?`font-mono text-[11px]`:``}`,children:t})]})}var Gf={"claude-code":`Claude Code`,cursor:`Cursor`,codex:`Codex CLI`,pi:`Pi Agent`,gemini:`Gemini CLI`,antigravity:`Antigravity`,copilot:`GitHub Copilot`};function Kf({adapter:e,home:t}){let n=Gf[e.id]??e.id,r=e.artifacts.filter(e=>e.exists&&e.ssg_wired).length,i=e.artifacts.filter(e=>e.exists).length;return(0,G.jsxs)(`div`,{className:`rounded-md border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Lf,{status:e.status}),(0,G.jsx)(`span`,{className:`text-[12.5px] font-semibold text-[var(--color-fg-0)]`,children:n}),e.active&&(0,G.jsx)(`span`,{className:`text-[9.5px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded-sm text-[var(--color-hig-blue)] bg-[color-mix(in_oklab,var(--color-hig-blue)_14%,transparent)]`,title:`This is the adapter ssg is currently using at runtime`,children:`Active`})]}),(0,G.jsxs)(`span`,{className:`text-[10px] text-[var(--color-fg-3)]`,children:[r,`/`,e.artifacts.length,` wired`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-2 text-[10.5px]`,children:[(0,G.jsx)(`span`,{className:e.detected?`text-[var(--color-decision-allow)]`:`text-[var(--color-fg-3)]`,children:e.detected?`● detected`:`○ not detected`}),(0,G.jsx)(`span`,{className:e.healthy?`text-[var(--color-decision-allow)]`:`text-[var(--color-fg-3)]`,children:e.healthy?`● binary healthy`:`○ binary missing`}),i===0&&(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`○ no config files on disk`})]}),e.artifacts.length>0&&(0,G.jsx)(`div`,{className:`border-t border-[var(--color-line-0)] pt-1`,children:e.artifacts.map(e=>(0,G.jsx)(Hf,{file:e,home:t,wired:e.exists?e.ssg_wired:void 0},e.path))}),e.status===`warn`&&i===0&&(0,G.jsxs)(`div`,{className:`mt-2 text-[10.5px] text-[var(--color-fg-3)]`,children:[`Wire it up with:`,` `,(0,G.jsxs)(`code`,{className:`font-mono text-[var(--color-fg-1)]`,children:[`ssg init --client=`,e.id]})]})]})}function qf(){let{data:e,loading:t,error:n,refetch:r}=B(`/api/json/setup-status`);if(t&&!e)return(0,G.jsx)(`div`,{className:`py-12 text-center text-[var(--color-fg-3)] text-[12px]`,children:`Reading setup status…`});if(n||!e)return(0,G.jsxs)(`div`,{className:`hig-card hig-card-padded text-[12px]`,children:[(0,G.jsxs)(`p`,{className:`text-[var(--color-decision-block)] mb-2`,children:[`Could not load /api/json/setup-status: `,n??`no response`]}),(0,G.jsx)(`button`,{onClick:r,className:`hig-button hig-button-small`,children:`Retry`})]});let{summary:i,license:a,daemon:o,dashboard:s,native:c,db:l,mcp:u,rules:d,init_files:f,adapters:p,hub:m,checks:h,home:g,cwd:_}=e;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-[20px] font-semibold tracking-tight text-[var(--color-fg-0)] leading-tight`,children:`Setup Status`}),(0,G.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-3)] mt-1 leading-relaxed`,children:[`What `,(0,G.jsx)(`code`,{className:`font-mono`,children:`ssg init`}),` wrote and whether every piece is wired up — license, hooks, MCP, native engine, daemon, rules, and hub packages.`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`text-[11px] text-[var(--color-fg-3)]`,children:[`ssg v`,e.version]}),(0,G.jsx)(`button`,{onClick:r,className:`hig-button hig-button-small`,children:`Refresh`})]})]}),(0,G.jsxs)(`section`,{className:`hig-card hig-card-padded flex items-center gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Lf,{status:i.overall,className:`!w-3 !h-3`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide text-[var(--color-fg-3)]`,children:`Overall`}),(0,G.jsx)(`div`,{className:`text-[14px] font-semibold text-[var(--color-fg-0)]`,children:i.overall===`ok`?`Healthy`:i.overall===`warn`?`Needs attention`:i.overall===`fail`?`Broken`:`Skipped`})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-4 text-[12px]`,children:[(0,G.jsxs)(`span`,{className:`text-[var(--color-decision-allow)]`,children:[`● `,i.ok,` ok`]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-decision-ask)]`,children:[`● `,i.warn,` warn`]}),i.fail>0&&(0,G.jsxs)(`span`,{className:`text-[var(--color-decision-block)]`,children:[`● `,i.fail,` fail`]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`○ `,i.skip,` skipped`]})]}),(0,G.jsxs)(`div`,{className:`ml-auto text-right`,children:[(0,G.jsx)(`div`,{className:`text-[10.5px] uppercase tracking-wide text-[var(--color-fg-3)]`,children:`Working dir`}),(0,G.jsx)(`code`,{className:`text-[11px] text-[var(--color-fg-1)]`,title:_,children:Vf(_,g)})]})]}),(0,G.jsx)(Uf,{title:`Checks`,hint:`${h.length} probes`,children:(0,G.jsx)(`div`,{children:h.map(e=>(0,G.jsxs)(`div`,{className:`flex items-start gap-3 py-1.5 border-b border-[var(--color-line-0)] last:border-0`,children:[(0,G.jsx)(Lf,{status:e.status,className:`mt-1`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--color-fg-0)]`,children:e.name}),(0,G.jsx)(Rf,{status:e.status})]}),(0,G.jsx)(`div`,{className:`text-[11px] text-[var(--color-fg-2)] mt-0.5 break-words`,children:e.detail}),e.fix&&(0,G.jsxs)(`div`,{className:`text-[11px] text-[var(--color-hig-blue)] font-mono mt-0.5`,children:[`→ `,e.fix]})]})]},e.name))})}),(0,G.jsxs)(Uf,{title:`License & authentication`,status:a.status===`healthy`||a.status===`healthy_free`?`ok`:`warn`,children:[(0,G.jsx)(Wf,{k:`Tier`,v:a.tier_label}),(0,G.jsx)(Wf,{k:`Status`,v:a.status}),(0,G.jsx)(Wf,{k:`Account`,v:a.email??`—`}),(0,G.jsx)(Wf,{k:`Auth method`,v:a.auth_method??`—`}),(0,G.jsx)(Wf,{k:`Evals today`,v:a.eval_daily_limit===null?`${a.evals_today.toLocaleString()} (unlimited)`:`${a.evals_today.toLocaleString()} / ${a.eval_daily_limit.toLocaleString()}`}),(0,G.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(`div`,{className:`text-[10.5px] uppercase tracking-wide text-[var(--color-fg-3)] mb-1`,children:`Credential files`}),(0,G.jsx)(Hf,{file:a.license_file,home:g}),(0,G.jsx)(Hf,{file:a.hosts_file,home:g})]})]}),(0,G.jsxs)(Uf,{title:`Runtime processes`,status:o.alive&&s.alive?`ok`:`warn`,children:[(0,G.jsx)(Wf,{k:`Daemon (evald)`,v:o.alive?`running — PID ${o.pid}`:o.pid?`stale — PID ${o.pid} in pidfile but process gone`:`not running`}),(0,G.jsx)(Wf,{k:`Daemon socket`,v:o.socket_exists?`present`:`missing`,mono:!0}),(0,G.jsx)(Wf,{k:`Dashboard (serve)`,v:s.alive?`running — PID ${s.pid}`:`not running`}),(0,G.jsx)(Wf,{k:`Native engine`,v:c.available?`loaded — sub-ms eval available`:`unavailable — TypeScript fallback`})]}),(0,G.jsxs)(Uf,{title:`Database & MCP`,status:l.status,children:[(0,G.jsx)(Wf,{k:`Rules in DB`,v:l.rules.toLocaleString()}),(0,G.jsx)(Wf,{k:`Audit log rows`,v:l.audit_rows.toLocaleString()}),(0,G.jsx)(Wf,{k:`DB path`,v:Vf(l.path,g),mono:!0}),(0,G.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(`div`,{className:`text-[10.5px] uppercase tracking-wide text-[var(--color-fg-3)] mb-1`,children:`MCP server`}),(0,G.jsx)(Wf,{k:`Status`,v:u.status===`active`?`active — ${u.recent_5min.toLocaleString()} calls in last 5 min`:u.status===`configured`?`configured — ${u.total.toLocaleString()} historical calls, none recent`:`no MCP traffic recorded yet`}),(0,G.jsx)(Wf,{k:`All-time calls`,v:u.total.toLocaleString()})]})]}),(0,G.jsxs)(Uf,{title:`Rules directories`,status:d.local_count>0?`ok`:`warn`,children:[(0,G.jsx)(Wf,{k:`Local`,v:`${d.local_count} .rules file${d.local_count===1?``:`s`}`}),(0,G.jsx)(Wf,{k:`Local path`,v:Vf(d.local_dir,g),mono:!0}),(0,G.jsx)(Wf,{k:`Global`,v:`${d.global_count} .rules file${d.global_count===1?``:`s`}`}),(0,G.jsx)(Wf,{k:`Global path`,v:Vf(d.global_dir,g),mono:!0})]}),(0,G.jsx)(Uf,{title:`Project init files`,hint:`${f.filter(e=>e.exists).length}/${f.length} present`,children:(0,G.jsx)(`div`,{children:f.map(e=>(0,G.jsx)(Hf,{file:e,home:g},e.path))})}),(0,G.jsx)(Uf,{title:`Adapters, hooks & MCP files`,hint:e.active_adapter?`Active: ${Gf[e.active_adapter]??e.active_adapter}`:`No active adapter`,children:(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-1 lg:grid-cols-2`,children:p.map(e=>(0,G.jsx)(Kf,{adapter:e,home:g},e.id))})}),(0,G.jsxs)(Uf,{title:`Hub-installed rulesets`,status:m.installs.length===0?`skip`:m.drift===0?`ok`:`warn`,hint:m.installs.length===0?`none installed`:`${m.in_sync} in sync${m.drift>0?`, ${m.drift} drift`:``}`,children:[(0,G.jsx)(Hf,{file:m.pins_file,home:g}),m.installs.length===0?(0,G.jsxs)(`p`,{className:`text-[11.5px] text-[var(--color-fg-3)] mt-2`,children:[`Install rulesets from the Hub tab. Each install is recorded per project path in `,(0,G.jsx)(`code`,{className:`font-mono`,children:`hub-pins.json`}),`.`]}):(0,G.jsx)(`div`,{className:`mt-2 space-y-2`,children:m.installs.map((e,t)=>(0,G.jsxs)(`div`,{className:`rounded-md border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-2 text-[11.5px]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,G.jsx)(Lf,{status:e.in_sync?`ok`:`warn`}),(0,G.jsx)(`span`,{className:`font-semibold text-[var(--color-fg-0)]`,children:e.id}),(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)]`,children:e.version}),(0,G.jsx)(`span`,{className:`ml-auto text-[10.5px] text-[var(--color-fg-3)]`,children:Bf(e.installed_at)})]}),(0,G.jsx)(`code`,{className:`block truncate text-[11px] text-[var(--color-fg-2)]`,title:e.path,children:Vf(e.path,g)}),e.files.length>0&&(0,G.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.files.map(e=>(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-2)] bg-[var(--color-surface-2)] border border-[var(--color-line-0)] rounded-sm px-1.5 py-0.5`,children:e},e))}),!e.in_sync&&e.drift_reason&&(0,G.jsxs)(`div`,{className:`mt-1 text-[10.5px] text-[var(--color-decision-ask)]`,children:[`Drift: `,e.drift_reason]})]},`${e.id}-${e.path}-${t}`))})]})]})}var Jf=`ssg-dashboard-tabs`,Yf=2e3,Xf=6e3;function Zf(){return`tab-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function Qf(){let[e,t]=(0,_.useState)(0),[n,r]=(0,_.useState)(!0),i=(0,_.useRef)(Zf()),a=(0,_.useRef)(new Map);return(0,_.useEffect)(()=>{if(typeof BroadcastChannel>`u`)return;let e=new BroadcastChannel(Jf);function n(){let e=Date.now();for(let[t,n]of a.current.entries())e-n>Xf&&a.current.delete(t);let n=a.current.size;t(n),r([...a.current.keys(),i.current].sort()[0]===i.current)}function o(e){let t=e.data;!t||t.id===i.current||(t.type===`leave`?a.current.delete(t.id):a.current.set(t.id,Date.now()),n())}e.addEventListener(`message`,o),e.postMessage({type:`join`,id:i.current});let s=setInterval(()=>{e.postMessage({type:`heartbeat`,id:i.current}),n()},Yf),c=()=>{e.postMessage({type:`leave`,id:i.current})};return window.addEventListener(`beforeunload`,c),()=>{clearInterval(s),e.postMessage({type:`leave`,id:i.current}),e.removeEventListener(`message`,o),e.close(),window.removeEventListener(`beforeunload`,c)}},[]),{otherTabCount:e,isLeader:n}}var $f=b;function ep(){(0,_.useEffect)(()=>we([]),[]);let e=(0,_.useSyncExternalStore)(ge,_e),[,t]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(e.connected||e.lastErrorAt===null)return;let n=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(n)},[e.connected,e.lastErrorAt]);let n=tp(e),r=n===`reconnecting`&&e.lastErrorAt!==null?Math.max(0,Math.ceil((e.lastErrorAt+e.reconnectDelayMs-Date.now())/1e3)):null,i=Math.round($f/1e3);if(n===`connected`)return(0,G.jsxs)(`div`,{className:`chip`,title:`Telemetry Live — SSE connected`,"data-testid":`sse-status-chip`,"data-state":`connected`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-[var(--color-decision-allow)]`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:`Live`})]});let a=n===`reconnecting`,o=a?{color:`var(--color-hig-orange)`,background:`color-mix(in oklab, var(--color-hig-orange) 14%, transparent)`}:{color:`var(--color-hig-red)`,background:`color-mix(in oklab, var(--color-hig-red) 14%, transparent)`},s=a?`bg-[var(--color-hig-orange)]`:`bg-[var(--color-hig-red)]`,c=a?r===null?`Reconnecting`:`Reconnect ${r}s`:`Offline`,l=`Live paused · ${i}s poll`;return(0,G.jsxs)(`div`,{className:`chip`,style:o,title:a?`Live stream down — reconnect in ${r??`…`}s (attempt ${e.reconnectAttempts}). Dashboard is polling every ${i}s until SSE recovers.`:`Live stream disconnected. Dashboard is polling every ${i}s — data still updates, just at a coarser cadence.`,"data-testid":`sse-status-chip`,"data-state":n,role:`status`,"aria-live":`polite`,children:[(0,G.jsx)(`span`,{className:`status-dot ${s} pulse-soft`}),(0,G.jsx)(`span`,{className:`hidden md:inline`,children:l}),(0,G.jsx)(`span`,{className:`md:hidden`,children:c})]})}function tp(e){return e.connected?`connected`:e.reconnectAttempts>0||e.lastErrorAt!==null?`reconnecting`:`disconnected`}var np=`ssg:ui:font-scale:v1`,rp=[{label:`S`,value:.9},{label:`M`,value:1},{label:`L`,value:1.15},{label:`XL`,value:1.3}],ip=1;function ap(e){if(typeof e!=`number`||!Number.isFinite(e))return ip;let t=rp.find(t=>Math.abs(t.value-e)<.001);return t?t.value:ip}function op(){if(typeof localStorage>`u`)return ip;try{let e=localStorage.getItem(np);return e===null?ip:ap(parseFloat(e))}catch{return ip}}function sp(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(np,String(e))}catch{}}function cp(e){typeof document>`u`||(document.documentElement.style.setProperty(`--ssg-font-scale`,String(e)),document.documentElement.style.fontSize=`${16*e}px`)}function lp(){let[e,t]=(0,_.useState)(()=>{let e=op();return cp(e),e});return(0,_.useEffect)(()=>{cp(e)},[e]),{scale:e,setScale:(0,_.useCallback)(e=>{t(e),sp(e),cp(e)},[])}}function up(){let{scale:e,setScale:t}=lp();return(0,G.jsx)(`div`,{role:`radiogroup`,"aria-label":`Font size`,className:`hig-segmented`,style:{height:`24px`},children:rp.map(n=>{let r=Math.abs(n.value-e)<.001;return(0,G.jsx)(`button`,{role:`radio`,"aria-checked":r,"aria-selected":r,onClick:()=>t(n.value),title:`Font size: ${n.label} (${Math.round(n.value*100)}%)`,className:r?`selected`:``,style:{height:`20px`,padding:`0 8px`,fontSize:`11px`},children:n.label},n.label)})})}var dp=`ssg:ui:theme:v1`,fp=[{label:`System (Auto)`,value:`default`},{label:`Apple Light`,value:`apple-light`},{label:`Apple Dark`,value:`apple-dark`},{label:`Light (Legacy)`,value:`light`},{label:`Dracula`,value:`dracula`},{label:`Gruvbox Dark`,value:`gruvbox-dark`},{label:`Gruvbox Light`,value:`gruvbox-light`},{label:`Tokyo Night`,value:`tokyo-night`},{label:`Catppuccin Mocha`,value:`catppuccin-mocha`},{label:`Nord`,value:`nord`},{label:`One Dark Pro`,value:`one-dark-pro`}],pp=new Set([`light`,`gruvbox-light`,`apple-light`]),mp=new Set([`apple-dark`,`dracula`,`gruvbox-dark`,`tokyo-night`,`catppuccin-mocha`,`nord`,`one-dark-pro`]),hp=`default`;function gp(e){return typeof e==`string`&&fp.some(t=>t.value===e)}function _p(){if(typeof localStorage>`u`)return hp;try{let e=localStorage.getItem(dp);return gp(e)?e:hp}catch{return hp}}function vp(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(dp,e)}catch{}}function yp(e){typeof document>`u`||(e===hp?(document.documentElement.removeAttribute(`data-theme`),document.documentElement.style.colorScheme=`light dark`):(document.documentElement.setAttribute(`data-theme`,e),document.documentElement.style.colorScheme=pp.has(e)?`light`:mp.has(e)?`dark`:`light dark`))}function bp(){let[e,t]=(0,_.useState)(()=>{let e=_p();return yp(e),e});return(0,_.useEffect)(()=>{yp(e)},[e]),{theme:e,setTheme:(0,_.useCallback)(e=>{t(e),vp(e),yp(e)},[])}}function xp(){let{theme:e,setTheme:t}=bp();return(0,G.jsx)(`select`,{value:e,onChange:e=>t(e.target.value),"aria-label":`Color theme`,title:`Color theme`,className:`hig-input cursor-pointer`,style:{height:`24px`,paddingRight:`22px`,minWidth:`90px`},children:fp.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function Sp(){let{mode:e,setMode:t}=ru(),n=e===`newcomer`;return(0,G.jsxs)(`div`,{role:`radiogroup`,"aria-label":`UI mode`,className:`hig-segmented`,style:{height:`24px`},title:n?`Switch to advanced view`:`Switch to simple view`,children:[(0,G.jsx)(`button`,{role:`radio`,"aria-checked":n,"aria-selected":n,onClick:()=>t(`newcomer`),className:n?`selected`:``,style:{height:`20px`,padding:`0 10px`,fontSize:`11.5px`},children:`Simple`}),(0,G.jsx)(`button`,{role:`radio`,"aria-checked":!n,"aria-selected":!n,onClick:()=>t(`pro`),className:n?``:`selected`,style:{height:`20px`,padding:`0 10px`,fontSize:`11.5px`},children:`Advanced`})]})}function Cp(){let[e,t]=(0,_.useState)(()=>Ro()),[n,r]=(0,_.useState)(()=>Bo()),[i,a]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{zo(e)},[e]),(0,_.useEffect)(()=>{Vo(n)},[n]),(0,G.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,G.jsxs)(`button`,{onClick:()=>t(e=>!e),onContextMenu:e=>{e.preventDefault(),a(e=>!e)},className:`chip cursor-pointer hover:bg-[var(--color-fill-2)] transition-colors`,style:e?{color:`var(--color-decision-allow)`}:void 0,title:e?`Decision chimes on · click to mute · right-click for volume`:`Decision chimes off · click to enable`,children:[(0,G.jsx)(`span`,{className:`status-dot ${e?`bg-[var(--color-decision-allow)]`:`bg-[var(--color-fg-4)]`}`}),(0,G.jsxs)(`span`,{className:`hidden sm:inline`,children:[`Audio `,e?`on`:`off`]})]}),i&&(0,G.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-50 flex items-center gap-2 px-3 py-2 hig-card hig-card-padded shadow-[var(--hig-shadow-2)]`,onMouseLeave:()=>a(!1),children:[(0,G.jsx)(`span`,{className:`overline`,children:`Volume`}),(0,G.jsx)(`input`,{type:`range`,min:0,max:1,step:.02,value:n,onChange:e=>r(parseFloat(e.target.value)),className:`w-24`,style:{accentColor:`var(--color-accent)`}}),(0,G.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-[var(--color-fg-2)] w-8 text-right`,children:Math.round(n*100)})]})]})}var wp={dashboard:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`9`,rx:`1.5`}),(0,G.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`5`,rx:`1.5`}),(0,G.jsx)(`rect`,{x:`14`,y:`12`,width:`7`,height:`9`,rx:`1.5`}),(0,G.jsx)(`rect`,{x:`3`,y:`16`,width:`7`,height:`5`,rx:`1.5`})]}),graph:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`6`,cy:`18`,r:`2.4`}),(0,G.jsx)(`circle`,{cx:`18`,cy:`6`,r:`2.4`}),(0,G.jsx)(`circle`,{cx:`18`,cy:`18`,r:`2.4`}),(0,G.jsx)(`circle`,{cx:`12`,cy:`11`,r:`2.4`}),(0,G.jsx)(`path`,{d:`M7.5 16.5l3-4M13.5 11.5l3-3.5M13.5 12l3 4.5`})]}),rules:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M9 5h11M9 12h11M9 19h11`}),(0,G.jsx)(`path`,{d:`M4 5l1 1 2-2M4 12l1 1 2-2M4 19l1 1 2-2`})]}),hub:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,G.jsx)(`path`,{d:`M3 12h18`}),(0,G.jsx)(`path`,{d:`M12 3a14 14 0 010 18M12 3a14 14 0 000 18`})]}),audit:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`11`,cy:`11`,r:`6.5`}),(0,G.jsx)(`path`,{d:`M21 21l-5-5`})]}),approvals:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M5 7h14v12a2 2 0 01-2 2H7a2 2 0 01-2-2z`}),(0,G.jsx)(`path`,{d:`M9 3v4M15 3v4`}),(0,G.jsx)(`path`,{d:`M9 13l2 2 4-4`})]}),profile:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`8`,r:`4`}),(0,G.jsx)(`path`,{d:`M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8`})]}),monitor:(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M3 12h3l3-7 4 14 3-7h5`})}),observability:(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M4 20h16M7 16V8M11 16V4M15 16v-6M19 16v-3`})}),debug:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`rect`,{x:`7`,y:`7`,width:`10`,height:`12`,rx:`5`}),(0,G.jsx)(`path`,{d:`M12 7V4M9 4l3 3 3-3`}),(0,G.jsx)(`path`,{d:`M5 11l2-1M5 18l2-1M19 11l-2-1M19 18l-2-1`})]}),home:(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M3 11l9-7 9 7v9a2 2 0 01-2 2h-3v-7H10v7H5a2 2 0 01-2-2z`})}),guardrails:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M12 3l8 3.7v6.3c0 5-3.5 9.6-8 11-4.5-1.4-8-6-8-11V6.7L12 3z`}),(0,G.jsx)(`path`,{d:`M9 12l2 2 4-4`})]}),tryit:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M9 3v6L4.5 18a2 2 0 001.7 3h11.6a2 2 0 001.7-3L15 9V3`}),(0,G.jsx)(`path`,{d:`M8 3h8`})]}),agents:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`8`,cy:`9`,r:`3`}),(0,G.jsx)(`circle`,{cx:`16`,cy:`9`,r:`3`}),(0,G.jsx)(`path`,{d:`M3 19c.7-2.5 2.6-4 5-4`}),(0,G.jsx)(`path`,{d:`M21 19c-.7-2.5-2.6-4-5-4`}),(0,G.jsx)(`path`,{d:`M9 17.5c.8-1 1.8-1.5 3-1.5s2.2.5 3 1.5`})]}),notifications:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M18 16v-5a6 6 0 1 0-12 0v5l-2 2h16z`}),(0,G.jsx)(`path`,{d:`M10 20a2 2 0 0 0 4 0`})]}),setup:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M9 12l2 2 4-4`}),(0,G.jsx)(`path`,{d:`M12 3l8 3.7v6.3c0 5-3.5 9.6-8 11-4.5-1.4-8-6-8-11V6.7L12 3z`})]})},Tp=[{title:`Overview`,items:[{path:`/`,label:`Dashboard`,icon:`dashboard`},{path:`/notifications`,label:`Notifications`,icon:`notifications`},{path:`/agents`,label:`Agents`,icon:`agents`},{path:`/graph`,label:`Graph`,icon:`graph`}]},{title:`Rules`,items:[{path:`/rules`,label:`Rules`,icon:`rules`},{path:`/hub`,label:`Hub`,icon:`hub`},{path:`/approvals`,label:`Approvals`,icon:`approvals`}]},{title:`Activity`,items:[{path:`/audit`,label:`Audit`,icon:`audit`},{path:`/monitor`,label:`Monitor`,icon:`monitor`},{path:`/observability`,label:`Observability`,icon:`observability`}]},{title:`Tools`,items:[{path:`/setup`,label:`Setup`,icon:`setup`},{path:`/debug`,label:`Debug`,icon:`debug`},{path:`/profile`,label:`Profile`,icon:`profile`}]}],Ep=[{title:`Get Started`,items:[{path:`/`,label:`Home`,icon:`home`},{path:`/agents`,label:`Agents`,icon:`agents`},{path:`/guardrails`,label:`Guardrails`,icon:`guardrails`},{path:`/try`,label:`Try It`,icon:`tryit`}]},{title:`Activity`,items:[{path:`/notifications`,label:`Notifications`,icon:`notifications`},{path:`/audit`,label:`Activity`,icon:`audit`},{path:`/approvals`,label:`Approvals`,icon:`approvals`}]},{title:`You`,items:[{path:`/setup`,label:`Setup`,icon:`setup`},{path:`/profile`,label:`Profile`,icon:`profile`}]}];function Dp(e){return e===`newcomer`?Ep:Tp}function Op(e){let t=Math.max(0,e-Date.now()),n=Math.floor(t/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m ${n%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function kp(){let{data:e}=B(`/api/json/daemon-status`,[Ae([`counters-updated`])[`counters-updated`]]),[t,n]=(0,_.useState)(!1),[,r]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(e?.status!==`degraded`||!e.hibernation)return;let t=setInterval(()=>r(e=>e+1),1e3);return()=>clearInterval(t)},[e?.status,e?.hibernation]);let i=e?.status??`starting`,a=i===`running`?`bg-[var(--color-decision-allow)]`:i===`starting`||i===`degraded`?`bg-[var(--color-decision-ask)]`:`bg-[var(--color-decision-block)]`,o=i===`starting`||i===`degraded`?`pulse-soft`:``,s=i===`degraded`&&e?.hibernation?Op(e.hibernation.nextRetryAt):null,c=i===`running`?`Daemon`:i===`starting`?`Booting`:i===`degraded`?`Retry ${s??`…`}`:i===`error`?`Error`:`Offline`;return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`button`,{onClick:()=>n(e=>!e),className:`chip cursor-pointer hover:bg-[var(--color-fill-2)] transition-colors`,title:i===`running`?`Daemon running`:i===`starting`?`Daemon starting…`:i===`degraded`?`Daemon hibernating — retry in ${s??`…`}`:i===`error`?`Daemon error`:`Daemon stopped`,children:[(0,G.jsx)(`span`,{className:`status-dot ${a} ${o}`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:c})]}),t&&(0,G.jsxs)(`div`,{className:`absolute right-0 top-7 z-50 w-72 hig-card hig-card-padded text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`Eval Daemon`}),(0,G.jsx)(`button`,{onClick:()=>n(!1),className:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-0)] cursor-pointer`,children:`✕`})]}),(0,G.jsxs)(`div`,{className:`space-y-1 text-[var(--color-fg-2)]`,children:[(0,G.jsxs)(`div`,{className:`font-mono text-[11px]`,children:[`status:`,` `,(0,G.jsx)(`span`,{className:i===`running`?`text-[var(--color-decision-allow)]`:i===`starting`||i===`degraded`?`text-[var(--color-decision-ask)]`:`text-[var(--color-decision-block)]`,children:i})]}),e?.pid&&(0,G.jsxs)(`div`,{className:`font-mono text-[11px]`,children:[`pid: `,e.pid]}),i===`degraded`&&e?.hibernation&&(0,G.jsxs)(`div`,{className:`mt-2 rounded-lg p-2 text-[11px] space-y-0.5`,style:{background:`color-mix(in oklab, var(--color-hig-orange) 14%, transparent)`,color:`color-mix(in oklab, var(--color-hig-orange) 90%, var(--color-fg-0))`},children:[(0,G.jsxs)(`div`,{children:[`next retry: `,(0,G.jsx)(`span`,{className:`font-medium`,children:s})]}),(0,G.jsxs)(`div`,{children:[`episode attempt: `,e.hibernation.attempt,e.hibernation.reason?` (${e.hibernation.reason})`:``]}),(0,G.jsx)(`div`,{className:`opacity-70`,children:`Slow-tier supervisor is retrying at long backoff — no manual restart required.`})]})]}),e?.logTail&&e.logTail.length>0&&(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsx)(`div`,{className:`overline mb-1`,children:`Recent log`}),(0,G.jsx)(`pre`,{className:`bg-[var(--color-surface-2)] border border-[var(--color-line-0)] rounded-md p-2 text-[10px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-all max-h-32 overflow-y-auto`,children:e.logTail.join(`
34
- `)})]})]})]})}function Ap(){let{data:e}=B(`/api/state/activity-degraded`);if(!e?.degraded)return null;let t=e.since?new Date(e.since).toLocaleTimeString():`recently`;return(0,G.jsxs)(`div`,{role:`status`,className:`hig-banner hig-banner-warning`,title:e.reason??`audit-worker degraded`,children:[(0,G.jsx)(`span`,{children:`⚠`}),(0,G.jsxs)(`span`,{children:[`Audit pipeline degraded since `,t,` — entries may be missing. Run`,` `,(0,G.jsx)(`code`,{className:`font-mono`,children:`ssg daemon --status`}),` to inspect.`]})]})}function jp(){let{data:e}=B(`/api/json/license`,[Ae([`counters-updated`])[`counters-updated`]]);return!e||e.tier!==`unlicensed`||e.status===`needs_reauth`||e.status===`needs_login`||e.eval_daily_limit===null||e.evals_today<e.eval_daily_limit?null:(0,G.jsxs)(`div`,{role:`alert`,className:`hig-banner hig-banner-error`,title:`Free tier daily eval limit reached — rules are being bypassed until quota resets`,children:[(0,G.jsx)(`span`,{children:`●`}),(0,G.jsxs)(`span`,{children:[`Quota exhausted — `,e.evals_today.toLocaleString(),`/`,e.eval_daily_limit.toLocaleString(),` evals used today. BLOCK and ASK rules are being bypassed (fail-open) until daily reset.`,` `,(0,G.jsx)(`a`,{href:e.upgrade_url,target:`_blank`,rel:`noopener noreferrer`,className:`underline font-medium`,children:`Upgrade to Pro →`})]})]})}function Mp(){let{data:e}=B(`/api/json/license`,[Ae([`counters-updated`])[`counters-updated`]]);if(!e||e.status!==`needs_reauth`)return null;let t=e.detail??`License JWT invalid or expired`;return(0,G.jsxs)(`div`,{role:`alert`,className:`hig-banner hig-banner-warning`,title:`Re-authentication required — paid-tier features are paused until you re-login`,children:[(0,G.jsx)(`span`,{children:`⚠`}),(0,G.jsxs)(`span`,{children:[`Re-authentication required — `,t,`. Run`,` `,(0,G.jsx)(`code`,{className:`font-mono`,children:`ssg auth login`}),` in your terminal to restore your tier.`]})]})}function Np(){let{data:e,refetch:t}=B(`/api/json/ask-mode`),[n,r]=(0,_.useState)(!1),i=e?.mode??`tty`;async function a(e){if(!(n||e===i)){r(!0);try{await fetch(`/api/json/ask-mode`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({mode:e})}),t()}finally{r(!1)}}}let o=i===`tty`;return(0,G.jsxs)(`button`,{onClick:()=>a(o?`dashboard`:`tty`),disabled:n,className:`chip cursor-pointer hover:bg-[var(--color-fill-2)] transition-colors disabled:opacity-50`,title:o?`ASK decisions prompt in the native IDE/TTY. Click to route to dashboard.`:`ASK decisions queue on /approvals. Click to route to native prompt.`,children:[(0,G.jsx)(`span`,{className:`status-dot ${o?`bg-[var(--color-hig-blue)]`:`bg-[var(--color-hig-purple)]`}`}),(0,G.jsxs)(`span`,{className:`hidden sm:inline`,children:[`Ask · `,o?`Native`:`Dashboard`]})]})}function Pp(e){let t=new Date(e);return`${t.getHours().toString().padStart(2,`0`)}:${t.getMinutes().toString().padStart(2,`0`)}`}var Fp={on:`audit`,audit:`off`,off:`on`};function Ip(){let{data:e,refetch:t}=B(`/api/json/mode`,[Ae([`mode-changed`])[`mode-changed`]]),[n,r]=(0,_.useState)(!1),i=e?.mode??`on`;async function a(e,i){if(!n){r(!0);try{let n={mode:e};typeof i==`number`&&i>0&&(n.forMs=i),await fetch(`/api/json/mode`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify(n)}),t()}finally{r(!1)}}}let o=i===`on`?`bg-[var(--color-hig-green)]`:i===`audit`?`bg-[var(--color-hig-orange)]`:`bg-[var(--color-hig-red)]`,s=e?.rearmAt!==void 0&&i!==`on`?` · until ${Pp(e.rearmAt)}`:``,c=`SSG · ${i.toUpperCase()}${s}`;return(0,G.jsxs)(`button`,{onClick:e=>{e.shiftKey?a(i===`off`?`audit`:`on`):a(Fp[i])},disabled:n,className:`chip cursor-pointer hover:bg-[var(--color-fill-2)] transition-colors disabled:opacity-50`,title:i===`on`?`SSG ON — rules enforce normally. Click to cycle: On → Audit → Off.`:i===`audit`?`SSG AUDIT — rules log only, nothing blocked or prompted. Click for Off; Shift+Click to resume On.`:`SSG OFF — kill switch engaged, evaluator returns allow. Click to resume On; Shift+Click for Audit.`,children:[(0,G.jsx)(`span`,{className:`status-dot ${o}`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:c})]})}function Lp(){let{data:e,refetch:t}=B(`/api/json/mode`,[Ae([`mode-changed`])[`mode-changed`]]),n=e?.mode??`on`;if(n===`on`)return null;let r=e?.rearmAt===void 0?``:` Auto-restores at ${Pp(e.rearmAt)}.`,i=n===`off`?`SSG is OFF — kill switch engaged.`:`SSG is in AUDIT mode — log-only.`,a=n===`off`?`Every tool call is being allowed without evaluation.${r}`:`Rules still match for the audit log, but nothing is being blocked or prompted.${r}`,o=n===`off`?`hig-banner hig-banner-error`:`hig-banner hig-banner-warning`;async function s(){await fetch(`/api/json/mode`,{method:`POST`,headers:{"Content-Type":`application/json`,...z()},body:JSON.stringify({mode:`on`})}),t()}return(0,G.jsxs)(`div`,{className:o,children:[(0,G.jsxs)(`svg`,{className:`shrink-0`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),(0,G.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),(0,G.jsxs)(`span`,{className:`flex-1`,children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:i}),` `,a]}),(0,G.jsx)(`button`,{onClick:s,className:`hig-button hig-button-small`,title:`Re-enable normal rule enforcement`,children:`Resume`})]})}function Rp({onRefresh:e}){return(0,G.jsx)(`button`,{onClick:e,className:`hig-button`,title:`Reset page — clears stale graph state without dropping SSE`,"aria-label":`Refresh page`,children:(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M21 12a9 9 0 1 1-3-6.7`}),(0,G.jsx)(`polyline`,{points:`21 3 21 9 15 9`})]})})}function zp(){let{data:e}=B(`/api/json/mcp-status`,[Ae([`activity-updated`])[`activity-updated`]]),t=e?.status??`inactive`;if(t===`inactive`)return null;let n=t===`active`?`bg-[var(--color-hig-blue)]`:`bg-[var(--color-fg-3)]`,r=t===`active`?`MCP active`:`MCP idle`;return(0,G.jsxs)(`div`,{className:`chip`,title:t===`active`?`MCP server: ${e?.recentCount??0} evals in last 5 min`:`MCP server: ${e?.totalCount??0} total evals`,children:[(0,G.jsx)(`span`,{className:`status-dot ${n}`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:r})]})}function Bp(){let{data:e}=B(`/api/json/adapters`);if(!e)return null;let t=e.adapters.find(e=>e.active);if(!t)return null;let n=t.id===`generic`;return(0,G.jsxs)(`a`,{href:`/agents`,className:`chip ss-agent-chip cursor-pointer transition-all`,title:n?`No specific AI client detected — SSG is running in generic adapter mode. Click to wire one up.`:`Connected agent: ${t.displayName} (${t.vendor}). Click to manage.`,style:{"--agent-accent":t.accent},"data-generic":n?`true`:`false`,children:[(0,G.jsx)(`span`,{className:`status-dot`,style:{background:t.accent,boxShadow:`0 0 6px color-mix(in oklab, ${t.accent} 60%, transparent)`}}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:t.displayName})]})}function Vp(e,t){if(e===`/`)return t===`newcomer`?(0,G.jsx)(_f,{}):(0,G.jsx)(ac,{});if(e===`/classic`)return(0,G.jsx)(Qc,{});if(e===`/graph`)return(0,G.jsx)(Ud,{});if(e===`/debug`)return(0,G.jsx)(Gd,{});if(e===`/rules`)return(0,G.jsx)(pl,{});if(e===`/audit`)return(0,G.jsx)(_l,{});if(e===`/approvals`)return(0,G.jsx)(Nl,{});if(e===`/profile`)return(0,G.jsx)(Yl,{});if(e===`/agents`)return(0,G.jsx)(Mf,{});if(e===`/notifications`)return(0,G.jsx)(If,{});if(e===`/setup`)return(0,G.jsx)(qf,{});if(e===`/try`)return(0,G.jsx)(xf,{});if(e===`/guardrails`)return(0,G.jsx)(su,{});if(e===`/hub/connect`)return(0,G.jsx)(Su,{});if(e===`/hub/publish`)return(0,G.jsx)(Cu,{});if(e.startsWith(`/hub/`)){let t=e.slice(5);if(t)return(0,G.jsx)(xu,{id:t})}return e===`/hub`?(0,G.jsx)(vu,{}):e===`/monitor`?(0,G.jsx)(Iu,{}):e===`/observability`?(0,G.jsx)(nd,{}):(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-24 text-[var(--color-fg-3)]`,children:[(0,G.jsx)(`p`,{className:`overline mb-2`,children:`Error · 404`}),(0,G.jsx)(`p`,{className:`text-sm`,children:`Page not found`}),(0,G.jsx)(`a`,{href:`/`,className:`mt-4 text-[12px] text-[var(--color-hig-blue)] hover:underline`,children:`← Back to dashboard`})]})}function Hp(e,t){return e===`/`?t===`newcomer`?`Home`:`Dashboard`:e===`/classic`?`Classic Dashboard`:e===`/graph`?`Graph`:e===`/debug`?`Debug`:e===`/rules`?`Rules`:e===`/audit`?t===`newcomer`?`Activity`:`Audit`:e===`/approvals`?`Approvals`:e===`/profile`?`Profile`:e===`/agents`?`Agents`:e===`/notifications`?`Notifications`:e===`/setup`?`Setup Status`:e===`/try`?`Try It`:e===`/guardrails`?`Guardrails`:e===`/hub/connect`?`Connect Hub`:e===`/hub/publish`?`Publish to Hub`:e.startsWith(`/hub/`)||e===`/hub`?`Hub`:e===`/monitor`?`Monitor`:e===`/observability`?`Observability`:`SigmaShake`}function Up(e){history.pushState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}function Wp({count:e}){let[t,n]=(0,_.useState)(!1);return t||e===0?null:(0,G.jsxs)(`div`,{className:`hig-banner hig-banner-warning`,children:[(0,G.jsxs)(`svg`,{className:`shrink-0`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),(0,G.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),(0,G.jsxs)(`span`,{className:`flex-1`,children:[(0,G.jsxs)(`span`,{className:`font-semibold`,children:[e,` other `,e===1?`tab`:`tabs`,` open.`]}),` `,`Each tab holds a live SSE connection. Browsers limit connections per origin — too many tabs will prevent this page from loading.`,` `,(0,G.jsx)(`span`,{className:`opacity-70`,children:`Close other tabs to restore full live-update functionality.`})]}),(0,G.jsx)(`button`,{onClick:()=>n(!0),className:`opacity-60 hover:opacity-100 transition-opacity shrink-0 cursor-pointer`,title:`Dismiss`,children:(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function Gp({pathname:e,navSections:t,open:n,onClose:r}){let i=t=>t===`/`?e===`/`:e.startsWith(t);return(0,G.jsxs)(`aside`,{className:`hig-sidebar ${n?`open`:``}`,"aria-label":`Primary`,children:[(0,G.jsxs)(`div`,{className:`hig-sidebar-header`,children:[(0,G.jsx)(`span`,{className:`hig-app-icon`,"aria-hidden":`true`,children:`SS`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`hig-app-name`,children:`SigmaShake`}),(0,G.jsx)(`div`,{className:`hig-app-meta`,children:`Governance`})]})]}),(0,G.jsx)(`nav`,{className:`hig-sidebar-nav`,children:t.map(e=>(0,G.jsxs)(`div`,{className:`hig-sidebar-section`,children:[(0,G.jsx)(`div`,{className:`hig-sidebar-section-title`,children:e.title}),e.items.map(e=>(0,G.jsxs)(`a`,{href:e.path,onClick:r,className:`hig-sidebar-item`,"data-active":i(e.path)?`true`:`false`,children:[(0,G.jsx)(`span`,{className:`hig-sidebar-icon`,"aria-hidden":`true`,children:wp[e.icon]}),(0,G.jsx)(`span`,{children:e.label})]},e.path))]},e.title))})]})}function Kp(){let[e,t]=(0,_.useState)(window.location.pathname),[n,r]=(0,_.useState)(0),[i,a]=(0,_.useState)(!1),{otherTabCount:o}=Qf(),{mode:s}=ru(),c=Dp(s),l=Hp(e,s);return(0,_.useEffect)(()=>{let e=()=>t(window.location.pathname);return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,_.useEffect)(()=>{a(!1)},[e]),(0,_.useEffect)(()=>{let e=e=>{let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);!n||n.startsWith(`http`)||n.startsWith(`//`)||(e.preventDefault(),Up(n))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[]),(0,G.jsxs)(`div`,{className:`hig-app`,children:[(0,G.jsx)(Gp,{pathname:e,navSections:c,open:i,onClose:()=>a(!1)}),(0,G.jsxs)(`div`,{className:`hig-window`,children:[(0,G.jsxs)(`header`,{className:`hig-toolbar`,children:[(0,G.jsx)(`button`,{"aria-label":`Toggle sidebar`,className:`md:hidden hig-button hig-button-small`,onClick:()=>a(e=>!e),children:(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 18 18`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,children:[(0,G.jsx)(`line`,{x1:`2`,y1:`5`,x2:`16`,y2:`5`}),(0,G.jsx)(`line`,{x1:`2`,y1:`9`,x2:`16`,y2:`9`}),(0,G.jsx)(`line`,{x1:`2`,y1:`13`,x2:`16`,y2:`13`})]})}),(0,G.jsx)(`h1`,{className:`hig-toolbar-title`,children:l}),(0,G.jsx)(`div`,{className:`hig-toolbar-spacer`}),(0,G.jsxs)(`div`,{className:`hig-toolbar-controls hidden md:flex`,children:[o>0&&(0,G.jsxs)(`span`,{className:`chip`,style:{color:`var(--color-hig-orange)`,background:`color-mix(in oklab, var(--color-hig-orange) 14%, transparent)`},title:`${o} other tab${o===1?``:`s`} open — may cause connection issues`,children:[o+1,` tabs`]}),(0,G.jsx)(ep,{}),(0,G.jsx)(Ip,{}),(0,G.jsx)(Np,{}),(0,G.jsx)(Bp,{}),(0,G.jsx)(zp,{}),(0,G.jsx)(kp,{}),(0,G.jsx)(Rp,{onRefresh:()=>r(e=>e+1)}),(0,G.jsx)(Sp,{}),(0,G.jsx)(xp,{}),(0,G.jsx)(up,{}),(0,G.jsx)(Cp,{})]})]}),(0,G.jsx)(Lp,{}),(0,G.jsx)(Wp,{count:o}),(0,G.jsx)(Mp,{}),(0,G.jsx)(jp,{}),(0,G.jsx)(Ap,{}),(0,G.jsx)(`main`,{className:`hig-content px-6 py-6`,children:Vp(e,s)},n)]})]})}var qp=document.getElementById(`app-root`);if(!qp)throw Error(`Missing #app-root`);g.createRoot(qp).render((0,G.jsx)(_.StrictMode,{children:(0,G.jsx)(Kp,{})}));
35
+ `)||`Exit code: ${m.exitCode}`})]})]})]})}function Bf({result:e}){return(0,G.jsx)(`ul`,{className:`ss-install-checklist`,children:(e.steps&&e.steps.length>0?e.steps:[{label:e.ok?`Setup complete`:`Setup failed`,status:e.ok?`ok`:`error`,detail:e.error??void 0}]).map((e,t)=>(0,G.jsxs)(`li`,{className:`ss-install-step ss-install-step--${e.status}`,children:[(0,G.jsx)(`span`,{className:`ss-install-step__icon`,"aria-hidden":`true`,children:e.status===`ok`?`✓`:e.status===`error`?`✗`:`–`}),(0,G.jsxs)(`div`,{className:`ss-install-step__body`,children:[(0,G.jsx)(`span`,{className:`ss-install-step__label`,children:e.label}),e.detail&&(0,G.jsx)(`span`,{className:`ss-install-step__detail`,children:e.detail})]})]},t))})}function Vf({a:e,onOpen:t}){return(0,G.jsxs)(`button`,{type:`button`,className:`ss-list-row`,onClick:t,"aria-label":`Open ${e.displayName} details`,children:[(0,G.jsx)(Pf,{a:e,size:34}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`text-[13.5px] font-semibold text-[var(--color-fg-0)] truncate`,children:e.displayName}),(0,G.jsx)(Ff,{a:e}),e.pinned&&!e.active&&(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:e.accent,background:`color-mix(in oklab, ${e.accent} 12%, transparent)`,borderColor:`color-mix(in oklab, ${e.accent} 30%, transparent)`},children:`Pinned`})]}),(0,G.jsx)(`p`,{className:`text-[10.5px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mt-0.5`,children:e.vendor})]}),(0,G.jsx)(If,{})]})}function Hf(){let{data:e,refetch:t}=B(`/api/json/adapters`),[n,r]=(0,_.useState)(`all`),[i,a]=(0,_.useState)(null),o=(0,_.useMemo)(()=>e?n===`detected`?e.adapters.filter(e=>e.detected):n===`available`?e.adapters.filter(e=>!e.detected):e.adapters:[],[e,n]);if(!e)return(0,G.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)]`,children:`loading adapters…`});let s=e.adapters.find(e=>e.active),c=e.adapters.filter(e=>e.detected).length,l=i?e.adapters.find(e=>e.id===i):null;return(0,G.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,G.jsxs)(`section`,{className:`rounded-2xl p-5 relative overflow-hidden`,style:{border:`1px solid var(--color-line-1)`,background:s?`linear-gradient(180deg, color-mix(in oklab, ${s.accent} 14%, transparent) 0%, transparent 70%), var(--color-surface-1)`:`var(--color-surface-1)`,boxShadow:s?`0 0 0 1px color-mix(in oklab, ${s.accent} 30%, transparent), 0 18px 40px color-mix(in oklab, ${s.accent} 14%, transparent)`:void 0},children:[(0,G.jsx)(`p`,{className:`ss-list-section-title`,style:{padding:0,marginBottom:12},children:`Connected agent`}),s?(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(Pf,{a:s,size:56}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`h2`,{className:`text-[18px] font-semibold text-[var(--color-fg-0)] tracking-tight`,children:s.displayName}),(0,G.jsx)(Ff,{a:s}),s.pinned?(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:s.accent,background:`color-mix(in oklab, ${s.accent} 14%, transparent)`,borderColor:`color-mix(in oklab, ${s.accent} 36%, transparent)`},title:`You pinned this agent as your default — auto-detection is overridden.`,children:`Pinned`}):(0,G.jsx)(`span`,{className:`agent-badge`,style:{color:`var(--color-fg-3)`,background:`var(--color-surface-2)`,borderColor:`var(--color-line-1)`},title:`SSG auto-detected this agent from process env and filesystem markers.`,children:`Auto-detected`})]}),(0,G.jsx)(`p`,{className:`text-[11px] font-mono uppercase tracking-wider text-[var(--color-fg-3)] mt-0.5`,children:s.vendor}),(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] mt-2 leading-relaxed`,children:s.pinned?`Pinned as your default agent — SSG will treat every tool call as ${s.displayName} regardless of auto-detection.`:s.id===`generic`?`No specific AI client detected — falling back to the generic adapter. Pick the agent you actually use and hit "Set as my agent" to override.`:s.healthy?`Auto-detected from process environment. If this isn't the agent you actually use, tap any other row and hit "Set as my agent" to pin it.`:`Forced via SSG_CLIENT — adapter is in use but its config dir is missing or incomplete.`}),s.pinned&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>{fetch(`/api/json/adapters/active`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({adapter:null})}).then(()=>t())},className:`text-[11px] font-mono text-[var(--color-fg-3)] hover:text-[var(--color-brand)] mt-3 cursor-pointer hover:underline`,children:`↺ reset to auto-detect`})]})]}):(0,G.jsx)(`p`,{className:`text-sm text-[var(--color-fg-2)]`,children:`No active adapter resolved.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`p`,{className:`ss-list-section-title`,style:{padding:0,marginBottom:0},children:[`All supported agents · `,e.adapters.length]}),(0,G.jsx)(`div`,{className:`ss-segment`,role:`tablist`,"aria-label":`Filter`,children:[`all`,`detected`,`available`].map(e=>(0,G.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":n===e,className:`ss-segment-item`,onClick:()=>r(e),children:e===`all`?`All`:e===`detected`?`Detected${c>0?` · ${c}`:``}`:`Available`},e))})]}),o.length>0?(0,G.jsx)(`div`,{className:`ss-list`,children:o.map(e=>(0,G.jsx)(Vf,{a:e,onOpen:()=>a(e.id)},e.id))}):(0,G.jsx)(`div`,{className:`rounded-2xl p-8 text-center`,style:{border:`1px dashed var(--color-line-1)`,background:`color-mix(in oklab, var(--color-surface-1) 50%, transparent)`},children:(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-3)] font-mono`,children:`no agents match this filter`})}),(0,G.jsx)(`div`,{className:`rounded-xl p-4`,style:{border:`1px dashed var(--color-line-1)`,background:`color-mix(in oklab, var(--color-surface-1) 50%, transparent)`},children:(0,G.jsxs)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] leading-relaxed`,children:[`SSG picks the active adapter at runtime — either from`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`SSG_CLIENT`}),` `,`or by auto-detecting your tool. Tap any agent to wire it into a project from the dashboard, or copy the`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg init`}),` command and run it yourself.`]})}),(0,G.jsx)(Uf,{ctx:e.context,adapters:e.adapters}),(0,G.jsx)(Gf,{}),l&&(0,G.jsx)(zf,{agent:l,ctx:e.context,onClose:()=>a(null),onInstalled:()=>t()})]})}function Uf({ctx:e,adapters:t}){let{data:n}=B(`/api/json/adapters/recent`),r=t.find(e=>e.active)??null,i=t.filter(e=>e.detected);return(0,G.jsxs)(`section`,{className:`rounded-2xl p-5`,style:{border:`1px solid var(--color-line-1)`,background:`var(--color-surface-1)`},children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between mb-3`,children:[(0,G.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight text-[var(--color-fg-0)]`,children:`How SigmaShake is connected`}),(0,G.jsx)(`span`,{className:`text-[11px] text-[var(--color-fg-3)]`,children:`Overview`})]}),(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] leading-relaxed mb-4`,children:`Each AI agent on your machine has its own config file. SigmaShake adds a small hook to those files so it sees every tool call before it runs.`}),(0,G.jsxs)(`ul`,{className:`space-y-2`,children:[(0,G.jsx)(Wf,{label:`Daemon`,status:`on`,detail:`Running — watching tool calls in real time.`}),(0,G.jsx)(Wf,{label:`Active AI agent`,status:r?`on`:`off`,detail:r?`${r.displayName} (${r.vendor})`:`Nothing detected yet — install an adapter below.`}),(0,G.jsx)(Wf,{label:`Wired-in agents`,status:i.length>0?`on`:`off`,detail:i.length>0?i.map(e=>e.displayName).join(`, `):`No agents wired in yet.`})]}),n?.recents&&n.recents.length>0&&(0,G.jsxs)(`div`,{className:`mt-5`,children:[(0,G.jsxs)(`p`,{className:`text-[11px] uppercase tracking-wider text-[var(--color-fg-3)] mb-2`,children:[`Projects connected (`,n.recents.length,`)`]}),(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:n.recents.map(t=>(0,G.jsxs)(`li`,{className:`flex items-center gap-3 rounded-lg px-3 py-2 text-[12px]`,style:{background:`var(--color-surface-2)`,border:`0.5px solid var(--color-line-1)`},children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{background:`var(--color-hig-green)`}}),(0,G.jsx)(`span`,{className:`font-mono text-[var(--color-fg-1)] truncate flex-1 min-w-0`,children:Rf(t.path,e.home)}),(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)] shrink-0`,children:new Date(t.lastUsed).toLocaleDateString(void 0,{month:`short`,day:`numeric`})})]},t.path))})]})]})}function Wf({label:e,status:t,detail:n}){return(0,G.jsxs)(`li`,{className:`flex items-center gap-3 rounded-lg px-3 py-2`,style:{background:`var(--color-surface-2)`,border:`0.5px solid var(--color-line-1)`},children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:t===`on`?`var(--color-hig-green)`:`var(--color-fg-4)`,boxShadow:t===`on`?`0 0 0 3px color-mix(in oklab, var(--color-hig-green) 22%, transparent)`:void 0}}),(0,G.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--color-fg-0)] w-32 shrink-0`,children:e}),(0,G.jsx)(`span`,{className:`text-[12px] text-[var(--color-fg-2)] flex-1 min-w-0 truncate`,children:n})]})}function Gf(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!0),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null);async function c(){a(!0),s(null);try{s(await(await fetch(`/api/json/uninstall-everything`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({keepData:n})})).json())}catch(e){s({ok:!1,error:`Could not reach SigmaShake`,detail:e instanceof Error?e.message:String(e)})}finally{a(!1)}}return(0,G.jsxs)(`section`,{className:`rounded-2xl p-5`,style:{border:`1px solid color-mix(in oklab, var(--color-hig-red) 28%, var(--color-line-1))`,background:`linear-gradient(180deg, color-mix(in oklab, var(--color-hig-red) 6%, transparent) 0%, transparent 100%), var(--color-surface-1)`},children:[(0,G.jsx)(`div`,{className:`flex items-baseline justify-between gap-3 flex-wrap`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight text-[var(--color-fg-0)]`,children:`Uninstall SigmaShake`}),(0,G.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-2)] leading-relaxed mt-1`,children:[`Removes the SigmaShake hook from every AI-agent config file on this machine and stops the daemon.`,` `,(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`The`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg`}),` binary itself stays installed — remove it with your package manager.`]})]})]})}),!e&&!o&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:`mt-4 text-[12.5px] font-medium px-4 py-2 rounded-lg cursor-pointer transition-colors`,style:{color:`var(--color-hig-red)`,border:`1px solid color-mix(in oklab, var(--color-hig-red) 40%, transparent)`,background:`color-mix(in oklab, var(--color-hig-red) 8%, transparent)`},children:`Uninstall SigmaShake everywhere…`}),e&&!o&&(0,G.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,G.jsxs)(`label`,{className:`flex items-start gap-2 text-[12px] text-[var(--color-fg-1)] cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked),className:`mt-0.5`}),(0,G.jsxs)(`span`,{children:[`Keep my activity history and license`,` `,(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`(~/.sigmashake/). Uncheck to wipe everything.`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>void c(),disabled:i,className:`text-[12.5px] font-medium px-4 py-2 rounded-lg cursor-pointer transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,style:{color:`white`,background:`var(--color-hig-red)`},children:i?`Uninstalling…`:`Yes — uninstall everywhere`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(!1),disabled:i,className:`text-[12.5px] font-medium px-4 py-2 rounded-lg cursor-pointer transition-colors`,style:{color:`var(--color-fg-1)`,background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`},children:`Cancel`})]})]}),o&&(0,G.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg px-4 py-3`,style:{border:`1px solid ${o.ok?`color-mix(in oklab, var(--color-hig-green) 38%, transparent)`:`color-mix(in oklab, var(--color-hig-red) 38%, transparent)`}`,background:o.ok?`color-mix(in oklab, var(--color-hig-green) 6%, transparent)`:`color-mix(in oklab, var(--color-hig-red) 6%, transparent)`},children:[(0,G.jsx)(`p`,{className:`text-[13px] font-semibold`,style:{color:o.ok?`var(--color-hig-green)`:`var(--color-hig-red)`},children:o.ok?`SigmaShake has been removed from this machine`:`Uninstall failed`}),(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--color-fg-2)] mt-1 leading-relaxed`,children:o.ok?(0,G.jsxs)(G.Fragment,{children:[`Hooks were stripped from every AI-agent config file. The daemon has stopped.`,o.packageManagerHint&&(0,G.jsxs)(G.Fragment,{children:[` `,`To also remove the`,` `,(0,G.jsx)(`code`,{className:`text-[var(--color-brand)]`,children:`ssg`}),` `,`binary, run:`,(0,G.jsx)(`code`,{className:`block mt-2 px-2 py-1.5 rounded bg-[var(--color-surface-2)] text-[var(--color-brand)] text-[11.5px] font-mono`,children:o.packageManagerHint})]})]}):(0,G.jsxs)(G.Fragment,{children:[o.error??`Unknown error.`,` `,o.detail&&(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:o.detail})]})})]}),(o.stdout||o.stderr)&&(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{className:`text-[11px] text-[var(--color-fg-3)] cursor-pointer hover:text-[var(--color-fg-1)]`,children:`Show full log`}),(0,G.jsx)(`pre`,{className:`text-[11px] font-mono rounded-md p-3 mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-all`,style:{background:`var(--color-surface-2)`,border:`1px solid var(--color-line-1)`,color:`var(--color-fg-2)`},children:[o.stdout,o.stderr].filter(Boolean).join(`
36
+ `)})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{s(null),t(!1)},className:`text-[11.5px] text-[var(--color-fg-3)] hover:text-[var(--color-fg-1)] cursor-pointer`,children:`↺ Close`})]})]})}function Kf(){return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-[20px] font-semibold tracking-tight text-[var(--color-fg-0)] leading-tight`,children:`Notifications`}),(0,G.jsx)(`p`,{className:`text-[12.5px] text-[var(--color-fg-3)] mt-1 leading-relaxed`,children:`Things that need your attention — rule drift, audit log capacity, daemon health, noisy rules. We update this list whenever something changes.`})]}),(0,G.jsx)(Ys,{showEmptyState:!0,hideHeader:!0})]})}function qf({status:e,className:t=``}){return(0,G.jsx)(`span`,{className:`status-dot ${e===`ok`?`bg-[var(--color-decision-allow)]`:e===`warn`?`bg-[var(--color-decision-ask)]`:e===`fail`?`bg-[var(--color-decision-block)]`:`bg-[var(--color-fg-3)]`} ${t}`})}function Jf({status:e}){let t=e===`ok`?`text-[var(--color-decision-allow)]`:e===`warn`?`text-[var(--color-decision-ask)]`:e===`fail`?`text-[var(--color-decision-block)]`:`text-[var(--color-fg-3)]`,n=e===`ok`?`OK`:e===`warn`?`Warn`:e===`fail`?`Fail`:`Skipped`;return(0,G.jsx)(`span`,{className:`text-[10.5px] font-medium uppercase tracking-wide ${t}`,children:n})}function Yf(e){return e===void 0?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Xf(e){if(!e)return``;let t=Math.floor((Date.now()-e)/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Zf(e,t){return t&&e.startsWith(t+`/`)?`~/`+e.slice(t.length+1):e===t?`~`:e}function Qf({file:e,home:t,wired:n}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-1 border-b border-[var(--color-line-0)] last:border-0 text-[11.5px]`,children:[(0,G.jsx)(qf,{status:e.exists?n===void 0||n?`ok`:`warn`:`skip`}),(0,G.jsx)(`code`,{className:`flex-1 truncate text-[var(--color-fg-1)]`,title:e.path,children:Zf(e.path,t)}),e.exists?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)]`,children:Yf(e.size)}),(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)] min-w-[60px] text-right`,children:Xf(e.modified_at)}),n===!1&&(0,G.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wide text-[var(--color-decision-ask)]`,title:`File exists but does not appear to contain SSG wiring`,children:`no ssg`}),n===!0&&(0,G.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wide text-[var(--color-decision-allow)]`,title:`File contains SSG hook / MCP entries`,children:`wired`})]}):(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)]`,children:`missing`})]})}function $f({title:e,status:t,children:n,hint:r}){return(0,G.jsxs)(`section`,{className:`hig-card hig-card-padded`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between mb-3`,children:[(0,G.jsxs)(`h2`,{className:`text-[13px] font-semibold text-[var(--color-fg-0)] flex items-center gap-2`,children:[t!==void 0&&(0,G.jsx)(qf,{status:t}),e]}),r&&(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)]`,children:r})]}),(0,G.jsx)(`div`,{children:n})]})}function ep({k:e,v:t,mono:n=!1}){return(0,G.jsxs)(`div`,{className:`flex items-baseline gap-3 py-1 text-[11.5px] border-b border-[var(--color-line-0)] last:border-0`,children:[(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)] min-w-[110px]`,children:e}),(0,G.jsx)(`span`,{className:`flex-1 text-[var(--color-fg-1)] ${n?`font-mono text-[11px]`:``}`,children:t})]})}var tp={"claude-code":`Claude Code`,cursor:`Cursor`,codex:`Codex CLI`,pi:`Pi Agent`,gemini:`Gemini CLI`,antigravity:`Antigravity`,copilot:`GitHub Copilot`};function np({adapter:e,home:t}){let n=tp[e.id]??e.id,r=e.artifacts.filter(e=>e.exists&&e.ssg_wired).length,i=e.artifacts.filter(e=>e.exists).length;return(0,G.jsxs)(`div`,{className:`rounded-md border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(qf,{status:e.status}),(0,G.jsx)(`span`,{className:`text-[12.5px] font-semibold text-[var(--color-fg-0)]`,children:n}),e.active&&(0,G.jsx)(`span`,{className:`text-[9.5px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded-sm text-[var(--color-hig-blue)] bg-[color-mix(in_oklab,var(--color-hig-blue)_14%,transparent)]`,title:`This is the adapter ssg is currently using at runtime`,children:`Active`})]}),(0,G.jsxs)(`span`,{className:`text-[10px] text-[var(--color-fg-3)]`,children:[r,`/`,e.artifacts.length,` wired`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-2 text-[10.5px]`,children:[(0,G.jsx)(`span`,{className:e.detected?`text-[var(--color-decision-allow)]`:`text-[var(--color-fg-3)]`,children:e.detected?`● detected`:`○ not detected`}),(0,G.jsx)(`span`,{className:e.healthy?`text-[var(--color-decision-allow)]`:`text-[var(--color-fg-3)]`,children:e.healthy?`● binary healthy`:`○ binary missing`}),i===0&&(0,G.jsx)(`span`,{className:`text-[var(--color-fg-3)]`,children:`○ no config files on disk`})]}),e.artifacts.length>0&&(0,G.jsx)(`div`,{className:`border-t border-[var(--color-line-0)] pt-1`,children:e.artifacts.map(e=>(0,G.jsx)(Qf,{file:e,home:t,wired:e.exists?e.ssg_wired:void 0},e.path))}),e.status===`warn`&&i===0&&(0,G.jsxs)(`div`,{className:`mt-2 text-[10.5px] text-[var(--color-fg-3)]`,children:[`Wire it up with:`,` `,(0,G.jsxs)(`code`,{className:`font-mono text-[var(--color-fg-1)]`,children:[`ssg init --client=`,e.id]})]})]})}function rp(){let{data:e,loading:t,error:n,refetch:r}=B(`/api/json/setup-status`);if(t&&!e)return(0,G.jsx)(`div`,{className:`py-12 text-center text-[var(--color-fg-3)] text-[12px]`,children:`Reading setup status…`});if(n||!e)return(0,G.jsxs)(`div`,{className:`hig-card hig-card-padded text-[12px]`,children:[(0,G.jsxs)(`p`,{className:`text-[var(--color-decision-block)] mb-2`,children:[`Could not load /api/json/setup-status: `,n??`no response`]}),(0,G.jsx)(`button`,{onClick:r,className:`hig-button hig-button-small`,children:`Retry`})]});let{summary:i,license:a,daemon:o,dashboard:s,native:c,db:l,mcp:u,rules:d,init_files:f,adapters:p,hub:m,checks:h,home:g,cwd:_}=e;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-[20px] font-semibold tracking-tight text-[var(--color-fg-0)] leading-tight`,children:`Setup Status`}),(0,G.jsxs)(`p`,{className:`text-[12.5px] text-[var(--color-fg-3)] mt-1 leading-relaxed`,children:[`What `,(0,G.jsx)(`code`,{className:`font-mono`,children:`ssg init`}),` wrote and whether every piece is wired up — license, hooks, MCP, native engine, daemon, rules, and hub packages.`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`text-[11px] text-[var(--color-fg-3)]`,children:[`ssg v`,e.version]}),(0,G.jsx)(`button`,{onClick:r,className:`hig-button hig-button-small`,children:`Refresh`})]})]}),(0,G.jsxs)(`section`,{className:`hig-card hig-card-padded flex items-center gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(qf,{status:i.overall,className:`!w-3 !h-3`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide text-[var(--color-fg-3)]`,children:`Overall`}),(0,G.jsx)(`div`,{className:`text-[14px] font-semibold text-[var(--color-fg-0)]`,children:i.overall===`ok`?`Healthy`:i.overall===`warn`?`Needs attention`:i.overall===`fail`?`Broken`:`Skipped`})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-4 text-[12px]`,children:[(0,G.jsxs)(`span`,{className:`text-[var(--color-decision-allow)]`,children:[`● `,i.ok,` ok`]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-decision-ask)]`,children:[`● `,i.warn,` warn`]}),i.fail>0&&(0,G.jsxs)(`span`,{className:`text-[var(--color-decision-block)]`,children:[`● `,i.fail,` fail`]}),(0,G.jsxs)(`span`,{className:`text-[var(--color-fg-3)]`,children:[`○ `,i.skip,` skipped`]})]}),(0,G.jsxs)(`div`,{className:`ml-auto text-right`,children:[(0,G.jsx)(`div`,{className:`text-[10.5px] uppercase tracking-wide text-[var(--color-fg-3)]`,children:`Working dir`}),(0,G.jsx)(`code`,{className:`text-[11px] text-[var(--color-fg-1)]`,title:_,children:Zf(_,g)})]})]}),(0,G.jsx)($f,{title:`Checks`,hint:`${h.length} probes`,children:(0,G.jsx)(`div`,{children:h.map(e=>(0,G.jsxs)(`div`,{className:`flex items-start gap-3 py-1.5 border-b border-[var(--color-line-0)] last:border-0`,children:[(0,G.jsx)(qf,{status:e.status,className:`mt-1`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--color-fg-0)]`,children:e.name}),(0,G.jsx)(Jf,{status:e.status})]}),(0,G.jsx)(`div`,{className:`text-[11px] text-[var(--color-fg-2)] mt-0.5 break-words`,children:e.detail}),e.fix&&(0,G.jsxs)(`div`,{className:`text-[11px] text-[var(--color-hig-blue)] font-mono mt-0.5`,children:[`→ `,e.fix]})]})]},e.name))})}),(0,G.jsxs)($f,{title:`License & authentication`,status:a.status===`healthy`||a.status===`healthy_free`?`ok`:`warn`,children:[(0,G.jsx)(ep,{k:`Tier`,v:a.tier_label}),(0,G.jsx)(ep,{k:`Status`,v:a.status}),(0,G.jsx)(ep,{k:`Account`,v:a.email??`—`}),(0,G.jsx)(ep,{k:`Auth method`,v:a.auth_method??`—`}),(0,G.jsx)(ep,{k:`Evals today`,v:a.eval_daily_limit===null?`${a.evals_today.toLocaleString()} (unlimited)`:`${a.evals_today.toLocaleString()} / ${a.eval_daily_limit.toLocaleString()}`}),(0,G.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(`div`,{className:`text-[10.5px] uppercase tracking-wide text-[var(--color-fg-3)] mb-1`,children:`Credential files`}),(0,G.jsx)(Qf,{file:a.license_file,home:g}),(0,G.jsx)(Qf,{file:a.hosts_file,home:g})]})]}),(0,G.jsxs)($f,{title:`Runtime processes`,status:o.alive&&s.alive?`ok`:`warn`,children:[(0,G.jsx)(ep,{k:`Daemon (evald)`,v:o.alive?`running — PID ${o.pid}`:o.pid?`stale — PID ${o.pid} in pidfile but process gone`:`not running`}),(0,G.jsx)(ep,{k:`Daemon socket`,v:o.socket_exists?`present`:`missing`,mono:!0}),(0,G.jsx)(ep,{k:`Dashboard (serve)`,v:s.alive?`running — PID ${s.pid}`:`not running`}),(0,G.jsx)(ep,{k:`Native engine`,v:c.available?`loaded — sub-ms eval available`:`unavailable — TypeScript fallback`})]}),(0,G.jsxs)($f,{title:`Database & MCP`,status:l.status,children:[(0,G.jsx)(ep,{k:`Rules in DB`,v:l.rules.toLocaleString()}),(0,G.jsx)(ep,{k:`Audit log rows`,v:l.audit_rows.toLocaleString()}),(0,G.jsx)(ep,{k:`DB path`,v:Zf(l.path,g),mono:!0}),(0,G.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-[var(--color-line-0)]`,children:[(0,G.jsx)(`div`,{className:`text-[10.5px] uppercase tracking-wide text-[var(--color-fg-3)] mb-1`,children:`MCP server`}),(0,G.jsx)(ep,{k:`Status`,v:u.status===`active`?`active — ${u.recent_5min.toLocaleString()} calls in last 5 min`:u.status===`configured`?`configured — ${u.total.toLocaleString()} historical calls, none recent`:`no MCP traffic recorded yet`}),(0,G.jsx)(ep,{k:`All-time calls`,v:u.total.toLocaleString()})]})]}),(0,G.jsxs)($f,{title:`Rules directories`,status:d.local_count>0?`ok`:`warn`,children:[(0,G.jsx)(ep,{k:`Local`,v:`${d.local_count} .rules file${d.local_count===1?``:`s`}`}),(0,G.jsx)(ep,{k:`Local path`,v:Zf(d.local_dir,g),mono:!0}),(0,G.jsx)(ep,{k:`Global`,v:`${d.global_count} .rules file${d.global_count===1?``:`s`}`}),(0,G.jsx)(ep,{k:`Global path`,v:Zf(d.global_dir,g),mono:!0})]}),(0,G.jsx)($f,{title:`Project init files`,hint:`${f.filter(e=>e.exists).length}/${f.length} present`,children:(0,G.jsx)(`div`,{children:f.map(e=>(0,G.jsx)(Qf,{file:e,home:g},e.path))})}),(0,G.jsx)($f,{title:`Adapters, hooks & MCP files`,hint:e.active_adapter?`Active: ${tp[e.active_adapter]??e.active_adapter}`:`No active adapter`,children:(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-1 lg:grid-cols-2`,children:p.map(e=>(0,G.jsx)(np,{adapter:e,home:g},e.id))})}),(0,G.jsxs)($f,{title:`Hub-installed rulesets`,status:m.installs.length===0?`skip`:m.drift===0?`ok`:`warn`,hint:m.installs.length===0?`none installed`:`${m.in_sync} in sync${m.drift>0?`, ${m.drift} drift`:``}`,children:[(0,G.jsx)(Qf,{file:m.pins_file,home:g}),m.installs.length===0?(0,G.jsxs)(`p`,{className:`text-[11.5px] text-[var(--color-fg-3)] mt-2`,children:[`Install rulesets from the Hub tab. Each install is recorded per project path in `,(0,G.jsx)(`code`,{className:`font-mono`,children:`hub-pins.json`}),`.`]}):(0,G.jsx)(`div`,{className:`mt-2 space-y-2`,children:m.installs.map((e,t)=>(0,G.jsxs)(`div`,{className:`rounded-md border border-[var(--color-line-1)] bg-[var(--color-surface-1)] p-2 text-[11.5px]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,G.jsx)(qf,{status:e.in_sync?`ok`:`warn`}),(0,G.jsx)(`span`,{className:`font-semibold text-[var(--color-fg-0)]`,children:e.id}),(0,G.jsx)(`span`,{className:`text-[10.5px] text-[var(--color-fg-3)]`,children:e.version}),(0,G.jsx)(`span`,{className:`ml-auto text-[10.5px] text-[var(--color-fg-3)]`,children:Xf(e.installed_at)})]}),(0,G.jsx)(`code`,{className:`block truncate text-[11px] text-[var(--color-fg-2)]`,title:e.path,children:Zf(e.path,g)}),e.files.length>0&&(0,G.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.files.map(e=>(0,G.jsx)(`span`,{className:`text-[10px] font-mono text-[var(--color-fg-2)] bg-[var(--color-surface-2)] border border-[var(--color-line-0)] rounded-sm px-1.5 py-0.5`,children:e},e))}),!e.in_sync&&e.drift_reason&&(0,G.jsxs)(`div`,{className:`mt-1 text-[10.5px] text-[var(--color-decision-ask)]`,children:[`Drift: `,e.drift_reason]})]},`${e.id}-${e.path}-${t}`))})]})]})}var ip=`ssg-dashboard-tabs`,ap=2e3,op=6e3;function sp(){return`tab-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function cp(){let[e,t]=(0,_.useState)(0),[n,r]=(0,_.useState)(!0),i=(0,_.useRef)(sp()),a=(0,_.useRef)(new Map);return(0,_.useEffect)(()=>{if(typeof BroadcastChannel>`u`)return;let e=new BroadcastChannel(ip);function n(){let e=Date.now();for(let[t,n]of a.current.entries())e-n>op&&a.current.delete(t);let n=a.current.size;t(n),r([...a.current.keys(),i.current].sort()[0]===i.current)}function o(e){let t=e.data;!t||t.id===i.current||(t.type===`leave`?a.current.delete(t.id):a.current.set(t.id,Date.now()),n())}e.addEventListener(`message`,o),e.postMessage({type:`join`,id:i.current});let s=setInterval(()=>{e.postMessage({type:`heartbeat`,id:i.current}),n()},ap),c=()=>{e.postMessage({type:`leave`,id:i.current})};return window.addEventListener(`beforeunload`,c),()=>{clearInterval(s),e.postMessage({type:`leave`,id:i.current}),e.removeEventListener(`message`,o),e.close(),window.removeEventListener(`beforeunload`,c)}},[]),{otherTabCount:e,isLeader:n}}var lp=b;function up(){(0,_.useEffect)(()=>Ce([]),[]);let e=(0,_.useSyncExternalStore)(he,ge),[,t]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(e.connected||e.lastErrorAt===null)return;let n=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(n)},[e.connected,e.lastErrorAt]);let n=dp(e),r=n===`reconnecting`&&e.lastErrorAt!==null?Math.max(0,Math.ceil((e.lastErrorAt+e.reconnectDelayMs-Date.now())/1e3)):null,i=Math.round(lp/1e3);if(n===`connected`)return(0,G.jsxs)(`div`,{className:`chip`,title:`Telemetry Live — SSE connected`,"data-testid":`sse-status-chip`,"data-state":`connected`,children:[(0,G.jsx)(`span`,{className:`status-dot bg-[var(--color-decision-allow)]`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:`Live`})]});let a=n===`reconnecting`,o=a?{color:`var(--color-hig-orange)`,background:`color-mix(in oklab, var(--color-hig-orange) 14%, transparent)`}:{color:`var(--color-hig-red)`,background:`color-mix(in oklab, var(--color-hig-red) 14%, transparent)`},s=a?`bg-[var(--color-hig-orange)]`:`bg-[var(--color-hig-red)]`,c=a?r===null?`Reconnecting`:`Reconnect ${r}s`:`Offline`,l=`Live paused · ${i}s poll`;return(0,G.jsxs)(`div`,{className:`chip`,style:o,title:a?`Live stream down — reconnect in ${r??`…`}s (attempt ${e.reconnectAttempts}). Dashboard is polling every ${i}s until SSE recovers.`:`Live stream disconnected. Dashboard is polling every ${i}s — data still updates, just at a coarser cadence.`,"data-testid":`sse-status-chip`,"data-state":n,role:`status`,"aria-live":`polite`,children:[(0,G.jsx)(`span`,{className:`status-dot ${s} pulse-soft`}),(0,G.jsx)(`span`,{className:`hidden md:inline`,children:l}),(0,G.jsx)(`span`,{className:`md:hidden`,children:c})]})}function dp(e){return e.connected?`connected`:e.reconnectAttempts>0||e.lastErrorAt!==null?`reconnecting`:`disconnected`}var fp=`ssg:ui:font-scale:v1`,pp=[{label:`S`,value:.9},{label:`M`,value:1},{label:`L`,value:1.15},{label:`XL`,value:1.3}],mp=1;function hp(e){if(typeof e!=`number`||!Number.isFinite(e))return mp;let t=pp.find(t=>Math.abs(t.value-e)<.001);return t?t.value:mp}function gp(){if(typeof localStorage>`u`)return mp;try{let e=localStorage.getItem(fp);return e===null?mp:hp(parseFloat(e))}catch{return mp}}function _p(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(fp,String(e))}catch{}}function vp(e){typeof document>`u`||(document.documentElement.style.setProperty(`--ssg-font-scale`,String(e)),document.documentElement.style.fontSize=`${16*e}px`)}function yp(){let[e,t]=(0,_.useState)(()=>{let e=gp();return vp(e),e});return(0,_.useEffect)(()=>{vp(e)},[e]),{scale:e,setScale:(0,_.useCallback)(e=>{t(e),_p(e),vp(e)},[])}}function bp(){let{scale:e,setScale:t}=yp();return(0,G.jsx)(`div`,{role:`radiogroup`,"aria-label":`Font size`,className:`hig-segmented`,style:{height:`24px`},children:pp.map(n=>{let r=Math.abs(n.value-e)<.001;return(0,G.jsx)(`button`,{role:`radio`,"aria-checked":r,"aria-selected":r,onClick:()=>t(n.value),title:`Font size: ${n.label} (${Math.round(n.value*100)}%)`,className:r?`selected`:``,style:{height:`20px`,padding:`0 8px`,fontSize:`11px`},children:n.label},n.label)})})}var xp=`ssg:ui:theme:v1`,Sp=[{label:`System (Auto)`,value:`default`},{label:`Apple Light`,value:`apple-light`},{label:`Apple Dark`,value:`apple-dark`},{label:`Light (Legacy)`,value:`light`},{label:`Dracula`,value:`dracula`},{label:`Gruvbox Dark`,value:`gruvbox-dark`},{label:`Gruvbox Light`,value:`gruvbox-light`},{label:`Tokyo Night`,value:`tokyo-night`},{label:`Catppuccin Mocha`,value:`catppuccin-mocha`},{label:`Nord`,value:`nord`},{label:`One Dark Pro`,value:`one-dark-pro`}],Cp=new Set([`light`,`gruvbox-light`,`apple-light`]),wp=new Set([`apple-dark`,`dracula`,`gruvbox-dark`,`tokyo-night`,`catppuccin-mocha`,`nord`,`one-dark-pro`]),Tp=`default`;function Ep(e){return typeof e==`string`&&Sp.some(t=>t.value===e)}function Dp(){if(typeof localStorage>`u`)return Tp;try{let e=localStorage.getItem(xp);return Ep(e)?e:Tp}catch{return Tp}}function Op(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(xp,e)}catch{}}function kp(e){typeof document>`u`||(e===Tp?(document.documentElement.removeAttribute(`data-theme`),document.documentElement.style.colorScheme=`light dark`):(document.documentElement.setAttribute(`data-theme`,e),document.documentElement.style.colorScheme=Cp.has(e)?`light`:wp.has(e)?`dark`:`light dark`))}function Ap(){let[e,t]=(0,_.useState)(()=>{let e=Dp();return kp(e),e});return(0,_.useEffect)(()=>{kp(e)},[e]),{theme:e,setTheme:(0,_.useCallback)(e=>{t(e),Op(e),kp(e)},[])}}function jp(){let{theme:e,setTheme:t}=Ap();return(0,G.jsx)(`select`,{value:e,onChange:e=>t(e.target.value),"aria-label":`Color theme`,title:`Color theme`,className:`hig-input cursor-pointer`,style:{height:`24px`,paddingRight:`22px`,minWidth:`90px`},children:Sp.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function Mp(){let{mode:e,setMode:t}=ru(),n=e===`newcomer`;return(0,G.jsxs)(`div`,{role:`radiogroup`,"aria-label":`UI mode`,className:`hig-segmented`,style:{height:`24px`},title:n?`Switch to advanced view`:`Switch to simple view`,children:[(0,G.jsx)(`button`,{role:`radio`,"aria-checked":n,"aria-selected":n,onClick:()=>t(`newcomer`),className:n?`selected`:``,style:{height:`20px`,padding:`0 10px`,fontSize:`11.5px`},children:`Simple`}),(0,G.jsx)(`button`,{role:`radio`,"aria-checked":!n,"aria-selected":!n,onClick:()=>t(`pro`),className:n?``:`selected`,style:{height:`20px`,padding:`0 10px`,fontSize:`11.5px`},children:`Advanced`})]})}function Np(){let[e,t]=(0,_.useState)(()=>Ro()),[n,r]=(0,_.useState)(()=>Bo()),[i,a]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{zo(e)},[e]),(0,_.useEffect)(()=>{Vo(n)},[n]),(0,G.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,G.jsxs)(`button`,{onClick:()=>t(e=>!e),onContextMenu:e=>{e.preventDefault(),a(e=>!e)},className:`chip cursor-pointer hover:bg-[var(--color-fill-2)] transition-colors`,style:e?{color:`var(--color-decision-allow)`}:void 0,title:e?`Decision chimes on · click to mute · right-click for volume`:`Decision chimes off · click to enable`,children:[(0,G.jsx)(`span`,{className:`status-dot ${e?`bg-[var(--color-decision-allow)]`:`bg-[var(--color-fg-4)]`}`}),(0,G.jsxs)(`span`,{className:`hidden sm:inline`,children:[`Audio `,e?`on`:`off`]})]}),i&&(0,G.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-50 flex items-center gap-2 px-3 py-2 hig-card hig-card-padded shadow-[var(--hig-shadow-2)]`,onMouseLeave:()=>a(!1),children:[(0,G.jsx)(`span`,{className:`overline`,children:`Volume`}),(0,G.jsx)(`input`,{type:`range`,min:0,max:1,step:.02,value:n,onChange:e=>r(parseFloat(e.target.value)),className:`w-24`,style:{accentColor:`var(--color-accent)`}}),(0,G.jsx)(`span`,{className:`text-[11px] font-mono tabular-nums text-[var(--color-fg-2)] w-8 text-right`,children:Math.round(n*100)})]})]})}var Pp={dashboard:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`9`,rx:`1.5`}),(0,G.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`5`,rx:`1.5`}),(0,G.jsx)(`rect`,{x:`14`,y:`12`,width:`7`,height:`9`,rx:`1.5`}),(0,G.jsx)(`rect`,{x:`3`,y:`16`,width:`7`,height:`5`,rx:`1.5`})]}),graph:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`6`,cy:`18`,r:`2.4`}),(0,G.jsx)(`circle`,{cx:`18`,cy:`6`,r:`2.4`}),(0,G.jsx)(`circle`,{cx:`18`,cy:`18`,r:`2.4`}),(0,G.jsx)(`circle`,{cx:`12`,cy:`11`,r:`2.4`}),(0,G.jsx)(`path`,{d:`M7.5 16.5l3-4M13.5 11.5l3-3.5M13.5 12l3 4.5`})]}),rules:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M9 5h11M9 12h11M9 19h11`}),(0,G.jsx)(`path`,{d:`M4 5l1 1 2-2M4 12l1 1 2-2M4 19l1 1 2-2`})]}),hub:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,G.jsx)(`path`,{d:`M3 12h18`}),(0,G.jsx)(`path`,{d:`M12 3a14 14 0 010 18M12 3a14 14 0 000 18`})]}),audit:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`11`,cy:`11`,r:`6.5`}),(0,G.jsx)(`path`,{d:`M21 21l-5-5`})]}),approvals:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M5 7h14v12a2 2 0 01-2 2H7a2 2 0 01-2-2z`}),(0,G.jsx)(`path`,{d:`M9 3v4M15 3v4`}),(0,G.jsx)(`path`,{d:`M9 13l2 2 4-4`})]}),profile:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`8`,r:`4`}),(0,G.jsx)(`path`,{d:`M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8`})]}),monitor:(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M3 12h3l3-7 4 14 3-7h5`})}),observability:(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M4 20h16M7 16V8M11 16V4M15 16v-6M19 16v-3`})}),debug:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`rect`,{x:`7`,y:`7`,width:`10`,height:`12`,rx:`5`}),(0,G.jsx)(`path`,{d:`M12 7V4M9 4l3 3 3-3`}),(0,G.jsx)(`path`,{d:`M5 11l2-1M5 18l2-1M19 11l-2-1M19 18l-2-1`})]}),home:(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M3 11l9-7 9 7v9a2 2 0 01-2 2h-3v-7H10v7H5a2 2 0 01-2-2z`})}),guardrails:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M12 3l8 3.7v6.3c0 5-3.5 9.6-8 11-4.5-1.4-8-6-8-11V6.7L12 3z`}),(0,G.jsx)(`path`,{d:`M9 12l2 2 4-4`})]}),tryit:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M9 3v6L4.5 18a2 2 0 001.7 3h11.6a2 2 0 001.7-3L15 9V3`}),(0,G.jsx)(`path`,{d:`M8 3h8`})]}),agents:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`circle`,{cx:`8`,cy:`9`,r:`3`}),(0,G.jsx)(`circle`,{cx:`16`,cy:`9`,r:`3`}),(0,G.jsx)(`path`,{d:`M3 19c.7-2.5 2.6-4 5-4`}),(0,G.jsx)(`path`,{d:`M21 19c-.7-2.5-2.6-4-5-4`}),(0,G.jsx)(`path`,{d:`M9 17.5c.8-1 1.8-1.5 3-1.5s2.2.5 3 1.5`})]}),notifications:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M18 16v-5a6 6 0 1 0-12 0v5l-2 2h16z`}),(0,G.jsx)(`path`,{d:`M10 20a2 2 0 0 0 4 0`})]}),setup:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M9 12l2 2 4-4`}),(0,G.jsx)(`path`,{d:`M12 3l8 3.7v6.3c0 5-3.5 9.6-8 11-4.5-1.4-8-6-8-11V6.7L12 3z`})]})},Fp=[{title:`Overview`,items:[{path:`/`,label:`Dashboard`,icon:`dashboard`},{path:`/notifications`,label:`Notifications`,icon:`notifications`},{path:`/agents`,label:`Agents`,icon:`agents`},{path:`/graph`,label:`Graph`,icon:`graph`}]},{title:`Rules`,items:[{path:`/rules`,label:`Rules`,icon:`rules`},{path:`/hub`,label:`Hub`,icon:`hub`},{path:`/approvals`,label:`Approvals`,icon:`approvals`}]},{title:`Activity`,items:[{path:`/audit`,label:`Audit`,icon:`audit`},{path:`/monitor`,label:`Monitor`,icon:`monitor`},{path:`/observability`,label:`Observability`,icon:`observability`}]},{title:`Tools`,items:[{path:`/setup`,label:`Setup`,icon:`setup`},{path:`/debug`,label:`Debug`,icon:`debug`},{path:`/profile`,label:`Profile`,icon:`profile`}]}],Ip=[{title:`Get Started`,items:[{path:`/`,label:`Home`,icon:`home`},{path:`/agents`,label:`Agents`,icon:`agents`},{path:`/guardrails`,label:`Guardrails`,icon:`guardrails`},{path:`/try`,label:`Try It`,icon:`tryit`}]},{title:`Activity`,items:[{path:`/notifications`,label:`Notifications`,icon:`notifications`},{path:`/audit`,label:`Activity`,icon:`audit`},{path:`/approvals`,label:`Approvals`,icon:`approvals`}]},{title:`You`,items:[{path:`/setup`,label:`Setup`,icon:`setup`},{path:`/profile`,label:`Profile`,icon:`profile`}]}];function Lp(e){return e===`newcomer`?Ip:Fp}function Rp(e){let t=Math.max(0,e-Date.now()),n=Math.floor(t/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m ${n%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function zp(){let{data:e}=B(`/api/json/daemon-status`,[Ae([`counters-updated`])[`counters-updated`]]),[t,n]=(0,_.useState)(!1),[,r]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(e?.status!==`degraded`||!e.hibernation)return;let t=setInterval(()=>r(e=>e+1),1e3);return()=>clearInterval(t)},[e?.status,e?.hibernation]);let i=e?.status??`starting`,a=i===`running`?`bg-[var(--color-decision-allow)]`:i===`starting`||i===`degraded`?`bg-[var(--color-decision-ask)]`:`bg-[var(--color-decision-block)]`,o=i===`starting`||i===`degraded`?`pulse-soft`:``,s=i===`degraded`&&e?.hibernation?Rp(e.hibernation.nextRetryAt):null,c=i===`running`?`Daemon`:i===`starting`?`Booting`:i===`degraded`?`Retry ${s??`…`}`:i===`error`?`Error`:`Offline`;return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`button`,{onClick:()=>n(e=>!e),className:`chip cursor-pointer hover:bg-[var(--color-fill-2)] transition-colors`,title:i===`running`?`Daemon running`:i===`starting`?`Daemon starting…`:i===`degraded`?`Daemon hibernating — retry in ${s??`…`}`:i===`error`?`Daemon error`:`Daemon stopped`,children:[(0,G.jsx)(`span`,{className:`status-dot ${a} ${o}`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:c})]}),t&&(0,G.jsxs)(`div`,{className:`absolute right-0 top-7 z-50 w-72 hig-card hig-card-padded text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`span`,{className:`overline`,children:`Eval Daemon`}),(0,G.jsx)(`button`,{onClick:()=>n(!1),className:`text-[var(--color-fg-3)] hover:text-[var(--color-fg-0)] cursor-pointer`,children:`✕`})]}),(0,G.jsxs)(`div`,{className:`space-y-1 text-[var(--color-fg-2)]`,children:[(0,G.jsxs)(`div`,{className:`font-mono text-[11px]`,children:[`status:`,` `,(0,G.jsx)(`span`,{className:i===`running`?`text-[var(--color-decision-allow)]`:i===`starting`||i===`degraded`?`text-[var(--color-decision-ask)]`:`text-[var(--color-decision-block)]`,children:i})]}),e?.pid&&(0,G.jsxs)(`div`,{className:`font-mono text-[11px]`,children:[`pid: `,e.pid]}),i===`degraded`&&e?.hibernation&&(0,G.jsxs)(`div`,{className:`mt-2 rounded-lg p-2 text-[11px] space-y-0.5`,style:{background:`color-mix(in oklab, var(--color-hig-orange) 14%, transparent)`,color:`color-mix(in oklab, var(--color-hig-orange) 90%, var(--color-fg-0))`},children:[(0,G.jsxs)(`div`,{children:[`next retry: `,(0,G.jsx)(`span`,{className:`font-medium`,children:s})]}),(0,G.jsxs)(`div`,{children:[`episode attempt: `,e.hibernation.attempt,e.hibernation.reason?` (${e.hibernation.reason})`:``]}),(0,G.jsx)(`div`,{className:`opacity-70`,children:`Slow-tier supervisor is retrying at long backoff — no manual restart required.`})]})]}),e?.logTail&&e.logTail.length>0&&(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsx)(`div`,{className:`overline mb-1`,children:`Recent log`}),(0,G.jsx)(`pre`,{className:`bg-[var(--color-surface-2)] border border-[var(--color-line-0)] rounded-md p-2 text-[10px] text-[var(--color-fg-2)] overflow-x-auto whitespace-pre-wrap break-all max-h-32 overflow-y-auto`,children:e.logTail.join(`
37
+ `)})]})]})]})}function Bp(){let{data:e}=B(`/api/state/activity-degraded`);if(!e?.degraded)return null;let t=e.since?new Date(e.since).toLocaleTimeString():`recently`;return(0,G.jsxs)(`div`,{role:`status`,className:`hig-banner hig-banner-warning`,title:e.reason??`audit-worker degraded`,children:[(0,G.jsx)(`span`,{children:`⚠`}),(0,G.jsxs)(`span`,{children:[`Audit pipeline degraded since `,t,` — entries may be missing. Run`,` `,(0,G.jsx)(`code`,{className:`font-mono`,children:`ssg daemon --status`}),` to inspect.`]})]})}function Vp(){let{data:e}=B(`/api/json/license`,[Ae([`counters-updated`])[`counters-updated`]]);return!e||e.tier!==`unlicensed`||e.status===`needs_reauth`||e.status===`needs_login`||e.eval_daily_limit===null||e.evals_today<e.eval_daily_limit?null:(0,G.jsxs)(`div`,{role:`alert`,className:`hig-banner hig-banner-error`,title:`Free tier daily eval limit reached — rules are being bypassed until quota resets`,children:[(0,G.jsx)(`span`,{children:`●`}),(0,G.jsxs)(`span`,{children:[`Quota exhausted — `,e.evals_today.toLocaleString(),`/`,e.eval_daily_limit.toLocaleString(),` evals used today. BLOCK and ASK rules are being bypassed (fail-open) until daily reset.`,` `,(0,G.jsx)(`a`,{href:e.upgrade_url,target:`_blank`,rel:`noopener noreferrer`,className:`underline font-medium`,children:`Upgrade to Pro →`})]})]})}function Hp(){let{data:e}=B(`/api/json/license`,[Ae([`counters-updated`])[`counters-updated`]]);if(!e||e.status!==`needs_reauth`)return null;let t=e.detail??`License JWT invalid or expired`;return(0,G.jsxs)(`div`,{role:`alert`,className:`hig-banner hig-banner-warning`,title:`Re-authentication required — paid-tier features are paused until you re-login`,children:[(0,G.jsx)(`span`,{children:`⚠`}),(0,G.jsxs)(`span`,{children:[`Re-authentication required — `,t,`. Run`,` `,(0,G.jsx)(`code`,{className:`font-mono`,children:`ssg auth login`}),` in your terminal to restore your tier.`]})]})}function Up(){let{data:e,refetch:t}=B(`/api/json/ask-mode`),[n,r]=(0,_.useState)(!1),i=e?.mode??`tty`;async function a(e){if(!(n||e===i)){r(!0);try{await fetch(`/api/json/ask-mode`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({mode:e})}),t()}finally{r(!1)}}}let o=i===`tty`;return(0,G.jsxs)(`button`,{onClick:()=>a(o?`dashboard`:`tty`),disabled:n,className:`chip cursor-pointer hover:bg-[var(--color-fill-2)] transition-colors disabled:opacity-50`,title:o?`ASK decisions prompt in the native IDE/TTY. Click to route to dashboard.`:`ASK decisions queue on /approvals. Click to route to native prompt.`,children:[(0,G.jsx)(`span`,{className:`status-dot ${o?`bg-[var(--color-hig-blue)]`:`bg-[var(--color-hig-purple)]`}`}),(0,G.jsxs)(`span`,{className:`hidden sm:inline`,children:[`Ask · `,o?`Native`:`Dashboard`]})]})}function Wp(e){let t=new Date(e);return`${t.getHours().toString().padStart(2,`0`)}:${t.getMinutes().toString().padStart(2,`0`)}`}var Gp={on:`audit`,audit:`off`,off:`on`};function Kp(){let{data:e,refetch:t}=B(`/api/json/mode`,[Ae([`mode-changed`])[`mode-changed`]]),[n,r]=(0,_.useState)(!1),i=e?.mode??`on`;async function a(e,i){if(!n){r(!0);try{let n={mode:e};typeof i==`number`&&i>0&&(n.forMs=i),await fetch(`/api/json/mode`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify(n)}),t()}finally{r(!1)}}}let o=i===`on`?`bg-[var(--color-hig-green)]`:i===`audit`?`bg-[var(--color-hig-orange)]`:`bg-[var(--color-hig-red)]`,s=e?.rearmAt!==void 0&&i!==`on`?` · until ${Wp(e.rearmAt)}`:``,c=`SSG · ${i.toUpperCase()}${s}`;return(0,G.jsxs)(`button`,{onClick:e=>{e.shiftKey?a(i===`off`?`audit`:`on`):a(Gp[i])},disabled:n,className:`chip cursor-pointer hover:bg-[var(--color-fill-2)] transition-colors disabled:opacity-50`,title:i===`on`?`SSG ON — rules enforce normally. Click to cycle: On → Audit → Off.`:i===`audit`?`SSG AUDIT — rules log only, nothing blocked or prompted. Click for Off; Shift+Click to resume On.`:`SSG OFF — kill switch engaged, evaluator returns allow. Click to resume On; Shift+Click for Audit.`,children:[(0,G.jsx)(`span`,{className:`status-dot ${o}`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:c})]})}function qp(){let{data:e,refetch:t}=B(`/api/json/mode`,[Ae([`mode-changed`])[`mode-changed`]]),n=e?.mode??`on`;if(n===`on`)return null;let r=e?.rearmAt===void 0?``:` Auto-restores at ${Wp(e.rearmAt)}.`,i=n===`off`?`SSG is OFF — kill switch engaged.`:`SSG is in AUDIT mode — log-only.`,a=n===`off`?`Every tool call is being allowed without evaluation.${r}`:`Rules still match for the audit log, but nothing is being blocked or prompted.${r}`,o=n===`off`?`hig-banner hig-banner-error`:`hig-banner hig-banner-warning`;async function s(){await fetch(`/api/json/mode`,{method:`POST`,headers:{"Content-Type":`application/json`,...ke()},body:JSON.stringify({mode:`on`})}),t()}return(0,G.jsxs)(`div`,{className:o,children:[(0,G.jsxs)(`svg`,{className:`shrink-0`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),(0,G.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),(0,G.jsxs)(`span`,{className:`flex-1`,children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:i}),` `,a]}),(0,G.jsx)(`button`,{onClick:s,className:`hig-button hig-button-small`,title:`Re-enable normal rule enforcement`,children:`Resume`})]})}function Jp({onRefresh:e}){return(0,G.jsx)(`button`,{onClick:e,className:`hig-button`,title:`Reset page — clears stale graph state without dropping SSE`,"aria-label":`Refresh page`,children:(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M21 12a9 9 0 1 1-3-6.7`}),(0,G.jsx)(`polyline`,{points:`21 3 21 9 15 9`})]})})}function Yp(){let{data:e}=B(`/api/json/mcp-status`,[Ae([`activity-updated`])[`activity-updated`]]),t=e?.status??`inactive`;if(t===`inactive`)return null;let n=t===`active`?`bg-[var(--color-hig-blue)]`:`bg-[var(--color-fg-3)]`,r=t===`active`?`MCP active`:`MCP idle`;return(0,G.jsxs)(`div`,{className:`chip`,title:t===`active`?`MCP server: ${e?.recentCount??0} evals in last 5 min`:`MCP server: ${e?.totalCount??0} total evals`,children:[(0,G.jsx)(`span`,{className:`status-dot ${n}`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:r})]})}function Xp(){let{data:e}=B(`/api/json/adapters`);if(!e)return null;let t=e.adapters.find(e=>e.active);if(!t)return null;let n=t.id===`generic`;return(0,G.jsxs)(`a`,{href:`/agents`,className:`chip ss-agent-chip cursor-pointer transition-all`,title:n?`No specific AI client detected — SSG is running in generic adapter mode. Click to wire one up.`:`Connected agent: ${t.displayName} (${t.vendor}). Click to manage.`,style:{"--agent-accent":t.accent},"data-generic":n?`true`:`false`,children:[(0,G.jsx)(`span`,{className:`status-dot`,style:{background:t.accent,boxShadow:`0 0 6px color-mix(in oklab, ${t.accent} 60%, transparent)`}}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:t.displayName})]})}function Zp(e,t){if(e===`/`)return t===`newcomer`?(0,G.jsx)(_f,{}):(0,G.jsx)(ac,{});if(e===`/classic`)return(0,G.jsx)(Qc,{});if(e===`/graph`)return(0,G.jsx)(Ud,{});if(e===`/debug`)return(0,G.jsx)(Gd,{});if(e===`/rules`)return(0,G.jsx)(pl,{});if(e===`/audit`)return(0,G.jsx)(_l,{});if(e===`/approvals`)return(0,G.jsx)(Nl,{});if(e===`/profile`)return(0,G.jsx)(Yl,{});if(e===`/agents`)return(0,G.jsx)(Hf,{});if(e===`/notifications`)return(0,G.jsx)(Kf,{});if(e===`/setup`)return(0,G.jsx)(rp,{});if(e===`/try`)return(0,G.jsx)(jf,{});if(e===`/guardrails`)return(0,G.jsx)(su,{});if(e===`/hub/connect`)return(0,G.jsx)(Su,{});if(e===`/hub/publish`)return(0,G.jsx)(Cu,{});if(e.startsWith(`/hub/`)){let t=e.slice(5);if(t)return(0,G.jsx)(xu,{id:t})}return e===`/hub`?(0,G.jsx)(vu,{}):e===`/monitor`?(0,G.jsx)(Iu,{}):e===`/observability`?(0,G.jsx)(nd,{}):(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-24 text-[var(--color-fg-3)]`,children:[(0,G.jsx)(`p`,{className:`overline mb-2`,children:`Error · 404`}),(0,G.jsx)(`p`,{className:`text-sm`,children:`Page not found`}),(0,G.jsx)(`a`,{href:`/`,className:`mt-4 text-[12px] text-[var(--color-hig-blue)] hover:underline`,children:`← Back to dashboard`})]})}function Qp(e,t){return e===`/`?t===`newcomer`?`Home`:`Dashboard`:e===`/classic`?`Classic Dashboard`:e===`/graph`?`Graph`:e===`/debug`?`Debug`:e===`/rules`?`Rules`:e===`/audit`?t===`newcomer`?`Activity`:`Audit`:e===`/approvals`?`Approvals`:e===`/profile`?`Profile`:e===`/agents`?`Agents`:e===`/notifications`?`Notifications`:e===`/setup`?`Setup Status`:e===`/try`?`Try It`:e===`/guardrails`?`Guardrails`:e===`/hub/connect`?`Connect Hub`:e===`/hub/publish`?`Publish to Hub`:e.startsWith(`/hub/`)||e===`/hub`?`Hub`:e===`/monitor`?`Monitor`:e===`/observability`?`Observability`:`SigmaShake`}function $p(e){history.pushState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}function em({count:e}){let[t,n]=(0,_.useState)(!1);return t||e===0?null:(0,G.jsxs)(`div`,{className:`hig-banner hig-banner-warning`,children:[(0,G.jsxs)(`svg`,{className:`shrink-0`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),(0,G.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,G.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),(0,G.jsxs)(`span`,{className:`flex-1`,children:[(0,G.jsxs)(`span`,{className:`font-semibold`,children:[e,` other `,e===1?`tab`:`tabs`,` open.`]}),` `,`Each tab holds a live SSE connection. Browsers limit connections per origin — too many tabs will prevent this page from loading.`,` `,(0,G.jsx)(`span`,{className:`opacity-70`,children:`Close other tabs to restore full live-update functionality.`})]}),(0,G.jsx)(`button`,{onClick:()=>n(!0),className:`opacity-60 hover:opacity-100 transition-opacity shrink-0 cursor-pointer`,title:`Dismiss`,children:(0,G.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function tm({pathname:e,navSections:t,open:n,onClose:r}){let i=t=>t===`/`?e===`/`:e.startsWith(t);return(0,G.jsxs)(`aside`,{className:`hig-sidebar ${n?`open`:``}`,"aria-label":`Primary`,children:[(0,G.jsxs)(`div`,{className:`hig-sidebar-header`,children:[(0,G.jsx)(`span`,{className:`hig-app-icon`,"aria-hidden":`true`,children:`SS`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`hig-app-name`,children:`SigmaShake`}),(0,G.jsx)(`div`,{className:`hig-app-meta`,children:`Governance`})]})]}),(0,G.jsx)(`nav`,{className:`hig-sidebar-nav`,children:t.map(e=>(0,G.jsxs)(`div`,{className:`hig-sidebar-section`,children:[(0,G.jsx)(`div`,{className:`hig-sidebar-section-title`,children:e.title}),e.items.map(e=>(0,G.jsxs)(`a`,{href:e.path,onClick:r,className:`hig-sidebar-item`,"data-active":i(e.path)?`true`:`false`,children:[(0,G.jsx)(`span`,{className:`hig-sidebar-icon`,"aria-hidden":`true`,children:Pp[e.icon]}),(0,G.jsx)(`span`,{children:e.label})]},e.path))]},e.title))})]})}function nm(){let[e,t]=(0,_.useState)(window.location.pathname),[n,r]=(0,_.useState)(0),[i,a]=(0,_.useState)(!1),{otherTabCount:o}=cp(),{mode:s}=ru(),c=Lp(s),l=Qp(e,s);return(0,_.useEffect)(()=>{let e=()=>t(window.location.pathname);return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,_.useEffect)(()=>{a(!1)},[e]),(0,_.useEffect)(()=>{let e=e=>{let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);!n||n.startsWith(`http`)||n.startsWith(`//`)||(e.preventDefault(),$p(n))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[]),(0,G.jsxs)(`div`,{className:`hig-app`,children:[(0,G.jsx)(tm,{pathname:e,navSections:c,open:i,onClose:()=>a(!1)}),(0,G.jsxs)(`div`,{className:`hig-window`,children:[(0,G.jsxs)(`header`,{className:`hig-toolbar`,children:[(0,G.jsx)(`button`,{"aria-label":`Toggle sidebar`,className:`md:hidden hig-button hig-button-small`,onClick:()=>a(e=>!e),children:(0,G.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 18 18`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,children:[(0,G.jsx)(`line`,{x1:`2`,y1:`5`,x2:`16`,y2:`5`}),(0,G.jsx)(`line`,{x1:`2`,y1:`9`,x2:`16`,y2:`9`}),(0,G.jsx)(`line`,{x1:`2`,y1:`13`,x2:`16`,y2:`13`})]})}),(0,G.jsx)(`h1`,{className:`hig-toolbar-title`,children:l}),(0,G.jsx)(`div`,{className:`hig-toolbar-spacer`}),(0,G.jsxs)(`div`,{className:`hig-toolbar-controls hidden md:flex`,children:[o>0&&(0,G.jsxs)(`span`,{className:`chip`,style:{color:`var(--color-hig-orange)`,background:`color-mix(in oklab, var(--color-hig-orange) 14%, transparent)`},title:`${o} other tab${o===1?``:`s`} open — may cause connection issues`,children:[o+1,` tabs`]}),(0,G.jsx)(up,{}),(0,G.jsx)(Kp,{}),(0,G.jsx)(Up,{}),(0,G.jsx)(Xp,{}),(0,G.jsx)(Yp,{}),(0,G.jsx)(zp,{}),(0,G.jsx)(Jp,{onRefresh:()=>r(e=>e+1)}),(0,G.jsx)(Mp,{}),(0,G.jsx)(jp,{}),(0,G.jsx)(bp,{}),(0,G.jsx)(Np,{})]})]}),(0,G.jsx)(qp,{}),(0,G.jsx)(em,{count:o}),(0,G.jsx)(Hp,{}),(0,G.jsx)(Vp,{}),(0,G.jsx)(Bp,{}),(0,G.jsx)(`main`,{className:`hig-content px-6 py-6`,children:Zp(e,s)},n)]})]})}var rm=document.getElementById(`app-root`);if(!rm)throw Error(`Missing #app-root`);g.createRoot(rm).render((0,G.jsx)(_.StrictMode,{children:(0,G.jsx)(nm,{})}));