@goondocks/myco 1.1.2 → 1.2.0-beta.1
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.
|
@@ -8,7 +8,7 @@ Error generating stack: `+e.message+`
|
|
|
8
8
|
`+e.stack}}var he=Object.prototype.hasOwnProperty,ge=t.unstable_scheduleCallback,_e=t.unstable_cancelCallback,ve=t.unstable_shouldYield,ye=t.unstable_requestPaint,be=t.unstable_now,xe=t.unstable_getCurrentPriorityLevel,Se=t.unstable_ImmediatePriority,Ce=t.unstable_UserBlockingPriority,we=t.unstable_NormalPriority,Te=t.unstable_LowPriority,Ee=t.unstable_IdlePriority,De=t.log,Oe=t.unstable_setDisableYieldValue,ke=null,Ae=null;function je(e){if(typeof De==`function`&&Oe(e),Ae&&typeof Ae.setStrictMode==`function`)try{Ae.setStrictMode(ke,e)}catch{}}var Me=Math.clz32?Math.clz32:Fe,Ne=Math.log,Pe=Math.LN2;function Fe(e){return e>>>=0,e===0?32:31-(Ne(e)/Pe|0)|0}var Ie=256,Le=262144,Re=4194304;function ze(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Be(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=ze(n))):i=ze(o):i=ze(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ze(n))):i=ze(o)):i=ze(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ve(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function He(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function W(){var e=Re;return Re<<=1,!(Re&62914560)&&(Re=4194304),e}function G(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ue(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function We(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Me(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ge(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ge(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Me(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ke(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Me(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function qe(e,t){var n=t&-t;return n=n&42?1:Je(n),(n&(e.suspendedLanes|t))===0?n:0}function Je(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ye(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Xe(){var e=L.p;return e===0?(e=window.event,e===void 0?32:vp(e.type)):e}function Ze(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var Qe=Math.random().toString(36).slice(2),$e=`__reactFiber$`+Qe,et=`__reactProps$`+Qe,tt=`__reactContainer$`+Qe,nt=`__reactEvents$`+Qe,rt=`__reactListeners$`+Qe,it=`__reactHandles$`+Qe,at=`__reactResources$`+Qe,ot=`__reactMarker$`+Qe;function st(e){delete e[$e],delete e[et],delete e[nt],delete e[rt],delete e[it]}function ct(e){var t=e[$e];if(t)return t;for(var n=e.parentNode;n;){if(t=n[tt]||n[$e]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hf(e);e!==null;){if(n=e[$e])return n;e=hf(e)}return t}e=n,n=e.parentNode}return null}function lt(e){if(e=e[$e]||e[tt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ut(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function dt(e){var t=e[at];return t||=e[at]={hoistableStyles:new Map,hoistableScripts:new Map},t}function ft(e){e[ot]=!0}var pt=new Set,mt={};function ht(e,t){gt(e,t),gt(e+`Capture`,t)}function gt(e,t){for(mt[e]=t,e=0;e<t.length;e++)pt.add(t[e])}var _t=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),vt={},yt={};function bt(e){return he.call(yt,e)?!0:he.call(vt,e)?!1:_t.test(e)?yt[e]=!0:(vt[e]=!0,!1)}function xt(e,t,n){if(bt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function St(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Ct(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function wt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Tt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Et(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Dt(e){if(!e._valueTracker){var t=Tt(e)?`checked`:`value`;e._valueTracker=Et(e,t,``+e[t])}}function Ot(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Tt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function kt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var At=/[\n"\\]/g;function jt(e){return e.replace(At,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Mt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+wt(t)):e.value!==``+wt(t)&&(e.value=``+wt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Pt(e,o,wt(n)):Pt(e,o,wt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+wt(s):e.removeAttribute(`name`)}function Nt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Dt(e);return}n=n==null?``:``+wt(n),t=t==null?n:``+wt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Dt(e)}function Pt(e,t,n){t===`number`&&kt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ft(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+wt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function It(e,t,n){if(t!=null&&(t=``+wt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+wt(n)}function Lt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(F(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=wt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Dt(e)}function Rt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var zt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Bt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||zt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Vt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Bt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Bt(e,o,t[o])}function Ht(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Ut=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Wt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Gt(e){return Wt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Kt(){}var qt=null;function Jt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yt=null,Xt=null;function Zt(e){var t=lt(e);if(t&&(e=t.stateNode)){var n=e[et]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Mt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+jt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[et]||null;if(!a)throw Error(i(90));Mt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Ot(r)}break a;case`textarea`:It(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ft(e,!!n.multiple,t,!1)}}}var Qt=!1;function $t(e,t,n){if(Qt)return e(t,n);Qt=!0;try{return e(t)}finally{if(Qt=!1,(Yt!==null||Xt!==null)&&(xu(),Yt&&(t=Yt,e=Xt,Xt=Yt=null,Zt(t),e)))for(t=0;t<e.length;t++)Zt(e[t])}}function en(e,t){var n=e.stateNode;if(n===null)return null;var r=n[et]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var tn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),nn=!1;if(tn)try{var rn={};Object.defineProperty(rn,"passive",{get:function(){nn=!0}}),window.addEventListener(`test`,rn,rn),window.removeEventListener(`test`,rn,rn)}catch{nn=!1}var an=null,on=null,sn=null;function cn(){if(sn)return sn;var e,t=on,n=t.length,r,i=`value`in an?an.value:an.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return sn=i.slice(e,1<r?1-r:void 0)}function ln(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function un(){return!0}function dn(){return!1}function fn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?un:dn,this.isPropagationStopped=dn,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=un)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=un)},persist:function(){},isPersistent:un}),t}var pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mn=fn(pn),hn=m({},pn,{view:0,detail:0}),gn=fn(hn),_n,vn,yn,bn=m({},hn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==yn&&(yn&&e.type===`mousemove`?(_n=e.screenX-yn.screenX,vn=e.screenY-yn.screenY):vn=_n=0,yn=e),_n)},movementY:function(e){return`movementY`in e?e.movementY:vn}}),xn=fn(bn),Sn=fn(m({},bn,{dataTransfer:0})),Cn=fn(m({},hn,{relatedTarget:0})),wn=fn(m({},pn,{animationName:0,elapsedTime:0,pseudoElement:0})),Tn=fn(m({},pn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),En=fn(m({},pn,{data:0})),Dn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},On={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},kn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function An(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=kn[e])?!!t[e]:!1}function jn(){return An}var Mn=fn(m({},hn,{key:function(e){if(e.key){var t=Dn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=ln(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?On[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jn,charCode:function(e){return e.type===`keypress`?ln(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?ln(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Nn=fn(m({},bn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pn=fn(m({},hn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jn})),Fn=fn(m({},pn,{propertyName:0,elapsedTime:0,pseudoElement:0})),In=fn(m({},bn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Ln=fn(m({},pn,{newState:0,oldState:0})),Rn=[9,13,27,32],zn=tn&&`CompositionEvent`in window,Bn=null;tn&&`documentMode`in document&&(Bn=document.documentMode);var Vn=tn&&`TextEvent`in window&&!Bn,Hn=tn&&(!zn||Bn&&8<Bn&&11>=Bn),Un=` `,Wn=!1;function Gn(e,t){switch(e){case`keyup`:return Rn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Kn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var qn=!1;function Jn(e,t){switch(e){case`compositionend`:return Kn(t);case`keypress`:return t.which===32?(Wn=!0,Un):null;case`textInput`:return e=t.data,e===Un&&Wn?null:e;default:return null}}function Yn(e,t){if(qn)return e===`compositionend`||!zn&&Gn(e,t)?(e=cn(),sn=on=an=null,qn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Hn&&t.locale!==`ko`?null:t.data;default:return null}}var Xn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Xn[e.type]:t===`textarea`}function Qn(e,t,n,r){Yt?Xt?Xt.push(r):Xt=[r]:Yt=r,t=kd(t,`onChange`),0<t.length&&(n=new mn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var $n=null,er=null;function tr(e){xd(e,0)}function nr(e){if(Ot(ut(e)))return e}function rr(e,t){if(e===`change`)return t}var ir=!1;if(tn){var ar;if(tn){var or=`oninput`in document;if(!or){var sr=document.createElement(`div`);sr.setAttribute(`oninput`,`return;`),or=typeof sr.oninput==`function`}ar=or}else ar=!1;ir=ar&&(!document.documentMode||9<document.documentMode)}function cr(){$n&&($n.detachEvent(`onpropertychange`,lr),er=$n=null)}function lr(e){if(e.propertyName===`value`&&nr(er)){var t=[];Qn(t,er,e,Jt(e)),$t(tr,t)}}function ur(e,t,n){e===`focusin`?(cr(),$n=t,er=n,$n.attachEvent(`onpropertychange`,lr)):e===`focusout`&&cr()}function dr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return nr(er)}function fr(e,t){if(e===`click`)return nr(t)}function pr(e,t){if(e===`input`||e===`change`)return nr(t)}function mr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var hr=typeof Object.is==`function`?Object.is:mr;function gr(e,t){if(hr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!he.call(t,i)||!hr(e[i],t[i]))return!1}return!0}function _r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vr(e,t){var n=_r(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=_r(n)}}function yr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function br(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=kt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=kt(e.document)}return t}function xr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Sr=tn&&`documentMode`in document&&11>=document.documentMode,Cr=null,wr=null,Tr=null,Er=!1;function Dr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Er||Cr==null||Cr!==kt(r)||(r=Cr,`selectionStart`in r&&xr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Tr&&gr(Tr,r)||(Tr=r,r=kd(wr,`onSelect`),0<r.length&&(t=new mn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Cr)))}function Or(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var kr={animationend:Or(`Animation`,`AnimationEnd`),animationiteration:Or(`Animation`,`AnimationIteration`),animationstart:Or(`Animation`,`AnimationStart`),transitionrun:Or(`Transition`,`TransitionRun`),transitionstart:Or(`Transition`,`TransitionStart`),transitioncancel:Or(`Transition`,`TransitionCancel`),transitionend:Or(`Transition`,`TransitionEnd`)},Ar={},jr={};tn&&(jr=document.createElement(`div`).style,`AnimationEvent`in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),`TransitionEvent`in window||delete kr.transitionend.transition);function Mr(e){if(Ar[e])return Ar[e];if(!kr[e])return e;var t=kr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jr)return Ar[e]=t[n];return e}var Nr=Mr(`animationend`),Pr=Mr(`animationiteration`),Fr=Mr(`animationstart`),Ir=Mr(`transitionrun`),Lr=Mr(`transitionstart`),Rr=Mr(`transitioncancel`),zr=Mr(`transitionend`),Br=new Map,Vr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Vr.push(`scrollEnd`);function Hr(e,t){Br.set(e,t),ht(t,[e])}var Ur=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Wr=[],Gr=0,Kr=0;function qr(){for(var e=Gr,t=Kr=Gr=0;t<e;){var n=Wr[t];Wr[t++]=null;var r=Wr[t];Wr[t++]=null;var i=Wr[t];Wr[t++]=null;var a=Wr[t];if(Wr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Zr(n,i,a)}}function Jr(e,t,n,r){Wr[Gr++]=e,Wr[Gr++]=t,Wr[Gr++]=n,Wr[Gr++]=r,Kr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Yr(e,t,n,r){return Jr(e,t,n,r),Qr(e)}function Xr(e,t){return Jr(e,null,null,t),Qr(e)}function Zr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Me(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Qr(e){if(50<fu)throw fu=0,pu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $r={};function ei(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(e,t,n,r){return new ei(e,t,n,r)}function ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ri(e,t){var n=e.alternate;return n===null?(n=ti(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ii(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ai(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ni(e)&&(s=1);else if(typeof e==`string`)s=qf(e,n,te.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ti(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return oi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ti(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ti(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ti(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ti(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function oi(e,t,n,r){return e=ti(7,e,r,t),e.lanes=n,e}function si(e,t,n){return e=ti(6,e,null,t),e.lanes=n,e}function ci(e){var t=ti(18,null,null,0);return t.stateNode=e,t}function li(e,t,n){return t=ti(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ui=new WeakMap;function di(e,t){if(typeof e==`object`&&e){var n=ui.get(e);return n===void 0?(t={value:e,source:t,stack:me(t)},ui.set(e,t),t):n}return{value:e,source:t,stack:me(t)}}var fi=[],pi=0,mi=null,hi=0,gi=[],_i=0,vi=null,yi=1,bi=``;function xi(e,t){fi[pi++]=hi,fi[pi++]=mi,mi=e,hi=t}function Si(e,t,n){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,vi=e;var r=yi;e=bi;var i=32-Me(r)-1;r&=~(1<<i),n+=1;var a=32-Me(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,yi=1<<32-Me(t)+i|n<<i|r,bi=a+e}else yi=1<<a|n<<i|r,bi=e}function Ci(e){e.return!==null&&(xi(e,1),Si(e,1,0))}function wi(e){for(;e===mi;)mi=fi[--pi],fi[pi]=null,hi=fi[--pi],fi[pi]=null;for(;e===vi;)vi=gi[--_i],gi[_i]=null,bi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null}function Ti(e,t){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,yi=t.id,bi=t.overflow,vi=e}var Ei=null,Di=null,Oi=!1,ki=null,Ai=!1,ji=Error(i(519));function Mi(e){throw Ri(di(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ji}function Ni(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[$e]=e,t[et]=r,n){case`dialog`:Sd(`cancel`,t),Sd(`close`,t);break;case`iframe`:case`object`:case`embed`:Sd(`load`,t);break;case`video`:case`audio`:for(n=0;n<yd.length;n++)Sd(yd[n],t);break;case`source`:Sd(`error`,t);break;case`img`:case`image`:case`link`:Sd(`error`,t),Sd(`load`,t);break;case`details`:Sd(`toggle`,t);break;case`input`:Sd(`invalid`,t),Nt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Sd(`invalid`,t);break;case`textarea`:Sd(`invalid`,t),Lt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Fd(t.textContent,n)?(r.popover!=null&&(Sd(`beforetoggle`,t),Sd(`toggle`,t)),r.onScroll!=null&&Sd(`scroll`,t),r.onScrollEnd!=null&&Sd(`scrollend`,t),r.onClick!=null&&(t.onclick=Kt),t=!0):t=!1,t||Mi(e,!0)}function Pi(e){for(Ei=e.return;Ei;)switch(Ei.tag){case 5:case 31:case 13:Ai=!1;return;case 27:case 3:Ai=!0;return;default:Ei=Ei.return}}function Fi(e){if(e!==Ei)return!1;if(!Oi)return Pi(e),Oi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||qd(e.type,e.memoizedProps)),n=!n),n&&Di&&Mi(e),Pi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Di=mf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Di=mf(e)}else t===27?(t=Di,tf(e.type)?(e=pf,pf=null,Di=e):Di=t):Di=Ei?ff(e.stateNode.nextSibling):null;return!0}function Ii(){Di=Ei=null,Oi=!1}function Li(){var e=ki;return e!==null&&(Ql===null?Ql=e:Ql.push.apply(Ql,e),ki=null),e}function Ri(e){ki===null?ki=[e]:ki.push(e)}var zi=B(null),Bi=null,Vi=null;function Hi(e,t,n){H(zi,t._currentValue),t._currentValue=n}function Ui(e){e._currentValue=zi.current,V(zi)}function Wi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function K(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Wi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Wi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Gi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;hr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===re.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[np]:e.push(np))}a=a.return}e!==null&&K(t,e,n,r),t.flags|=262144}function Ki(e){for(e=e.firstContext;e!==null;){if(!hr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qi(e){Bi=e,Vi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ji(e){return Xi(Bi,e)}function Yi(e,t){return Bi===null&&qi(e),Xi(e,t)}function Xi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Vi===null){if(e===null)throw Error(i(308));Vi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Vi=Vi.next=t;return n}var Zi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Qi=t.unstable_scheduleCallback,$i=t.unstable_NormalPriority,ea={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ta(){return{controller:new Zi,data:new Map,refCount:0}}function na(e){e.refCount--,e.refCount===0&&Qi($i,function(){e.controller.abort()})}var ra=null,ia=0,aa=0,oa=null;function sa(e,t){if(ra===null){var n=ra=[];ia=0,aa=pd(),oa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ia++,t.then(ca,ca),t}function ca(){if(--ia===0&&ra!==null){oa!==null&&(oa.status=`fulfilled`);var e=ra;ra=null,aa=0,oa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function la(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ua=I.S;I.S=function(e,t){tu=be(),typeof t==`object`&&t&&typeof t.then==`function`&&sa(e,t),ua!==null&&ua(e,t)};var da=B(null);function fa(){var e=da.current;return e===null?Il.pooledCache:e}function pa(e,t){t===null?H(da,da.current):H(da,t.pool)}function ma(){var e=fa();return e===null?null:{parent:ea._currentValue,pool:e}}var ha=Error(i(460)),ga=Error(i(474)),_a=Error(i(542)),va={then:function(){}};function ya(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ba(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Kt,Kt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e;default:if(typeof t.status==`string`)t.then(Kt,Kt);else{if(e=Il,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e}throw Sa=t,ha}}function xa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Sa=e,ha):e}}var Sa=null;function Ca(){if(Sa===null)throw Error(i(459));var e=Sa;return Sa=null,e}function wa(e){if(e===ha||e===_a)throw Error(i(483))}var Ta=null,Ea=0;function Da(e){var t=Ea;return Ea+=1,Ta===null&&(Ta=[]),ba(Ta,e,t)}function Oa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ka(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Aa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ri(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=si(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&xa(i)===t.type)?(t=a(t,n.props),Oa(t,n),t.return=e,t):(t=ai(n.type,n.key,n.props,null,e.mode,r),Oa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=li(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=oi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=si(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ai(t.type,t.key,t.props,null,e.mode,n),Oa(n,t),n.return=e,n;case v:return t=li(t,e.mode,n),t.return=e,t;case O:return t=xa(t),f(e,t,n)}if(F(t)||M(t))return t=oi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Da(t),n);if(t.$$typeof===C)return f(e,Yi(e,t),n);ka(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=xa(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Da(n),r);if(n.$$typeof===C)return p(e,t,Yi(e,n),r);ka(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=xa(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Da(r),i);if(r.$$typeof===C)return m(e,t,n,Yi(t,r),i);ka(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Oi&&xi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Oi&&xi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Oi&&xi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Oi&&xi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Oi&&xi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Oi&&xi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&xa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Oa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=oi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ai(o.type,o.key,o.props,null,e.mode,c),Oa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=li(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=xa(o),b(e,r,o,c)}if(F(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Da(o),c);if(o.$$typeof===C)return b(e,r,Yi(e,o),c);ka(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=si(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ea=0;var i=b(e,t,n,r);return Ta=null,i}catch(t){if(t===ha||t===_a)throw t;var a=ti(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ja=Aa(!0),Ma=Aa(!1),Na=!1;function Pa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fa(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 Ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Fl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Qr(e),Zr(e,null,n),t}return Jr(e,r,t,n),Qr(e)}function Ra(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ke(e,n)}}function za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ba=!1;function Va(){if(Ba){var e=oa;if(e!==null)throw e}}function Ha(e,t,n,r){Ba=!1;var i=e.updateQueue;Na=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Rl&f)===f:(r&f)===f){f!==0&&f===aa&&(Ba=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Na=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Kl|=o,e.lanes=o,e.memoizedState=d}}function Ua(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Wa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ua(n[e],t)}var Ga=B(null),Ka=B(0);function qa(e,t){e=Wl,H(Ka,e),H(Ga,t),Wl=e|t.baseLanes}function Ja(){H(Ka,Wl),H(Ga,Ga.current)}function Ya(){Wl=Ka.current,V(Ga),V(Ka)}var Xa=B(null),Za=null;function Qa(e){var t=e.alternate;H(ro,ro.current&1),H(Xa,e),Za===null&&(t===null||Ga.current!==null||t.memoizedState!==null)&&(Za=e)}function $a(e){H(ro,ro.current),H(Xa,e),Za===null&&(Za=e)}function eo(e){e.tag===22?(H(ro,ro.current),H(Xa,e),Za===null&&(Za=e)):to(e)}function to(){H(ro,ro.current),H(Xa,Xa.current)}function no(e){V(Xa),Za===e&&(Za=null),V(ro)}var ro=B(0);function io(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lf(n)||uf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ao=0,oo=null,so=null,co=null,lo=!1,uo=!1,fo=!1,po=0,mo=0,ho=null,go=0;function _o(){throw Error(i(321))}function vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!hr(e[n],t[n]))return!1;return!0}function yo(e,t,n,r,i,a){return ao=a,oo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Fs:Is,fo=!1,a=n(r,i),fo=!1,uo&&(a=xo(t,n,r,i)),bo(e),a}function bo(e){I.H=Ps;var t=so!==null&&so.next!==null;if(ao=0,co=so=oo=null,lo=!1,mo=0,ho=null,t)throw Error(i(300));e===null||$s||(e=e.dependencies,e!==null&&Ki(e)&&($s=!0))}function xo(e,t,n,r){oo=e;var a=0;do{if(uo&&(ho=null),mo=0,uo=!1,25<=a)throw Error(i(301));if(a+=1,co=so=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}I.H=Ls,o=t(n,r)}while(uo);return o}function So(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?ko(t):t,e=e.useState()[0],(so===null?null:so.memoizedState)!==e&&(oo.flags|=1024),t}function Co(){var e=po!==0;return po=0,e}function wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function To(e){if(lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lo=!1}ao=0,co=so=oo=null,uo=!1,mo=po=0,ho=null}function Eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return co===null?oo.memoizedState=co=e:co=co.next=e,co}function Do(){if(so===null){var e=oo.alternate;e=e===null?null:e.memoizedState}else e=so.next;var t=co===null?oo.memoizedState:co.next;if(t!==null)co=t,so=e;else{if(e===null)throw oo.alternate===null?Error(i(467)):Error(i(310));so=e,e={memoizedState:so.memoizedState,baseState:so.baseState,baseQueue:so.baseQueue,queue:so.queue,next:null},co===null?oo.memoizedState=co=e:co=co.next=e}return co}function Oo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ko(e){var t=mo;return mo+=1,ho===null&&(ho=[]),e=ba(ho,e,t),t=oo,(co===null?t.memoizedState:co.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Fs:Is),e}function Ao(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ko(e);if(e.$$typeof===C)return Ji(e)}throw Error(i(438,String(e)))}function jo(e){var t=null,n=oo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=oo.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Oo(),oo.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Mo(e,t){return typeof t==`function`?t(e):t}function No(e){return Po(Do(),so,e)}function Po(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ao&f)===f:(Rl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===aa&&(d=!0);else if((ao&p)===p){u=u.next,p===aa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,oo.lanes|=p,Kl|=p;f=u.action,fo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,oo.lanes|=f,Kl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!hr(o,e.memoizedState)&&($s=!0,d&&(n=oa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Fo(e){var t=Do(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);hr(o,t.memoizedState)||($s=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Io(e,t,n){var r=oo,a=Do(),o=Oi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!hr((so||a).memoizedState,n);if(s&&(a.memoizedState=n,$s=!0),a=a.queue,os(zo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||co!==null&&co.memoizedState.tag&1){if(r.flags|=2048,ts(9,{destroy:void 0},Ro.bind(null,r,a,n,t),null),Il===null)throw Error(i(349));o||ao&127||Lo(r,t,n)}return n}function Lo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=oo.updateQueue,t===null?(t=Oo(),oo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ro(e,t,n,r){t.value=n,t.getSnapshot=r,Bo(t)&&Vo(e)}function zo(e,t,n){return n(function(){Bo(t)&&Vo(e)})}function Bo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!hr(e,n)}catch{return!0}}function Vo(e){var t=Xr(e,2);t!==null&&gu(t,e,2)}function Ho(e){var t=Eo();if(typeof e==`function`){var n=e;if(e=n(),fo){je(!0);try{n()}finally{je(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:e},t}function Uo(e,t,n,r){return e.baseState=n,Po(e,so,typeof r==`function`?r:Mo)}function Wo(e,t,n,r,a){if(js(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};I.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Go(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Go(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),Ko(e,t,s)}catch(n){Jo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Ko(e,t,a)}catch(n){Jo(e,t,n)}}function Ko(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){qo(e,t,n)},function(n){return Jo(e,t,n)}):qo(e,t,n)}function qo(e,t,n){t.status=`fulfilled`,t.value=n,Yo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Go(e,n)))}function Jo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Yo(t),t=t.next;while(t!==r)}e.action=null}function Yo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xo(e,t){return t}function Zo(e,t){if(Oi){var n=Il.formState;if(n!==null){a:{var r=oo;if(Oi){if(Di){b:{for(var i=Di,a=Ai;i.nodeType!==8;){if(!a){i=null;break b}if(i=ff(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Di=ff(i.nextSibling),r=i.data===`F!`;break a}}Mi(r)}r=!1}r&&(t=n[0])}}return n=Eo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:t},n.queue=r,n=Os.bind(null,oo,r),r.dispatch=n,r=Ho(!1),a=As.bind(null,oo,!1,r.queue),r=Eo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Wo.bind(null,oo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function q(e){return Qo(Do(),so,e)}function Qo(e,t,n){if(t=Po(e,t,Xo)[0],e=No(Mo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ko(t)}catch(e){throw e===ha?_a:e}else r=t;t=Do();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(oo.flags|=2048,ts(9,{destroy:void 0},$o.bind(null,i,n),null)),[r,a,e]}function $o(e,t){e.action=t}function es(e){var t=Do(),n=so;if(n!==null)return Qo(t,n,e);Do(),t=t.memoizedState,n=Do();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ts(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=oo.updateQueue,t===null&&(t=Oo(),oo.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ns(){return Do().memoizedState}function rs(e,t,n,r){var i=Eo();oo.flags|=e,i.memoizedState=ts(1|t,{destroy:void 0},n,r===void 0?null:r)}function is(e,t,n,r){var i=Do();r=r===void 0?null:r;var a=i.memoizedState.inst;so!==null&&r!==null&&vo(r,so.memoizedState.deps)?i.memoizedState=ts(t,a,n,r):(oo.flags|=e,i.memoizedState=ts(1|t,a,n,r))}function as(e,t){rs(8390656,8,e,t)}function os(e,t){is(2048,8,e,t)}function ss(e){oo.flags|=4;var t=oo.updateQueue;if(t===null)t=Oo(),oo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function cs(e){var t=Do().memoizedState;return ss({ref:t,nextImpl:e}),function(){if(Fl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ls(e,t){return is(4,2,e,t)}function us(e,t){return is(4,4,e,t)}function ds(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fs(e,t,n){n=n==null?null:n.concat([e]),is(4,4,ds.bind(null,t,e),n)}function ps(){}function ms(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function hs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&vo(t,r[1]))return r[0];if(r=e(),fo){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r}function gs(e,t,n){return n===void 0||ao&1073741824&&!(Rl&261930)?e.memoizedState=t:(e.memoizedState=n,e=hu(),oo.lanes|=e,Kl|=e,n)}function _s(e,t,n,r){return hr(n,t)?n:Ga.current===null?!(ao&42)||ao&1073741824&&!(Rl&261930)?($s=!0,e.memoizedState=n):(e=hu(),oo.lanes|=e,Kl|=e,t):(e=gs(e,n,r),hr(e,t)||($s=!0),e)}function vs(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,As(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ks(e,t,la(c,r),mu(e)):ks(e,t,r,mu(e))}catch(n){ks(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function ys(){}function bs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=xs(e).queue;vs(e,a,t,R,n===null?ys:function(){return Ss(e),n(r)})}function xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ss(e){var t=xs(e);t.next===null&&(t=e.alternate.memoizedState),ks(e,t.next.queue,{},mu())}function Cs(){return Ji(np)}function ws(){return Do().memoizedState}function Ts(){return Do().memoizedState}function Es(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=Ia(n);var r=La(t,e,n);r!==null&&(gu(r,t,n),Ra(r,t,n)),t={cache:ta()},e.payload=t;return}t=t.return}}function Ds(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},js(e)?Ms(t,n):(n=Yr(e,t,n,r),n!==null&&(gu(n,e,r),Ns(n,t,r)))}function Os(e,t,n){ks(e,t,n,mu())}function ks(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,hr(s,o))return Jr(e,t,i,0),Il===null&&qr(),!1}catch{}if(n=Yr(e,t,i,r),n!==null)return gu(n,e,r),Ns(n,t,r),!0}return!1}function As(e,t,n,r){if(r={lane:2,revertLane:pd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},js(e)){if(t)throw Error(i(479))}else t=Yr(e,n,r,2),t!==null&&gu(t,e,2)}function js(e){var t=e.alternate;return e===oo||t!==null&&t===oo}function Ms(e,t){uo=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ke(e,n)}}var Ps={readContext:Ji,use:Ao,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useLayoutEffect:_o,useInsertionEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useSyncExternalStore:_o,useId:_o,useHostTransitionStatus:_o,useFormState:_o,useActionState:_o,useOptimistic:_o,useMemoCache:_o,useCacheRefresh:_o};Ps.useEffectEvent=_o;var Fs={readContext:Ji,use:Ao,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:Ji,useEffect:as,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rs(4194308,4,ds.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){rs(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var r=e();if(fo){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Eo();if(n!==void 0){var i=n(t);if(fo){je(!0);try{n(t)}finally{je(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ds.bind(null,oo,e),[r.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=Ho(e);var t=e.queue,n=Os.bind(null,oo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ps,useDeferredValue:function(e,t){return gs(Eo(),e,t)},useTransition:function(){var e=Ho(!1);return e=vs.bind(null,oo,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=oo,a=Eo();if(Oi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Il===null)throw Error(i(349));Rl&127||Lo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(zo.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,{destroy:void 0},Ro.bind(null,r,o,n,t),null),n},useId:function(){var e=Eo(),t=Il.identifierPrefix;if(Oi){var n=bi,r=yi;n=(r&~(1<<32-Me(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=po++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=go++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Cs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e){var t=Eo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=As.bind(null,oo,!0,n),n.dispatch=t,[e,t]},useMemoCache:jo,useCacheRefresh:function(){return Eo().memoizedState=Es.bind(null,oo)},useEffectEvent:function(e){var t=Eo(),n={impl:e};return t.memoizedState=n,function(){if(Fl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Is={readContext:Ji,use:Ao,useCallback:ms,useContext:Ji,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:No,useRef:ns,useState:function(){return No(Mo)},useDebugValue:ps,useDeferredValue:function(e,t){return _s(Do(),so.memoizedState,e,t)},useTransition:function(){var e=No(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:ws,useHostTransitionStatus:Cs,useFormState:q,useActionState:q,useOptimistic:function(e,t){return Uo(Do(),so,e,t)},useMemoCache:jo,useCacheRefresh:Ts};Is.useEffectEvent=cs;var Ls={readContext:Ji,use:Ao,useCallback:ms,useContext:Ji,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Fo,useRef:ns,useState:function(){return Fo(Mo)},useDebugValue:ps,useDeferredValue:function(e,t){var n=Do();return so===null?gs(n,e,t):_s(n,so.memoizedState,e,t)},useTransition:function(){var e=Fo(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:ws,useHostTransitionStatus:Cs,useFormState:es,useActionState:es,useOptimistic:function(e,t){var n=Do();return so===null?(n.baseState=e,[e,n.queue.dispatch]):Uo(n,so,e,t)},useMemoCache:jo,useCacheRefresh:Ts};Ls.useEffectEvent=cs;function Rs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var zs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Ia(r);i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(gu(t,e,r),Ra(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Ia(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(gu(t,e,r),Ra(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mu(),r=Ia(n);r.tag=2,t!=null&&(r.callback=t),t=La(e,r,n),t!==null&&(gu(t,e,n),Ra(t,e,n))}};function Bs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!gr(n,r)||!gr(i,a):!0}function Vs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&zs.enqueueReplaceState(t,t.state,null)}function Hs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Us(e){Ur(e)}function Ws(e){console.error(e)}function Gs(e){Ur(e)}function Ks(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Js(e,t,n){return n=Ia(n),n.tag=3,n.payload={element:null},n.callback=function(){Ks(e,t)},n}function Ys(e){return e=Ia(e),e.tag=3,e}function Xs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){qs(t,n,r),typeof i!=`function`&&(iu===null?iu=new Set([this]):iu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Zs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Gi(t,n,a,!0),n=Xa.current,n!==null){switch(n.tag){case 31:case 13:return Za===null?Ou():n.alternate===null&&Gl===0&&(Gl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===va?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qu(e,r,a)),!1;case 22:return n.flags|=65536,r===va?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),qu(e,r,a)),!1}throw Error(i(435,n.tag))}return qu(e,r,a),Ou(),!1}if(Oi)return t=Xa.current,t===null?(r!==ji&&(t=Error(i(423),{cause:r}),Ri(di(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=di(r,n),a=Js(e.stateNode,r,a),za(e,a),Gl!==4&&(Gl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ji&&(e=Error(i(422),{cause:r}),Ri(di(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=di(o,n),Zl===null?Zl=[o]:Zl.push(o),Gl!==4&&(Gl=2),t===null)return!0;r=di(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Js(n.stateNode,r,e),za(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(iu===null||!iu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ys(a),Xs(a,e,n,r),za(n,a),!1}n=n.return}while(n!==null);return!1}var Qs=Error(i(461)),$s=!1;function ec(e,t,n,r){t.child=e===null?Ma(t,null,n,r):ja(t,e.child,n,r)}function tc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return qi(t),r=yo(e,t,n,o,a,i),s=Co(),e!==null&&!$s?(wo(e,t,i),Tc(e,t,i)):(Oi&&s&&Ci(t),t.flags|=1,ec(e,t,r,i),t.child)}function nc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,rc(e,t,a,r,i)):(e=ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Ec(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?gr:n,n(o,r)&&e.ref===t.ref)return Tc(e,t,i)}return t.flags|=1,e=ri(a,r),e.ref=t.ref,e.return=t,t.child=e}function rc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(gr(a,r)&&e.ref===t.ref)if($s=!1,t.pendingProps=r=a,Ec(e,i))e.flags&131072&&($s=!0);else return t.lanes=e.lanes,Tc(e,t,i)}return dc(e,t,n,r,i)}function ic(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return oc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pa(t,a===null?null:a.cachePool),a===null?Ja():qa(t,a),eo(t);else return r=t.lanes=536870912,oc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&pa(t,null),Ja(),to(t)):(pa(t,a.cachePool),qa(t,a),to(t),t.memoizedState=null);return ec(e,t,i,n),t.child}function ac(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function oc(e,t,n,r,i){var a=fa();return a=a===null?null:{parent:ea._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&pa(t,null),Ja(),eo(t),e!==null&&Gi(e,t,r,!0),t.childLanes=i,null}function sc(e,t){return t=bc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function cc(e,t,n){return ja(t,e.child,null,n),e=sc(t,t.pendingProps),e.flags|=2,no(t),t.memoizedState=null,e}function lc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Oi){if(r.mode===`hidden`)return e=sc(t,r),t.lanes=536870912,ac(null,e);if($a(t),(e=Di)?(e=cf(e,Ai),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw Mi(t);return t.lanes=536870912,null}return sc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if($a(t),a)if(t.flags&256)t.flags&=-257,t=cc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if($s||Gi(e,t,n,!1),a=(n&e.childLanes)!==0,$s||a){if(r=Il,r!==null&&(s=qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Xr(e,s),gu(r,e,s),Qs;Ou(),t=cc(e,t,n)}else e=o.treeContext,Di=ff(s.nextSibling),Ei=t,Oi=!0,ki=null,Ai=!1,e!==null&&Ti(t,e),t=sc(t,r),t.flags|=4096;return t}return e=ri(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function uc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function dc(e,t,n,r,i){return qi(t),n=yo(e,t,n,r,void 0,i),r=Co(),e!==null&&!$s?(wo(e,t,i),Tc(e,t,i)):(Oi&&r&&Ci(t),t.flags|=1,ec(e,t,n,i),t.child)}function fc(e,t,n,r,i,a){return qi(t),t.updateQueue=null,n=xo(t,r,n,i),bo(e),r=Co(),e!==null&&!$s?(wo(e,t,a),Tc(e,t,a)):(Oi&&r&&Ci(t),t.flags|=1,ec(e,t,n,a),t.child)}function pc(e,t,n,r,i){if(qi(t),t.stateNode===null){var a=$r,o=n.contextType;typeof o==`object`&&o&&(a=Ji(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=zs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Pa(t),o=n.contextType,a.context=typeof o==`object`&&o?Ji(o):$r,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Rs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&zs.enqueueReplaceState(a,a.state,null),Ha(t,r,a,i),Va(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Hs(n,s);a.props=c;var l=a.context,u=n.contextType;o=$r,typeof u==`object`&&u&&(o=Ji(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Vs(t,a,r,o),Na=!1;var f=t.memoizedState;a.state=f,Ha(t,r,a,i),Va(),l=t.memoizedState,s||f!==l||Na?(typeof d==`function`&&(Rs(t,n,d,r),l=t.memoizedState),(c=Na||Bs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Fa(e,t),o=t.memoizedProps,u=Hs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=$r,typeof l==`object`&&l&&(c=Ji(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Vs(t,a,r,c),Na=!1,f=t.memoizedState,a.state=f,Ha(t,r,a,i),Va();var p=t.memoizedState;o!==d||f!==p||Na||e!==null&&e.dependencies!==null&&Ki(e.dependencies)?(typeof s==`function`&&(Rs(t,n,s,r),p=t.memoizedState),(u=Na||Bs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ki(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,uc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ja(t,e.child,null,i),t.child=ja(t,null,n,i)):ec(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Tc(e,t,i),e}function mc(e,t,n,r){return Ii(),t.flags|=256,ec(e,t,n,r),t.child}var hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gc(e){return{baseLanes:e,cachePool:ma()}}function _c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Yl),e}function vc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(ro.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Oi){if(a?Qa(t):to(t),(e=Di)?(e=cf(e,Ai),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw Mi(t);return uf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(to(t),a=t.mode,c=bc({mode:`hidden`,children:c},a),r=oi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(null,r)):(Qa(t),yc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Qa(t),t.flags&=-257,t=xc(e,t,n)):t.memoizedState===null?(to(t),c=r.fallback,a=t.mode,r=bc({mode:`visible`,children:r.children},a),c=oi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ja(t,e.child,null,n),r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,t=ac(null,r)):(to(t),t.child=e.child,t.flags|=128,t=null);else if(Qa(t),uf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ri({value:r,source:null,stack:null}),t=xc(e,t,n)}else if($s||Gi(e,t,n,!1),s=(n&e.childLanes)!==0,$s||s){if(s=Il,s!==null&&(r=qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Xr(e,r),gu(s,e,r),Qs;lf(c)||Ou(),t=xc(e,t,n)}else lf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Di=ff(c.nextSibling),Ei=t,Oi=!0,ki=null,Ai=!1,e!==null&&Ti(t,e),t=yc(t,r.children),t.flags|=4096);return t}return a?(to(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ri(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=oi(c,a,n,null),c.flags|=2):c=ri(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ac(null,r),r=t.child,c=e.child.memoizedState,c===null?c=gc(n):(a=c.cachePool,a===null?a=ma():(l=ea._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(e.child,r)):(Qa(t),n=e.child,e=n.sibling,n=ri(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function yc(e,t){return t=bc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function bc(e,t){return e=ti(22,e,null,t),e.lanes=0,e}function xc(e,t,n){return ja(t,e.child,null,n),e=yc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Sc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wi(e.return,t,n)}function Cc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function wc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ro.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,H(ro,o),ec(e,t,r,n),r=Oi?hi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sc(e,n,t);else if(e.tag===19)Sc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&io(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Cc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&io(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Cc(t,!0,n,null,a,r);break;case`together`:Cc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Gi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ri(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ri(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ec(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Ki(e))):!0}function Dc(e,t,n){switch(t.tag){case 3:ie(t,t.stateNode.containerInfo),Hi(t,ea,e.memoizedState.cache),Ii();break;case 27:case 5:oe(t);break;case 4:ie(t,t.stateNode.containerInfo);break;case 10:Hi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$a(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Qa(t),e=Tc(e,t,n),e===null?null:e.sibling):vc(e,t,n):(Qa(t),t.flags|=128,null);Qa(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Gi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return wc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),H(ro,ro.current),r)break;return null;case 22:return t.lanes=0,ic(e,t,n,t.pendingProps);case 24:Hi(t,ea,e.memoizedState.cache)}return Tc(e,t,n)}function Oc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)$s=!0;else{if(!Ec(e,n)&&!(t.flags&128))return $s=!1,Dc(e,t,n);$s=!!(e.flags&131072)}else $s=!1,Oi&&t.flags&1048576&&Si(t,hi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=xa(t.elementType),t.type=e,typeof e==`function`)ni(e)?(r=Hs(e,r),t.tag=1,t=pc(null,t,e,r,n)):(t.tag=0,t=dc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=tc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=nc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return dc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Hs(r,t.pendingProps),pc(e,t,r,a,n);case 3:a:{if(ie(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Fa(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Hi(t,ea,r),r!==o.cache&&K(t,[ea],n,!0),Va(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=mc(e,t,r,n);break a}else if(r!==a){a=di(Error(i(424)),t),Ri(a),t=mc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Di=ff(e.firstChild),Ei=t,Oi=!0,ki=null,Ai=!0,n=Ma(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ii(),r===a){t=Tc(e,t,n);break a}ec(e,t,r,n)}t=t.child}return t;case 26:return uc(e,t),e===null?(n=Nf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Oi||(n=t.type,e=t.pendingProps,r=Wd(U.current).createElement(n),r[$e]=t,r[et]=e,Rd(r,n,e),ft(r),t.stateNode=r):t.memoizedState=Nf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return oe(t),e===null&&Oi&&(r=t.stateNode=gf(t.type,t.pendingProps,U.current),Ei=t,Ai=!0,a=Di,tf(t.type)?(pf=a,Di=ff(r.firstChild)):Di=a),ec(e,t,t.pendingProps.children,n),uc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Oi&&((a=r=Di)&&(r=of(r,t.type,t.pendingProps,Ai),r===null?a=!1:(t.stateNode=r,Ei=t,Di=ff(r.firstChild),Ai=!1,a=!0)),a||Mi(t)),oe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,qd(a,o)?r=null:s!==null&&qd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=yo(e,t,So,null,null,n),np._currentValue=a),uc(e,t),ec(e,t,r,n),t.child;case 6:return e===null&&Oi&&((e=n=Di)&&(n=sf(n,t.pendingProps,Ai),n===null?e=!1:(t.stateNode=n,Ei=t,Di=null,e=!0)),e||Mi(t)),null;case 13:return vc(e,t,n);case 4:return ie(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ja(t,null,r,n):ec(e,t,r,n),t.child;case 11:return tc(e,t,t.type,t.pendingProps,n);case 7:return ec(e,t,t.pendingProps,n),t.child;case 8:return ec(e,t,t.pendingProps.children,n),t.child;case 12:return ec(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Hi(t,t.type,r.value),ec(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,qi(t),a=Ji(a),r=r(a),t.flags|=1,ec(e,t,r,n),t.child;case 14:return nc(e,t,t.type,t.pendingProps,n);case 15:return rc(e,t,t.type,t.pendingProps,n);case 19:return wc(e,t,n);case 31:return lc(e,t,n);case 22:return ic(e,t,n,t.pendingProps);case 24:return qi(t),r=Ji(ea),e===null?(a=fa(),a===null&&(a=Il,o=ta(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Pa(t),Hi(t,ea,a)):((e.lanes&n)!==0&&(Fa(e,t),Ha(t,null,null,n),Va()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Hi(t,ea,r),r!==a.cache&&K(t,[ea],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Hi(t,ea,r))),ec(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function kc(e){e.flags|=4}function Ac(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Tu())e.flags|=8192;else throw Sa=va,ga}else e.flags&=-16777217}function jc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Jf(t))if(Tu())e.flags|=8192;else throw Sa=va,ga}function Mc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:W(),e.lanes|=t,Xl|=t)}function Nc(e,t){if(!Oi)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Pc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Fc(e,t,n){var r=t.pendingProps;switch(wi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pc(t),null;case 1:return Pc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ui(ea),ae(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?kc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Li())),Pc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(kc(t),o===null?(Pc(t),Ac(t,a,null,r,n)):(Pc(t),jc(t,o))):o?o===e.memoizedState?(Pc(t),t.flags&=-16777217):(kc(t),Pc(t),jc(t,o)):(e=e.memoizedProps,e!==r&&kc(t),Pc(t),Ac(t,a,e,r,n)),null;case 27:if(se(t),n=U.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}e=te.current,Fi(t)?Ni(t,e):(e=gf(a,r,n),t.stateNode=e,kc(t))}return Pc(t),null;case 5:if(se(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}if(o=te.current,Fi(t))Ni(t,o);else{var s=Wd(U.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[$e]=t,o[et]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Rd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&kc(t)}}return Pc(t),Ac(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=U.current,Fi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ei,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[$e]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Fd(e.nodeValue,n)),e||Mi(t,!0)}else e=Wd(e).createTextNode(r),e[$e]=t,t.stateNode=e}return Pc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Fi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[$e]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),e=!1}else n=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(no(t),t):(no(t),null);if(t.flags&128)throw Error(i(558))}return Pc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Fi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[$e]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),a=!1}else a=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(no(t),t):(no(t),null)}return no(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Mc(t,t.updateQueue),Pc(t),null);case 4:return ae(),e===null&&Td(t.stateNode.containerInfo),Pc(t),null;case 10:return Ui(t.type),Pc(t),null;case 19:if(V(ro),r=t.memoizedState,r===null)return Pc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Nc(r,!1);else{if(Gl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=io(e),o!==null){for(t.flags|=128,Nc(r,!1),e=o.updateQueue,t.updateQueue=e,Mc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ii(n,e),n=n.sibling;return H(ro,ro.current&1|2),Oi&&xi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&be()>nu&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304)}else{if(!a)if(e=io(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Mc(t,e),Nc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Oi)return Pc(t),null}else 2*be()-r.renderingStartTime>nu&&n!==536870912&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Pc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=be(),e.sibling=null,n=ro.current,H(ro,a?n&1|2:n&1),Oi&&xi(t,r.treeForkCount),e);case 22:case 23:return no(t),Ya(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Pc(t),t.subtreeFlags&6&&(t.flags|=8192)):Pc(t),n=t.updateQueue,n!==null&&Mc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&V(da),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ui(ea),Pc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Ic(e,t){switch(wi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ui(ea),ae(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return se(t),null;case 31:if(t.memoizedState!==null){if(no(t),t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(no(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(ro),null;case 4:return ae(),null;case 10:return Ui(t.type),null;case 22:case 23:return no(t),Ya(),e!==null&&V(da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ui(ea),null;case 25:return null;default:return null}}function Lc(e,t){switch(wi(t),t.tag){case 3:Ui(ea),ae();break;case 26:case 27:case 5:se(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&no(t);break;case 13:no(t);break;case 19:V(ro);break;case 10:Ui(t.type);break;case 22:case 23:no(t),Ya(),e!==null&&V(da);break;case 24:Ui(ea)}}function Rc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ku(t,t.return,e)}}function zc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ku(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ku(t,t.return,e)}}function Bc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Wa(t,n)}catch(t){Ku(e,e.return,t)}}}function Vc(e,t,n){n.props=Hs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ku(e,t,n)}}function Hc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ku(e,t,n)}}function Uc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Ku(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ku(e,t,n)}else n.current=null}function Wc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ku(e,e.return,t)}}function Gc(e,t,n){try{var r=e.stateNode;zd(r,e.type,n,t),r[et]=t}catch(t){Ku(e,e.return,t)}}function Kc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tf(e.type)||e.tag===4}function qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Kc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&tf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Kt));else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Rd(t,r,n),t[$e]=e,t[et]=n}catch(t){Ku(e,e.return,t)}}var Zc=!1,Qc=!1,$c=!1,el=typeof WeakSet==`function`?WeakSet:Set,tl=null;function nl(e,t){if(e=e.containerInfo,Hd=dp,e=br(e),xr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ud={focusedElem:e,selectionRange:n},dp=!1,tl=t;tl!==null;)if(t=tl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,tl=e;else for(;tl!==null;){switch(t=tl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Hs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ku(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)af(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:af(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,tl=e;break}tl=t.return}}function rl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:vl(e,n),r&4&&Rc(5,n);break;case 1:if(vl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ku(n,n.return,e)}else{var i=Hs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ku(n,n.return,e)}}r&64&&Bc(n),r&512&&Hc(n,n.return);break;case 3:if(vl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Wa(e,t)}catch(e){Ku(n,n.return,e)}}break;case 27:t===null&&r&4&&Xc(n);case 26:case 5:vl(e,n),t===null&&r&4&&Wc(n),r&512&&Hc(n,n.return);break;case 12:vl(e,n);break;case 31:vl(e,n),r&4&&ll(e,n);break;case 13:vl(e,n),r&4&&ul(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Xu.bind(null,n),df(e,n))));break;case 22:if(r=n.memoizedState!==null||Zc,!r){t=t!==null&&t.memoizedState!==null||Qc,i=Zc;var a=Qc;Zc=r,(Qc=t)&&!a?bl(e,n,(n.subtreeFlags&8772)!=0):vl(e,n),Zc=i,Qc=a}break;case 30:break;default:vl(e,n)}}function il(e){var t=e.alternate;t!==null&&(e.alternate=null,il(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&st(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var al=null,ol=!1;function sl(e,t,n){for(n=n.child;n!==null;)cl(e,t,n),n=n.sibling}function cl(e,t,n){if(Ae&&typeof Ae.onCommitFiberUnmount==`function`)try{Ae.onCommitFiberUnmount(ke,n)}catch{}switch(n.tag){case 26:Qc||Uc(n,t),sl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Qc||Uc(n,t);var r=al,i=ol;tf(n.type)&&(al=n.stateNode,ol=!1),sl(e,t,n),_f(n.stateNode),al=r,ol=i;break;case 5:Qc||Uc(n,t);case 6:if(r=al,i=ol,al=null,sl(e,t,n),al=r,ol=i,al!==null)if(ol)try{(al.nodeType===9?al.body:al.nodeName===`HTML`?al.ownerDocument.body:al).removeChild(n.stateNode)}catch(e){Ku(n,t,e)}else try{al.removeChild(n.stateNode)}catch(e){Ku(n,t,e)}break;case 18:al!==null&&(ol?(e=al,nf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Lp(e)):nf(al,n.stateNode));break;case 4:r=al,i=ol,al=n.stateNode.containerInfo,ol=!0,sl(e,t,n),al=r,ol=i;break;case 0:case 11:case 14:case 15:zc(2,n,t),Qc||zc(4,n,t),sl(e,t,n);break;case 1:Qc||(Uc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Vc(n,t,r)),sl(e,t,n);break;case 21:sl(e,t,n);break;case 22:Qc=(r=Qc)||n.memoizedState!==null,sl(e,t,n),Qc=r;break;default:sl(e,t,n)}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Lp(e)}catch(e){Ku(t,t.return,e)}}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Lp(e)}catch(e){Ku(t,t.return,e)}}function dl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new el),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new el),t;default:throw Error(i(435,e.tag))}}function fl(e,t){var n=dl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Zu.bind(null,e,t);t.then(r,r)}})}function pl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(tf(c.type)){al=c.stateNode,ol=!1;break a}break;case 5:al=c.stateNode,ol=!1;break a;case 3:case 4:al=c.stateNode.containerInfo,ol=!0;break a}c=c.return}if(al===null)throw Error(i(160));cl(o,s,a),al=null,ol=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hl(t,e),t=t.sibling}var ml=null;function hl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pl(t,e),gl(e),r&4&&(zc(3,e,e.return),Rc(3,e),zc(5,e,e.return));break;case 1:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&64&&Zc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=ml;if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ot]||o[$e]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Rd(o,r,n),o[$e]=e,ft(o),r=o;break a;case`link`:var s=Gf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Rd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Gf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Rd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[$e]=e,ft(o),r=o}e.stateNode=r}else Kf(a,e.type,e.stateNode);else e.stateNode=Bf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Gc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Kf(a,e.type,e.stateNode):Bf(a,r,e.memoizedProps))}break;case 27:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),n!==null&&r&4&&Gc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),e.flags&32){a=e.stateNode;try{Rt(a,``)}catch(t){Ku(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Gc(e,a,n===null?a:n.memoizedProps)),r&1024&&($c=!0);break;case 6:if(pl(t,e),gl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ku(e,e.return,t)}}break;case 3:if(Wf=null,a=ml,ml=bf(t.containerInfo),pl(t,e),ml=a,gl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Lp(t.containerInfo)}catch(t){Ku(e,e.return,t)}$c&&($c=!1,_l(e));break;case 4:r=ml,ml=bf(e.stateNode.containerInfo),pl(t,e),gl(e),ml=r;break;case 12:pl(t,e),gl(e);break;case 31:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 13:pl(t,e),gl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(eu=be()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Zc,d=Qc;if(Zc=u||a,Qc=d||l,pl(t,e),Qc=d,Zc=u,gl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Zc||Qc||yl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Ku(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ku(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?rf(m,!0):rf(l.stateNode,!1)}catch(e){Ku(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,fl(e,n))));break;case 19:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 30:break;case 21:break;default:pl(t,e),gl(e)}}function gl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Kc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Yc(e,qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Rt(o,``),n.flags&=-33),Yc(e,qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Jc(e,qc(e),s);break;default:throw Error(i(161))}}catch(t){Ku(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _l(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;_l(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function vl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)rl(e,t.alternate,t),t=t.sibling}function yl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:zc(4,t,t.return),yl(t);break;case 1:Uc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Vc(t,t.return,n),yl(t);break;case 27:_f(t.stateNode);case 26:case 5:Uc(t,t.return),yl(t);break;case 22:t.memoizedState===null&&yl(t);break;case 30:yl(t);break;default:yl(t)}e=e.sibling}}function bl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:bl(i,a,n),Rc(4,a);break;case 1:if(bl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ku(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ua(c[i],s)}catch(e){Ku(r,r.return,e)}}n&&o&64&&Bc(a),Hc(a,a.return);break;case 27:Xc(a);case 26:case 5:bl(i,a,n),n&&r===null&&o&4&&Wc(a),Hc(a,a.return);break;case 12:bl(i,a,n);break;case 31:bl(i,a,n),n&&o&4&&ll(i,a);break;case 13:bl(i,a,n),n&&o&4&&ul(i,a);break;case 22:a.memoizedState===null&&bl(i,a,n),Hc(a,a.return);break;case 30:break;default:bl(i,a,n)}t=t.sibling}}function xl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&na(n))}function Sl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e))}function J(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cl(e,t,n,r),t=t.sibling}function Cl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:J(e,t,n,r),i&2048&&Rc(9,t);break;case 1:J(e,t,n,r);break;case 3:J(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e)));break;case 12:if(i&2048){J(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Ku(t,t.return,e)}}else J(e,t,n,r);break;case 31:J(e,t,n,r);break;case 13:J(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?J(e,t,n,r):(a._visibility|=2,Y(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?J(e,t,n,r):wl(e,t),i&2048&&xl(o,t);break;case 24:J(e,t,n,r),i&2048&&Sl(t.alternate,t);break;default:J(e,t,n,r)}}function Y(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Y(a,o,s,c,i),Rc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Y(a,o,s,c,i)):u._visibility&2?Y(a,o,s,c,i):wl(a,o),i&&l&2048&&xl(o.alternate,o);break;case 24:Y(a,o,s,c,i),i&&l&2048&&Sl(o.alternate,o);break;default:Y(a,o,s,c,i)}t=t.sibling}}function wl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:wl(n,r),i&2048&&xl(r.alternate,r);break;case 24:wl(n,r),i&2048&&Sl(r.alternate,r);break;default:wl(n,r)}t=t.sibling}}var Tl=8192;function El(e,t,n){if(e.subtreeFlags&Tl)for(e=e.child;e!==null;)Dl(e,t,n),e=e.sibling}function Dl(e,t,n){switch(e.tag){case 26:El(e,t,n),e.flags&Tl&&e.memoizedState!==null&&Yf(n,ml,e.memoizedState,e.memoizedProps);break;case 5:El(e,t,n);break;case 3:case 4:var r=ml;ml=bf(e.stateNode.containerInfo),El(e,t,n),ml=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Tl,Tl=16777216,El(e,t,n),Tl=r):El(e,t,n));break;default:El(e,t,n)}}function Ol(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 kl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Ml(r,e)}Ol(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Al(e),e=e.sibling}function Al(e){switch(e.tag){case 0:case 11:case 15:kl(e),e.flags&2048&&zc(9,e,e.return);break;case 3:kl(e);break;case 12:kl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,jl(e)):kl(e);break;default:kl(e)}}function jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Ml(r,e)}Ol(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:zc(8,t,t.return),jl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,jl(t));break;default:jl(t)}e=e.sibling}}function Ml(e,t){for(;tl!==null;){var n=tl;switch(n.tag){case 0:case 11:case 15:zc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:na(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tl=r;else a:for(n=e;tl!==null;){r=tl;var i=r.sibling,a=r.return;if(il(r),r===n){tl=null;break a}if(i!==null){i.return=a,tl=i;break a}tl=a}}}var Nl={getCacheForType:function(e){var t=Ji(ea),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ji(ea).controller.signal}},Pl=typeof WeakMap==`function`?WeakMap:Map,Fl=0,Il=null,Ll=null,Rl=0,zl=0,Bl=null,Vl=!1,Hl=!1,Ul=!1,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=null,Ql=null,$l=!1,eu=0,tu=0,nu=1/0,ru=null,iu=null,au=0,ou=null,su=null,cu=0,lu=0,uu=null,du=null,fu=0,pu=null;function mu(){return Fl&2&&Rl!==0?Rl&-Rl:I.T===null?Xe():pd()}function hu(){if(Yl===0)if(!(Rl&536870912)||Oi){var e=Le;Le<<=1,!(Le&3932160)&&(Le=262144),Yl=e}else Yl=536870912;return e=Xa.current,e!==null&&(e.flags|=32),Yl}function gu(e,t,n){(e===Il&&(zl===2||zl===9)||e.cancelPendingCommit!==null)&&(Cu(e,0),bu(e,Rl,Yl,!1)),Ue(e,n),(!(Fl&2)||e!==Il)&&(e===Il&&(!(Fl&2)&&(ql|=n),Gl===4&&bu(e,Rl,Yl,!1)),ad(e))}function _u(e,t,n){if(Fl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ve(e,t),a=r?ju(e,t):ku(e,t,!0),o=r;do{if(a===0){Hl&&!r&&bu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!yu(n)){a=ku(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Zl;var l=c.current.memoizedState.isDehydrated;if(l&&(Cu(c,s).flags|=256),s=ku(c,s,!1),s!==2){if(Ul&&!l){c.errorRecoveryDisabledLanes|=o,ql|=o,a=4;break a}o=Ql,Ql=a,o!==null&&(Ql===null?Ql=o:Ql.push.apply(Ql,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Cu(e,0),bu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:bu(r,t,Yl,!Vl);break a;case 2:Ql=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=eu+300-be(),10<a)){if(bu(r,t,Yl,!Vl),Be(r,0,!0)!==0)break a;cu=t,r.timeoutHandle=Xd(vu.bind(null,r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,`Throttled`,-0,0),a);break a}vu(r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,null,-0,0)}}break}while(1);ad(e)}function vu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Kt},Dl(t,a,d);var m=(a&62914560)===a?eu-be():(a&4194048)===a?tu-be():0;if(m=Zf(d,m),m!==null){cu=a,e.cancelPendingCommit=m(Ru.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),bu(e,a,o,!l);return}}Ru(e,t,a,n,r,i,o,s,c)}function yu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!hr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bu(e,t,n,r){t&=~Jl,t&=~ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Me(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ge(e,n,t)}function xu(){return Fl&6?!0:(od(0,!1),!1)}function Su(){if(Ll!==null){if(zl===0)var e=Ll.return;else e=Ll,Vi=Bi=null,To(e),Ta=null,Ea=0,e=Ll;for(;e!==null;)Lc(e.alternate,e),e=e.return;Ll=null}}function Cu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Zd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),cu=0,Su(),Il=e,Ll=n=ri(e.current,null),Rl=t,zl=0,Bl=null,Vl=!1,Hl=Ve(e,t),Ul=!1,Xl=Yl=Jl=ql=Kl=Gl=0,Ql=Zl=null,$l=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Me(r),a=1<<i;t|=e[i],r&=~a}return Wl=t,qr(),n}function wu(e,t){oo=null,I.H=Ps,t===ha||t===_a?(t=Ca(),zl=3):t===ga?(t=Ca(),zl=4):zl=t===Qs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Bl=t,Ll===null&&(Gl=1,Ks(e,di(t,e.current)))}function Tu(){var e=Xa.current;return e===null?!0:(Rl&4194048)===Rl?Za===null:(Rl&62914560)===Rl||Rl&536870912?e===Za:!1}function Eu(){var e=I.H;return I.H=Ps,e===null?Ps:e}function Du(){var e=I.A;return I.A=Nl,e}function Ou(){Gl=4,Vl||(Rl&4194048)!==Rl&&Xa.current!==null||(Hl=!0),!(Kl&134217727)&&!(ql&134217727)||Il===null||bu(Il,Rl,Yl,!1)}function ku(e,t,n){var r=Fl;Fl|=2;var i=Eu(),a=Du();(Il!==e||Rl!==t)&&(ru=null,Cu(e,t)),t=!1;var o=Gl;a:do try{if(zl!==0&&Ll!==null){var s=Ll,c=Bl;switch(zl){case 8:Su(),o=6;break a;case 3:case 2:case 9:case 6:Xa.current===null&&(t=!0);var l=zl;if(zl=0,Bl=null,Fu(e,s,c,l),n&&Hl){o=0;break a}break;default:l=zl,zl=0,Bl=null,Fu(e,s,c,l)}}Au(),o=Gl;break}catch(t){wu(e,t)}while(1);return t&&e.shellSuspendCounter++,Vi=Bi=null,Fl=r,I.H=i,I.A=a,Ll===null&&(Il=null,Rl=0,qr()),o}function Au(){for(;Ll!==null;)Nu(Ll)}function ju(e,t){var n=Fl;Fl|=2;var r=Eu(),a=Du();Il!==e||Rl!==t?(ru=null,nu=be()+500,Cu(e,t)):Hl=Ve(e,t);a:do try{if(zl!==0&&Ll!==null){t=Ll;var o=Bl;b:switch(zl){case 1:zl=0,Bl=null,Fu(e,t,o,1);break;case 2:case 9:if(ya(o)){zl=0,Bl=null,Pu(t);break}t=function(){zl!==2&&zl!==9||Il!==e||(zl=7),ad(e)},o.then(t,t);break a;case 3:zl=7;break a;case 4:zl=5;break a;case 7:ya(o)?(zl=0,Bl=null,Pu(t)):(zl=0,Bl=null,Fu(e,t,o,7));break;case 5:var s=null;switch(Ll.tag){case 26:s=Ll.memoizedState;case 5:case 27:var c=Ll;if(s?Jf(s):c.stateNode.complete){zl=0,Bl=null;var l=c.sibling;if(l!==null)Ll=l;else{var u=c.return;u===null?Ll=null:(Ll=u,Iu(u))}break b}}zl=0,Bl=null,Fu(e,t,o,5);break;case 6:zl=0,Bl=null,Fu(e,t,o,6);break;case 8:Su(),Gl=6;break a;default:throw Error(i(462))}}Mu();break}catch(t){wu(e,t)}while(1);return Vi=Bi=null,I.H=r,I.A=a,Fl=n,Ll===null?(Il=null,Rl=0,qr(),Gl):0}function Mu(){for(;Ll!==null&&!ve();)Nu(Ll)}function Nu(e){var t=Oc(e.alternate,e,Wl);e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Pu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=fc(n,t,t.pendingProps,t.type,void 0,Rl);break;case 11:t=fc(n,t,t.pendingProps,t.type.render,t.ref,Rl);break;case 5:To(t);default:Lc(n,t),t=Ll=ii(t,Wl),t=Oc(n,t,Wl)}e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Fu(e,t,n,r){Vi=Bi=null,To(t),Ta=null,Ea=0;var i=t.return;try{if(Zs(e,i,t,n,Rl)){Gl=1,Ks(e,di(n,e.current)),Ll=null;return}}catch(t){if(i!==null)throw Ll=i,t;Gl=1,Ks(e,di(n,e.current)),Ll=null;return}t.flags&32768?(Oi||r===1?e=!0:Hl||Rl&536870912?e=!1:(Vl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Xa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Lu(t,e)):Iu(t)}function Iu(e){var t=e;do{if(t.flags&32768){Lu(t,Vl);return}e=t.return;var n=Fc(t.alternate,t,Wl);if(n!==null){Ll=n;return}if(t=t.sibling,t!==null){Ll=t;return}Ll=t=e}while(t!==null);Gl===0&&(Gl=5)}function Lu(e,t){do{var n=Ic(e.alternate,e);if(n!==null){n.flags&=32767,Ll=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ll=e;return}Ll=e=n}while(e!==null);Gl=6,Ll=null}function Ru(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Uu();while(au!==0);if(Fl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Kr,We(e,n,o,s,c,l),e===Il&&(Ll=Il=null,Rl=0),su=t,ou=e,cu=n,lu=o,uu=a,du=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Qu(we,function(){return Wu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=I.T,I.T=null,a=L.p,L.p=2,s=Fl,Fl|=4;try{nl(e,t,n)}finally{Fl=s,L.p=a,I.T=r}}au=1,zu(),Bu(),Vu()}}function zu(){if(au===1){au=0;var e=ou,t=su,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Fl;Fl|=4;try{hl(t,e);var a=Ud,o=br(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&yr(s.ownerDocument.documentElement,s)){if(c!==null&&xr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=vr(s,h),v=vr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}dp=!!Hd,Ud=Hd=null}finally{Fl=i,L.p=r,I.T=n}}e.current=t,au=2}}function Bu(){if(au===2){au=0;var e=ou,t=su,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Fl;Fl|=4;try{rl(e,t.alternate,t)}finally{Fl=i,L.p=r,I.T=n}}au=3}}function Vu(){if(au===4||au===3){au=0,ye();var e=ou,t=su,n=cu,r=du;t.subtreeFlags&10256||t.flags&10256?au=5:(au=0,su=ou=null,Hu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(iu=null),Ye(n),t=t.stateNode,Ae&&typeof Ae.onCommitFiberRoot==`function`)try{Ae.onCommitFiberRoot(ke,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{I.T=t,L.p=i}}cu&3&&Uu(),ad(e),i=e.pendingLanes,n&261930&&i&42?e===pu?fu++:(fu=0,pu=e):fu=0,od(0,!1)}}function Hu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,na(t)))}function Uu(){return zu(),Bu(),Vu(),Wu()}function Wu(){if(au!==5)return!1;var e=ou,t=lu;lu=0;var n=Ye(cu),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=uu,uu=null;var o=ou,s=cu;if(au=0,su=ou=null,cu=0,Fl&6)throw Error(i(331));var c=Fl;if(Fl|=4,Al(o.current),Cl(o,o.current,s,n),Fl=c,od(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot==`function`)try{Ae.onPostCommitFiberRoot(ke,o)}catch{}return!0}finally{L.p=a,I.T=r,Hu(e,t)}}function Gu(e,t,n){t=di(n,t),t=Js(e.stateNode,t,2),e=La(e,t,2),e!==null&&(Ue(e,2),ad(e))}function Ku(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(iu===null||!iu.has(r))){e=di(n,e),n=Ys(2),r=La(t,n,2),r!==null&&(Xs(n,r,t,e),Ue(r,2),ad(r));break}}t=t.return}}function qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Pl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=Ju.bind(null,e,t,n),t.then(e,e))}function Ju(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Il===e&&(Rl&n)===n&&(Gl===4||Gl===3&&(Rl&62914560)===Rl&&300>be()-eu?!(Fl&2)&&Cu(e,0):Jl|=n,Xl===Rl&&(Xl=0)),ad(e)}function Yu(e,t){t===0&&(t=W()),e=Xr(e,t),e!==null&&(Ue(e,t),ad(e))}function Xu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yu(e,n)}function Zu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Yu(e,n)}function Qu(e,t){return ge(e,t)}var $u=null,ed=null,td=!1,nd=!1,rd=!1,id=0;function ad(e){e!==ed&&e.next===null&&(ed===null?$u=ed=e:ed=ed.next=e),nd=!0,td||(td=!0,fd())}function od(e,t){if(!rd&&nd){rd=!0;do for(var n=!1,r=$u;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Me(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,dd(r,a))}else a=Rl,a=Be(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ve(r,a)||(n=!0,dd(r,a));r=r.next}while(n);rd=!1}}function sd(){cd()}function cd(){nd=td=!1;var e=0;id!==0&&Yd()&&(e=id);for(var t=be(),n=null,r=$u;r!==null;){var i=r.next,a=ld(r,t);a===0?(r.next=null,n===null?$u=i:n.next=i,i===null&&(ed=n)):(n=r,(e!==0||a&3)&&(nd=!0)),r=i}au!==0&&au!==5||od(e,!1),id!==0&&(id=0)}function ld(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Me(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=He(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Il,n=Rl,n=Be(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(zl===2||zl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&_e(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ve(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&_e(r),Ye(n)){case 2:case 8:n=Ce;break;case 32:n=we;break;case 268435456:n=Ee;break;default:n=we}return r=ud.bind(null,e),n=ge(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&_e(r),e.callbackPriority=2,e.callbackNode=null,2}function ud(e,t){if(au!==0&&au!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Uu()&&e.callbackNode!==n)return null;var r=Rl;return r=Be(e,e===Il?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(_u(e,r,t),ld(e,be()),e.callbackNode!=null&&e.callbackNode===n?ud.bind(null,e):null)}function dd(e,t){if(Uu())return null;_u(e,t,!0)}function fd(){$d(function(){Fl&6?ge(Se,sd):cd()})}function pd(){if(id===0){var e=aa;e===0&&(e=Ie,Ie<<=1,!(Ie&261888)&&(Ie=256)),id=e}return id}function md(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Gt(``+e)}function hd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function gd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=md((i[et]||null).action),o=r.submitter;o&&(t=(t=o[et]||null)?md(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new mn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(id!==0){var e=o?hd(i,o):new FormData(i);bs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?hd(i,o):new FormData(i),bs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var _d=0;_d<Vr.length;_d++){var vd=Vr[_d];Hr(vd.toLowerCase(),`on`+(vd[0].toUpperCase()+vd.slice(1)))}Hr(Nr,`onAnimationEnd`),Hr(Pr,`onAnimationIteration`),Hr(Fr,`onAnimationStart`),Hr(`dblclick`,`onDoubleClick`),Hr(`focusin`,`onFocus`),Hr(`focusout`,`onBlur`),Hr(Ir,`onTransitionRun`),Hr(Lr,`onTransitionStart`),Hr(Rr,`onTransitionCancel`),Hr(zr,`onTransitionEnd`),gt(`onMouseEnter`,[`mouseout`,`mouseover`]),gt(`onMouseLeave`,[`mouseout`,`mouseover`]),gt(`onPointerEnter`,[`pointerout`,`pointerover`]),gt(`onPointerLeave`,[`pointerout`,`pointerover`]),ht(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),ht(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),ht(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),ht(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),ht(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),ht(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var yd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),bd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(yd));function xd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ur(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ur(e)}i.currentTarget=null,a=c}}}}function Sd(e,t){var n=t[nt];n===void 0&&(n=t[nt]=new Set);var r=e+`__bubble`;n.has(r)||(Ed(t,e,2,!1),n.add(r))}function Cd(e,t,n){var r=0;t&&(r|=4),Ed(n,e,r,t)}var wd=`_reactListening`+Math.random().toString(36).slice(2);function Td(e){if(!e[wd]){e[wd]=!0,pt.forEach(function(t){t!==`selectionchange`&&(bd.has(t)||Cd(t,!1,e),Cd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wd]||(t[wd]=!0,Cd(`selectionchange`,!1,t))}}function Ed(e,t,n,r){switch(vp(t)){case 2:var i=fp;break;case 8:i=pp;break;default:i=mp}n=i.bind(null,t,n,e),i=void 0,!nn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Dd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=ct(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}$t(function(){var r=a,i=Jt(n),s=[];a:{var c=Br.get(e);if(c!==void 0){var l=mn,u=e;switch(e){case`keypress`:if(ln(n)===0)break a;case`keydown`:case`keyup`:l=Mn;break;case`focusin`:u=`focus`,l=Cn;break;case`focusout`:u=`blur`,l=Cn;break;case`beforeblur`:case`afterblur`:l=Cn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=xn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Sn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Pn;break;case Nr:case Pr:case Fr:l=wn;break;case zr:l=Fn;break;case`scroll`:case`scrollend`:l=gn;break;case`wheel`:l=In;break;case`copy`:case`cut`:case`paste`:l=Tn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Nn;break;case`toggle`:case`beforetoggle`:l=Ln}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=en(m,p),g!=null&&d.push(Od(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==qt&&(u=n.relatedTarget||n.fromElement)&&(ct(u)||u[tt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?ct(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=xn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Nn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ut(l),h=u==null?c:ut(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ct(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ad,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&jd(s,c,l,d,!1),u!==null&&f!==null&&jd(s,f,u,d,!0)}}a:{if(c=r?ut(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=rr;else if(Zn(c))if(ir)v=pr;else{v=dr;var y=ur}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Ht(r.elementType)&&(v=rr):v=fr;if(v&&=v(e,r)){Qn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Pt(c,`number`,c.value)}switch(y=r?ut(r):window,e){case`focusin`:(Zn(y)||y.contentEditable===`true`)&&(Cr=y,wr=r,Tr=null);break;case`focusout`:Tr=wr=Cr=null;break;case`mousedown`:Er=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Er=!1,Dr(s,n,i);break;case`selectionchange`:if(Sr)break;case`keydown`:case`keyup`:Dr(s,n,i)}var b;if(zn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else qn?Gn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Hn&&n.locale!==`ko`&&(qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&qn&&(b=cn()):(an=i,on=`value`in an?an.value:an.textContent,qn=!0)),y=kd(r,x),0<y.length&&(x=new En(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Kn(n),b!==null&&(x.data=b)))),(b=Vn?Jn(e,n):Yn(e,n))&&(x=kd(r,`onBeforeInput`),0<x.length&&(y=new En(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),gd(s,e,r,n,i)}xd(s,t)})}function Od(e,t,n){return{instance:e,listener:t,currentTarget:n}}function kd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=en(e,n),i!=null&&r.unshift(Od(e,i,a)),i=en(e,t),i!=null&&r.push(Od(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ad(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function jd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=en(n,a),l!=null&&o.unshift(Od(n,l,c))):i||(l=en(n,a),l!=null&&o.push(Od(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Md=/\r\n?/g,Nd=/\u0000|\uFFFD/g;function Pd(e){return(typeof e==`string`?e:``+e).replace(Md,`
|
|
9
9
|
`).replace(Nd,``)}function Fd(e,t){return t=Pd(t),Pd(e)===t}function Id(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Rt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Rt(e,``+r);break;case`className`:St(e,`class`,r);break;case`tabIndex`:St(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:St(e,n,r);break;case`style`:Vt(e,r,o);break;case`data`:if(t!==`object`){St(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Gt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Id(e,t,`name`,a.name,a,null),Id(e,t,`formEncType`,a.formEncType,a,null),Id(e,t,`formMethod`,a.formMethod,a,null),Id(e,t,`formTarget`,a.formTarget,a,null)):(Id(e,t,`encType`,a.encType,a,null),Id(e,t,`method`,a.method,a,null),Id(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Gt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Kt);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Gt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Sd(`beforetoggle`,e),Sd(`toggle`,e),xt(e,`popover`,r);break;case`xlinkActuate`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:xt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Ut.get(n)||n,xt(e,n,r))}}function Ld(e,t,n,r,a,o){switch(n){case`style`:Vt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Rt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Rt(e,``+r);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Kt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!mt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[et]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):xt(e,n,r)}}}function Rd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Sd(`error`,e),Sd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Id(e,t,o,s,n,null)}}a&&Id(e,t,`srcSet`,n.srcSet,n,null),r&&Id(e,t,`src`,n.src,n,null);return;case`input`:Sd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Id(e,t,r,d,n,null)}}Nt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Sd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Id(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ft(e,!!r,n,!0):Ft(e,!!r,t,!1);return;case`textarea`:for(s in Sd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Id(e,t,s,c,n,null)}Lt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Id(e,t,l,r,n,null)}return;case`dialog`:Sd(`beforetoggle`,e),Sd(`toggle`,e),Sd(`cancel`,e),Sd(`close`,e);break;case`iframe`:case`object`:Sd(`load`,e);break;case`video`:case`audio`:for(r=0;r<yd.length;r++)Sd(yd[r],e);break;case`image`:Sd(`error`,e),Sd(`load`,e);break;case`details`:Sd(`toggle`,e);break;case`embed`:case`source`:case`link`:Sd(`error`,e),Sd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Id(e,t,u,r,n,null)}return;default:if(Ht(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Ld(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Id(e,t,c,r,n,null))}function zd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Id(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Id(e,t,p,m,r,f)}}Mt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Id(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Id(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ft(e,!!n,n?[]:``,!1):Ft(e,!!n,t,!0)):Ft(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Id(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Id(e,t,s,a,r,o)}It(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Id(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Id(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Id(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Id(e,t,u,p,r,m)}return;default:if(Ht(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Ld(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Ld(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Id(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Id(e,t,f,p,r,m)}function Bd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Vd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Bd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Bd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Hd=null,Ud=null;function Wd(e){return e.nodeType===9?e:e.ownerDocument}function Gd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Kd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function qd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Jd=null;function Yd(){var e=window.event;return e&&e.type===`popstate`?e===Jd?!1:(Jd=e,!0):(Jd=null,!1)}var Xd=typeof setTimeout==`function`?setTimeout:void 0,Zd=typeof clearTimeout==`function`?clearTimeout:void 0,Qd=typeof Promise==`function`?Promise:void 0,$d=typeof queueMicrotask==`function`?queueMicrotask:Qd===void 0?Xd:function(e){return Qd.resolve(null).then(e).catch(ef)};function ef(e){setTimeout(function(){throw e})}function tf(e){return e===`head`}function nf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Lp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_f(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_f(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ot]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_f(e.ownerDocument.body);n=i}while(n);Lp(t)}function rf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function af(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:af(n),st(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function of(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[ot])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=ff(e.nextSibling),e===null)break}return null}function sf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=ff(e.nextSibling),e===null))return null;return e}function cf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=ff(e.nextSibling),e===null))return null;return e}function lf(e){return e.data===`$?`||e.data===`$~`}function uf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function df(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function ff(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var pf=null;function mf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return ff(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function gf(e,t,n){switch(t=Wd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function _f(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);st(e)}var vf=new Map,yf=new Set;function bf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xf=L.d;L.d={f:Sf,r:Cf,D:Ef,C:Df,L:Of,m:kf,X:jf,S:Af,M:Mf};function Sf(){var e=xf.f(),t=xu();return e||t}function Cf(e){var t=lt(e);t!==null&&t.tag===5&&t.type===`form`?Ss(t):xf.r(e)}var wf=typeof document>`u`?null:document;function Tf(e,t,n){var r=wf;if(r&&typeof t==`string`&&t){var i=jt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),yf.has(i)||(yf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Rd(t,`link`,e),ft(t),r.head.appendChild(t)))}}function Ef(e){xf.D(e),Tf(`dns-prefetch`,e,null)}function Df(e,t){xf.C(e,t),Tf(`preconnect`,e,t)}function Of(e,t,n){xf.L(e,t,n);var r=wf;if(r&&e&&t){var i=`link[rel="preload"][as="`+jt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+jt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+jt(n.imageSizes)+`"]`)):i+=`[href="`+jt(e)+`"]`;var a=i;switch(t){case`style`:a=Pf(e);break;case`script`:a=Rf(e)}vf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Ff(a))||t===`script`&&r.querySelector(zf(a))||(t=r.createElement(`link`),Rd(t,`link`,e),ft(t),r.head.appendChild(t)))}}function kf(e,t){xf.m(e,t);var n=wf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+jt(r)+`"][href="`+jt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rf(e)}if(!vf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),vf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zf(a)))return}r=n.createElement(`link`),Rd(r,`link`,e),ft(r),n.head.appendChild(r)}}}function Af(e,t,n){xf.S(e,t,n);var r=wf;if(r&&e){var i=dt(r).hoistableStyles,a=Pf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Ff(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vf.get(a))&&Hf(e,n);var c=o=r.createElement(`link`);ft(c),Rd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jf(e,t){xf.X(e,t);var n=wf;if(n&&e){var r=dt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=m({src:e,async:!0},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),ft(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t){xf.M(e,t);var n=wf;if(n&&e){var r=dt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),ft(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t,n,r){var a=(a=U.current)?bf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Pf(n.href),n=dt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pf(n.href);var o=dt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Ff(e)))&&!o._p&&(s.instance=o,s.state.loading=5),vf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vf.set(e,n),o||Lf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Rf(n),n=dt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pf(e){return`href="`+jt(e)+`"`}function Ff(e){return`link[rel="stylesheet"][`+e+`]`}function If(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Lf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Rd(t,`link`,n),ft(t),e.head.appendChild(t))}function Rf(e){return`[src="`+jt(e)+`"]`}function zf(e){return`script[async]`+e}function Bf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+jt(n.href)+`"]`);if(r)return t.instance=r,ft(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ft(r),Rd(r,`style`,a),Vf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pf(n.href);var o=e.querySelector(Ff(a));if(o)return t.state.loading|=4,t.instance=o,ft(o),o;r=If(n),(a=vf.get(a))&&Hf(r,a),o=(e.ownerDocument||e).createElement(`link`),ft(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Rd(o,`link`,r),t.state.loading|=4,Vf(o,n.precedence,e),t.instance=o;case`script`:return o=Rf(n.src),(a=e.querySelector(zf(o)))?(t.instance=a,ft(a),a):(r=n,(a=vf.get(o))&&(r=m({},n),Uf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ft(a),Rd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vf(r,n.precedence,e));return t.instance}function Vf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wf=null;function Gf(e,t,n){if(Wf===null){var r=new Map,i=Wf=new Map;i.set(n,r)}else i=Wf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ot]||a[$e]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Kf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Yf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pf(r.href),a=t.querySelector(Ff(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Qf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ft(a);return}a=t.ownerDocument||t,r=If(r),(i=vf.get(i))&&Hf(r,i),a=a.createElement(`link`),ft(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Rd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Qf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Xf=0;function Zf(e,t){return e.stylesheets&&e.count===0&&ep(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Xf===0&&(Xf=62500*Vd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Xf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ep(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $f=null;function ep(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$f=new Map,t.forEach(tp,e),$f=null,Qf.call(e))}function tp(e,t){if(!(t.state.loading&4)){var n=$f.get(e);if(n)var r=n.get(null);else{n=new Map,$f.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Qf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var np={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function rp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=G(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=G(0),this.hiddenUpdates=G(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ip(e,t,n,r,i,a,o,s,c,l,u,d){return e=new rp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ti(3,null,null,t),e.current=a,a.stateNode=e,t=ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Pa(a),e}function ap(e){return e?(e=$r,e):$r}function op(e,t,n,r,i,a){i=ap(i),r.context===null?r.context=i:r.pendingContext=i,r=Ia(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=La(e,r,t),n!==null&&(gu(n,e,t),Ra(n,e,t))}function sp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cp(e,t){sp(e,t),(e=e.alternate)&&sp(e,t)}function lp(e){if(e.tag===13||e.tag===31){var t=Xr(e,67108864);t!==null&&gu(t,e,67108864),cp(e,67108864)}}function up(e){if(e.tag===13||e.tag===31){var t=mu();t=Je(t);var n=Xr(e,t);n!==null&&gu(n,e,t),cp(e,t)}}var dp=!0;function fp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,mp(e,t,n,r)}finally{L.p=a,I.T=i}}function pp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,mp(e,t,n,r)}finally{L.p=a,I.T=i}}function mp(e,t,n,r){if(dp){var i=hp(r);if(i===null)Dd(e,t,r,gp,n),Dp(e,r);else if(kp(i,e,t,n,r))r.stopPropagation();else if(Dp(e,r),t&4&&-1<Ep.indexOf(e)){for(;i!==null;){var a=lt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=ze(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Me(o);s.entanglements[1]|=c,o&=~c}ad(a),!(Fl&6)&&(nu=be()+500,od(0,!1))}}break;case 31:case 13:s=Xr(a,2),s!==null&&gu(s,a,2),xu(),cp(a,2)}if(a=hp(r),a===null&&Dd(e,t,r,gp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Dd(e,t,r,null,n)}}function hp(e){return e=Jt(e),_p(e)}var gp=null;function _p(e){if(gp=null,e=ct(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return gp=e,null}function vp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(xe()){case Se:return 2;case Ce:return 8;case we:case Te:return 32;case Ee:return 268435456;default:return 32}default:return 32}}var yp=!1,bp=null,xp=null,Sp=null,Cp=new Map,wp=new Map,Tp=[],Ep=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Dp(e,t){switch(e){case`focusin`:case`focusout`:bp=null;break;case`dragenter`:case`dragleave`:xp=null;break;case`mouseover`:case`mouseout`:Sp=null;break;case`pointerover`:case`pointerout`:Cp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:wp.delete(t.pointerId)}}function Op(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=lt(t),t!==null&&lp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function kp(e,t,n,r,i){switch(t){case`focusin`:return bp=Op(bp,e,t,n,r,i),!0;case`dragenter`:return xp=Op(xp,e,t,n,r,i),!0;case`mouseover`:return Sp=Op(Sp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Cp.set(a,Op(Cp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,wp.set(a,Op(wp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ap(e){var t=ct(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Ze(e.priority,function(){up(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Ze(e.priority,function(){up(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function jp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qt=r,n.target.dispatchEvent(r),qt=null}else return t=lt(n),t!==null&&lp(t),e.blockedOn=n,!1;t.shift()}return!0}function Mp(e,t,n){jp(e)&&n.delete(t)}function Np(){yp=!1,bp!==null&&jp(bp)&&(bp=null),xp!==null&&jp(xp)&&(xp=null),Sp!==null&&jp(Sp)&&(Sp=null),Cp.forEach(Mp),wp.forEach(Mp)}function Pp(e,n){e.blockedOn===n&&(e.blockedOn=null,yp||(yp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Np)))}var Fp=null;function Ip(e){Fp!==e&&(Fp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fp===e&&(Fp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(_p(r||n)===null)continue;break}var a=lt(n);a!==null&&(e.splice(t,3),t-=3,bs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Lp(e){function t(t){return Pp(t,e)}bp!==null&&Pp(bp,e),xp!==null&&Pp(xp,e),Sp!==null&&Pp(Sp,e),Cp.forEach(t),wp.forEach(t);for(var n=0;n<Tp.length;n++){var r=Tp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Tp.length&&(n=Tp[0],n.blockedOn===null);)Ap(n),n.blockedOn===null&&Tp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[et]||null;if(typeof a==`function`)o||Ip(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[et]||null)s=o.formAction;else if(_p(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Ip(n)}}}function Rp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function zp(e){this._internalRoot=e}Bp.prototype.render=zp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;op(n,mu(),e,t,null,null)},Bp.prototype.unmount=zp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;op(e.current,2,null,e,null,null),xu(),t[tt]=null}};function Bp(e){this._internalRoot=e}Bp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Xe();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Tp.length&&t!==0&&t<Tp[n].priority;n++);Tp.splice(n,0,e),n===0&&Ap(e)}};var Vp=n.version;if(Vp!==`19.2.7`)throw Error(i(527,Vp,`19.2.7`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Hp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Up=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Up.isDisabled&&Up.supportsFiber)try{ke=Up.inject(Hp),Ae=Up}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Us,s=Ws,c=Gs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ip(e,1,!1,null,null,n,r,null,o,s,c,Rp),e[tt]=t.current,Td(e),new zp(t)}})),_=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},y=new class extends v{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},b={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},x=new class{#e=b;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function S(e){setTimeout(e,0)}var C=typeof window>`u`||`Deno`in globalThis;function w(){}function T(e,t){return typeof e==`function`?e(t):e}function E(e){return typeof e==`number`&&e>=0&&e!==1/0}function D(e,t){return Math.max(e+(t||0)-Date.now(),0)}function O(e,t){return typeof e==`function`?e(t):e}function k(e,t){return typeof e==`function`?e(t):e}function A(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==M(o,t.options))return!1}else if(!P(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function j(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(N(t.options.mutationKey)!==N(a))return!1}else if(!P(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function M(e,t){return(t?.queryKeyHashFn||N)(e)}function N(e){return JSON.stringify(e,(e,t)=>ee(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function P(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>P(e[n],t[n])):!1}var F=Object.prototype.hasOwnProperty;function I(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=R(e)&&R(t);if(!r&&!(ee(e)&&ee(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:F.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=I(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function L(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function R(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ee(e){if(!z(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!z(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function z(e){return Object.prototype.toString.call(e)===`[object Object]`}function B(e){return new Promise(t=>{x.setTimeout(t,e)})}function V(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:I(e,t)}function H(e){return e}function te(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ne(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var U=Symbol();function re(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===U?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ie(e,t){return typeof e==`function`?e(...t):!!e}function ae(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var oe=(()=>{let e=()=>C;return{isServer(){return e()},setIsServer(t){e=t}}})();function se(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ce=S;function le(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ce,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ue=le(),de=new class extends v{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function fe(e){return Math.min(1e3*2**e,3e4)}function pe(e){return(e??`online`)===`online`?de.isOnline():!0}var me=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function he(e){let t=!1,n=0,r,i=se(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new me(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>y.isFocused()&&(e.networkMode===`always`||de.isOnline())&&e.canRun(),u=()=>pe(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(oe.isServer()?0:3),o=e.retryDelay??fe,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),B(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var ge=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),E(this.gcTime)&&(this.#e=x.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(oe.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(x.clearTimeout(this.#e),this.#e=void 0)}};function _e(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ae(e,()=>t.signal,()=>n=!0)},u=re(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ne:te;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?ye:ve,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ve(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function ve(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ye(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var be=class extends ge{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ce(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ce(this.options);e.data!==void 0&&(this.setState(Se(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=V(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(w).catch(w):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>k(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===U||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>O(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!D(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=re(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?_e(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=he({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof me&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof me){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...xe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Se(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ue.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function xe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pe(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Se(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ce(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var we=class extends v{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=se(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ee(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return De(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return De(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof k(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!L(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Oe(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||O(this.options.staleTime,this.#t)!==O(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ae(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(w)),t}#g(){this.#b();let e=O(this.options.staleTime,this.#t);if(oe.isServer()||this.#r.isStale||!E(e))return;let t=D(this.#r.dataUpdatedAt,e)+1;this.#d=x.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(oe.isServer()||k(this.options.enabled,this.#t)===!1||!E(this.#p)||this.#p===0)&&(this.#f=x.setInterval(()=>{(this.options.refetchIntervalInBackground||y.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(x.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(x.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ee(e,t),o=i&&Oe(e,n,t,r);(a||o)&&(l={...l,...xe(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=V(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=V(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ke(e,t),refetch:this.refetch,promise:this.#o,isEnabled:k(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=se())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!L(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){ue.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Te(e,t){return k(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&k(t.retryOnMount,e)===!1)}function Ee(e,t){return Te(e,t)||e.state.data!==void 0&&De(e,t,t.refetchOnMount)}function De(e,t,n){if(k(t.enabled,e)!==!1&&O(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ke(e,t)}return!1}function Oe(e,t,n,r){return(e!==t||k(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ke(e,n)}function ke(e,t){return k(t.enabled,e)!==!1&&e.isStaleByTime(O(t.staleTime,e))}function Ae(e,t){return!L(e.getCurrentResult(),t)}var je=class extends ge{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Me(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=he({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ue.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Me(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ne=class extends v{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new je({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Pe(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Pe(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Pe(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Pe(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ue.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>j(t,e))}findAll(e={}){return this.getAll().filter(t=>j(e,t))}notify(e){ue.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ue.batch(()=>Promise.all(e.map(e=>e.continue().catch(w))))}};function Pe(e){return e.options.scope?.id}var Fe=class extends v{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),L(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&N(t.mutationKey)!==N(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Me();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ue.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Ie(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Le(e,t,n){let r=e.slice(0);return r[t]=n,r}var Re=class extends v{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,ue.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!L(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ie(e,n).forEach(e=>{e.destroy()}),Ie(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=I(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new we(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Le(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&ue.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},ze=class extends v{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??M(r,t),a=this.get(i);return a||(a=new be({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ue.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>A(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>A(e,t)):t}notify(e){ue.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ue.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ue.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Be=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ze,this.#t=e.mutationCache||new Ne,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=y.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=de.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(O(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=T(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ue.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ue.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ue.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=ue.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(w).catch(w)}invalidateQueries(e,t={}){return ue.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ue.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(w)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(w)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(O(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(w).catch(w)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(w).catch(w)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return de.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(N(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{P(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(N(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{P(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=M(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===U&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ve=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),He=o(((e,t)=>{t.exports=Ve()})),W=l(d(),1),G=He(),Ue=W.createContext(void 0),We=e=>{let t=W.useContext(Ue);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ge=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,G.jsx)(Ue.Provider,{value:e,children:t})),Ke=W.createContext(!1),qe=()=>W.useContext(Ke);Ke.Provider;function Je(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ye=W.createContext(Je()),Xe=()=>W.useContext(Ye),Ze=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ie(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Qe=e=>{W.useEffect(()=>{e.clearReset()},[e])},$e=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ie(n,[e.error,r])),et=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},tt=(e,t)=>e.isLoading&&e.isFetching&&!t,nt=(e,t)=>e?.suspense&&t.isPending,rt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function it({queries:e,...t},n){let r=We(n),i=qe(),a=Xe(),o=W.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{et(e),Ze(e,a,r.getQueryCache().get(e.queryHash))}),Qe(a);let[s]=W.useState(()=>new Re(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;W.useSyncExternalStore(W.useCallback(e=>d?s.subscribe(ue.batchCalls(e)):w,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),W.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>nt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&nt(n,e)?rt(n,new we(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&$e({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function at(e,t,n){let r=qe(),i=Xe(),a=We(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,et(o),Ze(o,i,s),Qe(i);let l=!a.getQueryCache().get(o.queryHash),[u]=W.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(W.useSyncExternalStore(W.useCallback(e=>{let t=f?u.subscribe(ue.batchCalls(e)):w;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),W.useEffect(()=>{u.setOptions(o)},[o,u]),nt(o,d))throw rt(o,u,i);if($e({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!oe.isServer()&&tt(d,r)&&(l?rt(o,u,i):s?.promise)?.catch(w).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function ot(e,t){return at(e,we,t)}function st(e,t){let n=We(t),[r]=W.useState(()=>new Fe(n,e));W.useEffect(()=>{r.setOptions(e)},[r,e]);let i=W.useSyncExternalStore(W.useCallback(e=>r.subscribe(ue.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=W.useCallback((e,t)=>{r.mutate(e,t).catch(w)},[r]);if(i.error&&ie(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ct=`modulepreload`,lt=function(e){return`/`+e},ut={},dt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=lt(t,n),t in ut)return;ut[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:ct,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},ft=`popstate`;function pt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function mt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return yt(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:bt(t)}return St(t,n,null,e)}function ht(e,t){if(e===!1||e==null)throw Error(t)}function gt(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function _t(){return Math.random().toString(36).substring(2,10)}function vt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function yt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?xt(t):t,state:n,key:t&&t.key||r||_t(),mask:i}}function bt({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function xt(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function St(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=pt(e)?e:yt(h.location,e,t);n&&n(r,e),l=u()+1;let d=vt(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=pt(e)?e:yt(h.location,e,t);n&&n(r,e),l=u();let i=vt(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Ct(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(ft,d),c=e,()=>{i.removeEventListener(ft,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Ct(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),ht(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:bt(t);return i=i.replace(/ $/,`%20`),!n&&i.startsWith(`//`)&&(i=r+i),new URL(i,r)}function wt(e,t,n=`/`){return Tt(e,t,n,!1)}function Tt(e,t,n,r,i){let a=Wt((typeof t==`string`?xt(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Dt(e),s=null,c=Ut(a);for(let e=0;s==null&&e<o.length;++e)s=Bt(o[e],c,r);return s}function Et(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Dt(e){let t=Ot(e);return At(t),t}function Ot(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;ht(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=$t([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(ht(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Ot(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Rt(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of kt(e.path))a(e,t,!0,n)}),t}function kt(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=kt(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function At(e){e.sort((e,t)=>e.score===t.score?zt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var jt=/^:[\w-]+$/,Mt=3,Nt=2,Pt=1,Ft=10,It=-2,Lt=e=>e===`*`;function Rt(e,t){let n=e.split(`/`),r=n.length;return n.some(Lt)&&(r+=It),t&&(r+=Nt),n.filter(e=>!Lt(e)).reduce((e,t)=>e+(jt.test(t)?Mt:t===``?Pt:Ft),r)}function zt(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Bt(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Vt({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Vt({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:$t([a,u.pathname]),pathnameBase:tn($t([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=$t([a,u.pathnameBase]))}return o}function Vt(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ht(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Ht(e,t=!1,n=!0){gt(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Ut(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return gt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Wt(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var Gt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Kt(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?xt(e):e,a;return n?(n=Qt(n),a=n.startsWith(`/`)?qt(n.substring(1),`/`):qt(n,t)):a=t,{pathname:a,search:nn(r),hash:rn(i)}}function qt(e,t){let n=en(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Jt(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Yt(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Xt(e){let t=Yt(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Zt(e,t,n,r=!1){let i;typeof e==`string`?i=xt(e):(i={...e},ht(!i.pathname||!i.pathname.includes(`?`),Jt(`?`,`pathname`,`search`,i)),ht(!i.pathname||!i.pathname.includes(`#`),Jt(`#`,`pathname`,`hash`,i)),ht(!i.search||!i.search.includes(`#`),Jt(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Kt(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Qt=e=>e.replace(/\/\/+/g,`/`),$t=e=>Qt(e.join(`/`)),en=e=>e.replace(/\/+$/,``),tn=e=>en(e).replace(/^\/*/,`/`),nn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,rn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,an=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function on(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function sn(e){return $t(e.map(e=>e.route.path).filter(Boolean))||`/`}var cn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ln(e,t){let n=e;if(typeof n!=`string`||!Gt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(cn)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=Wt(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{gt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var un=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(un);var dn=[`GET`,...un];new Set(dn);var fn=W.createContext(null);fn.displayName=`DataRouter`;var pn=W.createContext(null);pn.displayName=`DataRouterState`;var mn=W.createContext(!1);function hn(){return W.useContext(mn)}var gn=W.createContext({isTransitioning:!1});gn.displayName=`ViewTransition`;var _n=W.createContext(new Map);_n.displayName=`Fetchers`;var vn=W.createContext(null);vn.displayName=`Await`;var yn=W.createContext(null);yn.displayName=`Navigation`;var bn=W.createContext(null);bn.displayName=`Location`;var xn=W.createContext({outlet:null,matches:[],isDataRoute:!1});xn.displayName=`Route`;var Sn=W.createContext(null);Sn.displayName=`RouteError`;var Cn=`REACT_ROUTER_ERROR`,wn=`REDIRECT`,Tn=`ROUTE_ERROR_RESPONSE`;function En(e){if(e.startsWith(`${Cn}:${wn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Dn(e){if(e.startsWith(`${Cn}:${Tn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new an(t.status,t.statusText,t.data)}catch{}}function On(e,{relative:t}={}){ht(kn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=W.useContext(yn),{hash:i,pathname:a,search:o}=Rn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:$t([n,a])),r.createHref({pathname:s,search:o,hash:i})}function kn(){return W.useContext(bn)!=null}function An(){return ht(kn(),`useLocation() may be used only in the context of a <Router> component.`),W.useContext(bn).location}var jn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Mn(e){W.useContext(yn).static||W.useLayoutEffect(e)}function Nn(){let{isDataRoute:e}=W.useContext(xn);return e?rr():Pn()}function Pn(){ht(kn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=W.useContext(fn),{basename:t,navigator:n}=W.useContext(yn),{matches:r}=W.useContext(xn),{pathname:i}=An(),a=JSON.stringify(Xt(r)),o=W.useRef(!1);return Mn(()=>{o.current=!0}),W.useCallback((r,s={})=>{if(gt(o.current,jn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Zt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:$t([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Fn=W.createContext(null);function In(e){let t=W.useContext(xn).outlet;return W.useMemo(()=>t&&W.createElement(Fn.Provider,{value:e},t),[t,e])}function Ln(){let{matches:e}=W.useContext(xn);return e[e.length-1]?.params??{}}function Rn(e,{relative:t}={}){let{matches:n}=W.useContext(xn),{pathname:r}=An(),i=JSON.stringify(Xt(n));return W.useMemo(()=>Zt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function zn(e,t){return Bn(e,t)}function Bn(e,t,n){ht(kn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=W.useContext(yn),{matches:i}=W.useContext(xn),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;ar(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
10
10
|
|
|
11
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=An(),d;if(t){let e=typeof t==`string`?xt(t):t;ht(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):wt(e,{pathname:p});gt(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),gt(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=qn(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:$t([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:$t([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?W.createElement(bn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Vn(){let e=nr(),t=on(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=W.createElement(W.Fragment,null,W.createElement(`p`,null,`💿 Hey developer 👋`),W.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,W.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,W.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),W.createElement(W.Fragment,null,W.createElement(`h2`,null,`Unexpected Application Error!`),W.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?W.createElement(`pre`,{style:i},n):null,o)}var Hn=W.createElement(Vn,null),Un=class extends W.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Dn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:W.createElement(xn.Provider,{value:this.props.routeContext},W.createElement(Sn.Provider,{value:e,children:this.props.component}));return this.context?W.createElement(Gn,{error:e},t):t}};Un.contextType=mn;var Wn=new WeakMap;function Gn({children:e,error:t}){let{basename:n}=W.useContext(yn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=En(t.digest);if(e){let r=Wn.get(t);if(r)throw r;let i=ln(e.location,n);if(cn&&!Wn.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Wn.set(t,n),n}return W.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function Kn({routeContext:e,match:t,children:n}){let r=W.useContext(fn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),W.createElement(xn.Provider,{value:e},n)}function qn(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);ht(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:sn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Hn,o&&(s<0&&c===0?(ar(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?W.createElement(n.route.Component,null):n.route.element?n.route.element:e,W.createElement(Kn,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?W.createElement(Un,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Jn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Yn(e){let t=W.useContext(fn);return ht(t,Jn(e)),t}function Xn(e){let t=W.useContext(pn);return ht(t,Jn(e)),t}function Zn(e){let t=W.useContext(xn);return ht(t,Jn(e)),t}function Qn(e){let t=Zn(e),n=t.matches[t.matches.length-1];return ht(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function $n(){return Qn(`useRouteId`)}function er(){let e=Xn(`useNavigation`);return W.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function tr(){let{matches:e,loaderData:t}=Xn(`useMatches`);return W.useMemo(()=>e.map(e=>Et(e,t)),[e,t])}function nr(){let e=W.useContext(Sn),t=Xn(`useRouteError`),n=Qn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function rr(){let{router:e}=Yn(`useNavigate`),t=Qn(`useNavigate`),n=W.useRef(!1);return Mn(()=>{n.current=!0}),W.useCallback(async(r,i={})=>{gt(n.current,jn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var ir={};function ar(e,t,n){!t&&!ir[e]&&(ir[e]=!0,gt(!1,n))}W.memo(or);function or({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Bn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function sr({to:e,replace:t,state:n,relative:r}){ht(kn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=W.useContext(yn);gt(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=W.useContext(xn),{pathname:o}=An(),s=Nn(),c=Zt(e,Xt(a),o,r===`path`),l=JSON.stringify(c);return W.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function cr(e){return In(e.context)}function lr(e){ht(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function ur({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){ht(!kn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=W.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=xt(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=W.useMemo(()=>{let e=Wt(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return gt(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:W.createElement(yn.Provider,{value:c},W.createElement(bn.Provider,{children:t,value:h}))}function dr({children:e,location:t}){return zn(fr(e),t)}W.Component;function fr(e,t=[]){let n=[];return W.Children.forEach(e,(e,r)=>{if(!W.isValidElement(e))return;let i=[...t,r];if(e.type===W.Fragment){n.push.apply(n,fr(e.props.children,i));return}ht(e.type===lr,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ht(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=fr(e.props.children,i)),n.push(a)}),n}var pr=`get`,mr=`application/x-www-form-urlencoded`;function hr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function gr(e){return hr(e)&&e.tagName.toLowerCase()===`button`}function _r(e){return hr(e)&&e.tagName.toLowerCase()===`form`}function vr(e){return hr(e)&&e.tagName.toLowerCase()===`input`}function yr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function br(e,t){return e.button===0&&(!t||t===`_self`)&&!yr(e)}function xr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Sr(e,t){let n=xr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Cr=null;function wr(){if(Cr===null)try{new FormData(document.createElement(`form`),0),Cr=!1}catch{Cr=!0}return Cr}var Tr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Er(e){return e!=null&&!Tr.has(e)?(gt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${mr}"`),null):e}function Dr(e,t){let n,r,i,a,o;if(_r(e)){let o=e.getAttribute(`action`);r=o?Wt(o,t):null,n=e.getAttribute(`method`)||pr,i=Er(e.getAttribute(`enctype`))||mr,a=new FormData(e)}else if(gr(e)||vr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Wt(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||pr,i=Er(e.getAttribute(`formenctype`))||Er(o.getAttribute(`enctype`))||mr,a=new FormData(o,e),!wr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(hr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=pr,r=null,i=mr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Or={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},kr=/[&><\u2028\u2029]/g;function Ar(e){return e.replace(kr,e=>Or[e])}function jr(e,t){if(e===!1||e==null)throw Error(t)}function Mr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&Wt(i.pathname,t)===`/`?i.pathname=`${en(t)}/_root.${r}`:i.pathname=`${en(i.pathname)}.${r}`,i}async function Nr(e,t){if(e.id in t)return t[e.id];try{let n=await dt(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Pr(e){return e!=null&&typeof e.page==`string`}function Fr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Ir(e,t,n){return Vr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Nr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Fr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Lr(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Rr(e,t,{includeHydrateFallback:n}={}){return zr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function zr(e){return[...new Set(e)]}function Br(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Vr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Pr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Br(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Hr(){let e=W.useContext(fn);return jr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Ur(){let e=W.useContext(pn);return jr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Wr=W.createContext(void 0);Wr.displayName=`FrameworkContext`;function Gr(){let e=W.useContext(Wr);return jr(e,`You must render this element inside a <HydratedRouter> element`),e}function Kr(e,t){let n=W.useContext(Wr),[r,i]=W.useState(!1),[a,o]=W.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=W.useRef(null);W.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),W.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:qr(s,p),onBlur:qr(c,m),onMouseEnter:qr(l,p),onMouseLeave:qr(u,m),onTouchStart:qr(d,p)}]:[a,f,{}]:[!1,f,{}]}function qr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Jr({page:e,...t}){let n=hn(),{router:r}=Hr(),i=W.useMemo(()=>wt(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?W.createElement(Xr,{page:e,matches:i,...t}):W.createElement(Zr,{page:e,matches:i,...t}):null}function Yr(e){let{manifest:t,routeModules:n}=Gr(),[r,i]=W.useState([]);return W.useEffect(()=>{let r=!1;return Ir(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Xr({page:e,matches:t,...n}){let r=An(),{future:i}=Gr(),{basename:a}=Hr(),o=W.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Mr(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return W.createElement(W.Fragment,null,o.map(e=>W.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Zr({page:e,matches:t,...n}){let r=An(),{future:i,manifest:a,routeModules:o}=Gr(),{basename:s}=Hr(),{loaderData:c,matches:l}=Ur(),u=W.useMemo(()=>Lr(e,t,l,a,r,`data`),[e,t,l,a,r]),d=W.useMemo(()=>Lr(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=W.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Mr(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=W.useMemo(()=>Rr(d,a),[d,a]),m=Yr(d);return W.createElement(W.Fragment,null,f.map(e=>W.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>W.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>W.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Qr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}W.Component;var $r=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{$r&&(window.__reactRouterVersion=`7.17.0`)}catch{}function ei({basename:e,children:t,useTransitions:n,window:r}){let i=W.useRef();i.current??=mt({window:r,v5Compat:!0});let a=i.current,[o,s]=W.useState({action:a.action,location:a.location}),c=W.useCallback(e=>{n===!1?s(e):W.startTransition(()=>s(e))},[n]);return W.useLayoutEffect(()=>a.listen(c),[a,c]),W.createElement(ur,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function ti({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=W.useState({action:n.action,location:n.location}),o=W.useCallback(e=>{r===!1?a(e):W.startTransition(()=>a(e))},[r]);return W.useLayoutEffect(()=>n.listen(o),[n,o]),W.createElement(ur,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}ti.displayName=`unstable_HistoryRouter`;var ni=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ri=W.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=W.useContext(yn),v=typeof l==`string`&&ni.test(l),y=ln(l,h);l=y.to;let b=On(l,{relative:r}),x=An(),S=null;if(o){let e=Zt(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:$t([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Kr(n,p),E=ui(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=W.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:Qr(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?W.createElement(W.Fragment,null,k,W.createElement(Jr,{page:b})):k});ri.displayName=`Link`;var ii=W.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Rn(a,{relative:c.relative}),d=An(),f=W.useContext(pn),{navigator:p,basename:m}=W.useContext(yn),h=f!=null&&xi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=Wt(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return W.createElement(ri,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});ii.displayName=`NavLink`;var ai=W.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=pr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=W.useContext(yn),g=mi(),_=hi(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&ni.test(s);return W.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?W.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});ai.displayName=`Form`;function oi({getKey:e,storageKey:t,...n}){let r=W.useContext(Wr),{basename:i}=W.useContext(yn),a=An(),o=tr();yi({getKey:e,storageKey:t});let s=W.useMemo(()=>{if(!r||!e)return null;let t=vi(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return W.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Ar(JSON.stringify(t||gi))}, ${Ar(JSON.stringify(s))})`}})}oi.displayName=`ScrollRestoration`;function si(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ci(e){let t=W.useContext(fn);return ht(t,si(e)),t}function li(e){let t=W.useContext(pn);return ht(t,si(e)),t}function ui(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Nn(),d=An(),f=Rn(e,{relative:o});return W.useCallback(p=>{if(br(p,t)){p.preventDefault();let t=n===void 0?bt(d)===bt(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?W.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function di(e){gt(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=W.useRef(xr(e)),n=W.useRef(!1),r=An(),i=W.useMemo(()=>Sr(r.search,n.current?null:t.current),[r.search]),a=Nn();return[i,W.useCallback((e,t)=>{let r=xr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var fi=0,pi=()=>`__${String(++fi)}__`;function mi(){let{router:e}=ci(`useSubmit`),{basename:t}=W.useContext(yn),n=$n(),r=e.fetch,i=e.navigate;return W.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Dr(e,t);a.navigate===!1?await r(a.fetcherKey||pi(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function hi(e,{relative:t}={}){let{basename:n}=W.useContext(yn),r=W.useContext(xn);ht(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Rn(e||`.`,{relative:t})},o=An();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:$t([n,a.pathname])),bt(a)}var gi=`react-router-scroll-positions`,_i={};function vi(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:Wt(e.pathname,n)||e.pathname},t)),i??=e.key,i}function yi({getKey:e,storageKey:t}={}){let{router:n}=ci(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=li(`useScrollRestoration`),{basename:a}=W.useContext(yn),o=An(),s=tr(),c=er();W.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),bi(W.useCallback(()=>{if(c.state===`idle`){let t=vi(o,s,a,e);_i[t]=window.scrollY}try{sessionStorage.setItem(t||gi,JSON.stringify(_i))}catch(e){gt(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(W.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||gi);e&&(_i=JSON.parse(e))}catch{}},[t]),W.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(_i,()=>window.scrollY,e?(t,n)=>vi(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),W.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{gt(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function bi(e,t){let{capture:n}=t||{};W.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function xi(e,{relative:t}={}){let n=W.useContext(gn);ht(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ci(`useViewTransitionState`),i=Rn(e,{relative:t});if(!n.isTransitioning)return!1;let a=Wt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Wt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Vt(i.pathname,o)!=null||Vt(i.pathname,a)!=null}var Si=l(_(),1),Ci=6e4,wi=3e5,Ti=200,Ei={active:1,idle:2,deep_sleep:5,hidden:10},Di=[`mousemove`,`mousedown`,`keydown`,`scroll`,`touchstart`],Oi=(0,W.createContext)(void 0);function ki({children:e}){let[t,n]=(0,W.useState)(`active`),r=(0,W.useRef)(null),i=(0,W.useRef)(null),a=(0,W.useRef)(Date.now()),o=(0,W.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null),i.current&&=(clearTimeout(i.current),null)},[]),s=(0,W.useCallback)(()=>{o(),r.current=setTimeout(()=>{n(`idle`),i.current=setTimeout(()=>{n(`deep_sleep`)},wi-Ci)},Ci)},[o]),c=(0,W.useCallback)(()=>{let e=Date.now();e-a.current<Ti||(a.current=e,n(`active`),s())},[s]),l=(0,W.useCallback)(()=>{document.hidden?(o(),n(`hidden`)):(n(`active`),a.current=Date.now(),s())},[o,s]);return(0,W.useEffect)(()=>{s();for(let e of Di)document.addEventListener(e,c,{passive:!0});return document.addEventListener(`visibilitychange`,l),()=>{o();for(let e of Di)document.removeEventListener(e,c);document.removeEventListener(`visibilitychange`,l)}},[c,l,s,o]),(0,G.jsx)(Oi.Provider,{value:{powerState:t},children:e})}function Ai(){let e=(0,W.useContext)(Oi);if(!e)throw Error(`usePowerState must be used within a PowerProvider`);return e.powerState}var ji={enabled:`cortex.enabled`,instructions:{injectOnSessionStart:`cortex.instructions.inject_on_session_start`,injectOnSubagentStart:`cortex.instructions.inject_on_subagent_start`},digest:{tier:`cortex.digest.tier`,injectOnSessionStart:`cortex.digest.inject_on_session_start`},spores:{injectOnPromptSubmit:`cortex.spores.inject_on_prompt_submit`,maxPerPrompt:`cortex.spores.max_per_prompt`},canopy:{injectOnPreToolUse:`cortex.canopy.inject_on_pre_tool_use`,minFileBytes:`cortex.canopy.min_file_bytes`,refresh:{backgroundEnabled:`cortex.canopy.refresh.background_enabled`,backgroundPeriodMinutes:`cortex.canopy.refresh.background_period_minutes`},exclude:{defaultPatterns:`cortex.canopy.exclude.default_patterns`,patterns:`cortex.canopy.exclude.patterns`}}},Mi={scheduledTasksEnabled:`agent.scheduled_tasks_enabled`,eventTasksEnabled:`agent.event_tasks_enabled`,summaryBatchInterval:`agent.summary_batch_interval`,runRetentionDays:`agent.run_retention_days`},Ni=`config-field-`,Pi={appearance:`config-section-appearance`,cortexInstructions:`config-section-cortex-instructions`,cortexBuilder:`config-section-cortex-builder`,cortexDigest:`config-section-cortex-digest`,settingsAgent:`config-section-settings-agent`,settingsEmbedding:`config-section-settings-embedding`,settingsNotifications:`config-section-settings-notifications`,settingsPlanCapture:`config-section-settings-plan-capture`,settingsProject:`config-section-settings-project`,agentOperations:`config-section-agent-operations`,operationsMaintenance:`config-section-operations-maintenance`,operationsBackup:`config-section-operations-backup`};Pi.appearance,Pi.settingsAgent,Pi.settingsEmbedding,Pi.cortexDigest,Pi.cortexInstructions,Pi.cortexInstructions,Pi.cortexInstructions,Pi.cortexInstructions,Pi.settingsNotifications,Pi.settingsPlanCapture,Pi.agentOperations,ji.digest.tier,ji.digest.injectOnSessionStart,ji.instructions.injectOnSessionStart,ji.instructions.injectOnSubagentStart,ji.spores.injectOnPromptSubmit,ji.spores.maxPerPrompt,ji.canopy.injectOnPreToolUse,ji.canopy.minFileBytes,Mi.scheduledTasksEnabled,Mi.eventTasksEnabled,Mi.summaryBatchInterval,Mi.runRetentionDays;function Fi(e){return`${Ni}${e.replace(/[^a-zA-Z0-9]+/g,`-`)}`}var Ii=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Li=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Ri=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),zi=e=>{let t=Ri(e);return t.charAt(0).toUpperCase()+t.slice(1)},Bi={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Vi=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Hi=(0,W.createContext)({}),Ui=()=>(0,W.useContext)(Hi),Wi=(0,W.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Ui()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,W.createElement)(`svg`,{ref:c,...Bi,width:t??l??Bi.width,height:t??l??Bi.height,stroke:e??f,strokeWidth:m,className:Ii(`lucide`,p,i),...!a&&!Vi(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,W.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),K=(e,t)=>{let n=(0,W.forwardRef)(({className:n,...r},i)=>(0,W.createElement)(Wi,{ref:i,iconNode:t,className:Ii(`lucide-${Li(zi(e))}`,`lucide-${e}`,n),...r}));return n.displayName=zi(e),n},Gi=K(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ki=K(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),qi=K(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ji=K(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Yi=K(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Xi=K(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Zi=K(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Qi=K(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),$i=K(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ea=K(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ta=K(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),na=K(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ra=K(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),ia=K(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),aa=K(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),oa=K(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),sa=K(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ca=K(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),la=K(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),ua=K(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),da=K(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),fa=K(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),pa=K(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ma=K(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ha=K(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),ga=K(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),_a=K(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),va=K(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ya=K(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),ba=K(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),xa=K(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Sa=K(`file-search`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]),Ca=K(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),wa=K(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),Ta=K(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Ea=K(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Da=K(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Oa=K(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ka=K(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Aa=K(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),ja=K(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Ma=K(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Na=K(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Pa=K(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Fa=K(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Ia=K(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),La=K(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Ra=K(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),za=K(`mail-check`,[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]]),Ba=K(`map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),Va=K(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Ha=K(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ua=K(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Wa=K(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Ga=K(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Ka=K(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),qa=K(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Ja=K(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Ya=K(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Xa=K(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Za=K(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),Qa=K(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),$a=K(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),eo=K(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),to=K(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),no=K(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ro=K(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),io=K(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),ao=K(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),oo=K(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),so=K(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),co=K(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),lo=K(`sprout`,[[`path`,{d:`M14 9.536V7a4 4 0 0 1 4-4h1.5a.5.5 0 0 1 .5.5V5a4 4 0 0 1-4 4 4 4 0 0 0-4 4c0 2 1 3 1 5a5 5 0 0 1-1 3`,key:`139s4v`}],[`path`,{d:`M4 9a5 5 0 0 1 8 4 5 5 0 0 1-8-4`,key:`1dlkgp`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),uo=K(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),fo=K(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),po=K(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),mo=K(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ho=K(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),go=K(`trees`,[[`path`,{d:`M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z`,key:`1l6gj6`}],[`path`,{d:`M7 16v6`,key:`1a82de`}],[`path`,{d:`M13 19v3`,key:`13sx9i`}],[`path`,{d:`M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5`,key:`1sj9kv`}]]),_o=K(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),vo=K(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),yo=K(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),bo=K(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),xo=K(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),So=K(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Co=K(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),wo=`myco.lastSelectedProject`,To=null;function Eo(e){To=e}function Do(){return To}function Oo(){return ko(Do())}function ko(e){return e?{"x-myco-grove-id":e.grove.id,"x-myco-project-id":e.project.project_id}:{}}function Ao(e,t,n){if(!t||!n)return null;let r=e.find(e=>e.slug===t||e.id===t);if(!r)return null;let i=r.projects.find(e=>e.slug===n||e.project_id===n);return i?{grove:r,project:i}:null}function jo(e){let t=e.find(e=>e.is_default&&e.projects.length>0)??e.find(e=>e.projects.length>0);return t?{grove:t,project:t.projects[0]}:null}function Mo(e){let t=new Map;for(let n of e??[]){let e=n.last_activity_at?Date.parse(n.last_activity_at):0;t.set(n.project_id,Number.isNaN(e)?0:e)}return t}function No(e,t){let n=jo(e);if(!t||t.length===0)return n;let r=Mo(t),i=n,a=n?r.get(n.project.project_id)??0:-1;for(let t of e)for(let e of t.projects){let n=r.get(e.project_id)??0;n>a&&(a=n,i={grove:t,project:e})}return i}function Po(e,t){if(e.projects.length===0)return null;if(!t||t.length===0)return e.projects[0];let n=Mo(t);return[...e.projects].sort((e,t)=>(n.get(t.project_id)??0)-(n.get(e.project_id)??0))[0]??null}function Fo(e,t=``){let n=t&&t!==`/`?`/${t.replace(/^\/+/,``)}`:``;return`/g/${e.grove.slug}/p/${e.project.slug}${n}`}function Io(e){let t=e.match(/^\/g\/[^/]+\/p\/[^/]+(?<suffix>\/.*)?$/)?.groups?.suffix??`/`;return/^\/sessions\/[^/]+/.test(t)?`/sessions`:t}var Lo=[{test:/^\/g\/[^/]+\/team(\/|$|\?)/,scope:`machine`}];function Ro(e){for(let t of Lo)if(t.test.test(e))return t.scope;return/^\/g\/[^/]+\/p\/[^/]+/.test(e)?`project`:/^\/g\/[^/]+/.test(e)?`grove`:`machine`}function zo(e){return e?`${e.grove.id}:${e.project.project_id}`:`none`}function Bo(){try{let e=window.localStorage.getItem(wo);if(!e)return null;let t=JSON.parse(e);return typeof t.groveId!=`string`||typeof t.projectId!=`string`?null:{groveId:t.groveId,projectId:t.projectId}}catch{return null}}function Vo(e){try{window.localStorage.setItem(wo,JSON.stringify({groveId:e.grove.id,projectId:e.project.project_id}))}catch{}}function Ho(e){let t=Bo();if(!t)return null;let n=e.find(e=>e.id===t.groveId),r=n?.projects.find(e=>e.project_id===t.projectId);return n&&r?{grove:n,project:r}:null}function Uo(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?`M`:(t.length===1?t[0].slice(0,2):`${t[0][0]}${t[1][0]}`).toUpperCase()}function Wo(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return`hsl(${t%360} 58% 48%)`}function Go(){return``}function Ko(e){return e.startsWith(`/`)?e:`/${e}`}var qo=`/api`,Jo=[`/groves`,`/version`,`/logs`,`/logs/search`,`/logs/stream`],Yo=`1.1.2`,Xo=!1;function Zo(e){if(Xo)return;let t=e.headers.get(`X-Myco-Api-Version`);t&&t!==Yo&&(Xo=!0,console.warn(`[myco] UI version ${Yo} is talking to daemon ${t} — reload to pick up the new UI build.`))}async function q(e,t){let n=t?.method?.toUpperCase(),r=t?.body!==void 0&&t.body!==null||n===`POST`||n===`PUT`,i=is(e,t?.headers,r),a=await fetch(Ko(`${qo}${e}`),{...t,headers:i});if(Zo(a),!a.ok){let e=await Qo(a).catch(()=>({}));throw ns(a.status,e),new ms(a.status,e)}return Qo(a)}async function Qo(e){if(!(e.status===204||e.status===205||e.headers.get(`Content-Length`)===`0`)){if(typeof e.text==`function`){let t=await e.text();return t.length===0?void 0:JSON.parse(t)}return e.json()}}var $o=`myco:auth-reload-ts`,es=1e4,ts=()=>{window.location.reload()};function ns(e,t){if(e===401&&hs(t)===`unauthorized_context_switch`&&!(typeof window>`u`||window.sessionStorage===void 0)){try{let e=Number(window.sessionStorage.getItem($o)??`0`);if(Number.isFinite(e)&&Date.now()-e<es)return;window.sessionStorage.setItem($o,String(Date.now()))}catch{return}ts()}}function rs(){if(typeof window>`u`)return;let e=window.__MYCO_AUTH__;return typeof e==`string`&&e.length>0?e:void 0}function is(e,t,n){let r=new Headers;if(!as(e)){for(let[e,t]of Object.entries(Oo()))r.set(e,t);let e=rs();e&&r.set(`x-myco-auth`,e)}return n&&r.set(`Content-Type`,`application/json`),t&&new Headers(t).forEach((e,t)=>r.set(t,e)),Array.from(r.keys()).length>0?r:void 0}function as(e){return Jo.some(t=>e===t||e.startsWith(`${t}/`))}async function os(e,t){return q(e,{method:`POST`,body:t?JSON.stringify(t):void 0})}async function ss(e,t,n){return q(e,{...n,method:`PUT`,body:JSON.stringify(t)})}async function cs(e,t){return q(e,{method:`PATCH`,body:JSON.stringify(t)})}async function ls(e,t){return q(e,{method:`DELETE`,body:t?JSON.stringify(t):void 0})}function us(e,t){return q(`/config/merged`,{signal:e,headers:t})}function ds(e,t){return q(`/config/local`,{signal:e,headers:t})}function fs(e,t,n,r){let i={scope:e,patch:t};return n&&n.length>0&&(i.clear=n),ss(`/config/scoped`,i,{headers:r})}function ps(e,t){return ss(`/config/scoped`,{scope:`local`,patch:{},clear:e},{headers:t})}var ms=class extends Error{status;body;constructor(e,t){let n=gs(t);super(n?`${n} (API ${e})`:`API error ${e}`),this.status=e,this.body=t}};function hs(e){if(typeof e!=`object`||!e||!(`error`in e))return null;let t=e.error;if(typeof t==`string`)return t;if(typeof t==`object`&&t&&`code`in t){let e=t.code;return typeof e==`string`?e:null}return null}function gs(e){if(typeof e!=`object`||!e)return null;if(`error`in e){let t=e.error;if(typeof t==`string`)return t;if(typeof t==`object`&&t){let e=`message`in t?t.message:null;if(typeof e==`string`&&e.length>0)return e;let n=`code`in t?t.code:null;if(typeof n==`string`&&n.length>0)return n}}let t=`message`in e?e.message:null;return typeof t==`string`&&t.length>0?t:null}function _s(e={}){let t=e.includeArchived??!1;return ot({queryKey:[`groves`,{includeArchived:t}],queryFn:({signal:e})=>q(t?`/groves?include_archived=true`:`/groves`,{signal:e}),staleTime:5e3,refetchInterval:e.refetchInterval})}var vs=(0,W.createContext)(null);function ys({selection:e,persist:t=!0,children:n}){let r=We(),i=zo(e),[a,o]=(0,W.useState)(null);return(0,W.useLayoutEffect)(()=>{Eo(e),t&&Vo(e),r.removeQueries({predicate:e=>e.queryKey[0]!==`groves`}),o(i)},[i,t,r]),a===i?(0,G.jsx)(vs.Provider,{value:e,children:n}):(0,G.jsx)(`div`,{className:`flex h-64 items-center justify-center text-sm text-on-surface-variant`,children:`Switching project...`})}function bs({children:e}){return(0,W.useLayoutEffect)(()=>{Eo(null)},[]),(0,G.jsx)(G.Fragment,{children:e})}function xs(){return(0,W.useContext)(vs)}function Ss(){let e=(0,W.useContext)(vs),t=_s();if(e)return e;let n=t.data?.groves??[];return Ho(n)??jo(n)}function Cs(e=``){let t=xs();return t?Fo(t,e):e||`/`}function ws(){let e=xs();return(0,W.useCallback)((t=``)=>e?Fo(e,t):t||`/`,[e])}function Ts(e,t){return e?[...t,{projectSelection:zo(e)}]:t}function Es(e){return Ts(xs(),e)}var Ds=6e4,Os=3e4;function ks(e,t,n){if(t===`heartbeat`){let t=e*Ei[n];return n===`hidden`?Math.min(t,Ds):n===`deep_sleep`?Math.min(t,Os):t}return n===`deep_sleep`||n===`hidden`?!1:e*Ei[n]}function As(e){let t=Ai(),{pollCategory:n,refetchInterval:r,contextFree:i=!1,...a}=e,o=Es(a.queryKey??[]),s=e=>e===!1||e===void 0?e:ks(e,n,t),c=typeof r==`function`?e=>s(r(e)):s(r);return ot({...a,queryKey:i?a.queryKey:o,refetchInterval:c})}var js={HEALTH:5e3,STATS:1e4,LOGS:3e3,PROGRESS:1e3,UPDATE:3e5,RUNS_ACTIVE:3e3,RUN_DETAIL:5e3,SESSIONS:8e3,SESSION_DETAIL:8e3,SPORES:3e4,CANOPY_ENTRIES:6e4,GIT_IDENTITY:5e3,TEAM:5e3},Ms=1e4,Ns=3e4,Ps=[`debug`,`info`,`warn`,`error`],Fs={debug:0,info:1,warn:2,error:3},Is=[`stable`,`beta`],Ls=1e3;function Rs(e){switch(e){case`info`:return`default`;case`warn`:return`warning`;case`error`:return`destructive`;default:return`secondary`}}function zs(e){switch(e){case`info`:return`bg-primary`;case`debug`:return`bg-outline`;case`warn`:return`bg-secondary`;case`error`:return`bg-tertiary`;default:return`bg-outline`}}function Bs(){return As({queryKey:[`daemon-stats`],queryFn:({signal:e})=>q(`/stats`,{signal:e}),refetchInterval:js.STATS,pollCategory:`standard`})}var Vs=500,Hs=3e4;function Us(){let[e,t]=(0,W.useState)(!1),n=(0,W.useRef)(null);return{restart:(0,W.useCallback)(async(e=!1)=>{t(!0);try{let r=await os(`/restart`,{force:e});if(r.status===`busy`)return t(!1),r;let i=Date.now()+Hs;n.current=new AbortController,await new Promise((e,t)=>{let r=async()=>{if(Date.now()>i){t(Error(`Restart timeout`));return}try{if((await fetch(Ko(`/health`),{signal:n.current.signal})).ok){e();return}setTimeout(r,Vs)}catch{setTimeout(r,Vs)}};setTimeout(r,Vs)}),window.location.reload()}catch(e){throw t(!1),e}},[]),isRestarting:e}}function Ws(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ws(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Gs(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ws(e))&&(r&&(r+=` `),r+=t);return r}var Ks=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,qs=Gs,Js=(e,t)=>n=>{if(t?.variants==null)return qs(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Ks(t)||Ks(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return qs(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Ys=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Xs=(e,t)=>({classGroupId:e,validator:t}),Zs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Qs=`-`,$s=[],ec=`arbitrary..`,tc=e=>{let t=ic(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return rc(e);let n=e.split(Qs);return nc(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ys(i,t):t:i||$s}return n[e]||$s}}},nc=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=nc(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Qs):e.slice(t).join(Qs),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},rc=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ec+r:void 0})(),ic=e=>{let{theme:t,classGroups:n}=e;return ac(n,t)},ac=(e,t)=>{let n=Zs();for(let r in e){let i=e[r];oc(i,n,r,t)}return n},oc=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];sc(i,t,n,r)}},sc=(e,t,n,r)=>{if(typeof e==`string`){cc(e,t,n);return}if(typeof e==`function`){lc(e,t,n,r);return}uc(e,t,n,r)},cc=(e,t,n)=>{let r=e===``?t:dc(t,e);r.classGroupId=n},lc=(e,t,n,r)=>{if(fc(e)){oc(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Xs(n,e))},uc=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];oc(o,dc(t,a),n,r)}},dc=(e,t)=>{let n=e,r=t.split(Qs),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Zs(),n.nextPart.set(t,i)),n=i}return n},fc=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,pc=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},mc=`!`,hc=`:`,gc=[],_c=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),vc=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===hc){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(mc)?(c=s.slice(0,-1),l=!0):s.startsWith(mc)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return _c(t,l,c,u)};if(t){let e=t+hc,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):_c(gc,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},yc=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},bc=e=>({cache:pc(e.cacheSize),parseClassName:vc(e),sortModifiers:yc(e),postfixLookupClassGroupIds:xc(e),...tc(e)}),xc=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Sc=/\s+/,Cc=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Sc),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+mc:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},wc=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Tc(n))&&(i&&(i+=` `),i+=r);return i},Tc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Tc(e[r]))&&(n&&(n+=` `),n+=t);return n},Ec=(e,...t)=>{let n,r,i,a,o=o=>(n=bc(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Cc(e,n);return i(e,a),a};return a=o,(...e)=>a(wc(...e))},Dc=[],Oc=e=>{let t=t=>t[e]||Dc;return t.isThemeGetter=!0,t},kc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ac=/^\((?:(\w[\w-]*):)?(.+)\)$/i,jc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Mc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Nc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Pc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Fc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ic=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Lc=e=>jc.test(e),Rc=e=>!!e&&!Number.isNaN(Number(e)),zc=e=>!!e&&Number.isInteger(Number(e)),Bc=e=>e.endsWith(`%`)&&Rc(e.slice(0,-1)),Vc=e=>Mc.test(e),Hc=()=>!0,Uc=e=>Nc.test(e)&&!Pc.test(e),Wc=()=>!1,Gc=e=>Fc.test(e),Kc=e=>Ic.test(e),qc=e=>!Xc(e)&&!il(e),Jc=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Yc=e=>fl(e,gl,Wc),Xc=e=>kc.test(e),Zc=e=>fl(e,_l,Uc),Qc=e=>fl(e,vl,Rc),$c=e=>fl(e,bl,Hc),el=e=>fl(e,yl,Wc),tl=e=>fl(e,ml,Wc),nl=e=>fl(e,hl,Kc),rl=e=>fl(e,xl,Gc),il=e=>Ac.test(e),al=e=>pl(e,_l),ol=e=>pl(e,yl),sl=e=>pl(e,ml),cl=e=>pl(e,gl),ll=e=>pl(e,hl),ul=e=>pl(e,xl,!0),dl=e=>pl(e,bl,!0),fl=(e,t,n)=>{let r=kc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},pl=(e,t,n=!1)=>{let r=Ac.exec(e);return r?r[1]?t(r[1]):n:!1},ml=e=>e===`position`||e===`percentage`,hl=e=>e===`image`||e===`url`,gl=e=>e===`length`||e===`size`||e===`bg-size`,_l=e=>e===`length`,vl=e=>e===`number`,yl=e=>e===`family-name`,bl=e=>e===`number`||e===`weight`,xl=e=>e===`shadow`,Sl=Ec(()=>{let e=Oc(`color`),t=Oc(`font`),n=Oc(`text`),r=Oc(`font-weight`),i=Oc(`tracking`),a=Oc(`leading`),o=Oc(`breakpoint`),s=Oc(`container`),c=Oc(`spacing`),l=Oc(`radius`),u=Oc(`shadow`),d=Oc(`inset-shadow`),f=Oc(`text-shadow`),p=Oc(`drop-shadow`),m=Oc(`blur`),h=Oc(`perspective`),g=Oc(`aspect`),_=Oc(`ease`),v=Oc(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),il,Xc],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[il,Xc,c],T=()=>[Lc,`full`,`auto`,...w()],E=()=>[zc,`none`,`subgrid`,il,Xc],D=()=>[`auto`,{span:[`full`,zc,il,Xc]},zc,il,Xc],O=()=>[zc,`auto`,il,Xc],k=()=>[`auto`,`min`,`max`,`fr`,il,Xc],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Lc,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Lc,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Lc,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,il,Xc],L=()=>[...b(),sl,tl,{position:[il,Xc]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,cl,Yc,{size:[il,Xc]}],z=()=>[Bc,al,Zc],B=()=>[``,`none`,`full`,l,il,Xc],V=()=>[``,Rc,al,Zc],H=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ne=()=>[Rc,Bc,sl,tl],U=()=>[``,`none`,m,il,Xc],re=()=>[`none`,Rc,il,Xc],ie=()=>[`none`,Rc,il,Xc],ae=()=>[Rc,il,Xc],oe=()=>[Lc,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Vc],breakpoint:[Vc],color:[Hc],container:[Vc],"drop-shadow":[Vc],ease:[`in`,`out`,`in-out`],font:[qc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Vc],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Vc],shadow:[Vc],spacing:[`px`,Rc],text:[Vc],"text-shadow":[Vc],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Lc,Xc,il,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,il,Xc]}],"container-named":[Jc],columns:[{columns:[Rc,Xc,il,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[zc,`auto`,il,Xc]}],basis:[{basis:[Lc,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Rc,Lc,`auto`,`initial`,`none`,Xc]}],grow:[{grow:[``,Rc,il,Xc]}],shrink:[{shrink:[``,Rc,il,Xc]}],order:[{order:[zc,`first`,`last`,`none`,il,Xc]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,al,Zc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,dl,$c]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Bc,Xc]}],"font-family":[{font:[ol,el,t]}],"font-features":[{"font-features":[Xc]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,il,Xc]}],"line-clamp":[{"line-clamp":[Rc,`none`,il,Qc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,il,Xc]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,il,Xc]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...H(),`wavy`]}],"text-decoration-thickness":[{decoration:[Rc,`from-font`,`auto`,il,Zc]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Rc,`auto`,il,Xc]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[zc,il,Xc]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,il,Xc]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,il,Xc]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},zc,il,Xc],radial:[``,il,Xc],conic:[zc,il,Xc]},ll,nl]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-bs":[{"border-bs":V()}],"border-w-be":[{"border-be":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":V()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...H(),`hidden`,`none`]}],"divide-style":[{divide:[...H(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...H(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Rc,il,Xc]}],"outline-w":[{outline:[``,Rc,al,Zc]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,ul,rl]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,ul,rl]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Rc,Zc]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,ul,rl]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Rc,il,Xc]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Rc]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[il,Xc]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Rc]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,il,Xc]}],filter:[{filter:[``,`none`,il,Xc]}],blur:[{blur:U()}],brightness:[{brightness:[Rc,il,Xc]}],contrast:[{contrast:[Rc,il,Xc]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,ul,rl]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Rc,il,Xc]}],"hue-rotate":[{"hue-rotate":[Rc,il,Xc]}],invert:[{invert:[``,Rc,il,Xc]}],saturate:[{saturate:[Rc,il,Xc]}],sepia:[{sepia:[``,Rc,il,Xc]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,il,Xc]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[Rc,il,Xc]}],"backdrop-contrast":[{"backdrop-contrast":[Rc,il,Xc]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Rc,il,Xc]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Rc,il,Xc]}],"backdrop-invert":[{"backdrop-invert":[``,Rc,il,Xc]}],"backdrop-opacity":[{"backdrop-opacity":[Rc,il,Xc]}],"backdrop-saturate":[{"backdrop-saturate":[Rc,il,Xc]}],"backdrop-sepia":[{"backdrop-sepia":[``,Rc,il,Xc]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,il,Xc]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Rc,`initial`,il,Xc]}],ease:[{ease:[`linear`,`initial`,_,il,Xc]}],delay:[{delay:[Rc,il,Xc]}],animate:[{animate:[`none`,v,il,Xc]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,il,Xc]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[il,Xc,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":[`translate-none`],zoom:[{zoom:[zc,il,Xc]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,il,Xc]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,il,Xc]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Rc,al,Zc,Qc]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function J(...e){return Sl(Gs(e))}var Cl=Js(`inline-flex items-center justify-center whitespace-nowrap rounded-md font-sans text-sm font-medium transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-surface disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-gradient-to-br from-primary to-primary-container text-on-primary shadow-xs hover:shadow-[0_0_0_1px_rgba(171,207,184,0.4)]`,destructive:`bg-gradient-to-br from-tertiary to-tertiary-container text-on-surface shadow-xs hover:shadow-[0_0_0_1px_rgba(255,180,161,0.4)]`,outline:`border border-[var(--ghost-border)] bg-transparent shadow-xs hover:bg-surface-container-high hover:text-on-surface`,secondary:`border border-outline-variant/20 bg-transparent hover:bg-surface-container-high text-on-surface`,ghost:`hover:bg-surface-container-high text-on-surface-variant hover:text-on-surface`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),Y=(0,W.forwardRef)(({className:e,variant:t,size:n,...r},i)=>(0,G.jsx)(`button`,{className:J(Cl({variant:t,size:n,className:e})),ref:i,...r}));Y.displayName=`Button`,typeof window<`u`&&window.document&&window.document.createElement;function wl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Tl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function El(...e){return t=>{let n=!1,r=e.map(e=>{let r=Tl(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Tl(e[t],null)}}}}function Dl(...e){return W.useCallback(El(...e),e)}function Ol(e,t){let n=W.createContext(t);n.displayName=e+`Context`;let r=e=>{let{children:t,...r}=e,i=W.useMemo(()=>r,Object.values(r));return(0,G.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=W.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function kl(e,t=[]){let n=[];function r(t,r){let i=W.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=W.useMemo(()=>o,Object.values(o));return(0,G.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=W.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>W.createContext(e));return function(n){let r=n?.[e]||t;return W.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Al(i,...t)]}function Al(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return W.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var jl=globalThis?.document?W.useLayoutEffect:()=>{},Ml=W.useId||(()=>void 0),Nl=0;function Pl(e){let[t,n]=W.useState(Ml());return jl(()=>{e||n(e=>e??String(Nl++))},[e]),e||(t?`radix-${t}`:``)}var Fl=W.useInsertionEffect||jl;function Il({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Ll({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=W.useRef(e!==void 0);W.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,W.useCallback(t=>{if(s){let n=Rl(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Ll({defaultProp:e,onChange:t}){let[n,r]=W.useState(e),i=W.useRef(n),a=W.useRef(t);return Fl(()=>{a.current=t},[t]),W.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Rl(e){return typeof e==`function`}var zl=l(h(),1);function Bl(e){let t=W.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];ql(r)&&typeof Zl==`function`&&(r=Zl(r._payload)),W.Children.forEach(r,e=>{if(Gl(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;ql(n)&&typeof Zl==`function`&&(n=Zl(n._payload)),a=Hl(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=W.cloneElement(a,void 0,s):!o&&W.Children.count(r)===1&&W.isValidElement(r)&&(a=r);let c=a?Wl(a):void 0,l=Dl(n,c);if(!a){if(r||r===0)throw Error(o?Xl(e):Yl(e));return r}let u=Ul(i,a.props??{});return a.type!==W.Fragment&&(u.ref=n?l:c),W.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var Vl=Symbol.for(`radix.slottable`),Hl=(e,t)=>{if(`child`in e.props){let t=e.props.child;return W.isValidElement(t)?W.cloneElement(t,void 0,e.props.children(t.props.children)):null}return W.isValidElement(t)?t:null};function Ul(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Wl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Gl(e){return W.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Vl}var Kl=Symbol.for(`react.lazy`);function ql(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Kl&&`_payload`in e&&Jl(e._payload)}function Jl(e){return typeof e==`object`&&!!e&&`then`in e}var Yl=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Xl=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Zl=W.use,Ql=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Bl(`Primitive.${t}`),r=W.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,G.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function $l(e,t){e&&zl.flushSync(()=>e.dispatchEvent(t))}function eu(e){let t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>((...e)=>t.current?.(...e)),[])}function tu(e,t=globalThis?.document){let n=eu(e);W.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var nu=`DismissableLayer`,ru=`dismissableLayer.update`,iu=`dismissableLayer.pointerDownOutside`,au=`dismissableLayer.focusOutside`,ou,su=W.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),cu=W.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=W.useContext(su),[u,d]=W.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=W.useState({}),m=Dl(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=du(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=fu(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return tu(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),W.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(ou=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),pu(),()=>{n&&(l.layersWithOutsidePointerEventsDisabled.delete(u),l.layersWithOutsidePointerEventsDisabled.size===0&&(f.body.style.pointerEvents=ou))}},[u,f,n,l]),W.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),pu())},[u,l]),W.useEffect(()=>{let e=()=>p({});return document.addEventListener(ru,e),()=>document.removeEventListener(ru,e)},[]),(0,G.jsx)(Ql.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:wl(e.onFocusCapture,S.onFocusCapture),onBlurCapture:wl(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:wl(e.onPointerDownCapture,x.onPointerDownCapture)})});cu.displayName=nu;var lu=`DismissableLayerBranch`,uu=W.forwardRef((e,t)=>{let n=W.useContext(su),r=W.useRef(null),i=Dl(t,r);return W.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,G.jsx)(Ql.div,{...e,ref:i})});uu.displayName=lu;function du(e,t=globalThis?.document){let n=eu(e),r=W.useRef(!1),i=W.useRef(()=>{});return W.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){mu(iu,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function fu(e,t=globalThis?.document){let n=eu(e),r=W.useRef(!1);return W.useEffect(()=>{let e=e=>{e.target&&!r.current&&mu(au,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function pu(){let e=new CustomEvent(ru);document.dispatchEvent(e)}function mu(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?$l(i,a):i.dispatchEvent(a)}var hu=`focusScope.autoFocusOnMount`,gu=`focusScope.autoFocusOnUnmount`,_u={bubbles:!1,cancelable:!0},vu=`FocusScope`,yu=W.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=W.useState(null),l=eu(i),u=eu(a),d=W.useRef(null),f=Dl(t,e=>c(e)),p=W.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;W.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Eu(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Eu(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Eu(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),W.useEffect(()=>{if(s){Du.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(hu,_u);s.addEventListener(hu,l),s.dispatchEvent(t),t.defaultPrevented||(bu(Au(Su(s)),{select:!0}),document.activeElement===e&&Eu(s))}return()=>{s.removeEventListener(hu,l),setTimeout(()=>{let t=new CustomEvent(gu,_u);s.addEventListener(gu,u),s.dispatchEvent(t),t.defaultPrevented||Eu(e??document.body,{select:!0}),s.removeEventListener(gu,u),Du.remove(p)},0)}}},[s,l,u,p]);let m=W.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=xu(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Eu(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Eu(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,G.jsx)(Ql.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});yu.displayName=vu;function bu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Eu(r,{select:t}),document.activeElement!==n)return}function xu(e){let t=Su(e);return[Cu(t,e),Cu(t.reverse(),e)]}function Su(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Cu(e,t){for(let n of e)if(!wu(n,{upTo:t}))return n}function wu(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Tu(e){return e instanceof HTMLInputElement&&`select`in e}function Eu(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Tu(e)&&t&&e.select()}}var Du=Ou();function Ou(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ku(e,t),e.unshift(t)},remove(t){e=ku(e,t),e[0]?.resume()}}}function ku(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Au(e){return e.filter(e=>e.tagName!==`A`)}var ju=`Portal`,Mu=W.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=W.useState(!1);jl(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?zl.createPortal((0,G.jsx)(Ql.div,{...r,ref:t}),o):null});Mu.displayName=ju;function Nu(e,t){return W.useReducer((e,n)=>t[e][n]??e,e)}var Pu=e=>{let{present:t,children:n}=e,r=Fu(t),i=typeof n==`function`?n({present:r.isPresent}):W.Children.only(n),a=Lu(r.ref,zu(i));return typeof n==`function`||r.isPresent?W.cloneElement(i,{ref:a}):null};Pu.displayName=`Presence`;function Fu(e){let[t,n]=W.useState(),r=W.useRef(null),i=W.useRef(e),a=W.useRef(`none`),[o,s]=Nu(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return W.useEffect(()=>{let e=Ru(r.current);a.current=o===`mounted`?e:`none`},[o]),jl(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Ru(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),jl(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Ru(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Ru(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:W.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Iu(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Lu(...e){let t=W.useRef(e);return t.current=e,W.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Iu(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Iu(n[e],null)}}},[])}function Ru(e){return e?.animationName||`none`}function zu(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Bu=0,Vu=null;function Hu(){W.useEffect(()=>{Vu||={start:Uu(),end:Uu()};let{start:e,end:t}=Vu;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Bu++,()=>{Bu===1&&(Vu?.start.remove(),Vu?.end.remove(),Vu=null),Bu=Math.max(0,Bu-1)}},[])}function Uu(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Wu=function(){return Wu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Wu.apply(this,arguments)};function Gu(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ku(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var qu=`right-scroll-bar-position`,Ju=`width-before-scroll-bar`,Yu=`with-scroll-bars-hidden`,Xu=`--removed-body-scroll-bar-size`;function Zu(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Qu(e,t){var n=(0,W.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var $u=typeof window<`u`?W.useLayoutEffect:W.useEffect,ed=new WeakMap;function td(e,t){var n=Qu(t||null,function(t){return e.forEach(function(e){return Zu(e,t)})});return $u(function(){var t=ed.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Zu(e,null)}),i.forEach(function(e){r.has(e)||Zu(e,a)})}ed.set(n,e)},[e]),n}function nd(e){return e}function rd(e,t){t===void 0&&(t=nd);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function id(e){e===void 0&&(e={});var t=rd(null);return t.options=Wu({async:!0,ssr:!1},e),t}var ad=function(e){var t=e.sideCar,n=Gu(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return W.createElement(r,Wu({},n))};ad.isSideCarExport=!0;function od(e,t){return e.useMedium(t),ad}var sd=id(),cd=function(){},ld=W.forwardRef(function(e,t){var n=W.useRef(null),r=W.useState({onScrollCapture:cd,onWheelCapture:cd,onTouchMoveCapture:cd}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Gu(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=td([n,t]),C=Wu(Wu({},b),i);return W.createElement(W.Fragment,null,u&&W.createElement(x,{sideCar:sd,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?W.cloneElement(W.Children.only(s),Wu(Wu({},C),{ref:S})):W.createElement(v,Wu({},C,{className:c,ref:S}),s))});ld.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},ld.classNames={fullWidth:Ju,zeroRight:qu};var ud,dd=function(){if(ud)return ud;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function fd(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=dd();return t&&e.setAttribute(`nonce`,t),e}function pd(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function md(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var hd=function(){var e=0,t=null;return{add:function(n){e==0&&(t=fd())&&(pd(t,n),md(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},gd=function(){var e=hd();return function(t,n){W.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},_d=function(){var e=gd();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},vd={left:0,top:0,right:0,gap:0},yd=function(e){return parseInt(e||``,10)||0},bd=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[yd(n),yd(r),yd(i)]},xd=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return vd;var t=bd(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Sd=_d(),Cd=`data-scroll-locked`,wd=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
11
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=An(),d;if(t){let e=typeof t==`string`?xt(t):t;ht(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):wt(e,{pathname:p});gt(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),gt(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=qn(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:$t([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:$t([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?W.createElement(bn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Vn(){let e=nr(),t=on(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=W.createElement(W.Fragment,null,W.createElement(`p`,null,`💿 Hey developer 👋`),W.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,W.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,W.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),W.createElement(W.Fragment,null,W.createElement(`h2`,null,`Unexpected Application Error!`),W.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?W.createElement(`pre`,{style:i},n):null,o)}var Hn=W.createElement(Vn,null),Un=class extends W.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Dn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:W.createElement(xn.Provider,{value:this.props.routeContext},W.createElement(Sn.Provider,{value:e,children:this.props.component}));return this.context?W.createElement(Gn,{error:e},t):t}};Un.contextType=mn;var Wn=new WeakMap;function Gn({children:e,error:t}){let{basename:n}=W.useContext(yn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=En(t.digest);if(e){let r=Wn.get(t);if(r)throw r;let i=ln(e.location,n);if(cn&&!Wn.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Wn.set(t,n),n}return W.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function Kn({routeContext:e,match:t,children:n}){let r=W.useContext(fn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),W.createElement(xn.Provider,{value:e},n)}function qn(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);ht(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:sn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Hn,o&&(s<0&&c===0?(ar(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?W.createElement(n.route.Component,null):n.route.element?n.route.element:e,W.createElement(Kn,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?W.createElement(Un,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Jn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Yn(e){let t=W.useContext(fn);return ht(t,Jn(e)),t}function Xn(e){let t=W.useContext(pn);return ht(t,Jn(e)),t}function Zn(e){let t=W.useContext(xn);return ht(t,Jn(e)),t}function Qn(e){let t=Zn(e),n=t.matches[t.matches.length-1];return ht(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function $n(){return Qn(`useRouteId`)}function er(){let e=Xn(`useNavigation`);return W.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function tr(){let{matches:e,loaderData:t}=Xn(`useMatches`);return W.useMemo(()=>e.map(e=>Et(e,t)),[e,t])}function nr(){let e=W.useContext(Sn),t=Xn(`useRouteError`),n=Qn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function rr(){let{router:e}=Yn(`useNavigate`),t=Qn(`useNavigate`),n=W.useRef(!1);return Mn(()=>{n.current=!0}),W.useCallback(async(r,i={})=>{gt(n.current,jn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var ir={};function ar(e,t,n){!t&&!ir[e]&&(ir[e]=!0,gt(!1,n))}W.memo(or);function or({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Bn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function sr({to:e,replace:t,state:n,relative:r}){ht(kn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=W.useContext(yn);gt(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=W.useContext(xn),{pathname:o}=An(),s=Nn(),c=Zt(e,Xt(a),o,r===`path`),l=JSON.stringify(c);return W.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function cr(e){return In(e.context)}function lr(e){ht(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function ur({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){ht(!kn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=W.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=xt(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=W.useMemo(()=>{let e=Wt(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return gt(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:W.createElement(yn.Provider,{value:c},W.createElement(bn.Provider,{children:t,value:h}))}function dr({children:e,location:t}){return zn(fr(e),t)}W.Component;function fr(e,t=[]){let n=[];return W.Children.forEach(e,(e,r)=>{if(!W.isValidElement(e))return;let i=[...t,r];if(e.type===W.Fragment){n.push.apply(n,fr(e.props.children,i));return}ht(e.type===lr,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ht(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=fr(e.props.children,i)),n.push(a)}),n}var pr=`get`,mr=`application/x-www-form-urlencoded`;function hr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function gr(e){return hr(e)&&e.tagName.toLowerCase()===`button`}function _r(e){return hr(e)&&e.tagName.toLowerCase()===`form`}function vr(e){return hr(e)&&e.tagName.toLowerCase()===`input`}function yr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function br(e,t){return e.button===0&&(!t||t===`_self`)&&!yr(e)}function xr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Sr(e,t){let n=xr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Cr=null;function wr(){if(Cr===null)try{new FormData(document.createElement(`form`),0),Cr=!1}catch{Cr=!0}return Cr}var Tr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Er(e){return e!=null&&!Tr.has(e)?(gt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${mr}"`),null):e}function Dr(e,t){let n,r,i,a,o;if(_r(e)){let o=e.getAttribute(`action`);r=o?Wt(o,t):null,n=e.getAttribute(`method`)||pr,i=Er(e.getAttribute(`enctype`))||mr,a=new FormData(e)}else if(gr(e)||vr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Wt(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||pr,i=Er(e.getAttribute(`formenctype`))||Er(o.getAttribute(`enctype`))||mr,a=new FormData(o,e),!wr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(hr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=pr,r=null,i=mr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Or={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},kr=/[&><\u2028\u2029]/g;function Ar(e){return e.replace(kr,e=>Or[e])}function jr(e,t){if(e===!1||e==null)throw Error(t)}function Mr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&Wt(i.pathname,t)===`/`?i.pathname=`${en(t)}/_root.${r}`:i.pathname=`${en(i.pathname)}.${r}`,i}async function Nr(e,t){if(e.id in t)return t[e.id];try{let n=await dt(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Pr(e){return e!=null&&typeof e.page==`string`}function Fr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Ir(e,t,n){return Vr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Nr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Fr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Lr(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Rr(e,t,{includeHydrateFallback:n}={}){return zr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function zr(e){return[...new Set(e)]}function Br(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Vr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Pr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Br(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Hr(){let e=W.useContext(fn);return jr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Ur(){let e=W.useContext(pn);return jr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Wr=W.createContext(void 0);Wr.displayName=`FrameworkContext`;function Gr(){let e=W.useContext(Wr);return jr(e,`You must render this element inside a <HydratedRouter> element`),e}function Kr(e,t){let n=W.useContext(Wr),[r,i]=W.useState(!1),[a,o]=W.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=W.useRef(null);W.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),W.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:qr(s,p),onBlur:qr(c,m),onMouseEnter:qr(l,p),onMouseLeave:qr(u,m),onTouchStart:qr(d,p)}]:[a,f,{}]:[!1,f,{}]}function qr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Jr({page:e,...t}){let n=hn(),{router:r}=Hr(),i=W.useMemo(()=>wt(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?W.createElement(Xr,{page:e,matches:i,...t}):W.createElement(Zr,{page:e,matches:i,...t}):null}function Yr(e){let{manifest:t,routeModules:n}=Gr(),[r,i]=W.useState([]);return W.useEffect(()=>{let r=!1;return Ir(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Xr({page:e,matches:t,...n}){let r=An(),{future:i}=Gr(),{basename:a}=Hr(),o=W.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Mr(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return W.createElement(W.Fragment,null,o.map(e=>W.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Zr({page:e,matches:t,...n}){let r=An(),{future:i,manifest:a,routeModules:o}=Gr(),{basename:s}=Hr(),{loaderData:c,matches:l}=Ur(),u=W.useMemo(()=>Lr(e,t,l,a,r,`data`),[e,t,l,a,r]),d=W.useMemo(()=>Lr(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=W.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Mr(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=W.useMemo(()=>Rr(d,a),[d,a]),m=Yr(d);return W.createElement(W.Fragment,null,f.map(e=>W.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>W.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>W.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Qr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}W.Component;var $r=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{$r&&(window.__reactRouterVersion=`7.17.0`)}catch{}function ei({basename:e,children:t,useTransitions:n,window:r}){let i=W.useRef();i.current??=mt({window:r,v5Compat:!0});let a=i.current,[o,s]=W.useState({action:a.action,location:a.location}),c=W.useCallback(e=>{n===!1?s(e):W.startTransition(()=>s(e))},[n]);return W.useLayoutEffect(()=>a.listen(c),[a,c]),W.createElement(ur,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function ti({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=W.useState({action:n.action,location:n.location}),o=W.useCallback(e=>{r===!1?a(e):W.startTransition(()=>a(e))},[r]);return W.useLayoutEffect(()=>n.listen(o),[n,o]),W.createElement(ur,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}ti.displayName=`unstable_HistoryRouter`;var ni=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ri=W.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=W.useContext(yn),v=typeof l==`string`&&ni.test(l),y=ln(l,h);l=y.to;let b=On(l,{relative:r}),x=An(),S=null;if(o){let e=Zt(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:$t([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Kr(n,p),E=ui(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=W.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:Qr(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?W.createElement(W.Fragment,null,k,W.createElement(Jr,{page:b})):k});ri.displayName=`Link`;var ii=W.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Rn(a,{relative:c.relative}),d=An(),f=W.useContext(pn),{navigator:p,basename:m}=W.useContext(yn),h=f!=null&&xi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=Wt(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return W.createElement(ri,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});ii.displayName=`NavLink`;var ai=W.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=pr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=W.useContext(yn),g=mi(),_=hi(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&ni.test(s);return W.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?W.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});ai.displayName=`Form`;function oi({getKey:e,storageKey:t,...n}){let r=W.useContext(Wr),{basename:i}=W.useContext(yn),a=An(),o=tr();yi({getKey:e,storageKey:t});let s=W.useMemo(()=>{if(!r||!e)return null;let t=vi(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return W.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Ar(JSON.stringify(t||gi))}, ${Ar(JSON.stringify(s))})`}})}oi.displayName=`ScrollRestoration`;function si(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ci(e){let t=W.useContext(fn);return ht(t,si(e)),t}function li(e){let t=W.useContext(pn);return ht(t,si(e)),t}function ui(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Nn(),d=An(),f=Rn(e,{relative:o});return W.useCallback(p=>{if(br(p,t)){p.preventDefault();let t=n===void 0?bt(d)===bt(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?W.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function di(e){gt(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=W.useRef(xr(e)),n=W.useRef(!1),r=An(),i=W.useMemo(()=>Sr(r.search,n.current?null:t.current),[r.search]),a=Nn();return[i,W.useCallback((e,t)=>{let r=xr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var fi=0,pi=()=>`__${String(++fi)}__`;function mi(){let{router:e}=ci(`useSubmit`),{basename:t}=W.useContext(yn),n=$n(),r=e.fetch,i=e.navigate;return W.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Dr(e,t);a.navigate===!1?await r(a.fetcherKey||pi(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function hi(e,{relative:t}={}){let{basename:n}=W.useContext(yn),r=W.useContext(xn);ht(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Rn(e||`.`,{relative:t})},o=An();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:$t([n,a.pathname])),bt(a)}var gi=`react-router-scroll-positions`,_i={};function vi(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:Wt(e.pathname,n)||e.pathname},t)),i??=e.key,i}function yi({getKey:e,storageKey:t}={}){let{router:n}=ci(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=li(`useScrollRestoration`),{basename:a}=W.useContext(yn),o=An(),s=tr(),c=er();W.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),bi(W.useCallback(()=>{if(c.state===`idle`){let t=vi(o,s,a,e);_i[t]=window.scrollY}try{sessionStorage.setItem(t||gi,JSON.stringify(_i))}catch(e){gt(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(W.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||gi);e&&(_i=JSON.parse(e))}catch{}},[t]),W.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(_i,()=>window.scrollY,e?(t,n)=>vi(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),W.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{gt(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function bi(e,t){let{capture:n}=t||{};W.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function xi(e,{relative:t}={}){let n=W.useContext(gn);ht(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ci(`useViewTransitionState`),i=Rn(e,{relative:t});if(!n.isTransitioning)return!1;let a=Wt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Wt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Vt(i.pathname,o)!=null||Vt(i.pathname,a)!=null}var Si=l(_(),1),Ci=6e4,wi=3e5,Ti=200,Ei={active:1,idle:2,deep_sleep:5,hidden:10},Di=[`mousemove`,`mousedown`,`keydown`,`scroll`,`touchstart`],Oi=(0,W.createContext)(void 0);function ki({children:e}){let[t,n]=(0,W.useState)(`active`),r=(0,W.useRef)(null),i=(0,W.useRef)(null),a=(0,W.useRef)(Date.now()),o=(0,W.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null),i.current&&=(clearTimeout(i.current),null)},[]),s=(0,W.useCallback)(()=>{o(),r.current=setTimeout(()=>{n(`idle`),i.current=setTimeout(()=>{n(`deep_sleep`)},wi-Ci)},Ci)},[o]),c=(0,W.useCallback)(()=>{let e=Date.now();e-a.current<Ti||(a.current=e,n(`active`),s())},[s]),l=(0,W.useCallback)(()=>{document.hidden?(o(),n(`hidden`)):(n(`active`),a.current=Date.now(),s())},[o,s]);return(0,W.useEffect)(()=>{s();for(let e of Di)document.addEventListener(e,c,{passive:!0});return document.addEventListener(`visibilitychange`,l),()=>{o();for(let e of Di)document.removeEventListener(e,c);document.removeEventListener(`visibilitychange`,l)}},[c,l,s,o]),(0,G.jsx)(Oi.Provider,{value:{powerState:t},children:e})}function Ai(){let e=(0,W.useContext)(Oi);if(!e)throw Error(`usePowerState must be used within a PowerProvider`);return e.powerState}var ji={enabled:`cortex.enabled`,instructions:{injectOnSessionStart:`cortex.instructions.inject_on_session_start`,injectOnSubagentStart:`cortex.instructions.inject_on_subagent_start`},digest:{tier:`cortex.digest.tier`,injectOnSessionStart:`cortex.digest.inject_on_session_start`},spores:{injectOnPromptSubmit:`cortex.spores.inject_on_prompt_submit`,maxPerPrompt:`cortex.spores.max_per_prompt`},canopy:{injectOnPreToolUse:`cortex.canopy.inject_on_pre_tool_use`,minFileBytes:`cortex.canopy.min_file_bytes`,refresh:{backgroundEnabled:`cortex.canopy.refresh.background_enabled`,backgroundPeriodMinutes:`cortex.canopy.refresh.background_period_minutes`},exclude:{defaultPatterns:`cortex.canopy.exclude.default_patterns`,patterns:`cortex.canopy.exclude.patterns`}}},Mi={scheduledTasksEnabled:`agent.scheduled_tasks_enabled`,eventTasksEnabled:`agent.event_tasks_enabled`,summaryBatchInterval:`agent.summary_batch_interval`,runRetentionDays:`agent.run_retention_days`},Ni=`config-field-`,Pi={appearance:`config-section-appearance`,cortexInstructions:`config-section-cortex-instructions`,cortexBuilder:`config-section-cortex-builder`,cortexDigest:`config-section-cortex-digest`,settingsAgent:`config-section-settings-agent`,settingsEmbedding:`config-section-settings-embedding`,settingsNotifications:`config-section-settings-notifications`,settingsPlanCapture:`config-section-settings-plan-capture`,settingsProject:`config-section-settings-project`,agentOperations:`config-section-agent-operations`,operationsMaintenance:`config-section-operations-maintenance`,operationsBackup:`config-section-operations-backup`};Pi.appearance,Pi.settingsAgent,Pi.settingsEmbedding,Pi.cortexDigest,Pi.cortexInstructions,Pi.cortexInstructions,Pi.cortexInstructions,Pi.cortexInstructions,Pi.settingsNotifications,Pi.settingsPlanCapture,Pi.agentOperations,ji.digest.tier,ji.digest.injectOnSessionStart,ji.instructions.injectOnSessionStart,ji.instructions.injectOnSubagentStart,ji.spores.injectOnPromptSubmit,ji.spores.maxPerPrompt,ji.canopy.injectOnPreToolUse,ji.canopy.minFileBytes,Mi.scheduledTasksEnabled,Mi.eventTasksEnabled,Mi.summaryBatchInterval,Mi.runRetentionDays;function Fi(e){return`${Ni}${e.replace(/[^a-zA-Z0-9]+/g,`-`)}`}var Ii=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Li=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Ri=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),zi=e=>{let t=Ri(e);return t.charAt(0).toUpperCase()+t.slice(1)},Bi={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Vi=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Hi=(0,W.createContext)({}),Ui=()=>(0,W.useContext)(Hi),Wi=(0,W.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Ui()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,W.createElement)(`svg`,{ref:c,...Bi,width:t??l??Bi.width,height:t??l??Bi.height,stroke:e??f,strokeWidth:m,className:Ii(`lucide`,p,i),...!a&&!Vi(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,W.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),K=(e,t)=>{let n=(0,W.forwardRef)(({className:n,...r},i)=>(0,W.createElement)(Wi,{ref:i,iconNode:t,className:Ii(`lucide-${Li(zi(e))}`,`lucide-${e}`,n),...r}));return n.displayName=zi(e),n},Gi=K(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ki=K(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),qi=K(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ji=K(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Yi=K(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Xi=K(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Zi=K(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Qi=K(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),$i=K(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ea=K(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ta=K(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),na=K(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ra=K(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),ia=K(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),aa=K(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),oa=K(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),sa=K(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ca=K(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),la=K(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),ua=K(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),da=K(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),fa=K(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),pa=K(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ma=K(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ha=K(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),ga=K(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),_a=K(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),va=K(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ya=K(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),ba=K(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),xa=K(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Sa=K(`file-search`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]),Ca=K(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),wa=K(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),Ta=K(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Ea=K(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Da=K(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Oa=K(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ka=K(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Aa=K(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),ja=K(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Ma=K(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Na=K(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Pa=K(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Fa=K(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Ia=K(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),La=K(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Ra=K(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),za=K(`mail-check`,[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]]),Ba=K(`map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),Va=K(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Ha=K(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ua=K(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Wa=K(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Ga=K(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Ka=K(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),qa=K(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Ja=K(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Ya=K(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Xa=K(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Za=K(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),Qa=K(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),$a=K(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),eo=K(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),to=K(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),no=K(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ro=K(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),io=K(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),ao=K(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),oo=K(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),so=K(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),co=K(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),lo=K(`sprout`,[[`path`,{d:`M14 9.536V7a4 4 0 0 1 4-4h1.5a.5.5 0 0 1 .5.5V5a4 4 0 0 1-4 4 4 4 0 0 0-4 4c0 2 1 3 1 5a5 5 0 0 1-1 3`,key:`139s4v`}],[`path`,{d:`M4 9a5 5 0 0 1 8 4 5 5 0 0 1-8-4`,key:`1dlkgp`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),uo=K(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),fo=K(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),po=K(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),mo=K(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ho=K(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),go=K(`trees`,[[`path`,{d:`M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z`,key:`1l6gj6`}],[`path`,{d:`M7 16v6`,key:`1a82de`}],[`path`,{d:`M13 19v3`,key:`13sx9i`}],[`path`,{d:`M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5`,key:`1sj9kv`}]]),_o=K(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),vo=K(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),yo=K(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),bo=K(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),xo=K(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),So=K(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Co=K(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),wo=`myco.lastSelectedProject`,To=null;function Eo(e){To=e}function Do(){return To}function Oo(){return ko(Do())}function ko(e){return e?{"x-myco-grove-id":e.grove.id,"x-myco-project-id":e.project.project_id}:{}}function Ao(e,t,n){if(!t||!n)return null;let r=e.find(e=>e.slug===t||e.id===t);if(!r)return null;let i=r.projects.find(e=>e.slug===n||e.project_id===n);return i?{grove:r,project:i}:null}function jo(e){let t=e.find(e=>e.is_default&&e.projects.length>0)??e.find(e=>e.projects.length>0);return t?{grove:t,project:t.projects[0]}:null}function Mo(e){let t=new Map;for(let n of e??[]){let e=n.last_activity_at?Date.parse(n.last_activity_at):0;t.set(n.project_id,Number.isNaN(e)?0:e)}return t}function No(e,t){let n=jo(e);if(!t||t.length===0)return n;let r=Mo(t),i=n,a=n?r.get(n.project.project_id)??0:-1;for(let t of e)for(let e of t.projects){let n=r.get(e.project_id)??0;n>a&&(a=n,i={grove:t,project:e})}return i}function Po(e,t){if(e.projects.length===0)return null;if(!t||t.length===0)return e.projects[0];let n=Mo(t);return[...e.projects].sort((e,t)=>(n.get(t.project_id)??0)-(n.get(e.project_id)??0))[0]??null}function Fo(e,t=``){let n=t&&t!==`/`?`/${t.replace(/^\/+/,``)}`:``;return`/g/${e.grove.slug}/p/${e.project.slug}${n}`}function Io(e){let t=e.match(/^\/g\/[^/]+\/p\/[^/]+(?<suffix>\/.*)?$/)?.groups?.suffix??`/`;return/^\/sessions\/[^/]+/.test(t)?`/sessions`:t}var Lo=[{test:/^\/g\/[^/]+\/team(\/|$|\?)/,scope:`machine`}];function Ro(e){for(let t of Lo)if(t.test.test(e))return t.scope;return/^\/g\/[^/]+\/p\/[^/]+/.test(e)?`project`:/^\/g\/[^/]+/.test(e)?`grove`:`machine`}function zo(e){return e?`${e.grove.id}:${e.project.project_id}`:`none`}function Bo(){try{let e=window.localStorage.getItem(wo);if(!e)return null;let t=JSON.parse(e);return typeof t.groveId!=`string`||typeof t.projectId!=`string`?null:{groveId:t.groveId,projectId:t.projectId}}catch{return null}}function Vo(e){try{window.localStorage.setItem(wo,JSON.stringify({groveId:e.grove.id,projectId:e.project.project_id}))}catch{}}function Ho(e){let t=Bo();if(!t)return null;let n=e.find(e=>e.id===t.groveId),r=n?.projects.find(e=>e.project_id===t.projectId);return n&&r?{grove:n,project:r}:null}function Uo(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?`M`:(t.length===1?t[0].slice(0,2):`${t[0][0]}${t[1][0]}`).toUpperCase()}function Wo(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return`hsl(${t%360} 58% 48%)`}function Go(){return``}function Ko(e){return e.startsWith(`/`)?e:`/${e}`}var qo=`/api`,Jo=[`/groves`,`/version`,`/logs`,`/logs/search`,`/logs/stream`],Yo=`1.2.0-beta.1`,Xo=!1;function Zo(e){if(Xo)return;let t=e.headers.get(`X-Myco-Api-Version`);t&&t!==Yo&&(Xo=!0,console.warn(`[myco] UI version ${Yo} is talking to daemon ${t} — reload to pick up the new UI build.`))}async function q(e,t){let n=t?.method?.toUpperCase(),r=t?.body!==void 0&&t.body!==null||n===`POST`||n===`PUT`,i=is(e,t?.headers,r),a=await fetch(Ko(`${qo}${e}`),{...t,headers:i});if(Zo(a),!a.ok){let e=await Qo(a).catch(()=>({}));throw ns(a.status,e),new ms(a.status,e)}return Qo(a)}async function Qo(e){if(!(e.status===204||e.status===205||e.headers.get(`Content-Length`)===`0`)){if(typeof e.text==`function`){let t=await e.text();return t.length===0?void 0:JSON.parse(t)}return e.json()}}var $o=`myco:auth-reload-ts`,es=1e4,ts=()=>{window.location.reload()};function ns(e,t){if(e===401&&hs(t)===`unauthorized_context_switch`&&!(typeof window>`u`||window.sessionStorage===void 0)){try{let e=Number(window.sessionStorage.getItem($o)??`0`);if(Number.isFinite(e)&&Date.now()-e<es)return;window.sessionStorage.setItem($o,String(Date.now()))}catch{return}ts()}}function rs(){if(typeof window>`u`)return;let e=window.__MYCO_AUTH__;return typeof e==`string`&&e.length>0?e:void 0}function is(e,t,n){let r=new Headers;if(!as(e)){for(let[e,t]of Object.entries(Oo()))r.set(e,t);let e=rs();e&&r.set(`x-myco-auth`,e)}return n&&r.set(`Content-Type`,`application/json`),t&&new Headers(t).forEach((e,t)=>r.set(t,e)),Array.from(r.keys()).length>0?r:void 0}function as(e){return Jo.some(t=>e===t||e.startsWith(`${t}/`))}async function os(e,t){return q(e,{method:`POST`,body:t?JSON.stringify(t):void 0})}async function ss(e,t,n){return q(e,{...n,method:`PUT`,body:JSON.stringify(t)})}async function cs(e,t){return q(e,{method:`PATCH`,body:JSON.stringify(t)})}async function ls(e,t){return q(e,{method:`DELETE`,body:t?JSON.stringify(t):void 0})}function us(e,t){return q(`/config/merged`,{signal:e,headers:t})}function ds(e,t){return q(`/config/local`,{signal:e,headers:t})}function fs(e,t,n,r){let i={scope:e,patch:t};return n&&n.length>0&&(i.clear=n),ss(`/config/scoped`,i,{headers:r})}function ps(e,t){return ss(`/config/scoped`,{scope:`local`,patch:{},clear:e},{headers:t})}var ms=class extends Error{status;body;constructor(e,t){let n=gs(t);super(n?`${n} (API ${e})`:`API error ${e}`),this.status=e,this.body=t}};function hs(e){if(typeof e!=`object`||!e||!(`error`in e))return null;let t=e.error;if(typeof t==`string`)return t;if(typeof t==`object`&&t&&`code`in t){let e=t.code;return typeof e==`string`?e:null}return null}function gs(e){if(typeof e!=`object`||!e)return null;if(`error`in e){let t=e.error;if(typeof t==`string`)return t;if(typeof t==`object`&&t){let e=`message`in t?t.message:null;if(typeof e==`string`&&e.length>0)return e;let n=`code`in t?t.code:null;if(typeof n==`string`&&n.length>0)return n}}let t=`message`in e?e.message:null;return typeof t==`string`&&t.length>0?t:null}function _s(e={}){let t=e.includeArchived??!1;return ot({queryKey:[`groves`,{includeArchived:t}],queryFn:({signal:e})=>q(t?`/groves?include_archived=true`:`/groves`,{signal:e}),staleTime:5e3,refetchInterval:e.refetchInterval})}var vs=(0,W.createContext)(null);function ys({selection:e,persist:t=!0,children:n}){let r=We(),i=zo(e),[a,o]=(0,W.useState)(null);return(0,W.useLayoutEffect)(()=>{Eo(e),t&&Vo(e),r.removeQueries({predicate:e=>e.queryKey[0]!==`groves`}),o(i)},[i,t,r]),a===i?(0,G.jsx)(vs.Provider,{value:e,children:n}):(0,G.jsx)(`div`,{className:`flex h-64 items-center justify-center text-sm text-on-surface-variant`,children:`Switching project...`})}function bs({children:e}){return(0,W.useLayoutEffect)(()=>{Eo(null)},[]),(0,G.jsx)(G.Fragment,{children:e})}function xs(){return(0,W.useContext)(vs)}function Ss(){let e=(0,W.useContext)(vs),t=_s();if(e)return e;let n=t.data?.groves??[];return Ho(n)??jo(n)}function Cs(e=``){let t=xs();return t?Fo(t,e):e||`/`}function ws(){let e=xs();return(0,W.useCallback)((t=``)=>e?Fo(e,t):t||`/`,[e])}function Ts(e,t){return e?[...t,{projectSelection:zo(e)}]:t}function Es(e){return Ts(xs(),e)}var Ds=6e4,Os=3e4;function ks(e,t,n){if(t===`heartbeat`){let t=e*Ei[n];return n===`hidden`?Math.min(t,Ds):n===`deep_sleep`?Math.min(t,Os):t}return n===`deep_sleep`||n===`hidden`?!1:e*Ei[n]}function As(e){let t=Ai(),{pollCategory:n,refetchInterval:r,contextFree:i=!1,...a}=e,o=Es(a.queryKey??[]),s=e=>e===!1||e===void 0?e:ks(e,n,t),c=typeof r==`function`?e=>s(r(e)):s(r);return ot({...a,queryKey:i?a.queryKey:o,refetchInterval:c})}var js={HEALTH:5e3,STATS:1e4,LOGS:3e3,PROGRESS:1e3,UPDATE:3e5,RUNS_ACTIVE:3e3,RUN_DETAIL:5e3,SESSIONS:8e3,SESSION_DETAIL:8e3,SPORES:3e4,CANOPY_ENTRIES:6e4,GIT_IDENTITY:5e3,TEAM:5e3},Ms=1e4,Ns=3e4,Ps=[`debug`,`info`,`warn`,`error`],Fs={debug:0,info:1,warn:2,error:3},Is=[`stable`,`beta`],Ls=1e3;function Rs(e){switch(e){case`info`:return`default`;case`warn`:return`warning`;case`error`:return`destructive`;default:return`secondary`}}function zs(e){switch(e){case`info`:return`bg-primary`;case`debug`:return`bg-outline`;case`warn`:return`bg-secondary`;case`error`:return`bg-tertiary`;default:return`bg-outline`}}function Bs(){return As({queryKey:[`daemon-stats`],queryFn:({signal:e})=>q(`/stats`,{signal:e}),refetchInterval:js.STATS,pollCategory:`standard`})}var Vs=500,Hs=3e4;function Us(){let[e,t]=(0,W.useState)(!1),n=(0,W.useRef)(null);return{restart:(0,W.useCallback)(async(e=!1)=>{t(!0);try{let r=await os(`/restart`,{force:e});if(r.status===`busy`)return t(!1),r;let i=Date.now()+Hs;n.current=new AbortController,await new Promise((e,t)=>{let r=async()=>{if(Date.now()>i){t(Error(`Restart timeout`));return}try{if((await fetch(Ko(`/health`),{signal:n.current.signal})).ok){e();return}setTimeout(r,Vs)}catch{setTimeout(r,Vs)}};setTimeout(r,Vs)}),window.location.reload()}catch(e){throw t(!1),e}},[]),isRestarting:e}}function Ws(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ws(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Gs(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ws(e))&&(r&&(r+=` `),r+=t);return r}var Ks=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,qs=Gs,Js=(e,t)=>n=>{if(t?.variants==null)return qs(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Ks(t)||Ks(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return qs(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Ys=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Xs=(e,t)=>({classGroupId:e,validator:t}),Zs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Qs=`-`,$s=[],ec=`arbitrary..`,tc=e=>{let t=ic(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return rc(e);let n=e.split(Qs);return nc(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ys(i,t):t:i||$s}return n[e]||$s}}},nc=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=nc(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Qs):e.slice(t).join(Qs),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},rc=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ec+r:void 0})(),ic=e=>{let{theme:t,classGroups:n}=e;return ac(n,t)},ac=(e,t)=>{let n=Zs();for(let r in e){let i=e[r];oc(i,n,r,t)}return n},oc=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];sc(i,t,n,r)}},sc=(e,t,n,r)=>{if(typeof e==`string`){cc(e,t,n);return}if(typeof e==`function`){lc(e,t,n,r);return}uc(e,t,n,r)},cc=(e,t,n)=>{let r=e===``?t:dc(t,e);r.classGroupId=n},lc=(e,t,n,r)=>{if(fc(e)){oc(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Xs(n,e))},uc=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];oc(o,dc(t,a),n,r)}},dc=(e,t)=>{let n=e,r=t.split(Qs),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Zs(),n.nextPart.set(t,i)),n=i}return n},fc=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,pc=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},mc=`!`,hc=`:`,gc=[],_c=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),vc=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===hc){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(mc)?(c=s.slice(0,-1),l=!0):s.startsWith(mc)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return _c(t,l,c,u)};if(t){let e=t+hc,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):_c(gc,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},yc=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},bc=e=>({cache:pc(e.cacheSize),parseClassName:vc(e),sortModifiers:yc(e),postfixLookupClassGroupIds:xc(e),...tc(e)}),xc=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Sc=/\s+/,Cc=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Sc),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+mc:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},wc=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Tc(n))&&(i&&(i+=` `),i+=r);return i},Tc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Tc(e[r]))&&(n&&(n+=` `),n+=t);return n},Ec=(e,...t)=>{let n,r,i,a,o=o=>(n=bc(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Cc(e,n);return i(e,a),a};return a=o,(...e)=>a(wc(...e))},Dc=[],Oc=e=>{let t=t=>t[e]||Dc;return t.isThemeGetter=!0,t},kc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ac=/^\((?:(\w[\w-]*):)?(.+)\)$/i,jc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Mc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Nc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Pc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Fc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ic=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Lc=e=>jc.test(e),Rc=e=>!!e&&!Number.isNaN(Number(e)),zc=e=>!!e&&Number.isInteger(Number(e)),Bc=e=>e.endsWith(`%`)&&Rc(e.slice(0,-1)),Vc=e=>Mc.test(e),Hc=()=>!0,Uc=e=>Nc.test(e)&&!Pc.test(e),Wc=()=>!1,Gc=e=>Fc.test(e),Kc=e=>Ic.test(e),qc=e=>!Xc(e)&&!il(e),Jc=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Yc=e=>fl(e,gl,Wc),Xc=e=>kc.test(e),Zc=e=>fl(e,_l,Uc),Qc=e=>fl(e,vl,Rc),$c=e=>fl(e,bl,Hc),el=e=>fl(e,yl,Wc),tl=e=>fl(e,ml,Wc),nl=e=>fl(e,hl,Kc),rl=e=>fl(e,xl,Gc),il=e=>Ac.test(e),al=e=>pl(e,_l),ol=e=>pl(e,yl),sl=e=>pl(e,ml),cl=e=>pl(e,gl),ll=e=>pl(e,hl),ul=e=>pl(e,xl,!0),dl=e=>pl(e,bl,!0),fl=(e,t,n)=>{let r=kc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},pl=(e,t,n=!1)=>{let r=Ac.exec(e);return r?r[1]?t(r[1]):n:!1},ml=e=>e===`position`||e===`percentage`,hl=e=>e===`image`||e===`url`,gl=e=>e===`length`||e===`size`||e===`bg-size`,_l=e=>e===`length`,vl=e=>e===`number`,yl=e=>e===`family-name`,bl=e=>e===`number`||e===`weight`,xl=e=>e===`shadow`,Sl=Ec(()=>{let e=Oc(`color`),t=Oc(`font`),n=Oc(`text`),r=Oc(`font-weight`),i=Oc(`tracking`),a=Oc(`leading`),o=Oc(`breakpoint`),s=Oc(`container`),c=Oc(`spacing`),l=Oc(`radius`),u=Oc(`shadow`),d=Oc(`inset-shadow`),f=Oc(`text-shadow`),p=Oc(`drop-shadow`),m=Oc(`blur`),h=Oc(`perspective`),g=Oc(`aspect`),_=Oc(`ease`),v=Oc(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),il,Xc],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[il,Xc,c],T=()=>[Lc,`full`,`auto`,...w()],E=()=>[zc,`none`,`subgrid`,il,Xc],D=()=>[`auto`,{span:[`full`,zc,il,Xc]},zc,il,Xc],O=()=>[zc,`auto`,il,Xc],k=()=>[`auto`,`min`,`max`,`fr`,il,Xc],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Lc,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Lc,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Lc,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,il,Xc],L=()=>[...b(),sl,tl,{position:[il,Xc]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,cl,Yc,{size:[il,Xc]}],z=()=>[Bc,al,Zc],B=()=>[``,`none`,`full`,l,il,Xc],V=()=>[``,Rc,al,Zc],H=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ne=()=>[Rc,Bc,sl,tl],U=()=>[``,`none`,m,il,Xc],re=()=>[`none`,Rc,il,Xc],ie=()=>[`none`,Rc,il,Xc],ae=()=>[Rc,il,Xc],oe=()=>[Lc,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Vc],breakpoint:[Vc],color:[Hc],container:[Vc],"drop-shadow":[Vc],ease:[`in`,`out`,`in-out`],font:[qc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Vc],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Vc],shadow:[Vc],spacing:[`px`,Rc],text:[Vc],"text-shadow":[Vc],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Lc,Xc,il,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,il,Xc]}],"container-named":[Jc],columns:[{columns:[Rc,Xc,il,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[zc,`auto`,il,Xc]}],basis:[{basis:[Lc,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Rc,Lc,`auto`,`initial`,`none`,Xc]}],grow:[{grow:[``,Rc,il,Xc]}],shrink:[{shrink:[``,Rc,il,Xc]}],order:[{order:[zc,`first`,`last`,`none`,il,Xc]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,al,Zc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,dl,$c]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Bc,Xc]}],"font-family":[{font:[ol,el,t]}],"font-features":[{"font-features":[Xc]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,il,Xc]}],"line-clamp":[{"line-clamp":[Rc,`none`,il,Qc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,il,Xc]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,il,Xc]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...H(),`wavy`]}],"text-decoration-thickness":[{decoration:[Rc,`from-font`,`auto`,il,Zc]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Rc,`auto`,il,Xc]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[zc,il,Xc]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,il,Xc]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,il,Xc]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},zc,il,Xc],radial:[``,il,Xc],conic:[zc,il,Xc]},ll,nl]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-bs":[{"border-bs":V()}],"border-w-be":[{"border-be":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":V()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...H(),`hidden`,`none`]}],"divide-style":[{divide:[...H(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...H(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Rc,il,Xc]}],"outline-w":[{outline:[``,Rc,al,Zc]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,ul,rl]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,ul,rl]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Rc,Zc]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,ul,rl]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Rc,il,Xc]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Rc]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[il,Xc]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Rc]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,il,Xc]}],filter:[{filter:[``,`none`,il,Xc]}],blur:[{blur:U()}],brightness:[{brightness:[Rc,il,Xc]}],contrast:[{contrast:[Rc,il,Xc]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,ul,rl]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Rc,il,Xc]}],"hue-rotate":[{"hue-rotate":[Rc,il,Xc]}],invert:[{invert:[``,Rc,il,Xc]}],saturate:[{saturate:[Rc,il,Xc]}],sepia:[{sepia:[``,Rc,il,Xc]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,il,Xc]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[Rc,il,Xc]}],"backdrop-contrast":[{"backdrop-contrast":[Rc,il,Xc]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Rc,il,Xc]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Rc,il,Xc]}],"backdrop-invert":[{"backdrop-invert":[``,Rc,il,Xc]}],"backdrop-opacity":[{"backdrop-opacity":[Rc,il,Xc]}],"backdrop-saturate":[{"backdrop-saturate":[Rc,il,Xc]}],"backdrop-sepia":[{"backdrop-sepia":[``,Rc,il,Xc]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,il,Xc]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Rc,`initial`,il,Xc]}],ease:[{ease:[`linear`,`initial`,_,il,Xc]}],delay:[{delay:[Rc,il,Xc]}],animate:[{animate:[`none`,v,il,Xc]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,il,Xc]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[il,Xc,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":[`translate-none`],zoom:[{zoom:[zc,il,Xc]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,il,Xc]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,il,Xc]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Rc,al,Zc,Qc]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function J(...e){return Sl(Gs(e))}var Cl=Js(`inline-flex items-center justify-center whitespace-nowrap rounded-md font-sans text-sm font-medium transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-surface disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-gradient-to-br from-primary to-primary-container text-on-primary shadow-xs hover:shadow-[0_0_0_1px_rgba(171,207,184,0.4)]`,destructive:`bg-gradient-to-br from-tertiary to-tertiary-container text-on-surface shadow-xs hover:shadow-[0_0_0_1px_rgba(255,180,161,0.4)]`,outline:`border border-[var(--ghost-border)] bg-transparent shadow-xs hover:bg-surface-container-high hover:text-on-surface`,secondary:`border border-outline-variant/20 bg-transparent hover:bg-surface-container-high text-on-surface`,ghost:`hover:bg-surface-container-high text-on-surface-variant hover:text-on-surface`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),Y=(0,W.forwardRef)(({className:e,variant:t,size:n,...r},i)=>(0,G.jsx)(`button`,{className:J(Cl({variant:t,size:n,className:e})),ref:i,...r}));Y.displayName=`Button`,typeof window<`u`&&window.document&&window.document.createElement;function wl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Tl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function El(...e){return t=>{let n=!1,r=e.map(e=>{let r=Tl(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Tl(e[t],null)}}}}function Dl(...e){return W.useCallback(El(...e),e)}function Ol(e,t){let n=W.createContext(t);n.displayName=e+`Context`;let r=e=>{let{children:t,...r}=e,i=W.useMemo(()=>r,Object.values(r));return(0,G.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=W.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function kl(e,t=[]){let n=[];function r(t,r){let i=W.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=W.useMemo(()=>o,Object.values(o));return(0,G.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=W.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>W.createContext(e));return function(n){let r=n?.[e]||t;return W.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Al(i,...t)]}function Al(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return W.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var jl=globalThis?.document?W.useLayoutEffect:()=>{},Ml=W.useId||(()=>void 0),Nl=0;function Pl(e){let[t,n]=W.useState(Ml());return jl(()=>{e||n(e=>e??String(Nl++))},[e]),e||(t?`radix-${t}`:``)}var Fl=W.useInsertionEffect||jl;function Il({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Ll({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=W.useRef(e!==void 0);W.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,W.useCallback(t=>{if(s){let n=Rl(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Ll({defaultProp:e,onChange:t}){let[n,r]=W.useState(e),i=W.useRef(n),a=W.useRef(t);return Fl(()=>{a.current=t},[t]),W.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Rl(e){return typeof e==`function`}var zl=l(h(),1);function Bl(e){let t=W.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];ql(r)&&typeof Zl==`function`&&(r=Zl(r._payload)),W.Children.forEach(r,e=>{if(Gl(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;ql(n)&&typeof Zl==`function`&&(n=Zl(n._payload)),a=Hl(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=W.cloneElement(a,void 0,s):!o&&W.Children.count(r)===1&&W.isValidElement(r)&&(a=r);let c=a?Wl(a):void 0,l=Dl(n,c);if(!a){if(r||r===0)throw Error(o?Xl(e):Yl(e));return r}let u=Ul(i,a.props??{});return a.type!==W.Fragment&&(u.ref=n?l:c),W.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var Vl=Symbol.for(`radix.slottable`),Hl=(e,t)=>{if(`child`in e.props){let t=e.props.child;return W.isValidElement(t)?W.cloneElement(t,void 0,e.props.children(t.props.children)):null}return W.isValidElement(t)?t:null};function Ul(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Wl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Gl(e){return W.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Vl}var Kl=Symbol.for(`react.lazy`);function ql(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Kl&&`_payload`in e&&Jl(e._payload)}function Jl(e){return typeof e==`object`&&!!e&&`then`in e}var Yl=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Xl=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Zl=W.use,Ql=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Bl(`Primitive.${t}`),r=W.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,G.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function $l(e,t){e&&zl.flushSync(()=>e.dispatchEvent(t))}function eu(e){let t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>((...e)=>t.current?.(...e)),[])}function tu(e,t=globalThis?.document){let n=eu(e);W.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var nu=`DismissableLayer`,ru=`dismissableLayer.update`,iu=`dismissableLayer.pointerDownOutside`,au=`dismissableLayer.focusOutside`,ou,su=W.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),cu=W.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=W.useContext(su),[u,d]=W.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=W.useState({}),m=Dl(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=du(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=fu(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return tu(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),W.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(ou=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),pu(),()=>{n&&(l.layersWithOutsidePointerEventsDisabled.delete(u),l.layersWithOutsidePointerEventsDisabled.size===0&&(f.body.style.pointerEvents=ou))}},[u,f,n,l]),W.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),pu())},[u,l]),W.useEffect(()=>{let e=()=>p({});return document.addEventListener(ru,e),()=>document.removeEventListener(ru,e)},[]),(0,G.jsx)(Ql.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:wl(e.onFocusCapture,S.onFocusCapture),onBlurCapture:wl(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:wl(e.onPointerDownCapture,x.onPointerDownCapture)})});cu.displayName=nu;var lu=`DismissableLayerBranch`,uu=W.forwardRef((e,t)=>{let n=W.useContext(su),r=W.useRef(null),i=Dl(t,r);return W.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,G.jsx)(Ql.div,{...e,ref:i})});uu.displayName=lu;function du(e,t=globalThis?.document){let n=eu(e),r=W.useRef(!1),i=W.useRef(()=>{});return W.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){mu(iu,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function fu(e,t=globalThis?.document){let n=eu(e),r=W.useRef(!1);return W.useEffect(()=>{let e=e=>{e.target&&!r.current&&mu(au,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function pu(){let e=new CustomEvent(ru);document.dispatchEvent(e)}function mu(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?$l(i,a):i.dispatchEvent(a)}var hu=`focusScope.autoFocusOnMount`,gu=`focusScope.autoFocusOnUnmount`,_u={bubbles:!1,cancelable:!0},vu=`FocusScope`,yu=W.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=W.useState(null),l=eu(i),u=eu(a),d=W.useRef(null),f=Dl(t,e=>c(e)),p=W.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;W.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Eu(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Eu(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Eu(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),W.useEffect(()=>{if(s){Du.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(hu,_u);s.addEventListener(hu,l),s.dispatchEvent(t),t.defaultPrevented||(bu(Au(Su(s)),{select:!0}),document.activeElement===e&&Eu(s))}return()=>{s.removeEventListener(hu,l),setTimeout(()=>{let t=new CustomEvent(gu,_u);s.addEventListener(gu,u),s.dispatchEvent(t),t.defaultPrevented||Eu(e??document.body,{select:!0}),s.removeEventListener(gu,u),Du.remove(p)},0)}}},[s,l,u,p]);let m=W.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=xu(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Eu(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Eu(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,G.jsx)(Ql.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});yu.displayName=vu;function bu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Eu(r,{select:t}),document.activeElement!==n)return}function xu(e){let t=Su(e);return[Cu(t,e),Cu(t.reverse(),e)]}function Su(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Cu(e,t){for(let n of e)if(!wu(n,{upTo:t}))return n}function wu(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Tu(e){return e instanceof HTMLInputElement&&`select`in e}function Eu(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Tu(e)&&t&&e.select()}}var Du=Ou();function Ou(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ku(e,t),e.unshift(t)},remove(t){e=ku(e,t),e[0]?.resume()}}}function ku(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Au(e){return e.filter(e=>e.tagName!==`A`)}var ju=`Portal`,Mu=W.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=W.useState(!1);jl(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?zl.createPortal((0,G.jsx)(Ql.div,{...r,ref:t}),o):null});Mu.displayName=ju;function Nu(e,t){return W.useReducer((e,n)=>t[e][n]??e,e)}var Pu=e=>{let{present:t,children:n}=e,r=Fu(t),i=typeof n==`function`?n({present:r.isPresent}):W.Children.only(n),a=Lu(r.ref,zu(i));return typeof n==`function`||r.isPresent?W.cloneElement(i,{ref:a}):null};Pu.displayName=`Presence`;function Fu(e){let[t,n]=W.useState(),r=W.useRef(null),i=W.useRef(e),a=W.useRef(`none`),[o,s]=Nu(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return W.useEffect(()=>{let e=Ru(r.current);a.current=o===`mounted`?e:`none`},[o]),jl(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Ru(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),jl(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Ru(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Ru(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:W.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Iu(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Lu(...e){let t=W.useRef(e);return t.current=e,W.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Iu(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Iu(n[e],null)}}},[])}function Ru(e){return e?.animationName||`none`}function zu(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Bu=0,Vu=null;function Hu(){W.useEffect(()=>{Vu||={start:Uu(),end:Uu()};let{start:e,end:t}=Vu;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Bu++,()=>{Bu===1&&(Vu?.start.remove(),Vu?.end.remove(),Vu=null),Bu=Math.max(0,Bu-1)}},[])}function Uu(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Wu=function(){return Wu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Wu.apply(this,arguments)};function Gu(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ku(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var qu=`right-scroll-bar-position`,Ju=`width-before-scroll-bar`,Yu=`with-scroll-bars-hidden`,Xu=`--removed-body-scroll-bar-size`;function Zu(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Qu(e,t){var n=(0,W.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var $u=typeof window<`u`?W.useLayoutEffect:W.useEffect,ed=new WeakMap;function td(e,t){var n=Qu(t||null,function(t){return e.forEach(function(e){return Zu(e,t)})});return $u(function(){var t=ed.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Zu(e,null)}),i.forEach(function(e){r.has(e)||Zu(e,a)})}ed.set(n,e)},[e]),n}function nd(e){return e}function rd(e,t){t===void 0&&(t=nd);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function id(e){e===void 0&&(e={});var t=rd(null);return t.options=Wu({async:!0,ssr:!1},e),t}var ad=function(e){var t=e.sideCar,n=Gu(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return W.createElement(r,Wu({},n))};ad.isSideCarExport=!0;function od(e,t){return e.useMedium(t),ad}var sd=id(),cd=function(){},ld=W.forwardRef(function(e,t){var n=W.useRef(null),r=W.useState({onScrollCapture:cd,onWheelCapture:cd,onTouchMoveCapture:cd}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Gu(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=td([n,t]),C=Wu(Wu({},b),i);return W.createElement(W.Fragment,null,u&&W.createElement(x,{sideCar:sd,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?W.cloneElement(W.Children.only(s),Wu(Wu({},C),{ref:S})):W.createElement(v,Wu({},C,{className:c,ref:S}),s))});ld.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},ld.classNames={fullWidth:Ju,zeroRight:qu};var ud,dd=function(){if(ud)return ud;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function fd(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=dd();return t&&e.setAttribute(`nonce`,t),e}function pd(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function md(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var hd=function(){var e=0,t=null;return{add:function(n){e==0&&(t=fd())&&(pd(t,n),md(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},gd=function(){var e=hd();return function(t,n){W.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},_d=function(){var e=gd();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},vd={left:0,top:0,right:0,gap:0},yd=function(e){return parseInt(e||``,10)||0},bd=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[yd(n),yd(r),yd(i)]},xd=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return vd;var t=bd(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Sd=_d(),Cd=`data-scroll-locked`,wd=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
12
12
|
.${Yu} {
|
|
13
13
|
overflow: hidden ${r};
|
|
14
14
|
padding-right: ${s}px ${r};
|
|
@@ -80,7 +80,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
80
80
|
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
81
81
|
`,...a.current()});return/^[\t ]/.test(l)&&(l=FE(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}VE.peek=HE;function VE(e){return e.value||``}function HE(){return`<`}UE.peek=WE;function UE(e,t,n,r){let i=ME(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function WE(){return`!`}GE.peek=KE;function GE(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function KE(){return`!`}qE.peek=JE;function qE(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function JE(){return"`"}function YE(e,t){let n=Sb(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}XE.peek=ZE;function XE(e,t,n,r){let i=ME(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(YE(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function ZE(e,t,n){return YE(e,n)?`<`:`[`}QE.peek=$E;function QE(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function $E(){return`[`}function eD(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function tD(e){let t=eD(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function nD(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function rD(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function iD(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?nD(n):eD(n),s=e.ordered?o===`.`?`)`:`.`:tD(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),rD(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function aD(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function oD(e,t,n,r){let i=aD(n),a=n.bulletCurrent||eD(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function sD(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var cD=hw([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function lD(e,t,n,r){return(e.children.some(function(e){return cD(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function uD(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}dD.peek=fD;function dD(e,t,n,r){let i=uD(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=IE(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=FE(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=IE(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+FE(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function fD(e,t,n){return n.options.strong||`*`}function pD(e,t,n,r){return n.safe(e.value,r)}function mD(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function hD(e,t,n){let r=(rD(n)+(n.options.ruleSpaces?` `:``)).repeat(mD(n));return n.options.ruleSpaces?r.slice(0,-1):r}var gD={blockquote:SE,break:EE,code:AE,definition:NE,emphasis:LE,hardBreak:EE,heading:BE,html:VE,image:UE,imageReference:GE,inlineCode:qE,link:XE,linkReference:QE,list:iD,listItem:oD,paragraph:sD,root:lD,strong:dD,text:pD,thematicBreak:hD};function _D(){return{enter:{table:vD,tableData:SD,tableHeader:SD,tableRow:bD},exit:{codeText:CD,table:yD,tableData:xD,tableHeader:xD,tableRow:xD}}}function vD(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function yD(e){this.exit(e),this.data.inTable=void 0}function bD(e){this.enter({type:`tableRow`,children:[]},e)}function xD(e){this.exit(e)}function SD(e){this.enter({type:`tableCell`,children:[]},e)}function CD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,wD));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function wD(e,t){return t===`|`?t:e}function TD(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
82
82
|
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
83
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return yE(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=gD.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function ED(){return{exit:{taskListCheckValueChecked:OD,taskListCheckValueUnchecked:OD,paragraph:kD}}}function DD(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:AD}}}function OD(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function kD(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function AD(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=gD.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function jD(){return[LT(),sE(),fE(),_D(),ED()]}function MD(e){return{extensions:[RT(),cE(e),pE(),TD(e),DD()]}}var ND={tokenize:qD,partial:!0},PD={tokenize:JD,partial:!0},FD={tokenize:YD,partial:!0},ID={tokenize:XD,partial:!0},LD={tokenize:ZD,partial:!0},RD={name:`wwwAutolink`,tokenize:GD,previous:QD},zD={name:`protocolAutolink`,tokenize:KD,previous:$D},BD={name:`emailAutolink`,tokenize:WD,previous:eO},VD={};function HD(){return{text:VD}}for(var UD=48;UD<123;)VD[UD]=BD,UD++,UD===58?UD=65:UD===91&&(UD=97);VD[43]=BD,VD[45]=BD,VD[46]=BD,VD[95]=BD,VD[72]=[BD,zD],VD[104]=[BD,zD],VD[87]=[BD,RD],VD[119]=[BD,RD];function WD(e,t,n){let r=this,i,a;return o;function o(t){return!tO(t)||!eO.call(r,r.previous)||nO(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return tO(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(LD,u,l)(t):t===45||t===95||Lb(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&Ib(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function GD(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!QD.call(r,r.previous)||nO(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(ND,e.attempt(PD,e.attempt(FD,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function KD(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&$D.call(r,r.previous)&&!nO(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Ib(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||zb(t)||Wb(t)||qb(t)||Kb(t)?n(t):e.attempt(PD,e.attempt(FD,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function qD(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function JD(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(ID,c,s)(t):t===null||Wb(t)||qb(t)||t!==45&&Kb(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function YD(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(ID,t,a)(o):o===null||Wb(o)||qb(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function XD(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||Wb(o)||qb(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Wb(e)||qb(e)?t(e):r(e)}function a(e){return Ib(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Ib(t)?(e.consume(t),o):n(t)}}function ZD(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Lb(e)?n(e):t(e)}}function QD(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Wb(e)}function $D(e){return!Ib(e)}function eO(e){return!(e===47||tO(e))}function tO(e){return e===43||e===45||e===46||e===95||Lb(e)}function nO(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var rO={tokenize:dO,partial:!0};function iO(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:cO,continuation:{tokenize:lO},exit:uO}},text:{91:{name:`gfmFootnoteCall`,tokenize:sO},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:aO,resolveTo:oO}}}}function aO(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Fb(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function oO(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function sO(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Wb(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Fb(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Wb(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function cO(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Wb(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Fb(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Wb(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Xb(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function lO(e,t,n){return e.check(dx,t,e.attempt(rO,t,n))}function uO(e){e.exit(`gfmFootnoteDefinition`)}function dO(e,t,n){let r=this;return Xb(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function fO(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Ob(o,o.length,0,ix(s,e.slice(r+1,n),t)),Ob(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Ob(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=rx(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=rx(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var pO=class{constructor(){this.map=[]}add(e,t,n){mO(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function mO(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function hO(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function gO(){return{flow:{null:{name:`table`,tokenize:_O,resolveAll:vO}}}}function _O(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Ub(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Gb(t)?Xb(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Wb(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Gb(t)?Xb(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Gb(t)?Xb(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Ub(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Gb(t)?Xb(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Ub(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Ub(n)?(e.exit(`tableRow`),t(n)):Gb(n)?Xb(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Wb(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function vO(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new pO;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(bO(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=yO(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=yO(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=yO(f,t,o,i,n,d)):(o[0]=o[1],d=yO(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&bO(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=hO(t.events,n))}return e}function yO(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},xO(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=xO(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=xO(t.events,n[2]),a=xO(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},xO(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function bO(e,t,n,r,i){let a=[],o=xO(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function xO(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var SO={name:`tasklistCheck`,tokenize:wO};function CO(){return{text:{91:SO}}}function wO(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Wb(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Ub(r)?t(r):Gb(r)?e.check({tokenize:TO},t,n)(r):n(r)}}function TO(e,t,n){return Xb(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function EO(e){return jb([HD(),iO(),fO(e),gO(),CO()])}var DO={};function OO(e){let t=this,n=e||DO,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(EO(n)),a.push(jD()),o.push(MD(n))}function kO({content:e,className:t,compact:n=!1}){return(0,G.jsx)(`div`,{className:J(n?`prose-myco-compact`:`prose-myco`,t),children:(0,G.jsx)(wT,{remarkPlugins:[OO],children:e})})}var AO={info:`bg-primary`,success:`bg-green-500`,warning:`bg-secondary`,error:`bg-tertiary`},jO={info:Ma,success:oa,warning:_o,error:ra},MO={unread:`New`,read:`Earlier`},NO=`notification-panel`;function PO(e){let t=Math.floor(Date.now()/1e3)-e;if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function FO({title:e,count:t}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-on-surface-variant`,children:e}),(0,G.jsx)(`span`,{className:`text-[11px] text-on-surface-variant/70`,children:t})]})}function IO({notification:e,onOpen:t,onDismiss:n}){let r=jO[e.level],i=e.status===`unread`;return(0,G.jsx)(`div`,{onClick:()=>t(e),className:J(`group cursor-pointer rounded-lg border border-transparent px-4 py-3 transition-colors hover:border-outline-variant/20 hover:bg-surface-container-high/70`,i&&`border-primary/10 bg-primary/[0.04]`),children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative mt-0.5 shrink-0`,children:[(0,G.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-surface-container-high text-on-surface-variant`,children:(0,G.jsx)(r,{className:`h-4 w-4`})}),i&&(0,G.jsx)(`span`,{className:J(`absolute -top-0.5 -right-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-surface-container`,AO[e.level])})]}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:J(`text-sm font-medium`,i?`text-on-surface`:`text-on-surface-variant`),children:e.title}),(0,G.jsx)(`span`,{className:`rounded-full bg-surface-container-high px-2 py-0.5 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e.domain})]}),e.message&&(0,G.jsx)(kO,{content:e.message,compact:!0,className:`line-clamp-3 text-xs leading-5 text-on-surface-variant`})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[(0,G.jsx)(`span`,{className:`pt-0.5 text-[10px] font-mono text-on-surface-variant/70`,children:PO(e.created_at)}),(0,G.jsx)(`button`,{onClick:t=>n(t,e),className:`rounded p-0.5 text-on-surface-variant/40 opacity-0 transition hover:text-on-surface-variant group-hover:opacity-100`,"aria-label":`Dismiss`,children:(0,G.jsx)(So,{className:`h-3.5 w-3.5`})})]})]})})]})})}function LO({open:e,onClose:t}){let{data:n,refetch:r}=jv({limit:50,enabled:e,pollCategory:`realtime`,refetchInterval:js.LOGS}),i=Nv(),a=Fv(),o=Pv(),s=Nn();(0,W.useEffect)(()=>{e&&r()},[e,r]),(0,W.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]);let c=(0,W.useCallback)(e=>{e.status===`unread`&&i.mutate({id:e.id,status:`read`}),e.link&&(s(e.link,{state:{source:NO,triggeredAt:Date.now()}}),t())},[i,s,t]),l=(0,W.useCallback)((e,t)=>{e.stopPropagation(),i.mutate({id:t.id,status:`dismissed`})},[i]),u=(n?.items??[]).filter(e=>e.status!==`dismissed`),d=n?.unread_count??0,f=u.filter(e=>e.status===`unread`),p=u.filter(e=>e.status!==`unread`);return(0,G.jsxs)(G.Fragment,{children:[e&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-40 bg-surface-dim/40 backdrop-blur-xs transition-opacity`,onClick:t,"aria-hidden":`true`}),(0,G.jsxs)(`aside`,{className:J(`fixed top-0 right-0 bottom-0 z-50 flex w-96 max-w-[calc(100vw-3rem)] flex-col border-l border-outline-variant/20 bg-surface-container shadow-2xl transition-transform duration-200 ease-out`,e?`translate-x-0`:`translate-x-full`),children:[(0,G.jsxs)(`div`,{className:`border-b border-outline-variant/20 px-4 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ji,{className:`h-4 w-4 shrink-0 text-primary`}),(0,G.jsx)(`h2`,{className:`min-w-0 text-sm font-medium text-on-surface`,children:`Notifications`}),d>0&&(0,G.jsx)(`span`,{className:`inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-primary/15 px-1.5 text-xs font-medium text-primary`,children:d})]})}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 shrink-0 px-2`,children:(0,G.jsx)(So,{className:`h-4 w-4`})})]}),(d>0||u.length>0)&&(0,G.jsxs)(`div`,{className:`mt-3 flex items-center justify-end gap-1 border-t border-outline-variant/10 pt-3`,children:[d>0&&(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:e=>{e.stopPropagation(),a.mutate(void 0)},title:`Mark all as read`,className:`h-7 gap-1 px-2 text-xs text-on-surface-variant`,children:[(0,G.jsx)(za,{className:`h-3.5 w-3.5`}),`Mark all read`]}),u.length>0&&(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:e=>{e.stopPropagation(),o.mutate(void 0)},title:`Clear all notifications`,className:`h-7 gap-1 px-2 text-xs text-on-surface-variant`,children:[(0,G.jsx)(ho,{className:`h-3.5 w-3.5`}),`Clear`]})]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:u.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,G.jsx)(Ji,{className:`h-5 w-5 text-on-surface-variant/50`}),(0,G.jsx)(`div`,{className:`text-sm text-on-surface-variant`,children:`No notifications yet`}),(0,G.jsx)(`div`,{className:`text-xs text-on-surface-variant/70`,children:`New events will appear here whether they display as banners or summary-only items.`})]}):(0,G.jsxs)(`div`,{className:`space-y-4 px-3 py-3`,children:[f.length>0&&(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(FO,{title:MO.unread,count:f.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:f.map(e=>(0,G.jsx)(IO,{notification:e,onOpen:c,onDismiss:l},e.id))})]}),p.length>0&&(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(FO,{title:MO.read,count:p.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:p.map(e=>(0,G.jsx)(IO,{notification:e,onOpen:c,onDismiss:l},e.id))})]})]})})]})]})}function RO(e){return Array.isArray(e)?e:e?e.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(e=>e.length>0):[]}function zO(e,t){let n=RO(t),r=e;for(let e of n){if(r==null)return;if(Array.isArray(r)){let t=Number(e);if(!Number.isInteger(t))return;r=r[t];continue}if(typeof r!=`object`)return;r=r[e]}return r}function BO(e,t,n){let r=RO(t);if(r.length===0)return;let i=e;for(let e=0;e<r.length-1;e+=1){let t=r[e],n=i[t];(typeof n!=`object`||!n||Array.isArray(n))&&(i[t]={}),i=i[t]}i[r[r.length-1]]=n}var VO=[`grove-config`];function HO(e){return[...VO,e??`none`]}function UO(){let e=Ss(),t=e?.grove.id??null,n=ko(e);return ot({queryKey:HO(t),queryFn:({signal:e})=>q(`/grove-config`,{signal:e,headers:n}),enabled:t!==null})}function WO(){let e=We(),t=Ss(),n=t?.grove.id??null,r=ko(t);return st({mutationFn:({patch:e,clear:t})=>ss(`/grove-config`,{patch:e,clear:t},{headers:r}),onSuccess:()=>{e.invalidateQueries({queryKey:HO(n)}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}var GO=[`machine-config`];function KO(){return As({queryKey:[...GO],queryFn:({signal:e})=>q(`/machine-config`,{signal:e}),refetchInterval:!1,pollCategory:`standard`,contextFree:!0})}function qO(){let e=We();return st({mutationFn:({patch:e,clear:t})=>ss(`/machine-config`,{patch:e,clear:t}),onSuccess:t=>{e.setQueryData([...GO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}function JO(){let e=We();return st({mutationFn:({path:e,value:t})=>ss(`/machine-config`,{addToList:[{path:e,values:[t]}]}),onSuccess:t=>{e.setQueryData([...GO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}function YO(){let e=We();return st({mutationFn:({path:e,value:t})=>ss(`/machine-config`,{removeFromList:[{path:e,values:[t]}]}),onSuccess:t=>{e.setQueryData([...GO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}var XO=[`config`,`merged`],ZO=[`config`,`local`],QO=[`notifications`];function $O(e){let t=We(),n=WO(),r=qO(),i=e?zo(e):`none`,a=(0,W.useMemo)(()=>ko(e),[e?.grove.id,e?.project.project_id]),o=ot({queryKey:[...XO,i],queryFn:({signal:e})=>us(e,a)}),s=ot({queryKey:[...ZO,i],queryFn:({signal:e})=>ds(e,a)}),c=(0,W.useRef)(o.data);c.current=o.data;let l=(0,W.useRef)(s.data);l.current=s.data;let u=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:QO})},[t]),d=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:ZO}),t.invalidateQueries({queryKey:XO}),u()},[u,t]),f=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:XO}),u()},[u,t]),p=(0,W.useCallback)(e=>e===`local`?d():f(),[d,f]),m=(0,W.useCallback)(async(e,t,i)=>{if(t===void 0){i===`grove`?(await n.mutateAsync({clear:[e]}),u()):i===`machine`?(await r.mutateAsync({clear:[e]}),u()):(await fs(i,{},[e],a),p(i));return}let o={};BO(o,e,t),i===`grove`?(await n.mutateAsync({patch:o}),u()):i===`machine`?(await r.mutateAsync({patch:o}),u()):(await fs(i,o,void 0,a),p(i))},[a,p,u,n,r]),h=(0,W.useCallback)(async(e,t,i)=>{let o={},s=[...i??[]];for(let{path:t,value:n}of e)n===void 0?s.push(t):BO(o,t,n);t===`grove`?(await n.mutateAsync({patch:o,clear:s.length>0?s:void 0}),u()):t===`machine`?(await r.mutateAsync({patch:o,clear:s.length>0?s:void 0}),u()):(await fs(t,o,s.length>0?s:void 0,a),p(t))},[a,p,u,n,r]),g=(0,W.useCallback)(async e=>{await ps([e],a),d()},[a,d]),_=(0,W.useCallback)(async e=>{e.length!==0&&(await ps(e,a),d())},[a,d]),v=(0,W.useCallback)(e=>zO(l.current??{},e)!==void 0,[]),y=(0,W.useCallback)(async(e,n,r)=>{if(r===`machine`){let r=await ss(`/machine-config`,{addToList:[{path:e,values:[n]}]});t.setQueryData([`machine-config`],{config:r}),t.invalidateQueries({queryKey:[`config`,`merged`]});return}let i=zO(c.current??{},e),a=Array.isArray(i)?i:[];a.includes(n)||await m(e,[...a,n],r)},[t,m]),b=(0,W.useCallback)(async(e,n,r)=>{if(r===`machine`){let r=await ss(`/machine-config`,{removeFromList:[{path:e,values:[n]}]});t.setQueryData([`machine-config`],{config:r}),t.invalidateQueries({queryKey:[`config`,`merged`]});return}let i=zO(c.current??{},e);await m(e,(Array.isArray(i)?i:[]).filter(e=>e!==n),r)},[t,m]);return{effective:o.data,local:s.data??{},isLoading:o.isLoading||s.isLoading,isLocalOverride:v,setField:m,setFields:h,resetField:g,resetFields:_,addToConfigList:y,removeFromConfigList:b}}function ek(){return $O(Ss())}function tk(){let{effective:e}=ek(),t=e?.notifications?.system_notifications??!1,{data:n,refetch:r}=jv({status:`unread`,mode:`banner`,limit:5,enabled:t,pollCategory:`heartbeat`,refetchInterval:js.PROGRESS,includeDaemon:!0}),i=(0,W.useRef)(new Set);return(0,W.useEffect)(()=>{t&&`Notification`in window&&Notification.permission==="default"&&Notification.requestPermission()},[t]),(0,W.useEffect)(()=>{if(!t||!(`Notification`in window)||Notification.permission!==`granted`||document.hasFocus())return;let e=n?.items??[];for(let t of e)i.current.has(t.id)||(i.current.add(t.id),nk(t))},[t,n]),(0,W.useEffect)(()=>{if(!t)return;let e=()=>{(document.hidden||!document.hasFocus())&&r()};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`blur`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`blur`,e)}},[t,r]),null}function nk(e){try{new window.Notification(e.title,{body:e.message??void 0,tag:e.id,icon:`/favicon.svg`})}catch{}}var rk=[`sage`,`moss`,`terracotta`,`dusk`,`plum`,`slate`],ik=[`light`,`dark`,`system`],ak=[`default`,`geist-mono`,`system`,`sf-mono`,`fira-code`,`jetbrains-mono`],ok=[`compact`,`normal`,`comfy`],sk=`myco-appearance`,ck={compact:.85,normal:1,comfy:1.15},lk={default:{heading:`'Newsreader', Georgia, serif`,ui:`'Inter', system-ui, sans-serif`,data:`'JetBrains Mono', 'Fira Code', monospace`},"geist-mono":{heading:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`,ui:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`,data:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`},system:{heading:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`,ui:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`,data:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`},"sf-mono":{heading:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`,ui:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`,data:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`},"fira-code":{heading:`'Fira Code', 'Fira Mono', ui-monospace, monospace`,ui:`'Fira Code', 'Fira Mono', ui-monospace, monospace`,data:`'Fira Code', 'Fira Mono', ui-monospace, monospace`},"jetbrains-mono":{heading:`'JetBrains Mono', ui-monospace, monospace`,ui:`'JetBrains Mono', ui-monospace, monospace`,data:`'JetBrains Mono', ui-monospace, monospace`}},uk=`(prefers-color-scheme: light)`;function dk(e){let t=document.documentElement;t.setAttribute(`data-theme`,e.theme);let n=e.mode===`system`?window.matchMedia(uk).matches?`light`:`dark`:e.mode;t.classList.toggle(`light`,n===`light`);let r=lk[e.font];t.style.setProperty(`--font-heading`,r.heading),t.style.setProperty(`--font-ui`,r.ui),t.style.setProperty(`--font-data`,r.data);let i=ck[e.density];t.style.setProperty(`--density`,String(i)),t.style.fontSize=`calc(14px * ${i})`;let a=document.querySelector(`link[rel="icon"]`);if(a){let t=`/favicon-${e.theme}.svg`;a.href.endsWith(t)||(a.href=t)}}function fk(e){try{localStorage.setItem(sk,JSON.stringify(e))}catch{}}function pk(){let e=null;try{e=localStorage.getItem(sk)}catch{return}if(e)try{dk(JSON.parse(e))}catch{try{localStorage.removeItem(sk)}catch{}}}var mk=(0,W.createContext)(null),hk={theme:`sage`,mode:`dark`,font:`default`,density:`normal`},gk=`(prefers-color-scheme: light)`;function _k({children:e}){let{effective:t,setField:n}=ek(),r=(0,W.useMemo)(()=>t?.appearance??hk,[t?.appearance]),i=(0,W.useRef)(r);i.current=r,(0,W.useLayoutEffect)(()=>{t?.appearance&&(dk(r),fk(r))},[r,t?.appearance]),(0,W.useEffect)(()=>{if(r.mode!==`system`)return;let e=window.matchMedia(gk),t=()=>dk(r);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[r]);let a=(0,W.useCallback)(async(e,t)=>{let r=i.current,a={...r,[e]:t};dk(a),fk(a);try{await n(`appearance.${e}`,t,`grove`)}catch(e){throw dk(r),fk(r),e}},[n]),o=(0,W.useMemo)(()=>({effective:r,set:a}),[r,a]);return(0,G.jsx)(mk.Provider,{value:o,children:e})}function vk(){let e=(0,W.useContext)(mk);if(!e)throw Error(`useAppearance must be used inside AppearanceProvider`);return e}var yk=[`cortex`,`canopy`,`skills`,`vault_evolution`],bk={capture:{home:`machine`,overridableBy:[]},machine_id:{home:`machine`,overridableBy:[]},"daemon.stale_session_threshold_ms":{home:`grove`,overridableBy:[]},"daemon.log_level":{home:`machine`,overridableBy:[]},"daemon.log_retention_days":{home:`machine`,overridableBy:[]},"daemon.update_channel":{home:`machine`,overridableBy:[]},"update.channel":{home:`machine`,overridableBy:[]},notifications:{home:`machine`,overridableBy:[`local`]},embedding:{home:`grove`,overridableBy:[]},appearance:{home:`grove`,overridableBy:[]},team:{home:`grove`,overridableBy:[]},agent:{home:`grove`,overridableBy:[`local`]},"agent.scheduled_tasks_enabled":{home:`grove`,overridableBy:[]},"agent.event_tasks_enabled":{home:`grove`,overridableBy:[]},"agent.run_retention_days":{home:`grove`,overridableBy:[]},skills:{home:`grove`,overridableBy:[`local`],gate:`skills`},vault_evolution:{home:`grove`,overridableBy:[`local`],gate:`vault_evolution`},maintenance:{home:`grove`,overridableBy:[`local`]},backup:{home:`grove`,overridableBy:[]},release_provenance:{home:`project`,overridableBy:[]},"release_provenance.reconcile_interval_minutes":{home:`grove`,overridableBy:[`project`,`local`]},cortex:{home:`project`,overridableBy:[`local`],gate:`cortex`},"cortex.canopy":{home:`project`,overridableBy:[`local`],gate:`canopy`},symbionts:{home:`project`,overridableBy:[`local`]},version:{home:`project`,overridableBy:[]},config_version:{home:`project`,overridableBy:[]}},xk=Object.keys(bk).sort((e,t)=>t.length-e.length);function Sk(e){for(let t of xk)if(e===t||e.startsWith(`${t}.`))return bk[t];throw Error(`No scope registry entry for config path: ${e}`)}var Ck={machine:`Machine`,grove:`Grove`,project:`Project`,local:`Personal`},wk={machine:`Every Grove on this machine`,grove:`Every project in this Grove`,project:`This project, shared via the repo`,local:`Personal — this project, on this machine (not shared via git)`},Tk={personal:`Personal`,project:`Project`,grove:`Grove`,"all-groves":`All Groves`,machine:`Machine`},Ek={personal:`This setting is overridden on this machine`,project:`This setting is using the shared project value`,grove:`This setting applies to every project in this Grove`,"all-groves":`This view aggregates every Grove on this machine`,machine:`This setting applies to every Grove on this machine`},Dk={personal:`border-sage/40 bg-sage/5 text-sage`,project:`border-[var(--ghost-border)] bg-surface-container/40 text-on-surface-variant`,grove:`border-ochre/40 bg-ochre/5 text-ochre`,"all-groves":`border-terracotta/40 bg-terracotta/5 text-terracotta`,machine:`border-terracotta/40 bg-terracotta/5 text-terracotta`};function Ok({scope:e}){let t=Tk[e];return(0,G.jsxs)(`span`,{title:Ek[e],className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${Dk[e]}`,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full ${e===`personal`?`bg-sage`:`bg-outline-variant/80`}`,"aria-hidden":!0}),t]})}var kk={machine:`machine`,grove:`grove`,project:`project`,local:`personal`};function Ak({path:e,hasLocalOverride:t,onSavePersonal:n,onReset:r}){let[i,a]=(0,W.useState)(!1),o=(0,W.useRef)(null);(0,W.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=Sk(e),c=kk[s.home]??`project`,l=t?`personal`:c,u=t?Ek.personal:wk[s.home]??Ek[c],d=Ck[s.home]??Tk[c];return(0,G.jsxs)(`span`,{ref:o,className:`relative inline-block`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-haspopup":`menu`,"aria-expanded":i,title:u,className:`cursor-pointer transition-colors hover:bg-sage/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 rounded-sm`,children:(0,G.jsx)(Ok,{scope:l})}),i&&(0,G.jsx)(`div`,{role:`menu`,className:`absolute left-0 top-full z-10 mt-1 w-44 rounded-md border border-[var(--ghost-border)] bg-surface-container-high p-1 text-xs shadow-lg`,children:t?(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r(),a(!1)},className:`block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest focus-visible:outline-none focus-visible:bg-surface-container-highest`,children:[`Reset to `,d]}):(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{n(),a(!1)},className:`block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest focus-visible:outline-none focus-visible:bg-surface-container-highest`,children:`Save Personal`})})]})}var jk={sage:{label:`Sage`,swatch:`#abcfb8`},moss:{label:`Moss`,swatch:`#9ca884`},terracotta:{label:`Terracotta`,swatch:`#d28a73`},dusk:{label:`Dusk`,swatch:`#8faed1`},plum:{label:`Plum`,swatch:`#b59ec8`},slate:{label:`Slate`,swatch:`#a6b0b8`}},Mk={light:{icon:fo,label:`Light`},dark:{icon:Wa,label:`Dark`},system:{icon:Ua,label:`System`}},Nk={default:`Default`,"geist-mono":`Geist`,system:`System`,"sf-mono":`SF Mono`,"fira-code":`Fira Code`,"jetbrains-mono":`JetBrains`},Pk=`myco-ui-appearance-expanded`;function Fk(){let e=typeof window<`u`?localStorage.getItem(Pk):null;return e===null?!0:e===`true`}function Ik({collapsed:e}){let{effective:t,set:n}=vk(),[r,i]=(0,W.useState)(Fk);(0,W.useEffect)(()=>{localStorage.setItem(Pk,String(r))},[r]);let a=(e,t)=>{n(e,t).catch(e=>console.error(`[appearance] grove write failed`,e))};if(e)return null;let o=(e,t,n)=>(0,G.jsxs)(`div`,{id:Fi(`appearance.${t}`),"data-config-field":`appearance.${t}`,className:`rounded-md transition-all duration-300`,children:[(0,G.jsxs)(`div`,{className:`flex items-center text-xs text-on-surface-variant`,children:[e,(0,G.jsx)(Ok,{scope:`grove`})]}),n]});return(0,G.jsxs)(`div`,{id:Pi.appearance,className:`rounded-md border border-[var(--ghost-border)] p-3 ${r?`space-y-3`:``}`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`-m-1 flex flex-1 items-center gap-1.5 rounded p-1 text-left hover:bg-surface-container-high`,"aria-expanded":r,"aria-label":r?`Collapse appearance section`:`Expand appearance section`,children:[(0,G.jsx)($i,{className:`h-3 w-3 text-on-surface-variant transition-transform ${r?``:`-rotate-90`}`}),(0,G.jsx)(`h3`,{className:`text-[10px] uppercase tracking-[0.22em] text-on-surface-variant`,children:`Appearance`})]})}),r&&(0,G.jsxs)(G.Fragment,{children:[o(`Color theme`,`theme`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-6 gap-1.5`,children:rk.map(e=>{let n=jk[e];return(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(`theme`,e),title:n.label,"aria-label":n.label,className:`relative aspect-square rounded-md border ${t.theme===e?`border-primary`:`border-[var(--ghost-border)]`}`,style:{backgroundColor:n.swatch},children:t.theme===e&&(0,G.jsx)(Qi,{className:`absolute inset-0 m-auto h-3 w-3 text-on-surface`})},e)})})),o(`Mode`,`mode`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-3 gap-1.5`,children:ik.map(e=>{let{icon:n,label:r}=Mk[e];return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>a(`mode`,e),className:`flex items-center justify-center gap-1 rounded-md border py-1 text-xs ${t.mode===e?`border-primary text-on-surface`:`border-[var(--ghost-border)] text-on-surface-variant`}`,"aria-label":r,children:[(0,G.jsx)(n,{className:`h-3 w-3`}),` `,r]},e)})})),o(`Font`,`font`,(0,G.jsx)(`select`,{value:t.font,onChange:e=>a(`font`,e.target.value),className:`mt-2 h-8 w-full rounded-md border border-[var(--ghost-border)] bg-[var(--surface-container-lowest)] px-2 text-xs`,children:ak.map(e=>(0,G.jsx)(`option`,{value:e,children:Nk[e]},e))})),o(`Density`,`density`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-3 gap-1.5`,children:ok.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(`density`,e),className:`rounded-md border py-1 text-xs capitalize ${t.density===e?`border-primary text-on-surface`:`border-[var(--ghost-border)] text-on-surface-variant`}`,children:e},e))}))]})]})}function Lk(){return As({queryKey:[`git-identity`],queryFn:({signal:e})=>q(`/git/status`,{signal:e}),refetchInterval:js.GIT_IDENTITY,pollCategory:`standard`})}function Rk(e){if(!e)return`?`;let t=e.trim();if(!t)return`?`;let n=t.split(/\s+/),r=n[0]??``;if(n.length===1)return r.slice(0,2).toUpperCase();let i=n[n.length-1]??``;return((r[0]??``)+(i[0]??``)).toUpperCase()}function zk({data:e,isPending:t,isError:n,to:r,className:i}){if(t||n||!e)return(0,G.jsxs)(`button`,{type:`button`,disabled:!0,"data-testid":`git-identity-pill`,className:J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 text-on-surface-variant`,i),title:n?`Failed to load git state`:`Loading git state`,children:[(0,G.jsx)(ka,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{className:`font-mono text-xs`,children:`—`})]});let a=Rk(e.author),o=`${e.author} <${e.author_email}> · ${e.branch}${e.dirty?` (dirty)`:``}`,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ka,{className:`h-3 w-3 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex flex-col items-start leading-tight`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:e.branch}),(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant inline-flex items-center gap-1`,children:[e.dirty&&(0,G.jsx)(`span`,{title:`working tree dirty`,className:`text-secondary`,children:`●`}),e.ahead>0&&(0,G.jsxs)(`span`,{title:`ahead of upstream`,children:[`↑`,e.ahead]}),e.behind>0&&(0,G.jsxs)(`span`,{title:`behind upstream`,children:[`↓`,e.behind]}),(0,G.jsx)(`span`,{children:e.author})]})]}),(0,G.jsx)(`span`,{className:`ml-1 inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary/20 font-sans text-[10px] font-semibold text-primary`,children:a})]}),c=J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 no-underline hover:bg-surface-container-high transition-colors`,i);return r?(0,G.jsx)(ri,{to:r,title:`${o}. Open release provenance settings.`,"data-testid":`git-identity-pill`,className:c,children:s}):(0,G.jsx)(`button`,{type:`button`,title:o,"data-testid":`git-identity-pill`,className:c,children:s})}var Bk={sage:`bg-primary`,ochre:`bg-secondary`,terracotta:`bg-tertiary`,outline:`bg-outline-variant`};function Vk({tone:e,pulse:t=!1,sizePx:n=6,className:r}){return(0,G.jsx)(`span`,{"data-testid":`status-dot`,"data-tone":e,"data-pulsing":t?`true`:`false`,className:J(`inline-block rounded-full`,Bk[e],t&&`animate-pulse`,r),style:{width:n,height:n},"aria-hidden":!0})}var Hk=[`update-status`];function Uk(){return As({queryKey:[...Hk],queryFn:({signal:e})=>q(`/update/status`,{signal:e}),refetchInterval:js.UPDATE,pollCategory:`standard`,contextFree:!0})}function Wk(){let e=We();return st({mutationFn:()=>os(`/update/check`),onSuccess:()=>{e.invalidateQueries({queryKey:[...Hk]})}})}function Gk(){return st({mutationFn:()=>os(`/update/apply`)})}function Kk(){let e=We();return st({mutationFn:e=>ss(`/update/channel`,{channel:e}),onSuccess:()=>{e.invalidateQueries({queryKey:[...Hk]})}})}function qk(e){return e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function Jk(e){return e.startsWith(`v`)?e:`v${e}`}function Yk({uptimeSeconds:e,version:t,updateAvailable:n=!1,latestVersion:r,to:i,className:a}){let o=n&&r?`Daemon uptime · update available: ${Jk(r)}`:t?`Daemon uptime · ${Jk(t)}`:`Daemon uptime`,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vk,{tone:n?`ochre`:`sage`,pulse:n}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`daemon`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:e===void 0?`—`:qk(e)}),t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-on-surface-variant`,children:`·`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:Jk(t)})]})]}),c=J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 no-underline`,i&&`hover:bg-surface-container-high transition-colors`,a);return i?(0,G.jsx)(ri,{to:i,className:c,title:`${o}. Open update settings.`,"aria-live":`polite`,children:s}):(0,G.jsx)(`div`,{className:J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1`,a),title:o,"aria-live":`polite`,children:s})}function Xk({to:e,className:t}){let{data:n}=Bs(),r=Uk(),i=!!(r.data&&!r.data.exempt&&(r.data.update_available||r.data.revert_available));return(0,G.jsx)(Yk,{uptimeSeconds:n?.daemon.uptime_seconds,version:n?.daemon.version_label??n?.daemon.version,updateAvailable:i,latestVersion:r.data?.latest_version,to:e,className:t})}function Zk(e,t){return!t||t<=0?0:Math.floor(e/t*100)}function Qk({describedCount:e,entriesCount:t,to:n,className:r}){let i=e!==void 0&&t!==void 0,a=i?Zk(e,t):null,o=i&&a<100,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vk,{tone:o?`ochre`:`sage`,pulse:o}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`cortex`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:a===null?`—`:`${a}%`})]}),c=J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 no-underline`,n&&`hover:bg-surface-container-high transition-colors`,r);return n?(0,G.jsx)(ri,{to:n,className:c,title:`Cortex (Canopy) describe coverage. Open Cortex.`,children:s}):(0,G.jsx)(`div`,{className:c,title:`Cortex (Canopy) describe coverage`,children:s})}function $k({to:e,className:t}){let{data:n}=Bs();return(0,G.jsx)(Qk,{describedCount:n?.canopy.described_count,entriesCount:n?.canopy.entries_count,to:e,className:t})}function eA(){let e=An(),t=xs(),n=Ro(e.pathname);if(n===`project`)return null;if(n===`grove`){let e=t?.grove,n=e?.projects.length??0;return(0,G.jsxs)(tA,{className:`border-secondary/50 bg-secondary/10 text-secondary`,dot:`bg-secondary`,title:`This page acts on every project in the Grove`,children:[`Grove-wide`,e?` · ${e.name}`:``,n?` · ${n} ${n===1?`project`:`projects`}`:``]})}return(0,G.jsx)(tA,{className:`border-tertiary/50 bg-tertiary/10 text-tertiary`,dot:`bg-tertiary`,title:`This page acts across every Grove on this machine`,children:`Machine-wide`})}function tA({children:e,className:t,dot:n,title:r}){return(0,G.jsxs)(`span`,{title:r,className:J(`inline-flex shrink-0 items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider`,t),children:[(0,G.jsx)(`span`,{className:J(`inline-block h-1.5 w-1.5 rounded-full`,n),"aria-hidden":!0}),e]})}var nA={"/":`Dashboard`,"/sessions":`Sessions`,"/cortex":`Cortex`,"/mycelium":`Mycelium`,"/skills":`Skills`,"/agent":`Agent`,"/settings":`Settings`,"/logs":`Logs`,"/machine":`Machine`,"/groves":`Groves`};function rA(e){let t=e,n=e.match(/^\/g\/[^/]+\/p\/[^/]+(\/.*)?$/);if(n)t=n[1]||`/`;else{let n=e.match(/^\/g\/[^/]+(\/.*)?$/);n&&(t=n[1]||`/`)}if(t===`/`)return[`Dashboard`];let r=t.split(`/`).filter(Boolean);return[nA[`/${r[0]}`]??r[0]]}function iA({onOpenSearch:e,onOpenNotifications:t,unreadCount:n,className:r}){let i=rA(An().pathname),a=Lk(),o=Cs(`/cortex`);return(0,G.jsxs)(`header`,{className:J(`sticky top-0 z-20 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container/90 backdrop-blur px-4`,r),children:[(0,G.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`flex items-center gap-1 font-sans text-xs text-on-surface-variant`,children:i.map((e,t)=>(0,G.jsxs)(`span`,{className:J(t===i.length-1&&`text-on-surface`),children:[t>0&&(0,G.jsx)(`span`,{className:`mx-1`,children:`/`}),e]},t))}),(0,G.jsx)(eA,{}),(0,G.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Search`,className:`ml-auto inline-flex h-7 items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 text-on-surface-variant hover:bg-surface-container-high transition-colors`,children:[(0,G.jsx)(no,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Search`}),(0,G.jsxs)(`kbd`,{className:`inline-flex items-center gap-0.5 font-mono text-[10px] text-on-surface-variant/70`,children:[(0,G.jsx)(fa,{className:`h-2.5 w-2.5`}),`K`]})]}),(0,G.jsx)(Xk,{to:`/settings?configSection=update#update`}),(0,G.jsx)($k,{to:o}),(0,G.jsx)(zk,{data:a.data,isPending:a.isPending,isError:a.isError,to:`/settings?configSection=release-provenance#release-provenance`}),(0,G.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":`Notifications`,className:`relative rounded-md p-1.5 text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface transition-colors`,children:[(0,G.jsx)(Ji,{className:`h-4 w-4`}),n>0&&(0,G.jsx)(`span`,{className:`absolute top-0.5 right-0.5 h-2 w-2 rounded-full bg-primary`})]})]})}var aA=[`Project`,`Observability`,`Grove management`,`Settings`],oA=[{to:`/`,label:`Dashboard`,icon:Fa,scope:`project`,category:`Project`},{to:`/sessions`,label:`Sessions`,icon:Ha,scope:`project`,category:`Project`},{to:`/agent`,label:`Agent`,icon:Xi,scope:`project`,category:`Project`},{to:`/cortex`,label:`Cortex`,icon:Zi,scope:`project`,category:`Project`},{to:`/mycelium`,label:`Mycelium`,icon:Ga,scope:`project`,category:`Project`},{to:`/skills`,label:`Skills`,icon:co,scope:`project`,category:`Project`},{to:`/g/:groveSlug/operations`,label:`Operations`,icon:Gi,scope:`grove`,category:`Observability`},{to:`/logs`,label:`Logs`,icon:to,scope:`machine`,category:`Observability`},{to:`/g/:groveSlug/dashboard`,label:`Grove`,icon:go,scope:`grove`,category:`Grove management`},{to:`/groves`,label:`Groves`,icon:Oa,scope:`machine`,category:`Grove management`},{to:`/symbionts`,label:`Symbionts`,icon:Ya,scope:`machine`,category:`Grove management`},{to:`/g/:groveSlug/team`,label:`Team`,icon:yo,scope:`grove`,category:`Grove management`},{to:`/settings`,label:`Settings`,icon:ao,scope:`machine`,category:`Settings`}],sA=`myco-ui-sidebar-collapsed`,cA=768,lA=80,uA=2e3,dA=[`ring-2`,`ring-primary/40`,`bg-primary/5`];function fA(){let[e,t]=(0,W.useState)(()=>localStorage.getItem(sA)===`true`);return{collapsed:e,toggle:(0,W.useCallback)(()=>{t(e=>{let t=!e;return localStorage.setItem(sA,String(t)),t})},[])}}function pA(){let[e,t]=(0,W.useState)(!1),[n,r]=(0,W.useState)(()=>typeof window<`u`&&window.innerWidth<cA);return(0,W.useEffect)(()=>{let e=window.matchMedia(`(max-width: ${cA-1}px)`),n=e=>{r(e.matches),e.matches||t(!1)};return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),(0,W.useEffect)(()=>{t(!1)},[An().pathname]),(0,W.useEffect)(()=>{if(e)return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=``}},[e]),{open:e,isMobile:n,toggle:(0,W.useCallback)(()=>t(e=>!e),[]),close:(0,W.useCallback)(()=>t(!1),[])}}function mA({collapsed:e=!1}){let{restart:t,isRestarting:n}=Us();return(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(),disabled:n,title:e?n?`Restarting...`:`Restart Daemon`:void 0,className:J(`text-on-surface-variant hover:text-on-surface`,e?`w-8 p-0 justify-center`:`w-full justify-start gap-2`),children:[(0,G.jsx)($a,{className:J(`h-4 w-4`,n&&`animate-spin`)}),!e&&(0,G.jsx)(`span`,{children:n?`Restarting...`:`Restart Daemon`})]})}function hA({collapsed:e}){let{data:t}=Bs(),n=t?.daemon.runtime;if(!n||n.source===`stable`)return null;let r=n.source===`dev`,i=r?`DEV`:`BETA`,a=r?`Daemon is running from a dev binary (make dev-link / npm link).`:`Daemon is running from the managed beta runtime under ~/.myco/runtime/.`,o=r?`bg-tertiary/20 text-tertiary border-tertiary/40`:`bg-secondary/20 text-secondary border-secondary/40`;return e?(0,G.jsx)(`div`,{className:J(`mx-auto flex h-5 w-8 items-center justify-center rounded border text-[10px] font-bold tracking-wider`,o),title:a,children:i}):(0,G.jsxs)(`div`,{className:J(`mx-2 flex items-center justify-center rounded border px-2 py-1 text-[11px] font-semibold tracking-wider`,o),title:a,children:[i,` runtime`]})}function gA({collapsed:e,onSearchOpen:t,onNotificationsOpen:n,unreadCount:r,onCollapseToggle:i,showCollapseToggle:a}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ev,{collapsed:e}),(0,G.jsxs)(`div`,{className:`px-2 pt-2 pb-1 space-y-0.5`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:t,title:e?`Search (⌘K)`:void 0,className:J(`flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,e?`justify-center px-2 py-2`:`gap-3 px-3 py-2`),children:[(0,G.jsx)(no,{className:`h-4 w-4 shrink-0`}),!e&&(0,G.jsx)(`span`,{className:`flex-1 text-left`,children:`Search`}),!e&&(0,G.jsxs)(`kbd`,{className:`text-xs text-on-surface-variant/60 font-mono`,children:[`⌘`,`K`]})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:n,title:e?`Notifications`:void 0,className:J(`flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,e?`justify-center px-2 py-2`:`gap-3 px-3 py-2`),children:[(0,G.jsx)(Ji,{className:`h-4 w-4 shrink-0`}),!e&&(0,G.jsx)(`span`,{className:`flex-1 text-left`,children:`Notifications`}),r>0&&(0,G.jsx)(`span`,{className:J(`h-2 w-2 rounded-full bg-primary shrink-0`,!e&&`ml-auto`)})]})]}),(0,G.jsx)(`nav`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-2 py-2`,"aria-label":`Main navigation`,children:aA.map(t=>{let n=oA.filter(e=>e.category===t);return n.length===0?null:(0,G.jsx)(_A,{label:t,collapsed:e,children:n.map(t=>(0,G.jsx)(yA,{item:t,collapsed:e},t.to))},t)})}),(0,G.jsxs)(`div`,{className:J(`py-3 space-y-2 mt-auto`,e?`px-1 flex flex-col items-center`:`px-2`),children:[(0,G.jsx)(hA,{collapsed:e}),!e&&(0,G.jsx)(Ik,{collapsed:e}),(0,G.jsx)(mA,{collapsed:e})]}),a&&i&&(0,G.jsx)(`div`,{className:J(`px-2 py-2`,e&&`flex justify-center`),children:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,className:J(`text-on-surface-variant hover:text-on-surface`,e?`w-8 p-0 justify-center`:`w-full justify-start gap-2`),title:e?`Expand sidebar`:`Collapse sidebar`,children:[e?(0,G.jsx)(ta,{className:`h-4 w-4`}):(0,G.jsx)(ea,{className:`h-4 w-4`}),!e&&(0,G.jsx)(`span`,{children:`Collapse`})]})})]})}function _A({label:e,collapsed:t,children:n}){return(0,G.jsxs)(`div`,{role:`group`,"aria-label":e,className:J(`space-y-0.5`,t&&`border-t border-[var(--ghost-border)] pt-3 mt-3 first:border-t-0 first:pt-0 first:mt-0`),children:[!t&&(0,G.jsx)(`div`,{className:`px-3 pt-4 pb-1 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e}),n]})}function vA(e,t,n,r){if(e.scope===`project`)return n;if(e.scope===`machine`)return e.to;if(!e.to.includes(`:groveSlug`))return n;let i=t?.grove??Ho(r)?.grove??jo(r)?.grove??r[0];return i?e.to.replace(`:groveSlug`,i.slug):`/`}function yA({item:e,collapsed:t}){return(0,G.jsxs)(ii,{to:vA(e,xs(),Cs(e.to),_s().data?.groves??[]),end:e.to===`/`,title:t?e.label:void 0,className:({isActive:e})=>J(`flex items-center rounded-md text-sm font-medium transition-colors`,t?`justify-center px-2 py-2`:`gap-3 px-3 py-2`,e?`bg-primary/10 text-primary`:`text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface`),children:[(0,G.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),!t&&e.label]})}function bA(e){let t=xs();(0,W.useEffect)(()=>{let n=t?.project.name??e??null;document.title=n?`${t?`${Uo(t.project.name)} `:``}${n} - Myco`:`Myco`},[t,e])}function xA(){let{collapsed:e,toggle:t}=fA(),{data:n}=Bs(),r=xs()?.project.name??n?.context.project.name??n?.vault.name;bA(r);let[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),{data:c}=Av(),l=c?.count??0,u=pA();(0,W.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&(e.preventDefault(),a(e=>!e))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]),(0,W.useEffect)(()=>{if(!u.open)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),u.close())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[u.open,u.close]);let d=(0,W.useCallback)(()=>a(!0),[]),f=(0,W.useCallback)(()=>s(!0),[]),p=(0,W.useCallback)(()=>s(!1),[]);return(0,W.useEffect)(()=>{let e=new URLSearchParams(location.search),t=e.get(`configField`)??void 0,n=e.get(`configSection`)??void 0;if(!t&&!n)return;let r=window.setTimeout(()=>{let e=SA(t,n);e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),e.classList.add(...dA),window.setTimeout(()=>{e.classList.remove(...dA)},uA))},lA);return()=>window.clearTimeout(r)},[location.key,location.search]),(0,G.jsxs)(`div`,{className:`flex h-screen overflow-hidden bg-background`,children:[(0,G.jsx)(ov,{open:i,onOpenChange:a}),(0,G.jsx)(Uv,{panelOpen:o}),(0,G.jsx)(LO,{open:o,onClose:p}),(0,G.jsx)(tk,{}),u.isMobile&&(0,G.jsxs)(`div`,{className:`fixed top-0 left-0 right-0 z-40 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container px-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:u.toggle,className:`rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":u.open?`Close navigation`:`Open navigation`,children:u.open?(0,G.jsx)(So,{className:`h-5 w-5`}):(0,G.jsx)(Va,{className:`h-5 w-5`})}),(0,G.jsx)(`span`,{className:`font-serif text-base text-primary tracking-wider`,children:`myco`}),r&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline uppercase tracking-widest`,children:r}),(0,G.jsx)(eA,{}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:f,className:`relative rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":`Notifications`,children:[(0,G.jsx)(Ji,{className:`h-4 w-4`}),l>0&&(0,G.jsx)(`span`,{className:`absolute top-0.5 right-0.5 h-2 w-2 rounded-full bg-primary`})]}),(0,G.jsx)(`button`,{type:`button`,onClick:d,className:`rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":`Search`,children:(0,G.jsx)(no,{className:`h-4 w-4`})})]})]}),u.isMobile&&u.open&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-40 bg-surface-dim/60 backdrop-blur-xs transition-opacity`,onClick:u.close,"aria-hidden":`true`}),u.isMobile&&(0,G.jsx)(`aside`,{className:J(`fixed top-12 left-0 bottom-0 z-50 w-64 flex flex-col bg-surface-container transition-transform duration-200 ease-out`,u.open?`translate-x-0`:`-translate-x-full`),children:(0,G.jsx)(gA,{collapsed:!1,onSearchOpen:d,onNotificationsOpen:f,unreadCount:l,showCollapseToggle:!1})}),!u.isMobile&&(0,G.jsx)(`aside`,{className:J(`flex flex-col bg-surface-container transition-[width] duration-200`,e?`w-14`:`w-56`),children:(0,G.jsx)(gA,{collapsed:e,onSearchOpen:d,onNotificationsOpen:f,unreadCount:l,onCollapseToggle:t,showCollapseToggle:!0})}),(0,G.jsxs)(`main`,{className:J(`flex flex-1 flex-col overflow-hidden bg-surface`,u.isMobile&&`pt-12`),"aria-label":`Page content`,children:[!u.isMobile&&(0,G.jsx)(iA,{onOpenSearch:d,onOpenNotifications:f,unreadCount:l}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,G.jsx)(cr,{})})]})]})}function SA(e,t){if(e){let t=e;for(;t.length>0;){let e=document.getElementById(Fi(t));if(e instanceof HTMLElement)return e;let n=t.lastIndexOf(`.`);if(n===-1)break;t=t.slice(0,n)}}if(t){let e=document.getElementById(t);if(e instanceof HTMLElement)return e}return null}var CA=0,wA=[],TA=new Set;function EA(){for(let e of TA)e(wA)}function DA(e){let t=++CA,n={...e,id:t};wA=[...wA,n],EA();let r=e.ttlMs??5e3;r>0&&setTimeout(()=>{wA=wA.filter(e=>e.id!==t),EA()},r)}function OA(){let[e,t]=(0,W.useState)(wA);return(0,W.useEffect)(()=>(TA.add(t),()=>{TA.delete(t)}),[]),e.length===0?null:(0,G.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`pointer-events-none fixed bottom-4 right-4 z-[60] flex w-full max-w-sm flex-col gap-2`,children:e.map(e=>(0,G.jsxs)(`div`,{className:J(`pointer-events-auto rounded-md border bg-surface-container-highest px-4 py-3 shadow-lg`,e.level===`success`&&`border-primary/30`,e.level===`error`&&`border-tertiary/40`,e.level===`info`&&`border-outline-variant/30`),children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-on-surface`,children:e.title}),e.detail&&(0,G.jsx)(`div`,{className:`mt-1 break-all font-mono text-xs text-on-surface-variant`,children:e.detail})]},e.id))})}var kA=js.SESSIONS,AA=js.SESSION_DETAIL,jA=js.SESSION_DETAIL,MA=3e4,NA=6e4,PA=1e4,FA=js.SESSION_DETAIL;function IA(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.agent&&t.set(`agent`,e.agent),e?.search&&t.set(`search`,e.search),e?.hasPlan&&t.set(`has_plan`,`true`),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/sessions?${n}`:`/sessions`;return As({queryKey:[`sessions`,e],queryFn:({signal:e})=>q(r,{signal:e}),pollCategory:`standard`,refetchInterval:kA})}function LA(e){return As({queryKey:[`session`,e],queryFn:({signal:t})=>q(`/sessions/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:AA})}function RA(e,t=[`human`]){let n=t===`all`?``:`?origins=${t.join(`,`)}`;return As({queryKey:[`session-batches`,e,t===`all`?`all`:[...t].sort().join(`,`)],queryFn:({signal:t})=>q(`/sessions/${e}/batches${n}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:jA})}function zA(e){return ot({queryKey:Es([`batch-activities`,e]),queryFn:({signal:t})=>q(`/batches/${e}/activities`,{signal:t}),enabled:e!==void 0,staleTime:MA})}function BA(e){return ot({queryKey:Es([`session-attachments`,e]),queryFn:({signal:t})=>q(`/sessions/${e}/attachments`,{signal:t}),enabled:e!==void 0,staleTime:NA})}function VA(){let e=We();return st({mutationFn:({id:e,force:t})=>ls(`/sessions/${e}`,t?{force:!0}:void 0),onSuccess:()=>{e.invalidateQueries({queryKey:[`sessions`]})}})}function HA(){let e=We();return st({mutationFn:e=>os(`/sessions/${e}/complete`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`session`,n]}),e.invalidateQueries({queryKey:[`sessions`]})}})}function UA(e){return ot({queryKey:Es([`session-impact`,e]),queryFn:({signal:t})=>q(`/sessions/${e}/impact`,{signal:t}),enabled:e!==null,staleTime:PA})}function WA(e){return As({queryKey:[`session-plans`,e],queryFn:async({signal:t})=>(await q(`/sessions/${e}/plans`,{signal:t})).plans,enabled:!!e,pollCategory:`standard`,refetchInterval:FA})}function GA(e){let t=We();return st({mutationFn:e=>ls(`/plans/${e}`),onSuccess:()=>{t.invalidateQueries({queryKey:[`session-plans`,e]})}})}var KA=js.RUNS_ACTIVE,qA=js.RUN_DETAIL,JA=js.STATS,YA=new Set([`completed`,`failed`,`skipped`]),XA=js.STATS,ZA=6e4,QA=50;function $A(e){let t=e?.limit??QA,n=new URLSearchParams;n.set(`limit`,String(t)),e?.offset!==void 0&&n.set(`offset`,String(e.offset)),e?.search&&n.set(`search`,e.search),e?.status&&n.set(`status`,e.status),e?.task&&n.set(`task`,e.task);let r=n.toString();return As({queryKey:[`agent-runs`,e],queryFn:({signal:e})=>q(`/agent/runs?${r}`,{signal:e}),pollCategory:`standard`,refetchInterval:KA})}function ej(e){return As({queryKey:[`agent-run`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:e=>{let t=e.state.data?.run?.status;return t&&YA.has(t)?!1:qA}})}function tj(e,t){let n=t?YA.has(t):!1;return As({queryKey:[`agent-reports`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/reports`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?!1:JA})}function nj(e,t){let n=t?YA.has(t):!1;return As({queryKey:[`agent-turns`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/turns`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?!1:XA})}function rj(){return ot({queryKey:Es([`agent-tasks`]),queryFn:({signal:e})=>q(`/agent/tasks`,{signal:e}),staleTime:ZA})}function ij(e){return ot({queryKey:Es([`agent-task`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}`,{signal:t}),enabled:e!==void 0,staleTime:ZA})}function aj(){let e=We();return st({mutationFn:({taskId:e,name:t})=>os(`/agent/tasks/${e}/copy`,t?{name:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function oj(){let e=We();return st({mutationFn:e=>ls(`/agent/tasks/${e}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function sj(e){return ot({queryKey:Es([`agent-task-yaml`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}/yaml`,{signal:t}),enabled:e!==void 0,staleTime:ZA})}function cj(){let e=We();return st({mutationFn:({taskId:e,yaml:t})=>ss(`/agent/tasks/${e}`,{yaml:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]}),e.invalidateQueries({queryKey:[`agent-task`]}),e.invalidateQueries({queryKey:[`agent-task-yaml`]})}})}function lj(){let e=We();return st({mutationFn:e=>os(`/agent/run`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-runs`]})}})}function uj(){let e=We(),t=xs();return st({mutationFn:({runId:e,mode:t})=>os(`/agent/runs/${e}/resume`,t?{mode:t}:{}),onSuccess:(n,r)=>{let i=Ts(t,[`agent-run`,r.runId]);e.setQueryData(i,e=>e&&{...e,run:{...e.run,status:`running`}}),e.invalidateQueries({queryKey:[`agent-runs`]}),e.invalidateQueries({queryKey:[`agent-run`,r.runId]})}})}function dj(e){return As({queryKey:[`agent-run-write-intents`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/write-intents`,{signal:t}),enabled:e!==null,pollCategory:`standard`,refetchInterval:!1})}function fj(e){return As({queryKey:[`agent-run-audit`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/audit`,{signal:t}),enabled:e!==null,pollCategory:`standard`,refetchInterval:!1})}function pj(e,t){let n=new URLSearchParams;n.set(`agentId`,e),n.set(`tier`,String(t));let r=n.toString();return As({queryKey:[`digest-revisions`,e,t],queryFn:({signal:e})=>q(`/digest/revisions?${r}`,{signal:e}),enabled:!!e&&Number.isFinite(t),pollCategory:`standard`,refetchInterval:!1})}function mj(){let e=We();return st({mutationFn:({revisionId:e,runId:t})=>os(`/digest/revisions/${e}/restore`,t?{runId:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`digest-revisions`]})}})}function hj(e){return{id:e.id,agent_id:e.agent_id,task:e.task,instruction:e.instruction,status:e.status,harness:e.harness,provider:e.provider,model:e.model,session_ref:e.session_ref,started_at:e.started_at,completed_at:e.completed_at,tokens_used:e.tokens_used,cost_usd:e.cost_usd,usage_data:e.usage_data,error:e.error,dry_run:e.dry_run??!1,reasoning_level:e.reasoning_level??null,execution_overrides:e.execution_overrides??null,write_intents:e.write_intents,duration_ms:e.duration_ms}}function gj(e){let t=xs(),n=it({queries:e.map(e=>({queryKey:Ts(t,[`agent-run`,e]),queryFn:({signal:t})=>q(`/agent/runs/${e}`,{signal:t}),enabled:!!e}))}),r=[],i=[],a=!1;for(let e of n){e.isLoading&&(a=!0),e.error&&i.push(e.error);let t=e.data?.run;t&&r.push(hj(t))}return{runs:r,isLoading:a,errors:i,isError:i.length>0}}function _j(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/skill-candidates?${n}`:`/skill-candidates`;return ot({queryKey:Es([`skill-candidates`,e]),queryFn:({signal:e})=>q(r,{signal:e})})}function vj(){let e=We();return st({mutationFn:({id:e,...t})=>ss(`/skill-candidates/${e}`,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-candidates`]})}})}function yj(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/skill-records?${n}`:`/skill-records`;return ot({queryKey:Es([`skill-records`,e]),queryFn:({signal:e})=>q(r,{signal:e})})}function bj(e){return ot({queryKey:Es([`skill-record`,e]),queryFn:({signal:t})=>q(`/skill-records/${e}`,{signal:t}),enabled:!!e})}function xj(){let e=We();return st({mutationFn:e=>ls(`/skill-records/${encodeURIComponent(e)}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-records`]}),e.invalidateQueries({queryKey:[`skill-record`]})}})}var Sj=6e4,Cj=36e5,wj=3e4;function Tj(e,t,n=``){return e?.myco_tool_calls?e.myco_tool_calls.find(e=>e.tool_name===t&&e.op===n)?.count??0:0}async function Ej(e,t){try{return await q(e,{signal:t})}catch(e){if(e instanceof ms&&e.status===404)return null;throw e}}function Dj(e){return ot({queryKey:Es([`session-canopy`,e]),queryFn:({signal:t})=>Ej(`/sessions/${e}/canopy`,t),enabled:e!==void 0,staleTime:Sj,retry:(e,t)=>t instanceof ms&&t.status===404?!1:e<2})}function Oj(e){let t=new URLSearchParams;e.limit!==void 0&&t.set(`limit`,String(e.limit)),e.offset!==void 0&&t.set(`offset`,String(e.offset)),e.language!==void 0&&t.set(`language`,e.language),e.described!==void 0&&t.set(`described`,String(e.described)),e.embedded!==void 0&&t.set(`embedded`,String(e.embedded)),e.path_prefix!==void 0&&t.set(`path_prefix`,e.path_prefix),e.q!==void 0&&e.q!==``&&t.set(`q`,e.q),e.sort_by!==void 0&&t.set(`sort_by`,e.sort_by),e.sort_dir!==void 0&&t.set(`sort_dir`,e.sort_dir);let n=t.toString();return n?`?${n}`:``}function kj(e){return As({queryKey:[`canopy-entries`,e.limit??null,e.offset??null,e.language??null,e.described??null,e.embedded??null,e.path_prefix??null,e.q??null,e.sort_by??null,e.sort_dir??null],queryFn:({signal:t})=>q(`/canopy/entries${Oj(e)}`,{signal:t}),staleTime:wj,pollCategory:`standard`,refetchInterval:js.CANOPY_ENTRIES})}function Aj(e){return ot({queryKey:Es([`canopy-entry`,e]),queryFn:({signal:t})=>Ej(`/canopy/entries/${encodeURIComponent(e??``)}`,t),enabled:typeof e==`string`&&e.length>0,staleTime:wj,retry:(e,t)=>t instanceof ms&&t.status===404?!1:e<2})}function jj(){let e=We();return st({mutationFn:async e=>os(`/canopy/entries/${encodeURIComponent(e)}/reembed`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}function Mj(){let e=We();return st({mutationFn:async e=>os(`/canopy/entries/${encodeURIComponent(e)}/redescribe`,{}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}var Nj=3e4;function Pj(){return ot({queryKey:Es([`canopy-map`]),queryFn:({signal:e})=>q(`/canopy/map`,{signal:e}),staleTime:Nj})}function Fj(){let e=We();return st({mutationFn:async e=>os(`/canopy/map/regenerate`,{force_cold_start:e.force_cold_start===!0}),onSuccess:()=>{e.invalidateQueries({queryKey:[`canopy-map`]})}})}function Ij(e,t){return ot({queryKey:Es([`canopy-tool-call-blob`,e,t]),queryFn:({signal:n})=>Ej(`/sessions/${e}/canopy/tool-calls/${t}/blob`,n),enabled:e!==void 0&&t!==void 0,staleTime:Cj,retry:(e,t)=>t instanceof ms&&t.status===404?!1:e<2})}function Lj({isLoading:e,error:t,loadingText:n=`Loading...`,children:r}){return e?(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:n})]}):t?(0,G.jsxs)(`div`,{className:`flex h-64 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to connect to daemon`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:t.message})]}):(0,G.jsx)(G.Fragment,{children:r})}var Rj={default:`w-full`,narrow:`mx-auto w-full max-w-3xl`},zj=(0,W.forwardRef)(({variant:e=`default`,className:t,children:n,...r},i)=>(0,G.jsx)(`div`,{ref:i,className:J(`flex flex-col gap-6 p-6`,Rj[e],t),...r,children:n}));zj.displayName=`PageContainer`;var Bj=Js(`rounded-xl bg-surface-container-low border border-outline-variant`,{variants:{accent:{sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`,outline:`border-t-2 border-t-outline-variant`},padded:{true:`p-4`,false:``}},defaultVariants:{accent:`sage`,padded:!1}}),Vj=(0,W.forwardRef)(({className:e,accent:t,padded:n,...r},i)=>(0,G.jsx)(`div`,{ref:i,className:J(Bj({accent:t,padded:n}),e),...r}));Vj.displayName=`AccentSurface`;var Hj=Js(`inline-flex items-center myco-eyebrow`,{variants:{tone:{default:`text-outline`,sage:`text-sage`,ochre:`text-ochre`,terra:`text-terracotta`,outline:`text-outline`},size:{sm:`myco-eyebrow-sm`,md:`myco-eyebrow`}},defaultVariants:{tone:`default`,size:`md`}}),Uj=(0,W.forwardRef)(({className:e,tone:t,size:n,...r},i)=>(0,G.jsx)(`span`,{ref:i,className:J(Hj({tone:t,size:n}),e),...r}));Uj.displayName=`Eyebrow`;var Wj=(0,W.forwardRef)(({tone:e=`sage`,eyebrow:t,title:n,actions:r,footer:i,padded:a=!0,className:o,children:s,...c},l)=>{let u=t!=null||n!=null||r!=null;return(0,G.jsxs)(Vj,{ref:l,accent:e,className:J(`flex flex-col`,o),...c,children:[u&&(0,G.jsxs)(`header`,{className:J(`flex items-start justify-between gap-3`,a?`px-5 pt-4`:`px-5 py-4`),children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[t!=null&&(0,G.jsx)(Uj,{tone:e,children:t}),n!=null&&(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:n})]}),r!=null&&(0,G.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:r})]}),s!=null&&(0,G.jsx)(`div`,{className:J(a?`px-5 py-4`:``),children:s}),i!=null&&(0,G.jsx)(`footer`,{className:`border-t border-[var(--ghost-border)] px-5 py-3`,children:i})]})});Wj.displayName=`Panel`;function Gj({data:e,widthPx:t=56,heightPx:n=16,barClassName:r=`fill-primary/60`,zeroBarClassName:i,minValueHeightPx:a=0,zeroValueHeightPx:o=0,ariaLabel:s=`Activity sparkline`,title:c,className:l}){let u=e.length;if(u===0)return(0,G.jsx)(`svg`,{role:`img`,"aria-label":s,title:c??s,width:t,height:n,className:J(`inline-block`,l)});let d=Math.max(...e,1),f=Math.max(1,(t-1*(u-1))/u);return(0,G.jsx)(`svg`,{role:`img`,"aria-label":s,title:c??s,width:t,height:n,className:J(`inline-block`,l),children:e.map((e,t)=>{let s=d===0?0:Math.round(e/d*n),c=Math.min(n,e>0?Math.max(a,s):o);return(0,G.jsx)(`rect`,{x:t*(f+1),y:n-c,width:f,height:c,className:e>0?r:i??r,rx:.5},t)})})}var Kj=8;function qj(e){let t=e??[];return t.length>=Kj?t.slice(t.length-Kj):[...t,...Array(Kj-t.length).fill(0)]}function Jj(e,t){return e===`session`?t===1?`prompt batch`:`prompt batches`:t===1?`agent turn`:`agent turns`}function Yj(e){return e===`session`?`this session`:`this run`}function Xj({data:e,kind:t,widthPx:n=48,heightPx:r=14,className:i,title:a,...o}){let s=qj(e),c=s.reduce((e,t)=>e+t,0),l=`${c.toLocaleString()} ${Jj(t,c)} across ${Yj(t)}`,u=Math.max(...s,1),d=Math.max(2,(n-2*(s.length-1))/s.length),f=t===`session`?`var(--sage)`:`var(--primary)`;return(0,G.jsx)(`svg`,{role:`img`,"aria-label":l,title:a??l,width:n,height:r,viewBox:`0 0 ${n} ${r}`,className:J(`inline-block`,i),...o,children:s.map((e,t)=>{let n=Math.round(e/u*r),i=e>0?Math.max(3,n):1;return(0,G.jsx)(`rect`,{x:t*(d+2),y:r-i,width:d,height:i,rx:1,fill:f,opacity:e>0?.75:.18},t)})})}var Zj=Js(`flex min-w-0 flex-col gap-1 overflow-hidden rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-4 py-3`,{variants:{tone:{default:``,sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`}},defaultVariants:{tone:`default`}}),Qj=(0,W.forwardRef)(({label:e,value:t,sub:n,tone:r,mono:i=!1,sparklineData:a,className:o,...s},c)=>(0,G.jsxs)(`div`,{ref:c,className:J(Zj({tone:r}),o),...s,children:[(0,G.jsx)(Uj,{size:`sm`,children:e}),(0,G.jsxs)(`div`,{className:J(`flex min-w-0 items-end justify-between gap-2`),children:[(0,G.jsx)(`div`,{className:J(`min-w-0 max-w-full [overflow-wrap:anywhere]`,i?`font-mono text-base leading-tight text-on-surface`:`myco-display-md text-on-surface`),children:t}),a&&a.length>=2&&(0,G.jsx)(Gj,{data:a,widthPx:80,heightPx:20,className:`opacity-60 shrink-0`})]}),n!=null&&(0,G.jsx)(`div`,{className:`font-mono text-[10px] text-outline`,children:n})]}));Qj.displayName=`MetricCard`;var $j=6,eM=6,tM=6,nM=6;function rM(e){return e===`running`?`sage`:e===`failed`||e===`error`?`terracotta`:e===`completed`||e===`succeeded`?`outline`:`ochre`}function iM(){let{data:e,isLoading:t,isError:n,error:r}=Bs(),{data:i}=IA({status:`active`,limit:$j}),{data:a}=IA({limit:1}),{data:o}=$A({limit:eM}),{data:s}=yj({limit:tM}),{data:c}=kj({limit:nM,sort_by:`llm_updated_at`,sort_dir:`desc`});return(0,G.jsx)(Lj,{isLoading:t,error:n?r instanceof Error?r:Error(`Unable to reach daemon`):null,loadingText:`Connecting to daemon...`,children:e&&(0,G.jsxs)(zj,{className:`gap-8`,children:[(0,G.jsx)(aM,{stats:e,activeSessionCount:i?.total??0,inFlightRunCount:(o?.runs??[]).filter(e=>e.status===`running`).length,lastSession:a?.sessions?.[0]}),(0,G.jsx)(lM,{stats:e}),(0,G.jsx)(pM,{sessions:i?.sessions??[],totalSporeCount:e.vault.spore_count,totalActiveCount:i?.total??0}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,G.jsx)(hM,{runs:o?.runs??[]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,G.jsx)(_M,{skills:s?.records??[]}),(0,G.jsx)(vM,{entries:c?.rows??[]})]})]})]})})}function aM({stats:e,activeSessionCount:t,inFlightRunCount:n,lastSession:r}){let i=e.context.project.name||vv(e.context.project.root),a=cM(t,n,e.embedding.queue_depth);return(0,G.jsxs)(`header`,{className:`flex items-start justify-between gap-4 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(Uj,{children:i}),(0,G.jsx)(`h1`,{className:`myco-display-lg text-on-surface m-0`,children:`Dashboard`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:a})]}),(0,G.jsx)(sM,{lastSession:r,activeCount:t,totalSessions:e.vault.session_count})]})}var oM=10080*60;function sM({lastSession:e,activeCount:t,totalSessions:n}){let r,i;if(t>0)r=`sage`,i=`Capturing now`;else if(n===0||!e)r=`outline`,i=`No sessions captured yet`;else{let t=e.ended_at??e.started_at,n=Date.now()/1e3-t<=oM;r=n?`sage`:`ochre`,i=n?`Last captured ${mv(t)}`:`No capture in 7 days · last ${mv(t)}`}return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-outline-variant/40 bg-surface-container/40 px-2.5 py-1 font-sans text-xs text-on-surface-variant`,title:`Capture health for this project — when a session last landed`,children:[(0,G.jsx)(Vk,{tone:r}),(0,G.jsx)(`span`,{children:i})]})}function cM(e,t,n){let r=[];return e>0&&r.push(`${e} ${e===1?`active session`:`active sessions`}`),t>0&&r.push(`${t} ${t===1?`run`:`runs`} running`),n>0&&r.push(`${n} in the embed queue`),r.length===0?`Quiet right now — nothing running.`:r.join(` · `)}function lM({stats:e}){return(0,G.jsxs)(`section`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,G.jsx)(dM,{stats:e}),(0,G.jsx)(fM,{stats:e})]})}function uM({accent:e,Icon:t,eyebrow:n,name:r,sub:i,children:a}){let o=e===`sage`?`text-sage`:e===`ochre`?`text-ochre`:`text-terracotta`,s=e===`sage`?`sage`:e===`ochre`?`ochre`:`default`;return(0,G.jsxs)(Vj,{accent:e,className:`p-5 flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(t,{className:J(`h-3.5 w-3.5`,o)}),(0,G.jsx)(Uj,{tone:s,children:n})]}),(0,G.jsx)(`div`,{className:`myco-display-md text-on-surface truncate`,title:r,children:r}),(0,G.jsx)(`div`,{className:`font-mono text-[10px] text-outline truncate`,title:i,children:i})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:a})]})}function dM({stats:e}){return(0,G.jsxs)(uM,{accent:`sage`,Icon:Ka,eyebrow:`Project`,name:e.context.project.name||vv(e.context.project.root),sub:e.context.project.root,children:[(0,G.jsx)(Qj,{label:`Sessions`,value:e.vault.session_count.toLocaleString(),tone:`sage`}),(0,G.jsx)(Qj,{label:`Spores`,value:e.vault.spore_count.toLocaleString()}),(0,G.jsx)(Qj,{label:`Plans`,value:e.vault.plan_count.toLocaleString()}),(0,G.jsx)(Qj,{label:`Canopy`,value:`${e.canopy.described_count}/${e.canopy.entries_count}`,sub:`described`,mono:!0})]})}function fM({stats:e}){let t=e.context.grove,n=t.name??`Local only`,r=t.slug?`${t.mode??`local`} · ${t.connection_state}`:`no grove bound`,i=e.embedding.total_embeddable,a=e.embedding.embedded_count,o=e.embedding.queue_depth;return(0,G.jsxs)(uM,{accent:`ochre`,Icon:go,eyebrow:`Grove`,name:n,sub:r,children:[(0,G.jsx)(Qj,{label:`Embeddings`,value:i>0?`${a}/${i}`:`—`,sub:i>0?`embedded`:`no items`,mono:!0,tone:`ochre`}),(0,G.jsx)(Qj,{label:`Embed queue`,value:o.toLocaleString(),sub:o>0?`pending`:`idle`})]})}function pM({sessions:e,totalSporeCount:t,totalActiveCount:n}){let r=Nn(),i=ws(),a=n===0?`No active sessions`:`${n} ${n===1?`active session`:`active sessions`}`;return(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:`Active sessions · ${n}`,title:a,children:[e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Sessions appear here when a symbiont starts a new conversation.`}):(0,G.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>(0,G.jsx)(mM,{session:e,accent:[`sage`,`ochre`,`terra`][t%3],onClick:()=>r(i(J_(e.id)))},e.id))}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between border-t border-[var(--ghost-border)] pt-3 text-xs font-mono text-outline`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-on-surface tabular-nums`,children:t.toLocaleString()}),` spores total`]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(i(`/sessions`)),className:`inline-flex items-center gap-1 text-sage hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 rounded`,children:[`View session archive`,(0,G.jsx)(qi,{className:`h-3 w-3`})]})]})]})}function mM({session:e,accent:t,onClick:n}){return(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:J(`w-full text-left rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-4 py-3 transition-colors`,`hover:bg-surface-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,t===`sage`&&`border-l-2 border-l-sage`,t===`ochre`&&`border-l-2 border-l-ochre`,t===`terra`&&`border-l-2 border-l-terracotta`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Vk,{tone:e.status===`active`?`sage`:`ochre`,pulse:e.status===`active`}),(0,G.jsx)(`span`,{className:`font-serif italic text-sm text-on-surface truncate flex-1 min-w-0`,children:e.title||`Untitled session`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:mv(e.started_at)})]}),(0,G.jsxs)(`div`,{className:`mt-1 font-mono text-[11px] text-on-surface-variant flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(`span`,{children:e.agent}),e.branch&&(0,G.jsxs)(`span`,{children:[`· `,e.branch]}),(0,G.jsxs)(`span`,{children:[`· `,e.prompt_count,`p · `,e.tool_count,`t`]}),e.activity_buckets&&e.activity_buckets.length>1&&(0,G.jsx)(`span`,{className:`ml-auto`,children:(0,G.jsx)(Gj,{data:e.activity_buckets,widthPx:64,heightPx:14})})]})]})}function hM({runs:e}){let t=Nn(),n=ws(),r=[...e].sort((e,t)=>e.status===`running`&&t.status!==`running`?-1:e.status!==`running`&&t.status===`running`?1:(t.started_at??0)-(e.started_at??0));return(0,G.jsx)(Wj,{accent:`terra`,eyebrow:`Agent runs`,title:`Recent`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/agent`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`All runs `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:r.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`No agent runs yet for this project.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none flex flex-col gap-2`,children:r.map(e=>(0,G.jsx)(gM,{run:e,onClick:()=>t(n(Y_(e.id)))},e.id))})})}function gM({run:e,onClick:t}){let n=rM(e.status),r=e.task??`untitled task`,i=e.tokens_used??0;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:t,className:`w-full text-left rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 transition-colors hover:bg-surface-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Vk,{tone:n,pulse:e.status===`running`}),(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface truncate flex-1 min-w-0`,children:r}),e.dry_run&&(0,G.jsx)(`span`,{className:`font-mono text-[9px] uppercase tracking-wider text-ochre bg-ochre/10 px-1.5 rounded`,children:`dry`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.status})]}),(0,G.jsxs)(`div`,{className:`mt-1 font-mono text-[10px] text-outline flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{children:e.id.slice(0,8)}),e.started_at&&(0,G.jsxs)(`span`,{children:[`· `,mv(e.started_at)]}),i>0&&(0,G.jsxs)(`span`,{children:[`· `,i.toLocaleString(),` tok`]}),e.model&&(0,G.jsxs)(`span`,{children:[`· `,e.model]})]})]})})}function _M({skills:e}){let t=Nn(),n=ws(),r=[...e].sort((e,t)=>t.updated_at-e.updated_at);return(0,G.jsx)(Wj,{accent:`sage`,eyebrow:`Skills`,title:`Recently evolved`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/skills`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Curate `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:r.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`No skills yet. The agent surfaces candidates as you work.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none grid grid-cols-1 sm:grid-cols-2 gap-2`,children:r.map(e=>(0,G.jsxs)(`li`,{className:`rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(co,{className:`h-3 w-3 text-sage shrink-0`}),(0,G.jsx)(`span`,{className:`font-sans text-xs font-medium text-on-surface truncate`,title:e.display_name,children:e.display_name||e.name}),(0,G.jsxs)(`span`,{className:`ml-auto font-mono text-[9px] uppercase tracking-wider text-ochre bg-ochre/10 px-1.5 rounded shrink-0`,children:[`gen `,e.generation]})]}),(0,G.jsx)(`div`,{className:`mt-1 font-mono text-[10px] text-outline`,children:mv(e.updated_at)})]},e.id))})})}function vM({entries:e}){let t=Nn(),n=ws();return(0,G.jsx)(Wj,{accent:`ochre`,eyebrow:`Canopy`,title:`Recent entries`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/cortex?tab=canopy`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Open Cortex `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Canopy hasn't summarized any files yet.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none flex flex-col gap-1.5`,children:e.map(e=>(0,G.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(xa,{className:`h-3 w-3 text-outline shrink-0`}),(0,G.jsx)(`span`,{className:`font-mono truncate flex-1 min-w-0 text-on-surface`,title:e.path,children:e.path}),e.language&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.language}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.llm_updated_at?mv(e.llm_updated_at):mv(e.mechanical_updated_at)})]},e.path))})})}function yM(e){let[t,n]=(0,W.useState)(()=>typeof window>`u`?!1:window.matchMedia(e).matches);return(0,W.useEffect)(()=>{if(typeof window>`u`)return;let t=window.matchMedia(e),r=e=>n(e.matches);return n(t.matches),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var bM=`(min-width: 768px)`,xM=240,SM=360;function CM({master:e,detail:t,hasSelection:n,onCloseMobileDetail:r,railMinWidthPx:i=xM,railMaxWidthPx:a=SM,className:o,masterAriaLabel:s=`List`,detailAriaLabel:c=`Details`}){return yM(bM)?(0,G.jsxs)(`div`,{className:J(`flex h-full w-full`,o),children:[(0,G.jsx)(`aside`,{"aria-label":s,className:`flex-shrink-0 overflow-y-auto border-r border-outline-variant/20`,style:{minWidth:i,maxWidth:a,width:`clamp(${i}px, 30vw, ${a}px)`},children:e}),(0,G.jsx)(`section`,{"aria-label":c,className:`flex-1 overflow-y-auto p-6`,children:t})]}):n?(0,G.jsxs)(`section`,{role:`region`,"aria-label":c,className:J(`flex h-full w-full flex-col`,o),children:[r&&(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:`sticky top-0 z-10 flex items-center gap-1 border-b border-outline-variant/20 bg-surface-container px-3 py-2 text-sm text-on-surface-variant hover:bg-surface-container-high`,children:[(0,G.jsx)(ea,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{children:`Back`})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:t})]}):(0,G.jsx)(`section`,{role:`region`,"aria-label":s,className:J(`h-full w-full overflow-y-auto`,o),children:e})}function wM({message:e,className:t}){return(0,G.jsx)(`div`,{className:J(`flex h-full w-full items-center justify-center text-on-surface-variant`,t),children:(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:e})})}function TM({searchPlaceholder:e=`Search...`,searchValue:t,onSearchChange:n,filters:r=[],filterValues:i={},onFilterChange:a,onClear:o,hasActiveFilters:s,inputRef:c,count:l,className:u}){let d=t.trim().length>0||r.some(e=>{let t=e.options[0]?.value??`all`;return(i[e.key]??t)!==t}),f=o&&(s??d);return(0,G.jsxs)(`div`,{className:J(`flex items-center gap-3 px-4 py-2.5 rounded-md bg-surface-container-low border border-[var(--ghost-border)]`,u),children:[(0,G.jsx)(no,{className:`h-4 w-4 text-on-surface-variant shrink-0`}),(0,G.jsx)(op,{ref:c,placeholder:e,value:t,onChange:e=>n(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1 min-w-[200px]`,"aria-label":e}),r.map(e=>(0,G.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,G.jsxs)(v_,{value:i[e.key]??`all`,onValueChange:t=>a?.(e.key,t),children:[(0,G.jsx)(b_,{children:(0,G.jsx)(y_,{placeholder:e.label})}),(0,G.jsx)(x_,{children:e.options.map(e=>(0,G.jsx)(S_,{value:e.value,children:e.label},e.value))})]})},e.key)),f&&(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,className:`shrink-0 gap-1.5`,onClick:o,"aria-label":`Clear search and filters`,children:[(0,G.jsx)(So,{className:`h-3.5 w-3.5`}),`Clear`]}),l!=null&&(0,G.jsx)(`span`,{className:`myco-eyebrow-sm shrink-0`,children:l})]})}var EM=Js(`rounded-md transition-colors`,{variants:{level:{lowest:`bg-surface-container-lowest`,low:`bg-surface-container-low`,default:`bg-surface-container`,high:`bg-surface-container-high`,highest:`bg-surface-container-highest`,bright:`bg-surface-bright`},interactive:{true:`cursor-pointer hover-lift hover:brightness-[1.08]`,false:``},ghostBorder:{true:`border border-[var(--ghost-border)]`,false:``},glass:{true:`backdrop-blur-xl bg-surface-variant/60`,false:``},glow:{true:`shadow-[inset_0_0_12px_rgba(171,207,184,0.2)]`,false:``},accent:{none:``,sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`,outline:`border-t-2 border-t-outline-variant`}},defaultVariants:{level:`low`,interactive:!1,ghostBorder:!1,glass:!1,glow:!1,accent:`none`}}),Q=(0,W.forwardRef)(({className:e,level:t,interactive:n,ghostBorder:r,glass:i,glow:a,accent:o,...s},c)=>(0,G.jsx)(`div`,{ref:c,className:J(EM({level:t,interactive:n,ghostBorder:r,glass:i,glow:a,accent:o}),e),...s}));Q.displayName=`Surface`;var DM={sage:`bg-sage/[0.08] shadow-[inset_2px_0_0_var(--sage)]`,ochre:`bg-ochre/[0.08] shadow-[inset_2px_0_0_var(--ochre)]`,terra:`bg-terracotta/[0.08] shadow-[inset_2px_0_0_var(--terracotta)]`},OM={sage:`bg-surface-container/60 ring-1 ring-inset ring-sage/30`,ochre:`bg-surface-container/60 ring-1 ring-inset ring-ochre/30`,terra:`bg-surface-container/60 ring-1 ring-inset ring-terracotta/30`},kM=(0,W.forwardRef)(({accent:e=`sage`,isActive:t=!1,isCursor:n=!1,interactive:r,onClick:i,className:a,children:o,onKeyDown:s,...c},l)=>{let u=r??typeof i==`function`;function d(e){u&&i&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i()),s?.(e)}return(0,G.jsx)(`div`,{ref:l,onClick:u?i:void 0,onKeyDown:u?d:s,tabIndex:u?0:void 0,role:u?`row`:void 0,"aria-selected":u?t:void 0,"data-active":t||void 0,"data-cursor":n||void 0,className:J(`relative border-b border-[var(--ghost-border)] last:border-b-0 px-4 py-3 transition-colors duration-100`,u&&`cursor-pointer hover:bg-surface-container focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sage/40`,t&&DM[e],n&&!t&&OM[e],a),...c,children:o})});kM.displayName=`Row`;function AM({open:e,onOpenChange:t,title:n,description:r,icon:i,meta:a,impact:o,confirmLabel:s=`Confirm`,variant:c=`destructive`,onConfirm:l,isPending:u=!1,errorMessage:d=null}){return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md border border-outline-variant/20 [&>button:last-child]:hidden`,children:[(0,G.jsxs)(np,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i&&(0,G.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-tertiary/15`,children:i}),(0,G.jsx)(ip,{children:n})]}),(0,G.jsx)(ap,{children:r})]}),a&&a.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-outline-variant/20 px-4 py-3`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant bg-surface-container px-1.5 py-0.5 rounded shrink-0`,children:a[0]?.value}),a.length>1&&(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface truncate`,children:a[1]?.value})]}),o&&o.length>0&&(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:o.map(e=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`font-sans text-[10px] font-medium uppercase tracking-wider text-on-surface-variant`,children:e.label}),(0,G.jsx)(`div`,{className:`font-sans text-base font-medium text-on-surface`,children:e.value})]},e.label))}),d&&(0,G.jsx)(`p`,{className:`text-sm text-tertiary`,"data-testid":`confirm-dialog-error`,role:`alert`,children:d}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:u,children:`Cancel`}),(0,G.jsxs)(Y,{variant:c,size:`sm`,onClick:l,disabled:u,className:`gap-2`,children:[u&&(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),s]})]})]})})}function jM({total:e,offset:t,limit:n,onPageChange:r}){if(Math.ceil(e/n)<=1)return null;let i=t>0,a=t+n<e,o=t+1,s=Math.min(t+n,e);return(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-3 pt-1`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!i,onClick:()=>r(Math.max(0,t-n)),className:`gap-1 text-on-surface-variant`,children:[(0,G.jsx)(ea,{className:`h-4 w-4`}),`Prev`]}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[o,`–`,s,` of `,e]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!a,onClick:()=>r(t+n),className:`gap-1 text-on-surface-variant`,children:[`Next`,(0,G.jsx)(ta,{className:`h-4 w-4`})]})]})}var MM=3e5;function NM(){return ot({queryKey:Es([`symbionts`]),queryFn:({signal:e})=>q(`/symbionts`,{signal:e}),staleTime:MM})}function PM(e,t,n){let r=e.find(e=>e.name===t);return r?.resumeCommand?r.resumeCommand.replace(`{sessionId}`,n):null}var FM={released:`released`,merged_unreleased:`merged`,not_on_release_line:`feature`,unknown:`unknown`,unreconciled:`unreconciled`},IM={released:`bg-primary/15 text-primary`,merged_unreleased:`bg-secondary/15 text-secondary`,not_on_release_line:`border border-[var(--ghost-border)] text-on-surface-variant`,unknown:`bg-surface-container-high text-on-surface-variant`,unreconciled:`border border-[var(--ghost-border)] text-on-surface-variant/70`},LM={released:`bg-primary`,merged_unreleased:`bg-secondary`,not_on_release_line:`bg-on-surface-variant/50`,unknown:`bg-on-surface-variant/40`,unreconciled:`bg-on-surface-variant/25`},RM={released:`border-primary`,merged_unreleased:`border-secondary`,not_on_release_line:`border-on-surface-variant/50`,unknown:`border-on-surface-variant/40`,unreconciled:`border-on-surface-variant/25`};function zM(e){let t=[FM[e.state]??e.state];return e.confidence&&t.push(`confidence: ${e.confidence}`),e.basis_kind&&t.push(`basis: ${e.basis_kind}`),e.basis_ref&&t.push(`ref: ${e.basis_ref}`),e.reason&&t.push(e.reason),t.join(` — `)}function BM({annotation:e,className:t}){if(!e)return null;let n=FM[e.state]??e.state;return(0,G.jsxs)(`span`,{className:J(`inline-flex items-center gap-1 rounded-xs px-1.5 py-0.5 font-sans text-[10px] font-medium uppercase tracking-wider`,IM[e.state]??IM.unknown,t),title:zM(e),children:[(0,G.jsx)(`span`,{children:n}),e.confidence?(0,G.jsx)(`span`,{className:`font-mono normal-case opacity-70`,children:e.confidence}):null]})}function VM({annotation:e,className:t}){if(!e)return null;let n=LM[e.state]??LM.unknown,r=RM[e.state]??RM.unknown,i=e.confidence??null,a;return a=i===`high`?n:i===`medium`?J(n,`opacity-60 border`,r):i===`low`?J(`bg-transparent border-2`,r):J(n,`opacity-50`),(0,G.jsx)(`span`,{className:J(`inline-block h-2.5 w-2.5 rounded-full shrink-0`,a,t),title:zM(e),"aria-label":`Release: ${zM(e)}`,role:`img`})}var HM=[`ACTIVE`,`TODAY`,`YESTERDAY`,`EARLIER`];function UM(e,t){let{isActive:n,startedAtEpochSec:r,nowEpochSec:i}=t,a=i??Math.floor(Date.now()/1e3),o=new Date(a*1e3),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime()/1e3,c=s-1440*60,l={ACTIVE:[],TODAY:[],YESTERDAY:[],EARLIER:[]};for(let t of e){if(n(t)){l.ACTIVE.push(t);continue}let e=r(t);if(e==null){l.EARLIER.push(t);continue}e>=s?l.TODAY.push(t):e>=c?l.YESTERDAY.push(t):l.EARLIER.push(t)}let u=[];for(let e of HM)l[e].length>0&&u.push({label:e,rows:l[e]});return u}function WM(e){return!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey}function GM({items:e,getId:t,selectedId:n,onActivate:r,filterInputRef:i,enabled:a=!0}){let o=(0,W.useRef)(t);o.current=t;let[s,c]=(0,W.useState)(()=>{if(!n)return 0;let r=e.findIndex(e=>t(e)===n);return r>=0?r:0}),l=(0,W.useRef)([]),u=(0,W.useRef)(n);return(0,W.useEffect)(()=>{if(u.current===n||(u.current=n,!n))return;let t=e.findIndex(e=>o.current(e)===n);t>=0&&c(t)},[n,e]),(0,W.useEffect)(()=>{s>=e.length&&c(Math.max(0,e.length-1)),l.current.length>e.length&&(l.current.length=e.length)},[e.length,s]),(0,W.useEffect)(()=>{let e=l.current[s];e&&typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`nearest`})},[s]),{cursorIndex:s,setRowRef:(0,W.useCallback)(e=>t=>{l.current[e]=t},[]),containerProps:{tabIndex:0,onKeyDown:(0,W.useCallback)(n=>{if(a){if(n.key===`/`&&WM(n)&&i?.current){n.preventDefault(),i.current.focus();return}if(WM(n)){if(n.key===`j`||n.key===`ArrowDown`){n.preventDefault(),c(t=>Math.min(e.length-1,t+1));return}if(n.key===`k`||n.key===`ArrowUp`){n.preventDefault(),c(e=>Math.max(0,e-1));return}if(n.key===`Enter`){n.preventDefault();let i=e[s];i&&r(t(i))}}}},[a,e,s,r,t,i])}}}var KM=5;function qM(e){return e===`active`?`sage`:e===`completed`?`outline`:`ochre`}var JM=(0,W.forwardRef)(function({session:e,symbiontDisplayName:t,isSelected:n,isCursor:r,onClick:i,onDelete:a},o){let s=e.title||_v(e.id);return(0,G.jsxs)(kM,{ref:o,isActive:n,isCursor:r,accent:`sage`,onClick:i,"aria-label":`Session: ${s}`,"data-selected":n||void 0,className:`group`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0 flex-1`,children:[(0,G.jsx)(Vk,{tone:qM(e.status),pulse:e.status===`active`,className:`mt-1.5 shrink-0`}),(0,G.jsx)(`h3`,{className:`font-serif italic text-sm text-on-surface truncate leading-snug`,children:s})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(VM,{annotation:e.release_state}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:mv(e.started_at)}),(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:`opacity-0 group-hover:opacity-100 focus-visible:opacity-100 p-1 rounded hover:bg-terracotta/10 hover:text-terracotta transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-terracotta/40`,"aria-label":`Delete session ${s}`,title:`Delete session`,children:(0,G.jsx)(ho,{className:`h-3.5 w-3.5`})})]})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 ml-5 flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 truncate font-mono text-[11px] text-on-surface-variant`,children:[e.agent,` · `,t,` · `,e.prompt_count,`p · `,e.tool_count,`t`]}),(0,G.jsx)(Xj,{data:e.activity_buckets,kind:`session`,widthPx:48,heightPx:14,className:`shrink-0`})]}),e.branch&&(0,G.jsxs)(`div`,{className:`mt-0.5 ml-5 inline-flex items-center gap-1 font-mono text-[10px] italic text-on-surface-variant`,children:[(0,G.jsx)(ka,{className:`h-2.5 w-2.5`}),e.branch]})]})});function YM(){return(0,G.jsxs)(`div`,{className:`border-b border-[var(--ghost-border)] last:border-b-0 px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`mt-1.5 h-1.5 w-1.5 rounded-full bg-surface-container-high animate-pulse shrink-0`}),(0,G.jsx)(`div`,{className:`h-3 w-48 rounded bg-surface-container-high animate-pulse`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`}),(0,G.jsx)(`div`,{className:`h-3 w-12 rounded bg-surface-container-high animate-pulse`})]})]}),(0,G.jsx)(`div`,{className:`mt-1.5 ml-5 h-2.5 w-40 rounded bg-surface-container-high animate-pulse`})]})}function XM({selectedId:e,search:t,statusFilter:n,agentFilter:r,hasPlanFilter:i,offset:a,onOffsetChange:o,filterInputRef:s,onSelectSession:c}){let l=An(),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(!1),m=VA(),{data:h}=UA(u?.id??null),{data:g}=NM(),_=(0,W.useMemo)(()=>{let e=new Map;for(let t of g?.symbionts??[])e.set(t.name,t.displayName);return t=>t?e.get(t)??t:`unknown`},[g]),{data:v,isLoading:y,isError:b,error:x}=IA({limit:50,offset:a,status:n,agent:r,hasPlan:i,search:t});function S(){u&&m.mutate({id:u.id,force:f},{onSuccess:()=>{d(null),p(!1)},onError:e=>{e instanceof ms&&e.status===409&&e.body?.error===`session_live`&&p(!0)}})}let C=v?.sessions??[],w=v?.total??0,T=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(T.current)return;let t=new URLSearchParams(l.search);t.has(`status`)||t.has(`agent`)||t.has(`has_plan`)||!e&&!y&&C.length>0&&(T.current=!0,c(C[0].id,{replace:!0}))},[e,y,C,c,l.search]);let E=GM({items:C,getId:e=>e.id,selectedId:e,onActivate:e=>c(e),filterInputRef:s}),D=C.filter(e=>e.status===`active`).length,O=C.reduce((e,t)=>e+(t.prompt_count??0),0),k=(0,G.jsxs)(`div`,{className:`px-4 py-3 border-b border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-2`,children:[(0,G.jsx)(`h2`,{className:`myco-eyebrow-sm`,children:`Sessions`}),(0,G.jsx)(`span`,{className:`myco-display-sm text-on-surface`,children:`Archive`})]}),(0,G.jsxs)(`div`,{className:`font-mono text-[11px] text-on-surface-variant inline-flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:w.toLocaleString()}),` TOTAL`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:D.toLocaleString()}),` ACTIVE`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:O.toLocaleString()}),` PROMPTS`]})]})]});return b?(0,G.jsxs)(`div`,{children:[k,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-terracotta mt-4`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load sessions`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:x instanceof Error?x.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{children:[k,y?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsx)(`div`,{role:`list`,"aria-label":`Session archive loading`,children:Array.from({length:KM}).map((e,t)=>(0,G.jsx)(YM,{},t))})}):C.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant mt-4`,children:[(0,G.jsx)(Ha,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:w===0&&!t&&!n&&!r?`No sessions yet`:`No matching sessions`}),w===0&&!t&&!n&&!r&&(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Sessions appear here as you work with your agent`})]}):(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsx)(`div`,{...E.containerProps,role:`list`,"aria-label":`Session archive`,className:`outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sage/40`,children:(()=>{let t=UM(C,{isActive:e=>e.status===`active`,startedAtEpochSec:e=>e.started_at}),n=0;return t.map(t=>(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{role:`separator`,className:`flex items-center justify-between px-4 py-2 border-b border-[var(--ghost-border)] bg-surface-container/40`,children:[(0,G.jsx)(`span`,{className:`myco-eyebrow-sm`,children:t.label}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline`,children:t.rows.length})]}),t.rows.map(t=>{let r=n++;return(0,G.jsx)(JM,{ref:E.setRowRef(r),session:t,symbiontDisplayName:_(t.agent),isSelected:e===t.id,isCursor:E.cursorIndex===r,onClick:()=>c(t.id),onDelete:()=>d(t)},t.id)})]},t.label))})()})}),(0,G.jsx)(jM,{total:w,offset:a,limit:50,onPageChange:o}),(0,G.jsx)(AM,{open:u!==null,onOpenChange:e=>{e||(d(null),p(!1))},title:`Delete Session`,description:f?`Session appears live — the agent is still running. Deleting now permanently discards the rest of the session as it happens. Delete anyway?`:`This will permanently remove this session and all related data. This action cannot be undone.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-terracotta`}),meta:u?[{label:`ID`,value:_v(u.id)},{label:`Title`,value:u.title||_v(u.id)}]:[],impact:h?[{label:`Prompts`,value:h.promptCount},{label:`Spores`,value:h.sporeCount},{label:`Attachments`,value:h.attachmentCount},{label:`Graph Edges`,value:h.graphEdgeCount}]:[],confirmLabel:f?`Delete Anyway`:`Delete Session`,variant:`destructive`,onConfirm:S,isPending:m.isPending})]})}function ZM({children:e,className:t}){return(0,G.jsx)(`div`,{className:J(`font-sans text-xs font-medium uppercase tracking-widest text-on-surface-variant`,t),children:e})}function QM({images:e,index:t,onClose:n,onNavigate:r}){let i=e[t],a=t>0,o=t<e.length-1;(0,W.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]);let s=(0,W.useCallback)(e=>{e.key===`Escape`&&n(),e.key===`ArrowLeft`&&a&&r(t-1),e.key===`ArrowRight`&&o&&r(t+1)},[n,r,t,a,o]);return(0,W.useEffect)(()=>(document.addEventListener(`keydown`,s),()=>document.removeEventListener(`keydown`,s)),[s]),i?(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-surface-dim/90 backdrop-blur-xs`,onClick:n,children:[(0,G.jsx)(`button`,{onClick:n,className:`absolute top-4 right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(So,{className:`h-5 w-5`})}),e.length>1&&(0,G.jsxs)(`span`,{className:`absolute top-4 left-1/2 -translate-x-1/2 font-mono text-xs text-on-surface/60 z-10`,children:[t+1,` / `,e.length]}),a&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(t-1)},className:`absolute left-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(ea,{className:`h-6 w-6`})}),o&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(t+1)},className:`absolute right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(ta,{className:`h-6 w-6`})}),(0,G.jsx)(`img`,{src:i.src,alt:i.alt,className:`max-h-[90vh] max-w-[90vw] rounded-lg shadow-ambient object-contain`,onClick:e=>e.stopPropagation()})]}):null}var $M=new Set([`Read`,`read`]);function eN(e){return e.canopy_injection_tokens===null?!1:$M.has(e.tool_name)}function tN({sessionId:e,toolCallId:t}){let{data:n,isLoading:r,isError:i,error:a}=Ij(e,t);return r?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`h-3 w-3/4 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-3 w-2/3 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-3 w-1/2 animate-pulse rounded bg-surface-container-high`})]}):i||n===null?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(wa,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:a instanceof Error?a.message:`No injection blob available for this tool call.`})]}):(0,G.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap break-words bg-surface-container-lowest rounded-md p-3 text-on-surface overflow-x-auto`,"data-testid":`canopy-blob-text`,children:n.blob})}function nN({sessionId:e,activity:t}){let[n,r]=(0,W.useState)(!1);if(!eN(t))return null;let i=t.canopy_injection_tokens;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r(!0)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:J(`inline-flex items-center gap-1 px-1.5 py-0.5 rounded`,`font-mono text-[10px] text-sage`,`bg-sage/10 hover:bg-sage/20 transition-colors cursor-pointer`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sage/40`),title:`Canopy injected ${i} tokens of file anatomy. Click to view the blob sent to the agent.`,"aria-label":`Canopy injection: ${i} tokens`,"data-testid":`canopy-tool-call-indicator`,children:[(0,G.jsx)(lo,{className:`h-3 w-3`,"aria-hidden":`true`}),(0,G.jsxs)(`span`,{children:[i,` tok`]}),(0,G.jsx)(qi,{className:`h-2.5 w-2.5 opacity-60`,"aria-hidden":`true`})]}),(0,G.jsx)(Zf,{open:n,onOpenChange:r,children:(0,G.jsxs)(tp,{className:`max-w-2xl`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Canopy injection blob`}),(0,G.jsx)(ap,{children:`The verbatim file-anatomy snippet Cortex sent the agent before this Read. Transparency is the default — what you see here is exactly what the model saw.`})]}),(0,G.jsx)(tN,{sessionId:e,toolCallId:t.id})]})})]})}var rN=3;function iN({activity:e}){let[t,n]=(0,W.useState)(!1),r=e.success===1,i=!!(e.tool_input||e.tool_output_summary||e.error_message);return(0,G.jsxs)(`div`,{className:J(`border-l-2 transition-colors`,t?`border-l-primary/30`:`border-transparent hover:border-l-primary/20`),children:[(0,G.jsxs)(`div`,{role:`button`,tabIndex:0,className:`w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-surface-container/30 transition-all`,onClick:()=>n(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e=>!e))},"aria-expanded":t,children:[t?(0,G.jsx)($i,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),e.myco_tool?(0,G.jsxs)(`span`,{className:`font-mono text-xs font-medium text-primary`,children:[e.myco_tool,e.myco_op&&(0,G.jsxs)(`span`,{className:`text-primary/60`,children:[` · `,e.myco_op]})]}):(0,G.jsx)(`span`,{className:`font-mono text-xs font-medium text-on-surface`,children:e.tool_name}),e.file_path&&(0,G.jsx)(`span`,{className:`truncate font-sans text-xs text-on-surface-variant flex-1`,children:e.file_path}),(0,G.jsx)(`span`,{className:`shrink-0 ml-auto`}),(0,G.jsx)(nN,{sessionId:e.session_id,activity:e}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:xv(e.duration_ms)}),r?(0,G.jsx)(oa,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):(0,G.jsx)(ca,{className:`h-3.5 w-3.5 shrink-0 text-tertiary`})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-150 ease-out`,style:{gridTemplateRows:t?`1fr`:`0fr`},children:(0,G.jsx)(`div`,{className:`overflow-hidden`,children:(0,G.jsxs)(`div`,{className:`px-8 pb-3 space-y-2`,children:[!i&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant/60 italic py-1`,children:`No input/output details captured`}),e.tool_input&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-on-surface-variant mb-1`,children:`Input`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface`,children:e.tool_input})]}),e.tool_output_summary&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-on-surface-variant mb-1`,children:`Output`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface`,children:e.tool_output_summary})]}),e.error_message&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-tertiary mb-1`,children:`Error`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-tertiary/10 text-tertiary rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all`,children:e.error_message})]})]})})})]})}function aN({batchId:e,activityCount:t}){let[n,r]=(0,W.useState)(!1),{data:i,isLoading:a}=zA(n?e:void 0);if(t===0)return null;let o=i??[];return(0,G.jsxs)(`div`,{className:`border-t border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`button`,{type:`button`,className:J(`w-full flex items-center gap-2 px-4 py-2 text-left transition-colors`,`hover:bg-surface-container/30`),onClick:()=>r(e=>!e),children:[n?(0,G.jsx)($i,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,children:`Tool Calls`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/60`,children:t})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out`,style:{gridTemplateRows:n?`1fr`:`0fr`},children:(0,G.jsxs)(`div`,{className:`overflow-hidden`,children:[a&&(0,G.jsx)(`div`,{className:`px-3 py-2 space-y-1`,children:Array.from({length:Math.min(t,rN)}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-3 animate-pulse rounded bg-surface-container-high w-full`},t))}),!a&&o.length>0&&(0,G.jsx)(`div`,{className:`space-y-0`,children:o.map(e=>(0,G.jsx)(iN,{activity:e},e.id))})]})})]})}var oN=`h-7 w-7`;function sN(e){return new Date(e*1e3).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function cN(e){return e?e.length>120?e.slice(0,120)+`…`:e:`(no prompt)`}function lN({child:e}){return(0,G.jsxs)(`div`,{className:`mt-3 border-l-2 border-primary/30 pl-4 pb-3 mx-4`,children:[(0,G.jsx)(`div`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-primary/70 mb-1`,children:e.kind===`interrupt`?`⚠ interrupt`:`↳ steering`}),(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-1`,children:[(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant shrink-0`,children:`Prompt`}),e.started_at&&(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:sN(e.started_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface whitespace-pre-wrap`,children:e.user_prompt??`(no prompt)`}),e.activity_count>0&&(0,G.jsx)(aN,{batchId:e.id,activityCount:e.activity_count}),e.response_summary&&(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,G.jsx)(Xi,{className:`h-3 w-3 text-primary/60`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,children:`Response`})]}),(0,G.jsx)(kO,{content:e.response_summary})]})]})}function uN(){if(typeof window>`u`)return;let e=window.__MYCO_AUTH__;return typeof e==`string`&&e.length>0?e:void 0}async function dN(e){let t=new Headers,n=uN();n&&t.set(`x-myco-auth`,n);let r=await fetch(e,{headers:t});if(!r.ok)throw Error(`resource fetch failed: ${r.status}`);return URL.createObjectURL(await r.blob())}function fN(e,t){return Ko(t?`/api/g/${t.grove.id}/p/${t.project.project_id}/attachments/${e}`:`/api/attachments/${e}`)}function pN(e){let t=xs(),[n,r]=(0,W.useState)(()=>e.map(()=>null));return(0,W.useEffect)(()=>{let n=!1,i=[];return r(e.map(()=>null)),Promise.all(e.map(e=>dN(fN(e,t)).then(e=>(i.push(e),e)).catch(()=>null))).then(e=>{if(n){for(let e of i)URL.revokeObjectURL(e);return}r(e)}),()=>{n=!0;for(let e of i)URL.revokeObjectURL(e)}},[`${t?.grove.id??``}|${t?.project.project_id??``}|${e.join(`|`)}`]),n}function mN({filePath:e,alt:t,className:n,loading:r=`lazy`}){let[i]=pN([e]);return i?(0,G.jsx)(`img`,{src:i,alt:t??e,className:n,loading:r}):(0,G.jsx)(`div`,{className:n,"aria-busy":`true`})}function hN({batch:e,batchAttachments:t,steeringChildren:n,defaultOpen:r=!1,promptIndex:i,isLast:a}){let[o,s]=(0,W.useState)(r),[c,l]=(0,W.useState)(null),u=pN(t.map(e=>e.file_path));return(0,G.jsxs)(`div`,{className:`relative flex gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative flex flex-col items-center shrink-0`,style:{width:`28px`},children:[i>0&&(0,G.jsx)(`div`,{className:`absolute top-0 w-px bg-outline-variant/40`,style:{height:`14px`}}),(0,G.jsx)(`div`,{className:J(oN,`rounded-full flex items-center justify-center shrink-0 text-[10px] font-mono font-bold transition-colors z-10`,o?`bg-primary text-on-primary`:`bg-surface-container-high text-on-surface-variant border border-outline-variant/40`),children:i+1}),!a&&(0,G.jsx)(`div`,{className:`flex-1 w-px bg-outline-variant/40`})]}),(0,G.jsxs)(Q,{level:`low`,className:J(`flex-1 overflow-hidden rounded-md max-w-full border border-outline-variant/10 mb-2`,e.kind===`recovered`&&`opacity-60 border-dashed`),children:[(0,G.jsxs)(`button`,{type:`button`,className:J(`flex w-full items-start gap-3 px-4 py-3 text-left transition-colors overflow-hidden`,`hover:bg-surface-container/40`,o&&`bg-surface-container/20`),onClick:()=>s(e=>!e),"aria-expanded":o,children:[o?(0,G.jsx)($i,{className:`mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform`}):(0,G.jsx)(ta,{className:`mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-0.5`,children:[(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant shrink-0`,children:e.kind===`recovered`?`Recovered`:`Prompt`}),e.activity_count>0&&(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/70 shrink-0`,children:[e.activity_count,` tool call`,e.activity_count===1?``:`s`]}),e.started_at&&(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:sN(e.started_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface truncate`,children:o?e.user_prompt??`(no prompt)`:cN(e.user_prompt)})]})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out`,style:{gridTemplateRows:o?`1fr`:`0fr`},children:(0,G.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`px-4 pt-0 pb-3 overflow-hidden`,children:[e.user_prompt&&e.user_prompt.length>120&&(0,G.jsx)(kO,{content:e.user_prompt}),t.length>0&&(0,G.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3`,children:t.map((e,t)=>(0,G.jsx)(`button`,{type:`button`,className:`rounded-md overflow-hidden hover:ring-2 hover:ring-primary/40 transition-all`,onClick:()=>l(t),children:(0,G.jsx)(mN,{filePath:e.file_path,alt:e.description??e.file_path??``,className:`max-w-[200px] max-h-[140px] object-cover rounded-md`})},e.id))}),c!==null&&(0,G.jsx)(QM,{images:t.map((e,t)=>({src:u[t]??``,alt:e.description??e.file_path??``})),index:c,onNavigate:l,onClose:()=>l(null)})]}),e.activity_count>0&&(0,G.jsx)(aN,{batchId:e.id,activityCount:e.activity_count}),n.map(e=>(0,G.jsx)(lN,{child:e},e.id)),e.response_summary&&(0,G.jsx)(`div`,{className:`border-t border-[var(--ghost-border)] overflow-hidden`,children:(0,G.jsxs)(`div`,{className:`flex gap-3 px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`w-0.5 shrink-0 rounded-full bg-primary/30`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,G.jsx)(Xi,{className:`h-3 w-3 text-primary/60`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,children:`Response`})]}),(0,G.jsx)(kO,{content:e.response_summary})]})]})})]})})]})]})}var gN=3;function _N(e){let t=new Map,n=[];for(let r of e)if(r.parent_prompt_batch_id==null)n.push(r);else{let e=t.get(r.parent_prompt_batch_id)??[];e.push(r),t.set(r.parent_prompt_batch_id,e)}return n.map(e=>({parent:e,children:(t.get(e.id)??[]).sort((e,t)=>(e.started_at??0)-(t.started_at??0))}))}var vN=[`human`],yN=[`human`,`system`,`agent_dispatch`,`hook_injected`];function bN({sessionId:e}){let[t,n]=(0,W.useState)(!1),{data:r,isLoading:i}=RA(e,t?yN:vN),{data:a}=BA(e),o=a??[],{byBatchId:s,byTurnNumber:c}=(0,W.useMemo)(()=>{let e=new Map,t=new Map;for(let n of o){if(n.prompt_batch_id!=null){let t=e.get(n.prompt_batch_id)??[];t.push(n),e.set(n.prompt_batch_id,t)}if(n.turn_number!=null){let e=t.get(n.turn_number)??[];e.push(n),t.set(n.turn_number,e)}}return{byBatchId:e,byTurnNumber:t}},[o]),l=(0,W.useMemo)(()=>_N([...r??[]].sort((e,t)=>(e.started_at??0)-(t.started_at??0))),[r]);return i?(0,G.jsx)(`div`,{className:`space-y-3 pl-11`,children:Array.from({length:gN}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-16 animate-pulse rounded-md bg-surface-container-low`},t))}):l.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ha,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No prompts recorded`})]}):(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-3 flex items-center justify-end pl-11 text-xs text-on-surface-variant`,children:(0,G.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2 select-none`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`h-3 w-3 cursor-pointer accent-primary`,checked:t,onChange:e=>n(e.target.checked)}),(0,G.jsx)(`span`,{children:`Show system & sub-agent prompts`})]})}),l.map(({parent:e,children:t},n)=>(0,G.jsx)(hN,{batch:e,batchAttachments:s.get(e.id)??(e.prompt_number===null?[]:c.get(e.prompt_number)??[]),steeringChildren:t,defaultOpen:n===l.length-1,promptIndex:n,isLast:n===l.length-1},e.id))]})}var xN=`▲`,SN=`▼`;function CN(e){let t=(e.match(/- \[x\]/gi)??[]).length;return{total:t+(e.match(/- \[ \]/g)??[]).length,checked:t}}var wN={active:`bg-green-500/10 text-green-500`,completed:`bg-blue-500/10 text-blue-500`},TN=`bg-muted text-muted-foreground`;function EN({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide`,wN[e]??TN),children:e})}function DN({planId:e}){let[t,n]=(0,W.useState)(`idle`),r=(0,W.useRef)(null);(0,W.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let i=(0,W.useCallback)(()=>{navigator.clipboard?.writeText&&(r.current&&clearTimeout(r.current),navigator.clipboard.writeText(e).then(()=>{n(`copied`),r.current=setTimeout(()=>n(`idle`),1500)},()=>{n(`failed`),r.current=setTimeout(()=>n(`idle`),1500)}))},[e]);return(0,G.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),i()},title:t===`failed`?`Copy failed — check clipboard permissions`:`Copy plan ID: ${e}`,className:`inline-flex items-center gap-1 font-mono text-xs text-muted-foreground hover:text-primary transition-colors`,"aria-live":`polite`,children:[(0,G.jsx)(`span`,{children:gv(e,8)}),t===`copied`&&(0,G.jsx)(Qi,{className:`h-3 w-3 text-primary`}),t===`failed`&&(0,G.jsx)(So,{className:`h-3 w-3 text-error`}),t===`idle`&&(0,G.jsx)(pa,{className:`h-3 w-3`})]})}function ON({plan:e,initialExpanded:t=!1,isDeleting:n=!1,onDelete:r}){let[i,a]=(0,W.useState)(t),o=(0,W.useMemo)(()=>e.content?CN(e.content):null,[e.content]),s=o!==null&&o.total>0,c=s?Math.round(o.checked/o.total*100):0,l=!!e.content,u=()=>{l&&a(e=>!e)};return(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/50 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:J(`flex items-start gap-3 p-4`,l&&`cursor-pointer hover:bg-muted/70 transition-colors`),onClick:l?u:void 0,onKeyDown:l?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u())}:void 0,role:l?`button`:void 0,tabIndex:l?0:void 0,"aria-expanded":l?i:void 0,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(EN,{status:e.status}),e.title&&(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface truncate`,children:e.title})]}),e.source_path&&(0,G.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground truncate`,title:e.source_path,children:e.source_path}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 font-sans text-xs text-muted-foreground`,children:[(0,G.jsx)(DN,{planId:e.id}),(0,G.jsxs)(`span`,{children:[`Created `,mv(e.created_at)]}),e.updated_at&&e.updated_at!==e.created_at&&(0,G.jsxs)(`span`,{title:hv(e.updated_at),children:[`Updated `,mv(e.updated_at)]})]}),s&&(0,G.jsxs)(`div`,{className:`space-y-1 pt-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between font-sans text-xs text-muted-foreground`,children:[(0,G.jsxs)(`span`,{children:[o.checked,`/`,o.total,` items`]}),(0,G.jsxs)(`span`,{children:[c,`%`]})]}),(0,G.jsx)(`div`,{className:`h-1.5 rounded-full bg-border overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-all`,style:{width:`${c}%`}})})]})]}),(l||r)&&(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r&&(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),r(e.id)},className:`text-xs text-muted-foreground hover:text-destructive transition-colors cursor-pointer disabled:opacity-50`,disabled:n,"aria-label":`Delete plan`,children:n?`Deleting...`:`Delete`}),l&&(0,G.jsx)(`span`,{className:`mt-0.5 text-xs text-muted-foreground`,"aria-hidden":`true`,children:i?xN:SN})]})]}),i&&e.content&&(0,G.jsx)(`div`,{className:`border-t border-border px-4 py-3`,children:(0,G.jsx)(kO,{content:e.content,className:`text-sm`})})]})}function kN({sessionId:e,expandedPlanId:t}){let{data:n,isLoading:r,isError:i}=WA(e),a=GA(e),[o,s]=(0,W.useState)(null);async function c(){if(o)try{await a.mutateAsync(o.id),s(null)}catch{s(null)}}return r?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`Loading plans...`})}):i?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`Failed to load plans.`})}):!n||n.length===0?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center rounded-lg border border-border bg-muted/30`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`No plans captured for this session`})}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[a.isError&&(0,G.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 font-sans text-sm text-destructive`,children:`Failed to delete plan.`}),n.map(e=>(0,G.jsx)(ON,{plan:e,initialExpanded:e.status===`in_progress`||String(e.id)===t,isDeleting:a.isPending&&o?.id===e.id,onDelete:()=>s(e)},e.id)),(0,G.jsx)(AM,{open:o!==null,onOpenChange:e=>{e||s(null)},title:`Delete Plan`,description:`This will permanently remove this captured plan from the session.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-tertiary`}),meta:o?[{label:`Status`,value:o.status},{label:`Title`,value:o.title||o.source_path||o.id}]:[],confirmLabel:`Delete Plan`,variant:`destructive`,onConfirm:c,isPending:a.isPending})]})}var AN=15e3,jN=3e4,MN=3e4,NN=6e4;function PN(e){let t=new URLSearchParams;e?.type&&t.set(`type`,e.type),e?.status&&t.set(`status`,e.status),e?.search&&t.set(`search`,e.search),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset)),e?.session_id&&t.set(`session_id`,e.session_id);let n=t.toString(),r=n?`/spores?${n}`:`/spores`;return As({queryKey:[`spores`,e],queryFn:({signal:e})=>q(r,{signal:e}),staleTime:AN,pollCategory:`standard`,refetchInterval:js.SPORES})}function FN(e){return ot({queryKey:Es([`spore`,e]),queryFn:({signal:t})=>q(`/spores/${e}`,{signal:t}),enabled:e!==void 0,staleTime:jN})}function IN(e,t=1,n=!0){return ot({queryKey:Es([`graph`,e,t]),queryFn:({signal:n})=>q(`/graph/${e}?depth=${t}`,{signal:n}),enabled:n&&e!==void 0,staleTime:MN})}function LN(e=!0){return ot({queryKey:Es([`full-graph`]),queryFn:({signal:e})=>q(`/graph`,{signal:e}),enabled:e,staleTime:MN})}function RN(){return ot({queryKey:Es([`graph-seeds`]),queryFn:({signal:e})=>q(`/graph/seeds`,{signal:e}),staleTime:MN})}function zN(e){let t=e?`/digest?agent_id=${encodeURIComponent(e)}`:`/digest`;return ot({queryKey:Es([`digest`,e]),queryFn:({signal:e})=>q(t,{signal:e}),staleTime:NN})}var BN=200,VN={decision:`default`,discovery:`default`,wisdom:`default`,architecture:`default`,trade_off:`secondary`,"cross-cutting":`secondary`,pattern:`secondary`,gotcha:`destructive`,bug_fix:`destructive`},HN={active:`default`,superseded:`outline`,consolidated:`outline`,obsolete:`outline`};function UN({spore:e}){let[t,n]=(0,W.useState)(!1),r=VN[e.observation_type]??`secondary`,i=HN[e.status]??`outline`,a=e.status!==`active`,o=e.content.split(`
|
|
83
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return yE(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=gD.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function ED(){return{exit:{taskListCheckValueChecked:OD,taskListCheckValueUnchecked:OD,paragraph:kD}}}function DD(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:AD}}}function OD(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function kD(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function AD(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=gD.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function jD(){return[LT(),sE(),fE(),_D(),ED()]}function MD(e){return{extensions:[RT(),cE(e),pE(),TD(e),DD()]}}var ND={tokenize:qD,partial:!0},PD={tokenize:JD,partial:!0},FD={tokenize:YD,partial:!0},ID={tokenize:XD,partial:!0},LD={tokenize:ZD,partial:!0},RD={name:`wwwAutolink`,tokenize:GD,previous:QD},zD={name:`protocolAutolink`,tokenize:KD,previous:$D},BD={name:`emailAutolink`,tokenize:WD,previous:eO},VD={};function HD(){return{text:VD}}for(var UD=48;UD<123;)VD[UD]=BD,UD++,UD===58?UD=65:UD===91&&(UD=97);VD[43]=BD,VD[45]=BD,VD[46]=BD,VD[95]=BD,VD[72]=[BD,zD],VD[104]=[BD,zD],VD[87]=[BD,RD],VD[119]=[BD,RD];function WD(e,t,n){let r=this,i,a;return o;function o(t){return!tO(t)||!eO.call(r,r.previous)||nO(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return tO(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(LD,u,l)(t):t===45||t===95||Lb(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&Ib(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function GD(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!QD.call(r,r.previous)||nO(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(ND,e.attempt(PD,e.attempt(FD,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function KD(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&$D.call(r,r.previous)&&!nO(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Ib(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||zb(t)||Wb(t)||qb(t)||Kb(t)?n(t):e.attempt(PD,e.attempt(FD,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function qD(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function JD(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(ID,c,s)(t):t===null||Wb(t)||qb(t)||t!==45&&Kb(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function YD(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(ID,t,a)(o):o===null||Wb(o)||qb(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function XD(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||Wb(o)||qb(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Wb(e)||qb(e)?t(e):r(e)}function a(e){return Ib(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Ib(t)?(e.consume(t),o):n(t)}}function ZD(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Lb(e)?n(e):t(e)}}function QD(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Wb(e)}function $D(e){return!Ib(e)}function eO(e){return!(e===47||tO(e))}function tO(e){return e===43||e===45||e===46||e===95||Lb(e)}function nO(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var rO={tokenize:dO,partial:!0};function iO(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:cO,continuation:{tokenize:lO},exit:uO}},text:{91:{name:`gfmFootnoteCall`,tokenize:sO},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:aO,resolveTo:oO}}}}function aO(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Fb(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function oO(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function sO(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Wb(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Fb(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Wb(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function cO(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Wb(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Fb(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Wb(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Xb(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function lO(e,t,n){return e.check(dx,t,e.attempt(rO,t,n))}function uO(e){e.exit(`gfmFootnoteDefinition`)}function dO(e,t,n){let r=this;return Xb(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function fO(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Ob(o,o.length,0,ix(s,e.slice(r+1,n),t)),Ob(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Ob(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=rx(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=rx(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var pO=class{constructor(){this.map=[]}add(e,t,n){mO(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function mO(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function hO(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function gO(){return{flow:{null:{name:`table`,tokenize:_O,resolveAll:vO}}}}function _O(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Ub(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Gb(t)?Xb(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Wb(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Gb(t)?Xb(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Gb(t)?Xb(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Ub(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Gb(t)?Xb(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Ub(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Ub(n)?(e.exit(`tableRow`),t(n)):Gb(n)?Xb(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Wb(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function vO(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new pO;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(bO(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=yO(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=yO(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=yO(f,t,o,i,n,d)):(o[0]=o[1],d=yO(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&bO(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=hO(t.events,n))}return e}function yO(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},xO(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=xO(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=xO(t.events,n[2]),a=xO(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},xO(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function bO(e,t,n,r,i){let a=[],o=xO(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function xO(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var SO={name:`tasklistCheck`,tokenize:wO};function CO(){return{text:{91:SO}}}function wO(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Wb(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Ub(r)?t(r):Gb(r)?e.check({tokenize:TO},t,n)(r):n(r)}}function TO(e,t,n){return Xb(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function EO(e){return jb([HD(),iO(),fO(e),gO(),CO()])}var DO={};function OO(e){let t=this,n=e||DO,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(EO(n)),a.push(jD()),o.push(MD(n))}function kO({content:e,className:t,compact:n=!1}){return(0,G.jsx)(`div`,{className:J(n?`prose-myco-compact`:`prose-myco`,t),children:(0,G.jsx)(wT,{remarkPlugins:[OO],children:e})})}var AO={info:`bg-primary`,success:`bg-green-500`,warning:`bg-secondary`,error:`bg-tertiary`},jO={info:Ma,success:oa,warning:_o,error:ra},MO={unread:`New`,read:`Earlier`},NO=`notification-panel`;function PO(e){let t=Math.floor(Date.now()/1e3)-e;if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function FO({title:e,count:t}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-on-surface-variant`,children:e}),(0,G.jsx)(`span`,{className:`text-[11px] text-on-surface-variant/70`,children:t})]})}function IO({notification:e,onOpen:t,onDismiss:n}){let r=jO[e.level],i=e.status===`unread`;return(0,G.jsx)(`div`,{onClick:()=>t(e),className:J(`group cursor-pointer rounded-lg border border-transparent px-4 py-3 transition-colors hover:border-outline-variant/20 hover:bg-surface-container-high/70`,i&&`border-primary/10 bg-primary/[0.04]`),children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative mt-0.5 shrink-0`,children:[(0,G.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-surface-container-high text-on-surface-variant`,children:(0,G.jsx)(r,{className:`h-4 w-4`})}),i&&(0,G.jsx)(`span`,{className:J(`absolute -top-0.5 -right-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-surface-container`,AO[e.level])})]}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:J(`text-sm font-medium`,i?`text-on-surface`:`text-on-surface-variant`),children:e.title}),(0,G.jsx)(`span`,{className:`rounded-full bg-surface-container-high px-2 py-0.5 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e.domain})]}),e.message&&(0,G.jsx)(kO,{content:e.message,compact:!0,className:`line-clamp-3 text-xs leading-5 text-on-surface-variant`})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[(0,G.jsx)(`span`,{className:`pt-0.5 text-[10px] font-mono text-on-surface-variant/70`,children:PO(e.created_at)}),(0,G.jsx)(`button`,{onClick:t=>n(t,e),className:`rounded p-0.5 text-on-surface-variant/40 opacity-0 transition hover:text-on-surface-variant group-hover:opacity-100`,"aria-label":`Dismiss`,children:(0,G.jsx)(So,{className:`h-3.5 w-3.5`})})]})]})})]})})}function LO({open:e,onClose:t}){let{data:n,refetch:r}=jv({limit:50,enabled:e,pollCategory:`realtime`,refetchInterval:js.LOGS}),i=Nv(),a=Fv(),o=Pv(),s=Nn();(0,W.useEffect)(()=>{e&&r()},[e,r]),(0,W.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]);let c=(0,W.useCallback)(e=>{e.status===`unread`&&i.mutate({id:e.id,status:`read`}),e.link&&(s(e.link,{state:{source:NO,triggeredAt:Date.now()}}),t())},[i,s,t]),l=(0,W.useCallback)((e,t)=>{e.stopPropagation(),i.mutate({id:t.id,status:`dismissed`})},[i]),u=(n?.items??[]).filter(e=>e.status!==`dismissed`),d=n?.unread_count??0,f=u.filter(e=>e.status===`unread`),p=u.filter(e=>e.status!==`unread`);return(0,G.jsxs)(G.Fragment,{children:[e&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-40 bg-surface-dim/40 backdrop-blur-xs transition-opacity`,onClick:t,"aria-hidden":`true`}),(0,G.jsxs)(`aside`,{className:J(`fixed top-0 right-0 bottom-0 z-50 flex w-96 max-w-[calc(100vw-3rem)] flex-col border-l border-outline-variant/20 bg-surface-container shadow-2xl transition-transform duration-200 ease-out`,e?`translate-x-0`:`translate-x-full`),children:[(0,G.jsxs)(`div`,{className:`border-b border-outline-variant/20 px-4 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ji,{className:`h-4 w-4 shrink-0 text-primary`}),(0,G.jsx)(`h2`,{className:`min-w-0 text-sm font-medium text-on-surface`,children:`Notifications`}),d>0&&(0,G.jsx)(`span`,{className:`inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-primary/15 px-1.5 text-xs font-medium text-primary`,children:d})]})}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 shrink-0 px-2`,children:(0,G.jsx)(So,{className:`h-4 w-4`})})]}),(d>0||u.length>0)&&(0,G.jsxs)(`div`,{className:`mt-3 flex items-center justify-end gap-1 border-t border-outline-variant/10 pt-3`,children:[d>0&&(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:e=>{e.stopPropagation(),a.mutate(void 0)},title:`Mark all as read`,className:`h-7 gap-1 px-2 text-xs text-on-surface-variant`,children:[(0,G.jsx)(za,{className:`h-3.5 w-3.5`}),`Mark all read`]}),u.length>0&&(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:e=>{e.stopPropagation(),o.mutate(void 0)},title:`Clear all notifications`,className:`h-7 gap-1 px-2 text-xs text-on-surface-variant`,children:[(0,G.jsx)(ho,{className:`h-3.5 w-3.5`}),`Clear`]})]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:u.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,G.jsx)(Ji,{className:`h-5 w-5 text-on-surface-variant/50`}),(0,G.jsx)(`div`,{className:`text-sm text-on-surface-variant`,children:`No notifications yet`}),(0,G.jsx)(`div`,{className:`text-xs text-on-surface-variant/70`,children:`New events will appear here whether they display as banners or summary-only items.`})]}):(0,G.jsxs)(`div`,{className:`space-y-4 px-3 py-3`,children:[f.length>0&&(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(FO,{title:MO.unread,count:f.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:f.map(e=>(0,G.jsx)(IO,{notification:e,onOpen:c,onDismiss:l},e.id))})]}),p.length>0&&(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(FO,{title:MO.read,count:p.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:p.map(e=>(0,G.jsx)(IO,{notification:e,onOpen:c,onDismiss:l},e.id))})]})]})})]})]})}function RO(e){return Array.isArray(e)?e:e?e.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(e=>e.length>0):[]}function zO(e,t){let n=RO(t),r=e;for(let e of n){if(r==null)return;if(Array.isArray(r)){let t=Number(e);if(!Number.isInteger(t))return;r=r[t];continue}if(typeof r!=`object`)return;r=r[e]}return r}function BO(e,t,n){let r=RO(t);if(r.length===0)return;let i=e;for(let e=0;e<r.length-1;e+=1){let t=r[e],n=i[t];(typeof n!=`object`||!n||Array.isArray(n))&&(i[t]={}),i=i[t]}i[r[r.length-1]]=n}var VO=[`grove-config`];function HO(e){return[...VO,e??`none`]}function UO(){let e=Ss(),t=e?.grove.id??null,n=ko(e);return ot({queryKey:HO(t),queryFn:({signal:e})=>q(`/grove-config`,{signal:e,headers:n}),enabled:t!==null})}function WO(){let e=We(),t=Ss(),n=t?.grove.id??null,r=ko(t);return st({mutationFn:({patch:e,clear:t})=>ss(`/grove-config`,{patch:e,clear:t},{headers:r}),onSuccess:()=>{e.invalidateQueries({queryKey:HO(n)}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}var GO=[`machine-config`];function KO(){return As({queryKey:[...GO],queryFn:({signal:e})=>q(`/machine-config`,{signal:e}),refetchInterval:!1,pollCategory:`standard`,contextFree:!0})}function qO(){let e=We();return st({mutationFn:({patch:e,clear:t})=>ss(`/machine-config`,{patch:e,clear:t}),onSuccess:t=>{e.setQueryData([...GO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}function JO(){let e=We();return st({mutationFn:({path:e,value:t})=>ss(`/machine-config`,{addToList:[{path:e,values:[t]}]}),onSuccess:t=>{e.setQueryData([...GO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}function YO(){let e=We();return st({mutationFn:({path:e,value:t})=>ss(`/machine-config`,{removeFromList:[{path:e,values:[t]}]}),onSuccess:t=>{e.setQueryData([...GO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}var XO=[`config`,`merged`],ZO=[`config`,`local`],QO=[`notifications`];function $O(e){let t=We(),n=WO(),r=qO(),i=e?zo(e):`none`,a=(0,W.useMemo)(()=>ko(e),[e?.grove.id,e?.project.project_id]),o=ot({queryKey:[...XO,i],queryFn:({signal:e})=>us(e,a)}),s=ot({queryKey:[...ZO,i],queryFn:({signal:e})=>ds(e,a)}),c=(0,W.useRef)(o.data);c.current=o.data;let l=(0,W.useRef)(s.data);l.current=s.data;let u=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:QO})},[t]),d=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:ZO}),t.invalidateQueries({queryKey:XO}),u()},[u,t]),f=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:XO}),u()},[u,t]),p=(0,W.useCallback)(e=>e===`local`?d():f(),[d,f]),m=(0,W.useCallback)(async(e,t,i)=>{if(t===void 0){i===`grove`?(await n.mutateAsync({clear:[e]}),u()):i===`machine`?(await r.mutateAsync({clear:[e]}),u()):(await fs(i,{},[e],a),p(i));return}let o={};BO(o,e,t),i===`grove`?(await n.mutateAsync({patch:o}),u()):i===`machine`?(await r.mutateAsync({patch:o}),u()):(await fs(i,o,void 0,a),p(i))},[a,p,u,n,r]),h=(0,W.useCallback)(async(e,t,i)=>{let o={},s=[...i??[]];for(let{path:t,value:n}of e)n===void 0?s.push(t):BO(o,t,n);t===`grove`?(await n.mutateAsync({patch:o,clear:s.length>0?s:void 0}),u()):t===`machine`?(await r.mutateAsync({patch:o,clear:s.length>0?s:void 0}),u()):(await fs(t,o,s.length>0?s:void 0,a),p(t))},[a,p,u,n,r]),g=(0,W.useCallback)(async e=>{await ps([e],a),d()},[a,d]),_=(0,W.useCallback)(async e=>{e.length!==0&&(await ps(e,a),d())},[a,d]),v=(0,W.useCallback)(e=>zO(l.current??{},e)!==void 0,[]),y=(0,W.useCallback)(async(e,n,r)=>{if(r===`machine`){let r=await ss(`/machine-config`,{addToList:[{path:e,values:[n]}]});t.setQueryData([`machine-config`],{config:r}),t.invalidateQueries({queryKey:[`config`,`merged`]});return}let i=zO(c.current??{},e),a=Array.isArray(i)?i:[];a.includes(n)||await m(e,[...a,n],r)},[t,m]),b=(0,W.useCallback)(async(e,n,r)=>{if(r===`machine`){let r=await ss(`/machine-config`,{removeFromList:[{path:e,values:[n]}]});t.setQueryData([`machine-config`],{config:r}),t.invalidateQueries({queryKey:[`config`,`merged`]});return}let i=zO(c.current??{},e);await m(e,(Array.isArray(i)?i:[]).filter(e=>e!==n),r)},[t,m]);return{effective:o.data,local:s.data??{},isLoading:o.isLoading||s.isLoading,isLocalOverride:v,setField:m,setFields:h,resetField:g,resetFields:_,addToConfigList:y,removeFromConfigList:b}}function ek(){return $O(Ss())}function tk(){let{effective:e}=ek(),t=e?.notifications?.system_notifications??!1,{data:n,refetch:r}=jv({status:`unread`,mode:`banner`,limit:5,enabled:t,pollCategory:`heartbeat`,refetchInterval:js.PROGRESS,includeDaemon:!0}),i=(0,W.useRef)(new Set);return(0,W.useEffect)(()=>{t&&`Notification`in window&&Notification.permission==="default"&&Notification.requestPermission()},[t]),(0,W.useEffect)(()=>{if(!t||!(`Notification`in window)||Notification.permission!==`granted`||document.hasFocus())return;let e=n?.items??[];for(let t of e)i.current.has(t.id)||(i.current.add(t.id),nk(t))},[t,n]),(0,W.useEffect)(()=>{if(!t)return;let e=()=>{(document.hidden||!document.hasFocus())&&r()};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`blur`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`blur`,e)}},[t,r]),null}function nk(e){try{new window.Notification(e.title,{body:e.message??void 0,tag:e.id,icon:`/favicon.svg`})}catch{}}var rk=[`sage`,`moss`,`terracotta`,`dusk`,`plum`,`slate`],ik=[`light`,`dark`,`system`],ak=[`default`,`geist-mono`,`system`,`sf-mono`,`fira-code`,`jetbrains-mono`],ok=[`compact`,`normal`,`comfy`],sk=`myco-appearance`,ck={compact:.85,normal:1,comfy:1.15},lk={default:{heading:`'Newsreader', Georgia, serif`,ui:`'Inter', system-ui, sans-serif`,data:`'JetBrains Mono', 'Fira Code', monospace`},"geist-mono":{heading:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`,ui:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`,data:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`},system:{heading:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`,ui:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`,data:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`},"sf-mono":{heading:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`,ui:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`,data:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`},"fira-code":{heading:`'Fira Code', 'Fira Mono', ui-monospace, monospace`,ui:`'Fira Code', 'Fira Mono', ui-monospace, monospace`,data:`'Fira Code', 'Fira Mono', ui-monospace, monospace`},"jetbrains-mono":{heading:`'JetBrains Mono', ui-monospace, monospace`,ui:`'JetBrains Mono', ui-monospace, monospace`,data:`'JetBrains Mono', ui-monospace, monospace`}},uk=`(prefers-color-scheme: light)`;function dk(e){let t=document.documentElement;t.setAttribute(`data-theme`,e.theme);let n=e.mode===`system`?window.matchMedia(uk).matches?`light`:`dark`:e.mode;t.classList.toggle(`light`,n===`light`);let r=lk[e.font];t.style.setProperty(`--font-heading`,r.heading),t.style.setProperty(`--font-ui`,r.ui),t.style.setProperty(`--font-data`,r.data);let i=ck[e.density];t.style.setProperty(`--density`,String(i)),t.style.fontSize=`calc(14px * ${i})`;let a=document.querySelector(`link[rel="icon"]`);if(a){let t=`/favicon-${e.theme}.svg`;a.href.endsWith(t)||(a.href=t)}}function fk(e){try{localStorage.setItem(sk,JSON.stringify(e))}catch{}}function pk(){let e=null;try{e=localStorage.getItem(sk)}catch{return}if(e)try{dk(JSON.parse(e))}catch{try{localStorage.removeItem(sk)}catch{}}}var mk=(0,W.createContext)(null),hk={theme:`sage`,mode:`dark`,font:`default`,density:`normal`},gk=`(prefers-color-scheme: light)`;function _k({children:e}){let{effective:t,setField:n}=ek(),r=(0,W.useMemo)(()=>t?.appearance??hk,[t?.appearance]),i=(0,W.useRef)(r);i.current=r,(0,W.useLayoutEffect)(()=>{t?.appearance&&(dk(r),fk(r))},[r,t?.appearance]),(0,W.useEffect)(()=>{if(r.mode!==`system`)return;let e=window.matchMedia(gk),t=()=>dk(r);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[r]);let a=(0,W.useCallback)(async(e,t)=>{let r=i.current,a={...r,[e]:t};dk(a),fk(a);try{await n(`appearance.${e}`,t,`grove`)}catch(e){throw dk(r),fk(r),e}},[n]),o=(0,W.useMemo)(()=>({effective:r,set:a}),[r,a]);return(0,G.jsx)(mk.Provider,{value:o,children:e})}function vk(){let e=(0,W.useContext)(mk);if(!e)throw Error(`useAppearance must be used inside AppearanceProvider`);return e}var yk=[`cortex`,`canopy`,`skills`,`vault_evolution`],bk={capture:{home:`machine`,overridableBy:[]},machine_id:{home:`machine`,overridableBy:[]},"daemon.stale_session_threshold_ms":{home:`grove`,overridableBy:[]},"daemon.log_level":{home:`machine`,overridableBy:[]},"daemon.log_retention_days":{home:`machine`,overridableBy:[]},"daemon.update_channel":{home:`machine`,overridableBy:[]},"update.channel":{home:`machine`,overridableBy:[]},notifications:{home:`machine`,overridableBy:[`local`]},embedding:{home:`grove`,overridableBy:[]},appearance:{home:`grove`,overridableBy:[]},team:{home:`grove`,overridableBy:[]},agent:{home:`grove`,overridableBy:[`local`]},"agent.scheduled_tasks_enabled":{home:`grove`,overridableBy:[]},"agent.event_tasks_enabled":{home:`grove`,overridableBy:[]},"agent.run_retention_days":{home:`grove`,overridableBy:[]},skills:{home:`grove`,overridableBy:[`local`],gate:`skills`},vault_evolution:{home:`grove`,overridableBy:[`local`],gate:`vault_evolution`},maintenance:{home:`grove`,overridableBy:[`local`]},backup:{home:`grove`,overridableBy:[]},release_provenance:{home:`project`,overridableBy:[]},"release_provenance.reconcile_interval_minutes":{home:`grove`,overridableBy:[`project`,`local`]},cortex:{home:`project`,overridableBy:[`local`],gate:`cortex`},"cortex.canopy":{home:`project`,overridableBy:[`local`],gate:`canopy`},symbionts:{home:`project`,overridableBy:[`local`]},version:{home:`project`,overridableBy:[]},config_version:{home:`project`,overridableBy:[]}},xk=Object.keys(bk).sort((e,t)=>t.length-e.length);function Sk(e){for(let t of xk)if(e===t||e.startsWith(`${t}.`))return bk[t];throw Error(`No scope registry entry for config path: ${e}`)}var Ck={machine:`Machine`,grove:`Grove`,project:`Project`,local:`Personal`},wk={machine:`Every Grove on this machine`,grove:`Every project in this Grove`,project:`This project, shared via the repo`,local:`Personal — this project, on this machine (not shared via git)`},Tk={personal:`Personal`,project:`Project`,grove:`Grove`,"all-groves":`All Groves`,machine:`Machine`},Ek={personal:`This setting is overridden on this machine`,project:`This setting is using the shared project value`,grove:`This setting applies to every project in this Grove`,"all-groves":`This view aggregates every Grove on this machine`,machine:`This setting applies to every Grove on this machine`},Dk={personal:`border-sage/40 bg-sage/5 text-sage`,project:`border-[var(--ghost-border)] bg-surface-container/40 text-on-surface-variant`,grove:`border-ochre/40 bg-ochre/5 text-ochre`,"all-groves":`border-terracotta/40 bg-terracotta/5 text-terracotta`,machine:`border-terracotta/40 bg-terracotta/5 text-terracotta`};function Ok({scope:e}){let t=Tk[e];return(0,G.jsxs)(`span`,{title:Ek[e],className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${Dk[e]}`,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full ${e===`personal`?`bg-sage`:`bg-outline-variant/80`}`,"aria-hidden":!0}),t]})}var kk={machine:`machine`,grove:`grove`,project:`project`,local:`personal`};function Ak({path:e,hasLocalOverride:t,onSavePersonal:n,onReset:r}){let[i,a]=(0,W.useState)(!1),o=(0,W.useRef)(null);(0,W.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=Sk(e),c=kk[s.home]??`project`,l=t?`personal`:c,u=t?Ek.personal:wk[s.home]??Ek[c],d=Ck[s.home]??Tk[c];return(0,G.jsxs)(`span`,{ref:o,className:`relative inline-block`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-haspopup":`menu`,"aria-expanded":i,title:u,className:`cursor-pointer transition-colors hover:bg-sage/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 rounded-sm`,children:(0,G.jsx)(Ok,{scope:l})}),i&&(0,G.jsx)(`div`,{role:`menu`,className:`absolute left-0 top-full z-10 mt-1 w-44 rounded-md border border-[var(--ghost-border)] bg-surface-container-high p-1 text-xs shadow-lg`,children:t?(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r(),a(!1)},className:`block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest focus-visible:outline-none focus-visible:bg-surface-container-highest`,children:[`Reset to `,d]}):(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{n(),a(!1)},className:`block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest focus-visible:outline-none focus-visible:bg-surface-container-highest`,children:`Save Personal`})})]})}var jk={sage:{label:`Sage`,swatch:`#abcfb8`},moss:{label:`Moss`,swatch:`#9ca884`},terracotta:{label:`Terracotta`,swatch:`#d28a73`},dusk:{label:`Dusk`,swatch:`#8faed1`},plum:{label:`Plum`,swatch:`#b59ec8`},slate:{label:`Slate`,swatch:`#a6b0b8`}},Mk={light:{icon:fo,label:`Light`},dark:{icon:Wa,label:`Dark`},system:{icon:Ua,label:`System`}},Nk={default:`Default`,"geist-mono":`Geist`,system:`System`,"sf-mono":`SF Mono`,"fira-code":`Fira Code`,"jetbrains-mono":`JetBrains`},Pk=`myco-ui-appearance-expanded`;function Fk(){let e=typeof window<`u`?localStorage.getItem(Pk):null;return e===null?!0:e===`true`}function Ik({collapsed:e}){let{effective:t,set:n}=vk(),[r,i]=(0,W.useState)(Fk);(0,W.useEffect)(()=>{localStorage.setItem(Pk,String(r))},[r]);let a=(e,t)=>{n(e,t).catch(e=>console.error(`[appearance] grove write failed`,e))};if(e)return null;let o=(e,t,n)=>(0,G.jsxs)(`div`,{id:Fi(`appearance.${t}`),"data-config-field":`appearance.${t}`,className:`rounded-md transition-all duration-300`,children:[(0,G.jsxs)(`div`,{className:`flex items-center text-xs text-on-surface-variant`,children:[e,(0,G.jsx)(Ok,{scope:`grove`})]}),n]});return(0,G.jsxs)(`div`,{id:Pi.appearance,className:`rounded-md border border-[var(--ghost-border)] p-3 ${r?`space-y-3`:``}`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`-m-1 flex flex-1 items-center gap-1.5 rounded p-1 text-left hover:bg-surface-container-high`,"aria-expanded":r,"aria-label":r?`Collapse appearance section`:`Expand appearance section`,children:[(0,G.jsx)($i,{className:`h-3 w-3 text-on-surface-variant transition-transform ${r?``:`-rotate-90`}`}),(0,G.jsx)(`h3`,{className:`text-[10px] uppercase tracking-[0.22em] text-on-surface-variant`,children:`Appearance`})]})}),r&&(0,G.jsxs)(G.Fragment,{children:[o(`Color theme`,`theme`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-6 gap-1.5`,children:rk.map(e=>{let n=jk[e];return(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(`theme`,e),title:n.label,"aria-label":n.label,className:`relative aspect-square rounded-md border ${t.theme===e?`border-primary`:`border-[var(--ghost-border)]`}`,style:{backgroundColor:n.swatch},children:t.theme===e&&(0,G.jsx)(Qi,{className:`absolute inset-0 m-auto h-3 w-3 text-on-surface`})},e)})})),o(`Mode`,`mode`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-3 gap-1.5`,children:ik.map(e=>{let{icon:n,label:r}=Mk[e];return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>a(`mode`,e),className:`flex items-center justify-center gap-1 rounded-md border py-1 text-xs ${t.mode===e?`border-primary text-on-surface`:`border-[var(--ghost-border)] text-on-surface-variant`}`,"aria-label":r,children:[(0,G.jsx)(n,{className:`h-3 w-3`}),` `,r]},e)})})),o(`Font`,`font`,(0,G.jsx)(`select`,{value:t.font,onChange:e=>a(`font`,e.target.value),className:`mt-2 h-8 w-full rounded-md border border-[var(--ghost-border)] bg-[var(--surface-container-lowest)] px-2 text-xs`,children:ak.map(e=>(0,G.jsx)(`option`,{value:e,children:Nk[e]},e))})),o(`Density`,`density`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-3 gap-1.5`,children:ok.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(`density`,e),className:`rounded-md border py-1 text-xs capitalize ${t.density===e?`border-primary text-on-surface`:`border-[var(--ghost-border)] text-on-surface-variant`}`,children:e},e))}))]})]})}function Lk(){return As({queryKey:[`git-identity`],queryFn:({signal:e})=>q(`/git/status`,{signal:e}),refetchInterval:js.GIT_IDENTITY,pollCategory:`standard`})}function Rk(e){if(!e)return`?`;let t=e.trim();if(!t)return`?`;let n=t.split(/\s+/),r=n[0]??``;if(n.length===1)return r.slice(0,2).toUpperCase();let i=n[n.length-1]??``;return((r[0]??``)+(i[0]??``)).toUpperCase()}function zk({data:e,isPending:t,isError:n,to:r,className:i}){if(t||n||!e)return(0,G.jsxs)(`button`,{type:`button`,disabled:!0,"data-testid":`git-identity-pill`,className:J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 text-on-surface-variant`,i),title:n?`Failed to load git state`:`Loading git state`,children:[(0,G.jsx)(ka,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{className:`font-mono text-xs`,children:`—`})]});let a=Rk(e.author),o=`${e.author} <${e.author_email}> · ${e.branch}${e.dirty?` (dirty)`:``}`,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ka,{className:`h-3 w-3 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex flex-col items-start leading-tight`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:e.branch}),(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant inline-flex items-center gap-1`,children:[e.dirty&&(0,G.jsx)(`span`,{title:`working tree dirty`,className:`text-secondary`,children:`●`}),e.ahead>0&&(0,G.jsxs)(`span`,{title:`ahead of upstream`,children:[`↑`,e.ahead]}),e.behind>0&&(0,G.jsxs)(`span`,{title:`behind upstream`,children:[`↓`,e.behind]}),(0,G.jsx)(`span`,{children:e.author})]})]}),(0,G.jsx)(`span`,{className:`ml-1 inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary/20 font-sans text-[10px] font-semibold text-primary`,children:a})]}),c=J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 no-underline hover:bg-surface-container-high transition-colors`,i);return r?(0,G.jsx)(ri,{to:r,title:`${o}. Open release provenance settings.`,"data-testid":`git-identity-pill`,className:c,children:s}):(0,G.jsx)(`button`,{type:`button`,title:o,"data-testid":`git-identity-pill`,className:c,children:s})}var Bk={sage:`bg-primary`,ochre:`bg-secondary`,terracotta:`bg-tertiary`,outline:`bg-outline-variant`};function Vk({tone:e,pulse:t=!1,sizePx:n=6,className:r}){return(0,G.jsx)(`span`,{"data-testid":`status-dot`,"data-tone":e,"data-pulsing":t?`true`:`false`,className:J(`inline-block rounded-full`,Bk[e],t&&`animate-pulse`,r),style:{width:n,height:n},"aria-hidden":!0})}var Hk=[`upgrade-status`];function Uk(){return As({queryKey:[...Hk],queryFn:({signal:e})=>q(`/upgrade/status`,{signal:e}),refetchInterval:js.UPDATE,pollCategory:`standard`,contextFree:!0})}function Wk(){let e=We();return st({mutationFn:()=>os(`/upgrade/check`),onSuccess:()=>{e.invalidateQueries({queryKey:[...Hk]})}})}function Gk(){return st({mutationFn:()=>os(`/upgrade/apply`)})}function Kk(){let e=We();return st({mutationFn:e=>ss(`/upgrade/channel`,{channel:e}),onSuccess:()=>{e.invalidateQueries({queryKey:[...Hk]})}})}function qk(e){return e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function Jk(e){return e.startsWith(`v`)?e:`v${e}`}function Yk({uptimeSeconds:e,version:t,updateAvailable:n=!1,latestVersion:r,to:i,className:a}){let o=n&&r?`Daemon uptime · update available: ${Jk(r)}`:t?`Daemon uptime · ${Jk(t)}`:`Daemon uptime`,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vk,{tone:n?`ochre`:`sage`,pulse:n}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`daemon`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:e===void 0?`—`:qk(e)}),t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-on-surface-variant`,children:`·`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:Jk(t)})]})]}),c=J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 no-underline`,i&&`hover:bg-surface-container-high transition-colors`,a);return i?(0,G.jsx)(ri,{to:i,className:c,title:`${o}. Open update settings.`,"aria-live":`polite`,children:s}):(0,G.jsx)(`div`,{className:J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1`,a),title:o,"aria-live":`polite`,children:s})}function Xk({to:e,className:t}){let{data:n}=Bs(),r=Uk(),i=!!(r.data&&!r.data.exempt&&(r.data.update_available||r.data.revert_available));return(0,G.jsx)(Yk,{uptimeSeconds:n?.daemon.uptime_seconds,version:n?.daemon.version_label??n?.daemon.version,updateAvailable:i,latestVersion:r.data?.latest_version,to:e,className:t})}function Zk(e,t){return!t||t<=0?0:Math.floor(e/t*100)}function Qk({describedCount:e,entriesCount:t,to:n,className:r}){let i=e!==void 0&&t!==void 0,a=i?Zk(e,t):null,o=i&&a<100,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vk,{tone:o?`ochre`:`sage`,pulse:o}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`cortex`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:a===null?`—`:`${a}%`})]}),c=J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 no-underline`,n&&`hover:bg-surface-container-high transition-colors`,r);return n?(0,G.jsx)(ri,{to:n,className:c,title:`Cortex (Canopy) describe coverage. Open Cortex.`,children:s}):(0,G.jsx)(`div`,{className:c,title:`Cortex (Canopy) describe coverage`,children:s})}function $k({to:e,className:t}){let{data:n}=Bs();return(0,G.jsx)(Qk,{describedCount:n?.canopy.described_count,entriesCount:n?.canopy.entries_count,to:e,className:t})}function eA(){let e=An(),t=xs(),n=Ro(e.pathname);if(n===`project`)return null;if(n===`grove`){let e=t?.grove,n=e?.projects.length??0;return(0,G.jsxs)(tA,{className:`border-secondary/50 bg-secondary/10 text-secondary`,dot:`bg-secondary`,title:`This page acts on every project in the Grove`,children:[`Grove-wide`,e?` · ${e.name}`:``,n?` · ${n} ${n===1?`project`:`projects`}`:``]})}return(0,G.jsx)(tA,{className:`border-tertiary/50 bg-tertiary/10 text-tertiary`,dot:`bg-tertiary`,title:`This page acts across every Grove on this machine`,children:`Machine-wide`})}function tA({children:e,className:t,dot:n,title:r}){return(0,G.jsxs)(`span`,{title:r,className:J(`inline-flex shrink-0 items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider`,t),children:[(0,G.jsx)(`span`,{className:J(`inline-block h-1.5 w-1.5 rounded-full`,n),"aria-hidden":!0}),e]})}var nA={"/":`Dashboard`,"/sessions":`Sessions`,"/cortex":`Cortex`,"/mycelium":`Mycelium`,"/skills":`Skills`,"/agent":`Agent`,"/settings":`Settings`,"/logs":`Logs`,"/machine":`Machine`,"/groves":`Groves`};function rA(e){let t=e,n=e.match(/^\/g\/[^/]+\/p\/[^/]+(\/.*)?$/);if(n)t=n[1]||`/`;else{let n=e.match(/^\/g\/[^/]+(\/.*)?$/);n&&(t=n[1]||`/`)}if(t===`/`)return[`Dashboard`];let r=t.split(`/`).filter(Boolean);return[nA[`/${r[0]}`]??r[0]]}function iA({onOpenSearch:e,onOpenNotifications:t,unreadCount:n,className:r}){let i=rA(An().pathname),a=Lk(),o=Cs(`/cortex`);return(0,G.jsxs)(`header`,{className:J(`sticky top-0 z-20 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container/90 backdrop-blur px-4`,r),children:[(0,G.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`flex items-center gap-1 font-sans text-xs text-on-surface-variant`,children:i.map((e,t)=>(0,G.jsxs)(`span`,{className:J(t===i.length-1&&`text-on-surface`),children:[t>0&&(0,G.jsx)(`span`,{className:`mx-1`,children:`/`}),e]},t))}),(0,G.jsx)(eA,{}),(0,G.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Search`,className:`ml-auto inline-flex h-7 items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 text-on-surface-variant hover:bg-surface-container-high transition-colors`,children:[(0,G.jsx)(no,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Search`}),(0,G.jsxs)(`kbd`,{className:`inline-flex items-center gap-0.5 font-mono text-[10px] text-on-surface-variant/70`,children:[(0,G.jsx)(fa,{className:`h-2.5 w-2.5`}),`K`]})]}),(0,G.jsx)(Xk,{to:`/settings?configSection=upgrade#upgrade`}),(0,G.jsx)($k,{to:o}),(0,G.jsx)(zk,{data:a.data,isPending:a.isPending,isError:a.isError,to:`/settings?configSection=release-provenance#release-provenance`}),(0,G.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":`Notifications`,className:`relative rounded-md p-1.5 text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface transition-colors`,children:[(0,G.jsx)(Ji,{className:`h-4 w-4`}),n>0&&(0,G.jsx)(`span`,{className:`absolute top-0.5 right-0.5 h-2 w-2 rounded-full bg-primary`})]})]})}var aA=[`Project`,`Observability`,`Grove management`,`Settings`],oA=[{to:`/`,label:`Dashboard`,icon:Fa,scope:`project`,category:`Project`},{to:`/sessions`,label:`Sessions`,icon:Ha,scope:`project`,category:`Project`},{to:`/agent`,label:`Agent`,icon:Xi,scope:`project`,category:`Project`},{to:`/cortex`,label:`Cortex`,icon:Zi,scope:`project`,category:`Project`},{to:`/mycelium`,label:`Mycelium`,icon:Ga,scope:`project`,category:`Project`},{to:`/skills`,label:`Skills`,icon:co,scope:`project`,category:`Project`},{to:`/g/:groveSlug/operations`,label:`Operations`,icon:Gi,scope:`grove`,category:`Observability`},{to:`/logs`,label:`Logs`,icon:to,scope:`machine`,category:`Observability`},{to:`/g/:groveSlug/dashboard`,label:`Grove`,icon:go,scope:`grove`,category:`Grove management`},{to:`/groves`,label:`Groves`,icon:Oa,scope:`machine`,category:`Grove management`},{to:`/symbionts`,label:`Symbionts`,icon:Ya,scope:`machine`,category:`Grove management`},{to:`/g/:groveSlug/team`,label:`Team`,icon:yo,scope:`grove`,category:`Grove management`},{to:`/settings`,label:`Settings`,icon:ao,scope:`machine`,category:`Settings`}],sA=`myco-ui-sidebar-collapsed`,cA=768,lA=80,uA=2e3,dA=[`ring-2`,`ring-primary/40`,`bg-primary/5`];function fA(){let[e,t]=(0,W.useState)(()=>localStorage.getItem(sA)===`true`);return{collapsed:e,toggle:(0,W.useCallback)(()=>{t(e=>{let t=!e;return localStorage.setItem(sA,String(t)),t})},[])}}function pA(){let[e,t]=(0,W.useState)(!1),[n,r]=(0,W.useState)(()=>typeof window<`u`&&window.innerWidth<cA);return(0,W.useEffect)(()=>{let e=window.matchMedia(`(max-width: ${cA-1}px)`),n=e=>{r(e.matches),e.matches||t(!1)};return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),(0,W.useEffect)(()=>{t(!1)},[An().pathname]),(0,W.useEffect)(()=>{if(e)return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=``}},[e]),{open:e,isMobile:n,toggle:(0,W.useCallback)(()=>t(e=>!e),[]),close:(0,W.useCallback)(()=>t(!1),[])}}function mA({collapsed:e=!1}){let{restart:t,isRestarting:n}=Us();return(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(),disabled:n,title:e?n?`Restarting...`:`Restart Daemon`:void 0,className:J(`text-on-surface-variant hover:text-on-surface`,e?`w-8 p-0 justify-center`:`w-full justify-start gap-2`),children:[(0,G.jsx)($a,{className:J(`h-4 w-4`,n&&`animate-spin`)}),!e&&(0,G.jsx)(`span`,{children:n?`Restarting...`:`Restart Daemon`})]})}function hA({collapsed:e}){let{data:t}=Bs(),n=t?.daemon.runtime;if(!n||n.source!==`dev`)return null;let r=`Daemon is running from a dev binary (make dev-link / npm link).`,i=`bg-tertiary/20 text-tertiary border-tertiary/40`;return e?(0,G.jsx)(`div`,{className:J(`mx-auto flex h-5 w-8 items-center justify-center rounded border text-[10px] font-bold tracking-wider`,i),title:r,children:`DEV`}):(0,G.jsxs)(`div`,{className:J(`mx-2 flex items-center justify-center rounded border px-2 py-1 text-[11px] font-semibold tracking-wider`,i),title:r,children:[`DEV`,` runtime`]})}function gA({collapsed:e,onSearchOpen:t,onNotificationsOpen:n,unreadCount:r,onCollapseToggle:i,showCollapseToggle:a}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ev,{collapsed:e}),(0,G.jsxs)(`div`,{className:`px-2 pt-2 pb-1 space-y-0.5`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:t,title:e?`Search (⌘K)`:void 0,className:J(`flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,e?`justify-center px-2 py-2`:`gap-3 px-3 py-2`),children:[(0,G.jsx)(no,{className:`h-4 w-4 shrink-0`}),!e&&(0,G.jsx)(`span`,{className:`flex-1 text-left`,children:`Search`}),!e&&(0,G.jsxs)(`kbd`,{className:`text-xs text-on-surface-variant/60 font-mono`,children:[`⌘`,`K`]})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:n,title:e?`Notifications`:void 0,className:J(`flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,e?`justify-center px-2 py-2`:`gap-3 px-3 py-2`),children:[(0,G.jsx)(Ji,{className:`h-4 w-4 shrink-0`}),!e&&(0,G.jsx)(`span`,{className:`flex-1 text-left`,children:`Notifications`}),r>0&&(0,G.jsx)(`span`,{className:J(`h-2 w-2 rounded-full bg-primary shrink-0`,!e&&`ml-auto`)})]})]}),(0,G.jsx)(`nav`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-2 py-2`,"aria-label":`Main navigation`,children:aA.map(t=>{let n=oA.filter(e=>e.category===t);return n.length===0?null:(0,G.jsx)(_A,{label:t,collapsed:e,children:n.map(t=>(0,G.jsx)(yA,{item:t,collapsed:e},t.to))},t)})}),(0,G.jsxs)(`div`,{className:J(`py-3 space-y-2 mt-auto`,e?`px-1 flex flex-col items-center`:`px-2`),children:[(0,G.jsx)(hA,{collapsed:e}),!e&&(0,G.jsx)(Ik,{collapsed:e}),(0,G.jsx)(mA,{collapsed:e})]}),a&&i&&(0,G.jsx)(`div`,{className:J(`px-2 py-2`,e&&`flex justify-center`),children:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,className:J(`text-on-surface-variant hover:text-on-surface`,e?`w-8 p-0 justify-center`:`w-full justify-start gap-2`),title:e?`Expand sidebar`:`Collapse sidebar`,children:[e?(0,G.jsx)(ta,{className:`h-4 w-4`}):(0,G.jsx)(ea,{className:`h-4 w-4`}),!e&&(0,G.jsx)(`span`,{children:`Collapse`})]})})]})}function _A({label:e,collapsed:t,children:n}){return(0,G.jsxs)(`div`,{role:`group`,"aria-label":e,className:J(`space-y-0.5`,t&&`border-t border-[var(--ghost-border)] pt-3 mt-3 first:border-t-0 first:pt-0 first:mt-0`),children:[!t&&(0,G.jsx)(`div`,{className:`px-3 pt-4 pb-1 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e}),n]})}function vA(e,t,n,r){if(e.scope===`project`)return n;if(e.scope===`machine`)return e.to;if(!e.to.includes(`:groveSlug`))return n;let i=t?.grove??Ho(r)?.grove??jo(r)?.grove??r[0];return i?e.to.replace(`:groveSlug`,i.slug):`/`}function yA({item:e,collapsed:t}){return(0,G.jsxs)(ii,{to:vA(e,xs(),Cs(e.to),_s().data?.groves??[]),end:e.to===`/`,title:t?e.label:void 0,className:({isActive:e})=>J(`flex items-center rounded-md text-sm font-medium transition-colors`,t?`justify-center px-2 py-2`:`gap-3 px-3 py-2`,e?`bg-primary/10 text-primary`:`text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface`),children:[(0,G.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),!t&&e.label]})}function bA(e){let t=xs();(0,W.useEffect)(()=>{let n=t?.project.name??e??null;document.title=n?`${t?`${Uo(t.project.name)} `:``}${n} - Myco`:`Myco`},[t,e])}function xA(){let{collapsed:e,toggle:t}=fA(),{data:n}=Bs(),r=xs()?.project.name??n?.context.project.name??n?.vault.name;bA(r);let[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),{data:c}=Av(),l=c?.count??0,u=pA();(0,W.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&(e.preventDefault(),a(e=>!e))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]),(0,W.useEffect)(()=>{if(!u.open)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),u.close())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[u.open,u.close]);let d=(0,W.useCallback)(()=>a(!0),[]),f=(0,W.useCallback)(()=>s(!0),[]),p=(0,W.useCallback)(()=>s(!1),[]);return(0,W.useEffect)(()=>{let e=new URLSearchParams(location.search),t=e.get(`configField`)??void 0,n=e.get(`configSection`)??void 0;if(!t&&!n)return;let r=window.setTimeout(()=>{let e=SA(t,n);e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),e.classList.add(...dA),window.setTimeout(()=>{e.classList.remove(...dA)},uA))},lA);return()=>window.clearTimeout(r)},[location.key,location.search]),(0,G.jsxs)(`div`,{className:`flex h-screen overflow-hidden bg-background`,children:[(0,G.jsx)(ov,{open:i,onOpenChange:a}),(0,G.jsx)(Uv,{panelOpen:o}),(0,G.jsx)(LO,{open:o,onClose:p}),(0,G.jsx)(tk,{}),u.isMobile&&(0,G.jsxs)(`div`,{className:`fixed top-0 left-0 right-0 z-40 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container px-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:u.toggle,className:`rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":u.open?`Close navigation`:`Open navigation`,children:u.open?(0,G.jsx)(So,{className:`h-5 w-5`}):(0,G.jsx)(Va,{className:`h-5 w-5`})}),(0,G.jsx)(`span`,{className:`font-serif text-base text-primary tracking-wider`,children:`myco`}),r&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline uppercase tracking-widest`,children:r}),(0,G.jsx)(eA,{}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:f,className:`relative rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":`Notifications`,children:[(0,G.jsx)(Ji,{className:`h-4 w-4`}),l>0&&(0,G.jsx)(`span`,{className:`absolute top-0.5 right-0.5 h-2 w-2 rounded-full bg-primary`})]}),(0,G.jsx)(`button`,{type:`button`,onClick:d,className:`rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":`Search`,children:(0,G.jsx)(no,{className:`h-4 w-4`})})]})]}),u.isMobile&&u.open&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-40 bg-surface-dim/60 backdrop-blur-xs transition-opacity`,onClick:u.close,"aria-hidden":`true`}),u.isMobile&&(0,G.jsx)(`aside`,{className:J(`fixed top-12 left-0 bottom-0 z-50 w-64 flex flex-col bg-surface-container transition-transform duration-200 ease-out`,u.open?`translate-x-0`:`-translate-x-full`),children:(0,G.jsx)(gA,{collapsed:!1,onSearchOpen:d,onNotificationsOpen:f,unreadCount:l,showCollapseToggle:!1})}),!u.isMobile&&(0,G.jsx)(`aside`,{className:J(`flex flex-col bg-surface-container transition-[width] duration-200`,e?`w-14`:`w-56`),children:(0,G.jsx)(gA,{collapsed:e,onSearchOpen:d,onNotificationsOpen:f,unreadCount:l,onCollapseToggle:t,showCollapseToggle:!0})}),(0,G.jsxs)(`main`,{className:J(`flex flex-1 flex-col overflow-hidden bg-surface`,u.isMobile&&`pt-12`),"aria-label":`Page content`,children:[!u.isMobile&&(0,G.jsx)(iA,{onOpenSearch:d,onOpenNotifications:f,unreadCount:l}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,G.jsx)(cr,{})})]})]})}function SA(e,t){if(e){let t=e;for(;t.length>0;){let e=document.getElementById(Fi(t));if(e instanceof HTMLElement)return e;let n=t.lastIndexOf(`.`);if(n===-1)break;t=t.slice(0,n)}}if(t){let e=document.getElementById(t);if(e instanceof HTMLElement)return e}return null}var CA=0,wA=[],TA=new Set;function EA(){for(let e of TA)e(wA)}function DA(e){let t=++CA,n={...e,id:t};wA=[...wA,n],EA();let r=e.ttlMs??5e3;r>0&&setTimeout(()=>{wA=wA.filter(e=>e.id!==t),EA()},r)}function OA(){let[e,t]=(0,W.useState)(wA);return(0,W.useEffect)(()=>(TA.add(t),()=>{TA.delete(t)}),[]),e.length===0?null:(0,G.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`pointer-events-none fixed bottom-4 right-4 z-[60] flex w-full max-w-sm flex-col gap-2`,children:e.map(e=>(0,G.jsxs)(`div`,{className:J(`pointer-events-auto rounded-md border bg-surface-container-highest px-4 py-3 shadow-lg`,e.level===`success`&&`border-primary/30`,e.level===`error`&&`border-tertiary/40`,e.level===`info`&&`border-outline-variant/30`),children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-on-surface`,children:e.title}),e.detail&&(0,G.jsx)(`div`,{className:`mt-1 break-all font-mono text-xs text-on-surface-variant`,children:e.detail})]},e.id))})}var kA=js.SESSIONS,AA=js.SESSION_DETAIL,jA=js.SESSION_DETAIL,MA=3e4,NA=6e4,PA=1e4,FA=js.SESSION_DETAIL;function IA(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.agent&&t.set(`agent`,e.agent),e?.search&&t.set(`search`,e.search),e?.hasPlan&&t.set(`has_plan`,`true`),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/sessions?${n}`:`/sessions`;return As({queryKey:[`sessions`,e],queryFn:({signal:e})=>q(r,{signal:e}),pollCategory:`standard`,refetchInterval:kA})}function LA(e){return As({queryKey:[`session`,e],queryFn:({signal:t})=>q(`/sessions/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:AA})}function RA(e,t=[`human`]){let n=t===`all`?``:`?origins=${t.join(`,`)}`;return As({queryKey:[`session-batches`,e,t===`all`?`all`:[...t].sort().join(`,`)],queryFn:({signal:t})=>q(`/sessions/${e}/batches${n}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:jA})}function zA(e){return ot({queryKey:Es([`batch-activities`,e]),queryFn:({signal:t})=>q(`/batches/${e}/activities`,{signal:t}),enabled:e!==void 0,staleTime:MA})}function BA(e){return ot({queryKey:Es([`session-attachments`,e]),queryFn:({signal:t})=>q(`/sessions/${e}/attachments`,{signal:t}),enabled:e!==void 0,staleTime:NA})}function VA(){let e=We();return st({mutationFn:({id:e,force:t})=>ls(`/sessions/${e}`,t?{force:!0}:void 0),onSuccess:()=>{e.invalidateQueries({queryKey:[`sessions`]})}})}function HA(){let e=We();return st({mutationFn:e=>os(`/sessions/${e}/complete`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`session`,n]}),e.invalidateQueries({queryKey:[`sessions`]})}})}function UA(e){return ot({queryKey:Es([`session-impact`,e]),queryFn:({signal:t})=>q(`/sessions/${e}/impact`,{signal:t}),enabled:e!==null,staleTime:PA})}function WA(e){return As({queryKey:[`session-plans`,e],queryFn:async({signal:t})=>(await q(`/sessions/${e}/plans`,{signal:t})).plans,enabled:!!e,pollCategory:`standard`,refetchInterval:FA})}function GA(e){let t=We();return st({mutationFn:e=>ls(`/plans/${e}`),onSuccess:()=>{t.invalidateQueries({queryKey:[`session-plans`,e]})}})}var KA=js.RUNS_ACTIVE,qA=js.RUN_DETAIL,JA=js.STATS,YA=new Set([`completed`,`failed`,`skipped`]),XA=js.STATS,ZA=6e4,QA=50;function $A(e){let t=e?.limit??QA,n=new URLSearchParams;n.set(`limit`,String(t)),e?.offset!==void 0&&n.set(`offset`,String(e.offset)),e?.search&&n.set(`search`,e.search),e?.status&&n.set(`status`,e.status),e?.task&&n.set(`task`,e.task);let r=n.toString();return As({queryKey:[`agent-runs`,e],queryFn:({signal:e})=>q(`/agent/runs?${r}`,{signal:e}),pollCategory:`standard`,refetchInterval:KA})}function ej(e){return As({queryKey:[`agent-run`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:e=>{let t=e.state.data?.run?.status;return t&&YA.has(t)?!1:qA}})}function tj(e,t){let n=t?YA.has(t):!1;return As({queryKey:[`agent-reports`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/reports`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?!1:JA})}function nj(e,t){let n=t?YA.has(t):!1;return As({queryKey:[`agent-turns`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/turns`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?!1:XA})}function rj(){return ot({queryKey:Es([`agent-tasks`]),queryFn:({signal:e})=>q(`/agent/tasks`,{signal:e}),staleTime:ZA})}function ij(e){return ot({queryKey:Es([`agent-task`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}`,{signal:t}),enabled:e!==void 0,staleTime:ZA})}function aj(){let e=We();return st({mutationFn:({taskId:e,name:t})=>os(`/agent/tasks/${e}/copy`,t?{name:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function oj(){let e=We();return st({mutationFn:e=>ls(`/agent/tasks/${e}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function sj(e){return ot({queryKey:Es([`agent-task-yaml`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}/yaml`,{signal:t}),enabled:e!==void 0,staleTime:ZA})}function cj(){let e=We();return st({mutationFn:({taskId:e,yaml:t})=>ss(`/agent/tasks/${e}`,{yaml:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]}),e.invalidateQueries({queryKey:[`agent-task`]}),e.invalidateQueries({queryKey:[`agent-task-yaml`]})}})}function lj(){let e=We();return st({mutationFn:e=>os(`/agent/run`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-runs`]})}})}function uj(){let e=We(),t=xs();return st({mutationFn:({runId:e,mode:t})=>os(`/agent/runs/${e}/resume`,t?{mode:t}:{}),onSuccess:(n,r)=>{let i=Ts(t,[`agent-run`,r.runId]);e.setQueryData(i,e=>e&&{...e,run:{...e.run,status:`running`}}),e.invalidateQueries({queryKey:[`agent-runs`]}),e.invalidateQueries({queryKey:[`agent-run`,r.runId]})}})}function dj(e){return As({queryKey:[`agent-run-write-intents`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/write-intents`,{signal:t}),enabled:e!==null,pollCategory:`standard`,refetchInterval:!1})}function fj(e){return As({queryKey:[`agent-run-audit`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/audit`,{signal:t}),enabled:e!==null,pollCategory:`standard`,refetchInterval:!1})}function pj(e,t){let n=new URLSearchParams;n.set(`agentId`,e),n.set(`tier`,String(t));let r=n.toString();return As({queryKey:[`digest-revisions`,e,t],queryFn:({signal:e})=>q(`/digest/revisions?${r}`,{signal:e}),enabled:!!e&&Number.isFinite(t),pollCategory:`standard`,refetchInterval:!1})}function mj(){let e=We();return st({mutationFn:({revisionId:e,runId:t})=>os(`/digest/revisions/${e}/restore`,t?{runId:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`digest-revisions`]})}})}function hj(e){return{id:e.id,agent_id:e.agent_id,task:e.task,instruction:e.instruction,status:e.status,harness:e.harness,provider:e.provider,model:e.model,session_ref:e.session_ref,started_at:e.started_at,completed_at:e.completed_at,tokens_used:e.tokens_used,cost_usd:e.cost_usd,usage_data:e.usage_data,error:e.error,dry_run:e.dry_run??!1,reasoning_level:e.reasoning_level??null,execution_overrides:e.execution_overrides??null,write_intents:e.write_intents,duration_ms:e.duration_ms}}function gj(e){let t=xs(),n=it({queries:e.map(e=>({queryKey:Ts(t,[`agent-run`,e]),queryFn:({signal:t})=>q(`/agent/runs/${e}`,{signal:t}),enabled:!!e}))}),r=[],i=[],a=!1;for(let e of n){e.isLoading&&(a=!0),e.error&&i.push(e.error);let t=e.data?.run;t&&r.push(hj(t))}return{runs:r,isLoading:a,errors:i,isError:i.length>0}}function _j(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/skill-candidates?${n}`:`/skill-candidates`;return ot({queryKey:Es([`skill-candidates`,e]),queryFn:({signal:e})=>q(r,{signal:e})})}function vj(){let e=We();return st({mutationFn:({id:e,...t})=>ss(`/skill-candidates/${e}`,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-candidates`]})}})}function yj(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/skill-records?${n}`:`/skill-records`;return ot({queryKey:Es([`skill-records`,e]),queryFn:({signal:e})=>q(r,{signal:e})})}function bj(e){return ot({queryKey:Es([`skill-record`,e]),queryFn:({signal:t})=>q(`/skill-records/${e}`,{signal:t}),enabled:!!e})}function xj(){let e=We();return st({mutationFn:e=>ls(`/skill-records/${encodeURIComponent(e)}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-records`]}),e.invalidateQueries({queryKey:[`skill-record`]})}})}var Sj=6e4,Cj=36e5,wj=3e4;function Tj(e,t,n=``){return e?.myco_tool_calls?e.myco_tool_calls.find(e=>e.tool_name===t&&e.op===n)?.count??0:0}async function Ej(e,t){try{return await q(e,{signal:t})}catch(e){if(e instanceof ms&&e.status===404)return null;throw e}}function Dj(e){return ot({queryKey:Es([`session-canopy`,e]),queryFn:({signal:t})=>Ej(`/sessions/${e}/canopy`,t),enabled:e!==void 0,staleTime:Sj,retry:(e,t)=>t instanceof ms&&t.status===404?!1:e<2})}function Oj(e){let t=new URLSearchParams;e.limit!==void 0&&t.set(`limit`,String(e.limit)),e.offset!==void 0&&t.set(`offset`,String(e.offset)),e.language!==void 0&&t.set(`language`,e.language),e.described!==void 0&&t.set(`described`,String(e.described)),e.embedded!==void 0&&t.set(`embedded`,String(e.embedded)),e.path_prefix!==void 0&&t.set(`path_prefix`,e.path_prefix),e.q!==void 0&&e.q!==``&&t.set(`q`,e.q),e.sort_by!==void 0&&t.set(`sort_by`,e.sort_by),e.sort_dir!==void 0&&t.set(`sort_dir`,e.sort_dir);let n=t.toString();return n?`?${n}`:``}function kj(e){return As({queryKey:[`canopy-entries`,e.limit??null,e.offset??null,e.language??null,e.described??null,e.embedded??null,e.path_prefix??null,e.q??null,e.sort_by??null,e.sort_dir??null],queryFn:({signal:t})=>q(`/canopy/entries${Oj(e)}`,{signal:t}),staleTime:wj,pollCategory:`standard`,refetchInterval:js.CANOPY_ENTRIES})}function Aj(e){return ot({queryKey:Es([`canopy-entry`,e]),queryFn:({signal:t})=>Ej(`/canopy/entries/${encodeURIComponent(e??``)}`,t),enabled:typeof e==`string`&&e.length>0,staleTime:wj,retry:(e,t)=>t instanceof ms&&t.status===404?!1:e<2})}function jj(){let e=We();return st({mutationFn:async e=>os(`/canopy/entries/${encodeURIComponent(e)}/reembed`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}function Mj(){let e=We();return st({mutationFn:async e=>os(`/canopy/entries/${encodeURIComponent(e)}/redescribe`,{}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}var Nj=3e4;function Pj(){return ot({queryKey:Es([`canopy-map`]),queryFn:({signal:e})=>q(`/canopy/map`,{signal:e}),staleTime:Nj})}function Fj(){let e=We();return st({mutationFn:async e=>os(`/canopy/map/regenerate`,{force_cold_start:e.force_cold_start===!0}),onSuccess:()=>{e.invalidateQueries({queryKey:[`canopy-map`]})}})}function Ij(e,t){return ot({queryKey:Es([`canopy-tool-call-blob`,e,t]),queryFn:({signal:n})=>Ej(`/sessions/${e}/canopy/tool-calls/${t}/blob`,n),enabled:e!==void 0&&t!==void 0,staleTime:Cj,retry:(e,t)=>t instanceof ms&&t.status===404?!1:e<2})}function Lj({isLoading:e,error:t,loadingText:n=`Loading...`,children:r}){return e?(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:n})]}):t?(0,G.jsxs)(`div`,{className:`flex h-64 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to connect to daemon`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:t.message})]}):(0,G.jsx)(G.Fragment,{children:r})}var Rj={default:`w-full`,narrow:`mx-auto w-full max-w-3xl`},zj=(0,W.forwardRef)(({variant:e=`default`,className:t,children:n,...r},i)=>(0,G.jsx)(`div`,{ref:i,className:J(`flex flex-col gap-6 p-6`,Rj[e],t),...r,children:n}));zj.displayName=`PageContainer`;var Bj=Js(`rounded-xl bg-surface-container-low border border-outline-variant`,{variants:{accent:{sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`,outline:`border-t-2 border-t-outline-variant`},padded:{true:`p-4`,false:``}},defaultVariants:{accent:`sage`,padded:!1}}),Vj=(0,W.forwardRef)(({className:e,accent:t,padded:n,...r},i)=>(0,G.jsx)(`div`,{ref:i,className:J(Bj({accent:t,padded:n}),e),...r}));Vj.displayName=`AccentSurface`;var Hj=Js(`inline-flex items-center myco-eyebrow`,{variants:{tone:{default:`text-outline`,sage:`text-sage`,ochre:`text-ochre`,terra:`text-terracotta`,outline:`text-outline`},size:{sm:`myco-eyebrow-sm`,md:`myco-eyebrow`}},defaultVariants:{tone:`default`,size:`md`}}),Uj=(0,W.forwardRef)(({className:e,tone:t,size:n,...r},i)=>(0,G.jsx)(`span`,{ref:i,className:J(Hj({tone:t,size:n}),e),...r}));Uj.displayName=`Eyebrow`;var Wj=(0,W.forwardRef)(({tone:e=`sage`,eyebrow:t,title:n,actions:r,footer:i,padded:a=!0,className:o,children:s,...c},l)=>{let u=t!=null||n!=null||r!=null;return(0,G.jsxs)(Vj,{ref:l,accent:e,className:J(`flex flex-col`,o),...c,children:[u&&(0,G.jsxs)(`header`,{className:J(`flex items-start justify-between gap-3`,a?`px-5 pt-4`:`px-5 py-4`),children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[t!=null&&(0,G.jsx)(Uj,{tone:e,children:t}),n!=null&&(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:n})]}),r!=null&&(0,G.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:r})]}),s!=null&&(0,G.jsx)(`div`,{className:J(a?`px-5 py-4`:``),children:s}),i!=null&&(0,G.jsx)(`footer`,{className:`border-t border-[var(--ghost-border)] px-5 py-3`,children:i})]})});Wj.displayName=`Panel`;function Gj({data:e,widthPx:t=56,heightPx:n=16,barClassName:r=`fill-primary/60`,zeroBarClassName:i,minValueHeightPx:a=0,zeroValueHeightPx:o=0,ariaLabel:s=`Activity sparkline`,title:c,className:l}){let u=e.length;if(u===0)return(0,G.jsx)(`svg`,{role:`img`,"aria-label":s,title:c??s,width:t,height:n,className:J(`inline-block`,l)});let d=Math.max(...e,1),f=Math.max(1,(t-1*(u-1))/u);return(0,G.jsx)(`svg`,{role:`img`,"aria-label":s,title:c??s,width:t,height:n,className:J(`inline-block`,l),children:e.map((e,t)=>{let s=d===0?0:Math.round(e/d*n),c=Math.min(n,e>0?Math.max(a,s):o);return(0,G.jsx)(`rect`,{x:t*(f+1),y:n-c,width:f,height:c,className:e>0?r:i??r,rx:.5},t)})})}var Kj=8;function qj(e){let t=e??[];return t.length>=Kj?t.slice(t.length-Kj):[...t,...Array(Kj-t.length).fill(0)]}function Jj(e,t){return e===`session`?t===1?`prompt batch`:`prompt batches`:t===1?`agent turn`:`agent turns`}function Yj(e){return e===`session`?`this session`:`this run`}function Xj({data:e,kind:t,widthPx:n=48,heightPx:r=14,className:i,title:a,...o}){let s=qj(e),c=s.reduce((e,t)=>e+t,0),l=`${c.toLocaleString()} ${Jj(t,c)} across ${Yj(t)}`,u=Math.max(...s,1),d=Math.max(2,(n-2*(s.length-1))/s.length),f=t===`session`?`var(--sage)`:`var(--primary)`;return(0,G.jsx)(`svg`,{role:`img`,"aria-label":l,title:a??l,width:n,height:r,viewBox:`0 0 ${n} ${r}`,className:J(`inline-block`,i),...o,children:s.map((e,t)=>{let n=Math.round(e/u*r),i=e>0?Math.max(3,n):1;return(0,G.jsx)(`rect`,{x:t*(d+2),y:r-i,width:d,height:i,rx:1,fill:f,opacity:e>0?.75:.18},t)})})}var Zj=Js(`flex min-w-0 flex-col gap-1 overflow-hidden rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-4 py-3`,{variants:{tone:{default:``,sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`}},defaultVariants:{tone:`default`}}),Qj=(0,W.forwardRef)(({label:e,value:t,sub:n,tone:r,mono:i=!1,sparklineData:a,className:o,...s},c)=>(0,G.jsxs)(`div`,{ref:c,className:J(Zj({tone:r}),o),...s,children:[(0,G.jsx)(Uj,{size:`sm`,children:e}),(0,G.jsxs)(`div`,{className:J(`flex min-w-0 items-end justify-between gap-2`),children:[(0,G.jsx)(`div`,{className:J(`min-w-0 max-w-full [overflow-wrap:anywhere]`,i?`font-mono text-base leading-tight text-on-surface`:`myco-display-md text-on-surface`),children:t}),a&&a.length>=2&&(0,G.jsx)(Gj,{data:a,widthPx:80,heightPx:20,className:`opacity-60 shrink-0`})]}),n!=null&&(0,G.jsx)(`div`,{className:`font-mono text-[10px] text-outline`,children:n})]}));Qj.displayName=`MetricCard`;var $j=6,eM=6,tM=6,nM=6;function rM(e){return e===`running`?`sage`:e===`failed`||e===`error`?`terracotta`:e===`completed`||e===`succeeded`?`outline`:`ochre`}function iM(){let{data:e,isLoading:t,isError:n,error:r}=Bs(),{data:i}=IA({status:`active`,limit:$j}),{data:a}=IA({limit:1}),{data:o}=$A({limit:eM}),{data:s}=yj({limit:tM}),{data:c}=kj({limit:nM,sort_by:`llm_updated_at`,sort_dir:`desc`});return(0,G.jsx)(Lj,{isLoading:t,error:n?r instanceof Error?r:Error(`Unable to reach daemon`):null,loadingText:`Connecting to daemon...`,children:e&&(0,G.jsxs)(zj,{className:`gap-8`,children:[(0,G.jsx)(aM,{stats:e,activeSessionCount:i?.total??0,inFlightRunCount:(o?.runs??[]).filter(e=>e.status===`running`).length,lastSession:a?.sessions?.[0]}),(0,G.jsx)(lM,{stats:e}),(0,G.jsx)(pM,{sessions:i?.sessions??[],totalSporeCount:e.vault.spore_count,totalActiveCount:i?.total??0}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,G.jsx)(hM,{runs:o?.runs??[]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,G.jsx)(_M,{skills:s?.records??[]}),(0,G.jsx)(vM,{entries:c?.rows??[]})]})]})]})})}function aM({stats:e,activeSessionCount:t,inFlightRunCount:n,lastSession:r}){let i=e.context.project.name||vv(e.context.project.root),a=cM(t,n,e.embedding.queue_depth);return(0,G.jsxs)(`header`,{className:`flex items-start justify-between gap-4 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(Uj,{children:i}),(0,G.jsx)(`h1`,{className:`myco-display-lg text-on-surface m-0`,children:`Dashboard`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:a})]}),(0,G.jsx)(sM,{lastSession:r,activeCount:t,totalSessions:e.vault.session_count})]})}var oM=10080*60;function sM({lastSession:e,activeCount:t,totalSessions:n}){let r,i;if(t>0)r=`sage`,i=`Capturing now`;else if(n===0||!e)r=`outline`,i=`No sessions captured yet`;else{let t=e.ended_at??e.started_at,n=Date.now()/1e3-t<=oM;r=n?`sage`:`ochre`,i=n?`Last captured ${mv(t)}`:`No capture in 7 days · last ${mv(t)}`}return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-outline-variant/40 bg-surface-container/40 px-2.5 py-1 font-sans text-xs text-on-surface-variant`,title:`Capture health for this project — when a session last landed`,children:[(0,G.jsx)(Vk,{tone:r}),(0,G.jsx)(`span`,{children:i})]})}function cM(e,t,n){let r=[];return e>0&&r.push(`${e} ${e===1?`active session`:`active sessions`}`),t>0&&r.push(`${t} ${t===1?`run`:`runs`} running`),n>0&&r.push(`${n} in the embed queue`),r.length===0?`Quiet right now — nothing running.`:r.join(` · `)}function lM({stats:e}){return(0,G.jsxs)(`section`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,G.jsx)(dM,{stats:e}),(0,G.jsx)(fM,{stats:e})]})}function uM({accent:e,Icon:t,eyebrow:n,name:r,sub:i,children:a}){let o=e===`sage`?`text-sage`:e===`ochre`?`text-ochre`:`text-terracotta`,s=e===`sage`?`sage`:e===`ochre`?`ochre`:`default`;return(0,G.jsxs)(Vj,{accent:e,className:`p-5 flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(t,{className:J(`h-3.5 w-3.5`,o)}),(0,G.jsx)(Uj,{tone:s,children:n})]}),(0,G.jsx)(`div`,{className:`myco-display-md text-on-surface truncate`,title:r,children:r}),(0,G.jsx)(`div`,{className:`font-mono text-[10px] text-outline truncate`,title:i,children:i})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:a})]})}function dM({stats:e}){return(0,G.jsxs)(uM,{accent:`sage`,Icon:Ka,eyebrow:`Project`,name:e.context.project.name||vv(e.context.project.root),sub:e.context.project.root,children:[(0,G.jsx)(Qj,{label:`Sessions`,value:e.vault.session_count.toLocaleString(),tone:`sage`}),(0,G.jsx)(Qj,{label:`Spores`,value:e.vault.spore_count.toLocaleString()}),(0,G.jsx)(Qj,{label:`Plans`,value:e.vault.plan_count.toLocaleString()}),(0,G.jsx)(Qj,{label:`Canopy`,value:`${e.canopy.described_count}/${e.canopy.entries_count}`,sub:`described`,mono:!0})]})}function fM({stats:e}){let t=e.context.grove,n=t.name??`Local only`,r=t.slug?`${t.mode??`local`} · ${t.connection_state}`:`no grove bound`,i=e.embedding.total_embeddable,a=e.embedding.embedded_count,o=e.embedding.queue_depth;return(0,G.jsxs)(uM,{accent:`ochre`,Icon:go,eyebrow:`Grove`,name:n,sub:r,children:[(0,G.jsx)(Qj,{label:`Embeddings`,value:i>0?`${a}/${i}`:`—`,sub:i>0?`embedded`:`no items`,mono:!0,tone:`ochre`}),(0,G.jsx)(Qj,{label:`Embed queue`,value:o.toLocaleString(),sub:o>0?`pending`:`idle`})]})}function pM({sessions:e,totalSporeCount:t,totalActiveCount:n}){let r=Nn(),i=ws(),a=n===0?`No active sessions`:`${n} ${n===1?`active session`:`active sessions`}`;return(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:`Active sessions · ${n}`,title:a,children:[e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Sessions appear here when a symbiont starts a new conversation.`}):(0,G.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>(0,G.jsx)(mM,{session:e,accent:[`sage`,`ochre`,`terra`][t%3],onClick:()=>r(i(J_(e.id)))},e.id))}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between border-t border-[var(--ghost-border)] pt-3 text-xs font-mono text-outline`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-on-surface tabular-nums`,children:t.toLocaleString()}),` spores total`]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(i(`/sessions`)),className:`inline-flex items-center gap-1 text-sage hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 rounded`,children:[`View session archive`,(0,G.jsx)(qi,{className:`h-3 w-3`})]})]})]})}function mM({session:e,accent:t,onClick:n}){return(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:J(`w-full text-left rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-4 py-3 transition-colors`,`hover:bg-surface-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,t===`sage`&&`border-l-2 border-l-sage`,t===`ochre`&&`border-l-2 border-l-ochre`,t===`terra`&&`border-l-2 border-l-terracotta`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Vk,{tone:e.status===`active`?`sage`:`ochre`,pulse:e.status===`active`}),(0,G.jsx)(`span`,{className:`font-serif italic text-sm text-on-surface truncate flex-1 min-w-0`,children:e.title||`Untitled session`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:mv(e.started_at)})]}),(0,G.jsxs)(`div`,{className:`mt-1 font-mono text-[11px] text-on-surface-variant flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(`span`,{children:e.agent}),e.branch&&(0,G.jsxs)(`span`,{children:[`· `,e.branch]}),(0,G.jsxs)(`span`,{children:[`· `,e.prompt_count,`p · `,e.tool_count,`t`]}),e.activity_buckets&&e.activity_buckets.length>1&&(0,G.jsx)(`span`,{className:`ml-auto`,children:(0,G.jsx)(Gj,{data:e.activity_buckets,widthPx:64,heightPx:14})})]})]})}function hM({runs:e}){let t=Nn(),n=ws(),r=[...e].sort((e,t)=>e.status===`running`&&t.status!==`running`?-1:e.status!==`running`&&t.status===`running`?1:(t.started_at??0)-(e.started_at??0));return(0,G.jsx)(Wj,{accent:`terra`,eyebrow:`Agent runs`,title:`Recent`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/agent`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`All runs `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:r.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`No agent runs yet for this project.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none flex flex-col gap-2`,children:r.map(e=>(0,G.jsx)(gM,{run:e,onClick:()=>t(n(Y_(e.id)))},e.id))})})}function gM({run:e,onClick:t}){let n=rM(e.status),r=e.task??`untitled task`,i=e.tokens_used??0;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:t,className:`w-full text-left rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 transition-colors hover:bg-surface-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Vk,{tone:n,pulse:e.status===`running`}),(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface truncate flex-1 min-w-0`,children:r}),e.dry_run&&(0,G.jsx)(`span`,{className:`font-mono text-[9px] uppercase tracking-wider text-ochre bg-ochre/10 px-1.5 rounded`,children:`dry`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.status})]}),(0,G.jsxs)(`div`,{className:`mt-1 font-mono text-[10px] text-outline flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{children:e.id.slice(0,8)}),e.started_at&&(0,G.jsxs)(`span`,{children:[`· `,mv(e.started_at)]}),i>0&&(0,G.jsxs)(`span`,{children:[`· `,i.toLocaleString(),` tok`]}),e.model&&(0,G.jsxs)(`span`,{children:[`· `,e.model]})]})]})})}function _M({skills:e}){let t=Nn(),n=ws(),r=[...e].sort((e,t)=>t.updated_at-e.updated_at);return(0,G.jsx)(Wj,{accent:`sage`,eyebrow:`Skills`,title:`Recently evolved`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/skills`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Curate `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:r.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`No skills yet. The agent surfaces candidates as you work.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none grid grid-cols-1 sm:grid-cols-2 gap-2`,children:r.map(e=>(0,G.jsxs)(`li`,{className:`rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(co,{className:`h-3 w-3 text-sage shrink-0`}),(0,G.jsx)(`span`,{className:`font-sans text-xs font-medium text-on-surface truncate`,title:e.display_name,children:e.display_name||e.name}),(0,G.jsxs)(`span`,{className:`ml-auto font-mono text-[9px] uppercase tracking-wider text-ochre bg-ochre/10 px-1.5 rounded shrink-0`,children:[`gen `,e.generation]})]}),(0,G.jsx)(`div`,{className:`mt-1 font-mono text-[10px] text-outline`,children:mv(e.updated_at)})]},e.id))})})}function vM({entries:e}){let t=Nn(),n=ws();return(0,G.jsx)(Wj,{accent:`ochre`,eyebrow:`Canopy`,title:`Recent entries`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/cortex?tab=canopy`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Open Cortex `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Canopy hasn't summarized any files yet.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none flex flex-col gap-1.5`,children:e.map(e=>(0,G.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(xa,{className:`h-3 w-3 text-outline shrink-0`}),(0,G.jsx)(`span`,{className:`font-mono truncate flex-1 min-w-0 text-on-surface`,title:e.path,children:e.path}),e.language&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.language}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.llm_updated_at?mv(e.llm_updated_at):mv(e.mechanical_updated_at)})]},e.path))})})}function yM(e){let[t,n]=(0,W.useState)(()=>typeof window>`u`?!1:window.matchMedia(e).matches);return(0,W.useEffect)(()=>{if(typeof window>`u`)return;let t=window.matchMedia(e),r=e=>n(e.matches);return n(t.matches),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var bM=`(min-width: 768px)`,xM=240,SM=360;function CM({master:e,detail:t,hasSelection:n,onCloseMobileDetail:r,railMinWidthPx:i=xM,railMaxWidthPx:a=SM,className:o,masterAriaLabel:s=`List`,detailAriaLabel:c=`Details`}){return yM(bM)?(0,G.jsxs)(`div`,{className:J(`flex h-full w-full`,o),children:[(0,G.jsx)(`aside`,{"aria-label":s,className:`flex-shrink-0 overflow-y-auto border-r border-outline-variant/20`,style:{minWidth:i,maxWidth:a,width:`clamp(${i}px, 30vw, ${a}px)`},children:e}),(0,G.jsx)(`section`,{"aria-label":c,className:`flex-1 overflow-y-auto p-6`,children:t})]}):n?(0,G.jsxs)(`section`,{role:`region`,"aria-label":c,className:J(`flex h-full w-full flex-col`,o),children:[r&&(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:`sticky top-0 z-10 flex items-center gap-1 border-b border-outline-variant/20 bg-surface-container px-3 py-2 text-sm text-on-surface-variant hover:bg-surface-container-high`,children:[(0,G.jsx)(ea,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{children:`Back`})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:t})]}):(0,G.jsx)(`section`,{role:`region`,"aria-label":s,className:J(`h-full w-full overflow-y-auto`,o),children:e})}function wM({message:e,className:t}){return(0,G.jsx)(`div`,{className:J(`flex h-full w-full items-center justify-center text-on-surface-variant`,t),children:(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:e})})}function TM({searchPlaceholder:e=`Search...`,searchValue:t,onSearchChange:n,filters:r=[],filterValues:i={},onFilterChange:a,onClear:o,hasActiveFilters:s,inputRef:c,count:l,className:u}){let d=t.trim().length>0||r.some(e=>{let t=e.options[0]?.value??`all`;return(i[e.key]??t)!==t}),f=o&&(s??d);return(0,G.jsxs)(`div`,{className:J(`flex items-center gap-3 px-4 py-2.5 rounded-md bg-surface-container-low border border-[var(--ghost-border)]`,u),children:[(0,G.jsx)(no,{className:`h-4 w-4 text-on-surface-variant shrink-0`}),(0,G.jsx)(op,{ref:c,placeholder:e,value:t,onChange:e=>n(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1 min-w-[200px]`,"aria-label":e}),r.map(e=>(0,G.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,G.jsxs)(v_,{value:i[e.key]??`all`,onValueChange:t=>a?.(e.key,t),children:[(0,G.jsx)(b_,{children:(0,G.jsx)(y_,{placeholder:e.label})}),(0,G.jsx)(x_,{children:e.options.map(e=>(0,G.jsx)(S_,{value:e.value,children:e.label},e.value))})]})},e.key)),f&&(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,className:`shrink-0 gap-1.5`,onClick:o,"aria-label":`Clear search and filters`,children:[(0,G.jsx)(So,{className:`h-3.5 w-3.5`}),`Clear`]}),l!=null&&(0,G.jsx)(`span`,{className:`myco-eyebrow-sm shrink-0`,children:l})]})}var EM=Js(`rounded-md transition-colors`,{variants:{level:{lowest:`bg-surface-container-lowest`,low:`bg-surface-container-low`,default:`bg-surface-container`,high:`bg-surface-container-high`,highest:`bg-surface-container-highest`,bright:`bg-surface-bright`},interactive:{true:`cursor-pointer hover-lift hover:brightness-[1.08]`,false:``},ghostBorder:{true:`border border-[var(--ghost-border)]`,false:``},glass:{true:`backdrop-blur-xl bg-surface-variant/60`,false:``},glow:{true:`shadow-[inset_0_0_12px_rgba(171,207,184,0.2)]`,false:``},accent:{none:``,sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`,outline:`border-t-2 border-t-outline-variant`}},defaultVariants:{level:`low`,interactive:!1,ghostBorder:!1,glass:!1,glow:!1,accent:`none`}}),Q=(0,W.forwardRef)(({className:e,level:t,interactive:n,ghostBorder:r,glass:i,glow:a,accent:o,...s},c)=>(0,G.jsx)(`div`,{ref:c,className:J(EM({level:t,interactive:n,ghostBorder:r,glass:i,glow:a,accent:o}),e),...s}));Q.displayName=`Surface`;var DM={sage:`bg-sage/[0.08] shadow-[inset_2px_0_0_var(--sage)]`,ochre:`bg-ochre/[0.08] shadow-[inset_2px_0_0_var(--ochre)]`,terra:`bg-terracotta/[0.08] shadow-[inset_2px_0_0_var(--terracotta)]`},OM={sage:`bg-surface-container/60 ring-1 ring-inset ring-sage/30`,ochre:`bg-surface-container/60 ring-1 ring-inset ring-ochre/30`,terra:`bg-surface-container/60 ring-1 ring-inset ring-terracotta/30`},kM=(0,W.forwardRef)(({accent:e=`sage`,isActive:t=!1,isCursor:n=!1,interactive:r,onClick:i,className:a,children:o,onKeyDown:s,...c},l)=>{let u=r??typeof i==`function`;function d(e){u&&i&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i()),s?.(e)}return(0,G.jsx)(`div`,{ref:l,onClick:u?i:void 0,onKeyDown:u?d:s,tabIndex:u?0:void 0,role:u?`row`:void 0,"aria-selected":u?t:void 0,"data-active":t||void 0,"data-cursor":n||void 0,className:J(`relative border-b border-[var(--ghost-border)] last:border-b-0 px-4 py-3 transition-colors duration-100`,u&&`cursor-pointer hover:bg-surface-container focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sage/40`,t&&DM[e],n&&!t&&OM[e],a),...c,children:o})});kM.displayName=`Row`;function AM({open:e,onOpenChange:t,title:n,description:r,icon:i,meta:a,impact:o,confirmLabel:s=`Confirm`,variant:c=`destructive`,onConfirm:l,isPending:u=!1,errorMessage:d=null}){return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md border border-outline-variant/20 [&>button:last-child]:hidden`,children:[(0,G.jsxs)(np,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i&&(0,G.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-tertiary/15`,children:i}),(0,G.jsx)(ip,{children:n})]}),(0,G.jsx)(ap,{children:r})]}),a&&a.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-outline-variant/20 px-4 py-3`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant bg-surface-container px-1.5 py-0.5 rounded shrink-0`,children:a[0]?.value}),a.length>1&&(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface truncate`,children:a[1]?.value})]}),o&&o.length>0&&(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:o.map(e=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`font-sans text-[10px] font-medium uppercase tracking-wider text-on-surface-variant`,children:e.label}),(0,G.jsx)(`div`,{className:`font-sans text-base font-medium text-on-surface`,children:e.value})]},e.label))}),d&&(0,G.jsx)(`p`,{className:`text-sm text-tertiary`,"data-testid":`confirm-dialog-error`,role:`alert`,children:d}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:u,children:`Cancel`}),(0,G.jsxs)(Y,{variant:c,size:`sm`,onClick:l,disabled:u,className:`gap-2`,children:[u&&(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),s]})]})]})})}function jM({total:e,offset:t,limit:n,onPageChange:r}){if(Math.ceil(e/n)<=1)return null;let i=t>0,a=t+n<e,o=t+1,s=Math.min(t+n,e);return(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-3 pt-1`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!i,onClick:()=>r(Math.max(0,t-n)),className:`gap-1 text-on-surface-variant`,children:[(0,G.jsx)(ea,{className:`h-4 w-4`}),`Prev`]}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[o,`–`,s,` of `,e]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!a,onClick:()=>r(t+n),className:`gap-1 text-on-surface-variant`,children:[`Next`,(0,G.jsx)(ta,{className:`h-4 w-4`})]})]})}var MM=3e5;function NM(){return ot({queryKey:Es([`symbionts`]),queryFn:({signal:e})=>q(`/symbionts`,{signal:e}),staleTime:MM})}function PM(e,t,n){let r=e.find(e=>e.name===t);return r?.resumeCommand?r.resumeCommand.replace(`{sessionId}`,n):null}var FM={released:`released`,merged_unreleased:`merged`,not_on_release_line:`feature`,unknown:`unknown`,unreconciled:`unreconciled`},IM={released:`bg-primary/15 text-primary`,merged_unreleased:`bg-secondary/15 text-secondary`,not_on_release_line:`border border-[var(--ghost-border)] text-on-surface-variant`,unknown:`bg-surface-container-high text-on-surface-variant`,unreconciled:`border border-[var(--ghost-border)] text-on-surface-variant/70`},LM={released:`bg-primary`,merged_unreleased:`bg-secondary`,not_on_release_line:`bg-on-surface-variant/50`,unknown:`bg-on-surface-variant/40`,unreconciled:`bg-on-surface-variant/25`},RM={released:`border-primary`,merged_unreleased:`border-secondary`,not_on_release_line:`border-on-surface-variant/50`,unknown:`border-on-surface-variant/40`,unreconciled:`border-on-surface-variant/25`};function zM(e){let t=[FM[e.state]??e.state];return e.confidence&&t.push(`confidence: ${e.confidence}`),e.basis_kind&&t.push(`basis: ${e.basis_kind}`),e.basis_ref&&t.push(`ref: ${e.basis_ref}`),e.reason&&t.push(e.reason),t.join(` — `)}function BM({annotation:e,className:t}){if(!e)return null;let n=FM[e.state]??e.state;return(0,G.jsxs)(`span`,{className:J(`inline-flex items-center gap-1 rounded-xs px-1.5 py-0.5 font-sans text-[10px] font-medium uppercase tracking-wider`,IM[e.state]??IM.unknown,t),title:zM(e),children:[(0,G.jsx)(`span`,{children:n}),e.confidence?(0,G.jsx)(`span`,{className:`font-mono normal-case opacity-70`,children:e.confidence}):null]})}function VM({annotation:e,className:t}){if(!e)return null;let n=LM[e.state]??LM.unknown,r=RM[e.state]??RM.unknown,i=e.confidence??null,a;return a=i===`high`?n:i===`medium`?J(n,`opacity-60 border`,r):i===`low`?J(`bg-transparent border-2`,r):J(n,`opacity-50`),(0,G.jsx)(`span`,{className:J(`inline-block h-2.5 w-2.5 rounded-full shrink-0`,a,t),title:zM(e),"aria-label":`Release: ${zM(e)}`,role:`img`})}var HM=[`ACTIVE`,`TODAY`,`YESTERDAY`,`EARLIER`];function UM(e,t){let{isActive:n,startedAtEpochSec:r,nowEpochSec:i}=t,a=i??Math.floor(Date.now()/1e3),o=new Date(a*1e3),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime()/1e3,c=s-1440*60,l={ACTIVE:[],TODAY:[],YESTERDAY:[],EARLIER:[]};for(let t of e){if(n(t)){l.ACTIVE.push(t);continue}let e=r(t);if(e==null){l.EARLIER.push(t);continue}e>=s?l.TODAY.push(t):e>=c?l.YESTERDAY.push(t):l.EARLIER.push(t)}let u=[];for(let e of HM)l[e].length>0&&u.push({label:e,rows:l[e]});return u}function WM(e){return!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey}function GM({items:e,getId:t,selectedId:n,onActivate:r,filterInputRef:i,enabled:a=!0}){let o=(0,W.useRef)(t);o.current=t;let[s,c]=(0,W.useState)(()=>{if(!n)return 0;let r=e.findIndex(e=>t(e)===n);return r>=0?r:0}),l=(0,W.useRef)([]),u=(0,W.useRef)(n);return(0,W.useEffect)(()=>{if(u.current===n||(u.current=n,!n))return;let t=e.findIndex(e=>o.current(e)===n);t>=0&&c(t)},[n,e]),(0,W.useEffect)(()=>{s>=e.length&&c(Math.max(0,e.length-1)),l.current.length>e.length&&(l.current.length=e.length)},[e.length,s]),(0,W.useEffect)(()=>{let e=l.current[s];e&&typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`nearest`})},[s]),{cursorIndex:s,setRowRef:(0,W.useCallback)(e=>t=>{l.current[e]=t},[]),containerProps:{tabIndex:0,onKeyDown:(0,W.useCallback)(n=>{if(a){if(n.key===`/`&&WM(n)&&i?.current){n.preventDefault(),i.current.focus();return}if(WM(n)){if(n.key===`j`||n.key===`ArrowDown`){n.preventDefault(),c(t=>Math.min(e.length-1,t+1));return}if(n.key===`k`||n.key===`ArrowUp`){n.preventDefault(),c(e=>Math.max(0,e-1));return}if(n.key===`Enter`){n.preventDefault();let i=e[s];i&&r(t(i))}}}},[a,e,s,r,t,i])}}}var KM=5;function qM(e){return e===`active`?`sage`:e===`completed`?`outline`:`ochre`}var JM=(0,W.forwardRef)(function({session:e,symbiontDisplayName:t,isSelected:n,isCursor:r,onClick:i,onDelete:a},o){let s=e.title||_v(e.id);return(0,G.jsxs)(kM,{ref:o,isActive:n,isCursor:r,accent:`sage`,onClick:i,"aria-label":`Session: ${s}`,"data-selected":n||void 0,className:`group`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0 flex-1`,children:[(0,G.jsx)(Vk,{tone:qM(e.status),pulse:e.status===`active`,className:`mt-1.5 shrink-0`}),(0,G.jsx)(`h3`,{className:`font-serif italic text-sm text-on-surface truncate leading-snug`,children:s})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(VM,{annotation:e.release_state}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:mv(e.started_at)}),(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:`opacity-0 group-hover:opacity-100 focus-visible:opacity-100 p-1 rounded hover:bg-terracotta/10 hover:text-terracotta transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-terracotta/40`,"aria-label":`Delete session ${s}`,title:`Delete session`,children:(0,G.jsx)(ho,{className:`h-3.5 w-3.5`})})]})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 ml-5 flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 truncate font-mono text-[11px] text-on-surface-variant`,children:[e.agent,` · `,t,` · `,e.prompt_count,`p · `,e.tool_count,`t`]}),(0,G.jsx)(Xj,{data:e.activity_buckets,kind:`session`,widthPx:48,heightPx:14,className:`shrink-0`})]}),e.branch&&(0,G.jsxs)(`div`,{className:`mt-0.5 ml-5 inline-flex items-center gap-1 font-mono text-[10px] italic text-on-surface-variant`,children:[(0,G.jsx)(ka,{className:`h-2.5 w-2.5`}),e.branch]})]})});function YM(){return(0,G.jsxs)(`div`,{className:`border-b border-[var(--ghost-border)] last:border-b-0 px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`mt-1.5 h-1.5 w-1.5 rounded-full bg-surface-container-high animate-pulse shrink-0`}),(0,G.jsx)(`div`,{className:`h-3 w-48 rounded bg-surface-container-high animate-pulse`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`}),(0,G.jsx)(`div`,{className:`h-3 w-12 rounded bg-surface-container-high animate-pulse`})]})]}),(0,G.jsx)(`div`,{className:`mt-1.5 ml-5 h-2.5 w-40 rounded bg-surface-container-high animate-pulse`})]})}function XM({selectedId:e,search:t,statusFilter:n,agentFilter:r,hasPlanFilter:i,offset:a,onOffsetChange:o,filterInputRef:s,onSelectSession:c}){let l=An(),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(!1),m=VA(),{data:h}=UA(u?.id??null),{data:g}=NM(),_=(0,W.useMemo)(()=>{let e=new Map;for(let t of g?.symbionts??[])e.set(t.name,t.displayName);return t=>t?e.get(t)??t:`unknown`},[g]),{data:v,isLoading:y,isError:b,error:x}=IA({limit:50,offset:a,status:n,agent:r,hasPlan:i,search:t});function S(){u&&m.mutate({id:u.id,force:f},{onSuccess:()=>{d(null),p(!1)},onError:e=>{e instanceof ms&&e.status===409&&e.body?.error===`session_live`&&p(!0)}})}let C=v?.sessions??[],w=v?.total??0,T=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(T.current)return;let t=new URLSearchParams(l.search);t.has(`status`)||t.has(`agent`)||t.has(`has_plan`)||!e&&!y&&C.length>0&&(T.current=!0,c(C[0].id,{replace:!0}))},[e,y,C,c,l.search]);let E=GM({items:C,getId:e=>e.id,selectedId:e,onActivate:e=>c(e),filterInputRef:s}),D=C.filter(e=>e.status===`active`).length,O=C.reduce((e,t)=>e+(t.prompt_count??0),0),k=(0,G.jsxs)(`div`,{className:`px-4 py-3 border-b border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-2`,children:[(0,G.jsx)(`h2`,{className:`myco-eyebrow-sm`,children:`Sessions`}),(0,G.jsx)(`span`,{className:`myco-display-sm text-on-surface`,children:`Archive`})]}),(0,G.jsxs)(`div`,{className:`font-mono text-[11px] text-on-surface-variant inline-flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:w.toLocaleString()}),` TOTAL`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:D.toLocaleString()}),` ACTIVE`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:O.toLocaleString()}),` PROMPTS`]})]})]});return b?(0,G.jsxs)(`div`,{children:[k,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-terracotta mt-4`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load sessions`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:x instanceof Error?x.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{children:[k,y?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsx)(`div`,{role:`list`,"aria-label":`Session archive loading`,children:Array.from({length:KM}).map((e,t)=>(0,G.jsx)(YM,{},t))})}):C.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant mt-4`,children:[(0,G.jsx)(Ha,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:w===0&&!t&&!n&&!r?`No sessions yet`:`No matching sessions`}),w===0&&!t&&!n&&!r&&(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Sessions appear here as you work with your agent`})]}):(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsx)(`div`,{...E.containerProps,role:`list`,"aria-label":`Session archive`,className:`outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sage/40`,children:(()=>{let t=UM(C,{isActive:e=>e.status===`active`,startedAtEpochSec:e=>e.started_at}),n=0;return t.map(t=>(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{role:`separator`,className:`flex items-center justify-between px-4 py-2 border-b border-[var(--ghost-border)] bg-surface-container/40`,children:[(0,G.jsx)(`span`,{className:`myco-eyebrow-sm`,children:t.label}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline`,children:t.rows.length})]}),t.rows.map(t=>{let r=n++;return(0,G.jsx)(JM,{ref:E.setRowRef(r),session:t,symbiontDisplayName:_(t.agent),isSelected:e===t.id,isCursor:E.cursorIndex===r,onClick:()=>c(t.id),onDelete:()=>d(t)},t.id)})]},t.label))})()})}),(0,G.jsx)(jM,{total:w,offset:a,limit:50,onPageChange:o}),(0,G.jsx)(AM,{open:u!==null,onOpenChange:e=>{e||(d(null),p(!1))},title:`Delete Session`,description:f?`Session appears live — the agent is still running. Deleting now permanently discards the rest of the session as it happens. Delete anyway?`:`This will permanently remove this session and all related data. This action cannot be undone.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-terracotta`}),meta:u?[{label:`ID`,value:_v(u.id)},{label:`Title`,value:u.title||_v(u.id)}]:[],impact:h?[{label:`Prompts`,value:h.promptCount},{label:`Spores`,value:h.sporeCount},{label:`Attachments`,value:h.attachmentCount},{label:`Graph Edges`,value:h.graphEdgeCount}]:[],confirmLabel:f?`Delete Anyway`:`Delete Session`,variant:`destructive`,onConfirm:S,isPending:m.isPending})]})}function ZM({children:e,className:t}){return(0,G.jsx)(`div`,{className:J(`font-sans text-xs font-medium uppercase tracking-widest text-on-surface-variant`,t),children:e})}function QM({images:e,index:t,onClose:n,onNavigate:r}){let i=e[t],a=t>0,o=t<e.length-1;(0,W.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]);let s=(0,W.useCallback)(e=>{e.key===`Escape`&&n(),e.key===`ArrowLeft`&&a&&r(t-1),e.key===`ArrowRight`&&o&&r(t+1)},[n,r,t,a,o]);return(0,W.useEffect)(()=>(document.addEventListener(`keydown`,s),()=>document.removeEventListener(`keydown`,s)),[s]),i?(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-surface-dim/90 backdrop-blur-xs`,onClick:n,children:[(0,G.jsx)(`button`,{onClick:n,className:`absolute top-4 right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(So,{className:`h-5 w-5`})}),e.length>1&&(0,G.jsxs)(`span`,{className:`absolute top-4 left-1/2 -translate-x-1/2 font-mono text-xs text-on-surface/60 z-10`,children:[t+1,` / `,e.length]}),a&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(t-1)},className:`absolute left-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(ea,{className:`h-6 w-6`})}),o&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(t+1)},className:`absolute right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(ta,{className:`h-6 w-6`})}),(0,G.jsx)(`img`,{src:i.src,alt:i.alt,className:`max-h-[90vh] max-w-[90vw] rounded-lg shadow-ambient object-contain`,onClick:e=>e.stopPropagation()})]}):null}var $M=new Set([`Read`,`read`]);function eN(e){return e.canopy_injection_tokens===null?!1:$M.has(e.tool_name)}function tN({sessionId:e,toolCallId:t}){let{data:n,isLoading:r,isError:i,error:a}=Ij(e,t);return r?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`h-3 w-3/4 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-3 w-2/3 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-3 w-1/2 animate-pulse rounded bg-surface-container-high`})]}):i||n===null?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(wa,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:a instanceof Error?a.message:`No injection blob available for this tool call.`})]}):(0,G.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap break-words bg-surface-container-lowest rounded-md p-3 text-on-surface overflow-x-auto`,"data-testid":`canopy-blob-text`,children:n.blob})}function nN({sessionId:e,activity:t}){let[n,r]=(0,W.useState)(!1);if(!eN(t))return null;let i=t.canopy_injection_tokens;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r(!0)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:J(`inline-flex items-center gap-1 px-1.5 py-0.5 rounded`,`font-mono text-[10px] text-sage`,`bg-sage/10 hover:bg-sage/20 transition-colors cursor-pointer`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sage/40`),title:`Canopy injected ${i} tokens of file anatomy. Click to view the blob sent to the agent.`,"aria-label":`Canopy injection: ${i} tokens`,"data-testid":`canopy-tool-call-indicator`,children:[(0,G.jsx)(lo,{className:`h-3 w-3`,"aria-hidden":`true`}),(0,G.jsxs)(`span`,{children:[i,` tok`]}),(0,G.jsx)(qi,{className:`h-2.5 w-2.5 opacity-60`,"aria-hidden":`true`})]}),(0,G.jsx)(Zf,{open:n,onOpenChange:r,children:(0,G.jsxs)(tp,{className:`max-w-2xl`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Canopy injection blob`}),(0,G.jsx)(ap,{children:`The verbatim file-anatomy snippet Cortex sent the agent before this Read. Transparency is the default — what you see here is exactly what the model saw.`})]}),(0,G.jsx)(tN,{sessionId:e,toolCallId:t.id})]})})]})}var rN=3;function iN({activity:e}){let[t,n]=(0,W.useState)(!1),r=e.success===1,i=!!(e.tool_input||e.tool_output_summary||e.error_message);return(0,G.jsxs)(`div`,{className:J(`border-l-2 transition-colors`,t?`border-l-primary/30`:`border-transparent hover:border-l-primary/20`),children:[(0,G.jsxs)(`div`,{role:`button`,tabIndex:0,className:`w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-surface-container/30 transition-all`,onClick:()=>n(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e=>!e))},"aria-expanded":t,children:[t?(0,G.jsx)($i,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),e.myco_tool?(0,G.jsxs)(`span`,{className:`font-mono text-xs font-medium text-primary`,children:[e.myco_tool,e.myco_op&&(0,G.jsxs)(`span`,{className:`text-primary/60`,children:[` · `,e.myco_op]})]}):(0,G.jsx)(`span`,{className:`font-mono text-xs font-medium text-on-surface`,children:e.tool_name}),e.file_path&&(0,G.jsx)(`span`,{className:`truncate font-sans text-xs text-on-surface-variant flex-1`,children:e.file_path}),(0,G.jsx)(`span`,{className:`shrink-0 ml-auto`}),(0,G.jsx)(nN,{sessionId:e.session_id,activity:e}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:xv(e.duration_ms)}),r?(0,G.jsx)(oa,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):(0,G.jsx)(ca,{className:`h-3.5 w-3.5 shrink-0 text-tertiary`})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-150 ease-out`,style:{gridTemplateRows:t?`1fr`:`0fr`},children:(0,G.jsx)(`div`,{className:`overflow-hidden`,children:(0,G.jsxs)(`div`,{className:`px-8 pb-3 space-y-2`,children:[!i&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant/60 italic py-1`,children:`No input/output details captured`}),e.tool_input&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-on-surface-variant mb-1`,children:`Input`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface`,children:e.tool_input})]}),e.tool_output_summary&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-on-surface-variant mb-1`,children:`Output`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface`,children:e.tool_output_summary})]}),e.error_message&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-tertiary mb-1`,children:`Error`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-tertiary/10 text-tertiary rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all`,children:e.error_message})]})]})})})]})}function aN({batchId:e,activityCount:t}){let[n,r]=(0,W.useState)(!1),{data:i,isLoading:a}=zA(n?e:void 0);if(t===0)return null;let o=i??[];return(0,G.jsxs)(`div`,{className:`border-t border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`button`,{type:`button`,className:J(`w-full flex items-center gap-2 px-4 py-2 text-left transition-colors`,`hover:bg-surface-container/30`),onClick:()=>r(e=>!e),children:[n?(0,G.jsx)($i,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,children:`Tool Calls`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/60`,children:t})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out`,style:{gridTemplateRows:n?`1fr`:`0fr`},children:(0,G.jsxs)(`div`,{className:`overflow-hidden`,children:[a&&(0,G.jsx)(`div`,{className:`px-3 py-2 space-y-1`,children:Array.from({length:Math.min(t,rN)}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-3 animate-pulse rounded bg-surface-container-high w-full`},t))}),!a&&o.length>0&&(0,G.jsx)(`div`,{className:`space-y-0`,children:o.map(e=>(0,G.jsx)(iN,{activity:e},e.id))})]})})]})}var oN=`h-7 w-7`;function sN(e){return new Date(e*1e3).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function cN(e){return e?e.length>120?e.slice(0,120)+`…`:e:`(no prompt)`}function lN({child:e}){return(0,G.jsxs)(`div`,{className:`mt-3 border-l-2 border-primary/30 pl-4 pb-3 mx-4`,children:[(0,G.jsx)(`div`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-primary/70 mb-1`,children:e.kind===`interrupt`?`⚠ interrupt`:`↳ steering`}),(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-1`,children:[(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant shrink-0`,children:`Prompt`}),e.started_at&&(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:sN(e.started_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface whitespace-pre-wrap`,children:e.user_prompt??`(no prompt)`}),e.activity_count>0&&(0,G.jsx)(aN,{batchId:e.id,activityCount:e.activity_count}),e.response_summary&&(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,G.jsx)(Xi,{className:`h-3 w-3 text-primary/60`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,children:`Response`})]}),(0,G.jsx)(kO,{content:e.response_summary})]})]})}function uN(){if(typeof window>`u`)return;let e=window.__MYCO_AUTH__;return typeof e==`string`&&e.length>0?e:void 0}async function dN(e){let t=new Headers,n=uN();n&&t.set(`x-myco-auth`,n);let r=await fetch(e,{headers:t});if(!r.ok)throw Error(`resource fetch failed: ${r.status}`);return URL.createObjectURL(await r.blob())}function fN(e,t){return Ko(t?`/api/g/${t.grove.id}/p/${t.project.project_id}/attachments/${e}`:`/api/attachments/${e}`)}function pN(e){let t=xs(),[n,r]=(0,W.useState)(()=>e.map(()=>null));return(0,W.useEffect)(()=>{let n=!1,i=[];return r(e.map(()=>null)),Promise.all(e.map(e=>dN(fN(e,t)).then(e=>(i.push(e),e)).catch(()=>null))).then(e=>{if(n){for(let e of i)URL.revokeObjectURL(e);return}r(e)}),()=>{n=!0;for(let e of i)URL.revokeObjectURL(e)}},[`${t?.grove.id??``}|${t?.project.project_id??``}|${e.join(`|`)}`]),n}function mN({filePath:e,alt:t,className:n,loading:r=`lazy`}){let[i]=pN([e]);return i?(0,G.jsx)(`img`,{src:i,alt:t??e,className:n,loading:r}):(0,G.jsx)(`div`,{className:n,"aria-busy":`true`})}function hN({batch:e,batchAttachments:t,steeringChildren:n,defaultOpen:r=!1,promptIndex:i,isLast:a}){let[o,s]=(0,W.useState)(r),[c,l]=(0,W.useState)(null),u=pN(t.map(e=>e.file_path));return(0,G.jsxs)(`div`,{className:`relative flex gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative flex flex-col items-center shrink-0`,style:{width:`28px`},children:[i>0&&(0,G.jsx)(`div`,{className:`absolute top-0 w-px bg-outline-variant/40`,style:{height:`14px`}}),(0,G.jsx)(`div`,{className:J(oN,`rounded-full flex items-center justify-center shrink-0 text-[10px] font-mono font-bold transition-colors z-10`,o?`bg-primary text-on-primary`:`bg-surface-container-high text-on-surface-variant border border-outline-variant/40`),children:i+1}),!a&&(0,G.jsx)(`div`,{className:`flex-1 w-px bg-outline-variant/40`})]}),(0,G.jsxs)(Q,{level:`low`,className:J(`flex-1 overflow-hidden rounded-md max-w-full border border-outline-variant/10 mb-2`,e.kind===`recovered`&&`opacity-60 border-dashed`),children:[(0,G.jsxs)(`button`,{type:`button`,className:J(`flex w-full items-start gap-3 px-4 py-3 text-left transition-colors overflow-hidden`,`hover:bg-surface-container/40`,o&&`bg-surface-container/20`),onClick:()=>s(e=>!e),"aria-expanded":o,children:[o?(0,G.jsx)($i,{className:`mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform`}):(0,G.jsx)(ta,{className:`mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-0.5`,children:[(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant shrink-0`,children:e.kind===`recovered`?`Recovered`:`Prompt`}),e.activity_count>0&&(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/70 shrink-0`,children:[e.activity_count,` tool call`,e.activity_count===1?``:`s`]}),e.started_at&&(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:sN(e.started_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface truncate`,children:o?e.user_prompt??`(no prompt)`:cN(e.user_prompt)})]})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out`,style:{gridTemplateRows:o?`1fr`:`0fr`},children:(0,G.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`px-4 pt-0 pb-3 overflow-hidden`,children:[e.user_prompt&&e.user_prompt.length>120&&(0,G.jsx)(kO,{content:e.user_prompt}),t.length>0&&(0,G.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3`,children:t.map((e,t)=>(0,G.jsx)(`button`,{type:`button`,className:`rounded-md overflow-hidden hover:ring-2 hover:ring-primary/40 transition-all`,onClick:()=>l(t),children:(0,G.jsx)(mN,{filePath:e.file_path,alt:e.description??e.file_path??``,className:`max-w-[200px] max-h-[140px] object-cover rounded-md`})},e.id))}),c!==null&&(0,G.jsx)(QM,{images:t.map((e,t)=>({src:u[t]??``,alt:e.description??e.file_path??``})),index:c,onNavigate:l,onClose:()=>l(null)})]}),e.activity_count>0&&(0,G.jsx)(aN,{batchId:e.id,activityCount:e.activity_count}),n.map(e=>(0,G.jsx)(lN,{child:e},e.id)),e.response_summary&&(0,G.jsx)(`div`,{className:`border-t border-[var(--ghost-border)] overflow-hidden`,children:(0,G.jsxs)(`div`,{className:`flex gap-3 px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`w-0.5 shrink-0 rounded-full bg-primary/30`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,G.jsx)(Xi,{className:`h-3 w-3 text-primary/60`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,children:`Response`})]}),(0,G.jsx)(kO,{content:e.response_summary})]})]})})]})})]})]})}var gN=3;function _N(e){let t=new Map,n=[];for(let r of e)if(r.parent_prompt_batch_id==null)n.push(r);else{let e=t.get(r.parent_prompt_batch_id)??[];e.push(r),t.set(r.parent_prompt_batch_id,e)}return n.map(e=>({parent:e,children:(t.get(e.id)??[]).sort((e,t)=>(e.started_at??0)-(t.started_at??0))}))}var vN=[`human`],yN=[`human`,`system`,`agent_dispatch`,`hook_injected`];function bN({sessionId:e}){let[t,n]=(0,W.useState)(!1),{data:r,isLoading:i}=RA(e,t?yN:vN),{data:a}=BA(e),o=a??[],{byBatchId:s,byTurnNumber:c}=(0,W.useMemo)(()=>{let e=new Map,t=new Map;for(let n of o){if(n.prompt_batch_id!=null){let t=e.get(n.prompt_batch_id)??[];t.push(n),e.set(n.prompt_batch_id,t)}if(n.turn_number!=null){let e=t.get(n.turn_number)??[];e.push(n),t.set(n.turn_number,e)}}return{byBatchId:e,byTurnNumber:t}},[o]),l=(0,W.useMemo)(()=>_N([...r??[]].sort((e,t)=>(e.started_at??0)-(t.started_at??0))),[r]);return i?(0,G.jsx)(`div`,{className:`space-y-3 pl-11`,children:Array.from({length:gN}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-16 animate-pulse rounded-md bg-surface-container-low`},t))}):l.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ha,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No prompts recorded`})]}):(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-3 flex items-center justify-end pl-11 text-xs text-on-surface-variant`,children:(0,G.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2 select-none`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`h-3 w-3 cursor-pointer accent-primary`,checked:t,onChange:e=>n(e.target.checked)}),(0,G.jsx)(`span`,{children:`Show system & sub-agent prompts`})]})}),l.map(({parent:e,children:t},n)=>(0,G.jsx)(hN,{batch:e,batchAttachments:s.get(e.id)??(e.prompt_number===null?[]:c.get(e.prompt_number)??[]),steeringChildren:t,defaultOpen:n===l.length-1,promptIndex:n,isLast:n===l.length-1},e.id))]})}var xN=`▲`,SN=`▼`;function CN(e){let t=(e.match(/- \[x\]/gi)??[]).length;return{total:t+(e.match(/- \[ \]/g)??[]).length,checked:t}}var wN={active:`bg-green-500/10 text-green-500`,completed:`bg-blue-500/10 text-blue-500`},TN=`bg-muted text-muted-foreground`;function EN({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide`,wN[e]??TN),children:e})}function DN({planId:e}){let[t,n]=(0,W.useState)(`idle`),r=(0,W.useRef)(null);(0,W.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let i=(0,W.useCallback)(()=>{navigator.clipboard?.writeText&&(r.current&&clearTimeout(r.current),navigator.clipboard.writeText(e).then(()=>{n(`copied`),r.current=setTimeout(()=>n(`idle`),1500)},()=>{n(`failed`),r.current=setTimeout(()=>n(`idle`),1500)}))},[e]);return(0,G.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),i()},title:t===`failed`?`Copy failed — check clipboard permissions`:`Copy plan ID: ${e}`,className:`inline-flex items-center gap-1 font-mono text-xs text-muted-foreground hover:text-primary transition-colors`,"aria-live":`polite`,children:[(0,G.jsx)(`span`,{children:gv(e,8)}),t===`copied`&&(0,G.jsx)(Qi,{className:`h-3 w-3 text-primary`}),t===`failed`&&(0,G.jsx)(So,{className:`h-3 w-3 text-error`}),t===`idle`&&(0,G.jsx)(pa,{className:`h-3 w-3`})]})}function ON({plan:e,initialExpanded:t=!1,isDeleting:n=!1,onDelete:r}){let[i,a]=(0,W.useState)(t),o=(0,W.useMemo)(()=>e.content?CN(e.content):null,[e.content]),s=o!==null&&o.total>0,c=s?Math.round(o.checked/o.total*100):0,l=!!e.content,u=()=>{l&&a(e=>!e)};return(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/50 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:J(`flex items-start gap-3 p-4`,l&&`cursor-pointer hover:bg-muted/70 transition-colors`),onClick:l?u:void 0,onKeyDown:l?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u())}:void 0,role:l?`button`:void 0,tabIndex:l?0:void 0,"aria-expanded":l?i:void 0,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(EN,{status:e.status}),e.title&&(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface truncate`,children:e.title})]}),e.source_path&&(0,G.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground truncate`,title:e.source_path,children:e.source_path}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 font-sans text-xs text-muted-foreground`,children:[(0,G.jsx)(DN,{planId:e.id}),(0,G.jsxs)(`span`,{children:[`Created `,mv(e.created_at)]}),e.updated_at&&e.updated_at!==e.created_at&&(0,G.jsxs)(`span`,{title:hv(e.updated_at),children:[`Updated `,mv(e.updated_at)]})]}),s&&(0,G.jsxs)(`div`,{className:`space-y-1 pt-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between font-sans text-xs text-muted-foreground`,children:[(0,G.jsxs)(`span`,{children:[o.checked,`/`,o.total,` items`]}),(0,G.jsxs)(`span`,{children:[c,`%`]})]}),(0,G.jsx)(`div`,{className:`h-1.5 rounded-full bg-border overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-all`,style:{width:`${c}%`}})})]})]}),(l||r)&&(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r&&(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),r(e.id)},className:`text-xs text-muted-foreground hover:text-destructive transition-colors cursor-pointer disabled:opacity-50`,disabled:n,"aria-label":`Delete plan`,children:n?`Deleting...`:`Delete`}),l&&(0,G.jsx)(`span`,{className:`mt-0.5 text-xs text-muted-foreground`,"aria-hidden":`true`,children:i?xN:SN})]})]}),i&&e.content&&(0,G.jsx)(`div`,{className:`border-t border-border px-4 py-3`,children:(0,G.jsx)(kO,{content:e.content,className:`text-sm`})})]})}function kN({sessionId:e,expandedPlanId:t}){let{data:n,isLoading:r,isError:i}=WA(e),a=GA(e),[o,s]=(0,W.useState)(null);async function c(){if(o)try{await a.mutateAsync(o.id),s(null)}catch{s(null)}}return r?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`Loading plans...`})}):i?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`Failed to load plans.`})}):!n||n.length===0?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center rounded-lg border border-border bg-muted/30`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`No plans captured for this session`})}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[a.isError&&(0,G.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 font-sans text-sm text-destructive`,children:`Failed to delete plan.`}),n.map(e=>(0,G.jsx)(ON,{plan:e,initialExpanded:e.status===`in_progress`||String(e.id)===t,isDeleting:a.isPending&&o?.id===e.id,onDelete:()=>s(e)},e.id)),(0,G.jsx)(AM,{open:o!==null,onOpenChange:e=>{e||s(null)},title:`Delete Plan`,description:`This will permanently remove this captured plan from the session.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-tertiary`}),meta:o?[{label:`Status`,value:o.status},{label:`Title`,value:o.title||o.source_path||o.id}]:[],confirmLabel:`Delete Plan`,variant:`destructive`,onConfirm:c,isPending:a.isPending})]})}var AN=15e3,jN=3e4,MN=3e4,NN=6e4;function PN(e){let t=new URLSearchParams;e?.type&&t.set(`type`,e.type),e?.status&&t.set(`status`,e.status),e?.search&&t.set(`search`,e.search),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset)),e?.session_id&&t.set(`session_id`,e.session_id);let n=t.toString(),r=n?`/spores?${n}`:`/spores`;return As({queryKey:[`spores`,e],queryFn:({signal:e})=>q(r,{signal:e}),staleTime:AN,pollCategory:`standard`,refetchInterval:js.SPORES})}function FN(e){return ot({queryKey:Es([`spore`,e]),queryFn:({signal:t})=>q(`/spores/${e}`,{signal:t}),enabled:e!==void 0,staleTime:jN})}function IN(e,t=1,n=!0){return ot({queryKey:Es([`graph`,e,t]),queryFn:({signal:n})=>q(`/graph/${e}?depth=${t}`,{signal:n}),enabled:n&&e!==void 0,staleTime:MN})}function LN(e=!0){return ot({queryKey:Es([`full-graph`]),queryFn:({signal:e})=>q(`/graph`,{signal:e}),enabled:e,staleTime:MN})}function RN(){return ot({queryKey:Es([`graph-seeds`]),queryFn:({signal:e})=>q(`/graph/seeds`,{signal:e}),staleTime:MN})}function zN(e){let t=e?`/digest?agent_id=${encodeURIComponent(e)}`:`/digest`;return ot({queryKey:Es([`digest`,e]),queryFn:({signal:e})=>q(t,{signal:e}),staleTime:NN})}var BN=200,VN={decision:`default`,discovery:`default`,wisdom:`default`,architecture:`default`,trade_off:`secondary`,"cross-cutting":`secondary`,pattern:`secondary`,gotcha:`destructive`,bug_fix:`destructive`},HN={active:`default`,superseded:`outline`,consolidated:`outline`,obsolete:`outline`};function UN({spore:e}){let[t,n]=(0,W.useState)(!1),r=VN[e.observation_type]??`secondary`,i=HN[e.status]??`outline`,a=e.status!==`active`,o=e.content.split(`
|
|
84
84
|
`).find(e=>e.trim().length>0)?.replace(/^#+\s*/,``)??``;return(0,G.jsxs)(Q,{level:`low`,className:J(`rounded-md border border-outline-variant/20 transition-colors`,a&&`opacity-70`),role:`listitem`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-expanded":t,className:`w-full px-4 py-3 text-left hover:bg-surface-container-high/50 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t?(0,G.jsx)($i,{className:`h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-1`,children:[(0,G.jsx)(X,{variant:r,children:e.observation_type}),(0,G.jsx)(X,{variant:i,children:e.status})]}),(0,G.jsx)(`p`,{className:J(`font-sans text-sm text-on-surface truncate`,a&&`line-through`),children:o})]})]})}),t&&(0,G.jsxs)(`div`,{className:`border-t border-outline-variant/20 px-4 py-3 space-y-3`,children:[(0,G.jsx)(kO,{content:e.content}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{title:hv(e.created_at),children:[`Created `,mv(e.created_at)]}),(0,G.jsxs)(`span`,{title:hv(e.updated_at),children:[`Last updated `,mv(e.updated_at)]})]})]})]})}function WN({sessionId:e,className:t}){let{data:n,isPending:r,isError:i}=PN({session_id:e,limit:BN});return r?(0,G.jsx)(`div`,{className:J(`space-y-3 p-4`,t),children:Array.from({length:3}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-20 animate-pulse rounded-md bg-surface-container-high`},t))}):i||!n?(0,G.jsx)(`div`,{className:J(`p-4 text-sm text-tertiary`,t),role:`alert`,children:`Failed to load spores for this session.`}):n.spores.length===0?(0,G.jsxs)(`div`,{className:J(`p-8 text-center text-on-surface-variant`,t),children:[(0,G.jsx)(`p`,{className:`font-sans text-sm italic`,children:`No spores derived from this session yet.`}),(0,G.jsx)(`p`,{className:`mt-2 font-mono text-xs`,children:`Spores get captured automatically as the agent learns from your prompts.`})]}):(0,G.jsx)(`div`,{className:J(`space-y-3 p-4`,t),role:`list`,children:n.spores.map(e=>(0,G.jsx)(UN,{spore:e},e.id))})}var GN=`/cortex?tab=canopy`,KN=1e3,qN=1e6;function JN(e){let t=e<0?`-`:``,n=Math.abs(e);return n>=qN?`${t}${(n/qN).toFixed(1)}M`:n>=KN*10?`${t}${Math.round(n/KN)}k`:n>=KN?`${t}${(n/KN).toFixed(1)}k`:`${t}${n.toLocaleString()}`}function YN(e){return e===null?`—`:e.toLocaleString()}function XN({label:e,value:t,hint:n}){return(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 py-1.5 border-b border-[var(--ghost-border)] last:border-0`,title:n,children:[(0,G.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:t})]})}function ZN({sessionId:e,fixture:t,className:n}){let[r,i]=(0,W.useState)(!1),a=t!==void 0,{data:o,isLoading:s}=Dj(a?void 0:e),c=a?t:o??null;if(!a&&s)return null;let l=c?.canopy_tokens_saved??0,u=c?.canopy_injections_offered??null,d=c?.canopy_skips_after_injection??null,f=c?.canopy_reads_after_injection??null,p=c?.canopy_redundant_reads??null,m=c?.canopy_injection_total_tokens??null,h=Tj(c,`myco_cortex`,`canopy_map`),g=u!==null&&u>0&&d!==null?`${d}/${u} skipped`:null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:J(`rounded-lg border border-outline-variant/10 bg-surface-container/60 p-4 border-t-2 border-t-sage`,`transition-[border-color,background-color] duration-200`,`hover:border-outline-variant/25 hover:bg-surface-container/80 cursor-pointer text-left`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sage/40`,n),"data-testid":`canopy-efficiency-tile`,"aria-label":`${JN(l)} tokens saved by Canopy. Click for breakdown.`,children:[(0,G.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline mb-2`,children:`Reads saved`}),(0,G.jsx)(`div`,{className:`flex items-end justify-between gap-2`,children:(0,G.jsx)(`p`,{className:J(`font-serif text-2xl font-bold`,l>=0?`text-sage`:`text-terracotta`),children:JN(l)})}),g&&(0,G.jsx)(`p`,{className:`font-mono text-[10px] text-outline mt-1`,children:g}),(0,G.jsxs)(`p`,{className:`font-mono text-[10px] text-outline mt-1`,"data-testid":`canopy-map-calls`,children:[`Map calls: `,h]})]}),(0,G.jsx)(Zf,{open:r,onOpenChange:i,children:(0,G.jsxs)(tp,{className:`max-w-md`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Canopy: Reads saved this session`}),(0,G.jsx)(ap,{children:`Direct token savings from files the agent skipped Reading after Canopy injected file anatomy via PreToolUse.`})]}),(0,G.jsxs)(`div`,{className:`mb-4`,children:[(0,G.jsx)(`p`,{className:J(`font-serif text-3xl font-bold tracking-tight`,l>=0?`text-sage`:`text-terracotta`),"aria-label":`${JN(l)} net tokens saved on Reads`,children:JN(l)}),(0,G.jsxs)(`p`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline mt-1`,children:[`net tokens `,l>=0?`saved on reads`:`spent on injections`]})]}),(0,G.jsxs)(`div`,{className:`space-y-0`,children:[(0,G.jsx)(XN,{label:`Injections offered`,value:YN(u),hint:`PreToolUse Read events where Canopy injected anatomy.`}),(0,G.jsx)(XN,{label:`Skipped after injection`,value:YN(d),hint:`Files the agent did not Read after seeing the injected blob.`}),(0,G.jsx)(XN,{label:`Read anyway`,value:YN(f),hint:`Files the agent Read in full after the injection.`}),(0,G.jsx)(XN,{label:`Injection cost`,value:m===null?`—`:`${JN(m)} tok`,hint:`Sum of tokens spent on Canopy injections this session.`}),p!==null&&p>0&&(0,G.jsx)(XN,{label:`Redundant reads`,value:YN(p),hint:`Files Read more than once in this session (informational).`}),(0,G.jsx)(XN,{label:`Map calls`,value:h.toLocaleString(),hint:`Times the agent called canopy_map() during this session.`})]}),(0,G.jsx)(ri,{to:GN,onClick:()=>i(!1),className:`inline-block mt-4 font-mono text-xs text-sage hover:underline`,children:`Learn more about Canopy →`})]})})]})}function QN(e){return e===`active`?`active`:e===`completed`?`completed`:`error`}var $N={active:`bg-primary`,completed:`bg-secondary`,error:`bg-tertiary`},eP={active:`bg-primary/15 text-primary`,completed:`bg-surface-container-high text-on-surface-variant`,error:`bg-tertiary/15 text-tertiary`};function tP({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-block h-2 w-2 rounded-full shrink-0`,$N[QN(e)])})}function nP({status:e}){let t=QN(e),n=e.charAt(0).toUpperCase()+e.slice(1);return(0,G.jsxs)(`span`,{className:J(`inline-flex items-center gap-1.5 rounded-xs px-2 py-0.5 font-sans text-xs font-medium`,eP[t]),children:[(0,G.jsx)(tP,{status:e}),n]})}function rP(e){return e===null?`—`:pv(new Date(e*1e3).toISOString())}var iP=1500;function aP({label:e,value:t,mono:n=!0,copyable:r=!1,code:i=!1}){let[a,o]=(0,W.useState)(!1),s=(0,W.useCallback)(()=>{navigator.clipboard.writeText(t),o(!0),setTimeout(()=>o(!1),iP)},[t]),c=i?(0,G.jsx)(`code`,{className:`text-xs font-mono text-primary bg-surface-container-lowest rounded px-1.5 py-0.5`,children:t}):(0,G.jsx)(`span`,{className:J(`text-xs text-on-surface`,n&&`font-mono`),children:t});return(0,G.jsxs)(`div`,{className:`flex items-baseline gap-3 py-1.5 border-b border-[var(--ghost-border)] last:border-0`,children:[(0,G.jsx)(`span`,{className:`shrink-0 w-20 font-sans text-xs font-medium text-on-surface-variant`,children:e}),r?(0,G.jsxs)(`button`,{onClick:s,title:`Click to copy`,className:`flex items-center gap-1.5 min-w-0 hover:text-primary transition-colors cursor-pointer`,children:[c,a&&(0,G.jsx)(Qi,{className:`h-3 w-3 text-primary shrink-0`})]}):(0,G.jsx)(`span`,{className:`min-w-0`,children:c})]})}function oP({label:e,value:t,activeTab:n,onClick:r}){return(0,G.jsx)(`button`,{onClick:()=>r(t),className:J(`px-4 py-2 font-sans text-sm font-medium transition-colors cursor-pointer`,n===t?`border-b-2 border-primary text-on-surface`:`text-muted-foreground hover:text-on-surface`),children:e})}function sP({id:e}){let t=Nn(),{data:n,isLoading:r,isError:i,error:a}=LA(e),{data:o}=NM(),s=lj(),c=HA(),[l,u]=(0,W.useState)(`idle`),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`tab`);return e===`plans`?`plans`:e===`spores`?`spores`:`conversation`}),[_]=(0,W.useState)(()=>new URLSearchParams(window.location.search).get(`plan`)),v=VA(),{data:y}=UA(d?e:null),{data:b}=WA(e);if(r)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(`/sessions`),className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session Archive`})]}),(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Loading session...`})]})]});if(i||!n)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(`/sessions`),className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session Archive`})]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session not found`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:a instanceof Error?a.message:`Unknown error`})]})]});let x=o?PM(o.symbionts,n.agent,e):null;return(0,G.jsxs)(`div`,{className:`space-y-6 overflow-hidden`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(`/sessions`),className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session Archive`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(`h1`,{className:`myco-display-lg text-on-surface m-0`,children:n.title??_v(n.id)}),(0,G.jsx)(nP,{status:n.status}),(0,G.jsx)(BM,{annotation:n.release_state}),n.agent&&(0,G.jsx)(X,{variant:`outline`,className:`font-mono text-[10px] px-1.5 py-0`,children:n.agent}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,className:`ml-auto gap-2`,disabled:l===`running`,onClick:async()=>{u(`running`);try{await s.mutateAsync({task:`title-summary`,instruction:`Process session ${e} only`}),u(`done`)}catch{u(`error`)}},children:[l===`running`?(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}):(0,G.jsx)(co,{className:`h-4 w-4`}),l===`done`?`Summary Requested`:`Generate Summary`]}),(()=>{let t=n.status!==`active`,r=c.isSuccess?`Session Completed`:t?`Already Completed`:`Complete Session`;return(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,className:`gap-2`,disabled:c.isPending||t,title:t?`Session is already completed`:`Mark this session completed and regenerate its summary`,onClick:()=>c.mutate(e),children:[c.isPending?(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}):(0,G.jsx)(oa,{className:`h-4 w-4`}),r]})})(),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-2 text-tertiary hover:text-tertiary hover:bg-tertiary/10`,onClick:()=>f(!0),children:[(0,G.jsx)(ho,{className:`h-4 w-4`}),`Delete`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 font-sans text-sm text-on-surface-variant`,children:[n.user&&(0,G.jsxs)(`span`,{children:[`User: `,(0,G.jsx)(`span`,{className:`text-on-surface`,children:n.user})]}),n.branch&&(0,G.jsxs)(`span`,{children:[`Branch: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:n.branch})]}),(0,G.jsxs)(`span`,{children:[`Started `,rP(n.started_at)]}),n.ended_at&&(0,G.jsxs)(`span`,{children:[`Duration: `,bv(n.started_at,n.ended_at)]})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsx)(Qj,{label:`Prompts`,value:String(n.prompt_count),tone:`sage`}),(0,G.jsx)(Qj,{label:`Tool Calls`,value:String(n.tool_count),tone:`sage`}),(0,G.jsx)(Qj,{label:`Plans`,value:String(b?.length??0)}),(0,G.jsx)(ZN,{sessionId:e})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-4 overflow-hidden`,children:[(0,G.jsx)(ZM,{className:`mb-3`,children:`Metadata`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-6`,children:[(0,G.jsx)(aP,{label:`Session ID`,value:e,copyable:!0}),x&&(0,G.jsx)(aP,{label:`Resume`,value:x,copyable:!0,code:!0}),n.parent_session_id&&(0,G.jsx)(aP,{label:`Parent`,value:n.parent_session_id}),n.parent_session_reason&&(0,G.jsx)(aP,{label:`Reason`,value:n.parent_session_reason,mono:!1}),n.project_root&&(0,G.jsx)(aP,{label:`Project`,value:n.project_root})]})]}),n.summary&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 overflow-hidden`,children:[(0,G.jsx)(ZM,{className:`mb-2`,children:`Summary`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant whitespace-pre-wrap break-words`,children:n.summary})]}),(0,G.jsxs)(`div`,{className:`min-w-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex gap-0 border-b border-border mb-4`,children:[(0,G.jsx)(oP,{label:`Conversation`,value:`conversation`,activeTab:h,onClick:g}),(0,G.jsx)(oP,{label:`Plans`,value:`plans`,activeTab:h,onClick:g}),(0,G.jsx)(oP,{label:`Spores`,value:`spores`,activeTab:h,onClick:g})]}),h===`conversation`&&(0,G.jsx)(bN,{sessionId:e}),h===`plans`&&(0,G.jsx)(kN,{sessionId:e,expandedPlanId:_}),h===`spores`&&(0,G.jsx)(WN,{sessionId:e})]}),(0,G.jsx)(AM,{open:d,onOpenChange:e=>{f(e),e||m(!1)},title:`Delete Session`,description:p?`Session appears live — the agent is still running. Deleting now permanently discards the rest of the session as it happens. Delete anyway?`:`This will permanently remove this session and all related data. This action cannot be undone.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-tertiary`}),meta:n?[{label:`ID`,value:_v(n.id)},{label:`Title`,value:n.title||_v(n.id)}]:[],impact:y?[{label:`Prompts`,value:y.promptCount},{label:`Spores`,value:y.sporeCount},{label:`Attachments`,value:y.attachmentCount},{label:`Graph Edges`,value:y.graphEdgeCount}]:[],confirmLabel:p?`Delete Anyway`:`Delete Session`,variant:`destructive`,onConfirm:()=>{v.mutate({id:n.id,force:p},{onSuccess:()=>{f(!1),m(!1),t(`/sessions`)},onError:e=>{e instanceof ms&&e.status===409&&e.body?.error===`session_live`&&m(!0)}})},isPending:v.isPending})]})}var cP=300;function lP(e,t=cP){let[n,r]=(0,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function uP({initialFilters:e}){let[t,n]=(0,W.useState)(``),r=lP(t),[i,a]=(0,W.useState)(e),[o,s]=(0,W.useState)(0),c=(0,W.useCallback)((e,t)=>{a(n=>({...n,[e]:t})),s(0)},[]),l=(0,W.useCallback)(e=>{n(e),s(0)},[]),u=(0,W.useCallback)(()=>{n(``),a(e),s(0)},[e]),d=(0,W.useMemo)(()=>t.trim().length>0||o>0||Object.entries(i).some(([t,n])=>n!==(e[t]??`all`)),[i,e,o,t]),f=(0,W.useCallback)(e=>{let t=i[e];return t&&t!==`all`?t:void 0},[i]);return{searchInput:t,debouncedSearch:r.length>0?r:void 0,filterValues:i,offset:o,setOffset:s,handleSearchChange:l,handleFilterChange:c,handleClearFilters:u,hasActiveFilters:d,activeFilter:f}}function dP(e,t=``,n=``){return`${e}${t}${n}`}function fP(e){if(!e)return 0;let t=Number(e);return Number.isInteger(t)&&t>0?t:0}function pP(e,t){let n=new URLSearchParams(e);for(let[e,r]of Object.entries(t)){let t=r.value,i=r.defaultValue;t==null||t===``||i!==void 0&&String(t)===String(i)?n.delete(e):n.set(e,String(t))}return n}function mP(e,t,n=``){let r=t.toString();return`${e}${r?`?${r}`:``}${n}`}function hP({filters:e,searchParam:t=`q`,offsetParam:n=`offset`}){let r=An(),i=Nn(),[a,o]=(0,W.useState)(()=>new URLSearchParams(r.search).get(t)??``),s=lP(a);(0,W.useEffect)(()=>{let e=new URLSearchParams(r.search).get(t)??``;o(t=>t===e?t:e)},[r.search,t]);let c=(0,W.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.key,n.defaultValue??`all`);return t},[e]),l=(0,W.useMemo)(()=>{let t=new URLSearchParams(r.search),n={};for(let r of e){let e=r.defaultValue??`all`;n[r.key]=t.get(r.key)??e}return n},[e,r.search]),u=(0,W.useMemo)(()=>fP(new URLSearchParams(r.search).get(n)),[r.search,n]),d=(0,W.useCallback)((e,t)=>{i(mP(r.pathname,e,r.hash),t)},[r.hash,r.pathname,i]),f=(0,W.useCallback)(e=>{d(pP(r.search,{[n]:{value:e,defaultValue:0}}))},[r.search,d,n]),p=(0,W.useCallback)(e=>{o(e),d(pP(r.search,{[t]:{value:e},[n]:{value:0,defaultValue:0}}),{replace:!0})},[r.search,d,n,t]),m=(0,W.useCallback)((e,t)=>{let i=c.get(e)??`all`;d(pP(r.search,{[e]:{value:t,defaultValue:i},[n]:{value:0,defaultValue:0}}))},[c,r.search,d,n]),h=(0,W.useCallback)(()=>{o(``);let i={[t]:{value:void 0},[n]:{value:0,defaultValue:0}};for(let t of e){let e=t.defaultValue??`all`;i[t.key]={value:e,defaultValue:e}}d(pP(r.search,i))},[e,r.search,d,n,t]),g=(0,W.useMemo)(()=>a.trim().length>0||u>0||e.some(e=>{let t=e.defaultValue??`all`;return l[e.key]!==t}),[l,e,u,a]),_=(0,W.useCallback)(e=>{let t=l[e],n=c.get(e)??`all`;return t&&t!==n?t:void 0},[c,l]);return{searchInput:a,debouncedSearch:s.length>0?s:void 0,filterValues:l,offset:u,setOffset:f,handleSearchChange:p,handleFilterChange:m,handleClearFilters:h,hasActiveFilters:g,activeFilter:_}}var gP={key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:`active`,label:`Active`},{value:`completed`,label:`Completed`}]},_P={key:`has_plan`,label:`Plans`,options:[{value:`all`,label:`All sessions`},{value:`true`,label:`With a plan`}]};function vP(){let{id:e}=Ln(),t=Nn(),n=An(),r=(0,W.useRef)(null),{searchInput:i,debouncedSearch:a,filterValues:o,offset:s,setOffset:c,handleSearchChange:l,handleFilterChange:u,handleClearFilters:d,hasActiveFilters:f,activeFilter:p}=hP({filters:[{key:`status`,defaultValue:`all`},{key:`agent`,defaultValue:`all`},{key:`has_plan`,defaultValue:`all`}]}),{data:m}=NM(),h=(0,W.useMemo)(()=>[gP,{key:`agent`,label:`Symbiont`,options:[{value:`all`,label:`All symbionts`},...(m?.symbionts??[]).filter(e=>e.enabled).map(e=>({value:e.name,label:e.displayName}))]},_P],[m]),g=p(`status`),_=p(`agent`),v=p(`has_plan`)===`true`,y=(0,W.useMemo)(()=>{if(!e)return n.pathname;let t=`/${e}`;return n.pathname.endsWith(t)?n.pathname.slice(0,-t.length):n.pathname},[e,n.pathname]),b=(0,W.useCallback)((e,r)=>{let i=new URLSearchParams(n.search);t(mP(`${y}/${e}`,i,n.hash),r)},[n.hash,n.search,t,y]),x=(0,W.useCallback)(()=>{t(mP(y,new URLSearchParams(n.search),n.hash))},[n.hash,n.search,t,y]);return(0,G.jsxs)(`div`,{className:`flex flex-col h-full gap-4 p-4`,children:[(0,G.jsx)(TM,{searchPlaceholder:`Search sessions...`,searchValue:i,onSearchChange:l,filters:h,filterValues:o,onFilterChange:u,onClear:d,hasActiveFilters:f,inputRef:r}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,G.jsx)(CM,{hasSelection:!!e,onCloseMobileDetail:x,masterAriaLabel:`Sessions`,detailAriaLabel:`Session details`,master:(0,G.jsx)(XM,{selectedId:e,search:a,statusFilter:g,agentFilter:_,hasPlanFilter:v,offset:s,onOffsetChange:c,filterInputRef:r,onSelectSession:b}),detail:e?(0,G.jsx)(sP,{id:e}):(0,G.jsx)(wM,{message:`Select a session to see its details.`})})})]})}function yP({title:e,subtitle:t,actions:n,className:r}){return(0,G.jsx)(`div`,{className:J(`pb-6`,r),children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`font-serif text-2xl font-normal text-on-surface tracking-wide`,children:e}),t&&(0,G.jsx)(`p`,{className:`mt-1 font-sans text-sm text-on-surface-variant`,children:t})]}),n&&(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:n})]})})}function bP({checked:e,onCheckedChange:t,disabled:n}){return(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,disabled:n,onClick:()=>t(!e),className:`relative inline-flex h-6 w-11 shrink-0 rounded-full transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 ${n?`cursor-not-allowed opacity-50`:`cursor-pointer`} ${e?`bg-primary`:`bg-surface-container-high`}`,children:(0,G.jsx)(`span`,{className:`pointer-events-none block h-5 w-5 rounded-full bg-on-surface shadow-lg ring-0 transition-transform ${e?`translate-x-5`:`translate-x-0`}`})})}var xP=(0,W.createContext)(null);function SP({children:e}){let[t,n]=(0,W.useState)(()=>new Set),r=(0,W.useCallback)(e=>{n(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),i=(0,W.useCallback)(()=>n(new Set),[]),a=(0,W.useMemo)(()=>({dirty:t,markDirty:r,clear:i}),[t,r,i]);return(0,G.jsx)(xP.Provider,{value:a,children:e})}function CP(){let e=(0,W.useContext)(xP);if(!e)throw Error(`useRestartGate must be inside RestartGateProvider`);return e}function wP(){return(0,W.useContext)(xP)?.markDirty??(()=>{})}function TP(){let{dirty:e,clear:t}=CP(),{restart:n,isRestarting:r}=Us();if(e.size===0)return null;let i=async()=>{try{await n(),t()}catch{}};return(0,G.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-4 rounded-md border border-ochre/40 bg-ochre/5 p-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Restart required`}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant truncate`,children:[`Changed: `,[...e].join(`, `)]})]}),(0,G.jsxs)(Y,{onClick:i,size:`sm`,disabled:r,children:[r?(0,G.jsx)(Ra,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):(0,G.jsx)(Qa,{className:`mr-1.5 h-3.5 w-3.5`}),`Restart daemon`]})]})}function EP({id:e,label:t,scope:n,scopeIndicator:r,hint:i,helper:a,error:o,children:s}){return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:e,className:`font-sans text-sm font-medium text-on-surface`,children:t}),i&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant font-normal`,children:[`(`,i,`)`]}),r??(n?(0,G.jsx)(Ok,{scope:n}):null)]}),s,a&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:a}),o&&(0,G.jsxs)(`p`,{className:`flex items-center gap-1 font-sans text-xs text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-3 w-3`}),`Save failed: `,o]})]})}var DP={machine:`machine`,grove:`grove`,project:`project`,local:`personal`};function OP({path:e,label:t,hint:n,requiresRestart:r,commitOn:i=`change`,parse:a,children:o}){let{effective:s,local:c,setField:l,resetField:u}=ek(),d=wP(),f=Sk(e),p=f.overridableBy.includes(`local`),m=f.home,h=zO(s??{},e),g=p&&zO(c??{},e)!==void 0,_=(0,W.useRef)(h);_.current=h;let[v,y]=(0,W.useState)(h),b=(0,W.useRef)(!1);(0,W.useEffect)(()=>{b.current||y(h)},[h]);let[x,S]=(0,W.useState)(null),C=(0,W.useCallback)(t=>{let n=a?a(t):t;n!==_.current&&(S(null),l(e,n,m).then(()=>{r&&d(e)}).catch(t=>{y(_.current),S(t instanceof Error?t.message:String(t)),console.error(`[scoped-field] write failed for ${e}`,t)}))},[e,m,a,r,l,d]),w=(0,W.useCallback)(e=>{b.current=!0,y(e),i===`change`&&(C(e),b.current=!1)},[C,i]),T=(0,W.useCallback)(()=>{i===`blur`&&v!==void 0&&C(v),b.current=!1},[C,i,v]),E=p?(0,G.jsx)(Ak,{path:e,hasLocalOverride:g,onSavePersonal:()=>l(e,_.current,`local`).catch(e=>console.error(`[scoped-field] save-personal failed`,e)),onReset:()=>u(e).catch(e=>console.error(`[scoped-field] reset failed`,e))}):void 0,D=DP[f.home]??`project`;return(0,G.jsx)(`div`,{id:Fi(e),"data-config-field":e,className:`rounded-md transition-all duration-300`,children:(0,G.jsx)(EP,{label:t,hint:n,scope:E?void 0:D,scopeIndicator:E,error:x??void 0,children:o({value:v,onChange:w,onBlur:T})})})}var kP=200,AP={1500:`T1500 — Compact`,5e3:`T5000 — Standard`,1e4:`T10000 — Full`};function jP(e){return AP[e]??`T${e}`}function MP({tier:e}){let[t,n]=(0,W.useState)(!1),r=e.content.length>kP,i=r&&!t?e.content.slice(0,kP)+`…`:e.content;return(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface font-medium`,children:jP(e.tier)}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Generated `,mv(e.generated_at)]})]}),(0,G.jsx)(kO,{content:i}),r&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`h-7 gap-1 text-xs text-on-surface-variant`,onClick:()=>n(!t),children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(na,{className:`h-3 w-3`}),`Show less`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($i,{className:`h-3 w-3`}),`Show more (`,e.content.length-kP,` more chars)`]})})]})}function NP(){return(0,G.jsxs)(Q,{level:`low`,className:`p-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`div`,{className:`h-4 w-24 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-20 animate-pulse rounded bg-surface-container`})]}),(0,G.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[(0,G.jsx)(`div`,{className:`h-3 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-3/5 animate-pulse rounded bg-surface-container`})]})]})}function PP({agentId:e}){let{data:t,isLoading:n,isError:r,error:i}=zN(e),a=t?.tiers??[];return n?(0,G.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,G.jsx)(NP,{},e))}):r?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-destructive`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load digest`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:i instanceof Error?i.message:`Unknown error`})]}):a.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ea,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No digest generated yet`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-center max-w-xs`,children:`Run the agent with the digest-only task to synthesize your vault knowledge into context extracts.`})]}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[a.length,` tier`,a.length===1?``:`s`,` — pre-computed context extracts at different token budgets.`]}),a.map(e=>(0,G.jsx)(MP,{tier:e},e.tier))]})}var FP=6,IP=[{value:`all`,label:`All`},{value:`yes`,label:`Yes`},{value:`no`,label:`No`}],LP=[{value:`all`,label:`All`},{value:`typescript`,label:`TypeScript`},{value:`javascript`,label:`JavaScript`},{value:`tsx`,label:`TSX`},{value:`jsx`,label:`JSX`},{value:`python`,label:`Python`},{value:`rust`,label:`Rust`},{value:`go`,label:`Go`},{value:`json`,label:`JSON`},{value:`yaml`,label:`YAML`},{value:`markdown`,label:`Markdown`},{value:`shell`,label:`Shell`},{value:`sql`,label:`SQL`}],RP=[{id:`path`,label:`Path`},{id:`language`,label:`Language`},{id:`embedded`,label:`Embedded`},{id:`llm_updated_at`,label:`Last Described`},{id:`token_estimate`,label:`Tokens`}];function zP(e){if(e===`yes`)return!0;if(e===`no`)return!1}function BP(e){return(0,G.jsx)(X,{variant:e?`default`:`secondary`,children:e?`Yes`:`No`})}function VP({label:e,value:t,options:n,onValueChange:r,triggerClassName:i=`w-32`}){return(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-sans text-xs uppercase tracking-wider`,children:e}),(0,G.jsx)(`div`,{className:`${i} shrink-0`,children:(0,G.jsxs)(v_,{value:t,onValueChange:r,children:[(0,G.jsx)(b_,{children:(0,G.jsx)(y_,{})}),(0,G.jsx)(x_,{children:n.map(e=>(0,G.jsx)(S_,{value:e.value,children:e.label},e.value))})]})})]})}function HP({children:e,className:t,sortKey:n,activeSort:r,activeDir:i,onSort:a}){let o=n!==void 0&&a!==void 0,s=o&&r===n;return o?(0,G.jsx)(`th`,{className:J(`px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,t),"aria-sort":s?i===`desc`?`descending`:`ascending`:`none`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>a(n),className:J(`flex items-center gap-1 uppercase tracking-widest text-[10px] font-medium transition-colors`,s?`text-on-surface`:`text-on-surface-variant hover:text-on-surface`),"aria-label":`Sort by ${String(e)}`,children:[(0,G.jsx)(`span`,{children:e}),s?i===`desc`?(0,G.jsx)($i,{className:`h-3 w-3`}):(0,G.jsx)(na,{className:`h-3 w-3`}):(0,G.jsx)($i,{className:`h-3 w-3 opacity-30`})]})}):(0,G.jsx)(`th`,{className:J(`px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,t),children:e})}function UP(){return(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)]`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-64 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-16 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-20 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-12 rounded bg-surface-container-high animate-pulse`})})]})}function WP({entry:e,selected:t,onClick:n}){return(0,G.jsxs)(`tr`,{className:J(`border-b border-[var(--ghost-border)] last:border-0 cursor-pointer transition-all duration-150`,`hover:bg-surface-container/60 hover:shadow-[inset_3px_0_0_var(--primary)]`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40`,t&&`bg-primary/5 shadow-[inset_3px_0_0_var(--primary)]`),onClick:n,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},tabIndex:0,role:`row`,"aria-selected":t,"aria-label":`Canopy entry: ${e.path}`,"data-testid":`canopy-entry-row-${e.path}`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface block truncate`,title:e.path,children:e.path})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:e.language??`—`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:BP(e.llm_description!==null)}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:BP(e.embedded===1)}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:Sv(e.llm_updated_at)})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:e.token_estimate.toLocaleString()})})]})}function GP({selectedPath:e,onSelectPath:t}){let{searchInput:n,debouncedSearch:r,filterValues:i,offset:a,setOffset:o,handleSearchChange:s,handleFilterChange:c,activeFilter:l}=uP({initialFilters:{language:`all`,described:`all`}}),[u,d]=(0,W.useState)(`llm_updated_at`),[f,p]=(0,W.useState)(`desc`),m=e=>{e===u?p(e=>e===`asc`?`desc`:`asc`):(d(e),p(`asc`))},{data:h,isLoading:g,isError:_,error:v}=kj((0,W.useMemo)(()=>({limit:50,offset:a,language:l(`language`),described:zP(l(`described`)),q:r,sort_by:u,sort_dir:f}),[a,l,r,u,f])),y=h?.rows??[],b=h?.total??0,x=(0,G.jsxs)(Q,{level:`bright`,className:`flex flex-wrap items-center gap-3 px-4 py-2 rounded-md`,children:[(0,G.jsx)(no,{className:`h-3.5 w-3.5 text-on-surface-variant shrink-0`}),(0,G.jsx)(op,{placeholder:`Search files (path or description)…`,value:n,onChange:e=>s(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1 min-w-[180px]`,"aria-label":`Search files`}),(0,G.jsx)(VP,{label:`Language`,value:i.language??`all`,options:LP,onValueChange:e=>c(`language`,e)}),(0,G.jsx)(VP,{label:`Described`,value:i.described??`all`,options:IP,onValueChange:e=>c(`described`,e)})]}),S=(0,G.jsx)(`thead`,{children:(0,G.jsx)(`tr`,{className:`border-b border-[var(--ghost-border)] bg-surface-container/50`,children:RP.map((e,t)=>{let n=[(0,G.jsx)(HP,{sortKey:e.id,activeSort:u,activeDir:f,onSort:m,children:e.label},e.id)];return e.id===`language`&&n.push((0,G.jsx)(HP,{children:`Described`},`described`)),n})})});return _?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[x,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load canopy entries`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:v instanceof Error?v.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[x,g?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[S,(0,G.jsx)(`tbody`,{children:Array.from({length:FP}).map((e,t)=>(0,G.jsx)(UP,{},t))})]})}):y.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-3 text-on-surface-variant`,"data-testid":`canopy-entries-empty`,children:[(0,G.jsx)(Sa,{className:`h-10 w-10 opacity-20`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:b===0?`No canopy entries match the current filters.`:`No matching entries on this page.`})]}):(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Canopy entries`,children:[S,(0,G.jsx)(`tbody`,{children:y.map(n=>(0,G.jsx)(WP,{entry:n,selected:n.path===e,onClick:()=>t(n.path)},n.path))})]})}),(0,G.jsx)(jM,{total:b,offset:a,limit:50,onPageChange:o})]})}function KP({open:e,onClose:t,widthPx:n=480,children:r,ariaLabel:i=`Detail panel`,className:a,testIdRoot:o}){return(0,W.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),e?(0,G.jsxs)(Q,{glass:!0,role:`dialog`,"aria-label":i,className:J(`fixed top-3 right-3 bottom-3 z-30 flex flex-col shadow-lg border border-outline-variant/15 rounded-md max-w-[calc(100vw-1.5rem)]`,a),style:{width:n},"data-testid":o?`${o}-panel`:void 0,children:[(0,G.jsx)(`div`,{className:`flex justify-end px-3 pt-3`,children:(0,G.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close detail`,"data-testid":o?`${o}-close`:void 0,className:`shrink-0 rounded-md p-1 text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high transition-colors`,children:(0,G.jsx)(So,{className:`h-4 w-4`})})}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 pb-5 pt-2`,children:r})]}):null}function qP(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function JP(e){return e.length>12?`${e.slice(0,12)}…`:e}function YP({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[140px_1fr] gap-3 items-baseline`,children:[(0,G.jsx)(`span`,{className:`font-sans text-xs uppercase tracking-wide text-on-surface-variant`,children:e}),(0,G.jsx)(`div`,{className:`font-mono text-xs text-on-surface min-w-0 break-all`,children:t})]})}function XP({text:e}){let[t,n]=(0,W.useState)(!1),r=(0,W.useCallback)(async()=>{navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(e),n(!0),window.setTimeout(()=>n(!1),1500))},[e]);return(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>void r(),className:`gap-1 px-2 h-6 text-xs text-on-surface-variant`,children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Qi,{className:`h-3 w-3`}),`Copied`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pa,{className:`h-3 w-3`}),`Copy`]})})}function ZP(){return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`h-7 w-48 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-20 animate-pulse rounded-md bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-4 w-full animate-pulse rounded bg-surface-container-high`},t))})]})}function QP({path:e,onBack:t,onClose:n}){let{data:r,isPending:i,isError:a,error:o}=Aj(e),s=jj(),c=Mj(),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(null),[h,g]=(0,W.useState)(!1),_=(0,W.useMemo)(()=>qP(r?.exports_json??null),[r?.exports_json]),v=(0,W.useMemo)(()=>qP(r?.imports_json??null),[r?.imports_json]),y=(0,W.useCallback)(()=>{u(null),f(!1),s.mutate(e,{onSuccess:()=>{f(!0),window.setTimeout(()=>f(!1),2500)},onError:e=>{u(e instanceof Error?e.message:`Re-embed failed`)}})},[e,s]),b=(0,W.useCallback)(()=>{m(null),g(!1),c.mutate(e,{onSuccess:()=>{g(!0),window.setTimeout(()=>g(!1),2500)},onError:e=>{m(e instanceof Error?e.message:`Re-describe failed`)}})},[e,c]);if(i)return(0,G.jsx)(KP,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsx)(ZP,{})});if(a)return(0,G.jsx)(KP,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[t?(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Back to list`]}):null,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,"data-testid":`canopy-entry-detail-error`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load entry`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:o instanceof Error?o.message:`Unknown error`})]})]})});if(!r)return(0,G.jsx)(KP,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[t?(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Back to list`]}):null,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant`,"data-testid":`canopy-entry-detail-empty`,children:[(0,G.jsx)(ra,{className:`h-5 w-5 opacity-50`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No entry found at this path.`})]})]})});let x=r.embedded===1;return(0,G.jsx)(KP,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,"data-testid":`canopy-entry-detail`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2 min-w-0`,children:[t?(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant -ml-2`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Back to list`]}):null,(0,G.jsx)(`h2`,{className:`font-mono text-sm text-on-surface break-all`,title:r.path,children:r.path}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r.language?(0,G.jsx)(X,{variant:`outline`,children:r.language}):null,(0,G.jsx)(X,{variant:x?`default`:`secondary`,children:x?`Embedded`:`Not embedded`}),(0,G.jsx)(X,{variant:r.llm_description?`default`:`secondary`,children:r.llm_description?`Described`:`No description`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:b,disabled:c.isPending,className:`gap-2`,"data-testid":`canopy-entry-redescribe`,"aria-label":`Re-run the Myco agent's description for this file.`,title:`Re-run the Myco agent's description for this file.`,children:[(0,G.jsx)(co,{className:c.isPending?`h-3.5 w-3.5 animate-pulse`:`h-3.5 w-3.5`}),c.isPending?`Describing...`:`Re-describe`]}),(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:y,disabled:s.isPending,className:`gap-2`,"data-testid":`canopy-entry-reembed`,children:[(0,G.jsx)(Qa,{className:s.isPending?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),s.isPending?`Queuing...`:`Re-embed`]})]}),h?(0,G.jsx)(`span`,{className:`font-sans text-xs text-primary`,role:`status`,children:`Queued for re-describe`}):null,p?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:p}):null,d?(0,G.jsx)(`span`,{className:`font-sans text-xs text-primary`,role:`status`,children:`Queued for re-embed`}):null,l?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:l}):null]})]}),r.llm_description?(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-primary/15 p-4`,children:[(0,G.jsx)(ZM,{children:`Description`}),(0,G.jsx)(`p`,{className:`mt-2 font-sans text-sm text-on-surface leading-relaxed`,children:r.llm_description})]}):(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4`,children:[(0,G.jsx)(ZM,{children:`Description`}),(0,G.jsx)(`p`,{className:`mt-2 font-sans text-sm text-on-surface-variant`,children:`The Myco agent hasn't described this file yet.`})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-2`,children:[(0,G.jsx)(ZM,{children:`Exports`}),_.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`No exports detected.`}):(0,G.jsx)(`ul`,{className:`space-y-1`,children:_.map(e=>(0,G.jsx)(`li`,{className:`font-mono text-xs text-on-surface break-all`,children:e},e))})]}),(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-2`,children:[(0,G.jsx)(ZM,{children:`Imports`}),v.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`No imports detected.`}):(0,G.jsx)(`ul`,{className:`space-y-1`,children:v.map(e=>(0,G.jsx)(`li`,{className:`font-mono text-xs text-on-surface break-all`,children:e},e))})]})]}),r.top_comment?(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-2`,children:[(0,G.jsx)(ZM,{children:`Top Comment`}),(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs text-on-surface`,children:r.top_comment})]}):null,(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-3`,children:[(0,G.jsx)(ZM,{children:`Metadata`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(YP,{label:`Tokens`,children:r.token_estimate.toLocaleString()}),(0,G.jsx)(YP,{label:`Lines`,children:r.line_count.toLocaleString()}),(0,G.jsxs)(YP,{label:`Size`,children:[r.size_bytes.toLocaleString(),` B`]}),(0,G.jsx)(YP,{label:`Hash`,children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(`code`,{title:r.content_hash,children:JP(r.content_hash)}),(0,G.jsx)(XP,{text:r.content_hash})]})}),(0,G.jsx)(YP,{label:`Indexed`,children:hv(r.mechanical_updated_at)}),(0,G.jsx)(YP,{label:`Described`,children:r.llm_updated_at===null?`—`:hv(r.llm_updated_at)})]})]})]})})}function $P({defaultPath:e}={}){let[t,n]=(0,W.useState)(e);return(0,G.jsxs)(`div`,{className:`relative space-y-6`,children:[(0,G.jsx)(GP,{selectedPath:t,onSelectPath:n}),t?(0,G.jsx)(QP,{path:t,onClose:()=>n(void 0)}):null]})}var eF={canopy_disabled:{title:`Canopy injection is turned off.`,detail:(0,G.jsxs)(G.Fragment,{children:[`Enable canopy injection on the`,` `,(0,G.jsx)(ri,{to:`/cortex?tab=canopy`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`Cortex → Canopy`}),` `,`page before regenerating the map.`]})},no_described_entries:{title:`No described files yet.`,detail:(0,G.jsxs)(G.Fragment,{children:[`The map is built from per-file descriptions written by the`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),`, which is opt-in. Enable its schedule (or run it once) so files get described, then regenerate the map.`]})},inputs_unchanged:{title:`The map is already current.`,detail:(0,G.jsx)(G.Fragment,{children:`No described files have changed since the last run. Use Rebuild to regenerate from scratch.`})},no_project_root:{title:`Project root unavailable.`,detail:(0,G.jsx)(G.Fragment,{children:`The daemon can’t resolve a project directory for this vault.`})}};function tF(){let e=Pj(),t=Fj(),[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(null),c=(0,W.useCallback)(e=>{r(null),a(null),s(e),t.mutate({force_cold_start:e===`rebuild`},{onSettled:()=>s(null),onSuccess:e=>{`skipped`in e&&e.skipped&&a(e.reason)},onError:e=>{r(e instanceof Error?e.message:`Regenerate failed`)}})},[t]),l=i?eF[i]??null:null,u=t.isPending,d=e.data,f=d?.is_empty===!0||!d?.content,p=d?.generated_at!==void 0&&d.generated_at!==null?hv(d.generated_at):`—`,m=d?.token_estimate!==void 0&&d.token_estimate!==null?d.token_estimate.toLocaleString():`—`;return(0,G.jsxs)(`div`,{className:`space-y-6`,"data-testid":`project-map-panel`,children:[(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-primary/15 p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(Ba,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`The Canopy Map is a guided tour of your project's architecture.`}),(0,G.jsxs)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:[`The Myco agent regenerates it as the codebase shifts, so connected agents can pull a current overview before exploring with Glob or Grep. Use `,(0,G.jsx)(`strong`,{children:`Rebuild`}),` to start over from scratch instead of refreshing the existing draft.`]})]})]})}),(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2 min-w-0`,children:[(0,G.jsx)(ZM,{children:`Canopy Map`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{"data-testid":`project-map-generated-at`,children:[`Last generated: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:p})]}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,G.jsxs)(`span`,{"data-testid":`project-map-tokens`,children:[`Tokens: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:m})]}),f?(0,G.jsx)(X,{variant:`secondary`,className:`ml-1`,children:`No map yet`}):null]})]}),f?null:(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`default`,size:`sm`,onClick:()=>c(`refresh`),disabled:u,className:`gap-2`,"data-testid":`canopy-map-refresh`,children:[(0,G.jsx)(Qa,{className:o===`refresh`?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),o===`refresh`?`Refreshing…`:`Refresh`]}),(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:()=>c(`rebuild`),disabled:u,className:`gap-2`,"data-testid":`canopy-map-rebuild`,children:[(0,G.jsx)($a,{className:o===`rebuild`?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),o===`rebuild`?`Rebuilding…`:`Rebuild`]})]}),n?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:n}):null]})]}),i?(0,G.jsxs)(`div`,{className:`mt-4 flex items-start gap-2 rounded-md border border-primary/20 bg-primary/5 p-3 text-xs text-on-surface`,role:`status`,"data-testid":`canopy-map-skip-notice`,children:[(0,G.jsx)(Ma,{className:`mt-0.5 h-3.5 w-3.5 flex-shrink-0 text-primary`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans font-medium`,children:l?.title??`Regenerate skipped.`}),(0,G.jsx)(`p`,{className:`font-sans text-on-surface-variant`,children:l?.detail??(0,G.jsxs)(G.Fragment,{children:[`Reason: `,(0,G.jsx)(`code`,{className:`font-mono`,children:i})]})})]})]}):null]}),e.isPending?(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6`,children:(0,G.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,G.jsx)(`div`,{className:`h-5 w-1/3 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-full animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-5/6 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-2/3 animate-pulse rounded bg-surface-container-high`})]})}):e.isError?(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-tertiary/20 p-6`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 text-tertiary`,"data-testid":`project-map-error`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load Canopy Map.`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:e.error instanceof Error?e.error.message:`Unknown error`})]})}):f?(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-primary/20 p-8`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 text-center`,"data-testid":`project-map-empty`,children:[(0,G.jsx)(Ba,{className:`h-6 w-6 text-primary`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface`,children:d?.message??`No Canopy Map yet.`}),(0,G.jsxs)(`p`,{className:`max-w-md font-sans text-xs text-on-surface-variant`,children:[`Generate the first map to give connected agents a high-level tour of your codebase. Future runs refresh incrementally; use`,` `,(0,G.jsx)(`strong`,{children:`Rebuild`}),` to start over.`]}),(0,G.jsxs)(`p`,{className:`max-w-md font-sans text-xs text-on-surface-variant`,children:[`The map needs at least one described file to build from. Enable the`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),` `,`(opt-in by default) so files get described in the background.`]}),(0,G.jsxs)(Y,{variant:`default`,size:`sm`,onClick:()=>c(`rebuild`),disabled:u,className:`gap-2 mt-1`,"data-testid":`canopy-map-generate`,children:[(0,G.jsx)(Qa,{className:u?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),u?`Generating…`:`Generate Map`]}),n?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:n}):null,i?(0,G.jsxs)(`div`,{className:`max-w-md space-y-1 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`p`,{className:`font-sans font-medium text-on-surface`,children:l?.title??`Regenerate skipped.`}),(0,G.jsx)(`p`,{className:`font-sans`,children:l?.detail??(0,G.jsxs)(G.Fragment,{children:[`Reason: `,(0,G.jsx)(`code`,{className:`font-mono`,children:i})]})})]}):null]})}):(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6`,children:(0,G.jsx)(`div`,{"data-testid":`project-map-content`,children:(0,G.jsx)(kO,{content:d.content})})})]})}var nF={2:`grid-cols-1 md:grid-cols-2`,3:`grid-cols-1 md:grid-cols-3`,4:`grid-cols-1 md:grid-cols-2 lg:grid-cols-4`};function rF(e,t){return e||(t<=2?2:t===3?3:4)}function iF({tabs:e,activeTab:t,onTabChange:n,columns:r,className:i}){return(0,G.jsx)(`div`,{role:`tablist`,className:J(`grid divide-y md:divide-y-0 md:divide-x divide-[var(--ghost-border)] border border-[var(--ghost-border)] rounded-md overflow-hidden bg-surface-container-low`,nF[rF(r,e.length)],i),children:e.map(e=>{let r=e.id===t;return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.id),className:J(`relative flex flex-col items-start gap-1 px-4 py-3 text-left transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,r?`bg-surface-container text-on-surface`:`text-on-surface-variant hover:bg-surface-container/60 hover:text-on-surface`),children:[r&&(0,G.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-[2px] bg-sage`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.Icon&&(0,G.jsx)(e.Icon,{size:14,className:r?`text-sage`:`text-outline`}),(0,G.jsx)(`span`,{className:`myco-display-xs`,children:e.label})]}),e.description&&(0,G.jsx)(`span`,{className:`myco-eyebrow-sm`,children:e.description})]},e.id)})})}function aF({tabs:e,activeTab:t,onTabChange:n,className:r}){return(0,G.jsx)(`div`,{role:`tablist`,className:J(`inline-flex items-center gap-1 p-1 rounded-md bg-surface-container-low border border-[var(--ghost-border)]`,r),children:e.map(e=>{let r=e.id===t;return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.id),className:J(`inline-flex items-center gap-1.5 px-3 py-1 rounded text-sm font-sans transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,r?`bg-surface-container text-on-surface shadow-[inset_0_-2px_0_var(--sage)]`:`text-on-surface-variant hover:text-on-surface`),children:[(0,G.jsx)(`span`,{children:e.label}),e.count!=null&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline`,children:e.count})]},e.id)})})}var oF=[{id:`overview`,label:`Overview`},{id:`entries`,label:`Entries`},{id:`map`,label:`Map`}],sF=new Set(oF.map(e=>e.id)),cF=`section`,lF=[{id:`instructions`,label:`Instructions`,description:`session-start`},{id:`builder`,label:`Builder`,description:`prompt forge`},{id:`digest`,label:`Digest`,description:`context tiers`},{id:`canopy`,label:`Canopy`,description:`code index`}],uF=new Set(lF.map(e=>e.id)),dF=new Set([`completed`,`failed`,`skipped`]),fF=12,pF=140,mF=[{value:`1500`,label:`1.5K - Executive briefing`},{value:`5000`,label:`5K - Deep onboarding`},{value:`10000`,label:`10K - Full institutional`}];function hF(e){let t=new URLSearchParams(e).get(`tab`);return t&&uF.has(t)?t:`instructions`}function gF(e){let t=new URLSearchParams(e).get(cF);return t&&sF.has(t)?t:`overview`}function _F(e){return e?new Date(e*1e3).toLocaleString():`Not generated yet`}function vF(e){switch(e){case`event-tasks-disabled`:return`event-driven tasks are disabled`;case`provider-not-configured`:return`no provider is configured for Cortex instructions`;case`agent-module-unavailable`:return`the agent harness is unavailable`;default:return e??`unknown reason`}}function yF(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=e.match(RegExp(`## ${n}\\n([\\s\\S]*?)\\n\\n## `));if(!r?.[1])return null;try{return JSON.parse(r[1])}catch{return null}}function bF(e){if(!e)return{goal:``,targetSymbiontName:null,targetSymbiontDisplayName:null,inlineInstructions:null};let t=e.match(/^Goal:\n([\s\S]*?)\n\n## Target symbiont\n/),n=yF(e,`Target symbiont`),r=yF(e,`Delivery contract`);return{goal:t?.[1]?.trim()??``,targetSymbiontName:n?.name??null,targetSymbiontDisplayName:n?.displayName??null,inlineInstructions:typeof r?.inline_instructions==`boolean`?r.inline_instructions:null}}function xF(e){switch(e){case`completed`:return`default`;case`failed`:return`destructive`;case`running`:return`warning`;default:return`secondary`}}function SF(e){return e===null?null:e?`Instructions included in prompt`:`Uses session-start instructions`}function CF(){return ot({queryKey:[`cortex-instructions`],queryFn:({signal:e})=>q(`/cortex/instructions`,{signal:e}),staleTime:6e4})}function wF(e){return As({queryKey:[`cortex-prompt-builder`,e],queryFn:({signal:t})=>q(`/cortex/prompt-builder/${e}`,{signal:t}),enabled:!!e,staleTime:0,pollCategory:`realtime`,refetchInterval:e=>{let t=e.state.data?.status;return t&&dF.has(t)?!1:js.PROGRESS}})}function TF(){let e=An(),t=Nn();ws();let n=hF(e.search),r=gF(e.search),i=(0,W.useCallback)(n=>{if(!uF.has(n))return;let r=new URLSearchParams(e.search);n===`instructions`?r.delete(`tab`):r.set(`tab`,n),n!==`canopy`&&r.delete(cF);let i=r.toString();t({pathname:e.pathname,search:i?`?${i}`:``},{replace:!0})},[e.pathname,e.search,t]),a=(0,W.useCallback)(n=>{if(!sF.has(n))return;let r=new URLSearchParams(e.search);r.set(`tab`,`canopy`),n===`overview`?r.delete(cF):r.set(cF,n);let i=r.toString();t({pathname:e.pathname,search:i?`?${i}`:``},{replace:!0})},[e.pathname,e.search,t]);return(0,G.jsxs)(zj,{children:[(0,G.jsx)(yP,{title:`Cortex`,subtitle:`Manage session-start context, prompt building, and digest access for connected symbionts.`}),(0,G.jsx)(iF,{tabs:lF.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:i,columns:4}),n===`digest`?(0,G.jsx)(AF,{}):n===`builder`?(0,G.jsx)(OF,{}):n===`canopy`?(0,G.jsx)(EF,{section:r,onSectionChange:a,searchParams:e.search}):(0,G.jsx)(DF,{})]})}function EF({section:e,onSectionChange:t,searchParams:n}){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(aF,{tabs:oF.map(e=>({id:e.id,label:e.label})),activeTab:e,onTabChange:t}),e===`entries`?(()=>{let e=new URLSearchParams(n).get(`path`)??void 0;return(0,G.jsx)($P,{defaultPath:e},e??`no-path`)})():e===`map`?(0,G.jsx)(tF,{}):(0,G.jsx)(MF,{})]})}function DF(){let{effective:e,isLoading:t}=ek(),n=CF(),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(!0),[s,c]=(0,W.useState)(null),l=(0,W.useCallback)(async()=>{i(!0);try{c(await os(`/cortex/instructions/refresh`,{})),await n.refetch()}finally{i(!1)}},[n]);if(t||!e)return(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading...`});let u=n.data;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(Q,{level:`low`,accent:`sage`,className:`rounded-lg border border-outline-variant p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-sage/10 p-2 text-sage`,children:(0,G.jsx)(Zi,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(Uj,{tone:`sage`,children:`Cortex · instructions`}),(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:`Session-start instructions for Myco-enabled symbionts`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`Review the stored instructions, control whether they inject alongside the digest, and refresh the stored guidance when project context changes.`})]})]})}),(0,G.jsxs)(Q,{id:Pi.cortexInstructions,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(Uj,{children:`Settings`}),(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:`Injection lifecycle`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Choose which Cortex context is added as symbionts move through session start, subagent start, and prompt submit events.`})]}),(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`grid gap-4 border-t border-outline-variant/20 pt-5 lg:grid-cols-[minmax(14rem,18rem)_minmax(0,1fr)]`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h4`,{className:`font-sans text-sm font-semibold text-on-surface m-0`,children:`Session start`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Context added when a new symbiont session begins.`})]}),(0,G.jsxs)(`div`,{className:`grid max-w-3xl gap-4 md:grid-cols-[minmax(12rem,16rem)_minmax(14rem,24rem)]`,children:[(0,G.jsx)(OP,{path:ji.instructions.injectOnSessionStart,label:`Managed instructions`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t})}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(OP,{path:ji.digest.injectOnSessionStart,label:`Preferred digest`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{checked:e??!1,onCheckedChange:t})}),(0,G.jsxs)(`p`,{className:`max-w-md font-sans text-xs text-on-surface-variant`,children:[`Optional session-start context from the selected digest tier. Review the saved tiers on the`,` `,(0,G.jsx)(ri,{to:`?tab=digest`,className:`text-primary underline-offset-4 hover:underline`,children:`Digest tab`}),`.`]})]})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 border-t border-outline-variant/20 pt-5 lg:grid-cols-[minmax(14rem,18rem)_minmax(0,1fr)]`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h4`,{className:`font-sans text-sm font-semibold text-on-surface m-0`,children:`Subagent start`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Managed instructions passed into supported spawned child agents.`})]}),(0,G.jsx)(`div`,{className:`max-w-3xl`,children:(0,G.jsx)(OP,{path:ji.instructions.injectOnSubagentStart,label:`Subagent instructions`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t})})})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 border-t border-outline-variant/20 pt-5 lg:grid-cols-[minmax(14rem,18rem)_minmax(0,1fr)]`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h4`,{className:`font-sans text-sm font-semibold text-on-surface m-0`,children:`Prompt submit`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Spore retrieval runs after the user prompt and attaches the most relevant memories.`})]}),(0,G.jsxs)(`div`,{className:`grid max-w-xl gap-4 md:grid-cols-[minmax(12rem,16rem)_minmax(8rem,12rem)]`,children:[(0,G.jsx)(OP,{path:ji.spores.injectOnPromptSubmit,label:`Spore retrieval`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(OP,{path:ji.spores.maxPerPrompt,label:`Max spores`,children:({value:e,onChange:t})=>(0,G.jsx)(op,{type:`number`,min:0,max:10,className:`max-w-32`,value:String(e??3),onChange:e=>t(Number(e.target.value))})})]})]})]})]}),(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(Uj,{children:`Artifact`}),(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:`Current Instructions`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Stored Markdown generated by the Myco agent for session-start injection.`}),s?(0,G.jsx)(`p`,{className:`mt-2 font-sans text-sm text-on-surface-variant`,children:s.started?`Refresh started${s.runId?` — run ${s.runId}`:``}. The stored artifact updates when that run completes.`:`Refresh did not start${s.reason?` — ${vF(s.reason)}`:``}.`}):null]}),(0,G.jsx)(Y,{onClick:()=>void l(),disabled:r,children:r?`Starting...`:`Refresh`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(X,{variant:u?.enabled?`default`:`secondary`,children:u?.enabled?`Session start enabled`:`Session start disabled`}),(0,G.jsx)(X,{variant:`secondary`,children:u?.stored?`Stored artifact`:`No stored artifact`}),(0,G.jsxs)(X,{variant:`secondary`,children:[`Generated: `,_F(u?.generatedAt??null)]})]}),(0,G.jsx)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5`,children:n.isLoading?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading instructions...`}):u?.content?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?`Collapse`:`Expand`})}),(0,G.jsx)(`div`,{className:a?`max-h-[70vh] overflow-auto pr-2`:`max-h-[28rem] overflow-auto pr-2`,children:(0,G.jsx)(kO,{content:u.content})})]}):(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No Cortex instructions are stored yet. Refresh to generate them.`})})]})]})}function OF(){let e=$A({task:`cortex-prompt-builder`,limit:fF}),{data:t}=NM(),n=(0,W.useMemo)(()=>(t?.symbionts??[]).filter(e=>e.enabled),[t]),[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(n[0]?.name??``),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1),p=wF(s?.runId??null),m=wF(l),h=(0,W.useMemo)(()=>(e.data?.runs??[]).map(e=>({run:e,parsed:bF(e.instruction)})),[e.data?.runs]),g=(0,W.useMemo)(()=>h.find(({run:e})=>e.id===l)??null,[h,l]);(0,W.useEffect)(()=>{if(n.length===0){a&&o(``);return}n.some(e=>e.name===a)||o(n[0]?.name??``)},[n,a]);let _=(0,W.useCallback)(async()=>{f(!0);try{c(await os(`/cortex/prompt-builder`,{goal:r,...a?{symbiont:a}:{}})),e.refetch()}finally{f(!1)}},[e,r,a]),v=r.trim().length>0;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Q,{id:Pi.cortexBuilder,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(co,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(ZM,{children:`Prompt Builder`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`Tell Myco what you want to build and which enabled symbiont you are targeting. Cortex runs a task through the Myco agent harness and returns a high-signal prompt you can paste into that agent.`})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`label`,{className:`block space-y-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:`What do you want to build?`}),(0,G.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),placeholder:`Build a migration workflow for ...`,rows:5,className:`w-full rounded-md bg-surface-container-lowest px-3 py-2 font-sans text-sm text-on-surface placeholder:text-on-surface-variant/50 focus:outline-hidden focus:ring-2 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 resize-y`})]}),(0,G.jsxs)(`label`,{className:`block space-y-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Target symbiont`}),(0,G.jsxs)(v_,{value:a,onValueChange:o,children:[(0,G.jsx)(b_,{children:(0,G.jsx)(y_,{placeholder:`Choose a symbiont`})}),(0,G.jsx)(x_,{children:n.map(e=>(0,G.jsx)(S_,{value:e.name,children:e.displayName},e.name))})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`This list comes from the symbionts enabled for this project.`})]}),(0,G.jsx)(Y,{onClick:()=>void _(),disabled:!v||d,children:d?`Starting...`:`Build Prompt`})]})]}),s?(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(X,{variant:xF(p.data?.status??`running`),children:p.data?.status??`running`}),SF(s.inlineInstructions)?(0,G.jsx)(X,{variant:`secondary`,children:SF(s.inlineInstructions)}):null,s.targetSymbiont?(0,G.jsx)(X,{variant:`secondary`,children:s.targetSymbiont.displayName}):null]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:p.data?.status&&dF.has(p.data.status)?`Run ${s.runId??`pending`} finished.`:`Run ${s.runId??`pending`} is in progress. Cortex checks for the prompt automatically.`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.runId?(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>u(s.runId),children:`View Details`}):null,(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{p.refetch(),e.refetch()},disabled:p.isFetching||e.isFetching,children:p.isFetching||e.isFetching?`Refreshing...`:`Refresh`})]})]})]}):null,(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(ZM,{children:`Recent Builds`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Each run captures the original build request, the generated prompt, and a direct link to the underlying agent run.`})]}),(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void e.refetch(),disabled:e.isFetching,children:e.isFetching?`Refreshing...`:`Refresh`})]}),e.isLoading?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading recent builds...`}):h.length===0?(0,G.jsx)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5`,children:(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No builder runs yet. Start one above and Cortex will keep the prompt artifact here.`})}):(0,G.jsx)(`div`,{className:`space-y-3`,children:h.map(({run:e,parsed:t})=>(0,G.jsx)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-4 space-y-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(X,{variant:xF(e.status),children:e.status}),SF(t.inlineInstructions)?(0,G.jsx)(X,{variant:`secondary`,children:SF(t.inlineInstructions)}):null,t.targetSymbiontDisplayName?(0,G.jsx)(X,{variant:`secondary`,children:t.targetSymbiontDisplayName}):null]}),(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:gv(t.goal||`Untitled build request`,pF)}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[`Started `,Sv(e.started_at)]}),(0,G.jsxs)(`span`,{children:[`Run `,_v(e.id)]}),e.completed_at?(0,G.jsxs)(`span`,{children:[`Duration `,bv(e.started_at,e.completed_at)]}):null]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>u(e.id),children:`View Details`}),(0,G.jsx)(`a`,{href:projectPath(Y_(e.id)),className:`inline-flex h-8 items-center justify-center rounded-md border border-[var(--ghost-border)] px-3 font-sans text-xs font-medium text-on-surface transition-all hover:bg-surface-container-high`,children:`Open Run`})]})]})},e.id))})]}),(0,G.jsx)(Zf,{open:l!==null,onOpenChange:e=>{e||u(null)},children:(0,G.jsxs)(tp,{className:`max-w-4xl max-h-[90vh] overflow-y-auto`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Prompt Build Details`}),(0,G.jsx)(ap,{children:`Review the generated prompt, task reports, and jump to the full agent run when you need deeper diagnostics.`})]}),l?(0,G.jsx)(kF,{runId:l,runInstruction:g?.run.instruction??null,result:m.data,isLoading:m.isLoading,isFetching:m.isFetching,onRefresh:()=>void m.refetch()}):null]})})]})}function kF({runId:e,runInstruction:t,result:n,isLoading:r,isFetching:i,onRefresh:a}){let o=(0,W.useMemo)(()=>bF(t),[t]),[s,c]=(0,W.useState)(!1),l=(0,W.useCallback)(async()=>{n?.prompt&&navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(n.prompt),c(!0),window.setTimeout(()=>c(!1),1500))},[n?.prompt]);return r&&!n?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading build details...`}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(X,{variant:xF(n?.status),children:n?.status??`loading`}),(0,G.jsxs)(X,{variant:`secondary`,children:[`Run `,_v(e)]}),o.targetSymbiontDisplayName?(0,G.jsx)(X,{variant:`secondary`,children:o.targetSymbiontDisplayName}):null]}),o.goal?(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:o.goal}):null,SF(o.inlineInstructions)?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:o.inlineInstructions?`This build embeds the current Cortex instructions directly into the generated prompt.`:`This build expects the target symbiont to receive Cortex instructions at session start.`}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n?.prompt?(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void l(),children:s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Qi,{className:`mr-1.5 h-3.5 w-3.5`}),`Copied`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pa,{className:`mr-1.5 h-3.5 w-3.5`}),`Copy Prompt`]})}):null,(0,G.jsx)(`a`,{href:projectPath(Y_(e)),className:`inline-flex h-8 items-center justify-center rounded-md border border-[var(--ghost-border)] px-3 font-sans text-xs font-medium text-on-surface transition-all hover:bg-surface-container-high`,children:`Open Full Run`}),(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:a,disabled:i,children:i?`Refreshing...`:`Refresh`})]})]}),(0,G.jsxs)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5 space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Generated Prompt`}),n?.prompt?(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-sm text-on-surface`,children:n.prompt}):(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:n?.status===`failed`?n.error||`The prompt builder run failed before producing a prompt.`:`Waiting for the Myco agent to produce the prompt...`})]}),n?.reports?.length?(0,G.jsxs)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5 space-y-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Task Reports`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:n.reports.map(e=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.action}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:hv(e.created_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:e.summary})]},e.id))})]}):null]})}function AF(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Q,{id:Pi.cortexDigest,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(ha,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(ZM,{children:`Digest`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`Choose which digest tier Cortex should use when digest injection is enabled, and review the maintained extracts below for on-demand retrieval.`})]})]}),(0,G.jsx)(OP,{path:ji.digest.tier,label:`Preferred digest tier`,children:({value:e,onChange:t})=>(0,G.jsxs)(v_,{value:String(e??5e3),onValueChange:e=>t(Number(e)),children:[(0,G.jsx)(b_,{children:(0,G.jsx)(y_,{})}),(0,G.jsx)(x_,{children:mF.map(e=>(0,G.jsx)(S_,{value:e.value,children:e.label},e.value))})]})})]}),(0,G.jsx)(PP,{})]})}function jF({patterns:e,onChange:t}){let[n,r]=(0,W.useState)(``),i=(0,W.useCallback)(()=>{let i=n.trim();if(!(!i||i.startsWith(`#`))){if(e.includes(i)){r(``);return}t([...e,i]),r(``)}},[n,e,t]),a=(0,W.useCallback)(n=>{t(e.filter((e,t)=>t!==n))},[e,t]);return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`rounded-md border border-outline-variant/30 bg-surface-container-low px-3 py-2 min-h-[44px]`,children:e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs italic text-on-surface-variant`,children:`No custom patterns yet — the Myco baseline above already covers common noise.`}):(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map((e,t)=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-surface-container px-2 py-0.5 font-mono text-xs text-on-surface`,children:[e,(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(t),"aria-label":`Remove pattern ${e}`,className:`rounded text-on-surface-variant hover:text-on-surface focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-primary/40`,children:`×`})]},`${e}-${t}`))})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(op,{value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())},placeholder:`e.g. fixtures/large/** or **/*.snap`,className:`font-mono text-xs`}),(0,G.jsx)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:i,disabled:n.trim().length===0,children:`Add`})]}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Press Enter or click Add. Glob syntax: `,(0,G.jsx)(`code`,{className:`font-mono`,children:`**`}),` `,`any depth, `,(0,G.jsx)(`code`,{className:`font-mono`,children:`*`}),` any chars in one segment.`]})]})}function MF(){let{effective:e,isLoading:t}=ek(),{data:n}=rj(),r=n?.tasks.find(e=>e.name===`canopy-describe`),i=(e?.agent?.tasks?.[`canopy-describe`])?.schedule?.enabled??r?.schedule?.enabled??!1;return t||!e?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading...`}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-primary/15 p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(go,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Canopy is your project's live code index.`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`It tracks what every file does so connected agents can answer codebase questions and skip redundant Reads. The Myco agent describes files in the background — opt-in, configurable below.`})]})]})}),(0,G.jsxs)(Q,{id:`config-section-cortex-canopy-collection`,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(ZM,{children:`Collection`}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`The scanner automatically skips anything matched by this project's`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.gitignore`}),` `,`files (root and nested), the Myco baseline below, and directories that Myco and your installed symbionts manage (`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.myco/`}),`,`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.agents/`}),`,`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.claude/`}),`,`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.cursor/`}),`, etc.). Add your own patterns at the bottom to exclude additional paths.`]})]}),(0,G.jsx)(OP,{path:ji.canopy.exclude.defaultPatterns,label:`Myco baseline (read-only)`,children:({value:e})=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 bg-surface-container-low/50 px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(e??[]).map(e=>(0,G.jsx)(`code`,{className:`inline-block rounded bg-surface-container px-2 py-0.5 font-mono text-xs text-on-surface-variant`,children:e},e))}),(0,G.jsx)(`p`,{className:`pt-2 font-sans text-xs text-on-surface-variant`,children:`Maintained by Myco. Filesystem and toolchain noise that shouldn't be indexed regardless of project setup.`})]})}),(0,G.jsx)(OP,{path:ji.canopy.exclude.patterns,label:`Your patterns`,children:({value:e,onChange:t})=>(0,G.jsx)(jF,{patterns:e??[],onChange:t})}),(0,G.jsxs)(`div`,{className:`space-y-1 pt-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-xs uppercase tracking-wide text-on-surface-variant`,children:`Background refresh`}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Session start and the Write/Edit tool already keep the index fresh during sessions. The background sweep is the safety net for changes made outside sessions (`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`git pull`}),`, edits via non-Myco tools).`]})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(OP,{path:ji.canopy.refresh.backgroundEnabled,label:`Periodic background scan`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(OP,{path:ji.canopy.refresh.backgroundPeriodMinutes,label:`Period (minutes)`,children:({value:e,onChange:t})=>(0,G.jsx)(op,{type:`number`,min:1,value:String(e??60),onChange:e=>t(Number(e.target.value))})})]})]}),(0,G.jsxs)(Q,{id:`config-section-cortex-canopy-injection`,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsx)(ZM,{children:`Injection`}),(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(OP,{path:ji.canopy.injectOnPreToolUse,label:`Inject canopy on Read`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(OP,{path:ji.canopy.minFileBytes,label:`Minimum file size (bytes)`,children:({value:e,onChange:t})=>(0,G.jsx)(op,{type:`number`,min:0,value:String(e??800),onChange:e=>t(Number(e.target.value))})})]})]}),(0,G.jsxs)(Q,{id:`config-section-cortex-canopy-llm`,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(ZM,{children:`Intelligence`}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 font-sans text-xs font-medium `+(i?`border-primary/30 bg-primary/10 text-primary`:`border-outline-variant/40 bg-surface-container text-on-surface-variant`),children:[(0,G.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full `+(i?`bg-primary`:`bg-on-surface-variant/60`),"aria-hidden":!0}),i?`Descriptions on`:`Descriptions off`]})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`One-sentence summaries the Myco agent writes for each file. They power semantic search across your codebase, ride along with Canopy injection on Read, and feed the Canopy Map — the highest-leverage piece of Canopy once it’s on.`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:i?(0,G.jsxs)(G.Fragment,{children:[`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),` `,`is enabled and filling in descriptions on schedule. Visit the task page to change the model, schedule, or token budget.`]}):(0,G.jsxs)(G.Fragment,{children:[`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),` `,`ships `,(0,G.jsx)(`strong`,{children:`opt-in`}),` — its schedule is off by default so new projects don’t spend tokens unprompted. Enable it on the task page (where you can also pick a model and schedule) to start filling in descriptions; the Canopy Map needs at least one described file before it can build.`]})})]})]})}function NF(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function PF(e){if(Array.isArray(e))return e}function FF(e){if(Array.isArray(e))return NF(e)}function IF(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function LF(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,JF(r.key),r)}}function RF(e,t,n){return t&&LF(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function zF(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=XF(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
85
85
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function BF(e,t,n){return(t=JF(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VF(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function HF(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function UF(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
86
86
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WF(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
@@ -412,4 +412,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
412
412
|
${t?`border-primary/40 bg-primary/5 text-on-surface`:`border-[var(--ghost-border)] bg-surface-container-lowest text-on-surface-variant hover:border-primary/20`}
|
|
413
413
|
`,children:O2[e]},e)})})]})]})]}),i&&Object.keys(i).length>0&&(0,G.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-[var(--ghost-border)]`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Parameters`}),Object.entries(i).map(([e,t])=>{let n=b[e],r=n??t,i=e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return typeof t==`boolean`?(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm text-on-surface`,children:i}),(0,G.jsx)(bP,{checked:r,onCheckedChange:t=>{x(n=>({...n,[e]:t}))}})]},e):(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm text-on-surface`,children:i}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(op,{type:typeof t==`number`?`number`:`text`,value:n==null?``:String(n),placeholder:String(t),onChange:n=>{let r=typeof t==`number`?n.target.value===``?void 0:Number(n.target.value):n.target.value;x(r===void 0?t=>{let n={...t};return delete n[e],n}:t=>({...t,[e]:r}))},className:`w-40 font-mono`}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`default: `,String(t)]})]})]},e)})]}),t&&t.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2 pt-2 border-t border-[var(--ghost-border)]`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide`,children:`Per-Phase Overrides`}),t.map(e=>(0,G.jsx)(G1,{phase:e,override:g[e.name]??{},taskHarness:ce,taskProviderType:H,taskModel:te||n?.model||``,taskReasoningMap:{...n?.reasoningMap??{},...ne?{low:ne}:{},...U?{default:U}:{},...re?{high:re}:{}},providers:A,isLoadingProviders:o,onChange:t=>_e(e.name,t)},e.name))]})]})}var N2=3;function P2(e){return{harness:e.execution?.harness,provider:e.execution?.provider?.type,model:e.execution?.model??e.model,reasoningLevel:e.execution?.reasoningLevel??e.reasoningLevel,maxTurns:e.execution?.maxTurns??e.maxTurns,timeoutSeconds:e.execution?.timeoutSeconds??e.timeoutSeconds}}function F2(e,t){let n=t?.agent?.provider,r=e.execution?.provider,i=e.execution?.reasoningLevel??e.reasoningLevel,a=e.execution?.model??e.model??n?.model;return{harness:e.execution?.harness??t?.agent?.harness??D1(r?.type)??D1(n?.type),providerType:r?.type??n?.type,localBackend:r?.local_backend??n?.local_backend,reasoningLevel:i,model:k1(i,r??n,a),reasoningMap:r?.reasoning_map??n?.reasoning_map,baseUrl:r?.base_url??n?.base_url,contextLength:r?.context_length??n?.context_length,maxTurns:e.execution?.maxTurns??e.maxTurns,timeoutSeconds:e.execution?.timeoutSeconds??e.timeoutSeconds}}function I2(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(`div`,{className:`h-8 w-24 animate-pulse rounded bg-surface-container-high`}),(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-low p-4 space-y-3`,children:[(0,G.jsx)(`div`,{className:`h-6 w-48 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-64 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-8 w-32 animate-pulse rounded bg-surface-container-high`})]}),(0,G.jsx)(`div`,{className:`rounded-md bg-surface-container-low p-4 space-y-2`,children:Array.from({length:N2}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-5 animate-pulse rounded bg-surface-container-high`},t))})]})}function L2({phase:e,index:t}){return(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`flex h-6 w-6 items-center justify-center rounded-full bg-surface-container-high font-mono text-xs font-semibold text-on-surface-variant shrink-0`,children:t+1}),(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.name}),!e.required&&(0,G.jsx)(X,{variant:`secondary`,children:`optional`})]}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant shrink-0`,children:[`max `,e.maxTurns,` turns`]})]}),e.reasoningLevel&&(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsxs)(X,{variant:`secondary`,children:[`reasoning `,e.reasoningLevel]})}),e.tools.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tools.map(e=>(0,G.jsx)(`span`,{className:`font-mono text-xs px-1.5 py-0.5 rounded-xs bg-surface-container-high text-on-surface-variant`,children:e},e))}),(0,G.jsx)(Q,{level:`lowest`,className:`p-3 overflow-auto max-h-40`,children:(0,G.jsx)(kO,{content:e.prompt})})]})}function R2({taskId:e,onBack:t,onNavigate:n,onRunTriggered:r}){let{data:i,isPending:a,isError:o}=ij(e),{effective:s}=ek(),c=i?.task,l=c?.phases??[],u=c?P2(c):{},d=c?F2(c,s):{},f=(0,W.useMemo)(()=>({harness:d.harness,providerType:d.providerType,localBackend:d.localBackend,reasoningLevel:d.reasoningLevel,reasoningMap:d.reasoningMap,model:d.model,baseUrl:d.baseUrl,contextLength:d.contextLength,maxTurns:d.maxTurns,timeoutSeconds:d.timeoutSeconds}),[d.harness,d.providerType,d.localBackend,d.reasoningLevel,d.reasoningMap,d.model,d.baseUrl,d.contextLength,d.maxTurns,d.timeoutSeconds]);return a?(0,G.jsx)(I2,{}):o||!i?.task?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Tasks`]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Task not found`})]})]}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Tasks`]}),(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-1 min-w-0`,children:[(0,G.jsx)(`h1`,{className:`font-serif text-lg text-on-surface`,children:c.displayName}),c.description&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:c.description})]}),(0,G.jsx)(X,{variant:A0(c.source),className:`shrink-0`,children:yv(c.source??`built-in`)})]}),(0,G.jsx)(b2,{task:c,onDeleted:t,onCustomized:e=>n?.(e),onRunTriggered:r})]}),(0,G.jsx)(M2,{taskId:e,phases:l,defaults:f,schedule:c.schedule,params:c.params}),(u.model!==void 0||u.reasoningLevel!==void 0||u.maxTurns!==void 0||u.timeoutSeconds!==void 0)&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-3`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Task Definition`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[u.harness!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Runtime`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.harness})]}),u.provider!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Provider`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.provider})]}),u.model!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Model`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.model})]}),u.reasoningLevel!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Reasoning`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.reasoningLevel})]}),u.maxTurns!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Max Turns`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.maxTurns})]}),u.timeoutSeconds!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Timeout`}),(0,G.jsxs)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:[u.timeoutSeconds,`s`]})]})]})]}),l.length>0?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:[`Phases`,(0,G.jsxs)(`span`,{className:`ml-2 text-on-surface normal-case font-normal`,children:[l.length,` `,l.length===1?`phase`:`phases`]})]}),l.map((e,t)=>(0,G.jsx)(L2,{phase:e,index:t},e.name))]}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Prompt`}),(0,G.jsx)(Q,{level:`lowest`,className:`p-4 overflow-auto max-h-96`,children:(0,G.jsx)(kO,{content:c.prompt??``})})]}),(0,G.jsx)(S2,{taskId:e})]})}function z2({label:e,value:t,max:n,color:r}){let i=n>0?Math.round(t/n*100):0,a=2*Math.PI*36,o=a-i/100*a;return(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative h-20 w-20`,children:[(0,G.jsxs)(`svg`,{className:`h-20 w-20 -rotate-90`,viewBox:`0 0 80 80`,children:[(0,G.jsx)(`circle`,{cx:`40`,cy:`40`,r:`36`,fill:`none`,stroke:`currentColor`,className:`text-surface-container/30`,strokeWidth:`6`}),(0,G.jsx)(`circle`,{cx:`40`,cy:`40`,r:`36`,fill:`none`,stroke:r,strokeWidth:`6`,strokeLinecap:`round`,strokeDasharray:a,strokeDashoffset:o,className:`transition-all duration-700`})]}),(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,G.jsxs)(`span`,{className:`text-sm font-semibold font-mono text-on-surface`,children:[i,`%`]})})]}),(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant text-center font-sans`,children:e})]})}function B2({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant font-sans`,children:e}),(0,G.jsx)(`span`,{className:`text-xs font-mono text-on-surface`,children:t})]})}function V2({stats:e}){let t=e.embedding.total_embeddable>0?e.embedding.embedded_count:0,n=e.embedding.total_embeddable;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`h2`,{className:`text-xs font-semibold text-on-surface-variant uppercase tracking-widest flex items-center gap-2 font-sans`,children:[(0,G.jsx)(Gi,{className:`h-3.5 w-3.5`}),`System Health`]}),(0,G.jsxs)(`div`,{className:`flex justify-center gap-8 py-2`,children:[(0,G.jsx)(z2,{label:`Embedding Coverage`,value:t,max:n,color:`#abcfb8`}),(0,G.jsx)(z2,{label:`Queue Health`,value:Math.max(0,n-e.embedding.queue_depth),max:n,color:`#edbf7f`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-0`,children:[(0,G.jsx)(B2,{label:`Sessions`,value:String(e.vault.session_count)}),(0,G.jsx)(B2,{label:`Spores`,value:String(e.vault.spore_count)}),(0,G.jsx)(B2,{label:`Entities`,value:String(e.vault.entity_count)}),(0,G.jsx)(B2,{label:`Graph edges`,value:String(e.vault.edge_count)}),(0,G.jsx)(B2,{label:`Uptime`,value:fv(e.daemon.uptime_seconds)}),(0,G.jsx)(B2,{label:`Daemon`,value:`v${e.daemon.version} :${e.daemon.port}`}),e.agent.last_run_at!==null&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(B2,{label:`Last run`,value:mv(e.agent.last_run_at)}),(0,G.jsx)(B2,{label:`Total runs`,value:String(e.agent.total_runs)})]}),e.digest.freshest_tier!==null&&(0,G.jsx)(B2,{label:`Digest tier`,value:`T${e.digest.freshest_tier}`})]})]})}function H2(){let{effective:e,isLoading:t}=ek(),{data:n,isLoading:r}=Bs(),{data:i,isLoading:a}=rj(),o=i?.tasks??[],[s,c]=(0,W.useState)(null),l=o.find(e=>e.isDefault)?.name??``,u=s??l,d=(0,W.useCallback)(e=>{c(e)},[]),f=!!e?.agent?.provider;return t||!e?(0,G.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,G.jsx)(`div`,{className:`h-32 rounded-md animate-pulse bg-surface-container-low`},e))}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Q,{id:Pi.agentOperations,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300`,children:[(0,G.jsx)(ZM,{children:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(io,{className:`h-4 w-4 text-primary`}),`Agent Operations`]})}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(OP,{path:`agent.scheduled_tasks_enabled`,label:`Scheduled Tasks`,hint:`runs intelligence/skill-survey/skill-evolve on a cron`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t,disabled:!f})}),(0,G.jsx)(OP,{path:`agent.event_tasks_enabled`,label:`Event-Driven Tasks`,hint:`titles + summaries on session end`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t,disabled:!f})})]}),!f&&(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant/70`,children:[`Configure an agent provider in`,` `,(0,G.jsx)(ri,{to:`/settings`,className:`underline hover:text-on-surface transition-colors`,children:`Settings`}),` `,`to enable agent tasks.`]}),(0,G.jsx)(`div`,{className:`border-t border-outline-variant/20`}),(0,G.jsx)(OP,{path:`agent.summary_batch_interval`,label:`Title & Summary Batch Interval`,commitOn:`blur`,hint:`batches between event-driven summary triggers; 0 disables`,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(op,{type:`number`,min:0,placeholder:`5`,value:e??``,onChange:e=>t(Number(e.target.value)),onBlur:n,className:`w-32 font-mono`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:`batches`})]})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Default Task`}),a?(0,G.jsxs)(`div`,{className:`flex h-9 items-center gap-2 text-on-surface-variant font-sans text-sm`,children:[(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),`Loading tasks...`]}):(0,G.jsxs)(v_,{value:u,onValueChange:d,children:[(0,G.jsx)(b_,{children:(0,G.jsx)(y_,{placeholder:`Select default task`})}),(0,G.jsx)(x_,{children:o.map(e=>(0,G.jsx)(S_,{value:e.name,children:e.displayName},e.name))})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`The task used when Run Now is clicked or no task is specified.`})]})]}),r?(0,G.jsx)(Q,{level:`low`,className:`p-6`,children:(0,G.jsx)(`div`,{className:`h-32 animate-pulse rounded-md bg-surface-container`})}):n?(0,G.jsx)(Q,{level:`low`,className:`p-6`,children:(0,G.jsx)(V2,{stats:n})}):null]})}var U2={sage:`border-t-sage`,ochre:`border-t-ochre`,terracotta:`border-t-terracotta`,outline:`border-t-outline`},W2={sage:`text-sage`,ochre:`text-ochre`,terracotta:`text-terracotta`,outline:`text-on-surface`};function G2({label:e,value:t,sublabel:n,accent:r,sparklineData:i,className:a,href:o}){let s=J(`rounded-lg border border-outline-variant/10 bg-surface-container/60 p-4 border-t-2 transition-[border-color,background-color] duration-200 hover:border-outline-variant/25 hover:bg-surface-container/80`,o&&`cursor-pointer`,U2[r],a),c=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline mb-2`,children:e}),(0,G.jsxs)(`div`,{className:`flex items-end justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:J(`font-serif text-2xl font-bold`,W2[r]),children:t}),i&&i.length>=2&&(0,G.jsx)(Gj,{data:i,widthPx:80,heightPx:28,className:`opacity-60`})]}),n&&(0,G.jsx)(`p`,{className:`font-mono text-[10px] text-outline mt-1`,children:n})]});return o?(0,G.jsx)(ri,{to:o,className:J(s,`block no-underline`),children:c}):(0,G.jsx)(`div`,{className:s,children:c})}var K2=`(task default)`;function q2(e){return e.reasoning_level??`(task default)`}function J2(e){let t=[];return Y2(e.harness)&&t.push(String(e.harness)),Y2(e.reasoningLevel)&&t.push(String(e.reasoningLevel)),Y2(e.model)&&t.push(String(e.model)),t.length===0?`default`:t.join(` / `)}function Y2(e){return!(e==null||e===``||e===`(task default)`)}function X2(e,t){return e==null||!Number.isFinite(e)||t<=0?null:Math.round(e/t*1e4)/1e4}function Z2(e,t){let n=null,r=null,i=null,a=null;for(let o=0;o<e.length;o++){let s=e[o],c=J2({harness:s.harness,reasoningLevel:t[o],model:s.model});s.cost_usd!==null&&s.cost_usd!==void 0&&Number.isFinite(s.cost_usd)&&((n===null||s.cost_usd<n.run.cost_usd)&&(n={run:s,label:c}),(r===null||s.cost_usd>r)&&(r=s.cost_usd));let l=s.write_intents?.total??0;l>0&&(i===null||l>(i.run.write_intents?.total??0))&&(i={run:s,label:c}),s.duration_ms!==null&&s.duration_ms!==void 0&&Number.isFinite(s.duration_ms)&&(a===null||s.duration_ms<a.run.duration_ms)&&(a={run:s,label:c})}let o=n&&r!==null&&r>0?Math.round((n.run.cost_usd??0)/r*100):null;return{cheapest:n,cheapestPct:o,mostWrites:i,fastest:a}}function Q2(e){let t=Object.entries(e);return t.length===0?``:(t.sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])),t.map(([e,t])=>`${$2(e)}×${t}`).join(`, `))}function $2(e){let t=e.split(`_`);if(t.length<=1)return e;let n=t[t.length-1];return n.length<3?e:n}function e4(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function t4(e){let t=H0(e,e4)?.phases;if(!Array.isArray(t)||t.length===0)return null;let n=0,r=!1;for(let e of t)typeof e.turnsUsed==`number`&&Number.isFinite(e.turnsUsed)&&(n+=e.turnsUsed,r=!0);return r?n:null}var n4=new Set([`status`]);function r4(e,t){switch(t){case`harness`:return e.harness??`__missing__`;case`reasoning`:return e.reasoning_level??`__missing__`;case`model`:return e.model??`__missing__`;case`status`:return e.status;case`turns`:{let t=t4(e.usage_data);return t===null?`__missing__`:String(t)}case`tokens`:return e.tokens_used===null||e.tokens_used===void 0?`__missing__`:String(e.tokens_used);case`cost`:return e.cost_usd===null||e.cost_usd===void 0?`__missing__`:e.cost_usd.toFixed(6);case`duration`:return e.duration_ms===null||e.duration_ms===void 0?`__missing__`:String(e.duration_ms);case`writes`:return String(e.write_intents?.total??0);case`costPerWrite`:{let t=X2(e.cost_usd,e.write_intents?.total??0);return t===null?`__missing__`:t.toFixed(4)}}}function i4(e,t){if(e.length<2)return new Set(t);let n=new Set;for(let r of t){if(n4.has(r)){n.add(r);continue}let t=r4(e[0],r),i=!1;for(let n=1;n<e.length;n++)if(r4(e[n],r)!==t){i=!0;break}i&&n.add(r)}return n}var a4=`run`;function o4(e){let t=s4(e.usage_data),n=e.execution_overrides?.phases??{},r=e.reasoning_level??null,i=e.model??null;return t.length===0?[{name:a4,reasoning:r,model:i,turnsUsed:t4(e.usage_data),tokensUsed:e.tokens_used??null,costUsd:e.cost_usd??null,durationMs:e.duration_ms??null}]:t.map(e=>{let t=n[e.name];return{name:e.name,reasoning:t?.reasoningLevel??r,model:t?.model??i,turnsUsed:typeof e.turnsUsed==`number`&&Number.isFinite(e.turnsUsed)?e.turnsUsed:null,tokensUsed:typeof e.tokensUsed==`number`&&Number.isFinite(e.tokensUsed)?e.tokensUsed:null,costUsd:typeof e.costUsd==`number`&&Number.isFinite(e.costUsd)?e.costUsd:null,durationMs:typeof e.usage?.durationMs==`number`&&Number.isFinite(e.usage.durationMs)?e.usage.durationMs:null}})}function s4(e){let t=H0(e,e4)?.phases;return Array.isArray(t)?t.filter(e=>typeof e?.name==`string`):[]}function c4(e){let t=e.execution_overrides?.phases;return t?Object.keys(t).length:0}function l4(e){let t=e.execution_overrides?.phases;if(!t)return``;let n=[];for(let[e,r]of Object.entries(t)){let t=[];r?.reasoningLevel&&t.push(r.reasoningLevel),r?.model&&t.push(`model=${r.model}`),n.push(`${e}: ${t.length>0?t.join(`, `):`(no override)`}`)}return n.join(` · `)}function u4(e){let t=0,n=0,r=0,i=0,a=0;for(let o of e)o.status===`completed`?t+=1:o.status===`failed`?n+=1:o.status===`skipped`&&(r+=1),typeof o.tokens_used==`number`&&Number.isFinite(o.tokens_used)&&(i+=o.tokens_used),typeof o.cost_usd==`number`&&Number.isFinite(o.cost_usd)&&(a+=o.cost_usd);return{total:e.length,completed:t,failed:n,skipped:r,totalTokens:i,totalCostUsd:a}}function d4(e){if(e.length<2)return{show:!1,spanMinutes:0,differentTasks:!1};let t=null,n=null,r=new Set;for(let i of e){i.task!==null&&i.task!==void 0?r.add(i.task):r.add(`__null_task__`);let e=i.started_at;typeof e==`number`&&Number.isFinite(e)&&((t===null||e<t)&&(t=e),(n===null||e>n)&&(n=e))}let i=t!==null&&n!==null?n-t:0,a=Math.floor(i/60),o=r.size>1;return{show:a>5||o,spanMinutes:a,differentTasks:o}}function f4(e){let t=Math.max(0,Math.floor(e));if(t<60)return`${t} ${t===1?`minute`:`minutes`}`;let n=Math.floor(t/60);if(n<24)return`${n} ${n===1?`hour`:`hours`}`;let r=Math.floor(n/24);return`${r} ${r===1?`day`:`days`}`}function p4(e){if(e.length===0)return{sameInput:null};let t=e.map(e=>({runId:e.id,inputs:q1(e.instruction)}));if(!t.some(e=>Object.keys(e.inputs).length>0))return{sameInput:null};let n=t[0].inputs,r=t.every(e=>m4(e.inputs,n)),i=Object.keys(n).length>0;return r&&i?{sameInput:!0,inputs:n}:{sameInput:!1,perRun:t}}function m4(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}var h4=[`harness`,`reasoning`,`model`,`status`,`turns`,`tokens`,`cost`,`duration`,`writes`,`costPerWrite`],g4={harness:`Runtime`,reasoning:`Reasoning`,model:`Model`,status:`Status`,turns:`Turns`,tokens:`Tokens`,cost:`Cost`,duration:`Duration`,writes:`Writes`,costPerWrite:`$/write`},_4=32;function v4({runs:e,isLoading:t,isError:n,errorMessage:r,onBack:i,onOpenRun:a,title:o=`Comparison`,subtitle:s,aggregate:c,metadataSlot:l,backLabel:u=`Back`}){let d=(0,W.useMemo)(()=>c??u4(e),[c,e]),f=(0,W.useMemo)(()=>e.map(e=>q2(e)),[e]),p=(0,W.useMemo)(()=>Z2(e,f),[e,f]),m=(0,W.useMemo)(()=>d4(e),[e]),h=(0,W.useMemo)(()=>p4(e),[e]),{data:g}=rj(),_=(0,W.useMemo)(()=>{let e=new Map;for(let t of g?.tasks??[])e.set(t.name,t.displayName);return e},[g]),v=(0,W.useMemo)(()=>w4(e,_),[e,_]),[y,b]=(0,W.useState)(!1),[x,S]=(0,W.useState)(new Set),C=(0,W.useCallback)(e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),w=(0,W.useMemo)(()=>y?i4(e,h4):new Set(h4),[y,e]),T=(0,W.useMemo)(()=>e.some(e=>c4(e)>0),[e]);if(t&&e.length===0)return(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans`,children:`Loading runs...`})]});if(n)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),u]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load runs`}),r&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:r})]})]});let E=e.length>1,D=e.length>1,O=s??`${e.length} ${e.length===1?`run`:`runs`}`,k=w.size+2;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),u]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h1`,{className:`font-serif text-xl text-on-surface`,children:o}),O&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:O})]}),m.show&&m.spanMinutes>5&&(0,G.jsxs)(Q,{level:`low`,className:`flex items-start gap-2 p-3 border border-outline-variant/40`,children:[(0,G.jsx)(_o,{className:`h-4 w-4 mt-0.5 text-secondary shrink-0`,"aria-hidden":!0}),(0,G.jsxs)(`div`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Runs span `,f4(m.spanMinutes),` of vault activity — results may reflect different vault states. Consider running with the same input (session_id, batch_id) for apples-to-apples comparison.`]})]}),(v.kind!==`none`||h.sameInput!==null)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v.kind===`single`&&(0,G.jsxs)(X,{variant:`outline`,className:`text-xs`,children:[`Task: `,v.label]}),v.kind===`mixed`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(X,{variant:`warning`,className:`text-xs`,title:v.tooltip,children:[`Tasks: `,v.count]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(_o,{className:`h-3 w-3 inline`,"aria-hidden":!0}),`Runs span multiple tasks — mechanical metrics are still comparable but output semantics differ.`]})]}),h.sameInput===!0&&(0,G.jsxs)(X,{variant:`default`,className:`gap-1 text-xs`,title:E4(h.inputs),children:[(0,G.jsx)(oa,{className:`h-3 w-3`,"aria-hidden":!0}),`Same input: `,T4(h.inputs)]}),h.sameInput===!1&&(0,G.jsxs)(X,{variant:`warning`,className:`gap-1 text-xs`,children:[(0,G.jsx)(_o,{className:`h-3 w-3 inline`,"aria-hidden":!0}),`Different inputs — each run targeted different data`]})]}),l,(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4`,children:[(0,G.jsx)(G2,{label:`Runs`,value:String(d.total),accent:`outline`}),(0,G.jsx)(G2,{label:`Completed`,value:String(d.completed),accent:`sage`}),(0,G.jsx)(G2,{label:`Failed`,value:String(d.failed),accent:`terracotta`}),(0,G.jsx)(G2,{label:`Skipped`,value:String(d.skipped),accent:`outline`}),(0,G.jsx)(G2,{label:`Tokens`,value:O0(d.totalTokens),accent:`ochre`}),(0,G.jsx)(G2,{label:`Cost`,value:D0(d.totalCostUsd,`actual`),accent:`ochre`})]}),E&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[p.cheapest?(0,G.jsx)(O4,{label:`Cheapest`,cell:p.cheapest.label,value:`${D0(p.cheapest.run.cost_usd,`actual`)}${p.cheapestPct===null?``:` (${p.cheapestPct}% of most expensive)`}`}):null,p.mostWrites?(0,G.jsx)(O4,{label:`Most writes`,cell:p.mostWrites.label,value:`${p.mostWrites.run.write_intents.total} intents`}):null,p.fastest?(0,G.jsx)(O4,{label:`Fastest`,cell:p.fastest.label,value:xv(p.fastest.run.duration_ms)}):null]}),T&&(0,G.jsx)(`p`,{className:`font-sans text-xs italic text-on-surface-variant`,children:`Some runs use phase-level overrides — expand rows to see per-phase differences.`}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Run comparison`}),D&&(0,G.jsx)(Y,{variant:y?`secondary`:`ghost`,size:`sm`,onClick:()=>b(e=>!e),className:`gap-2 text-xs`,"aria-pressed":y,children:`Show only varying dimensions`})]}),e.length===0?(0,G.jsx)(Q,{level:`low`,className:`flex h-24 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface-variant`,children:t?`Loading runs...`:`No runs to compare`})}):(0,G.jsx)(`div`,{className:`rounded-md bg-surface-container-low overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Run comparison`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/20 bg-surface-container/50`,children:[(0,G.jsx)(y4,{}),h4.filter(e=>w.has(e)).map(e=>(0,G.jsx)(y4,{children:g4[e]},e)),(0,G.jsx)(y4,{children:``})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsx)(b4,{run:e,expanded:x.has(e.id),onToggleExpanded:C,onOpenRun:a,visibleColumns:w,colSpan:k},e.id))})]})})]})]})}function y4({children:e}){return(0,G.jsx)(`th`,{className:`px-3 py-2 text-left text-[11px] font-medium text-on-surface-variant uppercase tracking-widest font-sans whitespace-nowrap`,children:e})}var b4=(0,W.memo)(function({run:e,expanded:t,onToggleExpanded:n,onOpenRun:r,visibleColumns:i,colSpan:a}){let o=(0,W.useMemo)(()=>({turnsTotal:t4(e.usage_data),costPerWrite:X2(e.cost_usd,e.write_intents.total),byToolLabel:Q2(e.write_intents.by_tool),reasoning:q2(e),phaseOverrideCount:c4(e),phaseOverrideTooltip:l4(e)}),[e]),s=(0,W.useMemo)(()=>t?o4(e):[],[t,e]),c=(0,W.useCallback)(()=>n(e.id),[n,e.id]),l=(0,W.useCallback)(()=>r(e.id),[r,e.id]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/10 last:border-0 hover:bg-surface-container-high/40 transition-colors`,children:[(0,G.jsx)(S4,{children:(0,G.jsx)(`button`,{type:`button`,onClick:c,"aria-expanded":t,"aria-label":t?`Collapse phase breakdown`:`Expand phase breakdown`,className:`flex items-center justify-center text-on-surface-variant hover:text-on-surface transition-colors`,children:t?(0,G.jsx)($i,{className:`h-4 w-4`}):(0,G.jsx)(ta,{className:`h-4 w-4`})})}),i.has(`harness`)&&(0,G.jsx)(S4,{children:e.harness||(0,G.jsx)(C4,{})}),i.has(`reasoning`)&&(0,G.jsx)(S4,{children:o.reasoning===`(task default)`?(0,G.jsx)(C4,{}):o.reasoning}),i.has(`model`)&&(0,G.jsx)(S4,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{children:e.model||(0,G.jsx)(C4,{})}),o.phaseOverrideCount>0&&(0,G.jsxs)(X,{variant:`secondary`,className:`text-[10px]`,title:o.phaseOverrideTooltip||void 0,children:[`Phases: `,o.phaseOverrideCount]})]})}),i.has(`status`)&&(0,G.jsx)(S4,{children:(0,G.jsx)(X,{variant:k0(e.status),children:yv(e.status)})}),i.has(`turns`)&&(0,G.jsx)(S4,{children:o.turnsTotal===null?`—`:o.turnsTotal}),i.has(`tokens`)&&(0,G.jsx)(S4,{children:O0(e.tokens_used)}),i.has(`cost`)&&(0,G.jsx)(S4,{children:D0(e.cost_usd,`actual`)}),i.has(`duration`)&&(0,G.jsx)(S4,{children:xv(e.duration_ms)}),i.has(`writes`)&&(0,G.jsx)(S4,{children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{children:e.write_intents.total}),o.byToolLabel&&(0,G.jsx)(`span`,{className:`font-sans text-[10px] text-on-surface-variant`,children:o.byToolLabel})]})}),i.has(`costPerWrite`)&&(0,G.jsx)(S4,{children:o.costPerWrite===null?`—`:`$${o.costPerWrite.toFixed(4)}`}),(0,G.jsx)(S4,{children:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-1 h-7 text-on-surface-variant`,onClick:l,children:[(0,G.jsx)(va,{className:`h-3 w-3`}),`View run`]})})]}),t&&(0,G.jsx)(`tr`,{className:`bg-surface-container/30 border-b border-outline-variant/10 last:border-0`,children:(0,G.jsx)(`td`,{colSpan:a,className:`px-3 py-3`,children:(0,G.jsx)(x4,{phases:s})})})]})},(e,t)=>e.run===t.run&&e.expanded===t.expanded&&e.visibleColumns===t.visibleColumns&&e.colSpan===t.colSpan&&e.onToggleExpanded===t.onToggleExpanded&&e.onOpenRun===t.onOpenRun);function x4({phases:e}){return e.length===0?(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant italic`,children:`No phase data available.`}):(0,G.jsx)(`div`,{className:`rounded-xs bg-surface-container-low/60 overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Phase breakdown`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/20`,children:[(0,G.jsx)(y4,{children:`Phase`}),(0,G.jsx)(y4,{children:`Reasoning`}),(0,G.jsx)(y4,{children:`Model`}),(0,G.jsx)(y4,{children:`Turns`}),(0,G.jsx)(y4,{children:`Tokens`}),(0,G.jsx)(y4,{children:`Cost`}),(0,G.jsx)(y4,{children:`Duration`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/10 last:border-0`,children:[(0,G.jsx)(S4,{children:e.name}),(0,G.jsx)(S4,{children:e.reasoning??(0,G.jsx)(C4,{})}),(0,G.jsx)(S4,{children:e.model??(0,G.jsx)(C4,{})}),(0,G.jsx)(S4,{children:e.turnsUsed===null?`—`:e.turnsUsed}),(0,G.jsx)(S4,{children:O0(e.tokensUsed)}),(0,G.jsx)(S4,{children:D0(e.costUsd,`actual`)}),(0,G.jsx)(S4,{children:xv(e.durationMs)})]},e.name))})]})})}function S4({children:e}){return(0,G.jsx)(`td`,{className:`px-3 py-2 font-mono text-xs text-on-surface whitespace-nowrap`,children:e})}function C4(){return(0,G.jsx)(`span`,{className:`font-sans text-[11px] italic text-on-surface-variant`,children:K2})}function w4(e,t){let n=new Set;for(let t of e)t.task&&n.add(t.task);if(n.size===0)return{kind:`none`};if(n.size===1){let[e]=n;return{kind:`single`,label:t.get(e)??e}}let r=[...n].map(e=>t.get(e)??e).sort();return{kind:`mixed`,count:n.size,tooltip:r.join(`, `)}}function T4(e){let t=Object.entries(e).filter(e=>!!e[1]);return t.length===0?``:t.map(([e,t])=>`${e}=${D4(t)}`).join(`, `)}function E4(e){return Object.entries(e).filter(e=>!!e[1]).map(([e,t])=>`${e}=${t}`).join(`, `)}function D4(e){return e.length<=_4?e:`${e.slice(0,_4-1)}…`}function O4({label:e,cell:t,value:n}){return(0,G.jsxs)(Q,{level:`low`,className:`px-3 py-2 flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`font-sans font-medium text-on-surface-variant uppercase tracking-wide text-[10px]`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:t}),(0,G.jsxs)(`span`,{className:`font-mono text-on-surface-variant`,children:[`— `,n]})]})}var k4=`tab`,A4=`task`,j4=`runs`,M4=new Set([`runs`,`tasks`,`config`,`comparisons`]),N4={evaluations:`comparisons`};function P4(e){if(!e)return;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0}function F4(e){let t=e.get(k4),n=`runs`;return t&&(M4.has(t)?n=t:N4[t]&&(n=N4[t])),{tab:n,taskId:e.get(A4)??void 0,compareRunIds:P4(e.get(j4))}}function I4({tab:e,taskId:t,compareRunIds:n}){let r=new URLSearchParams;return e!==`runs`&&r.set(k4,e),t&&r.set(A4,t),n&&n.length>0&&r.set(j4,n.join(`,`)),r}var L4=[{id:`runs`,label:`Runs`,description:`execution log`},{id:`tasks`,label:`Tasks`,description:`task library`},{id:`comparisons`,label:`Comparisons`,description:`side-by-side`},{id:`config`,label:`Config`,description:`agent settings`}],R4={key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:`running`,label:`Running`},{value:`completed`,label:`Completed`},{value:`failed`,label:`Failed`},{value:`cancelled`,label:`Cancelled`}]};function z4({runIds:e,onBack:t,onOpenRun:n}){let{runs:r,isLoading:i,isError:a,errors:o}=gj(e);return(0,G.jsx)(v4,{runs:r,isLoading:i,isError:a,errorMessage:o[0]?.message,onBack:t,onOpenRun:n,title:`Comparison`,subtitle:`${e.length} ${e.length===1?`run`:`runs`}`,backLabel:`Comparisons`})}function B4(){let{id:e}=Ln(),t=Nn(),n=An(),[r]=di(),i=(0,W.useMemo)(()=>F4(r),[r]),a=e?`runs`:i.tab,{taskId:o,compareRunIds:s}=i,[c,l]=(0,W.useState)(!1),u=(0,W.useRef)(null),{searchInput:d,debouncedSearch:f,filterValues:p,offset:m,setOffset:h,handleSearchChange:g,handleFilterChange:_,handleClearFilters:v,hasActiveFilters:y,activeFilter:b}=hP({filters:[{key:`status`,defaultValue:`all`},{key:`task`,defaultValue:`all`}]}),x=(0,W.useMemo)(()=>{if(e){let t=`/${e}`;if(n.pathname.endsWith(t))return n.pathname.slice(0,-t.length)}return n.pathname},[n.pathname,e]);(0,W.useEffect)(()=>{let e=new URLSearchParams(n.search),r=e.get(k4),i=r?N4[r]:void 0,a=!1;if(i&&(i===`runs`?e.delete(k4):e.set(k4,i),a=!0),a){let r=e.toString();t(`${n.pathname}${r?`?${r}`:``}${n.hash}`,{replace:!0})}},[]);let S=(0,W.useCallback)((e,r,i)=>{t(mP(x,I4({tab:e,taskId:r,compareRunIds:i}),n.hash))},[x,n.hash,t]),C=(0,W.useCallback)((e,r)=>{let i=a===`runs`?pP(n.search,{[k4]:{value:void 0},[j4]:{value:void 0}}):new URLSearchParams;t(mP(`${x}/${e}`,i,n.hash),r)},[x,n.hash,n.search,t,a]),w=(0,W.useCallback)(e=>{S(e)},[S]),T;a===`runs`&&(T=(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:()=>l(!0),children:[(0,G.jsx)(Ja,{className:`h-3.5 w-3.5`}),`Run Now`]}));let{data:E}=rj(),D=(0,W.useMemo)(()=>[R4,{key:`task`,label:`Task`,options:[{value:`all`,label:`All tasks`},...(E?.tasks??[]).map(e=>({value:e.name,label:e.displayName}))]}],[E]),O=b(`status`),k=b(`task`);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`shrink-0 p-6 pb-0 space-y-6`,children:[(0,G.jsx)(yP,{title:`Agent`,subtitle:`Intelligence runs, task configuration, and operational settings`,actions:T}),(0,G.jsx)(iF,{tabs:L4.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:a,onTabChange:w,columns:4}),a===`runs`&&(0,G.jsx)(TM,{searchPlaceholder:`Search runs...`,searchValue:d,onSearchChange:g,filters:D,filterValues:p,onFilterChange:_,onClear:v,hasActiveFilters:y,inputRef:u})]}),a===`runs`&&(0,G.jsx)(`div`,{className:`flex-1 min-h-0 mt-4`,children:(0,G.jsx)(CM,{hasSelection:!!e,onCloseMobileDetail:()=>{t(mP(x,new URLSearchParams(n.search),n.hash))},masterAriaLabel:`Agent runs`,detailAriaLabel:`Run details`,master:(0,G.jsx)(z0,{selectedId:e,search:f,statusFilter:O,taskFilter:k,offset:m,onOffsetChange:h,filterInputRef:u,onSelectRun:C,onTriggerRun:()=>l(!0),onCompareRuns:e=>S(`comparisons`,void 0,e)}),detail:e?(0,G.jsx)(h2,{runId:e,onBack:()=>{t(mP(x,new URLSearchParams(n.search),n.hash))}}):(0,G.jsx)(wM,{message:`Select a run to see its details.`})})}),a===`tasks`&&(0,G.jsx)(`div`,{className:`p-6 pt-4 space-y-4`,children:o?(0,G.jsx)(R2,{taskId:o,onBack:()=>S(`tasks`),onNavigate:e=>S(`tasks`,e),onRunTriggered:e=>{e&&C(e)}}):(0,G.jsx)(y2,{onSelect:e=>S(`tasks`,e)})}),a===`comparisons`&&(0,G.jsx)(`div`,{className:`p-6 pt-4 space-y-4`,children:s&&s.length>0?(0,G.jsx)(z4,{runIds:s,onBack:()=>S(`comparisons`),onOpenRun:e=>C(e)}):(0,G.jsxs)(Q,{level:`low`,className:`p-8 text-center space-y-2`,children:[(0,G.jsx)(`h2`,{className:`font-serif text-lg text-on-surface`,children:`Compare selected runs`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Select two or more runs in the Runs tab and use "Compare selected" to see them side by side here.`}),(0,G.jsx)(Y,{variant:`outline`,size:`sm`,className:`mt-2`,onClick:()=>S(`runs`),children:`Go to Runs`})]})}),a===`config`&&(0,G.jsx)(`div`,{className:`p-6 pt-4 space-y-4`,children:(0,G.jsx)(H2,{})}),(0,G.jsx)(E0,{open:c,onOpenChange:l,onTriggered:e=>{e&&C(e)}})]})}var V4={IDENTIFIED:`identified`,APPROVED:`approved`,GENERATED:`generated`,DISMISSED:`dismissed`,DEFERRED:`deferred`},H4=`${V4.APPROVED},${V4.GENERATED}`,U4=[{key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:V4.IDENTIFIED,label:`Identified`},{value:H4,label:`Approved & generated`},{value:V4.APPROVED,label:`Awaiting generation`},{value:V4.GENERATED,label:`Generated`},{value:V4.DEFERRED,label:`Deferred`},{value:V4.DISMISSED,label:`Dismissed`}]}];function W4(e){let t=`${(e*100).toFixed(0)}%`;return e>=.85?{text:t,variant:`default`}:e>=.7?{text:t,variant:`secondary`}:{text:t,variant:`outline`}}function G4(e){let t=Math.floor(Date.now()/1e3)-e;return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function K4(e){switch(e){case V4.IDENTIFIED:return(0,G.jsx)(X,{variant:`outline`,children:`Identified`});case V4.APPROVED:return(0,G.jsx)(X,{variant:`secondary`,children:`Awaiting generation`});case V4.GENERATED:return(0,G.jsx)(X,{variant:`default`,children:`Generated`});case V4.DEFERRED:return(0,G.jsx)(X,{variant:`outline`,children:`Deferred`});case V4.DISMISSED:return(0,G.jsx)(X,{variant:`outline`,className:`opacity-50`,children:`Dismissed`});default:return(0,G.jsx)(X,{variant:`outline`,children:e})}}function q4(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function J4(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||typeof t.type!=`string`?null:`${t.type}:${t.id}`}function Y4({label:e,values:t}){return t.length===0?null:(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`dt`,{className:`text-on-surface-variant`,children:e}),(0,G.jsx)(`dd`,{className:`mt-1 flex flex-wrap gap-1.5`,children:t.map(e=>(0,G.jsx)(`code`,{className:`max-w-full truncate rounded border border-outline-variant/40 bg-surface-container px-1.5 py-0.5 font-mono text-[11px] text-on-surface`,title:e,children:e},e))})]})}function X4({candidate:e}){let t=q4(e.source_ids).map(J4).filter(e=>!!e),n=q4(e.quality_failures).filter(e=>typeof e==`string`),r=q4(e.coverage_matches).filter(e=>typeof e==`string`),i=typeof e.quality_score==`number`&&Number.isFinite(e.quality_score)?e.quality_score:null;return e.evidence_bundle_id||i!==null||n.length>0||r.length>0||t.length>0||e.reconciliation_reason?(0,G.jsxs)(`details`,{className:`group font-sans text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`summary`,{className:`flex cursor-pointer list-none flex-wrap items-center gap-2 [&::-webkit-details-marker]:hidden`,children:[i!==null&&(0,G.jsxs)(X,{variant:i>=.7?`secondary`:`outline`,children:[`Quality `,(i*100).toFixed(0),`%`]}),e.evidence_bundle_id&&(0,G.jsxs)(X,{variant:`outline`,className:`max-w-[240px] truncate`,title:e.evidence_bundle_id,children:[`Bundle `,e.evidence_bundle_id]}),t.length>0&&(0,G.jsxs)(X,{variant:`outline`,title:t.join(`, `),children:[t.length,` source`,t.length===1?``:`s`]}),r.length>0&&(0,G.jsxs)(X,{variant:`outline`,title:r.join(`, `),children:[r.length,` overlap`,r.length===1?``:`s`]}),n.slice(0,3).map(e=>(0,G.jsx)(X,{variant:`outline`,className:`opacity-70`,children:e},e)),n.length>3&&(0,G.jsxs)(X,{variant:`outline`,className:`opacity-70`,children:[`+`,n.length-3,` more`]}),(0,G.jsx)(`span`,{className:`text-on-surface-variant underline-offset-2 group-open:underline`,children:`Evidence details`})]}),(0,G.jsxs)(`dl`,{className:`mt-3 grid gap-3 border-l border-outline-variant/40 pl-3 sm:grid-cols-2`,children:[e.evidence_bundle_id&&(0,G.jsx)(Y4,{label:`Bundle`,values:[e.evidence_bundle_id]}),(0,G.jsx)(Y4,{label:`Sources`,values:t}),(0,G.jsx)(Y4,{label:`Coverage matches`,values:r}),(0,G.jsx)(Y4,{label:`Quality failures`,values:n}),e.reconciliation_reason&&(0,G.jsxs)(`div`,{className:`min-w-0 sm:col-span-2`,children:[(0,G.jsx)(`dt`,{className:`text-on-surface-variant`,children:`Latest reconciliation`}),(0,G.jsx)(`dd`,{className:`mt-1 leading-relaxed text-on-surface`,children:e.reconciliation_reason})]})]})]}):null}function Z4({candidate:e,onApprove:t,onDefer:n,onDismiss:r,isApproving:i,isDeferring:a,isDismissing:o}){let s=W4(e.confidence),c=e.status===V4.IDENTIFIED||e.status===V4.APPROVED;return(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`h3`,{className:`font-serif text-lg text-on-surface leading-tight`,children:e.topic}),e.approved_at!==null&&(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant mt-1`,children:[`Approved `,G4(e.approved_at),e.status===V4.GENERATED&&` · generated`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[K4(e.status),(0,G.jsx)(X,{variant:s.variant,children:s.text}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:G4(e.created_at)})]})]}),(0,G.jsx)(kO,{content:e.rationale,className:`text-sm text-on-surface-variant`}),(0,G.jsx)(X4,{candidate:e}),c&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[e.status===V4.IDENTIFIED&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{size:`sm`,variant:`default`,onClick:t,disabled:i,children:[(0,G.jsx)(Qi,{className:`h-3.5 w-3.5 mr-1.5`}),i?`Approving...`:`Approve`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,onClick:n,disabled:a,className:`text-on-surface-variant`,children:[(0,G.jsx)(ua,{className:`h-3.5 w-3.5 mr-1.5`}),a?`Deferring...`:`Defer`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,onClick:r,disabled:o,className:`text-on-surface-variant`,children:[(0,G.jsx)(ca,{className:`h-3.5 w-3.5 mr-1.5`}),o?`Dismissing...`:`Dismiss`]})]}),e.status===V4.APPROVED&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:`Awaiting generation`})]})]})}function Q4(){return(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,G.jsx)(`div`,{className:`h-5 w-64 rounded bg-surface-container-high animate-pulse`}),(0,G.jsx)(`div`,{className:`h-5 w-20 rounded bg-surface-container-high animate-pulse`})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`h-3 w-full rounded bg-surface-container-high animate-pulse`}),(0,G.jsx)(`div`,{className:`h-3 w-3/4 rounded bg-surface-container-high animate-pulse`})]}),(0,G.jsx)(`div`,{className:`h-8 w-32 rounded bg-surface-container-high animate-pulse`})]})}function $4(){let e=vj(),{searchInput:t,debouncedSearch:n,filterValues:r,offset:i,setOffset:a,handleSearchChange:o,handleFilterChange:s,handleClearFilters:c,hasActiveFilters:l,activeFilter:u}=uP({initialFilters:{status:V4.IDENTIFIED}}),d=u(`status`),{data:f,isLoading:p,isError:m,error:h}=_j({status:d,limit:50,offset:i}),g=f?.candidates??[],_=f?.total??0,v=(0,W.useMemo)(()=>{if(!n)return g;let e=n.toLowerCase();return g.filter(t=>t.topic.toLowerCase().includes(e)||t.rationale.toLowerCase().includes(e))},[g,n]);function y(t){e.mutate({id:t.id,status:V4.APPROVED})}function b(t){e.mutate({id:t.id,status:V4.DEFERRED})}function x(t){e.mutate({id:t.id,status:V4.DISMISSED})}let S=(0,G.jsx)(TM,{searchPlaceholder:`Search candidates by title or rationale...`,searchValue:t,onSearchChange:o,filters:U4,filterValues:r,onFilterChange:s,onClear:c,hasActiveFilters:l});if(m)return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[S,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load candidates`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:h instanceof Error?h.message:`Unknown error`})]})]});if(p)return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[S,Array.from({length:3}).map((e,t)=>(0,G.jsx)(Q4,{},t))]});let C=e.isError?e.variables:void 0,w=C?g.find(e=>e.id===C.id)?.topic:void 0;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[S,e.isError&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-terracotta/40 bg-terracotta/5 px-3 py-2 font-sans text-sm text-on-surface`,children:[(0,G.jsx)(ra,{className:`mt-0.5 h-4 w-4 shrink-0 text-terracotta`}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[`Couldn't update `,w?`"${w}"`:`candidate`,`.`]}),` `,(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:e.error instanceof Error?e.error.message:`Unknown error`})]})]}),v.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-3 text-on-surface-variant`,children:[(0,G.jsx)(La,{className:`h-10 w-10 opacity-20`}),_===0&&!d&&!n?(0,G.jsxs)(`div`,{className:`text-center space-y-2 max-w-md`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`No skill candidates discovered yet`}),(0,G.jsx)(`p`,{className:`font-sans text-xs leading-relaxed`,children:`Candidates are procedural patterns discovered from your vault knowledge. Review and approve them here, then Myco generates full skills from them.`}),(0,G.jsxs)(`div`,{className:`font-sans text-xs space-y-1 pt-1`,children:[(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Automatic:`}),` `,`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-survey`,className:`text-primary hover:underline`,children:`Skill Survey`}),` `,`task runs automatically during idle periods and discovers candidates from session history, decisions, and gotchas.`]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Manual:`}),` `,`Run`,` `,(0,G.jsxs)(ri,{to:`/agent?tab=tasks&task=skill-survey`,className:`inline-flex items-center gap-1 text-primary hover:underline`,children:[(0,G.jsx)(va,{className:`h-3 w-3`}),`Skill Survey`]}),` `,`from the Agent page to discover candidates on demand.`]})]})]}):(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No matching candidates`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:n?`${v.length} of ${_} candidate${_===1?``:`s`}`:`${_} candidate${_===1?``:`s`}`}),v.map(t=>(0,G.jsx)(Z4,{candidate:t,onApprove:()=>y(t),onDefer:()=>b(t),onDismiss:()=>x(t),isApproving:e.isPending&&e.variables?.id===t.id&&e.variables?.status===V4.APPROVED,isDeferring:e.isPending&&e.variables?.id===t.id&&e.variables?.status===V4.DEFERRED,isDismissing:e.isPending&&e.variables?.id===t.id&&e.variables?.status===V4.DISMISSED},t.id))]}),(0,G.jsx)(jM,{total:n?v.length:_,offset:i,limit:50,onPageChange:a})]})}var e3=5,t3=[{key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:`active`,label:`Active`},{value:`stale`,label:`Stale`},{value:`retired`,label:`Retired`}]}];function n3(e){return e===`active`?`default`:e===`stale`?`secondary`:`outline`}function r3({children:e,className:t}){return(0,G.jsx)(`th`,{className:J(`px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,t),children:e})}function i3(){return(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)]`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-40 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-12 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-16 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-20 rounded bg-surface-container-high animate-pulse`})})]})}function a3({record:e,onClick:t}){return(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)] last:border-0 hover:bg-surface-container/60 cursor-pointer transition-all duration-150 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40 hover:shadow-[inset_3px_0_0_var(--primary)]`,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},tabIndex:0,role:`row`,"aria-label":`Skill: ${e.display_name}`,children:[(0,G.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface block`,children:e.display_name}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant block mt-0.5`,children:e.name})]}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsxs)(X,{variant:`outline`,className:`font-mono text-[10px] px-1.5 py-0`,children:[`gen `,e.generation]})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(X,{variant:n3(e.status),children:e.status})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:e.usage_count})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:Sv(e.updated_at)})})]})}function o3({onSelectSkill:e}){let{searchInput:t,debouncedSearch:n,filterValues:r,offset:i,setOffset:a,handleSearchChange:o,handleFilterChange:s,handleClearFilters:c,hasActiveFilters:l,activeFilter:u}=uP({initialFilters:{status:`all`}}),d=u(`status`),{data:f,isLoading:p,isError:m,error:h}=yj({status:d,limit:50,offset:i}),g=f?.records??[],_=f?.total??0,v=n?g.filter(e=>e.display_name.toLowerCase().includes(n.toLowerCase())||e.name.toLowerCase().includes(n.toLowerCase())||e.description.toLowerCase().includes(n.toLowerCase())):g,y=(0,G.jsx)(TM,{searchPlaceholder:`Search skills by name, slug, or description...`,searchValue:t,onSearchChange:o,filters:t3,filterValues:r,onFilterChange:s,onClear:c,hasActiveFilters:l,count:_>0?`${_} ${_===1?`skill`:`skills`}`:void 0}),b=(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)] bg-surface-container/50`,children:[(0,G.jsx)(r3,{children:`Name`}),(0,G.jsx)(r3,{children:`Generation`}),(0,G.jsx)(r3,{children:`Status`}),(0,G.jsx)(r3,{children:`Usage`}),(0,G.jsx)(r3,{children:`Last Evolved`})]})});return m?(0,G.jsxs)(`div`,{children:[y,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary mt-4`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load skills`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:h instanceof Error?h.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{children:[y,p?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[b,(0,G.jsx)(`tbody`,{children:Array.from({length:e3}).map((e,t)=>(0,G.jsx)(i3,{},t))})]})}):v.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-3 text-on-surface-variant mt-4`,children:[(0,G.jsx)(Yi,{className:`h-10 w-10 opacity-20`}),_===0&&!n&&!d?(0,G.jsxs)(`div`,{className:`text-center space-y-2 max-w-md`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`No skills generated yet`}),(0,G.jsx)(`p`,{className:`font-sans text-xs leading-relaxed`,children:`Skills are project-specific procedural guides generated from your vault knowledge. They teach agents how to accomplish tasks in this codebase.`}),(0,G.jsxs)(`div`,{className:`font-sans text-xs space-y-1 pt-1`,children:[(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Automatic:`}),` `,`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-survey`,className:`text-primary hover:underline`,children:`Skill Survey`}),` `,`task runs automatically and discovers candidates from your vault. Approve candidates in the`,` `,(0,G.jsx)(ri,{to:`/skills?tab=candidates`,className:`text-primary hover:underline`,children:`Candidates tab`}),`, then enable the`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-generate`,className:`text-primary hover:underline`,children:`Skill Generate`}),` `,`task to produce skills automatically.`]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Manual:`}),` `,`Run`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-generate`,className:`text-primary hover:underline`,children:`Skill Generate`}),` `,`from the Agent page to generate a skill on demand.`]})]})]}):(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No matching skills`})]}):(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Skills`,children:[b,(0,G.jsx)(`tbody`,{children:v.map(t=>(0,G.jsx)(a3,{record:t,onClick:()=>e(t.name)},t.id))})]})}),(0,G.jsx)(jM,{total:_,offset:i,limit:50,onPageChange:a})]})}var s3={created:`default`,updated:`secondary`,split:`warning`,retired:`outline`};function c3({entry:e}){let[t,n]=(0,W.useState)(!1);return(0,G.jsxs)(`div`,{className:`relative pl-6`,children:[(0,G.jsx)(`div`,{className:`absolute left-0 top-2 h-2.5 w-2.5 rounded-full border-2 border-outline-variant bg-surface-container`}),(0,G.jsxs)(`button`,{type:`button`,className:`w-full text-left group cursor-pointer`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(X,{variant:`outline`,className:`font-mono text-[10px] px-1.5 py-0`,children:[`v`,e.generation]}),(0,G.jsx)(X,{variant:s3[e.action]??`outline`,children:e.action}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant ml-auto shrink-0`,children:Sv(e.created_at)}),(0,G.jsx)(ta,{className:J(`h-3.5 w-3.5 text-on-surface-variant transition-transform duration-150`,t&&`rotate-90`)})]}),e.rationale&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant mt-1 leading-relaxed`,children:e.rationale})]}),t&&e.content_snapshot&&(0,G.jsx)(Q,{level:`lowest`,className:`mt-2 p-3 overflow-auto max-h-96`,children:(0,G.jsx)(`pre`,{className:`font-mono text-xs text-on-surface whitespace-pre-wrap break-words`,children:e.content_snapshot})})]})}function l3({entries:e}){return e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant py-4`,children:`No evolution history.`}):(0,G.jsxs)(`div`,{className:`relative space-y-4`,children:[(0,G.jsx)(`div`,{className:`absolute left-[4.5px] top-2 bottom-2 w-px bg-outline-variant/30`}),e.map(e=>(0,G.jsx)(c3,{entry:e},e.id))]})}function u3(e){return e===`active`?`default`:e===`stale`?`secondary`:`outline`}function d3(e){if(!e)return 0;try{let t=JSON.parse(e);return Array.isArray(t)?t.length:0}catch{return 0}}function f3(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(`div`,{className:`h-8 w-24 animate-pulse rounded bg-surface-container-high`}),(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-low p-4 space-y-3`,children:[(0,G.jsx)(`div`,{className:`h-6 w-48 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-64 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-5 w-32 animate-pulse rounded bg-surface-container-high`})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:Array.from({length:3}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-container-high`},t))})]})}function p3({skillName:e,onBack:t}){let{data:n,isPending:r,isError:i}=bj(e),a=xj(),[o,s]=(0,W.useState)(!1);if(r)return(0,G.jsx)(f3,{});if(i||!n)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Skills`]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Skill not found`})]})]});let c=d3(n.source_ids),l=n.lineage?.[0]?.content_snapshot??null,u=n.frontmatter??{},d=l?.replace(/^---\n[\s\S]*?\n---\n*/,``)??null;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Skills`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-2 text-tertiary hover:text-tertiary hover:bg-tertiary/10`,onClick:()=>s(!0),children:[(0,G.jsx)(ho,{className:`h-4 w-4`}),`Delete`]})]}),(0,G.jsx)(Q,{level:`low`,accent:`sage`,className:`p-5 space-y-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-1 min-w-0`,children:[(0,G.jsxs)(Uj,{tone:`sage`,children:[`Skill · `,n.name]}),(0,G.jsx)(`h1`,{className:`myco-display-md text-on-surface m-0`,children:n.display_name}),n.description&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:n.description}),n.path&&(0,G.jsx)(`p`,{className:`font-mono text-[10px] text-on-surface-variant mt-1`,children:n.path}),Object.keys(u).length>0&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 mt-2`,children:[u[`user-invocable`]===`true`&&(0,G.jsx)(X,{variant:`secondary`,children:`user-invocable`}),u[`allowed-tools`]&&(0,G.jsxs)(X,{variant:`outline`,children:[`tools: `,u[`allowed-tools`]]})]})]}),(0,G.jsx)(X,{variant:u3(n.status),className:`shrink-0`,children:n.status})]})}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,G.jsx)(Qj,{label:`Generation`,value:`v${n.generation}`,tone:`sage`,mono:!0}),(0,G.jsx)(Qj,{label:`Usage`,value:`${n.usage_total??n.usage_count??0}`,sub:`sessions`,tone:`ochre`}),(0,G.jsx)(Qj,{label:`Sources`,value:`${c}`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(ZM,{children:`Evolution History`}),(0,G.jsx)(l3,{entries:n.lineage??[]})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(ZM,{children:`Current Content`}),d?(0,G.jsx)(kO,{content:d}):(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant py-4`,children:`No content snapshot available.`})]}),(0,G.jsx)(AM,{open:o,onOpenChange:s,title:`Delete Skill`,description:`This will permanently delete the skill record, evolution history, and the SKILL.md file from disk.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-tertiary`}),meta:n?[{label:`Name`,value:n.name},{label:`Title`,value:n.display_name}]:[],confirmLabel:`Delete Skill`,variant:`destructive`,onConfirm:()=>{a.mutate(n.name,{onSuccess:()=>{s(!1),t()}})},isPending:a.isPending})]})}var m3=`tab`,h3=`skill`,g3=new Set([`candidates`,`skills`]);function _3(e){let t=new URLSearchParams(e),n=t.get(m3);return{tab:n&&g3.has(n)?n:`skills`,skill:t.get(h3)??void 0}}function v3(e,t){let n=new URLSearchParams;e!==`skills`&&n.set(m3,e),t&&n.set(h3,t);let r=n.toString(),i=r?`${window.location.pathname}?${r}`:window.location.pathname;window.history.replaceState(null,``,i)}var y3=[{id:`skills`,label:`Skills`,description:`promoted records`},{id:`candidates`,label:`Candidates`,description:`approval queue`}];function b3(){return(0,G.jsxs)(Zf,{children:[(0,G.jsx)(Qf,{asChild:!0,children:(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`text-on-surface-variant`,children:(0,G.jsx)(sa,{className:`h-4 w-4`})})}),(0,G.jsxs)(tp,{className:`max-w-lg`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`How Skills Work`}),(0,G.jsx)(ap,{children:`Skills are project-specific procedural guides generated from your vault knowledge. They teach agents how to accomplish tasks in your codebase.`})]}),(0,G.jsxs)(`div`,{className:`space-y-4 font-sans text-sm text-on-surface-variant`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`h4`,{className:`font-medium text-on-surface`,children:`The Pipeline`}),(0,G.jsxs)(`ol`,{className:`list-decimal pl-5 space-y-1`,children:[(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Survey`}),` — discovers candidate skills from vault knowledge (sessions, decisions, gotchas)`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Approve`}),` — you review candidates and approve the ones worth generating`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Generate`}),` — produces a SKILL.md file from the approved candidate's source material`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Evolve`}),` — updates existing skills when new knowledge makes them stale`]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`h4`,{className:`font-medium text-on-surface`,children:`Scheduling`}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Skill Survey`}),` runs automatically during idle periods. Skill Generate and Skill Evolve are off by default — enable them in the`,` `,(0,G.jsxs)(ri,{to:`/agent?tab=tasks`,className:`text-primary hover:underline inline-flex items-center gap-0.5`,children:[`Agent Tasks`,(0,G.jsx)(va,{className:`h-3 w-3`})]}),` `,`page for fully automatic operation, or trigger them manually with Run Now.`]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`h4`,{className:`font-medium text-on-surface`,children:`Quick Start`}),(0,G.jsxs)(`ol`,{className:`list-decimal pl-5 space-y-1`,children:[(0,G.jsx)(`li`,{children:`Wait for the survey to discover candidates (or run it manually)`}),(0,G.jsx)(`li`,{children:`Review candidates in the Candidates tab and approve the best ones`}),(0,G.jsxs)(`li`,{children:[`Run`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-generate`,className:`text-primary hover:underline`,children:`Skill Generate`}),` `,`to produce skills from approved candidates`]})]})]})]})]})]})}function x3(){let e=An(),t=_3(e.search),[n,r]=(0,W.useState)(t.tab),[i,a]=(0,W.useState)(t.skill),{data:o}=_j({status:`identified`}),{data:s}=yj({status:`active`}),c=o?.total??0,l=s?.total??0;(0,W.useEffect)(()=>{v3(n,i)},[n,i]),(0,W.useEffect)(()=>{let t=_3(e.search);r(t.tab),a(t.skill)},[e.search,e.key]);let u=(0,W.useCallback)(e=>{let t=e;r(t),t!==`skills`&&a(void 0)},[]),d=(0,W.useCallback)(e=>{r(`skills`),a(e)},[]);return(0,G.jsxs)(zj,{children:[(0,G.jsx)(yP,{title:`Skills`,subtitle:`Discovered skill candidates and promoted skill records`,actions:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c>0&&(0,G.jsxs)(X,{variant:`secondary`,children:[c,` pending`]}),l>0&&(0,G.jsxs)(X,{variant:`default`,children:[l,` active`]}),(0,G.jsx)(b3,{})]})}),(0,G.jsx)(iF,{tabs:y3.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:u,columns:2}),n===`candidates`&&(0,G.jsx)($4,{}),n===`skills`&&!i&&(0,G.jsx)(o3,{onSelectSkill:d}),n===`skills`&&i&&(0,G.jsx)(p3,{skillName:i,onBack:()=>a(void 0)})]})}function S3({id:e,value:t,onChange:n,disabled:r,readonly:i}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,id:e,children:[(0,G.jsx)(bP,{checked:t,onCheckedChange:e=>n(e),disabled:r||i}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:t?`On`:`Off`})]})}function C3({id:e,value:t,onChange:n,disabled:r,readonly:i,options:a,optionLabels:o,placeholder:s}){return i?(0,G.jsx)(`div`,{id:e,className:`flex h-9 items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:o?.[t]??t}):(0,G.jsxs)(v_,{value:t,onValueChange:n,disabled:r,children:[(0,G.jsx)(b_,{id:e,children:(0,G.jsx)(y_,{placeholder:s})}),(0,G.jsx)(x_,{children:a.map(e=>(0,G.jsx)(S_,{value:e,children:o?.[e]??e},e))})]})}function w3(e,t,n){let r=e;return typeof t==`number`&&(r=Math.max(t,r)),typeof n==`number`&&(r=Math.min(n,r)),r}function T3({id:e,value:t,onChange:n,disabled:r,readonly:i,min:a,max:o,step:s,suffix:c,placeholder:l}){let[u,d]=(0,W.useState)(String(t));(0,W.useEffect)(()=>{d(String(t))},[t]);function f(){if(u.trim()===``){d(String(t));return}let e=Number(u);if(Number.isNaN(e)){d(String(t));return}let r=w3(e,a,o);r!==t&&n(r),d(String(r))}function p(e){e.key===`Enter`?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),d(String(t)))}return i?(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{id:e,className:`flex h-9 w-32 items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:t}),c&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:c})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(op,{id:e,type:`number`,value:u,min:a,max:o,step:s??1,disabled:r,placeholder:l,onChange:e=>d(e.target.value),onBlur:f,onKeyDown:p,className:`w-32 font-mono`}),c&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:c})]})}function E3({id:e,value:t,onChange:n,disabled:r,readonly:i,placeholder:a,trim:o=!0}){let[s,c]=(0,W.useState)(t);(0,W.useEffect)(()=>{c(t)},[t]);function l(){let e=o?s.trim():s;e!==t&&n(e),c(e)}function u(e){e.key===`Enter`?(e.preventDefault(),l()):e.key===`Escape`&&(e.preventDefault(),c(t))}return i?(0,G.jsx)(`div`,{id:e,className:`flex h-9 w-full items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:t}):(0,G.jsx)(op,{id:e,type:`text`,value:s,placeholder:a,disabled:r,onChange:e=>c(e.target.value),onBlur:l,onKeyDown:u,className:`font-mono`})}function D3(e){return e.split(/\r?\n|,/).map(e=>e.trim()).filter(e=>e.length>0)}function O3({id:e,value:t,onChange:n,disabled:r,readonly:i,placeholder:a,allowDuplicates:o=!1,onAdd:s,onRemove:c}){let[l,u]=(0,W.useState)(``);function d(e){if(e.length===0)return;if(s){let n=new Set(o?[]:t);for(let t of e)!o&&n.has(t)||(n.add(t),s(t));return}let r=new Set(o?[]:t),i=t.slice();for(let t of e)!o&&r.has(t)||(r.add(t),i.push(t));i.length!==t.length&&n(i)}function f(){d(D3(l)),u(``)}function p(e){if(c){c(t[e]);return}let r=t.slice();r.splice(e,1),n(r)}function m(e){e.key===`Enter`&&(e.preventDefault(),f())}function h(e){let t=e.clipboardData.getData(`text`);t&&/[\r\n,]/.test(t)&&(e.preventDefault(),d(D3(l+t)),u(``))}return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[t.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,G.jsxs)(X,{variant:`secondary`,className:`gap-1 pr-1`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e}),!i&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e}`,disabled:r,onClick:()=>p(t),className:`rounded-xs p-0.5 text-on-surface-variant hover:bg-surface-container-highest hover:text-on-surface disabled:opacity-50`,children:(0,G.jsx)(So,{className:`h-3 w-3`})})]},`${e}-${t}`))}),!i&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(op,{id:e,type:`text`,value:l,placeholder:a,disabled:r,onChange:e=>u(e.target.value),onKeyDown:m,onPaste:h,onBlur:()=>{l.trim().length>0&&f()},className:`font-mono`}),(0,G.jsx)(Y,{type:`button`,variant:`outline`,size:`sm`,disabled:r||l.trim().length===0,onClick:f,children:`Add`})]})]})}function k3({id:e,value:t,onChange:n,disabled:r,readonly:i,configured:a,source:o,placeholder:s}){let[c,l]=(0,W.useState)(t),[u,d]=(0,W.useState)(!1);(0,W.useEffect)(()=>{l(t)},[t]);function f(){c!==t&&n(c)}function p(e){e.key===`Enter`?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),l(t))}let m=o?`stored in ${o}`:`stored in keychain`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(op,{id:e,type:u?`text`:`password`,value:c,placeholder:s,disabled:r||i,readOnly:i,autoComplete:`off`,onChange:e=>l(e.target.value),onBlur:f,onKeyDown:p,className:`font-mono`}),(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":u?`Hide secret`:`Reveal secret`,"aria-pressed":u,disabled:r,onClick:()=>d(e=>!e),children:u?(0,G.jsx)(ya,{className:`h-4 w-4`}):(0,G.jsx)(ba,{className:`h-4 w-4`})})]}),a&&(0,G.jsx)(`div`,{children:(0,G.jsx)(X,{variant:`default`,className:`bg-primary/15 text-primary`,children:m})})]})}function A3(){let[e,t]=(0,W.useState)({}),[n,r]=(0,W.useState)(``),[i,a]=(0,W.useState)(!0),[o,s]=(0,W.useState)(null),c=JO(),l=YO();(0,W.useEffect)(()=>{q(`/config/plan-dirs`).then(e=>t(e.symbiont)).catch(e=>s(e instanceof Error?e.message:String(e))).finally(()=>a(!1))},[]);let u=Object.entries(e);return(0,G.jsxs)(Q,{id:Pi.settingsPlanCapture,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-amber-500 transition-all duration-300`,children:[(0,G.jsx)(ZM,{children:`Plan Capture`}),i?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading...`}):(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Agent Directories`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Directories monitored by connected agents. Managed by symbiont manifests.`}),o?(0,G.jsxs)(`p`,{role:`alert`,className:`font-sans text-xs text-tertiary`,children:[`Failed to load agent directories: `,o]}):u.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant italic`,children:`No agent directories configured.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:u.map(([e,t])=>(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide`,children:e}),(0,G.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,G.jsx)(`div`,{className:`rounded bg-surface-container px-3 py-1.5 font-mono text-xs text-on-surface-variant`,children:e},e))})]},e))})]}),(0,G.jsx)(OP,{path:`capture.ignore_plan_dirs_in_git`,label:`Ignore Custom Plan Dirs In Git`,hint:`.gitignore is rewritten on every change`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{checked:e??!1,onCheckedChange:t})}),(0,G.jsx)(OP,{path:`capture.plan_dirs`,label:`Custom Directories`,hint:`extra paths to watch for plan files`,children:({value:e})=>{let t=e??[];return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[t.length>0&&(0,G.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded bg-surface-container px-3 py-1.5`,children:[(0,G.jsx)(`span`,{className:`flex-1 font-mono text-xs text-on-surface`,children:e}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>l.mutate({path:`capture.plan_dirs`,value:e}),className:`font-sans text-xs text-on-surface-variant hover:text-tertiary transition-colors leading-none`,"aria-label":`Remove ${e}`,children:`x`})]},e))}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(op,{placeholder:`/path/to/plans`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{if(e.key!==`Enter`)return;let i=n.trim();!i||t.includes(i)||(c.mutate({path:`capture.plan_dirs`,value:i}),r(``))},className:`flex-1 font-mono text-xs`}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>{let e=n.trim();!e||t.includes(e)||(c.mutate({path:`capture.plan_dirs`,value:e}),r(``))},disabled:!n.trim(),children:`Add`})]})]})}})]})]})}var j3={banner:`Banner`,summary:`Summary`};function M3({children:e}){return(0,G.jsx)(`div`,{className:`rounded-lg border border-outline-variant/20 bg-surface-container/40 p-4`,children:e})}function N3(){let{effective:e,setField:t,resetField:n,isLocalOverride:r}=ek(),{data:i}=Mv(),a=i?.domains??[],o=e?.notifications?.enabled??!0,s=e?.notifications?.default_mode??`summary`,c=!o,l=(0,W.useCallback)(async(e,r)=>{let i=`notifications.domains.${e}.mode`;r==="default"?await n(i):await t(i,r,`local`)},[n,t]),u=(0,W.useCallback)(async(e,n)=>{await t(`notifications.domains.${e}.enabled`,n,`local`)},[t]);return e?(0,G.jsxs)(Q,{id:Pi.settingsNotifications,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300`,children:[(0,G.jsx)(ZM,{children:`Notifications`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(M3,{children:(0,G.jsx)(OP,{path:`notifications.enabled`,label:`Notifications`,hint:`master switch for this machine`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t})})}),(0,G.jsxs)(`div`,{className:c?`space-y-4 opacity-60`:`space-y-4`,children:[(0,G.jsx)(M3,{children:(0,G.jsx)(OP,{path:`notifications.default_mode`,label:`Default Display`,hint:`summary = panel only; banner = temporary popup`,children:({value:e,onChange:t})=>(0,G.jsxs)(v_,{value:e??`summary`,onValueChange:e=>t(e),disabled:c,children:[(0,G.jsx)(b_,{className:`w-40`,children:(0,G.jsx)(y_,{})}),(0,G.jsxs)(x_,{children:[(0,G.jsx)(S_,{value:`summary`,children:`Summary`}),(0,G.jsx)(S_,{value:`banner`,children:`Banner`})]})]})})}),(0,G.jsx)(M3,{children:(0,G.jsx)(OP,{path:`notifications.system_notifications`,label:`Browser Notifications`,hint:`OS popups when tab unfocused; only for banner mode`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{checked:e??!1,onCheckedChange:t,disabled:c})})}),(0,G.jsx)(M3,{children:(0,G.jsx)(OP,{path:`notifications.retention_days`,label:`Notification Retention`,hint:`read and cleared notifications; unread notifications are preserved`,children:({value:e,onChange:t})=>(0,G.jsx)(T3,{id:`notifications-retention-days`,value:e??30,onChange:t,min:0,max:365,suffix:`days`,disabled:c})})}),a.length>0&&(0,G.jsx)(M3,{children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Per-Domain Overrides`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:"Leave on `Default` unless a domain should behave differently from the project-wide setting."})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:a.map(i=>{let a=e.notifications?.domains?.[i.domain]??{enabled:!0},o=a.enabled,d=a.mode??s,f=a.mode??`default`,p=`notifications.domains.${i.domain}`,m=r(p);return(0,G.jsx)(`div`,{className:`rounded-md border border-outline-variant/20 bg-surface-container-low/40 px-3 py-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface`,children:i.label}),(0,G.jsx)(`span`,{className:`rounded-full bg-surface-container-high px-2 py-0.5 text-[11px] text-on-surface-variant`,children:o?j3[d]:`Off`}),(0,G.jsx)(Ak,{path:p,hasLocalOverride:m,onSavePersonal:()=>t(p,a,`local`),onReset:()=>n(p)})]}),(0,G.jsx)(`p`,{className:`text-[11px] text-on-surface-variant`,children:i.types.map(e=>e.label).join(`, `)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 self-start`,children:[(0,G.jsxs)(v_,{value:f,onValueChange:e=>{l(i.domain,e)},disabled:c||!o,children:[(0,G.jsx)(b_,{className:`h-8 w-[120px] text-xs`,children:(0,G.jsx)(y_,{})}),(0,G.jsxs)(x_,{children:[(0,G.jsx)(S_,{value:`default`,children:`Default`}),(0,G.jsx)(S_,{value:`summary`,children:`Summary`}),(0,G.jsx)(S_,{value:`banner`,children:`Banner`})]})]}),(0,G.jsx)(bP,{checked:o,onCheckedChange:e=>{u(i.domain,e)},disabled:c})]})]})},i.domain)})})]})}),c&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Notifications are currently disabled, so display and domain settings are inactive.`})]})]})]}):null}var P3=[`provider-secrets`],F3=[`providers`],I3=[`models`];function L3(){return ot({queryKey:Es([...P3]),queryFn:({signal:e})=>q(`/providers/secrets`,{signal:e})})}function R3(e){e.invalidateQueries({queryKey:P3}),e.invalidateQueries({queryKey:F3}),e.invalidateQueries({queryKey:I3})}function z3(){let e=We();return st({mutationFn:({provider:e,apiKey:t,scope:n})=>ss(`/providers/secrets/${e}`,{api_key:t,scope:n}),onSuccess:()=>R3(e)})}function B3(){let e=We();return st({mutationFn:({provider:e,scope:t})=>ls(`/providers/secrets/${e}${t?`?scope=${encodeURIComponent(t)}`:``}`),onSuccess:()=>R3(e)})}var V3={openai:`OpenAI API Key`,openrouter:`OpenRouter API Key`};function H3(e){return e===`openai`||e===`openrouter`}function U3(){let{effective:e,setFields:t,isLocalOverride:n,resetFields:r}=ek(),{data:i,isPending:a}=N1(),{data:o}=L3(),s=z3(),c=B3(),l=P1(),u=i?.providers??[],d=e?.agent?.provider,f=e?.agent?.harness,{draft:p,savedDraft:m,isDirty:h,clearDraft:g,resetDraft:_,handleHarnessChange:v,handleProviderChange:y,handleModelChange:b,handleLocalBackendChange:x,handleReasoningChange:S,handleBaseUrlChange:C,handleContextLengthChange:w}=p0({source:{harness:f,provider:d},providers:u}),[T,E]=(0,W.useState)(``),D=H3(p.type)?p.type:null,O=D?o?.secrets[D]:void 0,k=p.baseUrl||T1(p.type,p.localBackend),A=L1(p.type||null,k||void 0,`llm`,p.localBackend||null).data?.models??u.find(e=>e.type===p.type)?.models??[],j=p.type!==``;(0,W.useEffect)(()=>{E(``)},[p.type]);let M=e?.agent?.reasoningLevel,[N,P]=(0,W.useState)(M??`default`),[F,I]=(0,W.useState)(null);(0,W.useEffect)(()=>{P(M??`default`)},[M]);let L=h||N!==(M??`default`),R=n(`agent.provider`)||n(`agent.harness`),ee=(0,W.useCallback)(async()=>{let e=n(`agent.harness`),t=n(`agent.provider`);if(e&&t){await r([`agent.harness`,`agent.provider`]);return}if(e){await r([`agent.harness`]);return}t&&await r([`agent.provider`])},[n,r]),z=(0,W.useCallback)(async()=>{let e=u0(p,A);await t([{path:`agent.harness`,value:p.harness||D1(p.type)},{path:`agent.provider`,value:e},{path:`agent.reasoningLevel`,value:N}],`local`)},[p,N,A,t]),B=(0,W.useCallback)((e,n)=>{let r=u0(e,A),i=[{path:`agent.harness`,value:e.harness||D1(e.type)},{path:`agent.provider`,value:r},{path:`agent.reasoningLevel`,value:N}];n&&i.push({path:`agent.scheduled_tasks_enabled`,value:!0},{path:`agent.event_tasks_enabled`,value:!0}),I(null),t(i,R?`local`:`grove`).catch(e=>{I(e instanceof Error?e.message:String(e)),console.error(`[agent-card] save provider failed`,e)})},[R,N,A,t]),V=(0,W.useCallback)(()=>{g(),l.reset()},[l,g]),H=(0,W.useCallback)(()=>{_(),P(M??`default`),l.reset()},[l,_,M]),te=(0,W.useCallback)(async()=>{if(p.type===``){I(null);try{await t([{path:`agent.scheduled_tasks_enabled`,value:!1},{path:`agent.event_tasks_enabled`,value:!1}],R?`local`:`grove`,[`agent.provider`,`agent.harness`,`agent.reasoningLevel`])}catch(e){I(e instanceof Error?e.message:String(e)),console.error(`[agent-card] clear provider failed`,e)}return}B(p,m.type===``&&p.type!==``)},[p,R,m.type,t,B]),ne=(0,W.useCallback)(()=>{!D||T.trim()===``||s.mutate({provider:D,apiKey:T.trim()},{onSuccess:()=>{E(``),l.reset()}})},[l,T,s,D]),U=(0,W.useCallback)(()=>{D&&c.mutate({provider:D},{onSuccess:()=>{E(``),l.reset()}})},[l,c,D]),re=(0,W.useCallback)(()=>{p.type!==``&&l.mutate({type:p.type,...p.type===`openai-compatible`&&p.localBackend?{local_backend:p.localBackend}:{},...p.baseUrl?{base_url:p.baseUrl}:{}})},[p.baseUrl,p.localBackend,p.type,l]);return(0,G.jsxs)(Q,{id:Pi.settingsAgent,"data-config-field":`agent.provider`,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300`,children:[(0,G.jsx)(ZM,{children:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Myco Agent`,(0,G.jsx)(Ak,{path:`agent.provider`,hasLocalOverride:R,onSavePersonal:z,onReset:ee})]})}),p.type===``?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No provider configured -- data collection is active. Configure a provider to enable the intelligence pipeline.`}):null,(0,G.jsx)(W1,{harness:p.harness,providerType:p.type,localBackend:p.localBackend,model:p.model,baseUrl:p.baseUrl,contextLength:p.contextLength,providers:u,isLoadingProviders:a,showModelSelector:!1,onHarnessChange:e=>{v(e),l.reset()},onProviderChange:e=>{y(e),l.reset()},onLocalBackendChange:e=>{x(e),l.reset()},onModelChange:b,onBaseUrlChange:C,onContextLengthChange:w}),j&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Default reasoning profile`}),(0,G.jsxs)(v_,{value:N,onValueChange:e=>P(e),children:[(0,G.jsx)(b_,{children:(0,G.jsx)(y_,{})}),(0,G.jsx)(x_,{children:C1.map(e=>(0,G.jsx)(S_,{value:e,children:e},e))})]}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:`Resolves to a model through the reasoning profiles below. Tasks may override per-task.`})]}),j&&(0,G.jsx)(E2,{description:"Built-in tasks resolve `low`, `default`, and `high` reasoning phases through these model mappings.",values:{low:p.reasoningLow,default:p.reasoningDefault,high:p.reasoningHigh},onChange:S,models:A,fallbackModel:p.model,placeholderWhenEmpty:`Use default model`}),j&&(0,G.jsx)(w2,{providerType:p.type,localBackend:p.localBackend,baseUrl:p.baseUrl,model:p.model,providers:u,onModelChange:b}),D&&(0,G.jsxs)(`div`,{className:`space-y-2 rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest p-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:V3[D]}),(0,G.jsx)(op,{type:`password`,value:T,onChange:e=>E(e.target.value),placeholder:O?.configured?`Replace saved key`:`Paste API key`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:ne,disabled:s.isPending||T.trim()===``,children:`Save key`}),O?.configured&&(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:U,disabled:c.isPending,children:`Clear key`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant break-all`,children:O?.configured?`${O.maskedValue} from ${O.source===`env`?`environment`:`${O.source} secrets`}`:`Key is required for model discovery and connection tests.`})]})]}),(p.type!==``||L)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:te,disabled:!L,children:`Save Changes`}),L?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:H,children:`Reset`}):null,p.type===``?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:re,disabled:l.isPending,children:[l.isPending?(0,G.jsx)(Ra,{className:`mr-2 h-4 w-4 animate-spin`}):null,`Test Connection`]}),l.isSuccess&&l.data.ok&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-primary`,children:[(0,G.jsx)(aa,{className:`h-4 w-4`}),`Connected — `,l.data.latency_ms,`ms`]}),l.isSuccess&&!l.data.ok&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-tertiary`,children:[(0,G.jsx)(ca,{className:`h-4 w-4`}),l.data.error??`Connection failed.`]}),l.isError&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-tertiary`,children:[(0,G.jsx)(ca,{className:`h-4 w-4`}),l.error.message]})]})]}),F&&(0,G.jsxs)(`p`,{role:`alert`,className:`flex items-center gap-1 font-sans text-sm text-tertiary`,children:[(0,G.jsx)(ca,{className:`h-4 w-4`}),F]}),p.type!==``||m.type!==``?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:V,className:`text-xs text-on-surface-variant`,children:`Clear provider`}):null]})]})}var W3=[{value:`ollama`,label:`Ollama`},{value:`openai-compatible`,label:`OpenAI-compatible`}];function G3(){let{effective:e}=ek(),t=e?.embedding.provider??`ollama`,n=e?.embedding.base_url??``,{data:r}=L1(t,n||void 0,`embedding`),i=r?.models??[],[a,o]=(0,W.useState)(`idle`),[s,c]=(0,W.useState)(``),l=(0,W.useCallback)(async()=>{o(`testing`),c(``);try{let e=new URLSearchParams({provider:t,type:`embedding`});n&&e.set(`base_url`,n);let r=(await q(`/models?${e.toString()}`)).models.length;o(`success`),c(`Connected -- ${r} model${r===1?``:`s`} available.`)}catch(e){o(`error`),c(e instanceof Error?e.message:`Connection failed.`)}},[t,n]);return(0,G.jsxs)(Q,{id:Pi.settingsEmbedding,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-ochre transition-all duration-300`,children:[(0,G.jsx)(ZM,{children:`Embedding`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(OP,{path:`embedding.provider`,label:`Provider`,requiresRestart:!0,children:({value:e,onChange:t})=>(0,G.jsxs)(v_,{value:e??`ollama`,onValueChange:e=>{t(e),o(`idle`)},children:[(0,G.jsx)(b_,{children:(0,G.jsx)(y_,{})}),(0,G.jsx)(x_,{children:W3.map(e=>(0,G.jsx)(S_,{value:e.value,children:e.label},e.value))})]})}),(0,G.jsx)(OP,{path:`embedding.model`,label:`Model`,requiresRestart:!0,commitOn:i.length>0?`change`:`blur`,children:({value:e,onChange:t,onBlur:n})=>i.length>0?(0,G.jsx)(c1,{value:e??``,onValueChange:t,placeholder:`Select a model`,searchPlaceholder:`Search embedding models...`,emptyMessage:`No embedding models match that search.`,options:i.map(e=>({value:e,label:e})),sortOptions:!0,monospace:!0}):(0,G.jsx)(op,{placeholder:`bge-m3`,value:e??``,onChange:e=>t(e.target.value),onBlur:n})}),(0,G.jsx)(OP,{path:`embedding.base_url`,label:`Base URL`,hint:`optional`,requiresRestart:!0,commitOn:`blur`,parse:e=>e===``?void 0:e,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsx)(op,{type:`url`,placeholder:`http://localhost:11434`,value:e??``,onChange:e=>{t(e.target.value),o(`idle`)},onBlur:n})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:l,disabled:a===`testing`,children:[a===`testing`?(0,G.jsx)(Ra,{className:`mr-2 h-4 w-4 animate-spin`}):null,`Test Connection`]}),a===`success`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-primary`,children:[(0,G.jsx)(aa,{className:`h-4 w-4`}),s]}),a===`error`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-tertiary`,children:[(0,G.jsx)(ca,{className:`h-4 w-4`}),s]})]})]})]})}function K3(e){return e.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean)}function q3({value:e,onChange:t,placeholder:n}){let r=(e??[]).join(`
|
|
414
414
|
`),[i,a]=(0,W.useState)(r);return(0,W.useEffect)(()=>{a(r)},[r]),(0,G.jsx)(`textarea`,{className:`min-h-24 w-full rounded-md border border-border bg-surface px-3 py-2 font-mono text-sm text-on-surface shadow-xs focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,value:i,placeholder:n,onChange:e=>a(e.target.value),onBlur:()=>t(K3(i))})}function J3(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>{let[t,n]=e.split(/\s*(?:=>|=)\s*/,2);return{path_glob:t?.trim()??``,tag_pattern:n?.trim()??``}}).filter(e=>e.path_glob&&e.tag_pattern)}function Y3({value:e,onChange:t}){let n=(e??[]).map(e=>`${e.path_glob} => ${e.tag_pattern}`).join(`
|
|
415
|
-
`),[r,i]=(0,W.useState)(n);return(0,W.useEffect)(()=>{i(n)},[n]),(0,G.jsx)(`textarea`,{className:`min-h-20 w-full rounded-md border border-border bg-surface px-3 py-2 font-mono text-sm text-on-surface shadow-xs focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,value:r,placeholder:`packages/api/ => refs/tags/api/v*`,onChange:e=>i(e.target.value),onBlur:()=>t(J3(r))})}function X3({children:e}){return(0,G.jsx)(`p`,{className:`font-sans text-xs leading-5 text-on-surface-variant`,children:e})}function Z3({title:e,description:t,children:n}){return(0,G.jsxs)(`section`,{className:`space-y-4 border-t border-outline-variant/20 pt-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-xs font-semibold uppercase tracking-wider text-on-surface-variant`,children:e}),(0,G.jsx)(X3,{children:t})]}),n]})}function Q3(){let{effective:e,setFields:t}=ek(),{data:n}=L3(),r=z3(),i=B3(),[a,o]=(0,W.useState)(``),s=`refs/tags/${e?.release_provenance.github.repo.split(`/`).pop()?.replace(/\.git$/,``)||`project`}/v*`,c=n?.secrets.github,l=c?.configured?`${c.maskedValue??`GitHub access`} connected for PR evidence.`:`Required for private repos and reliable squash-merge matches.`,u=(0,W.useCallback)((e,n)=>{t([{path:`release_provenance.production_refs`,value:e},{path:`release_provenance.integration_refs`,value:n}],`project`).catch(e=>console.error(`[settings] release provenance preset failed`,e))},[t]),d=(0,W.useCallback)(()=>{let e=a.trim();e&&r.mutate({provider:`github`,apiKey:e},{onSuccess:()=>o(``)})},[a,r]),f=(0,W.useCallback)(()=>{i.mutate({provider:`github`})},[i]);return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`max-w-4xl space-y-2`,children:[(0,G.jsx)(ZM,{children:`Release provenance`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Myco uses Git evidence to tell whether captured knowledge is released, merged but unreleased, or still only local.`})]}),(0,G.jsxs)(Z3,{title:`Release model`,description:`Define what counts as released and what counts as merged for this project.`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([`refs/tags/v*`],[`origin/main`]),children:`Semver tags`}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([s],[`origin/main`]),children:`Project tag family`}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([`origin/main`],[]),children:`Main branch deploys`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(OP,{path:`release_provenance.production_refs`,label:`Production refs`,hint:`one per line`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(q3,{value:e??[],onChange:t,placeholder:`refs/tags/v*`}),(0,G.jsx)(X3,{children:`Refs that mean code is released. Use release tags, project tag families, or the branch that deploys directly.`})]})}),(0,G.jsx)(OP,{path:`release_provenance.integration_refs`,label:`Integration refs`,hint:`one per line`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(q3,{value:e??[],onChange:t,placeholder:`origin/main`}),(0,G.jsx)(X3,{children:`Refs that mean work is merged but not necessarily released. For GitHub projects this is usually the default branch.`})]})})]})]}),(0,G.jsx)(Z3,{title:`GitHub evidence`,description:`Optional PR evidence improves reconciliation when squash merges hide direct commit ancestry.`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(20rem,1fr)_12rem]`,children:[(0,G.jsx)(OP,{path:`release_provenance.github.repo`,label:`Repository`,hint:`owner/name`,commitOn:`blur`,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(op,{value:e??``,placeholder:`owner/name`,onChange:e=>t(e.target.value),onBlur:n}),(0,G.jsx)(X3,{children:`Detected from the GitHub remote when possible. Leave blank to disable GitHub PR evidence.`})]})}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Access token`}),(0,G.jsx)(Ok,{scope:`machine`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,G.jsx)(op,{className:`min-w-0 flex-1`,type:`password`,value:a,placeholder:c?.configured?`Paste new GitHub token`:`Paste GitHub token`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())}}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:d,disabled:r.isPending||a.trim()===``,children:r.isPending?`Saving`:c?.configured?`Update`:`Connect`}),c?.configured&&c.source!==`env`&&(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:f,disabled:i.isPending,children:`Clear`})]}),(0,G.jsx)(X3,{children:l})]}),(0,G.jsx)(OP,{path:`release_provenance.github.max_lookups_per_run`,label:`PR lookups`,commitOn:`blur`,parse:e=>Number(e),children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(op,{type:`number`,min:0,max:200,value:String(e??20),onChange:e=>t(Number(e.target.value)),onBlur:n}),(0,G.jsx)(X3,{children:`Maximum GitHub PR searches per reconcile run. Higher values can improve older squash-merge matches but use more API quota.`})]})})]})}),(0,G.jsx)(Z3,{title:`Reconciliation behavior`,description:`Control whether provenance runs, how often it refreshes, and how unknown Git states are treated.`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-3`,children:[(0,G.jsx)(OP,{path:`release_provenance.enabled`,label:`Enabled`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t}),(0,G.jsx)(X3,{children:`Enabled by default for Git projects. Missing refs leave records unreconciled instead of guessed.`})]})}),(0,G.jsx)(OP,{path:`release_provenance.reconcile_interval_minutes`,label:`Reconcile interval`,hint:`minutes`,commitOn:`blur`,parse:e=>Number(e),children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(op,{type:`number`,min:1,max:1440,value:String(e??15),onChange:e=>t(Number(e.target.value)),onBlur:n}),(0,G.jsx)(X3,{children:`How often the daemon rechecks captured Git evidence against the release model.`})]})}),(0,G.jsx)(OP,{path:`release_provenance.production_debug_include_unknown`,label:`Include unknown debug`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t}),(0,G.jsx)(X3,{children:`Include dirty worktrees and other unknown Git states in production-scoped debug context.`})]})})]})}),(0,G.jsx)(Z3,{title:`Advanced monorepo releases`,description:`Use this only when different paths in one repository release through different tag families.`,children:(0,G.jsx)(OP,{path:`release_provenance.package_map`,label:`Monorepo release mapping`,hint:`path => release tag ref`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Y3,{value:e??[],onChange:t}),(0,G.jsx)(X3,{children:`Map a path prefix to the tag pattern that releases that part of the repository.`})]})})})]})}function $3(e){if(e instanceof Error)return e.message||e.constructor.name||`Error`;if(typeof e==`string`)return e||`Empty string error`;try{return JSON.stringify(e)}catch{return`Unserializable error`}}var e6=500,t6=6e4;function n6(e){return e?new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):`Never`}function r6(e,t){return e<=0?null:e===1&&t?t:`${e} packages`}function i6(){let{data:e}=Uk(),t=Wk(),n=Gk(),r=Kk(),[i,a]=(0,W.useState)(`idle`),[o,s]=(0,W.useState)(null);(0,W.useEffect)(()=>{if(!e?.restarting||i!==`idle`)return;a(`restarting`);let t=Date.now()+t6,n=!1,r=async()=>{if(!(n||Date.now()>t)){try{if((await fetch(Ko(`/health`))).ok){window.location.reload();return}}catch{}n||setTimeout(r,e6)}},o=setTimeout(r,e6);return()=>{n=!0,clearTimeout(o)}},[e?.restarting,i]);let c=(0,W.useCallback)(async()=>{a(`applying`),s(null);try{let e=(await n.mutateAsync()).version;a(`restarting`);let t=Date.now()+t6;await new Promise((n,r)=>{let i=async()=>{if(Date.now()>t){r(Error(`timeout`));return}try{let t=await fetch(Ko(`/health`));if(t.ok&&(await t.json().catch(()=>null))?.version===e){n();return}}catch{}setTimeout(i,e6)};setTimeout(i,e6)}),window.location.reload()}catch(e){a(`error`),s($3(e)===`timeout`?`Daemon did not restart within the expected time. Check the terminal.`:$3(e))}},[n]),l=(0,W.useCallback)(()=>{t.mutate()},[t]),u=(0,W.useCallback)(e=>{r.mutate(e)},[r]);if(!e)return null;let d=t.isPending,f=i===`applying`||i===`restarting`,p=e.update_available===!0,m=e.revert_available===!0,h=p||m,g=e.channel??`stable`,_=(e.packages??[]).filter(e=>e.installed),v=_.filter(e=>e.update_available),y=v.length,b=r6(y,v[0]?.latest_version??void 0),x=(e.runtime_scope??`machine`)===`managed`?`This machine is using a managed Myco runtime under ~/.myco/runtime/. Switching back to Stable removes the managed runtime and falls back to the global install on PATH.`:`This machine is using the global Myco install on PATH. Switching to Beta installs a managed runtime under ~/.myco/runtime/.`;return e.exempt?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(so,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(ZM,{children:`Updates`})]}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Updates are disabled in development mode.`,` `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-outline`,children:e.running_version})]})]}):(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ia,{className:J(`h-4 w-4`,h?`text-secondary`:`text-primary`)}),(0,G.jsx)(ZM,{children:`Updates`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-outline`,children:e.running_version}),p&&b&&(0,G.jsx)(X,{variant:`warning`,children:b})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[h?(0,G.jsx)(Y,{variant:`default`,size:`sm`,onClick:c,disabled:f,children:f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Qa,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),i===`restarting`?`Restarting…`:m&&!p?`Reverting…`:`Updating…`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ia,{className:`mr-1.5 h-3.5 w-3.5`}),m&&!p?`Revert to Stable & Restart`:y>1?`Update ${y} Packages & Restart`:`Update & Restart`]})}):(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-primary`,children:[(0,G.jsx)(oa,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Up to date`})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:l,disabled:d||f,children:[(0,G.jsx)(Qa,{className:J(`mr-1.5 h-3.5 w-3.5`,d&&`animate-spin`)}),`Check Now`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:Is.map(e=>(0,G.jsx)(Y,{variant:g===e?`default`:`ghost`,className:`text-xs capitalize h-6 px-2`,onClick:()=>u(e),disabled:r.isPending||f,children:e},e))}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Checked: `,n6(e.last_check)]})]}),_.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[_.map(e=>{let t=e.revert_available&&!e.update_available;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-outline/20 px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-sans text-sm text-on-surface`,children:e.display_name}),(0,G.jsxs)(`div`,{className:`font-mono text-xs text-on-surface-variant`,children:[e.installed_version??`not installed`,(e.update_available||t)&&e.latest_version?` → ${e.latest_version}`:``]})]}),(0,G.jsx)(X,{variant:e.update_available||t?`warning`:`secondary`,children:e.update_available?`Update available`:t?`Revert pending`:`Installed`})]},e.id)}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:x})]}),(i===`error`||e.error)&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-4 w-4 mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:o??e.error})]})]})}var a6=[`project`,`grove`,`all-groves`],o6={project:`Project`,grove:`Grove`,"all-groves":`All Groves`},s6={project:`Operate on the active project only`,grove:`Operate on every project in this Grove`,"all-groves":`Operate across every Grove on this machine`},c6={project:`border-outline-variant/30 bg-on-surface-variant/15 text-on-surface`,grove:`border-secondary/50 bg-secondary/10 text-secondary`,"all-groves":`border-tertiary/50 bg-tertiary/10 text-tertiary`},l6={project:`border-outline-variant/20 text-on-surface-variant hover:bg-on-surface-variant/5`,grove:`border-outline-variant/20 text-on-surface-variant hover:bg-secondary/5`,"all-groves":`border-outline-variant/20 text-on-surface-variant hover:bg-tertiary/5`};function u6({value:e,onChange:t,available:n=a6,helperText:r}){let i=a6.filter(e=>n.includes(e));return i.length===0?null:(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`div`,{role:`group`,"aria-label":`Operation scope`,className:`inline-flex items-center gap-1`,children:i.map(n=>{let r=e===n;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n),title:s6[n],"aria-pressed":r,className:J(`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider transition-colors`,r?c6[n]:l6[n]),children:[(0,G.jsx)(`span`,{className:J(`inline-block h-1.5 w-1.5 rounded-full`,r&&n===`grove`&&`bg-secondary`,r&&n===`all-groves`&&`bg-tertiary`,r&&n===`project`&&`bg-on-surface-variant`,!r&&`bg-outline-variant/60`),"aria-hidden":!0}),o6[n]]},n)})}),r&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:r})]})}var d6={grove:`Aggregated for this Grove. Switch projects via the upper-left switcher to view a different Grove.`,"all-groves":`Aggregates every Grove on this machine.`,project:`Filtered to the active project.`},f6={project:`Action targets the active project only.`,grove:`Action targets every project in this Grove.`,"all-groves":`Action targets every Grove on this machine.`};function p6(e,t){if(e===`all-groves`)return{kind:`all-groves`};if(t)return e===`grove`?{kind:`grove`,grove_id:t.grove.id}:{kind:`project`,grove_id:t.grove.id,project_id:t.project.project_id}}function m6(e){switch(e.kind){case`project`:return`the active project only`;case`grove`:return`every project in this Grove`;case`all-groves`:return`every Grove on this machine`}}function h6(e){switch(e.kind){case`project`:return`Project`;case`grove`:return`Grove`;case`all-groves`:return`All Groves`}}function g6({open:e,onOpenChange:t,action:n,scope:r,costEstimate:i,variant:a=`destructive`,onConfirm:o,isPending:s=!1}){let c=`${n} will run against ${m6(r)}. ${i?`Estimated cost: ${i}.`:``} This cannot be undone automatically.`,l=[{label:`Scope`,value:h6(r)}];return(0,G.jsx)(AM,{open:e,onOpenChange:t,title:n,description:c.trim(),icon:(0,G.jsx)(_o,{className:`h-5 w-5 text-tertiary`}),meta:l,confirmLabel:n,variant:a,onConfirm:o,isPending:s})}function _6(e,t){return t.kind===`all-groves`||e===`rebuild`||e===`vacuum`||e===`reindex`||e===`reembed-stale`&&t.kind===`grove`}function v6(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function y6(e){let t=new Map;for(let n of e){let e=new Date(n.modified_at).toISOString().slice(0,10),r=t.get(e)??[];r.push(n),t.set(e,r)}return t}function b6(e){let t=new Date().toISOString().slice(0,10),n=new Date(Date.now()-24*36e5).toISOString().slice(0,10);return e===t?`Today`:e===n?`Yesterday`:new Date(e).toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`})}function x6({open:e,onOpenChange:t,backups:n,groveId:r,headers:i}){let a=We(),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)({kind:`idle`});(0,W.useEffect)(()=>{e&&(s(null),l(null),d(null),p({kind:`idle`}))},[e]);async function m(e){s(e),l(null),d(null),p({kind:`idle`});try{l(await q(`/restore/preview`,{method:`POST`,headers:i,body:JSON.stringify({file_name:e.file_name})}))}catch(e){d($3(e))}}async function h(e){let t=Date.now()+30*6e4;for(;;){await new Promise(e=>setTimeout(e,2e3));let n=await q(`/restore/status?job_id=${encodeURIComponent(e)}`,{headers:i});if(n.status!==`running`)return n;if(Date.now()>t)return{...n,status:`error`,error:`Restore is taking unusually long; check the server logs.`}}}async function g(){if(o){p({kind:`restoring`});try{let e=await h((await q(`/restore`,{method:`POST`,headers:i,body:JSON.stringify({file_name:o.file_name})})).job_id);e.status===`done`&&e.result?(p({kind:`done`,result:e.result}),await a.invalidateQueries({queryKey:[`backups`,r]})):p({kind:`error`,message:e.error??`unknown error`})}catch(e){p({kind:`error`,message:$3(e)})}}}let _=f.kind===`restoring`;return(0,G.jsx)(Zf,{open:e,onOpenChange:e=>{_||t(e)},children:(0,G.jsxs)(tp,{className:`max-w-2xl`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Restore from backup`}),(0,G.jsx)(ap,{children:o?`Review what this backup holds, then restore. Restore merges records (existing rows are kept) and never deletes.`:`Pick a backup to restore. You’ll see its contents before anything happens.`})]}),o?(0,G.jsx)(C6,{backup:o,preview:c,previewError:u,phase:f,onBack:()=>{s(null),l(null),d(null),p({kind:`idle`})},onRestore:g,onClose:()=>t(!1)}):(0,G.jsx)(S6,{backups:n,onSelect:m})]})})}function S6({backups:e,onSelect:t}){return e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No backups available yet.`}):(0,G.jsx)(`div`,{className:`max-h-[55vh] overflow-y-auto pr-1 space-y-4`,children:Array.from(y6(e).entries()).map(([e,n])=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wider text-on-surface-variant sticky top-0 bg-surface-container-highest py-1`,children:b6(e)}),n.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:J(`w-full flex items-center justify-between rounded-md px-4 py-3 text-left`,`bg-surface-container-lowest hover:bg-surface-container-low transition-colors`),children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface`,children:v6(e.modified_at)}),(0,G.jsx)(X,{variant:`secondary`,children:Tv(e.size_bytes)}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant truncate`,children:e.machine_id})]}),(0,G.jsx)(ta,{className:`h-4 w-4 text-on-surface-variant shrink-0`})]},e.file_name))]},e))})}function C6({backup:e,preview:t,previewError:n,phase:r,onBack:i,onRestore:a,onClose:o}){let s=r.kind===`restoring`,c=r.kind===`done`;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:i,disabled:s,className:`inline-flex items-center gap-1.5 font-sans text-sm text-on-surface-variant hover:text-on-surface disabled:opacity-50`,children:[(0,G.jsx)(Ki,{className:`h-3.5 w-3.5`}),` All backups`]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface`,children:v6(e.modified_at)}),(0,G.jsx)(X,{variant:`secondary`,children:Tv(e.size_bytes)})]})]}),(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-lowest p-4`,children:[(0,G.jsx)(`p`,{className:`font-sans font-medium text-xs uppercase tracking-widest text-on-surface-variant mb-2`,children:`Backup contents`}),n?(0,G.jsxs)(`p`,{className:`font-sans text-sm text-tertiary`,children:[`Could not read contents: `,n]}):t?(0,G.jsx)(`div`,{className:`max-h-[34vh] overflow-y-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Backup contents`,children:[(0,G.jsx)(`thead`,{className:`sticky top-0 bg-surface-container-lowest`,children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Table`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`In backup`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`In database`})]})}),(0,G.jsx)(`tbody`,{children:t.tables.map((e,t)=>(0,G.jsxs)(`tr`,{className:J(t%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-1.5 pr-4`,children:e.table}),(0,G.jsx)(`td`,{className:`py-1.5 pr-4 text-right text-primary`,children:e.in_backup}),(0,G.jsx)(`td`,{className:`py-1.5 text-right text-on-surface-variant`,children:e.in_db})]},e.table))})]})}):(0,G.jsxs)(`p`,{className:`flex items-center gap-2 font-sans text-sm text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-3.5 w-3.5 animate-spin`}),` Reading backup contents…`]})]}),r.kind===`error`&&(0,G.jsxs)(`p`,{className:`font-sans text-sm text-tertiary`,children:[`Restore failed: `,r.message]}),s&&(0,G.jsxs)(`p`,{className:`flex items-center gap-2 font-sans text-sm text-primary`,children:[(0,G.jsx)(Ra,{className:`h-3.5 w-3.5 animate-spin`}),`Restoring… this runs in the background and can take a minute on a large backup. You can keep using Myco.`]}),c&&(0,G.jsxs)(`p`,{className:`flex items-center gap-2 font-sans text-sm text-primary`,children:[(0,G.jsx)(oa,{className:`h-3.5 w-3.5`}),`Restored `,r.result.total_restored,` records, skipped `,r.result.total_skipped,` already present.`]}),(0,G.jsx)(`div`,{className:`flex justify-end gap-2`,children:c?(0,G.jsx)(Y,{variant:`default`,size:`sm`,onClick:o,children:`Done`}):(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:a,disabled:s||!!n,children:[(0,G.jsx)(vo,{className:`mr-1.5 h-3.5 w-3.5`}),s?`Restoring…`:`Restore this backup`]})})]})}var w6=[`grove`,`all-groves`],T6=3;function E6({embedded:e=!1}={}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(`grove`),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(!1),d=Ss(),f=d?.grove.id??null,p=d?ko(d):void 0,m=ot({queryKey:[`backups`,f],queryFn:()=>q(`/backups`,{headers:p}),enabled:!!f}),h=m.data?.backups??[],g=!!f&&(m.isSuccess||m.isError),_=h.slice(0,T6),v=h.length>0?h[h.length-1]:null;async function y(){u(!0),n(null);try{let e=p6(r,d),t=await q(`/backup`,{method:`POST`,headers:p,body:JSON.stringify({scope:e})});t.summary?n({type:t.summary.failed>0?`error`:`success`,text:`Backed up ${t.summary.ok} Grove(s); ${t.summary.failed} failed`}):n({type:`success`,text:`Backup created (${Tv(t.size_bytes)})`}),await m.refetch()}catch(e){n({type:`error`,text:`Backup failed: ${$3(e)}`})}finally{u(!1)}}function b(){let e=p6(r,d);if(e&&_6(`backup`,e)){o(!0);return}y()}let x=m.isError?`Failed to load backups: ${$3(m.error)}`:null,S=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>m.refetch(),children:[(0,G.jsx)(Qa,{className:`mr-1.5 h-3.5 w-3.5`}),`Refresh`]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>c(!0),disabled:h.length===0,children:[(0,G.jsx)(vo,{className:`mr-1.5 h-3.5 w-3.5`}),`Restore…`]}),(0,G.jsxs)(Y,{variant:`default`,size:`sm`,onClick:b,disabled:l,children:[(0,G.jsx)(ga,{className:`mr-1.5 h-3.5 w-3.5`}),`Backup Now`]})]}),C=(0,G.jsxs)(G.Fragment,{children:[e?(0,G.jsx)(`div`,{className:`flex items-center justify-end`,children:S}):(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(ja,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(ZM,{children:`Backup & Restore`}),(0,G.jsx)(u6,{value:r,onChange:i,available:w6})]}),S]}),(0,G.jsx)(g6,{open:a,onOpenChange:o,action:`Create backup`,scope:p6(r,d)??{kind:`all-groves`},isPending:l,onConfirm:async()=>{await y(),o(!1)}}),(0,G.jsx)(x6,{open:s,onOpenChange:c,backups:h,groveId:f,headers:p}),!e&&(0,G.jsx)(OP,{path:`backup.dir`,label:`Backup Directory`,commitOn:`blur`,requiresRestart:!0,hint:`leave blank for default .myco/backups; ~ supported`,parse:e=>e===``?void 0:e,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Da,{className:`h-3.5 w-3.5 text-on-surface-variant shrink-0`}),(0,G.jsx)(`input`,{type:`text`,value:e??``,onChange:e=>t(e.target.value),onBlur:n,placeholder:`.myco/backups`,className:`flex-1 bg-surface-container text-on-surface font-mono text-sm rounded px-3 py-1.5 outline-hidden border border-outline-variant/15 focus:border-primary/40 placeholder:text-on-surface-variant/50`})]})}),(t||x)&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,t?.type===`success`?`text-primary`:`text-tertiary`),children:t?.text??x}),h.length>0?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[_.map((e,t)=>(0,G.jsx)(`div`,{className:`flex items-center justify-between rounded-md bg-surface-container-lowest px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface`,children:v6(e.modified_at)}),t===0&&(0,G.jsx)(X,{variant:`outline`,children:`Latest`}),(0,G.jsx)(X,{variant:`secondary`,children:Tv(e.size_bytes)}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant truncate`,children:e.machine_id})]})},e.file_name)),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[h.length,` backup`,h.length===1?``:`s`,` kept`,v?` · oldest ${v6(v.modified_at)}`:``,` · `,(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(!0),className:`text-primary hover:underline`,children:`browse & restore`})]})]}):g&&!x?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No backups yet. Click "Backup Now" to create one.`}):null]});return e?(0,G.jsx)(`div`,{className:`space-y-4`,children:C}):(0,G.jsx)(Q,{id:Pi.operationsBackup,level:`low`,className:`rounded-lg p-6 space-y-4 transition-all duration-300`,children:C})}var D6=[{id:`agent`,label:`Agent`,desc:`Default provider, runtime, and scheduled-task gates that drive the agent pipeline.`,category:`Agent`,icon:`Bot`,fields:[{key:`agent.provider.type`,label:`Provider`,scope:`grove`,kind:`select`,category:`Agent`,icon:`Bot`,options:[`anthropic`,`ollama`,`lmstudio`,`openai`,`openrouter`,`openai-compatible`],note:`Default provider for agent tasks. Individual tasks may override.`,customRender:`card-owns`},{key:`agent.provider.model`,label:`Model`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Provider-specific model identifier (e.g. claude-opus-4-7, gpt-oss:20b).`,customRender:`card-owns`},{key:`agent.provider.base_url`,label:`Base URL`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Override for self-hosted or OpenAI-compatible endpoints.`,customRender:`card-owns`},{key:`agent.provider.context_length`,label:`Context length`,scope:`grove`,kind:`number`,category:`Agent`,icon:`Bot`,note:`Context window size for local models (Ollama num_ctx, LM Studio context_length).`,customRender:`card-owns`},{key:`agent.reasoningLevel`,label:`Default reasoning profile`,scope:`grove`,kind:`select`,category:`Agent`,icon:`Bot`,options:[`low`,`default`,`high`],note:`Grove-wide default reasoning tier. Resolves to a model through the reasoning profiles, so it stays portable across model upgrades. Tasks may override per-task.`,customRender:`card-owns`},{key:`agent.model`,label:`Default model (advanced)`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Escape hatch — pins a specific model SKU when a reasoning tier has no mapping (e.g. local providers without a reasoning map).`,customRender:`card-owns`},{key:`agent.harness`,label:`Runtime`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Runtime id (e.g. claude-sdk, openai-agents). Picked from the installed runtime registry.`,customRender:`card-owns`},{key:`agent.run_retention_days`,label:`Agent run retention`,scope:`grove`,kind:`number`,category:`Agent`,icon:`Bot`,min:1,max:365,suffix:`days`,note:`Deletes completed, skipped, and non-resumable failed agent runs older than this window.`}]},{id:`scheduled-tasks`,label:`Scheduled tasks`,desc:`Master switches and freshness gates for the agent pipeline's scheduled and event-driven tasks.`,category:`Scheduled tasks`,icon:`Activity`,fields:[{key:`agent.scheduled_tasks_enabled`,label:`Scheduled tasks`,scope:`grove`,kind:`toggle`,category:`Scheduled tasks`,icon:`Activity`,note:`Master switch for all scheduled agent tasks (canopy-describe, intelligence-skill, etc.).`},{key:`agent.event_tasks_enabled`,label:`Event-driven tasks`,scope:`grove`,kind:`toggle`,category:`Scheduled tasks`,icon:`Activity`,note:`Master switch for tasks fired by capture events (e.g., end-of-session summaries).`},{key:`agent.scheduled_tasks_active_window_days`,label:`Active project window`,scope:`grove`,kind:`number`,category:`Scheduled tasks`,icon:`Activity`,min:0,max:365,suffix:`days`,note:`Only run scheduled tasks against projects touched within this window. 0 disables the gate (all projects always considered active).`}]},{id:`embedding`,label:`Embedding`,desc:`Vector embedding provider for spores, sessions, and semantic recall.`,category:`Embedding`,icon:`Brain`,fields:[{key:`embedding.provider`,label:`Provider`,scope:`grove`,kind:`select`,category:`Embedding`,icon:`Brain`,options:[`ollama`,`openai-compatible`,`openrouter`,`openai`],customRender:`card-owns`},{key:`embedding.model`,label:`Model`,scope:`grove`,kind:`text`,category:`Embedding`,icon:`Brain`,note:`Default is bge-m3. Must match the provider's embedding-model id.`,customRender:`card-owns`},{key:`embedding.base_url`,label:`Base URL`,scope:`grove`,kind:`text`,category:`Embedding`,icon:`Brain`,note:`Override for self-hosted or OpenAI-compatible endpoints.`,customRender:`card-owns`},{key:`embedding.run_in_deep_sleep`,label:`Keep embedding while deep-sleeping`,scope:`grove`,kind:`toggle`,category:`Embedding`,icon:`Brain`,note:`Keep draining the embedding queue when the daemon would otherwise enter deep sleep. Recommended when the backlog is large.`,customRender:`card-owns`}]},{id:`capture`,label:`Capture`,desc:`Where Myco picks up transcripts, plans, and other artifacts.`,category:`Capture`,icon:`MessageSquare`,fields:[{key:`capture.transcript_paths`,label:`Transcript paths`,scope:`machine`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`Additional directories scanned for agent transcripts. Empty uses the agent symbionts' defaults.`},{key:`capture.plan_dirs`,label:`Plan directories`,scope:`machine`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`Directories Myco watches for agent-authored plans.`,customRender:`card-owns`},{key:`capture.ignore_plan_dirs_in_git`,label:`Add plan dirs to .gitignore`,scope:`machine`,kind:`toggle`,category:`Capture`,icon:`MessageSquare`,note:`When on, Myco maintains a managed block in .gitignore covering the configured plan directories.`,customRender:`card-owns`},{key:`capture.artifact_extensions`,label:`Artifact extensions`,scope:`machine`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`File extensions captured as artifacts (e.g. .md, .py).`},{key:`capture.buffer_max_events`,label:`Event buffer size`,scope:`machine`,kind:`number`,category:`Capture`,icon:`MessageSquare`,min:100,step:100,note:`In-memory cap on pending capture events before backpressure kicks in.`}]},{id:`release-provenance`,label:`Release Provenance`,desc:`How Myco classifies session work against shipped, integrated, and unreleased refs.`,category:`Release Provenance`,icon:`GitBranch`,fields:[{key:`release_provenance.enabled`,label:`Enable release provenance`,scope:`project`,kind:`toggle`,category:`Release Provenance`,icon:`GitBranch`,customRender:`card-owns`},{key:`release_provenance.production_refs`,label:`Production refs`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Refs that represent shipped code (e.g. tags v*, refs/tags/release-*). Empty keeps state unreconciled rather than guessing.`,customRender:`card-owns`},{key:`release_provenance.integration_refs`,label:`Integration refs`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Refs that represent merged-but-not-yet-shipped code (e.g. main, develop).`,customRender:`card-owns`},{key:`release_provenance.github.repo`,label:`GitHub repo`,scope:`project`,kind:`text`,category:`Release Provenance`,icon:`GitBranch`,note:`owner/name. Empty disables PR-evidence lookup.`,customRender:`card-owns`},{key:`release_provenance.github.token_env`,label:`GitHub token env var`,scope:`project`,kind:`text`,category:`Release Provenance`,icon:`GitBranch`,note:`Name of the environment variable holding the GitHub token. Token values must never be stored in config.`,customRender:`card-owns`},{key:`release_provenance.github.max_lookups_per_run`,label:`Max PR lookups per run`,scope:`project`,kind:`number`,category:`Release Provenance`,icon:`GitBranch`,min:0,max:200,note:`Caps per-reconcile GitHub API calls so a noisy backlog can't drain the rate limit.`,customRender:`card-owns`},{key:`release_provenance.reconcile_interval_minutes`,label:`Reconcile interval (minutes)`,scope:`grove`,kind:`number`,category:`Release Provenance`,icon:`GitBranch`,min:1,max:1440,note:`How often the PowerManager-driven reconciler refreshes provenance state.`,customRender:`card-owns`},{key:`release_provenance.production_debug_include_unknown`,label:`Include unknown clues in production-debug`,scope:`project`,kind:`toggle`,category:`Release Provenance`,icon:`GitBranch`,note:`Lets production-debug retrieval surface unclassified clues alongside released hits.`,customRender:`card-owns`},{key:`release_provenance.package_map`,label:`Package map`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Monorepo path-glob → tag-pattern entries. Records outside any mapping fall back to the umbrella refs.`,customRender:`card-owns`}]},{id:`notifications`,label:`Notifications`,desc:`What Myco surfaces in the daemon UI and which channels it uses.`,category:`Notifications`,icon:`Bell`,fields:[{key:`notifications.enabled`,label:`Enable notifications`,scope:`machine`,kind:`toggle`,category:`Notifications`,icon:`Bell`,note:`Master switch — disables every notification channel when off.`,customRender:`card-owns`},{key:`notifications.default_mode`,label:`Default mode`,scope:`machine`,kind:`select`,category:`Notifications`,icon:`Bell`,options:[`banner`,`summary`],note:`How new notification types display until you customize them per-domain.`,customRender:`card-owns`},{key:`notifications.system_notifications`,label:`Browser system notifications`,scope:`machine`,kind:`toggle`,category:`Notifications`,icon:`Bell`,note:`Pipe banner-mode notifications through the browser Notification API.`,customRender:`card-owns`},{key:`notifications.retention_days`,label:`Notification retention (days)`,scope:`machine`,kind:`number`,category:`Notifications`,icon:`Bell`,min:0,max:365,suffix:`days`,note:`Deletes read and cleared notifications older than this window. Unread notifications are preserved.`,customRender:`card-owns`}]},{id:`skills`,label:`Skills`,desc:`Thresholds the skill-lifecycle pipeline uses to surface, promote, and retire skills.`,category:`Skills`,icon:`Sparkles`,fields:[{key:`skills.confidence_threshold`,label:`Auto-promote confidence`,scope:`grove`,kind:`number`,category:`Skills`,icon:`Sparkles`,min:0,max:1,step:.05,note:`Survey candidates above this score auto-promote without a manual approve.`},{key:`skills.usage_stale_days`,label:`Stale-skill window (days)`,scope:`grove`,kind:`number`,category:`Skills`,icon:`Sparkles`,min:0,suffix:`days`,note:`Skills with no usage in this many days get flagged for review.`}]},{id:`maintenance`,label:`Maintenance`,desc:`Background database hygiene jobs the daemon runs against this Grove.`,category:`Maintenance`,icon:`Wrench`,fields:[{key:`maintenance.auto_optimize`,label:`Auto-run PRAGMA optimize`,scope:`grove`,kind:`toggle`,category:`Maintenance`,icon:`Wrench`},{key:`maintenance.auto_optimize_interval_hours`,label:`Optimize interval (hours)`,scope:`grove`,kind:`number`,category:`Maintenance`,icon:`Wrench`,min:1,max:720,suffix:`hours`,dependsOn:{key:`maintenance.auto_optimize`,value:!0}},{key:`maintenance.auto_integrity_check`,label:`Auto-run integrity check`,scope:`grove`,kind:`toggle`,category:`Maintenance`,icon:`Wrench`,note:`Runs integrity + foreign-key checks on a slow cadence; failures surface in the Database panel.`},{key:`maintenance.auto_integrity_check_interval_hours`,label:`Integrity-check interval (hours)`,scope:`grove`,kind:`number`,category:`Maintenance`,icon:`Wrench`,min:1,max:8760,suffix:`hours`,dependsOn:{key:`maintenance.auto_integrity_check`,value:!0},note:`Default is 168 hours (weekly).`}]},{id:`backup`,label:`Backup`,desc:`Where Grove backups land and how many are kept.`,category:`Backup`,icon:`Save`,fields:[{key:`backup.dir`,label:`Backup directory`,scope:`grove`,kind:`text`,category:`Backup`,icon:`Save`,nullableEmpty:!0,note:`Override for the backup root. Supports ~. Defaults to <groveHome>/backups when empty.`},{key:`backup.auto_interval_hours`,label:`Auto-backup interval (hours)`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:1,max:720,suffix:`hours`,note:`Minimum hours between auto-backups. Default is 24 (one per day per machine).`},{key:`backup.retention.keep_daily`,label:`Daily backups to keep`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:1,max:365,suffix:`days`},{key:`backup.retention.keep_weekly`,label:`Weekly backups to keep`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:0,max:52,suffix:`weeks`,note:`Kept beyond the daily window for longer-term restore points.`}]},{id:`sessions`,label:`Sessions`,desc:`Session lifecycle thresholds the daemon uses for staleness detection.`,category:`Sessions`,icon:`Activity`,fields:[{key:`daemon.stale_session_threshold_ms`,label:`Stale-session threshold (ms)`,scope:`grove`,kind:`number`,category:`Sessions`,icon:`Activity`,min:1,max:10080,unit:{displayUnit:`minutes`,factor:6e4},note:`How long an idle session waits before it's auto-completed (display in minutes; daemon stores milliseconds).`}]},{id:`logging`,label:`Logging`,desc:`Daemon-process log verbosity and retention.`,category:`Logging`,icon:`ScrollText`,fields:[{key:`daemon.log_level`,label:`Log level`,scope:`machine`,kind:`select`,category:`Logging`,icon:`ScrollText`,options:[`debug`,`info`,`warn`,`error`]},{key:`daemon.log_retention_days`,label:`Log retention (days)`,scope:`machine`,kind:`number`,category:`Logging`,icon:`ScrollText`,min:1,max:365,suffix:`days`,note:`Window for log_entries rows. One daemon, one retention policy across every Grove it serves.`}]},{id:`update`,label:`Update`,desc:`Which release stream the daemon pulls updates from.`,category:`Update`,icon:`RotateCcw`,fields:[{key:`daemon.update_channel`,label:`Update channel`,scope:`machine`,kind:`select`,category:`Update`,icon:`RotateCcw`,options:[`stable`,`beta`],note:`Use beta for dogfood/preview builds. Machine-wide — one channel per machine.`,customRender:`card-owns`}]}];function O6(){let e=ek(),t=UO(),n=KO(),r=WO(),i=qO(),a=t.data?.config,o=n.data?.config;return{readField:(0,W.useCallback)(t=>{switch(t.scope){case`project`:{let n=e.effective;return n==null?void 0:zO(n,t.key)}case`grove`:return a?zO(a,t.key):void 0;case`machine`:return o?zO(o,t.key):void 0}},[e.effective,a,o]),writeField:(0,W.useCallback)(async(t,n)=>{if(n===void 0)switch(t.scope){case`project`:await e.setField(t.key,void 0,`project`);return;case`grove`:await r.mutateAsync({clear:[t.key]});return;case`machine`:await i.mutateAsync({clear:[t.key]});return}switch(t.scope){case`project`:await e.setField(t.key,n,`project`);return;case`grove`:{let e={};BO(e,t.key,n),await r.mutateAsync({patch:e});return}case`machine`:{let e={};BO(e,t.key,n),await i.mutateAsync({patch:e});return}}},[e,r,i]),isLoading:e.isLoading||!!t.isLoading||!!n.isLoading,error:t.error??n.error??null,scopeCounts:(0,W.useMemo)(()=>{let e={project:0,grove:0,machine:0};for(let t of D6)for(let n of t.fields)n.customRender!==`card-owns`&&(e[n.scope]+=1);return e},[])}}var k6=[{value:`all`,label:`All`},{value:`project`,label:`Project`},{value:`grove`,label:`Grove`},{value:`machine`,label:`Machine`}];function A6({scope:e,onScopeChange:t,searchInput:n,onSearchChange:r,scopeCounts:i}){let a=i.project+i.grove+i.machine;return(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(`div`,{role:`tablist`,"aria-label":`Filter settings by scope`,className:`inline-flex overflow-hidden rounded-md border border-[var(--ghost-border)] bg-surface-container-low`,children:k6.map(n=>{let r=n.value===`all`?a:i[n.value],o=n.value===e;return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o,onClick:()=>t(n.value),className:J(`relative flex items-center gap-1.5 px-3 py-1.5 transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,o?`bg-sage/10 text-on-surface`:`text-on-surface-variant hover:bg-surface-container hover:text-on-surface`),children:[o&&(0,G.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-[2px] bg-sage`}),(0,G.jsx)(`span`,{className:J(`myco-display-xs`,!o&&`text-on-surface-variant`),children:n.label}),(0,G.jsx)(X,{variant:`outline`,className:`px-1 py-0 text-[10px] font-mono`,children:r})]},n.value)})}),(0,G.jsxs)(`div`,{className:`relative flex-1 min-w-[16rem] max-w-md`,children:[(0,G.jsx)(no,{className:`pointer-events-none absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-on-surface-variant`}),(0,G.jsx)(op,{type:`search`,value:n,placeholder:`Search settings...`,onChange:e=>r(e.target.value),className:`pl-8 pr-8`}),n&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>r(``),className:`absolute right-1.5 top-1/2 -translate-y-1/2 rounded-sm p-1 text-on-surface-variant hover:bg-surface-container-high/40 hover:text-on-surface`,children:(0,G.jsx)(So,{className:`h-4 w-4`})})]})]})}var j6={Activity:Gi,Bell:Ji,Bot:Xi,Brain:Zi,GitBranch:ka,MessageSquare:Ha,RotateCcw:$a,Save:eo,ScrollText:to,Sparkles:co,Users:yo,Wrench:xo};function M6({name:e,className:t}){return(0,G.jsx)(j6[e]??Xi,{className:t})}var N6={toggle:S3,select:C3,number:T3,text:E3,list:O3,secret:k3},P6={project:`project`,grove:`grove`,machine:`machine`};function F6(e,t){let[n,r]=(0,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function I6(e,t){return t?`${e.label} ${e.key} ${e.category}`.toLowerCase().includes(t.toLowerCase()):!0}function L6(e){return e.customRender!==`card-owns`}function R6(e){return e.fields.filter(L6)}function z6(e,t,n){return R6(e).filter(e=>t!==`all`&&e.scope!==t?!1:I6(e,n))}function B6(e,t){for(let n of D6)for(let r of n.fields)if(r.key===e&&r.scope===t)return r}function V6(e,t,n,r,i){if(i){let t=r.trim(),i=e=>n===`all`||e.scope===n;return t.length>0?e.fields.some(e=>i(e)&&I6(e,t)):n===`all`?!0:e.fields.some(e=>i(e))}return t.length>0}var H6=new Set([`agent`,`embedding`,`capture`,`release-provenance`,`notifications`,`update`,`backup`,`logging`]),U6={agent:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(U3,{}),e.length>0&&(0,G.jsx)(X6,{fields:e,hasProject:t,unified:n})]}),embedding:()=>(0,G.jsx)(G3,{}),capture:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(A3,{}),e.length>0&&(0,G.jsx)(X6,{fields:e,hasProject:t,unified:n})]}),"release-provenance":()=>(0,G.jsx)(Q3,{}),notifications:()=>(0,G.jsx)(N3,{}),update:()=>(0,G.jsx)(i6,{}),backup:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(X6,{fields:e,hasProject:t,unified:n}),(0,G.jsx)(E6,{embedded:!0})]}),logging:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(X6,{fields:e,hasProject:t,unified:n}),(0,G.jsx)(W6,{})]})};function W6(){let e=Bs().data?.context?.request?.machine_id??`—`;return(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 py-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:items-start`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Machine ID`}),(0,G.jsx)(Ok,{scope:P6.machine})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Stable identifier this daemon uses when speaking to the team worker. Read-only.`})]}),(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(`div`,{className:`flex h-9 w-full items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:e})})]})}function G6(){return(0,G.jsx)(SP,{children:(0,G.jsx)(K6,{})})}function K6(){let e=xs(),t=An(),n=e!==null,r=O6(),[i,a]=(0,W.useState)(`all`),[o,s]=(0,W.useState)(``),c=F6(o,150),[l,u]=(0,W.useState)(D6[0]?.id??``),d=(0,W.useRef)(null),f=(0,W.useMemo)(()=>D6.map(e=>{let t=H6.has(e.id),n=z6(e,i,c);return{group:e,isCustom:t,visibleFields:n,visible:V6(e,n,i,c,t),mixedScopes:new Set(e.fields.map(e=>e.scope)).size>1}}),[i,c]),p=f.some(e=>e.visible);(0,W.useEffect)(()=>{let e=t.hash.replace(`#`,``);if(!e||!D6.some(t=>t.id===e))return;u(e);let n=document.getElementById(e);n&&requestAnimationFrame(()=>n.scrollIntoView({behavior:`auto`,block:`start`}))},[t.hash]),(0,W.useEffect)(()=>{if(r.isLoading)return;let e=new URLSearchParams(t.search),n=e.get(`configField`),i=e.get(`configSection`);if(!n&&!i)return;let a=[`ring-2`,`ring-primary/40`,`bg-primary/5`],o=(()=>{if(n){let e=n;for(;e.length>0;){let t=document.getElementById(Fi(e));if(t)return t;let n=e.lastIndexOf(`.`);if(n===-1)break;e=e.slice(0,n)}}if(i){let e=document.getElementById(i);if(e)return e}return null})();o&&(i&&D6.some(e=>e.id===i)&&u(i),requestAnimationFrame(()=>{o.scrollIntoView({behavior:`smooth`,block:`center`}),o.classList.add(...a),window.setTimeout(()=>o.classList.remove(...a),2e3)}))},[r.isLoading,t.search]);let m=(0,W.useCallback)(e=>{u(e);let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})},[]);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`px-6 pt-6`,children:[(0,G.jsx)(yP,{title:`Settings`,subtitle:`Project, Grove, and Machine settings in one place. Use the filter bar to narrow by scope.`}),(0,G.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-md border border-outline-variant/30 bg-surface-container/40 px-3 py-2 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Scopes`}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(Ok,{scope:`personal`}),` only you, this machine`]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(Ok,{scope:`project`}),` shared via the repo`]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(Ok,{scope:`grove`}),` all projects in this Grove`]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(Ok,{scope:`machine`}),` every Grove on this machine`]}),(0,G.jsx)(`span`,{className:`text-on-surface-variant/70`,children:`Precedence: Personal › Project › Grove › Machine.`})]}),!n&&(0,G.jsx)(`div`,{className:`mb-3 rounded-md border border-outline-variant/30 bg-surface-container/40 px-3 py-2 font-sans text-sm text-on-surface-variant`,children:`Select a project to edit Project and Grove settings. Machine-scoped settings are still editable below.`}),(0,G.jsx)(TP,{}),(0,G.jsx)(A6,{scope:i,onScopeChange:a,searchInput:o,onSearchChange:s,scopeCounts:r.scopeCounts})]}),(0,G.jsx)(`div`,{ref:d,className:`flex-1 overflow-auto px-6 pb-6`,children:(0,G.jsxs)(`div`,{className:`flex gap-6`,children:[(0,G.jsx)(q6,{summaries:f,activeId:l,onSelect:m}),(0,G.jsxs)(`main`,{className:`flex-1 space-y-4`,children:[!p&&(0,G.jsx)(`div`,{className:`flex h-64 items-center justify-center font-sans text-sm text-on-surface-variant`,children:`No settings match your filters.`}),f.map(e=>e.visible?(0,G.jsx)(J6,{group:e.group,isCustom:e.isCustom,visibleFields:e.visibleFields,mixedScopes:e.mixedScopes,hasProject:n,unified:r},e.group.id):null)]})]})})]})}function q6({summaries:e,activeId:t,onSelect:n}){return(0,G.jsx)(`nav`,{"aria-label":`Settings sections`,className:`sticky top-0 hidden h-fit w-[200px] shrink-0 self-start lg:block`,children:(0,G.jsx)(`ul`,{className:`space-y-0.5 py-2`,children:e.map(({group:e,visible:r,isCustom:i,visibleFields:a})=>{let o=e.id===t,s=i?R6(e).length:a.length;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:J(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left font-sans text-sm transition-colors`,o?`bg-surface-container-high/60 text-on-surface`:`text-on-surface-variant hover:bg-surface-container/40 hover:text-on-surface`,!r&&`opacity-40`),children:[(0,G.jsx)(M6,{name:e.icon,className:`h-4 w-4 shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:s})]})},e.id)})})})}function J6({group:e,isCustom:t,visibleFields:n,mixedScopes:r,hasProject:i,unified:a}){return(0,G.jsx)(Q,{level:`low`,className:`rounded-md p-4`,children:(0,G.jsxs)(`section`,{id:e.id,className:`scroll-mt-4`,children:[(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(M6,{name:e.icon,className:`h-4 w-4 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e.category}),(0,G.jsx)(`h2`,{className:`font-sans text-base text-on-surface`,children:e.label}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-outline`,children:e.desc})]}),r&&(0,G.jsx)(X,{variant:`outline`,className:`text-[10px]`,children:`Mixed scopes`})]}),t?(0,G.jsx)(Y6,{groupId:e.id,fields:n,hasProject:i,unified:a}):(0,G.jsx)(X6,{fields:n,hasProject:i,unified:a})]})})}function Y6({groupId:e,fields:t,hasProject:n,unified:r}){let i=U6[e];return i?(0,G.jsx)(`div`,{children:i({fields:t,hasProject:n,unified:r})}):null}function X6({fields:e,hasProject:t,unified:n}){return e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No fields match the current filters.`}):(0,G.jsx)(`div`,{className:`divide-y divide-outline-variant/20`,children:e.map(e=>(0,G.jsx)(Z6,{field:e,hasProject:t,unified:n},e.key))})}function Z6({field:e,hasProject:t,unified:n}){let r=Fi(e.key),i=`setting-${e.key.replace(/\./g,`-`)}`,a=n.readField(e),o=e.scope===`grove`&&!t||e.scope===`project`&&!t,s=(()=>{if(!e.dependsOn)return!1;let t=B6(e.dependsOn.key,e.scope);return t?n.readField(t)!==e.dependsOn.value:!1})(),c=o||s,[l,u]=(0,W.useState)(null),d=(0,W.useCallback)(t=>{u(null),n.writeField(e,t).catch(t=>{u(t instanceof Error?t.message:String(t)),console.error(`[settings] writeField failed: ${e.key}`,t)})},[n,e]),f=JO(),p=YO(),m=e.scope===`machine`&&e.kind===`list`,h=m?t=>f.mutate({path:e.key,value:t}):void 0,g=m?t=>p.mutate({path:e.key,value:t}):void 0;return(0,G.jsxs)(`div`,{id:r,className:`grid grid-cols-1 gap-3 py-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:items-start scroll-mt-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:i,className:`font-sans text-sm font-medium text-on-surface`,children:e.label}),(0,G.jsx)(Ok,{scope:P6[e.scope]}),(0,G.jsx)(`code`,{className:`font-mono text-[10px] text-on-surface-variant`,children:e.key})]}),e.note&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:e.note})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Q6,{inputId:i,field:e,value:a,onChange:d,disabled:c,onAdd:h,onRemove:g}),l&&(0,G.jsx)(`p`,{role:`alert`,className:`mt-1 font-sans text-xs text-tertiary`,children:l})]})]})}function Q6({inputId:e,field:t,value:n,onChange:r,disabled:i,onAdd:a,onRemove:o}){if(!N6[t.kind])return null;switch(t.kind){case`toggle`:return(0,G.jsx)(S3,{id:e,value:n??!1,onChange:e=>r(e),disabled:i,readonly:t.readonly});case`select`:return(0,G.jsx)(C3,{id:e,value:n??``,onChange:e=>r(e),options:t.options??[],disabled:i,readonly:t.readonly});case`number`:{let a=t.unit?.factor??1,o=typeof n==`number`?n:0;return(0,G.jsx)(T3,{id:e,value:a===1?o:o/a,onChange:e=>r(a===1?e:e*a),min:t.min,max:t.max,step:t.step,suffix:t.unit?.displayUnit??t.suffix,disabled:i,readonly:t.readonly})}case`text`:return(0,G.jsx)(E3,{id:e,value:typeof n==`string`?n:``,onChange:e=>{let n=typeof e==`string`?e:``;t.nullableEmpty&&n.length===0?r(void 0):r(e)},disabled:i,readonly:t.readonly});case`list`:return(0,G.jsx)(O3,{id:e,value:Array.isArray(n)?n:[],onChange:e=>r(e),disabled:i,readonly:t.readonly,onAdd:a,onRemove:o});case`secret`:return(0,G.jsx)(k3,{id:e,value:typeof n==`string`?n:``,onChange:e=>r(e),disabled:i,readonly:t.readonly});default:return null}}function $6({Icon:e,children:t,...n}){return(0,G.jsxs)(Uj,{...n,children:[(0,G.jsx)(e,{className:`h-3 w-3 mr-1.5`,"aria-hidden":!0}),t]})}function e8({term:e,children:t}){return(0,G.jsxs)(`div`,{className:`flex justify-between gap-2 text-xs`,children:[(0,G.jsx)(`dt`,{className:`text-on-surface-variant`,children:e}),(0,G.jsx)(`dd`,{className:`text-on-surface`,children:t})]})}function t8({name:e,slug:t,projectCount:n,machineId:r}){return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:go,tone:`sage`,children:`Grove`}),title:e,children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(e8,{term:`Slug`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:t})}),(0,G.jsx)(e8,{term:`Projects`,children:(0,G.jsx)(`span`,{children:n})}),(0,G.jsx)(e8,{term:`Machine`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:r})})]})})}function n8({uptimeSeconds:e,port:t,version:n}){return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:mo,tone:`sage`,children:`Daemon`}),title:qk(e),children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(e8,{term:`Port`,children:(0,G.jsxs)(`code`,{className:`font-mono`,children:[`:`,t]})}),(0,G.jsx)(e8,{term:`Version`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:n})}),(0,G.jsx)(e8,{term:`Status`,children:(0,G.jsx)(X,{variant:`default`,children:`running`})})]})})}function r8(e){return e?`?team_id=${encodeURIComponent(e)}`:``}function i8(e){let t=r8(e);return As({queryKey:[`team-status`,e??null],queryFn:({signal:e})=>q(`/team/status${t}`,{signal:e}),refetchInterval:js.STATS,pollCategory:`standard`})}function a8(e,t){let n=r8(t);return As({queryKey:[`team-queue-stats`,t??null],queryFn:({signal:e})=>q(`/team/queue-stats${n}`,{signal:e}),refetchInterval:js.TEAM,pollCategory:`standard`,enabled:e,placeholderData:H})}function o8(e,t){let n=r8(t);return As({queryKey:[`team-sync-summary`,t??null],queryFn:({signal:e})=>q(`/team/sync-summary${n}`,{signal:e}),refetchInterval:js.TEAM,pollCategory:`standard`,enabled:e,placeholderData:H})}function s8(e,t){let n=r8(t);return As({queryKey:[`team-dlq`,t??null],queryFn:({signal:e})=>q(`/team/dlq${n}`,{signal:e}),refetchInterval:js.TEAM,pollCategory:`standard`,enabled:e,placeholderData:H})}function c8(){return As({queryKey:[`team-registry`],queryFn:({signal:e})=>q(`/team/registry`,{signal:e}),refetchInterval:js.TEAM,pollCategory:`standard`})}function l8(){return As({queryKey:[`team-projects`],queryFn:({signal:e})=>q(`/team/projects`,{signal:e}),refetchInterval:js.TEAM,pollCategory:`standard`})}function u8(){let e=We();return st({mutationFn:e=>os(`/team/project-membership`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`team-registry`]}),e.invalidateQueries({queryKey:[`team-projects`]})}})}function d8(){let e=We();return st({mutationFn:e=>os(`/team/join`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`team-registry`]}),e.invalidateQueries({queryKey:[`team-projects`]}),e.invalidateQueries({queryKey:[`team-status`]})}})}function f8(){let e=We();return st({mutationFn:e=>os(`/team/forget`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`team-registry`]}),e.invalidateQueries({queryKey:[`team-projects`]}),e.invalidateQueries({queryKey:[`team-status`]})}})}function p8(e){let t=r8(e);return As({queryKey:[`team-members`,e??null],queryFn:({signal:e})=>q(`/team/members${t}`,{signal:e}),refetchInterval:js.STATS,pollCategory:`standard`})}function m8({groveSlug:e}){let{data:t}=i8(),{data:n}=p8(),r=t?.enabled??!1,i=t?.healthy??!1,a=r?i?`default`:`destructive`:`outline`,o=r?i?`synced`:`unhealthy`:`not connected`,s=n?.members.length??0;return(0,G.jsx)(ri,{to:`/g/${e}/team`,className:`block transition-opacity hover:opacity-90`,children:(0,G.jsx)(Wj,{tone:`ochre`,eyebrow:(0,G.jsx)($6,{Icon:yo,tone:`ochre`,children:`Team`}),title:`${s} member${s===1?``:`s`}`,children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(e8,{term:`Status`,children:(0,G.jsx)(X,{variant:a,children:o})}),(0,G.jsx)(e8,{term:`Pending sync`,children:(0,G.jsx)(`span`,{children:t?.pending_sync_count??0})})]})})})}function h8({groveSlug:e}){let{data:t,isLoading:n}=cv(),r=(t?.projects??[]).filter(t=>t.grove_slug===e).sort((e,t)=>(t.last_activity_at?Date.parse(t.last_activity_at):0)-(e.last_activity_at?Date.parse(e.last_activity_at):0));return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:`Projects`,title:`In this Grove`,actions:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:r.length}),padded:!1,children:n&&r.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`Loading…`}):r.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`No projects yet.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:r.map(t=>(0,G.jsx)(`li`,{children:(0,G.jsx)(kM,{accent:`sage`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(Ia,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(ri,{to:`/g/${e}/p/${t.project_id}`,className:`block truncate text-sm text-on-surface hover:text-sage`,children:t.project_name}),(0,G.jsxs)(`div`,{className:`flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[t.scheduled_runs_last_24h,` run`,t.scheduled_runs_last_24h===1?``:`s`,` / 24h`]}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[`last activity`,` `,t.last_activity_at?pv(t.last_activity_at):`never`]})]})]}),(0,G.jsx)(X,{variant:t.is_active?`default`:`outline`,children:t.is_active?`active`:`cold`})]})})},t.project_id))})})}function g8(e){let t=Nn(),{data:n,isLoading:r}=IA({status:`active`,limit:10}),i=n?.sessions??[];return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:`Active now`,title:`${i.length} ${i.length===1?`live session`:`live sessions`}`,padded:!1,children:r&&i.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`Loading…`}):i.length===0?(0,G.jsxs)(`div`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:[(0,G.jsx)(`p`,{className:`font-medium m-0`,children:`Nothing active`}),(0,G.jsx)(`p`,{className:`text-xs m-0`,children:`No symbiont sessions are running right now in this Grove.`})]}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:i.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(kM,{accent:`sage`,onClick:()=>t(`/sessions/${e.id}`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Vk,{tone:`sage`,pulse:!0}),(0,G.jsx)(`span`,{className:`truncate text-sm text-on-surface flex-1 min-w-0`,children:e.title||`Untitled session`}),(0,G.jsx)(X,{variant:`outline`,children:e.agent}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:mv(e.started_at)})]}),e.branch&&(0,G.jsxs)(`div`,{className:`mt-1 ml-5 flex items-center gap-1 font-mono text-[10px] italic text-on-surface-variant`,children:[(0,G.jsx)(ka,{className:`h-2.5 w-2.5`}),e.branch]})]})},e.id))})})}function _8(e=`project`){let t=e===`all-groves`?`grove`:e;return As({queryKey:[`embedding-details`,t],queryFn:({signal:e})=>q(`/embedding/details?scope=${t}`,{signal:e}),refetchInterval:js.STATS,pollCategory:`standard`})}function v8(){return As({queryKey:[`database-details`],queryFn:({signal:e})=>q(`/database/details`,{signal:e}),refetchInterval:js.STATS,pollCategory:`standard`})}function y8({groveSlug:e}){let{data:t}=_8(`grove`),{data:n}=v8(),r=t?Object.values(t.pending).reduce((e,t)=>e+t,0):0;return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:ma,tone:`sage`,children:`Grove`}),title:`Vault`,actions:(0,G.jsxs)(ri,{to:`/g/${e}/operations`,className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Operations `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,G.jsx)(Qj,{label:`Vectors`,value:t?String(t.total):`—`,tone:`sage`,mono:!0}),(0,G.jsx)(Qj,{label:`Pending`,value:String(r),tone:r>0?`ochre`:`default`,mono:!0}),(0,G.jsx)(Qj,{label:`DB size`,value:n?Tv(n.file.size_bytes):`—`,tone:`sage`,mono:!0}),(0,G.jsx)(Qj,{label:`Fragmentation`,value:n?`${n.file.fragmentation_pct.toFixed(1)}%`:`—`,tone:n&&n.file.fragmentation_pct>25?`ochre`:`default`,mono:!0})]})})}function b8({error:e,isLoading:t,backups:n,last:r}){return e?`Snapshot unavailable`:t||!n?`—`:r?pv(r.modified_at):`No backups yet`}function x8(){let e=Ss(),t=e?.grove.id??null,n=(0,W.useMemo)(()=>e?ko(e):void 0,[e]),{data:r,error:i,isLoading:a}=ot({queryKey:[`backups`,t],queryFn:({signal:e})=>q(`/backups`,{signal:e,headers:n}),enabled:!!t}),o=r?.backups??null,s=o&&o.length>0?o[0]:null,c=o?o.slice(1,5):[];return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:`Backup`,title:b8({error:i??null,isLoading:a,backups:o,last:s}),actions:(0,G.jsxs)(ri,{to:`/settings#backup`,className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Settings `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:i?(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0`,children:i.message}):a||!o?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Loading…`}):s===null?(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:[`Use `,(0,G.jsx)(`span`,{className:`text-on-surface`,children:`Backup Now`}),` in Settings to create the first snapshot.`]}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-on-surface`,children:[(0,G.jsx)(Ta,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsx)(`code`,{className:`font-mono truncate`,children:s.file_name})]}),(0,G.jsxs)(`div`,{className:`mt-1 flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(ua,{className:`h-3 w-3`}),pv(s.modified_at)]}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsx)(`span`,{children:Tv(s.size_bytes)})]})]}),c.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`myco-eyebrow-sm text-outline`,children:`Recent`}),(0,G.jsx)(`ul`,{className:`mt-1 m-0 p-0 list-none flex flex-col gap-0.5`,children:c.map(e=>(0,G.jsxs)(`li`,{className:`flex justify-between text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:pv(e.modified_at)}),(0,G.jsx)(`span`,{children:Tv(e.size_bytes)})]},e.file_name))})]})]})})}function S8({currentGroveSlug:e}){let{data:t,isLoading:n}=_s(),r=(t?.groves??[]).filter(t=>t.slug!==e);return n&&r.length===0?(0,G.jsx)(Wj,{tone:`ochre`,eyebrow:`Other Groves`,title:`Loading…`}):r.length===0?(0,G.jsx)(Wj,{tone:`ochre`,eyebrow:`Other Groves`,title:`Just this one`,children:(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:[`Create another with `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco grove create`}),`.`]})}):(0,G.jsx)(Wj,{tone:`ochre`,eyebrow:`Other Groves`,title:`${r.length} ${r.length===1?`sibling Grove`:`sibling Groves`}`,children:(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:r.map(e=>(0,G.jsxs)(ri,{to:`/g/${e.slug}`,className:`block rounded-md border border-[var(--ghost-border)] p-3 transition-colors hover:bg-surface-container`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(go,{className:`h-3.5 w-3.5 text-ochre`}),(0,G.jsx)(`span`,{className:`truncate text-sm font-medium text-on-surface`,children:e.name}),e.is_default&&(0,G.jsx)(X,{variant:`outline`,children:`default`})]}),(0,G.jsxs)(`div`,{className:`mt-1 flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e.slug}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[e.project_count,` project`,e.project_count===1?``:`s`]})]})]},e.slug))})})}function C8(){let e=xs(),{data:t}=Bs();if(!e||!t)return(0,G.jsx)(Lj,{isLoading:!0,error:null,loadingText:`Loading Grove…`,children:(0,G.jsx)(`span`,{})});let n=e.grove;return(0,G.jsxs)(zj,{children:[(0,G.jsx)(yP,{title:n.name,subtitle:`Database boundary for this set of projects. Embedding, vault, backups, and team sync are all Grove-scoped.`}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,G.jsx)(t8,{name:n.name,slug:n.slug,projectCount:n.project_count??0,machineId:t.context.request.machine_id}),(0,G.jsx)(n8,{uptimeSeconds:t.daemon.uptime_seconds,port:t.daemon.port,version:t.daemon.version}),(0,G.jsx)(m8,{groveSlug:n.slug})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,G.jsx)(h8,{groveSlug:n.slug}),(0,G.jsx)(g8,{groveSlug:n.slug})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,G.jsx)(y8,{groveSlug:n.slug}),(0,G.jsx)(x8,{})]}),(0,G.jsx)(S8,{currentGroveSlug:n.slug})]})}var w8=[`sessions`,`spores`,`plans`,`artifacts`,`skill_records`,`canopy_entries`],T8={},E8=20;function D8(e){return e.provider.available?Object.values(e.pending).some(e=>e>0)?`processing`:`idle`:`unavailable`}function O8(e){return e.provider.available?Object.values(e.pending).some(e=>e>0)?`bg-secondary`:`bg-primary`:`bg-tertiary`}function k8({data:e}){return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Embedding namespace breakdown`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Namespace`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Embedded`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Pending`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Stale`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Total`})]})}),(0,G.jsx)(`tbody`,{children:w8.map((t,n)=>{let r=e.namespace_breakdown?.[t],i=e.by_namespace[t],a=r?.embedded??i?.embedded??0,o=r?.pending??e.pending[t]??0,s=r?.stale??i?.stale??0,c=r?.total??a+o;return(0,G.jsxs)(`tr`,{className:J(`transition-colors hover:bg-surface-container-high/50`,n%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-2.5 pr-4`,children:T8[t]??t}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:a}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:o>0?(0,G.jsx)(`span`,{className:`text-secondary`,children:o}):o}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:s>0?(0,G.jsx)(`span`,{className:`text-tertiary`,children:s}):s}),(0,G.jsx)(`td`,{className:`py-2.5 text-right`,children:c})]},t)})})]})})}function A8(){let e=We(),t=xs(),[n,r]=(0,W.useState)(null),i=`grove`,{data:a,isLoading:o,isError:s,error:c}=_8(`grove`),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1);function p(e,n,r,a){let o=p6(i,t);if(!(o&&_6(e,o))){r();return}u({action:n,scopeKind:i,run:r,variant:a})}let[m,h]=(0,W.useState)([]),g=a?.total??null;(0,W.useEffect)(()=>{g!==null&&h(e=>{let t=[...e,g];return t.length>E8?t.slice(-20):t})},[g]);async function _(){r(null);try{let n=await os(`/embedding/reembed-stale`,{scope:p6(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Re-embed dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Re-embedded ${n.reembedded??0} stale vectors in ${n.passes??0} pass(es)`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${$3(e)}`})}}function v(){p(`reembed-stale`,`Re-embed stale vectors`,_)}async function y(){r(null);try{let n=await os(`/embedding/rebuild`,{scope:p6(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Rebuild dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Rebuild cleared ${n.queued??0} vectors and re-embedded ${n.embedded??0} records (passes ${n.passes??0}, remaining ${n.remaining_queue_depth??0})`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${$3(e)}`})}}function b(){p(`rebuild`,`Rebuild all vectors`,y,`destructive`)}async function x(){r(null);try{let n=await os(`/embedding/clean-orphans`,{scope:p6(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Clean orphans dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Cleaned ${n.orphans_cleaned??0} orphan vectors`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${$3(e)}`})}}function S(){p(`clean-orphans`,`Clean orphan vectors`,x)}async function C(){r(null);try{let n=await os(`/embedding/reconcile`,{scope:p6(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Reconcile dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Reconcile complete: ${n.embedded??0} embedded, ${n.orphans_cleaned??0} orphans cleaned (${n.duration_ms??0}ms)`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${$3(e)}`})}}function w(){p(`reconcile`,`Force reconcile embeddings`,C)}if(!a)return(0,G.jsx)(Lj,{isLoading:o,error:s?c instanceof Error?c:Error(`Unable to reach daemon`):null,loadingText:`Loading embedding details...`,children:(0,G.jsx)(`div`,{})});let T=Object.values(a.pending).reduce((e,t)=>e+t,0),E=Object.values(a.by_namespace).reduce((e,t)=>e+t.stale,0),D=a.canopy_describe?.pending??0;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-sans text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ma,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Provider`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:a.provider.name})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Model`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface truncate max-w-[200px]`,title:a.provider.model,children:a.provider.model})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:J(`h-2 w-2 rounded-full`,O8(a))}),(0,G.jsx)(`span`,{className:`text-on-surface-variant capitalize`,children:D8(a)})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3`,children:[(0,G.jsx)(G2,{label:`Total Vectors`,value:String(a.total),sparklineData:m,accent:`sage`}),(0,G.jsx)(G2,{label:`Pending`,value:String(T),accent:T>0?`ochre`:`outline`}),(0,G.jsx)(G2,{label:`Stale`,value:String(E),accent:E>0?`terracotta`:`outline`}),(0,G.jsx)(G2,{label:`Canopy Scribe`,value:String(D),sublabel:D>0?`${a.canopy_describe?.undescribed??0} new, ${a.canopy_describe?.stale??0} stale`:`fresh`,accent:D>0?`ochre`:`outline`})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(ZM,{children:`Namespace Breakdown`}),(0,G.jsx)(k8,{data:a})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(ZM,{children:`Actions`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:v,children:[(0,G.jsx)(Qa,{className:`mr-2 h-4 w-4`}),`Re-embed stale`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:S,children:[(0,G.jsx)(ho,{className:`mr-2 h-4 w-4`}),`Clean orphans`]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:w,children:[(0,G.jsx)(Ja,{className:`mr-2 h-4 w-4`}),`Force reconcile`]}),(0,G.jsxs)(Y,{variant:`destructive`,size:`sm`,onClick:b,children:[(0,G.jsx)($a,{className:`mr-2 h-4 w-4`}),`Rebuild all`]})]}),n&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,n.type===`success`?`text-primary`:`text-tertiary`),children:n.text})]}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(ri,{to:`/logs?component=embedding`,className:`font-sans text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1`,children:`View embedding activity in Logs →`})}),l&&(0,G.jsx)(g6,{open:!0,onOpenChange:e=>{e||u(null)},action:l.action,scope:p6(l.scopeKind,t)??{kind:`all-groves`},variant:l.variant,isPending:d,onConfirm:async()=>{f(!0);try{await l.run()}finally{f(!1),u(null)}}})]})}var j8=15,M8=`insufficient_disk_space`,N8=20,P8=[`grove`,`all-groves`];function F8(e){if(e<=0)return`now`;let t=Math.floor(e/1e3);if(t<60)return t+`s`;let n=Math.floor(t/60);return n<60?n+`m`:Math.floor(n/60)+`h`}function I8({title:e,value:t,onChange:n,available:r}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(ZM,{children:e}),(0,G.jsx)(u6,{value:t,onChange:n,available:r})]})}function L8({scope:e}){return(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:f6[e]})}function R8({tables:e}){let t=[...e].sort((e,t)=>t.rows-e.rows);return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Database table breakdown`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Table`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Rows`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Indexes`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Type`})]})}),(0,G.jsx)(`tbody`,{children:t.map((e,t)=>(0,G.jsxs)(`tr`,{className:J(`transition-colors hover:bg-surface-container-high/50`,t%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-2.5 pr-4`,children:e.name}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:e.rows.toLocaleString()}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:e.index_count}),(0,G.jsx)(`td`,{className:`py-2.5`,children:e.is_fts?(0,G.jsx)(X,{variant:`outline`,className:`px-1.5 py-0 text-[10px] uppercase`,children:`FTS5`}):(0,G.jsx)(`span`,{className:`text-on-surface-variant/60`,children:`btree`})})]},e.name))})]})})}function z8({details:e,onActionResult:t}){let{effective:n}=ek(),r=We(),i=xs(),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(`grove`),[l,u]=(0,W.useState)(!1);if(!n)return null;let d=n.maintenance.auto_optimize,f=n.maintenance.auto_optimize_interval_hours,p=e.last_optimize_at?new Date(e.last_optimize_at).getTime():null,m=p===null?0:p+f*lv*1e3-Date.now();async function h(){o(!0);try{let e=await os(`/database/optimize`,{scope:p6(s,i)});if(e.summary)t({type:e.summary.failed>0?`error`:`success`,text:`Optimize dispatched across ${e.summary.ok+e.summary.failed} Grove(s); ${e.summary.failed} failed`});else{let n=e.actions_failed?.length??0;t({type:n>0?`error`:`success`,text:`Optimize complete: `+(e.actions_completed?.length??0)+` steps, `+n+` failed (`+(e.duration_ms??0)+`ms)`})}r.invalidateQueries({queryKey:[`database-details`]})}catch(e){t({type:`error`,text:`Error: `+$3(e)})}finally{o(!1)}}function g(){let e=p6(s,i);if(e&&_6(`optimize`,e)){u(!0);return}h()}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(I8,{title:`Scheduled Maintenance`,value:s,onChange:c,available:P8}),(0,G.jsx)(L8,{scope:s}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Auto-optimize`}),` `,d?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-primary`,children:`on`}),`, every `,f,`h.`]}):(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`off.`}),` `,(0,G.jsx)(ri,{to:`/settings#maintenance`,className:`text-primary hover:text-primary/80 transition-colors text-xs`,children:`Configure in Settings →`})]}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Last run: `,e.last_optimize_at?pv(e.last_optimize_at):`never`,d&&p!==null&&(0,G.jsxs)(G.Fragment,{children:[` · Next: `,F8(m)]})]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:g,disabled:a,children:[(0,G.jsx)(Ja,{className:`mr-2 h-4 w-4`}),a?`Running...`:`Run now`]}),(0,G.jsx)(g6,{open:l,onOpenChange:u,action:`Optimize database`,scope:p6(s,i)??{kind:`all-groves`},isPending:a,onConfirm:async()=>{await h(),u(!1)}})]})}function B8({onActionResult:e}){let[t,n]=(0,W.useState)(!1);async function r(){n(!0);try{let t=await os(`/api/maintenance/release-provenance/reconcile`,{});if(t.disabled){e({type:`success`,text:`Release provenance reconciliation is disabled in config.`});return}let n=t.results??[],r=n.reduce((e,t)=>({reconciled:e.reconciled+t.reconciled,unchanged:e.unchanged+t.unchanged,failed:e.failed+t.failed,errors:e.errors+ +!!t.error}),{reconciled:0,unchanged:0,failed:0,errors:0}),i=`Release reconcile: ${n.length} project(s), ${r.reconciled} updated, ${r.unchanged} unchanged${r.failed?`, ${r.failed} rows failed`:``}${r.errors?`, ${r.errors} project errors`:``}.`;e({type:r.errors>0?`error`:`success`,text:i})}catch(t){e({type:`error`,text:`Error: `+$3(t)})}finally{n(!1)}}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(ZM,{children:`Release provenance`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Re-runs ancestry, patch-id, and (when configured) GitHub PR squash evidence checks for every served project. Reconciliation is idempotent — safe to invoke repeatedly. Status counts surface in each Grove's maintenance summary.`}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{onClick:r,disabled:t,variant:`outline`,size:`sm`,children:t?`Reconciling...`:`Reconcile now`})})]})}function V8({onActionResult:e}){let t=We(),n=xs(),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(`grove`),[s,c]=(0,W.useState)(null);function l(e,t,r,i){let o=p6(a,n);if(!(o&&_6(e,o))){r();return}c({action:t,run:r,variant:i})}async function u(){i(!0);try{let r=await os(`/database/integrity-check`,{scope:p6(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Integrity check across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):r.status===`ok`?e({type:`success`,text:`Integrity check OK (`+(r.duration_ms??0)+`ms)`}):e({type:`error`,text:`Integrity issues: `+(r.issues?.length??0)+` problems, `+(r.fk_violations??0)+` FK violations`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){e({type:`error`,text:`Error: `+$3(t)})}finally{i(!1)}}function d(){l(`integrity-check`,`Run integrity check`,u)}async function f(){i(!0);try{let r=await os(`/database/vacuum`,{scope:p6(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Vacuum across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):e({type:`success`,text:`Vacuum complete: freed `+Tv(r.freed_bytes??0)+` in `+(r.duration_ms??0)+`ms`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){if(t instanceof ms){let n=t.body;if(n?.error===M8){e({type:`error`,text:`Insufficient disk: need `+Tv(n.required_bytes??0)+`, have `+Tv(n.free_bytes??0)});return}}e({type:`error`,text:`Error: `+$3(t)})}finally{i(!1)}}function p(){l(`vacuum`,`Vacuum database`,f,`destructive`)}async function m(){i(!0);try{let r=await os(`/database/reindex`,{scope:p6(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Reindex across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):e({type:`success`,text:`Reindex complete (`+(r.duration_ms??0)+`ms)`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){e({type:`error`,text:`Error: `+$3(t)})}finally{i(!1)}}function h(){l(`reindex`,`Reindex database`,m)}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(I8,{title:`Actions`,value:a,onChange:o,available:P8}),(0,G.jsx)(L8,{scope:a}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:d,disabled:r,children:[(0,G.jsx)(Qa,{className:`mr-2 h-4 w-4`}),`Integrity check`]}),(0,G.jsxs)(Y,{variant:`destructive`,size:`sm`,onClick:p,disabled:r,children:[(0,G.jsx)(ho,{className:`mr-2 h-4 w-4`}),`Vacuum`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:h,disabled:r,children:[(0,G.jsx)($a,{className:`mr-2 h-4 w-4`}),`Reindex`]})]}),s&&(0,G.jsx)(g6,{open:!0,onOpenChange:e=>{e||c(null)},action:s.action,scope:p6(a,n)??{kind:`all-groves`},variant:s.variant,isPending:r,onConfirm:async()=>{await s.run(),c(null)}})]})}function H8(){let{data:e,isLoading:t,isError:n,error:r}=v8(),[i,a]=(0,W.useState)([]),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(`grove`);if((0,W.useEffect)(()=>{e&&a(t=>{let n=[...t,e.file.size_bytes];return n.length>N8?n.slice(-20):n})},[e]),t)return(0,G.jsx)(`div`,{className:`text-on-surface-variant`,children:`Loading database details...`});if(n)return(0,G.jsxs)(`div`,{className:`text-tertiary`,children:[`Error: `,r.message]});if(!e)return null;let u=e.file.fragmentation_pct.toFixed(1)+`%`,d=e.file.fragmentation_pct>j8?`ochre`:`outline`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-sans text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ha,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Database`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:`myco.db`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Schema`}),(0,G.jsxs)(`span`,{className:`font-mono text-on-surface`,children:[`v`,e.schema.version]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Journal`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface uppercase`,children:e.schema.journal_mode})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`healthy`})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-3`,children:[(0,G.jsx)(G2,{label:`Database Size`,value:Tv(e.file.size_bytes),sparklineData:i,accent:`sage`}),(0,G.jsx)(G2,{label:`Fragmentation`,value:u,accent:d}),(0,G.jsx)(G2,{label:`WAL Size`,value:Tv(e.file.wal_size_bytes),accent:`outline`})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(I8,{title:`Schema Breakdown`,value:c,onChange:l,available:P8}),(0,G.jsx)(L8,{scope:c}),(0,G.jsx)(R8,{tables:e.tables})]}),(0,G.jsx)(z8,{details:e,onActionResult:s}),(0,G.jsx)(B8,{onActionResult:s}),(0,G.jsx)(V8,{onActionResult:s}),o&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,o.type===`success`?`text-primary`:`text-tertiary`),children:o.text}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(ri,{to:`/logs?component=database`,className:`font-sans text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1`,children:`View database activity in Logs →`})})]})}var U8=[{id:`embedding`,label:`Embedding`,description:`queues + namespaces`},{id:`database`,label:`Database`,description:`file health + maintenance`}],W8=new Set([`embedding`,`database`]),G8={embedding:`Provider, queues, namespaces. Each action runs against the active Grove.`,database:`File health, tables, schedule, and on-demand maintenance for this Grove’s SQLite store.`},K8=`tab`;function q8(){let e=new URLSearchParams(window.location.search).get(K8);return e&&W8.has(e)?e:`embedding`}function J8(e){let t=new URLSearchParams;e!==`embedding`&&t.set(K8,e);let n=t.toString(),r=n?`${window.location.pathname}?${n}`:window.location.pathname;window.history.replaceState(null,``,r)}function Y8(){let e=We(),[t,n]=(0,W.useState)(q8),r=(0,W.useCallback)(e=>{let t=e;n(t),J8(t)},[]),i=(0,W.useCallback)(()=>{e.invalidateQueries({queryKey:[`embedding-details`]}),e.invalidateQueries({queryKey:[`database-details`]})},[e]);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`px-6 pt-6 space-y-6`,children:[(0,G.jsx)(yP,{title:`Operations`,subtitle:G8[t],actions:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,children:[(0,G.jsx)(Qa,{size:14}),`Refresh`]})}),(0,G.jsx)(iF,{tabs:U8.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:t,onTabChange:r,columns:2})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,G.jsxs)(`div`,{className:`px-6 pb-6`,children:[t===`embedding`&&(0,G.jsx)(A8,{}),t===`database`&&(0,G.jsx)(H8,{})]})})]})}var X8=[{value:`15m`,label:`15m`},{value:`1h`,label:`1h`},{value:`6h`,label:`6h`},{value:`24h`,label:`24h`},{value:`7d`,label:`7d`},{value:`30d`,label:`30d`}];function Z8({mode:e,onModeChange:t,searchValue:n,onSearchChange:r,onSearchSubmit:i,activeLevel:a,onLevelChange:o,components:s,activeComponents:c,onComponentToggle:l,onComponentsClear:u,timeRange:d,onTimeRangeChange:f,totalResults:p,paused:m=!1,onPausedToggle:h}){return(0,G.jsxs)(Q,{level:`default`,className:`rounded-md p-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center rounded-md bg-surface-container-low`,children:[(0,G.jsxs)(Y,{size:`sm`,variant:e===`live`?`default`:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs rounded-r-none`,onClick:()=>t(`live`),children:[(0,G.jsx)(Za,{className:`h-3 w-3`}),`Live`]}),(0,G.jsxs)(Y,{size:`sm`,variant:e===`search`?`default`:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs rounded-l-none`,onClick:()=>t(`search`),children:[(0,G.jsx)(no,{className:`h-3 w-3`}),`Search`]})]}),e===`live`&&h&&(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs`,onClick:h,"aria-label":m?`Resume log stream`:`Pause log stream`,title:m?`Resume`:`Pause`,children:[m?(0,G.jsx)(Ja,{className:`h-3 w-3`}):(0,G.jsx)(qa,{className:`h-3 w-3`}),m?`Resume`:`Pause`]}),e===`search`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-5 w-px bg-outline-variant/30`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(ua,{className:`h-3 w-3 text-on-surface-variant/50`}),X8.map(e=>(0,G.jsx)(Y,{size:`sm`,variant:d===e.value?`default`:`ghost`,className:`h-6 px-1.5 text-[10px]`,onClick:()=>f(e.value),children:e.label},e.value))]})]}),(0,G.jsx)(`form`,{className:`ml-auto flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault(),i()},children:(0,G.jsx)(op,{className:`h-7 w-56 text-xs`,placeholder:e===`search`?`Search logs...`:`Filter messages...`,value:n,onChange:e=>r(e.target.value),"aria-label":`Search log messages`})}),e===`search`&&p!==void 0&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-on-surface-variant/50 tabular-nums whitespace-nowrap`,children:[p.toLocaleString(),` results`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:Ps.map(e=>(0,G.jsxs)(Y,{size:`sm`,variant:a===e?`default`:`ghost`,className:`h-6 px-2 text-[10px] capitalize gap-1.5`,onClick:()=>o(e),children:[(0,G.jsx)(`div`,{className:J(`h-1.5 w-1.5 rounded-full`,zs(e))}),e]},e))}),s.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-4 w-px bg-outline-variant/20`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 flex-wrap`,children:[s.map(e=>(0,G.jsx)(Y,{size:`sm`,variant:c.has(e)?`default`:`ghost`,className:`h-5 px-1.5 text-[10px]`,onClick:()=>l(e),children:e},e)),c.size>0&&(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-5 px-1.5 text-[10px] text-on-surface-variant`,onClick:u,children:`clear`})]})]})]})]})}var Q8={debug:`border-l-outline/30`,info:`border-l-primary/50`,warn:`border-l-secondary/70`,error:`border-l-tertiary/80`},$8={context:`text-primary/70`,hooks:`text-on-surface-variant/70`,agent:`text-secondary/80`,daemon:`text-on-surface-variant/60`,capture:`text-primary/60`,processor:`text-on-surface-variant/70`,lifecycle:`text-primary/50`,embedding:`text-on-surface-variant/60`,power:`text-on-surface-variant/50`,server:`text-on-surface-variant/60`};function e5(e,t){if(t)return pv(e);let n=new Date(e);return`${String(n.getHours()).padStart(2,`0`)}:${String(n.getMinutes()).padStart(2,`0`)}:${String(n.getSeconds()).padStart(2,`0`)}`}var t5=40,n5=60;function r5(e){return typeof e==`string`&&e.length>0?e:null}var i5=[{pick:e=>r5(e.tool_name)},{pick:e=>r5(e.type)},{pick:e=>r5(e.agent_type)},{pick:e=>r5(e.task_subject),format:e=>gv(e,t5)},{pick:e=>r5(e.filename)},{pick:e=>r5(e.source_path)??r5(e.path),format:vv},{pick:e=>r5(e.error),format:e=>gv(e,n5)},{pick:e=>typeof e.pid==`number`?`pid ${e.pid}`:null}];function a5(e){if(!e)return``;for(let{pick:t,format:n}of i5){let r=t(e);if(r)return n?n(r):r}return``}function o5({entries:e,selectedId:t,onSelect:n,autoScroll:r=!1,relativeTime:i=!1,compact:a=!0}){let o=(0,W.useRef)(null);return(0,W.useEffect)(()=>{!r||!o.current||(o.current.scrollTop=o.current.scrollHeight)},[e,r]),(0,G.jsx)(`div`,{ref:o,className:`flex-1 overflow-y-auto bg-surface-container-lowest font-mono text-xs`,children:e.length===0?(0,G.jsx)(`div`,{className:`flex h-full min-h-[200px] items-center justify-center text-on-surface-variant/50 font-sans text-sm`,children:`No log entries`}):(0,G.jsxs)(`table`,{className:`w-full border-collapse`,"aria-label":`Log entries`,children:[(0,G.jsx)(`thead`,{className:`sticky top-0 z-10 bg-surface-container-lowest/95 backdrop-blur supports-[backdrop-filter]:bg-surface-container-lowest/80`,children:(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/10 text-[10px] uppercase tracking-[0.16em] text-on-surface-variant/50`,children:[(0,G.jsx)(`th`,{className:`w-[68px] px-3 py-2 text-left font-medium`,children:`Time`}),(0,G.jsx)(`th`,{className:`w-[12px] px-0 py-2`,"aria-hidden":`true`}),(0,G.jsx)(`th`,{className:`w-[48px] px-0 py-2 text-left font-medium`,children:`Level`}),(0,G.jsx)(`th`,{className:`w-[90px] px-0 py-2 text-left font-medium`,children:`Area`}),(0,G.jsx)(`th`,{className:`w-[72px] px-0 py-2 text-left font-medium`,children:`Session`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Message`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsx)(s5,{entry:e,selected:e.id===t,onSelect:n,relativeTime:i,compact:a},e.id))})]})})}var s5=(0,W.memo)(function({entry:e,selected:t,onSelect:n,relativeTime:r,compact:i}){let a=i?`py-0.5`:`py-1.5`,o=_v(e.session_id),s=a5(e.data);return(0,G.jsxs)(`tr`,{className:J(`cursor-pointer transition-colors border-l-2`,Q8[e.level],t?`bg-primary/10`:`hover:bg-surface-container-high/30`),onClick:()=>n(e),children:[(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pl-3 pr-2 text-on-surface-variant/50 align-top w-[68px] tabular-nums`,a),children:e5(e.timestamp,r)}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-1 align-top w-[12px]`,a),children:(0,G.jsx)(`div`,{className:J(`h-1.5 w-1.5 rounded-full mt-1`,zs(e.level))})}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[48px]`,a),children:(0,G.jsx)(X,{variant:Rs(e.level),className:`px-1 py-0 text-[9px] uppercase`,children:e.level})}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[90px] truncate max-w-[90px]`,a,$8[e.component]??`text-on-surface-variant/60`),children:e.component}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[72px] tabular-nums text-on-surface-variant/40`,a),title:e.session_id??``,children:o}),(0,G.jsxs)(`td`,{className:J(`pr-3 text-on-surface align-top break-words`,a),children:[(0,G.jsx)(`span`,{children:e.message}),s&&(0,G.jsxs)(`span`,{className:`ml-2 text-on-surface-variant/50`,children:[`· `,s]})]})]})});function c5({value:e}){let t=String(e),n=t.slice(0,8);return(0,G.jsxs)(ri,{to:`/sessions/${t}`,className:`font-mono text-primary hover:underline`,children:[n,`...`]})}function l5({value:e}){return Array.isArray(e)?(0,G.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.map((e,t)=>(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:String(e)},t))}):(0,G.jsx)(`span`,{children:String(e)})}function u5({value:e}){return Array.isArray(e)?(0,G.jsx)(`span`,{className:`flex gap-1`,children:e.map((e,t)=>(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0 tabular-nums`,children:String(e)},t))}):(0,G.jsx)(`span`,{children:String(e)})}function d5({value:e}){return(0,G.jsx)(`span`,{className:`rounded bg-tertiary/10 px-2 py-0.5 text-tertiary font-mono text-[11px]`,children:String(e)})}function f5({value:e}){return(0,G.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded bg-surface-container-lowest px-2 py-1 text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap`,children:String(e)})}function p5({value:e}){let t=new Date(String(e)),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24),o;return o=r<1?`just now`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${a}d ago`,(0,G.jsx)(`span`,{className:`tabular-nums`,title:t.toISOString(),children:o})}function m5({value:e}){return typeof e==`object`&&e?(0,G.jsx)(`pre`,{className:`text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap`,children:JSON.stringify(e,null,2)}):(0,G.jsx)(`span`,{children:String(e)})}var h5={session_id:c5,spore_titles:l5,scores:u5,error:d5,preview:f5,generated_at:p5,text:f5},g5=new Set([`id`,`timestamp`,`level`,`kind`,`component`,`message`]);function _5(e,t){return(0,G.jsx)(h5[e]??m5,{value:t})}function v5(e){return g5.has(e)}function y5(e){return e?Object.entries(e).filter(([e])=>!v5(e)):[]}var b5={debug:`text-on-surface-variant/60`,info:`text-primary`,warn:`text-secondary`,error:`text-tertiary`};function x5({entry:e,resolved:t,onClose:n}){let r=y5(e.data);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col bg-surface-container-low`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-mono`,children:e.kind}),(0,G.jsx)(`span`,{className:J(`text-xs font-medium`,b5[e.level]),children:e.level.toUpperCase()})]}),(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0`,onClick:n,"aria-label":`Close detail panel`,children:(0,G.jsx)(So,{className:`h-3.5 w-3.5`})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-3 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Timestamp`}),(0,G.jsx)(`div`,{className:`font-mono text-xs tabular-nums`,children:new Date(e.timestamp).toLocaleString()})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Message`}),(0,G.jsx)(`div`,{className:`text-sm text-on-surface leading-relaxed`,children:e.message})]}),e.session_id&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Session`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[_5(`session_id`,e.session_id),!!t?.session_title&&(0,G.jsx)(`span`,{className:`text-on-surface-variant/70`,children:String(t.session_title)})]})]}),r.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-1.5`,children:`Metadata`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:r.map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] text-on-surface-variant/40 mb-0.5`,children:e}),(0,G.jsx)(`div`,{className:`text-xs`,children:_5(e,t)})]},e))})]})]}),(0,G.jsx)(`div`,{className:`px-4 py-2 border-t border-outline-variant/10`,children:(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/40 tabular-nums`,children:[`id: `,e.id]})})]})}var S5=5e3;function C5(e=!1){let[t,n]=(0,W.useState)([]),r=(0,W.useRef)(null),{data:i,refetch:a}=As({queryKey:[`logs-stream`],queryFn:({signal:e})=>q(r.current===null?`/logs/stream`:`/logs/stream?since=${r.current}`,{signal:e}),pollCategory:`realtime`,refetchInterval:e?!1:js.LOGS,contextFree:!0}),o=(0,W.useRef)(e);return(0,W.useEffect)(()=>{o.current&&!e&&a(),o.current=e},[e,a]),(0,W.useEffect)(()=>{if(!i?.entries.length){i&&r.current===null&&(r.current=i.cursor);return}r.current=i.cursor,n(e=>{let t=[...e,...i.entries];return t.length>S5?t.slice(-5e3):t})},[i]),{entries:t,clear:(0,W.useCallback)(()=>{n([]),r.current=null},[])}}function w5(e,t){let n=new URLSearchParams;return e.q&&n.set(`q`,e.q),e.level&&n.set(`level`,e.level),e.component&&n.set(`component`,e.component),e.kind&&n.set(`kind`,e.kind),e.session_id&&n.set(`session_id`,e.session_id),e.from&&n.set(`from`,e.from),e.to&&n.set(`to`,e.to),e.page&&n.set(`page`,String(e.page)),e.page_size&&n.set(`page_size`,String(e.page_size)),ot({queryKey:[`logs-search`,Object.fromEntries(n)],queryFn:({signal:e})=>q(`/logs/search?${n.toString()}`,{signal:e}),enabled:t})}function T5(e){return ot({queryKey:[`log-detail`,e],queryFn:({signal:t})=>q(`/logs/${e}`,{signal:t}),enabled:e!==null})}function E5(e){return new Date(Date.now()-({"15m":15*6e4,"1h":60*6e4,"6h":360*6e4,"24h":1440*6e4,"7d":10080*6e4,"30d":720*60*6e4}[e]??1440*6e4)).toISOString()}function D5(){let e=(0,W.useMemo)(()=>{let e=new URLSearchParams(window.location.search),t=e.get(`component`)?.split(`,`).filter(Boolean)??[],n=e.get(`level`),r=e.get(`q`)??``;return{components:t,level:n,q:r,hasFilters:t.length>0||!!n||!!r}},[]),[t,n]=(0,W.useState)(e.hasFilters?`search`:`live`),[r,i]=(0,W.useState)(e.q),[a,o]=(0,W.useState)(e.q),[s,c]=(0,W.useState)(e.level??`debug`),[l,u]=(0,W.useState)(new Set(e.components)),[d,f]=(0,W.useState)(`24h`),[p,m]=(0,W.useState)(1),[h,g]=(0,W.useState)(null),[_,v]=(0,W.useState)(!1),{entries:y,clear:b}=C5(_),{data:x}=w5((0,W.useMemo)(()=>({q:a||void 0,level:s===`debug`?void 0:s,component:l.size>0?Array.from(l).join(`,`):void 0,from:E5(d),page:p,page_size:50}),[a,s,l,d,p]),t===`search`),{data:S}=T5(h?.id??null),[C,w]=(0,W.useState)(e.components);(0,W.useEffect)(()=>{let e=t===`live`?y:x?.entries??[];w(t=>{let n=new Set(t),r=!1;for(let t of e)n.has(t.component)||(n.add(t.component),r=!0);return r?Array.from(n).sort():t})},[y,x,t]);let T=(0,W.useMemo)(()=>{let e=Fs[s]??0,t=r.trim().toLowerCase();return y.filter(n=>!((Fs[n.level]??0)<e||l.size>0&&!l.has(n.component)||t&&!n.message.toLowerCase().includes(t)))},[y,s,l,r]),E=t===`live`?T:x?.entries??[],D=(0,W.useCallback)(e=>{n(e),g(null),e===`live`&&(b(),v(!1))},[b]),O=(0,W.useCallback)(()=>{o(r),m(1)},[r]),k=(0,W.useCallback)(e=>{g(t=>t?.id===e.id?null:e)},[]),A=(0,W.useCallback)(e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),m(1)},[]),j=(0,W.useCallback)(e=>{c(e),m(1)},[]),M=h!==null;return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsx)(`div`,{className:`px-6 pt-6`,children:(0,G.jsx)(yP,{title:`Logs`,subtitle:`Daemon log explorer`})}),(0,G.jsx)(`div`,{className:`px-6 mb-3`,children:(0,G.jsx)(Z8,{mode:t,onModeChange:D,searchValue:r,onSearchChange:i,onSearchSubmit:O,activeLevel:s,onLevelChange:j,components:C,activeComponents:l,onComponentToggle:A,onComponentsClear:()=>{u(new Set),m(1)},timeRange:d,onTimeRangeChange:e=>{f(e),m(1)},totalResults:t===`search`?x?.total:void 0,paused:_,onPausedToggle:()=>v(e=>!e)})}),(0,G.jsx)(`div`,{className:`flex flex-1 overflow-hidden mx-6 mb-6 rounded-lg border border-outline-variant/10`,children:(0,G.jsxs)(`div`,{className:`flex flex-col w-full`,children:[(0,G.jsx)(o5,{entries:E,selectedId:h?.id??null,onSelect:k,autoScroll:t===`live`&&!_,relativeTime:t===`live`,compact:!0}),t===`search`&&x&&(0,G.jsx)(`div`,{className:`border-t border-outline-variant/10 px-3 py-2 bg-surface-container-low`,children:(0,G.jsx)(jM,{total:x.total,offset:(p-1)*50,limit:50,onPageChange:e=>m(Math.floor(e/50)+1)})})]})}),(0,G.jsx)(KP,{open:M&&!!h,onClose:()=>g(null),ariaLabel:`Log entry detail`,children:h&&(0,G.jsx)(x5,{entry:h,resolved:S?.resolved,onClose:()=>g(null)})})]})}function O5({title:e,scope:t,meta:n,loading:r,error:i,empty:a,emptyText:o,children:s}){let c=(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ZM,{children:e}),t&&(0,G.jsx)(Ok,{scope:t})]});return r?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading…`})]}):i?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsxs)(`p`,{className:`font-sans text-sm text-tertiary`,children:[`Failed to load: `,i.message]})]}):a?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:o})]}):(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[c,n]}),t&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:d6[t]}),s]})}function k5({primary:e,meta:t}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-3 rounded-md bg-surface-container-low/40 p-3`,children:[(0,G.jsx)(`div`,{className:`min-w-0 space-y-1`,children:e}),(0,G.jsx)(`div`,{className:`flex flex-col items-end gap-0.5 text-right font-sans text-xs`,children:t})]})}function A5(e,t){if(!e)return!0;let n=Date.parse(e);return Number.isFinite(n)?Date.now()-n>t*60*60*1e3:!0}function j5(e){let{flags:t}=e;return t.error_count>0||t.integrity_issues>0?{label:`Issues detected`,icon:oo,tone:`error`}:t.backup_overdue>0||t.optimize_overdue>0?{label:`Maintenance overdue`,icon:ra,tone:`warn`}:{label:`All Groves healthy`,icon:oa,tone:`ok`}}function M5({row:e,thresholds:t}){let n=!e.error&&A5(e.last_backup_at,t.backup_overdue_hours),r=!e.error&&A5(e.last_optimize_at,t.optimize_overdue_hours),i=e.last_integrity_check?.status===`issues`;return(0,G.jsx)(k5,{primary:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface truncate`,children:e.grove.name}),(0,G.jsx)(X,{variant:`outline`,className:`px-1.5 py-0 text-[10px] uppercase`,children:e.grove.mode}),e.error&&(0,G.jsx)(X,{variant:`outline`,className:`border-tertiary px-1.5 py-0 text-[10px] uppercase text-tertiary`,children:`error`})]}),e.error?(0,G.jsx)(`p`,{className:`font-sans text-xs text-tertiary truncate`,title:e.error,children:e.error}):(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[e.project_count,` project`,e.project_count===1?``:`s`,` · `,Tv(e.db_size_bytes),e.embedding_pending===null?(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsx)(`span`,{className:`text-tertiary`,children:`embedding signal unavailable`})]}):e.embedding_pending>0?(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.embedding_pending,` pending`]})]}):null]})]}),meta:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,n&&`text-secondary`),children:[`backup: `,e.last_backup_at?pv(e.last_backup_at):`never`]}),(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,r&&`text-secondary`),children:[`optimize: `,e.last_optimize_at?pv(e.last_optimize_at):`never`]}),(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,i&&`text-tertiary`),children:[`integrity:`,` `,e.last_integrity_check?`${e.last_integrity_check.status} · ${pv(e.last_integrity_check.at)}`:`never`]})]})})}function N5(){let{data:e,isLoading:t,isError:n,error:r}=sv(),i=n?r instanceof Error?r:Error(`unknown error`):null,a=e?j5(e):null,o=a?.icon;return(0,G.jsx)(O5,{title:`Groves Overview`,scope:`all-groves`,loading:t,error:i,empty:!!e&&e.groves.length===0,emptyText:`No Groves are registered yet.`,meta:a&&o&&(0,G.jsxs)(`div`,{className:J(`flex items-center gap-1.5 font-sans text-xs`,a.tone===`ok`&&`text-primary`,a.tone===`warn`&&`text-secondary`,a.tone===`error`&&`text-tertiary`),children:[(0,G.jsx)(o,{className:`h-3.5 w-3.5`}),a.label]}),children:e&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 font-sans text-xs`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(ha,{className:`h-3.5 w-3.5 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Groves`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:e.groves.length})]}),e.flags.backup_overdue>0&&(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.flags.backup_overdue,` backup overdue`]}),e.flags.optimize_overdue>0&&(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.flags.optimize_overdue,` optimize overdue`]}),e.flags.integrity_issues>0&&(0,G.jsxs)(`span`,{className:`text-tertiary`,children:[e.flags.integrity_issues,` integrity issue`,e.flags.integrity_issues===1?``:`s`]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:e.groves.map(t=>(0,G.jsx)(M5,{row:t,thresholds:e.thresholds},t.grove.id))})]})})}function P5({row:e}){return(0,G.jsx)(k5,{primary:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface truncate`,children:e.project_name}),(0,G.jsx)(X,{variant:`outline`,className:J(`px-1.5 py-0 text-[10px] uppercase`,e.is_active?`border-primary text-primary`:`border-on-surface-variant text-on-surface-variant`),children:e.is_active?`active`:`cold`})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant truncate`,title:e.project_root,children:e.project_root})]}),meta:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[`last activity: `,e.last_activity_at?pv(e.last_activity_at):`never`]}),(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[e.scheduled_runs_last_24h,` run`,e.scheduled_runs_last_24h===1?``:`s`,` / 24h`]})]})})}function F5(){let{data:e,isLoading:t,isError:n,error:r}=cv(),i=n?r instanceof Error?r:Error(`unknown error`):null,a=e?.projects.filter(e=>e.is_active).length??0,o=(e?.projects.length??0)-a;return(0,G.jsx)(O5,{title:`Project Activity`,scope:`all-groves`,loading:t,error:i,empty:!!e&&e.projects.length===0,emptyText:`No projects are registered yet.`,meta:e&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(Gi,{className:`h-3.5 w-3.5`}),`window: `,e.active_window_days,`d`]}),children:e&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 font-sans text-xs`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Active`}),(0,G.jsx)(`span`,{className:`font-mono text-primary`,children:a})]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Cold`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface-variant`,children:o})]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:e.projects.map(e=>(0,G.jsx)(P5,{row:e},`${e.grove_id}:${e.project_id}`))}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Cold projects skip scheduled agent tasks. Configure the window in Settings under `,(0,G.jsx)(`span`,{className:`font-mono`,children:`agent.cold_project_threshold_days`}),`.`]})]})})}function I5(e){if(!Number.isFinite(e)||e<=0)return`—`;let t=Math.floor(e);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<48?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function L5(){let{data:e}=Bs();if(!e)return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ro,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(ZM,{children:`Daemon`})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading…`})]});let{pid:t,port:n,version:r,uptime_seconds:i,active_sessions:a}=e.daemon;return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ro,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(ZM,{children:`Daemon`})]}),(0,G.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-3`,children:[(0,G.jsx)(R5,{label:`PID`,value:String(t),mono:!0}),(0,G.jsx)(R5,{label:`Running port`,value:String(n),mono:!0}),(0,G.jsx)(R5,{label:`Version`,value:r,mono:!0}),(0,G.jsx)(R5,{label:`Uptime`,value:I5(i)}),(0,G.jsx)(R5,{label:`Active sessions`,value:String(a.length)})]})]})}function R5({label:e,value:t,mono:n=!1}){return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`font-sans text-[11px] uppercase tracking-wider text-on-surface-variant`,children:e}),(0,G.jsx)(`dd`,{className:J(`mt-0.5 text-sm text-on-surface`,n&&`font-mono`),children:t})]})}function z5(){return(0,G.jsxs)(zj,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(ma,{className:`h-5 w-5 text-primary`}),(0,G.jsx)(yP,{title:`Machine`,subtitle:`Status of the Myco daemon and every Grove on this machine.`,className:`flex-1 pb-0`})]}),(0,G.jsx)(L5,{}),(0,G.jsx)(N5,{}),(0,G.jsx)(F5,{})]})}function B5({label:e,value:t,mono:n=!0}){let[r,i]=(0,W.useState)(`idle`),a=(0,W.useRef)(null),o=(0,W.useCallback)(()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},[]);(0,W.useEffect)(()=>o,[o]);let s=(0,W.useCallback)(()=>{o(),navigator.clipboard.writeText(t).then(()=>{i(`copied`),a.current=setTimeout(()=>i(`idle`),2e3)},()=>{i(`failed`),a.current=setTimeout(()=>i(`idle`),2e3)})},[t,o]);return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:e}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,children:[(0,G.jsx)(`span`,{className:`text-sm text-on-surface break-all ${n?`font-mono`:``}`,children:t}),(0,G.jsxs)(`button`,{type:`button`,onClick:s,className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 transition-opacity`,title:r===`failed`?`Copy failed — check clipboard permissions`:`Copy to clipboard`,"aria-live":`polite`,children:[r===`copied`&&(0,G.jsx)(Qi,{className:`h-3.5 w-3.5 text-primary`}),r===`failed`&&(0,G.jsx)(So,{className:`h-3.5 w-3.5 text-error`}),r===`idle`&&(0,G.jsx)(pa,{className:`h-3.5 w-3.5`})]})]})]})}function V5({team:e,onLeave:t,leaving:n}){let r=e.projects.length,i=`myco-team update --team-id ${e.team_id} --observability`;return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-[var(--ghost-border)] px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface`,children:e.name}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface-variant break-all`,children:e.worker_url}),e.has_deployment&&(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(B5,{label:`Update command`,value:i})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-2 shrink-0`,children:[(0,G.jsxs)(X,{variant:`outline`,children:[r,` project`,r===1?``:`s`]}),(0,G.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>t(e),className:`text-xs text-on-surface-variant hover:text-terracotta-text transition-colors disabled:opacity-50`,children:`Leave team`})]})]})}function H5({project:e,teams:t,disabled:n,onChange:r}){let i=e.team_id??``;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-[var(--ghost-border)] px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface truncate`,children:e.project_name}),(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant truncate`,children:e.grove_name})]}),(0,G.jsxs)(`select`,{className:`shrink-0 rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 disabled:opacity-50`,value:i,disabled:n,"aria-label":`Team for ${e.project_name}`,onChange:e=>r(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`Not synced`}),t.map(e=>(0,G.jsx)(`option`,{value:e.team_id,children:e.name},e.team_id))]})]})}function U5(){let{data:e,isLoading:t}=c8(),{data:n,isLoading:r}=l8(),i=u8(),a=d8(),o=f8(),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(``),[p,m]=(0,W.useState)(``),[h,g]=(0,W.useState)(null),_=e?.teams??[],v=n?.projects??[],y=i.isPending,b=async()=>{g(null);try{await a.mutateAsync({worker_url:d.trim(),team_key:p.trim()}),f(``),m(``)}catch(e){g(e instanceof Error?e.message:String(e))}},x=async e=>{let t=e.has_deployment?`Leave "${e.name}"? This removes it from this machine only — the worker keeps running. Use "myco-team destroy" to delete the worker.`:`Leave "${e.name}"? This removes it from this machine and stops syncing your projects to it.`;if(window.confirm(t)){u(null),c(e.team_id);try{await o.mutateAsync({team_id:e.team_id})}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(null)}}},S=async(e,t)=>{let n=e.team_id??``;if(t!==n){u(null);try{n&&await i.mutateAsync({team_id:n,grove_id:e.grove_id,project_id:e.project_id,action:`remove`}),t!==``&&await i.mutateAsync({team_id:t,grove_id:e.grove_id,project_id:e.project_id,action:`add`})}catch(e){u(e instanceof Error?e.message:String(e))}}};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:Ga,children:`Teams`}),title:`Registered teams`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 mb-4`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Join a team a teammate shared with you. Paste the Worker URL and Team key — no extra install required.`}),(0,G.jsx)(`label`,{className:`myco-eyebrow-sm text-on-surface-variant`,htmlFor:`join-worker-url`,children:`Worker URL`}),(0,G.jsx)(`input`,{id:`join-worker-url`,"aria-label":`Worker URL`,className:`rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface`,value:d,onChange:e=>f(e.target.value),placeholder:`https://team.example.workers.dev`}),(0,G.jsx)(`label`,{className:`myco-eyebrow-sm text-on-surface-variant`,htmlFor:`join-team-key`,children:`Team key`}),(0,G.jsx)(`input`,{id:`join-team-key`,"aria-label":`Team key`,type:`password`,className:`rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface`,value:p,onChange:e=>m(e.target.value)}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{size:`sm`,disabled:a.isPending||!d.trim()||!p.trim(),onClick:b,children:a.isPending?`Joining…`:`Join team`})}),h&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0`,"data-testid":`team-join-error`,children:h})]}),t&&_.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Loading teams…`}):_.length===0?(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:[`No teams yet. An operator provisions one with `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team install`}),`, or join one a teammate shared with you using the form above.`]}):(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:_.map(e=>(0,G.jsx)(V5,{team:e,onLeave:x,leaving:s===e.team_id},e.team_id))})]}),(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:Oa,children:`Projects`}),title:`Assign projects to a team`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mb-3`,children:`Choose which team each project syncs to. Moving a project removes it from its current team before adding it to the new one.`}),r&&v.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Loading projects…`}):v.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`No projects`}),(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`No projects are registered with this daemon yet.`})]}):(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:v.map(e=>(0,G.jsx)(H5,{project:e,teams:_,disabled:y,onChange:t=>S(e,t)},`${e.grove_id}:${e.project_id}`))}),l&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0 mt-3`,"data-testid":`team-selection-error`,children:l})]})]})}var W5=16;function G5(e){return e.length<W5?`•`.repeat(Math.max(8,e.length)):`${e.slice(0,8)}${`•`.repeat(e.length-12)}${e.slice(-4)}`}function K5({label:e,value:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(`idle`),o=(0,W.useRef)(null),s=(0,W.useCallback)(()=>{o.current!==null&&(clearTimeout(o.current),o.current=null)},[]);(0,W.useEffect)(()=>s,[s]);let c=(0,W.useCallback)(()=>{s(),navigator.clipboard.writeText(t).then(()=>{a(`copied`),o.current=setTimeout(()=>a(`idle`),2e3)},()=>{a(`failed`),o.current=setTimeout(()=>a(`idle`),2e3)})},[t,s]),l=G5(t);return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:e}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,children:[(0,G.jsx)(`span`,{className:`text-sm text-on-surface font-mono break-all`,children:n?t:l}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface transition-opacity`,title:n?`Hide`:`Reveal`,children:n?(0,G.jsx)(ya,{className:`h-3.5 w-3.5`}):(0,G.jsx)(ba,{className:`h-3.5 w-3.5`})}),(0,G.jsxs)(`button`,{type:`button`,onClick:c,className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 transition-opacity`,title:i===`failed`?`Copy failed — check clipboard permissions`:`Copy to clipboard`,"aria-live":`polite`,children:[i===`copied`&&(0,G.jsx)(Qi,{className:`h-3.5 w-3.5 text-primary`}),i===`failed`&&(0,G.jsx)(So,{className:`h-3.5 w-3.5 text-error`}),i===`idle`&&(0,G.jsx)(pa,{className:`h-3.5 w-3.5`})]})]})]})}function q5({status:e}){let t=We(),[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:Na,children:`Team Credentials`}),title:`Worker credentials`,actions:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!0,title:`Coming soon`,children:[(0,G.jsx)(Qa,{className:`h-3.5 w-3.5 mr-1.5`}),`Rotate team key`]}),children:[(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0 mb-3`,children:[`These credentials belong to the registered Team worker for`,` `,(0,G.jsx)(`span`,{className:`text-on-surface font-medium`,children:e.grove?.name??`this Grove`}),`. Keep the Team key private because it authorizes writes to the worker.`,` `,`Share the Worker URL and Team key out-of-band with a teammate so they can `,(0,G.jsx)(`span`,{className:`text-on-surface font-medium`,children:`Join`}),` this team on their Teams tab.`]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.worker_url&&(0,G.jsx)(B5,{label:`Worker URL`,value:e.worker_url}),e.team_key&&(0,G.jsx)(K5,{label:`Team key`,value:e.team_key})]})]}),e.mcp_token&&e.mcp_endpoint&&(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:da,children:`Cloud MCP endpoint`}),title:`For cloud agents`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(X,{variant:e.mcp_healthy?`default`:`destructive`,children:e.mcp_healthy?`healthy`:`unhealthy`}),(0,G.jsxs)(`button`,{onClick:()=>s(!0),className:`text-xs text-on-surface-variant hover:text-terracotta-text transition-colors inline-flex items-center gap-1`,children:[(0,G.jsx)(Qa,{className:`h-3.5 w-3.5`}),`Rotate token`]})]}),children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mb-3`,children:`Configure cloud agents with this endpoint to access Grove team intelligence.`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(B5,{label:`MCP URL`,value:e.mcp_endpoint}),(0,G.jsx)(K5,{label:`MCP Access Token`,value:e.mcp_token})]}),(0,G.jsxs)(`div`,{className:`text-xs mt-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(!i),className:`myco-eyebrow-sm text-on-surface-variant cursor-pointer hover:text-on-surface transition-colors`,children:i?`Hide snippet`:`Config snippet`}),i&&(()=>{let t=JSON.stringify({mcp_servers:[{type:`url`,url:e.mcp_endpoint,name:`myco`,authorization_token:e.mcp_token}]},null,2);return(0,G.jsxs)(`div`,{className:`relative mt-2`,children:[(0,G.jsx)(`pre`,{className:`text-xs bg-surface-container p-3 rounded-lg overflow-x-auto text-on-surface-variant`,children:t}),(0,G.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(t),className:`absolute top-2 right-2 p-1 rounded hover:bg-surface-container-high transition-colors`,children:(0,G.jsx)(pa,{className:`h-3.5 w-3.5 text-on-surface-variant`})})]})})()]})]}),(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:mo,children:`This node`}),title:`Identity of this machine in the team`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Machine ID`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.machine_id})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Package version`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.package_version})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Protocol version`}),(0,G.jsxs)(`code`,{className:`text-xs font-mono text-on-surface`,children:[`v`,e.sync_protocol_version]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Schema version`}),(0,G.jsxs)(`code`,{className:`text-xs font-mono text-on-surface`,children:[`v`,e.schema_version]})]})]}),e.health_error&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0 mt-3`,children:e.health_error})]}),(0,G.jsx)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:Ga,children:`Collective`}),title:`Cross-team coordination`,actions:(0,G.jsx)(X,{variant:e.collective_connected?`default`:`outline`,children:e.collective_connected?`connected`:`not connected`}),children:e.collective_connected?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e.collective_url&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`URL`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.collective_url})]}),e.collective_project_id&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Project ID`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.collective_project_id})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Last settings sync`}),(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface m-0`,children:e.collective_last_settings_sync?new Date(e.collective_last_settings_sync*1e3).toLocaleString():`Never`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Last heartbeat`}),(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface m-0`,children:e.collective_last_heartbeat?new Date(e.collective_last_heartbeat*1e3).toLocaleString():`Never`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Capabilities`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.collective_capabilities.map(e=>(0,G.jsx)(X,{variant:`outline`,children:e},e))})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Effective overrides`}),(0,G.jsx)(`pre`,{className:`text-xs bg-surface-container p-3 rounded-lg overflow-x-auto text-on-surface-variant`,children:JSON.stringify(e.collective_settings,null,2)})]})]}):(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`This team worker is not currently connected to a Myco Collective.`})}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:async()=>{r(!0),p(null);try{await os(`/team/disconnect`),t.invalidateQueries({queryKey:[`team-status`]})}catch(e){p(e instanceof Error?e.message:String(e))}finally{r(!1)}},disabled:n,children:n?`Disconnecting...`:`Disconnect`})}),(0,G.jsx)(AM,{open:o,onOpenChange:s,title:`Rotate MCP Access Token`,description:`This will invalidate the current MCP token. Any cloud agents using it will lose access until reconfigured with the new token.`,confirmLabel:`Rotate Token`,variant:`destructive`,isPending:c,onConfirm:async()=>{l(!0),d(null);try{await os(`/team/rotate-mcp-token`),t.invalidateQueries({queryKey:[`team-status`]}),s(!1)}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(!1)}},errorMessage:u}),f&&(0,G.jsxs)(`p`,{className:`text-sm text-terracotta text-right m-0`,"data-testid":`team-disconnect-error`,children:[`Disconnect failed: `,f]})]})}var J5={sage:`bg-primary/10 text-primary`,ochre:`bg-secondary/10 text-secondary`,terracotta:`bg-tertiary/10 text-tertiary`,outline:`bg-surface-container text-on-surface-variant`};function Y5({label:e,value:t,tone:n,pulse:r,sub:i}){return(0,G.jsxs)(`div`,{className:J(`flex flex-col gap-1 rounded-md p-3`,J5[n]),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-wider`,children:[(0,G.jsx)(`span`,{className:J(`h-2 w-2 rounded-full bg-current`,r&&`animate-pulse`)}),e]}),(0,G.jsx)(`div`,{className:`font-mono text-2xl tabular-nums`,children:t}),i?(0,G.jsx)(`div`,{className:`text-[10px] text-on-surface-variant`,children:i}):null]})}function X5({title:e,actions:t,children:n}){return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:`Sync`,title:e,actions:t,children:n})}function Z5(e){return typeof e==`number`&&Number.isFinite(e)?e.toLocaleString():`—`}function Q5(e){if(!e)return`Never`;let t=new Date(e);return Number.isNaN(t.getTime())?`Never`:t.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`})}function $5(e){return e.replace(/_/g,` `)}function e7(e){return e===0?`0`:e>0?`+${e.toLocaleString()}`:e.toLocaleString()}function t7(e,t){return t===void 0?`—`:e7(t-e)}function n7({remote:e}){if(!e)return(0,G.jsx)(G2,{label:`Vectors`,value:`—`,accent:`outline`});if(!e.vector_index_healthy)return(0,G.jsx)(G2,{label:`Vectors`,value:`error`,sublabel:e.vector_index_error??`index unavailable`,accent:`terracotta`});let t=e.vector_count??0,n=e.embeddable_count,r=Z5(t);if(n==null)return(0,G.jsx)(G2,{label:`Vectors`,value:r,accent:`sage`});let i=n+Math.ceil(n*.1);if(t>=n&&t<=i)return(0,G.jsx)(G2,{label:`Vectors`,value:r,sublabel:`indexed (target ${Z5(n)})`,accent:`sage`});if(t>i)return(0,G.jsx)(G2,{label:`Vectors`,value:r,sublabel:`+${Z5(t-n)} stale vs target ${Z5(n)}`,accent:`ochre`});let a=n-t,o=n>0&&t<Math.max(1,n*.05);return(0,G.jsx)(G2,{label:`Vectors`,value:r,sublabel:o?`index empty — run reindex (target ${Z5(n)})`:`${Z5(a)} missing of ${Z5(n)}`,accent:o?`terracotta`:`ochre`})}function r7({rows:e}){return(0,G.jsx)(`div`,{className:`overflow-hidden rounded-md border border-outline-variant/10`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{className:`bg-surface-container/40 text-xs uppercase text-outline`,children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-mono`,children:`Table`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Local`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Cloud`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Δ`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsxs)(`tr`,{className:e.delta===0?`border-t border-outline-variant/10`:`border-t border-outline-variant/10 bg-terracotta/[0.04]`,children:[(0,G.jsx)(`td`,{className:`px-3 py-2 text-on-surface`,children:$5(e.table)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums text-on-surface`,children:Z5(e.local)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums text-on-surface`,children:Z5(e.cloud)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums ${e.delta===0?`text-on-surface-variant`:`text-terracotta`}`,children:e7(e.delta)})]},e.table))})]})})}function i7({message:e,onAction:t,busy:n}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2 border-b border-outline-variant/10 last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-on-surface font-mono truncate`,children:[e.table_name,` / `,e.row_id]}),(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant truncate`,children:[`machine=`,e.machine_id,` op=`,e.operation,e.reason?` · ${e.reason}`:``]}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant/60`,children:new Date(e.created_at*1e3).toLocaleString()})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:n,onClick:()=>t(`retry`,e.lease_id),children:`Retry`}),(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:n,onClick:()=>t(`discard`,e.lease_id),children:`Discard`})]})]})}function a7({status:e,teamId:t}){let n=We(),r=e.enabled&&e.healthy,{data:i,isLoading:a,isFetching:o,refetch:s}=a8(r,t),{data:c,isLoading:l,isFetching:u,refetch:d}=o8(r,t),{data:f}=Bs(),p=r,{data:m,isLoading:h,isFetching:g,refetch:_}=s8(p,t),[v,y]=(0,W.useState)(!1),[b,x]=(0,W.useState)(null),[S,C]=(0,W.useState)(!1),[w,T]=(0,W.useState)(null),[E,D]=(0,W.useState)(!1),[O,k]=(0,W.useState)(null),A=!r||!a&&!i,j=a||p&&h,M=!r||!j&&p&&!m,N=`Team connection is unhealthy.`,P=o||u||g,F=(0,W.useCallback)(()=>{s(),d(),_()},[s,d,_]),I=(0,W.useCallback)(async()=>{C(!0),T(null);try{let e=await os(`/team/backfill`,{mode:`all`}),t=e.vector_error?`; vector reindex failed: ${e.vector_error}`:e.vector_enqueued?` and queued ${Z5(e.vector_enqueued)} vectors for reindex`:``;e.flush_error?T(`Backfilled ${e.enqueued} records, but sync failed: ${e.flush_error}`):e.enqueued>0||(e.flushed??0)>0?T(`Backfilled ${Z5(e.enqueued)} records and handed off ${Z5(e.flushed)} in ${e.batches??0} batches${t}.`):e.vector_enqueued?T(`No eligible Grove records found${t}.`):T(`No eligible Grove records found.`),n.invalidateQueries({queryKey:[`team-status`]}),n.invalidateQueries({queryKey:[`team-sync-summary`]}),n.invalidateQueries({queryKey:[`team-queue-stats`]}),n.invalidateQueries({queryKey:[`team-dlq`]})}catch{T(`Backfill failed.`)}finally{C(!1)}},[n]),L=(0,W.useCallback)(async(e,t)=>{y(!0),x(null);try{let r=await os(`/team/dlq/${e}`,{lease_ids:[t]});x(((e===`retry`?r.retried:r.discarded)??0)>0?`${e===`retry`?`Retried`:`Discarded`} 1 message.`:`${e===`retry`?`Retry`:`Discard`} returned 0 — lease may have expired. Refresh and try again.`),await Promise.all([n.refetchQueries({queryKey:[`team-dlq`]}),n.refetchQueries({queryKey:[`team-queue-stats`]}),n.refetchQueries({queryKey:[`team-sync-summary`]})])}catch(t){x(`${e} failed: ${t instanceof Error?t.message:String(t)}`)}finally{y(!1)}},[n]),R=(0,W.useCallback)(async()=>{if(!(!m||m.messages.length===0)){y(!0),x(null);try{x(`Retried ${(await os(`/team/dlq/retry`,{lease_ids:m.messages.map(e=>e.lease_id)})).retried??0} of ${m.messages.length} messages.`),await Promise.all([n.refetchQueries({queryKey:[`team-dlq`]}),n.refetchQueries({queryKey:[`team-queue-stats`]}),n.refetchQueries({queryKey:[`team-sync-summary`]})])}catch(e){x(`Retry failed: ${e instanceof Error?e.message:String(e)}`)}finally{y(!1)}}},[m,n]),ee=(0,W.useCallback)(async()=>{D(!0),k(null);try{let e=await os(`/team/rebuild`);e.error?k(`Rebuild failed: ${e.error}`):k(`Rebuilt: handed off ${Z5(e.handedOff)} records in ${e.batches} batch${e.batches===1?``:`es`}.`),n.invalidateQueries({queryKey:[`team-status`]}),n.invalidateQueries({queryKey:[`team-sync-summary`]}),n.invalidateQueries({queryKey:[`team-queue-stats`]}),n.invalidateQueries({queryKey:[`team-dlq`]})}catch(e){k(`Rebuild failed: ${e instanceof Error?e.message:String(e)}`)}finally{D(!1)}},[n]),z=m?.messages??[],B=c?.remote_machine_total??null,V=c?.local.total_records??null;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,G.jsx)(V0,{intervalMs:r?js.TEAM:void 0,isFetching:P,onManualRefresh:F})}),(0,G.jsx)(X5,{title:`Remote store`,actions:c?.remote?e.worker_update_available?(0,G.jsxs)(X,{variant:`outline`,title:`Update available — deployed v${e.deployed_worker_version}, v${e.local_team_package_version} ready. Contact admin to update.`,children:[`v`,c.remote.package_version]}):(0,G.jsxs)(X,{variant:`default`,children:[`v`,c.remote.package_version]}):null,children:l&&!c?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):c?.remote_error?(0,G.jsx)(`p`,{className:`text-sm text-terracotta break-words m-0`,children:c.remote_error}):c?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,G.jsx)(G2,{label:`Local records`,value:Z5(V),sublabel:`this machine`,accent:`outline`}),(0,G.jsx)(G2,{label:`Remote records`,value:Z5(B),sublabel:`this machine`,accent:`outline`}),(0,G.jsx)(G2,{label:`Delta`,value:B===null||V===null?`—`:t7(V,B),accent:B!==null&&V!==null&&B!==V?`ochre`:`outline`}),(0,G.jsx)(n7,{remote:c.remote,localEmbedded:f?.embedding.embedded_count??null})]}),c.drift&&c.drift.length>0?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Local vs cloud (this machine)`}),(0,G.jsx)(r7,{rows:c.drift})]}):c.total_delta===0?(0,G.jsx)(`p`,{className:`text-xs text-sage m-0`,children:`In sync`}):null,(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`Last synced `,Q5(c.last_handoff?.completed_at)]}),(c.total_delta??0)>0&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-outline-variant/10 pt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Replaces this machine's cloud data with your local Grove. One-way; no reconciliation.`}),(0,G.jsx)(Y,{size:`sm`,variant:`outline`,onClick:ee,disabled:E,children:E?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Qa,{className:`h-3.5 w-3.5 animate-spin mr-1.5`}),`Rebuilding...`]}):`Rebuild from local`})]}),O&&(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:O})]})]}):(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:N})}),(0,G.jsx)(X5,{title:`Queue health`,children:a?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):A?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:N}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,G.jsx)(Y5,{label:`In flight`,value:i?.backlog??0,tone:(i?.backlog??0)>0?`ochre`:`outline`,pulse:(i?.backlog??0)>0,sub:(i?.backlog??0)>0?`draining`:void 0}),(0,G.jsx)(Y5,{label:`Failed`,value:i?.failed??0,tone:(i?.failed??0)>0?`terracotta`:`outline`}),(0,G.jsx)(Y5,{label:`Embeds failed`,value:i?.embed_failed??0,tone:(i?.embed_failed??0)>0?`terracotta`:`outline`})]}),i?.last_run_at!=null&&(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`Last run `,new Date(i.last_run_at*1e3).toLocaleString()]}),i?.last_error&&(0,G.jsx)(`p`,{className:`text-xs text-terracotta break-words m-0`,children:i.last_error}),(i?.embed_failed??0)>0&&i?.last_embed_error&&(0,G.jsx)(`p`,{className:`text-xs text-terracotta break-words m-0`,children:i.last_embed_error})]})}),(0,G.jsxs)(X5,{title:`Failed syncs`,actions:z.length>0?(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:v||M,onClick:R,children:`Retry all (${z.length})`}):null,children:[b&&(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface-variant m-0 mb-3`,children:b}),j?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):M?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:N}):z.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`No failed syncs.`}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`These records couldn't reach the cloud after repeated tries. Retry to attempt again, or discard to drop them.`}),(0,G.jsx)(`div`,{className:`divide-y divide-outline-variant/10`,children:z.map(e=>(0,G.jsx)(i7,{message:e,onAction:L,busy:v},e.lease_id))})]})]}),(0,G.jsxs)(X5,{title:`Backfill`,actions:(0,G.jsx)(Y,{size:`sm`,variant:`default`,onClick:I,disabled:S,children:S?`Backfilling...`:`Backfill existing records`}),children:[(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Re-sends every local record to the cloud — for recovery after a cloud-side reset or lost data. Not part of routine sync.`}),w&&(0,G.jsx)(`p`,{className:`text-sm text-sage m-0 mt-3`,children:w})]})]})}function o7(e){let t=e.trim();if(!t)return`?`;let n=t.split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[1][0]).toUpperCase():t.slice(0,2).toUpperCase()}var s7=(0,W.forwardRef)(({name:e,initials:t,size:n=36,className:r,style:i,...a},o)=>{let s=(t??o7(e)).slice(0,2);return(0,G.jsx)(`span`,{ref:o,"aria-label":e,className:J(`inline-flex items-center justify-center rounded-full font-mono font-semibold uppercase text-[var(--on-primary)] shrink-0`,r),style:{width:n,height:n,fontSize:Math.round(n/3),background:`linear-gradient(135deg, var(--sage-dim), var(--ochre))`,...i},...a,children:s})});s7.displayName=`MemberAvatar`;function c7(e){if(!e)return`never`;let t=Date.now()-e*1e3,n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<48?`${r}h ago`:`${Math.floor(r/24)}d ago`}function l7({m:e,isSelf:t}){return(0,G.jsx)(kM,{accent:`ochre`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(s7,{name:e.user,size:36}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-sm text-on-surface`,children:e.user}),t&&(0,G.jsx)(X,{variant:`outline`,children:`this machine`}),e.role&&(0,G.jsx)(X,{variant:e.role===`owner`?`default`:`outline`,children:e.role})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e.machine_id}),e.joined&&(0,G.jsxs)(`span`,{children:[`joined `,e.joined]}),!t&&(0,G.jsxs)(`span`,{children:[`last received `,c7(e.synced_at)]}),e.tags.map(e=>(0,G.jsxs)(`span`,{className:`font-mono`,children:[`#`,e]},e))]})]})]})})}function u7({teamId:e}={}){let{data:t,isLoading:n}=p8(e),{data:r,isLoading:i}=i8(e),a=r?.machine_id??null,o=n||i,s=t?.members.length??0;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(Wj,{tone:`ochre`,eyebrow:`Members`,title:`Roster`,actions:o?null:(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[s,` `,s===1?`member`:`members`]}),padded:!1,children:o?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant m-0`,children:`Loading…`}):!t||t.members.length===0?(0,G.jsxs)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant m-0`,children:[`No team members yet. Run `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team join`}),` on a teammate's machine to add them.`]}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:t.members.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(l7,{m:e,isSelf:e.machine_id===a})},e.id))})}),(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`Members come from the local `,(0,G.jsx)(`code`,{className:`font-mono`,children:`team_members`}),` table, synced from peers via the team Worker.`]})]})}var d7=(0,W.forwardRef)(({number:e,size:t=28,className:n,style:r,...i},a)=>(0,G.jsx)(`span`,{ref:a,className:J(`inline-flex items-center justify-center rounded-full bg-surface-container-high text-on-surface font-mono font-semibold shrink-0`,n),style:{width:t,height:t,fontSize:Math.round(t*12/28),...r},...i,children:e}));d7.displayName=`StepCircle`;function f7({n:e,state:t,title:n,children:r}){return(0,G.jsxs)(`li`,{"aria-current":t===`active`?`step`:void 0,className:J(`flex gap-3 rounded-md border border-[var(--ghost-border)] px-4 py-3 transition-colors`,t===`active`&&`bg-sage/[0.05] border-l-2 border-l-sage`,t===`complete`&&`opacity-70`),children:[(0,G.jsx)(d7,{number:e,className:J(t===`active`&&`bg-sage/15 text-sage`,t===`complete`&&`bg-sage text-on-sage`)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-on-surface m-0`,children:n}),r]})]})}function p7({scopeName:e}){return(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,G.jsxs)(Wj,{tone:`ochre`,eyebrow:(0,G.jsx)($6,{Icon:bo,tone:`ochre`,children:`Not syncing`}),title:`Team sync for ${e}`,children:[(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0 mb-3`,children:`This project is not assigned to a registered team.`}),(0,G.jsxs)(`ol`,{className:`m-0 p-0 list-none flex flex-col gap-3`,children:[(0,G.jsx)(f7,{n:1,state:`active`,title:`Install prerequisites`,children:(0,G.jsx)(`code`,{className:`block font-mono text-xs bg-surface-container rounded px-3 py-2 text-on-surface-variant`,children:`npm install -g @goondocks/myco-team wrangler && wrangler login`})}),(0,G.jsxs)(f7,{n:2,state:`idle`,title:`Provision the Grove worker`,children:[(0,G.jsx)(`code`,{className:`block font-mono text-xs bg-surface-container rounded px-3 py-2 text-on-surface-variant`,children:`myco-team install`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mt-1`,children:`Creates the worker and registers the team on this machine.`})]}),(0,G.jsx)(f7,{n:3,state:`idle`,title:`Add or join the team`,children:(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`On the Teams tab, provision a new team with `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team install`}),` — or, if a teammate shared a Worker URL and Team key, use "Join a team". Then assign this project to it.`]})})]})]})})}function m7({hasTeams:e}){return(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,G.jsx)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:Ga,children:`No team selected`}),title:`Select a team to view sync status`,children:(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:e?`Choose a team from the selector in the header to view its status, sync state, and members.`:`No teams are registered on this machine yet. Provision or join a team on the Teams tab, then return here.`})})})}function h7(e,t,n){let r=new Set(t.map(e=>e.team_id));return e&&r.has(e)?e:n&&r.has(n)?n:t[0]?.team_id}var g7=[{id:`teams`,label:`Teams`,description:`select projects`,Icon:Ga},{id:`status`,label:`Status`,description:`identity + health`,Icon:Gi},{id:`sync`,label:`Sync`,description:`queue + secrets`,Icon:Qa},{id:`members`,label:`Members`,description:`roster`,Icon:yo}],_7=new Set([`teams`,`status`,`sync`,`members`]);function v7({status:e}){if(e.version_status!==`client_too_old`&&e.version_status!==`worker_too_old`)return null;let t=e.version_status===`client_too_old`,n=t?`Sync paused — this machine is out of date`:`Sync paused — the team worker is out of date`,r=t?`myco update`:`myco-team update --team-id ${e.team_id??`<team_id>`}`,i=t?`This daemon speaks sync protocol v${e.daemon_protocol_version}, but the team worker requires at least v${e.worker_min_client_version??`?`}.`:`This daemon speaks sync protocol v${e.daemon_protocol_version}, but the team worker only supports up to v${e.worker_protocol_version??`?`}.`;return(0,G.jsxs)(Vj,{accent:`terra`,padded:!0,className:`mb-4 flex items-start gap-3`,role:`alert`,children:[(0,G.jsx)(_o,{className:`size-5 shrink-0 text-terracotta-text`,"aria-hidden":!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`p`,{className:`m-0 text-sm font-medium text-on-surface`,children:n}),(0,G.jsxs)(`p`,{className:`m-0 text-sm text-on-surface-variant`,children:[i,` Pending changes are held safely; run `,(0,G.jsx)(`code`,{className:`text-terracotta-text`,children:r}),` to resume syncing.`]})]})]})}var y7=`myco.team.selectedTeamId`;function b7(){let[e,t]=di(),{data:n,isLoading:r}=c8(),i=n?.teams??[],a=typeof window<`u`?window.localStorage.getItem(y7):null,o=h7(e.get(`team`),i,a);(0,W.useEffect)(()=>{o&&o!==a&&window.localStorage.setItem(y7,o)},[o,a]);let{data:s,isLoading:c}=i8(r?void 0:o),l=e.get(`tab`)??`teams`,u=_7.has(l)?l:`teams`;if(r||c)return(0,G.jsx)(Lj,{isLoading:!0,error:null,loadingText:`Loading team…`,children:(0,G.jsx)(`span`,{})});if(!s)return null;let d=s.enabled&&s.worker_url,f=s.grove?.name??s.project.name??`this Grove`;function p(){return u===`teams`?(0,G.jsx)(U5,{}):o?d?u===`sync`?(0,G.jsx)(a7,{status:s,teamId:o}):u===`members`?(0,G.jsx)(u7,{teamId:o}):(0,G.jsx)(q5,{status:s}):(0,G.jsx)(p7,{scopeName:f}):(0,G.jsx)(m7,{hasTeams:i.length>0})}return(0,G.jsxs)(zj,{children:[(0,G.jsx)(yP,{title:`Team`,subtitle:`Sync your projects to shared team clouds`,actions:i.length>0&&u!==`teams`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`label`,{htmlFor:`team-scope`,className:`myco-eyebrow-sm text-on-surface-variant`,children:`Team`}),(0,G.jsxs)(`select`,{id:`team-scope`,"aria-label":`Selected team`,className:`rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface`,value:o??``,onChange:e=>{window.localStorage.setItem(y7,e.target.value),t(t=>{let n=new URLSearchParams(t);return n.set(`team`,e.target.value),n},{replace:!0})},children:[!o&&(0,G.jsx)(`option`,{value:``,disabled:!0,children:`Select a team…`}),i.map(e=>(0,G.jsx)(`option`,{value:e.team_id,children:e.name},e.team_id))]})]}):void 0}),(0,G.jsx)(v7,{status:s}),(0,G.jsx)(iF,{tabs:g7,activeTab:u,onTabChange:e=>t(t=>{let n=new URLSearchParams(t);return n.set(`tab`,e),n},{replace:!0}),columns:4}),p()]})}function x7(){let[e]=di(),t=e.has(`preview`),n=Bs(),r=NM(),i=_s({refetchInterval:t?void 0:4e3}).data?.groves??[],a=Ho(i)??jo(i);if(a&&!t)return(0,G.jsx)(sr,{to:Fo(a),replace:!0});let o=!!a,s=i.reduce((e,t)=>e+t.projects.length,0),c=(r.data?.symbionts??[]).filter(e=>e.detected),l=n.data?.daemon.version,u=n.data?.daemon.port;return(0,G.jsx)(zj,{variant:`narrow`,className:`min-h-full justify-center`,children:(0,G.jsxs)(`div`,{className:`flex max-w-xl flex-col gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-primary/10 text-primary`,children:(0,G.jsx)(mo,{className:`h-5 w-5`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold text-on-surface`,children:o?`You're all set — Myco is capturing`:`You're set up — waiting for your first session`}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-on-surface-variant`,children:`Open any git repository in a supported agent (Claude Code, Cursor, Codex, Copilot, Antigravity, Windsurf, OpenCode, or Pi). Myco registers the project automatically on the first hook and this page opens its dashboard. Capture is scoped to git repositories — work in a non-git folder isn't recorded.`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-outline/40 bg-surface-container/40 p-4 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface`,children:[(0,G.jsx)(oa,{className:`h-4 w-4 shrink-0 text-green-500`}),(0,G.jsxs)(`span`,{children:[`Myco is running`,l?(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[` · v`,l]}):null,u?(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[` · port `,u]}):null]})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`mt-px font-medium text-on-surface`,children:`Agents`}),(0,G.jsx)(`span`,{children:c.length>0?`${c.length} detected — ${c.map(e=>e.displayName).join(`, `)}`:`No supported coding agents detected on this machine yet`})]}),o&&a?(0,G.jsxs)(ri,{to:Fo(a),className:`inline-flex items-center gap-1.5 font-medium text-primary hover:underline`,children:[s,` project`,s===1?``:`s`,` registered — go to dashboard`,(0,G.jsx)(qi,{className:`h-3.5 w-3.5`})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{className:`relative flex h-2 w-2 shrink-0`,children:[(0,G.jsx)(`span`,{className:`absolute inline-flex h-full w-full animate-ping rounded-full bg-primary/60`}),(0,G.jsx)(`span`,{className:`relative inline-flex h-2 w-2 rounded-full bg-primary`})]}),(0,G.jsx)(`span`,{children:`Waiting for your first session…`})]})]})]})})}function S7(){let e=We();return st({mutationFn:e=>os(`/groves`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function C7(){let e=We();return st({mutationFn:({id:e,name:t})=>q(`/groves/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({name:t})}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`groves`],exact:!1}),e.invalidateQueries({queryKey:[`grove`,n.id]})}})}function w7(){let e=We();return st({mutationFn:({id:e})=>q(`/groves/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function T7(){let e=We();return st({mutationFn:({targetGroveId:e,projectId:t})=>os(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function E7(){let e=We();return st({mutationFn:({id:e})=>os(`/groves/${encodeURIComponent(e)}/default`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function D7(){let e=We();return st({mutationFn:({groveId:e,projectId:t})=>os(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}/archive`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function O7(){let e=We();return st({mutationFn:({groveId:e,projectId:t})=>os(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}/unarchive`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function k7(){let e=We();return st({mutationFn:({groveId:e,projectId:t,confirmationName:n})=>q(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}`,{method:`DELETE`,body:JSON.stringify({confirmation_name:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}var A7={cortex:{id:`cortex`,label:`Cortex`,masterGate:`cortex.enabled`,memberGates:[],scheduledTasks:[`cortex-instructions`],advancedSettingsLink:`/settings#scheduled-tasks`},canopy:{id:`canopy`,label:`Canopy`,masterGate:`cortex.canopy.enabled`,memberGates:[],scheduledTasks:[`canopy-map`,`canopy-describe`],advancedSettingsLink:`/settings#scheduled-tasks`},skills:{id:`skills`,label:`Skills`,masterGate:`skills.enabled`,memberGates:[],scheduledTasks:[`skill-survey`,`skill-generate`,`skill-evolve`],advancedSettingsLink:`/settings#skills`},vault_evolution:{id:`vault_evolution`,label:`Vault Evolution`,masterGate:`vault_evolution.enabled`,memberGates:[],scheduledTasks:[`vault-evolve`],advancedSettingsLink:`/settings#scheduled-tasks`}};function j7(e,t){return e?zO(e,A7[t].masterGate)!==!1:!1}function M7(e){let t=Object.keys(A7).filter(t=>e[t]);return t.length===0?[{id:`capture-only`,label:`Capture-only`,to:``,tone:`outline`,title:`Sessions, search, and MCP only`}]:t.map(e=>({id:e,label:A7[e].label,to:A7[e].advancedSettingsLink,tone:`sage`,title:`${A7[e].label} enabled`}))}function N7({items:e,ariaLabel:t,trigger:n,align:r=`right`}){let[i,a]=(0,W.useState)(!1),o=(0,W.useRef)(null);return(0,W.useEffect)(()=>{if(!i)return;function e(e){o.current&&(o.current.contains(e.target)||a(!1))}function t(e){e.key===`Escape`&&a(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]),(0,G.jsxs)(`div`,{ref:o,className:`relative inline-block`,children:[(0,G.jsx)(`button`,{type:`button`,"aria-label":t,"aria-haspopup":`menu`,"aria-expanded":i,onClick:e=>{e.preventDefault(),e.stopPropagation(),a(e=>!e)},className:`inline-flex h-8 w-8 items-center justify-center rounded-md text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,children:n??(0,G.jsx)(_a,{className:`h-4 w-4`})}),i&&(0,G.jsx)(`div`,{role:`menu`,className:J(`absolute z-50 mt-1 min-w-[12rem] rounded-md border border-outline-variant/30 bg-surface-container-highest p-1 shadow-lg`,r===`right`?`right-0`:`left-0`),children:e.map(e=>(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,onClick:t=>{t.preventDefault(),t.stopPropagation(),!e.disabled&&(a(!1),e.onSelect())},className:J(`flex w-full items-center rounded-sm px-3 py-1.5 text-left text-sm transition-colors`,`text-on-surface hover:bg-surface-container-high`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent`,e.destructive&&!e.disabled&&`text-tertiary hover:bg-tertiary/10`),children:e.label},e.key))})]})}function P7({groveName:e,projectCount:t,isDefault:n,onRename:r,onDelete:i,onSetDefault:a}){let o=t>0;return(0,G.jsx)(N7,{items:[{key:`set-default`,label:`Set as default`,disabled:n,disabledReason:n?`Already the default Grove`:void 0,onSelect:a},{key:`rename`,label:`Rename`,onSelect:r},{key:`delete`,label:`Delete Grove`,destructive:!0,disabled:o,disabledReason:o?`Move or remove projects first`:void 0,onSelect:i}],ariaLabel:`${e} actions`})}function F7({projectName:e,archived:t=!1,onMove:n,onOpen:r,onArchive:i,onUnarchive:a,onDelete:o,onIgnore:s}){return(0,G.jsx)(N7,{items:[{key:`open`,label:`Open dashboard`,onSelect:r,disabled:t},{key:`move`,label:`Move to another Grove`,onSelect:n,disabled:t},{key:`ignore`,label:`Ignore project…`,onSelect:s,disabled:t},t?{key:`unarchive`,label:`Unarchive project`,onSelect:a}:{key:`archive`,label:`Archive project`,onSelect:i},{key:`delete`,label:`Delete permanently…`,onSelect:o,destructive:!0}],ariaLabel:`${e} actions`})}function I7(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`default`}function L7({open:e,onOpenChange:t}){let[n,r]=(0,W.useState)(``),[i,a]=(0,W.useState)(null),o=S7();(0,W.useEffect)(()=>{e&&(r(``),a(null),o.reset())},[e]);let s=n.trim(),c=s.length>0?I7(s):``;function l(e){if(e.preventDefault(),s.length===0){a(`Name is required.`);return}a(null),o.mutate({name:s},{onSuccess:e=>{DA({level:`success`,title:`Grove created`,detail:e.slug}),t(!1)},onError:e=>{DA({level:`error`,title:`Could not create Grove`,detail:e.message})}})}return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`New Grove`}),(0,G.jsx)(ap,{children:`Group projects into a local Grove.`})]}),(0,G.jsxs)(`form`,{onSubmit:l,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`new-grove-name`,className:`text-sm font-medium text-on-surface`,children:`Name`}),(0,G.jsx)(`input`,{id:`new-grove-name`,type:`text`,value:n,autoFocus:!0,onChange:e=>r(e.target.value),placeholder:`Personal`,className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`}),c&&(0,G.jsxs)(`p`,{className:`font-mono text-xs text-on-surface-variant`,children:[`slug: `,c]}),i&&(0,G.jsx)(`p`,{className:`text-xs text-tertiary`,children:i})]}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:o.isPending,children:`Cancel`}),(0,G.jsx)(Y,{type:`submit`,size:`sm`,disabled:o.isPending||s.length===0,children:o.isPending?`Creating…`:`Create`})]})]})]})})}function R7({open:e,onOpenChange:t,groveId:n,currentName:r}){let[i,a]=(0,W.useState)(r),o=C7();(0,W.useEffect)(()=>{e&&(a(r),o.reset())},[e,r]);let s=i.trim(),c=s===r;function l(e){e.preventDefault(),!(s.length===0||c)&&o.mutate({id:n,name:s},{onSuccess:()=>{DA({level:`success`,title:`Grove renamed`}),t(!1)},onError:e=>{DA({level:`error`,title:`Rename failed`,detail:e.message})}})}return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md`,children:[(0,G.jsx)(np,{children:(0,G.jsx)(ip,{children:`Rename Grove`})}),(0,G.jsxs)(`form`,{onSubmit:l,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`rename-grove-name`,className:`text-sm font-medium text-on-surface`,children:`Name`}),(0,G.jsx)(`input`,{id:`rename-grove-name`,type:`text`,value:i,autoFocus:!0,onChange:e=>a(e.target.value),className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant`,children:`The Grove slug may change if the new name slugifies differently. Auto-suffixes on collision.`})]}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:o.isPending,children:`Cancel`}),(0,G.jsx)(Y,{type:`submit`,size:`sm`,disabled:o.isPending||s.length===0||c,children:o.isPending?`Saving…`:`Save`})]})]})]})})}function z7({open:e,onOpenChange:t,groveId:n,groveName:r,projectCount:i}){let a=w7(),o=i>0;function s(){o||a.mutate({id:n},{onSuccess:()=>{DA({level:`success`,title:`Grove deleted`,detail:r}),t(!1)},onError:e=>{e instanceof ms&&e.status===409?DA({level:`error`,title:`Grove not empty`,detail:`${e.body?.project_count??`?`} project(s) still bound`}):DA({level:`error`,title:`Delete failed`,detail:e.message})}})}return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Delete Grove`}),(0,G.jsxs)(ap,{children:[`Delete `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:r}),`? This removes the Grove from the local registry.`]})]}),o&&(0,G.jsxs)(`p`,{className:`rounded-md border border-tertiary/30 bg-tertiary/10 px-3 py-2 text-sm text-on-surface`,children:[`Move or remove the `,i,` project`,i===1?``:`s`,` in this Grove first.`]}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:a.isPending,children:`Cancel`}),(0,G.jsx)(`span`,{title:o?`Grove still has projects`:void 0,children:(0,G.jsx)(Y,{type:`button`,variant:`destructive`,size:`sm`,onClick:s,disabled:a.isPending||o,children:a.isPending?`Deleting…`:`Delete Grove`})})]})]})})}function B7({open:e,onOpenChange:t,sourceGroveId:n,projectId:r,projectName:i,groves:a}){let o=a.filter(e=>e.id!==n),[s,c]=(0,W.useState)(o[0]?.id??``),l=T7();(0,W.useEffect)(()=>{e&&(c(o[0]?.id??``),l.reset())},[e,n,r]);function u(){s&&l.mutate({targetGroveId:s,projectId:r},{onSuccess:()=>{DA({level:`success`,title:`Project moved`}),t(!1)},onError:e=>{DA({level:`error`,title:`Move failed`,detail:e.message})}})}return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Move project`}),(0,G.jsxs)(ap,{children:[`Move `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:i}),` to another Grove.`]})]}),o.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant`,children:`No other Groves available. Create a new Grove first.`}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`move-target-grove`,className:`text-sm font-medium text-on-surface`,children:`Destination Grove`}),(0,G.jsx)(`select`,{id:`move-target-grove`,value:s,onChange:e=>c(e.target.value),disabled:l.isPending,className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,children:o.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant`,children:`The project keeps its data; only its Grove binding changes.`})]}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:l.isPending,children:`Cancel`}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,onClick:u,disabled:l.isPending||o.length===0||!s,className:`gap-2`,children:[l.isPending&&(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),l.isPending?`Moving…`:`Confirm move`]})]})]})})}function V7({open:e,onOpenChange:t,groveId:n,projectId:r,projectName:i}){let[a,o]=(0,W.useState)(``),s=k7(),c=a===i;function l(){c&&s.mutate({groveId:n,projectId:r,confirmationName:a},{onSuccess:e=>{DA({level:`success`,title:`Project deleted`,detail:e.delete.snapshot_path}),o(``),t(!1)},onError:e=>{DA({level:`error`,title:`Delete failed`,detail:e.message})}})}return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Delete Project Permanently`}),(0,G.jsxs)(ap,{children:[`This deletes `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:i}),` from its Grove and cannot be undone.`]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant`,children:[`Type `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:i}),` to confirm.`]}),(0,G.jsx)(op,{value:a,onChange:e=>o(e.target.value),"aria-label":`Project name confirmation`,autoComplete:`off`})]}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:s.isPending,children:`Cancel`}),(0,G.jsx)(Y,{type:`button`,variant:`destructive`,size:`sm`,onClick:l,disabled:s.isPending||!c,children:s.isPending?`Deleting…`:`Delete Permanently`})]})]})})}function H7({capId:e,scoped:t}){let n=A7[e],r=j7(t.effective,e);return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-3 border-b border-outline-variant/15 last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-on-surface`,children:n.label}),(0,G.jsx)(ri,{to:n.advancedSettingsLink,className:`text-xs text-on-surface-variant hover:text-on-surface transition-colors`,children:`Advanced settings →`})]}),(0,G.jsx)(bP,{checked:r,onCheckedChange:e=>{t.setFields([{path:n.masterGate,value:e}],`local`)}})]})}function U7({target:e,open:t,onClose:n}){let r=$O(e);return(0,G.jsxs)(KP,{open:t,onClose:n,ariaLabel:`Project capabilities`,testIdRoot:`capability-panel`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 mb-5`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-on-surface-variant`,children:`Capabilities`}),(0,G.jsx)(`div`,{className:`text-base font-semibold text-on-surface`,children:e.project.name}),(0,G.jsx)(`div`,{className:`text-xs text-on-surface-variant`,children:`Toggles apply at Personal scope — only this machine.`})]}),(0,G.jsx)(`div`,{className:`flex flex-col`,children:yk.map(e=>(0,G.jsx)(H7,{capId:e,scoped:r},e))}),(0,G.jsx)(`div`,{className:`mt-5 pt-4 border-t border-outline-variant/15`,children:(0,G.jsx)(`button`,{type:`button`,className:`text-xs text-on-surface-variant hover:text-on-surface transition-colors`,onClick:()=>{r.resetFields(yk.map(e=>A7[e].masterGate))},children:`Reset to defaults`})})]})}function W7(){let e=Nn(),t=E7(),n=D7(),r=O7(),i=KO(),a=JO(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null),[m,h]=(0,W.useState)(null),[g,_]=(0,W.useState)(!1),[v,y]=(0,W.useState)(``),[b,x]=(0,W.useState)(null),S=_s({includeArchived:g}),C=S.data?.groves??[],{data:w}=cv(),T=(0,W.useMemo)(()=>{let e=new Map;for(let t of w?.projects??[])e.set(t.project_id,t.last_activity_at);return e},[w]),E=e=>{let t=T.get(e);return t?Date.parse(t):0},D=e=>{let t=v.trim().toLowerCase();return[...t?e.projects.filter(e=>`${e.name} ${e.root}`.toLowerCase().includes(t)):e.projects].sort((e,t)=>E(t.project_id)-E(e.project_id))},O=v.trim().length>0;function k(e,t){n.mutate({groveId:e.id,projectId:t.project_id},{onSuccess:()=>DA({level:`success`,title:`Project archived`,detail:t.name}),onError:e=>DA({level:`error`,title:`Archive failed`,detail:e.message})})}function A(e,t){r.mutate({groveId:e.id,projectId:t.project_id},{onSuccess:()=>DA({level:`success`,title:`Project unarchived`,detail:t.name}),onError:e=>DA({level:`error`,title:`Unarchive failed`,detail:e.message})})}function j(e){t.mutate({id:e.id},{onSuccess:()=>{DA({level:`success`,title:`${e.name} is now the default Grove`})},onError:e=>{DA({level:`error`,title:`Failed to set default`,detail:e.message})}})}function M(e,t){if((i.data?.config.capture.ignore?.paths??[]).includes(t.root)){k(e,t);return}a.mutate({path:`capture.ignore.paths`,value:t.root},{onSuccess:()=>k(e,t),onError:e=>DA({level:`error`,title:`Ignore failed`,detail:e.message})})}return(0,G.jsxs)(Lj,{isLoading:S.isLoading,error:S.error,loadingText:`Loading Groves...`,children:[(0,G.jsxs)(zj,{children:[(0,G.jsxs)(`header`,{className:`flex items-end justify-between gap-4 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(Uj,{children:`Grove management`}),(0,G.jsx)(`h1`,{className:`myco-display-lg text-on-surface m-0`,children:`Groves`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Registered local Grove projects for this daemon.`})]}),(0,G.jsxs)(Y,{size:`sm`,onClick:()=>s(!0),className:`gap-1.5`,children:[(0,G.jsx)(Xa,{className:`h-4 w-4`}),`New Grove`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`label`,{className:`flex w-full max-w-xs items-center gap-2 rounded-md border border-outline-variant/30 bg-surface px-2 py-1.5 text-sm`,children:[(0,G.jsx)(no,{className:`h-4 w-4 text-on-surface-variant`}),(0,G.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`Search projects by name or path`,className:`min-w-0 flex-1 bg-transparent outline-none placeholder:text-on-surface-variant`})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-on-surface-variant`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`h-4 w-4 accent-primary`}),`Show archived projects`]})]}),(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:C.map(t=>{let n=D(t);return O&&n.length===0?null:(0,G.jsx)(Wj,{tone:`sage`,eyebrow:`Grove`,title:t.name,actions:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t.is_default&&(0,G.jsx)(X,{variant:`outline`,children:`default`}),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-on-surface-variant`,children:O?`${n.length} of ${t.project_count}`:`${t.project_count} project${t.project_count===1?``:`s`}`}),(0,G.jsx)(P7,{groveName:t.name,projectCount:t.project_count,isDefault:t.is_default,onRename:()=>l(t),onDelete:()=>d(t),onSetDefault:()=>j(t)})]}),padded:!1,children:n.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:O?`No matching projects.`:`No projects in this Grove.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:n.map(n=>{let r=T.get(n.project_id);return(0,G.jsx)(`li`,{children:(0,G.jsx)(kM,{accent:`sage`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(ii,{to:Fo({grove:t,project:n}),className:`flex min-w-0 flex-1 items-center gap-3 hover:text-sage`,children:[(0,G.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-xs font-semibold text-white`,style:{backgroundColor:Wo(n.project_id)},children:Uo(n.name)}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-sm font-medium text-on-surface`,children:n.name}),(0,G.jsx)(`span`,{className:`block truncate text-xs text-on-surface-variant font-mono`,children:n.root}),(0,G.jsx)(`span`,{className:`block truncate text-[11px] text-on-surface-variant`,children:r?`last active ${pv(r)}`:`no activity yet`})]}),n.manifest_state!==`present`&&(0,G.jsx)(X,{variant:`outline`,children:n.manifest_state}),n.status===`archived`&&(0,G.jsx)(X,{variant:`outline`,children:`archived`})]}),n.capabilities&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>x({grove:t,project:n}),"aria-label":`Configure ${n.name} capabilities`,title:`Configure capabilities`,"data-testid":`capability-badge-strip`,className:`shrink-0 flex flex-wrap items-center gap-1 rounded-md p-1 hover:bg-surface-container-high transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,children:M7(n.capabilities).map(e=>(0,G.jsx)(K$,{chip:e},e.id))}),(0,G.jsx)(F7,{projectName:n.name,archived:n.status===`archived`,onOpen:()=>e(Fo({grove:t,project:n})),onMove:()=>p({grove:t,project:n}),onIgnore:()=>M(t,n),onArchive:()=>k(t,n),onUnarchive:()=>A(t,n),onDelete:()=>h({grove:t,project:n})})]})})},n.project_id)})})},t.id)})})]}),(0,G.jsx)(L7,{open:o,onOpenChange:s}),c&&(0,G.jsx)(R7,{open:c!==null,onOpenChange:e=>!e&&l(null),groveId:c.id,currentName:c.name}),u&&(0,G.jsx)(z7,{open:u!==null,onOpenChange:e=>!e&&d(null),groveId:u.id,groveName:u.name,projectCount:u.project_count}),f&&(0,G.jsx)(B7,{open:f!==null,onOpenChange:e=>!e&&p(null),sourceGroveId:f.grove.id,projectId:f.project.project_id,projectName:f.project.name,groves:C}),m&&(0,G.jsx)(V7,{open:m!==null,onOpenChange:e=>!e&&h(null),groveId:m.grove.id,projectId:m.project.project_id,projectName:m.project.name}),b&&(0,G.jsx)(U7,{target:b,open:!0,onClose:()=>x(null)})]})}function G7(){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(OA,{}),(0,G.jsxs)(dr,{children:[(0,G.jsx)(lr,{path:`/`,element:(0,G.jsx)(K7,{})}),(0,G.jsxs)(lr,{element:(0,G.jsx)(bs,{children:(0,G.jsx)(_k,{children:(0,G.jsx)(xA,{})})}),children:[(0,G.jsx)(lr,{path:`/onboarding`,element:(0,G.jsx)(x7,{})}),(0,G.jsx)(lr,{path:`/groves`,element:(0,G.jsx)(W7,{})}),(0,G.jsx)(lr,{path:`/symbionts`,element:(0,G.jsx)($$,{})}),(0,G.jsx)(lr,{path:`/logs`,element:(0,G.jsx)(D5,{})}),(0,G.jsx)(lr,{path:`/machine`,element:(0,G.jsx)(z5,{})}),(0,G.jsx)(lr,{path:`/settings`,element:(0,G.jsx)(n9,{})}),(0,G.jsx)(lr,{path:`/machine/settings`,element:(0,G.jsx)(e9,{})}),(0,G.jsx)(lr,{path:`/system`,element:(0,G.jsx)(sr,{to:`/settings#logging`,replace:!0})})]}),(0,G.jsxs)(lr,{path:`/g/:groveSlug/p/:projectSlug`,element:(0,G.jsx)(r9,{}),children:[(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(iM,{})}),(0,G.jsx)(lr,{path:`sessions`,element:(0,G.jsx)(vP,{})}),(0,G.jsx)(lr,{path:`sessions/:id`,element:(0,G.jsx)(vP,{})}),(0,G.jsx)(lr,{path:`cortex`,element:(0,G.jsx)(TF,{})}),(0,G.jsx)(lr,{path:`mycelium`,element:(0,G.jsx)(G$,{})}),(0,G.jsx)(lr,{path:`agent`,element:(0,G.jsx)(B4,{})}),(0,G.jsx)(lr,{path:`agent/:id`,element:(0,G.jsx)(B4,{})}),(0,G.jsx)(lr,{path:`skills`,element:(0,G.jsx)(x3,{})}),(0,G.jsx)(lr,{path:`settings`,element:(0,G.jsx)(t9,{})}),(0,G.jsx)(lr,{path:`operations`,element:(0,G.jsx)(Z7,{})}),(0,G.jsx)(lr,{path:`team`,element:(0,G.jsx)(Y7,{})})]}),(0,G.jsx)(lr,{path:`/g/:groveSlug/dashboard`,element:(0,G.jsx)(i9,{}),children:(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(C8,{})})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/operations`,element:(0,G.jsx)(i9,{}),children:(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(Y8,{})})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/settings`,element:(0,G.jsx)($7,{})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/maintenance`,element:(0,G.jsx)(Q7,{})}),(0,G.jsxs)(lr,{path:`/g/:groveSlug/team`,element:(0,G.jsx)(i9,{}),children:[(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(b7,{})}),(0,G.jsx)(lr,{path:`maintenance`,element:(0,G.jsx)(X7,{})})]}),(0,G.jsx)(lr,{path:`/sessions`,element:(0,G.jsx)(q7,{suffix:`/sessions`})}),(0,G.jsx)(lr,{path:`/sessions/:id`,element:(0,G.jsx)(q7,{suffixFromPath:!0})}),(0,G.jsx)(lr,{path:`/cortex`,element:(0,G.jsx)(q7,{suffix:`/cortex`})}),(0,G.jsx)(lr,{path:`/mycelium`,element:(0,G.jsx)(q7,{suffix:`/mycelium`})}),(0,G.jsx)(lr,{path:`/agent`,element:(0,G.jsx)(q7,{suffix:`/agent`})}),(0,G.jsx)(lr,{path:`/agent/:id`,element:(0,G.jsx)(q7,{suffixFromPath:!0})}),(0,G.jsx)(lr,{path:`/skills`,element:(0,G.jsx)(q7,{suffix:`/skills`})}),(0,G.jsx)(lr,{path:`/operations`,element:(0,G.jsx)(J7,{suffix:`/operations`})}),(0,G.jsx)(lr,{path:`/team`,element:(0,G.jsx)(J7,{suffix:`/team`})}),(0,G.jsx)(lr,{path:`*`,element:(0,G.jsx)(sr,{to:`/`,replace:!0})})]})]})}function K7(){let{data:e,isLoading:t,error:n}=_s(),{data:r,isLoading:i}=cv();if(t)return(0,G.jsx)(a9,{text:`Loading projects...`});if(n)return(0,G.jsx)(a9,{text:n.message});let a=e?.groves??[],o=Ho(a);if(!o&&i)return(0,G.jsx)(a9,{text:`Loading projects...`});let s=o??No(a,r?.projects);return s?(0,G.jsx)(sr,{to:Fo(s),replace:!0}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function q7({suffix:e,suffixFromPath:t=!1}){let n=An(),{data:r,isLoading:i,error:a}=_s(),{data:o}=cv();if(i)return(0,G.jsx)(a9,{text:`Loading projects...`});if(a)return(0,G.jsx)(a9,{text:a.message});let s=r?.groves??[],c=Ho(s)??No(s,o?.projects);return c?(0,G.jsx)(sr,{to:dP(Fo(c,t?n.pathname:e),n.search,n.hash),replace:!0}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function J7({suffix:e}){let t=An(),{data:n,isLoading:r,error:i}=_s();if(r)return(0,G.jsx)(a9,{text:`Loading Grove...`});if(i)return(0,G.jsx)(a9,{text:i.message});let a=n?.groves??[],o=(Ho(a)??jo(a))?.grove??a[0];if(!o)return(0,G.jsx)(sr,{to:`/onboarding`,replace:!0});let s=e.startsWith(`/`)?e:`/${e}`;return(0,G.jsx)(sr,{to:dP(`/g/${o.slug}${s}`,t.search,t.hash),replace:!0})}function Y7(){let e=An(),{groveSlug:t}=Ln();return t?(0,G.jsx)(sr,{to:dP(`/g/${t}/team`,e.search,e.hash),replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function X7(){let{groveSlug:e}=Ln();return e?(0,G.jsx)(sr,{to:`/g/${e}/team?tab=sync`,replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function Z7(){let e=An(),{groveSlug:t}=Ln();return t?(0,G.jsx)(sr,{to:dP(`/g/${t}/operations`,e.search,e.hash),replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function Q7(){let e=An(),{groveSlug:t}=Ln();return t?(0,G.jsx)(sr,{to:dP(`/g/${t}/operations`,e.search,e.hash),replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function $7(){return(0,G.jsx)(sr,{to:`/settings#backup`,replace:!0})}function e9(){return(0,G.jsx)(sr,{to:`/settings#logging`,replace:!0})}function t9(){let e=An();return(0,G.jsx)(sr,{to:`/settings${e.search}${e.hash}`,replace:!0})}function n9(){let{data:e,isLoading:t,error:n}=_s(),{data:r}=cv();if(t)return(0,G.jsx)(a9,{text:`Loading settings...`});if(n)return(0,G.jsx)(a9,{text:n.message});let i=e?.groves??[],a=Ho(i)??No(i,r?.projects);return a?(0,G.jsx)(ys,{selection:a,persist:!1,children:(0,G.jsx)(_k,{children:(0,G.jsx)(G6,{})})}):(0,G.jsx)(bs,{children:(0,G.jsx)(_k,{children:(0,G.jsx)(G6,{})})})}function r9(){let{groveSlug:e,projectSlug:t}=Ln(),{data:n,isLoading:r,error:i}=_s();if(r)return(0,G.jsx)(a9,{text:`Loading project...`});if(i)return(0,G.jsx)(a9,{text:i.message});let a=Ao(n?.groves??[],e,t);return a?(0,G.jsx)(ys,{selection:a,children:(0,G.jsx)(_k,{children:(0,G.jsx)(xA,{})})}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function i9(){let{groveSlug:e}=Ln(),{data:t,isLoading:n,error:r}=_s(),{data:i}=cv();if(n)return(0,G.jsx)(a9,{text:`Loading Grove...`});if(r)return(0,G.jsx)(a9,{text:r.message});let a=t?.groves??[],o=a.find(t=>t.slug===e);if(!o)return(0,G.jsx)(sr,{to:`/`,replace:!0});let s=Ho(a),c=(s&&s.grove.id===o.id?s.project:null)??Po(o,i?.projects);return c?(0,G.jsx)(ys,{selection:{grove:o,project:c},persist:!1,children:(0,G.jsx)(_k,{children:(0,G.jsx)(xA,{})})}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function a9({text:e}){return(0,G.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-surface text-sm text-on-surface-variant`,children:e})}pk();var o9=new Be({defaultOptions:{queries:{staleTime:Ms}}});Si.createRoot(document.getElementById(`root`)).render((0,G.jsx)(W.StrictMode,{children:(0,G.jsx)(ki,{children:(0,G.jsx)(Ge,{client:o9,children:(0,G.jsx)(ei,{basename:Go()||void 0,children:(0,G.jsx)(G7,{})})})})}));
|
|
415
|
+
`),[r,i]=(0,W.useState)(n);return(0,W.useEffect)(()=>{i(n)},[n]),(0,G.jsx)(`textarea`,{className:`min-h-20 w-full rounded-md border border-border bg-surface px-3 py-2 font-mono text-sm text-on-surface shadow-xs focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,value:r,placeholder:`packages/api/ => refs/tags/api/v*`,onChange:e=>i(e.target.value),onBlur:()=>t(J3(r))})}function X3({children:e}){return(0,G.jsx)(`p`,{className:`font-sans text-xs leading-5 text-on-surface-variant`,children:e})}function Z3({title:e,description:t,children:n}){return(0,G.jsxs)(`section`,{className:`space-y-4 border-t border-outline-variant/20 pt-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-xs font-semibold uppercase tracking-wider text-on-surface-variant`,children:e}),(0,G.jsx)(X3,{children:t})]}),n]})}function Q3(){let{effective:e,setFields:t}=ek(),{data:n}=L3(),r=z3(),i=B3(),[a,o]=(0,W.useState)(``),s=`refs/tags/${e?.release_provenance.github.repo.split(`/`).pop()?.replace(/\.git$/,``)||`project`}/v*`,c=n?.secrets.github,l=c?.configured?`${c.maskedValue??`GitHub access`} connected for PR evidence.`:`Required for private repos and reliable squash-merge matches.`,u=(0,W.useCallback)((e,n)=>{t([{path:`release_provenance.production_refs`,value:e},{path:`release_provenance.integration_refs`,value:n}],`project`).catch(e=>console.error(`[settings] release provenance preset failed`,e))},[t]),d=(0,W.useCallback)(()=>{let e=a.trim();e&&r.mutate({provider:`github`,apiKey:e},{onSuccess:()=>o(``)})},[a,r]),f=(0,W.useCallback)(()=>{i.mutate({provider:`github`})},[i]);return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`max-w-4xl space-y-2`,children:[(0,G.jsx)(ZM,{children:`Release provenance`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Myco uses Git evidence to tell whether captured knowledge is released, merged but unreleased, or still only local.`})]}),(0,G.jsxs)(Z3,{title:`Release model`,description:`Define what counts as released and what counts as merged for this project.`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([`refs/tags/v*`],[`origin/main`]),children:`Semver tags`}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([s],[`origin/main`]),children:`Project tag family`}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([`origin/main`],[]),children:`Main branch deploys`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(OP,{path:`release_provenance.production_refs`,label:`Production refs`,hint:`one per line`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(q3,{value:e??[],onChange:t,placeholder:`refs/tags/v*`}),(0,G.jsx)(X3,{children:`Refs that mean code is released. Use release tags, project tag families, or the branch that deploys directly.`})]})}),(0,G.jsx)(OP,{path:`release_provenance.integration_refs`,label:`Integration refs`,hint:`one per line`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(q3,{value:e??[],onChange:t,placeholder:`origin/main`}),(0,G.jsx)(X3,{children:`Refs that mean work is merged but not necessarily released. For GitHub projects this is usually the default branch.`})]})})]})]}),(0,G.jsx)(Z3,{title:`GitHub evidence`,description:`Optional PR evidence improves reconciliation when squash merges hide direct commit ancestry.`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(20rem,1fr)_12rem]`,children:[(0,G.jsx)(OP,{path:`release_provenance.github.repo`,label:`Repository`,hint:`owner/name`,commitOn:`blur`,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(op,{value:e??``,placeholder:`owner/name`,onChange:e=>t(e.target.value),onBlur:n}),(0,G.jsx)(X3,{children:`Detected from the GitHub remote when possible. Leave blank to disable GitHub PR evidence.`})]})}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Access token`}),(0,G.jsx)(Ok,{scope:`machine`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,G.jsx)(op,{className:`min-w-0 flex-1`,type:`password`,value:a,placeholder:c?.configured?`Paste new GitHub token`:`Paste GitHub token`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())}}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:d,disabled:r.isPending||a.trim()===``,children:r.isPending?`Saving`:c?.configured?`Update`:`Connect`}),c?.configured&&c.source!==`env`&&(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:f,disabled:i.isPending,children:`Clear`})]}),(0,G.jsx)(X3,{children:l})]}),(0,G.jsx)(OP,{path:`release_provenance.github.max_lookups_per_run`,label:`PR lookups`,commitOn:`blur`,parse:e=>Number(e),children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(op,{type:`number`,min:0,max:200,value:String(e??20),onChange:e=>t(Number(e.target.value)),onBlur:n}),(0,G.jsx)(X3,{children:`Maximum GitHub PR searches per reconcile run. Higher values can improve older squash-merge matches but use more API quota.`})]})})]})}),(0,G.jsx)(Z3,{title:`Reconciliation behavior`,description:`Control whether provenance runs, how often it refreshes, and how unknown Git states are treated.`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-3`,children:[(0,G.jsx)(OP,{path:`release_provenance.enabled`,label:`Enabled`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t}),(0,G.jsx)(X3,{children:`Enabled by default for Git projects. Missing refs leave records unreconciled instead of guessed.`})]})}),(0,G.jsx)(OP,{path:`release_provenance.reconcile_interval_minutes`,label:`Reconcile interval`,hint:`minutes`,commitOn:`blur`,parse:e=>Number(e),children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(op,{type:`number`,min:1,max:1440,value:String(e??15),onChange:e=>t(Number(e.target.value)),onBlur:n}),(0,G.jsx)(X3,{children:`How often the daemon rechecks captured Git evidence against the release model.`})]})}),(0,G.jsx)(OP,{path:`release_provenance.production_debug_include_unknown`,label:`Include unknown debug`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(bP,{checked:e??!0,onCheckedChange:t}),(0,G.jsx)(X3,{children:`Include dirty worktrees and other unknown Git states in production-scoped debug context.`})]})})]})}),(0,G.jsx)(Z3,{title:`Advanced monorepo releases`,description:`Use this only when different paths in one repository release through different tag families.`,children:(0,G.jsx)(OP,{path:`release_provenance.package_map`,label:`Monorepo release mapping`,hint:`path => release tag ref`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Y3,{value:e??[],onChange:t}),(0,G.jsx)(X3,{children:`Map a path prefix to the tag pattern that releases that part of the repository.`})]})})})]})}function $3(e){if(e instanceof Error)return e.message||e.constructor.name||`Error`;if(typeof e==`string`)return e||`Empty string error`;try{return JSON.stringify(e)}catch{return`Unserializable error`}}var e6=500,t6=6e4;function n6(e){return e?new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):`Never`}function r6(e,t){return e<=0?null:e===1&&t?t:`${e} packages`}function i6(){let{data:e}=Uk(),t=Wk(),n=Gk(),r=Kk(),[i,a]=(0,W.useState)(`idle`),[o,s]=(0,W.useState)(null);(0,W.useEffect)(()=>{if(!e?.restarting||i!==`idle`)return;a(`restarting`);let t=Date.now()+t6,n=!1,r=async()=>{if(!(n||Date.now()>t)){try{if((await fetch(Ko(`/health`))).ok){window.location.reload();return}}catch{}n||setTimeout(r,e6)}},o=setTimeout(r,e6);return()=>{n=!0,clearTimeout(o)}},[e?.restarting,i]);let c=(0,W.useCallback)(async()=>{a(`applying`),s(null);try{let e=(await n.mutateAsync()).version;a(`restarting`);let t=Date.now()+t6;await new Promise((n,r)=>{let i=async()=>{if(Date.now()>t){r(Error(`timeout`));return}try{let t=await fetch(Ko(`/health`));if(t.ok&&(await t.json().catch(()=>null))?.version===e){n();return}}catch{}setTimeout(i,e6)};setTimeout(i,e6)}),window.location.reload()}catch(e){if(e instanceof ms&&e.status===422){a(`staging`),s(null);return}a(`error`),s($3(e)===`timeout`?`Daemon did not restart within the expected time. Check the terminal.`:$3(e))}},[n]),l=(0,W.useCallback)(()=>{t.mutate()},[t]),u=(0,W.useCallback)(e=>{r.mutate(e)},[r]);if(!e)return null;let d=t.isPending,f=i===`applying`||i===`restarting`,p=e.update_available===!0,m=e.revert_available===!0,h=p||m,g=e.channel??`stable`,_=(e.packages??[]).filter(e=>e.installed),v=_.filter(e=>e.update_available),y=v.length,b=r6(y,v[0]?.latest_version??void 0);return e.exempt?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(so,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(ZM,{children:`Upgrade`})]}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Upgrades are disabled in development mode.`,` `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-outline`,children:e.running_version})]})]}):(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ia,{className:J(`h-4 w-4`,h?`text-secondary`:`text-primary`)}),(0,G.jsx)(ZM,{children:`Upgrade`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-outline`,children:e.running_version}),p&&b&&(0,G.jsx)(X,{variant:`warning`,children:b})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[h?(0,G.jsx)(Y,{variant:`default`,size:`sm`,onClick:c,disabled:f,children:f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Qa,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),i===`restarting`?`Restarting…`:m&&!p?`Reverting…`:`Upgrading…`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ia,{className:`mr-1.5 h-3.5 w-3.5`}),m&&!p?`Revert to Stable & Restart`:y>1?`Upgrade ${y} Packages & Restart`:`Upgrade & Restart`]})}):(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-primary`,children:[(0,G.jsx)(oa,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Up to date`})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:l,disabled:d||f,children:[(0,G.jsx)(Qa,{className:J(`mr-1.5 h-3.5 w-3.5`,d&&`animate-spin`)}),`Check Now`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:Is.map(e=>(0,G.jsx)(Y,{variant:g===e?`default`:`ghost`,className:`text-xs capitalize h-6 px-2`,onClick:()=>u(e),disabled:r.isPending||f,children:e},e))}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Checked: `,n6(e.last_check)]})]}),_.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[_.map(e=>{let t=e.revert_available&&!e.update_available;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-outline/20 px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-sans text-sm text-on-surface`,children:e.display_name}),(0,G.jsxs)(`div`,{className:`font-mono text-xs text-on-surface-variant`,children:[e.installed_version??`not installed`,(e.update_available||t)&&e.latest_version?` → ${e.latest_version}`:``]})]}),(0,G.jsx)(X,{variant:e.update_available||t?`warning`:`secondary`,children:e.update_available?`Upgrade available`:t?`Revert pending`:`Installed`})]},e.id)}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`This machine runs the managed Myco binary at ~/.myco/bin/myco. Switching channels swaps that same binary in place — Beta installs the latest prerelease, Stable steps back to the latest stable release.`})]}),i===`staging`&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Qa,{className:`h-4 w-4 mt-0.5 shrink-0 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Upgrade is staging — try again in a moment.`})]}),(i===`error`||e.error)&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-tertiary`,children:[(0,G.jsx)(ra,{className:`h-4 w-4 mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:o??e.error})]})]})}var a6=[`project`,`grove`,`all-groves`],o6={project:`Project`,grove:`Grove`,"all-groves":`All Groves`},s6={project:`Operate on the active project only`,grove:`Operate on every project in this Grove`,"all-groves":`Operate across every Grove on this machine`},c6={project:`border-outline-variant/30 bg-on-surface-variant/15 text-on-surface`,grove:`border-secondary/50 bg-secondary/10 text-secondary`,"all-groves":`border-tertiary/50 bg-tertiary/10 text-tertiary`},l6={project:`border-outline-variant/20 text-on-surface-variant hover:bg-on-surface-variant/5`,grove:`border-outline-variant/20 text-on-surface-variant hover:bg-secondary/5`,"all-groves":`border-outline-variant/20 text-on-surface-variant hover:bg-tertiary/5`};function u6({value:e,onChange:t,available:n=a6,helperText:r}){let i=a6.filter(e=>n.includes(e));return i.length===0?null:(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`div`,{role:`group`,"aria-label":`Operation scope`,className:`inline-flex items-center gap-1`,children:i.map(n=>{let r=e===n;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n),title:s6[n],"aria-pressed":r,className:J(`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider transition-colors`,r?c6[n]:l6[n]),children:[(0,G.jsx)(`span`,{className:J(`inline-block h-1.5 w-1.5 rounded-full`,r&&n===`grove`&&`bg-secondary`,r&&n===`all-groves`&&`bg-tertiary`,r&&n===`project`&&`bg-on-surface-variant`,!r&&`bg-outline-variant/60`),"aria-hidden":!0}),o6[n]]},n)})}),r&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:r})]})}var d6={grove:`Aggregated for this Grove. Switch projects via the upper-left switcher to view a different Grove.`,"all-groves":`Aggregates every Grove on this machine.`,project:`Filtered to the active project.`},f6={project:`Action targets the active project only.`,grove:`Action targets every project in this Grove.`,"all-groves":`Action targets every Grove on this machine.`};function p6(e,t){if(e===`all-groves`)return{kind:`all-groves`};if(t)return e===`grove`?{kind:`grove`,grove_id:t.grove.id}:{kind:`project`,grove_id:t.grove.id,project_id:t.project.project_id}}function m6(e){switch(e.kind){case`project`:return`the active project only`;case`grove`:return`every project in this Grove`;case`all-groves`:return`every Grove on this machine`}}function h6(e){switch(e.kind){case`project`:return`Project`;case`grove`:return`Grove`;case`all-groves`:return`All Groves`}}function g6({open:e,onOpenChange:t,action:n,scope:r,costEstimate:i,variant:a=`destructive`,onConfirm:o,isPending:s=!1}){let c=`${n} will run against ${m6(r)}. ${i?`Estimated cost: ${i}.`:``} This cannot be undone automatically.`,l=[{label:`Scope`,value:h6(r)}];return(0,G.jsx)(AM,{open:e,onOpenChange:t,title:n,description:c.trim(),icon:(0,G.jsx)(_o,{className:`h-5 w-5 text-tertiary`}),meta:l,confirmLabel:n,variant:a,onConfirm:o,isPending:s})}function _6(e,t){return t.kind===`all-groves`||e===`rebuild`||e===`vacuum`||e===`reindex`||e===`reembed-stale`&&t.kind===`grove`}function v6(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function y6(e){let t=new Map;for(let n of e){let e=new Date(n.modified_at).toISOString().slice(0,10),r=t.get(e)??[];r.push(n),t.set(e,r)}return t}function b6(e){let t=new Date().toISOString().slice(0,10),n=new Date(Date.now()-24*36e5).toISOString().slice(0,10);return e===t?`Today`:e===n?`Yesterday`:new Date(e).toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`})}function x6({open:e,onOpenChange:t,backups:n,groveId:r,headers:i}){let a=We(),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)({kind:`idle`});(0,W.useEffect)(()=>{e&&(s(null),l(null),d(null),p({kind:`idle`}))},[e]);async function m(e){s(e),l(null),d(null),p({kind:`idle`});try{l(await q(`/restore/preview`,{method:`POST`,headers:i,body:JSON.stringify({file_name:e.file_name})}))}catch(e){d($3(e))}}async function h(e){let t=Date.now()+30*6e4;for(;;){await new Promise(e=>setTimeout(e,2e3));let n=await q(`/restore/status?job_id=${encodeURIComponent(e)}`,{headers:i});if(n.status!==`running`)return n;if(Date.now()>t)return{...n,status:`error`,error:`Restore is taking unusually long; check the server logs.`}}}async function g(){if(o){p({kind:`restoring`});try{let e=await h((await q(`/restore`,{method:`POST`,headers:i,body:JSON.stringify({file_name:o.file_name})})).job_id);e.status===`done`&&e.result?(p({kind:`done`,result:e.result}),await a.invalidateQueries({queryKey:[`backups`,r]})):p({kind:`error`,message:e.error??`unknown error`})}catch(e){p({kind:`error`,message:$3(e)})}}}let _=f.kind===`restoring`;return(0,G.jsx)(Zf,{open:e,onOpenChange:e=>{_||t(e)},children:(0,G.jsxs)(tp,{className:`max-w-2xl`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Restore from backup`}),(0,G.jsx)(ap,{children:o?`Review what this backup holds, then restore. Restore merges records (existing rows are kept) and never deletes.`:`Pick a backup to restore. You’ll see its contents before anything happens.`})]}),o?(0,G.jsx)(C6,{backup:o,preview:c,previewError:u,phase:f,onBack:()=>{s(null),l(null),d(null),p({kind:`idle`})},onRestore:g,onClose:()=>t(!1)}):(0,G.jsx)(S6,{backups:n,onSelect:m})]})})}function S6({backups:e,onSelect:t}){return e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No backups available yet.`}):(0,G.jsx)(`div`,{className:`max-h-[55vh] overflow-y-auto pr-1 space-y-4`,children:Array.from(y6(e).entries()).map(([e,n])=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wider text-on-surface-variant sticky top-0 bg-surface-container-highest py-1`,children:b6(e)}),n.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:J(`w-full flex items-center justify-between rounded-md px-4 py-3 text-left`,`bg-surface-container-lowest hover:bg-surface-container-low transition-colors`),children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface`,children:v6(e.modified_at)}),(0,G.jsx)(X,{variant:`secondary`,children:Tv(e.size_bytes)}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant truncate`,children:e.machine_id})]}),(0,G.jsx)(ta,{className:`h-4 w-4 text-on-surface-variant shrink-0`})]},e.file_name))]},e))})}function C6({backup:e,preview:t,previewError:n,phase:r,onBack:i,onRestore:a,onClose:o}){let s=r.kind===`restoring`,c=r.kind===`done`;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:i,disabled:s,className:`inline-flex items-center gap-1.5 font-sans text-sm text-on-surface-variant hover:text-on-surface disabled:opacity-50`,children:[(0,G.jsx)(Ki,{className:`h-3.5 w-3.5`}),` All backups`]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface`,children:v6(e.modified_at)}),(0,G.jsx)(X,{variant:`secondary`,children:Tv(e.size_bytes)})]})]}),(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-lowest p-4`,children:[(0,G.jsx)(`p`,{className:`font-sans font-medium text-xs uppercase tracking-widest text-on-surface-variant mb-2`,children:`Backup contents`}),n?(0,G.jsxs)(`p`,{className:`font-sans text-sm text-tertiary`,children:[`Could not read contents: `,n]}):t?(0,G.jsx)(`div`,{className:`max-h-[34vh] overflow-y-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Backup contents`,children:[(0,G.jsx)(`thead`,{className:`sticky top-0 bg-surface-container-lowest`,children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Table`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`In backup`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`In database`})]})}),(0,G.jsx)(`tbody`,{children:t.tables.map((e,t)=>(0,G.jsxs)(`tr`,{className:J(t%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-1.5 pr-4`,children:e.table}),(0,G.jsx)(`td`,{className:`py-1.5 pr-4 text-right text-primary`,children:e.in_backup}),(0,G.jsx)(`td`,{className:`py-1.5 text-right text-on-surface-variant`,children:e.in_db})]},e.table))})]})}):(0,G.jsxs)(`p`,{className:`flex items-center gap-2 font-sans text-sm text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-3.5 w-3.5 animate-spin`}),` Reading backup contents…`]})]}),r.kind===`error`&&(0,G.jsxs)(`p`,{className:`font-sans text-sm text-tertiary`,children:[`Restore failed: `,r.message]}),s&&(0,G.jsxs)(`p`,{className:`flex items-center gap-2 font-sans text-sm text-primary`,children:[(0,G.jsx)(Ra,{className:`h-3.5 w-3.5 animate-spin`}),`Restoring… this runs in the background and can take a minute on a large backup. You can keep using Myco.`]}),c&&(0,G.jsxs)(`p`,{className:`flex items-center gap-2 font-sans text-sm text-primary`,children:[(0,G.jsx)(oa,{className:`h-3.5 w-3.5`}),`Restored `,r.result.total_restored,` records, skipped `,r.result.total_skipped,` already present.`]}),(0,G.jsx)(`div`,{className:`flex justify-end gap-2`,children:c?(0,G.jsx)(Y,{variant:`default`,size:`sm`,onClick:o,children:`Done`}):(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:a,disabled:s||!!n,children:[(0,G.jsx)(vo,{className:`mr-1.5 h-3.5 w-3.5`}),s?`Restoring…`:`Restore this backup`]})})]})}var w6=[`grove`,`all-groves`],T6=3;function E6({embedded:e=!1}={}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(`grove`),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(!1),d=Ss(),f=d?.grove.id??null,p=d?ko(d):void 0,m=ot({queryKey:[`backups`,f],queryFn:()=>q(`/backups`,{headers:p}),enabled:!!f}),h=m.data?.backups??[],g=!!f&&(m.isSuccess||m.isError),_=h.slice(0,T6),v=h.length>0?h[h.length-1]:null;async function y(){u(!0),n(null);try{let e=p6(r,d),t=await q(`/backup`,{method:`POST`,headers:p,body:JSON.stringify({scope:e})});t.summary?n({type:t.summary.failed>0?`error`:`success`,text:`Backed up ${t.summary.ok} Grove(s); ${t.summary.failed} failed`}):n({type:`success`,text:`Backup created (${Tv(t.size_bytes)})`}),await m.refetch()}catch(e){n({type:`error`,text:`Backup failed: ${$3(e)}`})}finally{u(!1)}}function b(){let e=p6(r,d);if(e&&_6(`backup`,e)){o(!0);return}y()}let x=m.isError?`Failed to load backups: ${$3(m.error)}`:null,S=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>m.refetch(),children:[(0,G.jsx)(Qa,{className:`mr-1.5 h-3.5 w-3.5`}),`Refresh`]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>c(!0),disabled:h.length===0,children:[(0,G.jsx)(vo,{className:`mr-1.5 h-3.5 w-3.5`}),`Restore…`]}),(0,G.jsxs)(Y,{variant:`default`,size:`sm`,onClick:b,disabled:l,children:[(0,G.jsx)(ga,{className:`mr-1.5 h-3.5 w-3.5`}),`Backup Now`]})]}),C=(0,G.jsxs)(G.Fragment,{children:[e?(0,G.jsx)(`div`,{className:`flex items-center justify-end`,children:S}):(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(ja,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(ZM,{children:`Backup & Restore`}),(0,G.jsx)(u6,{value:r,onChange:i,available:w6})]}),S]}),(0,G.jsx)(g6,{open:a,onOpenChange:o,action:`Create backup`,scope:p6(r,d)??{kind:`all-groves`},isPending:l,onConfirm:async()=>{await y(),o(!1)}}),(0,G.jsx)(x6,{open:s,onOpenChange:c,backups:h,groveId:f,headers:p}),!e&&(0,G.jsx)(OP,{path:`backup.dir`,label:`Backup Directory`,commitOn:`blur`,requiresRestart:!0,hint:`leave blank for default .myco/backups; ~ supported`,parse:e=>e===``?void 0:e,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Da,{className:`h-3.5 w-3.5 text-on-surface-variant shrink-0`}),(0,G.jsx)(`input`,{type:`text`,value:e??``,onChange:e=>t(e.target.value),onBlur:n,placeholder:`.myco/backups`,className:`flex-1 bg-surface-container text-on-surface font-mono text-sm rounded px-3 py-1.5 outline-hidden border border-outline-variant/15 focus:border-primary/40 placeholder:text-on-surface-variant/50`})]})}),(t||x)&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,t?.type===`success`?`text-primary`:`text-tertiary`),children:t?.text??x}),h.length>0?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[_.map((e,t)=>(0,G.jsx)(`div`,{className:`flex items-center justify-between rounded-md bg-surface-container-lowest px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface`,children:v6(e.modified_at)}),t===0&&(0,G.jsx)(X,{variant:`outline`,children:`Latest`}),(0,G.jsx)(X,{variant:`secondary`,children:Tv(e.size_bytes)}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant truncate`,children:e.machine_id})]})},e.file_name)),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[h.length,` backup`,h.length===1?``:`s`,` kept`,v?` · oldest ${v6(v.modified_at)}`:``,` · `,(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(!0),className:`text-primary hover:underline`,children:`browse & restore`})]})]}):g&&!x?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No backups yet. Click "Backup Now" to create one.`}):null]});return e?(0,G.jsx)(`div`,{className:`space-y-4`,children:C}):(0,G.jsx)(Q,{id:Pi.operationsBackup,level:`low`,className:`rounded-lg p-6 space-y-4 transition-all duration-300`,children:C})}var D6=[{id:`agent`,label:`Agent`,desc:`Default provider, runtime, and scheduled-task gates that drive the agent pipeline.`,category:`Agent`,icon:`Bot`,fields:[{key:`agent.provider.type`,label:`Provider`,scope:`grove`,kind:`select`,category:`Agent`,icon:`Bot`,options:[`anthropic`,`ollama`,`lmstudio`,`openai`,`openrouter`,`openai-compatible`],note:`Default provider for agent tasks. Individual tasks may override.`,customRender:`card-owns`},{key:`agent.provider.model`,label:`Model`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Provider-specific model identifier (e.g. claude-opus-4-7, gpt-oss:20b).`,customRender:`card-owns`},{key:`agent.provider.base_url`,label:`Base URL`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Override for self-hosted or OpenAI-compatible endpoints.`,customRender:`card-owns`},{key:`agent.provider.context_length`,label:`Context length`,scope:`grove`,kind:`number`,category:`Agent`,icon:`Bot`,note:`Context window size for local models (Ollama num_ctx, LM Studio context_length).`,customRender:`card-owns`},{key:`agent.reasoningLevel`,label:`Default reasoning profile`,scope:`grove`,kind:`select`,category:`Agent`,icon:`Bot`,options:[`low`,`default`,`high`],note:`Grove-wide default reasoning tier. Resolves to a model through the reasoning profiles, so it stays portable across model upgrades. Tasks may override per-task.`,customRender:`card-owns`},{key:`agent.model`,label:`Default model (advanced)`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Escape hatch — pins a specific model SKU when a reasoning tier has no mapping (e.g. local providers without a reasoning map).`,customRender:`card-owns`},{key:`agent.harness`,label:`Runtime`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Runtime id (e.g. claude-sdk, openai-agents). Picked from the installed runtime registry.`,customRender:`card-owns`},{key:`agent.run_retention_days`,label:`Agent run retention`,scope:`grove`,kind:`number`,category:`Agent`,icon:`Bot`,min:1,max:365,suffix:`days`,note:`Deletes completed, skipped, and non-resumable failed agent runs older than this window.`}]},{id:`scheduled-tasks`,label:`Scheduled tasks`,desc:`Master switches and freshness gates for the agent pipeline's scheduled and event-driven tasks.`,category:`Scheduled tasks`,icon:`Activity`,fields:[{key:`agent.scheduled_tasks_enabled`,label:`Scheduled tasks`,scope:`grove`,kind:`toggle`,category:`Scheduled tasks`,icon:`Activity`,note:`Master switch for all scheduled agent tasks (canopy-describe, intelligence-skill, etc.).`},{key:`agent.event_tasks_enabled`,label:`Event-driven tasks`,scope:`grove`,kind:`toggle`,category:`Scheduled tasks`,icon:`Activity`,note:`Master switch for tasks fired by capture events (e.g., end-of-session summaries).`},{key:`agent.scheduled_tasks_active_window_days`,label:`Active project window`,scope:`grove`,kind:`number`,category:`Scheduled tasks`,icon:`Activity`,min:0,max:365,suffix:`days`,note:`Only run scheduled tasks against projects touched within this window. 0 disables the gate (all projects always considered active).`}]},{id:`embedding`,label:`Embedding`,desc:`Vector embedding provider for spores, sessions, and semantic recall.`,category:`Embedding`,icon:`Brain`,fields:[{key:`embedding.provider`,label:`Provider`,scope:`grove`,kind:`select`,category:`Embedding`,icon:`Brain`,options:[`ollama`,`openai-compatible`,`openrouter`,`openai`],customRender:`card-owns`},{key:`embedding.model`,label:`Model`,scope:`grove`,kind:`text`,category:`Embedding`,icon:`Brain`,note:`Default is bge-m3. Must match the provider's embedding-model id.`,customRender:`card-owns`},{key:`embedding.base_url`,label:`Base URL`,scope:`grove`,kind:`text`,category:`Embedding`,icon:`Brain`,note:`Override for self-hosted or OpenAI-compatible endpoints.`,customRender:`card-owns`},{key:`embedding.run_in_deep_sleep`,label:`Keep embedding while deep-sleeping`,scope:`grove`,kind:`toggle`,category:`Embedding`,icon:`Brain`,note:`Keep draining the embedding queue when the daemon would otherwise enter deep sleep. Recommended when the backlog is large.`,customRender:`card-owns`}]},{id:`capture`,label:`Capture`,desc:`Where Myco picks up transcripts, plans, and other artifacts.`,category:`Capture`,icon:`MessageSquare`,fields:[{key:`capture.transcript_paths`,label:`Transcript paths`,scope:`machine`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`Additional directories scanned for agent transcripts. Empty uses the agent symbionts' defaults.`},{key:`capture.plan_dirs`,label:`Plan directories`,scope:`machine`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`Directories Myco watches for agent-authored plans.`,customRender:`card-owns`},{key:`capture.ignore_plan_dirs_in_git`,label:`Add plan dirs to .gitignore`,scope:`machine`,kind:`toggle`,category:`Capture`,icon:`MessageSquare`,note:`When on, Myco maintains a managed block in .gitignore covering the configured plan directories.`,customRender:`card-owns`},{key:`capture.artifact_extensions`,label:`Artifact extensions`,scope:`machine`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`File extensions captured as artifacts (e.g. .md, .py).`},{key:`capture.buffer_max_events`,label:`Event buffer size`,scope:`machine`,kind:`number`,category:`Capture`,icon:`MessageSquare`,min:100,step:100,note:`In-memory cap on pending capture events before backpressure kicks in.`}]},{id:`release-provenance`,label:`Release Provenance`,desc:`How Myco classifies session work against shipped, integrated, and unreleased refs.`,category:`Release Provenance`,icon:`GitBranch`,fields:[{key:`release_provenance.enabled`,label:`Enable release provenance`,scope:`project`,kind:`toggle`,category:`Release Provenance`,icon:`GitBranch`,customRender:`card-owns`},{key:`release_provenance.production_refs`,label:`Production refs`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Refs that represent shipped code (e.g. tags v*, refs/tags/release-*). Empty keeps state unreconciled rather than guessing.`,customRender:`card-owns`},{key:`release_provenance.integration_refs`,label:`Integration refs`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Refs that represent merged-but-not-yet-shipped code (e.g. main, develop).`,customRender:`card-owns`},{key:`release_provenance.github.repo`,label:`GitHub repo`,scope:`project`,kind:`text`,category:`Release Provenance`,icon:`GitBranch`,note:`owner/name. Empty disables PR-evidence lookup.`,customRender:`card-owns`},{key:`release_provenance.github.token_env`,label:`GitHub token env var`,scope:`project`,kind:`text`,category:`Release Provenance`,icon:`GitBranch`,note:`Name of the environment variable holding the GitHub token. Token values must never be stored in config.`,customRender:`card-owns`},{key:`release_provenance.github.max_lookups_per_run`,label:`Max PR lookups per run`,scope:`project`,kind:`number`,category:`Release Provenance`,icon:`GitBranch`,min:0,max:200,note:`Caps per-reconcile GitHub API calls so a noisy backlog can't drain the rate limit.`,customRender:`card-owns`},{key:`release_provenance.reconcile_interval_minutes`,label:`Reconcile interval (minutes)`,scope:`grove`,kind:`number`,category:`Release Provenance`,icon:`GitBranch`,min:1,max:1440,note:`How often the PowerManager-driven reconciler refreshes provenance state.`,customRender:`card-owns`},{key:`release_provenance.production_debug_include_unknown`,label:`Include unknown clues in production-debug`,scope:`project`,kind:`toggle`,category:`Release Provenance`,icon:`GitBranch`,note:`Lets production-debug retrieval surface unclassified clues alongside released hits.`,customRender:`card-owns`},{key:`release_provenance.package_map`,label:`Package map`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Monorepo path-glob → tag-pattern entries. Records outside any mapping fall back to the umbrella refs.`,customRender:`card-owns`}]},{id:`notifications`,label:`Notifications`,desc:`What Myco surfaces in the daemon UI and which channels it uses.`,category:`Notifications`,icon:`Bell`,fields:[{key:`notifications.enabled`,label:`Enable notifications`,scope:`machine`,kind:`toggle`,category:`Notifications`,icon:`Bell`,note:`Master switch — disables every notification channel when off.`,customRender:`card-owns`},{key:`notifications.default_mode`,label:`Default mode`,scope:`machine`,kind:`select`,category:`Notifications`,icon:`Bell`,options:[`banner`,`summary`],note:`How new notification types display until you customize them per-domain.`,customRender:`card-owns`},{key:`notifications.system_notifications`,label:`Browser system notifications`,scope:`machine`,kind:`toggle`,category:`Notifications`,icon:`Bell`,note:`Pipe banner-mode notifications through the browser Notification API.`,customRender:`card-owns`},{key:`notifications.retention_days`,label:`Notification retention (days)`,scope:`machine`,kind:`number`,category:`Notifications`,icon:`Bell`,min:0,max:365,suffix:`days`,note:`Deletes read and cleared notifications older than this window. Unread notifications are preserved.`,customRender:`card-owns`}]},{id:`skills`,label:`Skills`,desc:`Thresholds the skill-lifecycle pipeline uses to surface, promote, and retire skills.`,category:`Skills`,icon:`Sparkles`,fields:[{key:`skills.confidence_threshold`,label:`Auto-promote confidence`,scope:`grove`,kind:`number`,category:`Skills`,icon:`Sparkles`,min:0,max:1,step:.05,note:`Survey candidates above this score auto-promote without a manual approve.`},{key:`skills.usage_stale_days`,label:`Stale-skill window (days)`,scope:`grove`,kind:`number`,category:`Skills`,icon:`Sparkles`,min:0,suffix:`days`,note:`Skills with no usage in this many days get flagged for review.`}]},{id:`maintenance`,label:`Maintenance`,desc:`Background database hygiene jobs the daemon runs against this Grove.`,category:`Maintenance`,icon:`Wrench`,fields:[{key:`maintenance.auto_optimize`,label:`Auto-run PRAGMA optimize`,scope:`grove`,kind:`toggle`,category:`Maintenance`,icon:`Wrench`},{key:`maintenance.auto_optimize_interval_hours`,label:`Optimize interval (hours)`,scope:`grove`,kind:`number`,category:`Maintenance`,icon:`Wrench`,min:1,max:720,suffix:`hours`,dependsOn:{key:`maintenance.auto_optimize`,value:!0}},{key:`maintenance.auto_integrity_check`,label:`Auto-run integrity check`,scope:`grove`,kind:`toggle`,category:`Maintenance`,icon:`Wrench`,note:`Runs integrity + foreign-key checks on a slow cadence; failures surface in the Database panel.`},{key:`maintenance.auto_integrity_check_interval_hours`,label:`Integrity-check interval (hours)`,scope:`grove`,kind:`number`,category:`Maintenance`,icon:`Wrench`,min:1,max:8760,suffix:`hours`,dependsOn:{key:`maintenance.auto_integrity_check`,value:!0},note:`Default is 168 hours (weekly).`}]},{id:`backup`,label:`Backup`,desc:`Where Grove backups land and how many are kept.`,category:`Backup`,icon:`Save`,fields:[{key:`backup.dir`,label:`Backup directory`,scope:`grove`,kind:`text`,category:`Backup`,icon:`Save`,nullableEmpty:!0,note:`Override for the backup root. Supports ~. Defaults to <groveHome>/backups when empty.`},{key:`backup.auto_interval_hours`,label:`Auto-backup interval (hours)`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:1,max:720,suffix:`hours`,note:`Minimum hours between auto-backups. Default is 24 (one per day per machine).`},{key:`backup.retention.keep_daily`,label:`Daily backups to keep`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:1,max:365,suffix:`days`},{key:`backup.retention.keep_weekly`,label:`Weekly backups to keep`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:0,max:52,suffix:`weeks`,note:`Kept beyond the daily window for longer-term restore points.`}]},{id:`sessions`,label:`Sessions`,desc:`Session lifecycle thresholds the daemon uses for staleness detection.`,category:`Sessions`,icon:`Activity`,fields:[{key:`daemon.stale_session_threshold_ms`,label:`Stale-session threshold (ms)`,scope:`grove`,kind:`number`,category:`Sessions`,icon:`Activity`,min:1,max:10080,unit:{displayUnit:`minutes`,factor:6e4},note:`How long an idle session waits before it's auto-completed (display in minutes; daemon stores milliseconds).`}]},{id:`logging`,label:`Logging`,desc:`Daemon-process log verbosity and retention.`,category:`Logging`,icon:`ScrollText`,fields:[{key:`daemon.log_level`,label:`Log level`,scope:`machine`,kind:`select`,category:`Logging`,icon:`ScrollText`,options:[`debug`,`info`,`warn`,`error`]},{key:`daemon.log_retention_days`,label:`Log retention (days)`,scope:`machine`,kind:`number`,category:`Logging`,icon:`ScrollText`,min:1,max:365,suffix:`days`,note:`Window for log_entries rows. One daemon, one retention policy across every Grove it serves.`}]},{id:`upgrade`,label:`Upgrade`,desc:`Which release stream the daemon pulls upgrades from.`,category:`Upgrade`,icon:`RotateCcw`,fields:[{key:`daemon.update_channel`,label:`Upgrade channel`,scope:`machine`,kind:`select`,category:`Upgrade`,icon:`RotateCcw`,options:[`stable`,`beta`],note:`Use beta for dogfood/preview builds. Machine-wide — one channel per machine.`,customRender:`card-owns`}]}];function O6(){let e=ek(),t=UO(),n=KO(),r=WO(),i=qO(),a=t.data?.config,o=n.data?.config;return{readField:(0,W.useCallback)(t=>{switch(t.scope){case`project`:{let n=e.effective;return n==null?void 0:zO(n,t.key)}case`grove`:return a?zO(a,t.key):void 0;case`machine`:return o?zO(o,t.key):void 0}},[e.effective,a,o]),writeField:(0,W.useCallback)(async(t,n)=>{if(n===void 0)switch(t.scope){case`project`:await e.setField(t.key,void 0,`project`);return;case`grove`:await r.mutateAsync({clear:[t.key]});return;case`machine`:await i.mutateAsync({clear:[t.key]});return}switch(t.scope){case`project`:await e.setField(t.key,n,`project`);return;case`grove`:{let e={};BO(e,t.key,n),await r.mutateAsync({patch:e});return}case`machine`:{let e={};BO(e,t.key,n),await i.mutateAsync({patch:e});return}}},[e,r,i]),isLoading:e.isLoading||!!t.isLoading||!!n.isLoading,error:t.error??n.error??null,scopeCounts:(0,W.useMemo)(()=>{let e={project:0,grove:0,machine:0};for(let t of D6)for(let n of t.fields)n.customRender!==`card-owns`&&(e[n.scope]+=1);return e},[])}}var k6=[{value:`all`,label:`All`},{value:`project`,label:`Project`},{value:`grove`,label:`Grove`},{value:`machine`,label:`Machine`}];function A6({scope:e,onScopeChange:t,searchInput:n,onSearchChange:r,scopeCounts:i}){let a=i.project+i.grove+i.machine;return(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(`div`,{role:`tablist`,"aria-label":`Filter settings by scope`,className:`inline-flex overflow-hidden rounded-md border border-[var(--ghost-border)] bg-surface-container-low`,children:k6.map(n=>{let r=n.value===`all`?a:i[n.value],o=n.value===e;return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o,onClick:()=>t(n.value),className:J(`relative flex items-center gap-1.5 px-3 py-1.5 transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,o?`bg-sage/10 text-on-surface`:`text-on-surface-variant hover:bg-surface-container hover:text-on-surface`),children:[o&&(0,G.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-[2px] bg-sage`}),(0,G.jsx)(`span`,{className:J(`myco-display-xs`,!o&&`text-on-surface-variant`),children:n.label}),(0,G.jsx)(X,{variant:`outline`,className:`px-1 py-0 text-[10px] font-mono`,children:r})]},n.value)})}),(0,G.jsxs)(`div`,{className:`relative flex-1 min-w-[16rem] max-w-md`,children:[(0,G.jsx)(no,{className:`pointer-events-none absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-on-surface-variant`}),(0,G.jsx)(op,{type:`search`,value:n,placeholder:`Search settings...`,onChange:e=>r(e.target.value),className:`pl-8 pr-8`}),n&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>r(``),className:`absolute right-1.5 top-1/2 -translate-y-1/2 rounded-sm p-1 text-on-surface-variant hover:bg-surface-container-high/40 hover:text-on-surface`,children:(0,G.jsx)(So,{className:`h-4 w-4`})})]})]})}var j6={Activity:Gi,Bell:Ji,Bot:Xi,Brain:Zi,GitBranch:ka,MessageSquare:Ha,RotateCcw:$a,Save:eo,ScrollText:to,Sparkles:co,Users:yo,Wrench:xo};function M6({name:e,className:t}){return(0,G.jsx)(j6[e]??Xi,{className:t})}var N6={toggle:S3,select:C3,number:T3,text:E3,list:O3,secret:k3},P6={project:`project`,grove:`grove`,machine:`machine`};function F6(e,t){let[n,r]=(0,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function I6(e,t){return t?`${e.label} ${e.key} ${e.category}`.toLowerCase().includes(t.toLowerCase()):!0}function L6(e){return e.customRender!==`card-owns`}function R6(e){return e.fields.filter(L6)}function z6(e,t,n){return R6(e).filter(e=>t!==`all`&&e.scope!==t?!1:I6(e,n))}function B6(e,t){for(let n of D6)for(let r of n.fields)if(r.key===e&&r.scope===t)return r}function V6(e,t,n,r,i){if(i){let t=r.trim(),i=e=>n===`all`||e.scope===n;return t.length>0?e.fields.some(e=>i(e)&&I6(e,t)):n===`all`?!0:e.fields.some(e=>i(e))}return t.length>0}var H6=new Set([`agent`,`embedding`,`capture`,`release-provenance`,`notifications`,`upgrade`,`backup`,`logging`]),U6={agent:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(U3,{}),e.length>0&&(0,G.jsx)(X6,{fields:e,hasProject:t,unified:n})]}),embedding:()=>(0,G.jsx)(G3,{}),capture:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(A3,{}),e.length>0&&(0,G.jsx)(X6,{fields:e,hasProject:t,unified:n})]}),"release-provenance":()=>(0,G.jsx)(Q3,{}),notifications:()=>(0,G.jsx)(N3,{}),upgrade:()=>(0,G.jsx)(i6,{}),backup:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(X6,{fields:e,hasProject:t,unified:n}),(0,G.jsx)(E6,{embedded:!0})]}),logging:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(X6,{fields:e,hasProject:t,unified:n}),(0,G.jsx)(W6,{})]})};function W6(){let e=Bs().data?.context?.request?.machine_id??`—`;return(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 py-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:items-start`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Machine ID`}),(0,G.jsx)(Ok,{scope:P6.machine})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Stable identifier this daemon uses when speaking to the team worker. Read-only.`})]}),(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(`div`,{className:`flex h-9 w-full items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:e})})]})}function G6(){return(0,G.jsx)(SP,{children:(0,G.jsx)(K6,{})})}function K6(){let e=xs(),t=An(),n=e!==null,r=O6(),[i,a]=(0,W.useState)(`all`),[o,s]=(0,W.useState)(``),c=F6(o,150),[l,u]=(0,W.useState)(D6[0]?.id??``),d=(0,W.useRef)(null),f=(0,W.useMemo)(()=>D6.map(e=>{let t=H6.has(e.id),n=z6(e,i,c);return{group:e,isCustom:t,visibleFields:n,visible:V6(e,n,i,c,t),mixedScopes:new Set(e.fields.map(e=>e.scope)).size>1}}),[i,c]),p=f.some(e=>e.visible);(0,W.useEffect)(()=>{let e=t.hash.replace(`#`,``);if(!e||!D6.some(t=>t.id===e))return;u(e);let n=document.getElementById(e);n&&requestAnimationFrame(()=>n.scrollIntoView({behavior:`auto`,block:`start`}))},[t.hash]),(0,W.useEffect)(()=>{if(r.isLoading)return;let e=new URLSearchParams(t.search),n=e.get(`configField`),i=e.get(`configSection`);if(!n&&!i)return;let a=[`ring-2`,`ring-primary/40`,`bg-primary/5`],o=(()=>{if(n){let e=n;for(;e.length>0;){let t=document.getElementById(Fi(e));if(t)return t;let n=e.lastIndexOf(`.`);if(n===-1)break;e=e.slice(0,n)}}if(i){let e=document.getElementById(i);if(e)return e}return null})();o&&(i&&D6.some(e=>e.id===i)&&u(i),requestAnimationFrame(()=>{o.scrollIntoView({behavior:`smooth`,block:`center`}),o.classList.add(...a),window.setTimeout(()=>o.classList.remove(...a),2e3)}))},[r.isLoading,t.search]);let m=(0,W.useCallback)(e=>{u(e);let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})},[]);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`px-6 pt-6`,children:[(0,G.jsx)(yP,{title:`Settings`,subtitle:`Project, Grove, and Machine settings in one place. Use the filter bar to narrow by scope.`}),(0,G.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-md border border-outline-variant/30 bg-surface-container/40 px-3 py-2 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Scopes`}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(Ok,{scope:`personal`}),` only you, this machine`]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(Ok,{scope:`project`}),` shared via the repo`]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(Ok,{scope:`grove`}),` all projects in this Grove`]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(Ok,{scope:`machine`}),` every Grove on this machine`]}),(0,G.jsx)(`span`,{className:`text-on-surface-variant/70`,children:`Precedence: Personal › Project › Grove › Machine.`})]}),!n&&(0,G.jsx)(`div`,{className:`mb-3 rounded-md border border-outline-variant/30 bg-surface-container/40 px-3 py-2 font-sans text-sm text-on-surface-variant`,children:`Select a project to edit Project and Grove settings. Machine-scoped settings are still editable below.`}),(0,G.jsx)(TP,{}),(0,G.jsx)(A6,{scope:i,onScopeChange:a,searchInput:o,onSearchChange:s,scopeCounts:r.scopeCounts})]}),(0,G.jsx)(`div`,{ref:d,className:`flex-1 overflow-auto px-6 pb-6`,children:(0,G.jsxs)(`div`,{className:`flex gap-6`,children:[(0,G.jsx)(q6,{summaries:f,activeId:l,onSelect:m}),(0,G.jsxs)(`main`,{className:`flex-1 space-y-4`,children:[!p&&(0,G.jsx)(`div`,{className:`flex h-64 items-center justify-center font-sans text-sm text-on-surface-variant`,children:`No settings match your filters.`}),f.map(e=>e.visible?(0,G.jsx)(J6,{group:e.group,isCustom:e.isCustom,visibleFields:e.visibleFields,mixedScopes:e.mixedScopes,hasProject:n,unified:r},e.group.id):null)]})]})})]})}function q6({summaries:e,activeId:t,onSelect:n}){return(0,G.jsx)(`nav`,{"aria-label":`Settings sections`,className:`sticky top-0 hidden h-fit w-[200px] shrink-0 self-start lg:block`,children:(0,G.jsx)(`ul`,{className:`space-y-0.5 py-2`,children:e.map(({group:e,visible:r,isCustom:i,visibleFields:a})=>{let o=e.id===t,s=i?R6(e).length:a.length;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:J(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left font-sans text-sm transition-colors`,o?`bg-surface-container-high/60 text-on-surface`:`text-on-surface-variant hover:bg-surface-container/40 hover:text-on-surface`,!r&&`opacity-40`),children:[(0,G.jsx)(M6,{name:e.icon,className:`h-4 w-4 shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:s})]})},e.id)})})})}function J6({group:e,isCustom:t,visibleFields:n,mixedScopes:r,hasProject:i,unified:a}){return(0,G.jsx)(Q,{level:`low`,className:`rounded-md p-4`,children:(0,G.jsxs)(`section`,{id:e.id,className:`scroll-mt-4`,children:[(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(M6,{name:e.icon,className:`h-4 w-4 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e.category}),(0,G.jsx)(`h2`,{className:`font-sans text-base text-on-surface`,children:e.label}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-outline`,children:e.desc})]}),r&&(0,G.jsx)(X,{variant:`outline`,className:`text-[10px]`,children:`Mixed scopes`})]}),t?(0,G.jsx)(Y6,{groupId:e.id,fields:n,hasProject:i,unified:a}):(0,G.jsx)(X6,{fields:n,hasProject:i,unified:a})]})})}function Y6({groupId:e,fields:t,hasProject:n,unified:r}){let i=U6[e];return i?(0,G.jsx)(`div`,{children:i({fields:t,hasProject:n,unified:r})}):null}function X6({fields:e,hasProject:t,unified:n}){return e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No fields match the current filters.`}):(0,G.jsx)(`div`,{className:`divide-y divide-outline-variant/20`,children:e.map(e=>(0,G.jsx)(Z6,{field:e,hasProject:t,unified:n},e.key))})}function Z6({field:e,hasProject:t,unified:n}){let r=Fi(e.key),i=`setting-${e.key.replace(/\./g,`-`)}`,a=n.readField(e),o=e.scope===`grove`&&!t||e.scope===`project`&&!t,s=(()=>{if(!e.dependsOn)return!1;let t=B6(e.dependsOn.key,e.scope);return t?n.readField(t)!==e.dependsOn.value:!1})(),c=o||s,[l,u]=(0,W.useState)(null),d=(0,W.useCallback)(t=>{u(null),n.writeField(e,t).catch(t=>{u(t instanceof Error?t.message:String(t)),console.error(`[settings] writeField failed: ${e.key}`,t)})},[n,e]),f=JO(),p=YO(),m=e.scope===`machine`&&e.kind===`list`,h=m?t=>f.mutate({path:e.key,value:t}):void 0,g=m?t=>p.mutate({path:e.key,value:t}):void 0;return(0,G.jsxs)(`div`,{id:r,className:`grid grid-cols-1 gap-3 py-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:items-start scroll-mt-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:i,className:`font-sans text-sm font-medium text-on-surface`,children:e.label}),(0,G.jsx)(Ok,{scope:P6[e.scope]}),(0,G.jsx)(`code`,{className:`font-mono text-[10px] text-on-surface-variant`,children:e.key})]}),e.note&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:e.note})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Q6,{inputId:i,field:e,value:a,onChange:d,disabled:c,onAdd:h,onRemove:g}),l&&(0,G.jsx)(`p`,{role:`alert`,className:`mt-1 font-sans text-xs text-tertiary`,children:l})]})]})}function Q6({inputId:e,field:t,value:n,onChange:r,disabled:i,onAdd:a,onRemove:o}){if(!N6[t.kind])return null;switch(t.kind){case`toggle`:return(0,G.jsx)(S3,{id:e,value:n??!1,onChange:e=>r(e),disabled:i,readonly:t.readonly});case`select`:return(0,G.jsx)(C3,{id:e,value:n??``,onChange:e=>r(e),options:t.options??[],disabled:i,readonly:t.readonly});case`number`:{let a=t.unit?.factor??1,o=typeof n==`number`?n:0;return(0,G.jsx)(T3,{id:e,value:a===1?o:o/a,onChange:e=>r(a===1?e:e*a),min:t.min,max:t.max,step:t.step,suffix:t.unit?.displayUnit??t.suffix,disabled:i,readonly:t.readonly})}case`text`:return(0,G.jsx)(E3,{id:e,value:typeof n==`string`?n:``,onChange:e=>{let n=typeof e==`string`?e:``;t.nullableEmpty&&n.length===0?r(void 0):r(e)},disabled:i,readonly:t.readonly});case`list`:return(0,G.jsx)(O3,{id:e,value:Array.isArray(n)?n:[],onChange:e=>r(e),disabled:i,readonly:t.readonly,onAdd:a,onRemove:o});case`secret`:return(0,G.jsx)(k3,{id:e,value:typeof n==`string`?n:``,onChange:e=>r(e),disabled:i,readonly:t.readonly});default:return null}}function $6({Icon:e,children:t,...n}){return(0,G.jsxs)(Uj,{...n,children:[(0,G.jsx)(e,{className:`h-3 w-3 mr-1.5`,"aria-hidden":!0}),t]})}function e8({term:e,children:t}){return(0,G.jsxs)(`div`,{className:`flex justify-between gap-2 text-xs`,children:[(0,G.jsx)(`dt`,{className:`text-on-surface-variant`,children:e}),(0,G.jsx)(`dd`,{className:`text-on-surface`,children:t})]})}function t8({name:e,slug:t,projectCount:n,machineId:r}){return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:go,tone:`sage`,children:`Grove`}),title:e,children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(e8,{term:`Slug`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:t})}),(0,G.jsx)(e8,{term:`Projects`,children:(0,G.jsx)(`span`,{children:n})}),(0,G.jsx)(e8,{term:`Machine`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:r})})]})})}function n8({uptimeSeconds:e,port:t,version:n}){return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:mo,tone:`sage`,children:`Daemon`}),title:qk(e),children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(e8,{term:`Port`,children:(0,G.jsxs)(`code`,{className:`font-mono`,children:[`:`,t]})}),(0,G.jsx)(e8,{term:`Version`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:n})}),(0,G.jsx)(e8,{term:`Status`,children:(0,G.jsx)(X,{variant:`default`,children:`running`})})]})})}function r8(e){return e?`?team_id=${encodeURIComponent(e)}`:``}function i8(e){let t=r8(e);return As({queryKey:[`team-status`,e??null],queryFn:({signal:e})=>q(`/team/status${t}`,{signal:e}),refetchInterval:js.STATS,pollCategory:`standard`})}function a8(e,t){let n=r8(t);return As({queryKey:[`team-queue-stats`,t??null],queryFn:({signal:e})=>q(`/team/queue-stats${n}`,{signal:e}),refetchInterval:js.TEAM,pollCategory:`standard`,enabled:e,placeholderData:H})}function o8(e,t){let n=r8(t);return As({queryKey:[`team-sync-summary`,t??null],queryFn:({signal:e})=>q(`/team/sync-summary${n}`,{signal:e}),refetchInterval:js.TEAM,pollCategory:`standard`,enabled:e,placeholderData:H})}function s8(e,t){let n=r8(t);return As({queryKey:[`team-dlq`,t??null],queryFn:({signal:e})=>q(`/team/dlq${n}`,{signal:e}),refetchInterval:js.TEAM,pollCategory:`standard`,enabled:e,placeholderData:H})}function c8(){return As({queryKey:[`team-registry`],queryFn:({signal:e})=>q(`/team/registry`,{signal:e}),refetchInterval:js.TEAM,pollCategory:`standard`})}function l8(){return As({queryKey:[`team-projects`],queryFn:({signal:e})=>q(`/team/projects`,{signal:e}),refetchInterval:js.TEAM,pollCategory:`standard`})}function u8(){let e=We();return st({mutationFn:e=>os(`/team/project-membership`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`team-registry`]}),e.invalidateQueries({queryKey:[`team-projects`]})}})}function d8(){let e=We();return st({mutationFn:e=>os(`/team/join`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`team-registry`]}),e.invalidateQueries({queryKey:[`team-projects`]}),e.invalidateQueries({queryKey:[`team-status`]})}})}function f8(){let e=We();return st({mutationFn:e=>os(`/team/forget`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`team-registry`]}),e.invalidateQueries({queryKey:[`team-projects`]}),e.invalidateQueries({queryKey:[`team-status`]})}})}function p8(e){let t=r8(e);return As({queryKey:[`team-members`,e??null],queryFn:({signal:e})=>q(`/team/members${t}`,{signal:e}),refetchInterval:js.STATS,pollCategory:`standard`})}function m8({groveSlug:e}){let{data:t}=i8(),{data:n}=p8(),r=t?.enabled??!1,i=t?.healthy??!1,a=r?i?`default`:`destructive`:`outline`,o=r?i?`synced`:`unhealthy`:`not connected`,s=n?.members.length??0;return(0,G.jsx)(ri,{to:`/g/${e}/team`,className:`block transition-opacity hover:opacity-90`,children:(0,G.jsx)(Wj,{tone:`ochre`,eyebrow:(0,G.jsx)($6,{Icon:yo,tone:`ochre`,children:`Team`}),title:`${s} member${s===1?``:`s`}`,children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(e8,{term:`Status`,children:(0,G.jsx)(X,{variant:a,children:o})}),(0,G.jsx)(e8,{term:`Pending sync`,children:(0,G.jsx)(`span`,{children:t?.pending_sync_count??0})})]})})})}function h8({groveSlug:e}){let{data:t,isLoading:n}=cv(),r=(t?.projects??[]).filter(t=>t.grove_slug===e).sort((e,t)=>(t.last_activity_at?Date.parse(t.last_activity_at):0)-(e.last_activity_at?Date.parse(e.last_activity_at):0));return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:`Projects`,title:`In this Grove`,actions:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:r.length}),padded:!1,children:n&&r.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`Loading…`}):r.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`No projects yet.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:r.map(t=>(0,G.jsx)(`li`,{children:(0,G.jsx)(kM,{accent:`sage`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(Ia,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(ri,{to:`/g/${e}/p/${t.project_id}`,className:`block truncate text-sm text-on-surface hover:text-sage`,children:t.project_name}),(0,G.jsxs)(`div`,{className:`flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[t.scheduled_runs_last_24h,` run`,t.scheduled_runs_last_24h===1?``:`s`,` / 24h`]}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[`last activity`,` `,t.last_activity_at?pv(t.last_activity_at):`never`]})]})]}),(0,G.jsx)(X,{variant:t.is_active?`default`:`outline`,children:t.is_active?`active`:`cold`})]})})},t.project_id))})})}function g8(e){let t=Nn(),{data:n,isLoading:r}=IA({status:`active`,limit:10}),i=n?.sessions??[];return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:`Active now`,title:`${i.length} ${i.length===1?`live session`:`live sessions`}`,padded:!1,children:r&&i.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`Loading…`}):i.length===0?(0,G.jsxs)(`div`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:[(0,G.jsx)(`p`,{className:`font-medium m-0`,children:`Nothing active`}),(0,G.jsx)(`p`,{className:`text-xs m-0`,children:`No symbiont sessions are running right now in this Grove.`})]}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:i.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(kM,{accent:`sage`,onClick:()=>t(`/sessions/${e.id}`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Vk,{tone:`sage`,pulse:!0}),(0,G.jsx)(`span`,{className:`truncate text-sm text-on-surface flex-1 min-w-0`,children:e.title||`Untitled session`}),(0,G.jsx)(X,{variant:`outline`,children:e.agent}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:mv(e.started_at)})]}),e.branch&&(0,G.jsxs)(`div`,{className:`mt-1 ml-5 flex items-center gap-1 font-mono text-[10px] italic text-on-surface-variant`,children:[(0,G.jsx)(ka,{className:`h-2.5 w-2.5`}),e.branch]})]})},e.id))})})}function _8(e=`project`){let t=e===`all-groves`?`grove`:e;return As({queryKey:[`embedding-details`,t],queryFn:({signal:e})=>q(`/embedding/details?scope=${t}`,{signal:e}),refetchInterval:js.STATS,pollCategory:`standard`})}function v8(){return As({queryKey:[`database-details`],queryFn:({signal:e})=>q(`/database/details`,{signal:e}),refetchInterval:js.STATS,pollCategory:`standard`})}function y8({groveSlug:e}){let{data:t}=_8(`grove`),{data:n}=v8(),r=t?Object.values(t.pending).reduce((e,t)=>e+t,0):0;return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:ma,tone:`sage`,children:`Grove`}),title:`Vault`,actions:(0,G.jsxs)(ri,{to:`/g/${e}/operations`,className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Operations `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,G.jsx)(Qj,{label:`Vectors`,value:t?String(t.total):`—`,tone:`sage`,mono:!0}),(0,G.jsx)(Qj,{label:`Pending`,value:String(r),tone:r>0?`ochre`:`default`,mono:!0}),(0,G.jsx)(Qj,{label:`DB size`,value:n?Tv(n.file.size_bytes):`—`,tone:`sage`,mono:!0}),(0,G.jsx)(Qj,{label:`Fragmentation`,value:n?`${n.file.fragmentation_pct.toFixed(1)}%`:`—`,tone:n&&n.file.fragmentation_pct>25?`ochre`:`default`,mono:!0})]})})}function b8({error:e,isLoading:t,backups:n,last:r}){return e?`Snapshot unavailable`:t||!n?`—`:r?pv(r.modified_at):`No backups yet`}function x8(){let e=Ss(),t=e?.grove.id??null,n=(0,W.useMemo)(()=>e?ko(e):void 0,[e]),{data:r,error:i,isLoading:a}=ot({queryKey:[`backups`,t],queryFn:({signal:e})=>q(`/backups`,{signal:e,headers:n}),enabled:!!t}),o=r?.backups??null,s=o&&o.length>0?o[0]:null,c=o?o.slice(1,5):[];return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:`Backup`,title:b8({error:i??null,isLoading:a,backups:o,last:s}),actions:(0,G.jsxs)(ri,{to:`/settings#backup`,className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Settings `,(0,G.jsx)(qi,{className:`h-3 w-3`})]}),children:i?(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0`,children:i.message}):a||!o?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Loading…`}):s===null?(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:[`Use `,(0,G.jsx)(`span`,{className:`text-on-surface`,children:`Backup Now`}),` in Settings to create the first snapshot.`]}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-on-surface`,children:[(0,G.jsx)(Ta,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsx)(`code`,{className:`font-mono truncate`,children:s.file_name})]}),(0,G.jsxs)(`div`,{className:`mt-1 flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(ua,{className:`h-3 w-3`}),pv(s.modified_at)]}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsx)(`span`,{children:Tv(s.size_bytes)})]})]}),c.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`myco-eyebrow-sm text-outline`,children:`Recent`}),(0,G.jsx)(`ul`,{className:`mt-1 m-0 p-0 list-none flex flex-col gap-0.5`,children:c.map(e=>(0,G.jsxs)(`li`,{className:`flex justify-between text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:pv(e.modified_at)}),(0,G.jsx)(`span`,{children:Tv(e.size_bytes)})]},e.file_name))})]})]})})}function S8({currentGroveSlug:e}){let{data:t,isLoading:n}=_s(),r=(t?.groves??[]).filter(t=>t.slug!==e);return n&&r.length===0?(0,G.jsx)(Wj,{tone:`ochre`,eyebrow:`Other Groves`,title:`Loading…`}):r.length===0?(0,G.jsx)(Wj,{tone:`ochre`,eyebrow:`Other Groves`,title:`Just this one`,children:(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:[`Create another with `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco grove create`}),`.`]})}):(0,G.jsx)(Wj,{tone:`ochre`,eyebrow:`Other Groves`,title:`${r.length} ${r.length===1?`sibling Grove`:`sibling Groves`}`,children:(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:r.map(e=>(0,G.jsxs)(ri,{to:`/g/${e.slug}`,className:`block rounded-md border border-[var(--ghost-border)] p-3 transition-colors hover:bg-surface-container`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(go,{className:`h-3.5 w-3.5 text-ochre`}),(0,G.jsx)(`span`,{className:`truncate text-sm font-medium text-on-surface`,children:e.name}),e.is_default&&(0,G.jsx)(X,{variant:`outline`,children:`default`})]}),(0,G.jsxs)(`div`,{className:`mt-1 flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e.slug}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[e.project_count,` project`,e.project_count===1?``:`s`]})]})]},e.slug))})})}function C8(){let e=xs(),{data:t}=Bs();if(!e||!t)return(0,G.jsx)(Lj,{isLoading:!0,error:null,loadingText:`Loading Grove…`,children:(0,G.jsx)(`span`,{})});let n=e.grove;return(0,G.jsxs)(zj,{children:[(0,G.jsx)(yP,{title:n.name,subtitle:`Database boundary for this set of projects. Embedding, vault, backups, and team sync are all Grove-scoped.`}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,G.jsx)(t8,{name:n.name,slug:n.slug,projectCount:n.project_count??0,machineId:t.context.request.machine_id}),(0,G.jsx)(n8,{uptimeSeconds:t.daemon.uptime_seconds,port:t.daemon.port,version:t.daemon.version}),(0,G.jsx)(m8,{groveSlug:n.slug})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,G.jsx)(h8,{groveSlug:n.slug}),(0,G.jsx)(g8,{groveSlug:n.slug})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,G.jsx)(y8,{groveSlug:n.slug}),(0,G.jsx)(x8,{})]}),(0,G.jsx)(S8,{currentGroveSlug:n.slug})]})}var w8=[`sessions`,`spores`,`plans`,`artifacts`,`skill_records`,`canopy_entries`],T8={},E8=20;function D8(e){return e.provider.available?Object.values(e.pending).some(e=>e>0)?`processing`:`idle`:`unavailable`}function O8(e){return e.provider.available?Object.values(e.pending).some(e=>e>0)?`bg-secondary`:`bg-primary`:`bg-tertiary`}function k8({data:e}){return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Embedding namespace breakdown`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Namespace`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Embedded`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Pending`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Stale`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Total`})]})}),(0,G.jsx)(`tbody`,{children:w8.map((t,n)=>{let r=e.namespace_breakdown?.[t],i=e.by_namespace[t],a=r?.embedded??i?.embedded??0,o=r?.pending??e.pending[t]??0,s=r?.stale??i?.stale??0,c=r?.total??a+o;return(0,G.jsxs)(`tr`,{className:J(`transition-colors hover:bg-surface-container-high/50`,n%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-2.5 pr-4`,children:T8[t]??t}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:a}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:o>0?(0,G.jsx)(`span`,{className:`text-secondary`,children:o}):o}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:s>0?(0,G.jsx)(`span`,{className:`text-tertiary`,children:s}):s}),(0,G.jsx)(`td`,{className:`py-2.5 text-right`,children:c})]},t)})})]})})}function A8(){let e=We(),t=xs(),[n,r]=(0,W.useState)(null),i=`grove`,{data:a,isLoading:o,isError:s,error:c}=_8(`grove`),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1);function p(e,n,r,a){let o=p6(i,t);if(!(o&&_6(e,o))){r();return}u({action:n,scopeKind:i,run:r,variant:a})}let[m,h]=(0,W.useState)([]),g=a?.total??null;(0,W.useEffect)(()=>{g!==null&&h(e=>{let t=[...e,g];return t.length>E8?t.slice(-20):t})},[g]);async function _(){r(null);try{let n=await os(`/embedding/reembed-stale`,{scope:p6(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Re-embed dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Re-embedded ${n.reembedded??0} stale vectors in ${n.passes??0} pass(es)`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${$3(e)}`})}}function v(){p(`reembed-stale`,`Re-embed stale vectors`,_)}async function y(){r(null);try{let n=await os(`/embedding/rebuild`,{scope:p6(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Rebuild dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Rebuild cleared ${n.queued??0} vectors and re-embedded ${n.embedded??0} records (passes ${n.passes??0}, remaining ${n.remaining_queue_depth??0})`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${$3(e)}`})}}function b(){p(`rebuild`,`Rebuild all vectors`,y,`destructive`)}async function x(){r(null);try{let n=await os(`/embedding/clean-orphans`,{scope:p6(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Clean orphans dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Cleaned ${n.orphans_cleaned??0} orphan vectors`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${$3(e)}`})}}function S(){p(`clean-orphans`,`Clean orphan vectors`,x)}async function C(){r(null);try{let n=await os(`/embedding/reconcile`,{scope:p6(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Reconcile dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Reconcile complete: ${n.embedded??0} embedded, ${n.orphans_cleaned??0} orphans cleaned (${n.duration_ms??0}ms)`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${$3(e)}`})}}function w(){p(`reconcile`,`Force reconcile embeddings`,C)}if(!a)return(0,G.jsx)(Lj,{isLoading:o,error:s?c instanceof Error?c:Error(`Unable to reach daemon`):null,loadingText:`Loading embedding details...`,children:(0,G.jsx)(`div`,{})});let T=w8.reduce((e,t)=>e+(a.namespace_breakdown?.[t]?.pending??a.pending[t]??0),0),E=w8.reduce((e,t)=>e+(a.namespace_breakdown?.[t]?.stale??a.by_namespace[t]?.stale??0),0),D=a.canopy_describe?.pending??0;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-sans text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ma,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Provider`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:a.provider.name})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Model`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface truncate max-w-[200px]`,title:a.provider.model,children:a.provider.model})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:J(`h-2 w-2 rounded-full`,O8(a))}),(0,G.jsx)(`span`,{className:`text-on-surface-variant capitalize`,children:D8(a)})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3`,children:[(0,G.jsx)(G2,{label:`Total Vectors`,value:String(a.total),sparklineData:m,accent:`sage`}),(0,G.jsx)(G2,{label:`Pending`,value:String(T),accent:T>0?`ochre`:`outline`}),(0,G.jsx)(G2,{label:`Stale`,value:String(E),accent:E>0?`terracotta`:`outline`}),(0,G.jsx)(G2,{label:`Canopy Scribe`,value:String(D),sublabel:D>0?`${a.canopy_describe?.undescribed??0} new, ${a.canopy_describe?.stale??0} stale`:`fresh`,accent:D>0?`ochre`:`outline`})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(ZM,{children:`Namespace Breakdown`}),(0,G.jsx)(k8,{data:a})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(ZM,{children:`Actions`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:v,children:[(0,G.jsx)(Qa,{className:`mr-2 h-4 w-4`}),`Re-embed stale`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:S,children:[(0,G.jsx)(ho,{className:`mr-2 h-4 w-4`}),`Clean orphans`]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:w,children:[(0,G.jsx)(Ja,{className:`mr-2 h-4 w-4`}),`Force reconcile`]}),(0,G.jsxs)(Y,{variant:`destructive`,size:`sm`,onClick:b,children:[(0,G.jsx)($a,{className:`mr-2 h-4 w-4`}),`Rebuild all`]})]}),n&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,n.type===`success`?`text-primary`:`text-tertiary`),children:n.text})]}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(ri,{to:`/logs?component=embedding`,className:`font-sans text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1`,children:`View embedding activity in Logs →`})}),l&&(0,G.jsx)(g6,{open:!0,onOpenChange:e=>{e||u(null)},action:l.action,scope:p6(l.scopeKind,t)??{kind:`all-groves`},variant:l.variant,isPending:d,onConfirm:async()=>{f(!0);try{await l.run()}finally{f(!1),u(null)}}})]})}var j8=15,M8=`insufficient_disk_space`,N8=20,P8=[`grove`,`all-groves`];function F8(e){if(e<=0)return`now`;let t=Math.floor(e/1e3);if(t<60)return t+`s`;let n=Math.floor(t/60);return n<60?n+`m`:Math.floor(n/60)+`h`}function I8({title:e,value:t,onChange:n,available:r}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(ZM,{children:e}),(0,G.jsx)(u6,{value:t,onChange:n,available:r})]})}function L8({scope:e}){return(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:f6[e]})}function R8({tables:e}){let t=[...e].sort((e,t)=>t.rows-e.rows);return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Database table breakdown`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Table`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Rows`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Indexes`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Type`})]})}),(0,G.jsx)(`tbody`,{children:t.map((e,t)=>(0,G.jsxs)(`tr`,{className:J(`transition-colors hover:bg-surface-container-high/50`,t%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-2.5 pr-4`,children:e.name}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:e.rows.toLocaleString()}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:e.index_count}),(0,G.jsx)(`td`,{className:`py-2.5`,children:e.is_fts?(0,G.jsx)(X,{variant:`outline`,className:`px-1.5 py-0 text-[10px] uppercase`,children:`FTS5`}):(0,G.jsx)(`span`,{className:`text-on-surface-variant/60`,children:`btree`})})]},e.name))})]})})}function z8({details:e,onActionResult:t}){let{effective:n}=ek(),r=We(),i=xs(),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(`grove`),[l,u]=(0,W.useState)(!1);if(!n)return null;let d=n.maintenance.auto_optimize,f=n.maintenance.auto_optimize_interval_hours,p=e.last_optimize_at?new Date(e.last_optimize_at).getTime():null,m=p===null?0:p+f*lv*1e3-Date.now();async function h(){o(!0);try{let e=await os(`/database/optimize`,{scope:p6(s,i)});if(e.summary)t({type:e.summary.failed>0?`error`:`success`,text:`Optimize dispatched across ${e.summary.ok+e.summary.failed} Grove(s); ${e.summary.failed} failed`});else{let n=e.actions_failed?.length??0;t({type:n>0?`error`:`success`,text:`Optimize complete: `+(e.actions_completed?.length??0)+` steps, `+n+` failed (`+(e.duration_ms??0)+`ms)`})}r.invalidateQueries({queryKey:[`database-details`]})}catch(e){t({type:`error`,text:`Error: `+$3(e)})}finally{o(!1)}}function g(){let e=p6(s,i);if(e&&_6(`optimize`,e)){u(!0);return}h()}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(I8,{title:`Scheduled Maintenance`,value:s,onChange:c,available:P8}),(0,G.jsx)(L8,{scope:s}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Auto-optimize`}),` `,d?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-primary`,children:`on`}),`, every `,f,`h.`]}):(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`off.`}),` `,(0,G.jsx)(ri,{to:`/settings#maintenance`,className:`text-primary hover:text-primary/80 transition-colors text-xs`,children:`Configure in Settings →`})]}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Last run: `,e.last_optimize_at?pv(e.last_optimize_at):`never`,d&&p!==null&&(0,G.jsxs)(G.Fragment,{children:[` · Next: `,F8(m)]})]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:g,disabled:a,children:[(0,G.jsx)(Ja,{className:`mr-2 h-4 w-4`}),a?`Running...`:`Run now`]}),(0,G.jsx)(g6,{open:l,onOpenChange:u,action:`Optimize database`,scope:p6(s,i)??{kind:`all-groves`},isPending:a,onConfirm:async()=>{await h(),u(!1)}})]})}function B8({onActionResult:e}){let[t,n]=(0,W.useState)(!1);async function r(){n(!0);try{let t=await os(`/api/maintenance/release-provenance/reconcile`,{});if(t.disabled){e({type:`success`,text:`Release provenance reconciliation is disabled in config.`});return}let n=t.results??[],r=n.reduce((e,t)=>({reconciled:e.reconciled+t.reconciled,unchanged:e.unchanged+t.unchanged,failed:e.failed+t.failed,errors:e.errors+ +!!t.error}),{reconciled:0,unchanged:0,failed:0,errors:0}),i=`Release reconcile: ${n.length} project(s), ${r.reconciled} updated, ${r.unchanged} unchanged${r.failed?`, ${r.failed} rows failed`:``}${r.errors?`, ${r.errors} project errors`:``}.`;e({type:r.errors>0?`error`:`success`,text:i})}catch(t){e({type:`error`,text:`Error: `+$3(t)})}finally{n(!1)}}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(ZM,{children:`Release provenance`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Re-runs ancestry, patch-id, and (when configured) GitHub PR squash evidence checks for every served project. Reconciliation is idempotent — safe to invoke repeatedly. Status counts surface in each Grove's maintenance summary.`}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{onClick:r,disabled:t,variant:`outline`,size:`sm`,children:t?`Reconciling...`:`Reconcile now`})})]})}function V8({onActionResult:e}){let t=We(),n=xs(),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(`grove`),[s,c]=(0,W.useState)(null);function l(e,t,r,i){let o=p6(a,n);if(!(o&&_6(e,o))){r();return}c({action:t,run:r,variant:i})}async function u(){i(!0);try{let r=await os(`/database/integrity-check`,{scope:p6(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Integrity check across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):r.status===`ok`?e({type:`success`,text:`Integrity check OK (`+(r.duration_ms??0)+`ms)`}):e({type:`error`,text:`Integrity issues: `+(r.issues?.length??0)+` problems, `+(r.fk_violations??0)+` FK violations`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){e({type:`error`,text:`Error: `+$3(t)})}finally{i(!1)}}function d(){l(`integrity-check`,`Run integrity check`,u)}async function f(){i(!0);try{let r=await os(`/database/vacuum`,{scope:p6(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Vacuum across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):e({type:`success`,text:`Vacuum complete: freed `+Tv(r.freed_bytes??0)+` in `+(r.duration_ms??0)+`ms`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){if(t instanceof ms){let n=t.body;if(n?.error===M8){e({type:`error`,text:`Insufficient disk: need `+Tv(n.required_bytes??0)+`, have `+Tv(n.free_bytes??0)});return}}e({type:`error`,text:`Error: `+$3(t)})}finally{i(!1)}}function p(){l(`vacuum`,`Vacuum database`,f,`destructive`)}async function m(){i(!0);try{let r=await os(`/database/reindex`,{scope:p6(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Reindex across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):e({type:`success`,text:`Reindex complete (`+(r.duration_ms??0)+`ms)`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){e({type:`error`,text:`Error: `+$3(t)})}finally{i(!1)}}function h(){l(`reindex`,`Reindex database`,m)}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(I8,{title:`Actions`,value:a,onChange:o,available:P8}),(0,G.jsx)(L8,{scope:a}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:d,disabled:r,children:[(0,G.jsx)(Qa,{className:`mr-2 h-4 w-4`}),`Integrity check`]}),(0,G.jsxs)(Y,{variant:`destructive`,size:`sm`,onClick:p,disabled:r,children:[(0,G.jsx)(ho,{className:`mr-2 h-4 w-4`}),`Vacuum`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:h,disabled:r,children:[(0,G.jsx)($a,{className:`mr-2 h-4 w-4`}),`Reindex`]})]}),s&&(0,G.jsx)(g6,{open:!0,onOpenChange:e=>{e||c(null)},action:s.action,scope:p6(a,n)??{kind:`all-groves`},variant:s.variant,isPending:r,onConfirm:async()=>{await s.run(),c(null)}})]})}function H8(){let{data:e,isLoading:t,isError:n,error:r}=v8(),[i,a]=(0,W.useState)([]),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(`grove`);if((0,W.useEffect)(()=>{e&&a(t=>{let n=[...t,e.file.size_bytes];return n.length>N8?n.slice(-20):n})},[e]),t)return(0,G.jsx)(`div`,{className:`text-on-surface-variant`,children:`Loading database details...`});if(n)return(0,G.jsxs)(`div`,{className:`text-tertiary`,children:[`Error: `,r.message]});if(!e)return null;let u=e.file.fragmentation_pct.toFixed(1)+`%`,d=e.file.fragmentation_pct>j8?`ochre`:`outline`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-sans text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ha,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Database`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:`myco.db`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Schema`}),(0,G.jsxs)(`span`,{className:`font-mono text-on-surface`,children:[`v`,e.schema.version]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Journal`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface uppercase`,children:e.schema.journal_mode})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`healthy`})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-3`,children:[(0,G.jsx)(G2,{label:`Database Size`,value:Tv(e.file.size_bytes),sparklineData:i,accent:`sage`}),(0,G.jsx)(G2,{label:`Fragmentation`,value:u,accent:d}),(0,G.jsx)(G2,{label:`WAL Size`,value:Tv(e.file.wal_size_bytes),accent:`outline`})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(I8,{title:`Schema Breakdown`,value:c,onChange:l,available:P8}),(0,G.jsx)(L8,{scope:c}),(0,G.jsx)(R8,{tables:e.tables})]}),(0,G.jsx)(z8,{details:e,onActionResult:s}),(0,G.jsx)(B8,{onActionResult:s}),(0,G.jsx)(V8,{onActionResult:s}),o&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,o.type===`success`?`text-primary`:`text-tertiary`),children:o.text}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(ri,{to:`/logs?component=database`,className:`font-sans text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1`,children:`View database activity in Logs →`})})]})}var U8=[{id:`embedding`,label:`Embedding`,description:`queues + namespaces`},{id:`database`,label:`Database`,description:`file health + maintenance`}],W8=new Set([`embedding`,`database`]),G8={embedding:`Provider, queues, namespaces. Each action runs against the active Grove.`,database:`File health, tables, schedule, and on-demand maintenance for this Grove’s SQLite store.`},K8=`tab`;function q8(){let e=new URLSearchParams(window.location.search).get(K8);return e&&W8.has(e)?e:`embedding`}function J8(e){let t=new URLSearchParams;e!==`embedding`&&t.set(K8,e);let n=t.toString(),r=n?`${window.location.pathname}?${n}`:window.location.pathname;window.history.replaceState(null,``,r)}function Y8(){let e=We(),[t,n]=(0,W.useState)(q8),r=(0,W.useCallback)(e=>{let t=e;n(t),J8(t)},[]),i=(0,W.useCallback)(()=>{e.invalidateQueries({queryKey:[`embedding-details`]}),e.invalidateQueries({queryKey:[`database-details`]})},[e]);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`px-6 pt-6 space-y-6`,children:[(0,G.jsx)(yP,{title:`Operations`,subtitle:G8[t],actions:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,children:[(0,G.jsx)(Qa,{size:14}),`Refresh`]})}),(0,G.jsx)(iF,{tabs:U8.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:t,onTabChange:r,columns:2})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,G.jsxs)(`div`,{className:`px-6 pb-6`,children:[t===`embedding`&&(0,G.jsx)(A8,{}),t===`database`&&(0,G.jsx)(H8,{})]})})]})}var X8=[{value:`15m`,label:`15m`},{value:`1h`,label:`1h`},{value:`6h`,label:`6h`},{value:`24h`,label:`24h`},{value:`7d`,label:`7d`},{value:`30d`,label:`30d`}];function Z8({mode:e,onModeChange:t,searchValue:n,onSearchChange:r,onSearchSubmit:i,activeLevel:a,onLevelChange:o,components:s,activeComponents:c,onComponentToggle:l,onComponentsClear:u,timeRange:d,onTimeRangeChange:f,totalResults:p,paused:m=!1,onPausedToggle:h}){return(0,G.jsxs)(Q,{level:`default`,className:`rounded-md p-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center rounded-md bg-surface-container-low`,children:[(0,G.jsxs)(Y,{size:`sm`,variant:e===`live`?`default`:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs rounded-r-none`,onClick:()=>t(`live`),children:[(0,G.jsx)(Za,{className:`h-3 w-3`}),`Live`]}),(0,G.jsxs)(Y,{size:`sm`,variant:e===`search`?`default`:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs rounded-l-none`,onClick:()=>t(`search`),children:[(0,G.jsx)(no,{className:`h-3 w-3`}),`Search`]})]}),e===`live`&&h&&(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs`,onClick:h,"aria-label":m?`Resume log stream`:`Pause log stream`,title:m?`Resume`:`Pause`,children:[m?(0,G.jsx)(Ja,{className:`h-3 w-3`}):(0,G.jsx)(qa,{className:`h-3 w-3`}),m?`Resume`:`Pause`]}),e===`search`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-5 w-px bg-outline-variant/30`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(ua,{className:`h-3 w-3 text-on-surface-variant/50`}),X8.map(e=>(0,G.jsx)(Y,{size:`sm`,variant:d===e.value?`default`:`ghost`,className:`h-6 px-1.5 text-[10px]`,onClick:()=>f(e.value),children:e.label},e.value))]})]}),(0,G.jsx)(`form`,{className:`ml-auto flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault(),i()},children:(0,G.jsx)(op,{className:`h-7 w-56 text-xs`,placeholder:e===`search`?`Search logs...`:`Filter messages...`,value:n,onChange:e=>r(e.target.value),"aria-label":`Search log messages`})}),e===`search`&&p!==void 0&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-on-surface-variant/50 tabular-nums whitespace-nowrap`,children:[p.toLocaleString(),` results`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:Ps.map(e=>(0,G.jsxs)(Y,{size:`sm`,variant:a===e?`default`:`ghost`,className:`h-6 px-2 text-[10px] capitalize gap-1.5`,onClick:()=>o(e),children:[(0,G.jsx)(`div`,{className:J(`h-1.5 w-1.5 rounded-full`,zs(e))}),e]},e))}),s.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-4 w-px bg-outline-variant/20`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 flex-wrap`,children:[s.map(e=>(0,G.jsx)(Y,{size:`sm`,variant:c.has(e)?`default`:`ghost`,className:`h-5 px-1.5 text-[10px]`,onClick:()=>l(e),children:e},e)),c.size>0&&(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-5 px-1.5 text-[10px] text-on-surface-variant`,onClick:u,children:`clear`})]})]})]})]})}var Q8={debug:`border-l-outline/30`,info:`border-l-primary/50`,warn:`border-l-secondary/70`,error:`border-l-tertiary/80`},$8={context:`text-primary/70`,hooks:`text-on-surface-variant/70`,agent:`text-secondary/80`,daemon:`text-on-surface-variant/60`,capture:`text-primary/60`,processor:`text-on-surface-variant/70`,lifecycle:`text-primary/50`,embedding:`text-on-surface-variant/60`,power:`text-on-surface-variant/50`,server:`text-on-surface-variant/60`};function e5(e,t){if(t)return pv(e);let n=new Date(e);return`${String(n.getHours()).padStart(2,`0`)}:${String(n.getMinutes()).padStart(2,`0`)}:${String(n.getSeconds()).padStart(2,`0`)}`}var t5=40,n5=60;function r5(e){return typeof e==`string`&&e.length>0?e:null}var i5=[{pick:e=>r5(e.tool_name)},{pick:e=>r5(e.type)},{pick:e=>r5(e.agent_type)},{pick:e=>r5(e.task_subject),format:e=>gv(e,t5)},{pick:e=>r5(e.filename)},{pick:e=>r5(e.source_path)??r5(e.path),format:vv},{pick:e=>r5(e.error),format:e=>gv(e,n5)},{pick:e=>typeof e.pid==`number`?`pid ${e.pid}`:null}];function a5(e){if(!e)return``;for(let{pick:t,format:n}of i5){let r=t(e);if(r)return n?n(r):r}return``}function o5({entries:e,selectedId:t,onSelect:n,autoScroll:r=!1,relativeTime:i=!1,compact:a=!0}){let o=(0,W.useRef)(null);return(0,W.useEffect)(()=>{!r||!o.current||(o.current.scrollTop=o.current.scrollHeight)},[e,r]),(0,G.jsx)(`div`,{ref:o,className:`flex-1 overflow-y-auto bg-surface-container-lowest font-mono text-xs`,children:e.length===0?(0,G.jsx)(`div`,{className:`flex h-full min-h-[200px] items-center justify-center text-on-surface-variant/50 font-sans text-sm`,children:`No log entries`}):(0,G.jsxs)(`table`,{className:`w-full border-collapse`,"aria-label":`Log entries`,children:[(0,G.jsx)(`thead`,{className:`sticky top-0 z-10 bg-surface-container-lowest/95 backdrop-blur supports-[backdrop-filter]:bg-surface-container-lowest/80`,children:(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/10 text-[10px] uppercase tracking-[0.16em] text-on-surface-variant/50`,children:[(0,G.jsx)(`th`,{className:`w-[68px] px-3 py-2 text-left font-medium`,children:`Time`}),(0,G.jsx)(`th`,{className:`w-[12px] px-0 py-2`,"aria-hidden":`true`}),(0,G.jsx)(`th`,{className:`w-[48px] px-0 py-2 text-left font-medium`,children:`Level`}),(0,G.jsx)(`th`,{className:`w-[90px] px-0 py-2 text-left font-medium`,children:`Area`}),(0,G.jsx)(`th`,{className:`w-[72px] px-0 py-2 text-left font-medium`,children:`Session`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Message`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsx)(s5,{entry:e,selected:e.id===t,onSelect:n,relativeTime:i,compact:a},e.id))})]})})}var s5=(0,W.memo)(function({entry:e,selected:t,onSelect:n,relativeTime:r,compact:i}){let a=i?`py-0.5`:`py-1.5`,o=_v(e.session_id),s=a5(e.data);return(0,G.jsxs)(`tr`,{className:J(`cursor-pointer transition-colors border-l-2`,Q8[e.level],t?`bg-primary/10`:`hover:bg-surface-container-high/30`),onClick:()=>n(e),children:[(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pl-3 pr-2 text-on-surface-variant/50 align-top w-[68px] tabular-nums`,a),children:e5(e.timestamp,r)}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-1 align-top w-[12px]`,a),children:(0,G.jsx)(`div`,{className:J(`h-1.5 w-1.5 rounded-full mt-1`,zs(e.level))})}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[48px]`,a),children:(0,G.jsx)(X,{variant:Rs(e.level),className:`px-1 py-0 text-[9px] uppercase`,children:e.level})}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[90px] truncate max-w-[90px]`,a,$8[e.component]??`text-on-surface-variant/60`),children:e.component}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[72px] tabular-nums text-on-surface-variant/40`,a),title:e.session_id??``,children:o}),(0,G.jsxs)(`td`,{className:J(`pr-3 text-on-surface align-top break-words`,a),children:[(0,G.jsx)(`span`,{children:e.message}),s&&(0,G.jsxs)(`span`,{className:`ml-2 text-on-surface-variant/50`,children:[`· `,s]})]})]})});function c5({value:e}){let t=String(e),n=t.slice(0,8);return(0,G.jsxs)(ri,{to:`/sessions/${t}`,className:`font-mono text-primary hover:underline`,children:[n,`...`]})}function l5({value:e}){return Array.isArray(e)?(0,G.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.map((e,t)=>(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:String(e)},t))}):(0,G.jsx)(`span`,{children:String(e)})}function u5({value:e}){return Array.isArray(e)?(0,G.jsx)(`span`,{className:`flex gap-1`,children:e.map((e,t)=>(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0 tabular-nums`,children:String(e)},t))}):(0,G.jsx)(`span`,{children:String(e)})}function d5({value:e}){return(0,G.jsx)(`span`,{className:`rounded bg-tertiary/10 px-2 py-0.5 text-tertiary font-mono text-[11px]`,children:String(e)})}function f5({value:e}){return(0,G.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded bg-surface-container-lowest px-2 py-1 text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap`,children:String(e)})}function p5({value:e}){let t=new Date(String(e)),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24),o;return o=r<1?`just now`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${a}d ago`,(0,G.jsx)(`span`,{className:`tabular-nums`,title:t.toISOString(),children:o})}function m5({value:e}){return typeof e==`object`&&e?(0,G.jsx)(`pre`,{className:`text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap`,children:JSON.stringify(e,null,2)}):(0,G.jsx)(`span`,{children:String(e)})}var h5={session_id:c5,spore_titles:l5,scores:u5,error:d5,preview:f5,generated_at:p5,text:f5},g5=new Set([`id`,`timestamp`,`level`,`kind`,`component`,`message`]);function _5(e,t){return(0,G.jsx)(h5[e]??m5,{value:t})}function v5(e){return g5.has(e)}function y5(e){return e?Object.entries(e).filter(([e])=>!v5(e)):[]}var b5={debug:`text-on-surface-variant/60`,info:`text-primary`,warn:`text-secondary`,error:`text-tertiary`};function x5({entry:e,resolved:t,onClose:n}){let r=y5(e.data);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col bg-surface-container-low`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-mono`,children:e.kind}),(0,G.jsx)(`span`,{className:J(`text-xs font-medium`,b5[e.level]),children:e.level.toUpperCase()})]}),(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0`,onClick:n,"aria-label":`Close detail panel`,children:(0,G.jsx)(So,{className:`h-3.5 w-3.5`})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-3 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Timestamp`}),(0,G.jsx)(`div`,{className:`font-mono text-xs tabular-nums`,children:new Date(e.timestamp).toLocaleString()})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Message`}),(0,G.jsx)(`div`,{className:`text-sm text-on-surface leading-relaxed`,children:e.message})]}),e.session_id&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Session`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[_5(`session_id`,e.session_id),!!t?.session_title&&(0,G.jsx)(`span`,{className:`text-on-surface-variant/70`,children:String(t.session_title)})]})]}),r.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-1.5`,children:`Metadata`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:r.map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] text-on-surface-variant/40 mb-0.5`,children:e}),(0,G.jsx)(`div`,{className:`text-xs`,children:_5(e,t)})]},e))})]})]}),(0,G.jsx)(`div`,{className:`px-4 py-2 border-t border-outline-variant/10`,children:(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/40 tabular-nums`,children:[`id: `,e.id]})})]})}var S5=5e3;function C5(e=!1){let[t,n]=(0,W.useState)([]),r=(0,W.useRef)(null),{data:i,refetch:a}=As({queryKey:[`logs-stream`],queryFn:({signal:e})=>q(r.current===null?`/logs/stream`:`/logs/stream?since=${r.current}`,{signal:e}),pollCategory:`realtime`,refetchInterval:e?!1:js.LOGS,contextFree:!0}),o=(0,W.useRef)(e);return(0,W.useEffect)(()=>{o.current&&!e&&a(),o.current=e},[e,a]),(0,W.useEffect)(()=>{if(!i?.entries.length){i&&r.current===null&&(r.current=i.cursor);return}r.current=i.cursor,n(e=>{let t=[...e,...i.entries];return t.length>S5?t.slice(-5e3):t})},[i]),{entries:t,clear:(0,W.useCallback)(()=>{n([]),r.current=null},[])}}function w5(e,t){let n=new URLSearchParams;return e.q&&n.set(`q`,e.q),e.level&&n.set(`level`,e.level),e.component&&n.set(`component`,e.component),e.kind&&n.set(`kind`,e.kind),e.session_id&&n.set(`session_id`,e.session_id),e.from&&n.set(`from`,e.from),e.to&&n.set(`to`,e.to),e.page&&n.set(`page`,String(e.page)),e.page_size&&n.set(`page_size`,String(e.page_size)),ot({queryKey:[`logs-search`,Object.fromEntries(n)],queryFn:({signal:e})=>q(`/logs/search?${n.toString()}`,{signal:e}),enabled:t})}function T5(e){return ot({queryKey:[`log-detail`,e],queryFn:({signal:t})=>q(`/logs/${e}`,{signal:t}),enabled:e!==null})}function E5(e){return new Date(Date.now()-({"15m":15*6e4,"1h":60*6e4,"6h":360*6e4,"24h":1440*6e4,"7d":10080*6e4,"30d":720*60*6e4}[e]??1440*6e4)).toISOString()}function D5(){let e=(0,W.useMemo)(()=>{let e=new URLSearchParams(window.location.search),t=e.get(`component`)?.split(`,`).filter(Boolean)??[],n=e.get(`level`),r=e.get(`q`)??``;return{components:t,level:n,q:r,hasFilters:t.length>0||!!n||!!r}},[]),[t,n]=(0,W.useState)(e.hasFilters?`search`:`live`),[r,i]=(0,W.useState)(e.q),[a,o]=(0,W.useState)(e.q),[s,c]=(0,W.useState)(e.level??`debug`),[l,u]=(0,W.useState)(new Set(e.components)),[d,f]=(0,W.useState)(`24h`),[p,m]=(0,W.useState)(1),[h,g]=(0,W.useState)(null),[_,v]=(0,W.useState)(!1),{entries:y,clear:b}=C5(_),{data:x}=w5((0,W.useMemo)(()=>({q:a||void 0,level:s===`debug`?void 0:s,component:l.size>0?Array.from(l).join(`,`):void 0,from:E5(d),page:p,page_size:50}),[a,s,l,d,p]),t===`search`),{data:S}=T5(h?.id??null),[C,w]=(0,W.useState)(e.components);(0,W.useEffect)(()=>{let e=t===`live`?y:x?.entries??[];w(t=>{let n=new Set(t),r=!1;for(let t of e)n.has(t.component)||(n.add(t.component),r=!0);return r?Array.from(n).sort():t})},[y,x,t]);let T=(0,W.useMemo)(()=>{let e=Fs[s]??0,t=r.trim().toLowerCase();return y.filter(n=>!((Fs[n.level]??0)<e||l.size>0&&!l.has(n.component)||t&&!n.message.toLowerCase().includes(t)))},[y,s,l,r]),E=t===`live`?T:x?.entries??[],D=(0,W.useCallback)(e=>{n(e),g(null),e===`live`&&(b(),v(!1))},[b]),O=(0,W.useCallback)(()=>{o(r),m(1)},[r]),k=(0,W.useCallback)(e=>{g(t=>t?.id===e.id?null:e)},[]),A=(0,W.useCallback)(e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),m(1)},[]),j=(0,W.useCallback)(e=>{c(e),m(1)},[]),M=h!==null;return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsx)(`div`,{className:`px-6 pt-6`,children:(0,G.jsx)(yP,{title:`Logs`,subtitle:`Daemon log explorer`})}),(0,G.jsx)(`div`,{className:`px-6 mb-3`,children:(0,G.jsx)(Z8,{mode:t,onModeChange:D,searchValue:r,onSearchChange:i,onSearchSubmit:O,activeLevel:s,onLevelChange:j,components:C,activeComponents:l,onComponentToggle:A,onComponentsClear:()=>{u(new Set),m(1)},timeRange:d,onTimeRangeChange:e=>{f(e),m(1)},totalResults:t===`search`?x?.total:void 0,paused:_,onPausedToggle:()=>v(e=>!e)})}),(0,G.jsx)(`div`,{className:`flex flex-1 overflow-hidden mx-6 mb-6 rounded-lg border border-outline-variant/10`,children:(0,G.jsxs)(`div`,{className:`flex flex-col w-full`,children:[(0,G.jsx)(o5,{entries:E,selectedId:h?.id??null,onSelect:k,autoScroll:t===`live`&&!_,relativeTime:t===`live`,compact:!0}),t===`search`&&x&&(0,G.jsx)(`div`,{className:`border-t border-outline-variant/10 px-3 py-2 bg-surface-container-low`,children:(0,G.jsx)(jM,{total:x.total,offset:(p-1)*50,limit:50,onPageChange:e=>m(Math.floor(e/50)+1)})})]})}),(0,G.jsx)(KP,{open:M&&!!h,onClose:()=>g(null),ariaLabel:`Log entry detail`,children:h&&(0,G.jsx)(x5,{entry:h,resolved:S?.resolved,onClose:()=>g(null)})})]})}function O5({title:e,scope:t,meta:n,loading:r,error:i,empty:a,emptyText:o,children:s}){let c=(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ZM,{children:e}),t&&(0,G.jsx)(Ok,{scope:t})]});return r?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading…`})]}):i?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsxs)(`p`,{className:`font-sans text-sm text-tertiary`,children:[`Failed to load: `,i.message]})]}):a?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:o})]}):(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[c,n]}),t&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:d6[t]}),s]})}function k5({primary:e,meta:t}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-3 rounded-md bg-surface-container-low/40 p-3`,children:[(0,G.jsx)(`div`,{className:`min-w-0 space-y-1`,children:e}),(0,G.jsx)(`div`,{className:`flex flex-col items-end gap-0.5 text-right font-sans text-xs`,children:t})]})}function A5(e,t){if(!e)return!0;let n=Date.parse(e);return Number.isFinite(n)?Date.now()-n>t*60*60*1e3:!0}function j5(e){let{flags:t}=e;return t.error_count>0||t.integrity_issues>0?{label:`Issues detected`,icon:oo,tone:`error`}:t.backup_overdue>0||t.optimize_overdue>0?{label:`Maintenance overdue`,icon:ra,tone:`warn`}:{label:`All Groves healthy`,icon:oa,tone:`ok`}}function M5({row:e,thresholds:t}){let n=!e.error&&A5(e.last_backup_at,t.backup_overdue_hours),r=!e.error&&A5(e.last_optimize_at,t.optimize_overdue_hours),i=e.last_integrity_check?.status===`issues`;return(0,G.jsx)(k5,{primary:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface truncate`,children:e.grove.name}),(0,G.jsx)(X,{variant:`outline`,className:`px-1.5 py-0 text-[10px] uppercase`,children:e.grove.mode}),e.error&&(0,G.jsx)(X,{variant:`outline`,className:`border-tertiary px-1.5 py-0 text-[10px] uppercase text-tertiary`,children:`error`})]}),e.error?(0,G.jsx)(`p`,{className:`font-sans text-xs text-tertiary truncate`,title:e.error,children:e.error}):(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[e.project_count,` project`,e.project_count===1?``:`s`,` · `,Tv(e.db_size_bytes),e.embedding_pending===null?(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsx)(`span`,{className:`text-tertiary`,children:`embedding signal unavailable`})]}):e.embedding_pending>0?(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.embedding_pending,` pending`]})]}):null]})]}),meta:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,n&&`text-secondary`),children:[`backup: `,e.last_backup_at?pv(e.last_backup_at):`never`]}),(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,r&&`text-secondary`),children:[`optimize: `,e.last_optimize_at?pv(e.last_optimize_at):`never`]}),(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,i&&`text-tertiary`),children:[`integrity:`,` `,e.last_integrity_check?`${e.last_integrity_check.status} · ${pv(e.last_integrity_check.at)}`:`never`]})]})})}function N5(){let{data:e,isLoading:t,isError:n,error:r}=sv(),i=n?r instanceof Error?r:Error(`unknown error`):null,a=e?j5(e):null,o=a?.icon;return(0,G.jsx)(O5,{title:`Groves Overview`,scope:`all-groves`,loading:t,error:i,empty:!!e&&e.groves.length===0,emptyText:`No Groves are registered yet.`,meta:a&&o&&(0,G.jsxs)(`div`,{className:J(`flex items-center gap-1.5 font-sans text-xs`,a.tone===`ok`&&`text-primary`,a.tone===`warn`&&`text-secondary`,a.tone===`error`&&`text-tertiary`),children:[(0,G.jsx)(o,{className:`h-3.5 w-3.5`}),a.label]}),children:e&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 font-sans text-xs`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(ha,{className:`h-3.5 w-3.5 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Groves`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:e.groves.length})]}),e.flags.backup_overdue>0&&(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.flags.backup_overdue,` backup overdue`]}),e.flags.optimize_overdue>0&&(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.flags.optimize_overdue,` optimize overdue`]}),e.flags.integrity_issues>0&&(0,G.jsxs)(`span`,{className:`text-tertiary`,children:[e.flags.integrity_issues,` integrity issue`,e.flags.integrity_issues===1?``:`s`]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:e.groves.map(t=>(0,G.jsx)(M5,{row:t,thresholds:e.thresholds},t.grove.id))})]})})}function P5({row:e}){return(0,G.jsx)(k5,{primary:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface truncate`,children:e.project_name}),(0,G.jsx)(X,{variant:`outline`,className:J(`px-1.5 py-0 text-[10px] uppercase`,e.is_active?`border-primary text-primary`:`border-on-surface-variant text-on-surface-variant`),children:e.is_active?`active`:`cold`})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant truncate`,title:e.project_root,children:e.project_root})]}),meta:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[`last activity: `,e.last_activity_at?pv(e.last_activity_at):`never`]}),(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[e.scheduled_runs_last_24h,` run`,e.scheduled_runs_last_24h===1?``:`s`,` / 24h`]})]})})}function F5(){let{data:e,isLoading:t,isError:n,error:r}=cv(),i=n?r instanceof Error?r:Error(`unknown error`):null,a=e?.projects.filter(e=>e.is_active).length??0,o=(e?.projects.length??0)-a;return(0,G.jsx)(O5,{title:`Project Activity`,scope:`all-groves`,loading:t,error:i,empty:!!e&&e.projects.length===0,emptyText:`No projects are registered yet.`,meta:e&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(Gi,{className:`h-3.5 w-3.5`}),`window: `,e.active_window_days,`d`]}),children:e&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 font-sans text-xs`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Active`}),(0,G.jsx)(`span`,{className:`font-mono text-primary`,children:a})]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Cold`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface-variant`,children:o})]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:e.projects.map(e=>(0,G.jsx)(P5,{row:e},`${e.grove_id}:${e.project_id}`))}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Cold projects skip scheduled agent tasks. Configure the window in Settings under `,(0,G.jsx)(`span`,{className:`font-mono`,children:`agent.cold_project_threshold_days`}),`.`]})]})})}function I5(e){if(!Number.isFinite(e)||e<=0)return`—`;let t=Math.floor(e);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<48?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function L5(){let{data:e}=Bs();if(!e)return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ro,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(ZM,{children:`Daemon`})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading…`})]});let{pid:t,port:n,version:r,uptime_seconds:i,active_sessions:a}=e.daemon;return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ro,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(ZM,{children:`Daemon`})]}),(0,G.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-3`,children:[(0,G.jsx)(R5,{label:`PID`,value:String(t),mono:!0}),(0,G.jsx)(R5,{label:`Running port`,value:String(n),mono:!0}),(0,G.jsx)(R5,{label:`Version`,value:r,mono:!0}),(0,G.jsx)(R5,{label:`Uptime`,value:I5(i)}),(0,G.jsx)(R5,{label:`Active sessions`,value:String(a.length)})]})]})}function R5({label:e,value:t,mono:n=!1}){return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`font-sans text-[11px] uppercase tracking-wider text-on-surface-variant`,children:e}),(0,G.jsx)(`dd`,{className:J(`mt-0.5 text-sm text-on-surface`,n&&`font-mono`),children:t})]})}function z5(){return(0,G.jsxs)(zj,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(ma,{className:`h-5 w-5 text-primary`}),(0,G.jsx)(yP,{title:`Machine`,subtitle:`Status of the Myco daemon and every Grove on this machine.`,className:`flex-1 pb-0`})]}),(0,G.jsx)(L5,{}),(0,G.jsx)(N5,{}),(0,G.jsx)(F5,{})]})}function B5({label:e,value:t,mono:n=!0}){let[r,i]=(0,W.useState)(`idle`),a=(0,W.useRef)(null),o=(0,W.useCallback)(()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},[]);(0,W.useEffect)(()=>o,[o]);let s=(0,W.useCallback)(()=>{o(),navigator.clipboard.writeText(t).then(()=>{i(`copied`),a.current=setTimeout(()=>i(`idle`),2e3)},()=>{i(`failed`),a.current=setTimeout(()=>i(`idle`),2e3)})},[t,o]);return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:e}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,children:[(0,G.jsx)(`span`,{className:`text-sm text-on-surface break-all ${n?`font-mono`:``}`,children:t}),(0,G.jsxs)(`button`,{type:`button`,onClick:s,className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 transition-opacity`,title:r===`failed`?`Copy failed — check clipboard permissions`:`Copy to clipboard`,"aria-live":`polite`,children:[r===`copied`&&(0,G.jsx)(Qi,{className:`h-3.5 w-3.5 text-primary`}),r===`failed`&&(0,G.jsx)(So,{className:`h-3.5 w-3.5 text-error`}),r===`idle`&&(0,G.jsx)(pa,{className:`h-3.5 w-3.5`})]})]})]})}function V5({team:e,onLeave:t,leaving:n}){let r=e.projects.length,i=`myco-team update --team-id ${e.team_id} --observability`;return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-[var(--ghost-border)] px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface`,children:e.name}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface-variant break-all`,children:e.worker_url}),e.has_deployment&&(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(B5,{label:`Update command`,value:i})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-2 shrink-0`,children:[(0,G.jsxs)(X,{variant:`outline`,children:[r,` project`,r===1?``:`s`]}),(0,G.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>t(e),className:`text-xs text-on-surface-variant hover:text-terracotta-text transition-colors disabled:opacity-50`,children:`Leave team`})]})]})}function H5({project:e,teams:t,disabled:n,onChange:r}){let i=e.team_id??``;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-[var(--ghost-border)] px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface truncate`,children:e.project_name}),(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant truncate`,children:e.grove_name})]}),(0,G.jsxs)(`select`,{className:`shrink-0 rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 disabled:opacity-50`,value:i,disabled:n,"aria-label":`Team for ${e.project_name}`,onChange:e=>r(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`Not synced`}),t.map(e=>(0,G.jsx)(`option`,{value:e.team_id,children:e.name},e.team_id))]})]})}function U5(){let{data:e,isLoading:t}=c8(),{data:n,isLoading:r}=l8(),i=u8(),a=d8(),o=f8(),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(``),[p,m]=(0,W.useState)(``),[h,g]=(0,W.useState)(null),_=e?.teams??[],v=n?.projects??[],y=i.isPending,b=async()=>{g(null);try{await a.mutateAsync({worker_url:d.trim(),team_key:p.trim()}),f(``),m(``)}catch(e){g(e instanceof Error?e.message:String(e))}},x=async e=>{let t=e.has_deployment?`Leave "${e.name}"? This removes it from this machine only — the worker keeps running. Use "myco-team destroy" to delete the worker.`:`Leave "${e.name}"? This removes it from this machine and stops syncing your projects to it.`;if(window.confirm(t)){u(null),c(e.team_id);try{await o.mutateAsync({team_id:e.team_id})}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(null)}}},S=async(e,t)=>{let n=e.team_id??``;if(t!==n){u(null);try{n&&await i.mutateAsync({team_id:n,grove_id:e.grove_id,project_id:e.project_id,action:`remove`}),t!==``&&await i.mutateAsync({team_id:t,grove_id:e.grove_id,project_id:e.project_id,action:`add`})}catch(e){u(e instanceof Error?e.message:String(e))}}};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:Ga,children:`Teams`}),title:`Registered teams`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 mb-4`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Join a team a teammate shared with you. Paste the Worker URL and Team key — no extra install required.`}),(0,G.jsx)(`label`,{className:`myco-eyebrow-sm text-on-surface-variant`,htmlFor:`join-worker-url`,children:`Worker URL`}),(0,G.jsx)(`input`,{id:`join-worker-url`,"aria-label":`Worker URL`,className:`rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface`,value:d,onChange:e=>f(e.target.value),placeholder:`https://team.example.workers.dev`}),(0,G.jsx)(`label`,{className:`myco-eyebrow-sm text-on-surface-variant`,htmlFor:`join-team-key`,children:`Team key`}),(0,G.jsx)(`input`,{id:`join-team-key`,"aria-label":`Team key`,type:`password`,className:`rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface`,value:p,onChange:e=>m(e.target.value)}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{size:`sm`,disabled:a.isPending||!d.trim()||!p.trim(),onClick:b,children:a.isPending?`Joining…`:`Join team`})}),h&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0`,"data-testid":`team-join-error`,children:h})]}),t&&_.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Loading teams…`}):_.length===0?(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:[`No teams yet. An operator provisions one with `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team install`}),`, or join one a teammate shared with you using the form above.`]}):(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:_.map(e=>(0,G.jsx)(V5,{team:e,onLeave:x,leaving:s===e.team_id},e.team_id))})]}),(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:Oa,children:`Projects`}),title:`Assign projects to a team`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mb-3`,children:`Choose which team each project syncs to. Moving a project removes it from its current team before adding it to the new one.`}),r&&v.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Loading projects…`}):v.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`No projects`}),(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`No projects are registered with this daemon yet.`})]}):(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:v.map(e=>(0,G.jsx)(H5,{project:e,teams:_,disabled:y,onChange:t=>S(e,t)},`${e.grove_id}:${e.project_id}`))}),l&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0 mt-3`,"data-testid":`team-selection-error`,children:l})]})]})}var W5=16;function G5(e){return e.length<W5?`•`.repeat(Math.max(8,e.length)):`${e.slice(0,8)}${`•`.repeat(e.length-12)}${e.slice(-4)}`}function K5({label:e,value:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(`idle`),o=(0,W.useRef)(null),s=(0,W.useCallback)(()=>{o.current!==null&&(clearTimeout(o.current),o.current=null)},[]);(0,W.useEffect)(()=>s,[s]);let c=(0,W.useCallback)(()=>{s(),navigator.clipboard.writeText(t).then(()=>{a(`copied`),o.current=setTimeout(()=>a(`idle`),2e3)},()=>{a(`failed`),o.current=setTimeout(()=>a(`idle`),2e3)})},[t,s]),l=G5(t);return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:e}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,children:[(0,G.jsx)(`span`,{className:`text-sm text-on-surface font-mono break-all`,children:n?t:l}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface transition-opacity`,title:n?`Hide`:`Reveal`,children:n?(0,G.jsx)(ya,{className:`h-3.5 w-3.5`}):(0,G.jsx)(ba,{className:`h-3.5 w-3.5`})}),(0,G.jsxs)(`button`,{type:`button`,onClick:c,className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 transition-opacity`,title:i===`failed`?`Copy failed — check clipboard permissions`:`Copy to clipboard`,"aria-live":`polite`,children:[i===`copied`&&(0,G.jsx)(Qi,{className:`h-3.5 w-3.5 text-primary`}),i===`failed`&&(0,G.jsx)(So,{className:`h-3.5 w-3.5 text-error`}),i===`idle`&&(0,G.jsx)(pa,{className:`h-3.5 w-3.5`})]})]})]})}function q5({status:e}){let t=We(),[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:Na,children:`Team Credentials`}),title:`Worker credentials`,actions:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!0,title:`Coming soon`,children:[(0,G.jsx)(Qa,{className:`h-3.5 w-3.5 mr-1.5`}),`Rotate team key`]}),children:[(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0 mb-3`,children:[`These credentials belong to the registered Team worker for`,` `,(0,G.jsx)(`span`,{className:`text-on-surface font-medium`,children:e.grove?.name??`this Grove`}),`. Keep the Team key private because it authorizes writes to the worker.`,` `,`Share the Worker URL and Team key out-of-band with a teammate so they can `,(0,G.jsx)(`span`,{className:`text-on-surface font-medium`,children:`Join`}),` this team on their Teams tab.`]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.worker_url&&(0,G.jsx)(B5,{label:`Worker URL`,value:e.worker_url}),e.team_key&&(0,G.jsx)(K5,{label:`Team key`,value:e.team_key})]})]}),e.mcp_token&&e.mcp_endpoint&&(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:da,children:`Cloud MCP endpoint`}),title:`For cloud agents`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(X,{variant:e.mcp_healthy?`default`:`destructive`,children:e.mcp_healthy?`healthy`:`unhealthy`}),(0,G.jsxs)(`button`,{onClick:()=>s(!0),className:`text-xs text-on-surface-variant hover:text-terracotta-text transition-colors inline-flex items-center gap-1`,children:[(0,G.jsx)(Qa,{className:`h-3.5 w-3.5`}),`Rotate token`]})]}),children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mb-3`,children:`Configure cloud agents with this endpoint to access Grove team intelligence.`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(B5,{label:`MCP URL`,value:e.mcp_endpoint}),(0,G.jsx)(K5,{label:`MCP Access Token`,value:e.mcp_token})]}),(0,G.jsxs)(`div`,{className:`text-xs mt-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(!i),className:`myco-eyebrow-sm text-on-surface-variant cursor-pointer hover:text-on-surface transition-colors`,children:i?`Hide snippet`:`Config snippet`}),i&&(()=>{let t=JSON.stringify({mcp_servers:[{type:`url`,url:e.mcp_endpoint,name:`myco`,authorization_token:e.mcp_token}]},null,2);return(0,G.jsxs)(`div`,{className:`relative mt-2`,children:[(0,G.jsx)(`pre`,{className:`text-xs bg-surface-container p-3 rounded-lg overflow-x-auto text-on-surface-variant`,children:t}),(0,G.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(t),className:`absolute top-2 right-2 p-1 rounded hover:bg-surface-container-high transition-colors`,children:(0,G.jsx)(pa,{className:`h-3.5 w-3.5 text-on-surface-variant`})})]})})()]})]}),(0,G.jsxs)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:mo,children:`This node`}),title:`Identity of this machine in the team`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Machine ID`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.machine_id})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Package version`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.package_version})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Protocol version`}),(0,G.jsxs)(`code`,{className:`text-xs font-mono text-on-surface`,children:[`v`,e.sync_protocol_version]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Schema version`}),(0,G.jsxs)(`code`,{className:`text-xs font-mono text-on-surface`,children:[`v`,e.schema_version]})]})]}),e.health_error&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0 mt-3`,children:e.health_error})]}),(0,G.jsx)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:Ga,children:`Collective`}),title:`Cross-team coordination`,actions:(0,G.jsx)(X,{variant:e.collective_connected?`default`:`outline`,children:e.collective_connected?`connected`:`not connected`}),children:e.collective_connected?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e.collective_url&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`URL`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.collective_url})]}),e.collective_project_id&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Project ID`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.collective_project_id})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Last settings sync`}),(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface m-0`,children:e.collective_last_settings_sync?new Date(e.collective_last_settings_sync*1e3).toLocaleString():`Never`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Last heartbeat`}),(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface m-0`,children:e.collective_last_heartbeat?new Date(e.collective_last_heartbeat*1e3).toLocaleString():`Never`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Capabilities`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.collective_capabilities.map(e=>(0,G.jsx)(X,{variant:`outline`,children:e},e))})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(Uj,{size:`sm`,children:`Effective overrides`}),(0,G.jsx)(`pre`,{className:`text-xs bg-surface-container p-3 rounded-lg overflow-x-auto text-on-surface-variant`,children:JSON.stringify(e.collective_settings,null,2)})]})]}):(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`This team worker is not currently connected to a Myco Collective.`})}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:async()=>{r(!0),p(null);try{await os(`/team/disconnect`),t.invalidateQueries({queryKey:[`team-status`]})}catch(e){p(e instanceof Error?e.message:String(e))}finally{r(!1)}},disabled:n,children:n?`Disconnecting...`:`Disconnect`})}),(0,G.jsx)(AM,{open:o,onOpenChange:s,title:`Rotate MCP Access Token`,description:`This will invalidate the current MCP token. Any cloud agents using it will lose access until reconfigured with the new token.`,confirmLabel:`Rotate Token`,variant:`destructive`,isPending:c,onConfirm:async()=>{l(!0),d(null);try{await os(`/team/rotate-mcp-token`),t.invalidateQueries({queryKey:[`team-status`]}),s(!1)}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(!1)}},errorMessage:u}),f&&(0,G.jsxs)(`p`,{className:`text-sm text-terracotta text-right m-0`,"data-testid":`team-disconnect-error`,children:[`Disconnect failed: `,f]})]})}var J5={sage:`bg-primary/10 text-primary`,ochre:`bg-secondary/10 text-secondary`,terracotta:`bg-tertiary/10 text-tertiary`,outline:`bg-surface-container text-on-surface-variant`};function Y5({label:e,value:t,tone:n,pulse:r,sub:i}){return(0,G.jsxs)(`div`,{className:J(`flex flex-col gap-1 rounded-md p-3`,J5[n]),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-wider`,children:[(0,G.jsx)(`span`,{className:J(`h-2 w-2 rounded-full bg-current`,r&&`animate-pulse`)}),e]}),(0,G.jsx)(`div`,{className:`font-mono text-2xl tabular-nums`,children:t}),i?(0,G.jsx)(`div`,{className:`text-[10px] text-on-surface-variant`,children:i}):null]})}function X5({title:e,actions:t,children:n}){return(0,G.jsx)(Wj,{tone:`sage`,eyebrow:`Sync`,title:e,actions:t,children:n})}function Z5(e){return typeof e==`number`&&Number.isFinite(e)?e.toLocaleString():`—`}function Q5(e){if(!e)return`Never`;let t=new Date(e);return Number.isNaN(t.getTime())?`Never`:t.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`})}function $5(e){return e.replace(/_/g,` `)}function e7(e){return e===0?`0`:e>0?`+${e.toLocaleString()}`:e.toLocaleString()}function t7(e,t){return t===void 0?`—`:e7(t-e)}function n7({remote:e}){if(!e)return(0,G.jsx)(G2,{label:`Vectors`,value:`—`,accent:`outline`});if(!e.vector_index_healthy)return(0,G.jsx)(G2,{label:`Vectors`,value:`error`,sublabel:e.vector_index_error??`index unavailable`,accent:`terracotta`});let t=e.vector_count??0,n=e.embeddable_count,r=Z5(t);if(n==null)return(0,G.jsx)(G2,{label:`Vectors`,value:r,accent:`sage`});let i=n+Math.ceil(n*.1);if(t>=n&&t<=i)return(0,G.jsx)(G2,{label:`Vectors`,value:r,sublabel:`indexed (target ${Z5(n)})`,accent:`sage`});if(t>i)return(0,G.jsx)(G2,{label:`Vectors`,value:r,sublabel:`+${Z5(t-n)} stale vs target ${Z5(n)}`,accent:`ochre`});let a=n-t,o=n>0&&t<Math.max(1,n*.05);return(0,G.jsx)(G2,{label:`Vectors`,value:r,sublabel:o?`index empty — run reindex (target ${Z5(n)})`:`${Z5(a)} missing of ${Z5(n)}`,accent:o?`terracotta`:`ochre`})}function r7({rows:e}){return(0,G.jsx)(`div`,{className:`overflow-hidden rounded-md border border-outline-variant/10`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{className:`bg-surface-container/40 text-xs uppercase text-outline`,children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-mono`,children:`Table`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Local`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Cloud`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Δ`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsxs)(`tr`,{className:e.delta===0?`border-t border-outline-variant/10`:`border-t border-outline-variant/10 bg-terracotta/[0.04]`,children:[(0,G.jsx)(`td`,{className:`px-3 py-2 text-on-surface`,children:$5(e.table)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums text-on-surface`,children:Z5(e.local)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums text-on-surface`,children:Z5(e.cloud)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums ${e.delta===0?`text-on-surface-variant`:`text-terracotta`}`,children:e7(e.delta)})]},e.table))})]})})}function i7({message:e,onAction:t,busy:n}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2 border-b border-outline-variant/10 last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-on-surface font-mono truncate`,children:[e.table_name,` / `,e.row_id]}),(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant truncate`,children:[`machine=`,e.machine_id,` op=`,e.operation,e.reason?` · ${e.reason}`:``]}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant/60`,children:new Date(e.created_at*1e3).toLocaleString()})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:n,onClick:()=>t(`retry`,e.lease_id),children:`Retry`}),(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:n,onClick:()=>t(`discard`,e.lease_id),children:`Discard`})]})]})}function a7({status:e,teamId:t}){let n=We(),r=e.enabled&&e.healthy,{data:i,isLoading:a,isFetching:o,refetch:s}=a8(r,t),{data:c,isLoading:l,isFetching:u,refetch:d}=o8(r,t),{data:f}=Bs(),p=r,{data:m,isLoading:h,isFetching:g,refetch:_}=s8(p,t),[v,y]=(0,W.useState)(!1),[b,x]=(0,W.useState)(null),[S,C]=(0,W.useState)(!1),[w,T]=(0,W.useState)(null),[E,D]=(0,W.useState)(!1),[O,k]=(0,W.useState)(null),A=!r||!a&&!i,j=a||p&&h,M=!r||!j&&p&&!m,N=`Team connection is unhealthy.`,P=o||u||g,F=(0,W.useCallback)(()=>{s(),d(),_()},[s,d,_]),I=(0,W.useCallback)(async()=>{C(!0),T(null);try{let e=await os(`/team/backfill`,{mode:`all`}),t=e.vector_error?`; vector reindex failed: ${e.vector_error}`:e.vector_enqueued?` and queued ${Z5(e.vector_enqueued)} vectors for reindex`:``;e.flush_error?T(`Backfilled ${e.enqueued} records, but sync failed: ${e.flush_error}`):e.enqueued>0||(e.flushed??0)>0?T(`Backfilled ${Z5(e.enqueued)} records and handed off ${Z5(e.flushed)} in ${e.batches??0} batches${t}.`):e.vector_enqueued?T(`No eligible Grove records found${t}.`):T(`No eligible Grove records found.`),n.invalidateQueries({queryKey:[`team-status`]}),n.invalidateQueries({queryKey:[`team-sync-summary`]}),n.invalidateQueries({queryKey:[`team-queue-stats`]}),n.invalidateQueries({queryKey:[`team-dlq`]})}catch{T(`Backfill failed.`)}finally{C(!1)}},[n]),L=(0,W.useCallback)(async(e,t)=>{y(!0),x(null);try{let r=await os(`/team/dlq/${e}`,{lease_ids:[t]});x(((e===`retry`?r.retried:r.discarded)??0)>0?`${e===`retry`?`Retried`:`Discarded`} 1 message.`:`${e===`retry`?`Retry`:`Discard`} returned 0 — lease may have expired. Refresh and try again.`),await Promise.all([n.refetchQueries({queryKey:[`team-dlq`]}),n.refetchQueries({queryKey:[`team-queue-stats`]}),n.refetchQueries({queryKey:[`team-sync-summary`]})])}catch(t){x(`${e} failed: ${t instanceof Error?t.message:String(t)}`)}finally{y(!1)}},[n]),R=(0,W.useCallback)(async()=>{if(!(!m||m.messages.length===0)){y(!0),x(null);try{x(`Retried ${(await os(`/team/dlq/retry`,{lease_ids:m.messages.map(e=>e.lease_id)})).retried??0} of ${m.messages.length} messages.`),await Promise.all([n.refetchQueries({queryKey:[`team-dlq`]}),n.refetchQueries({queryKey:[`team-queue-stats`]}),n.refetchQueries({queryKey:[`team-sync-summary`]})])}catch(e){x(`Retry failed: ${e instanceof Error?e.message:String(e)}`)}finally{y(!1)}}},[m,n]),ee=(0,W.useCallback)(async()=>{D(!0),k(null);try{let e=await os(`/team/rebuild`);e.error?k(`Rebuild failed: ${e.error}`):k(`Rebuilt: handed off ${Z5(e.handedOff)} records in ${e.batches} batch${e.batches===1?``:`es`}.`),n.invalidateQueries({queryKey:[`team-status`]}),n.invalidateQueries({queryKey:[`team-sync-summary`]}),n.invalidateQueries({queryKey:[`team-queue-stats`]}),n.invalidateQueries({queryKey:[`team-dlq`]})}catch(e){k(`Rebuild failed: ${e instanceof Error?e.message:String(e)}`)}finally{D(!1)}},[n]),z=m?.messages??[],B=c?.remote_machine_total??null,V=c?.local.total_records??null;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,G.jsx)(V0,{intervalMs:r?js.TEAM:void 0,isFetching:P,onManualRefresh:F})}),(0,G.jsx)(X5,{title:`Remote store`,actions:c?.remote?e.worker_update_available?(0,G.jsxs)(X,{variant:`outline`,title:`Update available — deployed v${e.deployed_worker_version}, v${e.local_team_package_version} ready. Contact admin to update.`,children:[`v`,c.remote.package_version]}):(0,G.jsxs)(X,{variant:`default`,children:[`v`,c.remote.package_version]}):null,children:l&&!c?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):c?.remote_error?(0,G.jsx)(`p`,{className:`text-sm text-terracotta break-words m-0`,children:c.remote_error}):c?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,G.jsx)(G2,{label:`Local records`,value:Z5(V),sublabel:`this machine`,accent:`outline`}),(0,G.jsx)(G2,{label:`Remote records`,value:Z5(B),sublabel:`this machine`,accent:`outline`}),(0,G.jsx)(G2,{label:`Delta`,value:B===null||V===null?`—`:t7(V,B),accent:B!==null&&V!==null&&B!==V?`ochre`:`outline`}),(0,G.jsx)(n7,{remote:c.remote,localEmbedded:f?.embedding.embedded_count??null})]}),c.drift&&c.drift.length>0?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Local vs cloud (this machine)`}),(0,G.jsx)(r7,{rows:c.drift})]}):c.total_delta===0?(0,G.jsx)(`p`,{className:`text-xs text-sage m-0`,children:`In sync`}):null,(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`Last synced `,Q5(c.last_handoff?.completed_at)]}),(c.total_delta??0)>0&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-outline-variant/10 pt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Replaces this machine's cloud data with your local Grove. One-way; no reconciliation.`}),(0,G.jsx)(Y,{size:`sm`,variant:`outline`,onClick:ee,disabled:E,children:E?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Qa,{className:`h-3.5 w-3.5 animate-spin mr-1.5`}),`Rebuilding...`]}):`Rebuild from local`})]}),O&&(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:O})]})]}):(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:N})}),(0,G.jsx)(X5,{title:`Queue health`,children:a?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):A?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:N}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,G.jsx)(Y5,{label:`In flight`,value:i?.backlog??0,tone:(i?.backlog??0)>0?`ochre`:`outline`,pulse:(i?.backlog??0)>0,sub:(i?.backlog??0)>0?`draining`:void 0}),(0,G.jsx)(Y5,{label:`Failed`,value:i?.failed??0,tone:(i?.failed??0)>0?`terracotta`:`outline`}),(0,G.jsx)(Y5,{label:`Embeds failed`,value:i?.embed_failed??0,tone:(i?.embed_failed??0)>0?`terracotta`:`outline`})]}),i?.last_run_at!=null&&(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`Last run `,new Date(i.last_run_at*1e3).toLocaleString()]}),i?.last_error&&(0,G.jsx)(`p`,{className:`text-xs text-terracotta break-words m-0`,children:i.last_error}),(i?.embed_failed??0)>0&&i?.last_embed_error&&(0,G.jsx)(`p`,{className:`text-xs text-terracotta break-words m-0`,children:i.last_embed_error})]})}),(0,G.jsxs)(X5,{title:`Failed syncs`,actions:z.length>0?(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:v||M,onClick:R,children:`Retry all (${z.length})`}):null,children:[b&&(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface-variant m-0 mb-3`,children:b}),j?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):M?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:N}):z.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`No failed syncs.`}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`These records couldn't reach the cloud after repeated tries. Retry to attempt again, or discard to drop them.`}),(0,G.jsx)(`div`,{className:`divide-y divide-outline-variant/10`,children:z.map(e=>(0,G.jsx)(i7,{message:e,onAction:L,busy:v},e.lease_id))})]})]}),(0,G.jsxs)(X5,{title:`Backfill`,actions:(0,G.jsx)(Y,{size:`sm`,variant:`default`,onClick:I,disabled:S,children:S?`Backfilling...`:`Backfill existing records`}),children:[(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Re-sends every local record to the cloud — for recovery after a cloud-side reset or lost data. Not part of routine sync.`}),w&&(0,G.jsx)(`p`,{className:`text-sm text-sage m-0 mt-3`,children:w})]})]})}function o7(e){let t=e.trim();if(!t)return`?`;let n=t.split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[1][0]).toUpperCase():t.slice(0,2).toUpperCase()}var s7=(0,W.forwardRef)(({name:e,initials:t,size:n=36,className:r,style:i,...a},o)=>{let s=(t??o7(e)).slice(0,2);return(0,G.jsx)(`span`,{ref:o,"aria-label":e,className:J(`inline-flex items-center justify-center rounded-full font-mono font-semibold uppercase text-[var(--on-primary)] shrink-0`,r),style:{width:n,height:n,fontSize:Math.round(n/3),background:`linear-gradient(135deg, var(--sage-dim), var(--ochre))`,...i},...a,children:s})});s7.displayName=`MemberAvatar`;function c7(e){if(!e)return`never`;let t=Date.now()-e*1e3,n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<48?`${r}h ago`:`${Math.floor(r/24)}d ago`}function l7({m:e,isSelf:t}){return(0,G.jsx)(kM,{accent:`ochre`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(s7,{name:e.user,size:36}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-sm text-on-surface`,children:e.user}),t&&(0,G.jsx)(X,{variant:`outline`,children:`this machine`}),e.role&&(0,G.jsx)(X,{variant:e.role===`owner`?`default`:`outline`,children:e.role})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e.machine_id}),e.joined&&(0,G.jsxs)(`span`,{children:[`joined `,e.joined]}),!t&&(0,G.jsxs)(`span`,{children:[`last received `,c7(e.synced_at)]}),e.tags.map(e=>(0,G.jsxs)(`span`,{className:`font-mono`,children:[`#`,e]},e))]})]})]})})}function u7({teamId:e}={}){let{data:t,isLoading:n}=p8(e),{data:r,isLoading:i}=i8(e),a=r?.machine_id??null,o=n||i,s=t?.members.length??0;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(Wj,{tone:`ochre`,eyebrow:`Members`,title:`Roster`,actions:o?null:(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[s,` `,s===1?`member`:`members`]}),padded:!1,children:o?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant m-0`,children:`Loading…`}):!t||t.members.length===0?(0,G.jsxs)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant m-0`,children:[`No team members yet. Run `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team join`}),` on a teammate's machine to add them.`]}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:t.members.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(l7,{m:e,isSelf:e.machine_id===a})},e.id))})}),(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`Members come from the local `,(0,G.jsx)(`code`,{className:`font-mono`,children:`team_members`}),` table, synced from peers via the team Worker.`]})]})}var d7=(0,W.forwardRef)(({number:e,size:t=28,className:n,style:r,...i},a)=>(0,G.jsx)(`span`,{ref:a,className:J(`inline-flex items-center justify-center rounded-full bg-surface-container-high text-on-surface font-mono font-semibold shrink-0`,n),style:{width:t,height:t,fontSize:Math.round(t*12/28),...r},...i,children:e}));d7.displayName=`StepCircle`;function f7({n:e,state:t,title:n,children:r}){return(0,G.jsxs)(`li`,{"aria-current":t===`active`?`step`:void 0,className:J(`flex gap-3 rounded-md border border-[var(--ghost-border)] px-4 py-3 transition-colors`,t===`active`&&`bg-sage/[0.05] border-l-2 border-l-sage`,t===`complete`&&`opacity-70`),children:[(0,G.jsx)(d7,{number:e,className:J(t===`active`&&`bg-sage/15 text-sage`,t===`complete`&&`bg-sage text-on-sage`)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-on-surface m-0`,children:n}),r]})]})}function p7({scopeName:e}){return(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,G.jsxs)(Wj,{tone:`ochre`,eyebrow:(0,G.jsx)($6,{Icon:bo,tone:`ochre`,children:`Not syncing`}),title:`Team sync for ${e}`,children:[(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0 mb-3`,children:`This project is not assigned to a registered team.`}),(0,G.jsxs)(`ol`,{className:`m-0 p-0 list-none flex flex-col gap-3`,children:[(0,G.jsx)(f7,{n:1,state:`active`,title:`Install prerequisites`,children:(0,G.jsx)(`code`,{className:`block font-mono text-xs bg-surface-container rounded px-3 py-2 text-on-surface-variant`,children:`npm install -g @goondocks/myco-team wrangler && wrangler login`})}),(0,G.jsxs)(f7,{n:2,state:`idle`,title:`Provision the Grove worker`,children:[(0,G.jsx)(`code`,{className:`block font-mono text-xs bg-surface-container rounded px-3 py-2 text-on-surface-variant`,children:`myco-team install`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mt-1`,children:`Creates the worker and registers the team on this machine.`})]}),(0,G.jsx)(f7,{n:3,state:`idle`,title:`Add or join the team`,children:(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`On the Teams tab, provision a new team with `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team install`}),` — or, if a teammate shared a Worker URL and Team key, use "Join a team". Then assign this project to it.`]})})]})]})})}function m7({hasTeams:e}){return(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,G.jsx)(Wj,{tone:`sage`,eyebrow:(0,G.jsx)($6,{Icon:Ga,children:`No team selected`}),title:`Select a team to view sync status`,children:(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:e?`Choose a team from the selector in the header to view its status, sync state, and members.`:`No teams are registered on this machine yet. Provision or join a team on the Teams tab, then return here.`})})})}function h7(e,t,n){let r=new Set(t.map(e=>e.team_id));return e&&r.has(e)?e:n&&r.has(n)?n:t[0]?.team_id}var g7=[{id:`teams`,label:`Teams`,description:`select projects`,Icon:Ga},{id:`status`,label:`Status`,description:`identity + health`,Icon:Gi},{id:`sync`,label:`Sync`,description:`queue + secrets`,Icon:Qa},{id:`members`,label:`Members`,description:`roster`,Icon:yo}],_7=new Set([`teams`,`status`,`sync`,`members`]);function v7({status:e}){if(e.version_status!==`client_too_old`&&e.version_status!==`worker_too_old`)return null;let t=e.version_status===`client_too_old`,n=t?`Sync paused — this machine is out of date`:`Sync paused — the team worker is out of date`,r=t?`myco update`:`myco-team update --team-id ${e.team_id??`<team_id>`}`,i=t?`This daemon speaks sync protocol v${e.daemon_protocol_version}, but the team worker requires at least v${e.worker_min_client_version??`?`}.`:`This daemon speaks sync protocol v${e.daemon_protocol_version}, but the team worker only supports up to v${e.worker_protocol_version??`?`}.`;return(0,G.jsxs)(Vj,{accent:`terra`,padded:!0,className:`mb-4 flex items-start gap-3`,role:`alert`,children:[(0,G.jsx)(_o,{className:`size-5 shrink-0 text-terracotta-text`,"aria-hidden":!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`p`,{className:`m-0 text-sm font-medium text-on-surface`,children:n}),(0,G.jsxs)(`p`,{className:`m-0 text-sm text-on-surface-variant`,children:[i,` Pending changes are held safely; run `,(0,G.jsx)(`code`,{className:`text-terracotta-text`,children:r}),` to resume syncing.`]})]})]})}var y7=`myco.team.selectedTeamId`;function b7(){let[e,t]=di(),{data:n,isLoading:r}=c8(),i=n?.teams??[],a=typeof window<`u`?window.localStorage.getItem(y7):null,o=h7(e.get(`team`),i,a);(0,W.useEffect)(()=>{o&&o!==a&&window.localStorage.setItem(y7,o)},[o,a]);let{data:s,isLoading:c}=i8(r?void 0:o),l=e.get(`tab`)??`teams`,u=_7.has(l)?l:`teams`;if(r||c)return(0,G.jsx)(Lj,{isLoading:!0,error:null,loadingText:`Loading team…`,children:(0,G.jsx)(`span`,{})});if(!s)return null;let d=s.enabled&&s.worker_url,f=s.grove?.name??s.project.name??`this Grove`;function p(){return u===`teams`?(0,G.jsx)(U5,{}):o?d?u===`sync`?(0,G.jsx)(a7,{status:s,teamId:o}):u===`members`?(0,G.jsx)(u7,{teamId:o}):(0,G.jsx)(q5,{status:s}):(0,G.jsx)(p7,{scopeName:f}):(0,G.jsx)(m7,{hasTeams:i.length>0})}return(0,G.jsxs)(zj,{children:[(0,G.jsx)(yP,{title:`Team`,subtitle:`Sync your projects to shared team clouds`,actions:i.length>0&&u!==`teams`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`label`,{htmlFor:`team-scope`,className:`myco-eyebrow-sm text-on-surface-variant`,children:`Team`}),(0,G.jsxs)(`select`,{id:`team-scope`,"aria-label":`Selected team`,className:`rounded-md border border-[var(--ghost-border)] bg-surface-container px-3 py-1.5 text-xs text-on-surface`,value:o??``,onChange:e=>{window.localStorage.setItem(y7,e.target.value),t(t=>{let n=new URLSearchParams(t);return n.set(`team`,e.target.value),n},{replace:!0})},children:[!o&&(0,G.jsx)(`option`,{value:``,disabled:!0,children:`Select a team…`}),i.map(e=>(0,G.jsx)(`option`,{value:e.team_id,children:e.name},e.team_id))]})]}):void 0}),(0,G.jsx)(v7,{status:s}),(0,G.jsx)(iF,{tabs:g7,activeTab:u,onTabChange:e=>t(t=>{let n=new URLSearchParams(t);return n.set(`tab`,e),n},{replace:!0}),columns:4}),p()]})}function x7(){let[e]=di(),t=e.has(`preview`),n=Bs(),r=NM(),i=_s({refetchInterval:t?void 0:4e3}).data?.groves??[],a=Ho(i)??jo(i);if(a&&!t)return(0,G.jsx)(sr,{to:Fo(a),replace:!0});let o=!!a,s=i.reduce((e,t)=>e+t.projects.length,0),c=(r.data?.symbionts??[]).filter(e=>e.detected),l=n.data?.daemon.version,u=n.data?.daemon.port;return(0,G.jsx)(zj,{variant:`narrow`,className:`min-h-full justify-center`,children:(0,G.jsxs)(`div`,{className:`flex max-w-xl flex-col gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-primary/10 text-primary`,children:(0,G.jsx)(mo,{className:`h-5 w-5`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold text-on-surface`,children:o?`You're all set — Myco is capturing`:`You're set up — waiting for your first session`}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-on-surface-variant`,children:`Open any git repository in a supported agent (Claude Code, Cursor, Codex, Copilot, Antigravity, Windsurf, OpenCode, or Pi). Myco registers the project automatically on the first hook and this page opens its dashboard. Capture is scoped to git repositories — work in a non-git folder isn't recorded.`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-outline/40 bg-surface-container/40 p-4 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface`,children:[(0,G.jsx)(oa,{className:`h-4 w-4 shrink-0 text-green-500`}),(0,G.jsxs)(`span`,{children:[`Myco is running`,l?(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[` · v`,l]}):null,u?(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[` · port `,u]}):null]})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`mt-px font-medium text-on-surface`,children:`Agents`}),(0,G.jsx)(`span`,{children:c.length>0?`${c.length} detected — ${c.map(e=>e.displayName).join(`, `)}`:`No supported coding agents detected on this machine yet`})]}),o&&a?(0,G.jsxs)(ri,{to:Fo(a),className:`inline-flex items-center gap-1.5 font-medium text-primary hover:underline`,children:[s,` project`,s===1?``:`s`,` registered — go to dashboard`,(0,G.jsx)(qi,{className:`h-3.5 w-3.5`})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{className:`relative flex h-2 w-2 shrink-0`,children:[(0,G.jsx)(`span`,{className:`absolute inline-flex h-full w-full animate-ping rounded-full bg-primary/60`}),(0,G.jsx)(`span`,{className:`relative inline-flex h-2 w-2 rounded-full bg-primary`})]}),(0,G.jsx)(`span`,{children:`Waiting for your first session…`})]})]})]})})}function S7(){let e=We();return st({mutationFn:e=>os(`/groves`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function C7(){let e=We();return st({mutationFn:({id:e,name:t})=>q(`/groves/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({name:t})}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`groves`],exact:!1}),e.invalidateQueries({queryKey:[`grove`,n.id]})}})}function w7(){let e=We();return st({mutationFn:({id:e})=>q(`/groves/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function T7(){let e=We();return st({mutationFn:({targetGroveId:e,projectId:t})=>os(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function E7(){let e=We();return st({mutationFn:({id:e})=>os(`/groves/${encodeURIComponent(e)}/default`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function D7(){let e=We();return st({mutationFn:({groveId:e,projectId:t})=>os(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}/archive`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function O7(){let e=We();return st({mutationFn:({groveId:e,projectId:t})=>os(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}/unarchive`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}function k7(){let e=We();return st({mutationFn:({groveId:e,projectId:t,confirmationName:n})=>q(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}`,{method:`DELETE`,body:JSON.stringify({confirmation_name:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`],exact:!1})}})}var A7={cortex:{id:`cortex`,label:`Cortex`,masterGate:`cortex.enabled`,memberGates:[],scheduledTasks:[`cortex-instructions`],advancedSettingsLink:`/settings#scheduled-tasks`},canopy:{id:`canopy`,label:`Canopy`,masterGate:`cortex.canopy.enabled`,memberGates:[],scheduledTasks:[`canopy-map`,`canopy-describe`],advancedSettingsLink:`/settings#scheduled-tasks`},skills:{id:`skills`,label:`Skills`,masterGate:`skills.enabled`,memberGates:[],scheduledTasks:[`skill-survey`,`skill-generate`,`skill-evolve`],advancedSettingsLink:`/settings#skills`},vault_evolution:{id:`vault_evolution`,label:`Vault Evolution`,masterGate:`vault_evolution.enabled`,memberGates:[],scheduledTasks:[`vault-evolve`],advancedSettingsLink:`/settings#scheduled-tasks`}};function j7(e,t){return e?zO(e,A7[t].masterGate)!==!1:!1}function M7(e){let t=Object.keys(A7).filter(t=>e[t]);return t.length===0?[{id:`capture-only`,label:`Capture-only`,to:``,tone:`outline`,title:`Sessions, search, and MCP only`}]:t.map(e=>({id:e,label:A7[e].label,to:A7[e].advancedSettingsLink,tone:`sage`,title:`${A7[e].label} enabled`}))}function N7({items:e,ariaLabel:t,trigger:n,align:r=`right`}){let[i,a]=(0,W.useState)(!1),o=(0,W.useRef)(null);return(0,W.useEffect)(()=>{if(!i)return;function e(e){o.current&&(o.current.contains(e.target)||a(!1))}function t(e){e.key===`Escape`&&a(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]),(0,G.jsxs)(`div`,{ref:o,className:`relative inline-block`,children:[(0,G.jsx)(`button`,{type:`button`,"aria-label":t,"aria-haspopup":`menu`,"aria-expanded":i,onClick:e=>{e.preventDefault(),e.stopPropagation(),a(e=>!e)},className:`inline-flex h-8 w-8 items-center justify-center rounded-md text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,children:n??(0,G.jsx)(_a,{className:`h-4 w-4`})}),i&&(0,G.jsx)(`div`,{role:`menu`,className:J(`absolute z-50 mt-1 min-w-[12rem] rounded-md border border-outline-variant/30 bg-surface-container-highest p-1 shadow-lg`,r===`right`?`right-0`:`left-0`),children:e.map(e=>(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,onClick:t=>{t.preventDefault(),t.stopPropagation(),!e.disabled&&(a(!1),e.onSelect())},className:J(`flex w-full items-center rounded-sm px-3 py-1.5 text-left text-sm transition-colors`,`text-on-surface hover:bg-surface-container-high`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent`,e.destructive&&!e.disabled&&`text-tertiary hover:bg-tertiary/10`),children:e.label},e.key))})]})}function P7({groveName:e,projectCount:t,isDefault:n,onRename:r,onDelete:i,onSetDefault:a}){let o=t>0;return(0,G.jsx)(N7,{items:[{key:`set-default`,label:`Set as default`,disabled:n,disabledReason:n?`Already the default Grove`:void 0,onSelect:a},{key:`rename`,label:`Rename`,onSelect:r},{key:`delete`,label:`Delete Grove`,destructive:!0,disabled:o,disabledReason:o?`Move or remove projects first`:void 0,onSelect:i}],ariaLabel:`${e} actions`})}function F7({projectName:e,archived:t=!1,onMove:n,onOpen:r,onArchive:i,onUnarchive:a,onDelete:o,onIgnore:s}){return(0,G.jsx)(N7,{items:[{key:`open`,label:`Open dashboard`,onSelect:r,disabled:t},{key:`move`,label:`Move to another Grove`,onSelect:n,disabled:t},{key:`ignore`,label:`Ignore project…`,onSelect:s,disabled:t},t?{key:`unarchive`,label:`Unarchive project`,onSelect:a}:{key:`archive`,label:`Archive project`,onSelect:i},{key:`delete`,label:`Delete permanently…`,onSelect:o,destructive:!0}],ariaLabel:`${e} actions`})}function I7(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`default`}function L7({open:e,onOpenChange:t}){let[n,r]=(0,W.useState)(``),[i,a]=(0,W.useState)(null),o=S7();(0,W.useEffect)(()=>{e&&(r(``),a(null),o.reset())},[e]);let s=n.trim(),c=s.length>0?I7(s):``;function l(e){if(e.preventDefault(),s.length===0){a(`Name is required.`);return}a(null),o.mutate({name:s},{onSuccess:e=>{DA({level:`success`,title:`Grove created`,detail:e.slug}),t(!1)},onError:e=>{DA({level:`error`,title:`Could not create Grove`,detail:e.message})}})}return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`New Grove`}),(0,G.jsx)(ap,{children:`Group projects into a local Grove.`})]}),(0,G.jsxs)(`form`,{onSubmit:l,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`new-grove-name`,className:`text-sm font-medium text-on-surface`,children:`Name`}),(0,G.jsx)(`input`,{id:`new-grove-name`,type:`text`,value:n,autoFocus:!0,onChange:e=>r(e.target.value),placeholder:`Personal`,className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`}),c&&(0,G.jsxs)(`p`,{className:`font-mono text-xs text-on-surface-variant`,children:[`slug: `,c]}),i&&(0,G.jsx)(`p`,{className:`text-xs text-tertiary`,children:i})]}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:o.isPending,children:`Cancel`}),(0,G.jsx)(Y,{type:`submit`,size:`sm`,disabled:o.isPending||s.length===0,children:o.isPending?`Creating…`:`Create`})]})]})]})})}function R7({open:e,onOpenChange:t,groveId:n,currentName:r}){let[i,a]=(0,W.useState)(r),o=C7();(0,W.useEffect)(()=>{e&&(a(r),o.reset())},[e,r]);let s=i.trim(),c=s===r;function l(e){e.preventDefault(),!(s.length===0||c)&&o.mutate({id:n,name:s},{onSuccess:()=>{DA({level:`success`,title:`Grove renamed`}),t(!1)},onError:e=>{DA({level:`error`,title:`Rename failed`,detail:e.message})}})}return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md`,children:[(0,G.jsx)(np,{children:(0,G.jsx)(ip,{children:`Rename Grove`})}),(0,G.jsxs)(`form`,{onSubmit:l,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`rename-grove-name`,className:`text-sm font-medium text-on-surface`,children:`Name`}),(0,G.jsx)(`input`,{id:`rename-grove-name`,type:`text`,value:i,autoFocus:!0,onChange:e=>a(e.target.value),className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant`,children:`The Grove slug may change if the new name slugifies differently. Auto-suffixes on collision.`})]}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:o.isPending,children:`Cancel`}),(0,G.jsx)(Y,{type:`submit`,size:`sm`,disabled:o.isPending||s.length===0||c,children:o.isPending?`Saving…`:`Save`})]})]})]})})}function z7({open:e,onOpenChange:t,groveId:n,groveName:r,projectCount:i}){let a=w7(),o=i>0;function s(){o||a.mutate({id:n},{onSuccess:()=>{DA({level:`success`,title:`Grove deleted`,detail:r}),t(!1)},onError:e=>{e instanceof ms&&e.status===409?DA({level:`error`,title:`Grove not empty`,detail:`${e.body?.project_count??`?`} project(s) still bound`}):DA({level:`error`,title:`Delete failed`,detail:e.message})}})}return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Delete Grove`}),(0,G.jsxs)(ap,{children:[`Delete `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:r}),`? This removes the Grove from the local registry.`]})]}),o&&(0,G.jsxs)(`p`,{className:`rounded-md border border-tertiary/30 bg-tertiary/10 px-3 py-2 text-sm text-on-surface`,children:[`Move or remove the `,i,` project`,i===1?``:`s`,` in this Grove first.`]}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:a.isPending,children:`Cancel`}),(0,G.jsx)(`span`,{title:o?`Grove still has projects`:void 0,children:(0,G.jsx)(Y,{type:`button`,variant:`destructive`,size:`sm`,onClick:s,disabled:a.isPending||o,children:a.isPending?`Deleting…`:`Delete Grove`})})]})]})})}function B7({open:e,onOpenChange:t,sourceGroveId:n,projectId:r,projectName:i,groves:a}){let o=a.filter(e=>e.id!==n),[s,c]=(0,W.useState)(o[0]?.id??``),l=T7();(0,W.useEffect)(()=>{e&&(c(o[0]?.id??``),l.reset())},[e,n,r]);function u(){s&&l.mutate({targetGroveId:s,projectId:r},{onSuccess:()=>{DA({level:`success`,title:`Project moved`}),t(!1)},onError:e=>{DA({level:`error`,title:`Move failed`,detail:e.message})}})}return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Move project`}),(0,G.jsxs)(ap,{children:[`Move `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:i}),` to another Grove.`]})]}),o.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant`,children:`No other Groves available. Create a new Grove first.`}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`move-target-grove`,className:`text-sm font-medium text-on-surface`,children:`Destination Grove`}),(0,G.jsx)(`select`,{id:`move-target-grove`,value:s,onChange:e=>c(e.target.value),disabled:l.isPending,className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,children:o.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant`,children:`The project keeps its data; only its Grove binding changes.`})]}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:l.isPending,children:`Cancel`}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,onClick:u,disabled:l.isPending||o.length===0||!s,className:`gap-2`,children:[l.isPending&&(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),l.isPending?`Moving…`:`Confirm move`]})]})]})})}function V7({open:e,onOpenChange:t,groveId:n,projectId:r,projectName:i}){let[a,o]=(0,W.useState)(``),s=k7(),c=a===i;function l(){c&&s.mutate({groveId:n,projectId:r,confirmationName:a},{onSuccess:e=>{DA({level:`success`,title:`Project deleted`,detail:e.delete.snapshot_path}),o(``),t(!1)},onError:e=>{DA({level:`error`,title:`Delete failed`,detail:e.message})}})}return(0,G.jsx)(Zf,{open:e,onOpenChange:t,children:(0,G.jsxs)(tp,{className:`sm:max-w-md`,children:[(0,G.jsxs)(np,{children:[(0,G.jsx)(ip,{children:`Delete Project Permanently`}),(0,G.jsxs)(ap,{children:[`This deletes `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:i}),` from its Grove and cannot be undone.`]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant`,children:[`Type `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:i}),` to confirm.`]}),(0,G.jsx)(op,{value:a,onChange:e=>o(e.target.value),"aria-label":`Project name confirmation`,autoComplete:`off`})]}),(0,G.jsxs)(rp,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:s.isPending,children:`Cancel`}),(0,G.jsx)(Y,{type:`button`,variant:`destructive`,size:`sm`,onClick:l,disabled:s.isPending||!c,children:s.isPending?`Deleting…`:`Delete Permanently`})]})]})})}function H7({capId:e,scoped:t}){let n=A7[e],r=j7(t.effective,e);return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-3 border-b border-outline-variant/15 last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-on-surface`,children:n.label}),(0,G.jsx)(ri,{to:n.advancedSettingsLink,className:`text-xs text-on-surface-variant hover:text-on-surface transition-colors`,children:`Advanced settings →`})]}),(0,G.jsx)(bP,{checked:r,onCheckedChange:e=>{t.setFields([{path:n.masterGate,value:e}],`local`)}})]})}function U7({target:e,open:t,onClose:n}){let r=$O(e);return(0,G.jsxs)(KP,{open:t,onClose:n,ariaLabel:`Project capabilities`,testIdRoot:`capability-panel`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 mb-5`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-on-surface-variant`,children:`Capabilities`}),(0,G.jsx)(`div`,{className:`text-base font-semibold text-on-surface`,children:e.project.name}),(0,G.jsx)(`div`,{className:`text-xs text-on-surface-variant`,children:`Toggles apply at Personal scope — only this machine.`})]}),(0,G.jsx)(`div`,{className:`flex flex-col`,children:yk.map(e=>(0,G.jsx)(H7,{capId:e,scoped:r},e))}),(0,G.jsx)(`div`,{className:`mt-5 pt-4 border-t border-outline-variant/15`,children:(0,G.jsx)(`button`,{type:`button`,className:`text-xs text-on-surface-variant hover:text-on-surface transition-colors`,onClick:()=>{r.resetFields(yk.map(e=>A7[e].masterGate))},children:`Reset to defaults`})})]})}function W7(){let e=Nn(),t=E7(),n=D7(),r=O7(),i=KO(),a=JO(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null),[m,h]=(0,W.useState)(null),[g,_]=(0,W.useState)(!1),[v,y]=(0,W.useState)(``),[b,x]=(0,W.useState)(null),S=_s({includeArchived:g}),C=S.data?.groves??[],{data:w}=cv(),T=(0,W.useMemo)(()=>{let e=new Map;for(let t of w?.projects??[])e.set(t.project_id,t.last_activity_at);return e},[w]),E=e=>{let t=T.get(e);return t?Date.parse(t):0},D=e=>{let t=v.trim().toLowerCase();return[...t?e.projects.filter(e=>`${e.name} ${e.root}`.toLowerCase().includes(t)):e.projects].sort((e,t)=>E(t.project_id)-E(e.project_id))},O=v.trim().length>0;function k(e,t){n.mutate({groveId:e.id,projectId:t.project_id},{onSuccess:()=>DA({level:`success`,title:`Project archived`,detail:t.name}),onError:e=>DA({level:`error`,title:`Archive failed`,detail:e.message})})}function A(e,t){r.mutate({groveId:e.id,projectId:t.project_id},{onSuccess:()=>DA({level:`success`,title:`Project unarchived`,detail:t.name}),onError:e=>DA({level:`error`,title:`Unarchive failed`,detail:e.message})})}function j(e){t.mutate({id:e.id},{onSuccess:()=>{DA({level:`success`,title:`${e.name} is now the default Grove`})},onError:e=>{DA({level:`error`,title:`Failed to set default`,detail:e.message})}})}function M(e,t){if((i.data?.config.capture.ignore?.paths??[]).includes(t.root)){k(e,t);return}a.mutate({path:`capture.ignore.paths`,value:t.root},{onSuccess:()=>k(e,t),onError:e=>DA({level:`error`,title:`Ignore failed`,detail:e.message})})}return(0,G.jsxs)(Lj,{isLoading:S.isLoading,error:S.error,loadingText:`Loading Groves...`,children:[(0,G.jsxs)(zj,{children:[(0,G.jsxs)(`header`,{className:`flex items-end justify-between gap-4 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(Uj,{children:`Grove management`}),(0,G.jsx)(`h1`,{className:`myco-display-lg text-on-surface m-0`,children:`Groves`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Registered local Grove projects for this daemon.`})]}),(0,G.jsxs)(Y,{size:`sm`,onClick:()=>s(!0),className:`gap-1.5`,children:[(0,G.jsx)(Xa,{className:`h-4 w-4`}),`New Grove`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`label`,{className:`flex w-full max-w-xs items-center gap-2 rounded-md border border-outline-variant/30 bg-surface px-2 py-1.5 text-sm`,children:[(0,G.jsx)(no,{className:`h-4 w-4 text-on-surface-variant`}),(0,G.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`Search projects by name or path`,className:`min-w-0 flex-1 bg-transparent outline-none placeholder:text-on-surface-variant`})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-on-surface-variant`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`h-4 w-4 accent-primary`}),`Show archived projects`]})]}),(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:C.map(t=>{let n=D(t);return O&&n.length===0?null:(0,G.jsx)(Wj,{tone:`sage`,eyebrow:`Grove`,title:t.name,actions:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t.is_default&&(0,G.jsx)(X,{variant:`outline`,children:`default`}),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-on-surface-variant`,children:O?`${n.length} of ${t.project_count}`:`${t.project_count} project${t.project_count===1?``:`s`}`}),(0,G.jsx)(P7,{groveName:t.name,projectCount:t.project_count,isDefault:t.is_default,onRename:()=>l(t),onDelete:()=>d(t),onSetDefault:()=>j(t)})]}),padded:!1,children:n.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:O?`No matching projects.`:`No projects in this Grove.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:n.map(n=>{let r=T.get(n.project_id);return(0,G.jsx)(`li`,{children:(0,G.jsx)(kM,{accent:`sage`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(ii,{to:Fo({grove:t,project:n}),className:`flex min-w-0 flex-1 items-center gap-3 hover:text-sage`,children:[(0,G.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-xs font-semibold text-white`,style:{backgroundColor:Wo(n.project_id)},children:Uo(n.name)}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-sm font-medium text-on-surface`,children:n.name}),(0,G.jsx)(`span`,{className:`block truncate text-xs text-on-surface-variant font-mono`,children:n.root}),(0,G.jsx)(`span`,{className:`block truncate text-[11px] text-on-surface-variant`,children:r?`last active ${pv(r)}`:`no activity yet`})]}),n.manifest_state!==`present`&&(0,G.jsx)(X,{variant:`outline`,children:n.manifest_state}),n.status===`archived`&&(0,G.jsx)(X,{variant:`outline`,children:`archived`})]}),n.capabilities&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>x({grove:t,project:n}),"aria-label":`Configure ${n.name} capabilities`,title:`Configure capabilities`,"data-testid":`capability-badge-strip`,className:`shrink-0 flex flex-wrap items-center gap-1 rounded-md p-1 hover:bg-surface-container-high transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,children:M7(n.capabilities).map(e=>(0,G.jsx)(K$,{chip:e},e.id))}),(0,G.jsx)(F7,{projectName:n.name,archived:n.status===`archived`,onOpen:()=>e(Fo({grove:t,project:n})),onMove:()=>p({grove:t,project:n}),onIgnore:()=>M(t,n),onArchive:()=>k(t,n),onUnarchive:()=>A(t,n),onDelete:()=>h({grove:t,project:n})})]})})},n.project_id)})})},t.id)})})]}),(0,G.jsx)(L7,{open:o,onOpenChange:s}),c&&(0,G.jsx)(R7,{open:c!==null,onOpenChange:e=>!e&&l(null),groveId:c.id,currentName:c.name}),u&&(0,G.jsx)(z7,{open:u!==null,onOpenChange:e=>!e&&d(null),groveId:u.id,groveName:u.name,projectCount:u.project_count}),f&&(0,G.jsx)(B7,{open:f!==null,onOpenChange:e=>!e&&p(null),sourceGroveId:f.grove.id,projectId:f.project.project_id,projectName:f.project.name,groves:C}),m&&(0,G.jsx)(V7,{open:m!==null,onOpenChange:e=>!e&&h(null),groveId:m.grove.id,projectId:m.project.project_id,projectName:m.project.name}),b&&(0,G.jsx)(U7,{target:b,open:!0,onClose:()=>x(null)})]})}function G7(){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(OA,{}),(0,G.jsxs)(dr,{children:[(0,G.jsx)(lr,{path:`/`,element:(0,G.jsx)(K7,{})}),(0,G.jsxs)(lr,{element:(0,G.jsx)(bs,{children:(0,G.jsx)(_k,{children:(0,G.jsx)(xA,{})})}),children:[(0,G.jsx)(lr,{path:`/onboarding`,element:(0,G.jsx)(x7,{})}),(0,G.jsx)(lr,{path:`/groves`,element:(0,G.jsx)(W7,{})}),(0,G.jsx)(lr,{path:`/symbionts`,element:(0,G.jsx)($$,{})}),(0,G.jsx)(lr,{path:`/logs`,element:(0,G.jsx)(D5,{})}),(0,G.jsx)(lr,{path:`/machine`,element:(0,G.jsx)(z5,{})}),(0,G.jsx)(lr,{path:`/settings`,element:(0,G.jsx)(n9,{})}),(0,G.jsx)(lr,{path:`/machine/settings`,element:(0,G.jsx)(e9,{})}),(0,G.jsx)(lr,{path:`/system`,element:(0,G.jsx)(sr,{to:`/settings#logging`,replace:!0})})]}),(0,G.jsxs)(lr,{path:`/g/:groveSlug/p/:projectSlug`,element:(0,G.jsx)(r9,{}),children:[(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(iM,{})}),(0,G.jsx)(lr,{path:`sessions`,element:(0,G.jsx)(vP,{})}),(0,G.jsx)(lr,{path:`sessions/:id`,element:(0,G.jsx)(vP,{})}),(0,G.jsx)(lr,{path:`cortex`,element:(0,G.jsx)(TF,{})}),(0,G.jsx)(lr,{path:`mycelium`,element:(0,G.jsx)(G$,{})}),(0,G.jsx)(lr,{path:`agent`,element:(0,G.jsx)(B4,{})}),(0,G.jsx)(lr,{path:`agent/:id`,element:(0,G.jsx)(B4,{})}),(0,G.jsx)(lr,{path:`skills`,element:(0,G.jsx)(x3,{})}),(0,G.jsx)(lr,{path:`settings`,element:(0,G.jsx)(t9,{})}),(0,G.jsx)(lr,{path:`operations`,element:(0,G.jsx)(Z7,{})}),(0,G.jsx)(lr,{path:`team`,element:(0,G.jsx)(Y7,{})})]}),(0,G.jsx)(lr,{path:`/g/:groveSlug/dashboard`,element:(0,G.jsx)(i9,{}),children:(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(C8,{})})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/operations`,element:(0,G.jsx)(i9,{}),children:(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(Y8,{})})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/settings`,element:(0,G.jsx)($7,{})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/maintenance`,element:(0,G.jsx)(Q7,{})}),(0,G.jsxs)(lr,{path:`/g/:groveSlug/team`,element:(0,G.jsx)(i9,{}),children:[(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(b7,{})}),(0,G.jsx)(lr,{path:`maintenance`,element:(0,G.jsx)(X7,{})})]}),(0,G.jsx)(lr,{path:`/sessions`,element:(0,G.jsx)(q7,{suffix:`/sessions`})}),(0,G.jsx)(lr,{path:`/sessions/:id`,element:(0,G.jsx)(q7,{suffixFromPath:!0})}),(0,G.jsx)(lr,{path:`/cortex`,element:(0,G.jsx)(q7,{suffix:`/cortex`})}),(0,G.jsx)(lr,{path:`/mycelium`,element:(0,G.jsx)(q7,{suffix:`/mycelium`})}),(0,G.jsx)(lr,{path:`/agent`,element:(0,G.jsx)(q7,{suffix:`/agent`})}),(0,G.jsx)(lr,{path:`/agent/:id`,element:(0,G.jsx)(q7,{suffixFromPath:!0})}),(0,G.jsx)(lr,{path:`/skills`,element:(0,G.jsx)(q7,{suffix:`/skills`})}),(0,G.jsx)(lr,{path:`/operations`,element:(0,G.jsx)(J7,{suffix:`/operations`})}),(0,G.jsx)(lr,{path:`/team`,element:(0,G.jsx)(J7,{suffix:`/team`})}),(0,G.jsx)(lr,{path:`*`,element:(0,G.jsx)(sr,{to:`/`,replace:!0})})]})]})}function K7(){let{data:e,isLoading:t,error:n}=_s(),{data:r,isLoading:i}=cv();if(t)return(0,G.jsx)(a9,{text:`Loading projects...`});if(n)return(0,G.jsx)(a9,{text:n.message});let a=e?.groves??[],o=Ho(a);if(!o&&i)return(0,G.jsx)(a9,{text:`Loading projects...`});let s=o??No(a,r?.projects);return s?(0,G.jsx)(sr,{to:Fo(s),replace:!0}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function q7({suffix:e,suffixFromPath:t=!1}){let n=An(),{data:r,isLoading:i,error:a}=_s(),{data:o}=cv();if(i)return(0,G.jsx)(a9,{text:`Loading projects...`});if(a)return(0,G.jsx)(a9,{text:a.message});let s=r?.groves??[],c=Ho(s)??No(s,o?.projects);return c?(0,G.jsx)(sr,{to:dP(Fo(c,t?n.pathname:e),n.search,n.hash),replace:!0}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function J7({suffix:e}){let t=An(),{data:n,isLoading:r,error:i}=_s();if(r)return(0,G.jsx)(a9,{text:`Loading Grove...`});if(i)return(0,G.jsx)(a9,{text:i.message});let a=n?.groves??[],o=(Ho(a)??jo(a))?.grove??a[0];if(!o)return(0,G.jsx)(sr,{to:`/onboarding`,replace:!0});let s=e.startsWith(`/`)?e:`/${e}`;return(0,G.jsx)(sr,{to:dP(`/g/${o.slug}${s}`,t.search,t.hash),replace:!0})}function Y7(){let e=An(),{groveSlug:t}=Ln();return t?(0,G.jsx)(sr,{to:dP(`/g/${t}/team`,e.search,e.hash),replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function X7(){let{groveSlug:e}=Ln();return e?(0,G.jsx)(sr,{to:`/g/${e}/team?tab=sync`,replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function Z7(){let e=An(),{groveSlug:t}=Ln();return t?(0,G.jsx)(sr,{to:dP(`/g/${t}/operations`,e.search,e.hash),replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function Q7(){let e=An(),{groveSlug:t}=Ln();return t?(0,G.jsx)(sr,{to:dP(`/g/${t}/operations`,e.search,e.hash),replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function $7(){return(0,G.jsx)(sr,{to:`/settings#backup`,replace:!0})}function e9(){return(0,G.jsx)(sr,{to:`/settings#logging`,replace:!0})}function t9(){let e=An();return(0,G.jsx)(sr,{to:`/settings${e.search}${e.hash}`,replace:!0})}function n9(){let{data:e,isLoading:t,error:n}=_s(),{data:r}=cv();if(t)return(0,G.jsx)(a9,{text:`Loading settings...`});if(n)return(0,G.jsx)(a9,{text:n.message});let i=e?.groves??[],a=Ho(i)??No(i,r?.projects);return a?(0,G.jsx)(ys,{selection:a,persist:!1,children:(0,G.jsx)(_k,{children:(0,G.jsx)(G6,{})})}):(0,G.jsx)(bs,{children:(0,G.jsx)(_k,{children:(0,G.jsx)(G6,{})})})}function r9(){let{groveSlug:e,projectSlug:t}=Ln(),{data:n,isLoading:r,error:i}=_s();if(r)return(0,G.jsx)(a9,{text:`Loading project...`});if(i)return(0,G.jsx)(a9,{text:i.message});let a=Ao(n?.groves??[],e,t);return a?(0,G.jsx)(ys,{selection:a,children:(0,G.jsx)(_k,{children:(0,G.jsx)(xA,{})})}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function i9(){let{groveSlug:e}=Ln(),{data:t,isLoading:n,error:r}=_s(),{data:i}=cv();if(n)return(0,G.jsx)(a9,{text:`Loading Grove...`});if(r)return(0,G.jsx)(a9,{text:r.message});let a=t?.groves??[],o=a.find(t=>t.slug===e);if(!o)return(0,G.jsx)(sr,{to:`/`,replace:!0});let s=Ho(a),c=(s&&s.grove.id===o.id?s.project:null)??Po(o,i?.projects);return c?(0,G.jsx)(ys,{selection:{grove:o,project:c},persist:!1,children:(0,G.jsx)(_k,{children:(0,G.jsx)(xA,{})})}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function a9({text:e}){return(0,G.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-surface text-sm text-on-surface-variant`,children:e})}pk();var o9=new Be({defaultOptions:{queries:{staleTime:Ms}}});Si.createRoot(document.getElementById(`root`)).render((0,G.jsx)(W.StrictMode,{children:(0,G.jsx)(ki,{children:(0,G.jsx)(Ge,{client:o9,children:(0,G.jsx)(ei,{basename:Go()||void 0,children:(0,G.jsx)(G7,{})})})})}));
|