claude-terminal-prism 0.1.23 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -30,15 +30,15 @@ import{r as C,a as cl}from"./vendor-zustand-zAtGz-1b.js";import{r as N0,R as Ln,
|
|
|
30
30
|
`+u[n].replace(" at new "," at ");return e.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",e.displayName)),h}while(1<=n&&0<=a);break}}}finally{ri=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?dl(l):""}function B0(e,t){switch(e.tag){case 26:case 27:case 5:return dl(e.type);case 16:return dl("Lazy");case 13:return e.child!==t&&t!==null?dl("Suspense Fallback"):dl("Suspense");case 19:return dl("SuspenseList");case 0:case 15:return fi(e.type,!1);case 11:return fi(e.type.render,!1);case 1:return fi(e.type,!0);case 31:return dl("Activity");default:return""}}function Jo(e){try{var t="",l=null;do t+=B0(e,l),l=e,e=e.return;while(e);return t}catch(n){return`
|
|
31
31
|
Error generating stack: `+n.message+`
|
|
32
32
|
`+n.stack}}var lc=Object.prototype.hasOwnProperty,Kc=xe.unstable_scheduleCallback,di=xe.unstable_cancelCallback,R0=xe.unstable_shouldYield,H0=xe.unstable_requestPaint,qe=xe.unstable_now,_0=xe.unstable_getCurrentPriorityLevel,Ur=xe.unstable_ImmediatePriority,Br=xe.unstable_UserBlockingPriority,ms=xe.unstable_NormalPriority,L0=xe.unstable_LowPriority,Rr=xe.unstable_IdlePriority,q0=xe.log,Y0=xe.unstable_setDisableYieldValue,ya=null,Ye=null;function Xt(e){if(typeof q0=="function"&&Y0(e),Ye&&typeof Ye.setStrictMode=="function")try{Ye.setStrictMode(ya,e)}catch{}}var Ge=Math.clz32?Math.clz32:Q0,G0=Math.log,X0=Math.LN2;function Q0(e){return e>>>=0,e===0?32:31-(G0(e)/X0|0)|0}var Ma=256,Ea=262144,Da=4194304;function ml(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 Ys(e,t,l){var n=e.pendingLanes;if(n===0)return 0;var a=0,s=e.suspendedLanes,c=e.pingedLanes;e=e.warmLanes;var o=n&134217727;return o!==0?(n=o&~s,n!==0?a=ml(n):(c&=o,c!==0?a=ml(c):l||(l=o&~e,l!==0&&(a=ml(l))))):(o=n&~s,o!==0?a=ml(o):c!==0?a=ml(c):l||(l=n&~e,l!==0&&(a=ml(l)))),a===0?0:t!==0&&t!==a&&!(t&s)&&(s=a&-a,l=t&-t,s>=l||s===32&&(l&4194048)!==0)?t:a}function va(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Z0(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 Hr(){var e=Da;return Da<<=1,!(Da&62914560)&&(Da=4194304),e}function mi(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function ba(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function V0(e,t,l,n,a,s){var c=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var o=e.entanglements,u=e.expirationTimes,f=e.hiddenUpdates;for(l=c&~l;0<l;){var h=31-Ge(l),p=1<<h;o[h]=0,u[h]=-1;var m=f[h];if(m!==null)for(f[h]=null,h=0;h<m.length;h++){var y=m[h];y!==null&&(y.lane&=-536870913)}l&=~p}n!==0&&_r(e,n,0),s!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=s&~(c&~t))}function _r(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-Ge(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|l&261930}function Lr(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var n=31-Ge(l),a=1<<n;a&t|e[n]&t&&(e[n]|=t),l&=~a}}function qr(e,t){var l=t&-t;return l=l&42?1:$c(l),l&(e.suspendedLanes|t)?0:l}function $c(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 Fc(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Yr(){var e=G.p;return e!==0?e:(e=window.event,e===void 0?32:f0(e.type))}function Ko(e,t){var l=G.p;try{return G.p=e,t()}finally{G.p=l}}var ol=Math.random().toString(36).slice(2),je="__reactFiber$"+ol,Oe="__reactProps$"+ol,bn="__reactContainer$"+ol,nc="__reactEvents$"+ol,J0="__reactListeners$"+ol,K0="__reactHandles$"+ol,$o="__reactResources$"+ol,ja="__reactMarker$"+ol;function Wc(e){delete e[je],delete e[Oe],delete e[nc],delete e[J0],delete e[K0]}function Ql(e){var t=e[je];if(t)return t;for(var l=e.parentNode;l;){if(t=l[bn]||l[je]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=lr(e);e!==null;){if(l=e[je])return l;e=lr(e)}return t}e=l,l=e.parentNode}return null}function jn(e){if(e=e[je]||e[bn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Rn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(N(33))}function tn(e){var t=e[$o];return t||(t=e[$o]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ge(e){e[ja]=!0}var Gr=new Set,Xr={};function kl(e,t){rn(e,t),rn(e+"Capture",t)}function rn(e,t){for(Xr[e]=t,e=0;e<t.length;e++)Gr.add(t[e])}var $0=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]*$"),Fo={},Wo={};function F0(e){return lc.call(Wo,e)?!0:lc.call(Fo,e)?!1:$0.test(e)?Wo[e]=!0:(Fo[e]=!0,!1)}function Ja(e,t,l){if(F0(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Oa(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function pt(e,t,l,n){if(n===null)e.removeAttribute(l);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+n)}}function Ke(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Qr(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function W0(e,t,l){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(c){l=""+c,s.call(this,c)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(c){l=""+c},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ac(e){if(!e._valueTracker){var t=Qr(e)?"checked":"value";e._valueTracker=W0(e,t,""+e[t])}}function Zr(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),n="";return e&&(n=Qr(e)?e.checked?"true":"false":e.value),e=n,e!==l?(t.setValue(e),!0):!1}function hs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var I0=/[\n"\\]/g;function We(e){return e.replace(I0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function sc(e,t,l,n,a,s,c,o){e.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?e.type=c:e.removeAttribute("type"),t!=null?c==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ke(t)):e.value!==""+Ke(t)&&(e.value=""+Ke(t)):c!=="submit"&&c!=="reset"||e.removeAttribute("value"),t!=null?ic(e,c,Ke(t)):l!=null?ic(e,c,Ke(l)):n!=null&&e.removeAttribute("value"),a==null&&s!=null&&(e.defaultChecked=!!s),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+Ke(o):e.removeAttribute("name")}function Vr(e,t,l,n,a,s,c,o){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||l!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){ac(e);return}l=l!=null?""+Ke(l):"",t=t!=null?""+Ke(t):l,o||t===e.value||(e.value=t),e.defaultValue=t}n=n??a,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=o?e.checked:!!n,e.defaultChecked=!!n,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.name=c),ac(e)}function ic(e,t,l){t==="number"&&hs(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function ln(e,t,l,n){if(e=e.options,t){t={};for(var a=0;a<l.length;a++)t["$"+l[a]]=!0;for(l=0;l<e.length;l++)a=t.hasOwnProperty("$"+e[l].value),e[l].selected!==a&&(e[l].selected=a),a&&n&&(e[l].defaultSelected=!0)}else{for(l=""+Ke(l),t=null,a=0;a<e.length;a++){if(e[a].value===l){e[a].selected=!0,n&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function Jr(e,t,l){if(t!=null&&(t=""+Ke(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Ke(l):""}function Kr(e,t,l,n){if(t==null){if(n!=null){if(l!=null)throw Error(N(92));if(Bn(n)){if(1<n.length)throw Error(N(93));n=n[0]}l=n}l==null&&(l=""),t=l}l=Ke(t),e.defaultValue=l,n=e.textContent,n===l&&n!==""&&n!==null&&(e.value=n),ac(e)}function fn(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var P0=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 Io(e,t,l){var n=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,l):typeof l!="number"||l===0||P0.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function $r(e,t,l){if(t!=null&&typeof t!="object")throw Error(N(62));if(e=e.style,l!=null){for(var n in l)!l.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var a in t)n=t[a],t.hasOwnProperty(a)&&l[a]!==n&&Io(e,a,n)}else for(var s in t)t.hasOwnProperty(s)&&Io(e,s,t[s])}function Ic(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 em=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"]]),tm=/^[\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 Ka(e){return tm.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function zt(){}var cc=null;function Pc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zl=null,nn=null;function Po(e){var t=jn(e);if(t&&(e=t.stateNode)){var l=e[Oe]||null;e:switch(e=t.stateNode,t.type){case"input":if(sc(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+We(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var n=l[t];if(n!==e&&n.form===e.form){var a=n[Oe]||null;if(!a)throw Error(N(90));sc(n,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<l.length;t++)n=l[t],n.form===e.form&&Zr(n)}break e;case"textarea":Jr(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&ln(e,!!l.multiple,t,!1)}}}var hi=!1;function Fr(e,t,l){if(hi)return e(t,l);hi=!0;try{var n=e(t);return n}finally{if(hi=!1,(Zl!==null||nn!==null)&&(Ps(),Zl&&(t=Zl,e=nn,nn=Zl=null,Po(t),e)))for(t=0;t<e.length;t++)Po(e[t])}}function aa(e,t){var l=e.stateNode;if(l===null)return null;var n=l[Oe]||null;if(n===null)return null;l=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(N(231,t,typeof l));return l}var wt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oc=!1;if(wt)try{var An={};Object.defineProperty(An,"passive",{get:function(){oc=!0}}),window.addEventListener("test",An,An),window.removeEventListener("test",An,An)}catch{oc=!1}var Qt=null,eo=null,$a=null;function Wr(){if($a)return $a;var e,t=eo,l=t.length,n,a="value"in Qt?Qt.value:Qt.textContent,s=a.length;for(e=0;e<l&&t[e]===a[e];e++);var c=l-e;for(n=1;n<=c&&t[l-n]===a[s-n];n++);return $a=a.slice(e,1<n?1-n:void 0)}function Fa(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 Ua(){return!0}function eu(){return!1}function Ue(e){function t(l,n,a,s,c){this._reactName=l,this._targetInst=a,this.type=n,this.nativeEvent=s,this.target=c,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(l=e[o],this[o]=l?l(s):s[o]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Ua:eu,this.isPropagationStopped=eu,this}return ee(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Ua)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ua)},persist:function(){},isPersistent:Ua}),t}var Al={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gs=Ue(Al),Sa=ee({},Al,{view:0,detail:0}),lm=Ue(Sa),xi,pi,wn,Xs=ee({},Sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:to,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!==wn&&(wn&&e.type==="mousemove"?(xi=e.screenX-wn.screenX,pi=e.screenY-wn.screenY):pi=xi=0,wn=e),xi)},movementY:function(e){return"movementY"in e?e.movementY:pi}}),tu=Ue(Xs),nm=ee({},Xs,{dataTransfer:0}),am=Ue(nm),sm=ee({},Sa,{relatedTarget:0}),gi=Ue(sm),im=ee({},Al,{animationName:0,elapsedTime:0,pseudoElement:0}),cm=Ue(im),om=ee({},Al,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),um=Ue(om),rm=ee({},Al,{data:0}),lu=Ue(rm),fm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dm={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"},mm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hm(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=mm[e])?!!t[e]:!1}function to(){return hm}var xm=ee({},Sa,{key:function(e){if(e.key){var t=fm[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Fa(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?dm[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:to,charCode:function(e){return e.type==="keypress"?Fa(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Fa(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),pm=Ue(xm),gm=ee({},Xs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nu=Ue(gm),ym=ee({},Sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:to}),vm=Ue(ym),bm=ee({},Al,{propertyName:0,elapsedTime:0,pseudoElement:0}),jm=Ue(bm),Sm=ee({},Xs,{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}),Nm=Ue(Sm),zm=ee({},Al,{newState:0,oldState:0}),Cm=Ue(zm),Tm=[9,13,27,32],lo=wt&&"CompositionEvent"in window,Qn=null;wt&&"documentMode"in document&&(Qn=document.documentMode);var km=wt&&"TextEvent"in window&&!Qn,Ir=wt&&(!lo||Qn&&8<Qn&&11>=Qn),au=" ",su=!1;function Pr(e,t){switch(e){case"keyup":return Tm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ef(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Vl=!1;function Am(e,t){switch(e){case"compositionend":return ef(t);case"keypress":return t.which!==32?null:(su=!0,au);case"textInput":return e=t.data,e===au&&su?null:e;default:return null}}function wm(e,t){if(Vl)return e==="compositionend"||!lo&&Pr(e,t)?(e=Wr(),$a=eo=Qt=null,Vl=!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 Ir&&t.locale!=="ko"?null:t.data;default:return null}}var Mm={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 iu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Mm[e.type]:t==="textarea"}function tf(e,t,l,n){Zl?nn?nn.push(n):nn=[n]:Zl=n,t=Ds(t,"onChange"),0<t.length&&(l=new Gs("onChange","change",null,l,n),e.push({event:l,listeners:t}))}var Zn=null,sa=null;function Em(e){Wd(e,0)}function Qs(e){var t=Rn(e);if(Zr(t))return e}function cu(e,t){if(e==="change")return t}var lf=!1;if(wt){var yi;if(wt){var vi="oninput"in document;if(!vi){var ou=document.createElement("div");ou.setAttribute("oninput","return;"),vi=typeof ou.oninput=="function"}yi=vi}else yi=!1;lf=yi&&(!document.documentMode||9<document.documentMode)}function uu(){Zn&&(Zn.detachEvent("onpropertychange",nf),sa=Zn=null)}function nf(e){if(e.propertyName==="value"&&Qs(sa)){var t=[];tf(t,sa,e,Pc(e)),Fr(Em,t)}}function Dm(e,t,l){e==="focusin"?(uu(),Zn=t,sa=l,Zn.attachEvent("onpropertychange",nf)):e==="focusout"&&uu()}function Om(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Qs(sa)}function Um(e,t){if(e==="click")return Qs(t)}function Bm(e,t){if(e==="input"||e==="change")return Qs(t)}function Rm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Qe=typeof Object.is=="function"?Object.is:Rm;function ia(e,t){if(Qe(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),n=Object.keys(t);if(l.length!==n.length)return!1;for(n=0;n<l.length;n++){var a=l[n];if(!lc.call(t,a)||!Qe(e[a],t[a]))return!1}return!0}function ru(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fu(e,t){var l=ru(e);e=0;for(var n;l;){if(l.nodeType===3){if(n=e+l.textContent.length,e<=t&&n>=t)return{node:l,offset:t-e};e=n}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=ru(l)}}function af(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?af(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=hs(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=hs(e.document)}return t}function no(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 Hm=wt&&"documentMode"in document&&11>=document.documentMode,Jl=null,uc=null,Vn=null,rc=!1;function du(e,t,l){var n=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;rc||Jl==null||Jl!==hs(n)||(n=Jl,"selectionStart"in n&&no(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Vn&&ia(Vn,n)||(Vn=n,n=Ds(uc,"onSelect"),0<n.length&&(t=new Gs("onSelect","select",null,t,l),e.push({event:t,listeners:n}),t.target=Jl)))}function fl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Kl={animationend:fl("Animation","AnimationEnd"),animationiteration:fl("Animation","AnimationIteration"),animationstart:fl("Animation","AnimationStart"),transitionrun:fl("Transition","TransitionRun"),transitionstart:fl("Transition","TransitionStart"),transitioncancel:fl("Transition","TransitionCancel"),transitionend:fl("Transition","TransitionEnd")},bi={},cf={};wt&&(cf=document.createElement("div").style,"AnimationEvent"in window||(delete Kl.animationend.animation,delete Kl.animationiteration.animation,delete Kl.animationstart.animation),"TransitionEvent"in window||delete Kl.transitionend.transition);function wl(e){if(bi[e])return bi[e];if(!Kl[e])return e;var t=Kl[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in cf)return bi[e]=t[l];return e}var of=wl("animationend"),uf=wl("animationiteration"),rf=wl("animationstart"),_m=wl("transitionrun"),Lm=wl("transitionstart"),qm=wl("transitioncancel"),ff=wl("transitionend"),df=new Map,fc="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(" ");fc.push("scrollEnd");function ot(e,t){df.set(e,t),kl(t,[e])}var xs=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!==null&&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)},Je=[],$l=0,ao=0;function Zs(){for(var e=$l,t=ao=$l=0;t<e;){var l=Je[t];Je[t++]=null;var n=Je[t];Je[t++]=null;var a=Je[t];Je[t++]=null;var s=Je[t];if(Je[t++]=null,n!==null&&a!==null){var c=n.pending;c===null?a.next=a:(a.next=c.next,c.next=a),n.pending=a}s!==0&&mf(l,a,s)}}function Vs(e,t,l,n){Je[$l++]=e,Je[$l++]=t,Je[$l++]=l,Je[$l++]=n,ao|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function so(e,t,l,n){return Vs(e,t,l,n),ps(e)}function Ml(e,t){return Vs(e,null,null,t),ps(e)}function mf(e,t,l){e.lanes|=l;var n=e.alternate;n!==null&&(n.lanes|=l);for(var a=!1,s=e.return;s!==null;)s.childLanes|=l,n=s.alternate,n!==null&&(n.childLanes|=l),s.tag===22&&(e=s.stateNode,e===null||e._visibility&1||(a=!0)),e=s,s=s.return;return e.tag===3?(s=e.stateNode,a&&t!==null&&(a=31-Ge(l),e=s.hiddenUpdates,n=e[a],n===null?e[a]=[t]:n.push(t),t.lane=l|536870912),s):null}function ps(e){if(50<ta)throw ta=0,Dc=null,Error(N(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Fl={};function Ym(e,t,l,n){this.tag=e,this.key=l,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _e(e,t,l,n){return new Ym(e,t,l,n)}function io(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Tt(e,t){var l=e.alternate;return l===null?(l=_e(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function hf(e,t){e.flags&=65011714;var l=e.alternate;return l===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=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Wa(e,t,l,n,a,s){var c=0;if(n=e,typeof e=="function")io(e)&&(c=1);else if(typeof e=="string")c=Vh(e,l,dt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Ii:return e=_e(31,l,t,a),e.elementType=Ii,e.lanes=s,e;case Gl:return yl(l.children,a,s,t);case Dr:c=8,a|=24;break;case $i:return e=_e(12,l,t,a|2),e.elementType=$i,e.lanes=s,e;case Fi:return e=_e(13,l,t,a),e.elementType=Fi,e.lanes=s,e;case Wi:return e=_e(19,l,t,a),e.elementType=Wi,e.lanes=s,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Nt:c=10;break e;case Or:c=9;break e;case Vc:c=11;break e;case Jc:c=14;break e;case Rt:c=16,n=null;break e}c=29,l=Error(N(130,e===null?"null":typeof e,"")),n=null}return t=_e(c,l,t,a),t.elementType=e,t.type=n,t.lanes=s,t}function yl(e,t,l,n){return e=_e(7,e,n,t),e.lanes=l,e}function ji(e,t,l){return e=_e(6,e,null,t),e.lanes=l,e}function xf(e){var t=_e(18,null,null,0);return t.stateNode=e,t}function Si(e,t,l){return t=_e(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var mu=new WeakMap;function Ie(e,t){if(typeof e=="object"&&e!==null){var l=mu.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Jo(t)},mu.set(e,t),t)}return{value:e,source:t,stack:Jo(t)}}var Wl=[],Il=0,gs=null,ca=0,$e=[],Fe=0,nl=null,ut=1,rt="";function jt(e,t){Wl[Il++]=ca,Wl[Il++]=gs,gs=e,ca=t}function pf(e,t,l){$e[Fe++]=ut,$e[Fe++]=rt,$e[Fe++]=nl,nl=e;var n=ut;e=rt;var a=32-Ge(n)-1;n&=~(1<<a),l+=1;var s=32-Ge(t)+a;if(30<s){var c=a-a%5;s=(n&(1<<c)-1).toString(32),n>>=c,a-=c,ut=1<<32-Ge(t)+a|l<<a|n,rt=s+e}else ut=1<<s|l<<a|n,rt=e}function co(e){e.return!==null&&(jt(e,1),pf(e,1,0))}function oo(e){for(;e===gs;)gs=Wl[--Il],Wl[Il]=null,ca=Wl[--Il],Wl[Il]=null;for(;e===nl;)nl=$e[--Fe],$e[Fe]=null,rt=$e[--Fe],$e[Fe]=null,ut=$e[--Fe],$e[Fe]=null}function gf(e,t){$e[Fe++]=ut,$e[Fe++]=rt,$e[Fe++]=nl,ut=t.id,rt=t.overflow,nl=e}var Se=null,P=null,q=!1,$t=null,Pe=!1,dc=Error(N(519));function al(e){var t=Error(N(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw oa(Ie(t,e)),dc}function hu(e){var t=e.stateNode,l=e.type,n=e.memoizedProps;switch(t[je]=e,t[Oe]=n,l){case"dialog":H("cancel",t),H("close",t);break;case"iframe":case"object":case"embed":H("load",t);break;case"video":case"audio":for(l=0;l<da.length;l++)H(da[l],t);break;case"source":H("error",t);break;case"img":case"image":case"link":H("error",t),H("load",t);break;case"details":H("toggle",t);break;case"input":H("invalid",t),Vr(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":H("invalid",t);break;case"textarea":H("invalid",t),Kr(t,n.value,n.defaultValue,n.children)}l=n.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||n.suppressHydrationWarning===!0||Pd(t.textContent,l)?(n.popover!=null&&(H("beforetoggle",t),H("toggle",t)),n.onScroll!=null&&H("scroll",t),n.onScrollEnd!=null&&H("scrollend",t),n.onClick!=null&&(t.onclick=zt),t=!0):t=!1,t||al(e,!0)}function xu(e){for(Se=e.return;Se;)switch(Se.tag){case 5:case 31:case 13:Pe=!1;return;case 27:case 3:Pe=!0;return;default:Se=Se.return}}function Hl(e){if(e!==Se)return!1;if(!q)return xu(e),q=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Hc(e.type,e.memoizedProps)),l=!l),l&&P&&al(e),xu(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(N(317));P=tr(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(N(317));P=tr(e)}else t===27?(t=P,ul(e.type)?(e=Yc,Yc=null,P=e):P=t):P=Se?lt(e.stateNode.nextSibling):null;return!0}function Sl(){P=Se=null,q=!1}function Ni(){var e=$t;return e!==null&&(Ee===null?Ee=e:Ee.push.apply(Ee,e),$t=null),e}function oa(e){$t===null?$t=[e]:$t.push(e)}var mc=mt(null),El=null,Ct=null;function _t(e,t,l){W(mc,t._currentValue),t._currentValue=l}function kt(e){e._currentValue=mc.current,ye(mc)}function hc(e,t,l){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===l)break;e=e.return}}function xc(e,t,l,n){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var s=a.dependencies;if(s!==null){var c=a.child;s=s.firstContext;e:for(;s!==null;){var o=s;s=a;for(var u=0;u<t.length;u++)if(o.context===t[u]){s.lanes|=l,o=s.alternate,o!==null&&(o.lanes|=l),hc(s.return,l,e),n||(c=null);break e}s=o.next}}else if(a.tag===18){if(c=a.return,c===null)throw Error(N(341));c.lanes|=l,s=c.alternate,s!==null&&(s.lanes|=l),hc(c,l,e),c=null}else c=a.child;if(c!==null)c.return=a;else for(c=a;c!==null;){if(c===e){c=null;break}if(a=c.sibling,a!==null){a.return=c.return,c=a;break}c=c.return}a=c}}function Sn(e,t,l,n){e=null;for(var a=t,s=!1;a!==null;){if(!s){if(a.flags&524288)s=!0;else if(a.flags&262144)break}if(a.tag===10){var c=a.alternate;if(c===null)throw Error(N(387));if(c=c.memoizedProps,c!==null){var o=a.type;Qe(a.pendingProps.value,c.value)||(e!==null?e.push(o):e=[o])}}else if(a===rs.current){if(c=a.alternate,c===null)throw Error(N(387));c.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(ha):e=[ha])}a=a.return}e!==null&&xc(t,e,l,n),t.flags|=262144}function ys(e){for(e=e.firstContext;e!==null;){if(!Qe(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Nl(e){El=e,Ct=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ne(e){return yf(El,e)}function Ba(e,t){return El===null&&Nl(e),yf(e,t)}function yf(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},Ct===null){if(e===null)throw Error(N(308));Ct=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ct=Ct.next=t;return l}var Gm=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},Xm=xe.unstable_scheduleCallback,Qm=xe.unstable_NormalPriority,fe={$$typeof:Nt,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function uo(){return{controller:new Gm,data:new Map,refCount:0}}function Na(e){e.refCount--,e.refCount===0&&Xm(Qm,function(){e.controller.abort()})}var Jn=null,pc=0,dn=0,an=null;function Zm(e,t){if(Jn===null){var l=Jn=[];pc=0,dn=Bo(),an={status:"pending",value:void 0,then:function(n){l.push(n)}}}return pc++,t.then(pu,pu),t}function pu(){if(--pc===0&&Jn!==null){an!==null&&(an.status="fulfilled");var e=Jn;Jn=null,dn=0,an=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Vm(e,t){var l=[],n={status:"pending",value:null,reason:null,then:function(a){l.push(a)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var a=0;a<l.length;a++)(0,l[a])(t)},function(a){for(n.status="rejected",n.reason=a,a=0;a<l.length;a++)(0,l[a])(void 0)}),n}var gu=D.S;D.S=function(e,t){Dd=qe(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Zm(e,t),gu!==null&&gu(e,t)};var vl=mt(null);function ro(){var e=vl.current;return e!==null?e:$.pooledCache}function Ia(e,t){t===null?W(vl,vl.current):W(vl,t.pool)}function vf(){var e=ro();return e===null?null:{parent:fe._currentValue,pool:e}}var Nn=Error(N(460)),fo=Error(N(474)),Js=Error(N(542)),vs={then:function(){}};function yu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function bf(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(zt,zt),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,bu(e),e;default:if(typeof t.status=="string")t.then(zt,zt);else{if(e=$,e!==null&&100<e.shellSuspendCounter)throw Error(N(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var a=t;a.status="fulfilled",a.value=n}},function(n){if(t.status==="pending"){var a=t;a.status="rejected",a.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,bu(e),e}throw bl=t,Nn}}function hl(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(bl=l,Nn):l}}var bl=null;function vu(){if(bl===null)throw Error(N(459));var e=bl;return bl=null,e}function bu(e){if(e===Nn||e===Js)throw Error(N(483))}var sn=null,ua=0;function Ra(e){var t=ua;return ua+=1,sn===null&&(sn=[]),bf(sn,e,t)}function Mn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ha(e,t){throw t.$$typeof===D0?Error(N(525)):(e=Object.prototype.toString.call(t),Error(N(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function jf(e){function t(r,d){if(e){var x=r.deletions;x===null?(r.deletions=[d],r.flags|=16):x.push(d)}}function l(r,d){if(!e)return null;for(;d!==null;)t(r,d),d=d.sibling;return null}function n(r){for(var d=new Map;r!==null;)r.key!==null?d.set(r.key,r):d.set(r.index,r),r=r.sibling;return d}function a(r,d){return r=Tt(r,d),r.index=0,r.sibling=null,r}function s(r,d,x){return r.index=x,e?(x=r.alternate,x!==null?(x=x.index,x<d?(r.flags|=67108866,d):x):(r.flags|=67108866,d)):(r.flags|=1048576,d)}function c(r){return e&&r.alternate===null&&(r.flags|=67108866),r}function o(r,d,x,b){return d===null||d.tag!==6?(d=ji(x,r.mode,b),d.return=r,d):(d=a(d,x),d.return=r,d)}function u(r,d,x,b){var S=x.type;return S===Gl?h(r,d,x.props.children,b,x.key):d!==null&&(d.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Rt&&hl(S)===d.type)?(d=a(d,x.props),Mn(d,x),d.return=r,d):(d=Wa(x.type,x.key,x.props,null,r.mode,b),Mn(d,x),d.return=r,d)}function f(r,d,x,b){return d===null||d.tag!==4||d.stateNode.containerInfo!==x.containerInfo||d.stateNode.implementation!==x.implementation?(d=Si(x,r.mode,b),d.return=r,d):(d=a(d,x.children||[]),d.return=r,d)}function h(r,d,x,b,S){return d===null||d.tag!==7?(d=yl(x,r.mode,b,S),d.return=r,d):(d=a(d,x),d.return=r,d)}function p(r,d,x){if(typeof d=="string"&&d!==""||typeof d=="number"||typeof d=="bigint")return d=ji(""+d,r.mode,x),d.return=r,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case wa:return x=Wa(d.type,d.key,d.props,null,r.mode,x),Mn(x,d),x.return=r,x;case Un:return d=Si(d,r.mode,x),d.return=r,d;case Rt:return d=hl(d),p(r,d,x)}if(Bn(d)||kn(d))return d=yl(d,r.mode,x,null),d.return=r,d;if(typeof d.then=="function")return p(r,Ra(d),x);if(d.$$typeof===Nt)return p(r,Ba(r,d),x);Ha(r,d)}return null}function m(r,d,x,b){var S=d!==null?d.key:null;if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return S!==null?null:o(r,d,""+x,b);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case wa:return x.key===S?u(r,d,x,b):null;case Un:return x.key===S?f(r,d,x,b):null;case Rt:return x=hl(x),m(r,d,x,b)}if(Bn(x)||kn(x))return S!==null?null:h(r,d,x,b,null);if(typeof x.then=="function")return m(r,d,Ra(x),b);if(x.$$typeof===Nt)return m(r,d,Ba(r,x),b);Ha(r,x)}return null}function y(r,d,x,b,S){if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return r=r.get(x)||null,o(d,r,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case wa:return r=r.get(b.key===null?x:b.key)||null,u(d,r,b,S);case Un:return r=r.get(b.key===null?x:b.key)||null,f(d,r,b,S);case Rt:return b=hl(b),y(r,d,x,b,S)}if(Bn(b)||kn(b))return r=r.get(x)||null,h(d,r,b,S,null);if(typeof b.then=="function")return y(r,d,x,Ra(b),S);if(b.$$typeof===Nt)return y(r,d,x,Ba(d,b),S);Ha(d,b)}return null}function g(r,d,x,b){for(var S=null,k=null,z=d,A=d=0,T=null;z!==null&&A<x.length;A++){z.index>A?(T=z,z=null):T=z.sibling;var M=m(r,z,x[A],b);if(M===null){z===null&&(z=T);break}e&&z&&M.alternate===null&&t(r,z),d=s(M,d,A),k===null?S=M:k.sibling=M,k=M,z=T}if(A===x.length)return l(r,z),q&&jt(r,A),S;if(z===null){for(;A<x.length;A++)z=p(r,x[A],b),z!==null&&(d=s(z,d,A),k===null?S=z:k.sibling=z,k=z);return q&&jt(r,A),S}for(z=n(z);A<x.length;A++)T=y(z,r,A,x[A],b),T!==null&&(e&&T.alternate!==null&&z.delete(T.key===null?A:T.key),d=s(T,d,A),k===null?S=T:k.sibling=T,k=T);return e&&z.forEach(function(Z){return t(r,Z)}),q&&jt(r,A),S}function j(r,d,x,b){if(x==null)throw Error(N(151));for(var S=null,k=null,z=d,A=d=0,T=null,M=x.next();z!==null&&!M.done;A++,M=x.next()){z.index>A?(T=z,z=null):T=z.sibling;var Z=m(r,z,M.value,b);if(Z===null){z===null&&(z=T);break}e&&z&&Z.alternate===null&&t(r,z),d=s(Z,d,A),k===null?S=Z:k.sibling=Z,k=Z,z=T}if(M.done)return l(r,z),q&&jt(r,A),S;if(z===null){for(;!M.done;A++,M=x.next())M=p(r,M.value,b),M!==null&&(d=s(M,d,A),k===null?S=M:k.sibling=M,k=M);return q&&jt(r,A),S}for(z=n(z);!M.done;A++,M=x.next())M=y(z,r,A,M.value,b),M!==null&&(e&&M.alternate!==null&&z.delete(M.key===null?A:M.key),d=s(M,d,A),k===null?S=M:k.sibling=M,k=M);return e&&z.forEach(function(Ce){return t(r,Ce)}),q&&jt(r,A),S}function v(r,d,x,b){if(typeof x=="object"&&x!==null&&x.type===Gl&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case wa:e:{for(var S=x.key;d!==null;){if(d.key===S){if(S=x.type,S===Gl){if(d.tag===7){l(r,d.sibling),b=a(d,x.props.children),b.return=r,r=b;break e}}else if(d.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Rt&&hl(S)===d.type){l(r,d.sibling),b=a(d,x.props),Mn(b,x),b.return=r,r=b;break e}l(r,d);break}else t(r,d);d=d.sibling}x.type===Gl?(b=yl(x.props.children,r.mode,b,x.key),b.return=r,r=b):(b=Wa(x.type,x.key,x.props,null,r.mode,b),Mn(b,x),b.return=r,r=b)}return c(r);case Un:e:{for(S=x.key;d!==null;){if(d.key===S)if(d.tag===4&&d.stateNode.containerInfo===x.containerInfo&&d.stateNode.implementation===x.implementation){l(r,d.sibling),b=a(d,x.children||[]),b.return=r,r=b;break e}else{l(r,d);break}else t(r,d);d=d.sibling}b=Si(x,r.mode,b),b.return=r,r=b}return c(r);case Rt:return x=hl(x),v(r,d,x,b)}if(Bn(x))return g(r,d,x,b);if(kn(x)){if(S=kn(x),typeof S!="function")throw Error(N(150));return x=S.call(x),j(r,d,x,b)}if(typeof x.then=="function")return v(r,d,Ra(x),b);if(x.$$typeof===Nt)return v(r,d,Ba(r,x),b);Ha(r,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,d!==null&&d.tag===6?(l(r,d.sibling),b=a(d,x),b.return=r,r=b):(l(r,d),b=ji(x,r.mode,b),b.return=r,r=b),c(r)):l(r,d)}return function(r,d,x,b){try{ua=0;var S=v(r,d,x,b);return sn=null,S}catch(z){if(z===Nn||z===Js)throw z;var k=_e(29,z,null,r.mode);return k.lanes=b,k.return=r,k}finally{}}}var zl=jf(!0),Sf=jf(!1),Ht=!1;function mo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gc(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 Ft(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wt(e,t,l){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Y&2){var a=n.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),n.pending=t,t=ps(e),mf(e,null,l),t}return Vs(e,n,t,l),ps(e)}function Kn(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,Lr(e,l)}}function zi(e,t){var l=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,l===n)){var a=null,s=null;if(l=l.firstBaseUpdate,l!==null){do{var c={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};s===null?a=s=c:s=s.next=c,l=l.next}while(l!==null);s===null?a=s=t:s=s.next=t}else a=s=t;l={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:s,shared:n.shared,callbacks:n.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var yc=!1;function $n(){if(yc){var e=an;if(e!==null)throw e}}function Fn(e,t,l,n){yc=!1;var a=e.updateQueue;Ht=!1;var s=a.firstBaseUpdate,c=a.lastBaseUpdate,o=a.shared.pending;if(o!==null){a.shared.pending=null;var u=o,f=u.next;u.next=null,c===null?s=f:c.next=f,c=u;var h=e.alternate;h!==null&&(h=h.updateQueue,o=h.lastBaseUpdate,o!==c&&(o===null?h.firstBaseUpdate=f:o.next=f,h.lastBaseUpdate=u))}if(s!==null){var p=a.baseState;c=0,h=f=u=null,o=s;do{var m=o.lane&-536870913,y=m!==o.lane;if(y?(L&m)===m:(n&m)===m){m!==0&&m===dn&&(yc=!0),h!==null&&(h=h.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var g=e,j=o;m=t;var v=l;switch(j.tag){case 1:if(g=j.payload,typeof g=="function"){p=g.call(v,p,m);break e}p=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=j.payload,m=typeof g=="function"?g.call(v,p,m):g,m==null)break e;p=ee({},p,m);break e;case 2:Ht=!0}}m=o.callback,m!==null&&(e.flags|=64,y&&(e.flags|=8192),y=a.callbacks,y===null?a.callbacks=[m]:y.push(m))}else y={lane:m,tag:o.tag,payload:o.payload,callback:o.callback,next:null},h===null?(f=h=y,u=p):h=h.next=y,c|=m;if(o=o.next,o===null){if(o=a.shared.pending,o===null)break;y=o,o=y.next,y.next=null,a.lastBaseUpdate=y,a.shared.pending=null}}while(!0);h===null&&(u=p),a.baseState=u,a.firstBaseUpdate=f,a.lastBaseUpdate=h,s===null&&(a.shared.lanes=0),il|=c,e.lanes=c,e.memoizedState=p}}function Nf(e,t){if(typeof e!="function")throw Error(N(191,e));e.call(t)}function zf(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Nf(l[e],t)}var mn=mt(null),bs=mt(0);function ju(e,t){e=Ot,W(bs,e),W(mn,t),Ot=e|t.baseLanes}function vc(){W(bs,Ot),W(mn,mn.current)}function ho(){Ot=bs.current,ye(mn),ye(bs)}var Ze=mt(null),tt=null;function Lt(e){var t=e.alternate;W(ie,ie.current&1),W(Ze,e),tt===null&&(t===null||mn.current!==null||t.memoizedState!==null)&&(tt=e)}function bc(e){W(ie,ie.current),W(Ze,e),tt===null&&(tt=e)}function Cf(e){e.tag===22?(W(ie,ie.current),W(Ze,e),tt===null&&(tt=e)):qt()}function qt(){W(ie,ie.current),W(Ze,Ze.current)}function He(e){ye(Ze),tt===e&&(tt=null),ye(ie)}var ie=mt(0);function js(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Lc(l)||qc(l)))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 Mt=0,U=null,K=null,ue=null,Ss=!1,cn=!1,Cl=!1,Ns=0,ra=0,on=null,Jm=0;function le(){throw Error(N(321))}function xo(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!Qe(e[l],t[l]))return!1;return!0}function po(e,t,l,n,a,s){return Mt=s,U=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=e===null||e.memoizedState===null?ld:ko,Cl=!1,s=l(n,a),Cl=!1,cn&&(s=kf(t,l,n,a)),Tf(e),s}function Tf(e){D.H=fa;var t=K!==null&&K.next!==null;if(Mt=0,ue=K=U=null,Ss=!1,ra=0,on=null,t)throw Error(N(300));e===null||de||(e=e.dependencies,e!==null&&ys(e)&&(de=!0))}function kf(e,t,l,n){U=e;var a=0;do{if(cn&&(on=null),ra=0,cn=!1,25<=a)throw Error(N(301));if(a+=1,ue=K=null,e.updateQueue!=null){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}D.H=nd,s=t(l,n)}while(cn);return s}function Km(){var e=D.H,t=e.useState()[0];return t=typeof t.then=="function"?za(t):t,e=e.useState()[0],(K!==null?K.memoizedState:null)!==e&&(U.flags|=1024),t}function go(){var e=Ns!==0;return Ns=0,e}function yo(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function vo(e){if(Ss){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ss=!1}Mt=0,ue=K=U=null,cn=!1,ra=Ns=0,on=null}function Te(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ue===null?U.memoizedState=ue=e:ue=ue.next=e,ue}function ce(){if(K===null){var e=U.alternate;e=e!==null?e.memoizedState:null}else e=K.next;var t=ue===null?U.memoizedState:ue.next;if(t!==null)ue=t,K=e;else{if(e===null)throw U.alternate===null?Error(N(467)):Error(N(310));K=e,e={memoizedState:K.memoizedState,baseState:K.baseState,baseQueue:K.baseQueue,queue:K.queue,next:null},ue===null?U.memoizedState=ue=e:ue=ue.next=e}return ue}function Ks(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function za(e){var t=ra;return ra+=1,on===null&&(on=[]),e=bf(on,e,t),t=U,(ue===null?t.memoizedState:ue.next)===null&&(t=t.alternate,D.H=t===null||t.memoizedState===null?ld:ko),e}function $s(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return za(e);if(e.$$typeof===Nt)return Ne(e)}throw Error(N(438,String(e)))}function bo(e){var t=null,l=U.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var n=U.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(a){return a.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=Ks(),U.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),n=0;n<e;n++)l[n]=O0;return t.index++,l}function Et(e,t){return typeof t=="function"?t(e):t}function Pa(e){var t=ce();return jo(t,K,e)}function jo(e,t,l){var n=e.queue;if(n===null)throw Error(N(311));n.lastRenderedReducer=l;var a=e.baseQueue,s=n.pending;if(s!==null){if(a!==null){var c=a.next;a.next=s.next,s.next=c}t.baseQueue=a=s,n.pending=null}if(s=e.baseState,a===null)e.memoizedState=s;else{t=a.next;var o=c=null,u=null,f=t,h=!1;do{var p=f.lane&-536870913;if(p!==f.lane?(L&p)===p:(Mt&p)===p){var m=f.revertLane;if(m===0)u!==null&&(u=u.next={lane:0,revertLane:0,gesture:null,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null}),p===dn&&(h=!0);else if((Mt&m)===m){f=f.next,m===dn&&(h=!0);continue}else p={lane:0,revertLane:f.revertLane,gesture:null,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null},u===null?(o=u=p,c=s):u=u.next=p,U.lanes|=m,il|=m;p=f.action,Cl&&l(s,p),s=f.hasEagerState?f.eagerState:l(s,p)}else m={lane:p,revertLane:f.revertLane,gesture:f.gesture,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null},u===null?(o=u=m,c=s):u=u.next=m,U.lanes|=p,il|=p;f=f.next}while(f!==null&&f!==t);if(u===null?c=s:u.next=o,!Qe(s,e.memoizedState)&&(de=!0,h&&(l=an,l!==null)))throw l;e.memoizedState=s,e.baseState=c,e.baseQueue=u,n.lastRenderedState=s}return a===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function Ci(e){var t=ce(),l=t.queue;if(l===null)throw Error(N(311));l.lastRenderedReducer=e;var n=l.dispatch,a=l.pending,s=t.memoizedState;if(a!==null){l.pending=null;var c=a=a.next;do s=e(s,c.action),c=c.next;while(c!==a);Qe(s,t.memoizedState)||(de=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),l.lastRenderedState=s}return[s,n]}function Af(e,t,l){var n=U,a=ce(),s=q;if(s){if(l===void 0)throw Error(N(407));l=l()}else l=t();var c=!Qe((K||a).memoizedState,l);if(c&&(a.memoizedState=l,de=!0),a=a.queue,So(Ef.bind(null,n,a,e),[e]),a.getSnapshot!==t||c||ue!==null&&ue.memoizedState.tag&1){if(n.flags|=2048,hn(9,{destroy:void 0},Mf.bind(null,n,a,l,t),null),$===null)throw Error(N(349));s||Mt&127||wf(n,t,l)}return l}function wf(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=U.updateQueue,t===null?(t=Ks(),U.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function Mf(e,t,l,n){t.value=l,t.getSnapshot=n,Df(t)&&Of(e)}function Ef(e,t,l){return l(function(){Df(t)&&Of(e)})}function Df(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!Qe(e,l)}catch{return!0}}function Of(e){var t=Ml(e,2);t!==null&&De(t,e,2)}function jc(e){var t=Te();if(typeof e=="function"){var l=e;if(e=l(),Cl){Xt(!0);try{l()}finally{Xt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Et,lastRenderedState:e},t}function Uf(e,t,l,n){return e.baseState=l,jo(e,K,typeof n=="function"?n:Et)}function $m(e,t,l,n,a){if(Ws(e))throw Error(N(485));if(e=t.action,e!==null){var s={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(c){s.listeners.push(c)}};D.T!==null?l(!0):s.isTransition=!1,n(s),l=t.pending,l===null?(s.next=t.pending=s,Bf(t,s)):(s.next=l.next,t.pending=l.next=s)}}function Bf(e,t){var l=t.action,n=t.payload,a=e.state;if(t.isTransition){var s=D.T,c={};D.T=c;try{var o=l(a,n),u=D.S;u!==null&&u(c,o),Su(e,t,o)}catch(f){Sc(e,t,f)}finally{s!==null&&c.types!==null&&(s.types=c.types),D.T=s}}else try{s=l(a,n),Su(e,t,s)}catch(f){Sc(e,t,f)}}function Su(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(n){Nu(e,t,n)},function(n){return Sc(e,t,n)}):Nu(e,t,l)}function Nu(e,t,l){t.status="fulfilled",t.value=l,Rf(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Bf(e,l)))}function Sc(e,t,l){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=l,Rf(t),t=t.next;while(t!==n)}e.action=null}function Rf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Hf(e,t){return t}function zu(e,t){if(q){var l=$.formState;if(l!==null){e:{var n=U;if(q){if(P){t:{for(var a=P,s=Pe;a.nodeType!==8;){if(!s){a=null;break t}if(a=lt(a.nextSibling),a===null){a=null;break t}}s=a.data,a=s==="F!"||s==="F"?a:null}if(a){P=lt(a.nextSibling),n=a.data==="F!";break e}}al(n)}n=!1}n&&(t=l[0])}}return l=Te(),l.memoizedState=l.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hf,lastRenderedState:t},l.queue=n,l=Pf.bind(null,U,n),n.dispatch=l,n=jc(!1),s=To.bind(null,U,!1,n.queue),n=Te(),a={state:t,dispatch:null,action:e,pending:null},n.queue=a,l=$m.bind(null,U,a,s,l),a.dispatch=l,n.memoizedState=e,[t,l,!1]}function Cu(e){var t=ce();return _f(t,K,e)}function _f(e,t,l){if(t=jo(e,t,Hf)[0],e=Pa(Et)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=za(t)}catch(c){throw c===Nn?Js:c}else n=t;t=ce();var a=t.queue,s=a.dispatch;return l!==t.memoizedState&&(U.flags|=2048,hn(9,{destroy:void 0},Fm.bind(null,a,l),null)),[n,s,e]}function Fm(e,t){e.action=t}function Tu(e){var t=ce(),l=K;if(l!==null)return _f(t,l,e);ce(),t=t.memoizedState,l=ce();var n=l.queue.dispatch;return l.memoizedState=e,[t,n,!1]}function hn(e,t,l,n){return e={tag:e,create:l,deps:n,inst:t,next:null},t=U.updateQueue,t===null&&(t=Ks(),U.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(n=l.next,l.next=e,e.next=n,t.lastEffect=e),e}function Lf(){return ce().memoizedState}function es(e,t,l,n){var a=Te();U.flags|=e,a.memoizedState=hn(1|t,{destroy:void 0},l,n===void 0?null:n)}function Fs(e,t,l,n){var a=ce();n=n===void 0?null:n;var s=a.memoizedState.inst;K!==null&&n!==null&&xo(n,K.memoizedState.deps)?a.memoizedState=hn(t,s,l,n):(U.flags|=e,a.memoizedState=hn(1|t,s,l,n))}function ku(e,t){es(8390656,8,e,t)}function So(e,t){Fs(2048,8,e,t)}function Wm(e){U.flags|=4;var t=U.updateQueue;if(t===null)t=Ks(),U.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function qf(e){var t=ce().memoizedState;return Wm({ref:t,nextImpl:e}),function(){if(Y&2)throw Error(N(440));return t.impl.apply(void 0,arguments)}}function Yf(e,t){return Fs(4,2,e,t)}function Gf(e,t){return Fs(4,4,e,t)}function Xf(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Qf(e,t,l){l=l!=null?l.concat([e]):null,Fs(4,4,Xf.bind(null,t,e),l)}function No(){}function Zf(e,t){var l=ce();t=t===void 0?null:t;var n=l.memoizedState;return t!==null&&xo(t,n[1])?n[0]:(l.memoizedState=[e,t],e)}function Vf(e,t){var l=ce();t=t===void 0?null:t;var n=l.memoizedState;if(t!==null&&xo(t,n[1]))return n[0];if(n=e(),Cl){Xt(!0);try{e()}finally{Xt(!1)}}return l.memoizedState=[n,t],n}function zo(e,t,l){return l===void 0||Mt&1073741824&&!(L&261930)?e.memoizedState=t:(e.memoizedState=l,e=Ud(),U.lanes|=e,il|=e,l)}function Jf(e,t,l,n){return Qe(l,t)?l:mn.current!==null?(e=zo(e,l,n),Qe(e,t)||(de=!0),e):!(Mt&42)||Mt&1073741824&&!(L&261930)?(de=!0,e.memoizedState=l):(e=Ud(),U.lanes|=e,il|=e,t)}function Kf(e,t,l,n,a){var s=G.p;G.p=s!==0&&8>s?s:8;var c=D.T,o={};D.T=o,To(e,!1,t,l);try{var u=a(),f=D.S;if(f!==null&&f(o,u),u!==null&&typeof u=="object"&&typeof u.then=="function"){var h=Vm(u,n);Wn(e,t,h,Xe(e))}else Wn(e,t,n,Xe(e))}catch(p){Wn(e,t,{then:function(){},status:"rejected",reason:p},Xe())}finally{G.p=s,c!==null&&o.types!==null&&(c.types=o.types),D.T=c}}function Im(){}function Nc(e,t,l,n){if(e.tag!==5)throw Error(N(476));var a=$f(e).queue;Kf(e,a,t,gl,l===null?Im:function(){return Ff(e),l(n)})}function $f(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:gl,baseState:gl,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Et,lastRenderedState:gl},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Et,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ff(e){var t=$f(e);t.next===null&&(t=e.alternate.memoizedState),Wn(e,t.next.queue,{},Xe())}function Co(){return Ne(ha)}function Wf(){return ce().memoizedState}function If(){return ce().memoizedState}function Pm(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=Xe();e=Ft(l);var n=Wt(t,e,l);n!==null&&(De(n,t,l),Kn(n,t,l)),t={cache:uo()},e.payload=t;return}t=t.return}}function eh(e,t,l){var n=Xe();l={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ws(e)?ed(t,l):(l=so(e,t,l,n),l!==null&&(De(l,e,n),td(l,t,n)))}function Pf(e,t,l){var n=Xe();Wn(e,t,l,n)}function Wn(e,t,l,n){var a={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Ws(e))ed(t,a);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var c=t.lastRenderedState,o=s(c,l);if(a.hasEagerState=!0,a.eagerState=o,Qe(o,c))return Vs(e,t,a,0),$===null&&Zs(),!1}catch{}finally{}if(l=so(e,t,a,n),l!==null)return De(l,e,n),td(l,t,n),!0}return!1}function To(e,t,l,n){if(n={lane:2,revertLane:Bo(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ws(e)){if(t)throw Error(N(479))}else t=so(e,l,n,2),t!==null&&De(t,e,2)}function Ws(e){var t=e.alternate;return e===U||t!==null&&t===U}function ed(e,t){cn=Ss=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function td(e,t,l){if(l&4194048){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,Lr(e,l)}}var fa={readContext:Ne,use:$s,useCallback:le,useContext:le,useEffect:le,useImperativeHandle:le,useLayoutEffect:le,useInsertionEffect:le,useMemo:le,useReducer:le,useRef:le,useState:le,useDebugValue:le,useDeferredValue:le,useTransition:le,useSyncExternalStore:le,useId:le,useHostTransitionStatus:le,useFormState:le,useActionState:le,useOptimistic:le,useMemoCache:le,useCacheRefresh:le};fa.useEffectEvent=le;var ld={readContext:Ne,use:$s,useCallback:function(e,t){return Te().memoizedState=[e,t===void 0?null:t],e},useContext:Ne,useEffect:ku,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,es(4194308,4,Xf.bind(null,t,e),l)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){es(4,2,e,t)},useMemo:function(e,t){var l=Te();t=t===void 0?null:t;var n=e();if(Cl){Xt(!0);try{e()}finally{Xt(!1)}}return l.memoizedState=[n,t],n},useReducer:function(e,t,l){var n=Te();if(l!==void 0){var a=l(t);if(Cl){Xt(!0);try{l(t)}finally{Xt(!1)}}}else a=t;return n.memoizedState=n.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},n.queue=e,e=e.dispatch=eh.bind(null,U,e),[n.memoizedState,e]},useRef:function(e){var t=Te();return e={current:e},t.memoizedState=e},useState:function(e){e=jc(e);var t=e.queue,l=Pf.bind(null,U,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:No,useDeferredValue:function(e,t){var l=Te();return zo(l,e,t)},useTransition:function(){var e=jc(!1);return e=Kf.bind(null,U,e.queue,!0,!1),Te().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var n=U,a=Te();if(q){if(l===void 0)throw Error(N(407));l=l()}else{if(l=t(),$===null)throw Error(N(349));L&127||wf(n,t,l)}a.memoizedState=l;var s={value:l,getSnapshot:t};return a.queue=s,ku(Ef.bind(null,n,s,e),[e]),n.flags|=2048,hn(9,{destroy:void 0},Mf.bind(null,n,s,l,t),null),l},useId:function(){var e=Te(),t=$.identifierPrefix;if(q){var l=rt,n=ut;l=(n&~(1<<32-Ge(n)-1)).toString(32)+l,t="_"+t+"R_"+l,l=Ns++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=Jm++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Co,useFormState:zu,useActionState:zu,useOptimistic:function(e){var t=Te();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=To.bind(null,U,!0,l),l.dispatch=t,[e,t]},useMemoCache:bo,useCacheRefresh:function(){return Te().memoizedState=Pm.bind(null,U)},useEffectEvent:function(e){var t=Te(),l={impl:e};return t.memoizedState=l,function(){if(Y&2)throw Error(N(440));return l.impl.apply(void 0,arguments)}}},ko={readContext:Ne,use:$s,useCallback:Zf,useContext:Ne,useEffect:So,useImperativeHandle:Qf,useInsertionEffect:Yf,useLayoutEffect:Gf,useMemo:Vf,useReducer:Pa,useRef:Lf,useState:function(){return Pa(Et)},useDebugValue:No,useDeferredValue:function(e,t){var l=ce();return Jf(l,K.memoizedState,e,t)},useTransition:function(){var e=Pa(Et)[0],t=ce().memoizedState;return[typeof e=="boolean"?e:za(e),t]},useSyncExternalStore:Af,useId:Wf,useHostTransitionStatus:Co,useFormState:Cu,useActionState:Cu,useOptimistic:function(e,t){var l=ce();return Uf(l,K,e,t)},useMemoCache:bo,useCacheRefresh:If};ko.useEffectEvent=qf;var nd={readContext:Ne,use:$s,useCallback:Zf,useContext:Ne,useEffect:So,useImperativeHandle:Qf,useInsertionEffect:Yf,useLayoutEffect:Gf,useMemo:Vf,useReducer:Ci,useRef:Lf,useState:function(){return Ci(Et)},useDebugValue:No,useDeferredValue:function(e,t){var l=ce();return K===null?zo(l,e,t):Jf(l,K.memoizedState,e,t)},useTransition:function(){var e=Ci(Et)[0],t=ce().memoizedState;return[typeof e=="boolean"?e:za(e),t]},useSyncExternalStore:Af,useId:Wf,useHostTransitionStatus:Co,useFormState:Tu,useActionState:Tu,useOptimistic:function(e,t){var l=ce();return K!==null?Uf(l,K,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:bo,useCacheRefresh:If};nd.useEffectEvent=qf;function Ti(e,t,l,n){t=e.memoizedState,l=l(n,t),l=l==null?t:ee({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var zc={enqueueSetState:function(e,t,l){e=e._reactInternals;var n=Xe(),a=Ft(n);a.payload=t,l!=null&&(a.callback=l),t=Wt(e,a,n),t!==null&&(De(t,e,n),Kn(t,e,n))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var n=Xe(),a=Ft(n);a.tag=1,a.payload=t,l!=null&&(a.callback=l),t=Wt(e,a,n),t!==null&&(De(t,e,n),Kn(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=Xe(),n=Ft(l);n.tag=2,t!=null&&(n.callback=t),t=Wt(e,n,l),t!==null&&(De(t,e,l),Kn(t,e,l))}};function Au(e,t,l,n,a,s,c){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,s,c):t.prototype&&t.prototype.isPureReactComponent?!ia(l,n)||!ia(a,s):!0}function wu(e,t,l,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,n),t.state!==e&&zc.enqueueReplaceState(t,t.state,null)}function Tl(e,t){var l=t;if("ref"in t){l={};for(var n in t)n!=="ref"&&(l[n]=t[n])}if(e=e.defaultProps){l===t&&(l=ee({},l));for(var a in e)l[a]===void 0&&(l[a]=e[a])}return l}function ad(e){xs(e)}function sd(e){console.error(e)}function id(e){xs(e)}function zs(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function Mu(e,t,l){try{var n=e.onCaughtError;n(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function Cc(e,t,l){return l=Ft(l),l.tag=3,l.payload={element:null},l.callback=function(){zs(e,t)},l}function cd(e){return e=Ft(e),e.tag=3,e}function od(e,t,l,n){var a=l.type.getDerivedStateFromError;if(typeof a=="function"){var s=n.value;e.payload=function(){return a(s)},e.callback=function(){Mu(t,l,n)}}var c=l.stateNode;c!==null&&typeof c.componentDidCatch=="function"&&(e.callback=function(){Mu(t,l,n),typeof a!="function"&&(It===null?It=new Set([this]):It.add(this));var o=n.stack;this.componentDidCatch(n.value,{componentStack:o!==null?o:""})})}function th(e,t,l,n,a){if(l.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=l.alternate,t!==null&&Sn(t,l,a,!0),l=Ze.current,l!==null){switch(l.tag){case 31:case 13:return tt===null?ws():l.alternate===null&&ne===0&&(ne=3),l.flags&=-257,l.flags|=65536,l.lanes=a,n===vs?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([n]):t.add(n),Hi(e,n,a)),!1;case 22:return l.flags|=65536,n===vs?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([n]):l.add(n)),Hi(e,n,a)),!1}throw Error(N(435,l.tag))}return Hi(e,n,a),ws(),!1}if(q)return t=Ze.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,n!==dc&&(e=Error(N(422),{cause:n}),oa(Ie(e,l)))):(n!==dc&&(t=Error(N(423),{cause:n}),oa(Ie(t,l))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,n=Ie(n,l),a=Cc(e.stateNode,n,a),zi(e,a),ne!==4&&(ne=2)),!1;var s=Error(N(520),{cause:n});if(s=Ie(s,l),ea===null?ea=[s]:ea.push(s),ne!==4&&(ne=2),t===null)return!0;n=Ie(n,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=a&-a,l.lanes|=e,e=Cc(l.stateNode,n,e),zi(l,e),!1;case 1:if(t=l.type,s=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||s!==null&&typeof s.componentDidCatch=="function"&&(It===null||!It.has(s))))return l.flags|=65536,a&=-a,l.lanes|=a,a=cd(a),od(a,e,l,n),zi(l,a),!1}l=l.return}while(l!==null);return!1}var Ao=Error(N(461)),de=!1;function ve(e,t,l,n){t.child=e===null?Sf(t,null,l,n):zl(t,e.child,l,n)}function Eu(e,t,l,n,a){l=l.render;var s=t.ref;if("ref"in n){var c={};for(var o in n)o!=="ref"&&(c[o]=n[o])}else c=n;return Nl(t),n=po(e,t,l,c,s,a),o=go(),e!==null&&!de?(yo(e,t,a),Dt(e,t,a)):(q&&o&&co(t),t.flags|=1,ve(e,t,n,a),t.child)}function Du(e,t,l,n,a){if(e===null){var s=l.type;return typeof s=="function"&&!io(s)&&s.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=s,ud(e,t,s,n,a)):(e=Wa(l.type,null,n,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!wo(e,a)){var c=s.memoizedProps;if(l=l.compare,l=l!==null?l:ia,l(c,n)&&e.ref===t.ref)return Dt(e,t,a)}return t.flags|=1,e=Tt(s,n),e.ref=t.ref,e.return=t,t.child=e}function ud(e,t,l,n,a){if(e!==null){var s=e.memoizedProps;if(ia(s,n)&&e.ref===t.ref)if(de=!1,t.pendingProps=n=s,wo(e,a))e.flags&131072&&(de=!0);else return t.lanes=e.lanes,Dt(e,t,a)}return Tc(e,t,l,n,a)}function rd(e,t,l,n){var a=n.children,s=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if(t.flags&128){if(s=s!==null?s.baseLanes|l:l,e!==null){for(n=t.child=e.child,a=0;n!==null;)a=a|n.lanes|n.childLanes,n=n.sibling;n=a&~s}else n=0,t.child=null;return Ou(e,t,s,l,n)}if(l&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ia(t,s!==null?s.cachePool:null),s!==null?ju(t,s):vc(),Cf(t);else return n=t.lanes=536870912,Ou(e,t,s!==null?s.baseLanes|l:l,l,n)}else s!==null?(Ia(t,s.cachePool),ju(t,s),qt(),t.memoizedState=null):(e!==null&&Ia(t,null),vc(),qt());return ve(e,t,a,l),t.child}function Hn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ou(e,t,l,n,a){var s=ro();return s=s===null?null:{parent:fe._currentValue,pool:s},t.memoizedState={baseLanes:l,cachePool:s},e!==null&&Ia(t,null),vc(),Cf(t),e!==null&&Sn(e,t,n,!0),t.childLanes=a,null}function ts(e,t){return t=Cs({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Uu(e,t,l){return zl(t,e.child,null,l),e=ts(t,t.pendingProps),e.flags|=2,He(t),t.memoizedState=null,e}function lh(e,t,l){var n=t.pendingProps,a=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(q){if(n.mode==="hidden")return e=ts(t,n),t.lanes=536870912,Hn(null,e);if(bc(t),(e=P)?(e=l0(e,Pe),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:nl!==null?{id:ut,overflow:rt}:null,retryLane:536870912,hydrationErrors:null},l=xf(e),l.return=t,t.child=l,Se=t,P=null)):e=null,e===null)throw al(t);return t.lanes=536870912,null}return ts(t,n)}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(bc(t),a)if(t.flags&256)t.flags&=-257,t=Uu(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(N(558));else if(de||Sn(e,t,l,!1),a=(l&e.childLanes)!==0,de||a){if(n=$,n!==null&&(c=qr(n,l),c!==0&&c!==s.retryLane))throw s.retryLane=c,Ml(e,c),De(n,e,c),Ao;ws(),t=Uu(e,t,l)}else e=s.treeContext,P=lt(c.nextSibling),Se=t,q=!0,$t=null,Pe=!1,e!==null&&gf(t,e),t=ts(t,n),t.flags|=4096;return t}return e=Tt(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ls(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(N(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Tc(e,t,l,n,a){return Nl(t),l=po(e,t,l,n,void 0,a),n=go(),e!==null&&!de?(yo(e,t,a),Dt(e,t,a)):(q&&n&&co(t),t.flags|=1,ve(e,t,l,a),t.child)}function Bu(e,t,l,n,a,s){return Nl(t),t.updateQueue=null,l=kf(t,n,l,a),Tf(e),n=go(),e!==null&&!de?(yo(e,t,s),Dt(e,t,s)):(q&&n&&co(t),t.flags|=1,ve(e,t,l,s),t.child)}function Ru(e,t,l,n,a){if(Nl(t),t.stateNode===null){var s=Fl,c=l.contextType;typeof c=="object"&&c!==null&&(s=Ne(c)),s=new l(n,s),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=zc,t.stateNode=s,s._reactInternals=t,s=t.stateNode,s.props=n,s.state=t.memoizedState,s.refs={},mo(t),c=l.contextType,s.context=typeof c=="object"&&c!==null?Ne(c):Fl,s.state=t.memoizedState,c=l.getDerivedStateFromProps,typeof c=="function"&&(Ti(t,l,c,n),s.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(c=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),c!==s.state&&zc.enqueueReplaceState(s,s.state,null),Fn(t,n,s,a),$n(),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){s=t.stateNode;var o=t.memoizedProps,u=Tl(l,o);s.props=u;var f=s.context,h=l.contextType;c=Fl,typeof h=="object"&&h!==null&&(c=Ne(h));var p=l.getDerivedStateFromProps;h=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,h||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(o||f!==c)&&wu(t,s,n,c),Ht=!1;var m=t.memoizedState;s.state=m,Fn(t,n,s,a),$n(),f=t.memoizedState,o||m!==f||Ht?(typeof p=="function"&&(Ti(t,l,p,n),f=t.memoizedState),(u=Ht||Au(t,l,u,n,m,f,c))?(h||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=f),s.props=n,s.state=f,s.context=c,n=u):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{s=t.stateNode,gc(e,t),c=t.memoizedProps,h=Tl(l,c),s.props=h,p=t.pendingProps,m=s.context,f=l.contextType,u=Fl,typeof f=="object"&&f!==null&&(u=Ne(f)),o=l.getDerivedStateFromProps,(f=typeof o=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(c!==p||m!==u)&&wu(t,s,n,u),Ht=!1,m=t.memoizedState,s.state=m,Fn(t,n,s,a),$n();var y=t.memoizedState;c!==p||m!==y||Ht||e!==null&&e.dependencies!==null&&ys(e.dependencies)?(typeof o=="function"&&(Ti(t,l,o,n),y=t.memoizedState),(h=Ht||Au(t,l,h,n,m,y,u)||e!==null&&e.dependencies!==null&&ys(e.dependencies))?(f||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(n,y,u),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(n,y,u)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||c===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=y),s.props=n,s.state=y,s.context=u,n=h):(typeof s.componentDidUpdate!="function"||c===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),n=!1)}return s=n,ls(e,t),n=(t.flags&128)!==0,s||n?(s=t.stateNode,l=n&&typeof l.getDerivedStateFromError!="function"?null:s.render(),t.flags|=1,e!==null&&n?(t.child=zl(t,e.child,null,a),t.child=zl(t,null,l,a)):ve(e,t,l,a),t.memoizedState=s.state,e=t.child):e=Dt(e,t,a),e}function Hu(e,t,l,n){return Sl(),t.flags|=256,ve(e,t,l,n),t.child}var ki={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ai(e){return{baseLanes:e,cachePool:vf()}}function wi(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=Le),e}function fd(e,t,l){var n=t.pendingProps,a=!1,s=(t.flags&128)!==0,c;if((c=s)||(c=e!==null&&e.memoizedState===null?!1:(ie.current&2)!==0),c&&(a=!0,t.flags&=-129),c=(t.flags&32)!==0,t.flags&=-33,e===null){if(q){if(a?Lt(t):qt(),(e=P)?(e=l0(e,Pe),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:nl!==null?{id:ut,overflow:rt}:null,retryLane:536870912,hydrationErrors:null},l=xf(e),l.return=t,t.child=l,Se=t,P=null)):e=null,e===null)throw al(t);return qc(e)?t.lanes=32:t.lanes=536870912,null}var o=n.children;return n=n.fallback,a?(qt(),a=t.mode,o=Cs({mode:"hidden",children:o},a),n=yl(n,a,l,null),o.return=t,n.return=t,o.sibling=n,t.child=o,n=t.child,n.memoizedState=Ai(l),n.childLanes=wi(e,c,l),t.memoizedState=ki,Hn(null,n)):(Lt(t),kc(t,o))}var u=e.memoizedState;if(u!==null&&(o=u.dehydrated,o!==null)){if(s)t.flags&256?(Lt(t),t.flags&=-257,t=Mi(e,t,l)):t.memoizedState!==null?(qt(),t.child=e.child,t.flags|=128,t=null):(qt(),o=n.fallback,a=t.mode,n=Cs({mode:"visible",children:n.children},a),o=yl(o,a,l,null),o.flags|=2,n.return=t,o.return=t,n.sibling=o,t.child=n,zl(t,e.child,null,l),n=t.child,n.memoizedState=Ai(l),n.childLanes=wi(e,c,l),t.memoizedState=ki,t=Hn(null,n));else if(Lt(t),qc(o)){if(c=o.nextSibling&&o.nextSibling.dataset,c)var f=c.dgst;c=f,n=Error(N(419)),n.stack="",n.digest=c,oa({value:n,source:null,stack:null}),t=Mi(e,t,l)}else if(de||Sn(e,t,l,!1),c=(l&e.childLanes)!==0,de||c){if(c=$,c!==null&&(n=qr(c,l),n!==0&&n!==u.retryLane))throw u.retryLane=n,Ml(e,n),De(c,e,n),Ao;Lc(o)||ws(),t=Mi(e,t,l)}else Lc(o)?(t.flags|=192,t.child=e.child,t=null):(e=u.treeContext,P=lt(o.nextSibling),Se=t,q=!0,$t=null,Pe=!1,e!==null&&gf(t,e),t=kc(t,n.children),t.flags|=4096);return t}return a?(qt(),o=n.fallback,a=t.mode,u=e.child,f=u.sibling,n=Tt(u,{mode:"hidden",children:n.children}),n.subtreeFlags=u.subtreeFlags&65011712,f!==null?o=Tt(f,o):(o=yl(o,a,l,null),o.flags|=2),o.return=t,n.return=t,n.sibling=o,t.child=n,Hn(null,n),n=t.child,o=e.child.memoizedState,o===null?o=Ai(l):(a=o.cachePool,a!==null?(u=fe._currentValue,a=a.parent!==u?{parent:u,pool:u}:a):a=vf(),o={baseLanes:o.baseLanes|l,cachePool:a}),n.memoizedState=o,n.childLanes=wi(e,c,l),t.memoizedState=ki,Hn(e.child,n)):(Lt(t),l=e.child,e=l.sibling,l=Tt(l,{mode:"visible",children:n.children}),l.return=t,l.sibling=null,e!==null&&(c=t.deletions,c===null?(t.deletions=[e],t.flags|=16):c.push(e)),t.child=l,t.memoizedState=null,l)}function kc(e,t){return t=Cs({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Cs(e,t){return e=_e(22,e,null,t),e.lanes=0,e}function Mi(e,t,l){return zl(t,e.child,null,l),e=kc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _u(e,t,l){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),hc(e.return,t,l)}function Ei(e,t,l,n,a,s){var c=e.memoizedState;c===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:l,tailMode:a,treeForkCount:s}:(c.isBackwards=t,c.rendering=null,c.renderingStartTime=0,c.last=n,c.tail=l,c.tailMode=a,c.treeForkCount=s)}function dd(e,t,l){var n=t.pendingProps,a=n.revealOrder,s=n.tail;n=n.children;var c=ie.current,o=(c&2)!==0;if(o?(c=c&1|2,t.flags|=128):c&=1,W(ie,c),ve(e,t,n,l),n=q?ca:0,!o&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&_u(e,l,t);else if(e.tag===19)_u(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case"forwards":for(l=t.child,a=null;l!==null;)e=l.alternate,e!==null&&js(e)===null&&(a=l),l=l.sibling;l=a,l===null?(a=t.child,t.child=null):(a=l.sibling,l.sibling=null),Ei(t,!1,a,l,s,n);break;case"backwards":case"unstable_legacy-backwards":for(l=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&js(e)===null){t.child=a;break}e=a.sibling,a.sibling=l,l=a,a=e}Ei(t,!0,l,null,s,n);break;case"together":Ei(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function Dt(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),il|=t.lanes,!(l&t.childLanes))if(e!==null){if(Sn(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(N(153));if(t.child!==null){for(e=t.child,l=Tt(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=Tt(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function wo(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&ys(e)))}function nh(e,t,l){switch(t.tag){case 3:fs(t,t.stateNode.containerInfo),_t(t,fe,e.memoizedState.cache),Sl();break;case 27:case 5:tc(t);break;case 4:fs(t,t.stateNode.containerInfo);break;case 10:_t(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,bc(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(Lt(t),t.flags|=128,null):l&t.child.childLanes?fd(e,t,l):(Lt(t),e=Dt(e,t,l),e!==null?e.sibling:null);Lt(t);break;case 19:var a=(e.flags&128)!==0;if(n=(l&t.childLanes)!==0,n||(Sn(e,t,l,!1),n=(l&t.childLanes)!==0),a){if(n)return dd(e,t,l);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),W(ie,ie.current),n)break;return null;case 22:return t.lanes=0,rd(e,t,l,t.pendingProps);case 24:_t(t,fe,e.memoizedState.cache)}return Dt(e,t,l)}function md(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)de=!0;else{if(!wo(e,l)&&!(t.flags&128))return de=!1,nh(e,t,l);de=!!(e.flags&131072)}else de=!1,q&&t.flags&1048576&&pf(t,ca,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=hl(t.elementType),t.type=e,typeof e=="function")io(e)?(n=Tl(e,n),t.tag=1,t=Ru(null,t,e,n,l)):(t.tag=0,t=Tc(null,t,e,n,l));else{if(e!=null){var a=e.$$typeof;if(a===Vc){t.tag=11,t=Eu(null,t,e,n,l);break e}else if(a===Jc){t.tag=14,t=Du(null,t,e,n,l);break e}}throw t=Pi(e)||e,Error(N(306,t,""))}}return t;case 0:return Tc(e,t,t.type,t.pendingProps,l);case 1:return n=t.type,a=Tl(n,t.pendingProps),Ru(e,t,n,a,l);case 3:e:{if(fs(t,t.stateNode.containerInfo),e===null)throw Error(N(387));n=t.pendingProps;var s=t.memoizedState;a=s.element,gc(e,t),Fn(t,n,null,l);var c=t.memoizedState;if(n=c.cache,_t(t,fe,n),n!==s.cache&&xc(t,[fe],l,!0),$n(),n=c.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:c.cache},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){t=Hu(e,t,n,l);break e}else if(n!==a){a=Ie(Error(N(424)),t),oa(a),t=Hu(e,t,n,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(P=lt(e.firstChild),Se=t,q=!0,$t=null,Pe=!0,l=Sf(t,null,n,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Sl(),n===a){t=Dt(e,t,l);break e}ve(e,t,n,l)}t=t.child}return t;case 26:return ls(e,t),e===null?(l=ar(t.type,null,t.pendingProps,null))?t.memoizedState=l:q||(l=t.type,e=t.pendingProps,n=Os(Kt.current).createElement(l),n[je]=t,n[Oe]=e,ze(n,l,e),ge(n),t.stateNode=n):t.memoizedState=ar(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return tc(t),e===null&&q&&(n=t.stateNode=n0(t.type,t.pendingProps,Kt.current),Se=t,Pe=!0,a=P,ul(t.type)?(Yc=a,P=lt(n.firstChild)):P=a),ve(e,t,t.pendingProps.children,l),ls(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&q&&((a=n=P)&&(n=Oh(n,t.type,t.pendingProps,Pe),n!==null?(t.stateNode=n,Se=t,P=lt(n.firstChild),Pe=!1,a=!0):a=!1),a||al(t)),tc(t),a=t.type,s=t.pendingProps,c=e!==null?e.memoizedProps:null,n=s.children,Hc(a,s)?n=null:c!==null&&Hc(a,c)&&(t.flags|=32),t.memoizedState!==null&&(a=po(e,t,Km,null,null,l),ha._currentValue=a),ls(e,t),ve(e,t,n,l),t.child;case 6:return e===null&&q&&((e=l=P)&&(l=Uh(l,t.pendingProps,Pe),l!==null?(t.stateNode=l,Se=t,P=null,e=!0):e=!1),e||al(t)),null;case 13:return fd(e,t,l);case 4:return fs(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=zl(t,null,n,l):ve(e,t,n,l),t.child;case 11:return Eu(e,t,t.type,t.pendingProps,l);case 7:return ve(e,t,t.pendingProps,l),t.child;case 8:return ve(e,t,t.pendingProps.children,l),t.child;case 12:return ve(e,t,t.pendingProps.children,l),t.child;case 10:return n=t.pendingProps,_t(t,t.type,n.value),ve(e,t,n.children,l),t.child;case 9:return a=t.type._context,n=t.pendingProps.children,Nl(t),a=Ne(a),n=n(a),t.flags|=1,ve(e,t,n,l),t.child;case 14:return Du(e,t,t.type,t.pendingProps,l);case 15:return ud(e,t,t.type,t.pendingProps,l);case 19:return dd(e,t,l);case 31:return lh(e,t,l);case 22:return rd(e,t,l,t.pendingProps);case 24:return Nl(t),n=Ne(fe),e===null?(a=ro(),a===null&&(a=$,s=uo(),a.pooledCache=s,s.refCount++,s!==null&&(a.pooledCacheLanes|=l),a=s),t.memoizedState={parent:n,cache:a},mo(t),_t(t,fe,a)):(e.lanes&l&&(gc(e,t),Fn(t,null,null,l),$n()),a=e.memoizedState,s=t.memoizedState,a.parent!==n?(a={parent:n,cache:n},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),_t(t,fe,n)):(n=s.cache,_t(t,fe,n),n!==a.cache&&xc(t,[fe],l,!0))),ve(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(N(156,t.tag))}function gt(e){e.flags|=4}function Di(e,t,l,n,a){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(a&335544128)===a)if(e.stateNode.complete)e.flags|=8192;else if(Hd())e.flags|=8192;else throw bl=vs,fo}else e.flags&=-16777217}function Lu(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!i0(t))if(Hd())e.flags|=8192;else throw bl=vs,fo}function _a(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Hr():536870912,e.lanes|=t,xn|=t)}function En(e,t){if(!q)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var n=null;l!==null;)l.alternate!==null&&(n=l),l=l.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function I(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,n=0;if(t)for(var a=e.child;a!==null;)l|=a.lanes|a.childLanes,n|=a.subtreeFlags&65011712,n|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)l|=a.lanes|a.childLanes,n|=a.subtreeFlags,n|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=n,e.childLanes=l,t}function ah(e,t,l){var n=t.pendingProps;switch(oo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return I(t),null;case 1:return I(t),null;case 3:return l=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),kt(fe),un(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Hl(t)?gt(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ni())),I(t),null;case 26:var a=t.type,s=t.memoizedState;return e===null?(gt(t),s!==null?(I(t),Lu(t,s)):(I(t),Di(t,a,null,n,l))):s?s!==e.memoizedState?(gt(t),I(t),Lu(t,s)):(I(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&>(t),I(t),Di(t,a,e,n,l)),null;case 27:if(ds(t),l=Kt.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&>(t);else{if(!n){if(t.stateNode===null)throw Error(N(166));return I(t),null}e=dt.current,Hl(t)?hu(t):(e=n0(a,n,l),t.stateNode=e,gt(t))}return I(t),null;case 5:if(ds(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&>(t);else{if(!n){if(t.stateNode===null)throw Error(N(166));return I(t),null}if(s=dt.current,Hl(t))hu(t);else{var c=Os(Kt.current);switch(s){case 1:s=c.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:s=c.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":s=c.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":s=c.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":s=c.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof n.is=="string"?c.createElement("select",{is:n.is}):c.createElement("select"),n.multiple?s.multiple=!0:n.size&&(s.size=n.size);break;default:s=typeof n.is=="string"?c.createElement(a,{is:n.is}):c.createElement(a)}}s[je]=t,s[Oe]=n;e:for(c=t.child;c!==null;){if(c.tag===5||c.tag===6)s.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===t)break e;for(;c.sibling===null;){if(c.return===null||c.return===t)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}t.stateNode=s;e:switch(ze(s,a,n),a){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&>(t)}}return I(t),Di(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&>(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(N(166));if(e=Kt.current,Hl(t)){if(e=t.stateNode,l=t.memoizedProps,n=null,a=Se,a!==null)switch(a.tag){case 27:case 5:n=a.memoizedProps}e[je]=t,e=!!(e.nodeValue===l||n!==null&&n.suppressHydrationWarning===!0||Pd(e.nodeValue,l)),e||al(t,!0)}else e=Os(e).createTextNode(n),e[je]=t,t.stateNode=e}return I(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(n=Hl(t),l!==null){if(e===null){if(!n)throw Error(N(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(N(557));e[je]=t}else Sl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;I(t),e=!1}else l=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(He(t),t):(He(t),null);if(t.flags&128)throw Error(N(558))}return I(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Hl(t),n!==null&&n.dehydrated!==null){if(e===null){if(!a)throw Error(N(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(N(317));a[je]=t}else Sl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;I(t),a=!1}else a=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(He(t),t):(He(t),null)}return He(t),t.flags&128?(t.lanes=l,t):(l=n!==null,e=e!==null&&e.memoizedState!==null,l&&(n=t.child,a=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(a=n.alternate.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==a&&(n.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),_a(t,t.updateQueue),I(t),null);case 4:return un(),e===null&&Ro(t.stateNode.containerInfo),I(t),null;case 10:return kt(t.type),I(t),null;case 19:if(ye(ie),n=t.memoizedState,n===null)return I(t),null;if(a=(t.flags&128)!==0,s=n.rendering,s===null)if(a)En(n,!1);else{if(ne!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=js(e),s!==null){for(t.flags|=128,En(n,!1),e=s.updateQueue,t.updateQueue=e,_a(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)hf(l,e),l=l.sibling;return W(ie,ie.current&1|2),q&&jt(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&qe()>ks&&(t.flags|=128,a=!0,En(n,!1),t.lanes=4194304)}else{if(!a)if(e=js(s),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,_a(t,e),En(n,!0),n.tail===null&&n.tailMode==="hidden"&&!s.alternate&&!q)return I(t),null}else 2*qe()-n.renderingStartTime>ks&&l!==536870912&&(t.flags|=128,a=!0,En(n,!1),t.lanes=4194304);n.isBackwards?(s.sibling=t.child,t.child=s):(e=n.last,e!==null?e.sibling=s:t.child=s,n.last=s)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=qe(),e.sibling=null,l=ie.current,W(ie,a?l&1|2:l&1),q&&jt(t,n.treeForkCount),e):(I(t),null);case 22:case 23:return He(t),ho(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?l&536870912&&!(t.flags&128)&&(I(t),t.subtreeFlags&6&&(t.flags|=8192)):I(t),l=t.updateQueue,l!==null&&_a(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==l&&(t.flags|=2048),e!==null&&ye(vl),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),kt(fe),I(t),null;case 25:return null;case 30:return null}throw Error(N(156,t.tag))}function sh(e,t){switch(oo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kt(fe),un(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ds(t),null;case 31:if(t.memoizedState!==null){if(He(t),t.alternate===null)throw Error(N(340));Sl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(He(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));Sl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(ie),null;case 4:return un(),null;case 10:return kt(t.type),null;case 22:case 23:return He(t),ho(),e!==null&&ye(vl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return kt(fe),null;case 25:return null;default:return null}}function hd(e,t){switch(oo(t),t.tag){case 3:kt(fe),un();break;case 26:case 27:case 5:ds(t);break;case 4:un();break;case 31:t.memoizedState!==null&&He(t);break;case 13:He(t);break;case 19:ye(ie);break;case 10:kt(t.type);break;case 22:case 23:He(t),ho(),e!==null&&ye(vl);break;case 24:kt(fe)}}function Ca(e,t){try{var l=t.updateQueue,n=l!==null?l.lastEffect:null;if(n!==null){var a=n.next;l=a;do{if((l.tag&e)===e){n=void 0;var s=l.create,c=l.inst;n=s(),c.destroy=n}l=l.next}while(l!==a)}}catch(o){Q(t,t.return,o)}}function sl(e,t,l){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var s=a.next;n=s;do{if((n.tag&e)===e){var c=n.inst,o=c.destroy;if(o!==void 0){c.destroy=void 0,a=t;var u=l,f=o;try{f()}catch(h){Q(a,u,h)}}}n=n.next}while(n!==s)}}catch(h){Q(t,t.return,h)}}function xd(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{zf(t,l)}catch(n){Q(e,e.return,n)}}}function pd(e,t,l){l.props=Tl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(n){Q(e,t,n)}}function In(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof l=="function"?e.refCleanup=l(n):l.current=n}}catch(a){Q(e,t,a)}}function ft(e,t){var l=e.ref,n=e.refCleanup;if(l!==null)if(typeof n=="function")try{n()}catch(a){Q(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(a){Q(e,t,a)}else l.current=null}function gd(e){var t=e.type,l=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break e;case"img":l.src?n.src=l.src:l.srcSet&&(n.srcset=l.srcSet)}}catch(a){Q(e,e.return,a)}}function Oi(e,t,l){try{var n=e.stateNode;kh(n,e.type,l,t),n[Oe]=t}catch(a){Q(e,e.return,a)}}function yd(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ul(e.type)||e.tag===4}function Ui(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||yd(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&&ul(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ac(e,t,l){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=zt));else if(n!==4&&(n===27&&ul(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Ac(e,t,l),e=e.sibling;e!==null;)Ac(e,t,l),e=e.sibling}function Ts(e,t,l){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(n!==4&&(n===27&&ul(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Ts(e,t,l),e=e.sibling;e!==null;)Ts(e,t,l),e=e.sibling}function vd(e){var t=e.stateNode,l=e.memoizedProps;try{for(var n=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);ze(t,n,l),t[je]=e,t[Oe]=l}catch(s){Q(e,e.return,s)}}var St=!1,re=!1,Bi=!1,qu=typeof WeakSet=="function"?WeakSet:Set,pe=null;function ih(e,t){if(e=e.containerInfo,Bc=Hs,e=sf(e),no(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var n=l.getSelection&&l.getSelection();if(n&&n.rangeCount!==0){l=n.anchorNode;var a=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{l.nodeType,s.nodeType}catch{l=null;break e}var c=0,o=-1,u=-1,f=0,h=0,p=e,m=null;t:for(;;){for(var y;p!==l||a!==0&&p.nodeType!==3||(o=c+a),p!==s||n!==0&&p.nodeType!==3||(u=c+n),p.nodeType===3&&(c+=p.nodeValue.length),(y=p.firstChild)!==null;)m=p,p=y;for(;;){if(p===e)break t;if(m===l&&++f===a&&(o=c),m===s&&++h===n&&(u=c),(y=p.nextSibling)!==null)break;p=m,m=p.parentNode}p=y}l=o===-1||u===-1?null:{start:o,end:u}}else l=null}l=l||{start:0,end:0}}else l=null;for(Rc={focusedElem:e,selectionRange:l},Hs=!1,pe=t;pe!==null;)if(t=pe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,pe=e;else for(;pe!==null;){switch(t=pe,s=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)a=e[l],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&s!==null){e=void 0,l=t,a=s.memoizedProps,s=s.memoizedState,n=l.stateNode;try{var g=Tl(l.type,a);e=n.getSnapshotBeforeUpdate(g,s),n.__reactInternalSnapshotBeforeUpdate=e}catch(j){Q(l,l.return,j)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)_c(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":_c(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(N(163))}if(e=t.sibling,e!==null){e.return=t.return,pe=e;break}pe=t.return}}function bd(e,t,l){var n=l.flags;switch(l.tag){case 0:case 11:case 15:vt(e,l),n&4&&Ca(5,l);break;case 1:if(vt(e,l),n&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(c){Q(l,l.return,c)}else{var a=Tl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(c){Q(l,l.return,c)}}n&64&&xd(l),n&512&&In(l,l.return);break;case 3:if(vt(e,l),n&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{zf(e,t)}catch(c){Q(l,l.return,c)}}break;case 27:t===null&&n&4&&vd(l);case 26:case 5:vt(e,l),t===null&&n&4&&gd(l),n&512&&In(l,l.return);break;case 12:vt(e,l);break;case 31:vt(e,l),n&4&&Nd(e,l);break;case 13:vt(e,l),n&4&&zd(e,l),n&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=xh.bind(null,l),Bh(e,l))));break;case 22:if(n=l.memoizedState!==null||St,!n){t=t!==null&&t.memoizedState!==null||re,a=St;var s=re;St=n,(re=t)&&!s?bt(e,l,(l.subtreeFlags&8772)!==0):vt(e,l),St=a,re=s}break;case 30:break;default:vt(e,l)}}function jd(e){var t=e.alternate;t!==null&&(e.alternate=null,jd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Wc(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 te=null,Me=!1;function yt(e,t,l){for(l=l.child;l!==null;)Sd(e,t,l),l=l.sibling}function Sd(e,t,l){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(ya,l)}catch{}switch(l.tag){case 26:re||ft(l,t),yt(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:re||ft(l,t);var n=te,a=Me;ul(l.type)&&(te=l.stateNode,Me=!1),yt(e,t,l),la(l.stateNode),te=n,Me=a;break;case 5:re||ft(l,t);case 6:if(n=te,a=Me,te=null,yt(e,t,l),te=n,Me=a,te!==null)if(Me)try{(te.nodeType===9?te.body:te.nodeName==="HTML"?te.ownerDocument.body:te).removeChild(l.stateNode)}catch(s){Q(l,t,s)}else try{te.removeChild(l.stateNode)}catch(s){Q(l,t,s)}break;case 18:te!==null&&(Me?(e=te,Pu(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),vn(e)):Pu(te,l.stateNode));break;case 4:n=te,a=Me,te=l.stateNode.containerInfo,Me=!0,yt(e,t,l),te=n,Me=a;break;case 0:case 11:case 14:case 15:sl(2,l,t),re||sl(4,l,t),yt(e,t,l);break;case 1:re||(ft(l,t),n=l.stateNode,typeof n.componentWillUnmount=="function"&&pd(l,t,n)),yt(e,t,l);break;case 21:yt(e,t,l);break;case 22:re=(n=re)||l.memoizedState!==null,yt(e,t,l),re=n;break;default:yt(e,t,l)}}function Nd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{vn(e)}catch(l){Q(t,t.return,l)}}}function zd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{vn(e)}catch(l){Q(t,t.return,l)}}function ch(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new qu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new qu),t;default:throw Error(N(435,e.tag))}}function La(e,t){var l=ch(e);t.forEach(function(n){if(!l.has(n)){l.add(n);var a=ph.bind(null,e,n);n.then(a,a)}})}function Ae(e,t){var l=t.deletions;if(l!==null)for(var n=0;n<l.length;n++){var a=l[n],s=e,c=t,o=c;e:for(;o!==null;){switch(o.tag){case 27:if(ul(o.type)){te=o.stateNode,Me=!1;break e}break;case 5:te=o.stateNode,Me=!1;break e;case 3:case 4:te=o.stateNode.containerInfo,Me=!0;break e}o=o.return}if(te===null)throw Error(N(160));Sd(s,c,a),te=null,Me=!1,s=a.alternate,s!==null&&(s.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Cd(t,e),t=t.sibling}var it=null;function Cd(e,t){var l=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ae(t,e),we(e),n&4&&(sl(3,e,e.return),Ca(3,e),sl(5,e,e.return));break;case 1:Ae(t,e),we(e),n&512&&(re||l===null||ft(l,l.return)),n&64&&St&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?n:l.concat(n))));break;case 26:var a=it;if(Ae(t,e),we(e),n&512&&(re||l===null||ft(l,l.return)),n&4){var s=l!==null?l.memoizedState:null;if(n=e.memoizedState,l===null)if(n===null)if(e.stateNode===null){e:{n=e.type,l=e.memoizedProps,a=a.ownerDocument||a;t:switch(n){case"title":s=a.getElementsByTagName("title")[0],(!s||s[ja]||s[je]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=a.createElement(n),a.head.insertBefore(s,a.querySelector("head > title"))),ze(s,n,l),s[je]=e,ge(s),n=s;break e;case"link":var c=ir("link","href",a).get(n+(l.href||""));if(c){for(var o=0;o<c.length;o++)if(s=c[o],s.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&s.getAttribute("rel")===(l.rel==null?null:l.rel)&&s.getAttribute("title")===(l.title==null?null:l.title)&&s.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){c.splice(o,1);break t}}s=a.createElement(n),ze(s,n,l),a.head.appendChild(s);break;case"meta":if(c=ir("meta","content",a).get(n+(l.content||""))){for(o=0;o<c.length;o++)if(s=c[o],s.getAttribute("content")===(l.content==null?null:""+l.content)&&s.getAttribute("name")===(l.name==null?null:l.name)&&s.getAttribute("property")===(l.property==null?null:l.property)&&s.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&s.getAttribute("charset")===(l.charSet==null?null:l.charSet)){c.splice(o,1);break t}}s=a.createElement(n),ze(s,n,l),a.head.appendChild(s);break;default:throw Error(N(468,n))}s[je]=e,ge(s),n=s}e.stateNode=n}else cr(a,e.type,e.stateNode);else e.stateNode=sr(a,n,e.memoizedProps);else s!==n?(s===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):s.count--,n===null?cr(a,e.type,e.stateNode):sr(a,n,e.memoizedProps)):n===null&&e.stateNode!==null&&Oi(e,e.memoizedProps,l.memoizedProps)}break;case 27:Ae(t,e),we(e),n&512&&(re||l===null||ft(l,l.return)),l!==null&&n&4&&Oi(e,e.memoizedProps,l.memoizedProps);break;case 5:if(Ae(t,e),we(e),n&512&&(re||l===null||ft(l,l.return)),e.flags&32){a=e.stateNode;try{fn(a,"")}catch(g){Q(e,e.return,g)}}n&4&&e.stateNode!=null&&(a=e.memoizedProps,Oi(e,a,l!==null?l.memoizedProps:a)),n&1024&&(Bi=!0);break;case 6:if(Ae(t,e),we(e),n&4){if(e.stateNode===null)throw Error(N(162));n=e.memoizedProps,l=e.stateNode;try{l.nodeValue=n}catch(g){Q(e,e.return,g)}}break;case 3:if(ss=null,a=it,it=Us(t.containerInfo),Ae(t,e),it=a,we(e),n&4&&l!==null&&l.memoizedState.isDehydrated)try{vn(t.containerInfo)}catch(g){Q(e,e.return,g)}Bi&&(Bi=!1,Td(e));break;case 4:n=it,it=Us(e.stateNode.containerInfo),Ae(t,e),we(e),it=n;break;case 12:Ae(t,e),we(e);break;case 31:Ae(t,e),we(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,La(e,n)));break;case 13:Ae(t,e),we(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Is=qe()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,La(e,n)));break;case 22:a=e.memoizedState!==null;var u=l!==null&&l.memoizedState!==null,f=St,h=re;if(St=f||a,re=h||u,Ae(t,e),re=h,St=f,we(e),n&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(l===null||u||St||re||xl(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){u=l=t;try{if(s=u.stateNode,a)c=s.style,typeof c.setProperty=="function"?c.setProperty("display","none","important"):c.display="none";else{o=u.stateNode;var p=u.memoizedProps.style,m=p!=null&&p.hasOwnProperty("display")?p.display:null;o.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(g){Q(u,u.return,g)}}}else if(t.tag===6){if(l===null){u=t;try{u.stateNode.nodeValue=a?"":u.memoizedProps}catch(g){Q(u,u.return,g)}}}else if(t.tag===18){if(l===null){u=t;try{var y=u.stateNode;a?er(y,!0):er(u.stateNode,!1)}catch(g){Q(u,u.return,g)}}}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 e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=e.updateQueue,n!==null&&(l=n.retryQueue,l!==null&&(n.retryQueue=null,La(e,l))));break;case 19:Ae(t,e),we(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,La(e,n)));break;case 30:break;case 21:break;default:Ae(t,e),we(e)}}function we(e){var t=e.flags;if(t&2){try{for(var l,n=e.return;n!==null;){if(yd(n)){l=n;break}n=n.return}if(l==null)throw Error(N(160));switch(l.tag){case 27:var a=l.stateNode,s=Ui(e);Ts(e,s,a);break;case 5:var c=l.stateNode;l.flags&32&&(fn(c,""),l.flags&=-33);var o=Ui(e);Ts(e,o,c);break;case 3:case 4:var u=l.stateNode.containerInfo,f=Ui(e);Ac(e,f,u);break;default:throw Error(N(161))}}catch(h){Q(e,e.return,h)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Td(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Td(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function vt(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)bd(e,t.alternate,t),t=t.sibling}function xl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:sl(4,t,t.return),xl(t);break;case 1:ft(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&pd(t,t.return,l),xl(t);break;case 27:la(t.stateNode);case 26:case 5:ft(t,t.return),xl(t);break;case 22:t.memoizedState===null&&xl(t);break;case 30:xl(t);break;default:xl(t)}e=e.sibling}}function bt(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,a=e,s=t,c=s.flags;switch(s.tag){case 0:case 11:case 15:bt(a,s,l),Ca(4,s);break;case 1:if(bt(a,s,l),n=s,a=n.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(f){Q(n,n.return,f)}if(n=s,a=n.updateQueue,a!==null){var o=n.stateNode;try{var u=a.shared.hiddenCallbacks;if(u!==null)for(a.shared.hiddenCallbacks=null,a=0;a<u.length;a++)Nf(u[a],o)}catch(f){Q(n,n.return,f)}}l&&c&64&&xd(s),In(s,s.return);break;case 27:vd(s);case 26:case 5:bt(a,s,l),l&&n===null&&c&4&&gd(s),In(s,s.return);break;case 12:bt(a,s,l);break;case 31:bt(a,s,l),l&&c&4&&Nd(a,s);break;case 13:bt(a,s,l),l&&c&4&&zd(a,s);break;case 22:s.memoizedState===null&&bt(a,s,l),In(s,s.return);break;case 30:break;default:bt(a,s,l)}t=t.sibling}}function Mo(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&Na(l))}function Eo(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Na(e))}function st(e,t,l,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)kd(e,t,l,n),t=t.sibling}function kd(e,t,l,n){var a=t.flags;switch(t.tag){case 0:case 11:case 15:st(e,t,l,n),a&2048&&Ca(9,t);break;case 1:st(e,t,l,n);break;case 3:st(e,t,l,n),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Na(e)));break;case 12:if(a&2048){st(e,t,l,n),e=t.stateNode;try{var s=t.memoizedProps,c=s.id,o=s.onPostCommit;typeof o=="function"&&o(c,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(u){Q(t,t.return,u)}}else st(e,t,l,n);break;case 31:st(e,t,l,n);break;case 13:st(e,t,l,n);break;case 23:break;case 22:s=t.stateNode,c=t.alternate,t.memoizedState!==null?s._visibility&2?st(e,t,l,n):Pn(e,t):s._visibility&2?st(e,t,l,n):(s._visibility|=2,Ll(e,t,l,n,(t.subtreeFlags&10256)!==0||!1)),a&2048&&Mo(c,t);break;case 24:st(e,t,l,n),a&2048&&Eo(t.alternate,t);break;default:st(e,t,l,n)}}function Ll(e,t,l,n,a){for(a=a&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var s=e,c=t,o=l,u=n,f=c.flags;switch(c.tag){case 0:case 11:case 15:Ll(s,c,o,u,a),Ca(8,c);break;case 23:break;case 22:var h=c.stateNode;c.memoizedState!==null?h._visibility&2?Ll(s,c,o,u,a):Pn(s,c):(h._visibility|=2,Ll(s,c,o,u,a)),a&&f&2048&&Mo(c.alternate,c);break;case 24:Ll(s,c,o,u,a),a&&f&2048&&Eo(c.alternate,c);break;default:Ll(s,c,o,u,a)}t=t.sibling}}function Pn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,n=t,a=n.flags;switch(n.tag){case 22:Pn(l,n),a&2048&&Mo(n.alternate,n);break;case 24:Pn(l,n),a&2048&&Eo(n.alternate,n);break;default:Pn(l,n)}t=t.sibling}}var _n=8192;function _l(e,t,l){if(e.subtreeFlags&_n)for(e=e.child;e!==null;)Ad(e,t,l),e=e.sibling}function Ad(e,t,l){switch(e.tag){case 26:_l(e,t,l),e.flags&_n&&e.memoizedState!==null&&Jh(l,it,e.memoizedState,e.memoizedProps);break;case 5:_l(e,t,l);break;case 3:case 4:var n=it;it=Us(e.stateNode.containerInfo),_l(e,t,l),it=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=_n,_n=16777216,_l(e,t,l),_n=n):_l(e,t,l));break;default:_l(e,t,l)}}function wd(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 Dn(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var l=0;l<t.length;l++){var n=t[l];pe=n,Ed(n,e)}wd(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Md(e),e=e.sibling}function Md(e){switch(e.tag){case 0:case 11:case 15:Dn(e),e.flags&2048&&sl(9,e,e.return);break;case 3:Dn(e);break;case 12:Dn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ns(e)):Dn(e);break;default:Dn(e)}}function ns(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var l=0;l<t.length;l++){var n=t[l];pe=n,Ed(n,e)}wd(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:sl(8,t,t.return),ns(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,ns(t));break;default:ns(t)}e=e.sibling}}function Ed(e,t){for(;pe!==null;){var l=pe;switch(l.tag){case 0:case 11:case 15:sl(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var n=l.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:Na(l.memoizedState.cache)}if(n=l.child,n!==null)n.return=l,pe=n;else e:for(l=e;pe!==null;){n=pe;var a=n.sibling,s=n.return;if(jd(n),n===l){pe=null;break e}if(a!==null){a.return=s,pe=a;break e}pe=s}}}var oh={getCacheForType:function(e){var t=Ne(fe),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return Ne(fe).controller.signal}},uh=typeof WeakMap=="function"?WeakMap:Map,Y=0,$=null,_=null,L=0,X=0,Re=null,Zt=!1,zn=!1,Do=!1,Ot=0,ne=0,il=0,jl=0,Oo=0,Le=0,xn=0,ea=null,Ee=null,wc=!1,Is=0,Dd=0,ks=1/0,As=null,It=null,he=0,Pt=null,pn=null,At=0,Mc=0,Ec=null,Od=null,ta=0,Dc=null;function Xe(){return Y&2&&L!==0?L&-L:D.T!==null?Bo():Yr()}function Ud(){if(Le===0)if(!(L&536870912)||q){var e=Ea;Ea<<=1,!(Ea&3932160)&&(Ea=262144),Le=e}else Le=536870912;return e=Ze.current,e!==null&&(e.flags|=32),Le}function De(e,t,l){(e===$&&(X===2||X===9)||e.cancelPendingCommit!==null)&&(gn(e,0),Vt(e,L,Le,!1)),ba(e,l),(!(Y&2)||e!==$)&&(e===$&&(!(Y&2)&&(jl|=l),ne===4&&Vt(e,L,Le,!1)),ht(e))}function Bd(e,t,l){if(Y&6)throw Error(N(327));var n=!l&&(t&127)===0&&(t&e.expiredLanes)===0||va(e,t),a=n?dh(e,t):Ri(e,t,!0),s=n;do{if(a===0){zn&&!n&&Vt(e,t,0,!1);break}else{if(l=e.current.alternate,s&&!rh(l)){a=Ri(e,t,!1),s=!1;continue}if(a===2){if(s=t,e.errorRecoveryDisabledLanes&s)var c=0;else c=e.pendingLanes&-536870913,c=c!==0?c:c&536870912?536870912:0;if(c!==0){t=c;e:{var o=e;a=ea;var u=o.current.memoizedState.isDehydrated;if(u&&(gn(o,c).flags|=256),c=Ri(o,c,!1),c!==2){if(Do&&!u){o.errorRecoveryDisabledLanes|=s,jl|=s,a=4;break e}s=Ee,Ee=a,s!==null&&(Ee===null?Ee=s:Ee.push.apply(Ee,s))}a=c}if(s=!1,a!==2)continue}}if(a===1){gn(e,0),Vt(e,t,0,!0);break}e:{switch(n=e,s=a,s){case 0:case 1:throw Error(N(345));case 4:if((t&4194048)!==t)break;case 6:Vt(n,t,Le,!Zt);break e;case 2:Ee=null;break;case 3:case 5:break;default:throw Error(N(329))}if((t&62914560)===t&&(a=Is+300-qe(),10<a)){if(Vt(n,t,Le,!Zt),Ys(n,0,!0)!==0)break e;At=t,n.timeoutHandle=t0(Yu.bind(null,n,l,Ee,As,wc,t,Le,jl,xn,Zt,s,"Throttled",-0,0),a);break e}Yu(n,l,Ee,As,wc,t,Le,jl,xn,Zt,s,null,-0,0)}}break}while(!0);ht(e)}function Yu(e,t,l,n,a,s,c,o,u,f,h,p,m,y){if(e.timeoutHandle=-1,p=t.subtreeFlags,p&8192||(p&16785408)===16785408){p={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:zt},Ad(t,s,p);var g=(s&62914560)===s?Is-qe():(s&4194048)===s?Dd-qe():0;if(g=Kh(p,g),g!==null){At=s,e.cancelPendingCommit=g(Xu.bind(null,e,t,s,l,n,a,c,o,u,h,p,null,m,y)),Vt(e,s,c,!f);return}}Xu(e,t,s,l,n,a,c,o,u)}function rh(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var n=0;n<l.length;n++){var a=l[n],s=a.getSnapshot;a=a.value;try{if(!Qe(s(),a))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;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 Vt(e,t,l,n){t&=~Oo,t&=~jl,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var a=t;0<a;){var s=31-Ge(a),c=1<<s;n[s]=-1,a&=~c}l!==0&&_r(e,l,t)}function Ps(){return Y&6?!0:(Ta(0),!1)}function Uo(){if(_!==null){if(X===0)var e=_.return;else e=_,Ct=El=null,vo(e),sn=null,ua=0,e=_;for(;e!==null;)hd(e.alternate,e),e=e.return;_=null}}function gn(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,Mh(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),At=0,Uo(),$=e,_=l=Tt(e.current,null),L=t,X=0,Re=null,Zt=!1,zn=va(e,t),Do=!1,xn=Le=Oo=jl=il=ne=0,Ee=ea=null,wc=!1,t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var a=31-Ge(n),s=1<<a;t|=e[a],n&=~s}return Ot=t,Zs(),l}function Rd(e,t){U=null,D.H=fa,t===Nn||t===Js?(t=vu(),X=3):t===fo?(t=vu(),X=4):X=t===Ao?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Re=t,_===null&&(ne=1,zs(e,Ie(t,e.current)))}function Hd(){var e=Ze.current;return e===null?!0:(L&4194048)===L?tt===null:(L&62914560)===L||L&536870912?e===tt:!1}function _d(){var e=D.H;return D.H=fa,e===null?fa:e}function Ld(){var e=D.A;return D.A=oh,e}function ws(){ne=4,Zt||(L&4194048)!==L&&Ze.current!==null||(zn=!0),!(il&134217727)&&!(jl&134217727)||$===null||Vt($,L,Le,!1)}function Ri(e,t,l){var n=Y;Y|=2;var a=_d(),s=Ld();($!==e||L!==t)&&(As=null,gn(e,t)),t=!1;var c=ne;e:do try{if(X!==0&&_!==null){var o=_,u=Re;switch(X){case 8:Uo(),c=6;break e;case 3:case 2:case 9:case 6:Ze.current===null&&(t=!0);var f=X;if(X=0,Re=null,Pl(e,o,u,f),l&&zn){c=0;break e}break;default:f=X,X=0,Re=null,Pl(e,o,u,f)}}fh(),c=ne;break}catch(h){Rd(e,h)}while(!0);return t&&e.shellSuspendCounter++,Ct=El=null,Y=n,D.H=a,D.A=s,_===null&&($=null,L=0,Zs()),c}function fh(){for(;_!==null;)qd(_)}function dh(e,t){var l=Y;Y|=2;var n=_d(),a=Ld();$!==e||L!==t?(As=null,ks=qe()+500,gn(e,t)):zn=va(e,t);e:do try{if(X!==0&&_!==null){t=_;var s=Re;t:switch(X){case 1:X=0,Re=null,Pl(e,t,s,1);break;case 2:case 9:if(yu(s)){X=0,Re=null,Gu(t);break}t=function(){X!==2&&X!==9||$!==e||(X=7),ht(e)},s.then(t,t);break e;case 3:X=7;break e;case 4:X=5;break e;case 7:yu(s)?(X=0,Re=null,Gu(t)):(X=0,Re=null,Pl(e,t,s,7));break;case 5:var c=null;switch(_.tag){case 26:c=_.memoizedState;case 5:case 27:var o=_;if(c?i0(c):o.stateNode.complete){X=0,Re=null;var u=o.sibling;if(u!==null)_=u;else{var f=o.return;f!==null?(_=f,ei(f)):_=null}break t}}X=0,Re=null,Pl(e,t,s,5);break;case 6:X=0,Re=null,Pl(e,t,s,6);break;case 8:Uo(),ne=6;break e;default:throw Error(N(462))}}mh();break}catch(h){Rd(e,h)}while(!0);return Ct=El=null,D.H=n,D.A=a,Y=l,_!==null?0:($=null,L=0,Zs(),ne)}function mh(){for(;_!==null&&!R0();)qd(_)}function qd(e){var t=md(e.alternate,e,Ot);e.memoizedProps=e.pendingProps,t===null?ei(e):_=t}function Gu(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Bu(l,t,t.pendingProps,t.type,void 0,L);break;case 11:t=Bu(l,t,t.pendingProps,t.type.render,t.ref,L);break;case 5:vo(t);default:hd(l,t),t=_=hf(t,Ot),t=md(l,t,Ot)}e.memoizedProps=e.pendingProps,t===null?ei(e):_=t}function Pl(e,t,l,n){Ct=El=null,vo(t),sn=null,ua=0;var a=t.return;try{if(th(e,a,t,l,L)){ne=1,zs(e,Ie(l,e.current)),_=null;return}}catch(s){if(a!==null)throw _=a,s;ne=1,zs(e,Ie(l,e.current)),_=null;return}t.flags&32768?(q||n===1?e=!0:zn||L&536870912?e=!1:(Zt=e=!0,(n===2||n===9||n===3||n===6)&&(n=Ze.current,n!==null&&n.tag===13&&(n.flags|=16384))),Yd(t,e)):ei(t)}function ei(e){var t=e;do{if(t.flags&32768){Yd(t,Zt);return}e=t.return;var l=ah(t.alternate,t,Ot);if(l!==null){_=l;return}if(t=t.sibling,t!==null){_=t;return}_=t=e}while(t!==null);ne===0&&(ne=5)}function Yd(e,t){do{var l=sh(e.alternate,e);if(l!==null){l.flags&=32767,_=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){_=e;return}_=e=l}while(e!==null);ne=6,_=null}function Xu(e,t,l,n,a,s,c,o,u){e.cancelPendingCommit=null;do ti();while(he!==0);if(Y&6)throw Error(N(327));if(t!==null){if(t===e.current)throw Error(N(177));if(s=t.lanes|t.childLanes,s|=ao,V0(e,l,s,c,o,u),e===$&&(_=$=null,L=0),pn=t,Pt=e,At=l,Mc=s,Ec=a,Od=n,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,gh(ms,function(){return Vd(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,t.subtreeFlags&13878||n){n=D.T,D.T=null,a=G.p,G.p=2,c=Y,Y|=4;try{ih(e,t,l)}finally{Y=c,G.p=a,D.T=n}}he=1,Gd(),Xd(),Qd()}}function Gd(){if(he===1){he=0;var e=Pt,t=pn,l=(t.flags&13878)!==0;if(t.subtreeFlags&13878||l){l=D.T,D.T=null;var n=G.p;G.p=2;var a=Y;Y|=4;try{Cd(t,e);var s=Rc,c=sf(e.containerInfo),o=s.focusedElem,u=s.selectionRange;if(c!==o&&o&&o.ownerDocument&&af(o.ownerDocument.documentElement,o)){if(u!==null&&no(o)){var f=u.start,h=u.end;if(h===void 0&&(h=f),"selectionStart"in o)o.selectionStart=f,o.selectionEnd=Math.min(h,o.value.length);else{var p=o.ownerDocument||document,m=p&&p.defaultView||window;if(m.getSelection){var y=m.getSelection(),g=o.textContent.length,j=Math.min(u.start,g),v=u.end===void 0?j:Math.min(u.end,g);!y.extend&&j>v&&(c=v,v=j,j=c);var r=fu(o,j),d=fu(o,v);if(r&&d&&(y.rangeCount!==1||y.anchorNode!==r.node||y.anchorOffset!==r.offset||y.focusNode!==d.node||y.focusOffset!==d.offset)){var x=p.createRange();x.setStart(r.node,r.offset),y.removeAllRanges(),j>v?(y.addRange(x),y.extend(d.node,d.offset)):(x.setEnd(d.node,d.offset),y.addRange(x))}}}}for(p=[],y=o;y=y.parentNode;)y.nodeType===1&&p.push({element:y,left:y.scrollLeft,top:y.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<p.length;o++){var b=p[o];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}Hs=!!Bc,Rc=Bc=null}finally{Y=a,G.p=n,D.T=l}}e.current=t,he=2}}function Xd(){if(he===2){he=0;var e=Pt,t=pn,l=(t.flags&8772)!==0;if(t.subtreeFlags&8772||l){l=D.T,D.T=null;var n=G.p;G.p=2;var a=Y;Y|=4;try{bd(e,t.alternate,t)}finally{Y=a,G.p=n,D.T=l}}he=3}}function Qd(){if(he===4||he===3){he=0,H0();var e=Pt,t=pn,l=At,n=Od;t.subtreeFlags&10256||t.flags&10256?he=5:(he=0,pn=Pt=null,Zd(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(It=null),Fc(l),t=t.stateNode,Ye&&typeof Ye.onCommitFiberRoot=="function")try{Ye.onCommitFiberRoot(ya,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=D.T,a=G.p,G.p=2,D.T=null;try{for(var s=e.onRecoverableError,c=0;c<n.length;c++){var o=n[c];s(o.value,{componentStack:o.stack})}}finally{D.T=t,G.p=a}}At&3&&ti(),ht(e),a=e.pendingLanes,l&261930&&a&42?e===Dc?ta++:(ta=0,Dc=e):ta=0,Ta(0)}}function Zd(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Na(t)))}function ti(){return Gd(),Xd(),Qd(),Vd()}function Vd(){if(he!==5)return!1;var e=Pt,t=Mc;Mc=0;var l=Fc(At),n=D.T,a=G.p;try{G.p=32>l?32:l,D.T=null,l=Ec,Ec=null;var s=Pt,c=At;if(he=0,pn=Pt=null,At=0,Y&6)throw Error(N(331));var o=Y;if(Y|=4,Md(s.current),kd(s,s.current,c,l),Y=o,Ta(0,!1),Ye&&typeof Ye.onPostCommitFiberRoot=="function")try{Ye.onPostCommitFiberRoot(ya,s)}catch{}return!0}finally{G.p=a,D.T=n,Zd(e,t)}}function Qu(e,t,l){t=Ie(l,t),t=Cc(e.stateNode,t,2),e=Wt(e,t,2),e!==null&&(ba(e,2),ht(e))}function Q(e,t,l){if(e.tag===3)Qu(e,e,l);else for(;t!==null;){if(t.tag===3){Qu(t,e,l);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(It===null||!It.has(n))){e=Ie(l,e),l=cd(2),n=Wt(t,l,2),n!==null&&(od(l,n,t,e),ba(n,2),ht(n));break}}t=t.return}}function Hi(e,t,l){var n=e.pingCache;if(n===null){n=e.pingCache=new uh;var a=new Set;n.set(t,a)}else a=n.get(t),a===void 0&&(a=new Set,n.set(t,a));a.has(l)||(Do=!0,a.add(l),e=hh.bind(null,e,t,l),t.then(e,e))}function hh(e,t,l){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,$===e&&(L&l)===l&&(ne===4||ne===3&&(L&62914560)===L&&300>qe()-Is?!(Y&2)&&gn(e,0):Oo|=l,xn===L&&(xn=0)),ht(e)}function Jd(e,t){t===0&&(t=Hr()),e=Ml(e,t),e!==null&&(ba(e,t),ht(e))}function xh(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Jd(e,l)}function ph(e,t){var l=0;switch(e.tag){case 31:case 13:var n=e.stateNode,a=e.memoizedState;a!==null&&(l=a.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(N(314))}n!==null&&n.delete(t),Jd(e,l)}function gh(e,t){return Kc(e,t)}var Ms=null,ql=null,Oc=!1,Es=!1,_i=!1,Jt=0;function ht(e){e!==ql&&e.next===null&&(ql===null?Ms=ql=e:ql=ql.next=e),Es=!0,Oc||(Oc=!0,vh())}function Ta(e,t){if(!_i&&Es){_i=!0;do for(var l=!1,n=Ms;n!==null;){if(e!==0){var a=n.pendingLanes;if(a===0)var s=0;else{var c=n.suspendedLanes,o=n.pingedLanes;s=(1<<31-Ge(42|e)+1)-1,s&=a&~(c&~o),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(l=!0,Zu(n,s))}else s=L,s=Ys(n,n===$?s:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),!(s&3)||va(n,s)||(l=!0,Zu(n,s));n=n.next}while(l);_i=!1}}function yh(){Kd()}function Kd(){Es=Oc=!1;var e=0;Jt!==0&&wh()&&(e=Jt);for(var t=qe(),l=null,n=Ms;n!==null;){var a=n.next,s=$d(n,t);s===0?(n.next=null,l===null?Ms=a:l.next=a,a===null&&(ql=l)):(l=n,(e!==0||s&3)&&(Es=!0)),n=a}he!==0&&he!==5||Ta(e),Jt!==0&&(Jt=0)}function $d(e,t){for(var l=e.suspendedLanes,n=e.pingedLanes,a=e.expirationTimes,s=e.pendingLanes&-62914561;0<s;){var c=31-Ge(s),o=1<<c,u=a[c];u===-1?(!(o&l)||o&n)&&(a[c]=Z0(o,t)):u<=t&&(e.expiredLanes|=o),s&=~o}if(t=$,l=L,l=Ys(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,l===0||e===t&&(X===2||X===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&di(n),e.callbackNode=null,e.callbackPriority=0;if(!(l&3)||va(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(n!==null&&di(n),Fc(l)){case 2:case 8:l=Br;break;case 32:l=ms;break;case 268435456:l=Rr;break;default:l=ms}return n=Fd.bind(null,e),l=Kc(l,n),e.callbackPriority=t,e.callbackNode=l,t}return n!==null&&n!==null&&di(n),e.callbackPriority=2,e.callbackNode=null,2}function Fd(e,t){if(he!==0&&he!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(ti()&&e.callbackNode!==l)return null;var n=L;return n=Ys(e,e===$?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(Bd(e,n,t),$d(e,qe()),e.callbackNode!=null&&e.callbackNode===l?Fd.bind(null,e):null)}function Zu(e,t){if(ti())return null;Bd(e,t,!0)}function vh(){Eh(function(){Y&6?Kc(Ur,yh):Kd()})}function Bo(){if(Jt===0){var e=dn;e===0&&(e=Ma,Ma<<=1,!(Ma&261888)&&(Ma=256)),Jt=e}return Jt}function Vu(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ka(""+e)}function Ju(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function bh(e,t,l,n,a){if(t==="submit"&&l&&l.stateNode===a){var s=Vu((a[Oe]||null).action),c=n.submitter;c&&(t=(t=c[Oe]||null)?Vu(t.formAction):c.getAttribute("formAction"),t!==null&&(s=t,c=null));var o=new Gs("action","action",null,n,a);e.push({event:o,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Jt!==0){var u=c?Ju(a,c):new FormData(a);Nc(l,{pending:!0,data:u,method:a.method,action:s},null,u)}}else typeof s=="function"&&(o.preventDefault(),u=c?Ju(a,c):new FormData(a),Nc(l,{pending:!0,data:u,method:a.method,action:s},s,u))},currentTarget:a}]})}}for(var Li=0;Li<fc.length;Li++){var qi=fc[Li],jh=qi.toLowerCase(),Sh=qi[0].toUpperCase()+qi.slice(1);ot(jh,"on"+Sh)}ot(of,"onAnimationEnd");ot(uf,"onAnimationIteration");ot(rf,"onAnimationStart");ot("dblclick","onDoubleClick");ot("focusin","onFocus");ot("focusout","onBlur");ot(_m,"onTransitionRun");ot(Lm,"onTransitionStart");ot(qm,"onTransitionCancel");ot(ff,"onTransitionEnd");rn("onMouseEnter",["mouseout","mouseover"]);rn("onMouseLeave",["mouseout","mouseover"]);rn("onPointerEnter",["pointerout","pointerover"]);rn("onPointerLeave",["pointerout","pointerover"]);kl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));kl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));kl("onBeforeInput",["compositionend","keypress","textInput","paste"]);kl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));kl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));kl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var da="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(" "),Nh=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(da));function Wd(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var n=e[l],a=n.event;n=n.listeners;e:{var s=void 0;if(t)for(var c=n.length-1;0<=c;c--){var o=n[c],u=o.instance,f=o.currentTarget;if(o=o.listener,u!==s&&a.isPropagationStopped())break e;s=o,a.currentTarget=f;try{s(a)}catch(h){xs(h)}a.currentTarget=null,s=u}else for(c=0;c<n.length;c++){if(o=n[c],u=o.instance,f=o.currentTarget,o=o.listener,u!==s&&a.isPropagationStopped())break e;s=o,a.currentTarget=f;try{s(a)}catch(h){xs(h)}a.currentTarget=null,s=u}}}}function H(e,t){var l=t[nc];l===void 0&&(l=t[nc]=new Set);var n=e+"__bubble";l.has(n)||(Id(t,e,2,!1),l.add(n))}function Yi(e,t,l){var n=0;t&&(n|=4),Id(l,e,n,t)}var qa="_reactListening"+Math.random().toString(36).slice(2);function Ro(e){if(!e[qa]){e[qa]=!0,Gr.forEach(function(l){l!=="selectionchange"&&(Nh.has(l)||Yi(l,!1,e),Yi(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[qa]||(t[qa]=!0,Yi("selectionchange",!1,t))}}function Id(e,t,l,n){switch(f0(t)){case 2:var a=Wh;break;case 8:a=Ih;break;default:a=qo}l=a.bind(null,t,l,e),a=void 0,!oc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),n?a!==void 0?e.addEventListener(t,l,{capture:!0,passive:a}):e.addEventListener(t,l,!0):a!==void 0?e.addEventListener(t,l,{passive:a}):e.addEventListener(t,l,!1)}function Gi(e,t,l,n,a){var s=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var c=n.tag;if(c===3||c===4){var o=n.stateNode.containerInfo;if(o===a)break;if(c===4)for(c=n.return;c!==null;){var u=c.tag;if((u===3||u===4)&&c.stateNode.containerInfo===a)return;c=c.return}for(;o!==null;){if(c=Ql(o),c===null)return;if(u=c.tag,u===5||u===6||u===26||u===27){n=s=c;continue e}o=o.parentNode}}n=n.return}Fr(function(){var f=s,h=Pc(l),p=[];e:{var m=df.get(e);if(m!==void 0){var y=Gs,g=e;switch(e){case"keypress":if(Fa(l)===0)break e;case"keydown":case"keyup":y=pm;break;case"focusin":g="focus",y=gi;break;case"focusout":g="blur",y=gi;break;case"beforeblur":case"afterblur":y=gi;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":y=tu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=am;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=vm;break;case of:case uf:case rf:y=cm;break;case ff:y=jm;break;case"scroll":case"scrollend":y=lm;break;case"wheel":y=Nm;break;case"copy":case"cut":case"paste":y=um;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=nu;break;case"toggle":case"beforetoggle":y=Cm}var j=(t&4)!==0,v=!j&&(e==="scroll"||e==="scrollend"),r=j?m!==null?m+"Capture":null:m;j=[];for(var d=f,x;d!==null;){var b=d;if(x=b.stateNode,b=b.tag,b!==5&&b!==26&&b!==27||x===null||r===null||(b=aa(d,r),b!=null&&j.push(ma(d,b,x))),v)break;d=d.return}0<j.length&&(m=new y(m,g,null,l,h),p.push({event:m,listeners:j}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",m&&l!==cc&&(g=l.relatedTarget||l.fromElement)&&(Ql(g)||g[bn]))break e;if((y||m)&&(m=h.window===h?h:(m=h.ownerDocument)?m.defaultView||m.parentWindow:window,y?(g=l.relatedTarget||l.toElement,y=f,g=g?Ql(g):null,g!==null&&(v=ga(g),j=g.tag,g!==v||j!==5&&j!==27&&j!==6)&&(g=null)):(y=null,g=f),y!==g)){if(j=tu,b="onMouseLeave",r="onMouseEnter",d="mouse",(e==="pointerout"||e==="pointerover")&&(j=nu,b="onPointerLeave",r="onPointerEnter",d="pointer"),v=y==null?m:Rn(y),x=g==null?m:Rn(g),m=new j(b,d+"leave",y,l,h),m.target=v,m.relatedTarget=x,b=null,Ql(h)===f&&(j=new j(r,d+"enter",g,l,h),j.target=x,j.relatedTarget=v,b=j),v=b,y&&g)t:{for(j=zh,r=y,d=g,x=0,b=r;b;b=j(b))x++;b=0;for(var S=d;S;S=j(S))b++;for(;0<x-b;)r=j(r),x--;for(;0<b-x;)d=j(d),b--;for(;x--;){if(r===d||d!==null&&r===d.alternate){j=r;break t}r=j(r),d=j(d)}j=null}else j=null;y!==null&&Ku(p,m,y,j,!1),g!==null&&v!==null&&Ku(p,v,g,j,!0)}}e:{if(m=f?Rn(f):window,y=m.nodeName&&m.nodeName.toLowerCase(),y==="select"||y==="input"&&m.type==="file")var k=cu;else if(iu(m))if(lf)k=Bm;else{k=Om;var z=Dm}else y=m.nodeName,!y||y.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?f&&Ic(f.elementType)&&(k=cu):k=Um;if(k&&(k=k(e,f))){tf(p,k,l,h);break e}z&&z(e,m,f),e==="focusout"&&f&&m.type==="number"&&f.memoizedProps.value!=null&&ic(m,"number",m.value)}switch(z=f?Rn(f):window,e){case"focusin":(iu(z)||z.contentEditable==="true")&&(Jl=z,uc=f,Vn=null);break;case"focusout":Vn=uc=Jl=null;break;case"mousedown":rc=!0;break;case"contextmenu":case"mouseup":case"dragend":rc=!1,du(p,l,h);break;case"selectionchange":if(Hm)break;case"keydown":case"keyup":du(p,l,h)}var A;if(lo)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Vl?Pr(e,l)&&(T="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(T="onCompositionStart");T&&(Ir&&l.locale!=="ko"&&(Vl||T!=="onCompositionStart"?T==="onCompositionEnd"&&Vl&&(A=Wr()):(Qt=h,eo="value"in Qt?Qt.value:Qt.textContent,Vl=!0)),z=Ds(f,T),0<z.length&&(T=new lu(T,e,null,l,h),p.push({event:T,listeners:z}),A?T.data=A:(A=ef(l),A!==null&&(T.data=A)))),(A=km?Am(e,l):wm(e,l))&&(T=Ds(f,"onBeforeInput"),0<T.length&&(z=new lu("onBeforeInput","beforeinput",null,l,h),p.push({event:z,listeners:T}),z.data=A)),bh(p,e,f,l,h)}Wd(p,t)})}function ma(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Ds(e,t){for(var l=t+"Capture",n=[];e!==null;){var a=e,s=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||s===null||(a=aa(e,l),a!=null&&n.unshift(ma(e,a,s)),a=aa(e,t),a!=null&&n.push(ma(e,a,s))),e.tag===3)return n;e=e.return}return[]}function zh(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ku(e,t,l,n,a){for(var s=t._reactName,c=[];l!==null&&l!==n;){var o=l,u=o.alternate,f=o.stateNode;if(o=o.tag,u!==null&&u===n)break;o!==5&&o!==26&&o!==27||f===null||(u=f,a?(f=aa(l,s),f!=null&&c.unshift(ma(l,f,u))):a||(f=aa(l,s),f!=null&&c.push(ma(l,f,u)))),l=l.return}c.length!==0&&e.push({event:t,listeners:c})}var Ch=/\r\n?/g,Th=/\u0000|\uFFFD/g;function $u(e){return(typeof e=="string"?e:""+e).replace(Ch,`
|
|
33
|
-
`).replace(Th,"")}function Pd(e,t){return t=$u(t),$u(e)===t}function J(e,t,l,n,a,s){switch(l){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||fn(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&fn(e,""+n);break;case"className":Oa(e,"class",n);break;case"tabIndex":Oa(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":Oa(e,l,n);break;case"style":$r(e,n,s);break;case"data":if(t!=="object"){Oa(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=Ka(""+n),e.setAttribute(l,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(l,"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 s=="function"&&(l==="formAction"?(t!=="input"&&J(e,t,"name",a.name,a,null),J(e,t,"formEncType",a.formEncType,a,null),J(e,t,"formMethod",a.formMethod,a,null),J(e,t,"formTarget",a.formTarget,a,null)):(J(e,t,"encType",a.encType,a,null),J(e,t,"method",a.method,a,null),J(e,t,"target",a.target,a,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=Ka(""+n),e.setAttribute(l,n);break;case"onClick":n!=null&&(e.onclick=zt);break;case"onScroll":n!=null&&H("scroll",e);break;case"onScrollEnd":n!=null&&H("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(N(61));if(l=n.__html,l!=null){if(a.children!=null)throw Error(N(60));e.innerHTML=l}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}l=Ka(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,""+n):e.removeAttribute(l);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":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":n===!0?e.setAttribute(l,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,n):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(l,n):e.removeAttribute(l);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(l):e.setAttribute(l,n);break;case"popover":H("beforetoggle",e),H("toggle",e),Ja(e,"popover",n);break;case"xlinkActuate":pt(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":pt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":pt(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":pt(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":pt(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":pt(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":pt(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":pt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":pt(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Ja(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=em.get(l)||l,Ja(e,l,n))}}function Uc(e,t,l,n,a,s){switch(l){case"style":$r(e,n,s);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(N(61));if(l=n.__html,l!=null){if(a.children!=null)throw Error(N(60));e.innerHTML=l}}break;case"children":typeof n=="string"?fn(e,n):(typeof n=="number"||typeof n=="bigint")&&fn(e,""+n);break;case"onScroll":n!=null&&H("scroll",e);break;case"onScrollEnd":n!=null&&H("scrollend",e);break;case"onClick":n!=null&&(e.onclick=zt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xr.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(a=l.endsWith("Capture"),t=l.slice(2,a?l.length-7:void 0),s=e[Oe]||null,s=s!=null?s[l]:null,typeof s=="function"&&e.removeEventListener(t,s,a),typeof n=="function")){typeof s!="function"&&s!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,n,a);break e}l in e?e[l]=n:n===!0?e.setAttribute(l,""):Ja(e,l,n)}}}function ze(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":H("error",e),H("load",e);var n=!1,a=!1,s;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];if(c!=null)switch(s){case"src":n=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(N(137,t));default:J(e,t,s,c,l,null)}}a&&J(e,t,"srcSet",l.srcSet,l,null),n&&J(e,t,"src",l.src,l,null);return;case"input":H("invalid",e);var o=s=c=a=null,u=null,f=null;for(n in l)if(l.hasOwnProperty(n)){var h=l[n];if(h!=null)switch(n){case"name":a=h;break;case"type":c=h;break;case"checked":u=h;break;case"defaultChecked":f=h;break;case"value":s=h;break;case"defaultValue":o=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(N(137,t));break;default:J(e,t,n,h,l,null)}}Vr(e,s,o,u,f,c,a,!1);return;case"select":H("invalid",e),n=c=s=null;for(a in l)if(l.hasOwnProperty(a)&&(o=l[a],o!=null))switch(a){case"value":s=o;break;case"defaultValue":c=o;break;case"multiple":n=o;default:J(e,t,a,o,l,null)}t=s,l=c,e.multiple=!!n,t!=null?ln(e,!!n,t,!1):l!=null&&ln(e,!!n,l,!0);return;case"textarea":H("invalid",e),s=a=n=null;for(c in l)if(l.hasOwnProperty(c)&&(o=l[c],o!=null))switch(c){case"value":n=o;break;case"defaultValue":a=o;break;case"children":s=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(N(91));break;default:J(e,t,c,o,l,null)}Kr(e,n,a,s);return;case"option":for(u in l)if(l.hasOwnProperty(u)&&(n=l[u],n!=null))switch(u){case"selected":e.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:J(e,t,u,n,l,null)}return;case"dialog":H("beforetoggle",e),H("toggle",e),H("cancel",e),H("close",e);break;case"iframe":case"object":H("load",e);break;case"video":case"audio":for(n=0;n<da.length;n++)H(da[n],e);break;case"image":H("error",e),H("load",e);break;case"details":H("toggle",e);break;case"embed":case"source":case"link":H("error",e),H("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(f in l)if(l.hasOwnProperty(f)&&(n=l[f],n!=null))switch(f){case"children":case"dangerouslySetInnerHTML":throw Error(N(137,t));default:J(e,t,f,n,l,null)}return;default:if(Ic(t)){for(h in l)l.hasOwnProperty(h)&&(n=l[h],n!==void 0&&Uc(e,t,h,n,l,void 0));return}}for(o in l)l.hasOwnProperty(o)&&(n=l[o],n!=null&&J(e,t,o,n,l,null))}function kh(e,t,l,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,s=null,c=null,o=null,u=null,f=null,h=null;for(y in l){var p=l[y];if(l.hasOwnProperty(y)&&p!=null)switch(y){case"checked":break;case"value":break;case"defaultValue":u=p;default:n.hasOwnProperty(y)||J(e,t,y,null,n,p)}}for(var m in n){var y=n[m];if(p=l[m],n.hasOwnProperty(m)&&(y!=null||p!=null))switch(m){case"type":s=y;break;case"name":a=y;break;case"checked":f=y;break;case"defaultChecked":h=y;break;case"value":c=y;break;case"defaultValue":o=y;break;case"children":case"dangerouslySetInnerHTML":if(y!=null)throw Error(N(137,t));break;default:y!==p&&J(e,t,m,y,n,p)}}sc(e,c,o,u,f,h,s,a);return;case"select":y=c=o=m=null;for(s in l)if(u=l[s],l.hasOwnProperty(s)&&u!=null)switch(s){case"value":break;case"multiple":y=u;default:n.hasOwnProperty(s)||J(e,t,s,null,n,u)}for(a in n)if(s=n[a],u=l[a],n.hasOwnProperty(a)&&(s!=null||u!=null))switch(a){case"value":m=s;break;case"defaultValue":o=s;break;case"multiple":c=s;default:s!==u&&J(e,t,a,s,n,u)}t=o,l=c,n=y,m!=null?ln(e,!!l,m,!1):!!n!=!!l&&(t!=null?ln(e,!!l,t,!0):ln(e,!!l,l?[]:"",!1));return;case"textarea":y=m=null;for(o in l)if(a=l[o],l.hasOwnProperty(o)&&a!=null&&!n.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:J(e,t,o,null,n,a)}for(c in n)if(a=n[c],s=l[c],n.hasOwnProperty(c)&&(a!=null||s!=null))switch(c){case"value":m=a;break;case"defaultValue":y=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(N(91));break;default:a!==s&&J(e,t,c,a,n,s)}Jr(e,m,y);return;case"option":for(var g in l)if(m=l[g],l.hasOwnProperty(g)&&m!=null&&!n.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:J(e,t,g,null,n,m)}for(u in n)if(m=n[u],y=l[u],n.hasOwnProperty(u)&&m!==y&&(m!=null||y!=null))switch(u){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:J(e,t,u,m,n,y)}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 j in l)m=l[j],l.hasOwnProperty(j)&&m!=null&&!n.hasOwnProperty(j)&&J(e,t,j,null,n,m);for(f in n)if(m=n[f],y=l[f],n.hasOwnProperty(f)&&m!==y&&(m!=null||y!=null))switch(f){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(N(137,t));break;default:J(e,t,f,m,n,y)}return;default:if(Ic(t)){for(var v in l)m=l[v],l.hasOwnProperty(v)&&m!==void 0&&!n.hasOwnProperty(v)&&Uc(e,t,v,void 0,n,m);for(h in n)m=n[h],y=l[h],!n.hasOwnProperty(h)||m===y||m===void 0&&y===void 0||Uc(e,t,h,m,n,y);return}}for(var r in l)m=l[r],l.hasOwnProperty(r)&&m!=null&&!n.hasOwnProperty(r)&&J(e,t,r,null,n,m);for(p in n)m=n[p],y=l[p],!n.hasOwnProperty(p)||m===y||m==null&&y==null||J(e,t,p,m,n,y)}function Fu(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ah(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),n=0;n<l.length;n++){var a=l[n],s=a.transferSize,c=a.initiatorType,o=a.duration;if(s&&o&&Fu(c)){for(c=0,o=a.responseEnd,n+=1;n<l.length;n++){var u=l[n],f=u.startTime;if(f>o)break;var h=u.transferSize,p=u.initiatorType;h&&Fu(p)&&(u=u.responseEnd,c+=h*(u<o?1:(o-f)/(u-f)))}if(--n,t+=8*(s+c)/(a.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 Bc=null,Rc=null;function Os(e){return e.nodeType===9?e:e.ownerDocument}function Wu(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 e0(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 Hc(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 Xi=null;function wh(){var e=window.event;return e&&e.type==="popstate"?e===Xi?!1:(Xi=e,!0):(Xi=null,!1)}var t0=typeof setTimeout=="function"?setTimeout:void 0,Mh=typeof clearTimeout=="function"?clearTimeout:void 0,Iu=typeof Promise=="function"?Promise:void 0,Eh=typeof queueMicrotask=="function"?queueMicrotask:typeof Iu<"u"?function(e){return Iu.resolve(null).then(e).catch(Dh)}:t0;function Dh(e){setTimeout(function(){throw e})}function ul(e){return e==="head"}function Pu(e,t){var l=t,n=0;do{var a=l.nextSibling;if(e.removeChild(l),a&&a.nodeType===8)if(l=a.data,l==="/$"||l==="/&"){if(n===0){e.removeChild(a),vn(t);return}n--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")n++;else if(l==="html")la(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,la(l);for(var s=l.firstChild;s;){var c=s.nextSibling,o=s.nodeName;s[ja]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&s.rel.toLowerCase()==="stylesheet"||l.removeChild(s),s=c}}else l==="body"&&la(e.ownerDocument.body);l=a}while(l);vn(t)}function er(e,t){var l=e;e=0;do{var n=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),n&&n.nodeType===8)if(l=n.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=n}while(l)}function _c(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":_c(l),Wc(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function Oh(e,t,l,n){for(;e.nodeType===1;){var a=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[ja])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(s=e.getAttribute("rel"),s==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(s!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(s=e.getAttribute("src"),(s!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&s&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var s=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===s)return e}else return e;if(e=lt(e.nextSibling),e===null)break}return null}function Uh(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=lt(e.nextSibling),e===null))return null;return e}function l0(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=lt(e.nextSibling),e===null))return null;return e}function Lc(e){return e.data==="$?"||e.data==="$~"}function qc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Bh(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var n=function(){t(),l.removeEventListener("DOMContentLoaded",n)};l.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function lt(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 Yc=null;function tr(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return lt(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function lr(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function n0(e,t,l){switch(t=Os(l),e){case"html":if(e=t.documentElement,!e)throw Error(N(452));return e;case"head":if(e=t.head,!e)throw Error(N(453));return e;case"body":if(e=t.body,!e)throw Error(N(454));return e;default:throw Error(N(451))}}function la(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Wc(e)}var nt=new Map,nr=new Set;function Us(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ut=G.d;G.d={f:Rh,r:Hh,D:_h,C:Lh,L:qh,m:Yh,X:Xh,S:Gh,M:Qh};function Rh(){var e=Ut.f(),t=Ps();return e||t}function Hh(e){var t=jn(e);t!==null&&t.tag===5&&t.type==="form"?Ff(t):Ut.r(e)}var Cn=typeof document>"u"?null:document;function a0(e,t,l){var n=Cn;if(n&&typeof t=="string"&&t){var a=We(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof l=="string"&&(a+='[crossorigin="'+l+'"]'),nr.has(a)||(nr.add(a),e={rel:e,crossOrigin:l,href:t},n.querySelector(a)===null&&(t=n.createElement("link"),ze(t,"link",e),ge(t),n.head.appendChild(t)))}}function _h(e){Ut.D(e),a0("dns-prefetch",e,null)}function Lh(e,t){Ut.C(e,t),a0("preconnect",e,t)}function qh(e,t,l){Ut.L(e,t,l);var n=Cn;if(n&&e&&t){var a='link[rel="preload"][as="'+We(t)+'"]';t==="image"&&l&&l.imageSrcSet?(a+='[imagesrcset="'+We(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(a+='[imagesizes="'+We(l.imageSizes)+'"]')):a+='[href="'+We(e)+'"]';var s=a;switch(t){case"style":s=yn(e);break;case"script":s=Tn(e)}nt.has(s)||(e=ee({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),nt.set(s,e),n.querySelector(a)!==null||t==="style"&&n.querySelector(ka(s))||t==="script"&&n.querySelector(Aa(s))||(t=n.createElement("link"),ze(t,"link",e),ge(t),n.head.appendChild(t)))}}function Yh(e,t){Ut.m(e,t);var l=Cn;if(l&&e){var n=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+We(n)+'"][href="'+We(e)+'"]',s=a;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Tn(e)}if(!nt.has(s)&&(e=ee({rel:"modulepreload",href:e},t),nt.set(s,e),l.querySelector(a)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Aa(s)))return}n=l.createElement("link"),ze(n,"link",e),ge(n),l.head.appendChild(n)}}}function Gh(e,t,l){Ut.S(e,t,l);var n=Cn;if(n&&e){var a=tn(n).hoistableStyles,s=yn(e);t=t||"default";var c=a.get(s);if(!c){var o={loading:0,preload:null};if(c=n.querySelector(ka(s)))o.loading=5;else{e=ee({rel:"stylesheet",href:e,"data-precedence":t},l),(l=nt.get(s))&&Ho(e,l);var u=c=n.createElement("link");ge(u),ze(u,"link",e),u._p=new Promise(function(f,h){u.onload=f,u.onerror=h}),u.addEventListener("load",function(){o.loading|=1}),u.addEventListener("error",function(){o.loading|=2}),o.loading|=4,as(c,t,n)}c={type:"stylesheet",instance:c,count:1,state:o},a.set(s,c)}}}function Xh(e,t){Ut.X(e,t);var l=Cn;if(l&&e){var n=tn(l).hoistableScripts,a=Tn(e),s=n.get(a);s||(s=l.querySelector(Aa(a)),s||(e=ee({src:e,async:!0},t),(t=nt.get(a))&&_o(e,t),s=l.createElement("script"),ge(s),ze(s,"link",e),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},n.set(a,s))}}function Qh(e,t){Ut.M(e,t);var l=Cn;if(l&&e){var n=tn(l).hoistableScripts,a=Tn(e),s=n.get(a);s||(s=l.querySelector(Aa(a)),s||(e=ee({src:e,async:!0,type:"module"},t),(t=nt.get(a))&&_o(e,t),s=l.createElement("script"),ge(s),ze(s,"link",e),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},n.set(a,s))}}function ar(e,t,l,n){var a=(a=Kt.current)?Us(a):null;if(!a)throw Error(N(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=yn(l.href),l=tn(a).hoistableStyles,n=l.get(t),n||(n={type:"style",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=yn(l.href);var s=tn(a).hoistableStyles,c=s.get(e);if(c||(a=a.ownerDocument||a,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,c),(s=a.querySelector(ka(e)))&&!s._p&&(c.instance=s,c.state.loading=5),nt.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},nt.set(e,l),s||Zh(a,e,l,c.state))),t&&n===null)throw Error(N(528,""));return c}if(t&&n!==null)throw Error(N(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Tn(l),l=tn(a).hoistableScripts,n=l.get(t),n||(n={type:"script",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(N(444,e))}}function yn(e){return'href="'+We(e)+'"'}function ka(e){return'link[rel="stylesheet"]['+e+"]"}function s0(e){return ee({},e,{"data-precedence":e.precedence,precedence:null})}function Zh(e,t,l,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),ze(t,"link",l),ge(t),e.head.appendChild(t))}function Tn(e){return'[src="'+We(e)+'"]'}function Aa(e){return"script[async]"+e}function sr(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+We(l.href)+'"]');if(n)return t.instance=n,ge(n),n;var a=ee({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),ge(n),ze(n,"style",a),as(n,l.precedence,e),t.instance=n;case"stylesheet":a=yn(l.href);var s=e.querySelector(ka(a));if(s)return t.state.loading|=4,t.instance=s,ge(s),s;n=s0(l),(a=nt.get(a))&&Ho(n,a),s=(e.ownerDocument||e).createElement("link"),ge(s);var c=s;return c._p=new Promise(function(o,u){c.onload=o,c.onerror=u}),ze(s,"link",n),t.state.loading|=4,as(s,l.precedence,e),t.instance=s;case"script":return s=Tn(l.src),(a=e.querySelector(Aa(s)))?(t.instance=a,ge(a),a):(n=l,(a=nt.get(s))&&(n=ee({},l),_o(n,a)),e=e.ownerDocument||e,a=e.createElement("script"),ge(a),ze(a,"link",n),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(N(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(n=t.instance,t.state.loading|=4,as(n,l.precedence,e));return t.instance}function as(e,t,l){for(var n=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=n.length?n[n.length-1]:null,s=a,c=0;c<n.length;c++){var o=n[c];if(o.dataset.precedence===t)s=o;else if(s!==a)break}s?s.parentNode.insertBefore(e,s.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Ho(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function _o(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ss=null;function ir(e,t,l){if(ss===null){var n=new Map,a=ss=new Map;a.set(l,n)}else a=ss,n=a.get(l),n||(n=new Map,a.set(l,n));if(n.has(e))return n;for(n.set(e,null),l=l.getElementsByTagName(e),a=0;a<l.length;a++){var s=l[a];if(!(s[ja]||s[je]||e==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var c=s.getAttribute(t)||"";c=e+c;var o=n.get(c);o?o.push(s):n.set(c,[s])}}return n}function cr(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function Vh(e,t,l){if(l===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 i0(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function Jh(e,t,l,n){if(l.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(l.state.loading&4)){if(l.instance===null){var a=yn(n.href),s=t.querySelector(ka(a));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Bs.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=s,ge(s);return}s=t.ownerDocument||t,n=s0(n),(a=nt.get(a))&&Ho(n,a),s=s.createElement("link"),ge(s);var c=s;c._p=new Promise(function(o,u){c.onload=o,c.onerror=u}),ze(s,"link",n),l.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&!(l.state.loading&3)&&(e.count++,l=Bs.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Qi=0;function Kh(e,t){return e.stylesheets&&e.count===0&&is(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var n=setTimeout(function(){if(e.stylesheets&&is(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4+t);0<e.imgBytes&&Qi===0&&(Qi=62500*Ah());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&is(e,e.stylesheets),e.unsuspend)){var s=e.unsuspend;e.unsuspend=null,s()}},(e.imgBytes>Qi?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(a)}}:null}function Bs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)is(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Rs=null;function is(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Rs=new Map,t.forEach($h,e),Rs=null,Bs.call(e))}function $h(e,t){if(!(t.state.loading&4)){var l=Rs.get(e);if(l)var n=l.get(null);else{l=new Map,Rs.set(e,l);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<a.length;s++){var c=a[s];(c.nodeName==="LINK"||c.getAttribute("media")!=="not all")&&(l.set(c.dataset.precedence,c),n=c)}n&&l.set(null,n)}a=t.instance,c=a.getAttribute("data-precedence"),s=l.get(c)||n,s===n&&l.set(null,a),l.set(c,a),this.count++,n=Bs.bind(this),a.addEventListener("load",n),a.addEventListener("error",n),s?s.parentNode.insertBefore(a,s.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var ha={$$typeof:Nt,Provider:null,Consumer:null,_currentValue:gl,_currentValue2:gl,_threadCount:0};function Fh(e,t,l,n,a,s,c,o,u){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=mi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mi(0),this.hiddenUpdates=mi(null),this.identifierPrefix=n,this.onUncaughtError=a,this.onCaughtError=s,this.onRecoverableError=c,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=u,this.incompleteTransitions=new Map}function c0(e,t,l,n,a,s,c,o,u,f,h,p){return e=new Fh(e,t,l,c,u,f,h,p,o),t=1,s===!0&&(t|=24),s=_e(3,null,null,t),e.current=s,s.stateNode=e,t=uo(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:n,isDehydrated:l,cache:t},mo(s),e}function o0(e){return e?(e=Fl,e):Fl}function u0(e,t,l,n,a,s){a=o0(a),n.context===null?n.context=a:n.pendingContext=a,n=Ft(t),n.payload={element:l},s=s===void 0?null:s,s!==null&&(n.callback=s),l=Wt(e,n,t),l!==null&&(De(l,e,t),Kn(l,e,t))}function or(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Lo(e,t){or(e,t),(e=e.alternate)&&or(e,t)}function r0(e){if(e.tag===13||e.tag===31){var t=Ml(e,67108864);t!==null&&De(t,e,67108864),Lo(e,67108864)}}function ur(e){if(e.tag===13||e.tag===31){var t=Xe();t=$c(t);var l=Ml(e,t);l!==null&&De(l,e,t),Lo(e,t)}}var Hs=!0;function Wh(e,t,l,n){var a=D.T;D.T=null;var s=G.p;try{G.p=2,qo(e,t,l,n)}finally{G.p=s,D.T=a}}function Ih(e,t,l,n){var a=D.T;D.T=null;var s=G.p;try{G.p=8,qo(e,t,l,n)}finally{G.p=s,D.T=a}}function qo(e,t,l,n){if(Hs){var a=Gc(n);if(a===null)Gi(e,t,n,_s,l),rr(e,n);else if(ex(a,e,t,l,n))n.stopPropagation();else if(rr(e,n),t&4&&-1<Ph.indexOf(e)){for(;a!==null;){var s=jn(a);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var c=ml(s.pendingLanes);if(c!==0){var o=s;for(o.pendingLanes|=2,o.entangledLanes|=2;c;){var u=1<<31-Ge(c);o.entanglements[1]|=u,c&=~u}ht(s),!(Y&6)&&(ks=qe()+500,Ta(0))}}break;case 31:case 13:o=Ml(s,2),o!==null&&De(o,s,2),Ps(),Lo(s,2)}if(s=Gc(n),s===null&&Gi(e,t,n,_s,l),s===a)break;a=s}a!==null&&n.stopPropagation()}else Gi(e,t,n,null,l)}}function Gc(e){return e=Pc(e),Yo(e)}var _s=null;function Yo(e){if(_s=null,e=Ql(e),e!==null){var t=ga(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=wr(t),e!==null)return e;e=null}else if(l===31){if(e=Mr(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return _s=e,null}function f0(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(_0()){case Ur:return 2;case Br:return 8;case ms:case L0:return 32;case Rr:return 268435456;default:return 32}default:return 32}}var Xc=!1,el=null,tl=null,ll=null,xa=new Map,pa=new Map,Yt=[],Ph="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 rr(e,t){switch(e){case"focusin":case"focusout":el=null;break;case"dragenter":case"dragleave":tl=null;break;case"mouseover":case"mouseout":ll=null;break;case"pointerover":case"pointerout":xa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":pa.delete(t.pointerId)}}function On(e,t,l,n,a,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:l,eventSystemFlags:n,nativeEvent:s,targetContainers:[a]},t!==null&&(t=jn(t),t!==null&&r0(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function ex(e,t,l,n,a){switch(t){case"focusin":return el=On(el,e,t,l,n,a),!0;case"dragenter":return tl=On(tl,e,t,l,n,a),!0;case"mouseover":return ll=On(ll,e,t,l,n,a),!0;case"pointerover":var s=a.pointerId;return xa.set(s,On(xa.get(s)||null,e,t,l,n,a)),!0;case"gotpointercapture":return s=a.pointerId,pa.set(s,On(pa.get(s)||null,e,t,l,n,a)),!0}return!1}function d0(e){var t=Ql(e.target);if(t!==null){var l=ga(t);if(l!==null){if(t=l.tag,t===13){if(t=wr(l),t!==null){e.blockedOn=t,Ko(e.priority,function(){ur(l)});return}}else if(t===31){if(t=Mr(l),t!==null){e.blockedOn=t,Ko(e.priority,function(){ur(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function cs(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Gc(e.nativeEvent);if(l===null){l=e.nativeEvent;var n=new l.constructor(l.type,l);cc=n,l.target.dispatchEvent(n),cc=null}else return t=jn(l),t!==null&&r0(t),e.blockedOn=l,!1;t.shift()}return!0}function fr(e,t,l){cs(e)&&l.delete(t)}function tx(){Xc=!1,el!==null&&cs(el)&&(el=null),tl!==null&&cs(tl)&&(tl=null),ll!==null&&cs(ll)&&(ll=null),xa.forEach(fr),pa.forEach(fr)}function Ya(e,t){e.blockedOn===t&&(e.blockedOn=null,Xc||(Xc=!0,xe.unstable_scheduleCallback(xe.unstable_NormalPriority,tx)))}var Ga=null;function dr(e){Ga!==e&&(Ga=e,xe.unstable_scheduleCallback(xe.unstable_NormalPriority,function(){Ga===e&&(Ga=null);for(var t=0;t<e.length;t+=3){var l=e[t],n=e[t+1],a=e[t+2];if(typeof n!="function"){if(Yo(n||l)===null)continue;break}var s=jn(l);s!==null&&(e.splice(t,3),t-=3,Nc(s,{pending:!0,data:a,method:l.method,action:n},n,a))}}))}function vn(e){function t(u){return Ya(u,e)}el!==null&&Ya(el,e),tl!==null&&Ya(tl,e),ll!==null&&Ya(ll,e),xa.forEach(t),pa.forEach(t);for(var l=0;l<Yt.length;l++){var n=Yt[l];n.blockedOn===e&&(n.blockedOn=null)}for(;0<Yt.length&&(l=Yt[0],l.blockedOn===null);)d0(l),l.blockedOn===null&&Yt.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(n=0;n<l.length;n+=3){var a=l[n],s=l[n+1],c=a[Oe]||null;if(typeof s=="function")c||dr(l);else if(c){var o=null;if(s&&s.hasAttribute("formAction")){if(a=s,c=s[Oe]||null)o=c.formAction;else if(Yo(a)!==null)continue}else o=c.action;typeof o=="function"?l[n+1]=o:(l.splice(n,3),n-=3),dr(l)}}}function m0(){function e(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(c){return a=c})},focusReset:"manual",scroll:"manual"})}function t(){a!==null&&(a(),a=null),n||setTimeout(l,20)}function l(){if(!n&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,a=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),a!==null&&(a(),a=null)}}}function Go(e){this._internalRoot=e}li.prototype.render=Go.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(N(409));var l=t.current,n=Xe();u0(l,n,e,t,null,null)};li.prototype.unmount=Go.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;u0(e.current,2,null,e,null,null),Ps(),t[bn]=null}};function li(e){this._internalRoot=e}li.prototype.unstable_scheduleHydration=function(e){if(e){var t=Yr();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Yt.length&&t!==0&&t<Yt[l].priority;l++);Yt.splice(l,0,e),l===0&&d0(e)}};var mr=kr.version;if(mr!=="19.2.5")throw Error(N(527,mr,"19.2.5"));G.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(N(188)):(e=Object.keys(e).join(","),Error(N(268,e)));return e=E0(t),e=e!==null?Er(e):null,e=e===null?null:e.stateNode,e};var lx={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xa=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xa.isDisabled&&Xa.supportsFiber)try{ya=Xa.inject(lx),Ye=Xa}catch{}}qs.createRoot=function(e,t){if(!Ar(e))throw Error(N(299));var l=!1,n="",a=ad,s=sd,c=id;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=c0(e,1,!1,null,null,l,n,null,a,s,c,m0),e[bn]=t.current,Ro(e),new Go(t)};qs.hydrateRoot=function(e,t,l){if(!Ar(e))throw Error(N(299));var n=!1,a="",s=ad,c=sd,o=id,u=null;return l!=null&&(l.unstable_strictMode===!0&&(n=!0),l.identifierPrefix!==void 0&&(a=l.identifierPrefix),l.onUncaughtError!==void 0&&(s=l.onUncaughtError),l.onCaughtError!==void 0&&(c=l.onCaughtError),l.onRecoverableError!==void 0&&(o=l.onRecoverableError),l.formState!==void 0&&(u=l.formState)),t=c0(e,1,!0,t,l??null,n,a,u,s,c,o,m0),t.context=o0(null),l=t.current,n=Xe(),n=$c(n),a=Ft(n),a.callback=null,Wt(l,a,n),l=n,t.current.lanes=l,ba(t,l),ht(t),e[bn]=t.current,Ro(e),new li(t)};qs.version="19.2.5";function h0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h0)}catch(e){console.error(e)}}h0(),zr.exports=qs;var nx=zr.exports;const ae=cl((e,t)=>({sessions:[],activeSessionId:null,setActiveSession:l=>{e({activeSessionId:l})},setSessions:l=>{if(e({sessions:l}),!t().activeSessionId&&l.length>0){const a=l.find(s=>s.status==="active")??l[0];a&&e({activeSessionId:a.id})}},upsertSession:l=>{e(n=>{const a=n.sessions.findIndex(s=>s.id===l.id);if(a>=0){const s=[...n.sessions];return s[a]=l,{sessions:s}}return{sessions:[l,...n.sessions]}}),t().activeSessionId||e({activeSessionId:l.id})},removeSession:l=>{e(n=>{var c;const a=n.sessions.filter(o=>o.id!==l),s=n.activeSessionId===l?((c=a.find(o=>o.status==="active")??a[0])==null?void 0:c.id)??null:n.activeSessionId;return{sessions:a,activeSessionId:s}})},getActiveSession:()=>{const{sessions:l,activeSessionId:n}=t();return l.find(a=>a.id===n)??null}})),ni=cl((e,t)=>({status:"disconnected",ws:null,lastHeartbeat:null,collectorUrl:"ws://localhost:4700/ws",connect:l=>{const n=t().ws;n&&n.close(),e({status:"connecting",collectorUrl:l});const a=new WebSocket(l);a.onopen=()=>{e({status:"connected",ws:a,lastHeartbeat:Date.now()})},a.onclose=()=>{e({status:"disconnected",ws:null})},a.onerror=()=>{e({status:"error",ws:null})},e({ws:a})},disconnect:()=>{const l=t().ws;l&&l.close(),e({status:"disconnected",ws:null})},send:l=>{const n=t().ws;n&&n.readyState===WebSocket.OPEN&&n.send(JSON.stringify(l))},setStatus:l=>e({status:l}),setLastHeartbeat:l=>e({lastHeartbeat:l})}));function ax(e,t){let l;try{l=e()}catch{return}return{getItem:a=>{var s;const c=u=>u===null?null:JSON.parse(u,void 0),o=(s=l.getItem(a))!=null?s:null;return o instanceof Promise?o.then(c):c(o)},setItem:(a,s)=>l.setItem(a,JSON.stringify(s,void 0)),removeItem:a=>l.removeItem(a)}}const Qc=e=>t=>{try{const l=e(t);return l instanceof Promise?l:{then(n){return Qc(n)(l)},catch(n){return this}}}catch(l){return{then(n){return this},catch(n){return Qc(n)(l)}}}},sx=(e,t)=>(l,n,a)=>{let s={storage:ax(()=>window.localStorage),partialize:v=>v,version:0,merge:(v,r)=>({...r,...v}),...t},c=!1,o=0;const u=new Set,f=new Set;let h=s.storage;if(!h)return e((...v)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),l(...v)},n,a);const p=()=>{const v=s.partialize({...n()});return h.setItem(s.name,{state:v,version:s.version})},m=a.setState;a.setState=(v,r)=>(m(v,r),p());const y=e((...v)=>(l(...v),p()),n,a);a.getInitialState=()=>y;let g;const j=()=>{var v,r;if(!h)return;const d=++o;c=!1,u.forEach(b=>{var S;return b((S=n())!=null?S:y)});const x=((r=s.onRehydrateStorage)==null?void 0:r.call(s,(v=n())!=null?v:y))||void 0;return Qc(h.getItem.bind(h))(s.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==s.version){if(s.migrate){const S=s.migrate(b.state,b.version);return S instanceof Promise?S.then(k=>[!0,k]):[!0,S]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var S;if(d!==o)return;const[k,z]=b;if(g=s.merge(z,(S=n())!=null?S:y),l(g,!0),k)return p()}).then(()=>{d===o&&(x==null||x(n(),void 0),g=n(),c=!0,f.forEach(b=>b(g)))}).catch(b=>{d===o&&(x==null||x(void 0,b))})};return a.persist={setOptions:v=>{s={...s,...v},v.storage&&(h=v.storage)},clearStorage:()=>{h==null||h.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>j(),hasHydrated:()=>c,onHydrate:v=>(u.add(v),()=>{u.delete(v)}),onFinishHydration:v=>(f.add(v),()=>{f.delete(v)})},s.skipHydration||j(),g||y},ix=sx,ai=cl()(ix(e=>({themeId:"neon",setTheme:t=>e({themeId:t})}),{name:"prism-theme"})),x0={neon:{id:"neon",label:"Neon",bg:"#09090B",headerBg:"rgba(9,9,11,0.95)",toolbarBg:"rgba(9,9,11,0.8)",sidebarBg:"rgba(9,9,11,0.95)",running:"#00FF88",success:"#00FF88",error:"#FF3366",info:"#00BBFF",warn:"#FFAA00",purple:"#BB88FF",chartColors:["#00FF88","#00BBFF","#FFAA00","#FF3366","#BB88FF","#FF8844","#44FFBB"]},claude:{id:"claude",label:"Claude",bg:"#1C1B19",headerBg:"rgba(24,23,19,0.95)",toolbarBg:"rgba(24,23,19,0.8)",sidebarBg:"rgba(22,21,17,0.95)",running:"#CC785C",success:"#7FB069",error:"#C0392B",info:"#5B8DB8",warn:"#E8A838",purple:"#9B7FC4",chartColors:["#CC785C","#5B8DB8","#E8A838","#C0392B","#9B7FC4","#D4956A","#7FB069"]}};function O(){const e=ai(t=>t.themeId);return x0[e]}function cx({status:e,url:t="localhost:4700"}){const l=O(),a={connected:{label:"Connected",color:l.success,glow:!0},connecting:{label:"Connecting…",color:l.warn,pulse:!0},disconnected:{label:"Disconnected",color:"#52525b"},error:{label:"Error",color:l.error,glow:!0}}[e];return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:a.pulse?"h-2 w-2 rounded-full flex-shrink-0 animate-pulse":"h-2 w-2 rounded-full flex-shrink-0",style:{background:a.color,boxShadow:a.glow?`0 0 6px ${a.color}`:"none"}}),i.jsxs("div",{className:"flex flex-col leading-none",children:[i.jsx("span",{className:"text-[11px] font-mono font-medium",style:{color:a.color},children:a.label}),i.jsx("span",{className:"text-[10px] font-mono text-zinc-300",children:t})]})]})}function ox(){return i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:i.jsx("path",{d:"M2 3h8M5 3V2h2v1M4 3v6.5a.5.5 0 00.5.5h3a.5.5 0 00.5-.5V3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ux({open:e}){return i.jsx("svg",{width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",className:me("transition-transform duration-150",e?"rotate-180":""),children:i.jsx("path",{d:"M1 1L5 5L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function rx(){const{sessions:e,activeSessionId:t,setActiveSession:l,removeSession:n}=ae(),{status:a,collectorUrl:s}=ni(),{themeId:c,setTheme:o}=ai(),u=O(),[f,h]=C.useState(!1),[p,m]=C.useState(null),y=C.useRef(null);C.useEffect(()=>{if(!f)return;function v(r){var d;(d=y.current)!=null&&d.contains(r.target)||h(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[f]),C.useEffect(()=>{if(!f)return;function v(r){r.key==="Escape"&&h(!1)}return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[f]);const g=e.find(v=>v.id===t);async function j(v,r){r.stopPropagation();const d=e.find(S=>S.id===v),x=d?`${d.name} — ${ct(new Date(d.startedAt),"MMM d, HH:mm:ss")}`:v;if(!confirm(`Delete session "${x}"? This cannot be undone.`))return;const b=s.replace(/^ws/,"http").replace(/\/ws$/,"");m(v);try{const S=await fetch(`${b}/api/sessions/${v}`,{method:"DELETE"});if(!S.ok)throw new Error(`HTTP ${S.status}`);n(v)}catch(S){alert(`Failed to delete: ${S instanceof Error?S.message:String(S)}`)}finally{m(null)}}return i.jsxs("header",{className:"flex h-14 flex-shrink-0 items-center justify-between border-b px-5",style:{borderColor:"rgba(255,255,255,0.08)",background:u.headerBg,backdropFilter:"blur(12px)"},children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-md text-xs font-bold",style:{background:`${u.running}1E`,border:`1px solid ${u.running}4D`},children:i.jsx("span",{style:{color:u.running,fontFamily:"JetBrains Mono, monospace"},children:"P"})}),i.jsxs("div",{className:"leading-none",children:[i.jsx("span",{className:"text-sm font-bold tracking-tight",style:{color:u.running,fontFamily:"JetBrains Mono, monospace"},children:"PRISM"}),i.jsx("p",{className:"text-[10px] text-zinc-300 font-mono",children:"agentic visibility"})]})]}),i.jsx("div",{className:"flex-1 max-w-sm mx-6",ref:y,children:e.length===0?i.jsx("p",{className:"text-xs font-mono text-zinc-300 text-center",children:"No sessions yet"}):i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>h(v=>!v),className:"flex w-full items-center gap-2 rounded border px-3 py-1.5 text-xs font-mono text-zinc-300 transition-colors hover:bg-white/[0.03]",style:{borderColor:f?"rgba(255,255,255,0.18)":"rgba(255,255,255,0.10)",background:"rgba(24,24,27,0.8)"},children:[g?i.jsxs("span",{className:"flex-1 flex items-center gap-1.5 min-w-0 truncate",children:[i.jsx("span",{className:"truncate",children:g.name}),g.totalCostUsd>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-zinc-700 shrink-0",children:"•"}),i.jsxs("span",{className:"shrink-0",style:{color:u.running},children:["$",g.totalCostUsd.toFixed(4)]})]}),i.jsx("span",{className:"text-zinc-700 shrink-0",children:"•"}),i.jsx("span",{className:"shrink-0 text-[9px] px-1 py-0.5 rounded",style:g.status==="active"?{background:`${u.running}1A`,color:u.running,border:`1px solid ${u.running}33`}:{background:"rgba(255,255,255,0.04)",color:"#71717a",border:"1px solid rgba(255,255,255,0.08)"},children:g.status==="active"?"live":"ended"})]}):i.jsx("span",{className:"flex-1 text-left text-zinc-600",children:"Select session"}),i.jsx("span",{className:"text-zinc-500 flex-shrink-0",children:i.jsx(ux,{open:f})})]}),f&&i.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 rounded-lg border overflow-hidden z-50",style:{background:"rgba(15,15,18,0.98)",borderColor:"rgba(255,255,255,0.12)",backdropFilter:"blur(16px)",boxShadow:"0 8px 32px rgba(0,0,0,0.6)"},children:i.jsx("div",{className:"max-h-64 overflow-y-auto",children:e.map(v=>{const r=v.id===t,d=p===v.id;return i.jsxs("div",{className:"group flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors hover:bg-white/[0.04]",style:{background:r?"rgba(255,255,255,0.04)":"transparent",borderBottom:"1px solid rgba(255,255,255,0.05)"},onClick:()=>{l(v.id),h(!1)},children:[i.jsx("div",{className:"h-1.5 w-1.5 rounded-full flex-shrink-0",style:{background:r?u.running:"transparent",border:r?"none":"1px solid rgba(255,255,255,0.15)"}}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs text-zinc-300 truncate",children:[i.jsx("span",{className:"truncate",children:v.name}),v.totalCostUsd>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-zinc-700 shrink-0",children:"•"}),i.jsxs("span",{className:"shrink-0",style:{color:u.running},children:["$",v.totalCostUsd.toFixed(4)]})]}),i.jsx("span",{className:"text-zinc-700 shrink-0",children:"•"}),i.jsx("span",{className:"shrink-0 text-[9px] px-1 py-0.5 rounded",style:v.status==="active"?{background:`${u.running}1A`,color:u.running,border:`1px solid ${u.running}33`}:{background:"rgba(255,255,255,0.04)",color:"#71717a",border:"1px solid rgba(255,255,255,0.08)"},children:v.status==="active"?"live":"ended"})]}),i.jsx("p",{className:"font-mono text-[10px] text-zinc-600 mt-0.5",children:ct(new Date(v.startedAt),"MMM d, HH:mm:ss")})]}),i.jsx("button",{onClick:x=>j(v.id,x),disabled:d,title:"Delete session",className:"flex-shrink-0 flex h-6 w-6 items-center justify-center rounded transition-colors disabled:opacity-40",style:{color:d?`${u.error}66`:u.error,background:`${u.error}14`,border:`1px solid ${u.error}33`},children:d?i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",className:"animate-spin",children:i.jsx("circle",{cx:"6",cy:"6",r:"4.5",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"14 8"})}):i.jsx(ox,{})})]},v.id)})})})]})}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"flex items-center gap-0.5 rounded-md border p-0.5",style:{borderColor:"rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.04)"},children:["neon","claude"].map(v=>i.jsx("button",{onClick:()=>o(v),className:me("rounded px-2.5 py-1 text-[10px] font-mono transition-colors capitalize",c===v?"bg-white/10 text-zinc-300":"text-zinc-400 hover:text-zinc-300"),children:v},v))}),i.jsx(cx,{status:a})]})]})}function p0({content:e,children:t,side:l="top",className:n}){const[a,s]=C.useState(!1),c=C.useRef(null),o=()=>{c.current=setTimeout(()=>s(!0),300)},u=()=>{c.current&&clearTimeout(c.current),s(!1)},f={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};return i.jsxs("div",{className:"relative inline-flex",onMouseEnter:o,onMouseLeave:u,children:[t,a&&i.jsx("div",{className:me("pointer-events-none absolute z-50 whitespace-nowrap rounded border border-white/[0.12]","bg-zinc-800 px-2 py-1 text-xs text-zinc-300 shadow-xl animate-fade-in",f[l],n),children:e})]})}function fx(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}function dx(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"5",r:"2"}),i.jsx("circle",{cx:"5",cy:"19",r:"2"}),i.jsx("circle",{cx:"19",cy:"19",r:"2"}),i.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"13"}),i.jsx("line",{x1:"12",y1:"13",x2:"5",y2:"17"}),i.jsx("line",{x1:"12",y1:"13",x2:"19",y2:"17"})]})}function mx(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),i.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]})}function hx(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.44-3.54z"}),i.jsx("path",{d:"M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.44-3.54z"})]})}function xx(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polyline",{points:"1 4 1 10 7 10"}),i.jsx("path",{d:"M3.51 15a9 9 0 1 0 .49-4"})]})}function px(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})})}function gx(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),i.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),i.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function yx(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"18",cy:"18",r:"3"}),i.jsx("circle",{cx:"6",cy:"6",r:"3"}),i.jsx("path",{d:"M13 6h3a2 2 0 0 1 2 2v7"}),i.jsx("line",{x1:"6",y1:"9",x2:"6",y2:"21"})]})}const vx=[{id:"events",label:"Event Stream",icon:i.jsx(fx,{})},{id:"cost",label:"Cost Analytics",icon:i.jsx(mx,{})},{id:"intelligence",label:"Session Intelligence",icon:i.jsx(hx,{})},{id:"tools",label:"Tool Inspector",icon:i.jsx(px,{})},{id:"context",label:"Context Window",icon:i.jsx(gx,{})},{id:"agents",label:"Agent Tree",icon:i.jsx(dx,{})},{id:"git",label:"Git",icon:i.jsx(yx,{})},{id:"history",label:"Session History",icon:i.jsx(xx,{})}];function bx({activePanel:e,onPanelChange:t}){const l=O(),n=vx;return i.jsx("aside",{className:"flex w-14 flex-shrink-0 flex-col items-center border-r py-3 gap-1",style:{borderColor:"rgba(255,255,255,0.08)",background:l.sidebarBg},children:n.map(a=>{const s=e===a.id;return i.jsx(p0,{content:a.label,side:"right",children:i.jsx("button",{onClick:()=>t(a.id),className:me("flex h-10 w-10 items-center justify-center rounded-lg transition-all duration-150",!s&&"text-zinc-300 hover:bg-white/5 hover:text-zinc-400"),style:s?{background:`${l.running}1A`,color:l.running,border:`1px solid ${l.running}33`}:{border:"1px solid transparent"},"aria-label":a.label,children:a.icon})},a.id)})})}const Qa=1e3,at=cl((e,t)=>({events:[],totalReceived:0,addEvent:l=>{e(n=>{const a=[l,...n.events];return{events:a.length>Qa?a.slice(0,Qa):a,totalReceived:n.totalReceived+1}})},addEvents:l=>{e(n=>{const a=new Map(n.events.map(c=>[c.id,c]));for(const c of l)a.set(c.id,c);const s=Array.from(a.values()).sort((c,o)=>o.timestamp-c.timestamp);return{events:s.length>Qa?s.slice(0,Qa):s,totalReceived:n.totalReceived+l.length}})},clearEvents:()=>{e({events:[],totalReceived:0})},getEventsByType:l=>t().events.filter(n=>n.type===l),getEventsBySession:l=>t().events.filter(n=>n.sessionId===l),getEventsByAgent:l=>t().events.filter(n=>n.payload.agentId===l)}));function jx(e,t){switch(e){case"green":return t.success;case"red":return t.error;case"blue":return t.info;case"yellow":return t.warn;case"purple":return t.purple;default:return null}}function Dl({children:e,variant:t="default",size:l="xs",className:n}){const a=ai(o=>o.themeId),s=x0[a],c=jx(t,s);return i.jsx("span",{className:me("inline-flex items-center rounded border font-mono font-medium uppercase tracking-wider",l==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-1 text-xs",!c&&(t==="gray"?"bg-white/5 text-zinc-400 border-white/10":"bg-white/5 text-zinc-300 border-white/10"),n),style:c?{background:`${c}1A`,color:c,borderColor:`${c}33`}:void 0,children:e})}function Ve({icon:e,title:t,description:l,action:n}){return i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[e&&i.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl border border-white/[0.08] bg-white/[0.03] text-zinc-300",children:e}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium text-zinc-400",children:t}),l&&i.jsx("p",{className:"mt-1 text-xs text-zinc-300",children:l})]}),n&&i.jsx("div",{className:"mt-2",children:n})]})}const Zi=[{id:"all",label:"All",match:e=>!0},{id:"tool",label:"Tools",match:e=>e.startsWith("tool.")},{id:"api",label:"API",match:e=>e.startsWith("api.")},{id:"agent",label:"Agents",match:e=>e.startsWith("agent.")},{id:"user",label:"Prompts",match:e=>e==="user.prompt"},{id:"cost",label:"Cost",match:e=>e==="cost.update"},{id:"session",label:"Session",match:e=>e.startsWith("session.")},{id:"mcp",label:"MCP",match:e=>e.startsWith("mcp.")}];function g0(e){if(e.type==="cost.update"){const t=e.payload;return{tokens:(t.inputTokens??0)+(t.outputTokens??0),costUsd:t.totalCostUsd??0}}if(e.type==="api.response"){const t=e.payload,l=t.usage;if(!l)return null;const n=(l.inputTokens??l.input_tokens??0)+(l.outputTokens??l.output_tokens??0);return n===0?null:{tokens:n,costUsd:t.costUsd??0}}return null}function y0(e){return e.startsWith("api.")?"blue":e.startsWith("agent.")?"green":e.startsWith("tool.")?"yellow":e.startsWith("mcp.")?"purple":e.includes("error")||e.includes("fail")||e==="loop.detected"?"red":e.startsWith("session.")?"gray":"default"}function Sx(e){var l,n,a;const t=e.payload;switch(e.type){case"tool.call":{const s=t.toolName??"",c=t.input,o=t.status;let u="";if(c){const f=((l=c.command)==null?void 0:l.split(`
|
|
34
|
-
`)[0])??"",h=c.file_path??c.path??"";u=(f||h||c.pattern||"").slice(0,60)}return`${s}${o?` [${o}]`:""}${u?` ${u}`:""}`}case"user.prompt":return((n=t.text)==null?void 0:n.slice(0,80))??"";case"cost.update":{const s=t;return`$${(s.totalCostUsd??0).toFixed(6)} ${((s.inputTokens??0)+(s.outputTokens??0)).toLocaleString()} tokens ${s.model??""}`}case"agent.spawn":return`${t.name??""} (${String(t.agentId??"").slice(0,8)})`;case"agent.state_change":return`${t.previousState??"?"} → ${t.nextState??"?"}${t.reason?` (${t.reason})`:""}`;case"agent.log":return`[${t.level??"info"}] ${((a=t.message)==null?void 0:a.slice(0,80))??""}`;case"session.summary":{const s=t.turnCount??0,c=t.totalCostUsd??0,o=t.cacheHitRate??0;return`${s} turns $${c.toFixed(4)} ${o}% cache`}case"mcp.tool.call":return`${t.serverName??""} / ${t.toolName??""}`;default:{const s=[];for(const c of Object.keys(t).slice(0,3)){const o=t[c];o!=null&&(typeof o=="string"?s.push(`${c}: "${o.length>24?o.slice(0,24)+"…":o}"`):typeof o=="number"||typeof o=="boolean"?s.push(`${c}: ${String(o)}`):Array.isArray(o)?s.push(`${c}: [${o.length}]`):s.push(`${c}: {…}`))}return s.join(" ")}}}function
|
|
35
|
-
`)});break}default:for(const[f,h]of Object.entries(s))h!=null&&u.push({label:f,value:typeof h=="string"?h:JSON.stringify(h)})}return i.jsxs("div",{className:"flex flex-col border-l overflow-hidden",style:{width:320,flexShrink:0,borderColor:"rgba(255,255,255,0.08)",background:"rgba(0,0,0,0.4)"},children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2 border-b",style:{borderColor:"rgba(255,255,255,0.06)"},children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx(Dl,{variant:c,className:"text-[10px] shrink-0",children:e.type}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600 truncate",children:ct(new Date(e.timestamp),"HH:mm:ss.SSS")})]}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[i.jsx("button",{onClick:()=>a(f=>!f),className:"font-mono text-[9px] px-1.5 py-0.5 rounded",style:n?{background:`${l.info}22`,color:l.info,border:`1px solid ${l.info}44`}:{color:"#52525b",border:"1px solid rgba(255,255,255,0.06)"},children:n?"Fields":"Raw"}),i.jsx("button",{onClick:t,className:"ml-1 text-zinc-600 hover:text-zinc-400 text-sm leading-none px-1",children:"✕"})]})]}),i.jsxs("div",{className:"flex shrink-0 gap-3 px-3 py-1.5 border-b",style:{borderColor:"rgba(255,255,255,0.04)"},children:[i.jsxs("span",{className:"font-mono text-[10px] text-zinc-600",children:["src: ",i.jsx("span",{className:"text-zinc-400",children:e.source})]}),o&&i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"font-mono text-[10px]",style:{color:l.info},children:[o.tokens.toLocaleString(),"t"]}),o.costUsd>0&&i.jsxs("span",{className:"font-mono text-[10px]",style:{color:l.running},children:["$",o.costUsd.toFixed(6)]})]}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-700 truncate",children:e.id.slice(0,16)})]}),i.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:n?i.jsx("pre",{className:"font-mono text-[10px] text-zinc-300 whitespace-pre-wrap break-all",children:JSON.stringify(e.payload,null,2)}):i.jsxs("div",{className:"space-y-3",children:[u.map((f,h)=>i.jsx(Nx,{label:f.label,value:f.value,color:f.color},h)),u.length===0&&i.jsx("span",{className:"text-[11px] text-zinc-600 font-mono",children:"No fields"})]})})]})}function hr(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),l=Math.floor(e%6e4/1e3);return l>0?`${t}m ${l}s`:`${t}m`}function Cx({event:e,isSelected:t,onSelect:l}){const n=y0(e.type),a=Sx(e),s=O(),c=g0(e),o=e.type==="tool.call"?e.payload.status:void 0,u=o==="error"?s.error:o==="complete"?s.running:o==="pending"?s.warn:null;return i.jsx("div",{className:me("border-b cursor-pointer transition-colors duration-100",t?"bg-white/[0.04]":"hover:bg-white/[0.02]"),style:{borderColor:"rgba(255,255,255,0.04)"},onClick:l,children:i.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",children:[i.jsx("span",{className:"w-24 flex-shrink-0 font-mono text-[10px] text-zinc-500",children:ct(new Date(e.timestamp),"HH:mm:ss.SSS")}),i.jsx(Dl,{variant:n,className:"w-44 flex-shrink-0 truncate justify-center text-[10px]",children:e.type}),i.jsx("span",{className:"w-14 flex-shrink-0 font-mono text-[10px] text-zinc-600 truncate",children:e.source}),i.jsx("span",{className:"flex-1 truncate font-mono text-[11px] text-zinc-400",children:a}),o?i.jsx("span",{className:"w-16 flex-shrink-0 text-right font-mono text-[9px] px-1.5 py-0.5 rounded",style:{color:u??"#52525b",background:u?`${u}1A`:"transparent"},children:o}):i.jsx("span",{className:"w-16 flex-shrink-0 text-right font-mono text-[11px]",style:{color:c?s.info:"#3f3f46"},children:c?c.tokens.toLocaleString():"—"}),i.jsx("span",{className:"w-24 flex-shrink-0 text-right font-mono text-[11px]",style:{color:((c==null?void 0:c.costUsd)??0)>0?s.running:"#3f3f46"},children:((c==null?void 0:c.costUsd)??0)>0?`$${c.costUsd.toFixed(6)}`:"—"}),i.jsx("div",{className:"w-1 h-4 rounded-full flex-shrink-0",style:{background:t?s.info:"transparent"}})]})})}function Tx(){const{events:e}=at(),{activeSessionId:t}=ae(),l=O(),[n,a]=C.useState("all"),[s,c]=C.useState(""),[o,u]=C.useState(null),[f,h]=C.useState(!1),[p,m]=C.useState("stream"),y=C.useRef(null),g=C.useRef(e.length);C.useEffect(()=>{var x;f||e.length!==g.current&&(g.current=e.length,(x=y.current)==null||x.scrollTo({top:0}))},[e.length,f]);const j=C.useCallback(x=>{p==="stream"?(m("inspect"),u(x),h(!0)):(u(b=>(b==null?void 0:b.id)===x.id?null:x),h(!0))},[p]),v=C.useCallback(()=>{m("stream"),u(null),h(!1)},[]),r=Zi.find(x=>x.id===n)??Zi[0],d=e.filter(x=>{if(t&&x.sessionId!==t||!r.match(x.type))return!1;if(s){const b=s.toLowerCase();if(!x.type.includes(b)&&!JSON.stringify(x.payload).toLowerCase().includes(b))return!1}return!0});return i.jsxs("div",{className:"flex h-full overflow-hidden",children:[i.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2 border-b px-4 py-2 flex-wrap",style:{borderColor:"rgba(255,255,255,0.07)",background:l.toolbarBg},children:[i.jsx("div",{className:"flex items-center gap-0.5 rounded border p-0.5 mr-1",style:{borderColor:"rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.03)"},children:["stream","inspect"].map(x=>i.jsx("button",{onClick:()=>x==="stream"?v():m("inspect"),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors capitalize",style:p===x?{background:"rgba(255,255,255,0.10)",color:"#d4d4d8"}:{color:"#52525b"},children:x==="stream"?"⏵ Stream":"⊞ Inspect"},x))}),i.jsx("div",{className:"h-4 w-px",style:{background:"rgba(255,255,255,0.08)"}}),Zi.map(x=>i.jsx("button",{onClick:()=>a(x.id),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors",style:n===x.id?{background:`${l.info}22`,color:l.info,border:`1px solid ${l.info}44`}:{color:"#71717a",border:"1px solid transparent"},children:x.label},x.id)),i.jsx("div",{className:"h-4 w-px mx-1",style:{background:"rgba(255,255,255,0.08)"}}),i.jsx("input",{type:"text",placeholder:"search…",value:s,onChange:x=>c(x.target.value),className:"h-6 rounded border bg-transparent px-2 text-[11px] font-mono text-zinc-300 placeholder-zinc-700 outline-none focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.08)",width:130}}),s&&i.jsx("button",{onClick:()=>c(""),className:"font-mono text-[10px] text-zinc-600 hover:text-zinc-400",children:"✕"}),i.jsx("div",{className:"flex-1"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:d.length}),i.jsx("button",{onClick:()=>{h(x=>!x),f&&u(null)},className:"h-6 rounded border px-2 text-[10px] font-mono transition-colors",style:f?{borderColor:`${l.warn}44`,background:`${l.warn}1A`,color:l.warn}:{borderColor:"rgba(255,255,255,0.08)",color:"#71717a"},children:f?"▶ Resume":"⏸ Pause"})]}),i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-1",style:{borderColor:"rgba(255,255,255,0.04)",background:"rgba(0,0,0,0.25)"},children:[i.jsx("span",{className:"w-24 flex-shrink-0 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Time"}),i.jsx("span",{className:"w-44 flex-shrink-0 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Type"}),i.jsx("span",{className:"w-14 flex-shrink-0 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Src"}),i.jsx("span",{className:"flex-1 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Payload"}),i.jsx("span",{className:"w-20 flex-shrink-0 text-right text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Tokens"}),i.jsx("span",{className:"w-24 flex-shrink-0 text-right text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Cost"}),i.jsx("div",{className:"w-1"})]}),i.jsx("div",{ref:y,className:"flex-1 overflow-y-auto",onMouseEnter:()=>{!o&&p==="stream"&&h(!0)},onMouseLeave:()=>{!o&&p==="stream"&&h(!1)},children:d.length===0?i.jsx(Ve,{icon:i.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),title:"No events",description:n==="all"?"Events will appear here as your agents run":`No ${n} events in this session`}):d.map(x=>i.jsx(Cx,{event:x,isSelected:(o==null?void 0:o.id)===x.id,onSelect:()=>j(x)},x.id))})]}),p==="inspect"&&o&&i.jsx(zx,{event:o,onClose:()=>{u(null),h(!1)}})]})}function kx(e){const t=[],l=new Map;for(const[a,s]of e.entries())l.set(a,{...s,children:[]});for(const a of l.values())if(a.parentId===null)t.push(a);else{const s=l.get(a.parentId);s?s.children.push(a):t.push(a)}const n=a=>{a.sort((s,c)=>s.spawnedAt-c.spawnedAt);for(const s of a)n(s.children)};return n(t),t}const be=cl((e,t)=>({agents:new Map,loopAlerts:[],upsertAgent:l=>{e(n=>{const a=new Map(n.agents),s=a.get(l.id);return s?a.set(l.id,{...s,...l,children:[]}):a.set(l.id,{...l,children:[]}),{agents:a}})},updateAgentStatus:(l,n,a)=>{e(s=>{const c=new Map(s.agents),o=c.get(l);return o?(c.set(l,{...o,status:n,...a!==void 0?{completedAt:a}:{}}),{agents:c}):{}})},incrementToolCallCount:l=>{e(n=>{const a=new Map(n.agents),s=a.get(l);return s?(a.set(l,{...s,toolCallCount:s.toolCallCount+1}),{agents:a}):{}})},addAgentLog:(l,n)=>{e(a=>{const s=new Map(a.agents),c=s.get(l);return c?(s.set(l,{...c,logs:[...c.logs,n]}),{agents:s}):{}})},addLoopAlert:l=>{e(n=>({loopAlerts:[l,...n.loopAlerts].slice(0,50)}))},dismissLoopAlert:l=>{e(n=>({loopAlerts:n.loopAlerts.filter(a=>a.id!==l)}))},getAgentTree:()=>kx(t().agents),getAgent:l=>t().agents.get(l)}));function Ax(e,t){switch(e){case"running":return t.running;case"waiting":return t.warn;case"failed":return t.error;case"completed":return"#52525b";default:return"#52525b"}}function wx(e){switch(e){case"running":return"green";case"waiting":return"yellow";case"failed":return"red";case"completed":return"gray";default:return"gray"}}function Mx(e,t){const l=t??Date.now();return jr(new Date(e),new Date(l),{addSuffix:!1})}function v0({agent:e,depth:t,isExpanded:l,isSelected:n,onToggle:a,onSelect:s}){const c=O(),o=e.children.length>0,u=e.logs.length>0,f=Ax(e.status,c);return i.jsxs("div",{children:[i.jsxs("div",{className:me("group flex items-center gap-2 px-4 py-2.5 cursor-pointer transition-colors duration-100","border-b hover:bg-white/[0.02]",n?"bg-white/[0.03]":""),style:{paddingLeft:`${16+t*20}px`,borderColor:"rgba(255,255,255,0.05)"},onClick:()=>s(e.id),children:[o?i.jsx("button",{className:"flex-shrink-0 text-zinc-300 hover:text-zinc-400 w-4",onClick:h=>{h.stopPropagation(),a(e.id)},children:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:me("transition-transform",l?"rotate-90":""),children:i.jsx("polyline",{points:"9 18 15 12 9 6"})})}):i.jsx("span",{className:"w-4 flex-shrink-0"}),i.jsx("div",{className:"h-2 w-2 flex-shrink-0 rounded-full",style:{background:f,boxShadow:e.status==="running"?`0 0 6px ${f}`:"none"}}),i.jsx("span",{className:"flex-1 font-mono text-sm font-medium truncate",style:{color:e.status==="running"?c.running:"#a1a1aa"},children:e.name}),i.jsx(Dl,{variant:wx(e.status),size:"xs",children:e.status}),i.jsx("span",{className:"w-20 text-right font-mono text-[11px] text-zinc-300",children:Mx(e.spawnedAt,e.completedAt)}),i.jsxs("span",{className:"w-14 text-right font-mono text-[11px] text-zinc-300",children:[e.toolCallCount," calls"]}),u&&i.jsxs("span",{className:"text-[10px] font-mono text-zinc-700 ml-1",children:[e.logs.length," logs"]})]}),n&&e.logs.length>0&&i.jsxs("div",{className:"border-b px-4 py-3",style:{paddingLeft:`${16+t*20+24}px`,borderColor:"rgba(255,255,255,0.05)",background:"rgba(0,0,0,0.3)"},children:[i.jsx("p",{className:"mb-2 text-[10px] font-mono uppercase tracking-widest text-zinc-700",children:"Reasoning Trace"}),i.jsx("div",{className:"space-y-1.5",children:e.logs.map((h,p)=>i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"flex-shrink-0 font-mono text-[10px] text-zinc-700 mt-0.5 w-20",children:new Date(h.timestamp).toLocaleTimeString("en",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}),i.jsx("span",{className:"font-mono text-[11px]",style:{color:h.level==="info"?c.success:h.level==="warn"?c.warn:h.level==="error"?c.error:"#71717a"},children:h.message})]},p))})]}),o&&l&&i.jsx("div",{children:e.children.map(h=>i.jsx(Ex,{agent:h,depth:t+1,isSelected:n,onToggle:a,onSelect:s},h.id))})]})}function Ex({agent:e,depth:t,isSelected:l,onToggle:n,onSelect:a}){return i.jsx(v0,{agent:e,depth:t,isExpanded:!0,isSelected:l,onToggle:n,onSelect:a})}function Dx({alert:e,onDismiss:t}){const l=O();return i.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 text-sm border-b",style:{background:`${l.error}14`,borderColor:`${l.error}33`},children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:l.error,strokeWidth:"2",children:[i.jsx("path",{d:"M10.29 3.86L1.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"}),i.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),i.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),i.jsxs("span",{style:{color:l.error},className:"font-mono text-xs font-medium flex-1",children:["Loop detected — ",i.jsx("span",{className:"font-bold",children:e.agentName})," called"," ",i.jsx("span",{className:"font-bold",children:e.toolName})," ",e.loopCount,"× in a tight window"]}),i.jsx("button",{onClick:()=>t(e.id),className:"font-mono text-[11px] transition-colors",style:{color:`${l.error}99`},onMouseEnter:n=>n.currentTarget.style.color=l.error,onMouseLeave:n=>n.currentTarget.style.color=`${l.error}99`,children:"Dismiss"})]})}function Ox(){const{loopAlerts:e,dismissLoopAlert:t}=be(),l=be(j=>j.getAgentTree),{activeSessionId:n}=ae(),a=O(),[s,c]=C.useState(new Set),[o,u]=C.useState(null),f=l(),h=n?f.filter(j=>j.sessionId===n):f,p=n?e.filter(j=>{const v=be.getState().getAgent(j.agentId);return(v==null?void 0:v.sessionId)===n}):e,m=C.useCallback(j=>{c(v=>{const r=new Set(v);return r.has(j)?r.delete(j):r.add(j),r})},[]),y=C.useCallback(j=>{u(v=>v===j?null:j)},[]),g=Array.from(be.getState().agents.values()).filter(j=>j.status==="running").length;return i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.08)",background:a.toolbarBg},children:[i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"Agent Tree"}),g>0&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"h-1.5 w-1.5 rounded-full animate-pulse-slow",style:{background:a.running,boxShadow:`0 0 4px ${a.running}`}}),i.jsxs("span",{className:"font-mono text-[11px]",style:{color:a.running},children:[g," running"]})]}),i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[h.length," agents"]})]}),p.map(j=>i.jsx(Dx,{alert:j,onDismiss:t},j.id)),i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2 border-b px-4 py-1.5",style:{borderColor:"rgba(255,255,255,0.05)",background:"rgba(0,0,0,0.3)"},children:[i.jsx("span",{className:"flex-1 text-[10px] font-mono uppercase tracking-widest text-zinc-700",children:"Agent"}),i.jsx("span",{className:"w-20 text-right text-[10px] font-mono uppercase tracking-widest text-zinc-700",children:"Status"}),i.jsx("span",{className:"w-20 text-right text-[10px] font-mono uppercase tracking-widest text-zinc-700",children:"Duration"}),i.jsx("span",{className:"w-14 text-right text-[10px] font-mono uppercase tracking-widest text-zinc-700",children:"Calls"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:h.length===0?i.jsx(Ve,{icon:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("circle",{cx:"12",cy:"5",r:"2"}),i.jsx("circle",{cx:"5",cy:"19",r:"2"}),i.jsx("circle",{cx:"19",cy:"19",r:"2"}),i.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"13"}),i.jsx("line",{x1:"12",y1:"13",x2:"5",y2:"17"}),i.jsx("line",{x1:"12",y1:"13",x2:"19",y2:"17"})]}),title:"No agents yet",description:"Agent hierarchy will appear as your workflows run"}):h.map(j=>i.jsx(v0,{agent:j,depth:0,isExpanded:s.has(j.id),isSelected:o===j.id,onToggle:m,onSelect:y},j.id))})]})}const si=cl((e,t)=>({summaries:new Map,setSummary:(l,n)=>{e(a=>{const s=new Map(a.summaries);return s.set(l,n),{summaries:s}})},getSummary:l=>t().summaries.get(l)}));function ke({children:e,className:t,glass:l=!1,padding:n="md"}){const a={none:"",sm:"p-3",md:"p-4",lg:"p-6"};return i.jsx("div",{className:me("rounded-lg border","border-white/[0.08]",l?"bg-white/[0.03] backdrop-blur-sm":"bg-zinc-900/80",a[n],t),children:e})}function et({title:e,subtitle:t,actions:l,className:n}){return i.jsxs("div",{className:me("flex items-center justify-between",n),children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-xs font-mono uppercase tracking-widest text-zinc-500",children:e}),t&&i.jsx("p",{className:"mt-0.5 text-xs text-zinc-300",children:t})]}),l&&i.jsx("div",{className:"flex items-center gap-2",children:l})]})}function Ux(e){if(e.type==="cost.update"){const t=e.payload;return{agentId:t.agentId??"unknown",model:t.model??"unknown",inputTokens:t.inputTokens??0,outputTokens:t.outputTokens??0,cacheReadTokens:t.cacheReadTokens??0,cacheWriteTokens:t.cacheWriteTokens??0,costUsd:t.totalCostUsd??0,timestamp:e.timestamp,source:e.source}}if(e.type==="api.response"){const t=e.payload,l=t.costUsd??0;return l===0?null:{agentId:t.agentId??"unknown",model:t.model??"unknown",inputTokens:t.inputTokens??0,outputTokens:t.outputTokens??0,cacheReadTokens:t.cacheReadTokens??0,cacheWriteTokens:t.cacheWriteTokens??0,costUsd:l,timestamp:e.timestamp,source:e.source}}if(e.type==="api.stream.end"){const t=e.payload,l=t.costUsd??0;return l===0?null:{agentId:"stream",model:"streaming",inputTokens:t.inputTokens??0,outputTokens:t.outputTokens??0,cacheReadTokens:t.cacheReadTokens??0,cacheWriteTokens:t.cacheWriteTokens??0,costUsd:l,timestamp:e.timestamp,source:e.source}}return null}function pl({label:e,value:t,sub:l,accentColor:n}){return i.jsxs(ke,{glass:!0,className:"flex flex-col gap-1.5 flex-1 min-w-0",children:[i.jsx("span",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-300",children:e}),i.jsx("span",{className:"font-mono text-2xl font-semibold",style:{color:n},children:t}),l&&i.jsx("span",{className:"text-[11px] font-mono text-zinc-300",children:l})]})}function os({active:e,payload:t,label:l}){return!e||!(t!=null&&t.length)?null:i.jsxs("div",{className:"rounded border px-3 py-2 text-xs font-mono",style:{background:"#1a1a1e",borderColor:"rgba(255,255,255,0.12)"},children:[i.jsx("p",{className:"text-zinc-400 mb-1",children:l}),t.map((n,a)=>{var s;return i.jsxs("p",{style:{color:n.color},children:[n.name,": ",typeof n.value=="number"&&((s=n.name)!=null&&s.includes("$"))?`$${n.value.toFixed(4)}`:typeof n.value=="number"?n.value.toLocaleString():n.value]},a)})]})}function Bx(){var c,o;const{sessions:e}=ae(),t=si(u=>u.summaries),l=O(),n=C.useMemo(()=>e.filter(u=>u.totalCostUsd>0).sort((u,f)=>f.totalCostUsd-u.totalCostUsd).slice(0,20).map(u=>{const f=t.get(u.id);return{name:u.name,id:u.id,costUsd:u.totalCostUsd,inputTokens:(f==null?void 0:f.inputTokens)??0,outputTokens:(f==null?void 0:f.outputTokens)??0,cacheReadTokens:(f==null?void 0:f.cacheReadTokens)??0,turnCount:(f==null?void 0:f.turnCount)??0,cacheHitRate:(f==null?void 0:f.cacheHitRate)??0}}),[e,t]),a=n.reduce((u,f)=>u+f.costUsd,0),s=n.reduce((u,f)=>u+f.inputTokens+f.outputTokens,0);return n.length===0?i.jsx(Ve,{icon:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),i.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]}),title:"No cross-session cost data",description:"Sessions with cost data will appear here"}):i.jsxs("div",{className:"flex flex-col gap-4 p-4 overflow-y-auto",children:[i.jsxs("div",{className:"flex gap-3",children:[i.jsx(pl,{label:"Total Spend",value:`$${a.toFixed(4)}`,sub:`${n.length} sessions`,accentColor:l.running}),i.jsx(pl,{label:"Total Tokens",value:s>=1e6?`${(s/1e6).toFixed(2)}M`:`${(s/1e3).toFixed(1)}k`,sub:"input + output",accentColor:l.info}),i.jsx(pl,{label:"Most Expensive",value:`$${((c=n[0])==null?void 0:c.costUsd.toFixed(4))??"0"}`,sub:((o=n[0])==null?void 0:o.name)??"—",accentColor:l.warn})]}),i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Cost per Session (top 20)",className:"mb-3"}),i.jsx(Ln,{width:"100%",height:220,children:i.jsxs(us,{data:n,margin:{top:4,right:4,bottom:40,left:8},children:[i.jsx(qn,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),i.jsx(Yn,{dataKey:"name",tick:{fontSize:9,fontFamily:"JetBrains Mono, monospace",fill:"#52525b"},axisLine:!1,tickLine:!1,angle:-35,textAnchor:"end",interval:0}),i.jsx(Gn,{tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1,tickFormatter:u=>`$${u.toFixed(2)}`}),i.jsx(Xn,{content:({active:u,payload:f})=>{var p;if(!u||!(f!=null&&f.length))return null;const h=(p=f[0])==null?void 0:p.payload;return i.jsxs("div",{className:"rounded border px-3 py-2 text-xs font-mono",style:{background:"#1a1a1e",borderColor:"rgba(255,255,255,0.12)"},children:[i.jsx("p",{className:"text-zinc-300 font-semibold mb-1",children:h.name}),i.jsxs("p",{style:{color:l.running},children:["$",h.costUsd.toFixed(6)]}),h.turnCount>0&&i.jsxs("p",{className:"text-zinc-400",children:[h.turnCount," turns"]}),h.cacheHitRate>0&&i.jsxs("p",{style:{color:l.warn},children:[h.cacheHitRate,"% cache hit"]})]})},cursor:{fill:"rgba(255,255,255,0.04)"}}),i.jsx(Gt,{dataKey:"costUsd",radius:[3,3,0,0],children:n.map((u,f)=>i.jsx(br,{fill:l.chartColors[f%l.chartColors.length],fillOpacity:.8},f))})]})})]}),n.some(u=>u.inputTokens>0)&&i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Token Breakdown per Session",className:"mb-3"}),i.jsx(Ln,{width:"100%",height:180,children:i.jsxs(us,{data:n,margin:{top:4,right:4,bottom:40,left:8},children:[i.jsx(qn,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),i.jsx(Yn,{dataKey:"name",tick:{fontSize:9,fontFamily:"JetBrains Mono, monospace",fill:"#52525b"},axisLine:!1,tickLine:!1,angle:-35,textAnchor:"end",interval:0}),i.jsx(Gn,{tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1,tickFormatter:u=>u>=1e3?`${(u/1e3).toFixed(0)}k`:String(u)}),i.jsx(Xn,{content:i.jsx(os,{}),cursor:{fill:"rgba(255,255,255,0.04)"}}),i.jsx(Gt,{dataKey:"inputTokens",name:"Input",fill:l.info,fillOpacity:.8,stackId:"a"}),i.jsx(Gt,{dataKey:"outputTokens",name:"Output",fill:l.warn,fillOpacity:.8,stackId:"a"}),i.jsx(Gt,{dataKey:"cacheReadTokens",name:"Cache Read",fill:l.purple,fillOpacity:.8,stackId:"a",radius:[3,3,0,0]})]})})]})]})}function Rx(){var b;const{events:e}=at(),{agents:t}=be(),{activeSessionId:l}=ae(),n=O(),[a,s]=C.useState("session"),c=l?e.filter(S=>S.sessionId===l):e,o=C.useMemo(()=>c.map(S=>Ux(S)).filter(S=>S!==null).sort((S,k)=>S.timestamp-k.timestamp),[c]),u=C.useMemo(()=>{let S=null,k=0,z=0,A=0,T=0,M=0;for(const Z of o)Z.source==="hook"?(!S||Z.costUsd>S.costUsd)&&(S=Z):(k+=Z.costUsd,z+=Z.inputTokens,A+=Z.outputTokens,T+=Z.cacheReadTokens,M+=Z.cacheWriteTokens);return{costUsd:((S==null?void 0:S.costUsd)??0)+k,inputTokens:((S==null?void 0:S.inputTokens)??0)+z,outputTokens:((S==null?void 0:S.outputTokens)??0)+A,cacheReadTokens:((S==null?void 0:S.cacheReadTokens)??0)+T,cacheWriteTokens:((S==null?void 0:S.cacheWriteTokens)??0)+M}},[o]),f=C.useMemo(()=>{var k;const S=new Map;for(const z of o){const A=((k=t.get(z.agentId))==null?void 0:k.name)??z.agentId.slice(0,8),T=S.get(z.agentId);z.source==="hook"?(!T||z.costUsd>T.costUsd)&&S.set(z.agentId,{agentId:z.agentId,name:A,costUsd:z.costUsd}):T?T.costUsd+=z.costUsd:S.set(z.agentId,{agentId:z.agentId,name:A,costUsd:z.costUsd})}return Array.from(S.values()).sort((z,A)=>A.costUsd-z.costUsd)},[o,t]),h=C.useMemo(()=>{let S=0;return o.map(k=>(k.source==="hook"?S=k.costUsd:S+=k.costUsd,{timestamp:k.timestamp,time:ct(new Date(k.timestamp),"HH:mm:ss"),costUsd:S}))},[o]),p=C.useMemo(()=>{const S=new Map,k=new Map;for(const A of o){const T=A.model.replace("claude-","").replace("-20","-");if(A.source==="hook"){const M=S.get(A.model);(!M||A.costUsd>M.costUsd)&&S.set(A.model,A)}else{const M=k.get(A.model);M?(M.inputTokens+=A.inputTokens,M.outputTokens+=A.outputTokens,M.cacheReadTokens+=A.cacheReadTokens):k.set(A.model,{model:T,inputTokens:A.inputTokens,outputTokens:A.outputTokens,cacheReadTokens:A.cacheReadTokens})}}const z=new Map;for(const[A,T]of S){const M=T.model.replace("claude-","").replace("-20","-");z.set(A,{model:M,inputTokens:T.inputTokens,outputTokens:T.outputTokens,cacheReadTokens:T.cacheReadTokens})}for(const[A,T]of k){const M=z.get(A);M?(M.inputTokens+=T.inputTokens,M.outputTokens+=T.outputTokens,M.cacheReadTokens+=T.cacheReadTokens):z.set(A,T)}return Array.from(z.values())},[o]),m=2e5,y=((b=[...o].reverse().find(S=>S.inputTokens>0))==null?void 0:b.inputTokens)??0,g=Math.min(y/m*100,100),j=g>80?n.error:g>60?n.warn:n.success,v=l?/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(l):!1,r=c.length,d=S=>S?{background:`${n.info}22`,color:n.info,border:`1px solid ${n.info}44`}:{color:"#52525b",border:"1px solid transparent"},x=o.length===0?i.jsxs("div",{className:"flex flex-col min-h-0",children:[i.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[v&&i.jsxs("div",{className:"rounded-lg border px-4 py-3 text-[12px] font-mono",style:{borderColor:`${n.warn}33`,background:`${n.warn}0D`,color:n.warn},children:[i.jsx("p",{className:"font-semibold mb-1",children:"Hook session — no API cost data"}),i.jsxs("p",{className:"text-[11px] opacity-80",children:["Claude Code hook sessions (",l==null?void 0:l.slice(0,8),"…) don't capture Anthropic API calls. Select a session with a ULID ID (e.g. 01KN…) from the header dropdown to see cost data."]})]}),!v&&r>0&&i.jsxs("div",{className:"rounded-lg border px-4 py-3 text-[12px] font-mono",style:{borderColor:`${n.info}33`,background:`${n.info}0D`,color:n.info},children:[i.jsxs("p",{className:"font-semibold mb-1",children:["SDK session — ",r," events, no cost events yet"]}),i.jsx("p",{className:"text-[11px] opacity-80",children:"Events are loaded but none are cost.update or api.response type yet. Make API calls through a prism()-wrapped client."})]}),!v&&r===0&&i.jsxs("div",{className:"rounded-lg border px-4 py-3 text-[12px] font-mono",style:{borderColor:"rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.03)",color:"#71717a"},children:[i.jsx("p",{className:"font-semibold mb-1",children:"No events loaded for this session"}),i.jsx("p",{className:"text-[11px] opacity-80",children:"The session snapshot may not have loaded yet. Try switching away and back, or check that the collector is running."})]})]}),i.jsx(Ve,{icon:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),i.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]}),title:"No cost data for this session",description:"Use the session dropdown (top) to switch to an SDK session (01KN… ULID format), or switch to Portfolio view."})]}):i.jsxs("div",{className:"flex flex-col gap-4 p-4 overflow-y-auto",children:[i.jsxs("div",{className:"flex gap-3",children:[i.jsx(pl,{label:"Total Cost",value:`$${u.costUsd.toFixed(4)}`,sub:"USD",accentColor:n.running}),i.jsx(pl,{label:"Input Tokens",value:u.inputTokens.toLocaleString(),sub:"prompt tokens",accentColor:n.info}),i.jsx(pl,{label:"Output Tokens",value:u.outputTokens.toLocaleString(),sub:"completion tokens",accentColor:n.warn}),i.jsx(pl,{label:"Cache Tokens",value:(u.cacheReadTokens+u.cacheWriteTokens).toLocaleString(),sub:`${u.cacheReadTokens.toLocaleString()} read / ${u.cacheWriteTokens.toLocaleString()} write`,accentColor:n.purple})]}),i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Context Window Utilization",className:"mb-2"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex-1 h-3 rounded-full overflow-hidden",style:{background:"rgba(255,255,255,0.06)"},children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${g}%`,background:j,boxShadow:`0 0 8px ${j}`}})}),i.jsxs("span",{className:"font-mono text-xs text-zinc-400 w-16 text-right",children:[g.toFixed(1),"%"]}),i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[y.toLocaleString()," / ",m.toLocaleString()]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Cost per Agent",className:"mb-3"}),i.jsx(Ln,{width:"100%",height:200,children:i.jsxs(us,{data:f,margin:{top:4,right:4,bottom:4,left:4},children:[i.jsx(qn,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),i.jsx(Yn,{dataKey:"name",tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1}),i.jsx(Gn,{tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1,tickFormatter:S=>`$${S.toFixed(3)}`}),i.jsx(Xn,{content:i.jsx(os,{}),cursor:{fill:"rgba(255,255,255,0.04)"}}),i.jsx(Gt,{dataKey:"costUsd",name:"Cost $",radius:[3,3,0,0],children:f.map((S,k)=>i.jsx(br,{fill:n.chartColors[k%n.chartColors.length],fillOpacity:.8},k))})]})})]}),i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Cumulative Cost Over Time",className:"mb-3"}),i.jsx(Ln,{width:"100%",height:200,children:i.jsxs(z0,{data:h,margin:{top:4,right:4,bottom:4,left:4},children:[i.jsx(qn,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),i.jsx(Yn,{dataKey:"time",tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1}),i.jsx(Gn,{tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1,tickFormatter:S=>`$${S.toFixed(3)}`}),i.jsx(Xn,{content:i.jsx(os,{})}),i.jsx(C0,{type:"monotone",dataKey:"costUsd",name:"Cumulative $",stroke:n.running,strokeWidth:2,dot:!1,activeDot:{r:4,fill:n.running}})]})})]})]}),p.length>0&&i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Token Breakdown by Model",className:"mb-3"}),i.jsx(Ln,{width:"100%",height:180,children:i.jsxs(us,{data:p,margin:{top:4,right:4,bottom:4,left:4},children:[i.jsx(qn,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),i.jsx(Yn,{dataKey:"model",tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1}),i.jsx(Gn,{tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1,tickFormatter:S=>S>=1e3?`${(S/1e3).toFixed(0)}k`:String(S)}),i.jsx(Xn,{content:i.jsx(os,{}),cursor:{fill:"rgba(255,255,255,0.04)"}}),i.jsx(Gt,{dataKey:"inputTokens",name:"Input",fill:n.info,fillOpacity:.8,stackId:"a",radius:[0,0,0,0]}),i.jsx(Gt,{dataKey:"outputTokens",name:"Output",fill:n.warn,fillOpacity:.8,stackId:"a"}),i.jsx(Gt,{dataKey:"cacheReadTokens",name:"Cache Read",fill:n.purple,fillOpacity:.8,stackId:"a",radius:[3,3,0,0]})]})})]})]});return i.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.08)",background:n.toolbarBg},children:[i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"Cost Analytics"}),a==="session"&&o.length>0&&i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[o.length," API calls"]}),i.jsx("div",{className:"flex-1"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:"view:"}),i.jsx("button",{onClick:()=>s("session"),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors",style:d(a==="session"),children:"Session"}),i.jsx("button",{onClick:()=>s("portfolio"),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors",style:d(a==="portfolio"),children:"Portfolio"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:a==="portfolio"?i.jsx(Bx,{}):x})]})}const Xo=cl((e,t)=>({checkpoints:[],selectedCheckpointId:null,addCheckpoint:l=>{e(n=>{const a=n.checkpoints.findIndex(s=>s.id===l.id);if(a>=0){const s=[...n.checkpoints];return s[a]=l,{checkpoints:s}}return{checkpoints:[l,...n.checkpoints]}})},selectCheckpoint:l=>{e({selectedCheckpointId:l})},getCheckpoint:l=>t().checkpoints.find(n=>n.id===l),getCheckpointsBySession:l=>t().checkpoints.filter(n=>n.sessionId===l).sort((n,a)=>n.timestamp-a.timestamp),getPreviousCheckpoint:l=>{const n=t().checkpoints.find(c=>c.id===l);if(!n)return;const a=t().checkpoints.filter(c=>c.sessionId===n.sessionId&&c.agentId===n.agentId).sort((c,o)=>c.timestamp-o.timestamp),s=a.findIndex(c=>c.id===l);return s>0?a[s-1]:void 0}}));function Hx(e,t){const l=e.split(`
|
|
33
|
+
`).replace(Th,"")}function Pd(e,t){return t=$u(t),$u(e)===t}function J(e,t,l,n,a,s){switch(l){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||fn(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&fn(e,""+n);break;case"className":Oa(e,"class",n);break;case"tabIndex":Oa(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":Oa(e,l,n);break;case"style":$r(e,n,s);break;case"data":if(t!=="object"){Oa(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=Ka(""+n),e.setAttribute(l,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(l,"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 s=="function"&&(l==="formAction"?(t!=="input"&&J(e,t,"name",a.name,a,null),J(e,t,"formEncType",a.formEncType,a,null),J(e,t,"formMethod",a.formMethod,a,null),J(e,t,"formTarget",a.formTarget,a,null)):(J(e,t,"encType",a.encType,a,null),J(e,t,"method",a.method,a,null),J(e,t,"target",a.target,a,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=Ka(""+n),e.setAttribute(l,n);break;case"onClick":n!=null&&(e.onclick=zt);break;case"onScroll":n!=null&&H("scroll",e);break;case"onScrollEnd":n!=null&&H("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(N(61));if(l=n.__html,l!=null){if(a.children!=null)throw Error(N(60));e.innerHTML=l}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}l=Ka(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,""+n):e.removeAttribute(l);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":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":n===!0?e.setAttribute(l,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,n):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(l,n):e.removeAttribute(l);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(l):e.setAttribute(l,n);break;case"popover":H("beforetoggle",e),H("toggle",e),Ja(e,"popover",n);break;case"xlinkActuate":pt(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":pt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":pt(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":pt(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":pt(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":pt(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":pt(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":pt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":pt(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Ja(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=em.get(l)||l,Ja(e,l,n))}}function Uc(e,t,l,n,a,s){switch(l){case"style":$r(e,n,s);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(N(61));if(l=n.__html,l!=null){if(a.children!=null)throw Error(N(60));e.innerHTML=l}}break;case"children":typeof n=="string"?fn(e,n):(typeof n=="number"||typeof n=="bigint")&&fn(e,""+n);break;case"onScroll":n!=null&&H("scroll",e);break;case"onScrollEnd":n!=null&&H("scrollend",e);break;case"onClick":n!=null&&(e.onclick=zt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xr.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(a=l.endsWith("Capture"),t=l.slice(2,a?l.length-7:void 0),s=e[Oe]||null,s=s!=null?s[l]:null,typeof s=="function"&&e.removeEventListener(t,s,a),typeof n=="function")){typeof s!="function"&&s!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,n,a);break e}l in e?e[l]=n:n===!0?e.setAttribute(l,""):Ja(e,l,n)}}}function ze(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":H("error",e),H("load",e);var n=!1,a=!1,s;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];if(c!=null)switch(s){case"src":n=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(N(137,t));default:J(e,t,s,c,l,null)}}a&&J(e,t,"srcSet",l.srcSet,l,null),n&&J(e,t,"src",l.src,l,null);return;case"input":H("invalid",e);var o=s=c=a=null,u=null,f=null;for(n in l)if(l.hasOwnProperty(n)){var h=l[n];if(h!=null)switch(n){case"name":a=h;break;case"type":c=h;break;case"checked":u=h;break;case"defaultChecked":f=h;break;case"value":s=h;break;case"defaultValue":o=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(N(137,t));break;default:J(e,t,n,h,l,null)}}Vr(e,s,o,u,f,c,a,!1);return;case"select":H("invalid",e),n=c=s=null;for(a in l)if(l.hasOwnProperty(a)&&(o=l[a],o!=null))switch(a){case"value":s=o;break;case"defaultValue":c=o;break;case"multiple":n=o;default:J(e,t,a,o,l,null)}t=s,l=c,e.multiple=!!n,t!=null?ln(e,!!n,t,!1):l!=null&&ln(e,!!n,l,!0);return;case"textarea":H("invalid",e),s=a=n=null;for(c in l)if(l.hasOwnProperty(c)&&(o=l[c],o!=null))switch(c){case"value":n=o;break;case"defaultValue":a=o;break;case"children":s=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(N(91));break;default:J(e,t,c,o,l,null)}Kr(e,n,a,s);return;case"option":for(u in l)if(l.hasOwnProperty(u)&&(n=l[u],n!=null))switch(u){case"selected":e.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:J(e,t,u,n,l,null)}return;case"dialog":H("beforetoggle",e),H("toggle",e),H("cancel",e),H("close",e);break;case"iframe":case"object":H("load",e);break;case"video":case"audio":for(n=0;n<da.length;n++)H(da[n],e);break;case"image":H("error",e),H("load",e);break;case"details":H("toggle",e);break;case"embed":case"source":case"link":H("error",e),H("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(f in l)if(l.hasOwnProperty(f)&&(n=l[f],n!=null))switch(f){case"children":case"dangerouslySetInnerHTML":throw Error(N(137,t));default:J(e,t,f,n,l,null)}return;default:if(Ic(t)){for(h in l)l.hasOwnProperty(h)&&(n=l[h],n!==void 0&&Uc(e,t,h,n,l,void 0));return}}for(o in l)l.hasOwnProperty(o)&&(n=l[o],n!=null&&J(e,t,o,n,l,null))}function kh(e,t,l,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,s=null,c=null,o=null,u=null,f=null,h=null;for(y in l){var p=l[y];if(l.hasOwnProperty(y)&&p!=null)switch(y){case"checked":break;case"value":break;case"defaultValue":u=p;default:n.hasOwnProperty(y)||J(e,t,y,null,n,p)}}for(var m in n){var y=n[m];if(p=l[m],n.hasOwnProperty(m)&&(y!=null||p!=null))switch(m){case"type":s=y;break;case"name":a=y;break;case"checked":f=y;break;case"defaultChecked":h=y;break;case"value":c=y;break;case"defaultValue":o=y;break;case"children":case"dangerouslySetInnerHTML":if(y!=null)throw Error(N(137,t));break;default:y!==p&&J(e,t,m,y,n,p)}}sc(e,c,o,u,f,h,s,a);return;case"select":y=c=o=m=null;for(s in l)if(u=l[s],l.hasOwnProperty(s)&&u!=null)switch(s){case"value":break;case"multiple":y=u;default:n.hasOwnProperty(s)||J(e,t,s,null,n,u)}for(a in n)if(s=n[a],u=l[a],n.hasOwnProperty(a)&&(s!=null||u!=null))switch(a){case"value":m=s;break;case"defaultValue":o=s;break;case"multiple":c=s;default:s!==u&&J(e,t,a,s,n,u)}t=o,l=c,n=y,m!=null?ln(e,!!l,m,!1):!!n!=!!l&&(t!=null?ln(e,!!l,t,!0):ln(e,!!l,l?[]:"",!1));return;case"textarea":y=m=null;for(o in l)if(a=l[o],l.hasOwnProperty(o)&&a!=null&&!n.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:J(e,t,o,null,n,a)}for(c in n)if(a=n[c],s=l[c],n.hasOwnProperty(c)&&(a!=null||s!=null))switch(c){case"value":m=a;break;case"defaultValue":y=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(N(91));break;default:a!==s&&J(e,t,c,a,n,s)}Jr(e,m,y);return;case"option":for(var g in l)if(m=l[g],l.hasOwnProperty(g)&&m!=null&&!n.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:J(e,t,g,null,n,m)}for(u in n)if(m=n[u],y=l[u],n.hasOwnProperty(u)&&m!==y&&(m!=null||y!=null))switch(u){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:J(e,t,u,m,n,y)}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 j in l)m=l[j],l.hasOwnProperty(j)&&m!=null&&!n.hasOwnProperty(j)&&J(e,t,j,null,n,m);for(f in n)if(m=n[f],y=l[f],n.hasOwnProperty(f)&&m!==y&&(m!=null||y!=null))switch(f){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(N(137,t));break;default:J(e,t,f,m,n,y)}return;default:if(Ic(t)){for(var v in l)m=l[v],l.hasOwnProperty(v)&&m!==void 0&&!n.hasOwnProperty(v)&&Uc(e,t,v,void 0,n,m);for(h in n)m=n[h],y=l[h],!n.hasOwnProperty(h)||m===y||m===void 0&&y===void 0||Uc(e,t,h,m,n,y);return}}for(var r in l)m=l[r],l.hasOwnProperty(r)&&m!=null&&!n.hasOwnProperty(r)&&J(e,t,r,null,n,m);for(p in n)m=n[p],y=l[p],!n.hasOwnProperty(p)||m===y||m==null&&y==null||J(e,t,p,m,n,y)}function Fu(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ah(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),n=0;n<l.length;n++){var a=l[n],s=a.transferSize,c=a.initiatorType,o=a.duration;if(s&&o&&Fu(c)){for(c=0,o=a.responseEnd,n+=1;n<l.length;n++){var u=l[n],f=u.startTime;if(f>o)break;var h=u.transferSize,p=u.initiatorType;h&&Fu(p)&&(u=u.responseEnd,c+=h*(u<o?1:(o-f)/(u-f)))}if(--n,t+=8*(s+c)/(a.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 Bc=null,Rc=null;function Os(e){return e.nodeType===9?e:e.ownerDocument}function Wu(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 e0(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 Hc(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 Xi=null;function wh(){var e=window.event;return e&&e.type==="popstate"?e===Xi?!1:(Xi=e,!0):(Xi=null,!1)}var t0=typeof setTimeout=="function"?setTimeout:void 0,Mh=typeof clearTimeout=="function"?clearTimeout:void 0,Iu=typeof Promise=="function"?Promise:void 0,Eh=typeof queueMicrotask=="function"?queueMicrotask:typeof Iu<"u"?function(e){return Iu.resolve(null).then(e).catch(Dh)}:t0;function Dh(e){setTimeout(function(){throw e})}function ul(e){return e==="head"}function Pu(e,t){var l=t,n=0;do{var a=l.nextSibling;if(e.removeChild(l),a&&a.nodeType===8)if(l=a.data,l==="/$"||l==="/&"){if(n===0){e.removeChild(a),vn(t);return}n--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")n++;else if(l==="html")la(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,la(l);for(var s=l.firstChild;s;){var c=s.nextSibling,o=s.nodeName;s[ja]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&s.rel.toLowerCase()==="stylesheet"||l.removeChild(s),s=c}}else l==="body"&&la(e.ownerDocument.body);l=a}while(l);vn(t)}function er(e,t){var l=e;e=0;do{var n=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),n&&n.nodeType===8)if(l=n.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=n}while(l)}function _c(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":_c(l),Wc(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function Oh(e,t,l,n){for(;e.nodeType===1;){var a=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[ja])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(s=e.getAttribute("rel"),s==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(s!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(s=e.getAttribute("src"),(s!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&s&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var s=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===s)return e}else return e;if(e=lt(e.nextSibling),e===null)break}return null}function Uh(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=lt(e.nextSibling),e===null))return null;return e}function l0(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=lt(e.nextSibling),e===null))return null;return e}function Lc(e){return e.data==="$?"||e.data==="$~"}function qc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Bh(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var n=function(){t(),l.removeEventListener("DOMContentLoaded",n)};l.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function lt(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 Yc=null;function tr(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return lt(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function lr(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function n0(e,t,l){switch(t=Os(l),e){case"html":if(e=t.documentElement,!e)throw Error(N(452));return e;case"head":if(e=t.head,!e)throw Error(N(453));return e;case"body":if(e=t.body,!e)throw Error(N(454));return e;default:throw Error(N(451))}}function la(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Wc(e)}var nt=new Map,nr=new Set;function Us(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ut=G.d;G.d={f:Rh,r:Hh,D:_h,C:Lh,L:qh,m:Yh,X:Xh,S:Gh,M:Qh};function Rh(){var e=Ut.f(),t=Ps();return e||t}function Hh(e){var t=jn(e);t!==null&&t.tag===5&&t.type==="form"?Ff(t):Ut.r(e)}var Cn=typeof document>"u"?null:document;function a0(e,t,l){var n=Cn;if(n&&typeof t=="string"&&t){var a=We(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof l=="string"&&(a+='[crossorigin="'+l+'"]'),nr.has(a)||(nr.add(a),e={rel:e,crossOrigin:l,href:t},n.querySelector(a)===null&&(t=n.createElement("link"),ze(t,"link",e),ge(t),n.head.appendChild(t)))}}function _h(e){Ut.D(e),a0("dns-prefetch",e,null)}function Lh(e,t){Ut.C(e,t),a0("preconnect",e,t)}function qh(e,t,l){Ut.L(e,t,l);var n=Cn;if(n&&e&&t){var a='link[rel="preload"][as="'+We(t)+'"]';t==="image"&&l&&l.imageSrcSet?(a+='[imagesrcset="'+We(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(a+='[imagesizes="'+We(l.imageSizes)+'"]')):a+='[href="'+We(e)+'"]';var s=a;switch(t){case"style":s=yn(e);break;case"script":s=Tn(e)}nt.has(s)||(e=ee({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),nt.set(s,e),n.querySelector(a)!==null||t==="style"&&n.querySelector(ka(s))||t==="script"&&n.querySelector(Aa(s))||(t=n.createElement("link"),ze(t,"link",e),ge(t),n.head.appendChild(t)))}}function Yh(e,t){Ut.m(e,t);var l=Cn;if(l&&e){var n=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+We(n)+'"][href="'+We(e)+'"]',s=a;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Tn(e)}if(!nt.has(s)&&(e=ee({rel:"modulepreload",href:e},t),nt.set(s,e),l.querySelector(a)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Aa(s)))return}n=l.createElement("link"),ze(n,"link",e),ge(n),l.head.appendChild(n)}}}function Gh(e,t,l){Ut.S(e,t,l);var n=Cn;if(n&&e){var a=tn(n).hoistableStyles,s=yn(e);t=t||"default";var c=a.get(s);if(!c){var o={loading:0,preload:null};if(c=n.querySelector(ka(s)))o.loading=5;else{e=ee({rel:"stylesheet",href:e,"data-precedence":t},l),(l=nt.get(s))&&Ho(e,l);var u=c=n.createElement("link");ge(u),ze(u,"link",e),u._p=new Promise(function(f,h){u.onload=f,u.onerror=h}),u.addEventListener("load",function(){o.loading|=1}),u.addEventListener("error",function(){o.loading|=2}),o.loading|=4,as(c,t,n)}c={type:"stylesheet",instance:c,count:1,state:o},a.set(s,c)}}}function Xh(e,t){Ut.X(e,t);var l=Cn;if(l&&e){var n=tn(l).hoistableScripts,a=Tn(e),s=n.get(a);s||(s=l.querySelector(Aa(a)),s||(e=ee({src:e,async:!0},t),(t=nt.get(a))&&_o(e,t),s=l.createElement("script"),ge(s),ze(s,"link",e),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},n.set(a,s))}}function Qh(e,t){Ut.M(e,t);var l=Cn;if(l&&e){var n=tn(l).hoistableScripts,a=Tn(e),s=n.get(a);s||(s=l.querySelector(Aa(a)),s||(e=ee({src:e,async:!0,type:"module"},t),(t=nt.get(a))&&_o(e,t),s=l.createElement("script"),ge(s),ze(s,"link",e),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},n.set(a,s))}}function ar(e,t,l,n){var a=(a=Kt.current)?Us(a):null;if(!a)throw Error(N(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=yn(l.href),l=tn(a).hoistableStyles,n=l.get(t),n||(n={type:"style",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=yn(l.href);var s=tn(a).hoistableStyles,c=s.get(e);if(c||(a=a.ownerDocument||a,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,c),(s=a.querySelector(ka(e)))&&!s._p&&(c.instance=s,c.state.loading=5),nt.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},nt.set(e,l),s||Zh(a,e,l,c.state))),t&&n===null)throw Error(N(528,""));return c}if(t&&n!==null)throw Error(N(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Tn(l),l=tn(a).hoistableScripts,n=l.get(t),n||(n={type:"script",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(N(444,e))}}function yn(e){return'href="'+We(e)+'"'}function ka(e){return'link[rel="stylesheet"]['+e+"]"}function s0(e){return ee({},e,{"data-precedence":e.precedence,precedence:null})}function Zh(e,t,l,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),ze(t,"link",l),ge(t),e.head.appendChild(t))}function Tn(e){return'[src="'+We(e)+'"]'}function Aa(e){return"script[async]"+e}function sr(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+We(l.href)+'"]');if(n)return t.instance=n,ge(n),n;var a=ee({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),ge(n),ze(n,"style",a),as(n,l.precedence,e),t.instance=n;case"stylesheet":a=yn(l.href);var s=e.querySelector(ka(a));if(s)return t.state.loading|=4,t.instance=s,ge(s),s;n=s0(l),(a=nt.get(a))&&Ho(n,a),s=(e.ownerDocument||e).createElement("link"),ge(s);var c=s;return c._p=new Promise(function(o,u){c.onload=o,c.onerror=u}),ze(s,"link",n),t.state.loading|=4,as(s,l.precedence,e),t.instance=s;case"script":return s=Tn(l.src),(a=e.querySelector(Aa(s)))?(t.instance=a,ge(a),a):(n=l,(a=nt.get(s))&&(n=ee({},l),_o(n,a)),e=e.ownerDocument||e,a=e.createElement("script"),ge(a),ze(a,"link",n),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(N(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(n=t.instance,t.state.loading|=4,as(n,l.precedence,e));return t.instance}function as(e,t,l){for(var n=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=n.length?n[n.length-1]:null,s=a,c=0;c<n.length;c++){var o=n[c];if(o.dataset.precedence===t)s=o;else if(s!==a)break}s?s.parentNode.insertBefore(e,s.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Ho(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function _o(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ss=null;function ir(e,t,l){if(ss===null){var n=new Map,a=ss=new Map;a.set(l,n)}else a=ss,n=a.get(l),n||(n=new Map,a.set(l,n));if(n.has(e))return n;for(n.set(e,null),l=l.getElementsByTagName(e),a=0;a<l.length;a++){var s=l[a];if(!(s[ja]||s[je]||e==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var c=s.getAttribute(t)||"";c=e+c;var o=n.get(c);o?o.push(s):n.set(c,[s])}}return n}function cr(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function Vh(e,t,l){if(l===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 i0(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function Jh(e,t,l,n){if(l.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(l.state.loading&4)){if(l.instance===null){var a=yn(n.href),s=t.querySelector(ka(a));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Bs.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=s,ge(s);return}s=t.ownerDocument||t,n=s0(n),(a=nt.get(a))&&Ho(n,a),s=s.createElement("link"),ge(s);var c=s;c._p=new Promise(function(o,u){c.onload=o,c.onerror=u}),ze(s,"link",n),l.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&!(l.state.loading&3)&&(e.count++,l=Bs.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Qi=0;function Kh(e,t){return e.stylesheets&&e.count===0&&is(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var n=setTimeout(function(){if(e.stylesheets&&is(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4+t);0<e.imgBytes&&Qi===0&&(Qi=62500*Ah());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&is(e,e.stylesheets),e.unsuspend)){var s=e.unsuspend;e.unsuspend=null,s()}},(e.imgBytes>Qi?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(a)}}:null}function Bs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)is(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Rs=null;function is(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Rs=new Map,t.forEach($h,e),Rs=null,Bs.call(e))}function $h(e,t){if(!(t.state.loading&4)){var l=Rs.get(e);if(l)var n=l.get(null);else{l=new Map,Rs.set(e,l);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<a.length;s++){var c=a[s];(c.nodeName==="LINK"||c.getAttribute("media")!=="not all")&&(l.set(c.dataset.precedence,c),n=c)}n&&l.set(null,n)}a=t.instance,c=a.getAttribute("data-precedence"),s=l.get(c)||n,s===n&&l.set(null,a),l.set(c,a),this.count++,n=Bs.bind(this),a.addEventListener("load",n),a.addEventListener("error",n),s?s.parentNode.insertBefore(a,s.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var ha={$$typeof:Nt,Provider:null,Consumer:null,_currentValue:gl,_currentValue2:gl,_threadCount:0};function Fh(e,t,l,n,a,s,c,o,u){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=mi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mi(0),this.hiddenUpdates=mi(null),this.identifierPrefix=n,this.onUncaughtError=a,this.onCaughtError=s,this.onRecoverableError=c,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=u,this.incompleteTransitions=new Map}function c0(e,t,l,n,a,s,c,o,u,f,h,p){return e=new Fh(e,t,l,c,u,f,h,p,o),t=1,s===!0&&(t|=24),s=_e(3,null,null,t),e.current=s,s.stateNode=e,t=uo(),t.refCount++,e.pooledCache=t,t.refCount++,s.memoizedState={element:n,isDehydrated:l,cache:t},mo(s),e}function o0(e){return e?(e=Fl,e):Fl}function u0(e,t,l,n,a,s){a=o0(a),n.context===null?n.context=a:n.pendingContext=a,n=Ft(t),n.payload={element:l},s=s===void 0?null:s,s!==null&&(n.callback=s),l=Wt(e,n,t),l!==null&&(De(l,e,t),Kn(l,e,t))}function or(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Lo(e,t){or(e,t),(e=e.alternate)&&or(e,t)}function r0(e){if(e.tag===13||e.tag===31){var t=Ml(e,67108864);t!==null&&De(t,e,67108864),Lo(e,67108864)}}function ur(e){if(e.tag===13||e.tag===31){var t=Xe();t=$c(t);var l=Ml(e,t);l!==null&&De(l,e,t),Lo(e,t)}}var Hs=!0;function Wh(e,t,l,n){var a=D.T;D.T=null;var s=G.p;try{G.p=2,qo(e,t,l,n)}finally{G.p=s,D.T=a}}function Ih(e,t,l,n){var a=D.T;D.T=null;var s=G.p;try{G.p=8,qo(e,t,l,n)}finally{G.p=s,D.T=a}}function qo(e,t,l,n){if(Hs){var a=Gc(n);if(a===null)Gi(e,t,n,_s,l),rr(e,n);else if(ex(a,e,t,l,n))n.stopPropagation();else if(rr(e,n),t&4&&-1<Ph.indexOf(e)){for(;a!==null;){var s=jn(a);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var c=ml(s.pendingLanes);if(c!==0){var o=s;for(o.pendingLanes|=2,o.entangledLanes|=2;c;){var u=1<<31-Ge(c);o.entanglements[1]|=u,c&=~u}ht(s),!(Y&6)&&(ks=qe()+500,Ta(0))}}break;case 31:case 13:o=Ml(s,2),o!==null&&De(o,s,2),Ps(),Lo(s,2)}if(s=Gc(n),s===null&&Gi(e,t,n,_s,l),s===a)break;a=s}a!==null&&n.stopPropagation()}else Gi(e,t,n,null,l)}}function Gc(e){return e=Pc(e),Yo(e)}var _s=null;function Yo(e){if(_s=null,e=Ql(e),e!==null){var t=ga(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=wr(t),e!==null)return e;e=null}else if(l===31){if(e=Mr(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return _s=e,null}function f0(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(_0()){case Ur:return 2;case Br:return 8;case ms:case L0:return 32;case Rr:return 268435456;default:return 32}default:return 32}}var Xc=!1,el=null,tl=null,ll=null,xa=new Map,pa=new Map,Yt=[],Ph="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 rr(e,t){switch(e){case"focusin":case"focusout":el=null;break;case"dragenter":case"dragleave":tl=null;break;case"mouseover":case"mouseout":ll=null;break;case"pointerover":case"pointerout":xa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":pa.delete(t.pointerId)}}function On(e,t,l,n,a,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:l,eventSystemFlags:n,nativeEvent:s,targetContainers:[a]},t!==null&&(t=jn(t),t!==null&&r0(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function ex(e,t,l,n,a){switch(t){case"focusin":return el=On(el,e,t,l,n,a),!0;case"dragenter":return tl=On(tl,e,t,l,n,a),!0;case"mouseover":return ll=On(ll,e,t,l,n,a),!0;case"pointerover":var s=a.pointerId;return xa.set(s,On(xa.get(s)||null,e,t,l,n,a)),!0;case"gotpointercapture":return s=a.pointerId,pa.set(s,On(pa.get(s)||null,e,t,l,n,a)),!0}return!1}function d0(e){var t=Ql(e.target);if(t!==null){var l=ga(t);if(l!==null){if(t=l.tag,t===13){if(t=wr(l),t!==null){e.blockedOn=t,Ko(e.priority,function(){ur(l)});return}}else if(t===31){if(t=Mr(l),t!==null){e.blockedOn=t,Ko(e.priority,function(){ur(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function cs(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Gc(e.nativeEvent);if(l===null){l=e.nativeEvent;var n=new l.constructor(l.type,l);cc=n,l.target.dispatchEvent(n),cc=null}else return t=jn(l),t!==null&&r0(t),e.blockedOn=l,!1;t.shift()}return!0}function fr(e,t,l){cs(e)&&l.delete(t)}function tx(){Xc=!1,el!==null&&cs(el)&&(el=null),tl!==null&&cs(tl)&&(tl=null),ll!==null&&cs(ll)&&(ll=null),xa.forEach(fr),pa.forEach(fr)}function Ya(e,t){e.blockedOn===t&&(e.blockedOn=null,Xc||(Xc=!0,xe.unstable_scheduleCallback(xe.unstable_NormalPriority,tx)))}var Ga=null;function dr(e){Ga!==e&&(Ga=e,xe.unstable_scheduleCallback(xe.unstable_NormalPriority,function(){Ga===e&&(Ga=null);for(var t=0;t<e.length;t+=3){var l=e[t],n=e[t+1],a=e[t+2];if(typeof n!="function"){if(Yo(n||l)===null)continue;break}var s=jn(l);s!==null&&(e.splice(t,3),t-=3,Nc(s,{pending:!0,data:a,method:l.method,action:n},n,a))}}))}function vn(e){function t(u){return Ya(u,e)}el!==null&&Ya(el,e),tl!==null&&Ya(tl,e),ll!==null&&Ya(ll,e),xa.forEach(t),pa.forEach(t);for(var l=0;l<Yt.length;l++){var n=Yt[l];n.blockedOn===e&&(n.blockedOn=null)}for(;0<Yt.length&&(l=Yt[0],l.blockedOn===null);)d0(l),l.blockedOn===null&&Yt.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(n=0;n<l.length;n+=3){var a=l[n],s=l[n+1],c=a[Oe]||null;if(typeof s=="function")c||dr(l);else if(c){var o=null;if(s&&s.hasAttribute("formAction")){if(a=s,c=s[Oe]||null)o=c.formAction;else if(Yo(a)!==null)continue}else o=c.action;typeof o=="function"?l[n+1]=o:(l.splice(n,3),n-=3),dr(l)}}}function m0(){function e(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(c){return a=c})},focusReset:"manual",scroll:"manual"})}function t(){a!==null&&(a(),a=null),n||setTimeout(l,20)}function l(){if(!n&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,a=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),a!==null&&(a(),a=null)}}}function Go(e){this._internalRoot=e}li.prototype.render=Go.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(N(409));var l=t.current,n=Xe();u0(l,n,e,t,null,null)};li.prototype.unmount=Go.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;u0(e.current,2,null,e,null,null),Ps(),t[bn]=null}};function li(e){this._internalRoot=e}li.prototype.unstable_scheduleHydration=function(e){if(e){var t=Yr();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Yt.length&&t!==0&&t<Yt[l].priority;l++);Yt.splice(l,0,e),l===0&&d0(e)}};var mr=kr.version;if(mr!=="19.2.5")throw Error(N(527,mr,"19.2.5"));G.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(N(188)):(e=Object.keys(e).join(","),Error(N(268,e)));return e=E0(t),e=e!==null?Er(e):null,e=e===null?null:e.stateNode,e};var lx={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xa=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xa.isDisabled&&Xa.supportsFiber)try{ya=Xa.inject(lx),Ye=Xa}catch{}}qs.createRoot=function(e,t){if(!Ar(e))throw Error(N(299));var l=!1,n="",a=ad,s=sd,c=id;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=c0(e,1,!1,null,null,l,n,null,a,s,c,m0),e[bn]=t.current,Ro(e),new Go(t)};qs.hydrateRoot=function(e,t,l){if(!Ar(e))throw Error(N(299));var n=!1,a="",s=ad,c=sd,o=id,u=null;return l!=null&&(l.unstable_strictMode===!0&&(n=!0),l.identifierPrefix!==void 0&&(a=l.identifierPrefix),l.onUncaughtError!==void 0&&(s=l.onUncaughtError),l.onCaughtError!==void 0&&(c=l.onCaughtError),l.onRecoverableError!==void 0&&(o=l.onRecoverableError),l.formState!==void 0&&(u=l.formState)),t=c0(e,1,!0,t,l??null,n,a,u,s,c,o,m0),t.context=o0(null),l=t.current,n=Xe(),n=$c(n),a=Ft(n),a.callback=null,Wt(l,a,n),l=n,t.current.lanes=l,ba(t,l),ht(t),e[bn]=t.current,Ro(e),new li(t)};qs.version="19.2.5";function h0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h0)}catch(e){console.error(e)}}h0(),zr.exports=qs;var nx=zr.exports;const ae=cl((e,t)=>({sessions:[],activeSessionId:null,setActiveSession:l=>{e({activeSessionId:l})},setSessions:l=>{if(e({sessions:l}),!t().activeSessionId&&l.length>0){const a=l.find(s=>s.status==="active")??l[0];a&&e({activeSessionId:a.id})}},upsertSession:l=>{e(n=>{const a=n.sessions.findIndex(s=>s.id===l.id);if(a>=0){const s=[...n.sessions];return s[a]=l,{sessions:s}}return{sessions:[l,...n.sessions]}}),t().activeSessionId||e({activeSessionId:l.id})},removeSession:l=>{e(n=>{var c;const a=n.sessions.filter(o=>o.id!==l),s=n.activeSessionId===l?((c=a.find(o=>o.status==="active")??a[0])==null?void 0:c.id)??null:n.activeSessionId;return{sessions:a,activeSessionId:s}})},getActiveSession:()=>{const{sessions:l,activeSessionId:n}=t();return l.find(a=>a.id===n)??null}})),ni=cl((e,t)=>({status:"disconnected",ws:null,lastHeartbeat:null,collectorUrl:"ws://localhost:4700/ws",connect:l=>{const n=t().ws;n&&n.close(),e({status:"connecting",collectorUrl:l});const a=new WebSocket(l);a.onopen=()=>{e({status:"connected",ws:a,lastHeartbeat:Date.now()})},a.onclose=()=>{e({status:"disconnected",ws:null})},a.onerror=()=>{e({status:"error",ws:null})},e({ws:a})},disconnect:()=>{const l=t().ws;l&&l.close(),e({status:"disconnected",ws:null})},send:l=>{const n=t().ws;n&&n.readyState===WebSocket.OPEN&&n.send(JSON.stringify(l))},setStatus:l=>e({status:l}),setLastHeartbeat:l=>e({lastHeartbeat:l})}));function ax(e,t){let l;try{l=e()}catch{return}return{getItem:a=>{var s;const c=u=>u===null?null:JSON.parse(u,void 0),o=(s=l.getItem(a))!=null?s:null;return o instanceof Promise?o.then(c):c(o)},setItem:(a,s)=>l.setItem(a,JSON.stringify(s,void 0)),removeItem:a=>l.removeItem(a)}}const Qc=e=>t=>{try{const l=e(t);return l instanceof Promise?l:{then(n){return Qc(n)(l)},catch(n){return this}}}catch(l){return{then(n){return this},catch(n){return Qc(n)(l)}}}},sx=(e,t)=>(l,n,a)=>{let s={storage:ax(()=>window.localStorage),partialize:v=>v,version:0,merge:(v,r)=>({...r,...v}),...t},c=!1,o=0;const u=new Set,f=new Set;let h=s.storage;if(!h)return e((...v)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),l(...v)},n,a);const p=()=>{const v=s.partialize({...n()});return h.setItem(s.name,{state:v,version:s.version})},m=a.setState;a.setState=(v,r)=>(m(v,r),p());const y=e((...v)=>(l(...v),p()),n,a);a.getInitialState=()=>y;let g;const j=()=>{var v,r;if(!h)return;const d=++o;c=!1,u.forEach(b=>{var S;return b((S=n())!=null?S:y)});const x=((r=s.onRehydrateStorage)==null?void 0:r.call(s,(v=n())!=null?v:y))||void 0;return Qc(h.getItem.bind(h))(s.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==s.version){if(s.migrate){const S=s.migrate(b.state,b.version);return S instanceof Promise?S.then(k=>[!0,k]):[!0,S]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var S;if(d!==o)return;const[k,z]=b;if(g=s.merge(z,(S=n())!=null?S:y),l(g,!0),k)return p()}).then(()=>{d===o&&(x==null||x(n(),void 0),g=n(),c=!0,f.forEach(b=>b(g)))}).catch(b=>{d===o&&(x==null||x(void 0,b))})};return a.persist={setOptions:v=>{s={...s,...v},v.storage&&(h=v.storage)},clearStorage:()=>{h==null||h.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>j(),hasHydrated:()=>c,onHydrate:v=>(u.add(v),()=>{u.delete(v)}),onFinishHydration:v=>(f.add(v),()=>{f.delete(v)})},s.skipHydration||j(),g||y},ix=sx,ai=cl()(ix(e=>({themeId:"neon",setTheme:t=>e({themeId:t})}),{name:"prism-theme"})),x0={neon:{id:"neon",label:"Neon",bg:"#09090B",headerBg:"rgba(9,9,11,0.95)",toolbarBg:"rgba(9,9,11,0.8)",sidebarBg:"rgba(9,9,11,0.95)",running:"#00FF88",success:"#00FF88",error:"#FF3366",info:"#00BBFF",warn:"#FFAA00",purple:"#BB88FF",chartColors:["#00FF88","#00BBFF","#FFAA00","#FF3366","#BB88FF","#FF8844","#44FFBB"]},claude:{id:"claude",label:"Claude",bg:"#1C1B19",headerBg:"rgba(24,23,19,0.95)",toolbarBg:"rgba(24,23,19,0.8)",sidebarBg:"rgba(22,21,17,0.95)",running:"#CC785C",success:"#7FB069",error:"#C0392B",info:"#5B8DB8",warn:"#E8A838",purple:"#9B7FC4",chartColors:["#CC785C","#5B8DB8","#E8A838","#C0392B","#9B7FC4","#D4956A","#7FB069"]}};function O(){const e=ai(t=>t.themeId);return x0[e]}function cx({status:e,url:t="localhost:4700"}){const l=O(),a={connected:{label:"Connected",color:l.success,glow:!0},connecting:{label:"Connecting…",color:l.warn,pulse:!0},disconnected:{label:"Disconnected",color:"#52525b"},error:{label:"Error",color:l.error,glow:!0}}[e];return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:a.pulse?"h-2 w-2 rounded-full flex-shrink-0 animate-pulse":"h-2 w-2 rounded-full flex-shrink-0",style:{background:a.color,boxShadow:a.glow?`0 0 6px ${a.color}`:"none"}}),i.jsxs("div",{className:"flex flex-col leading-none",children:[i.jsx("span",{className:"text-[11px] font-mono font-medium",style:{color:a.color},children:a.label}),i.jsx("span",{className:"text-[10px] font-mono text-zinc-300",children:t})]})]})}function ox(){return i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:i.jsx("path",{d:"M2 3h8M5 3V2h2v1M4 3v6.5a.5.5 0 00.5.5h3a.5.5 0 00.5-.5V3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ux({open:e}){return i.jsx("svg",{width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",className:me("transition-transform duration-150",e?"rotate-180":""),children:i.jsx("path",{d:"M1 1L5 5L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function rx(){const{sessions:e,activeSessionId:t,setActiveSession:l,removeSession:n}=ae(),{status:a,collectorUrl:s}=ni(),{themeId:c,setTheme:o}=ai(),u=O(),[f,h]=C.useState(!1),[p,m]=C.useState(null),y=C.useRef(null);C.useEffect(()=>{if(!f)return;function v(r){var d;(d=y.current)!=null&&d.contains(r.target)||h(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[f]),C.useEffect(()=>{if(!f)return;function v(r){r.key==="Escape"&&h(!1)}return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[f]);const g=e.find(v=>v.id===t);async function j(v,r){r.stopPropagation();const d=e.find(S=>S.id===v),x=d?`${d.name} — ${ct(new Date(d.startedAt),"MMM d, HH:mm:ss")}`:v;if(!confirm(`Delete session "${x}"? This cannot be undone.`))return;const b=s.replace(/^ws/,"http").replace(/\/ws$/,"");m(v);try{const S=await fetch(`${b}/api/sessions/${v}`,{method:"DELETE"});if(!S.ok)throw new Error(`HTTP ${S.status}`);n(v)}catch(S){alert(`Failed to delete: ${S instanceof Error?S.message:String(S)}`)}finally{m(null)}}return i.jsxs("header",{className:"flex h-14 flex-shrink-0 items-center justify-between border-b px-5",style:{borderColor:"rgba(255,255,255,0.08)",background:u.headerBg,backdropFilter:"blur(12px)"},children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-md text-xs font-bold",style:{background:`${u.running}1E`,border:`1px solid ${u.running}4D`},children:i.jsx("span",{style:{color:u.running,fontFamily:"JetBrains Mono, monospace"},children:"P"})}),i.jsxs("div",{className:"leading-none",children:[i.jsx("span",{className:"text-sm font-bold tracking-tight",style:{color:u.running,fontFamily:"JetBrains Mono, monospace"},children:"PRISM"}),i.jsx("p",{className:"text-[10px] text-zinc-300 font-mono",children:"agentic visibility"})]})]}),i.jsx("div",{className:"flex-1 max-w-sm mx-6",ref:y,children:e.length===0?i.jsx("p",{className:"text-xs font-mono text-zinc-300 text-center",children:"No sessions yet"}):i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>h(v=>!v),className:"flex w-full items-center gap-2 rounded border px-3 py-1.5 text-xs font-mono text-zinc-300 transition-colors hover:bg-white/[0.03]",style:{borderColor:f?"rgba(255,255,255,0.18)":"rgba(255,255,255,0.10)",background:"rgba(24,24,27,0.8)"},children:[g?i.jsxs("span",{className:"flex-1 flex items-center gap-1.5 min-w-0 truncate",children:[i.jsx("span",{className:"truncate",children:g.name}),g.totalCostUsd>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-zinc-700 shrink-0",children:"•"}),i.jsxs("span",{className:"shrink-0",style:{color:u.running},children:["$",g.totalCostUsd.toFixed(4)]})]}),i.jsx("span",{className:"text-zinc-700 shrink-0",children:"•"}),i.jsx("span",{className:"shrink-0 text-[9px] px-1 py-0.5 rounded",style:g.status==="active"?{background:`${u.running}1A`,color:u.running,border:`1px solid ${u.running}33`}:{background:"rgba(255,255,255,0.04)",color:"#71717a",border:"1px solid rgba(255,255,255,0.08)"},children:g.status==="active"?"live":"ended"})]}):i.jsx("span",{className:"flex-1 text-left text-zinc-600",children:"Select session"}),i.jsx("span",{className:"text-zinc-500 flex-shrink-0",children:i.jsx(ux,{open:f})})]}),f&&i.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 rounded-lg border overflow-hidden z-50",style:{background:"rgba(15,15,18,0.98)",borderColor:"rgba(255,255,255,0.12)",backdropFilter:"blur(16px)",boxShadow:"0 8px 32px rgba(0,0,0,0.6)"},children:i.jsx("div",{className:"max-h-64 overflow-y-auto",children:e.map(v=>{const r=v.id===t,d=p===v.id;return i.jsxs("div",{className:"group flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors hover:bg-white/[0.04]",style:{background:r?"rgba(255,255,255,0.04)":"transparent",borderBottom:"1px solid rgba(255,255,255,0.05)"},onClick:()=>{l(v.id),h(!1)},children:[i.jsx("div",{className:"h-1.5 w-1.5 rounded-full flex-shrink-0",style:{background:r?u.running:"transparent",border:r?"none":"1px solid rgba(255,255,255,0.15)"}}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs text-zinc-300 truncate",children:[i.jsx("span",{className:"truncate",children:v.name}),v.totalCostUsd>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-zinc-700 shrink-0",children:"•"}),i.jsxs("span",{className:"shrink-0",style:{color:u.running},children:["$",v.totalCostUsd.toFixed(4)]})]}),i.jsx("span",{className:"text-zinc-700 shrink-0",children:"•"}),i.jsx("span",{className:"shrink-0 text-[9px] px-1 py-0.5 rounded",style:v.status==="active"?{background:`${u.running}1A`,color:u.running,border:`1px solid ${u.running}33`}:{background:"rgba(255,255,255,0.04)",color:"#71717a",border:"1px solid rgba(255,255,255,0.08)"},children:v.status==="active"?"live":"ended"})]}),i.jsx("p",{className:"font-mono text-[10px] text-zinc-600 mt-0.5",children:ct(new Date(v.startedAt),"MMM d, HH:mm:ss")})]}),i.jsx("button",{onClick:x=>j(v.id,x),disabled:d,title:"Delete session",className:"flex-shrink-0 flex h-6 w-6 items-center justify-center rounded transition-colors disabled:opacity-40",style:{color:d?`${u.error}66`:u.error,background:`${u.error}14`,border:`1px solid ${u.error}33`},children:d?i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",className:"animate-spin",children:i.jsx("circle",{cx:"6",cy:"6",r:"4.5",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"14 8"})}):i.jsx(ox,{})})]},v.id)})})})]})}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"flex items-center gap-0.5 rounded-md border p-0.5",style:{borderColor:"rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.04)"},children:["neon","claude"].map(v=>i.jsx("button",{onClick:()=>o(v),className:me("rounded px-2.5 py-1 text-[10px] font-mono transition-colors capitalize",c===v?"bg-white/10 text-zinc-300":"text-zinc-400 hover:text-zinc-300"),children:v},v))}),i.jsx(cx,{status:a})]})]})}function p0({content:e,children:t,side:l="top",className:n}){const[a,s]=C.useState(!1),c=C.useRef(null),o=()=>{c.current=setTimeout(()=>s(!0),300)},u=()=>{c.current&&clearTimeout(c.current),s(!1)},f={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};return i.jsxs("div",{className:"relative inline-flex",onMouseEnter:o,onMouseLeave:u,children:[t,a&&i.jsx("div",{className:me("pointer-events-none absolute z-50 whitespace-nowrap rounded border border-white/[0.12]","bg-zinc-800 px-2 py-1 text-xs text-zinc-300 shadow-xl animate-fade-in",f[l],n),children:e})]})}function fx(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}function dx(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"5",r:"2"}),i.jsx("circle",{cx:"5",cy:"19",r:"2"}),i.jsx("circle",{cx:"19",cy:"19",r:"2"}),i.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"13"}),i.jsx("line",{x1:"12",y1:"13",x2:"5",y2:"17"}),i.jsx("line",{x1:"12",y1:"13",x2:"19",y2:"17"})]})}function mx(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),i.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]})}function hx(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.44-3.54z"}),i.jsx("path",{d:"M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.44-3.54z"})]})}function xx(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polyline",{points:"1 4 1 10 7 10"}),i.jsx("path",{d:"M3.51 15a9 9 0 1 0 .49-4"})]})}function px(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})})}function gx(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),i.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),i.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}const yx=[{id:"events",label:"Event Stream",icon:i.jsx(fx,{})},{id:"cost",label:"Cost Analytics",icon:i.jsx(mx,{})},{id:"intelligence",label:"Session Intelligence",icon:i.jsx(hx,{})},{id:"tools",label:"Tool Inspector",icon:i.jsx(px,{})},{id:"context",label:"Context Window",icon:i.jsx(gx,{})},{id:"agents",label:"Agent Tree",icon:i.jsx(dx,{})},{id:"history",label:"Session History",icon:i.jsx(xx,{})}];function vx({activePanel:e,onPanelChange:t}){const l=O(),n=yx;return i.jsx("aside",{className:"flex w-14 flex-shrink-0 flex-col items-center border-r py-3 gap-1",style:{borderColor:"rgba(255,255,255,0.08)",background:l.sidebarBg},children:n.map(a=>{const s=e===a.id;return i.jsx(p0,{content:a.label,side:"right",children:i.jsx("button",{onClick:()=>t(a.id),className:me("flex h-10 w-10 items-center justify-center rounded-lg transition-all duration-150",!s&&"text-zinc-300 hover:bg-white/5 hover:text-zinc-400"),style:s?{background:`${l.running}1A`,color:l.running,border:`1px solid ${l.running}33`}:{border:"1px solid transparent"},"aria-label":a.label,children:a.icon})},a.id)})})}const Qa=1e3,at=cl((e,t)=>({events:[],totalReceived:0,addEvent:l=>{e(n=>{const a=[l,...n.events];return{events:a.length>Qa?a.slice(0,Qa):a,totalReceived:n.totalReceived+1}})},addEvents:l=>{e(n=>{const a=new Map(n.events.map(c=>[c.id,c]));for(const c of l)a.set(c.id,c);const s=Array.from(a.values()).sort((c,o)=>o.timestamp-c.timestamp);return{events:s.length>Qa?s.slice(0,Qa):s,totalReceived:n.totalReceived+l.length}})},clearEvents:()=>{e({events:[],totalReceived:0})},getEventsByType:l=>t().events.filter(n=>n.type===l),getEventsBySession:l=>t().events.filter(n=>n.sessionId===l),getEventsByAgent:l=>t().events.filter(n=>n.payload.agentId===l)}));function bx(e,t){switch(e){case"green":return t.success;case"red":return t.error;case"blue":return t.info;case"yellow":return t.warn;case"purple":return t.purple;default:return null}}function Dl({children:e,variant:t="default",size:l="xs",className:n}){const a=ai(o=>o.themeId),s=x0[a],c=bx(t,s);return i.jsx("span",{className:me("inline-flex items-center rounded border font-mono font-medium uppercase tracking-wider",l==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-1 text-xs",!c&&(t==="gray"?"bg-white/5 text-zinc-400 border-white/10":"bg-white/5 text-zinc-300 border-white/10"),n),style:c?{background:`${c}1A`,color:c,borderColor:`${c}33`}:void 0,children:e})}function Ve({icon:e,title:t,description:l,action:n}){return i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[e&&i.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl border border-white/[0.08] bg-white/[0.03] text-zinc-300",children:e}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium text-zinc-400",children:t}),l&&i.jsx("p",{className:"mt-1 text-xs text-zinc-300",children:l})]}),n&&i.jsx("div",{className:"mt-2",children:n})]})}const Zi=[{id:"all",label:"All",match:e=>!0},{id:"tool",label:"Tools",match:e=>e.startsWith("tool.")},{id:"api",label:"API",match:e=>e.startsWith("api.")},{id:"agent",label:"Agents",match:e=>e.startsWith("agent.")},{id:"user",label:"Prompts",match:e=>e==="user.prompt"},{id:"cost",label:"Cost",match:e=>e==="cost.update"},{id:"session",label:"Session",match:e=>e.startsWith("session.")},{id:"mcp",label:"MCP",match:e=>e.startsWith("mcp.")}];function g0(e){if(e.type==="cost.update"){const t=e.payload;return{tokens:(t.inputTokens??0)+(t.outputTokens??0),costUsd:t.totalCostUsd??0}}if(e.type==="api.response"){const t=e.payload,l=t.usage;if(!l)return null;const n=(l.inputTokens??l.input_tokens??0)+(l.outputTokens??l.output_tokens??0);return n===0?null:{tokens:n,costUsd:t.costUsd??0}}return null}function y0(e){return e.startsWith("api.")?"blue":e.startsWith("agent.")?"green":e.startsWith("tool.")?"yellow":e.startsWith("mcp.")?"purple":e.includes("error")||e.includes("fail")||e==="loop.detected"?"red":e.startsWith("session.")?"gray":"default"}function jx(e){var l,n,a;const t=e.payload;switch(e.type){case"tool.call":{const s=t.toolName??"",c=t.input,o=t.status;let u="";if(c){const f=((l=c.command)==null?void 0:l.split(`
|
|
34
|
+
`)[0])??"",h=c.file_path??c.path??"";u=(f||h||c.pattern||"").slice(0,60)}return`${s}${o?` [${o}]`:""}${u?` ${u}`:""}`}case"user.prompt":return((n=t.text)==null?void 0:n.slice(0,80))??"";case"cost.update":{const s=t;return`$${(s.totalCostUsd??0).toFixed(6)} ${((s.inputTokens??0)+(s.outputTokens??0)).toLocaleString()} tokens ${s.model??""}`}case"agent.spawn":return`${t.name??""} (${String(t.agentId??"").slice(0,8)})`;case"agent.state_change":return`${t.previousState??"?"} → ${t.nextState??"?"}${t.reason?` (${t.reason})`:""}`;case"agent.log":return`[${t.level??"info"}] ${((a=t.message)==null?void 0:a.slice(0,80))??""}`;case"session.summary":{const s=t.turnCount??0,c=t.totalCostUsd??0,o=t.cacheHitRate??0;return`${s} turns $${c.toFixed(4)} ${o}% cache`}case"mcp.tool.call":return`${t.serverName??""} / ${t.toolName??""}`;default:{const s=[];for(const c of Object.keys(t).slice(0,3)){const o=t[c];o!=null&&(typeof o=="string"?s.push(`${c}: "${o.length>24?o.slice(0,24)+"…":o}"`):typeof o=="number"||typeof o=="boolean"?s.push(`${c}: ${String(o)}`):Array.isArray(o)?s.push(`${c}: [${o.length}]`):s.push(`${c}: {…}`))}return s.join(" ")}}}function Sx({label:e,value:t,mono:l=!0,color:n}){return i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsx("span",{className:"text-[9px] font-mono uppercase tracking-widest text-zinc-600",children:e}),i.jsx("span",{className:me("text-[11px] break-all",l?"font-mono":""),style:{color:n??"#d4d4d8"},children:t})]})}function Nx({event:e,onClose:t}){const l=O(),[n,a]=C.useState(!1),s=e.payload,c=y0(e.type),o=g0(e),u=[];switch(e.type){case"tool.call":{const f=s.input,h=s.output;u.push({label:"Tool",value:s.toolName??""}),s.agentId&&u.push({label:"Agent ID",value:s.agentId}),(s.callId??s.toolCallId)&&u.push({label:"Call ID",value:s.callId??s.toolCallId});const p=s.status;if(p&&u.push({label:"Status",value:p,color:p==="complete"?l.running:p==="error"?l.error:l.warn}),f)for(const[m,y]of Object.entries(f)){if(y==null)continue;const g=typeof y=="string"?y:JSON.stringify(y,null,2);u.push({label:`input.${m}`,value:g.slice(0,800)})}if(h&&Object.keys(h).length>0){const m=JSON.stringify(h).slice(0,300);u.push({label:"Output",value:m})}break}case"user.prompt":u.push({label:"Prompt",value:s.text??""}),s.promptSource&&u.push({label:"Source",value:s.promptSource});break;case"cost.update":{const f=s;u.push({label:"Cost",value:`$${(f.totalCostUsd??0).toFixed(8)}`,color:l.running}),u.push({label:"Model",value:f.model??""}),u.push({label:"Input Tokens",value:(f.inputTokens??0).toLocaleString()}),u.push({label:"Output Tokens",value:(f.outputTokens??0).toLocaleString()});const h=s.cacheReadTokens??0,p=s.cacheWriteTokens??0;h&&u.push({label:"Cache Reads",value:h.toLocaleString(),color:l.warn}),p&&u.push({label:"Cache Writes",value:p.toLocaleString(),color:l.warn}),u.push({label:"Input Cost",value:`$${(f.inputCostUsd??0).toFixed(8)}`}),u.push({label:"Output Cost",value:`$${(f.outputCostUsd??0).toFixed(8)}`});const m=s.agentId;m&&u.push({label:"Agent ID",value:m});break}case"agent.spawn":u.push({label:"Agent ID",value:s.agentId??""}),u.push({label:"Name",value:s.name??""}),s.parentAgentId&&u.push({label:"Parent",value:s.parentAgentId}),s.depth!==void 0&&u.push({label:"Depth",value:String(s.depth)});break;case"agent.state_change":u.push({label:"Agent ID",value:s.agentId??""}),u.push({label:"Previous State",value:s.previousState??""}),u.push({label:"Next State",value:s.nextState??"",color:l.running}),s.reason&&u.push({label:"Reason",value:s.reason});break;case"agent.log":u.push({label:"Agent ID",value:s.agentId??""}),u.push({label:"Level",value:s.level??"info"}),u.push({label:"Message",value:s.message??""});break;case"session.summary":{u.push({label:"Turns",value:String(s.turnCount??0)}),u.push({label:"Total Duration",value:hr(s.totalDurationMs??0)}),u.push({label:"Avg Turn Duration",value:hr(s.avgTurnDurationMs??0)}),u.push({label:"Stop Reason",value:s.stopReason??""}),u.push({label:"Model",value:s.model??""}),u.push({label:"Total Cost",value:`$${(s.totalCostUsd??0).toFixed(8)}`,color:l.running}),u.push({label:"Cache Saved",value:`$${(s.cacheSavedUsd??0).toFixed(6)}`,color:l.warn}),u.push({label:"Cache Hit Rate",value:`${s.cacheHitRate??0}%`});const f=s.toolBreakdown;if(f){const p=Object.entries(f).sort((m,y)=>y[1]-m[1]).slice(0,8);u.push({label:"Tools",value:p.map(([m,y])=>`${m}×${y}`).join(" ")})}const h=s.filesModified;h!=null&&h.length&&u.push({label:`Files (${h.length})`,value:h.slice(0,10).map(p=>p.split("/").pop()).join(`
|
|
35
|
+
`)});break}default:for(const[f,h]of Object.entries(s))h!=null&&u.push({label:f,value:typeof h=="string"?h:JSON.stringify(h)})}return i.jsxs("div",{className:"flex flex-col border-l overflow-hidden",style:{width:320,flexShrink:0,borderColor:"rgba(255,255,255,0.08)",background:"rgba(0,0,0,0.4)"},children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2 border-b",style:{borderColor:"rgba(255,255,255,0.06)"},children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx(Dl,{variant:c,className:"text-[10px] shrink-0",children:e.type}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600 truncate",children:ct(new Date(e.timestamp),"HH:mm:ss.SSS")})]}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[i.jsx("button",{onClick:()=>a(f=>!f),className:"font-mono text-[9px] px-1.5 py-0.5 rounded",style:n?{background:`${l.info}22`,color:l.info,border:`1px solid ${l.info}44`}:{color:"#52525b",border:"1px solid rgba(255,255,255,0.06)"},children:n?"Fields":"Raw"}),i.jsx("button",{onClick:t,className:"ml-1 text-zinc-600 hover:text-zinc-400 text-sm leading-none px-1",children:"✕"})]})]}),i.jsxs("div",{className:"flex shrink-0 gap-3 px-3 py-1.5 border-b",style:{borderColor:"rgba(255,255,255,0.04)"},children:[i.jsxs("span",{className:"font-mono text-[10px] text-zinc-600",children:["src: ",i.jsx("span",{className:"text-zinc-400",children:e.source})]}),o&&i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"font-mono text-[10px]",style:{color:l.info},children:[o.tokens.toLocaleString(),"t"]}),o.costUsd>0&&i.jsxs("span",{className:"font-mono text-[10px]",style:{color:l.running},children:["$",o.costUsd.toFixed(6)]})]}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-700 truncate",children:e.id.slice(0,16)})]}),i.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:n?i.jsx("pre",{className:"font-mono text-[10px] text-zinc-300 whitespace-pre-wrap break-all",children:JSON.stringify(e.payload,null,2)}):i.jsxs("div",{className:"space-y-3",children:[u.map((f,h)=>i.jsx(Sx,{label:f.label,value:f.value,color:f.color},h)),u.length===0&&i.jsx("span",{className:"text-[11px] text-zinc-600 font-mono",children:"No fields"})]})})]})}function hr(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),l=Math.floor(e%6e4/1e3);return l>0?`${t}m ${l}s`:`${t}m`}function zx({event:e,isSelected:t,onSelect:l}){const n=y0(e.type),a=jx(e),s=O(),c=g0(e),o=e.type==="tool.call"?e.payload.status:void 0,u=o==="error"?s.error:o==="complete"?s.running:o==="pending"?s.warn:null;return i.jsx("div",{className:me("border-b cursor-pointer transition-colors duration-100",t?"bg-white/[0.04]":"hover:bg-white/[0.02]"),style:{borderColor:"rgba(255,255,255,0.04)"},onClick:l,children:i.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",children:[i.jsx("span",{className:"w-24 flex-shrink-0 font-mono text-[10px] text-zinc-500",children:ct(new Date(e.timestamp),"HH:mm:ss.SSS")}),i.jsx(Dl,{variant:n,className:"w-44 flex-shrink-0 truncate justify-center text-[10px]",children:e.type}),i.jsx("span",{className:"w-14 flex-shrink-0 font-mono text-[10px] text-zinc-600 truncate",children:e.source}),i.jsx("span",{className:"flex-1 truncate font-mono text-[11px] text-zinc-400",children:a}),o?i.jsx("span",{className:"w-16 flex-shrink-0 text-right font-mono text-[9px] px-1.5 py-0.5 rounded",style:{color:u??"#52525b",background:u?`${u}1A`:"transparent"},children:o}):i.jsx("span",{className:"w-16 flex-shrink-0 text-right font-mono text-[11px]",style:{color:c?s.info:"#3f3f46"},children:c?c.tokens.toLocaleString():"—"}),i.jsx("span",{className:"w-24 flex-shrink-0 text-right font-mono text-[11px]",style:{color:((c==null?void 0:c.costUsd)??0)>0?s.running:"#3f3f46"},children:((c==null?void 0:c.costUsd)??0)>0?`$${c.costUsd.toFixed(6)}`:"—"}),i.jsx("div",{className:"w-1 h-4 rounded-full flex-shrink-0",style:{background:t?s.info:"transparent"}})]})})}function Cx(){const{events:e}=at(),{activeSessionId:t}=ae(),l=O(),[n,a]=C.useState("all"),[s,c]=C.useState(""),[o,u]=C.useState(null),[f,h]=C.useState(!1),[p,m]=C.useState("stream"),y=C.useRef(null),g=C.useRef(e.length);C.useEffect(()=>{var x;f||e.length!==g.current&&(g.current=e.length,(x=y.current)==null||x.scrollTo({top:0}))},[e.length,f]);const j=C.useCallback(x=>{p==="stream"?(m("inspect"),u(x),h(!0)):(u(b=>(b==null?void 0:b.id)===x.id?null:x),h(!0))},[p]),v=C.useCallback(()=>{m("stream"),u(null),h(!1)},[]),r=Zi.find(x=>x.id===n)??Zi[0],d=e.filter(x=>{if(t&&x.sessionId!==t||!r.match(x.type))return!1;if(s){const b=s.toLowerCase();if(!x.type.includes(b)&&!JSON.stringify(x.payload).toLowerCase().includes(b))return!1}return!0});return i.jsxs("div",{className:"flex h-full overflow-hidden",children:[i.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2 border-b px-4 py-2 flex-wrap",style:{borderColor:"rgba(255,255,255,0.07)",background:l.toolbarBg},children:[i.jsx("div",{className:"flex items-center gap-0.5 rounded border p-0.5 mr-1",style:{borderColor:"rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.03)"},children:["stream","inspect"].map(x=>i.jsx("button",{onClick:()=>x==="stream"?v():m("inspect"),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors capitalize",style:p===x?{background:"rgba(255,255,255,0.10)",color:"#d4d4d8"}:{color:"#52525b"},children:x==="stream"?"⏵ Stream":"⊞ Inspect"},x))}),i.jsx("div",{className:"h-4 w-px",style:{background:"rgba(255,255,255,0.08)"}}),Zi.map(x=>i.jsx("button",{onClick:()=>a(x.id),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors",style:n===x.id?{background:`${l.info}22`,color:l.info,border:`1px solid ${l.info}44`}:{color:"#71717a",border:"1px solid transparent"},children:x.label},x.id)),i.jsx("div",{className:"h-4 w-px mx-1",style:{background:"rgba(255,255,255,0.08)"}}),i.jsx("input",{type:"text",placeholder:"search…",value:s,onChange:x=>c(x.target.value),className:"h-6 rounded border bg-transparent px-2 text-[11px] font-mono text-zinc-300 placeholder-zinc-700 outline-none focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.08)",width:130}}),s&&i.jsx("button",{onClick:()=>c(""),className:"font-mono text-[10px] text-zinc-600 hover:text-zinc-400",children:"✕"}),i.jsx("div",{className:"flex-1"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:d.length}),i.jsx("button",{onClick:()=>{h(x=>!x),f&&u(null)},className:"h-6 rounded border px-2 text-[10px] font-mono transition-colors",style:f?{borderColor:`${l.warn}44`,background:`${l.warn}1A`,color:l.warn}:{borderColor:"rgba(255,255,255,0.08)",color:"#71717a"},children:f?"▶ Resume":"⏸ Pause"})]}),i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-1",style:{borderColor:"rgba(255,255,255,0.04)",background:"rgba(0,0,0,0.25)"},children:[i.jsx("span",{className:"w-24 flex-shrink-0 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Time"}),i.jsx("span",{className:"w-44 flex-shrink-0 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Type"}),i.jsx("span",{className:"w-14 flex-shrink-0 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Src"}),i.jsx("span",{className:"flex-1 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Payload"}),i.jsx("span",{className:"w-20 flex-shrink-0 text-right text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Tokens"}),i.jsx("span",{className:"w-24 flex-shrink-0 text-right text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"Cost"}),i.jsx("div",{className:"w-1"})]}),i.jsx("div",{ref:y,className:"flex-1 overflow-y-auto",onMouseEnter:()=>{!o&&p==="stream"&&h(!0)},onMouseLeave:()=>{!o&&p==="stream"&&h(!1)},children:d.length===0?i.jsx(Ve,{icon:i.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),title:"No events",description:n==="all"?"Events will appear here as your agents run":`No ${n} events in this session`}):d.map(x=>i.jsx(zx,{event:x,isSelected:(o==null?void 0:o.id)===x.id,onSelect:()=>j(x)},x.id))})]}),p==="inspect"&&o&&i.jsx(Nx,{event:o,onClose:()=>{u(null),h(!1)}})]})}function Tx(e){const t=[],l=new Map;for(const[a,s]of e.entries())l.set(a,{...s,children:[]});for(const a of l.values())if(a.parentId===null)t.push(a);else{const s=l.get(a.parentId);s?s.children.push(a):t.push(a)}const n=a=>{a.sort((s,c)=>s.spawnedAt-c.spawnedAt);for(const s of a)n(s.children)};return n(t),t}const be=cl((e,t)=>({agents:new Map,loopAlerts:[],upsertAgent:l=>{e(n=>{const a=new Map(n.agents),s=a.get(l.id);return s?a.set(l.id,{...s,...l,children:[]}):a.set(l.id,{...l,children:[]}),{agents:a}})},updateAgentStatus:(l,n,a)=>{e(s=>{const c=new Map(s.agents),o=c.get(l);return o?(c.set(l,{...o,status:n,...a!==void 0?{completedAt:a}:{}}),{agents:c}):{}})},incrementToolCallCount:l=>{e(n=>{const a=new Map(n.agents),s=a.get(l);return s?(a.set(l,{...s,toolCallCount:s.toolCallCount+1}),{agents:a}):{}})},addAgentLog:(l,n)=>{e(a=>{const s=new Map(a.agents),c=s.get(l);return c?(s.set(l,{...c,logs:[...c.logs,n]}),{agents:s}):{}})},addLoopAlert:l=>{e(n=>({loopAlerts:[l,...n.loopAlerts].slice(0,50)}))},dismissLoopAlert:l=>{e(n=>({loopAlerts:n.loopAlerts.filter(a=>a.id!==l)}))},getAgentTree:()=>Tx(t().agents),getAgent:l=>t().agents.get(l)}));function kx(e,t){switch(e){case"running":return t.running;case"waiting":return t.warn;case"failed":return t.error;case"completed":return"#52525b";default:return"#52525b"}}function Ax(e){switch(e){case"running":return"green";case"waiting":return"yellow";case"failed":return"red";case"completed":return"gray";default:return"gray"}}function wx(e,t){const l=t??Date.now();return jr(new Date(e),new Date(l),{addSuffix:!1})}function v0({agent:e,depth:t,isExpanded:l,isSelected:n,onToggle:a,onSelect:s}){const c=O(),o=e.children.length>0,u=e.logs.length>0,f=kx(e.status,c);return i.jsxs("div",{children:[i.jsxs("div",{className:me("group flex items-center gap-2 px-4 py-2.5 cursor-pointer transition-colors duration-100","border-b hover:bg-white/[0.02]",n?"bg-white/[0.03]":""),style:{paddingLeft:`${16+t*20}px`,borderColor:"rgba(255,255,255,0.05)"},onClick:()=>s(e.id),children:[o?i.jsx("button",{className:"flex-shrink-0 text-zinc-300 hover:text-zinc-400 w-4",onClick:h=>{h.stopPropagation(),a(e.id)},children:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:me("transition-transform",l?"rotate-90":""),children:i.jsx("polyline",{points:"9 18 15 12 9 6"})})}):i.jsx("span",{className:"w-4 flex-shrink-0"}),i.jsx("div",{className:"h-2 w-2 flex-shrink-0 rounded-full",style:{background:f,boxShadow:e.status==="running"?`0 0 6px ${f}`:"none"}}),i.jsx("span",{className:"flex-1 font-mono text-sm font-medium truncate",style:{color:e.status==="running"?c.running:"#a1a1aa"},children:e.name}),i.jsx(Dl,{variant:Ax(e.status),size:"xs",children:e.status}),i.jsx("span",{className:"w-20 text-right font-mono text-[11px] text-zinc-300",children:wx(e.spawnedAt,e.completedAt)}),i.jsxs("span",{className:"w-14 text-right font-mono text-[11px] text-zinc-300",children:[e.toolCallCount," calls"]}),u&&i.jsxs("span",{className:"text-[10px] font-mono text-zinc-700 ml-1",children:[e.logs.length," logs"]})]}),n&&e.logs.length>0&&i.jsxs("div",{className:"border-b px-4 py-3",style:{paddingLeft:`${16+t*20+24}px`,borderColor:"rgba(255,255,255,0.05)",background:"rgba(0,0,0,0.3)"},children:[i.jsx("p",{className:"mb-2 text-[10px] font-mono uppercase tracking-widest text-zinc-700",children:"Reasoning Trace"}),i.jsx("div",{className:"space-y-1.5",children:e.logs.map((h,p)=>i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"flex-shrink-0 font-mono text-[10px] text-zinc-700 mt-0.5 w-20",children:new Date(h.timestamp).toLocaleTimeString("en",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}),i.jsx("span",{className:"font-mono text-[11px]",style:{color:h.level==="info"?c.success:h.level==="warn"?c.warn:h.level==="error"?c.error:"#71717a"},children:h.message})]},p))})]}),o&&l&&i.jsx("div",{children:e.children.map(h=>i.jsx(Mx,{agent:h,depth:t+1,isSelected:n,onToggle:a,onSelect:s},h.id))})]})}function Mx({agent:e,depth:t,isSelected:l,onToggle:n,onSelect:a}){return i.jsx(v0,{agent:e,depth:t,isExpanded:!0,isSelected:l,onToggle:n,onSelect:a})}function Ex({alert:e,onDismiss:t}){const l=O();return i.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 text-sm border-b",style:{background:`${l.error}14`,borderColor:`${l.error}33`},children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:l.error,strokeWidth:"2",children:[i.jsx("path",{d:"M10.29 3.86L1.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"}),i.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),i.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),i.jsxs("span",{style:{color:l.error},className:"font-mono text-xs font-medium flex-1",children:["Loop detected — ",i.jsx("span",{className:"font-bold",children:e.agentName})," called"," ",i.jsx("span",{className:"font-bold",children:e.toolName})," ",e.loopCount,"× in a tight window"]}),i.jsx("button",{onClick:()=>t(e.id),className:"font-mono text-[11px] transition-colors",style:{color:`${l.error}99`},onMouseEnter:n=>n.currentTarget.style.color=l.error,onMouseLeave:n=>n.currentTarget.style.color=`${l.error}99`,children:"Dismiss"})]})}function Dx(){const{loopAlerts:e,dismissLoopAlert:t}=be(),l=be(j=>j.getAgentTree),{activeSessionId:n}=ae(),a=O(),[s,c]=C.useState(new Set),[o,u]=C.useState(null),f=l(),h=n?f.filter(j=>j.sessionId===n):f,p=n?e.filter(j=>{const v=be.getState().getAgent(j.agentId);return(v==null?void 0:v.sessionId)===n}):e,m=C.useCallback(j=>{c(v=>{const r=new Set(v);return r.has(j)?r.delete(j):r.add(j),r})},[]),y=C.useCallback(j=>{u(v=>v===j?null:j)},[]),g=Array.from(be.getState().agents.values()).filter(j=>j.status==="running").length;return i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.08)",background:a.toolbarBg},children:[i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"Agent Tree"}),g>0&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"h-1.5 w-1.5 rounded-full animate-pulse-slow",style:{background:a.running,boxShadow:`0 0 4px ${a.running}`}}),i.jsxs("span",{className:"font-mono text-[11px]",style:{color:a.running},children:[g," running"]})]}),i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[h.length," agents"]})]}),p.map(j=>i.jsx(Ex,{alert:j,onDismiss:t},j.id)),i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2 border-b px-4 py-1.5",style:{borderColor:"rgba(255,255,255,0.05)",background:"rgba(0,0,0,0.3)"},children:[i.jsx("span",{className:"flex-1 text-[10px] font-mono uppercase tracking-widest text-zinc-700",children:"Agent"}),i.jsx("span",{className:"w-20 text-right text-[10px] font-mono uppercase tracking-widest text-zinc-700",children:"Status"}),i.jsx("span",{className:"w-20 text-right text-[10px] font-mono uppercase tracking-widest text-zinc-700",children:"Duration"}),i.jsx("span",{className:"w-14 text-right text-[10px] font-mono uppercase tracking-widest text-zinc-700",children:"Calls"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:h.length===0?i.jsx(Ve,{icon:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("circle",{cx:"12",cy:"5",r:"2"}),i.jsx("circle",{cx:"5",cy:"19",r:"2"}),i.jsx("circle",{cx:"19",cy:"19",r:"2"}),i.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"13"}),i.jsx("line",{x1:"12",y1:"13",x2:"5",y2:"17"}),i.jsx("line",{x1:"12",y1:"13",x2:"19",y2:"17"})]}),title:"No agents yet",description:"Agent hierarchy will appear as your workflows run"}):h.map(j=>i.jsx(v0,{agent:j,depth:0,isExpanded:s.has(j.id),isSelected:o===j.id,onToggle:m,onSelect:y},j.id))})]})}const si=cl((e,t)=>({summaries:new Map,setSummary:(l,n)=>{e(a=>{const s=new Map(a.summaries);return s.set(l,n),{summaries:s}})},getSummary:l=>t().summaries.get(l)}));function ke({children:e,className:t,glass:l=!1,padding:n="md"}){const a={none:"",sm:"p-3",md:"p-4",lg:"p-6"};return i.jsx("div",{className:me("rounded-lg border","border-white/[0.08]",l?"bg-white/[0.03] backdrop-blur-sm":"bg-zinc-900/80",a[n],t),children:e})}function et({title:e,subtitle:t,actions:l,className:n}){return i.jsxs("div",{className:me("flex items-center justify-between",n),children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-xs font-mono uppercase tracking-widest text-zinc-500",children:e}),t&&i.jsx("p",{className:"mt-0.5 text-xs text-zinc-300",children:t})]}),l&&i.jsx("div",{className:"flex items-center gap-2",children:l})]})}function Ox(e){if(e.type==="cost.update"){const t=e.payload;return{agentId:t.agentId??"unknown",model:t.model??"unknown",inputTokens:t.inputTokens??0,outputTokens:t.outputTokens??0,cacheReadTokens:t.cacheReadTokens??0,cacheWriteTokens:t.cacheWriteTokens??0,costUsd:t.totalCostUsd??0,timestamp:e.timestamp,source:e.source}}if(e.type==="api.response"){const t=e.payload,l=t.costUsd??0;return l===0?null:{agentId:t.agentId??"unknown",model:t.model??"unknown",inputTokens:t.inputTokens??0,outputTokens:t.outputTokens??0,cacheReadTokens:t.cacheReadTokens??0,cacheWriteTokens:t.cacheWriteTokens??0,costUsd:l,timestamp:e.timestamp,source:e.source}}if(e.type==="api.stream.end"){const t=e.payload,l=t.costUsd??0;return l===0?null:{agentId:"stream",model:"streaming",inputTokens:t.inputTokens??0,outputTokens:t.outputTokens??0,cacheReadTokens:t.cacheReadTokens??0,cacheWriteTokens:t.cacheWriteTokens??0,costUsd:l,timestamp:e.timestamp,source:e.source}}return null}function pl({label:e,value:t,sub:l,accentColor:n}){return i.jsxs(ke,{glass:!0,className:"flex flex-col gap-1.5 flex-1 min-w-0",children:[i.jsx("span",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-300",children:e}),i.jsx("span",{className:"font-mono text-2xl font-semibold",style:{color:n},children:t}),l&&i.jsx("span",{className:"text-[11px] font-mono text-zinc-300",children:l})]})}function os({active:e,payload:t,label:l}){return!e||!(t!=null&&t.length)?null:i.jsxs("div",{className:"rounded border px-3 py-2 text-xs font-mono",style:{background:"#1a1a1e",borderColor:"rgba(255,255,255,0.12)"},children:[i.jsx("p",{className:"text-zinc-400 mb-1",children:l}),t.map((n,a)=>{var s;return i.jsxs("p",{style:{color:n.color},children:[n.name,": ",typeof n.value=="number"&&((s=n.name)!=null&&s.includes("$"))?`$${n.value.toFixed(4)}`:typeof n.value=="number"?n.value.toLocaleString():n.value]},a)})]})}function Ux(){var c,o;const{sessions:e}=ae(),t=si(u=>u.summaries),l=O(),n=C.useMemo(()=>e.filter(u=>u.totalCostUsd>0).sort((u,f)=>f.totalCostUsd-u.totalCostUsd).slice(0,20).map(u=>{const f=t.get(u.id);return{name:u.name,id:u.id,costUsd:u.totalCostUsd,inputTokens:(f==null?void 0:f.inputTokens)??0,outputTokens:(f==null?void 0:f.outputTokens)??0,cacheReadTokens:(f==null?void 0:f.cacheReadTokens)??0,turnCount:(f==null?void 0:f.turnCount)??0,cacheHitRate:(f==null?void 0:f.cacheHitRate)??0}}),[e,t]),a=n.reduce((u,f)=>u+f.costUsd,0),s=n.reduce((u,f)=>u+f.inputTokens+f.outputTokens,0);return n.length===0?i.jsx(Ve,{icon:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),i.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]}),title:"No cross-session cost data",description:"Sessions with cost data will appear here"}):i.jsxs("div",{className:"flex flex-col gap-4 p-4 overflow-y-auto",children:[i.jsxs("div",{className:"flex gap-3",children:[i.jsx(pl,{label:"Total Spend",value:`$${a.toFixed(4)}`,sub:`${n.length} sessions`,accentColor:l.running}),i.jsx(pl,{label:"Total Tokens",value:s>=1e6?`${(s/1e6).toFixed(2)}M`:`${(s/1e3).toFixed(1)}k`,sub:"input + output",accentColor:l.info}),i.jsx(pl,{label:"Most Expensive",value:`$${((c=n[0])==null?void 0:c.costUsd.toFixed(4))??"0"}`,sub:((o=n[0])==null?void 0:o.name)??"—",accentColor:l.warn})]}),i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Cost per Session (top 20)",className:"mb-3"}),i.jsx(Ln,{width:"100%",height:220,children:i.jsxs(us,{data:n,margin:{top:4,right:4,bottom:40,left:8},children:[i.jsx(qn,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),i.jsx(Yn,{dataKey:"name",tick:{fontSize:9,fontFamily:"JetBrains Mono, monospace",fill:"#52525b"},axisLine:!1,tickLine:!1,angle:-35,textAnchor:"end",interval:0}),i.jsx(Gn,{tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1,tickFormatter:u=>`$${u.toFixed(2)}`}),i.jsx(Xn,{content:({active:u,payload:f})=>{var p;if(!u||!(f!=null&&f.length))return null;const h=(p=f[0])==null?void 0:p.payload;return i.jsxs("div",{className:"rounded border px-3 py-2 text-xs font-mono",style:{background:"#1a1a1e",borderColor:"rgba(255,255,255,0.12)"},children:[i.jsx("p",{className:"text-zinc-300 font-semibold mb-1",children:h.name}),i.jsxs("p",{style:{color:l.running},children:["$",h.costUsd.toFixed(6)]}),h.turnCount>0&&i.jsxs("p",{className:"text-zinc-400",children:[h.turnCount," turns"]}),h.cacheHitRate>0&&i.jsxs("p",{style:{color:l.warn},children:[h.cacheHitRate,"% cache hit"]})]})},cursor:{fill:"rgba(255,255,255,0.04)"}}),i.jsx(Gt,{dataKey:"costUsd",radius:[3,3,0,0],children:n.map((u,f)=>i.jsx(br,{fill:l.chartColors[f%l.chartColors.length],fillOpacity:.8},f))})]})})]}),n.some(u=>u.inputTokens>0)&&i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Token Breakdown per Session",className:"mb-3"}),i.jsx(Ln,{width:"100%",height:180,children:i.jsxs(us,{data:n,margin:{top:4,right:4,bottom:40,left:8},children:[i.jsx(qn,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),i.jsx(Yn,{dataKey:"name",tick:{fontSize:9,fontFamily:"JetBrains Mono, monospace",fill:"#52525b"},axisLine:!1,tickLine:!1,angle:-35,textAnchor:"end",interval:0}),i.jsx(Gn,{tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1,tickFormatter:u=>u>=1e3?`${(u/1e3).toFixed(0)}k`:String(u)}),i.jsx(Xn,{content:i.jsx(os,{}),cursor:{fill:"rgba(255,255,255,0.04)"}}),i.jsx(Gt,{dataKey:"inputTokens",name:"Input",fill:l.info,fillOpacity:.8,stackId:"a"}),i.jsx(Gt,{dataKey:"outputTokens",name:"Output",fill:l.warn,fillOpacity:.8,stackId:"a"}),i.jsx(Gt,{dataKey:"cacheReadTokens",name:"Cache Read",fill:l.purple,fillOpacity:.8,stackId:"a",radius:[3,3,0,0]})]})})]})]})}function Bx(){var b;const{events:e}=at(),{agents:t}=be(),{activeSessionId:l}=ae(),n=O(),[a,s]=C.useState("session"),c=l?e.filter(S=>S.sessionId===l):e,o=C.useMemo(()=>c.map(S=>Ox(S)).filter(S=>S!==null).sort((S,k)=>S.timestamp-k.timestamp),[c]),u=C.useMemo(()=>{let S=null,k=0,z=0,A=0,T=0,M=0;for(const Z of o)Z.source==="hook"?(!S||Z.costUsd>S.costUsd)&&(S=Z):(k+=Z.costUsd,z+=Z.inputTokens,A+=Z.outputTokens,T+=Z.cacheReadTokens,M+=Z.cacheWriteTokens);return{costUsd:((S==null?void 0:S.costUsd)??0)+k,inputTokens:((S==null?void 0:S.inputTokens)??0)+z,outputTokens:((S==null?void 0:S.outputTokens)??0)+A,cacheReadTokens:((S==null?void 0:S.cacheReadTokens)??0)+T,cacheWriteTokens:((S==null?void 0:S.cacheWriteTokens)??0)+M}},[o]),f=C.useMemo(()=>{var k;const S=new Map;for(const z of o){const A=((k=t.get(z.agentId))==null?void 0:k.name)??z.agentId.slice(0,8),T=S.get(z.agentId);z.source==="hook"?(!T||z.costUsd>T.costUsd)&&S.set(z.agentId,{agentId:z.agentId,name:A,costUsd:z.costUsd}):T?T.costUsd+=z.costUsd:S.set(z.agentId,{agentId:z.agentId,name:A,costUsd:z.costUsd})}return Array.from(S.values()).sort((z,A)=>A.costUsd-z.costUsd)},[o,t]),h=C.useMemo(()=>{let S=0;return o.map(k=>(k.source==="hook"?S=k.costUsd:S+=k.costUsd,{timestamp:k.timestamp,time:ct(new Date(k.timestamp),"HH:mm:ss"),costUsd:S}))},[o]),p=C.useMemo(()=>{const S=new Map,k=new Map;for(const A of o){const T=A.model.replace("claude-","").replace("-20","-");if(A.source==="hook"){const M=S.get(A.model);(!M||A.costUsd>M.costUsd)&&S.set(A.model,A)}else{const M=k.get(A.model);M?(M.inputTokens+=A.inputTokens,M.outputTokens+=A.outputTokens,M.cacheReadTokens+=A.cacheReadTokens):k.set(A.model,{model:T,inputTokens:A.inputTokens,outputTokens:A.outputTokens,cacheReadTokens:A.cacheReadTokens})}}const z=new Map;for(const[A,T]of S){const M=T.model.replace("claude-","").replace("-20","-");z.set(A,{model:M,inputTokens:T.inputTokens,outputTokens:T.outputTokens,cacheReadTokens:T.cacheReadTokens})}for(const[A,T]of k){const M=z.get(A);M?(M.inputTokens+=T.inputTokens,M.outputTokens+=T.outputTokens,M.cacheReadTokens+=T.cacheReadTokens):z.set(A,T)}return Array.from(z.values())},[o]),m=2e5,y=((b=[...o].reverse().find(S=>S.inputTokens>0))==null?void 0:b.inputTokens)??0,g=Math.min(y/m*100,100),j=g>80?n.error:g>60?n.warn:n.success,v=l?/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(l):!1,r=c.length,d=S=>S?{background:`${n.info}22`,color:n.info,border:`1px solid ${n.info}44`}:{color:"#52525b",border:"1px solid transparent"},x=o.length===0?i.jsxs("div",{className:"flex flex-col min-h-0",children:[i.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[v&&i.jsxs("div",{className:"rounded-lg border px-4 py-3 text-[12px] font-mono",style:{borderColor:`${n.warn}33`,background:`${n.warn}0D`,color:n.warn},children:[i.jsx("p",{className:"font-semibold mb-1",children:"Hook session — no API cost data"}),i.jsxs("p",{className:"text-[11px] opacity-80",children:["Claude Code hook sessions (",l==null?void 0:l.slice(0,8),"…) don't capture Anthropic API calls. Select a session with a ULID ID (e.g. 01KN…) from the header dropdown to see cost data."]})]}),!v&&r>0&&i.jsxs("div",{className:"rounded-lg border px-4 py-3 text-[12px] font-mono",style:{borderColor:`${n.info}33`,background:`${n.info}0D`,color:n.info},children:[i.jsxs("p",{className:"font-semibold mb-1",children:["SDK session — ",r," events, no cost events yet"]}),i.jsx("p",{className:"text-[11px] opacity-80",children:"Events are loaded but none are cost.update or api.response type yet. Make API calls through a prism()-wrapped client."})]}),!v&&r===0&&i.jsxs("div",{className:"rounded-lg border px-4 py-3 text-[12px] font-mono",style:{borderColor:"rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.03)",color:"#71717a"},children:[i.jsx("p",{className:"font-semibold mb-1",children:"No events loaded for this session"}),i.jsx("p",{className:"text-[11px] opacity-80",children:"The session snapshot may not have loaded yet. Try switching away and back, or check that the collector is running."})]})]}),i.jsx(Ve,{icon:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),i.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]}),title:"No cost data for this session",description:"Use the session dropdown (top) to switch to an SDK session (01KN… ULID format), or switch to Portfolio view."})]}):i.jsxs("div",{className:"flex flex-col gap-4 p-4 overflow-y-auto",children:[i.jsxs("div",{className:"flex gap-3",children:[i.jsx(pl,{label:"Total Cost",value:`$${u.costUsd.toFixed(4)}`,sub:"USD",accentColor:n.running}),i.jsx(pl,{label:"Input Tokens",value:u.inputTokens.toLocaleString(),sub:"prompt tokens",accentColor:n.info}),i.jsx(pl,{label:"Output Tokens",value:u.outputTokens.toLocaleString(),sub:"completion tokens",accentColor:n.warn}),i.jsx(pl,{label:"Cache Tokens",value:(u.cacheReadTokens+u.cacheWriteTokens).toLocaleString(),sub:`${u.cacheReadTokens.toLocaleString()} read / ${u.cacheWriteTokens.toLocaleString()} write`,accentColor:n.purple})]}),i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Context Window Utilization",className:"mb-2"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex-1 h-3 rounded-full overflow-hidden",style:{background:"rgba(255,255,255,0.06)"},children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${g}%`,background:j,boxShadow:`0 0 8px ${j}`}})}),i.jsxs("span",{className:"font-mono text-xs text-zinc-400 w-16 text-right",children:[g.toFixed(1),"%"]}),i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[y.toLocaleString()," / ",m.toLocaleString()]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Cost per Agent",className:"mb-3"}),i.jsx(Ln,{width:"100%",height:200,children:i.jsxs(us,{data:f,margin:{top:4,right:4,bottom:4,left:4},children:[i.jsx(qn,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),i.jsx(Yn,{dataKey:"name",tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1}),i.jsx(Gn,{tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1,tickFormatter:S=>`$${S.toFixed(3)}`}),i.jsx(Xn,{content:i.jsx(os,{}),cursor:{fill:"rgba(255,255,255,0.04)"}}),i.jsx(Gt,{dataKey:"costUsd",name:"Cost $",radius:[3,3,0,0],children:f.map((S,k)=>i.jsx(br,{fill:n.chartColors[k%n.chartColors.length],fillOpacity:.8},k))})]})})]}),i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Cumulative Cost Over Time",className:"mb-3"}),i.jsx(Ln,{width:"100%",height:200,children:i.jsxs(z0,{data:h,margin:{top:4,right:4,bottom:4,left:4},children:[i.jsx(qn,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),i.jsx(Yn,{dataKey:"time",tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1}),i.jsx(Gn,{tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1,tickFormatter:S=>`$${S.toFixed(3)}`}),i.jsx(Xn,{content:i.jsx(os,{})}),i.jsx(C0,{type:"monotone",dataKey:"costUsd",name:"Cumulative $",stroke:n.running,strokeWidth:2,dot:!1,activeDot:{r:4,fill:n.running}})]})})]})]}),p.length>0&&i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Token Breakdown by Model",className:"mb-3"}),i.jsx(Ln,{width:"100%",height:180,children:i.jsxs(us,{data:p,margin:{top:4,right:4,bottom:4,left:4},children:[i.jsx(qn,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),i.jsx(Yn,{dataKey:"model",tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1}),i.jsx(Gn,{tick:{fontSize:10,fontFamily:"JetBrains Mono, monospace",fill:"#71717a"},axisLine:!1,tickLine:!1,tickFormatter:S=>S>=1e3?`${(S/1e3).toFixed(0)}k`:String(S)}),i.jsx(Xn,{content:i.jsx(os,{}),cursor:{fill:"rgba(255,255,255,0.04)"}}),i.jsx(Gt,{dataKey:"inputTokens",name:"Input",fill:n.info,fillOpacity:.8,stackId:"a",radius:[0,0,0,0]}),i.jsx(Gt,{dataKey:"outputTokens",name:"Output",fill:n.warn,fillOpacity:.8,stackId:"a"}),i.jsx(Gt,{dataKey:"cacheReadTokens",name:"Cache Read",fill:n.purple,fillOpacity:.8,stackId:"a",radius:[3,3,0,0]})]})})]})]});return i.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.08)",background:n.toolbarBg},children:[i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"Cost Analytics"}),a==="session"&&o.length>0&&i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[o.length," API calls"]}),i.jsx("div",{className:"flex-1"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:"view:"}),i.jsx("button",{onClick:()=>s("session"),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors",style:d(a==="session"),children:"Session"}),i.jsx("button",{onClick:()=>s("portfolio"),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors",style:d(a==="portfolio"),children:"Portfolio"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:a==="portfolio"?i.jsx(Ux,{}):x})]})}const Xo=cl((e,t)=>({checkpoints:[],selectedCheckpointId:null,addCheckpoint:l=>{e(n=>{const a=n.checkpoints.findIndex(s=>s.id===l.id);if(a>=0){const s=[...n.checkpoints];return s[a]=l,{checkpoints:s}}return{checkpoints:[l,...n.checkpoints]}})},selectCheckpoint:l=>{e({selectedCheckpointId:l})},getCheckpoint:l=>t().checkpoints.find(n=>n.id===l),getCheckpointsBySession:l=>t().checkpoints.filter(n=>n.sessionId===l).sort((n,a)=>n.timestamp-a.timestamp),getPreviousCheckpoint:l=>{const n=t().checkpoints.find(c=>c.id===l);if(!n)return;const a=t().checkpoints.filter(c=>c.sessionId===n.sessionId&&c.agentId===n.agentId).sort((c,o)=>c.timestamp-o.timestamp),s=a.findIndex(c=>c.id===l);return s>0?a[s-1]:void 0}}));function Rx(e,t){const l=e.split(`
|
|
36
36
|
`),n=t.split(`
|
|
37
|
-
`),a=[],s=new Set(l),c=new Set(n);for(const o of l)c.has(o)||a.push({type:"removed",content:o});for(const o of n)s.has(o)?a.push({type:"unchanged",content:o}):a.push({type:"added",content:o});return a.slice(0,50)}function
|
|
38
|
-
…`:c.content})]},o)})}),n==="diff"&&t&&i.jsx("div",{className:"space-y-3",children:i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"State Diff",className:"mb-2"}),i.jsx("div",{className:"font-mono text-[11px]",children:Hx(JSON.stringify(t.agentState,null,2),JSON.stringify(e.agentState,null,2)).map((c,o)=>i.jsxs("div",{className:"px-2 py-0.5",style:{background:c.type==="added"?`${l.success}0D`:c.type==="removed"?`${l.error}0D`:"transparent",color:c.type==="added"?l.success:c.type==="removed"?l.error:"#52525b"},children:[i.jsx("span",{className:"select-none mr-2",children:c.type==="added"?"+":c.type==="removed"?"-":" "}),c.content]},o))})]})})]})]})}function qx(){const{checkpoints:e,selectedCheckpointId:t,selectCheckpoint:l,getPreviousCheckpoint:n}=Xo(),{activeSessionId:a}=ae(),s=O(),c=a?e.filter(f=>f.sessionId===a).sort((f,h)=>h.timestamp-f.timestamp):[...e].sort((f,h)=>h.timestamp-f.timestamp),o=t?e.find(f=>f.id===t):null,u=t?n(t):void 0;return i.jsxs("div",{className:"flex h-full",children:[i.jsxs("div",{className:"flex w-72 flex-shrink-0 flex-col border-r",style:{borderColor:"rgba(255,255,255,0.08)"},children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.08)",background:s.toolbarBg},children:[i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"Checkpoints"}),i.jsx("span",{className:"font-mono text-[11px] text-zinc-300",children:c.length})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:c.length===0?i.jsx(Ve,{icon:i.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),title:"No checkpoints yet",description:"Use ctx.checkpoint() in your agent to create checkpoints"}):c.map(f=>i.jsx(_x,{checkpoint:f,isSelected:t===f.id,onSelect:()=>l(f.id)},f.id))})]}),i.jsx("div",{className:"flex-1 overflow-hidden",children:o?i.jsx(Lx,{checkpoint:o,prevCheckpoint:u}):i.jsx(Ve,{title:"Select a checkpoint",description:"Click a checkpoint on the left to inspect it"})})]})}const Yl=cl((e,t)=>({servers:new Map,callRecords:[],upsertServer:l=>{e(n=>{const a=new Map(n.servers);return a.set(l.id,l),{servers:a}})},setServerStatus:(l,n)=>{e(a=>{const s=new Map(a.servers),c=s.get(l);return c?(s.set(l,{...c,status:n}),{servers:s}):{}})},updateHeartbeat:(l,n)=>{e(a=>{const s=new Map(a.servers),c=s.get(l);return c?(s.set(l,{...c,lastHeartbeat:n}),{servers:s}):{}})},addCallRecord:l=>{e(n=>({callRecords:[l,...n.callRecords].slice(0,500)})),e(n=>{const a=new Map(n.servers),s=a.get(l.serverId);return s?(a.set(l.serverId,{...s,callCount:s.callCount+1}),{servers:a}):{}})},updateCallRecord:(l,n)=>{e(a=>{const s=a.callRecords.findIndex(u=>u.callId===l);if(s<0)return{};const c=[...a.callRecords],o=c[s];if(!o)return{};if(c[s]={...o,...n},n.isError&&n.serverId){const u=new Map(a.servers),f=u.get(n.serverId);if(f)return u.set(n.serverId,{...f,errorCount:f.errorCount+1}),{callRecords:c,servers:u}}return{callRecords:c}})},getServerList:()=>Array.from(t().servers.values()),getAllTools:()=>{const l=[];for(const n of t().servers.values())for(const a of n.tools)l.push({...a,serverName:n.name,serverId:n.id});return l}}));function Yx({server:e,isSelected:t,onSelect:l}){const n=O(),a=e.status==="connected";return i.jsxs("button",{onClick:l,className:"w-full text-left rounded-lg border p-3 transition-all duration-150",style:t?{borderColor:`${n.running}4D`,background:`${n.running}0D`}:{borderColor:"rgba(255,255,255,0.08)",background:"rgba(24,24,27,0.8)"},children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"h-2 w-2 rounded-full flex-shrink-0",style:{background:a?n.success:"#52525b",boxShadow:a?`0 0 6px ${n.success}`:"none"}}),i.jsx("span",{className:"font-mono text-sm font-medium text-zinc-300 truncate flex-1",children:e.name}),i.jsx(Dl,{variant:a?"green":"gray",size:"xs",children:e.status})]}),i.jsxs("div",{className:"flex items-center gap-3 text-[11px] font-mono text-zinc-300",children:[i.jsxs("span",{children:[e.tools.length," tools"]}),i.jsx("span",{children:"·"}),i.jsxs("span",{children:[e.callCount," calls"]}),e.errorCount>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"·"}),i.jsxs("span",{style:{color:n.error},children:[e.errorCount," errors"]})]}),e.lastHeartbeat&&i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"·"}),i.jsx("span",{children:T0(new Date(e.lastHeartbeat),{addSuffix:!0})})]})]})]})}function Gx({tools:e}){const t=O(),[l,n]=C.useState(""),[a,s]=C.useState(null),c=e.filter(o=>o.name.toLowerCase().includes(l.toLowerCase())||o.description.toLowerCase().includes(l.toLowerCase()));return i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"text",placeholder:"Search tools…",value:l,onChange:o=>n(o.target.value),className:"h-7 flex-1 rounded border bg-zinc-900/80 px-2.5 text-[11px] font-mono text-zinc-300 placeholder-zinc-700",style:{borderColor:"rgba(255,255,255,0.10)",outline:"none"}}),i.jsxs("span",{className:"text-[11px] font-mono text-zinc-300",children:[c.length," tools"]})]}),i.jsxs("div",{className:"space-y-1",children:[c.map(o=>{const u=`${o.serverId}:${o.name}`,f=a===u;return i.jsxs("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"rgba(255,255,255,0.07)"},children:[i.jsxs("button",{onClick:()=>s(f?null:u),className:"w-full flex items-center gap-3 px-3 py-2 hover:bg-white/[0.02] text-left transition-colors",children:[i.jsx("span",{className:"font-mono text-xs font-medium",style:{color:t.purple},children:o.name}),i.jsx("span",{className:"flex-1 truncate text-[11px] font-mono text-zinc-300",children:o.description}),i.jsx(Dl,{variant:"gray",size:"xs",children:o.serverName}),i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:me("text-zinc-700 transition-transform",f?"rotate-90":""),children:i.jsx("polyline",{points:"9 18 15 12 9 6"})})]}),f&&i.jsx("div",{className:"px-3 pb-3",children:i.jsx("pre",{className:"rounded-md p-2 text-[10px] font-mono text-zinc-400 overflow-x-auto",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.05)"},children:JSON.stringify(o.inputSchema,null,2)})})]},u)}),c.length===0&&l&&i.jsxs("p",{className:"text-center py-4 text-xs font-mono text-zinc-300",children:['No tools matching "',l,'"']})]})]})}function Xx({record:e}){const t=O(),[l,n]=C.useState(!1),a=e.status==="completed"?t.success:e.status==="error"?t.error:t.warn;return i.jsxs("div",{className:"border-b cursor-pointer hover:bg-white/[0.01] transition-colors",style:{borderColor:"rgba(255,255,255,0.05)"},onClick:()=>n(s=>!s),children:[i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[i.jsx("div",{className:"h-1.5 w-1.5 rounded-full flex-shrink-0",style:{background:a}}),i.jsx("span",{className:"font-mono text-[11px]",style:{color:t.purple},children:e.toolName}),i.jsx("span",{className:"text-[10px] font-mono text-zinc-300",children:e.serverName}),i.jsx("span",{className:"flex-1"}),e.durationMs!==void 0&&i.jsxs("span",{className:"font-mono text-[10px] text-zinc-300",children:[e.durationMs,"ms"]}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-700",children:new Date(e.timestamp).toLocaleTimeString("en",{hour12:!1})}),i.jsx(Dl,{variant:e.status==="completed"?"green":e.status==="error"?"red":"yellow",size:"xs",children:e.status})]}),l&&i.jsxs("div",{className:"px-3 pb-3 space-y-2",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-700 mb-1",children:"Input"}),i.jsx("pre",{className:"rounded p-2 text-[10px] font-mono text-zinc-400 overflow-x-auto",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.05)"},children:JSON.stringify(e.input,null,2)})]}),e.output!==void 0&&i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-700 mb-1",children:"Output"}),i.jsx("pre",{className:"rounded p-2 text-[10px] font-mono text-zinc-400 overflow-x-auto max-h-40",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.05)"},children:JSON.stringify(e.output,null,2)})]})]})]})}function Qx(){const{servers:e,callRecords:t,getServerList:l,getAllTools:n}=Yl(),a=O(),[s,c]=C.useState(null),o=l(),u=n(),f=s?t.filter(p=>p.serverId===s):t,h=t.length>0?(t.filter(p=>p.status==="error").length/t.length*100).toFixed(1):"0.0";return o.length===0?i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsx("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.08)",background:a.toolbarBg},children:i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"MCP Monitor"})}),i.jsx(Ve,{icon:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),i.jsx("polyline",{points:"15 3 21 3 21 9"}),i.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),title:"No MCP servers connected",description:"MCP server data will appear when agents use tool servers"})]}):i.jsxs("div",{className:"flex h-full overflow-hidden",children:[i.jsxs("div",{className:"flex w-72 flex-shrink-0 flex-col border-r overflow-y-auto",style:{borderColor:"rgba(255,255,255,0.08)"},children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.08)",background:a.toolbarBg},children:[i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"MCP Monitor"}),i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[o.filter(p=>p.status==="connected").length,"/",o.length," online"]})]}),i.jsx("div",{className:"p-3 space-y-2",children:i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-700 mb-1",children:"Total Calls"}),i.jsx("p",{className:"font-mono text-lg font-semibold",style:{color:a.info},children:t.length})]}),i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-700 mb-1",children:"Error Rate"}),i.jsxs("p",{className:"font-mono text-lg font-semibold",style:{color:parseFloat(h)>5?a.error:a.success},children:[h,"%"]})]})]})}),i.jsxs("div",{className:"px-3 pb-3 space-y-2",children:[i.jsx("button",{onClick:()=>c(null),className:"w-full text-left rounded-md border px-3 py-2 text-xs font-mono transition-colors",style:s===null?{borderColor:`${a.running}4D`,background:`${a.running}0D`,color:a.running}:{borderColor:"rgba(255,255,255,0.08)",color:"#52525b"},children:"All Servers"}),o.map(p=>i.jsx(Yx,{server:p,isSelected:s===p.id,onSelect:()=>c(s===p.id?null:p.id)},p.id))]})]}),i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsx("div",{className:"flex-1 overflow-y-auto border-b p-4",style:{borderColor:"rgba(255,255,255,0.08)"},children:i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Tool Registry",className:"mb-3"}),i.jsx(Gx,{tools:s?u.filter(p=>p.serverId===s):u})]})}),i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b flex-shrink-0",style:{borderColor:"rgba(255,255,255,0.08)",background:a.toolbarBg},children:[i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"Call Trace"}),i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[f.length," calls"]})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:f.length===0?i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx("p",{className:"text-xs font-mono text-zinc-300",children:"No calls yet"})}):f.map(p=>i.jsx(Xx,{record:p},p.id))})]})]})]})}function Zc(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),l=Math.floor(e%6e4/1e3);return l>0?`${t}m ${l}s`:`${t}m`}function en(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Zx({data:e,color:t}){const l=[{label:"Turns",value:String(e.turnCount)},{label:"Total Duration",value:Zc(e.totalDurationMs)},{label:"Avg Turn",value:Zc(e.avgTurnDurationMs)},{label:"Stop Reason",value:e.stopReason.replace("_"," ")},{label:"Model",value:e.model.replace("claude-","cl-")},{label:"Total Cost",value:`$${e.totalCostUsd.toFixed(8)}`},{label:"Input Tokens",value:en(e.inputTokens)},{label:"Output Tokens",value:en(e.outputTokens)},{label:"Cache Writes",value:en(e.cacheWriteTokens)},{label:"Cache Reads",value:en(e.cacheReadTokens)},{label:"Cache Saved",value:`$${e.cacheSavedUsd.toFixed(6)}`},{label:"Cache Hit Rate",value:`${e.cacheHitRate}%`}];return i.jsx("div",{className:"grid grid-cols-3 gap-2",children:l.map(({label:n,value:a})=>i.jsxs("div",{className:"rounded-md border px-3 py-2",style:{borderColor:"rgba(255,255,255,0.06)",background:"rgba(0,0,0,0.3)"},children:[i.jsx("div",{className:"text-[9px] font-mono uppercase tracking-widest text-zinc-600",children:n}),i.jsx("div",{className:"mt-0.5 font-mono text-xs font-semibold",style:{color:t},children:a})]},n))})}function Vx({toolBreakdown:e,topTools:t}){var s;const l=O(),n=t.length>0?t:Object.entries(e).sort((c,o)=>o[1]-c[1]).slice(0,10).map(([c,o])=>({name:c,count:o}));if(n.length===0)return i.jsx("div",{className:"text-xs text-zinc-600",children:"No tool calls recorded"});const a=((s=n[0])==null?void 0:s.count)??1;return i.jsx("div",{className:"space-y-1.5",children:n.map(({name:c,count:o})=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-24 shrink-0 truncate font-mono text-[11px] text-zinc-400",children:c}),i.jsxs("div",{className:"relative flex-1 h-4 rounded overflow-hidden",style:{background:"rgba(255,255,255,0.04)"},children:[i.jsx("div",{className:"absolute inset-y-0 left-0 rounded",style:{width:`${o/a*100}%`,background:`${l.info}44`}}),i.jsx("div",{className:"absolute inset-0 flex items-center px-1.5",style:{background:"transparent"},children:i.jsx("span",{className:"font-mono text-[10px]",style:{color:l.info},children:o})})]})]},c))})}function Jx({files:e}){const t=O();return e.length===0?i.jsx("div",{className:"text-xs text-zinc-600",children:"No files recorded"}):i.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:e.map((l,n)=>{const a=l.split("/"),s=a[a.length-1]??l,c=a.slice(0,-1).join("/");return i.jsxs("div",{className:"flex items-baseline gap-1.5 font-mono text-[11px]",children:[i.jsx("span",{style:{color:t.running},children:s}),c&&i.jsx("span",{className:"text-zinc-600 truncate",children:c})]},n)})})}function Kx(){const e=O(),{events:t}=at(),{activeSessionId:l}=ae(),n=C.useMemo(()=>{const s=(l?t.filter(c=>c.sessionId===l):t).find(c=>c.type==="session.summary");return s?s.payload:null},[t,l]);return n?i.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.06)"},children:[i.jsx("span",{className:"text-xs font-mono uppercase tracking-widest text-zinc-500",children:"Session Intelligence"}),i.jsxs("span",{className:"font-mono text-[10px]",style:{color:e.running},children:[n.turnCount," turns · ",Zc(n.totalDurationMs)]})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[i.jsxs(ke,{padding:"sm",children:[i.jsx(et,{title:"Session Stats",className:"mb-3"}),i.jsx(Zx,{data:n,color:e.running})]}),i.jsxs(ke,{padding:"sm",children:[i.jsx(et,{title:"Tool Breakdown",subtitle:`${Object.values(n.toolBreakdown).reduce((a,s)=>a+s,0)} total calls`,className:"mb-3"}),i.jsx(Vx,{toolBreakdown:n.toolBreakdown,topTools:n.topTools})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs(ke,{padding:"sm",children:[i.jsx(et,{title:"Files Touched",subtitle:`${n.filesModified.length} file${n.filesModified.length!==1?"s":""}`,className:"mb-3"}),i.jsx(Jx,{files:n.filesModified})]}),i.jsxs(ke,{padding:"sm",children:[i.jsx(et,{title:"Cache Efficiency",className:"mb-3"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("span",{className:"text-[10px] font-mono text-zinc-600",children:"Hit Rate"}),i.jsxs("span",{className:"text-[10px] font-mono",style:{color:e.running},children:[n.cacheHitRate,"%"]})]}),i.jsx("div",{className:"h-2 rounded overflow-hidden",style:{background:"rgba(255,255,255,0.06)"},children:i.jsx("div",{className:"h-full rounded transition-all",style:{width:`${n.cacheHitRate}%`,background:e.running}})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-zinc-600",children:"Reads"}),i.jsx("div",{style:{color:e.info},children:en(n.cacheReadTokens)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-zinc-600",children:"Writes"}),i.jsx("div",{style:{color:e.warn},children:en(n.cacheWriteTokens)})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx("div",{className:"text-zinc-600",children:"Saved"}),i.jsxs("div",{style:{color:e.running},children:["$",n.cacheSavedUsd.toFixed(6)]})]})]})]})]})]})]})]}):i.jsx(Ve,{icon:i.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),i.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),title:"No Session Summary Yet",description:"Session intelligence is generated when a Claude Code session ends (Stop hook). Start and complete a Claude Code session to see analytics here."})}function $x({cmd:e,index:t}){const l=O(),[n,a]=C.useState(!1),s=e.exitCode===0||e.exitCode===null,c=e.exitCode===null?"#52525b":e.exitCode===0?l.running:l.error,o=e.command.split(`
|
|
39
|
-
`),u=o[0]??"",f=o.length>1,h=n?e.command:u;return i.jsx("div",{className:"border-b transition-colors duration-100 hover:bg-white/[0.02]",style:{borderColor:"rgba(255,255,255,0.05)"},children:i.jsxs("div",{className:"flex items-start gap-3 px-4 py-2 cursor-pointer",onClick:()=>f&&a(p=>!p),children:[i.jsx("span",{className:"shrink-0 mt-0.5 w-6 text-right font-mono text-[10px] text-zinc-700 select-none",children:t+1}),i.jsx("div",{className:"shrink-0 mt-0.5 w-6 h-4 rounded text-[9px] font-mono font-bold flex items-center justify-center",style:{background:`${c}22`,color:c,border:`1px solid ${c}44`},children:e.exitCode??"?"}),i.jsxs("pre",{className:"flex-1 font-mono text-[11px] whitespace-pre-wrap break-all leading-relaxed",style:{color:s?"#d4d4d8":l.error},children:[h,f&&!n&&i.jsxs("span",{className:"ml-1 text-zinc-600 text-[10px]",children:["…",o.length-1," more line",o.length>2?"s":""]})]}),e.durationMs!==void 0&&i.jsx("span",{className:"shrink-0 font-mono text-[10px] text-zinc-600 mt-0.5",children:e.durationMs<1e3?`${e.durationMs}ms`:`${(e.durationMs/1e3).toFixed(1)}s`})]})})}function Fx(){const e=O(),{events:t}=at(),{activeSessionId:l}=ae(),[n,a]=C.useState(""),[s,c]=C.useState(!1),o=C.useMemo(()=>{const p=(l?t.filter(y=>y.sessionId===l):t).find(y=>y.type==="session.summary");return p?p.payload.bashCommands??[]:[]},[t,l]),u=C.useMemo(()=>o.filter(h=>!(s&&h.exitCode!==null&&h.exitCode===0||n&&!h.command.toLowerCase().includes(n.toLowerCase()))),[o,n,s]),f=o.filter(h=>h.exitCode!==null&&h.exitCode!==0).length;return o.length===0?i.jsx(Ve,{icon:i.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polyline",{points:"4 17 10 11 4 5"}),i.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]}),title:"No Bash Commands",description:"Bash commands are captured when a Claude Code session ends. Complete a session that uses the Bash tool to see commands here."}):i.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-4 py-2",style:{borderColor:"rgba(255,255,255,0.06)"},children:[i.jsx("span",{className:"text-xs font-mono uppercase tracking-widest text-zinc-500",children:"Bash Inspector"}),i.jsxs("span",{className:"font-mono text-[10px] text-zinc-600",children:[o.length," commands",f>0&&i.jsxs("span",{style:{color:e.error},children:[" · ",f," errors"]})]}),i.jsx("div",{className:"flex-1"}),i.jsx("button",{onClick:()=>c(h=>!h),className:"flex items-center gap-1.5 rounded px-2 py-1 font-mono text-[10px] transition-colors",style:{background:s?`${e.error}22`:"rgba(255,255,255,0.04)",color:s?e.error:"#71717a",border:`1px solid ${s?`${e.error}44`:"rgba(255,255,255,0.08)"}`},children:"Errors Only"}),i.jsx("input",{type:"text",value:n,onChange:h=>a(h.target.value),placeholder:"filter commands...",className:"rounded border bg-transparent px-2 py-1 font-mono text-[11px] text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.08)",width:180}})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-4 py-1",style:{borderColor:"rgba(255,255,255,0.04)"},children:[i.jsx("div",{className:"w-6"}),i.jsx("div",{className:"w-6 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"exit"}),i.jsx("div",{className:"flex-1 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"command"}),i.jsx("div",{className:"w-12 text-right text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"dur"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:u.length===0?i.jsx("div",{className:"flex items-center justify-center h-24 text-xs text-zinc-600 font-mono",children:"no matching commands"}):u.map((h,p)=>i.jsx($x,{cmd:h,index:p},p))})]})}function Wx(e,t){return[...e].sort((l,n)=>{switch(t){case"cost":return n.totalCostUsd-l.totalCostUsd;case"duration":{const a=l.endedAt?l.endedAt-l.startedAt:1/0;return(n.endedAt?n.endedAt-n.startedAt:1/0)-a}case"name":return l.name.localeCompare(n.name);case"date":default:return n.startedAt-l.startedAt}})}function Ix(e,t){if(!t)return"live";try{return jr(new Date(e),new Date(t))}catch{return"—"}}function Px(e){return e===0?"—":e<.01?`$${e.toFixed(6)}`:`$${e.toFixed(4)}`}function ep({session:e,costUsd:t,isActive:l,meta:n,onSelect:a}){const s=O(),c=e.status==="active",o=Ix(e.startedAt,e.endedAt);return i.jsxs("div",{onClick:a,className:me("flex items-center gap-4 border-b px-5 py-3 cursor-pointer transition-colors",l?"bg-white/[0.04]":"hover:bg-white/[0.02]"),style:{borderColor:"rgba(255,255,255,0.04)"},children:[i.jsx("div",{className:"h-1.5 w-1.5 rounded-full flex-shrink-0",style:{background:l?s.running:"transparent",border:l?"none":"1px solid rgba(255,255,255,0.12)"}}),i.jsxs("div",{className:"w-48 flex-shrink-0 min-w-0",children:[i.jsx("div",{className:"font-mono text-[12px] text-zinc-200 truncate",children:e.name}),i.jsx("div",{className:"font-mono text-[10px] text-zinc-600 mt-0.5",children:ct(new Date(e.startedAt),"MMM d, HH:mm")})]}),i.jsx("div",{className:"w-14 flex-shrink-0",children:i.jsx("span",{className:"font-mono text-[9px] px-1.5 py-0.5 rounded",style:c?{background:`${s.running}1A`,color:s.running,border:`1px solid ${s.running}33`}:{background:"rgba(255,255,255,0.04)",color:"#52525b",border:"1px solid rgba(255,255,255,0.08)"},children:c?"live":"ended"})}),i.jsx("div",{className:"w-24 flex-shrink-0 font-mono text-[11px]",style:{color:c?s.running:"#71717a"},children:o}),i.jsx("div",{className:"w-24 flex-shrink-0 font-mono text-[12px]",style:{color:t>0?s.running:"#3f3f46"},children:Px(t)}),i.jsx("div",{className:"w-14 flex-shrink-0 font-mono text-[11px]",style:{color:n.turnCount?s.info:"#3f3f46"},children:n.turnCount!==null?`${n.turnCount}t`:"—"}),i.jsx("div",{className:"w-14 flex-shrink-0 font-mono text-[11px]",style:{color:n.cacheHitRate!==null?s.warn:"#3f3f46"},children:n.cacheHitRate!==null?`${n.cacheHitRate}%`:"—"}),i.jsx("div",{className:"flex-1 flex flex-wrap gap-1 min-w-0",children:n.topTools.slice(0,5).map(u=>i.jsx("span",{className:"font-mono text-[9px] px-1 py-0.5 rounded",style:{background:"rgba(255,255,255,0.04)",color:"#71717a",border:"1px solid rgba(255,255,255,0.06)"},children:u},u))})]})}function tp(e){return{turnCount:e.turnCount,topTools:(e.topTools??[]).slice(0,5).map(t=>t.name),cacheHitRate:e.cacheHitRate}}function lp(){const{sessions:e,activeSessionId:t,setActiveSession:l}=ae(),{events:n}=at(),a=si(v=>v.summaries),s=O(),[c,o]=C.useState(""),[u,f]=C.useState("date"),h=C.useMemo(()=>{const v=new Map,r=new Map;for(const x of n){if(x.type!=="cost.update")continue;const b=x.payload.totalCostUsd??0;x.source==="hook"?v.set(x.sessionId,Math.max(v.get(x.sessionId)??0,b)):r.set(x.sessionId,(r.get(x.sessionId)??0)+b)}const d=new Map;for(const[x,b]of v)d.set(x,b);for(const[x,b]of r)d.set(x,(d.get(x)??0)+b);return d},[n]),p=v=>h.get(v.id)??v.totalCostUsd,m=C.useMemo(()=>{const v=c.toLowerCase().trim(),r=v?e.filter(d=>d.name.toLowerCase().includes(v)||d.id.toLowerCase().includes(v)):e;return Wx(r,u)},[e,c,u]),y=e.reduce((v,r)=>v+p(r),0),g=e.filter(v=>v.status==="active").length,j=[{key:"date",label:"Recent"},{key:"cost",label:"Cost"},{key:"duration",label:"Duration"},{key:"name",label:"Name"}];return e.length===0?i.jsx(Ve,{icon:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("polyline",{points:"12 6 12 12 16 14"})]}),title:"No sessions",description:"Sessions will appear here once Claude Code starts reporting to PRISM"}):i.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-5 py-2",style:{borderColor:"rgba(255,255,255,0.07)",background:s.toolbarBg},children:[i.jsxs("span",{className:"font-mono text-[10px] text-zinc-500",children:[e.length," sessions"]}),g>0&&i.jsxs("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded",style:{background:`${s.running}1A`,color:s.running},children:[g," live"]}),i.jsx("span",{className:"font-mono text-[10px]",style:{color:s.running},children:y>0?`$${y.toFixed(4)} total`:""}),i.jsx("div",{className:"flex-1"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:"sort:"}),j.map(({key:v,label:r})=>i.jsx("button",{onClick:()=>f(v),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors",style:u===v?{background:`${s.info}22`,color:s.info,border:`1px solid ${s.info}44`}:{color:"#52525b",border:"1px solid transparent"},children:r},v)),i.jsx("div",{className:"h-4 w-px mx-1",style:{background:"rgba(255,255,255,0.08)"}}),i.jsx("input",{type:"text",placeholder:"search sessions…",value:c,onChange:v=>o(v.target.value),className:"h-6 rounded border bg-transparent px-2 text-[11px] font-mono text-zinc-300 placeholder-zinc-700 outline-none focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.08)",width:160}}),c&&i.jsx("button",{onClick:()=>o(""),className:"font-mono text-[10px] text-zinc-600 hover:text-zinc-400",children:"✕"})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-4 border-b px-5 py-1.5",style:{borderColor:"rgba(255,255,255,0.04)",background:"rgba(0,0,0,0.25)"},children:[i.jsx("div",{className:"w-1.5 shrink-0"}),i.jsx("span",{className:"w-48 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Session"}),i.jsx("span",{className:"w-14 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Status"}),i.jsx("span",{className:"w-24 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Duration"}),i.jsx("span",{className:"w-24 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Cost"}),i.jsx("span",{className:"w-14 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Turns"}),i.jsx("span",{className:"w-14 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Cache"}),i.jsx("span",{className:"flex-1 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Top Tools"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:m.length===0?i.jsx("div",{className:"flex h-full items-center justify-center",children:i.jsxs("p",{className:"font-mono text-xs text-zinc-600",children:['No sessions match "',c,'"']})}):m.map(v=>i.jsx(ep,{session:v,costUsd:p(v),isActive:v.id===t,meta:a.has(v.id)?tp(a.get(v.id)):{turnCount:null,topTools:[],cacheHitRate:null},onSelect:()=>l(v.id)},v.id))})]})}function b0(e){return e===void 0?"—":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function np(e){var s;const t=e.command;if(t)return((s=t.split(`
|
|
40
|
-
`)[0])==null?void 0:s.slice(0,80))??"";const l=e.file_path??e.path;if(l)return l;const n=e.pattern;return n||Object.keys(e).slice(0,2).map(c=>{var o;return`${c}: ${(o=JSON.stringify(e[c]))==null?void 0:o.slice(0,30)}`}).join(" ")}const ap={Bash:"#FFAA00",Read:"#00BBFF",Write:"#00FF88",Edit:"#BB88FF",MultiEdit:"#BB88FF",Glob:"#00BBFF",Grep:"#00BBFF",Task:"#FF8844",WebFetch:"#FF3366",WebSearch:"#FF3366",TodoWrite:"#44FFBB",TodoRead:"#44FFBB"};function ii(e,t){return ap[e]??t}function xr({data:e,label:t}){const l=O(),[n,a]=C.useState(!1),s=JSON.stringify(e,null,2);return i.jsxs("div",{className:"mt-3",children:[i.jsxs("button",{className:"flex items-center gap-1.5 mb-1",onClick:()=>a(c=>!c),children:[i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-widest",style:{color:"#52525b"},children:t}),i.jsx("span",{className:"font-mono text-[9px]",style:{color:"#52525b"},children:n?"▶":"▼"})]}),!n&&i.jsx("pre",{className:"rounded p-2.5 font-mono text-[10px] leading-relaxed overflow-x-auto whitespace-pre-wrap break-all",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.07)",color:l.info},children:s})]})}function sp({call:e,onClose:t}){const l=O(),n=ii(e.toolName,l.info),a=e.status==="error"?l.error:e.status==="complete"?l.running:l.warn;return i.jsxs("div",{className:"flex flex-col border-l overflow-hidden",style:{width:380,flexShrink:0,borderColor:"rgba(255,255,255,0.08)",background:"rgba(0,0,0,0.4)"},children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2 border-b",style:{borderColor:"rgba(255,255,255,0.06)"},children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-mono text-xs font-semibold px-2 py-0.5 rounded",style:{background:`${n}1A`,color:n,border:`1px solid ${n}44`},children:e.toolName}),e.status&&i.jsx("span",{className:"font-mono text-[9px]",style:{color:a},children:e.status})]}),i.jsx("button",{onClick:t,className:"text-zinc-600 hover:text-zinc-400 text-sm px-1",children:"✕"})]}),i.jsxs("div",{className:"flex gap-3 px-3 py-1.5 border-b shrink-0",style:{borderColor:"rgba(255,255,255,0.04)"},children:[i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:ct(new Date(e.timestamp),"HH:mm:ss.SSS")}),e.durationMs!==void 0&&i.jsx("span",{className:"font-mono text-[10px]",style:{color:l.warn},children:b0(e.durationMs)}),e.agentId&&i.jsxs("span",{className:"font-mono text-[10px] text-zinc-600 truncate",children:["agent: ",e.agentId.slice(0,12)]})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[i.jsx(xr,{data:e.input,label:"Input"}),e.output!==void 0&&i.jsx(xr,{data:e.output,label:"Output"})]})]})}function ip({call:e,isSelected:t,onSelect:l}){const n=O(),a=ii(e.toolName,n.info),s=e.status==="error"?n.error:e.status==="complete"?n.running:n.warn;return i.jsx("div",{className:me("border-b cursor-pointer transition-colors duration-100",t?"bg-white/[0.04]":"hover:bg-white/[0.02]"),style:{borderColor:"rgba(255,255,255,0.04)"},onClick:l,children:i.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",children:[i.jsx("span",{className:"w-24 shrink-0 font-mono text-[10px] text-zinc-500",children:ct(new Date(e.timestamp),"HH:mm:ss.SSS")}),i.jsx("span",{className:"w-28 shrink-0 font-mono text-[11px] font-medium truncate",style:{color:a},children:e.toolName}),i.jsx("span",{className:"flex-1 font-mono text-[11px] text-zinc-400 truncate",children:np(e.input)}),e.durationMs!==void 0&&i.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-[10px]",style:{color:n.warn},children:b0(e.durationMs)}),e.status&&i.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-[9px] px-1.5 py-0.5 rounded",style:{color:s,background:`${s}1A`},children:e.status}),i.jsx("div",{className:"w-1 h-4 rounded-full shrink-0",style:{background:t?n.info:"transparent"}})]})})}function cp({calls:e}){const t=O(),l=e.length,n=e.filter(o=>o.status==="error").length,a=new Set(e.map(o=>o.toolName)).size,s=e.reduce((o,u)=>(o[u.toolName]=(o[u.toolName]??0)+1,o),{}),c=Object.entries(s).sort((o,u)=>u[1]-o[1])[0];return i.jsxs("div",{className:"flex gap-4 px-4 py-1.5 border-b shrink-0",style:{borderColor:"rgba(255,255,255,0.06)",background:"rgba(0,0,0,0.25)"},children:[i.jsx(Za,{label:"Total",value:String(l),color:t.info}),n>0&&i.jsx(Za,{label:"Errors",value:String(n),color:t.error}),i.jsx(Za,{label:"Unique Tools",value:String(a),color:t.purple}),c&&i.jsx(Za,{label:`Top: ${c[0]}`,value:`×${c[1]}`,color:ii(c[0],t.warn)})]})}function Za({label:e,value:t,color:l}){return i.jsxs("div",{className:"flex items-baseline gap-1.5",children:[i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-widest text-zinc-600",children:e}),i.jsx("span",{className:"font-mono text-xs font-semibold",style:{color:l},children:t})]})}function op(){const e=O(),{events:t}=at(),{activeSessionId:l}=ae(),[n,a]=C.useState(""),[s,c]=C.useState("all"),[o,u]=C.useState(null),f=C.useMemo(()=>(l?t.filter(y=>y.sessionId===l):t).filter(y=>y.type==="tool.call").map(y=>{const g=y.payload;return{id:y.id,timestamp:y.timestamp,toolName:g.toolName??"unknown",agentId:g.agentId,callId:g.callId??g.toolCallId,status:g.status,input:g.input??{},output:g.output,durationMs:g.durationMs}}),[t,l]),h=C.useMemo(()=>["all",...Array.from(new Set(f.map(y=>y.toolName))).sort()],[f]),p=C.useMemo(()=>f.filter(m=>{if(s!=="all"&&m.toolName!==s)return!1;if(n){const y=n.toLowerCase();if(!m.toolName.toLowerCase().includes(y)&&!JSON.stringify(m.input).toLowerCase().includes(y))return!1}return!0}),[f,s,n]);return f.length===0?i.jsx(Ve,{icon:i.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),title:"No Tool Calls",description:"Tool calls will appear here as your agent runs. Start a Claude Code session to see Bash, Read, Write, and other tool calls in real time."}):i.jsxs("div",{className:"flex h-full overflow-hidden",children:[i.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-4 py-2 flex-wrap",style:{borderColor:"rgba(255,255,255,0.07)",background:e.toolbarBg},children:[i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-zinc-500",children:"Tool Inspector"}),i.jsx("div",{className:"h-4 w-px mx-1",style:{background:"rgba(255,255,255,0.08)"}}),i.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:h.map(m=>{const y=m==="all"?e.info:ii(m,e.info),g=s===m;return i.jsx("button",{onClick:()=>c(m),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors capitalize",style:g?{background:`${y}22`,color:y,border:`1px solid ${y}44`}:{color:"#71717a",border:"1px solid transparent"},children:m},m)})}),i.jsx("div",{className:"flex-1"}),i.jsx("input",{type:"text",placeholder:"search input...",value:n,onChange:m=>a(m.target.value),className:"h-6 rounded border bg-transparent px-2 text-[11px] font-mono text-zinc-300 placeholder-zinc-700 outline-none focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.08)",width:150}}),n&&i.jsx("button",{onClick:()=>a(""),className:"font-mono text-[10px] text-zinc-600 hover:text-zinc-400",children:"✕"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:p.length})]}),i.jsx(cp,{calls:p}),i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-4 py-1",style:{borderColor:"rgba(255,255,255,0.04)",background:"rgba(0,0,0,0.25)"},children:[i.jsx("span",{className:"w-24 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Time"}),i.jsx("span",{className:"w-28 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Tool"}),i.jsx("span",{className:"flex-1 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Input Summary"}),i.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Dur"}),i.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Status"}),i.jsx("div",{className:"w-1"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:p.length===0?i.jsx("div",{className:"flex items-center justify-center h-24 font-mono text-xs text-zinc-600",children:"no matching tool calls"}):p.map(m=>i.jsx(ip,{call:m,isSelected:(o==null?void 0:o.id)===m.id,onSelect:()=>u(y=>(y==null?void 0:y.id)===m.id?null:m)},m.id))})]}),o&&i.jsx(sp,{call:o,onClose:()=>u(null)})]})}function up({level:e}){const t=O(),l=e==="error"?t.error:e==="warn"?t.warn:e==="debug"?t.purple:t.info;return i.jsx("span",{className:"shrink-0 font-mono text-[8px] uppercase tracking-widest px-1.5 py-0.5 rounded",style:{color:l,background:`${l}1A`,border:`1px solid ${l}33`},children:e})}function rp({type:e}){const t=O(),n={log:"#52525b",state:t.warn,checkpoint:t.running,spawn:t.purple,complete:t.running}[e];return i.jsx("span",{className:"shrink-0 font-mono text-[8px] uppercase tracking-widest",style:{color:n},children:e})}function fp({step:e,showAgent:t}){const l=O(),[n,a]=C.useState(!1),s=!!e.detail;return i.jsxs("div",{className:me("border-b transition-colors",s?"cursor-pointer hover:bg-white/[0.02]":""),style:{borderColor:"rgba(255,255,255,0.04)"},onClick:()=>s&&a(c=>!c),children:[i.jsxs("div",{className:"flex items-start gap-3 px-4 py-2",children:[i.jsx("span",{className:"shrink-0 mt-0.5 font-mono text-[10px] text-zinc-600 w-24",children:ct(new Date(e.timestamp),"HH:mm:ss.SSS")}),i.jsx("div",{className:"shrink-0 mt-0.5 w-20",children:i.jsx(rp,{type:e.type})}),i.jsx("div",{className:"shrink-0 mt-0.5 w-12",children:i.jsx(up,{level:e.level})}),t&&i.jsx("span",{className:"shrink-0 mt-0.5 w-24 font-mono text-[10px] truncate",style:{color:e.agentName?l.purple:"#3f3f46"},children:e.agentName??"—"}),i.jsx("span",{className:me("flex-1 font-mono text-[11px] break-all",n?"whitespace-pre-wrap":"truncate"),style:{color:e.level==="error"?l.error:e.level==="warn"?l.warn:"#d4d4d8"},children:e.message}),s&&i.jsx("span",{className:"shrink-0 font-mono text-[9px] text-zinc-600 mt-0.5",children:n?"▲":"▼"})]}),n&&e.detail&&i.jsx("div",{className:"px-4 pb-2 pl-44",children:i.jsx("pre",{className:"rounded p-2 font-mono text-[10px] whitespace-pre-wrap break-all",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.06)",color:l.info},children:e.detail})})]})}function pr({name:e,isActive:t,color:l,onClick:n}){return i.jsx("button",{onClick:n,className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors",style:t?{background:`${l}22`,color:l,border:`1px solid ${l}44`}:{color:"#71717a",border:"1px solid transparent"},children:e})}function dp(){const e=O(),{events:t}=at(),{activeSessionId:l}=ae(),n=be(v=>v.agents),[a,s]=C.useState("all"),[c,o]=C.useState("all"),[u,f]=C.useState(""),h=C.useMemo(()=>{const v=new Map;for(const[r,d]of n.entries())v.set(r,d.name);return v},[n]),p=C.useMemo(()=>(l?t.filter(r=>r.sessionId===l):t).filter(r=>["agent.log","agent.state_change","checkpoint.create","agent.spawn","agent.complete","loop.detected"].includes(r.type)).map(r=>{const d=r.payload,x=d.agentId,b=x?h.get(x):void 0;switch(r.type){case"agent.log":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:d.message??"",level:d.level??"info",type:"log",detail:d.data?JSON.stringify(d.data,null,2):void 0};case"agent.state_change":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:`State → ${d.nextState}${d.reason?` (${d.reason})`:""}`,level:d.nextState==="error"?"error":"info",type:"state"};case"checkpoint.create":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:`Checkpoint: ${d.label??""}`,level:"info",type:"checkpoint",detail:d.metadata?JSON.stringify(d.metadata,null,2):void 0};case"agent.spawn":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:d.name??b,message:`Agent spawned: ${d.name??x??""}`,level:"info",type:"spawn"};case"agent.complete":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:`Agent complete — ${(d.durationMs??0)>0?`${(d.durationMs/1e3).toFixed(1)}s`:"done"}${d.errorMessage?`: ${d.errorMessage}`:""}`,level:d.state==="error"?"error":"info",type:"complete"};case"loop.detected":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:`Loop detected: ${d.toolName??""} called ${d.callCount??0}× in ${d.windowSeconds??60}s window`,level:"warn",type:"log"};default:return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:JSON.stringify(d).slice(0,120),level:"debug",type:"log"}}}),[t,l,h]),m=C.useMemo(()=>{const v=new Map;for(const r of p)r.agentId&&!v.has(r.agentId)&&v.set(r.agentId,r.agentName??r.agentId.slice(0,8));return Array.from(v.entries())},[p]),y=C.useMemo(()=>{const v=[e.purple,e.info,e.running,e.warn,"#FF8844","#44FFBB"],r=new Map;return m.forEach(([d],x)=>r.set(d,v[x%v.length])),r},[m,e]),g=C.useMemo(()=>p.filter(v=>{var r;if(a!=="all"&&v.agentId!==a||c!=="all"&&v.level!==c)return!1;if(u){const d=u.toLowerCase();if(!v.message.toLowerCase().includes(d)&&!((r=v.agentName)!=null&&r.toLowerCase().includes(d)))return!1}return!0}),[p,a,c,u]),j=a==="all"&&m.length>1;return p.length===0?i.jsx(Ve,{icon:i.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("path",{d:"M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.44-3.54z"}),i.jsx("path",{d:"M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.44-3.54z"})]}),title:"No Reasoning Steps",description:"Agent logs, state transitions, and checkpoints will appear here as your agent runs."}):i.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-4 py-2 flex-wrap",style:{borderColor:"rgba(255,255,255,0.07)",background:e.toolbarBg},children:[i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-zinc-500 mr-1",children:"Reasoning"}),i.jsx("div",{className:"h-4 w-px",style:{background:"rgba(255,255,255,0.08)"}}),i.jsx(pr,{name:"all",isActive:a==="all",color:e.info,onClick:()=>s("all")}),m.map(([v,r])=>i.jsx(pr,{name:r,isActive:a===v,color:y.get(v)??e.purple,onClick:()=>s(v)},v)),i.jsx("div",{className:"h-4 w-px mx-1",style:{background:"rgba(255,255,255,0.08)"}}),["all","info","warn","error","debug"].map(v=>{const r=v==="all"?"#52525b":v==="error"?e.error:v==="warn"?e.warn:v==="debug"?e.purple:e.info;return i.jsx("button",{onClick:()=>o(v),className:"rounded px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-widest transition-colors",style:c===v?{background:`${r}22`,color:r,border:`1px solid ${r}44`}:{color:"#52525b",border:"1px solid transparent"},children:v},v)}),i.jsx("div",{className:"flex-1"}),i.jsx("input",{type:"text",placeholder:"search...",value:u,onChange:v=>f(v.target.value),className:"h-6 rounded border bg-transparent px-2 text-[11px] font-mono text-zinc-300 placeholder-zinc-700 outline-none focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.08)",width:130}}),u&&i.jsx("button",{onClick:()=>f(""),className:"font-mono text-[10px] text-zinc-600",children:"✕"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:g.length})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-4 py-1",style:{borderColor:"rgba(255,255,255,0.04)",background:"rgba(0,0,0,0.25)"},children:[i.jsx("span",{className:"w-24 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Time"}),i.jsx("span",{className:"w-20 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Type"}),i.jsx("span",{className:"w-12 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Level"}),j&&i.jsx("span",{className:"w-24 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Agent"}),i.jsx("span",{className:"flex-1 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Message"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:g.length===0?i.jsx("div",{className:"flex items-center justify-center h-24 font-mono text-xs text-zinc-600",children:"no matching steps"}):g.map(v=>i.jsx(fp,{step:v,showAgent:j},v.id))})]})}const Vi={"claude-opus-4-6":2e5,"claude-sonnet-4-6":2e5,"claude-haiku-4-5":2e5,"claude-haiku-4-5-20251001":2e5,"claude-3-5-sonnet-20241022":2e5,"claude-3-5-haiku-20241022":2e5,"claude-3-opus-20240229":2e5,"claude-sonnet-4-5":2e5,"claude-sonnet-4-5-20251001":2e5};function gr(e){if(Vi[e])return Vi[e];for(const[t,l]of Object.entries(Vi))if(e.startsWith(t.split("-").slice(0,3).join("-")))return l;return 2e5}function mp({pct:e,color:t,label:l}){const n=Math.min(100,Math.max(0,e)),a=n>=90?"#FF3366":n>=70?"#FFAA00":t;return i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-600 w-20 text-right",children:l}),i.jsx("div",{className:"flex-1 rounded-full overflow-hidden",style:{height:6,background:"rgba(255,255,255,0.06)"},children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${n}%`,background:a,boxShadow:n>50?`0 0 8px ${a}66`:"none"}})}),i.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold w-12 text-right",style:{color:a},children:[n.toFixed(1),"%"]})]})}function Va({label:e,value:t,color:l,pct:n,total:a}){return i.jsxs("div",{className:"flex flex-col gap-1.5 rounded-lg p-3",style:{background:`${l}0D`,border:`1px solid ${l}22`},children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-widest",style:{color:`${l}99`},children:e}),i.jsx("span",{className:"font-mono text-xs font-bold",style:{color:l},children:t.toLocaleString()})]}),i.jsx("div",{className:"rounded-full overflow-hidden",style:{height:3,background:"rgba(255,255,255,0.06)"},children:i.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(100,n)}%`,background:l}})}),i.jsxs("span",{className:"font-mono text-[9px]",style:{color:`${l}77`},children:[a>0?(t/a*100).toFixed(1):"0","% of total"]})]})}function hp({point:e,maxTokens:t,isLast:l}){const n=O(),a=t>0?e.inputTokens/t*100:0,s=e.pct>=90?n.error:e.pct>=70?n.warn:n.info;return i.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[i.jsx("div",{className:"shrink-0 h-2 rounded-full transition-all",style:{width:`${Math.max(2,a)}%`,maxWidth:"100%",background:s,opacity:l?1:.5}}),i.jsxs("span",{className:"font-mono text-[9px] shrink-0",style:{color:s},children:[e.pct.toFixed(0),"%"]})]})}function xp(){const e=O(),{events:t}=at(),{activeSessionId:l}=ae(),n=C.useMemo(()=>(l?t.filter(v=>v.sessionId===l):t).filter(v=>v.type==="cost.update"),[t,l]),a=C.useMemo(()=>n.slice().reverse().map(j=>{const v=j.payload,r=v.inputTokens??0,d=v.outputTokens??0,x=v.cacheReadTokens??0,b=v.cacheWriteTokens??0,S=v.model??"",k=gr(S),z=k>0?r/k*100:0;return{timestamp:j.timestamp,inputTokens:r,outputTokens:d,cacheReadTokens:x,cacheWriteTokens:b,model:S,contextLimit:k,pct:z}}),[n]),s=C.useMemo(()=>a[a.length-1]??null,[a]),c=C.useMemo(()=>(l?t.filter(v=>v.sessionId===l):t).find(v=>v.type==="session.summary"),[t,l]),u=C.useMemo(()=>{if(!c)return null;const j=c.payload;return{input:j.inputTokens??0,output:j.outputTokens??0,cacheRead:j.cacheReadTokens??0,cacheWrite:j.cacheWriteTokens??0,model:c.payload.model??""}},[c])??(s?{input:s.inputTokens,output:s.outputTokens,cacheRead:s.cacheReadTokens,cacheWrite:s.cacheWriteTokens,model:s.model}:null),f=a.length>0?Math.max(...a.map(j=>j.inputTokens)):0;if(!u&&a.length===0)return i.jsx(Ve,{icon:i.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),i.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),i.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),title:"No Context Data",description:"Context window utilization will appear here once your agent makes API calls."});const h=u?gr(u.model):2e5,p=u?u.input:0,m=h>0?p/h*100:0,y=m>=90?e.error:m>=70?e.warn:e.running,g=u?u.input+u.output+u.cacheRead+u.cacheWrite:0;return i.jsxs("div",{className:"flex h-full flex-col overflow-y-auto p-5 gap-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"font-mono text-sm font-bold text-zinc-200",children:"Context Window"}),i.jsxs("p",{className:"font-mono text-[10px] text-zinc-600 mt-0.5",children:[(u==null?void 0:u.model)??"unknown model"," — ",h.toLocaleString()," token limit"]})]}),i.jsxs("div",{className:"flex flex-col items-end",style:{color:y},children:[i.jsxs("span",{className:"font-mono text-3xl font-bold leading-none",children:[m.toFixed(1),"%"]}),i.jsx("span",{className:"font-mono text-[10px] mt-0.5",children:"utilization"})]})]}),i.jsx("div",{className:"space-y-3",children:i.jsx(mp,{pct:m,color:e.info,label:"Input ctx"})}),u&&i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(Va,{label:"Input Tokens",value:u.input,color:e.info,pct:u.input/h*100,total:g}),i.jsx(Va,{label:"Output Tokens",value:u.output,color:e.running,pct:u.output/Math.max(u.output,1)*100,total:g}),i.jsx(Va,{label:"Cache Reads",value:u.cacheRead,color:e.warn,pct:g>0?u.cacheRead/g*100:0,total:g}),i.jsx(Va,{label:"Cache Writes",value:u.cacheWrite,color:e.purple,pct:g>0?u.cacheWrite/g*100:0,total:g})]}),m>=70&&i.jsxs("div",{className:"rounded-lg p-3 flex items-start gap-2",style:{background:`${y}0D`,border:`1px solid ${y}33`},children:[i.jsx("span",{className:"text-lg leading-none",children:m>=90?"⚠️":"📊"}),i.jsxs("div",{children:[i.jsx("p",{className:"font-mono text-xs font-semibold",style:{color:y},children:m>=90?"Context Critical":"Context Pressure"}),i.jsx("p",{className:"font-mono text-[10px] text-zinc-400 mt-1",children:m>=90?`Context window is ${m.toFixed(0)}% full. The model may truncate or refuse soon.`:`At ${m.toFixed(0)}% utilization. Consider summarizing or starting a new session.`})]})]}),a.length>1&&i.jsxs("div",{children:[i.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-widest text-zinc-600 mb-2",children:["Context Growth (",a.length," snapshots)"]}),i.jsx("div",{className:"space-y-0.5",children:a.map((j,v)=>i.jsx(hp,{point:j,maxTokens:f,isLast:v===a.length-1},j.timestamp))})]}),i.jsxs("div",{className:"rounded-lg p-3",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.06)"},children:[i.jsx("p",{className:"font-mono text-[9px] uppercase tracking-widest text-zinc-600 mb-2",children:"Model Limits"}),i.jsx("div",{className:"space-y-1",children:[{model:"claude-opus-4-6",limit:"200K",label:"Claude Opus 4.6"},{model:"claude-sonnet-4-6",limit:"200K",label:"Claude Sonnet 4.6"},{model:"claude-haiku-4-5",limit:"200K",label:"Claude Haiku 4.5"}].map(j=>{var r;const v=(r=u==null?void 0:u.model)==null?void 0:r.startsWith(j.model.split("-").slice(0,3).join("-"));return i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-mono text-[10px]",style:{color:v?e.running:"#52525b"},children:j.label}),i.jsx("span",{className:"font-mono text-[10px]",style:{color:v?e.info:"#3f3f46"},children:j.limit})]},j.model)})})]})]})}function pp({line:e}){const t=O();return e.startsWith("+++")||e.startsWith("---")?i.jsx("div",{className:"font-mono text-[10px] leading-relaxed",style:{color:"#71717a"},children:e}):e.startsWith("+")?i.jsx("div",{className:"font-mono text-[10px] leading-relaxed",style:{color:t.running,background:`${t.running}0A`},children:e}):e.startsWith("-")?i.jsx("div",{className:"font-mono text-[10px] leading-relaxed",style:{color:t.error,background:`${t.error}0A`},children:e}):e.startsWith("@@")?i.jsx("div",{className:"font-mono text-[10px] leading-relaxed",style:{color:t.info},children:e}):i.jsx("div",{className:"font-mono text-[10px] leading-relaxed text-zinc-500",children:e})}function j0({node:e,depth:t,statusMap:l,selectedFile:n,onSelect:a}){var y,g;const s=O(),[c,o]=C.useState(t<2),u=l.get(e.path),f=n===e.path;if(e.type==="dir"){const j=((y=e.children)==null?void 0:y.some(v=>l.has(v.path)))??!1;return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-1 cursor-pointer hover:bg-white/[0.03] rounded px-1 py-0.5",style:{paddingLeft:`${t*12+4}px`},onClick:()=>o(v=>!v),children:[i.jsx("span",{className:"font-mono text-[10px] text-zinc-600 shrink-0 w-3",children:c?"▾":"▸"}),i.jsxs("span",{className:"font-mono text-[10px] truncate",style:{color:j?s.warn:"#52525b"},children:[e.name,"/"]})]}),c&&((g=e.children)==null?void 0:g.map(v=>i.jsx(j0,{node:v,depth:t+1,statusMap:l,selectedFile:n,onSelect:a},v.path)))]})}let h="#52525b",p="",m="#52525b";return u&&(u.staged?(p=u.status,m=u.status==="A"?s.running:u.status==="D"?s.error:s.warn,h="#d4d4d8"):u.untracked?(p="?",m="#52525b",h="#71717a"):(p=u.workStatus,m=u.workStatus==="D"?s.error:s.warn,h="#a1a1aa")),i.jsxs("div",{className:me("flex items-center gap-1 cursor-pointer rounded px-1 py-0.5 transition-colors",f?"bg-white/[0.06]":"hover:bg-white/[0.03]"),style:{paddingLeft:`${t*12+4}px`},onClick:()=>u&&a(e.path,u.staged),children:[p?i.jsx("span",{className:"shrink-0 font-mono text-[9px] font-bold w-3 text-center",style:{color:m},children:p}):i.jsx("span",{className:"shrink-0 w-3"}),i.jsx("span",{className:"font-mono text-[10px] truncate",style:{color:h},children:e.name})]})}function Ji({title:e,files:t,color:l,selectedFile:n,staged:a,onSelect:s,onStage:c,onUnstage:o,onDiscard:u,loading:f}){const h=O(),[p,m]=C.useState(new Set);if(t.length===0)return null;const y=r=>{m(d=>{const x=new Set(d);return x.has(r)?x.delete(r):x.add(r),x})},g=t.every(r=>p.has(r.path)),j=()=>{m(g?new Set:new Set(t.map(r=>r.path)))},v=t.filter(r=>p.has(r.path)).map(r=>r.path);return i.jsxs("div",{className:"mb-1",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-1 sticky top-0",style:{background:"rgba(9,9,11,0.95)",borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:j,className:"flex items-center gap-1",children:i.jsx("span",{className:"w-3 h-3 rounded border flex items-center justify-center",style:{borderColor:g?l:"rgba(255,255,255,0.15)",background:g?l:"transparent"},children:g&&i.jsx("span",{style:{color:"#09090B",fontSize:8,fontWeight:900},children:"✓"})})}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-widest",style:{color:l},children:e}),i.jsx("span",{className:"font-mono text-[9px] px-1.5 py-0.5 rounded",style:{color:l,background:`${l}1A`,border:`1px solid ${l}33`},children:t.length})]}),i.jsx("div",{className:"flex items-center gap-1",children:v.length>0&&i.jsxs(i.Fragment,{children:[c&&i.jsxs("button",{disabled:f,onClick:()=>{c(v),m(new Set)},className:"font-mono text-[9px] px-1.5 py-0.5 rounded transition-colors disabled:opacity-40",style:{color:h.running,background:`${h.running}1A`,border:`1px solid ${h.running}33`},children:["Stage ",v.length]}),o&&i.jsxs("button",{disabled:f,onClick:()=>{o(v),m(new Set)},className:"font-mono text-[9px] px-1.5 py-0.5 rounded transition-colors disabled:opacity-40",style:{color:h.warn,background:`${h.warn}1A`,border:`1px solid ${h.warn}33`},children:["Unstage ",v.length]}),u&&i.jsxs("button",{disabled:f,onClick:()=>{confirm(`Discard changes to ${v.length} file(s)?`)&&(u(v),m(new Set))},className:"font-mono text-[9px] px-1.5 py-0.5 rounded transition-colors disabled:opacity-40",style:{color:h.error,background:`${h.error}1A`,border:`1px solid ${h.error}33`},children:["Discard ",v.length]})]})})]}),t.map(r=>{const d=a?r.status:r.untracked?"?":r.workStatus,x=d==="A"?h.running:d==="D"?h.error:d==="?"?"#52525b":h.warn,b=n===r.path;return i.jsxs("div",{className:me("flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors",b?"bg-white/[0.05]":"hover:bg-white/[0.02]"),onClick:()=>s(r.path,a),children:[i.jsx("button",{onClick:S=>{S.stopPropagation(),y(r.path)},className:"shrink-0",children:i.jsx("span",{className:"w-3 h-3 rounded border flex items-center justify-center",style:{borderColor:p.has(r.path)?x:"rgba(255,255,255,0.15)",background:p.has(r.path)?x:"transparent",display:"inline-flex"},children:p.has(r.path)&&i.jsx("span",{style:{color:"#09090B",fontSize:8,fontWeight:900},children:"✓"})})}),i.jsx("span",{className:"shrink-0 font-mono text-[9px] font-bold w-3 text-center",style:{color:x},children:d}),i.jsx("span",{className:"flex-1 font-mono text-[10px] text-zinc-300 truncate",title:r.path,children:r.path.split("/").pop()}),i.jsx("span",{className:"font-mono text-[9px] text-zinc-600 truncate max-w-32",title:r.path,children:r.path.includes("/")?r.path.slice(0,r.path.lastIndexOf("/")):""})]},r.path)})]})}function gp({status:e,gitRoot:t,onSuccess:l,loading:n,setLoading:a}){var A;const s=O(),{collectorUrl:c}=ni(),[o,u]=C.useState(""),[f,h]=C.useState(""),[p,m]=C.useState(""),y=C.useRef(null),g=c.replace(/^ws/,"http").replace(/\/ws$/,""),j=(e==null?void 0:e.staged.length)??0,v=(e==null?void 0:e.remotes[0])??"origin",r=(e==null?void 0:e.branch)??"",d=((A=e==null?void 0:e.aheadBehind)==null?void 0:A.ahead)??0,x=o.trim().length>0&&j>0,b=d>0||j===0;async function S(){if(x){a(!0),m(""),h("");try{const T=await fetch(`${g}/api/git/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:o.trim(),gitRoot:t})}),M=await T.json();if(!T.ok||M.error){m(M.error??"Commit failed");return}h(M.output??"Committed"),u(""),l()}catch(T){m(T instanceof Error?T.message:String(T))}finally{a(!1)}}}async function k(){a(!0),m(""),h("");try{const T=await fetch(`${g}/api/git/push`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:v,branch:r,gitRoot:t})}),M=await T.json();if(!T.ok||M.error){m(M.error??"Push failed");return}h(M.output||"Pushed successfully"),l()}catch(T){m(T instanceof Error?T.message:String(T))}finally{a(!1)}}async function z(){a(!0),m(""),h("");try{const T=await fetch(`${g}/api/git/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:o.trim(),gitRoot:t})}),M=await T.json();if(!T.ok||M.error){m(M.error??"Commit failed");return}const Z=await fetch(`${g}/api/git/push`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:v,branch:r,gitRoot:t})}),Ce=await Z.json();if(!Z.ok||Ce.error){h(`Committed. Push failed: ${Ce.error??""}`);return}h(`${M.output??"Committed"}
|
|
37
|
+
`),a=[],s=new Set(l),c=new Set(n);for(const o of l)c.has(o)||a.push({type:"removed",content:o});for(const o of n)s.has(o)?a.push({type:"unchanged",content:o}):a.push({type:"added",content:o});return a.slice(0,50)}function Hx({checkpoint:e,isSelected:t,onSelect:l}){const n=O();return i.jsx("button",{onClick:l,className:me("w-full text-left px-4 py-3 border-b transition-colors duration-100","hover:bg-white/[0.02]",t?"bg-white/[0.03]":""),style:{borderColor:"rgba(255,255,255,0.05)"},children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"mt-1 flex h-6 w-6 flex-shrink-0 items-center justify-center rounded",style:{background:`${n.info}1A`,border:`1px solid ${n.info}33`},children:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:n.info,strokeWidth:"2",children:i.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("span",{className:"font-mono text-sm font-medium text-zinc-300 truncate",children:e.label})}),i.jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[i.jsx("span",{className:"font-mono text-[11px] text-zinc-300",children:e.agentName}),i.jsx("span",{className:"text-zinc-700",children:"·"}),i.jsx("span",{className:"font-mono text-[11px] text-zinc-300",children:ct(new Date(e.timestamp),"HH:mm:ss")}),i.jsx("span",{className:"text-zinc-700",children:"·"}),i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[e.conversationHistory.length," messages"]}),e.fileSnapshots.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-zinc-700",children:"·"}),i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[e.fileSnapshots.length," files"]})]})]})]}),t&&i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:n.info,strokeWidth:"2",className:"flex-shrink-0 mt-1",children:i.jsx("polyline",{points:"20 6 9 17 4 12"})})]})})}function _x({checkpoint:e,prevCheckpoint:t}){const l=O(),[n,a]=C.useState("history"),s=[{id:"history",label:"Conversation"},{id:"state",label:"Agent State"},{id:"files",label:`Files (${e.fileSnapshots.length})`},...t?[{id:"diff",label:"Diff"}]:[]];return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between px-4 py-3 border-b",style:{borderColor:"rgba(255,255,255,0.08)"},children:[i.jsxs("div",{children:[i.jsx("p",{className:"font-mono text-sm font-semibold text-zinc-300",children:e.label}),i.jsxs("p",{className:"font-mono text-[11px] text-zinc-300 mt-0.5",children:[e.agentName," — ",ct(new Date(e.timestamp),"MMM d, HH:mm:ss")]})]}),i.jsx(p0,{content:"Restore — coming soon",side:"left",children:i.jsx("button",{disabled:!0,className:"h-8 rounded border px-3 text-xs font-mono text-zinc-300 cursor-not-allowed opacity-40",style:{borderColor:"rgba(255,255,255,0.08)"},children:"Restore"})})]}),i.jsx("div",{className:"flex flex-shrink-0 gap-1 border-b px-4 pt-2",style:{borderColor:"rgba(255,255,255,0.08)"},children:s.map(c=>i.jsx("button",{onClick:()=>a(c.id),className:"px-3 py-1.5 font-mono text-[11px] border-b-2 transition-colors",style:n===c.id?{borderColor:l.running,color:l.running}:{borderColor:"transparent",color:"#52525b"},children:c.label},c.id))}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[n==="history"&&i.jsx("div",{className:"space-y-3",children:e.conversationHistory.map((c,o)=>i.jsxs("div",{className:me("flex gap-3",c.role==="assistant"?"flex-row-reverse":""),children:[i.jsx("div",{className:"flex-shrink-0 h-6 w-6 rounded-full flex items-center justify-center text-[10px] font-mono font-bold",style:{background:c.role==="assistant"?`${l.running}1E`:`${l.info}1E`,border:`1px solid ${c.role==="assistant"?l.running:l.info}33`,color:c.role==="assistant"?l.running:l.info},children:c.role==="assistant"?"A":"U"}),i.jsx("div",{className:"flex-1 rounded-lg px-3 py-2 text-xs font-mono text-zinc-300 max-w-[80%]",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.06)"},children:i.jsx("p",{className:"whitespace-pre-wrap break-words",children:typeof c.content=="string"?c.content.length>500?c.content.slice(0,500)+"…":c.content:JSON.stringify(c.content)})})]},o))}),n==="state"&&i.jsx("pre",{className:"rounded-md p-3 text-[11px] font-mono text-zinc-300 overflow-x-auto",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.06)"},children:JSON.stringify(e.agentState,null,2)}),n==="files"&&i.jsx("div",{className:"space-y-3",children:e.fileSnapshots.length===0?i.jsx("p",{className:"text-xs font-mono text-zinc-300",children:"No file snapshots in this checkpoint"}):e.fileSnapshots.map((c,o)=>{var u;return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[i.jsx(Dl,{variant:"blue",size:"xs",children:((u=c.path.split(".").pop())==null?void 0:u.toUpperCase())??"FILE"}),i.jsx("span",{className:"font-mono text-[11px] text-zinc-400",children:c.path})]}),i.jsx("pre",{className:"rounded-md p-3 text-[11px] font-mono text-zinc-300 overflow-x-auto max-h-64",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.06)"},children:c.content.length>2e3?c.content.slice(0,2e3)+`
|
|
38
|
+
…`:c.content})]},o)})}),n==="diff"&&t&&i.jsx("div",{className:"space-y-3",children:i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"State Diff",className:"mb-2"}),i.jsx("div",{className:"font-mono text-[11px]",children:Rx(JSON.stringify(t.agentState,null,2),JSON.stringify(e.agentState,null,2)).map((c,o)=>i.jsxs("div",{className:"px-2 py-0.5",style:{background:c.type==="added"?`${l.success}0D`:c.type==="removed"?`${l.error}0D`:"transparent",color:c.type==="added"?l.success:c.type==="removed"?l.error:"#52525b"},children:[i.jsx("span",{className:"select-none mr-2",children:c.type==="added"?"+":c.type==="removed"?"-":" "}),c.content]},o))})]})})]})]})}function Lx(){const{checkpoints:e,selectedCheckpointId:t,selectCheckpoint:l,getPreviousCheckpoint:n}=Xo(),{activeSessionId:a}=ae(),s=O(),c=a?e.filter(f=>f.sessionId===a).sort((f,h)=>h.timestamp-f.timestamp):[...e].sort((f,h)=>h.timestamp-f.timestamp),o=t?e.find(f=>f.id===t):null,u=t?n(t):void 0;return i.jsxs("div",{className:"flex h-full",children:[i.jsxs("div",{className:"flex w-72 flex-shrink-0 flex-col border-r",style:{borderColor:"rgba(255,255,255,0.08)"},children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.08)",background:s.toolbarBg},children:[i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"Checkpoints"}),i.jsx("span",{className:"font-mono text-[11px] text-zinc-300",children:c.length})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:c.length===0?i.jsx(Ve,{icon:i.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),title:"No checkpoints yet",description:"Use ctx.checkpoint() in your agent to create checkpoints"}):c.map(f=>i.jsx(Hx,{checkpoint:f,isSelected:t===f.id,onSelect:()=>l(f.id)},f.id))})]}),i.jsx("div",{className:"flex-1 overflow-hidden",children:o?i.jsx(_x,{checkpoint:o,prevCheckpoint:u}):i.jsx(Ve,{title:"Select a checkpoint",description:"Click a checkpoint on the left to inspect it"})})]})}const Yl=cl((e,t)=>({servers:new Map,callRecords:[],upsertServer:l=>{e(n=>{const a=new Map(n.servers);return a.set(l.id,l),{servers:a}})},setServerStatus:(l,n)=>{e(a=>{const s=new Map(a.servers),c=s.get(l);return c?(s.set(l,{...c,status:n}),{servers:s}):{}})},updateHeartbeat:(l,n)=>{e(a=>{const s=new Map(a.servers),c=s.get(l);return c?(s.set(l,{...c,lastHeartbeat:n}),{servers:s}):{}})},addCallRecord:l=>{e(n=>({callRecords:[l,...n.callRecords].slice(0,500)})),e(n=>{const a=new Map(n.servers),s=a.get(l.serverId);return s?(a.set(l.serverId,{...s,callCount:s.callCount+1}),{servers:a}):{}})},updateCallRecord:(l,n)=>{e(a=>{const s=a.callRecords.findIndex(u=>u.callId===l);if(s<0)return{};const c=[...a.callRecords],o=c[s];if(!o)return{};if(c[s]={...o,...n},n.isError&&n.serverId){const u=new Map(a.servers),f=u.get(n.serverId);if(f)return u.set(n.serverId,{...f,errorCount:f.errorCount+1}),{callRecords:c,servers:u}}return{callRecords:c}})},getServerList:()=>Array.from(t().servers.values()),getAllTools:()=>{const l=[];for(const n of t().servers.values())for(const a of n.tools)l.push({...a,serverName:n.name,serverId:n.id});return l}}));function qx({server:e,isSelected:t,onSelect:l}){const n=O(),a=e.status==="connected";return i.jsxs("button",{onClick:l,className:"w-full text-left rounded-lg border p-3 transition-all duration-150",style:t?{borderColor:`${n.running}4D`,background:`${n.running}0D`}:{borderColor:"rgba(255,255,255,0.08)",background:"rgba(24,24,27,0.8)"},children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"h-2 w-2 rounded-full flex-shrink-0",style:{background:a?n.success:"#52525b",boxShadow:a?`0 0 6px ${n.success}`:"none"}}),i.jsx("span",{className:"font-mono text-sm font-medium text-zinc-300 truncate flex-1",children:e.name}),i.jsx(Dl,{variant:a?"green":"gray",size:"xs",children:e.status})]}),i.jsxs("div",{className:"flex items-center gap-3 text-[11px] font-mono text-zinc-300",children:[i.jsxs("span",{children:[e.tools.length," tools"]}),i.jsx("span",{children:"·"}),i.jsxs("span",{children:[e.callCount," calls"]}),e.errorCount>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"·"}),i.jsxs("span",{style:{color:n.error},children:[e.errorCount," errors"]})]}),e.lastHeartbeat&&i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"·"}),i.jsx("span",{children:T0(new Date(e.lastHeartbeat),{addSuffix:!0})})]})]})]})}function Yx({tools:e}){const t=O(),[l,n]=C.useState(""),[a,s]=C.useState(null),c=e.filter(o=>o.name.toLowerCase().includes(l.toLowerCase())||o.description.toLowerCase().includes(l.toLowerCase()));return i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"text",placeholder:"Search tools…",value:l,onChange:o=>n(o.target.value),className:"h-7 flex-1 rounded border bg-zinc-900/80 px-2.5 text-[11px] font-mono text-zinc-300 placeholder-zinc-700",style:{borderColor:"rgba(255,255,255,0.10)",outline:"none"}}),i.jsxs("span",{className:"text-[11px] font-mono text-zinc-300",children:[c.length," tools"]})]}),i.jsxs("div",{className:"space-y-1",children:[c.map(o=>{const u=`${o.serverId}:${o.name}`,f=a===u;return i.jsxs("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"rgba(255,255,255,0.07)"},children:[i.jsxs("button",{onClick:()=>s(f?null:u),className:"w-full flex items-center gap-3 px-3 py-2 hover:bg-white/[0.02] text-left transition-colors",children:[i.jsx("span",{className:"font-mono text-xs font-medium",style:{color:t.purple},children:o.name}),i.jsx("span",{className:"flex-1 truncate text-[11px] font-mono text-zinc-300",children:o.description}),i.jsx(Dl,{variant:"gray",size:"xs",children:o.serverName}),i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:me("text-zinc-700 transition-transform",f?"rotate-90":""),children:i.jsx("polyline",{points:"9 18 15 12 9 6"})})]}),f&&i.jsx("div",{className:"px-3 pb-3",children:i.jsx("pre",{className:"rounded-md p-2 text-[10px] font-mono text-zinc-400 overflow-x-auto",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.05)"},children:JSON.stringify(o.inputSchema,null,2)})})]},u)}),c.length===0&&l&&i.jsxs("p",{className:"text-center py-4 text-xs font-mono text-zinc-300",children:['No tools matching "',l,'"']})]})]})}function Gx({record:e}){const t=O(),[l,n]=C.useState(!1),a=e.status==="completed"?t.success:e.status==="error"?t.error:t.warn;return i.jsxs("div",{className:"border-b cursor-pointer hover:bg-white/[0.01] transition-colors",style:{borderColor:"rgba(255,255,255,0.05)"},onClick:()=>n(s=>!s),children:[i.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[i.jsx("div",{className:"h-1.5 w-1.5 rounded-full flex-shrink-0",style:{background:a}}),i.jsx("span",{className:"font-mono text-[11px]",style:{color:t.purple},children:e.toolName}),i.jsx("span",{className:"text-[10px] font-mono text-zinc-300",children:e.serverName}),i.jsx("span",{className:"flex-1"}),e.durationMs!==void 0&&i.jsxs("span",{className:"font-mono text-[10px] text-zinc-300",children:[e.durationMs,"ms"]}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-700",children:new Date(e.timestamp).toLocaleTimeString("en",{hour12:!1})}),i.jsx(Dl,{variant:e.status==="completed"?"green":e.status==="error"?"red":"yellow",size:"xs",children:e.status})]}),l&&i.jsxs("div",{className:"px-3 pb-3 space-y-2",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-700 mb-1",children:"Input"}),i.jsx("pre",{className:"rounded p-2 text-[10px] font-mono text-zinc-400 overflow-x-auto",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.05)"},children:JSON.stringify(e.input,null,2)})]}),e.output!==void 0&&i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-700 mb-1",children:"Output"}),i.jsx("pre",{className:"rounded p-2 text-[10px] font-mono text-zinc-400 overflow-x-auto max-h-40",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.05)"},children:JSON.stringify(e.output,null,2)})]})]})]})}function Xx(){const{servers:e,callRecords:t,getServerList:l,getAllTools:n}=Yl(),a=O(),[s,c]=C.useState(null),o=l(),u=n(),f=s?t.filter(p=>p.serverId===s):t,h=t.length>0?(t.filter(p=>p.status==="error").length/t.length*100).toFixed(1):"0.0";return o.length===0?i.jsxs("div",{className:"flex h-full flex-col",children:[i.jsx("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.08)",background:a.toolbarBg},children:i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"MCP Monitor"})}),i.jsx(Ve,{icon:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),i.jsx("polyline",{points:"15 3 21 3 21 9"}),i.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),title:"No MCP servers connected",description:"MCP server data will appear when agents use tool servers"})]}):i.jsxs("div",{className:"flex h-full overflow-hidden",children:[i.jsxs("div",{className:"flex w-72 flex-shrink-0 flex-col border-r overflow-y-auto",style:{borderColor:"rgba(255,255,255,0.08)"},children:[i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-3 border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.08)",background:a.toolbarBg},children:[i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"MCP Monitor"}),i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[o.filter(p=>p.status==="connected").length,"/",o.length," online"]})]}),i.jsx("div",{className:"p-3 space-y-2",children:i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-700 mb-1",children:"Total Calls"}),i.jsx("p",{className:"font-mono text-lg font-semibold",style:{color:a.info},children:t.length})]}),i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-700 mb-1",children:"Error Rate"}),i.jsxs("p",{className:"font-mono text-lg font-semibold",style:{color:parseFloat(h)>5?a.error:a.success},children:[h,"%"]})]})]})}),i.jsxs("div",{className:"px-3 pb-3 space-y-2",children:[i.jsx("button",{onClick:()=>c(null),className:"w-full text-left rounded-md border px-3 py-2 text-xs font-mono transition-colors",style:s===null?{borderColor:`${a.running}4D`,background:`${a.running}0D`,color:a.running}:{borderColor:"rgba(255,255,255,0.08)",color:"#52525b"},children:"All Servers"}),o.map(p=>i.jsx(qx,{server:p,isSelected:s===p.id,onSelect:()=>c(s===p.id?null:p.id)},p.id))]})]}),i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsx("div",{className:"flex-1 overflow-y-auto border-b p-4",style:{borderColor:"rgba(255,255,255,0.08)"},children:i.jsxs(ke,{glass:!0,padding:"sm",children:[i.jsx(et,{title:"Tool Registry",className:"mb-3"}),i.jsx(Yx,{tools:s?u.filter(p=>p.serverId===s):u})]})}),i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b flex-shrink-0",style:{borderColor:"rgba(255,255,255,0.08)",background:a.toolbarBg},children:[i.jsx("span",{className:"text-[11px] font-mono uppercase tracking-widest text-zinc-300",children:"Call Trace"}),i.jsxs("span",{className:"font-mono text-[11px] text-zinc-300",children:[f.length," calls"]})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:f.length===0?i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx("p",{className:"text-xs font-mono text-zinc-300",children:"No calls yet"})}):f.map(p=>i.jsx(Gx,{record:p},p.id))})]})]})]})}function Zc(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),l=Math.floor(e%6e4/1e3);return l>0?`${t}m ${l}s`:`${t}m`}function en(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Qx({data:e,color:t}){const l=[{label:"Turns",value:String(e.turnCount)},{label:"Total Duration",value:Zc(e.totalDurationMs)},{label:"Avg Turn",value:Zc(e.avgTurnDurationMs)},{label:"Stop Reason",value:e.stopReason.replace("_"," ")},{label:"Model",value:e.model.replace("claude-","cl-")},{label:"Total Cost",value:`$${e.totalCostUsd.toFixed(8)}`},{label:"Input Tokens",value:en(e.inputTokens)},{label:"Output Tokens",value:en(e.outputTokens)},{label:"Cache Writes",value:en(e.cacheWriteTokens)},{label:"Cache Reads",value:en(e.cacheReadTokens)},{label:"Cache Saved",value:`$${e.cacheSavedUsd.toFixed(6)}`},{label:"Cache Hit Rate",value:`${e.cacheHitRate}%`}];return i.jsx("div",{className:"grid grid-cols-3 gap-2",children:l.map(({label:n,value:a})=>i.jsxs("div",{className:"rounded-md border px-3 py-2",style:{borderColor:"rgba(255,255,255,0.06)",background:"rgba(0,0,0,0.3)"},children:[i.jsx("div",{className:"text-[9px] font-mono uppercase tracking-widest text-zinc-600",children:n}),i.jsx("div",{className:"mt-0.5 font-mono text-xs font-semibold",style:{color:t},children:a})]},n))})}function Zx({toolBreakdown:e,topTools:t}){var s;const l=O(),n=t.length>0?t:Object.entries(e).sort((c,o)=>o[1]-c[1]).slice(0,10).map(([c,o])=>({name:c,count:o}));if(n.length===0)return i.jsx("div",{className:"text-xs text-zinc-600",children:"No tool calls recorded"});const a=((s=n[0])==null?void 0:s.count)??1;return i.jsx("div",{className:"space-y-1.5",children:n.map(({name:c,count:o})=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-24 shrink-0 truncate font-mono text-[11px] text-zinc-400",children:c}),i.jsxs("div",{className:"relative flex-1 h-4 rounded overflow-hidden",style:{background:"rgba(255,255,255,0.04)"},children:[i.jsx("div",{className:"absolute inset-y-0 left-0 rounded",style:{width:`${o/a*100}%`,background:`${l.info}44`}}),i.jsx("div",{className:"absolute inset-0 flex items-center px-1.5",style:{background:"transparent"},children:i.jsx("span",{className:"font-mono text-[10px]",style:{color:l.info},children:o})})]})]},c))})}function Vx({files:e}){const t=O();return e.length===0?i.jsx("div",{className:"text-xs text-zinc-600",children:"No files recorded"}):i.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:e.map((l,n)=>{const a=l.split("/"),s=a[a.length-1]??l,c=a.slice(0,-1).join("/");return i.jsxs("div",{className:"flex items-baseline gap-1.5 font-mono text-[11px]",children:[i.jsx("span",{style:{color:t.running},children:s}),c&&i.jsx("span",{className:"text-zinc-600 truncate",children:c})]},n)})})}function Jx(){const e=O(),{events:t}=at(),{activeSessionId:l}=ae(),n=C.useMemo(()=>{const s=(l?t.filter(c=>c.sessionId===l):t).find(c=>c.type==="session.summary");return s?s.payload:null},[t,l]);return n?i.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b px-4 py-2.5",style:{borderColor:"rgba(255,255,255,0.06)"},children:[i.jsx("span",{className:"text-xs font-mono uppercase tracking-widest text-zinc-500",children:"Session Intelligence"}),i.jsxs("span",{className:"font-mono text-[10px]",style:{color:e.running},children:[n.turnCount," turns · ",Zc(n.totalDurationMs)]})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[i.jsxs(ke,{padding:"sm",children:[i.jsx(et,{title:"Session Stats",className:"mb-3"}),i.jsx(Qx,{data:n,color:e.running})]}),i.jsxs(ke,{padding:"sm",children:[i.jsx(et,{title:"Tool Breakdown",subtitle:`${Object.values(n.toolBreakdown).reduce((a,s)=>a+s,0)} total calls`,className:"mb-3"}),i.jsx(Zx,{toolBreakdown:n.toolBreakdown,topTools:n.topTools})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs(ke,{padding:"sm",children:[i.jsx(et,{title:"Files Touched",subtitle:`${n.filesModified.length} file${n.filesModified.length!==1?"s":""}`,className:"mb-3"}),i.jsx(Vx,{files:n.filesModified})]}),i.jsxs(ke,{padding:"sm",children:[i.jsx(et,{title:"Cache Efficiency",className:"mb-3"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("span",{className:"text-[10px] font-mono text-zinc-600",children:"Hit Rate"}),i.jsxs("span",{className:"text-[10px] font-mono",style:{color:e.running},children:[n.cacheHitRate,"%"]})]}),i.jsx("div",{className:"h-2 rounded overflow-hidden",style:{background:"rgba(255,255,255,0.06)"},children:i.jsx("div",{className:"h-full rounded transition-all",style:{width:`${n.cacheHitRate}%`,background:e.running}})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-zinc-600",children:"Reads"}),i.jsx("div",{style:{color:e.info},children:en(n.cacheReadTokens)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-zinc-600",children:"Writes"}),i.jsx("div",{style:{color:e.warn},children:en(n.cacheWriteTokens)})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx("div",{className:"text-zinc-600",children:"Saved"}),i.jsxs("div",{style:{color:e.running},children:["$",n.cacheSavedUsd.toFixed(6)]})]})]})]})]})]})]})]}):i.jsx(Ve,{icon:i.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),i.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),title:"No Session Summary Yet",description:"Session intelligence is generated when a Claude Code session ends (Stop hook). Start and complete a Claude Code session to see analytics here."})}function Kx({cmd:e,index:t}){const l=O(),[n,a]=C.useState(!1),s=e.exitCode===0||e.exitCode===null,c=e.exitCode===null?"#52525b":e.exitCode===0?l.running:l.error,o=e.command.split(`
|
|
39
|
+
`),u=o[0]??"",f=o.length>1,h=n?e.command:u;return i.jsx("div",{className:"border-b transition-colors duration-100 hover:bg-white/[0.02]",style:{borderColor:"rgba(255,255,255,0.05)"},children:i.jsxs("div",{className:"flex items-start gap-3 px-4 py-2 cursor-pointer",onClick:()=>f&&a(p=>!p),children:[i.jsx("span",{className:"shrink-0 mt-0.5 w-6 text-right font-mono text-[10px] text-zinc-700 select-none",children:t+1}),i.jsx("div",{className:"shrink-0 mt-0.5 w-6 h-4 rounded text-[9px] font-mono font-bold flex items-center justify-center",style:{background:`${c}22`,color:c,border:`1px solid ${c}44`},children:e.exitCode??"?"}),i.jsxs("pre",{className:"flex-1 font-mono text-[11px] whitespace-pre-wrap break-all leading-relaxed",style:{color:s?"#d4d4d8":l.error},children:[h,f&&!n&&i.jsxs("span",{className:"ml-1 text-zinc-600 text-[10px]",children:["…",o.length-1," more line",o.length>2?"s":""]})]}),e.durationMs!==void 0&&i.jsx("span",{className:"shrink-0 font-mono text-[10px] text-zinc-600 mt-0.5",children:e.durationMs<1e3?`${e.durationMs}ms`:`${(e.durationMs/1e3).toFixed(1)}s`})]})})}function $x(){const e=O(),{events:t}=at(),{activeSessionId:l}=ae(),[n,a]=C.useState(""),[s,c]=C.useState(!1),o=C.useMemo(()=>{const p=(l?t.filter(y=>y.sessionId===l):t).find(y=>y.type==="session.summary");return p?p.payload.bashCommands??[]:[]},[t,l]),u=C.useMemo(()=>o.filter(h=>!(s&&h.exitCode!==null&&h.exitCode===0||n&&!h.command.toLowerCase().includes(n.toLowerCase()))),[o,n,s]),f=o.filter(h=>h.exitCode!==null&&h.exitCode!==0).length;return o.length===0?i.jsx(Ve,{icon:i.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polyline",{points:"4 17 10 11 4 5"}),i.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]}),title:"No Bash Commands",description:"Bash commands are captured when a Claude Code session ends. Complete a session that uses the Bash tool to see commands here."}):i.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-4 py-2",style:{borderColor:"rgba(255,255,255,0.06)"},children:[i.jsx("span",{className:"text-xs font-mono uppercase tracking-widest text-zinc-500",children:"Bash Inspector"}),i.jsxs("span",{className:"font-mono text-[10px] text-zinc-600",children:[o.length," commands",f>0&&i.jsxs("span",{style:{color:e.error},children:[" · ",f," errors"]})]}),i.jsx("div",{className:"flex-1"}),i.jsx("button",{onClick:()=>c(h=>!h),className:"flex items-center gap-1.5 rounded px-2 py-1 font-mono text-[10px] transition-colors",style:{background:s?`${e.error}22`:"rgba(255,255,255,0.04)",color:s?e.error:"#71717a",border:`1px solid ${s?`${e.error}44`:"rgba(255,255,255,0.08)"}`},children:"Errors Only"}),i.jsx("input",{type:"text",value:n,onChange:h=>a(h.target.value),placeholder:"filter commands...",className:"rounded border bg-transparent px-2 py-1 font-mono text-[11px] text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.08)",width:180}})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-4 py-1",style:{borderColor:"rgba(255,255,255,0.04)"},children:[i.jsx("div",{className:"w-6"}),i.jsx("div",{className:"w-6 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"exit"}),i.jsx("div",{className:"flex-1 text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"command"}),i.jsx("div",{className:"w-12 text-right text-[9px] font-mono uppercase tracking-widest text-zinc-700",children:"dur"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:u.length===0?i.jsx("div",{className:"flex items-center justify-center h-24 text-xs text-zinc-600 font-mono",children:"no matching commands"}):u.map((h,p)=>i.jsx(Kx,{cmd:h,index:p},p))})]})}function Fx(e,t){return[...e].sort((l,n)=>{switch(t){case"cost":return n.totalCostUsd-l.totalCostUsd;case"duration":{const a=l.endedAt?l.endedAt-l.startedAt:1/0;return(n.endedAt?n.endedAt-n.startedAt:1/0)-a}case"name":return l.name.localeCompare(n.name);case"date":default:return n.startedAt-l.startedAt}})}function Wx(e,t){if(!t)return"live";try{return jr(new Date(e),new Date(t))}catch{return"—"}}function Ix(e){return e===0?"—":e<.01?`$${e.toFixed(6)}`:`$${e.toFixed(4)}`}function Px({session:e,costUsd:t,isActive:l,meta:n,onSelect:a}){const s=O(),c=e.status==="active",o=Wx(e.startedAt,e.endedAt);return i.jsxs("div",{onClick:a,className:me("flex items-center gap-4 border-b px-5 py-3 cursor-pointer transition-colors",l?"bg-white/[0.04]":"hover:bg-white/[0.02]"),style:{borderColor:"rgba(255,255,255,0.04)"},children:[i.jsx("div",{className:"h-1.5 w-1.5 rounded-full flex-shrink-0",style:{background:l?s.running:"transparent",border:l?"none":"1px solid rgba(255,255,255,0.12)"}}),i.jsxs("div",{className:"w-48 flex-shrink-0 min-w-0",children:[i.jsx("div",{className:"font-mono text-[12px] text-zinc-200 truncate",children:e.name}),i.jsx("div",{className:"font-mono text-[10px] text-zinc-600 mt-0.5",children:ct(new Date(e.startedAt),"MMM d, HH:mm")})]}),i.jsx("div",{className:"w-14 flex-shrink-0",children:i.jsx("span",{className:"font-mono text-[9px] px-1.5 py-0.5 rounded",style:c?{background:`${s.running}1A`,color:s.running,border:`1px solid ${s.running}33`}:{background:"rgba(255,255,255,0.04)",color:"#52525b",border:"1px solid rgba(255,255,255,0.08)"},children:c?"live":"ended"})}),i.jsx("div",{className:"w-24 flex-shrink-0 font-mono text-[11px]",style:{color:c?s.running:"#71717a"},children:o}),i.jsx("div",{className:"w-24 flex-shrink-0 font-mono text-[12px]",style:{color:t>0?s.running:"#3f3f46"},children:Ix(t)}),i.jsx("div",{className:"w-14 flex-shrink-0 font-mono text-[11px]",style:{color:n.turnCount?s.info:"#3f3f46"},children:n.turnCount!==null?`${n.turnCount}t`:"—"}),i.jsx("div",{className:"w-14 flex-shrink-0 font-mono text-[11px]",style:{color:n.cacheHitRate!==null?s.warn:"#3f3f46"},children:n.cacheHitRate!==null?`${n.cacheHitRate}%`:"—"}),i.jsx("div",{className:"flex-1 flex flex-wrap gap-1 min-w-0",children:n.topTools.slice(0,5).map(u=>i.jsx("span",{className:"font-mono text-[9px] px-1 py-0.5 rounded",style:{background:"rgba(255,255,255,0.04)",color:"#71717a",border:"1px solid rgba(255,255,255,0.06)"},children:u},u))})]})}function ep(e){return{turnCount:e.turnCount,topTools:(e.topTools??[]).slice(0,5).map(t=>t.name),cacheHitRate:e.cacheHitRate}}function tp(){const{sessions:e,activeSessionId:t,setActiveSession:l}=ae(),{events:n}=at(),a=si(v=>v.summaries),s=O(),[c,o]=C.useState(""),[u,f]=C.useState("date"),h=C.useMemo(()=>{const v=new Map,r=new Map;for(const x of n){if(x.type!=="cost.update")continue;const b=x.payload.totalCostUsd??0;x.source==="hook"?v.set(x.sessionId,Math.max(v.get(x.sessionId)??0,b)):r.set(x.sessionId,(r.get(x.sessionId)??0)+b)}const d=new Map;for(const[x,b]of v)d.set(x,b);for(const[x,b]of r)d.set(x,(d.get(x)??0)+b);return d},[n]),p=v=>h.get(v.id)??v.totalCostUsd,m=C.useMemo(()=>{const v=c.toLowerCase().trim(),r=v?e.filter(d=>d.name.toLowerCase().includes(v)||d.id.toLowerCase().includes(v)):e;return Fx(r,u)},[e,c,u]),y=e.reduce((v,r)=>v+p(r),0),g=e.filter(v=>v.status==="active").length,j=[{key:"date",label:"Recent"},{key:"cost",label:"Cost"},{key:"duration",label:"Duration"},{key:"name",label:"Name"}];return e.length===0?i.jsx(Ve,{icon:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("polyline",{points:"12 6 12 12 16 14"})]}),title:"No sessions",description:"Sessions will appear here once Claude Code starts reporting to PRISM"}):i.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-5 py-2",style:{borderColor:"rgba(255,255,255,0.07)",background:s.toolbarBg},children:[i.jsxs("span",{className:"font-mono text-[10px] text-zinc-500",children:[e.length," sessions"]}),g>0&&i.jsxs("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded",style:{background:`${s.running}1A`,color:s.running},children:[g," live"]}),i.jsx("span",{className:"font-mono text-[10px]",style:{color:s.running},children:y>0?`$${y.toFixed(4)} total`:""}),i.jsx("div",{className:"flex-1"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:"sort:"}),j.map(({key:v,label:r})=>i.jsx("button",{onClick:()=>f(v),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors",style:u===v?{background:`${s.info}22`,color:s.info,border:`1px solid ${s.info}44`}:{color:"#52525b",border:"1px solid transparent"},children:r},v)),i.jsx("div",{className:"h-4 w-px mx-1",style:{background:"rgba(255,255,255,0.08)"}}),i.jsx("input",{type:"text",placeholder:"search sessions…",value:c,onChange:v=>o(v.target.value),className:"h-6 rounded border bg-transparent px-2 text-[11px] font-mono text-zinc-300 placeholder-zinc-700 outline-none focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.08)",width:160}}),c&&i.jsx("button",{onClick:()=>o(""),className:"font-mono text-[10px] text-zinc-600 hover:text-zinc-400",children:"✕"})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-4 border-b px-5 py-1.5",style:{borderColor:"rgba(255,255,255,0.04)",background:"rgba(0,0,0,0.25)"},children:[i.jsx("div",{className:"w-1.5 shrink-0"}),i.jsx("span",{className:"w-48 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Session"}),i.jsx("span",{className:"w-14 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Status"}),i.jsx("span",{className:"w-24 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Duration"}),i.jsx("span",{className:"w-24 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Cost"}),i.jsx("span",{className:"w-14 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Turns"}),i.jsx("span",{className:"w-14 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Cache"}),i.jsx("span",{className:"flex-1 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Top Tools"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:m.length===0?i.jsx("div",{className:"flex h-full items-center justify-center",children:i.jsxs("p",{className:"font-mono text-xs text-zinc-600",children:['No sessions match "',c,'"']})}):m.map(v=>i.jsx(Px,{session:v,costUsd:p(v),isActive:v.id===t,meta:a.has(v.id)?ep(a.get(v.id)):{turnCount:null,topTools:[],cacheHitRate:null},onSelect:()=>l(v.id)},v.id))})]})}function b0(e){return e===void 0?"—":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function lp(e){var s;const t=e.command;if(t)return((s=t.split(`
|
|
40
|
+
`)[0])==null?void 0:s.slice(0,80))??"";const l=e.file_path??e.path;if(l)return l;const n=e.pattern;return n||Object.keys(e).slice(0,2).map(c=>{var o;return`${c}: ${(o=JSON.stringify(e[c]))==null?void 0:o.slice(0,30)}`}).join(" ")}const np={Bash:"#FFAA00",Read:"#00BBFF",Write:"#00FF88",Edit:"#BB88FF",MultiEdit:"#BB88FF",Glob:"#00BBFF",Grep:"#00BBFF",Task:"#FF8844",WebFetch:"#FF3366",WebSearch:"#FF3366",TodoWrite:"#44FFBB",TodoRead:"#44FFBB"};function ii(e,t){return np[e]??t}function xr({data:e,label:t}){const l=O(),[n,a]=C.useState(!1),s=JSON.stringify(e,null,2);return i.jsxs("div",{className:"mt-3",children:[i.jsxs("button",{className:"flex items-center gap-1.5 mb-1",onClick:()=>a(c=>!c),children:[i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-widest",style:{color:"#52525b"},children:t}),i.jsx("span",{className:"font-mono text-[9px]",style:{color:"#52525b"},children:n?"▶":"▼"})]}),!n&&i.jsx("pre",{className:"rounded p-2.5 font-mono text-[10px] leading-relaxed overflow-x-auto whitespace-pre-wrap break-all",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.07)",color:l.info},children:s})]})}function ap({call:e,onClose:t}){const l=O(),n=ii(e.toolName,l.info),a=e.status==="error"?l.error:e.status==="complete"?l.running:l.warn;return i.jsxs("div",{className:"flex flex-col border-l overflow-hidden",style:{width:380,flexShrink:0,borderColor:"rgba(255,255,255,0.08)",background:"rgba(0,0,0,0.4)"},children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2 border-b",style:{borderColor:"rgba(255,255,255,0.06)"},children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-mono text-xs font-semibold px-2 py-0.5 rounded",style:{background:`${n}1A`,color:n,border:`1px solid ${n}44`},children:e.toolName}),e.status&&i.jsx("span",{className:"font-mono text-[9px]",style:{color:a},children:e.status})]}),i.jsx("button",{onClick:t,className:"text-zinc-600 hover:text-zinc-400 text-sm px-1",children:"✕"})]}),i.jsxs("div",{className:"flex gap-3 px-3 py-1.5 border-b shrink-0",style:{borderColor:"rgba(255,255,255,0.04)"},children:[i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:ct(new Date(e.timestamp),"HH:mm:ss.SSS")}),e.durationMs!==void 0&&i.jsx("span",{className:"font-mono text-[10px]",style:{color:l.warn},children:b0(e.durationMs)}),e.agentId&&i.jsxs("span",{className:"font-mono text-[10px] text-zinc-600 truncate",children:["agent: ",e.agentId.slice(0,12)]})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[i.jsx(xr,{data:e.input,label:"Input"}),e.output!==void 0&&i.jsx(xr,{data:e.output,label:"Output"})]})]})}function sp({call:e,isSelected:t,onSelect:l}){const n=O(),a=ii(e.toolName,n.info),s=e.status==="error"?n.error:e.status==="complete"?n.running:n.warn;return i.jsx("div",{className:me("border-b cursor-pointer transition-colors duration-100",t?"bg-white/[0.04]":"hover:bg-white/[0.02]"),style:{borderColor:"rgba(255,255,255,0.04)"},onClick:l,children:i.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",children:[i.jsx("span",{className:"w-24 shrink-0 font-mono text-[10px] text-zinc-500",children:ct(new Date(e.timestamp),"HH:mm:ss.SSS")}),i.jsx("span",{className:"w-28 shrink-0 font-mono text-[11px] font-medium truncate",style:{color:a},children:e.toolName}),i.jsx("span",{className:"flex-1 font-mono text-[11px] text-zinc-400 truncate",children:lp(e.input)}),e.durationMs!==void 0&&i.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-[10px]",style:{color:n.warn},children:b0(e.durationMs)}),e.status&&i.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-[9px] px-1.5 py-0.5 rounded",style:{color:s,background:`${s}1A`},children:e.status}),i.jsx("div",{className:"w-1 h-4 rounded-full shrink-0",style:{background:t?n.info:"transparent"}})]})})}function ip({calls:e}){const t=O(),l=e.length,n=e.filter(o=>o.status==="error").length,a=new Set(e.map(o=>o.toolName)).size,s=e.reduce((o,u)=>(o[u.toolName]=(o[u.toolName]??0)+1,o),{}),c=Object.entries(s).sort((o,u)=>u[1]-o[1])[0];return i.jsxs("div",{className:"flex gap-4 px-4 py-1.5 border-b shrink-0",style:{borderColor:"rgba(255,255,255,0.06)",background:"rgba(0,0,0,0.25)"},children:[i.jsx(Za,{label:"Total",value:String(l),color:t.info}),n>0&&i.jsx(Za,{label:"Errors",value:String(n),color:t.error}),i.jsx(Za,{label:"Unique Tools",value:String(a),color:t.purple}),c&&i.jsx(Za,{label:`Top: ${c[0]}`,value:`×${c[1]}`,color:ii(c[0],t.warn)})]})}function Za({label:e,value:t,color:l}){return i.jsxs("div",{className:"flex items-baseline gap-1.5",children:[i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-widest text-zinc-600",children:e}),i.jsx("span",{className:"font-mono text-xs font-semibold",style:{color:l},children:t})]})}function cp(){const e=O(),{events:t}=at(),{activeSessionId:l}=ae(),[n,a]=C.useState(""),[s,c]=C.useState("all"),[o,u]=C.useState(null),f=C.useMemo(()=>(l?t.filter(y=>y.sessionId===l):t).filter(y=>y.type==="tool.call").map(y=>{const g=y.payload;return{id:y.id,timestamp:y.timestamp,toolName:g.toolName??"unknown",agentId:g.agentId,callId:g.callId??g.toolCallId,status:g.status,input:g.input??{},output:g.output,durationMs:g.durationMs}}),[t,l]),h=C.useMemo(()=>["all",...Array.from(new Set(f.map(y=>y.toolName))).sort()],[f]),p=C.useMemo(()=>f.filter(m=>{if(s!=="all"&&m.toolName!==s)return!1;if(n){const y=n.toLowerCase();if(!m.toolName.toLowerCase().includes(y)&&!JSON.stringify(m.input).toLowerCase().includes(y))return!1}return!0}),[f,s,n]);return f.length===0?i.jsx(Ve,{icon:i.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),title:"No Tool Calls",description:"Tool calls will appear here as your agent runs. Start a Claude Code session to see Bash, Read, Write, and other tool calls in real time."}):i.jsxs("div",{className:"flex h-full overflow-hidden",children:[i.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-4 py-2 flex-wrap",style:{borderColor:"rgba(255,255,255,0.07)",background:e.toolbarBg},children:[i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-zinc-500",children:"Tool Inspector"}),i.jsx("div",{className:"h-4 w-px mx-1",style:{background:"rgba(255,255,255,0.08)"}}),i.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:h.map(m=>{const y=m==="all"?e.info:ii(m,e.info),g=s===m;return i.jsx("button",{onClick:()=>c(m),className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors capitalize",style:g?{background:`${y}22`,color:y,border:`1px solid ${y}44`}:{color:"#71717a",border:"1px solid transparent"},children:m},m)})}),i.jsx("div",{className:"flex-1"}),i.jsx("input",{type:"text",placeholder:"search input...",value:n,onChange:m=>a(m.target.value),className:"h-6 rounded border bg-transparent px-2 text-[11px] font-mono text-zinc-300 placeholder-zinc-700 outline-none focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.08)",width:150}}),n&&i.jsx("button",{onClick:()=>a(""),className:"font-mono text-[10px] text-zinc-600 hover:text-zinc-400",children:"✕"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:p.length})]}),i.jsx(ip,{calls:p}),i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-4 py-1",style:{borderColor:"rgba(255,255,255,0.04)",background:"rgba(0,0,0,0.25)"},children:[i.jsx("span",{className:"w-24 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Time"}),i.jsx("span",{className:"w-28 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Tool"}),i.jsx("span",{className:"flex-1 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Input Summary"}),i.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Dur"}),i.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Status"}),i.jsx("div",{className:"w-1"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:p.length===0?i.jsx("div",{className:"flex items-center justify-center h-24 font-mono text-xs text-zinc-600",children:"no matching tool calls"}):p.map(m=>i.jsx(sp,{call:m,isSelected:(o==null?void 0:o.id)===m.id,onSelect:()=>u(y=>(y==null?void 0:y.id)===m.id?null:m)},m.id))})]}),o&&i.jsx(ap,{call:o,onClose:()=>u(null)})]})}function op({level:e}){const t=O(),l=e==="error"?t.error:e==="warn"?t.warn:e==="debug"?t.purple:t.info;return i.jsx("span",{className:"shrink-0 font-mono text-[8px] uppercase tracking-widest px-1.5 py-0.5 rounded",style:{color:l,background:`${l}1A`,border:`1px solid ${l}33`},children:e})}function up({type:e}){const t=O(),n={log:"#52525b",state:t.warn,checkpoint:t.running,spawn:t.purple,complete:t.running}[e];return i.jsx("span",{className:"shrink-0 font-mono text-[8px] uppercase tracking-widest",style:{color:n},children:e})}function rp({step:e,showAgent:t}){const l=O(),[n,a]=C.useState(!1),s=!!e.detail;return i.jsxs("div",{className:me("border-b transition-colors",s?"cursor-pointer hover:bg-white/[0.02]":""),style:{borderColor:"rgba(255,255,255,0.04)"},onClick:()=>s&&a(c=>!c),children:[i.jsxs("div",{className:"flex items-start gap-3 px-4 py-2",children:[i.jsx("span",{className:"shrink-0 mt-0.5 font-mono text-[10px] text-zinc-600 w-24",children:ct(new Date(e.timestamp),"HH:mm:ss.SSS")}),i.jsx("div",{className:"shrink-0 mt-0.5 w-20",children:i.jsx(up,{type:e.type})}),i.jsx("div",{className:"shrink-0 mt-0.5 w-12",children:i.jsx(op,{level:e.level})}),t&&i.jsx("span",{className:"shrink-0 mt-0.5 w-24 font-mono text-[10px] truncate",style:{color:e.agentName?l.purple:"#3f3f46"},children:e.agentName??"—"}),i.jsx("span",{className:me("flex-1 font-mono text-[11px] break-all",n?"whitespace-pre-wrap":"truncate"),style:{color:e.level==="error"?l.error:e.level==="warn"?l.warn:"#d4d4d8"},children:e.message}),s&&i.jsx("span",{className:"shrink-0 font-mono text-[9px] text-zinc-600 mt-0.5",children:n?"▲":"▼"})]}),n&&e.detail&&i.jsx("div",{className:"px-4 pb-2 pl-44",children:i.jsx("pre",{className:"rounded p-2 font-mono text-[10px] whitespace-pre-wrap break-all",style:{background:"rgba(0,0,0,0.4)",border:"1px solid rgba(255,255,255,0.06)",color:l.info},children:e.detail})})]})}function pr({name:e,isActive:t,color:l,onClick:n}){return i.jsx("button",{onClick:n,className:"rounded px-2 py-0.5 font-mono text-[10px] transition-colors",style:t?{background:`${l}22`,color:l,border:`1px solid ${l}44`}:{color:"#71717a",border:"1px solid transparent"},children:e})}function fp(){const e=O(),{events:t}=at(),{activeSessionId:l}=ae(),n=be(v=>v.agents),[a,s]=C.useState("all"),[c,o]=C.useState("all"),[u,f]=C.useState(""),h=C.useMemo(()=>{const v=new Map;for(const[r,d]of n.entries())v.set(r,d.name);return v},[n]),p=C.useMemo(()=>(l?t.filter(r=>r.sessionId===l):t).filter(r=>["agent.log","agent.state_change","checkpoint.create","agent.spawn","agent.complete","loop.detected"].includes(r.type)).map(r=>{const d=r.payload,x=d.agentId,b=x?h.get(x):void 0;switch(r.type){case"agent.log":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:d.message??"",level:d.level??"info",type:"log",detail:d.data?JSON.stringify(d.data,null,2):void 0};case"agent.state_change":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:`State → ${d.nextState}${d.reason?` (${d.reason})`:""}`,level:d.nextState==="error"?"error":"info",type:"state"};case"checkpoint.create":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:`Checkpoint: ${d.label??""}`,level:"info",type:"checkpoint",detail:d.metadata?JSON.stringify(d.metadata,null,2):void 0};case"agent.spawn":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:d.name??b,message:`Agent spawned: ${d.name??x??""}`,level:"info",type:"spawn"};case"agent.complete":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:`Agent complete — ${(d.durationMs??0)>0?`${(d.durationMs/1e3).toFixed(1)}s`:"done"}${d.errorMessage?`: ${d.errorMessage}`:""}`,level:d.state==="error"?"error":"info",type:"complete"};case"loop.detected":return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:`Loop detected: ${d.toolName??""} called ${d.callCount??0}× in ${d.windowSeconds??60}s window`,level:"warn",type:"log"};default:return{id:r.id,timestamp:r.timestamp,agentId:x,agentName:b,message:JSON.stringify(d).slice(0,120),level:"debug",type:"log"}}}),[t,l,h]),m=C.useMemo(()=>{const v=new Map;for(const r of p)r.agentId&&!v.has(r.agentId)&&v.set(r.agentId,r.agentName??r.agentId.slice(0,8));return Array.from(v.entries())},[p]),y=C.useMemo(()=>{const v=[e.purple,e.info,e.running,e.warn,"#FF8844","#44FFBB"],r=new Map;return m.forEach(([d],x)=>r.set(d,v[x%v.length])),r},[m,e]),g=C.useMemo(()=>p.filter(v=>{var r;if(a!=="all"&&v.agentId!==a||c!=="all"&&v.level!==c)return!1;if(u){const d=u.toLowerCase();if(!v.message.toLowerCase().includes(d)&&!((r=v.agentName)!=null&&r.toLowerCase().includes(d)))return!1}return!0}),[p,a,c,u]),j=a==="all"&&m.length>1;return p.length===0?i.jsx(Ve,{icon:i.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("path",{d:"M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.44-3.54z"}),i.jsx("path",{d:"M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.44-3.54z"})]}),title:"No Reasoning Steps",description:"Agent logs, state transitions, and checkpoints will appear here as your agent runs."}):i.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-4 py-2 flex-wrap",style:{borderColor:"rgba(255,255,255,0.07)",background:e.toolbarBg},children:[i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-zinc-500 mr-1",children:"Reasoning"}),i.jsx("div",{className:"h-4 w-px",style:{background:"rgba(255,255,255,0.08)"}}),i.jsx(pr,{name:"all",isActive:a==="all",color:e.info,onClick:()=>s("all")}),m.map(([v,r])=>i.jsx(pr,{name:r,isActive:a===v,color:y.get(v)??e.purple,onClick:()=>s(v)},v)),i.jsx("div",{className:"h-4 w-px mx-1",style:{background:"rgba(255,255,255,0.08)"}}),["all","info","warn","error","debug"].map(v=>{const r=v==="all"?"#52525b":v==="error"?e.error:v==="warn"?e.warn:v==="debug"?e.purple:e.info;return i.jsx("button",{onClick:()=>o(v),className:"rounded px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-widest transition-colors",style:c===v?{background:`${r}22`,color:r,border:`1px solid ${r}44`}:{color:"#52525b",border:"1px solid transparent"},children:v},v)}),i.jsx("div",{className:"flex-1"}),i.jsx("input",{type:"text",placeholder:"search...",value:u,onChange:v=>f(v.target.value),className:"h-6 rounded border bg-transparent px-2 text-[11px] font-mono text-zinc-300 placeholder-zinc-700 outline-none focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.08)",width:130}}),u&&i.jsx("button",{onClick:()=>f(""),className:"font-mono text-[10px] text-zinc-600",children:"✕"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:g.length})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b px-4 py-1",style:{borderColor:"rgba(255,255,255,0.04)",background:"rgba(0,0,0,0.25)"},children:[i.jsx("span",{className:"w-24 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Time"}),i.jsx("span",{className:"w-20 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Type"}),i.jsx("span",{className:"w-12 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Level"}),j&&i.jsx("span",{className:"w-24 shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Agent"}),i.jsx("span",{className:"flex-1 font-mono text-[9px] uppercase tracking-widest text-zinc-700",children:"Message"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:g.length===0?i.jsx("div",{className:"flex items-center justify-center h-24 font-mono text-xs text-zinc-600",children:"no matching steps"}):g.map(v=>i.jsx(rp,{step:v,showAgent:j},v.id))})]})}const Vi={"claude-opus-4-6":2e5,"claude-sonnet-4-6":2e5,"claude-haiku-4-5":2e5,"claude-haiku-4-5-20251001":2e5,"claude-3-5-sonnet-20241022":2e5,"claude-3-5-haiku-20241022":2e5,"claude-3-opus-20240229":2e5,"claude-sonnet-4-5":2e5,"claude-sonnet-4-5-20251001":2e5};function gr(e){if(Vi[e])return Vi[e];for(const[t,l]of Object.entries(Vi))if(e.startsWith(t.split("-").slice(0,3).join("-")))return l;return 2e5}function dp({pct:e,color:t,label:l}){const n=Math.min(100,Math.max(0,e)),a=n>=90?"#FF3366":n>=70?"#FFAA00":t;return i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"shrink-0 font-mono text-[9px] uppercase tracking-widest text-zinc-600 w-20 text-right",children:l}),i.jsx("div",{className:"flex-1 rounded-full overflow-hidden",style:{height:6,background:"rgba(255,255,255,0.06)"},children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${n}%`,background:a,boxShadow:n>50?`0 0 8px ${a}66`:"none"}})}),i.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold w-12 text-right",style:{color:a},children:[n.toFixed(1),"%"]})]})}function Va({label:e,value:t,color:l,pct:n,total:a}){return i.jsxs("div",{className:"flex flex-col gap-1.5 rounded-lg p-3",style:{background:`${l}0D`,border:`1px solid ${l}22`},children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-widest",style:{color:`${l}99`},children:e}),i.jsx("span",{className:"font-mono text-xs font-bold",style:{color:l},children:t.toLocaleString()})]}),i.jsx("div",{className:"rounded-full overflow-hidden",style:{height:3,background:"rgba(255,255,255,0.06)"},children:i.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(100,n)}%`,background:l}})}),i.jsxs("span",{className:"font-mono text-[9px]",style:{color:`${l}77`},children:[a>0?(t/a*100).toFixed(1):"0","% of total"]})]})}function mp({point:e,maxTokens:t,isLast:l}){const n=O(),a=t>0?e.inputTokens/t*100:0,s=e.pct>=90?n.error:e.pct>=70?n.warn:n.info;return i.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[i.jsx("div",{className:"shrink-0 h-2 rounded-full transition-all",style:{width:`${Math.max(2,a)}%`,maxWidth:"100%",background:s,opacity:l?1:.5}}),i.jsxs("span",{className:"font-mono text-[9px] shrink-0",style:{color:s},children:[e.pct.toFixed(0),"%"]})]})}function hp(){const e=O(),{events:t}=at(),{activeSessionId:l}=ae(),n=C.useMemo(()=>(l?t.filter(v=>v.sessionId===l):t).filter(v=>v.type==="cost.update"),[t,l]),a=C.useMemo(()=>n.slice().reverse().map(j=>{const v=j.payload,r=v.inputTokens??0,d=v.outputTokens??0,x=v.cacheReadTokens??0,b=v.cacheWriteTokens??0,S=v.model??"",k=gr(S),z=k>0?r/k*100:0;return{timestamp:j.timestamp,inputTokens:r,outputTokens:d,cacheReadTokens:x,cacheWriteTokens:b,model:S,contextLimit:k,pct:z}}),[n]),s=C.useMemo(()=>a[a.length-1]??null,[a]),c=C.useMemo(()=>(l?t.filter(v=>v.sessionId===l):t).find(v=>v.type==="session.summary"),[t,l]),u=C.useMemo(()=>{if(!c)return null;const j=c.payload;return{input:j.inputTokens??0,output:j.outputTokens??0,cacheRead:j.cacheReadTokens??0,cacheWrite:j.cacheWriteTokens??0,model:c.payload.model??""}},[c])??(s?{input:s.inputTokens,output:s.outputTokens,cacheRead:s.cacheReadTokens,cacheWrite:s.cacheWriteTokens,model:s.model}:null),f=a.length>0?Math.max(...a.map(j=>j.inputTokens)):0;if(!u&&a.length===0)return i.jsx(Ve,{icon:i.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),i.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),i.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),title:"No Context Data",description:"Context window utilization will appear here once your agent makes API calls."});const h=u?gr(u.model):2e5,p=u?u.input:0,m=h>0?p/h*100:0,y=m>=90?e.error:m>=70?e.warn:e.running,g=u?u.input+u.output+u.cacheRead+u.cacheWrite:0;return i.jsxs("div",{className:"flex h-full flex-col overflow-y-auto p-5 gap-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"font-mono text-sm font-bold text-zinc-200",children:"Context Window"}),i.jsxs("p",{className:"font-mono text-[10px] text-zinc-600 mt-0.5",children:[(u==null?void 0:u.model)??"unknown model"," — ",h.toLocaleString()," token limit"]})]}),i.jsxs("div",{className:"flex flex-col items-end",style:{color:y},children:[i.jsxs("span",{className:"font-mono text-3xl font-bold leading-none",children:[m.toFixed(1),"%"]}),i.jsx("span",{className:"font-mono text-[10px] mt-0.5",children:"utilization"})]})]}),i.jsx("div",{className:"space-y-3",children:i.jsx(dp,{pct:m,color:e.info,label:"Input ctx"})}),u&&i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(Va,{label:"Input Tokens",value:u.input,color:e.info,pct:u.input/h*100,total:g}),i.jsx(Va,{label:"Output Tokens",value:u.output,color:e.running,pct:u.output/Math.max(u.output,1)*100,total:g}),i.jsx(Va,{label:"Cache Reads",value:u.cacheRead,color:e.warn,pct:g>0?u.cacheRead/g*100:0,total:g}),i.jsx(Va,{label:"Cache Writes",value:u.cacheWrite,color:e.purple,pct:g>0?u.cacheWrite/g*100:0,total:g})]}),m>=70&&i.jsxs("div",{className:"rounded-lg p-3 flex items-start gap-2",style:{background:`${y}0D`,border:`1px solid ${y}33`},children:[i.jsx("span",{className:"text-lg leading-none",children:m>=90?"⚠️":"📊"}),i.jsxs("div",{children:[i.jsx("p",{className:"font-mono text-xs font-semibold",style:{color:y},children:m>=90?"Context Critical":"Context Pressure"}),i.jsx("p",{className:"font-mono text-[10px] text-zinc-400 mt-1",children:m>=90?`Context window is ${m.toFixed(0)}% full. The model may truncate or refuse soon.`:`At ${m.toFixed(0)}% utilization. Consider summarizing or starting a new session.`})]})]}),a.length>1&&i.jsxs("div",{children:[i.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-widest text-zinc-600 mb-2",children:["Context Growth (",a.length," snapshots)"]}),i.jsx("div",{className:"space-y-0.5",children:a.map((j,v)=>i.jsx(mp,{point:j,maxTokens:f,isLast:v===a.length-1},j.timestamp))})]}),i.jsxs("div",{className:"rounded-lg p-3",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.06)"},children:[i.jsx("p",{className:"font-mono text-[9px] uppercase tracking-widest text-zinc-600 mb-2",children:"Model Limits"}),i.jsx("div",{className:"space-y-1",children:[{model:"claude-opus-4-6",limit:"200K",label:"Claude Opus 4.6"},{model:"claude-sonnet-4-6",limit:"200K",label:"Claude Sonnet 4.6"},{model:"claude-haiku-4-5",limit:"200K",label:"Claude Haiku 4.5"}].map(j=>{var r;const v=(r=u==null?void 0:u.model)==null?void 0:r.startsWith(j.model.split("-").slice(0,3).join("-"));return i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-mono text-[10px]",style:{color:v?e.running:"#52525b"},children:j.label}),i.jsx("span",{className:"font-mono text-[10px]",style:{color:v?e.info:"#3f3f46"},children:j.limit})]},j.model)})})]})]})}function xp({line:e}){const t=O();return e.startsWith("+++")||e.startsWith("---")?i.jsx("div",{className:"font-mono text-[10px] leading-relaxed",style:{color:"#71717a"},children:e}):e.startsWith("+")?i.jsx("div",{className:"font-mono text-[10px] leading-relaxed",style:{color:t.running,background:`${t.running}0A`},children:e}):e.startsWith("-")?i.jsx("div",{className:"font-mono text-[10px] leading-relaxed",style:{color:t.error,background:`${t.error}0A`},children:e}):e.startsWith("@@")?i.jsx("div",{className:"font-mono text-[10px] leading-relaxed",style:{color:t.info},children:e}):i.jsx("div",{className:"font-mono text-[10px] leading-relaxed text-zinc-500",children:e})}function j0({node:e,depth:t,statusMap:l,selectedFile:n,onSelect:a}){var y,g;const s=O(),[c,o]=C.useState(t<2),u=l.get(e.path),f=n===e.path;if(e.type==="dir"){const j=((y=e.children)==null?void 0:y.some(v=>l.has(v.path)))??!1;return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-1 cursor-pointer hover:bg-white/[0.03] rounded px-1 py-0.5",style:{paddingLeft:`${t*12+4}px`},onClick:()=>o(v=>!v),children:[i.jsx("span",{className:"font-mono text-[10px] text-zinc-600 shrink-0 w-3",children:c?"▾":"▸"}),i.jsxs("span",{className:"font-mono text-[10px] truncate",style:{color:j?s.warn:"#52525b"},children:[e.name,"/"]})]}),c&&((g=e.children)==null?void 0:g.map(v=>i.jsx(j0,{node:v,depth:t+1,statusMap:l,selectedFile:n,onSelect:a},v.path)))]})}let h="#52525b",p="",m="#52525b";return u&&(u.staged?(p=u.status,m=u.status==="A"?s.running:u.status==="D"?s.error:s.warn,h="#d4d4d8"):u.untracked?(p="?",m="#52525b",h="#71717a"):(p=u.workStatus,m=u.workStatus==="D"?s.error:s.warn,h="#a1a1aa")),i.jsxs("div",{className:me("flex items-center gap-1 cursor-pointer rounded px-1 py-0.5 transition-colors",f?"bg-white/[0.06]":"hover:bg-white/[0.03]"),style:{paddingLeft:`${t*12+4}px`},onClick:()=>u&&a(e.path,u.staged),children:[p?i.jsx("span",{className:"shrink-0 font-mono text-[9px] font-bold w-3 text-center",style:{color:m},children:p}):i.jsx("span",{className:"shrink-0 w-3"}),i.jsx("span",{className:"font-mono text-[10px] truncate",style:{color:h},children:e.name})]})}function Ji({title:e,files:t,color:l,selectedFile:n,staged:a,onSelect:s,onStage:c,onUnstage:o,onDiscard:u,loading:f}){const h=O(),[p,m]=C.useState(new Set);if(t.length===0)return null;const y=r=>{m(d=>{const x=new Set(d);return x.has(r)?x.delete(r):x.add(r),x})},g=t.every(r=>p.has(r.path)),j=()=>{m(g?new Set:new Set(t.map(r=>r.path)))},v=t.filter(r=>p.has(r.path)).map(r=>r.path);return i.jsxs("div",{className:"mb-1",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-1 sticky top-0",style:{background:"rgba(9,9,11,0.95)",borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:j,className:"flex items-center gap-1",children:i.jsx("span",{className:"w-3 h-3 rounded border flex items-center justify-center",style:{borderColor:g?l:"rgba(255,255,255,0.15)",background:g?l:"transparent"},children:g&&i.jsx("span",{style:{color:"#09090B",fontSize:8,fontWeight:900},children:"✓"})})}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-widest",style:{color:l},children:e}),i.jsx("span",{className:"font-mono text-[9px] px-1.5 py-0.5 rounded",style:{color:l,background:`${l}1A`,border:`1px solid ${l}33`},children:t.length})]}),i.jsx("div",{className:"flex items-center gap-1",children:v.length>0&&i.jsxs(i.Fragment,{children:[c&&i.jsxs("button",{disabled:f,onClick:()=>{c(v),m(new Set)},className:"font-mono text-[9px] px-1.5 py-0.5 rounded transition-colors disabled:opacity-40",style:{color:h.running,background:`${h.running}1A`,border:`1px solid ${h.running}33`},children:["Stage ",v.length]}),o&&i.jsxs("button",{disabled:f,onClick:()=>{o(v),m(new Set)},className:"font-mono text-[9px] px-1.5 py-0.5 rounded transition-colors disabled:opacity-40",style:{color:h.warn,background:`${h.warn}1A`,border:`1px solid ${h.warn}33`},children:["Unstage ",v.length]}),u&&i.jsxs("button",{disabled:f,onClick:()=>{confirm(`Discard changes to ${v.length} file(s)?`)&&(u(v),m(new Set))},className:"font-mono text-[9px] px-1.5 py-0.5 rounded transition-colors disabled:opacity-40",style:{color:h.error,background:`${h.error}1A`,border:`1px solid ${h.error}33`},children:["Discard ",v.length]})]})})]}),t.map(r=>{const d=a?r.status:r.untracked?"?":r.workStatus,x=d==="A"?h.running:d==="D"?h.error:d==="?"?"#52525b":h.warn,b=n===r.path;return i.jsxs("div",{className:me("flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors",b?"bg-white/[0.05]":"hover:bg-white/[0.02]"),onClick:()=>s(r.path,a),children:[i.jsx("button",{onClick:S=>{S.stopPropagation(),y(r.path)},className:"shrink-0",children:i.jsx("span",{className:"w-3 h-3 rounded border flex items-center justify-center",style:{borderColor:p.has(r.path)?x:"rgba(255,255,255,0.15)",background:p.has(r.path)?x:"transparent",display:"inline-flex"},children:p.has(r.path)&&i.jsx("span",{style:{color:"#09090B",fontSize:8,fontWeight:900},children:"✓"})})}),i.jsx("span",{className:"shrink-0 font-mono text-[9px] font-bold w-3 text-center",style:{color:x},children:d}),i.jsx("span",{className:"flex-1 font-mono text-[10px] text-zinc-300 truncate",title:r.path,children:r.path.split("/").pop()}),i.jsx("span",{className:"font-mono text-[9px] text-zinc-600 truncate max-w-32",title:r.path,children:r.path.includes("/")?r.path.slice(0,r.path.lastIndexOf("/")):""})]},r.path)})]})}function pp({status:e,gitRoot:t,onSuccess:l,loading:n,setLoading:a}){var A;const s=O(),{collectorUrl:c}=ni(),[o,u]=C.useState(""),[f,h]=C.useState(""),[p,m]=C.useState(""),y=C.useRef(null),g=c.replace(/^ws/,"http").replace(/\/ws$/,""),j=(e==null?void 0:e.staged.length)??0,v=(e==null?void 0:e.remotes[0])??"origin",r=(e==null?void 0:e.branch)??"",d=((A=e==null?void 0:e.aheadBehind)==null?void 0:A.ahead)??0,x=o.trim().length>0&&j>0,b=d>0||j===0;async function S(){if(x){a(!0),m(""),h("");try{const T=await fetch(`${g}/api/git/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:o.trim(),gitRoot:t})}),M=await T.json();if(!T.ok||M.error){m(M.error??"Commit failed");return}h(M.output??"Committed"),u(""),l()}catch(T){m(T instanceof Error?T.message:String(T))}finally{a(!1)}}}async function k(){a(!0),m(""),h("");try{const T=await fetch(`${g}/api/git/push`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:v,branch:r,gitRoot:t})}),M=await T.json();if(!T.ok||M.error){m(M.error??"Push failed");return}h(M.output||"Pushed successfully"),l()}catch(T){m(T instanceof Error?T.message:String(T))}finally{a(!1)}}async function z(){a(!0),m(""),h("");try{const T=await fetch(`${g}/api/git/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:o.trim(),gitRoot:t})}),M=await T.json();if(!T.ok||M.error){m(M.error??"Commit failed");return}const Z=await fetch(`${g}/api/git/push`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:v,branch:r,gitRoot:t})}),Ce=await Z.json();if(!Z.ok||Ce.error){h(`Committed. Push failed: ${Ce.error??""}`);return}h(`${M.output??"Committed"}
|
|
41
41
|
|
|
42
|
-
${Ce.output||"Pushed"}`),u(""),l()}catch(T){m(T instanceof Error?T.message:String(T))}finally{a(!1)}}return i.jsxs("div",{className:"flex flex-col h-full p-4 gap-4",children:[i.jsxs("div",{className:"rounded-lg p-3 flex items-center justify-between",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)"},children:[i.jsxs("div",{children:[i.jsx("p",{className:"font-mono text-xs font-semibold text-zinc-200",children:r}),i.jsxs("p",{className:"font-mono text-[10px] text-zinc-600",children:[j," staged file",j!==1?"s":"",(e==null?void 0:e.aheadBehind)&&i.jsxs("span",{className:"ml-2",style:{color:d>0?s.warn:"#52525b"},children:["↑",d," ↓",e.aheadBehind.behind]})]})]}),v&&i.jsx("span",{className:"font-mono text-[9px] text-zinc-600",children:v})]}),j===0&&i.jsx("div",{className:"rounded px-3 py-2 font-mono text-[10px]",style:{background:`${s.warn}0D`,border:`1px solid ${s.warn}22`,color:s.warn},children:"No staged changes. Stage files to commit."}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{className:"font-mono text-[9px] uppercase tracking-widest text-zinc-600",children:"Commit Message"}),i.jsx("textarea",{ref:y,value:o,onChange:T=>u(T.target.value),placeholder:"feat: describe what you changed...",rows:4,className:"rounded border bg-transparent px-3 py-2 font-mono text-xs text-zinc-200 placeholder-zinc-700 outline-none resize-none focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.10)",background:"rgba(0,0,0,0.3)"},onKeyDown:T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&S()}}),i.jsx("p",{className:"font-mono text-[9px] text-zinc-700",children:"⌘↵ to commit"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("button",{disabled:!x||n,onClick:S,className:"w-full rounded py-2 font-mono text-xs font-semibold transition-all disabled:opacity-40",style:{background:`${s.running}22`,color:s.running,border:`1px solid ${s.running}44`},children:n?"Working...":`Commit (${j} file${j!==1?"s":""})`}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("button",{disabled:n||!b,onClick:k,className:"flex-1 rounded py-1.5 font-mono text-xs transition-all disabled:opacity-40",style:{color:s.info,border:`1px solid ${s.info}44`,background:`${s.info}0D`},children:["Push",v?` → ${v}`:""]}),i.jsx("button",{disabled:!x||n,onClick:z,className:"flex-1 rounded py-1.5 font-mono text-xs transition-all disabled:opacity-40",style:{color:s.purple,border:`1px solid ${s.purple}44`,background:`${s.purple}0D`},children:"Commit + Push"})]})]}),f&&i.jsx("div",{className:"rounded p-2.5 font-mono text-[10px] whitespace-pre-wrap",style:{background:`${s.running}0D`,border:`1px solid ${s.running}22`,color:s.running},children:f}),p&&i.jsx("div",{className:"rounded p-2.5 font-mono text-[10px] whitespace-pre-wrap",style:{background:`${s.error}0D`,border:`1px solid ${s.error}33`,color:s.error},children:p})]})}function yp(){const e=O(),{collectorUrl:t}=ni(),l=t.replace(/^ws/,"http").replace(/\/ws$/,""),{events:n}=at(),{activeSessionId:a}=ae(),[s,c]=C.useState(null),[o,u]=C.useState([]),[f,h]=C.useState(!1),[p,m]=C.useState(!1),[y,g]=C.useState(!1),[j,v]=C.useState(""),[r,d]=C.useState(""),[x,b]=C.useState(""),[S,k]=C.useState(null),[z,A]=C.useState(!1),[T,M]=C.useState(""),[Z,Ce]=C.useState("diff"),[rl,ci]=C.useState(!1),Ol=C.useMemo(()=>{const E=new Map;for(const V of n){if(V.type!=="git.context")continue;const oe=V.payload.gitRoot;if(!oe||E.has(oe))continue;const Be=oe.split("/").filter(Boolean),oi=Be.length>=2?`${Be[Be.length-2]}/${Be[Be.length-1]}`:Be[Be.length-1]??oe;E.set(oe,oi)}return Array.from(E.entries()).map(([V,oe])=>({root:V,label:oe}))},[n]);C.useEffect(()=>{if(!a)return;const E=n.find(V=>V.sessionId===a&&V.type==="git.context");if(E){const V=E.payload.gitRoot;V&&V!==r&&(d(V),b(""))}},[a,n]);const w=C.useCallback(async E=>{h(!0),v("");try{const V=E?`?gitRoot=${encodeURIComponent(E)}`:"",oe=await fetch(`${l}/api/git/status${V}`),Be=await oe.json();if(!oe.ok||Be.error){v(Be.error??"Failed to load git status");return}c(Be),d(Be.gitRoot)}catch(V){v(V instanceof Error?V.message:"Network error")}finally{h(!1)}},[l]),R=C.useCallback(async E=>{try{const oe=await(await fetch(`${l}/api/git/files?gitRoot=${encodeURIComponent(E)}`)).json();oe.tree&&u(oe.tree)}catch{}},[l]);C.useEffect(()=>{w(r||void 0)},[w,r]),C.useEffect(()=>{r&&rl&&R(r)},[r,rl,R]);const B=C.useCallback(async(E,V)=>{m(!0),M("");try{const oe=new URLSearchParams({file:E,gitRoot:r});V&&oe.set("staged","1");const oi=await(await fetch(`${l}/api/git/diff?${oe}`)).json();M(oi.diff??"")}catch{}finally{m(!1)}},[l,r]),F=C.useCallback((E,V)=>{k(E),A(V),Ce("diff"),B(E,V)},[B]);async function se(E){g(!0);try{await fetch(`${l}/api/git/stage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:E,gitRoot:r})}),await w(r)}finally{g(!1)}}async function Ul(E){g(!0);try{await fetch(`${l}/api/git/unstage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:E,gitRoot:r})}),await w(r)}finally{g(!1)}}async function Bl(E){g(!0);try{await fetch(`${l}/api/git/discard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:E,gitRoot:r})}),await w(r)}finally{g(!1)}}const Rl=new Map;if(s)for(const E of[...s.staged,...s.unstaged,...s.untracked])Rl.set(E.path,E);const xt=s?s.staged.length+s.unstaged.length+s.untracked.length:0;return i.jsxs("div",{className:"flex h-full overflow-hidden",children:[i.jsxs("div",{className:"flex flex-col overflow-hidden border-r",style:{width:320,flexShrink:0,borderColor:"rgba(255,255,255,0.08)"},children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",style:{borderColor:"rgba(255,255,255,0.08)",background:e.toolbarBg},children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",className:"shrink-0 text-zinc-400",children:[i.jsx("circle",{cx:"12",cy:"12",r:"4"}),i.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"6"}),i.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"22"}),i.jsx("line",{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76"}),i.jsx("line",{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07"}),i.jsx("line",{x1:"2",y1:"12",x2:"6",y2:"12"}),i.jsx("line",{x1:"18",y1:"12",x2:"22",y2:"12"}),i.jsx("line",{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24"}),i.jsx("line",{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93"})]}),s?i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{className:"font-mono text-xs font-semibold text-zinc-200 truncate block",children:s.branch}),s.aheadBehind&&i.jsxs("span",{className:"font-mono text-[9px]",style:{color:s.aheadBehind.ahead>0?e.warn:"#52525b"},children:["↑",s.aheadBehind.ahead," ↓",s.aheadBehind.behind]})]}):i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:"not a git repo"})]}),i.jsx("button",{onClick:()=>w(r),disabled:f,className:"shrink-0 p-1 rounded hover:bg-white/[0.05] transition-colors disabled:opacity-40",title:"Refresh",children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:f?"animate-spin":"",children:[i.jsx("polyline",{points:"23 4 23 10 17 10"}),i.jsx("polyline",{points:"1 20 1 14 7 14"}),i.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})})]}),i.jsxs("div",{className:"shrink-0 flex flex-col gap-0 border-b",style:{borderColor:"rgba(255,255,255,0.05)"},children:[Ol.length>0&&i.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b",style:{borderColor:"rgba(255,255,255,0.04)"},children:[i.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"shrink-0 text-zinc-600",children:[i.jsx("circle",{cx:"18",cy:"18",r:"3"}),i.jsx("circle",{cx:"6",cy:"6",r:"3"}),i.jsx("path",{d:"M13 6h3a2 2 0 0 1 2 2v7"}),i.jsx("line",{x1:"6",y1:"9",x2:"6",y2:"21"})]}),i.jsx("select",{value:r,onChange:E=>{d(E.target.value),b(""),w(E.target.value)},className:"flex-1 bg-transparent font-mono text-[10px] text-zinc-300 outline-none cursor-pointer",style:{background:"transparent"},children:Ol.map(({root:E,label:V})=>i.jsx("option",{value:E,style:{background:"#09090B",color:"#d4d4d8"},children:V},E))})]}),i.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5",children:[i.jsx("input",{type:"text",value:x,onChange:E=>b(E.target.value),onKeyDown:E=>{E.key==="Enter"&&w(x||void 0)},placeholder:r||"git root path (Enter to apply)",className:"flex-1 bg-transparent font-mono text-[10px] text-zinc-500 placeholder-zinc-700 outline-none truncate"}),x&&i.jsx("button",{onClick:()=>{w(x)},className:"shrink-0 font-mono text-[9px] px-1.5 py-0.5 rounded",style:{color:e.info,border:`1px solid ${e.info}33`},children:"Go"})]})]}),j&&i.jsx("div",{className:"shrink-0 px-3 py-2 font-mono text-[10px]",style:{color:e.error,background:`${e.error}0D`},children:j}),i.jsxs("div",{className:"flex-1 overflow-y-auto",children:[s&&i.jsxs(i.Fragment,{children:[xt===0&&i.jsx("div",{className:"flex items-center justify-center h-16 font-mono text-[10px] text-zinc-600",children:"Working tree clean"}),i.jsx(Ji,{title:"Staged",files:s.staged,color:e.running,selectedFile:S,staged:!0,onSelect:F,onUnstage:Ul,loading:y}),i.jsx(Ji,{title:"Changes",files:s.unstaged,color:e.warn,selectedFile:S,staged:!1,onSelect:F,onStage:se,onDiscard:Bl,loading:y}),i.jsx(Ji,{title:"Untracked",files:s.untracked,color:"#52525b",selectedFile:S,staged:!1,onSelect:F,onStage:se,loading:y})]}),r&&i.jsxs("div",{className:"mt-2 border-t",style:{borderColor:"rgba(255,255,255,0.06)"},children:[i.jsxs("button",{onClick:()=>ci(E=>!E),className:"flex items-center gap-1.5 w-full px-3 py-2 text-left hover:bg-white/[0.02] transition-colors",children:[i.jsx("span",{className:"font-mono text-[9px] text-zinc-600",children:rl?"▾":"▸"}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-widest text-zinc-600",children:"All Files"})]}),rl&&i.jsx("div",{className:"pb-2",children:o.map(E=>i.jsx(j0,{node:E,depth:0,statusMap:Rl,selectedFile:S,onSelect:F},E.path))})]})]})]}),i.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b px-3 py-1.5",style:{borderColor:"rgba(255,255,255,0.08)",background:e.toolbarBg},children:[["diff","commit"].map(E=>{const V=Z===E,oe=E==="commit"?e.running:e.info;return i.jsx("button",{onClick:()=>Ce(E),className:"rounded px-3 py-1 font-mono text-[10px] capitalize transition-colors",style:V?{background:`${oe}1A`,color:oe,border:`1px solid ${oe}33`}:{color:"#52525b",border:"1px solid transparent"},children:E==="commit"?i.jsxs("span",{className:"flex items-center gap-1",children:["Commit",s!=null&&s.staged.length?i.jsx("span",{className:"font-mono text-[8px] px-1 py-0.5 rounded-full",style:{background:`${e.running}22`,color:e.running},children:s.staged.length}):null]}):S?`diff: ${S.split("/").pop()}`:"Diff"},E)}),S&&Z==="diff"&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"font-mono text-[9px] text-zinc-600 mx-1",children:"—"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-400 truncate",children:S}),i.jsx("span",{className:"font-mono text-[9px] px-1.5 py-0.5 rounded ml-1",style:{color:z?e.running:e.warn,background:z?`${e.running}1A`:`${e.warn}1A`},children:z?"staged":"unstaged"})]})]}),Z==="diff"?i.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:p?i.jsx("div",{className:"flex items-center justify-center h-24 font-mono text-xs text-zinc-600",children:"Loading diff..."}):S?T?i.jsx("div",{children:T.split(`
|
|
43
|
-
`).map((E,V)=>i.jsx(pp,{line:E},V))}):i.jsx("div",{className:"flex items-center justify-center h-24 font-mono text-xs text-zinc-600",children:"No diff available"}):i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-center",children:[i.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",className:"text-zinc-700",children:[i.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),i.jsx("polyline",{points:"14 2 14 8 20 8"}),i.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),i.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),i.jsx("polyline",{points:"10 9 9 9 8 9"})]}),i.jsx("p",{className:"font-mono text-xs text-zinc-600",children:"Select a file to view its diff"})]})}):i.jsx(gp,{status:s,gitRoot:r,onSuccess:()=>w(r),loading:y,setLoading:g})]})]})}function vp({activePanel:e}){return i.jsxs("main",{className:"flex-1 overflow-hidden",children:[e==="events"&&i.jsx(Tx,{}),e==="agents"&&i.jsx(Ox,{}),e==="tools"&&i.jsx(op,{}),e==="reasoning"&&i.jsx(dp,{}),e==="context"&&i.jsx(xp,{}),e==="cost"&&i.jsx(Rx,{}),e==="checkpoints"&&i.jsx(qx,{}),e==="mcp"&&i.jsx(Qx,{}),e==="git"&&i.jsx(yp,{}),e==="bash"&&i.jsx(Fx,{}),e==="intelligence"&&i.jsx(Kx,{}),e==="history"&&i.jsx(lp,{})]})}const bp=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`,yr=1e3,jp=3e4,Sp=1.5;function Ki(e,t){if(!e)return t;try{return JSON.parse(e)}catch{return t}}function vr(e){const t=e.id,l=e.name??"";return{id:t,name:l||t.slice(0,8),startedAt:e.startedAt??e.started_at,endedAt:e.endedAt??e.ended_at??void 0,totalCostUsd:e.totalCostUsd??e.total_cost??0,totalEvents:e.totalEvents??e.total_tokens??0,agentCount:e.agentCount??e.agent_count??0,status:e.status==="active"?"active":"ended"}}function Np(e){const t=e.payload,l=typeof t=="string"?JSON.parse(t):t??{};return{id:e.id,sessionId:e.sessionId??e.session_id,timestamp:e.timestamp,type:e.type,source:e.source,payload:l}}function zp(e){return{id:e.id,sessionId:e.sessionId??e.session_id,parentId:e.parentId??e.parent_id,name:e.name,status:e.status,spawnedAt:e.spawnedAt??e.spawned_at,completedAt:e.completedAt??e.completed_at??void 0,depth:e.depth??0,loopCount:e.loopCount??e.loop_count??0,toolCallCount:0,logs:[],children:[]}}function Cp(e){const t=at.getState().addEvent,l=be.getState().upsertAgent,n=be.getState().updateAgentStatus,a=be.getState().incrementToolCallCount,s=be.getState().addAgentLog,c=be.getState().addLoopAlert,o=ae.getState().upsertSession,u=Yl.getState().upsertServer,f=Yl.getState().setServerStatus,h=Yl.getState().updateHeartbeat,p=Yl.getState().addCallRecord,m=Yl.getState().updateCallRecord,y=Xo.getState().addCheckpoint;switch(t(e),e.type){case"session.start":{const g=e.payload,j=g.sessionId??e.sessionId;o({id:j,name:g.name??j.slice(0,8),startedAt:g.startedAt??e.timestamp,totalCostUsd:0,totalEvents:0,agentCount:0,status:"active"});break}case"session.end":{const g=e.payload,j=g.sessionId??e.sessionId,r=ae.getState().sessions.find(d=>d.id===j);r&&o({...r,status:"ended",endedAt:e.timestamp,totalCostUsd:r.totalCostUsd||g.totalCostUsd,totalEvents:r.totalEvents||g.totalEvents});break}case"agent.spawn":{const g=e.payload;l({id:g.agentId,sessionId:e.sessionId,parentId:g.parentId,name:g.name,status:"running",spawnedAt:e.timestamp,depth:g.depth,loopCount:0,toolCallCount:0,logs:[],children:[]});const v=ae.getState().sessions.find(r=>r.id===e.sessionId);v&&ae.getState().upsertSession({...v,agentCount:v.agentCount+1});break}case"agent.complete":{const g=e.payload;n(g.agentId,"completed",e.timestamp);break}case"agent.state_change":{const g=e.payload;g.nextState==="error"?(n(g.agentId,"failed",e.timestamp),g.reason&&s(g.agentId,{timestamp:e.timestamp,message:`Failed: ${g.reason}`,level:"error"})):g.nextState==="complete"?n(g.agentId,"completed",e.timestamp):g.nextState==="running"?n(g.agentId,"running"):g.nextState==="waiting"&&n(g.agentId,"waiting");break}case"agent.fail":{const g=e.payload;n(g.agentId,"failed",e.timestamp),s(g.agentId,{timestamp:e.timestamp,message:`Agent failed: ${g.error}`,level:"error"});break}case"agent.log":{const g=e.payload;s(g.agentId,{timestamp:e.timestamp,message:g.message,level:g.level});break}case"agent.checkpoint":{const g=e.payload,j=be.getState().getAgent(g.agentId);y({id:g.checkpointId,sessionId:e.sessionId,agentId:g.agentId,agentName:(j==null?void 0:j.name)??g.agentId,label:g.label,timestamp:e.timestamp,conversationHistory:g.conversationHistory,agentState:g.agentState,fileSnapshots:g.fileSnapshots});break}case"checkpoint.create":{const g=e.payload,j=be.getState().getAgent(g.agentId);y({id:e.id,sessionId:e.sessionId,agentId:g.agentId,agentName:(j==null?void 0:j.name)??g.agentId,label:g.label,timestamp:e.timestamp,conversationHistory:[],agentState:g.metadata??{},fileSnapshots:[]});break}case"cost.update":break;case"tool.call":{const g=e.payload;a(g.agentId);break}case"session.summary":{si.getState().setSummary(e.sessionId,e.payload);break}case"loop.detected":{const g=e.payload,j=be.getState().getAgent(g.agentId);j&&be.getState().upsertAgent({...j,loopCount:g.loopCount}),c({id:e.id,agentId:g.agentId,agentName:g.agentName,toolName:g.toolName,loopCount:g.loopCount,detectedAt:e.timestamp});break}case"mcp.connect":{const g=e.payload;u({id:g.serverId,name:g.serverName,status:"connected",tools:g.tools,callCount:0,errorCount:0,lastHeartbeat:e.timestamp,connectedAt:e.timestamp});break}case"mcp.disconnect":{const g=e.payload;f(g.serverId,"disconnected");break}case"mcp.tool.call":{const g=e.payload;p({id:e.id,serverId:g.serverId,serverName:g.serverName,toolName:g.toolName,callId:g.callId,input:g.input,timestamp:e.timestamp,status:"pending"});break}case"mcp.tool.result":{const g=e.payload;m(g.callId,{output:g.output,durationMs:g.durationMs,isError:g.isError,status:g.isError?"error":"completed",serverId:g.serverId});break}case"mcp.heartbeat":{const g=e.payload;h(g.serverId,g.timestamp);break}}}function Tp(){const e=C.useRef(null),t=C.useRef(yr),l=C.useRef(null),n=C.useRef(!0),{setStatus:a,setLastHeartbeat:s}=ni(),{activeSessionId:c}=ae(),o=C.useCallback((p,m)=>{p.readyState===WebSocket.OPEN&&p.send(JSON.stringify({type:"subscribe",sessionId:m}))},[]),u=C.useCallback(async()=>{var p;try{const[m,y]=await Promise.allSettled([(async()=>{var r;const g=[];let j=1,v=1;do{const d=await fetch(`/api/sessions?page=${j}&pageSize=100`);if(!d.ok)break;const x=await d.json();Array.isArray(x.data)&&g.push(...x.data),v=((r=x.meta)==null?void 0:r.totalPages)??1,j++}while(j<=v);return g})(),fetch("/api/summaries").then(g=>g.ok?g.json():null)]);if(m.status==="fulfilled"){const g=m.value.map(j=>vr(j));ae.getState().setSessions(g)}if(y.status==="fulfilled"&&((p=y.value)!=null&&p.data)){const g=si.getState().setSummary;for(const{sessionId:j,summary:v}of y.value.data)j&&v&&g(j,v)}}catch{}},[]),f=C.useCallback(()=>{n.current&&(l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{t.current=Math.min(t.current*Sp,jp),h()},t.current))},[]),h=C.useCallback(()=>{if(!n.current||e.current&&e.current.readyState===WebSocket.OPEN)return;a("connecting");const p=new WebSocket(bp);e.current=p,p.onopen=()=>{if(!n.current)return;t.current=yr,a("connected"),s(Date.now()),o(p,"*"),u();const m=ae.getState().activeSessionId;m&&o(p,m)},p.onmessage=m=>{if(!n.current)return;s(Date.now());let y;try{y=JSON.parse(m.data)}catch{return}if(y.type==="event")Cp(y.data);else if(y.type==="snapshot"){const g=y.data,j=g.session,v=g.events??[],r=g.agents??[],d=g.checkpoints??[];ae.getState().upsertSession(vr(j)),at.getState().addEvents(v.map(Np));for(const x of r)be.getState().upsertAgent(zp(x));for(const x of d){const b=x.agent_id??x.agentId;if(!b)continue;const S=be.getState().getAgent(b);Xo.getState().addCheckpoint({id:x.id,sessionId:x.session_id??x.sessionId,agentId:b,agentName:(S==null?void 0:S.name)??b,label:x.label,timestamp:x.created_at??x.createdAt,conversationHistory:Ki(x.conversation_history,[]),agentState:Ki(x.agent_state,{}),fileSnapshots:Ki(x.file_snapshots,[])})}}else y.type==="error"&&console.error("[PRISM WS]",y.data.message)},p.onclose=()=>{n.current&&(a("disconnected"),e.current=null,f())},p.onerror=()=>{n.current&&a("error")}},[u,f,s,a,o]);return C.useEffect(()=>(n.current=!0,h(),()=>{var p;n.current=!1,l.current&&clearTimeout(l.current),(p=e.current)==null||p.close()}),[h]),C.useEffect(()=>{const p=setInterval(()=>{n.current&&u()},6e4);return()=>clearInterval(p)},[u]),C.useEffect(()=>{var p;c&&((p=e.current)==null?void 0:p.readyState)===WebSocket.OPEN&&o(e.current,c)},[c,o]),{send:p=>{var m;((m=e.current)==null?void 0:m.readyState)===WebSocket.OPEN&&e.current.send(JSON.stringify(p))}}}function kp(){const e=O(),{events:t}=at(),{activeSessionId:l,sessions:n}=ae(),a=n.find(h=>h.id===l),s=C.useMemo(()=>{const h=l?t.filter(k=>k.sessionId===l):[];let p=0,m=null,y=null;for(const k of h)if(k.type==="tool.call")p++;else if(k.type==="session.summary"&&m===null){const z=k.payload;m=z.turnCount,y=z.cacheHitRate}let g=0,j=0,v=0,r=0,d=0,x=0,b=0,S=0;for(const k of h){if(k.type!=="cost.update")continue;const z=k.payload,A=z;k.source==="hook"?(z.totalCostUsd??0)>g&&(g=z.totalCostUsd??0,j=z.inputTokens??0,v=z.outputTokens??0,r=A.cacheReadTokens??0):(d+=z.totalCostUsd??0,x+=z.inputTokens??0,b+=z.outputTokens??0,S+=A.cacheReadTokens??0)}return{hookCost:g,hookInputTokens:j,hookOutputTokens:v,hookCacheReadTokens:r,sdkCost:d,sdkInputTokens:x,sdkOutputTokens:b,sdkCacheReadTokens:S,toolCalls:p,turnCount:m,cacheHitRate:y,eventCount:h.length}},[t,l]);if(!a)return null;const c=s.hookCost>0,o=s.sdkCost>0,u=s.hookInputTokens+s.hookOutputTokens,f=s.sdkInputTokens+s.sdkOutputTokens;return i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-6 border-b px-5 py-1.5 overflow-x-auto",style:{borderColor:"rgba(255,255,255,0.06)",background:"rgba(0,0,0,0.3)"},children:[c&&i.jsx(Bt,{label:"Hook Cost",value:`$${s.hookCost.toFixed(6)}`,color:e.running,sub:u>0?`${s.hookInputTokens.toLocaleString()} in / ${s.hookOutputTokens.toLocaleString()} out`:void 0}),o&&i.jsx(Bt,{label:"SDK Cost",value:`$${s.sdkCost.toFixed(6)}`,color:e.running,sub:f>0?`${s.sdkInputTokens.toLocaleString()} in / ${s.sdkOutputTokens.toLocaleString()} out`:void 0}),!c&&!o&&i.jsx(Bt,{label:"Cost",value:"—",color:"#3f3f46"}),s.hookCacheReadTokens+s.sdkCacheReadTokens>0&&i.jsx(Bt,{label:"Cache Reads",value:(s.hookCacheReadTokens+s.sdkCacheReadTokens).toLocaleString(),color:e.warn}),s.cacheHitRate!==null&&i.jsx(Bt,{label:"Cache Hit",value:`${s.cacheHitRate}%`,color:e.warn}),s.turnCount!==null&&i.jsx(Bt,{label:"Turns",value:String(s.turnCount),color:e.purple}),i.jsx(Bt,{label:"Tools",value:String(s.toolCalls),color:e.purple}),i.jsx(Bt,{label:"Events",value:String(s.eventCount),color:"#52525b"})]})}function Bt({label:e,value:t,color:l,sub:n}){return i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("span",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-300",children:e}),i.jsx("span",{className:"font-mono text-sm font-semibold",style:{color:l},children:t}),n&&i.jsx("span",{className:"text-[10px] font-mono text-zinc-700",children:n})]})}function Ap(){const[e,t]=C.useState("events"),l=O(),n=ai(a=>a.themeId);return Tp(),i.jsxs("div",{"data-theme":n,className:"flex h-screen flex-col overflow-hidden",style:{background:l.bg,fontFamily:"Geist Sans, Inter, system-ui, sans-serif"},children:[i.jsx(rx,{}),i.jsx(kp,{}),i.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[i.jsx(bx,{activePanel:e,onPanelChange:t}),i.jsx(vp,{activePanel:e})]})]})}const S0=document.getElementById("root");if(!S0)throw new Error("Root element #root not found");nx.createRoot(S0).render(i.jsx(C.StrictMode,{children:i.jsx(Ap,{})}));
|
|
44
|
-
//# sourceMappingURL=index-
|
|
42
|
+
${Ce.output||"Pushed"}`),u(""),l()}catch(T){m(T instanceof Error?T.message:String(T))}finally{a(!1)}}return i.jsxs("div",{className:"flex flex-col h-full p-4 gap-4",children:[i.jsxs("div",{className:"rounded-lg p-3 flex items-center justify-between",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)"},children:[i.jsxs("div",{children:[i.jsx("p",{className:"font-mono text-xs font-semibold text-zinc-200",children:r}),i.jsxs("p",{className:"font-mono text-[10px] text-zinc-600",children:[j," staged file",j!==1?"s":"",(e==null?void 0:e.aheadBehind)&&i.jsxs("span",{className:"ml-2",style:{color:d>0?s.warn:"#52525b"},children:["↑",d," ↓",e.aheadBehind.behind]})]})]}),v&&i.jsx("span",{className:"font-mono text-[9px] text-zinc-600",children:v})]}),j===0&&i.jsx("div",{className:"rounded px-3 py-2 font-mono text-[10px]",style:{background:`${s.warn}0D`,border:`1px solid ${s.warn}22`,color:s.warn},children:"No staged changes. Stage files to commit."}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx("label",{className:"font-mono text-[9px] uppercase tracking-widest text-zinc-600",children:"Commit Message"}),i.jsx("textarea",{ref:y,value:o,onChange:T=>u(T.target.value),placeholder:"feat: describe what you changed...",rows:4,className:"rounded border bg-transparent px-3 py-2 font-mono text-xs text-zinc-200 placeholder-zinc-700 outline-none resize-none focus:border-zinc-500",style:{borderColor:"rgba(255,255,255,0.10)",background:"rgba(0,0,0,0.3)"},onKeyDown:T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&S()}}),i.jsx("p",{className:"font-mono text-[9px] text-zinc-700",children:"⌘↵ to commit"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("button",{disabled:!x||n,onClick:S,className:"w-full rounded py-2 font-mono text-xs font-semibold transition-all disabled:opacity-40",style:{background:`${s.running}22`,color:s.running,border:`1px solid ${s.running}44`},children:n?"Working...":`Commit (${j} file${j!==1?"s":""})`}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("button",{disabled:n||!b,onClick:k,className:"flex-1 rounded py-1.5 font-mono text-xs transition-all disabled:opacity-40",style:{color:s.info,border:`1px solid ${s.info}44`,background:`${s.info}0D`},children:["Push",v?` → ${v}`:""]}),i.jsx("button",{disabled:!x||n,onClick:z,className:"flex-1 rounded py-1.5 font-mono text-xs transition-all disabled:opacity-40",style:{color:s.purple,border:`1px solid ${s.purple}44`,background:`${s.purple}0D`},children:"Commit + Push"})]})]}),f&&i.jsx("div",{className:"rounded p-2.5 font-mono text-[10px] whitespace-pre-wrap",style:{background:`${s.running}0D`,border:`1px solid ${s.running}22`,color:s.running},children:f}),p&&i.jsx("div",{className:"rounded p-2.5 font-mono text-[10px] whitespace-pre-wrap",style:{background:`${s.error}0D`,border:`1px solid ${s.error}33`,color:s.error},children:p})]})}function gp(){const e=O(),{collectorUrl:t}=ni(),l=t.replace(/^ws/,"http").replace(/\/ws$/,""),{events:n}=at(),{activeSessionId:a}=ae(),[s,c]=C.useState(null),[o,u]=C.useState([]),[f,h]=C.useState(!1),[p,m]=C.useState(!1),[y,g]=C.useState(!1),[j,v]=C.useState(""),[r,d]=C.useState(""),[x,b]=C.useState(""),[S,k]=C.useState(null),[z,A]=C.useState(!1),[T,M]=C.useState(""),[Z,Ce]=C.useState("diff"),[rl,ci]=C.useState(!1),Ol=C.useMemo(()=>{const E=new Map;for(const V of n){if(V.type!=="git.context")continue;const oe=V.payload.gitRoot;if(!oe||E.has(oe))continue;const Be=oe.split("/").filter(Boolean),oi=Be.length>=2?`${Be[Be.length-2]}/${Be[Be.length-1]}`:Be[Be.length-1]??oe;E.set(oe,oi)}return Array.from(E.entries()).map(([V,oe])=>({root:V,label:oe}))},[n]);C.useEffect(()=>{if(!a)return;const E=n.find(V=>V.sessionId===a&&V.type==="git.context");if(E){const V=E.payload.gitRoot;V&&V!==r&&(d(V),b(""))}},[a,n]);const w=C.useCallback(async E=>{h(!0),v("");try{const V=E?`?gitRoot=${encodeURIComponent(E)}`:"",oe=await fetch(`${l}/api/git/status${V}`),Be=await oe.json();if(!oe.ok||Be.error){v(Be.error??"Failed to load git status");return}c(Be),d(Be.gitRoot)}catch(V){v(V instanceof Error?V.message:"Network error")}finally{h(!1)}},[l]),R=C.useCallback(async E=>{try{const oe=await(await fetch(`${l}/api/git/files?gitRoot=${encodeURIComponent(E)}`)).json();oe.tree&&u(oe.tree)}catch{}},[l]);C.useEffect(()=>{w(r||void 0)},[w,r]),C.useEffect(()=>{r&&rl&&R(r)},[r,rl,R]);const B=C.useCallback(async(E,V)=>{m(!0),M("");try{const oe=new URLSearchParams({file:E,gitRoot:r});V&&oe.set("staged","1");const oi=await(await fetch(`${l}/api/git/diff?${oe}`)).json();M(oi.diff??"")}catch{}finally{m(!1)}},[l,r]),F=C.useCallback((E,V)=>{k(E),A(V),Ce("diff"),B(E,V)},[B]);async function se(E){g(!0);try{await fetch(`${l}/api/git/stage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:E,gitRoot:r})}),await w(r)}finally{g(!1)}}async function Ul(E){g(!0);try{await fetch(`${l}/api/git/unstage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:E,gitRoot:r})}),await w(r)}finally{g(!1)}}async function Bl(E){g(!0);try{await fetch(`${l}/api/git/discard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:E,gitRoot:r})}),await w(r)}finally{g(!1)}}const Rl=new Map;if(s)for(const E of[...s.staged,...s.unstaged,...s.untracked])Rl.set(E.path,E);const xt=s?s.staged.length+s.unstaged.length+s.untracked.length:0;return i.jsxs("div",{className:"flex h-full overflow-hidden",children:[i.jsxs("div",{className:"flex flex-col overflow-hidden border-r",style:{width:320,flexShrink:0,borderColor:"rgba(255,255,255,0.08)"},children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",style:{borderColor:"rgba(255,255,255,0.08)",background:e.toolbarBg},children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",className:"shrink-0 text-zinc-400",children:[i.jsx("circle",{cx:"12",cy:"12",r:"4"}),i.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"6"}),i.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"22"}),i.jsx("line",{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76"}),i.jsx("line",{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07"}),i.jsx("line",{x1:"2",y1:"12",x2:"6",y2:"12"}),i.jsx("line",{x1:"18",y1:"12",x2:"22",y2:"12"}),i.jsx("line",{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24"}),i.jsx("line",{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93"})]}),s?i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{className:"font-mono text-xs font-semibold text-zinc-200 truncate block",children:s.branch}),s.aheadBehind&&i.jsxs("span",{className:"font-mono text-[9px]",style:{color:s.aheadBehind.ahead>0?e.warn:"#52525b"},children:["↑",s.aheadBehind.ahead," ↓",s.aheadBehind.behind]})]}):i.jsx("span",{className:"font-mono text-[10px] text-zinc-600",children:"not a git repo"})]}),i.jsx("button",{onClick:()=>w(r),disabled:f,className:"shrink-0 p-1 rounded hover:bg-white/[0.05] transition-colors disabled:opacity-40",title:"Refresh",children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:f?"animate-spin":"",children:[i.jsx("polyline",{points:"23 4 23 10 17 10"}),i.jsx("polyline",{points:"1 20 1 14 7 14"}),i.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})})]}),i.jsxs("div",{className:"shrink-0 flex flex-col gap-0 border-b",style:{borderColor:"rgba(255,255,255,0.05)"},children:[Ol.length>0&&i.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b",style:{borderColor:"rgba(255,255,255,0.04)"},children:[i.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"shrink-0 text-zinc-600",children:[i.jsx("circle",{cx:"18",cy:"18",r:"3"}),i.jsx("circle",{cx:"6",cy:"6",r:"3"}),i.jsx("path",{d:"M13 6h3a2 2 0 0 1 2 2v7"}),i.jsx("line",{x1:"6",y1:"9",x2:"6",y2:"21"})]}),i.jsx("select",{value:r,onChange:E=>{d(E.target.value),b(""),w(E.target.value)},className:"flex-1 bg-transparent font-mono text-[10px] text-zinc-300 outline-none cursor-pointer",style:{background:"transparent"},children:Ol.map(({root:E,label:V})=>i.jsx("option",{value:E,style:{background:"#09090B",color:"#d4d4d8"},children:V},E))})]}),i.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5",children:[i.jsx("input",{type:"text",value:x,onChange:E=>b(E.target.value),onKeyDown:E=>{E.key==="Enter"&&w(x||void 0)},placeholder:r||"git root path (Enter to apply)",className:"flex-1 bg-transparent font-mono text-[10px] text-zinc-500 placeholder-zinc-700 outline-none truncate"}),x&&i.jsx("button",{onClick:()=>{w(x)},className:"shrink-0 font-mono text-[9px] px-1.5 py-0.5 rounded",style:{color:e.info,border:`1px solid ${e.info}33`},children:"Go"})]})]}),j&&i.jsx("div",{className:"shrink-0 px-3 py-2 font-mono text-[10px]",style:{color:e.error,background:`${e.error}0D`},children:j}),i.jsxs("div",{className:"flex-1 overflow-y-auto",children:[s&&i.jsxs(i.Fragment,{children:[xt===0&&i.jsx("div",{className:"flex items-center justify-center h-16 font-mono text-[10px] text-zinc-600",children:"Working tree clean"}),i.jsx(Ji,{title:"Staged",files:s.staged,color:e.running,selectedFile:S,staged:!0,onSelect:F,onUnstage:Ul,loading:y}),i.jsx(Ji,{title:"Changes",files:s.unstaged,color:e.warn,selectedFile:S,staged:!1,onSelect:F,onStage:se,onDiscard:Bl,loading:y}),i.jsx(Ji,{title:"Untracked",files:s.untracked,color:"#52525b",selectedFile:S,staged:!1,onSelect:F,onStage:se,loading:y})]}),r&&i.jsxs("div",{className:"mt-2 border-t",style:{borderColor:"rgba(255,255,255,0.06)"},children:[i.jsxs("button",{onClick:()=>ci(E=>!E),className:"flex items-center gap-1.5 w-full px-3 py-2 text-left hover:bg-white/[0.02] transition-colors",children:[i.jsx("span",{className:"font-mono text-[9px] text-zinc-600",children:rl?"▾":"▸"}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-widest text-zinc-600",children:"All Files"})]}),rl&&i.jsx("div",{className:"pb-2",children:o.map(E=>i.jsx(j0,{node:E,depth:0,statusMap:Rl,selectedFile:S,onSelect:F},E.path))})]})]})]}),i.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b px-3 py-1.5",style:{borderColor:"rgba(255,255,255,0.08)",background:e.toolbarBg},children:[["diff","commit"].map(E=>{const V=Z===E,oe=E==="commit"?e.running:e.info;return i.jsx("button",{onClick:()=>Ce(E),className:"rounded px-3 py-1 font-mono text-[10px] capitalize transition-colors",style:V?{background:`${oe}1A`,color:oe,border:`1px solid ${oe}33`}:{color:"#52525b",border:"1px solid transparent"},children:E==="commit"?i.jsxs("span",{className:"flex items-center gap-1",children:["Commit",s!=null&&s.staged.length?i.jsx("span",{className:"font-mono text-[8px] px-1 py-0.5 rounded-full",style:{background:`${e.running}22`,color:e.running},children:s.staged.length}):null]}):S?`diff: ${S.split("/").pop()}`:"Diff"},E)}),S&&Z==="diff"&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"font-mono text-[9px] text-zinc-600 mx-1",children:"—"}),i.jsx("span",{className:"font-mono text-[10px] text-zinc-400 truncate",children:S}),i.jsx("span",{className:"font-mono text-[9px] px-1.5 py-0.5 rounded ml-1",style:{color:z?e.running:e.warn,background:z?`${e.running}1A`:`${e.warn}1A`},children:z?"staged":"unstaged"})]})]}),Z==="diff"?i.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:p?i.jsx("div",{className:"flex items-center justify-center h-24 font-mono text-xs text-zinc-600",children:"Loading diff..."}):S?T?i.jsx("div",{children:T.split(`
|
|
43
|
+
`).map((E,V)=>i.jsx(xp,{line:E},V))}):i.jsx("div",{className:"flex items-center justify-center h-24 font-mono text-xs text-zinc-600",children:"No diff available"}):i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-center",children:[i.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",className:"text-zinc-700",children:[i.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),i.jsx("polyline",{points:"14 2 14 8 20 8"}),i.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),i.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),i.jsx("polyline",{points:"10 9 9 9 8 9"})]}),i.jsx("p",{className:"font-mono text-xs text-zinc-600",children:"Select a file to view its diff"})]})}):i.jsx(pp,{status:s,gitRoot:r,onSuccess:()=>w(r),loading:y,setLoading:g})]})]})}function yp({activePanel:e}){return i.jsxs("main",{className:"flex-1 overflow-hidden",children:[e==="events"&&i.jsx(Cx,{}),e==="agents"&&i.jsx(Dx,{}),e==="tools"&&i.jsx(cp,{}),e==="reasoning"&&i.jsx(fp,{}),e==="context"&&i.jsx(hp,{}),e==="cost"&&i.jsx(Bx,{}),e==="checkpoints"&&i.jsx(Lx,{}),e==="mcp"&&i.jsx(Xx,{}),e==="git"&&i.jsx(gp,{}),e==="bash"&&i.jsx($x,{}),e==="intelligence"&&i.jsx(Jx,{}),e==="history"&&i.jsx(tp,{})]})}const vp=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`,yr=1e3,bp=3e4,jp=1.5;function Ki(e,t){if(!e)return t;try{return JSON.parse(e)}catch{return t}}function vr(e){const t=e.id,l=e.name??"";return{id:t,name:l||t.slice(0,8),startedAt:e.startedAt??e.started_at,endedAt:e.endedAt??e.ended_at??void 0,totalCostUsd:e.totalCostUsd??e.total_cost??0,totalEvents:e.totalEvents??e.total_tokens??0,agentCount:e.agentCount??e.agent_count??0,status:e.status==="active"?"active":"ended"}}function Sp(e){const t=e.payload,l=typeof t=="string"?JSON.parse(t):t??{};return{id:e.id,sessionId:e.sessionId??e.session_id,timestamp:e.timestamp,type:e.type,source:e.source,payload:l}}function Np(e){return{id:e.id,sessionId:e.sessionId??e.session_id,parentId:e.parentId??e.parent_id,name:e.name,status:e.status,spawnedAt:e.spawnedAt??e.spawned_at,completedAt:e.completedAt??e.completed_at??void 0,depth:e.depth??0,loopCount:e.loopCount??e.loop_count??0,toolCallCount:0,logs:[],children:[]}}function zp(e){const t=at.getState().addEvent,l=be.getState().upsertAgent,n=be.getState().updateAgentStatus,a=be.getState().incrementToolCallCount,s=be.getState().addAgentLog,c=be.getState().addLoopAlert,o=ae.getState().upsertSession,u=Yl.getState().upsertServer,f=Yl.getState().setServerStatus,h=Yl.getState().updateHeartbeat,p=Yl.getState().addCallRecord,m=Yl.getState().updateCallRecord,y=Xo.getState().addCheckpoint;switch(t(e),e.type){case"session.start":{const g=e.payload,j=g.sessionId??e.sessionId;o({id:j,name:g.name??j.slice(0,8),startedAt:g.startedAt??e.timestamp,totalCostUsd:0,totalEvents:0,agentCount:0,status:"active"});break}case"session.end":{const g=e.payload,j=g.sessionId??e.sessionId,r=ae.getState().sessions.find(d=>d.id===j);r&&o({...r,status:"ended",endedAt:e.timestamp,totalCostUsd:r.totalCostUsd||g.totalCostUsd,totalEvents:r.totalEvents||g.totalEvents});break}case"agent.spawn":{const g=e.payload;l({id:g.agentId,sessionId:e.sessionId,parentId:g.parentId,name:g.name,status:"running",spawnedAt:e.timestamp,depth:g.depth,loopCount:0,toolCallCount:0,logs:[],children:[]});const v=ae.getState().sessions.find(r=>r.id===e.sessionId);v&&ae.getState().upsertSession({...v,agentCount:v.agentCount+1});break}case"agent.complete":{const g=e.payload;n(g.agentId,"completed",e.timestamp);break}case"agent.state_change":{const g=e.payload;g.nextState==="error"?(n(g.agentId,"failed",e.timestamp),g.reason&&s(g.agentId,{timestamp:e.timestamp,message:`Failed: ${g.reason}`,level:"error"})):g.nextState==="complete"?n(g.agentId,"completed",e.timestamp):g.nextState==="running"?n(g.agentId,"running"):g.nextState==="waiting"&&n(g.agentId,"waiting");break}case"agent.fail":{const g=e.payload;n(g.agentId,"failed",e.timestamp),s(g.agentId,{timestamp:e.timestamp,message:`Agent failed: ${g.error}`,level:"error"});break}case"agent.log":{const g=e.payload;s(g.agentId,{timestamp:e.timestamp,message:g.message,level:g.level});break}case"agent.checkpoint":{const g=e.payload,j=be.getState().getAgent(g.agentId);y({id:g.checkpointId,sessionId:e.sessionId,agentId:g.agentId,agentName:(j==null?void 0:j.name)??g.agentId,label:g.label,timestamp:e.timestamp,conversationHistory:g.conversationHistory,agentState:g.agentState,fileSnapshots:g.fileSnapshots});break}case"checkpoint.create":{const g=e.payload,j=be.getState().getAgent(g.agentId);y({id:e.id,sessionId:e.sessionId,agentId:g.agentId,agentName:(j==null?void 0:j.name)??g.agentId,label:g.label,timestamp:e.timestamp,conversationHistory:[],agentState:g.metadata??{},fileSnapshots:[]});break}case"cost.update":break;case"tool.call":{const g=e.payload;a(g.agentId);break}case"session.summary":{si.getState().setSummary(e.sessionId,e.payload);break}case"loop.detected":{const g=e.payload,j=be.getState().getAgent(g.agentId);j&&be.getState().upsertAgent({...j,loopCount:g.loopCount}),c({id:e.id,agentId:g.agentId,agentName:g.agentName,toolName:g.toolName,loopCount:g.loopCount,detectedAt:e.timestamp});break}case"mcp.connect":{const g=e.payload;u({id:g.serverId,name:g.serverName,status:"connected",tools:g.tools,callCount:0,errorCount:0,lastHeartbeat:e.timestamp,connectedAt:e.timestamp});break}case"mcp.disconnect":{const g=e.payload;f(g.serverId,"disconnected");break}case"mcp.tool.call":{const g=e.payload;p({id:e.id,serverId:g.serverId,serverName:g.serverName,toolName:g.toolName,callId:g.callId,input:g.input,timestamp:e.timestamp,status:"pending"});break}case"mcp.tool.result":{const g=e.payload;m(g.callId,{output:g.output,durationMs:g.durationMs,isError:g.isError,status:g.isError?"error":"completed",serverId:g.serverId});break}case"mcp.heartbeat":{const g=e.payload;h(g.serverId,g.timestamp);break}}}function Cp(){const e=C.useRef(null),t=C.useRef(yr),l=C.useRef(null),n=C.useRef(!0),{setStatus:a,setLastHeartbeat:s}=ni(),{activeSessionId:c}=ae(),o=C.useCallback((p,m)=>{p.readyState===WebSocket.OPEN&&p.send(JSON.stringify({type:"subscribe",sessionId:m}))},[]),u=C.useCallback(async()=>{var p;try{const[m,y]=await Promise.allSettled([(async()=>{var r;const g=[];let j=1,v=1;do{const d=await fetch(`/api/sessions?page=${j}&pageSize=100`);if(!d.ok)break;const x=await d.json();Array.isArray(x.data)&&g.push(...x.data),v=((r=x.meta)==null?void 0:r.totalPages)??1,j++}while(j<=v);return g})(),fetch("/api/summaries").then(g=>g.ok?g.json():null)]);if(m.status==="fulfilled"){const g=m.value.map(j=>vr(j));ae.getState().setSessions(g)}if(y.status==="fulfilled"&&((p=y.value)!=null&&p.data)){const g=si.getState().setSummary;for(const{sessionId:j,summary:v}of y.value.data)j&&v&&g(j,v)}}catch{}},[]),f=C.useCallback(()=>{n.current&&(l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{t.current=Math.min(t.current*jp,bp),h()},t.current))},[]),h=C.useCallback(()=>{if(!n.current||e.current&&e.current.readyState===WebSocket.OPEN)return;a("connecting");const p=new WebSocket(vp);e.current=p,p.onopen=()=>{if(!n.current)return;t.current=yr,a("connected"),s(Date.now()),o(p,"*"),u();const m=ae.getState().activeSessionId;m&&o(p,m)},p.onmessage=m=>{if(!n.current)return;s(Date.now());let y;try{y=JSON.parse(m.data)}catch{return}if(y.type==="event")zp(y.data);else if(y.type==="snapshot"){const g=y.data,j=g.session,v=g.events??[],r=g.agents??[],d=g.checkpoints??[];ae.getState().upsertSession(vr(j)),at.getState().addEvents(v.map(Sp));for(const x of r)be.getState().upsertAgent(Np(x));for(const x of d){const b=x.agent_id??x.agentId;if(!b)continue;const S=be.getState().getAgent(b);Xo.getState().addCheckpoint({id:x.id,sessionId:x.session_id??x.sessionId,agentId:b,agentName:(S==null?void 0:S.name)??b,label:x.label,timestamp:x.created_at??x.createdAt,conversationHistory:Ki(x.conversation_history,[]),agentState:Ki(x.agent_state,{}),fileSnapshots:Ki(x.file_snapshots,[])})}}else y.type==="error"&&console.error("[PRISM WS]",y.data.message)},p.onclose=()=>{n.current&&(a("disconnected"),e.current=null,f())},p.onerror=()=>{n.current&&a("error")}},[u,f,s,a,o]);return C.useEffect(()=>(n.current=!0,h(),()=>{var p;n.current=!1,l.current&&clearTimeout(l.current),(p=e.current)==null||p.close()}),[h]),C.useEffect(()=>{const p=setInterval(()=>{n.current&&u()},6e4);return()=>clearInterval(p)},[u]),C.useEffect(()=>{var p;c&&((p=e.current)==null?void 0:p.readyState)===WebSocket.OPEN&&o(e.current,c)},[c,o]),{send:p=>{var m;((m=e.current)==null?void 0:m.readyState)===WebSocket.OPEN&&e.current.send(JSON.stringify(p))}}}function Tp(){const e=O(),{events:t}=at(),{activeSessionId:l,sessions:n}=ae(),a=n.find(h=>h.id===l),s=C.useMemo(()=>{const h=l?t.filter(k=>k.sessionId===l):[];let p=0,m=null,y=null;for(const k of h)if(k.type==="tool.call")p++;else if(k.type==="session.summary"&&m===null){const z=k.payload;m=z.turnCount,y=z.cacheHitRate}let g=0,j=0,v=0,r=0,d=0,x=0,b=0,S=0;for(const k of h){if(k.type!=="cost.update")continue;const z=k.payload,A=z;k.source==="hook"?(z.totalCostUsd??0)>g&&(g=z.totalCostUsd??0,j=z.inputTokens??0,v=z.outputTokens??0,r=A.cacheReadTokens??0):(d+=z.totalCostUsd??0,x+=z.inputTokens??0,b+=z.outputTokens??0,S+=A.cacheReadTokens??0)}return{hookCost:g,hookInputTokens:j,hookOutputTokens:v,hookCacheReadTokens:r,sdkCost:d,sdkInputTokens:x,sdkOutputTokens:b,sdkCacheReadTokens:S,toolCalls:p,turnCount:m,cacheHitRate:y,eventCount:h.length}},[t,l]);if(!a)return null;const c=s.hookCost>0,o=s.sdkCost>0,u=s.hookInputTokens+s.hookOutputTokens,f=s.sdkInputTokens+s.sdkOutputTokens;return i.jsxs("div",{className:"flex flex-shrink-0 items-center gap-6 border-b px-5 py-1.5 overflow-x-auto",style:{borderColor:"rgba(255,255,255,0.06)",background:"rgba(0,0,0,0.3)"},children:[c&&i.jsx(Bt,{label:"Hook Cost",value:`$${s.hookCost.toFixed(6)}`,color:e.running,sub:u>0?`${s.hookInputTokens.toLocaleString()} in / ${s.hookOutputTokens.toLocaleString()} out`:void 0}),o&&i.jsx(Bt,{label:"SDK Cost",value:`$${s.sdkCost.toFixed(6)}`,color:e.running,sub:f>0?`${s.sdkInputTokens.toLocaleString()} in / ${s.sdkOutputTokens.toLocaleString()} out`:void 0}),!c&&!o&&i.jsx(Bt,{label:"Cost",value:"—",color:"#3f3f46"}),s.hookCacheReadTokens+s.sdkCacheReadTokens>0&&i.jsx(Bt,{label:"Cache Reads",value:(s.hookCacheReadTokens+s.sdkCacheReadTokens).toLocaleString(),color:e.warn}),s.cacheHitRate!==null&&i.jsx(Bt,{label:"Cache Hit",value:`${s.cacheHitRate}%`,color:e.warn}),s.turnCount!==null&&i.jsx(Bt,{label:"Turns",value:String(s.turnCount),color:e.purple}),i.jsx(Bt,{label:"Tools",value:String(s.toolCalls),color:e.purple}),i.jsx(Bt,{label:"Events",value:String(s.eventCount),color:"#52525b"})]})}function Bt({label:e,value:t,color:l,sub:n}){return i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("span",{className:"text-[10px] font-mono uppercase tracking-widest text-zinc-300",children:e}),i.jsx("span",{className:"font-mono text-sm font-semibold",style:{color:l},children:t}),n&&i.jsx("span",{className:"text-[10px] font-mono text-zinc-700",children:n})]})}function kp(){const[e,t]=C.useState("events"),l=O(),n=ai(a=>a.themeId);return Cp(),i.jsxs("div",{"data-theme":n,className:"flex h-screen flex-col overflow-hidden",style:{background:l.bg,fontFamily:"Geist Sans, Inter, system-ui, sans-serif"},children:[i.jsx(rx,{}),i.jsx(Tp,{}),i.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[i.jsx(vx,{activePanel:e,onPanelChange:t}),i.jsx(yp,{activePanel:e})]})]})}const S0=document.getElementById("root");if(!S0)throw new Error("Root element #root not found");nx.createRoot(S0).render(i.jsx(C.StrictMode,{children:i.jsx(kp,{})}));
|
|
44
|
+
//# sourceMappingURL=index-4PSJ6wun.js.map
|