@goondocks/myco 1.0.8 → 1.0.9

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){qo(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){qo(e,t,n)}}function Ko(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){q(e,t,n)},function(n){return qo(e,t,n)}):q(e,t,n)}function q(e,t,n){t.status=`fulfilled`,t.value=n,Jo(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 qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Jo(t),t=t.next;while(t!==r)}e.action=null}function Jo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Yo(e,t){return t}function Xo(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:Yo,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 Zo(e){return Qo(Do(),so,e)}function Qo(e,t,n){if(t=Po(e,t,Yo)[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:Xo,useActionState:Xo,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:Zo,useActionState:Zo,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:J(e,n),r&4&&Rc(5,n);break;case 1:if(J(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(J(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:J(e,n),t===null&&r&4&&Wc(n),r&512&&Hc(n,n.return);break;case 12:J(e,n);break;case 31:J(e,n),r&4&&ll(e,n);break;case 13:J(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?Y(e,n,(n.subtreeFlags&8772)!=0):J(e,n),Zc=i,Qc=a}break;case 30:break;default:J(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||vl(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 J(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)rl(e,t.alternate,t),t=t.sibling}function vl(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),vl(t);break;case 1:Uc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Vc(t,t.return,n),vl(t);break;case 27:_f(t.stateNode);case 26:case 5:Uc(t,t.return),vl(t);break;case 22:t.memoizedState===null&&vl(t);break;case 30:vl(t);break;default:vl(t)}e=e.sibling}}function Y(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:Y(i,a,n),Rc(4,a);break;case 1:if(Y(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:Y(i,a,n),n&&r===null&&o&4&&Wc(a),Hc(a,a.return);break;case 12:Y(i,a,n);break;case 31:Y(i,a,n),n&&o&4&&ll(i,a);break;case 13:Y(i,a,n),n&&o&4&&ul(i,a);break;case 22:a.memoizedState===null&&Y(i,a,n),Hc(a,a.return);break;case 30:break;default:Y(i,a,n)}t=t.sibling}}function yl(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 bl(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 xl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Sl(e,t,n,r),t=t.sibling}function Sl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:xl(e,t,n,r),i&2048&&Rc(9,t);break;case 1:xl(e,t,n,r);break;case 3:xl(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){xl(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 xl(e,t,n,r);break;case 31:xl(e,t,n,r);break;case 13:xl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?xl(e,t,n,r):(a._visibility|=2,Cl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?xl(e,t,n,r):wl(e,t),i&2048&&yl(o,t);break;case 24:xl(e,t,n,r),i&2048&&bl(t.alternate,t);break;default:xl(e,t,n,r)}}function Cl(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:Cl(a,o,s,c,i),Rc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Cl(a,o,s,c,i)):u._visibility&2?Cl(a,o,s,c,i):wl(a,o),i&&l&2048&&yl(o.alternate,o);break;case 24:Cl(a,o,s,c,i),i&&l&2048&&bl(o.alternate,o);break;default:Cl(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&&yl(r.alternate,r);break;case 24:wl(n,r),i&2048&&bl(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),Sl(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.16.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`},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;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,t=``){let n=t&&t!==`/`?`/${t.replace(/^\/+/,``)}`:``;return`/g/${e.grove.slug}/p/${e.project.slug}${n}`}function No(e){let t=e.match(/^\/g\/[^/]+\/p\/[^/]+(?<suffix>\/.*)?$/)?.groups?.suffix??`/`;return/^\/sessions\/[^/]+/.test(t)?`/sessions`:t}function Po(e){return e?`${e.grove.id}:${e.project.project_id}`:`none`}function Fo(){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 Io(e){try{window.localStorage.setItem(wo,JSON.stringify({groveId:e.grove.id,projectId:e.project.project_id}))}catch{}}function Lo(e){let t=Fo();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 Ro(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 zo(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 Bo(){return``}function Vo(e){return e.startsWith(`/`)?e:`/${e}`}var Ho=`/api`,Uo=[`/groves`,`/version`,`/logs`,`/logs/search`,`/logs/stream`],Wo=`1.0.8`,Go=!1;function Ko(e){if(Go)return;let t=e.headers.get(`X-Myco-Api-Version`);t&&t!==Wo&&(Go=!0,console.warn(`[myco] UI version ${Wo} 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=$o(e,t?.headers,r),a=await fetch(Vo(`${Ho}${e}`),{...t,headers:i});if(Ko(a),!a.ok){let e=await qo(a).catch(()=>({}));throw Zo(a.status,e),new ls(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 Jo=`myco:auth-reload-ts`,Yo=1e4,Xo=()=>{window.location.reload()};function Zo(e,t){if(e===401&&us(t)===`unauthorized_context_switch`&&!(typeof window>`u`||window.sessionStorage===void 0)){try{let e=Number(window.sessionStorage.getItem(Jo)??`0`);if(Number.isFinite(e)&&Date.now()-e<Yo)return;window.sessionStorage.setItem(Jo,String(Date.now()))}catch{return}Xo()}}function Qo(){if(typeof window>`u`)return;let e=window.__MYCO_AUTH__;return typeof e==`string`&&e.length>0?e:void 0}function $o(e,t,n){let r=new Headers;if(!es(e)){for(let[e,t]of Object.entries(Oo()))r.set(e,t);let e=Qo();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 es(e){return Uo.some(t=>e===t||e.startsWith(`${t}/`))}async function ts(e,t){return q(e,{method:`POST`,body:t?JSON.stringify(t):void 0})}async function ns(e,t,n){return q(e,{...n,method:`PUT`,body:JSON.stringify(t)})}async function rs(e,t){return q(e,{method:`PATCH`,body:JSON.stringify(t)})}async function is(e,t){return q(e,{method:`DELETE`,body:t?JSON.stringify(t):void 0})}function as(e,t){return q(`/config/merged`,{signal:e,headers:t})}function os(e,t){return q(`/config/local`,{signal:e,headers:t})}function ss(e,t,n,r){let i={scope:e,patch:t};return n&&n.length>0&&(i.clear=n),ns(`/config/scoped`,i,{headers:r})}function cs(e,t){return ns(`/config/scoped`,{scope:`local`,patch:{},clear:e},{headers:t})}var ls=class extends Error{status;body;constructor(e,t){let n=ds(t);super(n?`${n} (API ${e})`:`API error ${e}`),this.status=e,this.body=t}};function us(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 ds(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 fs(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 ps=(0,W.createContext)(null);function ms({selection:e,children:t}){let n=We(),r=Po(e),[i,a]=(0,W.useState)(null);return(0,W.useLayoutEffect)(()=>{Eo(e),Io(e),n.removeQueries({predicate:e=>e.queryKey[0]!==`groves`}),a(r)},[r,n]),i===r?(0,G.jsx)(ps.Provider,{value:e,children:t}):(0,G.jsx)(`div`,{className:`flex h-64 items-center justify-center text-sm text-on-surface-variant`,children:`Switching project...`})}function hs({children:e}){return(0,W.useLayoutEffect)(()=>{Eo(null)},[]),(0,G.jsx)(G.Fragment,{children:e})}function gs(){return(0,W.useContext)(ps)}function _s(){let e=(0,W.useContext)(ps),t=fs();if(e)return e;let n=t.data?.groves??[];return Lo(n)??jo(n)}function vs(e=``){let t=gs();return t?Mo(t,e):e||`/`}function ys(){let e=gs();return(0,W.useCallback)((t=``)=>e?Mo(e,t):t||`/`,[e])}function bs(e,t){if(!e)return t;let[n,...r]=t;return[n,{projectSelection:Po(e)},...r]}function xs(e){return bs(gs(),e)}var Ss=6e4,Cs=3e4;function ws(e,t,n){if(t===`heartbeat`){let t=e*Ei[n];return n===`hidden`?Math.min(t,Ss):n===`deep_sleep`?Math.min(t,Cs):t}return n===`deep_sleep`||n===`hidden`?!1:e*Ei[n]}function Ts(e){let t=Ai(),{pollCategory:n,refetchInterval:r,contextFree:i=!1,...a}=e,o=xs(a.queryKey??[]),s=e=>e===!1||e===void 0?e:ws(e,n,t),c=typeof r==`function`?e=>s(r(e)):s(r);return ot({...a,queryKey:i?a.queryKey:o,refetchInterval:c})}var Es={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},Ds=1e4,Os=3e4,ks=[`debug`,`info`,`warn`,`error`],As={debug:0,info:1,warn:2,error:3},js=[`stable`,`beta`],Ms=1e3;function Ns(e){switch(e){case`info`:return`default`;case`warn`:return`warning`;case`error`:return`destructive`;default:return`secondary`}}function Ps(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 Fs(){return Ts({queryKey:[`daemon-stats`],queryFn:({signal:e})=>q(`/stats`,{signal:e}),refetchInterval:Es.STATS,pollCategory:`standard`})}var Is=500,Ls=3e4;function Rs(){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 ts(`/restart`,{force:e});if(r.status===`busy`)return t(!1),r;let i=Date.now()+Ls;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(Vo(`/health`),{signal:n.current.signal})).ok){e();return}setTimeout(r,Is)}catch{setTimeout(r,Is)}};setTimeout(r,Is)}),window.location.reload()}catch(e){throw t(!1),e}},[]),isRestarting:e}}function zs(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=zs(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Bs(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=zs(e))&&(r&&(r+=` `),r+=t);return r}var Vs=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Hs=Bs,Us=(e,t)=>n=>{if(t?.variants==null)return Hs(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=Vs(t)||Vs(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 Hs(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)},Ws=(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},Gs=(e,t)=>({classGroupId:e,validator:t}),Ks=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),qs=`-`,Js=[],Ys=`arbitrary..`,Xs=e=>{let t=$s(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Qs(e);let n=e.split(qs);return Zs(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ws(i,t):t:i||Js}return n[e]||Js}}},Zs=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Zs(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}},Qs=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?Ys+r:void 0})(),$s=e=>{let{theme:t,classGroups:n}=e;return ec(n,t)},ec=(e,t)=>{let n=Ks();for(let r in e){let i=e[r];tc(i,n,r,t)}return n},tc=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];nc(i,t,n,r)}},nc=(e,t,n,r)=>{if(typeof e==`string`){rc(e,t,n);return}if(typeof e==`function`){ic(e,t,n,r);return}ac(e,t,n,r)},rc=(e,t,n)=>{let r=e===``?t:oc(t,e);r.classGroupId=n},ic=(e,t,n,r)=>{if(sc(e)){tc(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Gs(n,e))},ac=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];tc(o,oc(t,a),n,r)}},oc=(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=Ks(),n.nextPart.set(t,i)),n=i}return n},sc=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,cc=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)}}},lc=`!`,uc=`:`,dc=[],fc=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),pc=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===uc){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(lc)?(c=s.slice(0,-1),l=!0):s.startsWith(lc)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return fc(t,l,c,u)};if(t){let e=t+uc,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):fc(dc,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},mc=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}},hc=e=>({cache:cc(e.cacheSize),parseClassName:pc(e),sortModifiers:mc(e),postfixLookupClassGroupIds:gc(e),...Xs(e)}),gc=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},_c=/\s+/,vc=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(_c),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?_+lc:_,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},yc=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=bc(n))&&(i&&(i+=` `),i+=r);return i},bc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=bc(e[r]))&&(n&&(n+=` `),n+=t);return n},xc=(e,...t)=>{let n,r,i,a,o=o=>(n=hc(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=vc(e,n);return i(e,a),a};return a=o,(...e)=>a(yc(...e))},Sc=[],Cc=e=>{let t=t=>t[e]||Sc;return t.isThemeGetter=!0,t},wc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Tc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ec=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Dc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Oc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,kc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ac=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mc=e=>Ec.test(e),Nc=e=>!!e&&!Number.isNaN(Number(e)),Pc=e=>!!e&&Number.isInteger(Number(e)),Fc=e=>e.endsWith(`%`)&&Nc(e.slice(0,-1)),Ic=e=>Dc.test(e),Lc=()=>!0,Rc=e=>Oc.test(e)&&!kc.test(e),zc=()=>!1,Bc=e=>Ac.test(e),Vc=e=>jc.test(e),Hc=e=>!Gc(e)&&!$c(e),Uc=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)),Wc=e=>sl(e,dl,zc),Gc=e=>wc.test(e),Kc=e=>sl(e,fl,Rc),qc=e=>sl(e,pl,Nc),Jc=e=>sl(e,hl,Lc),Yc=e=>sl(e,ml,zc),Xc=e=>sl(e,ll,zc),Zc=e=>sl(e,ul,Vc),Qc=e=>sl(e,gl,Bc),$c=e=>Tc.test(e),el=e=>cl(e,fl),tl=e=>cl(e,ml),nl=e=>cl(e,ll),rl=e=>cl(e,dl),il=e=>cl(e,ul),al=e=>cl(e,gl,!0),ol=e=>cl(e,hl,!0),sl=(e,t,n)=>{let r=wc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},cl=(e,t,n=!1)=>{let r=Tc.exec(e);return r?r[1]?t(r[1]):n:!1},ll=e=>e===`position`||e===`percentage`,ul=e=>e===`image`||e===`url`,dl=e=>e===`length`||e===`size`||e===`bg-size`,fl=e=>e===`length`,pl=e=>e===`number`,ml=e=>e===`family-name`,hl=e=>e===`number`||e===`weight`,gl=e=>e===`shadow`,_l=xc(()=>{let e=Cc(`color`),t=Cc(`font`),n=Cc(`text`),r=Cc(`font-weight`),i=Cc(`tracking`),a=Cc(`leading`),o=Cc(`breakpoint`),s=Cc(`container`),c=Cc(`spacing`),l=Cc(`radius`),u=Cc(`shadow`),d=Cc(`inset-shadow`),f=Cc(`text-shadow`),p=Cc(`drop-shadow`),m=Cc(`blur`),h=Cc(`perspective`),g=Cc(`aspect`),_=Cc(`ease`),v=Cc(`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(),$c,Gc],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$c,Gc,c],T=()=>[Mc,`full`,`auto`,...w()],E=()=>[Pc,`none`,`subgrid`,$c,Gc],D=()=>[`auto`,{span:[`full`,Pc,$c,Gc]},Pc,$c,Gc],O=()=>[Pc,`auto`,$c,Gc],k=()=>[`auto`,`min`,`max`,`fr`,$c,Gc],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=()=>[Mc,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Mc,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Mc,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,$c,Gc],L=()=>[...b(),nl,Xc,{position:[$c,Gc]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,rl,Wc,{size:[$c,Gc]}],z=()=>[Fc,el,Kc],B=()=>[``,`none`,`full`,l,$c,Gc],V=()=>[``,Nc,el,Kc],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=()=>[Nc,Fc,nl,Xc],U=()=>[``,`none`,m,$c,Gc],re=()=>[`none`,Nc,$c,Gc],ie=()=>[`none`,Nc,$c,Gc],ae=()=>[Nc,$c,Gc],oe=()=>[Mc,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Ic],breakpoint:[Ic],color:[Lc],container:[Ic],"drop-shadow":[Ic],ease:[`in`,`out`,`in-out`],font:[Hc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Ic],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Ic],shadow:[Ic],spacing:[`px`,Nc],text:[Ic],"text-shadow":[Ic],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Mc,Gc,$c,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,$c,Gc]}],"container-named":[Uc],columns:[{columns:[Nc,Gc,$c,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:[Pc,`auto`,$c,Gc]}],basis:[{basis:[Mc,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Nc,Mc,`auto`,`initial`,`none`,Gc]}],grow:[{grow:[``,Nc,$c,Gc]}],shrink:[{shrink:[``,Nc,$c,Gc]}],order:[{order:[Pc,`first`,`last`,`none`,$c,Gc]}],"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,el,Kc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,ol,Jc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Fc,Gc]}],"font-family":[{font:[tl,Yc,t]}],"font-features":[{"font-features":[Gc]}],"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,$c,Gc]}],"line-clamp":[{"line-clamp":[Nc,`none`,$c,qc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$c,Gc]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$c,Gc]}],"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:[Nc,`from-font`,`auto`,$c,Kc]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Nc,`auto`,$c,Gc]}],"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:[Pc,$c,Gc]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$c,Gc]}],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`,$c,Gc]}],"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`]},Pc,$c,Gc],radial:[``,$c,Gc],conic:[Pc,$c,Gc]},il,Zc]}],"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":[Nc,$c,Gc]}],"outline-w":[{outline:[``,Nc,el,Kc]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,al,Qc]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,al,Qc]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Nc,Kc]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,al,Qc]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Nc,$c,Gc]}],"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":[Nc]}],"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":[$c,Gc]}],"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":[Nc]}],"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`,$c,Gc]}],filter:[{filter:[``,`none`,$c,Gc]}],blur:[{blur:U()}],brightness:[{brightness:[Nc,$c,Gc]}],contrast:[{contrast:[Nc,$c,Gc]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,al,Qc]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Nc,$c,Gc]}],"hue-rotate":[{"hue-rotate":[Nc,$c,Gc]}],invert:[{invert:[``,Nc,$c,Gc]}],saturate:[{saturate:[Nc,$c,Gc]}],sepia:[{sepia:[``,Nc,$c,Gc]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$c,Gc]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[Nc,$c,Gc]}],"backdrop-contrast":[{"backdrop-contrast":[Nc,$c,Gc]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Nc,$c,Gc]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Nc,$c,Gc]}],"backdrop-invert":[{"backdrop-invert":[``,Nc,$c,Gc]}],"backdrop-opacity":[{"backdrop-opacity":[Nc,$c,Gc]}],"backdrop-saturate":[{"backdrop-saturate":[Nc,$c,Gc]}],"backdrop-sepia":[{"backdrop-sepia":[``,Nc,$c,Gc]}],"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`,$c,Gc]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Nc,`initial`,$c,Gc]}],ease:[{ease:[`linear`,`initial`,_,$c,Gc]}],delay:[{delay:[Nc,$c,Gc]}],animate:[{animate:[`none`,v,$c,Gc]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$c,Gc]}],"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:[$c,Gc,``,`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:[Pc,$c,Gc]}],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`,$c,Gc]}],"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`,$c,Gc]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Nc,el,Kc,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 _l(Bs(e))}var vl=Us(`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(vl({variant:t,size:n,className:e})),ref:i,...r}));Y.displayName=`Button`,typeof window<`u`&&window.document&&window.document.createElement;function yl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function bl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function xl(...e){return t=>{let n=!1,r=e.map(e=>{let r=bl(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():bl(e[t],null)}}}}function Sl(...e){return W.useCallback(xl(...e),e)}function Cl(e,t){let n=W.createContext(t),r=e=>{let{children:t,...r}=e,i=W.useMemo(()=>r,Object.values(r));return(0,G.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=W.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function wl(e,t=[]){let n=[];function r(t,r){let i=W.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=W.useMemo(()=>o,Object.values(o));return(0,G.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=W.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>W.createContext(e));return function(n){let r=n?.[e]||t;return W.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Tl(i,...t)]}function Tl(...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 El=globalThis?.document?W.useLayoutEffect:()=>{},Dl=W.useId||(()=>void 0),Ol=0;function kl(e){let[t,n]=W.useState(Dl());return El(()=>{e||n(e=>e??String(Ol++))},[e]),e||(t?`radix-${t}`:``)}var Al=W.useInsertionEffect||El;function jl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Ml({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=Nl(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Ml({defaultProp:e,onChange:t}){let[n,r]=W.useState(e),i=W.useRef(n),a=W.useRef(t);return Al(()=>{a.current=t},[t]),W.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Nl(e){return typeof e==`function`}var Pl=l(h(),1);function Fl(e){let t=Il(e),n=W.forwardRef((e,n)=>{let{children:r,...i}=e,a=W.Children.toArray(r),o=a.find(Rl);if(o){let e=o.props.children,r=a.map(t=>t===o?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return(0,G.jsx)(t,{...i,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return(0,G.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Il(e){let t=W.forwardRef((e,t)=>{let{children:n,...r}=e;if(W.isValidElement(n)){let e=Bl(n),i=zl(r,n.props);return n.type!==W.Fragment&&(i.ref=t?xl(t,e):e),W.cloneElement(n,i)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ll=Symbol(`radix.slottable`);function Rl(e){return W.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ll}function zl(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 Bl(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 Vl=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Fl(`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 Hl(e,t){e&&Pl.flushSync(()=>e.dispatchEvent(t))}function Ul(e){let t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...e)=>t.current?.(...e),[])}function Wl(e,t=globalThis?.document){let n=Ul(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 Gl=`DismissableLayer`,Kl=`dismissableLayer.update`,ql=`dismissableLayer.pointerDownOutside`,Jl=`dismissableLayer.focusOutside`,Yl,Xl=W.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zl=W.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=W.useContext(Xl),[u,d]=W.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=W.useState({}),m=Sl(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=eu(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=tu(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Wl(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&&(Yl=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),nu(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Yl)}},[u,f,n,l]),W.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),nu())},[u,l]),W.useEffect(()=>{let e=()=>p({});return document.addEventListener(Kl,e),()=>document.removeEventListener(Kl,e)},[]),(0,G.jsx)(Vl.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:yl(e.onFocusCapture,S.onFocusCapture),onBlurCapture:yl(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:yl(e.onPointerDownCapture,x.onPointerDownCapture)})});Zl.displayName=Gl;var Ql=`DismissableLayerBranch`,$l=W.forwardRef((e,t)=>{let n=W.useContext(Xl),r=W.useRef(null),i=Sl(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)(Vl.div,{...e,ref:i})});$l.displayName=Ql;function eu(e,t=globalThis?.document){let n=Ul(e),r=W.useRef(!1),i=W.useRef(()=>{});return W.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){ru(ql,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 tu(e,t=globalThis?.document){let n=Ul(e),r=W.useRef(!1);return W.useEffect(()=>{let e=e=>{e.target&&!r.current&&ru(Jl,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 nu(){let e=new CustomEvent(Kl);document.dispatchEvent(e)}function ru(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?Hl(i,a):i.dispatchEvent(a)}var iu=`focusScope.autoFocusOnMount`,au=`focusScope.autoFocusOnUnmount`,ou={bubbles:!1,cancelable:!0},su=`FocusScope`,cu=W.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=W.useState(null),l=Ul(i),u=Ul(a),d=W.useRef(null),f=Sl(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:hu(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||hu(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&hu(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){gu.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(iu,ou);s.addEventListener(iu,l),s.dispatchEvent(t),t.defaultPrevented||(lu(yu(du(s)),{select:!0}),document.activeElement===e&&hu(s))}return()=>{s.removeEventListener(iu,l),setTimeout(()=>{let t=new CustomEvent(au,ou);s.addEventListener(au,u),s.dispatchEvent(t),t.defaultPrevented||hu(e??document.body,{select:!0}),s.removeEventListener(au,u),gu.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]=uu(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&hu(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&hu(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,G.jsx)(Vl.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});cu.displayName=su;function lu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(hu(r,{select:t}),document.activeElement!==n)return}function uu(e){let t=du(e);return[fu(t,e),fu(t.reverse(),e)]}function du(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function fu(e,t){for(let n of e)if(!pu(n,{upTo:t}))return n}function pu(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 mu(e){return e instanceof HTMLInputElement&&`select`in e}function hu(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mu(e)&&t&&e.select()}}var gu=_u();function _u(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=vu(e,t),e.unshift(t)},remove(t){e=vu(e,t),e[0]?.resume()}}}function vu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yu(e){return e.filter(e=>e.tagName!==`A`)}var bu=`Portal`,xu=W.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=W.useState(!1);El(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Pl.createPortal((0,G.jsx)(Vl.div,{...r,ref:t}),o):null});xu.displayName=bu;function Su(e,t){return W.useReducer((e,n)=>t[e][n]??e,e)}var Cu=e=>{let{present:t,children:n}=e,r=wu(t),i=typeof n==`function`?n({present:r.isPresent}):W.Children.only(n),a=Sl(r.ref,Eu(i));return typeof n==`function`||r.isPresent?W.cloneElement(i,{ref:a}):null};Cu.displayName=`Presence`;function wu(e){let[t,n]=W.useState(),r=W.useRef(null),i=W.useRef(e),a=W.useRef(`none`),[o,s]=Su(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return W.useEffect(()=>{let e=Tu(r.current);a.current=o===`mounted`?e:`none`},[o]),El(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Tu(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),El(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Tu(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=Tu(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 Tu(e){return e?.animationName||`none`}function Eu(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 Du=0;function Ou(){W.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??ku()),document.body.insertAdjacentElement(`beforeend`,e[1]??ku()),Du++,()=>{Du===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Du--}},[])}function ku(){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 Au=function(){return Au=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},Au.apply(this,arguments)};function ju(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 Mu(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 Nu=`right-scroll-bar-position`,Pu=`width-before-scroll-bar`,Fu=`with-scroll-bars-hidden`,Iu=`--removed-body-scroll-bar-size`;function Lu(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ru(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 zu=typeof window<`u`?W.useLayoutEffect:W.useEffect,Bu=new WeakMap;function Vu(e,t){var n=Ru(t||null,function(t){return e.forEach(function(e){return Lu(e,t)})});return zu(function(){var t=Bu.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Lu(e,null)}),i.forEach(function(e){r.has(e)||Lu(e,a)})}Bu.set(n,e)},[e]),n}function Hu(e){return e}function Uu(e,t){t===void 0&&(t=Hu);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 Wu(e){e===void 0&&(e={});var t=Uu(null);return t.options=Au({async:!0,ssr:!1},e),t}var Gu=function(e){var t=e.sideCar,n=ju(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,Au({},n))};Gu.isSideCarExport=!0;function Ku(e,t){return e.useMedium(t),Gu}var qu=Wu(),Ju=function(){},Yu=W.forwardRef(function(e,t){var n=W.useRef(null),r=W.useState({onScrollCapture:Ju,onWheelCapture:Ju,onTouchMoveCapture:Ju}),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=ju(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Vu([n,t]),C=Au(Au({},b),i);return W.createElement(W.Fragment,null,u&&W.createElement(x,{sideCar:qu,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),Au(Au({},C),{ref:S})):W.createElement(v,Au({},C,{className:c,ref:S}),s))});Yu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Yu.classNames={fullWidth:Pu,zeroRight:Nu};var Xu,Zu=function(){if(Xu)return Xu;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Qu(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Zu();return t&&e.setAttribute(`nonce`,t),e}function $u(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ed(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var td=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Qu())&&($u(t,n),ed(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nd=function(){var e=td();return function(t,n){W.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},rd=function(){var e=nd();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},id={left:0,top:0,right:0,gap:0},ad=function(e){return parseInt(e||``,10)||0},od=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[ad(n),ad(r),ad(i)]},sd=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return id;var t=od(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])}},cd=rd(),ld=`data-scroll-locked`,ud=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.16.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`},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;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,t=``){let n=t&&t!==`/`?`/${t.replace(/^\/+/,``)}`:``;return`/g/${e.grove.slug}/p/${e.project.slug}${n}`}function No(e){let t=e.match(/^\/g\/[^/]+\/p\/[^/]+(?<suffix>\/.*)?$/)?.groups?.suffix??`/`;return/^\/sessions\/[^/]+/.test(t)?`/sessions`:t}function Po(e){return e?`${e.grove.id}:${e.project.project_id}`:`none`}function Fo(){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 Io(e){try{window.localStorage.setItem(wo,JSON.stringify({groveId:e.grove.id,projectId:e.project.project_id}))}catch{}}function Lo(e){let t=Fo();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 Ro(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 zo(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 Bo(){return``}function Vo(e){return e.startsWith(`/`)?e:`/${e}`}var Ho=`/api`,Uo=[`/groves`,`/version`,`/logs`,`/logs/search`,`/logs/stream`],Wo=`1.0.9`,Go=!1;function Ko(e){if(Go)return;let t=e.headers.get(`X-Myco-Api-Version`);t&&t!==Wo&&(Go=!0,console.warn(`[myco] UI version ${Wo} 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=$o(e,t?.headers,r),a=await fetch(Vo(`${Ho}${e}`),{...t,headers:i});if(Ko(a),!a.ok){let e=await qo(a).catch(()=>({}));throw Zo(a.status,e),new ls(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 Jo=`myco:auth-reload-ts`,Yo=1e4,Xo=()=>{window.location.reload()};function Zo(e,t){if(e===401&&us(t)===`unauthorized_context_switch`&&!(typeof window>`u`||window.sessionStorage===void 0)){try{let e=Number(window.sessionStorage.getItem(Jo)??`0`);if(Number.isFinite(e)&&Date.now()-e<Yo)return;window.sessionStorage.setItem(Jo,String(Date.now()))}catch{return}Xo()}}function Qo(){if(typeof window>`u`)return;let e=window.__MYCO_AUTH__;return typeof e==`string`&&e.length>0?e:void 0}function $o(e,t,n){let r=new Headers;if(!es(e)){for(let[e,t]of Object.entries(Oo()))r.set(e,t);let e=Qo();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 es(e){return Uo.some(t=>e===t||e.startsWith(`${t}/`))}async function ts(e,t){return q(e,{method:`POST`,body:t?JSON.stringify(t):void 0})}async function ns(e,t,n){return q(e,{...n,method:`PUT`,body:JSON.stringify(t)})}async function rs(e,t){return q(e,{method:`PATCH`,body:JSON.stringify(t)})}async function is(e,t){return q(e,{method:`DELETE`,body:t?JSON.stringify(t):void 0})}function as(e,t){return q(`/config/merged`,{signal:e,headers:t})}function os(e,t){return q(`/config/local`,{signal:e,headers:t})}function ss(e,t,n,r){let i={scope:e,patch:t};return n&&n.length>0&&(i.clear=n),ns(`/config/scoped`,i,{headers:r})}function cs(e,t){return ns(`/config/scoped`,{scope:`local`,patch:{},clear:e},{headers:t})}var ls=class extends Error{status;body;constructor(e,t){let n=ds(t);super(n?`${n} (API ${e})`:`API error ${e}`),this.status=e,this.body=t}};function us(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 ds(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 fs(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 ps=(0,W.createContext)(null);function ms({selection:e,children:t}){let n=We(),r=Po(e),[i,a]=(0,W.useState)(null);return(0,W.useLayoutEffect)(()=>{Eo(e),Io(e),n.removeQueries({predicate:e=>e.queryKey[0]!==`groves`}),a(r)},[r,n]),i===r?(0,G.jsx)(ps.Provider,{value:e,children:t}):(0,G.jsx)(`div`,{className:`flex h-64 items-center justify-center text-sm text-on-surface-variant`,children:`Switching project...`})}function hs({children:e}){return(0,W.useLayoutEffect)(()=>{Eo(null)},[]),(0,G.jsx)(G.Fragment,{children:e})}function gs(){return(0,W.useContext)(ps)}function _s(){let e=(0,W.useContext)(ps),t=fs();if(e)return e;let n=t.data?.groves??[];return Lo(n)??jo(n)}function vs(e=``){let t=gs();return t?Mo(t,e):e||`/`}function ys(){let e=gs();return(0,W.useCallback)((t=``)=>e?Mo(e,t):t||`/`,[e])}function bs(e,t){if(!e)return t;let[n,...r]=t;return[n,{projectSelection:Po(e)},...r]}function xs(e){return bs(gs(),e)}var Ss=6e4,Cs=3e4;function ws(e,t,n){if(t===`heartbeat`){let t=e*Ei[n];return n===`hidden`?Math.min(t,Ss):n===`deep_sleep`?Math.min(t,Cs):t}return n===`deep_sleep`||n===`hidden`?!1:e*Ei[n]}function Ts(e){let t=Ai(),{pollCategory:n,refetchInterval:r,contextFree:i=!1,...a}=e,o=xs(a.queryKey??[]),s=e=>e===!1||e===void 0?e:ws(e,n,t),c=typeof r==`function`?e=>s(r(e)):s(r);return ot({...a,queryKey:i?a.queryKey:o,refetchInterval:c})}var Es={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},Ds=1e4,Os=3e4,ks=[`debug`,`info`,`warn`,`error`],As={debug:0,info:1,warn:2,error:3},js=[`stable`,`beta`],Ms=1e3;function Ns(e){switch(e){case`info`:return`default`;case`warn`:return`warning`;case`error`:return`destructive`;default:return`secondary`}}function Ps(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 Fs(){return Ts({queryKey:[`daemon-stats`],queryFn:({signal:e})=>q(`/stats`,{signal:e}),refetchInterval:Es.STATS,pollCategory:`standard`})}var Is=500,Ls=3e4;function Rs(){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 ts(`/restart`,{force:e});if(r.status===`busy`)return t(!1),r;let i=Date.now()+Ls;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(Vo(`/health`),{signal:n.current.signal})).ok){e();return}setTimeout(r,Is)}catch{setTimeout(r,Is)}};setTimeout(r,Is)}),window.location.reload()}catch(e){throw t(!1),e}},[]),isRestarting:e}}function zs(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=zs(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Bs(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=zs(e))&&(r&&(r+=` `),r+=t);return r}var Vs=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Hs=Bs,Us=(e,t)=>n=>{if(t?.variants==null)return Hs(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=Vs(t)||Vs(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 Hs(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)},Ws=(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},Gs=(e,t)=>({classGroupId:e,validator:t}),Ks=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),qs=`-`,Js=[],Ys=`arbitrary..`,Xs=e=>{let t=$s(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Qs(e);let n=e.split(qs);return Zs(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ws(i,t):t:i||Js}return n[e]||Js}}},Zs=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Zs(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}},Qs=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?Ys+r:void 0})(),$s=e=>{let{theme:t,classGroups:n}=e;return ec(n,t)},ec=(e,t)=>{let n=Ks();for(let r in e){let i=e[r];tc(i,n,r,t)}return n},tc=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];nc(i,t,n,r)}},nc=(e,t,n,r)=>{if(typeof e==`string`){rc(e,t,n);return}if(typeof e==`function`){ic(e,t,n,r);return}ac(e,t,n,r)},rc=(e,t,n)=>{let r=e===``?t:oc(t,e);r.classGroupId=n},ic=(e,t,n,r)=>{if(sc(e)){tc(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Gs(n,e))},ac=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];tc(o,oc(t,a),n,r)}},oc=(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=Ks(),n.nextPart.set(t,i)),n=i}return n},sc=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,cc=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)}}},lc=`!`,uc=`:`,dc=[],fc=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),pc=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===uc){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(lc)?(c=s.slice(0,-1),l=!0):s.startsWith(lc)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return fc(t,l,c,u)};if(t){let e=t+uc,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):fc(dc,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},mc=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}},hc=e=>({cache:cc(e.cacheSize),parseClassName:pc(e),sortModifiers:mc(e),postfixLookupClassGroupIds:gc(e),...Xs(e)}),gc=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},_c=/\s+/,vc=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(_c),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?_+lc:_,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},yc=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=bc(n))&&(i&&(i+=` `),i+=r);return i},bc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=bc(e[r]))&&(n&&(n+=` `),n+=t);return n},xc=(e,...t)=>{let n,r,i,a,o=o=>(n=hc(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=vc(e,n);return i(e,a),a};return a=o,(...e)=>a(yc(...e))},Sc=[],Cc=e=>{let t=t=>t[e]||Sc;return t.isThemeGetter=!0,t},wc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Tc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ec=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Dc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Oc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,kc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ac=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mc=e=>Ec.test(e),Nc=e=>!!e&&!Number.isNaN(Number(e)),Pc=e=>!!e&&Number.isInteger(Number(e)),Fc=e=>e.endsWith(`%`)&&Nc(e.slice(0,-1)),Ic=e=>Dc.test(e),Lc=()=>!0,Rc=e=>Oc.test(e)&&!kc.test(e),zc=()=>!1,Bc=e=>Ac.test(e),Vc=e=>jc.test(e),Hc=e=>!Gc(e)&&!$c(e),Uc=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)),Wc=e=>sl(e,dl,zc),Gc=e=>wc.test(e),Kc=e=>sl(e,fl,Rc),qc=e=>sl(e,pl,Nc),Jc=e=>sl(e,hl,Lc),Yc=e=>sl(e,ml,zc),Xc=e=>sl(e,ll,zc),Zc=e=>sl(e,ul,Vc),Qc=e=>sl(e,gl,Bc),$c=e=>Tc.test(e),el=e=>cl(e,fl),tl=e=>cl(e,ml),nl=e=>cl(e,ll),rl=e=>cl(e,dl),il=e=>cl(e,ul),al=e=>cl(e,gl,!0),ol=e=>cl(e,hl,!0),sl=(e,t,n)=>{let r=wc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},cl=(e,t,n=!1)=>{let r=Tc.exec(e);return r?r[1]?t(r[1]):n:!1},ll=e=>e===`position`||e===`percentage`,ul=e=>e===`image`||e===`url`,dl=e=>e===`length`||e===`size`||e===`bg-size`,fl=e=>e===`length`,pl=e=>e===`number`,ml=e=>e===`family-name`,hl=e=>e===`number`||e===`weight`,gl=e=>e===`shadow`,_l=xc(()=>{let e=Cc(`color`),t=Cc(`font`),n=Cc(`text`),r=Cc(`font-weight`),i=Cc(`tracking`),a=Cc(`leading`),o=Cc(`breakpoint`),s=Cc(`container`),c=Cc(`spacing`),l=Cc(`radius`),u=Cc(`shadow`),d=Cc(`inset-shadow`),f=Cc(`text-shadow`),p=Cc(`drop-shadow`),m=Cc(`blur`),h=Cc(`perspective`),g=Cc(`aspect`),_=Cc(`ease`),v=Cc(`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(),$c,Gc],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$c,Gc,c],T=()=>[Mc,`full`,`auto`,...w()],E=()=>[Pc,`none`,`subgrid`,$c,Gc],D=()=>[`auto`,{span:[`full`,Pc,$c,Gc]},Pc,$c,Gc],O=()=>[Pc,`auto`,$c,Gc],k=()=>[`auto`,`min`,`max`,`fr`,$c,Gc],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=()=>[Mc,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Mc,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Mc,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,$c,Gc],L=()=>[...b(),nl,Xc,{position:[$c,Gc]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,rl,Wc,{size:[$c,Gc]}],z=()=>[Fc,el,Kc],B=()=>[``,`none`,`full`,l,$c,Gc],V=()=>[``,Nc,el,Kc],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=()=>[Nc,Fc,nl,Xc],U=()=>[``,`none`,m,$c,Gc],re=()=>[`none`,Nc,$c,Gc],ie=()=>[`none`,Nc,$c,Gc],ae=()=>[Nc,$c,Gc],oe=()=>[Mc,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Ic],breakpoint:[Ic],color:[Lc],container:[Ic],"drop-shadow":[Ic],ease:[`in`,`out`,`in-out`],font:[Hc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Ic],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Ic],shadow:[Ic],spacing:[`px`,Nc],text:[Ic],"text-shadow":[Ic],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Mc,Gc,$c,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,$c,Gc]}],"container-named":[Uc],columns:[{columns:[Nc,Gc,$c,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:[Pc,`auto`,$c,Gc]}],basis:[{basis:[Mc,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Nc,Mc,`auto`,`initial`,`none`,Gc]}],grow:[{grow:[``,Nc,$c,Gc]}],shrink:[{shrink:[``,Nc,$c,Gc]}],order:[{order:[Pc,`first`,`last`,`none`,$c,Gc]}],"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,el,Kc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,ol,Jc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Fc,Gc]}],"font-family":[{font:[tl,Yc,t]}],"font-features":[{"font-features":[Gc]}],"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,$c,Gc]}],"line-clamp":[{"line-clamp":[Nc,`none`,$c,qc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$c,Gc]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$c,Gc]}],"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:[Nc,`from-font`,`auto`,$c,Kc]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Nc,`auto`,$c,Gc]}],"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:[Pc,$c,Gc]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$c,Gc]}],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`,$c,Gc]}],"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`]},Pc,$c,Gc],radial:[``,$c,Gc],conic:[Pc,$c,Gc]},il,Zc]}],"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":[Nc,$c,Gc]}],"outline-w":[{outline:[``,Nc,el,Kc]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,al,Qc]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,al,Qc]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Nc,Kc]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,al,Qc]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Nc,$c,Gc]}],"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":[Nc]}],"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":[$c,Gc]}],"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":[Nc]}],"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`,$c,Gc]}],filter:[{filter:[``,`none`,$c,Gc]}],blur:[{blur:U()}],brightness:[{brightness:[Nc,$c,Gc]}],contrast:[{contrast:[Nc,$c,Gc]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,al,Qc]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Nc,$c,Gc]}],"hue-rotate":[{"hue-rotate":[Nc,$c,Gc]}],invert:[{invert:[``,Nc,$c,Gc]}],saturate:[{saturate:[Nc,$c,Gc]}],sepia:[{sepia:[``,Nc,$c,Gc]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$c,Gc]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[Nc,$c,Gc]}],"backdrop-contrast":[{"backdrop-contrast":[Nc,$c,Gc]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Nc,$c,Gc]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Nc,$c,Gc]}],"backdrop-invert":[{"backdrop-invert":[``,Nc,$c,Gc]}],"backdrop-opacity":[{"backdrop-opacity":[Nc,$c,Gc]}],"backdrop-saturate":[{"backdrop-saturate":[Nc,$c,Gc]}],"backdrop-sepia":[{"backdrop-sepia":[``,Nc,$c,Gc]}],"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`,$c,Gc]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Nc,`initial`,$c,Gc]}],ease:[{ease:[`linear`,`initial`,_,$c,Gc]}],delay:[{delay:[Nc,$c,Gc]}],animate:[{animate:[`none`,v,$c,Gc]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$c,Gc]}],"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:[$c,Gc,``,`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:[Pc,$c,Gc]}],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`,$c,Gc]}],"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`,$c,Gc]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Nc,el,Kc,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 _l(Bs(e))}var vl=Us(`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(vl({variant:t,size:n,className:e})),ref:i,...r}));Y.displayName=`Button`,typeof window<`u`&&window.document&&window.document.createElement;function yl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function bl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function xl(...e){return t=>{let n=!1,r=e.map(e=>{let r=bl(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():bl(e[t],null)}}}}function Sl(...e){return W.useCallback(xl(...e),e)}function Cl(e,t){let n=W.createContext(t),r=e=>{let{children:t,...r}=e,i=W.useMemo(()=>r,Object.values(r));return(0,G.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=W.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function wl(e,t=[]){let n=[];function r(t,r){let i=W.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=W.useMemo(()=>o,Object.values(o));return(0,G.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=W.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>W.createContext(e));return function(n){let r=n?.[e]||t;return W.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Tl(i,...t)]}function Tl(...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 El=globalThis?.document?W.useLayoutEffect:()=>{},Dl=W.useId||(()=>void 0),Ol=0;function kl(e){let[t,n]=W.useState(Dl());return El(()=>{e||n(e=>e??String(Ol++))},[e]),e||(t?`radix-${t}`:``)}var Al=W.useInsertionEffect||El;function jl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Ml({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=Nl(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Ml({defaultProp:e,onChange:t}){let[n,r]=W.useState(e),i=W.useRef(n),a=W.useRef(t);return Al(()=>{a.current=t},[t]),W.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Nl(e){return typeof e==`function`}var Pl=l(h(),1);function Fl(e){let t=Il(e),n=W.forwardRef((e,n)=>{let{children:r,...i}=e,a=W.Children.toArray(r),o=a.find(Rl);if(o){let e=o.props.children,r=a.map(t=>t===o?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return(0,G.jsx)(t,{...i,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return(0,G.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Il(e){let t=W.forwardRef((e,t)=>{let{children:n,...r}=e;if(W.isValidElement(n)){let e=Bl(n),i=zl(r,n.props);return n.type!==W.Fragment&&(i.ref=t?xl(t,e):e),W.cloneElement(n,i)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ll=Symbol(`radix.slottable`);function Rl(e){return W.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ll}function zl(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 Bl(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 Vl=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Fl(`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 Hl(e,t){e&&Pl.flushSync(()=>e.dispatchEvent(t))}function Ul(e){let t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...e)=>t.current?.(...e),[])}function Wl(e,t=globalThis?.document){let n=Ul(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 Gl=`DismissableLayer`,Kl=`dismissableLayer.update`,ql=`dismissableLayer.pointerDownOutside`,Jl=`dismissableLayer.focusOutside`,Yl,Xl=W.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zl=W.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=W.useContext(Xl),[u,d]=W.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=W.useState({}),m=Sl(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=eu(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=tu(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Wl(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&&(Yl=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),nu(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Yl)}},[u,f,n,l]),W.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),nu())},[u,l]),W.useEffect(()=>{let e=()=>p({});return document.addEventListener(Kl,e),()=>document.removeEventListener(Kl,e)},[]),(0,G.jsx)(Vl.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:yl(e.onFocusCapture,S.onFocusCapture),onBlurCapture:yl(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:yl(e.onPointerDownCapture,x.onPointerDownCapture)})});Zl.displayName=Gl;var Ql=`DismissableLayerBranch`,$l=W.forwardRef((e,t)=>{let n=W.useContext(Xl),r=W.useRef(null),i=Sl(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)(Vl.div,{...e,ref:i})});$l.displayName=Ql;function eu(e,t=globalThis?.document){let n=Ul(e),r=W.useRef(!1),i=W.useRef(()=>{});return W.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){ru(ql,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 tu(e,t=globalThis?.document){let n=Ul(e),r=W.useRef(!1);return W.useEffect(()=>{let e=e=>{e.target&&!r.current&&ru(Jl,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 nu(){let e=new CustomEvent(Kl);document.dispatchEvent(e)}function ru(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?Hl(i,a):i.dispatchEvent(a)}var iu=`focusScope.autoFocusOnMount`,au=`focusScope.autoFocusOnUnmount`,ou={bubbles:!1,cancelable:!0},su=`FocusScope`,cu=W.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=W.useState(null),l=Ul(i),u=Ul(a),d=W.useRef(null),f=Sl(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:hu(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||hu(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&hu(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){gu.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(iu,ou);s.addEventListener(iu,l),s.dispatchEvent(t),t.defaultPrevented||(lu(yu(du(s)),{select:!0}),document.activeElement===e&&hu(s))}return()=>{s.removeEventListener(iu,l),setTimeout(()=>{let t=new CustomEvent(au,ou);s.addEventListener(au,u),s.dispatchEvent(t),t.defaultPrevented||hu(e??document.body,{select:!0}),s.removeEventListener(au,u),gu.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]=uu(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&hu(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&hu(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,G.jsx)(Vl.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});cu.displayName=su;function lu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(hu(r,{select:t}),document.activeElement!==n)return}function uu(e){let t=du(e);return[fu(t,e),fu(t.reverse(),e)]}function du(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function fu(e,t){for(let n of e)if(!pu(n,{upTo:t}))return n}function pu(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 mu(e){return e instanceof HTMLInputElement&&`select`in e}function hu(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mu(e)&&t&&e.select()}}var gu=_u();function _u(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=vu(e,t),e.unshift(t)},remove(t){e=vu(e,t),e[0]?.resume()}}}function vu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yu(e){return e.filter(e=>e.tagName!==`A`)}var bu=`Portal`,xu=W.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=W.useState(!1);El(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Pl.createPortal((0,G.jsx)(Vl.div,{...r,ref:t}),o):null});xu.displayName=bu;function Su(e,t){return W.useReducer((e,n)=>t[e][n]??e,e)}var Cu=e=>{let{present:t,children:n}=e,r=wu(t),i=typeof n==`function`?n({present:r.isPresent}):W.Children.only(n),a=Sl(r.ref,Eu(i));return typeof n==`function`||r.isPresent?W.cloneElement(i,{ref:a}):null};Cu.displayName=`Presence`;function wu(e){let[t,n]=W.useState(),r=W.useRef(null),i=W.useRef(e),a=W.useRef(`none`),[o,s]=Su(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return W.useEffect(()=>{let e=Tu(r.current);a.current=o===`mounted`?e:`none`},[o]),El(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Tu(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),El(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Tu(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=Tu(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 Tu(e){return e?.animationName||`none`}function Eu(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 Du=0;function Ou(){W.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??ku()),document.body.insertAdjacentElement(`beforeend`,e[1]??ku()),Du++,()=>{Du===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Du--}},[])}function ku(){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 Au=function(){return Au=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},Au.apply(this,arguments)};function ju(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 Mu(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 Nu=`right-scroll-bar-position`,Pu=`width-before-scroll-bar`,Fu=`with-scroll-bars-hidden`,Iu=`--removed-body-scroll-bar-size`;function Lu(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ru(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 zu=typeof window<`u`?W.useLayoutEffect:W.useEffect,Bu=new WeakMap;function Vu(e,t){var n=Ru(t||null,function(t){return e.forEach(function(e){return Lu(e,t)})});return zu(function(){var t=Bu.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Lu(e,null)}),i.forEach(function(e){r.has(e)||Lu(e,a)})}Bu.set(n,e)},[e]),n}function Hu(e){return e}function Uu(e,t){t===void 0&&(t=Hu);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 Wu(e){e===void 0&&(e={});var t=Uu(null);return t.options=Au({async:!0,ssr:!1},e),t}var Gu=function(e){var t=e.sideCar,n=ju(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,Au({},n))};Gu.isSideCarExport=!0;function Ku(e,t){return e.useMedium(t),Gu}var qu=Wu(),Ju=function(){},Yu=W.forwardRef(function(e,t){var n=W.useRef(null),r=W.useState({onScrollCapture:Ju,onWheelCapture:Ju,onTouchMoveCapture:Ju}),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=ju(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Vu([n,t]),C=Au(Au({},b),i);return W.createElement(W.Fragment,null,u&&W.createElement(x,{sideCar:qu,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),Au(Au({},C),{ref:S})):W.createElement(v,Au({},C,{className:c,ref:S}),s))});Yu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Yu.classNames={fullWidth:Pu,zeroRight:Nu};var Xu,Zu=function(){if(Xu)return Xu;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Qu(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Zu();return t&&e.setAttribute(`nonce`,t),e}function $u(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ed(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var td=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Qu())&&($u(t,n),ed(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nd=function(){var e=td();return function(t,n){W.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},rd=function(){var e=nd();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},id={left:0,top:0,right:0,gap:0},ad=function(e){return parseInt(e||``,10)||0},od=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[ad(n),ad(r),ad(i)]},sd=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return id;var t=od(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])}},cd=rd(),ld=`data-scroll-locked`,ud=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
  .${Fu} {
13
13
  overflow: hidden ${r};
14
14
  padding-right: ${s}px ${r};
@@ -80,8 +80,8 @@ 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=vE(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}wE.peek=TE;function wE(e){return e.value||``}function TE(){return`<`}EE.peek=DE;function EE(e,t,n,r){let i=hE(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 DE(){return`!`}OE.peek=kE;function OE(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`!`}AE.peek=jE;function AE(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 ME(e,t){let n=ab(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))}NE.peek=PE;function NE(e,t,n,r){let i=hE(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(ME(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 PE(e,t,n){return ME(e,n)?`<`:`[`}FE.peek=IE;function FE(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 IE(){return`[`}function LE(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 RE(e){let t=LE(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 zE(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function BE(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 VE(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?zE(n):LE(n),s=e.ordered?o===`.`?`)`:`.`:RE(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),BE(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 HE(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 UE(e,t,n,r){let i=HE(n),a=n.bulletCurrent||LE(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 WE(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var GE=QC([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function KE(e,t,n,r){return(e.children.some(function(e){return GE(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function qE(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}JE.peek=YE;function JE(e,t,n,r){let i=qE(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=yE(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=vE(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=yE(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+vE(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function YE(e,t,n){return n.options.strong||`*`}function XE(e,t,n,r){return n.safe(e.value,r)}function ZE(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 QE(e,t,n){let r=(BE(n)+(n.options.ruleSpaces?` `:``)).repeat(ZE(n));return n.options.ruleSpaces?r.slice(0,-1):r}var $E={blockquote:aE,break:lE,code:pE,definition:gE,emphasis:bE,hardBreak:lE,heading:CE,html:wE,image:EE,imageReference:OE,inlineCode:AE,link:NE,linkReference:FE,list:VE,listItem:UE,paragraph:WE,root:KE,strong:JE,text:XE,thematicBreak:QE};function eD(){return{enter:{table:tD,tableData:aD,tableHeader:aD,tableRow:rD},exit:{codeText:oD,table:nD,tableData:iD,tableHeader:iD,tableRow:iD}}}function tD(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 nD(e){this.exit(e),this.data.inTable=void 0}function rD(e){this.enter({type:`tableRow`,children:[]},e)}function iD(e){this.exit(e)}function aD(e){this.enter({type:`tableCell`,children:[]},e)}function oD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,sD));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function sD(e,t){return t===`|`?t:e}function cD(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 nE(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=$E.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function lD(){return{exit:{taskListCheckValueChecked:dD,taskListCheckValueUnchecked:dD,paragraph:fD}}}function uD(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:pD}}}function dD(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function fD(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 pD(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=$E.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 mD(){return[bT(),WT(),YT(),eD(),lD()]}function hD(e){return{extensions:[xT(),GT(e),XT(),cD(e),uD()]}}var gD={tokenize:AD,partial:!0},_D={tokenize:jD,partial:!0},vD={tokenize:MD,partial:!0},yD={tokenize:ND,partial:!0},bD={tokenize:PD,partial:!0},xD={name:`wwwAutolink`,tokenize:OD,previous:FD},SD={name:`protocolAutolink`,tokenize:kD,previous:ID},CD={name:`emailAutolink`,tokenize:DD,previous:LD},wD={};function TD(){return{text:wD}}for(var ED=48;ED<123;)wD[ED]=CD,ED++,ED===58?ED=65:ED===91&&(ED=97);wD[43]=CD,wD[45]=CD,wD[46]=CD,wD[95]=CD,wD[72]=[CD,SD],wD[104]=[CD,SD],wD[87]=[CD,xD],wD[119]=[CD,xD];function DD(e,t,n){let r=this,i,a;return o;function o(t){return!RD(t)||!LD.call(r,r.previous)||zD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return RD(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(bD,u,l)(t):t===45||t===95||bb(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&&yb(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function OD(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!FD.call(r,r.previous)||zD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(gD,e.attempt(_D,e.attempt(vD,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)&&ID.call(r,r.previous)&&!zD(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(yb(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||Sb(t)||Db(t)||Ab(t)||kb(t)?n(t):e.attempt(_D,e.attempt(vD,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function AD(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(yD,c,s)(t):t===null||Db(t)||Ab(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 MD(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(yD,t,a)(o):o===null||Db(o)||Ab(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function ND(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||Db(o)||Ab(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Db(e)||Ab(e)?t(e):r(e)}function a(e){return yb(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):yb(t)?(e.consume(t),o):n(t)}}function PD(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return bb(e)?n(e):t(e)}}function FD(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Db(e)}function ID(e){return!yb(e)}function LD(e){return!(e===47||RD(e))}function RD(e){return e===43||e===45||e===46||e===95||bb(e)}function zD(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 BD={tokenize:JD,partial:!0};function VD(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:GD,continuation:{tokenize:KD},exit:qD}},text:{91:{name:`gfmFootnoteCall`,tokenize:WD},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:HD,resolveTo:UD}}}}function HD(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=vb(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 UD(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 WD(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||Db(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(vb(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Db(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 GD(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||Db(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=vb(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Db(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),Nb(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function KD(e,t,n){return e.check(Jb,t,e.attempt(BD,t,n))}function qD(e){e.exit(`gfmFootnoteDefinition`)}function JD(e,t,n){let r=this;return Nb(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 YD(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&&db(o,o.length,0,Vb(s,e.slice(r+1,n),t)),db(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),db(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=Bb(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=Bb(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var XD=class{constructor(){this.map=[]}add(e,t,n){ZD(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 ZD(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 QD(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 $D(){return{flow:{null:{name:`table`,tokenize:eO,resolveAll:tO}}}}function eO(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):Eb(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Ob(t)?Nb(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||Db(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,Ob(t)?Nb(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 Ob(t)?Nb(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||Eb(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 Ob(t)?Nb(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Eb(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||Eb(n)?(e.exit(`tableRow`),t(n)):Ob(n)?Nb(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Db(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 tO(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 XD;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(rO(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=nO(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=nO(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=nO(f,t,o,i,n,d)):(o[0]=o[1],d=nO(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&rO(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=QD(t.events,n))}return e}function nO(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},iO(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=iO(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=iO(t.events,n[2]),a=iO(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({},iO(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function rO(e,t,n,r,i){let a=[],o=iO(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 iO(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var aO={name:`tasklistCheck`,tokenize:sO};function oO(){return{text:{91:aO}}}function sO(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 Db(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 Eb(r)?t(r):Ob(r)?e.check({tokenize:cO},t,n)(r):n(r)}}function cO(e,t,n){return Nb(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function lO(e){return mb([TD(),VD(),YD(e),$D(),oO()])}var uO={};function dO(e){let t=this,n=e||uO,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(lO(n)),a.push(mD()),o.push(hD(n))}function fO({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)(sT,{remarkPlugins:[dO],children:e})})}var pO={info:`bg-primary`,success:`bg-green-500`,warning:`bg-secondary`,error:`bg-tertiary`},mO={info:Ma,success:oa,warning:_o,error:ra},hO={unread:`New`,read:`Earlier`},gO=`notification-panel`;function _O(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 vO({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 yO({notification:e,onOpen:t,onDismiss:n}){let r=mO[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`,pO[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)(fO,{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:_O(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 bO({open:e,onClose:t}){let{data:n,refetch:r}=mv({limit:50,enabled:e,pollCategory:`realtime`,refetchInterval:Es.LOGS}),i=gv(),a=vv(),o=_v(),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:gO,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)(vO,{title:hO.unread,count:f.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:f.map(e=>(0,G.jsx)(yO,{notification:e,onOpen:c,onDismiss:l},e.id))})]}),p.length>0&&(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(vO,{title:hO.read,count:p.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:p.map(e=>(0,G.jsx)(yO,{notification:e,onOpen:c,onDismiss:l},e.id))})]})]})})]})]})}function xO(e){return Array.isArray(e)?e:e?e.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(e=>e.length>0):[]}function SO(e,t){let n=xO(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 CO(e,t,n){let r=xO(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 wO=[`grove-config`];function TO(e){return[...wO,e??`none`]}function EO(){let e=_s(),t=e?.grove.id??null,n=ko(e);return ot({queryKey:TO(t),queryFn:({signal:e})=>q(`/grove-config`,{signal:e,headers:n}),enabled:t!==null})}function DO(){let e=We(),t=_s(),n=t?.grove.id??null,r=ko(t);return st({mutationFn:e=>ns(`/grove-config`,{patch:e},{headers:r}),onSuccess:()=>{e.invalidateQueries({queryKey:TO(n)}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}var OO=[`machine-config`];function kO(){return Ts({queryKey:[...OO],queryFn:({signal:e})=>q(`/machine-config`,{signal:e}),refetchInterval:!1,pollCategory:`standard`,contextFree:!0})}function AO(){let e=We();return st({mutationFn:e=>ns(`/machine-config`,{patch:e}),onSuccess:t=>{e.setQueryData([...OO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}function jO(){let e=We();return st({mutationFn:({path:e,value:t})=>ns(`/machine-config`,{addToList:[{path:e,values:[t]}]}),onSuccess:t=>{e.setQueryData([...OO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}function MO(){let e=We();return st({mutationFn:({path:e,value:t})=>ns(`/machine-config`,{removeFromList:[{path:e,values:[t]}]}),onSuccess:t=>{e.setQueryData([...OO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}var NO=[`config`,`merged`],PO=[`config`,`local`],FO=[`notifications`];function IO(e){let t=We(),n=DO(),r=AO(),i=e?Po(e):`none`,a=(0,W.useMemo)(()=>ko(e),[e?.grove.id,e?.project.project_id]),o=ot({queryKey:[...NO,i],queryFn:({signal:e})=>as(e,a)}),s=ot({queryKey:[...PO,i],queryFn:({signal:e})=>os(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:FO})},[t]),d=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:PO}),t.invalidateQueries({queryKey:NO}),u()},[u,t]),f=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:NO}),u()},[u,t]),p=(0,W.useCallback)(e=>e===`local`?d():f(),[d,f]),m=(0,W.useCallback)(async(e,t,i)=>{let o={};CO(o,e,t),i===`grove`?(await n.mutateAsync(o),u()):i===`machine`?(await r.mutateAsync(o),u()):(await ss(i,o,void 0,a),p(i))},[a,p,u,n,r]),h=(0,W.useCallback)(async(e,t,i)=>{let o={};for(let{path:t,value:n}of e)CO(o,t,n);t===`grove`?(await n.mutateAsync(o),u()):t===`machine`?(await r.mutateAsync(o),u()):(await ss(t,o,i,a),p(t))},[a,p,u,n,r]),g=(0,W.useCallback)(async e=>{await cs([e],a),d()},[a,d]),_=(0,W.useCallback)(async e=>{e.length!==0&&(await cs(e,a),d())},[a,d]),v=(0,W.useCallback)(async e=>{let t=SO(c.current??{},e),n={};CO(n,e,t),await ss(`project`,n,void 0,a),await cs([e],a),d()},[a,d]),y=(0,W.useCallback)(e=>SO(l.current??{},e)!==void 0,[]),b=(0,W.useCallback)(async(e,n,r)=>{if(r===`machine`){let r=await ns(`/machine-config`,{addToList:[{path:e,values:[n]}]});t.setQueryData([`machine-config`],{config:r}),t.invalidateQueries({queryKey:[`config`,`merged`]});return}let i=SO(c.current??{},e),a=Array.isArray(i)?i:[];a.includes(n)||await m(e,[...a,n],r)},[t,m]),x=(0,W.useCallback)(async(e,n,r)=>{if(r===`machine`){let r=await ns(`/machine-config`,{removeFromList:[{path:e,values:[n]}]});t.setQueryData([`machine-config`],{config:r}),t.invalidateQueries({queryKey:[`config`,`merged`]});return}let i=SO(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:y,setField:m,setFields:h,resetField:g,resetFields:_,promoteField:v,addToConfigList:b,removeFromConfigList:x}}function LO(){return IO(_s())}function RO(){let{effective:e}=LO(),t=e?.notifications?.system_notifications??!1,{data:n,refetch:r}=mv({status:`unread`,mode:`banner`,limit:5,enabled:t,pollCategory:`heartbeat`,refetchInterval:Es.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),zO(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 zO(e){try{new window.Notification(e.title,{body:e.message??void 0,tag:e.id,icon:`/favicon.svg`})}catch{}}var BO=[`sage`,`moss`,`terracotta`,`dusk`,`plum`,`slate`],VO=[`light`,`dark`,`system`],HO=[`default`,`geist-mono`,`system`,`sf-mono`,`fira-code`,`jetbrains-mono`],UO=[`compact`,`normal`,`comfy`],WO=`myco-appearance`,GO={compact:.85,normal:1,comfy:1.15},KO={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`}},qO=`(prefers-color-scheme: light)`;function JO(e){let t=document.documentElement;t.setAttribute(`data-theme`,e.theme);let n=e.mode===`system`?window.matchMedia(qO).matches?`light`:`dark`:e.mode;t.classList.toggle(`light`,n===`light`);let r=KO[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=GO[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 YO(e){try{localStorage.setItem(WO,JSON.stringify(e))}catch{}}function XO(){let e=null;try{e=localStorage.getItem(WO)}catch{return}if(e)try{JO(JSON.parse(e))}catch{try{localStorage.removeItem(WO)}catch{}}}var ZO=(0,W.createContext)(null),QO={theme:`sage`,mode:`dark`,font:`default`,density:`normal`},$O=`(prefers-color-scheme: light)`;function ek({children:e}){let{effective:t,setField:n}=LO(),r=(0,W.useMemo)(()=>t?.appearance??QO,[t?.appearance]),i=(0,W.useRef)(r);i.current=r,(0,W.useLayoutEffect)(()=>{t?.appearance&&(JO(r),YO(r))},[r,t?.appearance]),(0,W.useEffect)(()=>{if(r.mode!==`system`)return;let e=window.matchMedia($O),t=()=>JO(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};JO(a),YO(a);try{await n(`appearance.${e}`,t,`grove`)}catch(e){throw JO(r),YO(r),e}},[n]),o=(0,W.useMemo)(()=>({effective:r,set:a}),[r,a]);return(0,G.jsx)(ZO.Provider,{value:o,children:e})}function tk(){let e=(0,W.useContext)(ZO);if(!e)throw Error(`useAppearance must be used inside AppearanceProvider`);return e}var nk=[`cortex`,`canopy`,`skills`,`vault_evolution`],rk={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:[]},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:[]}},ik=Object.keys(rk).sort((e,t)=>t.length-e.length);function ak(e){for(let t of ik)if(e===t||e.startsWith(`${t}.`))return rk[t];throw Error(`No scope registry entry for config path: ${e}`)}var ok={machine:`Machine`,grove:`Grove`,project:`Project`,local:`Personal`},sk={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)`},ck={personal:`Personal`,project:`Project`,grove:`Grove`,"all-groves":`All Groves`,machine:`Machine`},lk={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`},uk={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 dk({scope:e}){let t=ck[e];return(0,G.jsxs)(`span`,{title:lk[e],className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${uk[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 fk={machine:`machine`,grove:`grove`,project:`project`,local:`personal`};function pk({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=ak(e),c=fk[s.home]??`project`,l=t?`personal`:c,u=t?lk.personal:sk[s.home]??lk[c],d=ok[s.home]??ck[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)(dk,{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 mk={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`}},hk={light:{icon:fo,label:`Light`},dark:{icon:Wa,label:`Dark`},system:{icon:Ua,label:`System`}},gk={default:`Default`,"geist-mono":`Geist`,system:`System`,"sf-mono":`SF Mono`,"fira-code":`Fira Code`,"jetbrains-mono":`JetBrains`},_k=`myco-ui-appearance-expanded`;function vk(){let e=typeof window<`u`?localStorage.getItem(_k):null;return e===null?!0:e===`true`}function yk({collapsed:e}){let{effective:t,set:n}=tk(),[r,i]=(0,W.useState)(vk);(0,W.useEffect)(()=>{localStorage.setItem(_k,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)(dk,{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:BO.map(e=>{let n=mk[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:VO.map(e=>{let{icon:n,label:r}=hk[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:HO.map(e=>(0,G.jsx)(`option`,{value:e,children:gk[e]},e))})),o(`Density`,`density`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-3 gap-1.5`,children:UO.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 bk(){return Ts({queryKey:[`git-identity`],queryFn:({signal:e})=>q(`/git/status`,{signal:e}),refetchInterval:Es.GIT_IDENTITY,pollCategory:`standard`})}function xk(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 Sk({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=xk(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 Ck={sage:`bg-primary`,ochre:`bg-secondary`,terracotta:`bg-tertiary`,outline:`bg-outline-variant`};function wk({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`,Ck[e],t&&`animate-pulse`,r),style:{width:n,height:n},"aria-hidden":!0})}var Tk=[`update-status`];function Ek(){return Ts({queryKey:[...Tk],queryFn:({signal:e})=>q(`/update/status`,{signal:e}),refetchInterval:Es.UPDATE,pollCategory:`standard`,contextFree:!0})}function Dk(){let e=We();return st({mutationFn:()=>ts(`/update/check`),onSuccess:()=>{e.invalidateQueries({queryKey:[...Tk]})}})}function Ok(){return st({mutationFn:()=>ts(`/update/apply`)})}function kk(){let e=We();return st({mutationFn:e=>ns(`/update/channel`,{channel:e}),onSuccess:()=>{e.invalidateQueries({queryKey:[...Tk]})}})}function Ak(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 Mk({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)(wk,{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?`—`:Ak(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 Nk({to:e,className:t}){let{data:n}=Fs(),r=Ek(),i=!!(r.data&&!r.data.exempt&&(r.data.update_available||r.data.revert_available));return(0,G.jsx)(Mk,{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 Pk(e,t){return!t||t<=0?0:Math.floor(e/t*100)}function Fk({describedCount:e,entriesCount:t,to:n,className:r}){let i=e!==void 0&&t!==void 0,a=i?Pk(e,t):null,o=i&&a<100,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(wk,{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 Ik({to:e,className:t}){let{data:n}=Fs();return(0,G.jsx)(Fk,{describedCount:n?.canopy.described_count,entriesCount:n?.canopy.entries_count,to:e,className:t})}var Lk={"/":`Dashboard`,"/sessions":`Sessions`,"/cortex":`Cortex`,"/mycelium":`Mycelium`,"/skills":`Skills`,"/agent":`Agent`,"/settings":`Settings`,"/logs":`Logs`,"/machine":`Machine`,"/groves":`Groves`};function Rk(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[Lk[`/${r[0]}`]??r[0]]}function zk({onOpenSearch:e,onOpenNotifications:t,unreadCount:n,className:r}){let i=Rk(An().pathname),a=bk(),o=vs(`/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.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)(Nk,{to:`/settings?configSection=update#update`}),(0,G.jsx)(Ik,{to:o}),(0,G.jsx)(Sk,{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 Bk=[`Project`,`Observability`,`Grove management`,`Settings`],Vk=[{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`}],Hk=`myco-ui-sidebar-collapsed`,Uk=768,Wk=80,Gk=2e3,Kk=[`ring-2`,`ring-primary/40`,`bg-primary/5`];function qk(){let[e,t]=(0,W.useState)(()=>localStorage.getItem(Hk)===`true`);return{collapsed:e,toggle:(0,W.useCallback)(()=>{t(e=>{let t=!e;return localStorage.setItem(Hk,String(t)),t})},[])}}function Jk(){let[e,t]=(0,W.useState)(!1),[n,r]=(0,W.useState)(()=>typeof window<`u`&&window.innerWidth<Uk);return(0,W.useEffect)(()=>{let e=window.matchMedia(`(max-width: ${Uk-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 Yk({collapsed:e=!1}){let{restart:t,isRestarting:n}=Rs();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 Xk({collapsed:e}){let{data:t}=Fs(),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 Zk({collapsed:e,onSearchOpen:t,onNotificationsOpen:n,unreadCount:r,onCollapseToggle:i,showCollapseToggle:a}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(uv,{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:Bk.map(t=>{let n=Vk.filter(e=>e.category===t);return n.length===0?null:(0,G.jsx)(Qk,{label:t,collapsed:e,children:n.map(t=>(0,G.jsx)(eA,{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)(Xk,{collapsed:e}),!e&&(0,G.jsx)(yk,{collapsed:e}),(0,G.jsx)(Yk,{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 Qk({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 $k(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??Lo(r)?.grove??jo(r)?.grove??r[0];return i?e.to.replace(`:groveSlug`,i.slug):`/`}function eA({item:e,collapsed:t}){return(0,G.jsxs)(ii,{to:$k(e,gs(),vs(e.to),fs().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 tA(e){let t=gs();(0,W.useEffect)(()=>{let n=t?.project.name??e??null;document.title=n?`${t?`${Ro(t.project.name)} `:``}${n} - Myco`:`Myco`},[t,e])}function nA(){let{collapsed:e,toggle:t}=qk(),{data:n}=Fs(),r=gs()?.project.name??n?.context.project.name??n?.vault.name;tA(r);let[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),{data:c}=pv(),l=c?.count??0,u=Jk();(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=rA(t,n);e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),e.classList.add(...Kk),window.setTimeout(()=>{e.classList.remove(...Kk)},Gk))},Wk);return()=>window.clearTimeout(r)},[location.key,location.search]),(0,G.jsxs)(`div`,{className:`flex h-screen overflow-hidden bg-background`,children:[(0,G.jsx)(W_,{open:i,onOpenChange:a}),(0,G.jsx)(Ev,{panelOpen:o}),(0,G.jsx)(bO,{open:o,onClose:p}),(0,G.jsx)(RO,{}),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.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)(Zk,{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)(Zk,{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)(zk,{onOpenSearch:d,onOpenNotifications:f,unreadCount:l}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,G.jsx)(cr,{})})]})]})}function rA(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 iA=0,aA=[],oA=new Set;function sA(){for(let e of oA)e(aA)}function cA(e){let t=++iA,n={...e,id:t};aA=[...aA,n],sA();let r=e.ttlMs??5e3;r>0&&setTimeout(()=>{aA=aA.filter(e=>e.id!==t),sA()},r)}function lA(){let[e,t]=(0,W.useState)(aA);return(0,W.useEffect)(()=>(oA.add(t),()=>{oA.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 uA=Es.SESSIONS,dA=Es.SESSION_DETAIL,fA=Es.SESSION_DETAIL,pA=3e4,mA=6e4,hA=1e4,gA=Es.SESSION_DETAIL;function _A(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 Ts({queryKey:[`sessions`,e],queryFn:({signal:e})=>q(r,{signal:e}),pollCategory:`standard`,refetchInterval:uA})}function vA(e){return Ts({queryKey:[`session`,e],queryFn:({signal:t})=>q(`/sessions/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:dA})}function yA(e,t=[`human`]){let n=t===`all`?``:`?origins=${t.join(`,`)}`;return Ts({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:fA})}function bA(e){return ot({queryKey:xs([`batch-activities`,e]),queryFn:({signal:t})=>q(`/batches/${e}/activities`,{signal:t}),enabled:e!==void 0,staleTime:pA})}function xA(e){return ot({queryKey:xs([`session-attachments`,e]),queryFn:({signal:t})=>q(`/sessions/${e}/attachments`,{signal:t}),enabled:e!==void 0,staleTime:mA})}function SA(){let e=We();return st({mutationFn:e=>is(`/sessions/${e}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`sessions`]})}})}function CA(){let e=We();return st({mutationFn:e=>ts(`/sessions/${e}/complete`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`session`,n]}),e.invalidateQueries({queryKey:[`sessions`]})}})}function wA(e){return ot({queryKey:xs([`session-impact`,e]),queryFn:({signal:t})=>q(`/sessions/${e}/impact`,{signal:t}),enabled:e!==null,staleTime:hA})}function TA(e){return Ts({queryKey:[`session-plans`,e],queryFn:async({signal:t})=>(await q(`/sessions/${e}/plans`,{signal:t})).plans,enabled:!!e,pollCategory:`standard`,refetchInterval:gA})}function EA(e){let t=We();return st({mutationFn:e=>is(`/plans/${e}`),onSuccess:()=>{t.invalidateQueries({queryKey:[`session-plans`,e]})}})}var DA=Es.RUNS_ACTIVE,OA=Es.RUN_DETAIL,kA=Es.STATS,AA=new Set([`completed`,`failed`,`skipped`]),jA=Es.STATS,MA=6e4,NA=50;function PA(e){let t=e?.limit??NA,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 Ts({queryKey:[`agent-runs`,e],queryFn:({signal:e})=>q(`/agent/runs?${r}`,{signal:e}),pollCategory:`standard`,refetchInterval:DA})}function FA(e){return Ts({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&&AA.has(t)?!1:OA}})}function IA(e,t){let n=t?AA.has(t):!1;return Ts({queryKey:[`agent-reports`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/reports`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?!1:kA})}function LA(e,t){let n=t?AA.has(t):!1;return Ts({queryKey:[`agent-turns`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/turns`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?!1:jA})}function RA(){return ot({queryKey:xs([`agent-tasks`]),queryFn:({signal:e})=>q(`/agent/tasks`,{signal:e}),staleTime:MA})}function zA(e){return ot({queryKey:xs([`agent-task`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}`,{signal:t}),enabled:e!==void 0,staleTime:MA})}function BA(){let e=We();return st({mutationFn:({taskId:e,name:t})=>ts(`/agent/tasks/${e}/copy`,t?{name:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function VA(){let e=We();return st({mutationFn:e=>is(`/agent/tasks/${e}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function HA(e){return ot({queryKey:xs([`agent-task-yaml`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}/yaml`,{signal:t}),enabled:e!==void 0,staleTime:MA})}function UA(){let e=We();return st({mutationFn:({taskId:e,yaml:t})=>ns(`/agent/tasks/${e}`,{yaml:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]}),e.invalidateQueries({queryKey:[`agent-task`]}),e.invalidateQueries({queryKey:[`agent-task-yaml`]})}})}function WA(){let e=We();return st({mutationFn:e=>ts(`/agent/run`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-runs`]})}})}function GA(){let e=We();return st({mutationFn:({runId:e,mode:t})=>ts(`/agent/runs/${e}/resume`,t?{mode:t}:{}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`agent-runs`]}),e.invalidateQueries({queryKey:[`agent-run`,n.runId]})}})}function KA(e){return Ts({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 qA(e){return Ts({queryKey:[`agent-run-audit`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/audit`,{signal:t}),enabled:e!==null,pollCategory:`standard`,refetchInterval:!1})}function JA(e,t){let n=new URLSearchParams;n.set(`agentId`,e),n.set(`tier`,String(t));let r=n.toString();return Ts({queryKey:[`digest-revisions`,e,t],queryFn:({signal:e})=>q(`/digest/revisions?${r}`,{signal:e}),enabled:!!e&&Number.isFinite(t),pollCategory:`standard`,refetchInterval:!1})}function YA(){let e=We();return st({mutationFn:({revisionId:e,runId:t})=>ts(`/digest/revisions/${e}/restore`,t?{runId:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`digest-revisions`]})}})}function XA(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 ZA(e){let t=gs(),n=it({queries:e.map(e=>({queryKey:bs(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(XA(t))}return{runs:r,isLoading:a,errors:i,isError:i.length>0}}function QA(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:xs([`skill-candidates`,e]),queryFn:({signal:e})=>q(r,{signal:e})})}function $A(){let e=We();return st({mutationFn:({id:e,...t})=>ns(`/skill-candidates/${e}`,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-candidates`]})}})}function ej(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:xs([`skill-records`,e]),queryFn:({signal:e})=>q(r,{signal:e})})}function tj(e){return ot({queryKey:xs([`skill-record`,e]),queryFn:({signal:t})=>q(`/skill-records/${e}`,{signal:t}),enabled:!!e})}function nj(){let e=We();return st({mutationFn:e=>is(`/skill-records/${encodeURIComponent(e)}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-records`]}),e.invalidateQueries({queryKey:[`skill-record`]})}})}var rj=6e4,ij=36e5,aj=3e4;function oj(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 sj(e,t){try{return await q(e,{signal:t})}catch(e){if(e instanceof ls&&e.status===404)return null;throw e}}function cj(e){return ot({queryKey:xs([`session-canopy`,e]),queryFn:({signal:t})=>sj(`/sessions/${e}/canopy`,t),enabled:e!==void 0,staleTime:rj,retry:(e,t)=>t instanceof ls&&t.status===404?!1:e<2})}function lj(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 uj(e){return Ts({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${lj(e)}`,{signal:t}),staleTime:aj,pollCategory:`standard`,refetchInterval:Es.CANOPY_ENTRIES})}function dj(e){return ot({queryKey:xs([`canopy-entry`,e]),queryFn:({signal:t})=>sj(`/canopy/entries/${encodeURIComponent(e??``)}`,t),enabled:typeof e==`string`&&e.length>0,staleTime:aj,retry:(e,t)=>t instanceof ls&&t.status===404?!1:e<2})}function fj(){let e=We();return st({mutationFn:async e=>ts(`/canopy/entries/${encodeURIComponent(e)}/reembed`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}function pj(){let e=We();return st({mutationFn:async e=>ts(`/canopy/entries/${encodeURIComponent(e)}/redescribe`,{}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}var mj=3e4;function hj(){return ot({queryKey:xs([`canopy-map`]),queryFn:({signal:e})=>q(`/canopy/map`,{signal:e}),staleTime:mj})}function gj(){let e=We();return st({mutationFn:async e=>ts(`/canopy/map/regenerate`,{force_cold_start:e.force_cold_start===!0}),onSuccess:()=>{e.invalidateQueries({queryKey:[`canopy-map`]})}})}function _j(e,t){return ot({queryKey:xs([`canopy-tool-call-blob`,e,t]),queryFn:({signal:n})=>sj(`/sessions/${e}/canopy/tool-calls/${t}/blob`,n),enabled:e!==void 0&&t!==void 0,staleTime:ij,retry:(e,t)=>t instanceof ls&&t.status===404?!1:e<2})}function vj({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 yj={default:`w-full`,narrow:`mx-auto w-full max-w-3xl`},bj=(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`,yj[e],t),...r,children:n}));bj.displayName=`PageContainer`;var xj=Us(`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}}),Sj=(0,W.forwardRef)(({className:e,accent:t,padded:n,...r},i)=>(0,G.jsx)(`div`,{ref:i,className:J(xj({accent:t,padded:n}),e),...r}));Sj.displayName=`AccentSurface`;var Cj=Us(`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`}}),wj=(0,W.forwardRef)(({className:e,tone:t,size:n,...r},i)=>(0,G.jsx)(`span`,{ref:i,className:J(Cj({tone:t,size:n}),e),...r}));wj.displayName=`Eyebrow`;var Tj=(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)(Sj,{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)(wj,{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})]})});Tj.displayName=`Panel`;function Ej({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 Dj=8;function Oj(e){let t=e??[];return t.length>=Dj?t.slice(t.length-Dj):[...t,...Array(Dj-t.length).fill(0)]}function kj(e,t){return e===`session`?t===1?`prompt batch`:`prompt batches`:t===1?`agent turn`:`agent turns`}function Aj(e){return e===`session`?`this session`:`this run`}function jj({data:e,kind:t,widthPx:n=48,heightPx:r=14,className:i,title:a,...o}){let s=Oj(e),c=s.reduce((e,t)=>e+t,0),l=`${c.toLocaleString()} ${kj(t,c)} across ${Aj(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 Mj=Us(`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`}}),Nj=(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(Mj({tone:r}),o),...s,children:[(0,G.jsx)(wj,{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)(Ej,{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})]}));Nj.displayName=`MetricCard`;var Pj=6,Fj=6,Ij=6,Lj=6;function Rj(e){return e===`running`?`sage`:e===`failed`||e===`error`?`terracotta`:e===`completed`||e===`succeeded`?`outline`:`ochre`}function zj(){let{data:e,isLoading:t,isError:n,error:r}=Fs(),{data:i}=_A({status:`active`,limit:Pj}),{data:a}=_A({limit:1}),{data:o}=PA({limit:Fj}),{data:s}=ej({limit:Ij}),{data:c}=uj({limit:Lj,sort_by:`llm_updated_at`,sort_dir:`desc`});return(0,G.jsx)(vj,{isLoading:t,error:n?r instanceof Error?r:Error(`Unable to reach daemon`):null,loadingText:`Connecting to daemon...`,children:e&&(0,G.jsxs)(bj,{className:`gap-8`,children:[(0,G.jsx)(Bj,{stats:e,activeSessionCount:i?.total??0,inFlightRunCount:(o?.runs??[]).filter(e=>e.status===`running`).length,lastSession:a?.sessions?.[0]}),(0,G.jsx)(Wj,{stats:e}),(0,G.jsx)(Jj,{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)(Xj,{runs:o?.runs??[]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,G.jsx)(Qj,{skills:s?.records??[]}),(0,G.jsx)($j,{entries:c?.rows??[]})]})]})]})})}function Bj({stats:e,activeSessionCount:t,inFlightRunCount:n,lastSession:r}){let i=e.context.project.name||nv(e.context.project.root),a=Uj(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)(wj,{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)(Hj,{lastSession:r,activeCount:t,totalSessions:e.vault.session_count})]})}var Vj=10080*60;function Hj({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<=Vj;r=n?`sage`:`ochre`,i=n?`Last captured ${Q_(t)}`:`No capture in 7 days · last ${Q_(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)(wk,{tone:r}),(0,G.jsx)(`span`,{children:i})]})}function Uj(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 Wj({stats:e}){return(0,G.jsxs)(`section`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,G.jsx)(Kj,{stats:e}),(0,G.jsx)(qj,{stats:e})]})}function Gj({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)(Sj,{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)(wj,{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 Kj({stats:e}){return(0,G.jsxs)(Gj,{accent:`sage`,Icon:Ka,eyebrow:`Project`,name:e.context.project.name||nv(e.context.project.root),sub:e.context.project.root,children:[(0,G.jsx)(Nj,{label:`Sessions`,value:e.vault.session_count.toLocaleString(),tone:`sage`}),(0,G.jsx)(Nj,{label:`Spores`,value:e.vault.spore_count.toLocaleString()}),(0,G.jsx)(Nj,{label:`Plans`,value:e.vault.plan_count.toLocaleString()}),(0,G.jsx)(Nj,{label:`Canopy`,value:`${e.canopy.described_count}/${e.canopy.entries_count}`,sub:`described`,mono:!0})]})}function qj({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)(Gj,{accent:`ochre`,Icon:go,eyebrow:`Grove`,name:n,sub:r,children:[(0,G.jsx)(Nj,{label:`Embeddings`,value:i>0?`${a}/${i}`:`—`,sub:i>0?`embedded`:`no items`,mono:!0,tone:`ochre`}),(0,G.jsx)(Nj,{label:`Embed queue`,value:o.toLocaleString(),sub:o>0?`pending`:`idle`})]})}function Jj({sessions:e,totalSporeCount:t,totalActiveCount:n}){let r=Nn(),i=ys(),a=n===0?`No active sessions`:`${n} ${n===1?`active session`:`active sessions`}`;return(0,G.jsxs)(Tj,{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)(Yj,{session:e,accent:[`sage`,`ochre`,`terra`][t%3],onClick:()=>r(i(`/sessions/${e.id}`))},e.id))}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between border-t border-[var(--ghost-border)] pt-3 text-xs font-mono text-outline`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-on-surface tabular-nums`,children:t.toLocaleString()}),` spores total`]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(i(`/sessions`)),className:`inline-flex items-center gap-1 text-sage hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 rounded`,children:[`View session archive`,(0,G.jsx)(qi,{className:`h-3 w-3`})]})]})]})}function Yj({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)(wk,{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:Q_(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)(Ej,{data:e.activity_buckets,widthPx:64,heightPx:14})})]})]})}function Xj({runs:e}){let t=Nn(),n=ys(),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)(Tj,{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)(Zj,{run:e,onClick:()=>t(n(`/agent?runId=${e.id}`))},e.id))})})}function Zj({run:e,onClick:t}){let n=Rj(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)(wk,{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:[`· `,Q_(e.started_at)]}),i>0&&(0,G.jsxs)(`span`,{children:[`· `,i.toLocaleString(),` tok`]}),e.model&&(0,G.jsxs)(`span`,{children:[`· `,e.model]})]})]})})}function Qj({skills:e}){let t=Nn(),n=ys(),r=[...e].sort((e,t)=>t.updated_at-e.updated_at);return(0,G.jsx)(Tj,{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:Q_(e.updated_at)})]},e.id))})})}function $j({entries:e}){let t=Nn(),n=ys();return(0,G.jsx)(Tj,{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?Q_(e.llm_updated_at):Q_(e.mechanical_updated_at)})]},e.path))})})}function eM(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 tM=`(min-width: 768px)`,nM=240,rM=360;function iM({master:e,detail:t,hasSelection:n,onCloseMobileDetail:r,railMinWidthPx:i=nM,railMaxWidthPx:a=rM,className:o,masterAriaLabel:s=`List`,detailAriaLabel:c=`Details`}){return eM(tM)?(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 aM({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 oM({searchPlaceholder:e=`Search...`,searchValue:t,onSearchChange:n,filters:r=[],filterValues:i={},onFilterChange:a,inputRef:o,count:s,className:c}){return(0,G.jsxs)(`div`,{className:J(`flex items-center gap-3 px-4 py-2.5 rounded-md bg-surface-container-low border border-[var(--ghost-border)]`,c),children:[(0,G.jsx)(no,{className:`h-4 w-4 text-on-surface-variant shrink-0`}),(0,G.jsx)(Kf,{ref:o,placeholder:e,value:t,onChange:e=>n(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1 min-w-[200px]`,"aria-label":e}),r.map(e=>(0,G.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,G.jsxs)(c_,{value:i[e.key]??`all`,onValueChange:t=>a?.(e.key,t),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:e.label})}),(0,G.jsx)(d_,{children:e.options.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})},e.key)),s!=null&&(0,G.jsx)(`span`,{className:`myco-eyebrow-sm shrink-0`,children:s})]})}var sM=Us(`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(sM({level:t,interactive:n,ghostBorder:r,glass:i,glow:a,accent:o}),e),...s}));Q.displayName=`Surface`;var cM={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)]`},lM={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`},uM=(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&&cM[e],n&&!t&&lM[e],a),...c,children:o})});uM.displayName=`Row`;function dM({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)(Lf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Vf,{className:`sm:max-w-md border border-outline-variant/20 [&>button:last-child]:hidden`,children:[(0,G.jsxs)(Hf,{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)(Wf,{children:n})]}),(0,G.jsx)(Gf,{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)(Uf,{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 fM({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 pM=3e5;function mM(){return ot({queryKey:xs([`symbionts`]),queryFn:({signal:e})=>q(`/symbionts`,{signal:e}),staleTime:pM})}function hM(e,t,n){let r=e.find(e=>e.name===t);return r?.resumeCommand?r.resumeCommand.replace(`{sessionId}`,n):null}var gM={released:`released`,merged_unreleased:`merged`,not_on_release_line:`feature`,unknown:`unknown`,unreconciled:`unreconciled`},_M={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`},vM={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`},yM={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 bM(e){let t=[gM[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 xM({annotation:e,className:t}){if(!e)return null;let n=gM[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`,_M[e.state]??_M.unknown,t),title:bM(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 SM({annotation:e,className:t}){if(!e)return null;let n=vM[e.state]??vM.unknown,r=yM[e.state]??yM.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:bM(e),"aria-label":`Release: ${bM(e)}`,role:`img`})}var CM=[`ACTIVE`,`TODAY`,`YESTERDAY`,`EARLIER`];function wM(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 CM)l[e].length>0&&u.push({label:e,rows:l[e]});return u}function TM(e){return!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey}function EM({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===`/`&&TM(n)&&i?.current){n.preventDefault(),i.current.focus();return}if(TM(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 DM=5;function OM(e){return e===`active`?`sage`:e===`completed`?`outline`:`ochre`}var kM=(0,W.forwardRef)(function({session:e,symbiontDisplayName:t,isSelected:n,isCursor:r,onClick:i,onDelete:a},o){let s=e.title||tv(e.id);return(0,G.jsxs)(uM,{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)(wk,{tone:OM(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)(SM,{annotation:e.release_state}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:Q_(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)(jj,{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 AM(){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 jM({selectedId:e,search:t,statusFilter:n,agentFilter:r,hasPlanFilter:i,offset:a,onOffsetChange:o,filterInputRef:s}){let c=Nn(),l=An(),[u,d]=(0,W.useState)(null),f=SA(),{data:p}=wA(u?.id??null),{data:m}=mM(),h=(0,W.useMemo)(()=>{let e=new Map;for(let t of m?.symbionts??[])e.set(t.name,t.displayName);return t=>t?e.get(t)??t:`unknown`},[m]),{data:g,isLoading:_,isError:v,error:y}=_A({limit:50,offset:a,status:n,agent:r,hasPlan:i,search:t});function b(){u&&f.mutate(u.id,{onSuccess:()=>d(null)})}let x=g?.sessions??[],S=g?.total??0,C=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(C.current)return;let t=new URLSearchParams(l.search);t.has(`status`)||t.has(`agent`)||t.has(`has_plan`)||!e&&!_&&x.length>0&&(C.current=!0,c(`/sessions/${x[0].id}`,{replace:!0}))},[e,_,x,c,l.search]);let w=EM({items:x,getId:e=>e.id,selectedId:e,onActivate:e=>c(`/sessions/${e}`),filterInputRef:s}),T=x.filter(e=>e.status===`active`).length,E=x.reduce((e,t)=>e+(t.prompt_count??0),0),D=(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:S.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:T.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:E.toLocaleString()}),` PROMPTS`]})]})]});return v?(0,G.jsxs)(`div`,{children:[D,(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:y instanceof Error?y.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{children:[D,_?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsx)(`div`,{role:`list`,"aria-label":`Session archive loading`,children:Array.from({length:DM}).map((e,t)=>(0,G.jsx)(AM,{},t))})}):x.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:S===0&&!t&&!n&&!r?`No sessions yet`:`No matching sessions`}),S===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`,{...w.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=wM(x,{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)(kM,{ref:w.setRowRef(r),session:t,symbiontDisplayName:h(t.agent),isSelected:e===t.id,isCursor:w.cursorIndex===r,onClick:()=>c(`/sessions/${t.id}`),onDelete:()=>d(t)},t.id)})]},t.label))})()})}),(0,G.jsx)(fM,{total:S,offset:a,limit:50,onPageChange:o}),(0,G.jsx)(dM,{open:u!==null,onOpenChange:e=>{e||d(null)},title:`Delete Session`,description:`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:tv(u.id)},{label:`Title`,value:u.title||tv(u.id)}]:[],impact:p?[{label:`Prompts`,value:p.promptCount},{label:`Spores`,value:p.sporeCount},{label:`Attachments`,value:p.attachmentCount},{label:`Graph Edges`,value:p.graphEdgeCount}]:[],confirmLabel:`Delete Session`,variant:`destructive`,onConfirm:b,isPending:f.isPending})]})}function MM({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 NM({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 PM=new Set([`Read`,`read`]);function FM(e){return e.canopy_injection_tokens===null?!1:PM.has(e.tool_name)}function IM({sessionId:e,toolCallId:t}){let{data:n,isLoading:r,isError:i,error:a}=_j(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 LM({sessionId:e,activity:t}){let[n,r]=(0,W.useState)(!1);if(!FM(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)(Lf,{open:n,onOpenChange:r,children:(0,G.jsxs)(Vf,{className:`max-w-2xl`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Canopy injection blob`}),(0,G.jsx)(Gf,{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)(IM,{sessionId:e,toolCallId:t.id})]})})]})}var RM=3;function zM({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)(LM,{sessionId:e.session_id,activity:e}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:av(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 BM({batchId:e,activityCount:t}){let[n,r]=(0,W.useState)(!1),{data:i,isLoading:a}=bA(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,RM)}).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)(zM,{activity:e},e.id))})]})})]})}var VM=`h-7 w-7`;function HM(e){return new Date(e*1e3).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function UM(e){return e?e.length>120?e.slice(0,120)+`…`:e:`(no prompt)`}function WM({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:HM(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)(BM,{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)(fO,{content:e.response_summary})]})]})}function GM(){if(typeof window>`u`)return;let e=window.__MYCO_AUTH__;return typeof e==`string`&&e.length>0?e:void 0}async function KM(e){let t=new Headers,n=GM();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 qM(e,t){return Vo(t?`/api/g/${t.grove.id}/p/${t.project.project_id}/attachments/${e}`:`/api/attachments/${e}`)}function JM(e){let t=gs(),[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=>KM(qM(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 YM({filePath:e,alt:t,className:n,loading:r=`lazy`}){let[i]=JM([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 XM({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=JM(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(VM,`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:HM(e.started_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface truncate`,children:o?e.user_prompt??`(no prompt)`:UM(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)(fO,{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)(YM,{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)(NM,{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)(BM,{batchId:e.id,activityCount:e.activity_count}),n.map(e=>(0,G.jsx)(WM,{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)(fO,{content:e.response_summary})]})]})})]})})]})]})}var ZM=3;function QM(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 $M=[`human`],eN=[`human`,`system`,`agent_dispatch`,`hook_injected`];function tN({sessionId:e}){let[t,n]=(0,W.useState)(!1),{data:r,isLoading:i}=yA(e,t?eN:$M),{data:a}=xA(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)(()=>QM([...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:ZM}).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)(XM,{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 nN=`▲`,rN=`▼`;function iN(e){let t=(e.match(/- \[x\]/gi)??[]).length;return{total:t+(e.match(/- \[ \]/g)??[]).length,checked:t}}var aN={active:`bg-green-500/10 text-green-500`,completed:`bg-blue-500/10 text-blue-500`},oN=`bg-muted text-muted-foreground`;function sN({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`,aN[e]??oN),children:e})}function cN({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:ev(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 lN({plan:e,initialExpanded:t=!1,isDeleting:n=!1,onDelete:r}){let[i,a]=(0,W.useState)(t),o=(0,W.useMemo)(()=>e.content?iN(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)(sN,{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)(cN,{planId:e.id}),(0,G.jsxs)(`span`,{children:[`Created `,Q_(e.created_at)]}),e.updated_at&&e.updated_at!==e.created_at&&(0,G.jsxs)(`span`,{title:$_(e.updated_at),children:[`Updated `,Q_(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?nN:rN})]})]}),i&&e.content&&(0,G.jsx)(`div`,{className:`border-t border-border px-4 py-3`,children:(0,G.jsx)(fO,{content:e.content,className:`text-sm`})})]})}function uN({sessionId:e,expandedPlanId:t}){let{data:n,isLoading:r,isError:i}=TA(e),a=EA(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)(lN,{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)(dM,{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 dN=15e3,fN=3e4,pN=3e4,mN=6e4;function hN(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 Ts({queryKey:[`spores`,e],queryFn:({signal:e})=>q(r,{signal:e}),staleTime:dN,pollCategory:`standard`,refetchInterval:Es.SPORES})}function gN(e){return ot({queryKey:xs([`spore`,e]),queryFn:({signal:t})=>q(`/spores/${e}`,{signal:t}),enabled:e!==void 0,staleTime:fN})}function _N(e,t=1,n=!0){return ot({queryKey:xs([`graph`,e,t]),queryFn:({signal:n})=>q(`/graph/${e}?depth=${t}`,{signal:n}),enabled:n&&e!==void 0,staleTime:pN})}function vN(e=!0){return ot({queryKey:xs([`full-graph`]),queryFn:({signal:e})=>q(`/graph`,{signal:e}),enabled:e,staleTime:pN})}function yN(){return ot({queryKey:xs([`graph-seeds`]),queryFn:({signal:e})=>q(`/graph/seeds`,{signal:e}),staleTime:pN})}function bN(e){let t=e?`/digest?agent_id=${encodeURIComponent(e)}`:`/digest`;return ot({queryKey:xs([`digest`,e]),queryFn:({signal:e})=>q(t,{signal:e}),staleTime:mN})}var xN=200,SN={decision:`default`,discovery:`default`,wisdom:`default`,architecture:`default`,trade_off:`secondary`,"cross-cutting":`secondary`,pattern:`secondary`,gotcha:`destructive`,bug_fix:`destructive`},CN={active:`default`,superseded:`outline`,consolidated:`outline`,archived:`outline`};function wN({spore:e}){let[t,n]=(0,W.useState)(!1),r=SN[e.observation_type]??`secondary`,i=CN[e.status]??`outline`,a=e.content.split(`
84
- `).find(e=>e.trim().length>0)?.replace(/^#+\s*/,``)??``;return(0,G.jsxs)(Q,{level:`low`,className:J(`rounded-md border border-outline-variant/20 transition-colors`,e.status===`superseded`&&`opacity-70`),role:`listitem`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-expanded":t,className:`w-full px-4 py-3 text-left hover:bg-surface-container-high/50 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t?(0,G.jsx)($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`,e.status===`superseded`&&`line-through`),children:a})]})]})}),t&&(0,G.jsxs)(`div`,{className:`border-t border-outline-variant/20 px-4 py-3 space-y-3`,children:[(0,G.jsx)(fO,{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:$_(e.created_at),children:[`Created `,Q_(e.created_at)]}),(0,G.jsxs)(`span`,{title:$_(e.updated_at),children:[`Last updated `,Q_(e.updated_at)]})]})]})]})}function TN({sessionId:e,className:t}){let{data:n,isPending:r,isError:i}=hN({session_id:e,limit:xN});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)(wN,{spore:e},e.id))})}var EN=`/cortex?tab=canopy`,DN=1e3,ON=1e6;function kN(e){let t=e<0?`-`:``,n=Math.abs(e);return n>=ON?`${t}${(n/ON).toFixed(1)}M`:n>=DN*10?`${t}${Math.round(n/DN)}k`:n>=DN?`${t}${(n/DN).toFixed(1)}k`:`${t}${n.toLocaleString()}`}function AN(e){return e===null?`—`:e.toLocaleString()}function jN({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 MN({sessionId:e,fixture:t,className:n}){let[r,i]=(0,W.useState)(!1),a=t!==void 0,{data:o,isLoading:s}=cj(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=oj(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":`${kN(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:kN(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)(Lf,{open:r,onOpenChange:i,children:(0,G.jsxs)(Vf,{className:`max-w-md`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Canopy: Reads saved this session`}),(0,G.jsx)(Gf,{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":`${kN(l)} net tokens saved on Reads`,children:kN(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)(jN,{label:`Injections offered`,value:AN(u),hint:`PreToolUse Read events where Canopy injected anatomy.`}),(0,G.jsx)(jN,{label:`Skipped after injection`,value:AN(d),hint:`Files the agent did not Read after seeing the injected blob.`}),(0,G.jsx)(jN,{label:`Read anyway`,value:AN(f),hint:`Files the agent Read in full after the injection.`}),(0,G.jsx)(jN,{label:`Injection cost`,value:m===null?`—`:`${kN(m)} tok`,hint:`Sum of tokens spent on Canopy injections this session.`}),p!==null&&p>0&&(0,G.jsx)(jN,{label:`Redundant reads`,value:AN(p),hint:`Files Read more than once in this session (informational).`}),(0,G.jsx)(jN,{label:`Map calls`,value:h.toLocaleString(),hint:`Times the agent called canopy_map() during this session.`})]}),(0,G.jsx)(ri,{to:EN,onClick:()=>i(!1),className:`inline-block mt-4 font-mono text-xs text-sage hover:underline`,children:`Learn more about Canopy →`})]})})]})}function NN(e){return e===`active`?`active`:e===`completed`?`completed`:`error`}var PN={active:`bg-primary`,completed:`bg-secondary`,error:`bg-tertiary`},FN={active:`bg-primary/15 text-primary`,completed:`bg-surface-container-high text-on-surface-variant`,error:`bg-tertiary/15 text-tertiary`};function IN({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-block h-2 w-2 rounded-full shrink-0`,PN[NN(e)])})}function LN({status:e}){let t=NN(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`,FN[t]),children:[(0,G.jsx)(IN,{status:e}),n]})}function RN(e){return e===null?`—`:Z_(new Date(e*1e3).toISOString())}var zN=1500;function BN({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),zN)},[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 VN({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 HN({id:e}){let t=Nn(),{data:n,isLoading:r,isError:i,error:a}=vA(e),{data:o}=mM(),s=WA(),c=CA(),[l,u]=(0,W.useState)(`idle`),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`tab`);return e===`plans`?`plans`:e===`spores`?`spores`:`conversation`}),[h]=(0,W.useState)(()=>new URLSearchParams(window.location.search).get(`plan`)),g=SA(),{data:_}=wA(d?e:null),{data:v}=TA(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 y=o?hM(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??tv(n.id)}),(0,G.jsx)(LN,{status:n.status}),(0,G.jsx)(xM,{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 `,RN(n.started_at)]}),n.ended_at&&(0,G.jsxs)(`span`,{children:[`Duration: `,iv(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)(Nj,{label:`Prompts`,value:String(n.prompt_count),tone:`sage`}),(0,G.jsx)(Nj,{label:`Tool Calls`,value:String(n.tool_count),tone:`sage`}),(0,G.jsx)(Nj,{label:`Plans`,value:String(v?.length??0)}),(0,G.jsx)(MN,{sessionId:e})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-4 overflow-hidden`,children:[(0,G.jsx)(MM,{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)(BN,{label:`Session ID`,value:e,copyable:!0}),y&&(0,G.jsx)(BN,{label:`Resume`,value:y,copyable:!0,code:!0}),n.parent_session_id&&(0,G.jsx)(BN,{label:`Parent`,value:n.parent_session_id}),n.parent_session_reason&&(0,G.jsx)(BN,{label:`Reason`,value:n.parent_session_reason,mono:!1}),n.project_root&&(0,G.jsx)(BN,{label:`Project`,value:n.project_root})]})]}),n.summary&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 overflow-hidden`,children:[(0,G.jsx)(MM,{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)(VN,{label:`Conversation`,value:`conversation`,activeTab:p,onClick:m}),(0,G.jsx)(VN,{label:`Plans`,value:`plans`,activeTab:p,onClick:m}),(0,G.jsx)(VN,{label:`Spores`,value:`spores`,activeTab:p,onClick:m})]}),p===`conversation`&&(0,G.jsx)(tN,{sessionId:e}),p===`plans`&&(0,G.jsx)(uN,{sessionId:e,expandedPlanId:h}),p===`spores`&&(0,G.jsx)(TN,{sessionId:e})]}),(0,G.jsx)(dM,{open:d,onOpenChange:f,title:`Delete Session`,description:`This will permanently remove this session and all related data. This action cannot be undone.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-tertiary`}),meta:n?[{label:`ID`,value:tv(n.id)},{label:`Title`,value:n.title||tv(n.id)}]:[],impact:_?[{label:`Prompts`,value:_.promptCount},{label:`Spores`,value:_.sporeCount},{label:`Attachments`,value:_.attachmentCount},{label:`Graph Edges`,value:_.graphEdgeCount}]:[],confirmLabel:`Delete Session`,variant:`destructive`,onConfirm:()=>{g.mutate(n.id,{onSuccess:()=>{f(!1),t(`/sessions`)}})},isPending:g.isPending})]})}var UN=300;function WN(e,t=UN){let[n,r]=(0,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function GN({initialFilters:e}){let[t,n]=(0,W.useState)(``),r=WN(t),[i,a]=(0,W.useState)(e),[o,s]=(0,W.useState)(0),c=(0,W.useCallback)((e,t)=>{a(n=>({...n,[e]:t})),s(0)},[]),l=(0,W.useCallback)(e=>{n(e),s(0)},[]),u=(0,W.useCallback)(e=>{let t=i[e];return t&&t!==`all`?t:void 0},[i]);return{searchInput:t,debouncedSearch:r.length>0?r:void 0,filterValues:i,offset:o,setOffset:s,handleSearchChange:l,handleFilterChange:c,activeFilter:u}}var KN={key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:`active`,label:`Active`},{value:`completed`,label:`Completed`}]},qN={key:`has_plan`,label:`Plans`,options:[{value:`all`,label:`All sessions`},{value:`true`,label:`With a plan`}]};function JN(){let{id:e}=Ln(),t=Nn(),[n]=di(),r=(0,W.useRef)(null),i=(0,W.useMemo)(()=>({status:n.get(`status`)??`all`,agent:n.get(`agent`)??`all`,has_plan:n.get(`has_plan`)===`true`?`true`:`all`}),[n]),{searchInput:a,debouncedSearch:o,filterValues:s,offset:c,setOffset:l,handleSearchChange:u,handleFilterChange:d,activeFilter:f}=GN({initialFilters:i});(0,W.useEffect)(()=>{for(let[e,t]of Object.entries(i))s[e]!==t&&d(e,t)},[i]);let{data:p}=mM(),m=(0,W.useMemo)(()=>[KN,{key:`agent`,label:`Symbiont`,options:[{value:`all`,label:`All symbionts`},...(p?.symbionts??[]).filter(e=>e.enabled).map(e=>({value:e.name,label:e.displayName}))]},qN],[p]),h=f(`status`),g=f(`agent`),_=f(`has_plan`)===`true`;return(0,G.jsxs)(`div`,{className:`flex flex-col h-full gap-4 p-4`,children:[(0,G.jsx)(oM,{searchPlaceholder:`Search sessions...`,searchValue:a,onSearchChange:u,filters:m,filterValues:s,onFilterChange:d,inputRef:r}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,G.jsx)(iM,{hasSelection:!!e,onCloseMobileDetail:()=>t(`..`),masterAriaLabel:`Sessions`,detailAriaLabel:`Session details`,master:(0,G.jsx)(jM,{selectedId:e,search:o,statusFilter:h,agentFilter:g,hasPlanFilter:_,offset:c,onOffsetChange:l,filterInputRef:r}),detail:e?(0,G.jsx)(HN,{id:e}):(0,G.jsx)(aM,{message:`Select a session to see its details.`})})})]})}function YN({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 XN({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 ZN=(0,W.createContext)(null);function QN({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)(ZN.Provider,{value:a,children:e})}function $N(){let e=(0,W.useContext)(ZN);if(!e)throw Error(`useRestartGate must be inside RestartGateProvider`);return e}function eP(){return(0,W.useContext)(ZN)?.markDirty??(()=>{})}function tP(){let{dirty:e,clear:t}=$N(),{restart:n,isRestarting:r}=Rs();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 nP({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)(dk,{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 rP={machine:`machine`,grove:`grove`,project:`project`,local:`personal`};function iP({path:e,label:t,hint:n,requiresRestart:r,commitOn:i=`change`,parse:a,children:o}){let{effective:s,local:c,setField:l,resetField:u}=LO(),d=eP(),f=ak(e),p=f.overridableBy.includes(`local`),m=f.home,h=SO(s??{},e),g=p&&SO(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)(pk,{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=rP[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)(nP,{label:t,hint:n,scope:E?void 0:D,scopeIndicator:E,error:x??void 0,children:o({value:v,onChange:w,onBlur:T})})})}var aP=200,oP={1500:`T1500 — Compact`,5e3:`T5000 — Standard`,1e4:`T10000 — Full`};function sP(e){return oP[e]??`T${e}`}function cP({tier:e}){let[t,n]=(0,W.useState)(!1),r=e.content.length>aP,i=r&&!t?e.content.slice(0,aP)+`…`: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:sP(e.tier)}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Generated `,Q_(e.generated_at)]})]}),(0,G.jsx)(fO,{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-aP,` more chars)`]})})]})}function lP(){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 uP({agentId:e}){let{data:t,isLoading:n,isError:r,error:i}=bN(e),a=t?.tiers??[];return n?(0,G.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,G.jsx)(lP,{},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)(cP,{tier:e},e.tier))]})}var dP=6,fP=[{value:`all`,label:`All`},{value:`yes`,label:`Yes`},{value:`no`,label:`No`}],pP=[{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`}],mP=[{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 hP(e){if(e===`yes`)return!0;if(e===`no`)return!1}function gP(e){return(0,G.jsx)(X,{variant:e?`default`:`secondary`,children:e?`Yes`:`No`})}function _P({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)(c_,{value:t,onValueChange:r,children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{})}),(0,G.jsx)(d_,{children:n.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})})]})}function vP({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 yP(){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 bP({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:gP(e.llm_description!==null)}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:gP(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:ov(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 xP({selectedPath:e,onSelectPath:t}){let{searchInput:n,debouncedSearch:r,filterValues:i,offset:a,setOffset:o,handleSearchChange:s,handleFilterChange:c,activeFilter:l}=GN({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}=uj((0,W.useMemo)(()=>({limit:50,offset:a,language:l(`language`),described:hP(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)(Kf,{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)(_P,{label:`Language`,value:i.language??`all`,options:pP,onValueChange:e=>c(`language`,e)}),(0,G.jsx)(_P,{label:`Described`,value:i.described??`all`,options:fP,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:mP.map((e,t)=>{let n=[(0,G.jsx)(vP,{sortKey:e.id,activeSort:u,activeDir:f,onSort:m,children:e.label},e.id)];return e.id===`language`&&n.push((0,G.jsx)(vP,{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:dP}).map((e,t)=>(0,G.jsx)(yP,{},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)(bP,{entry:n,selected:n.path===e,onClick:()=>t(n.path)},n.path))})]})}),(0,G.jsx)(fM,{total:b,offset:a,limit:50,onPageChange:o})]})}function SP({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 CP(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function wP(e){return e.length>12?`${e.slice(0,12)}…`:e}function TP({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 EP({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 DP(){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 OP({path:e,onBack:t,onClose:n}){let{data:r,isPending:i,isError:a,error:o}=dj(e),s=fj(),c=pj(),[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)(()=>CP(r?.exports_json??null),[r?.exports_json]),v=(0,W.useMemo)(()=>CP(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)(SP,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsx)(DP,{})});if(a)return(0,G.jsx)(SP,{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)(SP,{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)(SP,{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)(MM,{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)(MM,{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)(MM,{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)(MM,{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)(MM,{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)(MM,{children:`Metadata`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(TP,{label:`Tokens`,children:r.token_estimate.toLocaleString()}),(0,G.jsx)(TP,{label:`Lines`,children:r.line_count.toLocaleString()}),(0,G.jsxs)(TP,{label:`Size`,children:[r.size_bytes.toLocaleString(),` B`]}),(0,G.jsx)(TP,{label:`Hash`,children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(`code`,{title:r.content_hash,children:wP(r.content_hash)}),(0,G.jsx)(EP,{text:r.content_hash})]})}),(0,G.jsx)(TP,{label:`Indexed`,children:$_(r.mechanical_updated_at)}),(0,G.jsx)(TP,{label:`Described`,children:r.llm_updated_at===null?`—`:$_(r.llm_updated_at)})]})]})]})})}function kP({defaultPath:e}={}){let[t,n]=(0,W.useState)(e);return(0,G.jsxs)(`div`,{className:`relative space-y-6`,children:[(0,G.jsx)(xP,{selectedPath:t,onSelectPath:n}),t?(0,G.jsx)(OP,{path:t,onClose:()=>n(void 0)}):null]})}var AP={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 jP(){let e=hj(),t=gj(),[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?AP[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?$_(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)(MM,{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)(fO,{content:d.content})})})]})}var MP={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 NP(e,t){return e||(t<=2?2:t===3?3:4)}function PP({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`,MP[NP(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 FP({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 IP=[{id:`overview`,label:`Overview`},{id:`entries`,label:`Entries`},{id:`map`,label:`Map`}],LP=new Set(IP.map(e=>e.id)),RP=`section`,zP=[{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`}],BP=new Set(zP.map(e=>e.id)),VP=new Set([`completed`,`failed`,`skipped`]),HP=12,UP=140,WP=[{value:`1500`,label:`1.5K - Executive briefing`},{value:`5000`,label:`5K - Deep onboarding`},{value:`10000`,label:`10K - Full institutional`}];function GP(e){let t=new URLSearchParams(e).get(`tab`);return t&&BP.has(t)?t:`instructions`}function KP(e){let t=new URLSearchParams(e).get(RP);return t&&LP.has(t)?t:`overview`}function qP(e){return e?new Date(e*1e3).toLocaleString():`Not generated yet`}function JP(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 YP(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 XP(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=YP(e,`Target symbiont`),r=YP(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 ZP(e){switch(e){case`completed`:return`default`;case`failed`:return`destructive`;case`running`:return`warning`;default:return`secondary`}}function QP(e){return e===null?null:e?`Instructions included in prompt`:`Uses session-start instructions`}function $P(){return ot({queryKey:[`cortex-instructions`],queryFn:({signal:e})=>q(`/cortex/instructions`,{signal:e}),staleTime:6e4})}function eF(e){return Ts({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&&VP.has(t)?!1:Es.PROGRESS}})}function tF(){let e=An(),t=Nn(),n=GP(e.search),r=KP(e.search),i=(0,W.useCallback)(n=>{if(!BP.has(n))return;let r=new URLSearchParams(e.search);n===`instructions`?r.delete(`tab`):r.set(`tab`,n),n!==`canopy`&&r.delete(RP);let i=r.toString();t({pathname:e.pathname,search:i?`?${i}`:``},{replace:!0})},[e.pathname,e.search,t]),a=(0,W.useCallback)(n=>{if(!LP.has(n))return;let r=new URLSearchParams(e.search);r.set(`tab`,`canopy`),n===`overview`?r.delete(RP):r.set(RP,n);let i=r.toString();t({pathname:e.pathname,search:i?`?${i}`:``},{replace:!0})},[e.pathname,e.search,t]);return(0,G.jsxs)(bj,{children:[(0,G.jsx)(YN,{title:`Cortex`,subtitle:`Manage session-start context, prompt building, and digest access for connected symbionts.`}),(0,G.jsx)(PP,{tabs:zP.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:i,columns:4}),n===`digest`?(0,G.jsx)(oF,{}):n===`builder`?(0,G.jsx)(iF,{}):n===`canopy`?(0,G.jsx)(nF,{section:r,onSectionChange:a,searchParams:e.search}):(0,G.jsx)(rF,{})]})}function nF({section:e,onSectionChange:t,searchParams:n}){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(FP,{tabs:IP.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)(kP,{defaultPath:e},e??`no-path`)})():e===`map`?(0,G.jsx)(jP,{}):(0,G.jsx)(cF,{})]})}function rF(){let{effective:e,isLoading:t}=LO(),n=$P(),[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 ts(`/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)(wj,{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)(wj,{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)(iP,{path:ji.instructions.injectOnSessionStart,label:`Managed instructions`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(iP,{path:ji.digest.injectOnSessionStart,label:`Preferred digest`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{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)(iP,{path:ji.instructions.injectOnSubagentStart,label:`Subagent instructions`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{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)(iP,{path:ji.spores.injectOnPromptSubmit,label:`Spore retrieval`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(iP,{path:ji.spores.maxPerPrompt,label:`Max spores`,children:({value:e,onChange:t})=>(0,G.jsx)(Kf,{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)(wj,{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?` — ${JP(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: `,qP(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)(fO,{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 iF(){let e=PA({task:`cortex-prompt-builder`,limit:HP}),{data:t}=mM(),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=eF(s?.runId??null),m=eF(l),h=(0,W.useMemo)(()=>(e.data?.runs??[]).map(e=>({run:e,parsed:XP(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 ts(`/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)(MM,{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)(c_,{value:a,onValueChange:o,children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:`Choose a symbiont`})}),(0,G.jsx)(d_,{children:n.map(e=>(0,G.jsx)(f_,{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:ZP(p.data?.status??`running`),children:p.data?.status??`running`}),QP(s.inlineInstructions)?(0,G.jsx)(X,{variant:`secondary`,children:QP(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&&VP.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)(MM,{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:ZP(e.status),children:e.status}),QP(t.inlineInstructions)?(0,G.jsx)(X,{variant:`secondary`,children:QP(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:ev(t.goal||`Untitled build request`,UP)}),(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 `,ov(e.started_at)]}),(0,G.jsxs)(`span`,{children:[`Run `,tv(e.id)]}),e.completed_at?(0,G.jsxs)(`span`,{children:[`Duration `,iv(e.started_at,e.completed_at)]}):null]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>u(e.id),children:`View Details`}),(0,G.jsx)(`a`,{href:`/agent?run=${e.id}`,className:`inline-flex h-8 items-center justify-center rounded-md border border-[var(--ghost-border)] px-3 font-sans text-xs font-medium text-on-surface transition-all hover:bg-surface-container-high`,children:`Open Run`})]})]})},e.id))})]}),(0,G.jsx)(Lf,{open:l!==null,onOpenChange:e=>{e||u(null)},children:(0,G.jsxs)(Vf,{className:`max-w-4xl max-h-[90vh] overflow-y-auto`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Prompt Build Details`}),(0,G.jsx)(Gf,{children:`Review the generated prompt, task reports, and jump to the full agent run when you need deeper diagnostics.`})]}),l?(0,G.jsx)(aF,{runId:l,runInstruction:g?.run.instruction??null,result:m.data,isLoading:m.isLoading,isFetching:m.isFetching,onRefresh:()=>void m.refetch()}):null]})})]})}function aF({runId:e,runInstruction:t,result:n,isLoading:r,isFetching:i,onRefresh:a}){let o=(0,W.useMemo)(()=>XP(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:ZP(n?.status),children:n?.status??`loading`}),(0,G.jsxs)(X,{variant:`secondary`,children:[`Run `,tv(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,QP(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:`/agent?run=${e}`,className:`inline-flex h-8 items-center justify-center rounded-md border border-[var(--ghost-border)] px-3 font-sans text-xs font-medium text-on-surface transition-all hover:bg-surface-container-high`,children:`Open Full Run`}),(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:a,disabled:i,children:i?`Refreshing...`:`Refresh`})]})]}),(0,G.jsxs)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5 space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Generated Prompt`}),n?.prompt?(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-sm text-on-surface`,children:n.prompt}):(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:n?.status===`failed`?n.error||`The prompt builder run failed before producing a prompt.`:`Waiting for the Myco agent to produce the prompt...`})]}),n?.reports?.length?(0,G.jsxs)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5 space-y-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Task Reports`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:n.reports.map(e=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.action}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:$_(e.created_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:e.summary})]},e.id))})]}):null]})}function oF(){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)(MM,{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)(iP,{path:ji.digest.tier,label:`Preferred digest tier`,children:({value:e,onChange:t})=>(0,G.jsxs)(c_,{value:String(e??5e3),onValueChange:e=>t(Number(e)),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{})}),(0,G.jsx)(d_,{children:WP.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})})]}),(0,G.jsx)(uP,{})]})}function sF({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)(Kf,{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 cF(){let{effective:e,isLoading:t}=LO(),{data:n}=RA(),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)(MM,{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)(iP,{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)(iP,{path:ji.canopy.exclude.patterns,label:`Your patterns`,children:({value:e,onChange:t})=>(0,G.jsx)(sF,{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)(iP,{path:ji.canopy.refresh.backgroundEnabled,label:`Periodic background scan`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(iP,{path:ji.canopy.refresh.backgroundPeriodMinutes,label:`Period (minutes)`,children:({value:e,onChange:t})=>(0,G.jsx)(Kf,{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)(MM,{children:`Injection`}),(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(iP,{path:ji.canopy.injectOnPreToolUse,label:`Inject canopy on Read`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(iP,{path:ji.canopy.minFileBytes,label:`Minimum file size (bytes)`,children:({value:e,onChange:t})=>(0,G.jsx)(Kf,{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)(MM,{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 lF(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 uF(e){if(Array.isArray(e))return e}function dF(e){if(Array.isArray(e))return lF(e)}function fF(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function pF(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,wF(r.key),r)}}function mF(e,t,n){return t&&pF(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function hF(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=EF(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.
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 nE(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=$E.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function lD(){return{exit:{taskListCheckValueChecked:dD,taskListCheckValueUnchecked:dD,paragraph:fD}}}function uD(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:pD}}}function dD(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function fD(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 pD(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=$E.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 mD(){return[bT(),WT(),YT(),eD(),lD()]}function hD(e){return{extensions:[xT(),GT(e),XT(),cD(e),uD()]}}var gD={tokenize:AD,partial:!0},_D={tokenize:jD,partial:!0},vD={tokenize:MD,partial:!0},yD={tokenize:ND,partial:!0},bD={tokenize:PD,partial:!0},xD={name:`wwwAutolink`,tokenize:OD,previous:FD},SD={name:`protocolAutolink`,tokenize:kD,previous:ID},CD={name:`emailAutolink`,tokenize:DD,previous:LD},wD={};function TD(){return{text:wD}}for(var ED=48;ED<123;)wD[ED]=CD,ED++,ED===58?ED=65:ED===91&&(ED=97);wD[43]=CD,wD[45]=CD,wD[46]=CD,wD[95]=CD,wD[72]=[CD,SD],wD[104]=[CD,SD],wD[87]=[CD,xD],wD[119]=[CD,xD];function DD(e,t,n){let r=this,i,a;return o;function o(t){return!RD(t)||!LD.call(r,r.previous)||zD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return RD(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(bD,u,l)(t):t===45||t===95||bb(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&&yb(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function OD(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!FD.call(r,r.previous)||zD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(gD,e.attempt(_D,e.attempt(vD,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)&&ID.call(r,r.previous)&&!zD(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(yb(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||Sb(t)||Db(t)||Ab(t)||kb(t)?n(t):e.attempt(_D,e.attempt(vD,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function AD(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(yD,c,s)(t):t===null||Db(t)||Ab(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 MD(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(yD,t,a)(o):o===null||Db(o)||Ab(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function ND(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||Db(o)||Ab(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Db(e)||Ab(e)?t(e):r(e)}function a(e){return yb(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):yb(t)?(e.consume(t),o):n(t)}}function PD(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return bb(e)?n(e):t(e)}}function FD(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Db(e)}function ID(e){return!yb(e)}function LD(e){return!(e===47||RD(e))}function RD(e){return e===43||e===45||e===46||e===95||bb(e)}function zD(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 BD={tokenize:JD,partial:!0};function VD(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:GD,continuation:{tokenize:KD},exit:qD}},text:{91:{name:`gfmFootnoteCall`,tokenize:WD},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:HD,resolveTo:UD}}}}function HD(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=vb(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 UD(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 WD(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||Db(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(vb(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Db(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 GD(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||Db(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=vb(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Db(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),Nb(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function KD(e,t,n){return e.check(Jb,t,e.attempt(BD,t,n))}function qD(e){e.exit(`gfmFootnoteDefinition`)}function JD(e,t,n){let r=this;return Nb(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 YD(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&&db(o,o.length,0,Vb(s,e.slice(r+1,n),t)),db(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),db(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=Bb(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=Bb(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var XD=class{constructor(){this.map=[]}add(e,t,n){ZD(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 ZD(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 QD(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 $D(){return{flow:{null:{name:`table`,tokenize:eO,resolveAll:tO}}}}function eO(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):Eb(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Ob(t)?Nb(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||Db(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,Ob(t)?Nb(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 Ob(t)?Nb(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||Eb(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 Ob(t)?Nb(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Eb(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||Eb(n)?(e.exit(`tableRow`),t(n)):Ob(n)?Nb(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Db(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 tO(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 XD;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(rO(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=nO(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=nO(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=nO(f,t,o,i,n,d)):(o[0]=o[1],d=nO(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&rO(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=QD(t.events,n))}return e}function nO(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},iO(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=iO(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=iO(t.events,n[2]),a=iO(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({},iO(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function rO(e,t,n,r,i){let a=[],o=iO(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 iO(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var aO={name:`tasklistCheck`,tokenize:sO};function oO(){return{text:{91:aO}}}function sO(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 Db(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 Eb(r)?t(r):Ob(r)?e.check({tokenize:cO},t,n)(r):n(r)}}function cO(e,t,n){return Nb(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function lO(e){return mb([TD(),VD(),YD(e),$D(),oO()])}var uO={};function dO(e){let t=this,n=e||uO,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(lO(n)),a.push(mD()),o.push(hD(n))}function fO({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)(sT,{remarkPlugins:[dO],children:e})})}var pO={info:`bg-primary`,success:`bg-green-500`,warning:`bg-secondary`,error:`bg-tertiary`},mO={info:Ma,success:oa,warning:_o,error:ra},hO={unread:`New`,read:`Earlier`},gO=`notification-panel`;function _O(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 vO({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 yO({notification:e,onOpen:t,onDismiss:n}){let r=mO[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`,pO[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)(fO,{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:_O(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 bO({open:e,onClose:t}){let{data:n,refetch:r}=mv({limit:50,enabled:e,pollCategory:`realtime`,refetchInterval:Es.LOGS}),i=gv(),a=vv(),o=_v(),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:gO,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)(vO,{title:hO.unread,count:f.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:f.map(e=>(0,G.jsx)(yO,{notification:e,onOpen:c,onDismiss:l},e.id))})]}),p.length>0&&(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(vO,{title:hO.read,count:p.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:p.map(e=>(0,G.jsx)(yO,{notification:e,onOpen:c,onDismiss:l},e.id))})]})]})})]})]})}function xO(e){return Array.isArray(e)?e:e?e.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(e=>e.length>0):[]}function SO(e,t){let n=xO(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 CO(e,t,n){let r=xO(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 wO=[`grove-config`];function TO(e){return[...wO,e??`none`]}function EO(){let e=_s(),t=e?.grove.id??null,n=ko(e);return ot({queryKey:TO(t),queryFn:({signal:e})=>q(`/grove-config`,{signal:e,headers:n}),enabled:t!==null})}function DO(){let e=We(),t=_s(),n=t?.grove.id??null,r=ko(t);return st({mutationFn:e=>ns(`/grove-config`,{patch:e},{headers:r}),onSuccess:()=>{e.invalidateQueries({queryKey:TO(n)}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}var OO=[`machine-config`];function kO(){return Ts({queryKey:[...OO],queryFn:({signal:e})=>q(`/machine-config`,{signal:e}),refetchInterval:!1,pollCategory:`standard`,contextFree:!0})}function AO(){let e=We();return st({mutationFn:e=>ns(`/machine-config`,{patch:e}),onSuccess:t=>{e.setQueryData([...OO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}function jO(){let e=We();return st({mutationFn:({path:e,value:t})=>ns(`/machine-config`,{addToList:[{path:e,values:[t]}]}),onSuccess:t=>{e.setQueryData([...OO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}function MO(){let e=We();return st({mutationFn:({path:e,value:t})=>ns(`/machine-config`,{removeFromList:[{path:e,values:[t]}]}),onSuccess:t=>{e.setQueryData([...OO],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}var NO=[`config`,`merged`],PO=[`config`,`local`],FO=[`notifications`];function IO(e){let t=We(),n=DO(),r=AO(),i=e?Po(e):`none`,a=(0,W.useMemo)(()=>ko(e),[e?.grove.id,e?.project.project_id]),o=ot({queryKey:[...NO,i],queryFn:({signal:e})=>as(e,a)}),s=ot({queryKey:[...PO,i],queryFn:({signal:e})=>os(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:FO})},[t]),d=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:PO}),t.invalidateQueries({queryKey:NO}),u()},[u,t]),f=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:NO}),u()},[u,t]),p=(0,W.useCallback)(e=>e===`local`?d():f(),[d,f]),m=(0,W.useCallback)(async(e,t,i)=>{let o={};CO(o,e,t),i===`grove`?(await n.mutateAsync(o),u()):i===`machine`?(await r.mutateAsync(o),u()):(await ss(i,o,void 0,a),p(i))},[a,p,u,n,r]),h=(0,W.useCallback)(async(e,t,i)=>{let o={};for(let{path:t,value:n}of e)CO(o,t,n);t===`grove`?(await n.mutateAsync(o),u()):t===`machine`?(await r.mutateAsync(o),u()):(await ss(t,o,i,a),p(t))},[a,p,u,n,r]),g=(0,W.useCallback)(async e=>{await cs([e],a),d()},[a,d]),_=(0,W.useCallback)(async e=>{e.length!==0&&(await cs(e,a),d())},[a,d]),v=(0,W.useCallback)(async e=>{let t=SO(c.current??{},e),n={};CO(n,e,t),await ss(`project`,n,void 0,a),await cs([e],a),d()},[a,d]),y=(0,W.useCallback)(e=>SO(l.current??{},e)!==void 0,[]),b=(0,W.useCallback)(async(e,n,r)=>{if(r===`machine`){let r=await ns(`/machine-config`,{addToList:[{path:e,values:[n]}]});t.setQueryData([`machine-config`],{config:r}),t.invalidateQueries({queryKey:[`config`,`merged`]});return}let i=SO(c.current??{},e),a=Array.isArray(i)?i:[];a.includes(n)||await m(e,[...a,n],r)},[t,m]),x=(0,W.useCallback)(async(e,n,r)=>{if(r===`machine`){let r=await ns(`/machine-config`,{removeFromList:[{path:e,values:[n]}]});t.setQueryData([`machine-config`],{config:r}),t.invalidateQueries({queryKey:[`config`,`merged`]});return}let i=SO(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:y,setField:m,setFields:h,resetField:g,resetFields:_,promoteField:v,addToConfigList:b,removeFromConfigList:x}}function LO(){return IO(_s())}function RO(){let{effective:e}=LO(),t=e?.notifications?.system_notifications??!1,{data:n,refetch:r}=mv({status:`unread`,mode:`banner`,limit:5,enabled:t,pollCategory:`heartbeat`,refetchInterval:Es.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),zO(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 zO(e){try{new window.Notification(e.title,{body:e.message??void 0,tag:e.id,icon:`/favicon.svg`})}catch{}}var BO=[`sage`,`moss`,`terracotta`,`dusk`,`plum`,`slate`],VO=[`light`,`dark`,`system`],HO=[`default`,`geist-mono`,`system`,`sf-mono`,`fira-code`,`jetbrains-mono`],UO=[`compact`,`normal`,`comfy`],WO=`myco-appearance`,GO={compact:.85,normal:1,comfy:1.15},KO={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`}},qO=`(prefers-color-scheme: light)`;function JO(e){let t=document.documentElement;t.setAttribute(`data-theme`,e.theme);let n=e.mode===`system`?window.matchMedia(qO).matches?`light`:`dark`:e.mode;t.classList.toggle(`light`,n===`light`);let r=KO[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=GO[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 YO(e){try{localStorage.setItem(WO,JSON.stringify(e))}catch{}}function XO(){let e=null;try{e=localStorage.getItem(WO)}catch{return}if(e)try{JO(JSON.parse(e))}catch{try{localStorage.removeItem(WO)}catch{}}}var ZO=(0,W.createContext)(null),QO={theme:`sage`,mode:`dark`,font:`default`,density:`normal`},$O=`(prefers-color-scheme: light)`;function ek({children:e}){let{effective:t,setField:n}=LO(),r=(0,W.useMemo)(()=>t?.appearance??QO,[t?.appearance]),i=(0,W.useRef)(r);i.current=r,(0,W.useLayoutEffect)(()=>{t?.appearance&&(JO(r),YO(r))},[r,t?.appearance]),(0,W.useEffect)(()=>{if(r.mode!==`system`)return;let e=window.matchMedia($O),t=()=>JO(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};JO(a),YO(a);try{await n(`appearance.${e}`,t,`grove`)}catch(e){throw JO(r),YO(r),e}},[n]),o=(0,W.useMemo)(()=>({effective:r,set:a}),[r,a]);return(0,G.jsx)(ZO.Provider,{value:o,children:e})}function tk(){let e=(0,W.useContext)(ZO);if(!e)throw Error(`useAppearance must be used inside AppearanceProvider`);return e}var nk=[`cortex`,`canopy`,`skills`,`vault_evolution`],rk={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:[]},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:[]}},ik=Object.keys(rk).sort((e,t)=>t.length-e.length);function ak(e){for(let t of ik)if(e===t||e.startsWith(`${t}.`))return rk[t];throw Error(`No scope registry entry for config path: ${e}`)}var ok={machine:`Machine`,grove:`Grove`,project:`Project`,local:`Personal`},sk={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)`},ck={personal:`Personal`,project:`Project`,grove:`Grove`,"all-groves":`All Groves`,machine:`Machine`},lk={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`},uk={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 dk({scope:e}){let t=ck[e];return(0,G.jsxs)(`span`,{title:lk[e],className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${uk[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 fk={machine:`machine`,grove:`grove`,project:`project`,local:`personal`};function pk({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=ak(e),c=fk[s.home]??`project`,l=t?`personal`:c,u=t?lk.personal:sk[s.home]??lk[c],d=ok[s.home]??ck[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)(dk,{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 mk={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`}},hk={light:{icon:fo,label:`Light`},dark:{icon:Wa,label:`Dark`},system:{icon:Ua,label:`System`}},gk={default:`Default`,"geist-mono":`Geist`,system:`System`,"sf-mono":`SF Mono`,"fira-code":`Fira Code`,"jetbrains-mono":`JetBrains`},_k=`myco-ui-appearance-expanded`;function vk(){let e=typeof window<`u`?localStorage.getItem(_k):null;return e===null?!0:e===`true`}function yk({collapsed:e}){let{effective:t,set:n}=tk(),[r,i]=(0,W.useState)(vk);(0,W.useEffect)(()=>{localStorage.setItem(_k,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)(dk,{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:BO.map(e=>{let n=mk[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:VO.map(e=>{let{icon:n,label:r}=hk[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:HO.map(e=>(0,G.jsx)(`option`,{value:e,children:gk[e]},e))})),o(`Density`,`density`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-3 gap-1.5`,children:UO.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 bk(){return Ts({queryKey:[`git-identity`],queryFn:({signal:e})=>q(`/git/status`,{signal:e}),refetchInterval:Es.GIT_IDENTITY,pollCategory:`standard`})}function xk(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 Sk({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=xk(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 Ck={sage:`bg-primary`,ochre:`bg-secondary`,terracotta:`bg-tertiary`,outline:`bg-outline-variant`};function wk({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`,Ck[e],t&&`animate-pulse`,r),style:{width:n,height:n},"aria-hidden":!0})}var Tk=[`update-status`];function Ek(){return Ts({queryKey:[...Tk],queryFn:({signal:e})=>q(`/update/status`,{signal:e}),refetchInterval:Es.UPDATE,pollCategory:`standard`,contextFree:!0})}function Dk(){let e=We();return st({mutationFn:()=>ts(`/update/check`),onSuccess:()=>{e.invalidateQueries({queryKey:[...Tk]})}})}function Ok(){return st({mutationFn:()=>ts(`/update/apply`)})}function kk(){let e=We();return st({mutationFn:e=>ns(`/update/channel`,{channel:e}),onSuccess:()=>{e.invalidateQueries({queryKey:[...Tk]})}})}function Ak(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 Mk({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)(wk,{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?`—`:Ak(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 Nk({to:e,className:t}){let{data:n}=Fs(),r=Ek(),i=!!(r.data&&!r.data.exempt&&(r.data.update_available||r.data.revert_available));return(0,G.jsx)(Mk,{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 Pk(e,t){return!t||t<=0?0:Math.floor(e/t*100)}function Fk({describedCount:e,entriesCount:t,to:n,className:r}){let i=e!==void 0&&t!==void 0,a=i?Pk(e,t):null,o=i&&a<100,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(wk,{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 Ik({to:e,className:t}){let{data:n}=Fs();return(0,G.jsx)(Fk,{describedCount:n?.canopy.described_count,entriesCount:n?.canopy.entries_count,to:e,className:t})}var Lk={"/":`Dashboard`,"/sessions":`Sessions`,"/cortex":`Cortex`,"/mycelium":`Mycelium`,"/skills":`Skills`,"/agent":`Agent`,"/settings":`Settings`,"/logs":`Logs`,"/machine":`Machine`,"/groves":`Groves`};function Rk(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[Lk[`/${r[0]}`]??r[0]]}function zk({onOpenSearch:e,onOpenNotifications:t,unreadCount:n,className:r}){let i=Rk(An().pathname),a=bk(),o=vs(`/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.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)(Nk,{to:`/settings?configSection=update#update`}),(0,G.jsx)(Ik,{to:o}),(0,G.jsx)(Sk,{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 Bk=[`Project`,`Observability`,`Grove management`,`Settings`],Vk=[{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`}],Hk=`myco-ui-sidebar-collapsed`,Uk=768,Wk=80,Gk=2e3,Kk=[`ring-2`,`ring-primary/40`,`bg-primary/5`];function qk(){let[e,t]=(0,W.useState)(()=>localStorage.getItem(Hk)===`true`);return{collapsed:e,toggle:(0,W.useCallback)(()=>{t(e=>{let t=!e;return localStorage.setItem(Hk,String(t)),t})},[])}}function Jk(){let[e,t]=(0,W.useState)(!1),[n,r]=(0,W.useState)(()=>typeof window<`u`&&window.innerWidth<Uk);return(0,W.useEffect)(()=>{let e=window.matchMedia(`(max-width: ${Uk-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 Yk({collapsed:e=!1}){let{restart:t,isRestarting:n}=Rs();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 Xk({collapsed:e}){let{data:t}=Fs(),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 Zk({collapsed:e,onSearchOpen:t,onNotificationsOpen:n,unreadCount:r,onCollapseToggle:i,showCollapseToggle:a}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(uv,{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:Bk.map(t=>{let n=Vk.filter(e=>e.category===t);return n.length===0?null:(0,G.jsx)(Qk,{label:t,collapsed:e,children:n.map(t=>(0,G.jsx)(eA,{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)(Xk,{collapsed:e}),!e&&(0,G.jsx)(yk,{collapsed:e}),(0,G.jsx)(Yk,{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 Qk({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 $k(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??Lo(r)?.grove??jo(r)?.grove??r[0];return i?e.to.replace(`:groveSlug`,i.slug):`/`}function eA({item:e,collapsed:t}){return(0,G.jsxs)(ii,{to:$k(e,gs(),vs(e.to),fs().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 tA(e){let t=gs();(0,W.useEffect)(()=>{let n=t?.project.name??e??null;document.title=n?`${t?`${Ro(t.project.name)} `:``}${n} - Myco`:`Myco`},[t,e])}function nA(){let{collapsed:e,toggle:t}=qk(),{data:n}=Fs(),r=gs()?.project.name??n?.context.project.name??n?.vault.name;tA(r);let[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),{data:c}=pv(),l=c?.count??0,u=Jk();(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=rA(t,n);e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),e.classList.add(...Kk),window.setTimeout(()=>{e.classList.remove(...Kk)},Gk))},Wk);return()=>window.clearTimeout(r)},[location.key,location.search]),(0,G.jsxs)(`div`,{className:`flex h-screen overflow-hidden bg-background`,children:[(0,G.jsx)(W_,{open:i,onOpenChange:a}),(0,G.jsx)(Ev,{panelOpen:o}),(0,G.jsx)(bO,{open:o,onClose:p}),(0,G.jsx)(RO,{}),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.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)(Zk,{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)(Zk,{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)(zk,{onOpenSearch:d,onOpenNotifications:f,unreadCount:l}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,G.jsx)(cr,{})})]})]})}function rA(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 iA=0,aA=[],oA=new Set;function sA(){for(let e of oA)e(aA)}function cA(e){let t=++iA,n={...e,id:t};aA=[...aA,n],sA();let r=e.ttlMs??5e3;r>0&&setTimeout(()=>{aA=aA.filter(e=>e.id!==t),sA()},r)}function lA(){let[e,t]=(0,W.useState)(aA);return(0,W.useEffect)(()=>(oA.add(t),()=>{oA.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 uA=Es.SESSIONS,dA=Es.SESSION_DETAIL,fA=Es.SESSION_DETAIL,pA=3e4,mA=6e4,hA=1e4,gA=Es.SESSION_DETAIL;function _A(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 Ts({queryKey:[`sessions`,e],queryFn:({signal:e})=>q(r,{signal:e}),pollCategory:`standard`,refetchInterval:uA})}function vA(e){return Ts({queryKey:[`session`,e],queryFn:({signal:t})=>q(`/sessions/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:dA})}function yA(e,t=[`human`]){let n=t===`all`?``:`?origins=${t.join(`,`)}`;return Ts({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:fA})}function bA(e){return ot({queryKey:xs([`batch-activities`,e]),queryFn:({signal:t})=>q(`/batches/${e}/activities`,{signal:t}),enabled:e!==void 0,staleTime:pA})}function xA(e){return ot({queryKey:xs([`session-attachments`,e]),queryFn:({signal:t})=>q(`/sessions/${e}/attachments`,{signal:t}),enabled:e!==void 0,staleTime:mA})}function SA(){let e=We();return st({mutationFn:e=>is(`/sessions/${e}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`sessions`]})}})}function CA(){let e=We();return st({mutationFn:e=>ts(`/sessions/${e}/complete`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`session`,n]}),e.invalidateQueries({queryKey:[`sessions`]})}})}function wA(e){return ot({queryKey:xs([`session-impact`,e]),queryFn:({signal:t})=>q(`/sessions/${e}/impact`,{signal:t}),enabled:e!==null,staleTime:hA})}function TA(e){return Ts({queryKey:[`session-plans`,e],queryFn:async({signal:t})=>(await q(`/sessions/${e}/plans`,{signal:t})).plans,enabled:!!e,pollCategory:`standard`,refetchInterval:gA})}function EA(e){let t=We();return st({mutationFn:e=>is(`/plans/${e}`),onSuccess:()=>{t.invalidateQueries({queryKey:[`session-plans`,e]})}})}var DA=Es.RUNS_ACTIVE,OA=Es.RUN_DETAIL,kA=Es.STATS,AA=new Set([`completed`,`failed`,`skipped`]),jA=Es.STATS,MA=6e4,NA=50;function PA(e){let t=e?.limit??NA,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 Ts({queryKey:[`agent-runs`,e],queryFn:({signal:e})=>q(`/agent/runs?${r}`,{signal:e}),pollCategory:`standard`,refetchInterval:DA})}function FA(e){return Ts({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&&AA.has(t)?!1:OA}})}function IA(e,t){let n=t?AA.has(t):!1;return Ts({queryKey:[`agent-reports`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/reports`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?!1:kA})}function LA(e,t){let n=t?AA.has(t):!1;return Ts({queryKey:[`agent-turns`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/turns`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?!1:jA})}function RA(){return ot({queryKey:xs([`agent-tasks`]),queryFn:({signal:e})=>q(`/agent/tasks`,{signal:e}),staleTime:MA})}function zA(e){return ot({queryKey:xs([`agent-task`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}`,{signal:t}),enabled:e!==void 0,staleTime:MA})}function BA(){let e=We();return st({mutationFn:({taskId:e,name:t})=>ts(`/agent/tasks/${e}/copy`,t?{name:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function VA(){let e=We();return st({mutationFn:e=>is(`/agent/tasks/${e}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function HA(e){return ot({queryKey:xs([`agent-task-yaml`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}/yaml`,{signal:t}),enabled:e!==void 0,staleTime:MA})}function UA(){let e=We();return st({mutationFn:({taskId:e,yaml:t})=>ns(`/agent/tasks/${e}`,{yaml:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]}),e.invalidateQueries({queryKey:[`agent-task`]}),e.invalidateQueries({queryKey:[`agent-task-yaml`]})}})}function WA(){let e=We();return st({mutationFn:e=>ts(`/agent/run`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-runs`]})}})}function GA(){let e=We();return st({mutationFn:({runId:e,mode:t})=>ts(`/agent/runs/${e}/resume`,t?{mode:t}:{}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`agent-runs`]}),e.invalidateQueries({queryKey:[`agent-run`,n.runId]})}})}function KA(e){return Ts({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 qA(e){return Ts({queryKey:[`agent-run-audit`,e],queryFn:({signal:t})=>q(`/agent/runs/${e}/audit`,{signal:t}),enabled:e!==null,pollCategory:`standard`,refetchInterval:!1})}function JA(e,t){let n=new URLSearchParams;n.set(`agentId`,e),n.set(`tier`,String(t));let r=n.toString();return Ts({queryKey:[`digest-revisions`,e,t],queryFn:({signal:e})=>q(`/digest/revisions?${r}`,{signal:e}),enabled:!!e&&Number.isFinite(t),pollCategory:`standard`,refetchInterval:!1})}function YA(){let e=We();return st({mutationFn:({revisionId:e,runId:t})=>ts(`/digest/revisions/${e}/restore`,t?{runId:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`digest-revisions`]})}})}function XA(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 ZA(e){let t=gs(),n=it({queries:e.map(e=>({queryKey:bs(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(XA(t))}return{runs:r,isLoading:a,errors:i,isError:i.length>0}}function QA(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:xs([`skill-candidates`,e]),queryFn:({signal:e})=>q(r,{signal:e})})}function $A(){let e=We();return st({mutationFn:({id:e,...t})=>ns(`/skill-candidates/${e}`,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-candidates`]})}})}function ej(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:xs([`skill-records`,e]),queryFn:({signal:e})=>q(r,{signal:e})})}function tj(e){return ot({queryKey:xs([`skill-record`,e]),queryFn:({signal:t})=>q(`/skill-records/${e}`,{signal:t}),enabled:!!e})}function nj(){let e=We();return st({mutationFn:e=>is(`/skill-records/${encodeURIComponent(e)}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-records`]}),e.invalidateQueries({queryKey:[`skill-record`]})}})}var rj=6e4,ij=36e5,aj=3e4;function oj(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 sj(e,t){try{return await q(e,{signal:t})}catch(e){if(e instanceof ls&&e.status===404)return null;throw e}}function cj(e){return ot({queryKey:xs([`session-canopy`,e]),queryFn:({signal:t})=>sj(`/sessions/${e}/canopy`,t),enabled:e!==void 0,staleTime:rj,retry:(e,t)=>t instanceof ls&&t.status===404?!1:e<2})}function lj(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 uj(e){return Ts({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${lj(e)}`,{signal:t}),staleTime:aj,pollCategory:`standard`,refetchInterval:Es.CANOPY_ENTRIES})}function dj(e){return ot({queryKey:xs([`canopy-entry`,e]),queryFn:({signal:t})=>sj(`/canopy/entries/${encodeURIComponent(e??``)}`,t),enabled:typeof e==`string`&&e.length>0,staleTime:aj,retry:(e,t)=>t instanceof ls&&t.status===404?!1:e<2})}function fj(){let e=We();return st({mutationFn:async e=>ts(`/canopy/entries/${encodeURIComponent(e)}/reembed`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}function pj(){let e=We();return st({mutationFn:async e=>ts(`/canopy/entries/${encodeURIComponent(e)}/redescribe`,{}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}var mj=3e4;function hj(){return ot({queryKey:xs([`canopy-map`]),queryFn:({signal:e})=>q(`/canopy/map`,{signal:e}),staleTime:mj})}function gj(){let e=We();return st({mutationFn:async e=>ts(`/canopy/map/regenerate`,{force_cold_start:e.force_cold_start===!0}),onSuccess:()=>{e.invalidateQueries({queryKey:[`canopy-map`]})}})}function _j(e,t){return ot({queryKey:xs([`canopy-tool-call-blob`,e,t]),queryFn:({signal:n})=>sj(`/sessions/${e}/canopy/tool-calls/${t}/blob`,n),enabled:e!==void 0&&t!==void 0,staleTime:ij,retry:(e,t)=>t instanceof ls&&t.status===404?!1:e<2})}function vj({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 yj={default:`w-full`,narrow:`mx-auto w-full max-w-3xl`},bj=(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`,yj[e],t),...r,children:n}));bj.displayName=`PageContainer`;var xj=Us(`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}}),Sj=(0,W.forwardRef)(({className:e,accent:t,padded:n,...r},i)=>(0,G.jsx)(`div`,{ref:i,className:J(xj({accent:t,padded:n}),e),...r}));Sj.displayName=`AccentSurface`;var Cj=Us(`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`}}),wj=(0,W.forwardRef)(({className:e,tone:t,size:n,...r},i)=>(0,G.jsx)(`span`,{ref:i,className:J(Cj({tone:t,size:n}),e),...r}));wj.displayName=`Eyebrow`;var Tj=(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)(Sj,{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)(wj,{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})]})});Tj.displayName=`Panel`;function Ej({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 Dj=8;function Oj(e){let t=e??[];return t.length>=Dj?t.slice(t.length-Dj):[...t,...Array(Dj-t.length).fill(0)]}function kj(e,t){return e===`session`?t===1?`prompt batch`:`prompt batches`:t===1?`agent turn`:`agent turns`}function Aj(e){return e===`session`?`this session`:`this run`}function jj({data:e,kind:t,widthPx:n=48,heightPx:r=14,className:i,title:a,...o}){let s=Oj(e),c=s.reduce((e,t)=>e+t,0),l=`${c.toLocaleString()} ${kj(t,c)} across ${Aj(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 Mj=Us(`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`}}),Nj=(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(Mj({tone:r}),o),...s,children:[(0,G.jsx)(wj,{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)(Ej,{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})]}));Nj.displayName=`MetricCard`;var Pj=6,Fj=6,Ij=6,Lj=6;function Rj(e){return e===`running`?`sage`:e===`failed`||e===`error`?`terracotta`:e===`completed`||e===`succeeded`?`outline`:`ochre`}function zj(){let{data:e,isLoading:t,isError:n,error:r}=Fs(),{data:i}=_A({status:`active`,limit:Pj}),{data:a}=_A({limit:1}),{data:o}=PA({limit:Fj}),{data:s}=ej({limit:Ij}),{data:c}=uj({limit:Lj,sort_by:`llm_updated_at`,sort_dir:`desc`});return(0,G.jsx)(vj,{isLoading:t,error:n?r instanceof Error?r:Error(`Unable to reach daemon`):null,loadingText:`Connecting to daemon...`,children:e&&(0,G.jsxs)(bj,{className:`gap-8`,children:[(0,G.jsx)(Bj,{stats:e,activeSessionCount:i?.total??0,inFlightRunCount:(o?.runs??[]).filter(e=>e.status===`running`).length,lastSession:a?.sessions?.[0]}),(0,G.jsx)(Wj,{stats:e}),(0,G.jsx)(Jj,{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)(Xj,{runs:o?.runs??[]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,G.jsx)(Qj,{skills:s?.records??[]}),(0,G.jsx)($j,{entries:c?.rows??[]})]})]})]})})}function Bj({stats:e,activeSessionCount:t,inFlightRunCount:n,lastSession:r}){let i=e.context.project.name||nv(e.context.project.root),a=Uj(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)(wj,{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)(Hj,{lastSession:r,activeCount:t,totalSessions:e.vault.session_count})]})}var Vj=10080*60;function Hj({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<=Vj;r=n?`sage`:`ochre`,i=n?`Last captured ${Q_(t)}`:`No capture in 7 days · last ${Q_(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)(wk,{tone:r}),(0,G.jsx)(`span`,{children:i})]})}function Uj(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 Wj({stats:e}){return(0,G.jsxs)(`section`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,G.jsx)(Kj,{stats:e}),(0,G.jsx)(qj,{stats:e})]})}function Gj({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)(Sj,{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)(wj,{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 Kj({stats:e}){return(0,G.jsxs)(Gj,{accent:`sage`,Icon:Ka,eyebrow:`Project`,name:e.context.project.name||nv(e.context.project.root),sub:e.context.project.root,children:[(0,G.jsx)(Nj,{label:`Sessions`,value:e.vault.session_count.toLocaleString(),tone:`sage`}),(0,G.jsx)(Nj,{label:`Spores`,value:e.vault.spore_count.toLocaleString()}),(0,G.jsx)(Nj,{label:`Plans`,value:e.vault.plan_count.toLocaleString()}),(0,G.jsx)(Nj,{label:`Canopy`,value:`${e.canopy.described_count}/${e.canopy.entries_count}`,sub:`described`,mono:!0})]})}function qj({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)(Gj,{accent:`ochre`,Icon:go,eyebrow:`Grove`,name:n,sub:r,children:[(0,G.jsx)(Nj,{label:`Embeddings`,value:i>0?`${a}/${i}`:`—`,sub:i>0?`embedded`:`no items`,mono:!0,tone:`ochre`}),(0,G.jsx)(Nj,{label:`Embed queue`,value:o.toLocaleString(),sub:o>0?`pending`:`idle`})]})}function Jj({sessions:e,totalSporeCount:t,totalActiveCount:n}){let r=Nn(),i=ys(),a=n===0?`No active sessions`:`${n} ${n===1?`active session`:`active sessions`}`;return(0,G.jsxs)(Tj,{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)(Yj,{session:e,accent:[`sage`,`ochre`,`terra`][t%3],onClick:()=>r(i(`/sessions/${e.id}`))},e.id))}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between border-t border-[var(--ghost-border)] pt-3 text-xs font-mono text-outline`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-on-surface tabular-nums`,children:t.toLocaleString()}),` spores total`]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(i(`/sessions`)),className:`inline-flex items-center gap-1 text-sage hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 rounded`,children:[`View session archive`,(0,G.jsx)(qi,{className:`h-3 w-3`})]})]})]})}function Yj({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)(wk,{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:Q_(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)(Ej,{data:e.activity_buckets,widthPx:64,heightPx:14})})]})]})}function Xj({runs:e}){let t=Nn(),n=ys(),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)(Tj,{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)(Zj,{run:e,onClick:()=>t(n(`/agent?runId=${e.id}`))},e.id))})})}function Zj({run:e,onClick:t}){let n=Rj(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)(wk,{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:[`· `,Q_(e.started_at)]}),i>0&&(0,G.jsxs)(`span`,{children:[`· `,i.toLocaleString(),` tok`]}),e.model&&(0,G.jsxs)(`span`,{children:[`· `,e.model]})]})]})})}function Qj({skills:e}){let t=Nn(),n=ys(),r=[...e].sort((e,t)=>t.updated_at-e.updated_at);return(0,G.jsx)(Tj,{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:Q_(e.updated_at)})]},e.id))})})}function $j({entries:e}){let t=Nn(),n=ys();return(0,G.jsx)(Tj,{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?Q_(e.llm_updated_at):Q_(e.mechanical_updated_at)})]},e.path))})})}function eM(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 tM=`(min-width: 768px)`,nM=240,rM=360;function iM({master:e,detail:t,hasSelection:n,onCloseMobileDetail:r,railMinWidthPx:i=nM,railMaxWidthPx:a=rM,className:o,masterAriaLabel:s=`List`,detailAriaLabel:c=`Details`}){return eM(tM)?(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 aM({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 oM({searchPlaceholder:e=`Search...`,searchValue:t,onSearchChange:n,filters:r=[],filterValues:i={},onFilterChange:a,inputRef:o,count:s,className:c}){return(0,G.jsxs)(`div`,{className:J(`flex items-center gap-3 px-4 py-2.5 rounded-md bg-surface-container-low border border-[var(--ghost-border)]`,c),children:[(0,G.jsx)(no,{className:`h-4 w-4 text-on-surface-variant shrink-0`}),(0,G.jsx)(Kf,{ref:o,placeholder:e,value:t,onChange:e=>n(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1 min-w-[200px]`,"aria-label":e}),r.map(e=>(0,G.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,G.jsxs)(c_,{value:i[e.key]??`all`,onValueChange:t=>a?.(e.key,t),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:e.label})}),(0,G.jsx)(d_,{children:e.options.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})},e.key)),s!=null&&(0,G.jsx)(`span`,{className:`myco-eyebrow-sm shrink-0`,children:s})]})}var sM=Us(`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(sM({level:t,interactive:n,ghostBorder:r,glass:i,glow:a,accent:o}),e),...s}));Q.displayName=`Surface`;var cM={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)]`},lM={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`},uM=(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&&cM[e],n&&!t&&lM[e],a),...c,children:o})});uM.displayName=`Row`;function dM({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)(Lf,{open:e,onOpenChange:t,children:(0,G.jsxs)(Vf,{className:`sm:max-w-md border border-outline-variant/20 [&>button:last-child]:hidden`,children:[(0,G.jsxs)(Hf,{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)(Wf,{children:n})]}),(0,G.jsx)(Gf,{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)(Uf,{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 fM({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 pM=3e5;function mM(){return ot({queryKey:xs([`symbionts`]),queryFn:({signal:e})=>q(`/symbionts`,{signal:e}),staleTime:pM})}function hM(e,t,n){let r=e.find(e=>e.name===t);return r?.resumeCommand?r.resumeCommand.replace(`{sessionId}`,n):null}var gM={released:`released`,merged_unreleased:`merged`,not_on_release_line:`feature`,unknown:`unknown`,unreconciled:`unreconciled`},_M={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`},vM={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`},yM={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 bM(e){let t=[gM[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 xM({annotation:e,className:t}){if(!e)return null;let n=gM[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`,_M[e.state]??_M.unknown,t),title:bM(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 SM({annotation:e,className:t}){if(!e)return null;let n=vM[e.state]??vM.unknown,r=yM[e.state]??yM.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:bM(e),"aria-label":`Release: ${bM(e)}`,role:`img`})}var CM=[`ACTIVE`,`TODAY`,`YESTERDAY`,`EARLIER`];function wM(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 CM)l[e].length>0&&u.push({label:e,rows:l[e]});return u}function TM(e){return!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey}function EM({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===`/`&&TM(n)&&i?.current){n.preventDefault(),i.current.focus();return}if(TM(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 DM=5;function OM(e){return e===`active`?`sage`:e===`completed`?`outline`:`ochre`}var kM=(0,W.forwardRef)(function({session:e,symbiontDisplayName:t,isSelected:n,isCursor:r,onClick:i,onDelete:a},o){let s=e.title||tv(e.id);return(0,G.jsxs)(uM,{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)(wk,{tone:OM(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)(SM,{annotation:e.release_state}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:Q_(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)(jj,{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 AM(){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 jM({selectedId:e,search:t,statusFilter:n,agentFilter:r,hasPlanFilter:i,offset:a,onOffsetChange:o,filterInputRef:s}){let c=Nn(),l=An(),[u,d]=(0,W.useState)(null),f=SA(),{data:p}=wA(u?.id??null),{data:m}=mM(),h=(0,W.useMemo)(()=>{let e=new Map;for(let t of m?.symbionts??[])e.set(t.name,t.displayName);return t=>t?e.get(t)??t:`unknown`},[m]),{data:g,isLoading:_,isError:v,error:y}=_A({limit:50,offset:a,status:n,agent:r,hasPlan:i,search:t});function b(){u&&f.mutate(u.id,{onSuccess:()=>d(null)})}let x=g?.sessions??[],S=g?.total??0,C=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(C.current)return;let t=new URLSearchParams(l.search);t.has(`status`)||t.has(`agent`)||t.has(`has_plan`)||!e&&!_&&x.length>0&&(C.current=!0,c(`/sessions/${x[0].id}`,{replace:!0}))},[e,_,x,c,l.search]);let w=EM({items:x,getId:e=>e.id,selectedId:e,onActivate:e=>c(`/sessions/${e}`),filterInputRef:s}),T=x.filter(e=>e.status===`active`).length,E=x.reduce((e,t)=>e+(t.prompt_count??0),0),D=(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:S.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:T.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:E.toLocaleString()}),` PROMPTS`]})]})]});return v?(0,G.jsxs)(`div`,{children:[D,(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:y instanceof Error?y.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{children:[D,_?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsx)(`div`,{role:`list`,"aria-label":`Session archive loading`,children:Array.from({length:DM}).map((e,t)=>(0,G.jsx)(AM,{},t))})}):x.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:S===0&&!t&&!n&&!r?`No sessions yet`:`No matching sessions`}),S===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`,{...w.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=wM(x,{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)(kM,{ref:w.setRowRef(r),session:t,symbiontDisplayName:h(t.agent),isSelected:e===t.id,isCursor:w.cursorIndex===r,onClick:()=>c(`/sessions/${t.id}`),onDelete:()=>d(t)},t.id)})]},t.label))})()})}),(0,G.jsx)(fM,{total:S,offset:a,limit:50,onPageChange:o}),(0,G.jsx)(dM,{open:u!==null,onOpenChange:e=>{e||d(null)},title:`Delete Session`,description:`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:tv(u.id)},{label:`Title`,value:u.title||tv(u.id)}]:[],impact:p?[{label:`Prompts`,value:p.promptCount},{label:`Spores`,value:p.sporeCount},{label:`Attachments`,value:p.attachmentCount},{label:`Graph Edges`,value:p.graphEdgeCount}]:[],confirmLabel:`Delete Session`,variant:`destructive`,onConfirm:b,isPending:f.isPending})]})}function MM({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 NM({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 PM=new Set([`Read`,`read`]);function FM(e){return e.canopy_injection_tokens===null?!1:PM.has(e.tool_name)}function IM({sessionId:e,toolCallId:t}){let{data:n,isLoading:r,isError:i,error:a}=_j(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 LM({sessionId:e,activity:t}){let[n,r]=(0,W.useState)(!1);if(!FM(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)(Lf,{open:n,onOpenChange:r,children:(0,G.jsxs)(Vf,{className:`max-w-2xl`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Canopy injection blob`}),(0,G.jsx)(Gf,{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)(IM,{sessionId:e,toolCallId:t.id})]})})]})}var RM=3;function zM({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)(LM,{sessionId:e.session_id,activity:e}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:av(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 BM({batchId:e,activityCount:t}){let[n,r]=(0,W.useState)(!1),{data:i,isLoading:a}=bA(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,RM)}).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)(zM,{activity:e},e.id))})]})})]})}var VM=`h-7 w-7`;function HM(e){return new Date(e*1e3).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function UM(e){return e?e.length>120?e.slice(0,120)+`…`:e:`(no prompt)`}function WM({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:HM(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)(BM,{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)(fO,{content:e.response_summary})]})]})}function GM(){if(typeof window>`u`)return;let e=window.__MYCO_AUTH__;return typeof e==`string`&&e.length>0?e:void 0}async function KM(e){let t=new Headers,n=GM();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 qM(e,t){return Vo(t?`/api/g/${t.grove.id}/p/${t.project.project_id}/attachments/${e}`:`/api/attachments/${e}`)}function JM(e){let t=gs(),[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=>KM(qM(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 YM({filePath:e,alt:t,className:n,loading:r=`lazy`}){let[i]=JM([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 XM({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=JM(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(VM,`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:HM(e.started_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface truncate`,children:o?e.user_prompt??`(no prompt)`:UM(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)(fO,{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)(YM,{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)(NM,{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)(BM,{batchId:e.id,activityCount:e.activity_count}),n.map(e=>(0,G.jsx)(WM,{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)(fO,{content:e.response_summary})]})]})})]})})]})]})}var ZM=3;function QM(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 $M=[`human`],eN=[`human`,`system`,`agent_dispatch`,`hook_injected`];function tN({sessionId:e}){let[t,n]=(0,W.useState)(!1),{data:r,isLoading:i}=yA(e,t?eN:$M),{data:a}=xA(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)(()=>QM([...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:ZM}).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)(XM,{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 nN=`▲`,rN=`▼`;function iN(e){let t=(e.match(/- \[x\]/gi)??[]).length;return{total:t+(e.match(/- \[ \]/g)??[]).length,checked:t}}var aN={active:`bg-green-500/10 text-green-500`,completed:`bg-blue-500/10 text-blue-500`},oN=`bg-muted text-muted-foreground`;function sN({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`,aN[e]??oN),children:e})}function cN({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:ev(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 lN({plan:e,initialExpanded:t=!1,isDeleting:n=!1,onDelete:r}){let[i,a]=(0,W.useState)(t),o=(0,W.useMemo)(()=>e.content?iN(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)(sN,{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)(cN,{planId:e.id}),(0,G.jsxs)(`span`,{children:[`Created `,Q_(e.created_at)]}),e.updated_at&&e.updated_at!==e.created_at&&(0,G.jsxs)(`span`,{title:$_(e.updated_at),children:[`Updated `,Q_(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?nN:rN})]})]}),i&&e.content&&(0,G.jsx)(`div`,{className:`border-t border-border px-4 py-3`,children:(0,G.jsx)(fO,{content:e.content,className:`text-sm`})})]})}function uN({sessionId:e,expandedPlanId:t}){let{data:n,isLoading:r,isError:i}=TA(e),a=EA(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)(lN,{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)(dM,{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 dN=15e3,fN=3e4,pN=3e4,mN=6e4;function hN(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 Ts({queryKey:[`spores`,e],queryFn:({signal:e})=>q(r,{signal:e}),staleTime:dN,pollCategory:`standard`,refetchInterval:Es.SPORES})}function gN(e){return ot({queryKey:xs([`spore`,e]),queryFn:({signal:t})=>q(`/spores/${e}`,{signal:t}),enabled:e!==void 0,staleTime:fN})}function _N(e,t=1,n=!0){return ot({queryKey:xs([`graph`,e,t]),queryFn:({signal:n})=>q(`/graph/${e}?depth=${t}`,{signal:n}),enabled:n&&e!==void 0,staleTime:pN})}function vN(e=!0){return ot({queryKey:xs([`full-graph`]),queryFn:({signal:e})=>q(`/graph`,{signal:e}),enabled:e,staleTime:pN})}function yN(){return ot({queryKey:xs([`graph-seeds`]),queryFn:({signal:e})=>q(`/graph/seeds`,{signal:e}),staleTime:pN})}function bN(e){let t=e?`/digest?agent_id=${encodeURIComponent(e)}`:`/digest`;return ot({queryKey:xs([`digest`,e]),queryFn:({signal:e})=>q(t,{signal:e}),staleTime:mN})}var xN=200,SN={decision:`default`,discovery:`default`,wisdom:`default`,architecture:`default`,trade_off:`secondary`,"cross-cutting":`secondary`,pattern:`secondary`,gotcha:`destructive`,bug_fix:`destructive`},CN={active:`default`,superseded:`outline`,consolidated:`outline`,obsolete:`outline`};function wN({spore:e}){let[t,n]=(0,W.useState)(!1),r=SN[e.observation_type]??`secondary`,i=CN[e.status]??`outline`,a=e.status!==`active`,o=e.content.split(`
84
+ `).find(e=>e.trim().length>0)?.replace(/^#+\s*/,``)??``;return(0,G.jsxs)(Q,{level:`low`,className:J(`rounded-md border border-outline-variant/20 transition-colors`,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)(fO,{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:$_(e.created_at),children:[`Created `,Q_(e.created_at)]}),(0,G.jsxs)(`span`,{title:$_(e.updated_at),children:[`Last updated `,Q_(e.updated_at)]})]})]})]})}function TN({sessionId:e,className:t}){let{data:n,isPending:r,isError:i}=hN({session_id:e,limit:xN});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)(wN,{spore:e},e.id))})}var EN=`/cortex?tab=canopy`,DN=1e3,ON=1e6;function kN(e){let t=e<0?`-`:``,n=Math.abs(e);return n>=ON?`${t}${(n/ON).toFixed(1)}M`:n>=DN*10?`${t}${Math.round(n/DN)}k`:n>=DN?`${t}${(n/DN).toFixed(1)}k`:`${t}${n.toLocaleString()}`}function AN(e){return e===null?`—`:e.toLocaleString()}function jN({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 MN({sessionId:e,fixture:t,className:n}){let[r,i]=(0,W.useState)(!1),a=t!==void 0,{data:o,isLoading:s}=cj(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=oj(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":`${kN(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:kN(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)(Lf,{open:r,onOpenChange:i,children:(0,G.jsxs)(Vf,{className:`max-w-md`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Canopy: Reads saved this session`}),(0,G.jsx)(Gf,{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":`${kN(l)} net tokens saved on Reads`,children:kN(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)(jN,{label:`Injections offered`,value:AN(u),hint:`PreToolUse Read events where Canopy injected anatomy.`}),(0,G.jsx)(jN,{label:`Skipped after injection`,value:AN(d),hint:`Files the agent did not Read after seeing the injected blob.`}),(0,G.jsx)(jN,{label:`Read anyway`,value:AN(f),hint:`Files the agent Read in full after the injection.`}),(0,G.jsx)(jN,{label:`Injection cost`,value:m===null?`—`:`${kN(m)} tok`,hint:`Sum of tokens spent on Canopy injections this session.`}),p!==null&&p>0&&(0,G.jsx)(jN,{label:`Redundant reads`,value:AN(p),hint:`Files Read more than once in this session (informational).`}),(0,G.jsx)(jN,{label:`Map calls`,value:h.toLocaleString(),hint:`Times the agent called canopy_map() during this session.`})]}),(0,G.jsx)(ri,{to:EN,onClick:()=>i(!1),className:`inline-block mt-4 font-mono text-xs text-sage hover:underline`,children:`Learn more about Canopy →`})]})})]})}function NN(e){return e===`active`?`active`:e===`completed`?`completed`:`error`}var PN={active:`bg-primary`,completed:`bg-secondary`,error:`bg-tertiary`},FN={active:`bg-primary/15 text-primary`,completed:`bg-surface-container-high text-on-surface-variant`,error:`bg-tertiary/15 text-tertiary`};function IN({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-block h-2 w-2 rounded-full shrink-0`,PN[NN(e)])})}function LN({status:e}){let t=NN(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`,FN[t]),children:[(0,G.jsx)(IN,{status:e}),n]})}function RN(e){return e===null?`—`:Z_(new Date(e*1e3).toISOString())}var zN=1500;function BN({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),zN)},[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 VN({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 HN({id:e}){let t=Nn(),{data:n,isLoading:r,isError:i,error:a}=vA(e),{data:o}=mM(),s=WA(),c=CA(),[l,u]=(0,W.useState)(`idle`),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`tab`);return e===`plans`?`plans`:e===`spores`?`spores`:`conversation`}),[h]=(0,W.useState)(()=>new URLSearchParams(window.location.search).get(`plan`)),g=SA(),{data:_}=wA(d?e:null),{data:v}=TA(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 y=o?hM(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??tv(n.id)}),(0,G.jsx)(LN,{status:n.status}),(0,G.jsx)(xM,{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 `,RN(n.started_at)]}),n.ended_at&&(0,G.jsxs)(`span`,{children:[`Duration: `,iv(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)(Nj,{label:`Prompts`,value:String(n.prompt_count),tone:`sage`}),(0,G.jsx)(Nj,{label:`Tool Calls`,value:String(n.tool_count),tone:`sage`}),(0,G.jsx)(Nj,{label:`Plans`,value:String(v?.length??0)}),(0,G.jsx)(MN,{sessionId:e})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-4 overflow-hidden`,children:[(0,G.jsx)(MM,{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)(BN,{label:`Session ID`,value:e,copyable:!0}),y&&(0,G.jsx)(BN,{label:`Resume`,value:y,copyable:!0,code:!0}),n.parent_session_id&&(0,G.jsx)(BN,{label:`Parent`,value:n.parent_session_id}),n.parent_session_reason&&(0,G.jsx)(BN,{label:`Reason`,value:n.parent_session_reason,mono:!1}),n.project_root&&(0,G.jsx)(BN,{label:`Project`,value:n.project_root})]})]}),n.summary&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 overflow-hidden`,children:[(0,G.jsx)(MM,{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)(VN,{label:`Conversation`,value:`conversation`,activeTab:p,onClick:m}),(0,G.jsx)(VN,{label:`Plans`,value:`plans`,activeTab:p,onClick:m}),(0,G.jsx)(VN,{label:`Spores`,value:`spores`,activeTab:p,onClick:m})]}),p===`conversation`&&(0,G.jsx)(tN,{sessionId:e}),p===`plans`&&(0,G.jsx)(uN,{sessionId:e,expandedPlanId:h}),p===`spores`&&(0,G.jsx)(TN,{sessionId:e})]}),(0,G.jsx)(dM,{open:d,onOpenChange:f,title:`Delete Session`,description:`This will permanently remove this session and all related data. This action cannot be undone.`,icon:(0,G.jsx)(ho,{className:`h-4 w-4 text-tertiary`}),meta:n?[{label:`ID`,value:tv(n.id)},{label:`Title`,value:n.title||tv(n.id)}]:[],impact:_?[{label:`Prompts`,value:_.promptCount},{label:`Spores`,value:_.sporeCount},{label:`Attachments`,value:_.attachmentCount},{label:`Graph Edges`,value:_.graphEdgeCount}]:[],confirmLabel:`Delete Session`,variant:`destructive`,onConfirm:()=>{g.mutate(n.id,{onSuccess:()=>{f(!1),t(`/sessions`)}})},isPending:g.isPending})]})}var UN=300;function WN(e,t=UN){let[n,r]=(0,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function GN({initialFilters:e}){let[t,n]=(0,W.useState)(``),r=WN(t),[i,a]=(0,W.useState)(e),[o,s]=(0,W.useState)(0),c=(0,W.useCallback)((e,t)=>{a(n=>({...n,[e]:t})),s(0)},[]),l=(0,W.useCallback)(e=>{n(e),s(0)},[]),u=(0,W.useCallback)(e=>{let t=i[e];return t&&t!==`all`?t:void 0},[i]);return{searchInput:t,debouncedSearch:r.length>0?r:void 0,filterValues:i,offset:o,setOffset:s,handleSearchChange:l,handleFilterChange:c,activeFilter:u}}var KN={key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:`active`,label:`Active`},{value:`completed`,label:`Completed`}]},qN={key:`has_plan`,label:`Plans`,options:[{value:`all`,label:`All sessions`},{value:`true`,label:`With a plan`}]};function JN(){let{id:e}=Ln(),t=Nn(),[n]=di(),r=(0,W.useRef)(null),i=(0,W.useMemo)(()=>({status:n.get(`status`)??`all`,agent:n.get(`agent`)??`all`,has_plan:n.get(`has_plan`)===`true`?`true`:`all`}),[n]),{searchInput:a,debouncedSearch:o,filterValues:s,offset:c,setOffset:l,handleSearchChange:u,handleFilterChange:d,activeFilter:f}=GN({initialFilters:i});(0,W.useEffect)(()=>{for(let[e,t]of Object.entries(i))s[e]!==t&&d(e,t)},[i]);let{data:p}=mM(),m=(0,W.useMemo)(()=>[KN,{key:`agent`,label:`Symbiont`,options:[{value:`all`,label:`All symbionts`},...(p?.symbionts??[]).filter(e=>e.enabled).map(e=>({value:e.name,label:e.displayName}))]},qN],[p]),h=f(`status`),g=f(`agent`),_=f(`has_plan`)===`true`;return(0,G.jsxs)(`div`,{className:`flex flex-col h-full gap-4 p-4`,children:[(0,G.jsx)(oM,{searchPlaceholder:`Search sessions...`,searchValue:a,onSearchChange:u,filters:m,filterValues:s,onFilterChange:d,inputRef:r}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,G.jsx)(iM,{hasSelection:!!e,onCloseMobileDetail:()=>t(`..`),masterAriaLabel:`Sessions`,detailAriaLabel:`Session details`,master:(0,G.jsx)(jM,{selectedId:e,search:o,statusFilter:h,agentFilter:g,hasPlanFilter:_,offset:c,onOffsetChange:l,filterInputRef:r}),detail:e?(0,G.jsx)(HN,{id:e}):(0,G.jsx)(aM,{message:`Select a session to see its details.`})})})]})}function YN({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 XN({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 ZN=(0,W.createContext)(null);function QN({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)(ZN.Provider,{value:a,children:e})}function $N(){let e=(0,W.useContext)(ZN);if(!e)throw Error(`useRestartGate must be inside RestartGateProvider`);return e}function eP(){return(0,W.useContext)(ZN)?.markDirty??(()=>{})}function tP(){let{dirty:e,clear:t}=$N(),{restart:n,isRestarting:r}=Rs();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 nP({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)(dk,{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 rP={machine:`machine`,grove:`grove`,project:`project`,local:`personal`};function iP({path:e,label:t,hint:n,requiresRestart:r,commitOn:i=`change`,parse:a,children:o}){let{effective:s,local:c,setField:l,resetField:u}=LO(),d=eP(),f=ak(e),p=f.overridableBy.includes(`local`),m=f.home,h=SO(s??{},e),g=p&&SO(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)(pk,{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=rP[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)(nP,{label:t,hint:n,scope:E?void 0:D,scopeIndicator:E,error:x??void 0,children:o({value:v,onChange:w,onBlur:T})})})}var aP=200,oP={1500:`T1500 — Compact`,5e3:`T5000 — Standard`,1e4:`T10000 — Full`};function sP(e){return oP[e]??`T${e}`}function cP({tier:e}){let[t,n]=(0,W.useState)(!1),r=e.content.length>aP,i=r&&!t?e.content.slice(0,aP)+`…`: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:sP(e.tier)}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Generated `,Q_(e.generated_at)]})]}),(0,G.jsx)(fO,{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-aP,` more chars)`]})})]})}function lP(){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 uP({agentId:e}){let{data:t,isLoading:n,isError:r,error:i}=bN(e),a=t?.tiers??[];return n?(0,G.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,G.jsx)(lP,{},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)(cP,{tier:e},e.tier))]})}var dP=6,fP=[{value:`all`,label:`All`},{value:`yes`,label:`Yes`},{value:`no`,label:`No`}],pP=[{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`}],mP=[{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 hP(e){if(e===`yes`)return!0;if(e===`no`)return!1}function gP(e){return(0,G.jsx)(X,{variant:e?`default`:`secondary`,children:e?`Yes`:`No`})}function _P({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)(c_,{value:t,onValueChange:r,children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{})}),(0,G.jsx)(d_,{children:n.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})})]})}function vP({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 yP(){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 bP({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:gP(e.llm_description!==null)}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:gP(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:ov(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 xP({selectedPath:e,onSelectPath:t}){let{searchInput:n,debouncedSearch:r,filterValues:i,offset:a,setOffset:o,handleSearchChange:s,handleFilterChange:c,activeFilter:l}=GN({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}=uj((0,W.useMemo)(()=>({limit:50,offset:a,language:l(`language`),described:hP(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)(Kf,{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)(_P,{label:`Language`,value:i.language??`all`,options:pP,onValueChange:e=>c(`language`,e)}),(0,G.jsx)(_P,{label:`Described`,value:i.described??`all`,options:fP,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:mP.map((e,t)=>{let n=[(0,G.jsx)(vP,{sortKey:e.id,activeSort:u,activeDir:f,onSort:m,children:e.label},e.id)];return e.id===`language`&&n.push((0,G.jsx)(vP,{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:dP}).map((e,t)=>(0,G.jsx)(yP,{},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)(bP,{entry:n,selected:n.path===e,onClick:()=>t(n.path)},n.path))})]})}),(0,G.jsx)(fM,{total:b,offset:a,limit:50,onPageChange:o})]})}function SP({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 CP(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function wP(e){return e.length>12?`${e.slice(0,12)}…`:e}function TP({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 EP({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 DP(){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 OP({path:e,onBack:t,onClose:n}){let{data:r,isPending:i,isError:a,error:o}=dj(e),s=fj(),c=pj(),[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)(()=>CP(r?.exports_json??null),[r?.exports_json]),v=(0,W.useMemo)(()=>CP(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)(SP,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsx)(DP,{})});if(a)return(0,G.jsx)(SP,{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)(SP,{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)(SP,{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)(MM,{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)(MM,{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)(MM,{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)(MM,{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)(MM,{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)(MM,{children:`Metadata`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(TP,{label:`Tokens`,children:r.token_estimate.toLocaleString()}),(0,G.jsx)(TP,{label:`Lines`,children:r.line_count.toLocaleString()}),(0,G.jsxs)(TP,{label:`Size`,children:[r.size_bytes.toLocaleString(),` B`]}),(0,G.jsx)(TP,{label:`Hash`,children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(`code`,{title:r.content_hash,children:wP(r.content_hash)}),(0,G.jsx)(EP,{text:r.content_hash})]})}),(0,G.jsx)(TP,{label:`Indexed`,children:$_(r.mechanical_updated_at)}),(0,G.jsx)(TP,{label:`Described`,children:r.llm_updated_at===null?`—`:$_(r.llm_updated_at)})]})]})]})})}function kP({defaultPath:e}={}){let[t,n]=(0,W.useState)(e);return(0,G.jsxs)(`div`,{className:`relative space-y-6`,children:[(0,G.jsx)(xP,{selectedPath:t,onSelectPath:n}),t?(0,G.jsx)(OP,{path:t,onClose:()=>n(void 0)}):null]})}var AP={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 jP(){let e=hj(),t=gj(),[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?AP[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?$_(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)(MM,{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)(fO,{content:d.content})})})]})}var MP={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 NP(e,t){return e||(t<=2?2:t===3?3:4)}function PP({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`,MP[NP(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 FP({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 IP=[{id:`overview`,label:`Overview`},{id:`entries`,label:`Entries`},{id:`map`,label:`Map`}],LP=new Set(IP.map(e=>e.id)),RP=`section`,zP=[{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`}],BP=new Set(zP.map(e=>e.id)),VP=new Set([`completed`,`failed`,`skipped`]),HP=12,UP=140,WP=[{value:`1500`,label:`1.5K - Executive briefing`},{value:`5000`,label:`5K - Deep onboarding`},{value:`10000`,label:`10K - Full institutional`}];function GP(e){let t=new URLSearchParams(e).get(`tab`);return t&&BP.has(t)?t:`instructions`}function KP(e){let t=new URLSearchParams(e).get(RP);return t&&LP.has(t)?t:`overview`}function qP(e){return e?new Date(e*1e3).toLocaleString():`Not generated yet`}function JP(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 YP(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 XP(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=YP(e,`Target symbiont`),r=YP(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 ZP(e){switch(e){case`completed`:return`default`;case`failed`:return`destructive`;case`running`:return`warning`;default:return`secondary`}}function QP(e){return e===null?null:e?`Instructions included in prompt`:`Uses session-start instructions`}function $P(){return ot({queryKey:[`cortex-instructions`],queryFn:({signal:e})=>q(`/cortex/instructions`,{signal:e}),staleTime:6e4})}function eF(e){return Ts({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&&VP.has(t)?!1:Es.PROGRESS}})}function tF(){let e=An(),t=Nn(),n=GP(e.search),r=KP(e.search),i=(0,W.useCallback)(n=>{if(!BP.has(n))return;let r=new URLSearchParams(e.search);n===`instructions`?r.delete(`tab`):r.set(`tab`,n),n!==`canopy`&&r.delete(RP);let i=r.toString();t({pathname:e.pathname,search:i?`?${i}`:``},{replace:!0})},[e.pathname,e.search,t]),a=(0,W.useCallback)(n=>{if(!LP.has(n))return;let r=new URLSearchParams(e.search);r.set(`tab`,`canopy`),n===`overview`?r.delete(RP):r.set(RP,n);let i=r.toString();t({pathname:e.pathname,search:i?`?${i}`:``},{replace:!0})},[e.pathname,e.search,t]);return(0,G.jsxs)(bj,{children:[(0,G.jsx)(YN,{title:`Cortex`,subtitle:`Manage session-start context, prompt building, and digest access for connected symbionts.`}),(0,G.jsx)(PP,{tabs:zP.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:i,columns:4}),n===`digest`?(0,G.jsx)(oF,{}):n===`builder`?(0,G.jsx)(iF,{}):n===`canopy`?(0,G.jsx)(nF,{section:r,onSectionChange:a,searchParams:e.search}):(0,G.jsx)(rF,{})]})}function nF({section:e,onSectionChange:t,searchParams:n}){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(FP,{tabs:IP.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)(kP,{defaultPath:e},e??`no-path`)})():e===`map`?(0,G.jsx)(jP,{}):(0,G.jsx)(cF,{})]})}function rF(){let{effective:e,isLoading:t}=LO(),n=$P(),[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 ts(`/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)(wj,{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)(wj,{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)(iP,{path:ji.instructions.injectOnSessionStart,label:`Managed instructions`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(iP,{path:ji.digest.injectOnSessionStart,label:`Preferred digest`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{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)(iP,{path:ji.instructions.injectOnSubagentStart,label:`Subagent instructions`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{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)(iP,{path:ji.spores.injectOnPromptSubmit,label:`Spore retrieval`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(iP,{path:ji.spores.maxPerPrompt,label:`Max spores`,children:({value:e,onChange:t})=>(0,G.jsx)(Kf,{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)(wj,{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?` — ${JP(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: `,qP(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)(fO,{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 iF(){let e=PA({task:`cortex-prompt-builder`,limit:HP}),{data:t}=mM(),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=eF(s?.runId??null),m=eF(l),h=(0,W.useMemo)(()=>(e.data?.runs??[]).map(e=>({run:e,parsed:XP(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 ts(`/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)(MM,{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)(c_,{value:a,onValueChange:o,children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:`Choose a symbiont`})}),(0,G.jsx)(d_,{children:n.map(e=>(0,G.jsx)(f_,{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:ZP(p.data?.status??`running`),children:p.data?.status??`running`}),QP(s.inlineInstructions)?(0,G.jsx)(X,{variant:`secondary`,children:QP(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&&VP.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)(MM,{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:ZP(e.status),children:e.status}),QP(t.inlineInstructions)?(0,G.jsx)(X,{variant:`secondary`,children:QP(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:ev(t.goal||`Untitled build request`,UP)}),(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 `,ov(e.started_at)]}),(0,G.jsxs)(`span`,{children:[`Run `,tv(e.id)]}),e.completed_at?(0,G.jsxs)(`span`,{children:[`Duration `,iv(e.started_at,e.completed_at)]}):null]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>u(e.id),children:`View Details`}),(0,G.jsx)(`a`,{href:`/agent?run=${e.id}`,className:`inline-flex h-8 items-center justify-center rounded-md border border-[var(--ghost-border)] px-3 font-sans text-xs font-medium text-on-surface transition-all hover:bg-surface-container-high`,children:`Open Run`})]})]})},e.id))})]}),(0,G.jsx)(Lf,{open:l!==null,onOpenChange:e=>{e||u(null)},children:(0,G.jsxs)(Vf,{className:`max-w-4xl max-h-[90vh] overflow-y-auto`,children:[(0,G.jsxs)(Hf,{children:[(0,G.jsx)(Wf,{children:`Prompt Build Details`}),(0,G.jsx)(Gf,{children:`Review the generated prompt, task reports, and jump to the full agent run when you need deeper diagnostics.`})]}),l?(0,G.jsx)(aF,{runId:l,runInstruction:g?.run.instruction??null,result:m.data,isLoading:m.isLoading,isFetching:m.isFetching,onRefresh:()=>void m.refetch()}):null]})})]})}function aF({runId:e,runInstruction:t,result:n,isLoading:r,isFetching:i,onRefresh:a}){let o=(0,W.useMemo)(()=>XP(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:ZP(n?.status),children:n?.status??`loading`}),(0,G.jsxs)(X,{variant:`secondary`,children:[`Run `,tv(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,QP(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:`/agent?run=${e}`,className:`inline-flex h-8 items-center justify-center rounded-md border border-[var(--ghost-border)] px-3 font-sans text-xs font-medium text-on-surface transition-all hover:bg-surface-container-high`,children:`Open Full Run`}),(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:a,disabled:i,children:i?`Refreshing...`:`Refresh`})]})]}),(0,G.jsxs)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5 space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Generated Prompt`}),n?.prompt?(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-sm text-on-surface`,children:n.prompt}):(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:n?.status===`failed`?n.error||`The prompt builder run failed before producing a prompt.`:`Waiting for the Myco agent to produce the prompt...`})]}),n?.reports?.length?(0,G.jsxs)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5 space-y-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Task Reports`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:n.reports.map(e=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.action}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:$_(e.created_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:e.summary})]},e.id))})]}):null]})}function oF(){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)(MM,{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)(iP,{path:ji.digest.tier,label:`Preferred digest tier`,children:({value:e,onChange:t})=>(0,G.jsxs)(c_,{value:String(e??5e3),onValueChange:e=>t(Number(e)),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{})}),(0,G.jsx)(d_,{children:WP.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})})]}),(0,G.jsx)(uP,{})]})}function sF({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)(Kf,{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 cF(){let{effective:e,isLoading:t}=LO(),{data:n}=RA(),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)(MM,{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)(iP,{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)(iP,{path:ji.canopy.exclude.patterns,label:`Your patterns`,children:({value:e,onChange:t})=>(0,G.jsx)(sF,{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)(iP,{path:ji.canopy.refresh.backgroundEnabled,label:`Periodic background scan`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(iP,{path:ji.canopy.refresh.backgroundPeriodMinutes,label:`Period (minutes)`,children:({value:e,onChange:t})=>(0,G.jsx)(Kf,{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)(MM,{children:`Injection`}),(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(iP,{path:ji.canopy.injectOnPreToolUse,label:`Inject canopy on Read`,children:({value:e,onChange:t})=>(0,G.jsx)(XN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(iP,{path:ji.canopy.minFileBytes,label:`Minimum file size (bytes)`,children:({value:e,onChange:t})=>(0,G.jsx)(Kf,{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)(MM,{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 lF(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 uF(e){if(Array.isArray(e))return e}function dF(e){if(Array.isArray(e))return lF(e)}function fF(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function pF(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,wF(r.key),r)}}function mF(e,t,n){return t&&pF(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function hF(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=EF(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 gF(e,t,n){return(t=wF(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _F(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function vF(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 yF(){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 bF(){throw TypeError(`Invalid attempt to spread non-iterable instance.
87
87
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xF(e,t){return uF(e)||vF(e,t)||EF(e,t)||yF()}function SF(e){return dF(e)||_F(e)||EF(e)||bF()}function CF(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}function wF(e){var t=CF(e,`string`);return typeof t==`symbol`?t:t+``}function TF(e){"@babel/helpers - typeof";return TF=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},TF(e)}function EF(e,t){if(e){if(typeof e==`string`)return lF(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lF(e,t):void 0}}var DF=typeof window>`u`?null:window,OF=DF?DF.navigator:null;DF&&DF.document;var kF=TF(``),AF=TF({}),jF=TF(function(){}),MF=typeof HTMLElement>`u`?`undefined`:TF(HTMLElement),NF=function(e){return e&&e.instanceString&&FF(e.instanceString)?e.instanceString():null},PF=function(e){return e!=null&&TF(e)==kF},FF=function(e){return e!=null&&TF(e)===jF},IF=function(e){return!VF(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},LF=function(e){return e!=null&&TF(e)===AF&&!IF(e)&&e.constructor===Object},RF=function(e){return e!=null&&TF(e)===AF},$=function(e){return e!=null&&TF(e)===TF(1)&&!isNaN(e)},zF=function(e){return $(e)&&Math.floor(e)===e},BF=function(e){if(MF!==`undefined`)return e!=null&&e instanceof HTMLElement},VF=function(e){return HF(e)||UF(e)},HF=function(e){return NF(e)===`collection`&&e._private.single},UF=function(e){return NF(e)===`collection`&&!e._private.single},WF=function(e){return NF(e)===`core`},GF=function(e){return NF(e)===`stylesheet`},KF=function(e){return NF(e)===`event`},qF=function(e){return e==null?!0:!!(e===``||e.match(/^\s+$/))},JF=function(e){return typeof HTMLElement>`u`?!1:e instanceof HTMLElement},YF=function(e){return LF(e)&&$(e.x1)&&$(e.x2)&&$(e.y1)&&$(e.y2)},XF=function(e){return RF(e)&&FF(e.then)},ZF=function(){return OF&&OF.userAgent.match(/msie|trident|edge/i)},QF=function(e,t){t||=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return`undefined`;for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join(`$`)};var n=function(){var r=this,i=arguments,a,o=t.apply(r,i),s=n.cache;return(a=s[o])||(a=s[o]=e.apply(r,i)),a};return n.cache={},n},$F=QF(function(e){return e.replace(/([A-Z])/g,function(e){return`-`+e.toLowerCase()})}),eI=QF(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),tI=QF(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+`$`+t}),nI=function(e){return qF(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},rI=function(e,t){return e.slice(-1*t.length)===t},iI=`(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))`,aI=`rgb[a]?\\((`+iI+`[%]?)\\s*,\\s*(`+iI+`[%]?)\\s*,\\s*(`+iI+`[%]?)(?:\\s*,\\s*(`+iI+`))?\\)`,oI=`rgb[a]?\\((?:`+iI+`[%]?)\\s*,\\s*(?:`+iI+`[%]?)\\s*,\\s*(?:`+iI+`[%]?)(?:\\s*,\\s*(?:`+iI+`))?\\)`,sI=`hsl[a]?\\((`+iI+`)\\s*,\\s*(`+iI+`[%])\\s*,\\s*(`+iI+`[%])(?:\\s*,\\s*(`+iI+`))?\\)`,cI=`hsl[a]?\\((?:`+iI+`)\\s*,\\s*(?:`+iI+`[%])\\s*,\\s*(?:`+iI+`[%])(?:\\s*,\\s*(?:`+iI+`))?\\)`,lI=`\\#[0-9a-fA-F]{3}`,uI=`\\#[0-9a-fA-F]{6}`,dI=function(e,t){return e<t?-1:+(e>t)},fI=function(e,t){return-1*dI(e,t)},pI=Object.assign==null?function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e}:Object.assign.bind(Object),mI=function(e){if(!(!(e.length===4||e.length===7)||e[0]!==`#`)){var t=e.length===4,n,r,i,a=16;return t?(n=parseInt(e[1]+e[1],a),r=parseInt(e[2]+e[2],a),i=parseInt(e[3]+e[3],a)):(n=parseInt(e[1]+e[2],a),r=parseInt(e[3]+e[4],a),i=parseInt(e[5]+e[6],a)),[n,r,i]}},hI=function(e){var t,n,r,i,a,o,s,c;function l(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var u=RegExp(`^`+sI+`$`).exec(e);if(u){if(n=parseInt(u[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,r=parseFloat(u[2]),r<0||r>100||(r/=100,i=parseFloat(u[3]),i<0||i>100)||(i/=100,a=u[4],a!==void 0&&(a=parseFloat(a),a<0||a>1)))return;if(r===0)o=s=c=Math.round(i*255);else{var d=i<.5?i*(1+r):i+r-i*r,f=2*i-d;o=Math.round(255*l(f,d,n+1/3)),s=Math.round(255*l(f,d,n)),c=Math.round(255*l(f,d,n-1/3))}t=[o,s,c,a]}return t},gI=function(e){var t,n=RegExp(`^`+aI+`$`).exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if(a[a.length-1]===`%`&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var c=n[4];if(c!==void 0){if(c=parseFloat(c),c<0||c>1)return;t.push(c)}}return t},_I=function(e){return yI[e.toLowerCase()]},vI=function(e){return(IF(e)?e:null)||_I(e)||mI(e)||gI(e)||hI(e)},yI={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},bI=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(LF(a))throw Error(`Tried to set map with object key`);i<n.length-1?(t[a]??(t[a]={}),t=t[a]):t[a]=e.value}},xI=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(LF(a))throw Error(`Tried to get map with object key`);if(t=t[a],t==null)return t}return t},SI=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function CI(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var wI,TI;function EI(){if(TI)return wI;TI=1;function e(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}return wI=e,wI}var DI,OI;function kI(){return OI?DI:(OI=1,DI=typeof SI==`object`&&SI&&SI.Object===Object&&SI,DI)}var AI,jI;function MI(){if(jI)return AI;jI=1;var e=kI(),t=typeof self==`object`&&self&&self.Object===Object&&self;return AI=e||t||Function(`return this`)(),AI}var NI,PI;function FI(){if(PI)return NI;PI=1;var e=MI();return NI=function(){return e.Date.now()},NI}var II,LI;function RI(){if(LI)return II;LI=1;var e=/\s/;function t(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}return II=t,II}var zI,BI;function VI(){if(BI)return zI;BI=1;var e=RI(),t=/^\s+/;function n(n){return n&&n.slice(0,e(n)+1).replace(t,``)}return zI=n,zI}var HI,UI;function WI(){return UI?HI:(UI=1,HI=MI().Symbol,HI)}var GI,KI;function qI(){if(KI)return GI;KI=1;var e=WI(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch{}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}return GI=a,GI}var JI,YI;function XI(){if(YI)return JI;YI=1;var e=Object.prototype.toString;function t(t){return e.call(t)}return JI=t,JI}var ZI,QI;function $I(){if(QI)return ZI;QI=1;var e=WI(),t=qI(),n=XI(),r=`[object Null]`,i=`[object Undefined]`,a=e?e.toStringTag:void 0;function o(e){return e==null?e===void 0?i:r:a&&a in Object(e)?t(e):n(e)}return ZI=o,ZI}var eL,tL;function nL(){if(tL)return eL;tL=1;function e(e){return typeof e==`object`&&!!e}return eL=e,eL}var rL,iL;function aL(){if(iL)return rL;iL=1;var e=$I(),t=nL(),n=`[object Symbol]`;function r(r){return typeof r==`symbol`||t(r)&&e(r)==n}return rL=r,rL}var oL,sL;function cL(){if(sL)return oL;sL=1;var e=VI(),t=EI(),n=aL(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function c(c){if(typeof c==`number`)return c;if(n(c))return r;if(t(c)){var l=typeof c.valueOf==`function`?c.valueOf():c;c=t(l)?l+``:l}if(typeof c!=`string`)return c===0?c:+c;c=e(c);var u=a.test(c);return u||o.test(c)?s(c.slice(2),u?2:8):i.test(c)?r:+c}return oL=c,oL}var lL,uL;function dL(){if(uL)return lL;uL=1;var e=EI(),t=FI(),n=cL(),r=`Expected a function`,i=Math.max,a=Math.min;function o(o,s,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof o!=`function`)throw TypeError(r);s=n(s)||0,e(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?i(n(c.maxWait)||0,s):d,v=`trailing`in c?!!c.trailing:v);function y(e){var t=l,n=u;return l=u=void 0,h=e,f=o.apply(n,t),f}function b(e){return h=e,p=setTimeout(C,s),g?y(e):f}function x(e){var t=e-m,n=e-h,r=s-t;return _?a(r,d-n):r}function S(e){var t=e-m,n=e-h;return m===void 0||t>=s||t<0||_&&n>=d}function C(){var e=t();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(t())}function D(){var e=t(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,s),y(m)}return p===void 0&&(p=setTimeout(C,s)),f}return D.cancel=T,D.flush=E,D}return lL=o,lL}var fL=CI(dL()),pL=DF?DF.performance:null,mL=pL&&pL.now?function(){return pL.now()}:function(){return Date.now()},hL=function(){if(DF){if(DF.requestAnimationFrame)return function(e){DF.requestAnimationFrame(e)};if(DF.mozRequestAnimationFrame)return function(e){DF.mozRequestAnimationFrame(e)};if(DF.webkitRequestAnimationFrame)return function(e){DF.webkitRequestAnimationFrame(e)};if(DF.msRequestAnimationFrame)return function(e){DF.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(mL())},1e3/60)}}(),gL=function(e){return hL(e)},_L=mL,vL=9261,yL=65599,bL=5381,xL=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:vL,n;n=e.next(),!n.done;)t=t*yL+n.value|0;return t},SL=function(e){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:vL)*yL+e|0},CL=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bL;return(t<<5)+t+e|0},wL=function(e,t){return e*2097152+t},TL=function(e){return e[0]*2097152+e[1]},EL=function(e,t){return[SL(e[0],t[0]),CL(e[1],t[1])]},DL=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return xL({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},OL=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return xL({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},kL=function(){return AL(arguments)},AL=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=n===0?OL(r):OL(r,t)}return t};function jL(e,t,n,r,i){var a=i*Math.PI/180;return{x:Math.cos(a)*(e-n)-Math.sin(a)*(t-r)+n,y:Math.sin(a)*(e-n)+Math.cos(a)*(t-r)+r}}var ML=function(e,t,n,r,i,a){return{x:(e-n)*i+n,y:(t-r)*a+r}};function NL(e,t,n){if(n===0)return e;var r=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,a=t.w/t.h,o=1/a,s=jL(e.x,e.y,r,i,n),c=ML(s.x,s.y,r,i,a,o);return{x:c.x,y:c.y}}var PL=!0,FL=console.warn!=null,IL=console.trace!=null,LL=2**53-1||9007199254740991,RL=function(){return!0},zL=function(){return!1},BL=function(){return 0},VL=function(){},HL=function(e){throw Error(e)},UL=function(e){if(e!==void 0)PL=!!e;else return PL},WL=function(e){UL()&&(FL?console.warn(e):(console.log(e),IL&&console.trace()))},GL=function(e){return pI({},e)},KL=function(e){return e==null?e:IF(e)?e.slice():LF(e)?GL(e):e},qL=function(e){return e.slice()},JL=function(e,t){for(t=e=``;e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):`-`);return t},YL={},XL=function(){return YL},ZL=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=n?.[a];r[a]=o===void 0?e[a]:o}return r}},QL=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},$L=function(e){e.splice(0,e.length)},eR=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},tR=function(e,t,n){return n&&(t=tI(n,t)),e[t]},nR=function(e,t,n,r){n&&(t=tI(n,t)),e[t]=r},rR=typeof Map<`u`?Map:function(){function e(){fF(this,e),this._obj={}}return mF(e,[{key:`set`,value:function(e,t){return this._obj[e]=t,this}},{key:`delete`,value:function(e){return this._obj[e]=void 0,this}},{key:`clear`,value:function(){this._obj={}}},{key:`has`,value:function(e){return this._obj[e]!==void 0}},{key:`get`,value:function(e){return this._obj[e]}}])}(),iR=`undefined`,aR=function(){function e(t){if(fF(this,e),this._obj=Object.create(null),this.size=0,t!=null)for(var n=t.instanceString!=null&&t.instanceString()===this.instanceString()?t.toArray():t,r=0;r<n.length;r++)this.add(n[r])}return mF(e,[{key:`instanceString`,value:function(){return`set`}},{key:`add`,value:function(e){var t=this._obj;t[e]!==1&&(t[e]=1,this.size++)}},{key:`delete`,value:function(e){var t=this._obj;t[e]===1&&(t[e]=0,this.size--)}},{key:`clear`,value:function(){this._obj=Object.create(null)}},{key:`has`,value:function(e){return this._obj[e]===1}},{key:`toArray`,value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}},{key:`forEach`,value:function(e,t){return this.toArray().forEach(e,t)}}])}(),oR=(typeof Set>`u`?`undefined`:TF(Set))===iR?aR:Set,sR=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!WF(e)){HL(`An element must have a core reference and parameters set`);return}var r=t.group;if(r??=t.data&&t.data.source!=null&&t.data.target!=null?`edges`:`nodes`,r!==`nodes`&&r!==`edges`){HL("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?r===`edges`:!!t.pannable,active:!1,classes:new oR,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x??(i.position.x=0),i.position.y??(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var c=[];IF(t.classes)?c=t.classes:PF(t.classes)&&(c=t.classes.split(/\s+/));for(var l=0,u=c.length;l<u;l++){var d=c[l];!d||d===``||i.classes.add(d)}this.createEmitter(),(n===void 0||n)&&this.restore();var f=t.style||t.css;f&&(WL("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(f))},cR=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;LF(t)&&!VF(t)&&(i=t,t=i.roots||i.root,n=i.visit,r=i.directed),r=arguments.length===2&&!FF(n)?n:r,n=FF(n)?n:function(){};for(var a=this._private.cy,o=t=PF(t)?this.filter(t):t,s=[],c=[],l={},u={},d={},f=0,p,m=this.byGroup(),h=m.nodes,g=m.edges,_=0;_<o.length;_++){var v=o[_],y=v.id();v.isNode()&&(s.unshift(v),e.bfs&&(d[y]=!0,c.push(v)),u[y]=0)}for(var b=function(){var t=e.bfs?s.shift():s.pop(),i=t.id();if(e.dfs){if(d[i])return 0;d[i]=!0,c.push(t)}var a=u[i],o=l[i],m=o==null?null:o.source(),_=o==null?null:o.target(),v=o==null?void 0:t.same(m)?_[0]:m[0],y=n(t,o,v,f++,a);if(y===!0)return p=t,1;if(y===!1)return 1;for(var b=t.connectedEdges().filter(function(e){return(!r||e.source().same(t))&&g.has(e)}),x=0;x<b.length;x++){var S=b[x],C=S.connectedNodes().filter(function(e){return!e.same(t)&&h.has(e)}),w=C.id();C.length!==0&&!d[w]&&(C=C[0],s.push(C),e.bfs&&(d[w]=!0,c.push(C)),l[w]=S,u[w]=u[i]+1)}},x;s.length!==0&&(x=b(),!(x!==0&&x===1)););for(var S=a.collection(),C=0;C<c.length;C++){var w=c[C],T=l[w.id()];T!=null&&S.push(T),S.push(w)}return{path:a.collection(S),found:a.collection(p)}}},lR={breadthFirstSearch:cR({bfs:!0}),depthFirstSearch:cR({dfs:!0})};lR.bfs=lR.breadthFirstSearch,lR.dfs=lR.depthFirstSearch;var uR={exports:{}},dR=uR.exports,fR;function pR(){return fR?uR.exports:(fR=1,(function(e,t){(function(){var t,n,r=Math.floor,i,a,o,s,c,l,u=Math.min,d,f,p,m,h;n=function(e,t){return e<t?-1:+(e>t)},l=function(e,t,i,a,o){var s;if(i??=0,o??=n,i<0)throw Error(`lo must be non-negative`);for(a??=e.length;i<a;)s=r((i+a)/2),o(t,e[s])<0?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return r??=n,e.push(t),m(e,0,e.length-1,r)},a=function(e,t){var r,i;return t??=n,r=e.pop(),e.length?(i=e[0],e[0]=r,h(e,0,t)):i=r,i},c=function(e,t,r){var i;return r??=n,i=e[0],e[0]=t,h(e,0,r),i},s=function(e,t,r){var i;return r??=n,e.length&&r(e[0],t)<0&&(i=[e[0],t],t=i[0],e[0]=i[1],h(e,0,r)),t},i=function(e,t){var i,a,o,s,c,l;for(t??=n,s=(function(){l=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)l.push(t);return l}).apply(this).reverse(),c=[],a=0,o=s.length;a<o;a++)i=s[a],c.push(h(e,i,t));return c},p=function(e,t,r){var i;if(r??=n,i=e.indexOf(t),i!==-1)return m(e,0,i,r),h(e,i,r)},d=function(e,t,r){var a,o,c,l,u;if(r??=n,o=e.slice(0,t),!o.length)return o;for(i(o,r),u=e.slice(t),c=0,l=u.length;c<l;c++)a=u[c],s(o,a,r);return o.sort(r).reverse()},f=function(e,t,r){var o,s,c,d,f,p,m,h,g;if(r??=n,t*10<=e.length){if(c=e.slice(0,t).sort(r),!c.length)return c;for(s=c[c.length-1],m=e.slice(t),d=0,p=m.length;d<p;d++)o=m[d],r(o,s)<0&&(l(c,o,0,null,r),c.pop(),s=c[c.length-1]);return c}for(i(e,r),g=[],f=0,h=u(t,e.length);0<=h?f<h:f>h;0<=h?++f:--f)g.push(a(e,r));return g},m=function(e,t,r,i){var a,o,s;for(i??=n,a=e[r];r>t;){if(s=r-1>>1,o=e[s],i(a,o)<0){e[r]=o,r=s;continue}break}return e[r]=a},h=function(e,t,r){var i,a,o,s,c;for(r??=n,a=e.length,c=t,o=e[t],i=2*t+1;i<a;)s=i+1,s<a&&!(r(e[i],e[s])<0)&&(i=s),e[t]=e[i],t=i,i=2*t+1;return e[t]=o,m(e,c,t,r)},t=(function(){e.push=o,e.pop=a,e.replace=c,e.pushpop=s,e.heapify=i,e.updateItem=p,e.nlargest=d,e.nsmallest=f;function e(e){this.cmp=e??n,this.nodes=[]}return e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return this.nodes.indexOf(e)!==-1},e.prototype.replace=function(e){return c(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return this.nodes.length===0},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t=new e;return t.nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e})(),(function(t,n){return e.exports=n()})(this,function(){return t})}).call(dR)})(uR),uR.exports)}var mR,hR;function gR(){return hR?mR:(hR=1,mR=pR(),mR)}var _R=CI(gR()),vR=ZL({root:null,weight:function(e){return 1},directed:!1}),yR={dijkstra:function(e){if(!LF(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=vR(e),r=n.root,i=n.weight,a=n.directed,o=this,s=i,c=PF(r)?this.filter(r)[0]:r[0],l={},u={},d={},f=this.byGroup(),p=f.nodes,m=f.edges;m.unmergeBy(function(e){return e.isLoop()});for(var h=function(e){return l[e.id()]},g=function(e,t){l[e.id()]=t,_.updateItem(e)},_=new _R(function(e,t){return h(e)-h(t)}),v=0;v<p.length;v++){var y=p[v];l[y.id()]=y.same(c)?0:1/0,_.push(y)}for(var b=function(e,t){for(var n=(a?e.edgesTo(t):e.edgesWith(t)).intersect(m),r=1/0,i,o=0;o<n.length;o++){var c=n[o],l=s(c);(l<r||!i)&&(r=l,i=c)}return{edge:i,dist:r}};_.size()>0;){var x=_.pop(),S=h(x),C=x.id();if(d[C]=S,S!==1/0)for(var w=x.neighborhood().intersect(p),T=0;T<w.length;T++){var E=w[T],D=E.id(),O=b(x,E),k=S+O.dist;k<h(E)&&(g(E,k),u[D]={node:x,edge:O.edge})}}return{distanceTo:function(e){return d[(PF(e)?p.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=PF(e)?p.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);u[i];){var a=u[i];n.unshift(a.edge),n.unshift(a.node),r=a.node,i=r.id()}return o.spawn(n)}}}},bR={kruskal:function(e){e||=function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=Array(i),o=n,s=function(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t},c=0;c<i;c++)a[c]=this.spawn(n[c]);for(var l=r.sort(function(t,n){return e(t)-e(n)}),u=0;u<l.length;u++){var d=l[u],f=d.source()[0],p=d.target()[0],m=s(f),h=s(p),g=a[m],_=a[h];m!==h&&(o.merge(d),g.merge(_),a.splice(h,1))}return o}},xR=ZL({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),SR={aStar:function(e){var t=this.cy(),n=xR(e),r=n.root,i=n.goal,a=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var c=r.id(),l=i.id(),u={},d={},f={},p=new _R(function(e,t){return d[e.id()]-d[t.id()]}),m=new oR,h={},g={},_=function(e,t){p.push(e),m.add(t)},v,y,b=function(){v=p.pop(),y=v.id(),m.delete(y)},x=function(e){return m.has(e)};_(r,c),u[c]=0,d[c]=a(r);for(var S=0;p.size()>0;){if(b(),S++,y===l){for(var C=[],w=i,T=l,E=g[T];C.unshift(w),E!=null&&C.unshift(E),w=h[T],w!=null;)T=w.id(),E=g[T];return{found:!0,distance:u[y],path:this.spawn(C),steps:S}}f[y]=!0;for(var D=v._private.edges,O=0;O<D.length;O++){var k=D[O];if(this.hasElementWithId(k.id())&&!(o&&k.data(`source`)!==y)){var A=k.source(),j=k.target(),M=A.id()===y?j:A,N=M.id();if(this.hasElementWithId(N)&&!f[N]){var P=u[y]+s(k);if(!x(N)){u[N]=P,d[N]=P+a(M),_(M,N),h[N]=v,g[N]=k;continue}P<u[N]&&(u[N]=P,d[N]=P+a(M),h[N]=v,g[N]=k)}}}}return{found:!1,distance:void 0,path:void 0,steps:S}}},CR=ZL({weight:function(e){return 1},directed:!1}),wR={floydWarshall:function(e){for(var t=this.cy(),n=CR(e),r=n.weight,i=n.directed,a=r,o=this.byGroup(),s=o.nodes,c=o.edges,l=s.length,u=l*l,d=function(e){return s.indexOf(e)},f=function(e){return s[e]},p=Array(u),m=0;m<u;m++){var h=m%l;(m-h)/l===h?p[m]=0:p[m]=1/0}for(var g=Array(u),_=Array(u),v=0;v<c.length;v++){var y=c[v],b=y.source()[0],x=y.target()[0];if(b!==x){var S=d(b),C=d(x),w=S*l+C,T=a(y);if(p[w]>T&&(p[w]=T,g[w]=C,_[w]=y),!i){var E=C*l+S;!i&&p[E]>T&&(p[E]=T,g[E]=S,_[E]=y)}}}for(var D=0;D<l;D++)for(var O=0;O<l;O++)for(var k=O*l+D,A=0;A<l;A++){var j=O*l+A,M=D*l+A;p[k]+p[M]<p[j]&&(p[j]=p[k]+p[M],g[j]=g[k])}var N=function(e){return(PF(e)?t.filter(e):e)[0]},P=function(e){return d(N(e))};return{distance:function(e,t){var n=P(e),r=P(t);return p[n*l+r]},path:function(e,n){var r=P(e),i=P(n),a=f(r);if(r===i)return a.collection();if(g[r*l+i]==null)return t.collection();var o=t.collection(),s=r,c;for(o.merge(a);r!==i;)s=r,r=g[r*l+i],c=_[s*l+r],o.merge(c),o.merge(f(r));return o}}}},TR=ZL({weight:function(e){return 1},directed:!1,root:null}),ER={bellmanFord:function(e){var t=this,n=TR(e),r=n.weight,i=n.directed,a=n.root,o=r,s=this,c=this.cy(),l=this.byGroup(),u=l.edges,d=l.nodes,f=d.length,p=new rR,m=!1,h=[];a=c.collection(a)[0],u.unmergeBy(function(e){return e.isLoop()});for(var g=u.length,_=function(e){var t=p.get(e.id());return t||(t={},p.set(e.id(),t)),t},v=function(e){return(PF(e)?c.$(e):e)[0]},y=function(e){return _(v(e)).dist},b=function(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:a,r=v(e),i=[],o=r;;){if(o==null)return t.spawn();var c=_(o),l=c.edge,u=c.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;l!=null&&i.unshift(l),o=u}return s.spawn(i)},x=0;x<f;x++){var S=d[x],C=_(S);S.same(a)?C.dist=0:C.dist=1/0,C.pred=null,C.edge=null}for(var w=!1,T=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,w=!0)},E=1;E<f;E++){w=!1;for(var D=0;D<g;D++){var O=u[D],k=O.source(),A=O.target(),j=o(O),M=_(k),N=_(A);T(k,A,O,M,N,j),i||T(A,k,O,N,M,j)}if(!w)break}if(w)for(var P=[],F=0;F<g;F++){var I=u[F],L=I.source(),R=I.target(),ee=o(I),z=_(L).dist,B=_(R).dist;if(z+ee<B||!i&&B+ee<z)if(m||=(WL(`Graph contains a negative weight cycle for Bellman-Ford`),!0),e.findNegativeWeightCycles!==!1){var V=[];z+ee<B&&V.push(L),!i&&B+ee<z&&V.push(R);for(var H=V.length,te=0;te<H;te++){var ne=V[te],U=[ne];U.push(_(ne).edge);for(var re=_(ne).pred;U.indexOf(re)===-1;)U.push(re),U.push(_(re).edge),re=_(re).pred;U=U.slice(U.indexOf(re));for(var ie=U[0].id(),ae=0,oe=2;oe<U.length;oe+=2)U[oe].id()<ie&&(ie=U[oe].id(),ae=oe);U=U.slice(ae).concat(U.slice(0,ae)),U.push(U[0]);var se=U.map(function(e){return e.id()}).join(`,`);P.indexOf(se)===-1&&(h.push(s.spawn(U)),P.push(se))}}else break}return{distanceTo:y,pathTo:b,hasNegativeWeightCycle:m,negativeWeightCycles:h}}},DR=Math.sqrt(2),OR=function(e,t,n){n.length===0&&HL(`Karger-Stein must be run on a connected (sub)graph`);for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],c=n,l=c.length-1;l>=0;l--){var u=c[l],d=u[1],f=u[2];(t[d]===o&&t[f]===s||t[d]===s&&t[f]===o)&&c.splice(l,1)}for(var p=0;p<c.length;p++){var m=c[p];m[1]===s?(c[p]=m.slice(),c[p][1]=o):m[2]===s&&(c[p]=m.slice(),c[p][2]=o)}for(var h=0;h<t.length;h++)t[h]===s&&(t[h]=o);return c},kR=function(e,t,n,r){for(;n>r;)t=OR(Math.floor(Math.random()*t.length),e,t),n--;return t},AR={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var i=n.length,a=r.length,o=Math.ceil((Math.log(i)/Math.LN2)**2),s=Math.floor(i/DR);if(i<2){HL(`At least 2 nodes are required for Karger-Stein algorithm`);return}for(var c=[],l=0;l<a;l++){var u=r[l];c.push([l,n.indexOf(u.source()),n.indexOf(u.target())])}for(var d=1/0,f=[],p=Array(i),m=Array(i),h=Array(i),g=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},_=0;_<=o;_++){for(var v=0;v<i;v++)m[v]=v;var y=kR(m,c.slice(),i,s),b=y.slice();g(m,h);var x=kR(m,y,s,2),S=kR(h,b,s,2);x.length<=S.length&&x.length<d?(d=x.length,f=x,g(m,p)):S.length<=x.length&&S.length<d&&(d=S.length,f=S,g(h,p))}for(var C=this.spawn(f.map(function(e){return r[e[0]]})),w=this.spawn(),T=this.spawn(),E=p[0],D=0;D<p.length;D++){var O=p[D],k=n[D];O===E?w.merge(k):T.merge(k)}var A=function(t){var n=e.spawn();return t.forEach(function(t){n.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!C.contains(t)&&n.merge(t)})}),n};return{cut:C,components:[A(w),A(T)],partition1:w,partition2:T}}},jR=function(e){return{x:e.x,y:e.y}},MR=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},NR=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},PR=function(e){return{x:e[0],y:e[1]}},FR=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r},IR=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r},LR=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i},RR=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var c=e[s];a?isFinite(c)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var l=e.length,u=Math.floor(l/2);return l%2==0?(e[u-1+o]+e[u+o])/2:e[u+1+o]},zR=function(e){return Math.PI*e/180},BR=function(e,t){return Math.atan2(t,e)-Math.PI/2},VR=Math.log2||function(e){return Math.log(e)/Math.log(2)},HR=function(e){return e>0?1:e<0?-1:0},UR=function(e,t){return Math.sqrt(WR(e,t))},WR=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},GR=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},KR=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},qR=function(e,t,n,r){return{x:KR(e.x,t.x,n.x,r),y:KR(e.y,t.y,n.y,r)}},JR=function(e,t,n,r){var i={x:t.x-e.x,y:t.y-e.y},a=UR(e,t),o={x:i.x/a,y:i.y/a};return n??=0,r??=n*a,{x:e.x+o.x*r,y:e.y+o.y*r}},YR=function(e,t,n){return Math.max(e,Math.min(n,t))},XR=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},ZR=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},QR=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},$R=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},ez=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},tz=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},nz=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,r,i,a;if(t.length===1)n=r=i=a=t[0];else if(t.length===2)n=i=t[0],a=r=t[1];else if(t.length===4){var o=xF(t,4);n=o[0],r=o[1],i=o[2],a=o[3]}return e.x1-=a,e.x2+=r,e.y1-=n,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},rz=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},iz=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},az=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},oz=function(e,t){return az(e,t.x,t.y)},sz=function(e,t){return az(e,t.x1,t.y1)&&az(e,t.x2,t.y2)},cz=Math.hypot??function(e,t){return Math.sqrt(e*e+t*t)};function lz(e,t){if(e.length<3)throw Error(`Need at least 3 vertices`);var n=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},r=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},i=function(e,t){return{x:e.x*t,y:e.y*t}},a=function(e,t){return e.x*t.y-e.y*t.x},o=function(e){var t=cz(e.x,e.y);return t===0?{x:0,y:0}:{x:e.x/t,y:e.y/t}},s=function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return t/2},c=function(e,t,o,s){var c=r(t,e),l=r(s,o),u=a(c,l);return Math.abs(u)<1e-9?n(e,i(c,.5)):n(e,i(c,a(r(o,e),l)/u))},l=e.map(function(e){return{x:e.x,y:e.y}});s(l)<0&&l.reverse();for(var u=l.length,d=[],f=0;f<u;f++){var p=l[f],m=l[(f+1)%u],h=r(m,p),g=o({x:h.y,y:-h.x});d.push(g)}for(var _=d.map(function(e,r){return{p1:n(l[r],i(e,t)),p2:n(l[(r+1)%u],i(e,t))}}),v=[],y=0;y<u;y++){var b=_[(y-1+u)%u],x=_[y],S=c(b.p1,b.p2,x.p1,x.p2);v.push(S)}return v}function uz(e,t,n,r,i,a){var o=lz(Oz(e,t,n,r,i),a),s=XR();return o.forEach(function(e){return ez(s,e.x,e.y)}),s}var dz=function(e,t,n,r,i,a,o){var s=arguments.length>7&&arguments[7]!==void 0?arguments[7]:`auto`,c=s===`auto`?Fz(i,a):s,l=i/2,u=a/2;c=Math.min(c,l,u);var d=c!==l,f=c!==u,p;if(d){var m=n-l+c-o,h=r-u-o;if(p=Dz(e,t,n,r,m,h,n+l-c+o,h,!1),p.length>0)return p}if(f){var g=n+l+o;if(p=Dz(e,t,n,r,g,r-u+c-o,g,r+u-c+o,!1),p.length>0)return p}if(d){var _=n-l+c-o,v=r+u+o;if(p=Dz(e,t,n,r,_,v,n+l-c+o,v,!1),p.length>0)return p}if(f){var y=n-l-o;if(p=Dz(e,t,n,r,y,r-u+c-o,y,r+u-c+o,!1),p.length>0)return p}var b,x=n-l+c,S=r-u+c;if(b=Tz(e,t,n,r,x,S,c+o),b.length>0&&b[0]<=x&&b[1]<=S)return[b[0],b[1]];var C=n+l-c,w=r-u+c;if(b=Tz(e,t,n,r,C,w,c+o),b.length>0&&b[0]>=C&&b[1]<=w)return[b[0],b[1]];var T=n+l-c,E=r+u-c;if(b=Tz(e,t,n,r,T,E,c+o),b.length>0&&b[0]>=T&&b[1]>=E)return[b[0],b[1]];var D=n-l+c,O=r+u-c;return b=Tz(e,t,n,r,D,O,c+o),b.length>0&&b[0]<=D&&b[1]>=O?[b[0],b[1]]:[]},fz=function(e,t,n,r,i,a,o){var s=o,c=Math.min(n,i),l=Math.max(n,i),u=Math.min(r,a),d=Math.max(r,a);return c-s<=e&&e<=l+s&&u-s<=t&&t<=d+s},pz=function(e,t,n,r,i,a,o,s,c){var l={x1:Math.min(n,o,i)-c,x2:Math.max(n,o,i)+c,y1:Math.min(r,s,a)-c,y2:Math.max(r,s,a)+c};return!(e<l.x1||e>l.x2||t<l.y1||t>l.y2)},mz=function(e,t,n,r){n-=r;var i=t*t-4*e*n;if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},hz=function(e,t,n,r,i){e===0&&(e=1e-5),t/=e,n/=e,r/=e;var a,o=(3*n-t*t)/9,s=-(27*r)+t*(9*n-t*t*2),c,l,u,d,f;if(s/=54,a=o*o*o+s*s,i[1]=0,d=t/3,a>0){l=s+Math.sqrt(a),l=l<0?-((-l)**(1/3)):l**(1/3),u=s-Math.sqrt(a),u=u<0?-((-u)**(1/3)):u**(1/3),i[0]=-d+l+u,d+=(l+u)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-u+l)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,a===0){f=s<0?-((-s)**(1/3)):s**(1/3),i[0]=-d+2*f,i[4]=i[2]=-(f+d);return}o=-o,c=o*o*o,c=Math.acos(s/Math.sqrt(c)),f=2*Math.sqrt(o),i[0]=-d+f*Math.cos(c/3),i[2]=-d+f*Math.cos((c+2*Math.PI)/3),i[4]=-d+f*Math.cos((c+4*Math.PI)/3)},gz=function(e,t,n,r,i,a,o,s){var c=1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,l=9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,u=3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,d=1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,f=[];hz(c,l,u,d,f);for(var p=1e-7,m=[],h=0;h<6;h+=2)Math.abs(f[h+1])<p&&f[h]>=0&&f[h]<=1&&m.push(f[h]);m.push(1),m.push(0);for(var g=-1,_,v,y,b=0;b<m.length;b++)_=(1-m[b])**2*n+2*(1-m[b])*m[b]*i+m[b]*m[b]*o,v=(1-m[b])**2*r+2*(1-m[b])*m[b]*a+m[b]*m[b]*s,y=(_-e)**2+(v-t)**2,g>=0?y<g&&(g=y):g=y;return g},_z=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],c=s[0]*s[0]+s[1]*s[1],l=o[0]*o[0]+o[1]*o[1],u=o[0]*s[0]+o[1]*s[1],d=u*u/c;return u<0?l:d>c?(e-i)*(e-i)+(t-a)*(t-a):l-d},vz=function(e,t,n){for(var r,i,a,o,s,c=0,l=0;l<n.length/2;l++)if(r=n[l*2],i=n[l*2+1],l+1<n.length/2?(a=n[(l+1)*2],o=n[(l+1)*2+1]):(a=n[(l+1-n.length/2)*2],o=n[(l+1-n.length/2)*2+1]),!(r==e&&a==e))if(r>=e&&e>=a||r<=e&&e<=a)s=(e-r)/(a-r)*(o-i)+i,s>t&&c++;else continue;return c%2!=0},yz=function(e,t,n,r,i,a,o,s,c){var l=Array(n.length),u;s[0]==null?u=s:(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2);for(var d=Math.cos(-u),f=Math.sin(-u),p=0;p<l.length/2;p++)l[p*2]=a/2*(n[p*2]*d-n[p*2+1]*f),l[p*2+1]=o/2*(n[p*2+1]*d+n[p*2]*f),l[p*2]+=r,l[p*2+1]+=i;return vz(e,t,c>0?xz(Sz(l,-c)):l)},bz=function(e,t,n,r,i,a,o,s){for(var c=Array(n.length*2),l=0;l<s.length;l++){var u=s[l];if(c[l*4+0]=u.startX,c[l*4+1]=u.startY,c[l*4+2]=u.stopX,c[l*4+3]=u.stopY,(u.cx-e)**2+(u.cy-t)**2<=u.radius**2)return!0}return vz(e,t,c)},xz=function(e){for(var t=Array(e.length/2),n,r,i,a,o,s,c,l,u=0;u<e.length/4;u++){n=e[u*4],r=e[u*4+1],i=e[u*4+2],a=e[u*4+3],u<e.length/4-1?(o=e[(u+1)*4],s=e[(u+1)*4+1],c=e[(u+1)*4+2],l=e[(u+1)*4+3]):(o=e[0],s=e[1],c=e[2],l=e[3]);var d=Dz(n,r,i,a,o,s,c,l,!0);t[u*2]=d[0],t[u*2+1]=d[1]}return t},Sz=function(e,t){for(var n=Array(e.length*2),r,i,a,o,s=0;s<e.length/2;s++){r=e[s*2],i=e[s*2+1],s<e.length/2-1?(a=e[(s+1)*2],o=e[(s+1)*2+1]):(a=e[0],o=e[1]);var c=o-i,l=-(a-r),u=Math.sqrt(c*c+l*l),d=c/u,f=l/u;n[s*4]=r+d*t,n[s*4+1]=i+f*t,n[s*4+2]=a+d*t,n[s*4+3]=o+f*t}return n},Cz=function(e,t,n,r,i,a){var o=n-e,s=r-t;o/=i,s/=a;var c=Math.sqrt(o*o+s*s),l=c-1;if(l<0)return[];var u=l/c;return[(n-e)*u+e,(r-t)*u+t]},wz=function(e,t,n,r,i,a,o){return e-=i,t-=a,e/=n/2+o,t/=r/2+o,e*e+t*t<=1},Tz=function(e,t,n,r,i,a,o){var s=[n-e,r-t],c=[e-i,t-a],l=s[0]*s[0]+s[1]*s[1],u=2*(c[0]*s[0]+c[1]*s[1]),d=c[0]*c[0]+c[1]*c[1]-o*o,f=u*u-4*l*d;if(f<0)return[];var p=(-u+Math.sqrt(f))/(2*l),m=(-u-Math.sqrt(f))/(2*l),h=Math.min(p,m),g=Math.max(p,m),_=[];if(h>=0&&h<=1&&_.push(h),g>=0&&g<=1&&_.push(g),_.length===0)return[];var v=_[0]*s[0]+e,y=_[0]*s[1]+t;return _.length>1?_[0]==_[1]?[v,y]:[v,y,_[1]*s[0]+e,_[1]*s[1]+t]:[v,y]},Ez=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Dz=function(e,t,n,r,i,a,o,s,c){var l=e-i,u=n-e,d=o-i,f=t-a,p=r-t,m=s-a,h=d*f-m*l,g=u*f-p*l,_=m*u-d*p;if(_!==0){var v=h/_,y=g/_,b=.001,x=0-b,S=1+b;return x<=v&&v<=S&&x<=y&&y<=S||c?[e+v*u,t+v*p]:[]}else if(h===0||g===0)return Ez(e,n,o)===o?[o,s]:Ez(e,n,i)===i?[i,a]:Ez(i,o,n)===n?[n,r]:[];else return[]},Oz=function(e,t,n,r,i){var a=[],o=r/2,s=i/2,c=t,l=n;a.push({x:c+o*e[0],y:l+s*e[1]});for(var u=1;u<e.length/2;u++)a.push({x:c+o*e[u*2],y:l+s*e[u*2+1]});return a},kz=function(e,t,n,r,i,a,o,s){var c=[],l,u=Array(n.length),d=!0;a??(d=!1);var f;if(d){for(var p=0;p<u.length/2;p++)u[p*2]=n[p*2]*a+r,u[p*2+1]=n[p*2+1]*o+i;f=s>0?xz(Sz(u,-s)):u}else f=n;for(var m,h,g,_,v=0;v<f.length/2;v++)m=f[v*2],h=f[v*2+1],v<f.length/2-1?(g=f[(v+1)*2],_=f[(v+1)*2+1]):(g=f[0],_=f[1]),l=Dz(e,t,r,i,m,h,g,_),l.length!==0&&c.push(l[0],l[1]);return c},Az=function(e,t,n,r,i,a,o,s,c){var l=[],u,d=Array(n.length*2);c.forEach(function(n,a){a===0?(d[d.length-2]=n.startX,d[d.length-1]=n.startY):(d[a*4-2]=n.startX,d[a*4-1]=n.startY),d[a*4]=n.stopX,d[a*4+1]=n.stopY,u=Tz(e,t,r,i,n.cx,n.cy,n.radius),u.length!==0&&l.push(u[0],u[1])});for(var f=0;f<d.length/4;f++)u=Dz(e,t,r,i,d[f*4],d[f*4+1],d[f*4+2],d[f*4+3],!1),u.length!==0&&l.push(u[0],u[1]);if(l.length>2){for(var p=[l[0],l[1]],m=(p[0]-e)**2+(p[1]-t)**2,h=1;h<l.length/2;h++){var g=(l[h*2]-e)**2+(l[h*2+1]-t)**2;g<=m&&(p[0]=l[h*2],p[1]=l[h*2+1],m=g)}return p}return l},jz=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},Mz=function(e,t){var n=Pz(e,t);return n=Nz(n),n},Nz=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,c=0;c<r;c++)t=e[2*c],n=e[2*c+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var l=2/(o-i),u=2/(s-a),d=0;d<r;d++)t=e[2*d]=e[2*d]*l,n=e[2*d+1]=e[2*d+1]*u,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var f=0;f<r;f++)n=e[2*f+1]=e[2*f+1]+(-1-a);return e},Pz=function(e,t){var n=1/e*2*Math.PI,r=e%2==0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var i=Array(e*2),a,o=0;o<e;o++)a=o*n+r,i[2*o]=Math.cos(a),i[2*o+1]=Math.sin(-a);return i},Fz=function(e,t){return Math.min(e/4,t/4,8)},Iz=function(e,t){return Math.min(e/10,t/10,8)},Lz=function(){return 8},Rz=function(e,t,n){return[e-2*t+n,2*(t-e),e]},zz=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Bz(e,t){function n(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length],a={x:i.x-r.x,y:i.y-r.y},o={x:-a.y,y:a.x},s=Math.sqrt(o.x*o.x+o.y*o.y);t.push({x:o.x/s,y:o.y/s})}return t}function r(e,t){var n=1/0,r=-1/0,i=hF(e),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=o.x*t.x+o.y*t.y;n=Math.min(n,s),r=Math.max(r,s)}}catch(e){i.e(e)}finally{i.f()}return{min:n,max:r}}function i(e,t){return!(e.max<t.min||t.max<e.min)}var a=hF([].concat(SF(n(e)),SF(n(t)))),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;if(!i(r(e,s),r(t,s)))return!1}}catch(e){a.e(e)}finally{a.f()}return!0}var Vz=ZL({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Hz={pageRank:function(e){for(var t=Vz(e),n=t.dampingFactor,r=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),c=s.nodes,l=s.edges,u=c.length,d=u*u,f=l.length,p=Array(d),m=Array(u),h=(1-n)/u,g=0;g<u;g++){for(var _=0;_<u;_++){var v=g*u+_;p[v]=0}m[g]=0}for(var y=0;y<f;y++){var b=l[y],x=b.data(`source`),S=b.data(`target`);if(x!==S){var C=c.indexOfId(x),w=c.indexOfId(S),T=a(b),E=w*u+C;p[E]+=T,m[C]+=T}}for(var D=1/u+h,O=0;O<u;O++)if(m[O]===0)for(var k=0;k<u;k++){var A=k*u+O;p[A]=D}else for(var j=0;j<u;j++){var M=j*u+O;p[M]=p[M]/m[O]+h}for(var N=Array(u),P=Array(u),F,I=0;I<u;I++)N[I]=1;for(var L=0;L<i;L++){for(var R=0;R<u;R++)P[R]=0;for(var ee=0;ee<u;ee++)for(var z=0;z<u;z++){var B=ee*u+z;P[ee]+=p[B]*N[z]}GR(P),F=N,N=P,P=F;for(var V=0,H=0;H<u;H++){var te=F[H]-N[H];V+=te*te}if(V<r)break}return{rank:function(e){return e=o.collection(e)[0],N[c.indexOf(e)]}}}},Uz=ZL({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Wz={degreeCentralityNormalized:function(e){e=Uz(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,c=0;c<r;c++){var l=n[c],u=l.id();e.root=l;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),s<d.outdegree&&(s=d.outdegree),i[u]=d.indegree,a[u]=d.outdegree}return{indegree:function(e){return o==0?0:(PF(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return s===0?0:(PF(e)&&(e=t.filter(e)),a[e.id()]/s)}}}else{for(var f={},p=0,m=0;m<r;m++){var h=n[m];e.root=h;var g=this.degreeCentrality(e);p<g.degree&&(p=g.degree),f[h.id()]=g.degree}return{degree:function(e){return p===0?0:(PF(e)&&(e=t.filter(e)),f[e.id()]/p)}}}},degreeCentrality:function(e){e=Uz(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var c=i.connectedEdges(),l=c.filter(function(e){return e.target().same(i)&&n.has(e)}),u=c.filter(function(e){return e.source().same(i)&&n.has(e)}),d=l.length,f=u.length,p=0,m=0,h=0;h<l.length;h++)p+=a(l[h]);for(var g=0;g<u.length;g++)m+=a(u[g]);return{indegree:d**(1-s)*p**+s,outdegree:f**(1-s)*m**+s}}else{for(var _=i.connectedEdges().intersection(n),v=_.length,y=0,b=0;b<_.length;b++)y+=a(_[b]);return{degree:v**(1-s)*y**+s}}}};Wz.dc=Wz.degreeCentrality,Wz.dcn=Wz.degreeCentralityNormalised=Wz.degreeCentralityNormalized;var Gz=ZL({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Kz={closenessCentralityNormalized:function(e){for(var t=Gz(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,c=this.nodes(),l=this.floydWarshall({weight:r,directed:i}),u=0;u<c.length;u++){for(var d=0,f=c[u],p=0;p<c.length;p++)if(u!==p){var m=l.distance(f,c[p]);n?d+=1/m:d+=m}n||(d=1/d),s<d&&(s=d),o[f.id()]=d}return{closeness:function(e){return s==0?0:(e=PF(e)?a.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=Gz(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,c=this.nodes(),l=0;l<c.length;l++){var u=c[l];if(!u.same(n)){var d=o.distanceTo(u);a?s+=1/d:s+=d}}return a?s:1/s}};Kz.cc=Kz.closenessCentrality,Kz.ccn=Kz.closenessCentralityNormalised=Kz.closenessCentralityNormalized;var qz=ZL({weight:null,directed:!1}),Jz={betweennessCentrality:function(e){for(var t=qz(e),n=t.directed,r=t.weight,i=r!=null,a=this.cy(),o=this.nodes(),s={},c={},l=0,u={set:function(e,t){c[e]=t,t>l&&(l=t)},get:function(e){return c[e]}},d=0;d<o.length;d++){var f=o[d],p=f.id();n?s[p]=f.outgoers().nodes():s[p]=f.openNeighborhood().nodes(),u.set(p,0)}for(var m=function(){for(var e=o[h].id(),t=[],n={},c={},l={},d=new _R(function(e,t){return l[e]-l[t]}),f=0;f<o.length;f++){var p=o[f].id();n[p]=[],c[p]=0,l[p]=1/0}for(c[e]=1,l[e]=0,d.push(e);!d.empty();){var m=d.pop();if(t.push(m),i)for(var g=0;g<s[m].length;g++){var _=s[m][g],v=a.getElementById(m),y=void 0;y=v.edgesTo(_).length>0?v.edgesTo(_)[0]:_.edgesTo(v)[0];var b=r(y);_=_.id(),l[_]>l[m]+b&&(l[_]=l[m]+b,d.nodes.indexOf(_)<0?d.push(_):d.updateItem(_),c[_]=0,n[_]=[]),l[_]==l[m]+b&&(c[_]=c[_]+c[m],n[_].push(m))}else for(var x=0;x<s[m].length;x++){var S=s[m][x].id();l[S]==1/0&&(d.push(S),l[S]=l[m]+1),l[S]==l[m]+1&&(c[S]=c[S]+c[m],n[S].push(m))}}for(var C={},w=0;w<o.length;w++)C[o[w].id()]=0;for(;t.length>0;){for(var T=t.pop(),E=0;E<n[T].length;E++){var D=n[T][E];C[D]=C[D]+c[D]/c[T]*(1+C[T])}T!=o[h].id()&&u.set(T,u.get(T)+C[T])}},h=0;h<o.length;h++)m();var g={betweenness:function(e){var t=a.collection(e).id();return u.get(t)},betweennessNormalized:function(e){if(l==0)return 0;var t=a.collection(e).id();return u.get(t)/l}};return g.betweennessNormalised=g.betweennessNormalized,g}};Jz.bc=Jz.betweennessCentrality;var Yz=ZL({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),Xz=function(e){return Yz(e)},Zz=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},Qz=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},$z=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},eB=function(e,t,n){for(var r=Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},tB=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=eB(e,r,t);return e},nB=function(e,t,n){for(var r=Array(t*t),i=0;i<t*t;i++)r[i]=e[i]**+n;return $z(r,t),r},rB=function(e,t,n,r){for(var i=0;i<n;i++)if(Math.round(e[i]*10**r)/10**r!=Math.round(t[i]*10**r)/10**r)return!1;return!0},iB=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(e[a*t+s]*1e3)/1e3>0&&o.push(n[s]);o.length!==0&&i.push(r.collection(o))}return i},aB=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},oB=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&aB(e[t],e[n])&&e.splice(n,1);return e},sB=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=Xz(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s=t.length,c=s*s,l=Array(c),u,d=0;d<c;d++)l[d]=0;for(var f=0;f<n.length;f++){var p=n[f],m=a[p.source().id()],h=a[p.target().id()],g=Zz(p,i.attributes);l[m*s+h]+=g,l[h*s+m]+=g}Qz(l,s,i.multFactor),$z(l,s);for(var _=!0,v=0;_&&v<i.maxIterations;)_=!1,u=tB(l,s,i.expandFactor),l=nB(u,s,i.inflateFactor),rB(l,u,c,4)||(_=!0),v++;var y=iB(l,s,t,r);return y=oB(y),y},cB={markovClustering:sB,mcl:sB},lB=function(e){return e},uB=function(e,t){return Math.abs(t-e)},dB=function(e,t,n){return e+uB(t,n)},fB=function(e,t,n){return e+(n-t)**2},pB=function(e){return Math.sqrt(e)},mB=function(e,t,n){return Math.max(e,uB(t,n))},hB=function(e,t,n,r,i){for(var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:lB,o=r,s,c,l=0;l<e;l++)s=t(l),c=n(l),o=i(o,s,c);return a(o)},gB={euclidean:function(e,t,n){return e>=2?hB(e,t,n,0,fB,pB):hB(e,t,n,0,dB)},squaredEuclidean:function(e,t,n){return hB(e,t,n,0,fB)},manhattan:function(e,t,n){return hB(e,t,n,0,dB)},max:function(e,t,n){return hB(e,t,n,-1/0,mB)}};gB[`squared-euclidean`]=gB.squaredEuclidean,gB.squaredeuclidean=gB.squaredEuclidean;function _B(e,t,n,r,i,a){var o=FF(e)?e:gB[e]||gB.euclidean;return t===0&&FF(e)?o(i,a):o(t,n,r,i,a)}var vB=ZL({k:2,m:2,sensitivityThreshold:1e-4,distance:`euclidean`,maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),yB=function(e){return vB(e)},bB=function(e,t,n,r,i){var a=i===`kMedoids`?function(e){return r[e](n)}:function(e){return n[e]},o=function(e){return r[e](t)},s=n,c=t;return _B(e,r.length,a,o,s,c)},xB=function(e,t,n){for(var r=n.length,i=Array(r),a=Array(r),o=Array(t),s=null,c=0;c<r;c++)i[c]=e.min(n[c]).value,a[c]=e.max(n[c]).value;for(var l=0;l<t;l++){s=[];for(var u=0;u<r;u++)s[u]=Math.random()*(a[u]-i[u])+i[u];o[l]=s}return o},SB=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var c=bB(n,e,t[s],r,i);c<a&&(a=c,o=s)}return o},CB=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)i=t[a],n[i.id()]===e&&r.push(i);return r},wB=function(e,t,n){return Math.abs(t-e)<=n},TB=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)if(Math.abs(e[r][i]-t[r][i])>n)return!1;return!0},EB=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},DB=function(e,t){var n=Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];EB(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},OB=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=bB(`manhattan`,t[i],e,n,`kMedoids`);return r},kB=function(e){var t=this.cy(),n=this.nodes(),r=null,i=yB(e),a=Array(i.k),o={},s;i.testMode?typeof i.testCentroids==`number`?(i.testCentroids,s=xB(n,i.k,i.attributes)):s=TF(i.testCentroids)===`object`?i.testCentroids:xB(n,i.k,i.attributes):s=xB(n,i.k,i.attributes);for(var c=!0,l=0;c&&l<i.maxIterations;){for(var u=0;u<n.length;u++)r=n[u],o[r.id()]=SB(r,s,i.distance,i.attributes,`kMeans`);c=!1;for(var d=0;d<i.k;d++){var f=CB(d,n,o);if(f.length!==0){for(var p=i.attributes.length,m=s[d],h=Array(p),g=Array(p),_=0;_<p;_++){g[_]=0;for(var v=0;v<f.length;v++)r=f[v],g[_]+=i.attributes[_](r);h[_]=g[_]/f.length,wB(h[_],m[_],i.sensitivityThreshold)||(c=!0)}s[d]=h,a[d]=t.collection(f)}}l++}return a},AB=function(e){var t=this.cy(),n=this.nodes(),r=null,i=yB(e),a=Array(i.k),o,s={},c,l=Array(i.k);i.testMode?typeof i.testCentroids==`number`||(o=TF(i.testCentroids)===`object`?i.testCentroids:DB(n,i.k)):o=DB(n,i.k);for(var u=!0,d=0;u&&d<i.maxIterations;){for(var f=0;f<n.length;f++)r=n[f],s[r.id()]=SB(r,o,i.distance,i.attributes,`kMedoids`);u=!1;for(var p=0;p<o.length;p++){var m=CB(p,n,s);if(m.length!==0){l[p]=OB(o[p],m,i.attributes);for(var h=0;h<m.length;h++)c=OB(m[h],m,i.attributes),c<l[p]&&(l[p]=c,o[p]=m[h],u=!0);a[p]=t.collection(m)}}d++}return a},jB=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var c=0;c<e.length;c++)r[s][c]=n[s][c]**+i.m;for(var l=0;l<e.length;l++)for(var u=0;u<i.attributes.length;u++){a=0,o=0;for(var d=0;d<t.length;d++)a+=r[d][l]*i.attributes[u](t[d]),o+=r[d][l];e[l][u]=a/o}},MB=function(e,t,n,r,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,c,l=2/(i.m-1),u=0;u<n.length;u++)for(var d=0;d<r.length;d++){o=0;for(var f=0;f<n.length;f++)s=bB(i.distance,r[d],n[u],i.attributes,`cmeans`),c=bB(i.distance,r[d],n[f],i.attributes,`cmeans`),o+=(s/c)**+l;e[d][u]=1/o}},NB=function(e,t,n,r){for(var i=Array(n.k),a=0;a<i.length;a++)i[a]=[];for(var o,s,c=0;c<t.length;c++){o=-1/0,s=-1;for(var l=0;l<t[0].length;l++)t[c][l]>o&&(o=t[c][l],s=l);i[s].push(e[c])}for(var u=0;u<i.length;u++)i[u]=r.collection(i[u]);return i},PB=function(e){for(var t=this.cy(),n=this.nodes(),r=yB(e),i,a,o,s=Array(n.length),c,l=0;l<n.length;l++)s[l]=Array(r.k);o=Array(n.length);for(var u=0;u<n.length;u++)o[u]=Array(r.k);for(var d=0;d<n.length;d++){for(var f=0,p=0;p<r.k;p++)o[d][p]=Math.random(),f+=o[d][p];for(var m=0;m<r.k;m++)o[d][m]=o[d][m]/f}a=Array(r.k);for(var h=0;h<r.k;h++)a[h]=Array(r.attributes.length);c=Array(n.length);for(var g=0;g<n.length;g++)c[g]=Array(r.k);for(var _=!0,v=0;_&&v<r.maxIterations;)_=!1,jB(a,n,o,c,r),MB(o,s,a,n,r),TB(o,s,r.sensitivityThreshold)||(_=!0),v++;return i=NB(n,o,r,t),{clusters:i,degreeOfMembership:o}},FB={kMeans:kB,kMedoids:AB,fuzzyCMeans:PB,fcm:PB},IB=ZL({distance:`euclidean`,linkage:`min`,mode:`threshold`,threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),LB={single:`min`,complete:`max`},RB=function(e){var t=IB(e),n=LB[t.linkage];return n!=null&&(t.linkage=n),t},zB=function(e,t,n,r,i){for(var a=0,o=1/0,s,c=i.attributes,l=function(e,t){return _B(i.distance,c.length,function(t){return c[t](e)},function(e){return c[e](t)},e,t)},u=0;u<e.length;u++){var d=e[u].key,f=n[d][r[d]];f<o&&(a=d,o=f)}if(i.mode===`threshold`&&o>=i.threshold||i.mode===`dendrogram`&&e.length===1)return!1;var p=t[a],m=t[r[a]],h=i.mode===`dendrogram`?{left:p,right:m,key:p.key}:{value:p.value.concat(m.value),key:p.key};e[p.index]=h,e.splice(m.index,1),t[p.key]=h;for(var g=0;g<e.length;g++){var _=e[g];p.key===_.key?s=1/0:i.linkage===`min`?(s=n[p.key][_.key],n[p.key][_.key]>n[m.key][_.key]&&(s=n[m.key][_.key])):i.linkage===`max`?(s=n[p.key][_.key],n[p.key][_.key]<n[m.key][_.key]&&(s=n[m.key][_.key])):s=i.linkage===`mean`?(n[p.key][_.key]*p.size+n[m.key][_.key]*m.size)/(p.size+m.size):i.mode===`dendrogram`?l(_.value,p.value):l(_.value[0],p.value[0]),n[p.key][_.key]=n[_.key][p.key]=s}for(var v=0;v<e.length;v++){var y=e[v].key;if(r[y]===p.key||r[y]===m.key){for(var b=y,x=0;x<e.length;x++){var S=e[x].key;n[y][S]<n[y][b]&&(b=S)}r[y]=b}e[v].index=v}return p.key=m.key=p.index=m.index=null,!0},BB=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&BB(e.left,t),e.right&&BB(e.right,t)))},VB=function(e,t){if(!e)return``;if(e.left&&e.right){var n=VB(e.left,t),r=VB(e.right,t),i=t.add({group:`nodes`,data:{id:n+`,`+r}});return t.add({group:`edges`,data:{source:n,target:i.id()}}),t.add({group:`edges`,data:{source:r,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},HB=function(e,t,n){if(!e)return[];var r=[],i=[],a=[];return t===0?(e.left&&BB(e.left,r),e.right&&BB(e.right,i),a=r.concat(i),[n.collection(a)]):t===1?e.value?[n.collection(e.value)]:(e.left&&BB(e.left,r),e.right&&BB(e.right,i),[n.collection(r),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(r=HB(e.left,t-1,n)),e.right&&(i=HB(e.right,t-1,n)),r.concat(i))},UB=function(e){for(var t=this.cy(),n=this.nodes(),r=RB(e),i=r.attributes,a=function(e,t){return _B(r.distance,i.length,function(t){return i[t](e)},function(e){return i[e](t)},e,t)},o=[],s=[],c=[],l=[],u=0;u<n.length;u++){var d={value:r.mode===`dendrogram`?n[u]:[n[u]],key:u,index:u};o[u]=d,l[u]=d,s[u]=[],c[u]=0}for(var f=0;f<o.length;f++)for(var p=0;p<=f;p++){var m=void 0;m=r.mode===`dendrogram`?f===p?1/0:a(o[f].value,o[p].value):f===p?1/0:a(o[f].value[0],o[p].value[0]),s[f][p]=m,s[p][f]=m,m<s[f][c[f]]&&(c[f]=p)}for(var h=zB(o,l,s,c,r);h;)h=zB(o,l,s,c,r);var g;return r.mode===`dendrogram`?(g=HB(o[0],r.dendrogramDepth,t),r.addDendrogram&&VB(o[0],t)):(g=Array(o.length),o.forEach(function(e,n){e.key=e.index=null,g[n]=t.collection(e.value)})),g},WB={hierarchicalClustering:UB,hca:UB},GB=ZL({distance:`euclidean`,preference:`median`,damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),KB=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||HL(`Damping must range on [0.5, 1). Got: ${t}`);var r=[`median`,`mean`,`min`,`max`];return r.some(function(e){return e===n})||$(n)||HL(`Preference must be one of [${r.map(function(e){return`'${e}'`}).join(`, `)}] or a number. Got: ${n}`),GB(e)},qB=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-_B(e,r.length,function(e){return i(t,e)},function(e){return i(n,e)},t,n)},JB=function(e,t){var n=null;return n=t===`median`?RR(e):t===`mean`?LR(e):t===`min`?FR(e):t===`max`?IR(e):t,n},YB=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r},XB=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var c=n[s];t[i*e+c]>o&&(a=c,o=t[i*e+c])}a>0&&r.push(a)}for(var l=0;l<n.length;l++)r[n[l]]=n[l];return r},ZB=function(e,t,n){for(var r=XB(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,c=-1/0,l=0;l<a.length;l++){for(var u=0,d=0;d<a.length;d++)u+=t[a[d]*e+a[l]];u>c&&(s=l,c=u)}n[i]=a[s]}return r=XB(e,t,n),r},QB=function(e){for(var t=this.cy(),n=this.nodes(),r=KB(e),i={},a=0;a<n.length;a++)i[n[a].id()]=a;for(var o=n.length,s=o*o,c=Array(s),l,u,d,f=0;f<s;f++)c[f]=-1/0;for(var p=0;p<o;p++)for(var m=0;m<o;m++)p!==m&&(c[p*o+m]=qB(r.distance,n[p],n[m],r.attributes));l=JB(c,r.preference);for(var h=0;h<o;h++)c[h*o+h]=l;u=Array(s);for(var g=0;g<s;g++)u[g]=0;d=Array(s);for(var _=0;_<s;_++)d[_]=0;for(var v=Array(o),y=Array(o),b=Array(o),x=0;x<o;x++)v[x]=0,y[x]=0,b[x]=0;for(var S=Array(o*r.minIterations),C=0;C<S.length;C++)S[C]=0;var w;for(w=0;w<r.maxIterations;w++){for(var T=0;T<o;T++){for(var E=-1/0,D=-1/0,O=-1,k=0,A=0;A<o;A++)v[A]=u[T*o+A],k=d[T*o+A]+c[T*o+A],k>=E?(D=E,E=k,O=A):k>D&&(D=k);for(var j=0;j<o;j++)u[T*o+j]=(1-r.damping)*(c[T*o+j]-E)+r.damping*v[j];u[T*o+O]=(1-r.damping)*(c[T*o+O]-D)+r.damping*v[O]}for(var M=0;M<o;M++){for(var N=0,P=0;P<o;P++)v[P]=d[P*o+M],y[P]=Math.max(0,u[P*o+M]),N+=y[P];N-=y[M],y[M]=u[M*o+M],N+=y[M];for(var F=0;F<o;F++)d[F*o+M]=(1-r.damping)*Math.min(0,N-y[F])+r.damping*v[F];d[M*o+M]=(1-r.damping)*(N-y[M])+r.damping*v[M]}for(var I=0,L=0;L<o;L++){var R=+(d[L*o+L]+u[L*o+L]>0);S[w%r.minIterations*o+L]=R,I+=R}if(I>0&&(w>=r.minIterations-1||w==r.maxIterations-1)){for(var ee=0,z=0;z<o;z++){b[z]=0;for(var B=0;B<r.minIterations;B++)b[z]+=S[B*o+z];(b[z]===0||b[z]===r.minIterations)&&ee++}if(ee===o)break}}for(var V=YB(o,u,d),H=ZB(o,c,V),te={},ne=0;ne<V.length;ne++)te[V[ne]]=[];for(var U=0;U<n.length;U++){var re=H[i[n[U].id()]];re!=null&&te[re].push(n[U])}for(var ie=Array(V.length),ae=0;ae<V.length;ae++)ie[ae]=t.collection(te[V[ae]]);return ie},$B={affinityPropagation:QB,ap:QB},eV=ZL({root:void 0,directed:!1}),tV={hierholzer:function(e){if(!LF(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n=eV(e),r=n.root,i=n.directed,a=this,o=!1,s,c,l;r&&(l=PF(r)?this.filter(r)[0].id():r[0].id());var u={},d={};i?a.forEach(function(e){var t=e.id();if(e.isNode()){var n=e.indegree(!0),r=e.outdegree(!0),i=n-r,a=r-n;i==1?s?o=!0:s=t:a==1?c?o=!0:c=t:(a>1||i>1)&&(o=!0),u[t]=[],e.outgoers().forEach(function(e){e.isEdge()&&u[t].push(e.id())})}else d[t]=[void 0,e.target().id()]}):a.forEach(function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(s?c?o=!0:c=t:s=t),u[t]=[],e.connectedEdges().forEach(function(e){return u[t].push(e.id())})):d[t]=[e.source().id(),e.target().id()]});var f={found:!1,trail:void 0};if(o)return f;if(c&&s)if(i){if(l&&c!=l)return f;l=c}else if(l&&c!=l&&s!=l)return f;else l||=c;else l||=a[0].id();var p=function(e){for(var t=e,n=[e],r,a,o;u[t].length;)r=u[t].shift(),a=d[r][0],o=d[r][1],t==o?!i&&t!=a&&(u[a]=u[a].filter(function(e){return e!=r}),t=a):(u[o]=u[o].filter(function(e){return e!=r}),t=o),n.unshift(r),n.unshift(t);return n},m=[],h=[];for(h=p(l);h.length!=1;)u[h[0]].length==0?(m.unshift(a.getElementById(h.shift())),m.unshift(a.getElementById(h.shift()))):h=p(h.shift()).concat(h);for(var g in m.unshift(a.getElementById(h.shift())),u)if(u[g].length)return f;return f.found=!0,f.trail=this.spawn(m,!0),f}},nV=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){for(var o=a.length-1,s=[],c=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);c.merge(n),r.forEach(function(n){var r=n.id(),i=n.connectedEdges().intersection(e);c.merge(n),t[r].cutVertex?c.merge(i.filter(function(e){return e.isLoop()})):c.merge(i)})}),i.push(c)},c=function(l,u,d){l===d&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.size()===0)i.push(e.spawn(e.getElementById(u)));else{var p,m,h,g;f.forEach(function(e){p=e.source().id(),m=e.target().id(),h=p===u?m:p,h!==d&&(g=e.id(),o[g]||(o[g]=!0,a.push({x:u,y:h,edge:e})),h in t?t[u].low=Math.min(t[u].low,t[h].id):(c(l,h,u),t[u].low=Math.min(t[u].low,t[h].low),t[u].id<=t[h].low&&(t[u].cutVertex=!0,s(u,h))))})}};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(r=0,c(n,n),t[n].cutVertex=r>1)}});var l=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(l),components:i}},rV={hopcroftTarjanBiconnected:nV,htbc:nV,htb:nV,hopcroftTarjanBiconnectedComponents:nV},iV=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var c=e.spawn();;){var l=i.pop();if(c.merge(e.getElementById(l)),t[l].low=t[s].index,t[l].explored=!0,l===s)break}var u=c.edgesWith(c),d=c.merge(u);r.push(d),a=a.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},aV={tarjanStronglyConnected:iV,tsc:iV,tscc:iV,tarjanStronglyConnectedComponents:iV},oV={};[lR,yR,bR,SR,wR,ER,AR,Hz,Wz,Kz,Jz,cB,FB,WB,$B,tV,rV,aV].forEach(function(e){pI(oV,e)});var sV=0,cV=1,lV=2,uV=function(e){if(!(this instanceof uV))return new uV(e);this.id=`Thenable/1.0.7`,this.state=sV,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e==`function`&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};uV.prototype={fulfill:function(e){return dV(this,cV,`fulfillValue`,e)},reject:function(e){return dV(this,lV,`rejectReason`,e)},then:function(e,t){var n=this,r=new uV;return n.onFulfilled.push(mV(e,r,`fulfill`)),n.onRejected.push(mV(t,r,`reject`)),fV(n),r.proxy}};var dV=function(e,t,n,r){return e.state===sV&&(e.state=t,e[n]=r,fV(e)),e},fV=function(e){e.state===cV?pV(e,`onFulfilled`,e.fulfillValue):e.state===lV&&pV(e,`onRejected`,e.rejectReason)},pV=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};typeof setImmediate==`function`?setImmediate(i):setTimeout(i,0)}},mV=function(e,t,n){return function(r){if(typeof e!=`function`)t[n].call(t,r);else{var i;try{i=e(r)}catch(e){t.reject(e);return}hV(t,i)}}},hV=function(e,t){if(e===t||e.proxy===t){e.reject(TypeError(`cannot resolve promise with itself`));return}var n;if(TF(t)===`object`&&t!==null||typeof t==`function`)try{n=t.then}catch(t){e.reject(t);return}if(typeof n==`function`){var r=!1;try{n.call(t,function(n){r||(r=!0,n===t?e.reject(TypeError(`circular thenable chain`)):hV(e,n))},function(t){r||(r=!0,e.reject(t))})}catch(t){r||e.reject(t)}return}e.fulfill(t)};uV.all=function(e){return new uV(function(t,n){for(var r=Array(e.length),i=0,a=function(n,a){r[n]=a,i++,i===e.length&&t(r)},o=0;o<e.length;o++)(function(t){var r=e[t];r!=null&&r.then!=null?r.then(function(e){a(t,e)},function(e){n(e)}):a(t,r)})(o)})},uV.resolve=function(e){return new uV(function(t,n){t(e)})},uV.reject=function(e){return new uV(function(t,n){n(e)})};var gV=typeof Promise<`u`?Promise:uV,_V=function(e,t,n){var r=WF(e),i=!r,a=this._private=pI({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&FF(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(r){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},vV=_V.prototype;pI(vV,{instanceString:function(){return`animation`},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;t=e.queue?n.queue:n.current,t.push(this),VF(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];r!=null&&(e[t]=e[n],e[n]=r)};if(n(`zoom`,`startZoom`),n(`pan`,`startPan`),n(`position`,`startPosition`),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t=this._private,n;switch(e){case`frame`:n=t.frames;break;default:case`complete`:case`completed`:n=t.completes}return new gV(function(e,t){n.push(function(){e()})})}}),vV.complete=vV.completed,vV.run=vV.play,vV.running=vV.playing;var yV={animated:function(){return function(){var e=this,t=e.length===void 0?[e]:e;if(!(this._private.cy||this).styleEnabled())return!1;var n=t[0];if(n)return n._private.animation.current.length>0}},clearQueue:function(){return function(){var e=this,t=e.length===void 0?[e]:e;if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n<t.length;n++){var r=t[n];r._private.animation.queue=[]}return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=n.length!==void 0,i=r?n:[n],a=this._private.cy||this,o=!r,s=!o;if(!a.styleEnabled())return this;var c=a.style();if(e=pI({},e,t),Object.keys(e).length===0)return new _V(i[0],e);switch(e.duration===void 0&&(e.duration=400),e.duration){case`slow`:e.duration=600;break;case`fast`:e.duration=200;break}if(s&&(e.style=c.getPropsList(e.style||e.css),e.css=void 0),s&&e.renderedPosition!=null){var l=e.renderedPosition,u=a.pan(),d=a.zoom();e.position=NR(l,d,u)}if(o&&e.panBy!=null){var f=e.panBy,p=a.pan();e.pan={x:p.x+f.x,y:p.y+f.y}}var m=e.center||e.centre;if(o&&m!=null){var h=a.getCenterPan(m.eles,e.zoom);h!=null&&(e.pan=h)}if(o&&e.fit!=null){var g=e.fit,_=a.getFitViewport(g.eles||g.boundingBox,g.padding);_!=null&&(e.pan=_.pan,e.zoom=_.zoom)}if(o&&LF(e.zoom)){var v=a.getZoomedViewport(e.zoom);v==null?e.zoom=null:(v.zoomed&&(e.zoom=v.zoom),v.panned&&(e.pan=v.pan))}return new _V(i[0],e)}},animate:function(){return function(e,t){var n=this,r=n.length===void 0?[n]:n;if(!(this._private.cy||this).styleEnabled())return this;t&&(e=pI({},e,t));for(var i=0;i<r.length;i++){var a=r[i],o=a.animated()&&(e.queue===void 0||e.queue);a.animation(e,o?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=this,r=n.length===void 0?[n]:n,i=this._private.cy||this;if(!i.styleEnabled())return this;for(var a=0;a<r.length;a++){for(var o=r[a]._private,s=o.animation.current,c=0;c<s.length;c++){var l=s[c]._private;t&&(l.duration=0)}e&&(o.animation.queue=[]),t||(o.animation.current=[])}return i.notify(`draw`),this}}},bV,xV;function SV(){return xV?bV:(xV=1,bV=Array.isArray,bV)}var CV,wV;function TV(){if(wV)return CV;wV=1;var e=SV(),t=aL(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(i,a){if(e(i))return!1;var o=typeof i;return o==`number`||o==`symbol`||o==`boolean`||i==null||t(i)?!0:r.test(i)||!n.test(i)||a!=null&&i in Object(a)}return CV=i,CV}var EV,DV;function OV(){if(DV)return EV;DV=1;var e=$I(),t=EI(),n=`[object AsyncFunction]`,r=`[object Function]`,i=`[object GeneratorFunction]`,a=`[object Proxy]`;function o(o){if(!t(o))return!1;var s=e(o);return s==r||s==i||s==n||s==a}return EV=o,EV}var kV,AV;function jV(){return AV?kV:(AV=1,kV=MI()[`__core-js_shared__`],kV)}var MV,NV;function PV(){if(NV)return MV;NV=1;var e=jV(),t=function(){var t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||``);return t?`Symbol(src)_1.`+t:``}();function n(e){return!!t&&t in e}return MV=n,MV}var FV,IV;function LV(){if(IV)return FV;IV=1;var e=Function.prototype.toString;function t(t){if(t!=null){try{return e.call(t)}catch{}try{return t+``}catch{}}return``}return FV=t,FV}var RV,zV;function BV(){if(zV)return RV;zV=1;var e=OV(),t=PV(),n=EI(),r=LV(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=RegExp(`^`+c.call(l).replace(i,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function d(i){return!n(i)||t(i)?!1:(e(i)?u:a).test(r(i))}return RV=d,RV}var VV,HV;function UV(){if(HV)return VV;HV=1;function e(e,t){return e?.[t]}return VV=e,VV}var WV,GV;function KV(){if(GV)return WV;GV=1;var e=BV(),t=UV();function n(n,r){var i=t(n,r);return e(i)?i:void 0}return WV=n,WV}var qV,JV;function YV(){return JV?qV:(JV=1,qV=KV()(Object,`create`),qV)}var XV,ZV;function QV(){if(ZV)return XV;ZV=1;var e=YV();function t(){this.__data__=e?e(null):{},this.size=0}return XV=t,XV}var $V,eH;function tH(){if(eH)return $V;eH=1;function e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}return $V=e,$V}var nH,rH;function iH(){if(rH)return nH;rH=1;var e=YV(),t=`__lodash_hash_undefined__`,n=Object.prototype.hasOwnProperty;function r(r){var i=this.__data__;if(e){var a=i[r];return a===t?void 0:a}return n.call(i,r)?i[r]:void 0}return nH=r,nH}var aH,oH;function sH(){if(oH)return aH;oH=1;var e=YV(),t=Object.prototype.hasOwnProperty;function n(n){var r=this.__data__;return e?r[n]!==void 0:t.call(r,n)}return aH=n,aH}var cH,lH;function uH(){if(lH)return cH;lH=1;var e=YV(),t=`__lodash_hash_undefined__`;function n(n,r){var i=this.__data__;return this.size+=+!this.has(n),i[n]=e&&r===void 0?t:r,this}return cH=n,cH}var dH,fH;function pH(){if(fH)return dH;fH=1;var e=QV(),t=tH(),n=iH(),r=sH(),i=uH();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,dH=a,dH}var mH,hH;function gH(){if(hH)return mH;hH=1;function e(){this.__data__=[],this.size=0}return mH=e,mH}var _H,vH;function yH(){if(vH)return _H;vH=1;function e(e,t){return e===t||e!==e&&t!==t}return _H=e,_H}var bH,xH;function SH(){if(xH)return bH;xH=1;var e=yH();function t(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}return bH=t,bH}var CH,wH;function TH(){if(wH)return CH;wH=1;var e=SH(),t=Array.prototype.splice;function n(n){var r=this.__data__,i=e(r,n);return i<0?!1:(i==r.length-1?r.pop():t.call(r,i,1),--this.size,!0)}return CH=n,CH}var EH,DH;function OH(){if(DH)return EH;DH=1;var e=SH();function t(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}return EH=t,EH}var kH,AH;function jH(){if(AH)return kH;AH=1;var e=SH();function t(t){return e(this.__data__,t)>-1}return kH=t,kH}var MH,NH;function PH(){if(NH)return MH;NH=1;var e=SH();function t(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}return MH=t,MH}var FH,IH;function LH(){if(IH)return FH;IH=1;var e=gH(),t=TH(),n=OH(),r=jH(),i=PH();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,FH=a,FH}var RH,zH;function BH(){return zH?RH:(zH=1,RH=KV()(MI(),`Map`),RH)}var VH,HH;function UH(){if(HH)return VH;HH=1;var e=pH(),t=LH(),n=BH();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return VH=r,VH}var WH,GH;function KH(){if(GH)return WH;GH=1;function e(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}return WH=e,WH}var qH,JH;function YH(){if(JH)return qH;JH=1;var e=KH();function t(t,n){var r=t.__data__;return e(n)?r[typeof n==`string`?`string`:`hash`]:r.map}return qH=t,qH}var XH,ZH;function QH(){if(ZH)return XH;ZH=1;var e=YH();function t(t){var n=e(this,t).delete(t);return this.size-=+!!n,n}return XH=t,XH}var $H,eU;function tU(){if(eU)return $H;eU=1;var e=YH();function t(t){return e(this,t).get(t)}return $H=t,$H}var nU,rU;function iU(){if(rU)return nU;rU=1;var e=YH();function t(t){return e(this,t).has(t)}return nU=t,nU}var aU,oU;function sU(){if(oU)return aU;oU=1;var e=YH();function t(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this}return aU=t,aU}var cU,lU;function uU(){if(lU)return cU;lU=1;var e=UH(),t=QH(),n=tU(),r=iU(),i=sU();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,cU=a,cU}var dU,fU;function pU(){if(fU)return dU;fU=1;var e=uU(),t=`Expected a function`;function n(r,i){if(typeof r!=`function`||i!=null&&typeof i!=`function`)throw TypeError(t);var a=function(){var e=arguments,t=i?i.apply(this,e):e[0],n=a.cache;if(n.has(t))return n.get(t);var o=r.apply(this,e);return a.cache=n.set(t,o)||n,o};return a.cache=new(n.Cache||e),a}return n.Cache=e,dU=n,dU}var mU,hU;function gU(){if(hU)return mU;hU=1;var e=pU(),t=500;function n(n){var r=e(n,function(e){return i.size===t&&i.clear(),e}),i=r.cache;return r}return mU=n,mU}var _U,vU;function yU(){if(vU)return _U;vU=1;var e=gU(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g;return _U=e(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(``),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,`$1`):t||e)}),r}),_U}var bU,xU;function SU(){if(xU)return bU;xU=1;function e(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}return bU=e,bU}var CU,wU;function TU(){if(wU)return CU;wU=1;var e=WI(),t=SU(),n=SV(),r=aL(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(e){if(typeof e==`string`)return e;if(n(e))return t(e,o)+``;if(r(e))return a?a.call(e):``;var i=e+``;return i==`0`&&1/e==-1/0?`-0`:i}return CU=o,CU}var EU,DU;function OU(){if(DU)return EU;DU=1;var e=TU();function t(t){return t==null?``:e(t)}return EU=t,EU}var kU,AU;function jU(){if(AU)return kU;AU=1;var e=SV(),t=TV(),n=yU(),r=OU();function i(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}return kU=i,kU}var MU,NU;function PU(){if(NU)return MU;NU=1;var e=aL();function t(t){if(typeof t==`string`||e(t))return t;var n=t+``;return n==`0`&&1/t==-1/0?`-0`:n}return MU=t,MU}var FU,IU;function LU(){if(IU)return FU;IU=1;var e=jU(),t=PU();function n(n,r){r=e(r,n);for(var i=0,a=r.length;n!=null&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}return FU=n,FU}var RU,zU;function BU(){if(zU)return RU;zU=1;var e=LU();function t(t,n,r){var i=t==null?void 0:e(t,n);return i===void 0?r:i}return RU=t,RU}var VU=CI(BU()),HU,UU;function WU(){if(UU)return HU;UU=1;var e=KV();return HU=function(){try{var t=e(Object,`defineProperty`);return t({},``,{}),t}catch{}}(),HU}var GU,KU;function qU(){if(KU)return GU;KU=1;var e=WU();function t(t,n,r){n==`__proto__`&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}return GU=t,GU}var JU,YU;function XU(){if(YU)return JU;YU=1;var e=qU(),t=yH(),n=Object.prototype.hasOwnProperty;function r(r,i,a){var o=r[i];(!(n.call(r,i)&&t(o,a))||a===void 0&&!(i in r))&&e(r,i,a)}return JU=r,JU}var ZU,QU;function $U(){if(QU)return ZU;QU=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(n,r){var i=typeof n;return r??=e,!!r&&(i==`number`||i!=`symbol`&&t.test(n))&&n>-1&&n%1==0&&n<r}return ZU=n,ZU}var eW,tW;function nW(){if(tW)return eW;tW=1;var e=XU(),t=jU(),n=$U(),r=EI(),i=PU();function a(a,o,s,c){if(!r(a))return a;o=t(o,a);for(var l=-1,u=o.length,d=u-1,f=a;f!=null&&++l<u;){var p=i(o[l]),m=s;if(p===`__proto__`||p===`constructor`||p===`prototype`)return a;if(l!=d){var h=f[p];m=c?c(h,p,f):void 0,m===void 0&&(m=r(h)?h:n(o[l+1])?[]:{})}e(f,p,m),f=f[p]}return a}return eW=a,eW}var rW,iW;function aW(){if(iW)return rW;iW=1;var e=nW();function t(t,n,r){return t==null?t:e(t,n,r)}return rW=t,rW}var oW=CI(aW()),sW,cW;function lW(){if(cW)return sW;cW=1;function e(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}return sW=e,sW}var uW,dW;function fW(){if(dW)return uW;dW=1;var e=SU(),t=lW(),n=SV(),r=aL(),i=yU(),a=PU(),o=OU();function s(s){return n(s)?e(s,a):r(s)?[s]:t(i(o(s)))}return uW=s,uW}var pW=CI(fW()),mW={data:function(e){return e=pI({},{field:`data`,bindingEvent:`data`,allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:`data`,settingTriggersEvent:!1,triggerFnName:`trigger`,immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,i=this,a=i.length!==void 0,o=a?i:[i],s=a?i[0]:i;if(PF(t)){var c=t.indexOf(`.`)!==-1&&pW(t);if(r.allowGetting&&n===void 0){var l;return s&&(r.beforeGet(s),l=c&&s._private[r.field][t]===void 0?VU(s._private[r.field],c):s._private[r.field][t]),l}else if(r.allowSetting&&n!==void 0&&!r.immutableKeys[t]){var u=gF({},t,n);r.beforeSet(i,u);for(var d=0,f=o.length;d<f;d++){var p=o[d];r.canSet(p)&&(c&&s._private[r.field][t]===void 0?oW(p._private[r.field],c,n):p._private[r.field][t]=n)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&LF(t)){var m=t,h,g,_=Object.keys(m);r.beforeSet(i,m);for(var v=0;v<_.length;v++)if(h=_[v],g=m[h],!r.immutableKeys[h])for(var y=0;y<o.length;y++){var b=o[y];r.canSet(b)&&(b._private[r.field][h]=g)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&FF(t)){var x=t;i.on(r.bindingEvent,x)}else if(r.allowGetting&&t===void 0){var S;return s&&(r.beforeGet(s),S=s._private[r.field]),S}return i}},removeData:function(e){return e=pI({},{field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=this,i=r.length===void 0?[r]:r;if(PF(t)){for(var a=t.split(/\s+/),o=a.length,s=0;s<o;s++){var c=a[s];if(!qF(c)&&!n.immutableKeys[c])for(var l=0,u=i.length;l<u;l++)i[l]._private[n.field][c]=void 0}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(t===void 0){for(var d=0,f=i.length;d<f;d++)for(var p=i[d]._private[n.field],m=Object.keys(p),h=0;h<m.length;h++){var g=m[h];n.immutableKeys[g]||(p[g]=void 0)}n.triggerEvent&&r[n.triggerFnName](n.event)}return r}}},hW={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new gV(function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)})}}},gW={};[yV,mW,hW].forEach(function(e){pI(gW,e)});var _W={animate:gW.animate(),animation:gW.animation(),animated:gW.animated(),clearQueue:gW.clearQueue(),delay:gW.delay(),delayAnimation:gW.delayAnimation(),stop:gW.stop()},vW={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(e){return n.push(e)}),n}else IF(e)||(e=(e||``).match(/\S+/g)||[]);for(var r=[],i=new oR(e),a=0;a<t.length;a++){for(var o=t[a],s=o._private,c=s.classes,l=!1,u=0;u<e.length;u++){var d=e[u];if(!c.has(d)){l=!0;break}}l||=c.size!==e.length,l&&(s.classes=i,r.push(o))}return r.length>0&&this.spawn(r).updateStyle().emit(`class`),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){IF(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,i=[],a=0,o=n.length;a<o;a++)for(var s=n[a],c=s._private.classes,l=!1,u=0;u<e.length;u++){var d=e[u],f=c.has(d),p=!1;t||r&&!f?(c.add(d),p=!0):(!t||r&&f)&&(c.delete(d),p=!0),!l&&p&&(i.push(s),l=!0)}return i.length>0&&this.spawn(i).updateStyle().emit(`class`),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};vW.className=vW.classNames=vW.classes;var yW={metaChar:`[\\!\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\\`\\{\\|\\}\\~]`,comparatorOp:`=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=`,boolOp:`\\?|\\!|\\^`,string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:iI,meta:`degree|indegree|outdegree`,separator:`\\s*,\\s*`,descendant:`\\s+`,child:`\\s+>\\s+`,subject:`\\$`,group:`node|edge|\\*`,directedEdge:`\\s+->\\s+`,undirectedEdge:`\\s+<->\\s+`};yW.variable=`(?:[\\w-.]|(?:\\\\`+yW.metaChar+`))+`,yW.className=`(?:[\\w-]|(?:\\\\`+yW.metaChar+`))+`,yW.value=yW.string+`|`+yW.number,yW.id=yW.variable,(function(){var e=yW.comparatorOp.split(`|`),t,n;for(n=0;n<e.length;n++)t=e[n],yW.comparatorOp+=`|@`+t;for(e=yW.comparatorOp.split(`|`),n=0;n<e.length;n++)t=e[n],!(t.indexOf(`!`)>=0)&&t!==`=`&&(yW.comparatorOp+=`|\\!`+t)})();var bW=function(){return{checks:[]}},xW={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},SW=[{selector:`:selected`,matches:function(e){return e.selected()}},{selector:`:unselected`,matches:function(e){return!e.selected()}},{selector:`:selectable`,matches:function(e){return e.selectable()}},{selector:`:unselectable`,matches:function(e){return!e.selectable()}},{selector:`:locked`,matches:function(e){return e.locked()}},{selector:`:unlocked`,matches:function(e){return!e.locked()}},{selector:`:visible`,matches:function(e){return e.visible()}},{selector:`:hidden`,matches:function(e){return!e.visible()}},{selector:`:transparent`,matches:function(e){return e.transparent()}},{selector:`:grabbed`,matches:function(e){return e.grabbed()}},{selector:`:free`,matches:function(e){return!e.grabbed()}},{selector:`:removed`,matches:function(e){return e.removed()}},{selector:`:inside`,matches:function(e){return!e.removed()}},{selector:`:grabbable`,matches:function(e){return e.grabbable()}},{selector:`:ungrabbable`,matches:function(e){return!e.grabbable()}},{selector:`:animated`,matches:function(e){return e.animated()}},{selector:`:unanimated`,matches:function(e){return!e.animated()}},{selector:`:parent`,matches:function(e){return e.isParent()}},{selector:`:childless`,matches:function(e){return e.isChildless()}},{selector:`:child`,matches:function(e){return e.isChild()}},{selector:`:orphan`,matches:function(e){return e.isOrphan()}},{selector:`:nonorphan`,matches:function(e){return e.isChild()}},{selector:`:compound`,matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:`:loop`,matches:function(e){return e.isLoop()}},{selector:`:simple`,matches:function(e){return e.isSimple()}},{selector:`:active`,matches:function(e){return e.active()}},{selector:`:inactive`,matches:function(e){return!e.active()}},{selector:`:backgrounding`,matches:function(e){return e.backgrounding()}},{selector:`:nonbackgrounding`,matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return fI(e.selector,t.selector)}),CW=function(){for(var e={},t,n=0;n<SW.length;n++)t=SW[n],e[t.selector]=t.matches;return e}(),wW=function(e,t){return CW[e](t)},TW=`(`+SW.map(function(e){return e.selector}).join(`|`)+`)`,EW=function(e){return e.replace(RegExp(`\\\\(`+yW.metaChar+`)`,`g`),function(e,t){return t})},DW=function(e,t,n){e[e.length-1]=n},OW=[{name:`group`,query:!0,regex:`(`+yW.group+`)`,populate:function(e,t,n){var r=xF(n,1)[0];t.checks.push({type:xW.GROUP,value:r===`*`?r:r+`s`})}},{name:`state`,query:!0,regex:TW,populate:function(e,t,n){var r=xF(n,1)[0];t.checks.push({type:xW.STATE,value:r})}},{name:`id`,query:!0,regex:`\\#(`+yW.id+`)`,populate:function(e,t,n){var r=xF(n,1)[0];t.checks.push({type:xW.ID,value:EW(r)})}},{name:`className`,query:!0,regex:`\\.(`+yW.className+`)`,populate:function(e,t,n){var r=xF(n,1)[0];t.checks.push({type:xW.CLASS,value:EW(r)})}},{name:`dataExists`,query:!0,regex:`\\[\\s*(`+yW.variable+`)\\s*\\]`,populate:function(e,t,n){var r=xF(n,1)[0];t.checks.push({type:xW.DATA_EXIST,field:EW(r)})}},{name:`dataCompare`,query:!0,regex:`\\[\\s*(`+yW.variable+`)\\s*(`+yW.comparatorOp+`)\\s*(`+yW.value+`)\\s*\\]`,populate:function(e,t,n){var r=xF(n,3),i=r[0],a=r[1],o=r[2];o=RegExp(`^`+yW.string+`$`).exec(o)==null?parseFloat(o):o.substring(1,o.length-1),t.checks.push({type:xW.DATA_COMPARE,field:EW(i),operator:a,value:o})}},{name:`dataBool`,query:!0,regex:`\\[\\s*(`+yW.boolOp+`)\\s*(`+yW.variable+`)\\s*\\]`,populate:function(e,t,n){var r=xF(n,2),i=r[0],a=r[1];t.checks.push({type:xW.DATA_BOOL,field:EW(a),operator:i})}},{name:`metaCompare`,query:!0,regex:`\\[\\[\\s*(`+yW.meta+`)\\s*(`+yW.comparatorOp+`)\\s*(`+yW.number+`)\\s*\\]\\]`,populate:function(e,t,n){var r=xF(n,3),i=r[0],a=r[1],o=r[2];t.checks.push({type:xW.META_COMPARE,field:EW(i),operator:a,value:parseFloat(o)})}},{name:`nextQuery`,separator:!0,regex:yW.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return n!=null&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=bW()}},{name:`directedEdge`,separator:!0,regex:yW.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n=bW(),r=t,i=bW();return n.checks.push({type:xW.DIRECTED_EDGE,source:r,target:i}),DW(e,t,n),e.edgeCount++,i}else{var a=bW(),o=t,s=bW();return a.checks.push({type:xW.NODE_SOURCE,source:o,target:s}),DW(e,t,a),e.edgeCount++,s}}},{name:`undirectedEdge`,separator:!0,regex:yW.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n=bW(),r=t,i=bW();return n.checks.push({type:xW.UNDIRECTED_EDGE,nodes:[r,i]}),DW(e,t,n),e.edgeCount++,i}else{var a=bW(),o=t,s=bW();return a.checks.push({type:xW.NODE_NEIGHBOR,node:o,neighbor:s}),DW(e,t,a),s}}},{name:`child`,separator:!0,regex:yW.child,populate:function(e,t){if(e.currentSubject==null){var n=bW(),r=bW(),i=e[e.length-1];return n.checks.push({type:xW.CHILD,parent:i,child:r}),DW(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var a=bW(),o=e[e.length-1],s=bW(),c=bW(),l=bW(),u=bW();return a.checks.push({type:xW.COMPOUND_SPLIT,left:o,right:s,subject:c}),c.checks=t.checks,t.checks=[{type:xW.TRUE}],u.checks.push({type:xW.TRUE}),s.checks.push({type:xW.PARENT,parent:u,child:l}),DW(e,o,a),e.currentSubject=c,e.compoundCount++,l}else{var d=bW(),f=bW(),p=[{type:xW.PARENT,parent:d,child:f}];return d.checks=t.checks,t.checks=p,e.compoundCount++,f}}},{name:`descendant`,separator:!0,regex:yW.descendant,populate:function(e,t){if(e.currentSubject==null){var n=bW(),r=bW(),i=e[e.length-1];return n.checks.push({type:xW.DESCENDANT,ancestor:i,descendant:r}),DW(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var a=bW(),o=e[e.length-1],s=bW(),c=bW(),l=bW(),u=bW();return a.checks.push({type:xW.COMPOUND_SPLIT,left:o,right:s,subject:c}),c.checks=t.checks,t.checks=[{type:xW.TRUE}],u.checks.push({type:xW.TRUE}),s.checks.push({type:xW.ANCESTOR,ancestor:u,descendant:l}),DW(e,o,a),e.currentSubject=c,e.compoundCount++,l}else{var d=bW(),f=bW(),p=[{type:xW.ANCESTOR,ancestor:d,descendant:f}];return d.checks=t.checks,t.checks=p,e.compoundCount++,f}}},{name:`subject`,modifier:!0,regex:yW.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return WL("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=n==null?null:n.type;r===xW.DIRECTED_EDGE?n.type=xW.NODE_TARGET:r===xW.UNDIRECTED_EDGE&&(n.type=xW.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];OW.forEach(function(e){return e.regexObj=RegExp(`^`+e.regex)});var kW=function(e){for(var t,n,r,i=0;i<OW.length;i++){var a=OW[i],o=a.name,s=e.match(a.regexObj);if(s!=null){n=s,t=a,r=o;var c=s[0];e=e.substring(c.length);break}}return{expr:t,match:n,name:r,remaining:e}},AW=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},jW={parse:function(e){var t=this,n=t.inputText=e,r=t[0]=bW();for(t.length=1,n=AW(n);;){var i=kW(n);if(i.expr==null)return WL("The selector `"+e+"`is invalid"),!1;var a=i.match.slice(1),o=i.expr.populate(t,r,a);if(o===!1)return!1;if(o!=null&&(r=o),n=i.remaining,n.match(/^\s*$/))break}var s=t[t.length-1];t.currentSubject!=null&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var c=0;c<t.length;c++){var l=t[c];if(l.compoundCount>0&&l.edgeCount>0)return WL("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return WL("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;l.edgeCount===1&&WL("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(e){return e??``},t=function(t){return PF(t)?`"`+t+`"`:e(t)},n=function(e){return` `+e+` `},r=function(r,a){var o=r.type,s=r.value;switch(o){case xW.GROUP:var c=e(s);return c.substring(0,c.length-1);case xW.DATA_COMPARE:var l=r.field,u=r.operator;return`[`+l+n(e(u))+t(s)+`]`;case xW.DATA_BOOL:var d=r.operator,f=r.field;return`[`+e(d)+f+`]`;case xW.DATA_EXIST:return`[`+r.field+`]`;case xW.META_COMPARE:var p=r.operator;return`[[`+r.field+n(e(p))+t(s)+`]]`;case xW.STATE:return s;case xW.ID:return`#`+s;case xW.CLASS:return`.`+s;case xW.PARENT:case xW.CHILD:return i(r.parent,a)+n(`>`)+i(r.child,a);case xW.ANCESTOR:case xW.DESCENDANT:return i(r.ancestor,a)+` `+i(r.descendant,a);case xW.COMPOUND_SPLIT:var m=i(r.left,a),h=i(r.subject,a),g=i(r.right,a);return m+(m.length>0?` `:``)+h+g;case xW.TRUE:return``}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&a===0?`$`:``)+r(i,t)},``)},a=``,o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=`, `)}return this.toStringCache=a,a}},MW=function(e,t,n){var r,i=PF(e),a=$(e),o=PF(n),s,c,l=!1,u=!1,d=!1;switch(t.indexOf(`!`)>=0&&(t=t.replace(`!`,``),u=!0),t.indexOf(`@`)>=0&&(t=t.replace(`@`,``),l=!0),(i||o||l)&&(s=!i&&!a?``:``+e,c=``+n),l&&(e=s=s.toLowerCase(),n=c=c.toLowerCase()),t){case`*=`:r=s.indexOf(c)>=0;break;case`$=`:r=s.indexOf(c,s.length-c.length)>=0;break;case`^=`:r=s.indexOf(c)===0;break;case`=`:r=e===n;break;case`>`:d=!0,r=e>n;break;case`>=`:d=!0,r=e>=n;break;case`<`:d=!0,r=e<n;break;case`<=`:d=!0,r=e<=n;break;default:r=!1;break}return u&&(e!=null||!d)&&(r=!r),r},NW=function(e,t){switch(t){case`?`:return!!e;case`!`:return!e;case`^`:return e===void 0}},PW=function(e){return e!==void 0},FW=function(e,t){return e.data(t)},IW=function(e,t){return e[t]()},LW=[],RW=function(e,t){return e.checks.every(function(e){return LW[e.type](e,t)})};LW[xW.GROUP]=function(e,t){var n=e.value;return n===`*`||n===t.group()},LW[xW.STATE]=function(e,t){var n=e.value;return wW(n,t)},LW[xW.ID]=function(e,t){var n=e.value;return t.id()===n},LW[xW.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},LW[xW.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return MW(IW(t,n),r,i)},LW[xW.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return MW(FW(t,n),r,i)},LW[xW.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return NW(FW(t,n),r)},LW[xW.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,PW(FW(t,n))},LW[xW.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return RW(n,i)&&RW(r,a)||RW(r,i)&&RW(n,a)},LW[xW.NODE_NEIGHBOR]=function(e,t){return RW(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&RW(e.neighbor,t)})},LW[xW.DIRECTED_EDGE]=function(e,t){return RW(e.source,t.source())&&RW(e.target,t.target())},LW[xW.NODE_SOURCE]=function(e,t){return RW(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&RW(e.target,t)})},LW[xW.NODE_TARGET]=function(e,t){return RW(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&RW(e.source,t)})},LW[xW.CHILD]=function(e,t){return RW(e.child,t)&&RW(e.parent,t.parent())},LW[xW.PARENT]=function(e,t){return RW(e.parent,t)&&t.children().some(function(t){return RW(e.child,t)})},LW[xW.DESCENDANT]=function(e,t){return RW(e.descendant,t)&&t.ancestors().some(function(t){return RW(e.ancestor,t)})},LW[xW.ANCESTOR]=function(e,t){return RW(e.ancestor,t)&&t.descendants().some(function(t){return RW(e.descendant,t)})},LW[xW.COMPOUND_SPLIT]=function(e,t){return RW(e.subject,t)&&RW(e.left,t)&&RW(e.right,t)},LW[xW.TRUE]=function(){return!0},LW[xW.COLLECTION]=function(e,t){return e.value.has(t)},LW[xW.FILTER]=function(e,t){var n=e.value;return n(t)};var zW={matches:function(e){for(var t=this,n=0;n<t.length;n++){var r=t[n];if(RW(r,e))return!0}return!1},filter:function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===xW.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(RW(r,e))return!0}return!1};return t.text()??(n=function(){return!0}),e.filter(n)}},BW=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||PF(e)&&e.match(/^\s*$/)||(VF(e)?this.addQuery({checks:[{type:xW.COLLECTION,value:e.collection()}]}):FF(e)?this.addQuery({checks:[{type:xW.FILTER,value:e}]}):PF(e)?this.parse(e)||(this.invalid=!0):HL(`A selector must be created from a string; found `))},VW=BW.prototype;[jW,zW].forEach(function(e){return pI(VW,e)}),VW.text=function(){return this.inputText},VW.size=function(){return this.length},VW.eq=function(e){return this[e]},VW.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},VW.addQuery=function(e){this[this.length++]=e},VW.selector=VW.toString;var HW={allAre:function(e){var t=new BW(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new BW(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length?t===1?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}):!1},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};HW.allAreNeighbours=HW.allAreNeighbors,HW.has=HW.contains,HW.equal=HW.equals=HW.same;var UW=function(e,t){return function(n,r,i,a){var o=n,s=this,c;if(o==null?c=``:VF(o)&&o.length===1&&(c=o.id()),s.length===1&&c){var l=s[0]._private,u=l.traversalCache=l.traversalCache||{},d=u[t]=u[t]||[],f=OL(c);return d[f]||(d[f]=e.call(s,n,r,i,a))}else return e.call(s,n,r,i,a)}},WW={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t||=r,t=t.intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:UW(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,!0).filter(e)},`children`),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];function n(e){for(var r=0;r<e.length;r++){var i=e[r];t.push(i),i.children().nonempty()&&n(i.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function GW(e,t,n,r){for(var i=[],a=new oR,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var c=e[s];n?i.push(c):o&&r(i,a,c)}for(;i.length>0;){var l=i.shift();t(l),a.add(l.id()),o&&r(i,a,l)}return e}function KW(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}WW.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return GW(this,e,t,KW)};function qW(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}WW.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return GW(this,e,t,qW)};function JW(e,t,n){qW(e,t,n),KW(e,t,n)}WW.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return GW(this,e,t,JW)},WW.ancestors=WW.parents;var YW=XW={data:gW.data({field:`data`,bindingEvent:`data`,allowBinding:!0,allowSetting:!0,settingEvent:`data`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:gW.removeData({field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:gW.data({field:`scratch`,bindingEvent:`scratch`,allowBinding:!0,allowSetting:!0,settingEvent:`scratch`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeScratch:gW.removeData({field:`scratch`,event:`scratch`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0}),rscratch:gW.data({field:`rscratch`,allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:gW.removeData({field:`rscratch`,triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},XW;YW.attr=YW.data,YW.removeAttr=YW.removeData;var ZW=XW,QW={};function $W(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;o<a.length;o++){var s=a[o];!t&&s.isLoop()||(r+=e(i,s))}return r}else return}}pI(QW,{degree:$W(function(e,t){return t.source().same(t.target())?2:1}),indegree:$W(function(e,t){return+!!t.target().same(e)}),outdegree:$W(function(e,t){return+!!t.source().same(e)})});function eG(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);o!==void 0&&(r===void 0||t(o,r))&&(r=o)}return r}}pI(QW,{minDegree:eG(`degree`,function(e,t){return e<t}),maxDegree:eG(`degree`,function(e,t){return e>t}),minIndegree:eG(`indegree`,function(e,t){return e<t}),maxIndegree:eG(`indegree`,function(e,t){return e>t}),minOutdegree:eG(`outdegree`,function(e,t){return e<t}),maxOutdegree:eG(`outdegree`,function(e,t){return e>t})}),pI(QW,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var tG,nG,rG=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:t.x==null?0:t.x-a.x,y:t.y==null?0:t.y-a.y};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},iG={field:`position`,bindingEvent:`position`,allowBinding:!0,allowSetting:!0,settingEvent:`position`,settingTriggersEvent:!0,triggerFnName:`emitAndNotify`,allowGetting:!0,validKeys:[`x`,`y`],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){rG(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};tG=nG={position:gW.data(iG),silentPosition:gW.data(pI({},iG,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){rG(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(LF(e))t?this.silentPosition(e):this.position(e);else if(FF(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var a=this[i],o=void 0;(o=n(a,i))&&(t?a.silentPosition(o):a.position(o))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(LF(e)?(r={x:$(e.x)?e.x:0,y:$(e.y)?e.y:0},n=t):PF(e)&&$(t)&&(r={x:0,y:0},r[e]=t),r!=null){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),c={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(c):o.position(c)}}i.endBatch()}return this},silentShift:function(e,t){return LF(e)?this.shift(e,!0):PF(e)&&$(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=LF(e)?e:void 0,s=o!==void 0||t!==void 0&&PF(e);if(n&&n.isNode())if(s)for(var c=0;c<this.length;c++){var l=this[c];t===void 0?o!==void 0&&l.position(NR(o,i,a)):l.position(e,(t-a[e])/i)}else return o=MR(n.position(),i,a),e===void 0?o:o[e];else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=LF(e)?e:void 0,a=i!==void 0||t!==void 0&&PF(e),o=r.hasCompoundNodes();if(n&&n.isNode())if(a)for(var s=0;s<this.length;s++){var c=this[s],l=o?c.parent():null,u=l&&l.length>0,d=u;u&&(l=l[0]);var f=d?l.position():{x:0,y:0};t===void 0?i!==void 0&&c.position({x:i.x+f.x,y:i.y+f.y}):c.position(e,t+f[e])}else{var p=n.position(),m=o?n.parent():null,h=m&&m.length>0,g=h;h&&(m=m[0]);var _=g?m.position():{x:0,y:0};return i={x:p.x-_.x,y:p.y-_.y},e===void 0?i:i[e]}else if(!a)return;return this}},tG.modelPosition=tG.point=tG.position,tG.modelPositions=tG.points=tG.positions,tG.renderedPoint=tG.renderedPosition,tG.relativePoint=tG.relativePosition;var aG=nG,oG=sG={},sG;sG.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,c=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:c,w:o-a,h:c-s}},sG.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()||this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify(`bounds`)}}),this},sG.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;function n(e){if(!e.isParent())return;var t=e._private,n=e.children(),r=e.pstyle(`compound-sizing-wrt-labels`).value===`include`,i={width:{val:e.pstyle(`min-width`).pfValue,left:e.pstyle(`min-width-bias-left`),right:e.pstyle(`min-width-bias-right`)},height:{val:e.pstyle(`min-height`).pfValue,top:e.pstyle(`min-height-bias-top`),bottom:e.pstyle(`min-height-bias-bottom`)}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;(a.w===0||a.h===0)&&(a={w:e.pstyle(`width`).pfValue,h:e.pstyle(`height`).pfValue},a.x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);function s(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}function c(e,t,n,r){if(n.units===`%`)switch(r){case`width`:return e>0?n.pfValue*e:0;case`height`:return t>0?n.pfValue*t:0;case`average`:return e>0&&t>0?n.pfValue*(e+t)/2:0;case`min`:return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case`max`:return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}else if(n.units===`px`)return n.pfValue;else return 0}var l=i.width.left.value;i.width.left.units===`px`&&i.width.val>0&&(l=l*100/i.width.val);var u=i.width.right.value;i.width.right.units===`px`&&i.width.val>0&&(u=u*100/i.width.val);var d=i.height.top.value;i.height.top.units===`px`&&i.height.val>0&&(d=d*100/i.height.val);var f=i.height.bottom.value;i.height.bottom.units===`px`&&i.height.val>0&&(f=f*100/i.height.val);var p=s(i.width.val-a.w,l,u),m=p.biasDiff,h=p.biasComplementDiff,g=s(i.height.val-a.h,d,f),_=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=c(a.w,a.h,e.pstyle(`padding`),e.pstyle(`padding-relative-to`).value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-m+a.x1+a.x2+h)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-_+a.y1+a.y2+v)/2}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;(!a.compoundBoundsClean||e)&&(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var cG=function(e){return e===1/0||e===-1/0?0:e},lG=function(e,t,n,r,i){r-t===0||i-n===0||t==null||n==null||r==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},uG=function(e,t){return t==null?e:lG(e,t.x1,t.y1,t.x2,t.y2)},dG=function(e,t,n){return tR(e,t,n)},fG=function(e,t,n){if(!t.cy().headless()){var r=t._private,i=r.rstyle,a=i.arrowWidth/2,o=t.pstyle(n+`-arrow-shape`).value,s,c;if(o!==`none`){n===`source`?(s=i.srcX,c=i.srcY):n===`target`?(s=i.tgtX,c=i.tgtY):(s=i.midX,c=i.midY);var l=r.arrowBounds=r.arrowBounds||{},u=l[n]=l[n]||{};u.x1=s-a,u.y1=c-a,u.x2=s+a,u.y2=c+a,u.w=u.x2-u.x1,u.h=u.y2-u.y1,tz(u,1),lG(e,u.x1,u.y1,u.x2,u.y2)}}},pG=function(e,t,n){if(!t.cy().headless()){var r=n?n+`-`:``,i=t._private,a=i.rstyle;if(t.pstyle(r+`label`).strValue){var o=t.pstyle(`text-halign`),s=t.pstyle(`text-valign`),c=dG(a,`labelWidth`,n),l=dG(a,`labelHeight`,n),u=dG(a,`labelX`,n),d=dG(a,`labelY`,n),f=t.pstyle(r+`text-margin-x`).pfValue,p=t.pstyle(r+`text-margin-y`).pfValue,m=t.isEdge(),h=t.pstyle(r+`text-rotation`),g=t.pstyle(`text-outline-width`).pfValue,_=t.pstyle(`text-border-width`).pfValue/2,v=t.pstyle(`text-background-padding`).pfValue,y=2,b=l,x=c,S=x/2,C=b/2,w,T,E,D;if(m)w=u-S,T=u+S,E=d-C,D=d+C;else{switch(o.value){case`left`:w=u-x,T=u;break;case`center`:w=u-S,T=u+S;break;case`right`:w=u,T=u+x;break}switch(s.value){case`top`:E=d-b,D=d;break;case`center`:E=d-C,D=d+C;break;case`bottom`:E=d,D=d+b;break}}var O=f-Math.max(g,_)-v-y,k=f+Math.max(g,_)+v+y,A=p-Math.max(g,_)-v-y,j=p+Math.max(g,_)+v+y;w+=O,T+=k,E+=A,D+=j;var M=n||`main`,N=i.labelBounds,P=N[M]=N[M]||{};P.x1=w,P.y1=E,P.x2=T,P.y2=D,P.w=T-w,P.h=D-E,P.leftPad=O,P.rightPad=k,P.topPad=A,P.botPad=j;var F=m&&h.strValue===`autorotate`,I=h.pfValue!=null&&h.pfValue!==0;if(F||I){var L=F?dG(i.rstyle,`labelAngle`,n):h.pfValue,R=Math.cos(L),ee=Math.sin(L),z=(w+T)/2,B=(E+D)/2;if(!m){switch(o.value){case`left`:z=T;break;case`right`:z=w;break}switch(s.value){case`top`:B=D;break;case`bottom`:B=E;break}}var V=function(e,t){return e-=z,t-=B,{x:e*R-t*ee+z,y:e*ee+t*R+B}},H=V(w,E),te=V(w,D),ne=V(T,E),U=V(T,D);w=Math.min(H.x,te.x,ne.x,U.x),T=Math.max(H.x,te.x,ne.x,U.x),E=Math.min(H.y,te.y,ne.y,U.y),D=Math.max(H.y,te.y,ne.y,U.y)}var re=M+`Rot`,ie=N[re]=N[re]||{};ie.x1=w,ie.y1=E,ie.x2=T,ie.y2=D,ie.w=T-w,ie.h=D-E,lG(e,w,E,T,D),lG(i.labelBounds.all,w,E,T,D)}return e}},mG=function(e,t){if(!t.cy().headless()){var n=t.pstyle(`outline-opacity`).value,r=t.pstyle(`outline-width`).value+t.pstyle(`outline-offset`).value;hG(e,t,n,r,`outside`,r/2)}},hG=function(e,t,n,r,i,a){if(!(n===0||r<=0||i===`inside`)){var o=t.cy().renderer(),s=o.nodeShapes[o.getNodeShape(t)];if(s){var c=t.position(),l=c.x,u=c.y,d=t.width(),f=t.height();s.hasMiterBounds?(i===`center`&&(r/=2),uG(e,s.miterBounds(l,u,d,f,r))):a!=null&&a>0&&nz(e,[a,a,a,a])}}},gG=function(e,t){if(!t.cy().headless()){var n=t.pstyle(`border-opacity`).value,r=t.pstyle(`border-width`).pfValue,i=t.pstyle(`border-position`).value;hG(e,t,n,r,i)}},_G=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a=XR(),o=e._private,s=e.isNode(),c=e.isEdge(),l,u,d,f,p,m,h=o.rstyle,g=s&&r?e.pstyle(`bounds-expansion`).pfValue:[0],_=function(e){return e.pstyle(`display`).value!==`none`},v=!r||_(e)&&(!c||_(e.source())&&_(e.target()));if(v){var y=0,b=0;r&&t.includeOverlays&&(y=e.pstyle(`overlay-opacity`).value,y!==0&&(b=e.pstyle(`overlay-padding`).value));var x=0,S=0;r&&t.includeUnderlays&&(x=e.pstyle(`underlay-opacity`).value,x!==0&&(S=e.pstyle(`underlay-padding`).value));var C=Math.max(b,S),w=0,T=0;if(r&&(w=e.pstyle(`width`).pfValue,T=w/2),s&&t.includeNodes){var E=e.position();p=E.x,m=E.y;var D=e.outerWidth()/2,O=e.outerHeight()/2;l=p-D,u=p+D,d=m-O,f=m+O,lG(a,l,d,u,f),r&&mG(a,e),r&&t.includeOutlines&&!i&&mG(a,e),r&&gG(a,e)}else if(c&&t.includeEdges)if(r&&!i){var k=e.pstyle(`curve-style`).strValue;if(l=Math.min(h.srcX,h.midX,h.tgtX),u=Math.max(h.srcX,h.midX,h.tgtX),d=Math.min(h.srcY,h.midY,h.tgtY),f=Math.max(h.srcY,h.midY,h.tgtY),l-=T,u+=T,d-=T,f+=T,lG(a,l,d,u,f),k===`haystack`){var A=h.haystackPts;if(A&&A.length===2){if(l=A[0].x,d=A[0].y,u=A[1].x,f=A[1].y,l>u){var j=l;l=u,u=j}if(d>f){var M=d;d=f,f=M}lG(a,l-T,d-T,u+T,f+T)}}else if(k===`bezier`||k===`unbundled-bezier`||rI(k,`segments`)||rI(k,`taxi`)){var N;switch(k){case`bezier`:case`unbundled-bezier`:N=h.bezierPts;break;case`segments`:case`taxi`:case`round-segments`:case`round-taxi`:N=h.linePts;break}if(N!=null)for(var P=0;P<N.length;P++){var F=N[P];l=F.x-T,u=F.x+T,d=F.y-T,f=F.y+T,lG(a,l,d,u,f)}}}else{var I=e.source().position(),L=e.target().position();if(l=I.x,u=L.x,d=I.y,f=L.y,l>u){var R=l;l=u,u=R}if(d>f){var ee=d;d=f,f=ee}l-=T,u+=T,d-=T,f+=T,lG(a,l,d,u,f)}if(r&&t.includeEdges&&c&&(fG(a,e,`mid-source`),fG(a,e,`mid-target`),fG(a,e,`source`),fG(a,e,`target`)),r&&e.pstyle(`ghost`).value===`yes`){var z=e.pstyle(`ghost-offset-x`).pfValue,B=e.pstyle(`ghost-offset-y`).pfValue;lG(a,a.x1+z,a.y1+B,a.x2+z,a.y2+B)}var V=o.bodyBounds=o.bodyBounds||{};rz(V,a),nz(V,g),tz(V,1),r&&(l=a.x1,u=a.x2,d=a.y1,f=a.y2,lG(a,l-C,d-C,u+C,f+C));var H=o.overlayBounds=o.overlayBounds||{};rz(H,a),nz(H,g),tz(H,1);var te=o.labelBounds=o.labelBounds||{};te.all==null?te.all=XR():QR(te.all),r&&t.includeLabels&&(t.includeMainLabels&&pG(a,e,null),c&&(t.includeSourceLabels&&pG(a,e,`source`),t.includeTargetLabels&&pG(a,e,`target`)))}return a.x1=cG(a.x1),a.y1=cG(a.y1),a.x2=cG(a.x2),a.y2=cG(a.y2),a.w=cG(a.x2-a.x1),a.h=cG(a.y2-a.y1),a.w>0&&a.h>0&&v&&(nz(a,g),tz(a,1)),a},vG=function(e){var t=0,n=function(e){return+!!e<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays),r+=n(e.includeOutlines),r},yG=function(e){var t=function(e){return Math.round(e)};if(e.isEdge()){var n=e.source().position(),r=e.target().position();return DL([t(n.x),t(n.y),t(r.x),t(r.y)])}else{var i=e.position();return DL([t(i.x),t(i.y)])}},bG=function(e,t){var n=e._private,r,i=e.isEdge(),a=(t==null?SG:vG(t))===SG;if(n.bbCache==null?(r=_G(e,xG),n.bbCache=r,n.bbCachePosKey=yG(e)):r=n.bbCache,!a){var o=e.isNode();r=XR(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?uG(r,n.overlayBounds):uG(r,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?uG(r,n.labelBounds.all):(t.includeMainLabels&&uG(r,n.labelBounds.mainRot),t.includeSourceLabels&&uG(r,n.labelBounds.sourceRot),t.includeTargetLabels&&uG(r,n.labelBounds.targetRot))),r.w=r.x2-r.x1,r.h=r.y2-r.y1}return r},xG={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},SG=vG(xG),CG=ZL(xG);sG.boundingBox=function(e){var t,n=e===void 0||e.useCache===void 0||e.useCache===!0,r=QF(function(e){var t=e._private;return t.bbCache==null||t.styleDirty||t.bbCachePosKey!==yG(e)},function(e){return e.id()});if(n&&this.length===1&&!r(this[0]))e=e===void 0?xG:CG(e),t=bG(this[0],e);else{t=XR(),e||=xG;var i=CG(e),a=this,o=a.cy().styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var s=0;s<a.length;s++){var c=a[s];r(c)&&c.dirtyBoundingBoxCache(),uG(t,bG(c,i))}}return t.x1=cG(t.x1),t.y1=cG(t.y1),t.x2=cG(t.x2),t.y2=cG(t.y2),t.w=cG(t.x2-t.x1),t.h=cG(t.y2-t.y1),t},sG.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds[`mid-source`]=null,t.arrowBounds[`mid-target`]=null}return this.emitAndNotify(`bounds`),this},sG.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),i=n.collection();if(r&&(i=t.filter(function(e){return e.isParent()}),t=t.not(i)),LF(e)){var a=e;e=function(){return a}}var o=function(t,n){return t._private.bbAtOldPos=e(t,n)},s=function(e){return e._private.bbAtOldPos};n.startBatch(),t.forEach(o).silentPositions(e),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var c=ZR(this.boundingBox({useCache:!1}));return t.silentPositions(s),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),n.endBatch(),c},oG.boundingbox=oG.bb=oG.boundingBox,oG.renderedBoundingbox=oG.renderedBoundingBox;var wG=sG,TG=EG={},EG,DG=function(e){e.uppercaseName=nI(e.name),e.autoName=`auto`+e.uppercaseName,e.labelName=`label`+e.uppercaseName,e.outerName=`outer`+e.uppercaseName,e.uppercaseOuterName=nI(e.outerName),TG[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t)if(r){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);switch(i.strValue){case`label`:return t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return i.pfValue}}else return 1},TG[`outer`+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)if(n){var r=t[e.name](),i=t.pstyle(`border-position`).value,a=i===`center`?t.pstyle(`border-width`).pfValue:i===`outside`?2*t.pstyle(`border-width`).pfValue:0,o=2*t.padding();return r+a+o}else return 1},TG[`rendered`+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},TG[`rendered`+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};DG({name:`width`}),DG({name:`height`}),EG.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding===void 0?e.pstyle(`padding`).pfValue:t.autoPadding):e.pstyle(`padding`).pfValue},EG.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},EG.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var OG=EG,kG=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},AG=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return MR(t(e),n.zoom(),n.pan())}},jG=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map(function(e){return MR(e,i,r)})}},MG={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},NG=function(e){return`rendered`+e[0].toUpperCase()+e.substr(1)},PG=pI({},aG,wG,OG,Object.keys(MG).reduce(function(e,t){var n=MG[t],r=NG(t);return e[t]=function(){return kG(this,n.get)},n.mult?e[r]=function(){return jG(this,n.get)}:e[r]=function(){return AG(this,n.get)},e},{})),FG=function(e,t){this.recycle(e,t)};function IG(){return!1}function LG(){return!0}FG.prototype={instanceString:function(){return`event`},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=IG,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?LG:IG):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type==null?this.type:t.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=LG;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=LG;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=LG,this.stopPropagation()},isDefaultPrevented:IG,isPropagationStopped:IG,isImmediatePropagationStopped:IG};var RG=/^([^.]+)(\.(?:[^.]+))?$/,zG=`.*`,BG={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},VG=Object.keys(BG),HG={};function UG(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:HG,t=arguments.length>1?arguments[1]:void 0,n=0;n<VG.length;n++){var r=VG[n];this[r]=e[r]||BG[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var WG=UG.prototype,GG=function(e,t,n,r,i,a,o){FF(r)&&(i=r,r=null),o&&(a=a==null?o:pI({},a,o));for(var s=IF(n)?n:n.split(/\s+/),c=0;c<s.length;c++){var l=s[c];if(!qF(l)){var u=l.match(RG);if(u){var d=u[1];if(t(e,l,d,u[2]?u[2]:null,r,i,a)===!1)break}}}},KG=function(e,t){return e.addEventFields(e.context,t),new FG(t.type,t)},qG=function(e,t,n){if(KF(n)){t(e,n);return}else if(LF(n)){t(e,KG(e,n));return}for(var r=IF(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!qF(a)){var o=a.match(RG);if(o){var s=o[1];t(e,KG(e,{type:s,namespace:o[2]?o[2]:null,target:e.context}))}}}};WG.on=WG.addListener=function(e,t,n,r,i){return GG(this,function(e,t,n,r,i,a,o){FF(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})},e,t,n,r,i),this},WG.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},WG.removeListener=WG.off=function(e,t,n,r){var i=this;this.emitting!==0&&(this.listeners=qL(this.listeners));for(var a=this.listeners,o=function(o){var s=a[o];GG(i,function(t,n,r,i,c,l){if((s.type===r||e===`*`)&&(!i&&s.namespace!==`.*`||s.namespace===i)&&(!c||t.qualifierCompare(s.qualifier,c))&&(!l||s.callback===l))return a.splice(o,1),!1},e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},WG.removeAllListeners=function(){return this.removeListener(`*`)},WG.emit=WG.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,IF(t)||(t=[t]),qG(this,function(e,a){n!=null&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(){var n=r[s];if(n.type===a.type&&(!n.namespace||n.namespace===a.namespace||n.namespace===zG)&&e.eventMatches(e.context,n,a)){var i=[a];t!=null&&eR(i,t),e.beforeEmit(e.context,n,a),n.conf&&n.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==n}));var o=e.callbackContext(e.context,n,a),c=n.callback.apply(o,i);e.afterEmit(e.context,n,a),c===!1&&(a.stopPropagation(),a.preventDefault())}},s=0;s<i;s++)o();e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var JG={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null?!0:e!==n.target&&HF(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier==null?e:n.target},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},YG=function(e){return PF(e)?new BW(e):e},XG={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||=new UG(JG,t)}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=YG(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=YG(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=YG(t),i=0;i<this.length;i++)this[i].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=YG(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};gW.eventAliasesOn(XG);var ZG={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(PF(e)||VF(e))return new BW(e).filter(this);if(FF(e)){for(var n=this.spawn(),r=this,i=0;i<r.length;i++){var a=r[i];(t?e.apply(t,[a,i,r]):e(a,i,r))&&n.push(a)}return n}return this.spawn()},not:function(e){if(e){PF(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t}else return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(PF(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=this,i=e,a=this.length<e.length,o=a?r:i,s=a?i:r,c=0;c<o.length;c++){var l=o[c];s.has(l)&&n.push(l)}return n},xor:function(e){var t=this._private.cy;PF(e)&&(e=t.$(e));var n=this.spawn(),r=this,i=e,a=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return a(r,i),a(i,r),n},diff:function(e){var t=this._private.cy;PF(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),a=this,o=e,s=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):n.push(a)}};return s(a,o,n),s(o,a,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(PF(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i];this.has(a)||r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&PF(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var c=this.length++;this[c]=o,i.set(s,{ele:o,index:c})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&PF(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;i<r.length;i++){var a=r[i],o=t?e.apply(t,[a,i,r]):e(a,i,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,i=0;i<r.length;i++)n=e(n,r[i],i,r);return n},max:function(e,t){for(var n=-1/0,r,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s>n&&(n=s,r=o)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s<n&&(n=s,r=o)}return{value:n,ele:r}}},QG=ZG;QG.u=QG[`|`]=QG[`+`]=QG.union=QG.or=QG.add,QG[`\\`]=QG[`!`]=QG[`-`]=QG.difference=QG.relativeComplement=QG.subtract=QG.not,QG.n=QG[`&`]=QG[`.`]=QG.and=QG.intersection=QG.intersect,QG[`^`]=QG[`(+)`]=QG[`(-)`]=QG.symmetricDifference=QG.symdiff=QG.xor,QG.fnFilter=QG.filterFn=QG.stdFilter=QG.filter,QG.complement=QG.abscomp=QG.absoluteComplement;var $G={isNode:function(){return this.group()===`nodes`},isEdge:function(){return this.group()===`edges`},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},eK=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle(`z-compound-depth`);return t.value===`auto`?n?e.zDepth():0:t.value===`bottom`?-1:t.value===`top`?LL:0}var i=r(e)-r(t);if(i!==0)return i;function a(e){return e.pstyle(`z-index-compare`).value===`auto`?+!!e.isNode():0}var o=a(e)-a(t);if(o!==0)return o;var s=e.pstyle(`z-index`).value-t.pstyle(`z-index`).value;return s===0?e.poolIndex()-t.poolIndex():s},tK={forEach:function(e,t){if(FF(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if((t?e.apply(t,[i,r,this]):e(i,r,this))===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;t??=r,e??=0,e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!FF(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(eK)},zDepth:function(){var e=this[0];if(e){var t=e._private;if(t.group===`nodes`){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:LL-1}else{var r=t.source,i=t.target,a=r.zDepth(),o=i.zDepth();return Math.max(a,o,0)}}}};tK.each=tK.forEach,(function(){var e=`undefined`;(typeof Symbol>`u`?`undefined`:TF(Symbol))!=e&&TF(Symbol.iterator)!=e&&(tK[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return gF({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})})})();var nK=ZL({nodeDimensionsIncludeLabels:!1}),rK={layoutDimensions:function(e){e=nK(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(e){return!e.isParent()}),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=QF(n,o);e.emit({type:`layoutstart`,layout:e}),e.animations=[];var c=function(e,t,n){var r={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(n.x-r.x)*e,y:(n.y-r.y)*e};return{x:r.x+i.x,y:r.y+i.y}},l=t.spacingFactor&&t.spacingFactor!==1,u=function(){if(!l)return null;for(var e=XR(),t=0;t<r.length;t++){var n=r[t],i=s(n,t);ez(e,i.x,i.y)}return e}(),d=QF(function(e,n){var r=s(e,n);return l&&(r=c(Math.abs(t.spacingFactor),u,r)),t.transform!=null&&(r=t.transform(e,r)),r},o);if(t.animate){for(var f=0;f<r.length;f++){var p=r[f],m=d(p,f);if(t.animateFilter==null||t.animateFilter(p,f)){var h=p.animation({position:m,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(h)}else p.position(m)}if(t.fit){var g=i.animation({fit:{boundingBox:a.boundingBoxAt(d),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else if(t.zoom!==void 0&&t.pan!==void 0){var _=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(_)}e.animations.forEach(function(e){return e.play()}),e.one(`layoutready`,t.ready),e.emit({type:`layoutready`,layout:e}),gV.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one(`layoutstop`,t.stop),e.emit({type:`layoutstop`,layout:e})})}else r.positions(d),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one(`layoutready`,t.ready),e.emit({type:`layoutready`,layout:e}),e.one(`layoutstop`,t.stop),e.emit({type:`layoutstop`,layout:e});return this},layout:function(e){return this.cy().makeLayout(pI({},e,{eles:this}))}};rK.createLayout=rK.makeLayout=rK.layout;function iK(e,t,n){var r=n._private,i=r.styleCache=r.styleCache||[],a;return(a=i[e])??(a=i[e]=t(n)),a}function aK(e,t){return e=OL(e),function(n){return iK(e,t,n)}}function oK(e,t){e=OL(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return iK(e,n,t)}}var sK={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(e){return e._private.styleCache=null};if(e.hasCompoundNodes()){var n=this.spawnSelf().merge(this.descendants()).merge(this.parents());n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(e){t(e),e.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),r=this;e=!!(e||e===void 0),n&&(r=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=r;return e?i.emitAndNotify(`style`):i.emit(`style`),r.forEach(function(e){return e._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],r=n.cy();if(r.styleEnabled()&&n)return n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n)),n._private.style[e]??(t?r.style().getDefaultProperty(e):null)},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue===void 0?n.value:n.pfValue}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,i=n.style();if(LF(e)){var a=e;i.applyBypass(this,a,r),this.emitAndNotify(`style`)}else if(PF(e))if(t===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,t,r),this.emitAndNotify(`style`);else if(e===void 0){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),i=this;if(e===void 0)for(var a=0;a<i.length;a++){var o=i[a];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var s=0;s<i.length;s++){var c=i[s];r.removeBypasses(c,e,n)}}return this.emitAndNotify(`style`),this},show:function(){return this.css(`display`,`element`),this},hide:function(){return this.css(`display`,`none`),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle(`opacity`).value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++)i=a[o].pstyle(`opacity`).value*i;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();if(e)return t?e.effectiveOpacity()===0:e.pstyle(`opacity`).value===0},backgrounding:function(){return this.cy().styleEnabled()?!!this[0]._private.backgrounding:!1}};function cK(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++){var i=n[r];if(!t(i))return!1}return!0}function lK(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||cK(i,r);var s=o.source,c=o.target;return n(s)&&(!a||cK(s,n))&&(s===c||n(c)&&(!a||cK(c,n)))}}}var uK=aK(`eleTakesUpSpace`,function(e){return e.pstyle(`display`).value===`element`&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});sK.takesUpSpace=oK(`takesUpSpace`,lK({ok:uK})),sK.interactive=oK(`interactive`,lK({ok:aK(`eleInteractive`,function(e){return e.pstyle(`events`).value===`yes`&&e.pstyle(`visibility`).value===`visible`&&uK(e)}),parentOk:aK(`parentInteractive`,function(e){return e.pstyle(`visibility`).value===`visible`&&uK(e)}),edgeOkViaNode:uK})),sK.noninteractive=function(){var e=this[0];if(e)return!e.interactive()},sK.visible=oK(`visible`,lK({ok:aK(`eleVisible`,function(e){return e.pstyle(`visibility`).value===`visible`&&e.pstyle(`opacity`).pfValue!==0&&uK(e)}),edgeOkViaNode:uK})),sK.hidden=function(){var e=this[0];if(e)return!e.visible()},sK.isBundledBezier=oK(`isBundledBezier`,function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle(`curve-style`).value===`bezier`&&this.takesUpSpace():!1}),sK.bypass=sK.css=sK.style,sK.renderedCss=sK.renderedStyle,sK.removeBypass=sK.removeCss=sK.removeStyle,sK.pstyle=sK.parsedStyle;var dK={};function fK(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(t.length===1&&FF(t[0])){var a=t[0];this.on(e.event,a)}else if(t.length===0||t.length===1&&IF(t[0])){for(var o=t.length===1?t[0]:null,s=0;s<this.length;s++){var c=this[s],l=!e.ableField||c._private[e.ableField],u=c._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(c);if(d!==void 0&&(l=d,!d))return this}l&&(c._private[e.field]=e.value,u&&n.push(c))}var f=this.spawn(n);f.updateStyle(),f.emit(e.event),o&&f.emit(o)}return this}}function pK(e){dK[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},dK[e.on]=fK({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),dK[e.off]=fK({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}pK({field:`locked`,overrideField:function(e){return e.cy().autolock()?!0:void 0},on:`lock`,off:`unlock`}),pK({field:`grabbable`,overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:`grabify`,off:`ungrabify`}),pK({field:`selected`,ableField:`selectable`,overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:`select`,off:`unselect`}),pK({field:`selectable`,overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:`selectify`,off:`unselectify`}),dK.deselect=dK.unselect,dK.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},pK({field:`active`,on:`activate`,off:`unactivate`}),pK({field:`pannable`,on:`panify`,off:`unpanify`}),dK.inactive=function(){var e=this[0];if(e)return!e._private.active};var mK={},hK=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode()){for(var o=!1,s=a.connectedEdges(),c=0;c<s.length;c++){var l=s[c],u=l.source(),d=l.target();if(e.noIncomingEdges&&d===a&&u!==a||e.noOutgoingEdges&&u===a&&d!==a){o=!0;break}}o||r.push(a)}}return this.spawn(r,!0).filter(t)}},gK=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode())for(var o=a.connectedEdges(),s=0;s<o.length;s++){var c=o[s],l=c.source(),u=c.target();e.outgoing&&l===a?(r.push(c),r.push(u)):e.incoming&&u===a&&(r.push(c),r.push(l))}}return this.spawn(r,!0).filter(t)}},_K=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(a.length===0)break;for(var o=!1,s=0;s<a.length;s++){var c=a[s],l=c.id();i[l]||(i[l]=!0,r.push(c),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};mK.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},pI(mK,{roots:hK({noIncomingEdges:!0}),leaves:hK({noOutgoingEdges:!0}),outgoers:UW(gK({outgoing:!0}),`outgoers`),successors:_K({outgoing:!0}),incomers:UW(gK({incoming:!0}),`incomers`),predecessors:_K({})}),pI(mK,{neighborhood:UW(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],c=s.source(),l=s.target(),u=i===c?l:c;u.length>0&&t.push(u[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},`neighborhood`),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),mK.neighbourhood=mK.neighborhood,mK.closedNeighbourhood=mK.closedNeighborhood,mK.openNeighbourhood=mK.openNeighborhood,pI(mK,{source:UW(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},`source`),target:UW(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},`target`),sources:vK({attr:`source`}),targets:vK({attr:`target`})});function vK(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}pI(mK,{edgesWith:UW(yK(),`edgesWith`),edgesTo:UW(yK({thisIsSrc:!0}),`edgesTo`)});function yK(e){return function(t){var n=[],r=this._private.cy,i=e||{};PF(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var c=o[s],l=c._private.data,u=this.hasElementWithId(l.source)&&t.hasElementWithId(l.target),d=t.hasElementWithId(l.source)&&this.hasElementWithId(l.target);(u||d)&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!u||i.thisIsTgt&&!d)||n.push(c))}return this.spawn(n,!0)}}pI(mK,{connectedEdges:UW(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];if(i.isNode())for(var a=i._private.edges,o=0;o<a.length;o++){var s=a[o];t.push(s)}}return this.spawn(t,!0).filter(e)},`connectedEdges`),connectedNodes:UW(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];i.isEdge()&&(t.push(i.source()[0]),t.push(i.target()[0]))}return this.spawn(t,!0).filter(e)},`connectedNodes`),parallelEdges:UW(bK(),`parallelEdges`),codirectedEdges:UW(bK({codirected:!0}),`codirectedEdges`)});function bK(e){return e=pI({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,c=s._private.data.id,l=o.data.target,u=s._private.edges,d=0;d<u.length;d++){var f=u[d],p=f._private.data,m=p.target,h=p.source,g=m===l&&h===c,_=c===m&&l===h;(i.codirected&&g||!i.codirected&&(g||_))&&n.push(f)}return this.spawn(n,!0).filter(t)}}pI(mK,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=e==null?t.nodes():e.nodes(),a=[];e!=null&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();var s=function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach(function(n){n.connectedEdges().forEach(function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)})})};do s();while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),mK.componentsOf=mK.components;var xK=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){HL(`A collection must have a reference to the core`);return}var i=new rR,a=!1;if(!t)t=[];else if(t.length>0&&LF(t[0])&&!HF(t[0])){a=!0;for(var o=[],s=new oR,c=0,l=t.length;c<l;c++){var u=t[c];u.data??={};var d=u.data;if(d.id==null)d.id=JL();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;var f=new sR(e,u,!1);o.push(f),s.add(d.id)}t=o}this.length=0;for(var p=0,m=t.length;p<m;p++){var h=t[p][0];if(h!=null){var g=h._private.data.id;(!n||!i.has(g))&&(n&&i.set(g,{index:this.length,ele:h}),this[this.length]=h,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap??this.rebuildMap(),this.lazyMap},set map(e){this.lazyMap=e},rebuildMap:function(){for(var e=this.lazyMap=new rR,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=i),a&&!r&&this.restore()},SK=sR.prototype=xK.prototype=Object.create(Array.prototype);SK.instanceString=function(){return`collection`},SK.spawn=function(e,t){return new xK(this.cy(),e,t)},SK.spawnSelf=function(){return this.spawn(this)},SK.cy=function(){return this._private.cy},SK.renderer=function(){return this._private.cy.renderer()},SK.element=function(){return this[0]},SK.collection=function(){return UF(this)?this:new xK(this._private.cy,[this])},SK.unique=function(){return new xK(this._private.cy,this,!0)},SK.hasElementWithId=function(e){return e=``+e,this._private.map.has(e)},SK.getElementById=function(e){e=``+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new xK(t)},SK.$id=SK.getElementById,SK.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},SK.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},SK.indexOfId=function(e){return e=``+e,this._private.map.get(e).index},SK.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(LF(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,c=e.data.target;s!=null&&s!=i.source&&(o.source=``+s,a=!0),c!=null&&c!=i.target&&(o.target=``+c,a=!0),a&&(t=t.move(o))}else{var l=`parent`in e.data,u=e.data.parent;l&&(u!=null||i.parent!=null)&&u!=i.parent&&(u===void 0&&(u=null),u!=null&&(u=``+u),t=t.move({parent:u}))}}e.position&&t.position(e.position);var d=function(n,i,a){var o=e[n];o!=null&&o!==r[n]&&(o?t[i]():t[a]())};return d(`removed`,`remove`,`restore`),d(`selected`,`select`,`unselect`),d(`selectable`,`selectify`,`unselectify`),d(`locked`,`lock`,`unlock`),d(`grabbable`,`grabify`,`ungrabify`),d(`pannable`,`panify`,`unpanify`),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}else if(e===void 0){var f={data:KL(r.data),position:KL(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};f.classes=``;var p=0;return r.classes.forEach(function(e){return f.classes+=p++===0?e:` `+e}),f}}},SK.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},SK.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=new sR(e,this[n].json(),!1);t.push(r)}return new xK(e,t)},SK.copy=SK.clone,SK.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),i=r._private,a=[],o=[],s,c=0,l=n.length;c<l;c++){var u=n[c];t&&!u.removed()||(u.isNode()?a.push(u):o.push(u))}s=a.concat(o);var d,f=function(){s.splice(d,1),d--};for(d=0;d<s.length;d++){var p=s[d],m=p._private,h=m.data;if(p.clearTraversalCache(),!(!t&&!m.removed)){if(h.id===void 0)h.id=JL();else if($(h.id))h.id=``+h.id;else if(qF(h.id)||!PF(h.id)){HL("Can not create element with invalid string ID `"+h.id+"`"),f();continue}else if(r.hasElementWithId(h.id)){HL("Can not create second element with ID `"+h.id+"`"),f();continue}}var g=h.id;if(p.isNode()){var _=m.position;_.x??=0,_.y??=0}if(p.isEdge()){for(var v=p,y=[`source`,`target`],b=y.length,x=!1,S=0;S<b;S++){var C=y[S],w=h[C];$(w)&&(w=h[C]=``+h[C]),w==null||w===``?(HL("Can not create edge `"+g+"` with unspecified "+C),x=!0):r.hasElementWithId(w)||(HL("Can not create edge `"+g+"` with nonexistent "+C+" `"+w+"`"),x=!0)}if(x){f();continue}var T=r.getElementById(h.source),E=r.getElementById(h.target);T.same(E)?T._private.edges.push(v):(T._private.edges.push(v),E._private.edges.push(v)),v._private.source=T,v._private.target=E}m.map=new rR,m.map.set(g,{ele:p,index:0}),m.removed=!1,t&&r.addToPool(p)}for(var D=0;D<a.length;D++){var O=a[D],k=O._private.data;$(k.parent)&&(k.parent=``+k.parent);var A=k.parent;if(A!=null||O._private.parent){var j=O._private.parent?r.collection().merge(O._private.parent):r.getElementById(A);if(j.empty())k.parent=void 0;else if(j[0].removed())WL(`Node added with missing parent, reference to parent removed`),k.parent=void 0,O._private.parent=null;else{for(var M=!1,N=j;!N.empty();){if(O.same(N)){M=!0,k.parent=void 0;break}N=N.parent()}M||(j[0]._private.children.push(O),O._private.parent=j[0],i.hasCompoundNodes=!0)}}}if(s.length>0){for(var P=s.length===n.length?n:new xK(r,s),F=0;F<P.length;F++){var I=P[F];I.isNode()||(I.parallelEdges().clearTraversalCache(),I.source().clearTraversalCache(),I.target().clearTraversalCache())}(i.hasCompoundNodes?r.collection().merge(P).merge(P.connectedNodes()).merge(P.parent()):P).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?P.emitAndNotify(`add`):t&&P.emit(`add`)}return n},SK.removed=function(){var e=this[0];return e&&e._private.removed},SK.inside=function(){var e=this[0];return e&&!e._private.removed},SK.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n<t.length;n++)c(t[n])}function s(e){for(var t=e._private.children,n=0;n<t.length;n++)c(t[n])}function c(e){var n=i[e.id()];t&&e.removed()||n||(i[e.id()]=!0,e.isNode()?(r.push(e),o(e),s(e)):r.unshift(e))}for(var l=0,u=n.length;l<u;l++){var d=n[l];c(d)}function f(e,t){var n=e._private.edges;QL(n,t),e.clearTraversalCache()}function p(e){e.clearTraversalCache()}var m=[];m.ids={};function h(e,t){t=t[0],e=e[0];var n=e._private.children,r=e.id();QL(n,t),t._private.parent=null,m.ids[r]||(m.ids[r]=!0,m.push(e))}n.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var g=0;g<r.length;g++){var _=r[g];if(_.isEdge()){var v=_.source()[0],y=_.target()[0];f(v,_),f(y,_);for(var b=_.parallelEdges(),x=0;x<b.length;x++){var S=b[x];p(S),S.isBundledBezier()&&S.dirtyBoundingBoxCache()}}else{var C=_.parent();C.length!==0&&h(C,_)}t&&(_._private.removed=!0)}var w=a._private.elements;a._private.hasCompoundNodes=!1;for(var T=0;T<w.length;T++)if(w[T].isParent()){a._private.hasCompoundNodes=!0;break}var E=new xK(this.cy(),r);E.size()>0&&(e?E.emitAndNotify(`remove`):t&&E.emit(`remove`));for(var D=0;D<m.length;D++){var O=m[D];(!t||!O.removed())&&O.updateStyle()}return E},SK.move=function(e){var t=this._private.cy,n=this,r=!1,i=!1,a=function(e){return e==null?e:``+e};if(e.source!==void 0||e.target!==void 0){var o=a(e.source),s=a(e.target),c=o!=null&&t.hasElementWithId(o),l=s!=null&&t.hasElementWithId(s);(c||l)&&(t.batch(function(){n.remove(r,i),n.emitAndNotify(`moveout`);for(var e=0;e<n.length;e++){var t=n[e],a=t._private.data;t.isEdge()&&(c&&(a.source=o),l&&(a.target=s))}n.restore(r,i)}),n.emitAndNotify(`move`))}else if(e.parent!==void 0){var u=a(e.parent);if(u===null||t.hasElementWithId(u)){var d=u===null?void 0:u;t.batch(function(){var e=n.remove(r,i);e.emitAndNotify(`moveout`);for(var t=0;t<n.length;t++){var a=n[t],o=a._private.data;a.isNode()&&(o.parent=d)}e.restore(r,i)}),n.emitAndNotify(`move`)}}return this},[oV,_W,vW,HW,WW,ZW,QW,PG,XG,ZG,$G,tK,rK,sK,dK,mK].forEach(function(e){pI(SK,e)});var CK={add:function(e){var t,n=this;if(VF(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],a=0;a<r.length;a++){var o=r[a];i.push(o.json())}t=new xK(n,i)}}else if(IF(e))t=new xK(n,e);else if(LF(e)&&(IF(e.nodes)||IF(e.edges))){for(var s=e,c=[],l=[`nodes`,`edges`],u=0,d=l.length;u<d;u++){var f=l[u],p=s[f];if(IF(p))for(var m=0,h=p.length;m<h;m++){var g=pI({group:f},p[m]);c.push(g)}}t=new xK(n,c)}else t=new sR(n,e).collection();return t},remove:function(e){if(!VF(e)&&PF(e)){var t=e;e=this.$(t)}return e.remove()}};function wK(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,c=11,l=1/(c-1),u=typeof Float32Array<`u`;if(arguments.length!==4)return!1;for(var d=0;d<4;++d)if(typeof arguments[d]!=`number`||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var f=u?new Float32Array(c):Array(c);function p(e,t){return 1-3*t+3*e}function m(e,t){return 3*t-6*e}function h(e){return 3*e}function g(e,t,n){return((p(t,n)*e+m(t,n))*e+h(t))*e}function _(e,t,n){return 3*p(t,n)*e*e+2*m(t,n)*e+h(t)}function v(t,r){for(var a=0;a<i;++a){var o=_(r,e,n);if(o===0)return r;var s=g(r,e,n)-t;r-=s/o}return r}function y(){for(var t=0;t<c;++t)f[t]=g(t*l,e,n)}function b(t,r,i){var a,c,l=0;do c=r+(i-r)/2,a=g(c,e,n)-t,a>0?i=c:r=c;while(Math.abs(a)>o&&++l<s);return c}function x(t){for(var r=0,i=1,o=c-1;i!==o&&f[i]<=t;++i)r+=l;--i;var s=(t-f[i])/(f[i+1]-f[i]),u=r+s*l,d=_(u,e,n);return d>=a?v(t,u):d===0?u:b(t,r,r+l)}var S=!1;function C(){S=!0,(e!==t||n!==r)&&y()}var w=function(i){return S||C(),e===t&&n===r?i:i===0?0:i===1?1:g(x(i),t,r)};w.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var T=`generateBezier(`+[e,t,n,r]+`)`;return w.toString=function(){return T},w}var TK=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,r*.5,i),o=t(n,r*.5,a),s=t(n,r,o),c=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),l=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x+=c*r,n.v+=l*r,n}return function e(t,r,i){var a={x:-1,v:0,tension:null,friction:null},o=[0],s=0,c=1/1e4,l=16/1e3,u,d,f;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i||=null,a.tension=t,a.friction=r,u=i!==null,u?(s=e(t,r),d=s/i*l):d=l;f=n(f||a,d),o.push(1+f.x),s+=16,Math.abs(f.x)>c&&Math.abs(f.v)>c;);return u?function(e){return o[e*(o.length-1)|0]}:s}}(),EK=function(e,t,n,r){var i=wK(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},DK={linear:function(e,t,n){return e+(t-e)*n},ease:EK(.25,.1,.25,1),"ease-in":EK(.42,0,1,1),"ease-out":EK(0,0,.58,1),"ease-in-out":EK(.42,0,.58,1),"ease-in-sine":EK(.47,0,.745,.715),"ease-out-sine":EK(.39,.575,.565,1),"ease-in-out-sine":EK(.445,.05,.55,.95),"ease-in-quad":EK(.55,.085,.68,.53),"ease-out-quad":EK(.25,.46,.45,.94),"ease-in-out-quad":EK(.455,.03,.515,.955),"ease-in-cubic":EK(.55,.055,.675,.19),"ease-out-cubic":EK(.215,.61,.355,1),"ease-in-out-cubic":EK(.645,.045,.355,1),"ease-in-quart":EK(.895,.03,.685,.22),"ease-out-quart":EK(.165,.84,.44,1),"ease-in-out-quart":EK(.77,0,.175,1),"ease-in-quint":EK(.755,.05,.855,.06),"ease-out-quint":EK(.23,1,.32,1),"ease-in-out-quint":EK(.86,0,.07,1),"ease-in-expo":EK(.95,.05,.795,.035),"ease-out-expo":EK(.19,1,.22,1),"ease-in-out-expo":EK(1,0,0,1),"ease-in-circ":EK(.6,.04,.98,.335),"ease-out-circ":EK(.075,.82,.165,1),"ease-in-out-circ":EK(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return DK.linear;var r=TK(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":EK};function OK(e,t,n,r,i){if(r===1||t===n)return n;var a=i(t,n,r);return e==null?a:((e.roundValue||e.color)&&(a=Math.round(a)),e.min!==void 0&&(a=Math.max(a,e.min)),e.max!==void 0&&(a=Math.min(a,e.max)),a)}function kK(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!==`%`)?e.pfValue:e.value:e}function AK(e,t,n,r,i){var a=i==null?null:i.type;n<0?n=0:n>1&&(n=1);var o=kK(e,i),s=kK(t,i);if($(o)&&$(s))return OK(a,o,s,n,r);if(IF(o)&&IF(s)){for(var c=[],l=0;l<s.length;l++){var u=o[l],d=s[l];if(u!=null&&d!=null){var f=OK(a,u,d,n,r);c.push(f)}else c.push(d)}return c}}function jK(e,t,n,r){var i=!r,a=e._private,o=t._private,s=o.easing,c=o.startTime,l=(r?e:e.cy()).style();if(!o.easingImpl)if(s==null)o.easingImpl=DK.linear;else{var u=PF(s)?l.parse(`transition-timing-function`,s).value:s,d,f;PF(u)?(d=u,f=[]):(d=u[1],f=u.slice(2).map(function(e){return+e})),f.length>0?(d===`spring`&&f.push(o.duration),o.easingImpl=DK[d].apply(null,f)):o.easingImpl=DK[d]}var p=o.easingImpl,m=o.duration===0?1:(n-c)/o.duration;if(o.applying&&(m=o.progress),m<0?m=0:m>1&&(m=1),o.delay==null){var h=o.startPosition,g=o.position;if(g&&i&&!e.locked()){var _={};MK(h.x,g.x)&&(_.x=AK(h.x,g.x,m,p)),MK(h.y,g.y)&&(_.y=AK(h.y,g.y,m,p)),e.position(_)}var v=o.startPan,y=o.pan,b=a.pan,x=y!=null&&r;x&&(MK(v.x,y.x)&&(b.x=AK(v.x,y.x,m,p)),MK(v.y,y.y)&&(b.y=AK(v.y,y.y,m,p)),e.emit(`pan`));var S=o.startZoom,C=o.zoom,w=C!=null&&r;w&&(MK(S,C)&&(a.zoom=YR(a.minZoom,AK(S,C,m,p),a.maxZoom)),e.emit(`zoom`)),(x||w)&&e.emit(`viewport`);var T=o.style;if(T&&T.length>0&&i){for(var E=0;E<T.length;E++){var D=T[E],O=D.name,k=D,A=o.startStyle[O],j=l.properties[A.name],M=AK(A,k,m,p,j);l.overrideBypass(e,O,M)}e.emit(`style`)}}return o.progress=m,m}function MK(e,t){return e==null||t==null?!1:$(e)&&$(t)?!0:!!(e&&t)}function NK(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function PK(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(a.length===0){var c=o.shift();c&&a.push(c)}for(var l=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t];n()}e.splice(0,e.length)},u=a.length-1;u>=0;u--){var d=a[u],f=d._private;if(f.stopped){a.splice(u,1),f.hooked=!1,f.playing=!1,f.started=!1,l(f.frames);continue}!f.playing&&!f.applying||(f.playing&&f.applying&&(f.applying=!1),f.started||NK(t,d,e),jK(t,d,e,n),f.applying&&=!1,l(f.frames),f.step!=null&&f.step(e),d.completed()&&(a.splice(u,1),f.hooked=!1,f.playing=!1,f.started=!1,l(f.completes)),s=!0)}return!n&&a.length===0&&o.length===0&&r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=n[o],c=i(s);a||=c}var l=i(t,!0);(a||l)&&(n.length>0?t.notify(`draw`,n):t.notify(`draw`)),n.unmerge(r),t.emit(`step`)}var FK={animate:gW.animate(),animation:gW.animation(),animated:gW.animated(),clearQueue:gW.clearQueue(),delay:gW.delay(),delayAnimation:gW.delayAnimation(),stop:gW.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&gL(function(n){PK(n,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(t,n){PK(n,e)},n.beforeRenderPriorities.animations):t()}},IK={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null?!0:e!==n.target&&HF(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier==null?e:n.target}},LK=function(e){return PF(e)?new BW(e):e},RK={createEmitter:function(){var e=this._private;return e.emitter||=new UG(IK,this),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,LK(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,LK(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,LK(t),n),this},once:function(e,t,n){return this.emitter().one(e,LK(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};gW.eventAliasesOn(RK);var zK={png:function(e){var t=this._private.renderer;return e||={},t.png(e)},jpg:function(e){var t=this._private.renderer;return e||={},e.bg=e.bg||`#fff`,t.jpg(e)}};zK.jpeg=zK.jpg;var BK={layout:function(e){var t=this;if(e==null){HL(`Layout options must be specified to make a layout`);return}if(e.name==null){HL("A `name` must be specified to make a layout");return}var n=e.name,r=t.extension(`layout`,n);if(r==null){HL("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}return new r(pI({},e,{cy:t,eles:PF(e.eles)?t.$(e.eles):e.eles==null?t.$():e.eles}))}};BK.createLayout=BK.makeLayout=BK.layout;var VK={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t);return}if(n.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount??=0,e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}})}},HK=ZL({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),UK={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify(`draw`),this},resize:function(){return this.invalidateSize(),this.emitAndNotify(`resize`),this},initRenderer:function(e){var t=this,n=t.extension(`renderer`,e.name);if(n==null){HL(`Can not initialise: No such renderer \`${e.name}\` found. Did you forget to import it and \`cytoscape.use()\` it?`);return}e.wheelSensitivity!==void 0&&WL(`You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.`);var r=HK(e);r.cy=t,t._private.renderer=new n(r),this.notify(`init`)},destroyRenderer:function(){var e=this;e.notify(`destroy`);var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on(`render`,e)},offRender:function(e){return this.off(`render`,e)}};UK.invalidateDimensions=UK.resize;var WK={collection:function(e,t){return PF(e)?this.$(e):VF(e)?e.collection():IF(e)?(t||={},new xK(this,e,t.unique,t.removed)):new xK(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};WK.elements=WK.filter=WK.$;var GK={},KK=`t`,qK=`f`;GK.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r<e.length;r++){var i=e[r],a=t.getContextMeta(i);if(!a.empty){var o=t.getContextStyle(a),s=t.applyContextStyle(a,o,i);i._private.appliedInitStyle?t.updateTransitions(i,s.diffProps):i._private.appliedInitStyle=!0,t.updateStyleHints(i)&&n.push(i)}}return n},GK.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},i=e+`-`+t,a=r[i];if(a)return a;for(var o=[],s={},c=0;c<n.length;c++){var l=n[c],u=e[c]===KK,d=t[c]===KK,f=u!==d,p=l.mappedProperties.length>0;if(f||d&&p){var m=void 0;f&&p||f?m=l.properties:p&&(m=l.mappedProperties);for(var h=0;h<m.length;h++){for(var g=m[h],_=g.name,v=!1,y=c+1;y<n.length;y++){var b=n[y];if(t[y]===KK&&(v=b.properties[g.name]!=null,v))break}!s[_]&&!v&&(s[_]=!0,o.push(_))}}}return r[i]=o,o},GK.getContextMeta=function(e){for(var t=this,n=``,r,i=e._private.styleCxtKey||``,a=0;a<t.length;a++){var o=t[a];o.selector&&o.selector.matches(e)?n+=KK:n+=qK}return r=t.getPropertiesDiff(i,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}},GK.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var i={_private:{key:t}},a=0;a<n.length;a++){var o=n[a];if(t[a]===KK)for(var s=0;s<o.properties.length;s++){var c=o.properties[s];i[c.name]=c}}return r[t]=i,i},GK.applyContextStyle=function(e,t,n){for(var r=this,i=e.diffPropNames,a={},o=r.types,s=0;s<i.length;s++){var c=i[s],l=t[c],u=n.pstyle(c);if(!l)if(u)l=u.bypass?{name:c,deleteBypassed:!0}:{name:c,delete:!0};else continue;if(u!==l){if(l.mapped===o.fn&&u!=null&&u.mapping!=null&&u.mapping.value===l.value){var d=u.mapping;if((d.fnValue=l.value(n))===d.prevFnValue)continue}var f=a[c]={prev:u};r.applyParsedProperty(n,l),f.next=n.pstyle(c),f.next&&f.next.bypass&&(f.next=f.next.bypassed)}}return{diffProps:a}},GK.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s=t.group===`nodes`,c=e._private.style;r=Object.keys(c);for(var l=0;l<i.length;l++){var u=i[l];t.styleKeys[u]=[vL,bL]}for(var d=function(e,n){return t.styleKeys[n][0]=SL(e,t.styleKeys[n][0])},f=function(e,n){return t.styleKeys[n][1]=CL(e,t.styleKeys[n][1])},p=function(e,t){d(e,t),f(e,t)},m=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);d(r,t),f(r,t)}},h=2e9,g=function(e){return-128<e&&e<128&&Math.floor(e)!==e?h-(e*1024|0):e},_=0;_<r.length;_++){var v=r[_],y=c[v];if(y!=null){var b=this.properties[v],x=b.type,S=b.groupKey,C=void 0;b.hashOverride==null?y.pfValue!=null&&(C=y.pfValue):C=b.hashOverride(e,y);var w=b.enums==null?y.value:null,T=C!=null,E=T||w!=null,D=y.units;x.number&&E&&!x.multiple?(p(g(T?C:w),S),!T&&D!=null&&m(D,S)):m(y.strValue,S)}}for(var O=[vL,bL],k=0;k<i.length;k++){var A=i[k],j=t.styleKeys[A];O[0]=SL(j[0],O[0]),O[1]=CL(j[1],O[1])}t.styleKey=wL(O[0],O[1]);var M=t.styleKeys;t.labelDimsKey=TL(M.labelDimensions);var N=a(e,[`label`],M.labelDimensions);if(t.labelKey=TL(N),t.labelStyleKey=TL(EL(M.commonLabel,N)),!s){var P=a(e,[`source-label`],M.labelDimensions);t.sourceLabelKey=TL(P),t.sourceLabelStyleKey=TL(EL(M.commonLabel,P));var F=a(e,[`target-label`],M.labelDimensions);t.targetLabelKey=TL(F),t.targetLabelStyleKey=TL(EL(M.commonLabel,F))}if(s){var I=t.styleKeys,L=I.nodeBody,R=I.nodeBorder,ee=I.nodeOutline,z=I.backgroundImage,B=I.compound,V=I.pie,H=I.stripe;t.nodeKey=TL([L,R,ee,z,B,V,H].filter(function(e){return e!=null}).reduce(EL,[vL,bL])),t.hasPie=V!=null&&V[0]!==vL&&V[1]!==bL,t.hasStripe=H!=null&&H[0]!==vL&&H[1]!==bL}return o!==t.styleKey},GK.clearStyleHints=function(e){var t=e._private;t.styleCxtKey=``,t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null,t.hasStripe=null},GK.applyParsedProperty=function(e,t){var n=this,r=t,i=e._private.style,a,o=n.types,s=n.properties[r.name].type,c=r.bypass,l=i[r.name],u=l&&l.bypass,d=e._private,f=`mapping`,p=function(e){return e==null?null:e.pfValue==null?e.value:e.pfValue},m=function(){var t=p(l),i=p(r);n.checkTriggers(e,r.name,t,i)};if(t.name===`curve-style`&&e.isEdge()&&(t.value!==`bezier`&&e.isLoop()||t.value===`haystack`&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,`bezier`,c)),r.delete)return i[r.name]=void 0,m(),!0;if(r.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,m(),!0):!1:(m(),!0);if(r.deleteBypass)return l?l.bypass?(i[r.name]=l.bypassed,m(),!0):!1:(m(),!0);var h=function(){WL("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case o.mapData:for(var g=r.field.split(`.`),_=d.data,v=0;v<g.length&&_;v++){var y=g[v];_=_[y]}if(_==null)return h(),!1;var b;if($(_)){var x=r.fieldMax-r.fieldMin;b=x===0?0:(_-r.fieldMin)/x}else return WL("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+`: `+_+"` for `"+e.id()+"` is non-numeric)"),!1;if(b<0?b=0:b>1&&(b=1),s.color){var S=r.valueMin[0],C=r.valueMax[0],w=r.valueMin[1],T=r.valueMax[1],E=r.valueMin[2],D=r.valueMax[2],O=r.valueMin[3]==null?1:r.valueMin[3],k=r.valueMax[3]==null?1:r.valueMax[3],A=[Math.round(S+(C-S)*b),Math.round(w+(T-w)*b),Math.round(E+(D-E)*b),Math.round(O+(k-O)*b)];a={bypass:r.bypass,name:r.name,value:A,strValue:`rgb(`+A[0]+`, `+A[1]+`, `+A[2]+`)`}}else if(s.number){var j=r.valueMin+(r.valueMax-r.valueMin)*b;a=this.parse(r.name,j,r.bypass,f)}else return!1;if(!a)return h(),!1;a.mapping=r,r=a;break;case o.data:for(var M=r.field.split(`.`),N=d.data,P=0;P<M.length&&N;P++){var F=M[P];N=N[F]}if(N!=null&&(a=this.parse(r.name,N,r.bypass,f)),!a)return h(),!1;a.mapping=r,r=a;break;case o.fn:var I=r.value,L=r.fnValue==null?I(e):r.fnValue;if(r.prevFnValue=L,L==null)return WL("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(a=this.parse(r.name,L,r.bypass,f),!a)return WL("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;a.mapping=KL(r),r=a;break;case void 0:break;default:return!1}return c?(u?r.bypassed=l.bypassed:r.bypassed=l,i[r.name]=r):u?l.bypassed=r:i[r.name]=r,m(),!0},GK.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],c=i[s];c!=null&&(c.bypass?c.bypassed=null:i[s]=null)}}},GK.update=function(){this._private.cy.mutableElements().updateStyle()},GK.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle(`transition-property`).value,a=e.pstyle(`transition-duration`).pfValue,o=e.pstyle(`transition-delay`).pfValue;if(i.length>0&&a>0){for(var s={},c=!1,l=0;l<i.length;l++){var u=i[l],d=e.pstyle(u),f=t[u];if(f){var p=f.prev,m=f.next==null?d:f.next,h=!1,g=void 0,_=1e-6;p&&($(p.pfValue)&&$(m.pfValue)?(h=m.pfValue-p.pfValue,g=p.pfValue+_*h):$(p.value)&&$(m.value)?(h=m.value-p.value,g=p.value+_*h):IF(p.value)&&IF(m.value)&&(h=p.value[0]!==m.value[0]||p.value[1]!==m.value[1]||p.value[2]!==m.value[2],g=p.strValue),h&&(s[u]=m.strValue,this.applyBypass(e,u,g),c=!0))}}if(!c)return;r.transitioning=!0,new gV(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle(`transition-timing-function`).value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify(`style`),r.transitioning=!1})}else r.transitioning&&=(this.removeBypasses(e,i),e.emitAndNotify(`style`),!1)},GK.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);e.removed()||s!=null&&s(n,r,e)&&a(o)},GK.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify(`zorder`,e)})},GK.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},GK.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},GK.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},GK.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var JK={};JK.applyBypass=function(e,t,n,r){var i=this,a=[],o=!0;if(t===`*`||t===`**`){if(n!==void 0)for(var s=0;s<i.properties.length;s++){var c=i.properties[s].name,l=this.parse(c,n,!0);l&&a.push(l)}}else if(PF(t)){var u=this.parse(t,n,!0);u&&a.push(u)}else if(LF(t)){var d=t;r=n;for(var f=Object.keys(d),p=0;p<f.length;p++){var m=f[p],h=d[m];if(h===void 0&&(h=d[eI(m)]),h!==void 0){var g=this.parse(m,h,!0);g&&a.push(g)}}}else return!1;if(a.length===0)return!1;for(var _=!1,v=0;v<e.length;v++){for(var y=e[v],b={},x=void 0,S=0;S<a.length;S++){var C=a[S];if(r){var w=y.pstyle(C.name);x=b[C.name]={prev:w}}_=this.applyParsedProperty(y,KL(C))||_,r&&(x.next=y.pstyle(C.name))}_&&this.updateStyleHints(y),r&&this.updateTransitions(y,b,o)}return _},JK.overrideBypass=function(e,t,n){t=$F(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,c=o.mutiple,l=a?a.pfValue==null?a.value:a.pfValue:null;!a||!a.bypass?this.applyBypass(i,t,n):(a.value=n,a.pfValue!=null&&(a.pfValue=n),s?a.strValue=`rgb(`+n.join(`,`)+`)`:c?a.strValue=n.join(` `):a.strValue=``+n,this.updateStyleHints(i)),this.checkTriggers(i,t,l,n)}},JK.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},JK.removeBypasses=function(e,t,n){for(var r=!0,i=0;i<e.length;i++){for(var a=e[i],o={},s=0;s<t.length;s++){var c=t[s],l=this.properties[c],u=a.pstyle(l.name);if(!(!u||!u.bypass)){var d=this.parse(c,``,!0),f=o[l.name]={prev:u};this.applyParsedProperty(a,d),f.next=a.pstyle(l.name)}}this.updateStyleHints(a),n&&this.updateTransitions(a,o,r)}};var YK={};YK.getEmSizeInPixels=function(){var e=this.containerCss(`font-size`);return e==null?1:parseFloat(e)},YK.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var XK={};XK.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},XK.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},i=0;i<n.properties.length;i++){var a=n.properties[i],o=n.getStylePropertyValue(e,a.name,t);o!=null&&(r[a.name]=o,r[eI(a.name)]=o)}return r}},XK.getIndexedStyle=function(e,t,n,r){return e.pstyle(t)[n][r]??e.cy().style().getDefaultProperty(t)[n][0]},XK.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var i=r.properties[t];i.alias&&(i=i.pointsTo);var a=i.type,o=e.pstyle(i.name);if(o){var s=o.value,c=o.units,l=o.strValue;if(n&&a.number&&s!=null&&$(s)){var u=e.cy().zoom(),d=function(e){return e*u},f=function(e,t){return d(e)+t},p=IF(s);return(p?c.every(function(e){return e!=null}):c!=null)?p?s.map(function(e,t){return f(e,c[t])}).join(` `):f(s,c):p?s.map(function(e){return PF(e)?e:``+d(e)}).join(` `):``+d(s)}else if(l!=null)return l}return null}},XK.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);a!==void 0&&(a=LF(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},XK.getPropsList=function(e){var t=this,n=[],r=e,i=t.properties;if(r)for(var a=Object.keys(r),o=0;o<a.length;o++){var s=a[o],c=r[s],l=i[s]||i[$F(s)],u=this.parse(l.name,c);u&&n.push(u)}return n},XK.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),i,a,o,s,c,l;for(c=0;c<t.length;c++)if(i=t[c],a=e.pstyle(i,!1),a!=null)if(a.pfValue!=null)r[0]=SL(s,r[0]),r[1]=CL(s,r[1]);else for(o=a.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),r[0]=SL(s,r[0]),r[1]=CL(s,r[1]);return r},XK.getPropertiesHash=XK.getNonDefaultPropertiesHash;var ZK={};ZK.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],i=r.selector,a=r.style||r.css,o=Object.keys(a);t.selector(i);for(var s=0;s<o.length;s++){var c=o[s],l=a[c];t.css(c,l)}}return t},ZK.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},ZK.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():`core`,style:a})}return e};var QK={};QK.appendFromString=function(e){var t=this,n=this,r=``+e,i,a,o;r=r.replace(/[/][*](\s|.)+?[*][/]/g,``);function s(){r=r.length>i.length?r.substr(i.length):``}function c(){a=a.length>o.length?a.substr(o.length):``}for(;!r.match(/^\s*$/);){var l=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){WL(`Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: `+r);break}i=l[0];var u=l[1];if(u!==`core`&&new BW(u).invalid){WL(`Skipping parsing of block: Invalid selector found in string stylesheet: `+u),s();continue}var d=l[2],f=!1;a=d;for(var p=[];!a.match(/^\s*$/);){var m=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){WL(`Skipping parsing of block: Invalid formatting of style property and value definitions found in:`+d),f=!0;break}o=m[0];var h=m[1],g=m[2];if(!t.properties[h]){WL(`Skipping property: Invalid property name in: `+o),c();continue}if(!n.parse(h,g)){WL(`Skipping property: Invalid property definition in: `+o),c();continue}p.push({name:h,val:g}),c()}if(f){s();break}n.selector(u);for(var _=0;_<p.length;_++){var v=p[_];n.css(v.name,v.val)}s()}return n},QK.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var $K={};(function(){var e=iI,t=oI,n=cI,r=lI,i=uI,a=function(e){return`^`+e+`\\s*\\(\\s*([\\w\\.]+)\\s*\\)$`},o=function(a){var o=e+`|\\w+|`+t+`|`+n+`|`+r+`|`+i;return`^`+a+`\\s*\\(([\\w\\.]+)\\s*\\,\\s*(`+e+`)\\s*\\,\\s*(`+e+`)\\s*,\\s*(`+o+`)\\s*\\,\\s*(`+o+`)\\)$`},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,`^(none)$`,`^(.+)$`];$K.types={time:{number:!0,min:0,units:`s|ms`,implicitUnits:`ms`},percent:{number:!0,min:0,max:100,units:`%`,implicitUnits:`%`},percentages:{number:!0,min:0,max:100,units:`%`,implicitUnits:`%`,multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:[`parent`,`origin`]},nodeSize:{number:!0,min:0,enums:[`label`]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:[`horizontal`,`leftward`,`rightward`,`vertical`,`upward`,`downward`,`auto`]},axisDirectionExplicit:{enums:[`leftward`,`rightward`,`upward`,`downward`]},axisDirectionPrimary:{enums:[`horizontal`,`vertical`]},paddingRelativeTo:{enums:[`width`,`height`,`average`,`min`,`max`]},bgWH:{number:!0,min:0,allowPercent:!0,enums:[`auto`],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:[`inner`,`include-padding`],multiple:!0},bgRepeat:{enums:[`repeat`,`repeat-x`,`repeat-y`,`no-repeat`],multiple:!0},bgFit:{enums:[`none`,`contain`,`cover`],multiple:!0},bgCrossOrigin:{enums:[`anonymous`,`use-credentials`,`null`],multiple:!0},bgClip:{enums:[`none`,`node`],multiple:!0},bgContainment:{enums:[`inside`,`over`],multiple:!0},boxSelection:{enums:[`contain`,`overlap`,`none`]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:[`solid`,`linear-gradient`,`radial-gradient`]},bool:{enums:[`yes`,`no`]},bools:{enums:[`yes`,`no`],multiple:!0},lineStyle:{enums:[`solid`,`dotted`,`dashed`]},lineCap:{enums:[`butt`,`round`,`square`]},linePosition:{enums:[`center`,`inside`,`outside`]},lineJoin:{enums:[`round`,`bevel`,`miter`]},borderStyle:{enums:[`solid`,`dotted`,`dashed`,`double`]},curveStyle:{enums:[`bezier`,`unbundled-bezier`,`haystack`,`segments`,`straight`,`straight-triangle`,`taxi`,`round-segments`,`round-taxi`]},radiusType:{enums:[`arc-radius`,`influence-radius`],multiple:!0},fontFamily:{regex:`^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$`},fontStyle:{enums:[`italic`,`normal`,`oblique`]},fontWeight:{enums:[`normal`,`bold`,`bolder`,`lighter`,`100`,`200`,`300`,`400`,`500`,`600`,`800`,`900`,100,200,300,400,500,600,700,800,900]},textDecoration:{enums:[`none`,`underline`,`overline`,`line-through`]},textTransform:{enums:[`none`,`uppercase`,`lowercase`]},textWrap:{enums:[`none`,`wrap`,`ellipsis`]},textOverflowWrap:{enums:[`whitespace`,`anywhere`]},textBackgroundShape:{enums:[`rectangle`,`roundrectangle`,`round-rectangle`,`circle`]},nodeShape:{enums:`rectangle.roundrectangle.round-rectangle.cutrectangle.cut-rectangle.bottomroundrectangle.bottom-round-rectangle.barrel.ellipse.triangle.round-triangle.square.pentagon.round-pentagon.hexagon.round-hexagon.concavehexagon.concave-hexagon.heptagon.round-heptagon.octagon.round-octagon.tag.round-tag.star.diamond.round-diamond.vee.rhomboid.right-rhomboid.polygon`.split(`.`)},overlayShape:{enums:[`roundrectangle`,`round-rectangle`,`ellipse`]},cornerRadius:{number:!0,min:0,units:`px|em`,implicitUnits:`px`,enums:[`auto`]},compoundIncludeLabels:{enums:[`include`,`exclude`]},arrowShape:{enums:[`tee`,`triangle`,`triangle-tee`,`circle-triangle`,`triangle-cross`,`triangle-backcurve`,`vee`,`square`,`circle`,`diamond`,`chevron`,`none`]},arrowFill:{enums:[`filled`,`hollow`]},arrowWidth:{number:!0,units:`%|px|em`,implicitUnits:`px`,enums:[`match-line`]},display:{enums:[`element`,`none`]},visibility:{enums:[`hidden`,`visible`]},zCompoundDepth:{enums:[`bottom`,`orphan`,`auto`,`top`]},zIndexCompare:{enums:[`auto`,`manual`]},valign:{enums:[`top`,`center`,`bottom`]},halign:{enums:[`left`,`center`,`right`]},justification:{enums:[`left`,`center`,`right`,`auto`]},text:{string:!0},data:{mapping:!0,regex:a(`data`)},layoutData:{mapping:!0,regex:a(`layoutData`)},scratch:{mapping:!0,regex:a(`scratch`)},mapData:{mapping:!0,regex:o(`mapData`)},mapLayoutData:{mapping:!0,regex:o(`mapLayoutData`)},mapScratch:{mapping:!0,regex:o(`mapScratch`)},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:`deg|rad`,implicitUnits:`rad`},textRotation:{number:!0,units:`deg|rad`,implicitUnits:`rad`,enums:[`none`,`autorotate`]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:[`intersection`,`node-position`,`endpoints`]},edgeEndpoint:{number:!0,multiple:!0,units:`%|px|em|deg|rad`,implicitUnits:`px`,enums:[`inside-to-node`,`outside-to-node`,`outside-to-node-or-label`,`outside-to-line`,`outside-to-line-or-label`],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return t[0]!==`deg`&&t[0]!==`rad`&&t[1]!==`deg`&&t[1]!==`rad`;case 1:return PF(e[0])||t[0]===`deg`||t[0]===`rad`;default:return!1}}},easing:{regexes:[`^(spring)\\s*\\(\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*\\)$`,`^(cubic-bezier)\\s*\\(\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*\\)$`],enums:`linear.ease.ease-in.ease-out.ease-in-out.ease-in-sine.ease-out-sine.ease-in-out-sine.ease-in-quad.ease-out-quad.ease-in-out-quad.ease-in-cubic.ease-out-cubic.ease-in-out-cubic.ease-in-quart.ease-out-quart.ease-in-out-quart.ease-in-quint.ease-out-quint.ease-in-out-quint.ease-in-expo.ease-out-expo.ease-in-out-expo.ease-in-circ.ease-out-circ.ease-in-out-circ`.split(`.`)},gradientDirection:{enums:[`to-bottom`,`to-top`,`to-left`,`to-right`,`to-bottom-right`,`to-bottom-left`,`to-top-right`,`to-top-left`,`to-right-bottom`,`to-left-bottom`,`to-right-top`,`to-left-top`]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return t===1||t===2||t===4}}};var c={zeroNonZero:function(e,t){return(e==null||t==null)&&e!==t||e==0&&t!=0?!0:e!=0&&t==0},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){var n=qF(e),r=qF(t);return n&&!r||!n&&r}},l=$K.types,u=[{name:`label`,type:l.text,triggersBounds:c.any,triggersZOrder:c.emptyNonEmpty},{name:`text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any}],d=[{name:`source-label`,type:l.text,triggersBounds:c.any},{name:`source-text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`source-text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`source-text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`source-text-offset`,type:l.size,triggersBounds:c.any}],f=[{name:`target-label`,type:l.text,triggersBounds:c.any},{name:`target-text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`target-text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`target-text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`target-text-offset`,type:l.size,triggersBounds:c.any}],p=[{name:`font-family`,type:l.fontFamily,triggersBounds:c.any},{name:`font-style`,type:l.fontStyle,triggersBounds:c.any},{name:`font-weight`,type:l.fontWeight,triggersBounds:c.any},{name:`font-size`,type:l.size,triggersBounds:c.any},{name:`text-transform`,type:l.textTransform,triggersBounds:c.any},{name:`text-wrap`,type:l.textWrap,triggersBounds:c.any},{name:`text-overflow-wrap`,type:l.textOverflowWrap,triggersBounds:c.any},{name:`text-max-width`,type:l.size,triggersBounds:c.any},{name:`text-outline-width`,type:l.size,triggersBounds:c.any},{name:`line-height`,type:l.positiveNumber,triggersBounds:c.any}],m=[{name:`text-valign`,type:l.valign,triggersBounds:c.any},{name:`text-halign`,type:l.halign,triggersBounds:c.any},{name:`color`,type:l.color},{name:`text-outline-color`,type:l.color},{name:`text-outline-opacity`,type:l.zeroOneNumber},{name:`text-background-color`,type:l.color},{name:`text-background-opacity`,type:l.zeroOneNumber},{name:`text-background-padding`,type:l.size,triggersBounds:c.any},{name:`text-border-opacity`,type:l.zeroOneNumber},{name:`text-border-color`,type:l.color},{name:`text-border-width`,type:l.size,triggersBounds:c.any},{name:`text-border-style`,type:l.borderStyle,triggersBounds:c.any},{name:`text-background-shape`,type:l.textBackgroundShape,triggersBounds:c.any},{name:`text-justification`,type:l.justification},{name:`box-select-labels`,type:l.bool,triggersBounds:c.any}],h=[{name:`events`,type:l.bool,triggersZOrder:c.any},{name:`text-events`,type:l.bool,triggersZOrder:c.any},{name:`box-selection`,type:l.boxSelection,triggersZOrder:c.any}],g=[{name:`display`,type:l.display,triggersZOrder:c.any,triggersBounds:c.any,triggersBoundsOfConnectedEdges:c.any,triggersBoundsOfParallelEdges:function(e,t,n){return e===t?!1:n.pstyle(`curve-style`).value===`bezier`}},{name:`visibility`,type:l.visibility,triggersZOrder:c.any},{name:`opacity`,type:l.zeroOneNumber,triggersZOrder:c.zeroNonZero},{name:`text-opacity`,type:l.zeroOneNumber},{name:`min-zoomed-font-size`,type:l.size},{name:`z-compound-depth`,type:l.zCompoundDepth,triggersZOrder:c.any},{name:`z-index-compare`,type:l.zIndexCompare,triggersZOrder:c.any},{name:`z-index`,type:l.number,triggersZOrder:c.any}],_=[{name:`overlay-padding`,type:l.size,triggersBounds:c.any},{name:`overlay-color`,type:l.color},{name:`overlay-opacity`,type:l.zeroOneNumber,triggersBounds:c.zeroNonZero},{name:`overlay-shape`,type:l.overlayShape,triggersBounds:c.any},{name:`overlay-corner-radius`,type:l.cornerRadius}],v=[{name:`underlay-padding`,type:l.size,triggersBounds:c.any},{name:`underlay-color`,type:l.color},{name:`underlay-opacity`,type:l.zeroOneNumber,triggersBounds:c.zeroNonZero},{name:`underlay-shape`,type:l.overlayShape,triggersBounds:c.any},{name:`underlay-corner-radius`,type:l.cornerRadius}],y=[{name:`transition-property`,type:l.propList},{name:`transition-duration`,type:l.time},{name:`transition-delay`,type:l.time},{name:`transition-timing-function`,type:l.easing}],b=function(e,t){return t.value===`label`?-e.poolIndex():t.pfValue},x=[{name:`height`,type:l.nodeSize,triggersBounds:c.any,hashOverride:b},{name:`width`,type:l.nodeSize,triggersBounds:c.any,hashOverride:b},{name:`shape`,type:l.nodeShape,triggersBounds:c.any},{name:`shape-polygon-points`,type:l.polygonPointList,triggersBounds:c.any},{name:`corner-radius`,type:l.cornerRadius},{name:`background-color`,type:l.color},{name:`background-fill`,type:l.fill},{name:`background-opacity`,type:l.zeroOneNumber},{name:`background-blacken`,type:l.nOneOneNumber},{name:`background-gradient-stop-colors`,type:l.colors},{name:`background-gradient-stop-positions`,type:l.percentages},{name:`background-gradient-direction`,type:l.gradientDirection},{name:`padding`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`padding-relative-to`,type:l.paddingRelativeTo,triggersBounds:c.any},{name:`bounds-expansion`,type:l.boundsExpansion,triggersBounds:c.any}],S=[{name:`border-color`,type:l.color},{name:`border-opacity`,type:l.zeroOneNumber},{name:`border-width`,type:l.size,triggersBounds:c.any},{name:`border-style`,type:l.borderStyle},{name:`border-cap`,type:l.lineCap},{name:`border-join`,type:l.lineJoin},{name:`border-dash-pattern`,type:l.numbers},{name:`border-dash-offset`,type:l.number},{name:`border-position`,type:l.linePosition}],C=[{name:`outline-color`,type:l.color},{name:`outline-opacity`,type:l.zeroOneNumber},{name:`outline-width`,type:l.size,triggersBounds:c.any},{name:`outline-style`,type:l.borderStyle},{name:`outline-offset`,type:l.size,triggersBounds:c.any}],w=[{name:`background-image`,type:l.urls},{name:`background-image-crossorigin`,type:l.bgCrossOrigin},{name:`background-image-opacity`,type:l.zeroOneNumbers},{name:`background-image-containment`,type:l.bgContainment},{name:`background-image-smoothing`,type:l.bools},{name:`background-position-x`,type:l.bgPos},{name:`background-position-y`,type:l.bgPos},{name:`background-width-relative-to`,type:l.bgRelativeTo},{name:`background-height-relative-to`,type:l.bgRelativeTo},{name:`background-repeat`,type:l.bgRepeat},{name:`background-fit`,type:l.bgFit},{name:`background-clip`,type:l.bgClip},{name:`background-width`,type:l.bgWH},{name:`background-height`,type:l.bgWH},{name:`background-offset-x`,type:l.bgPos},{name:`background-offset-y`,type:l.bgPos}],T=[{name:`position`,type:l.position,triggersBounds:c.any},{name:`compound-sizing-wrt-labels`,type:l.compoundIncludeLabels,triggersBounds:c.any},{name:`min-width`,type:l.size,triggersBounds:c.any},{name:`min-width-bias-left`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-width-bias-right`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-height`,type:l.size,triggersBounds:c.any},{name:`min-height-bias-top`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-height-bias-bottom`,type:l.sizeMaybePercent,triggersBounds:c.any}],E=[{name:`line-style`,type:l.lineStyle},{name:`line-color`,type:l.color},{name:`line-fill`,type:l.fill},{name:`line-cap`,type:l.lineCap},{name:`line-opacity`,type:l.zeroOneNumber},{name:`line-dash-pattern`,type:l.numbers},{name:`line-dash-offset`,type:l.number},{name:`line-outline-width`,type:l.size},{name:`line-outline-color`,type:l.color},{name:`line-gradient-stop-colors`,type:l.colors},{name:`line-gradient-stop-positions`,type:l.percentages},{name:`curve-style`,type:l.curveStyle,triggersBounds:c.any,triggersBoundsOfParallelEdges:function(e,t){return e===t?!1:e===`bezier`||t===`bezier`}},{name:`haystack-radius`,type:l.zeroOneNumber,triggersBounds:c.any},{name:`source-endpoint`,type:l.edgeEndpoint,triggersBounds:c.any},{name:`target-endpoint`,type:l.edgeEndpoint,triggersBounds:c.any},{name:`control-point-step-size`,type:l.size,triggersBounds:c.any},{name:`control-point-distances`,type:l.bidirectionalSizes,triggersBounds:c.any},{name:`control-point-weights`,type:l.numbers,triggersBounds:c.any},{name:`segment-distances`,type:l.bidirectionalSizes,triggersBounds:c.any},{name:`segment-weights`,type:l.numbers,triggersBounds:c.any},{name:`segment-radii`,type:l.numbers,triggersBounds:c.any},{name:`radius-type`,type:l.radiusType,triggersBounds:c.any},{name:`taxi-turn`,type:l.bidirectionalSizeMaybePercent,triggersBounds:c.any},{name:`taxi-turn-min-distance`,type:l.size,triggersBounds:c.any},{name:`taxi-direction`,type:l.axisDirection,triggersBounds:c.any},{name:`taxi-radius`,type:l.number,triggersBounds:c.any},{name:`edge-distances`,type:l.edgeDistances,triggersBounds:c.any},{name:`arrow-scale`,type:l.positiveNumber,triggersBounds:c.any},{name:`loop-direction`,type:l.angle,triggersBounds:c.any},{name:`loop-sweep`,type:l.angle,triggersBounds:c.any},{name:`source-distance-from-node`,type:l.size,triggersBounds:c.any},{name:`target-distance-from-node`,type:l.size,triggersBounds:c.any}],D=[{name:`ghost`,type:l.bool,triggersBounds:c.any},{name:`ghost-offset-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`ghost-offset-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`ghost-opacity`,type:l.zeroOneNumber}],O=[{name:`selection-box-color`,type:l.color},{name:`selection-box-opacity`,type:l.zeroOneNumber},{name:`selection-box-border-color`,type:l.color},{name:`selection-box-border-width`,type:l.size},{name:`active-bg-color`,type:l.color},{name:`active-bg-opacity`,type:l.zeroOneNumber},{name:`active-bg-size`,type:l.size},{name:`outside-texture-bg-color`,type:l.color},{name:`outside-texture-bg-opacity`,type:l.zeroOneNumber}],k=[];$K.pieBackgroundN=16,k.push({name:`pie-size`,type:l.sizeMaybePercent}),k.push({name:`pie-hole`,type:l.sizeMaybePercent}),k.push({name:`pie-start-angle`,type:l.angle});for(var A=1;A<=$K.pieBackgroundN;A++)k.push({name:`pie-`+A+`-background-color`,type:l.color}),k.push({name:`pie-`+A+`-background-size`,type:l.percent}),k.push({name:`pie-`+A+`-background-opacity`,type:l.zeroOneNumber});var j=[];$K.stripeBackgroundN=16,j.push({name:`stripe-size`,type:l.sizeMaybePercent}),j.push({name:`stripe-direction`,type:l.axisDirectionPrimary});for(var M=1;M<=$K.stripeBackgroundN;M++)j.push({name:`stripe-`+M+`-background-color`,type:l.color}),j.push({name:`stripe-`+M+`-background-size`,type:l.percent}),j.push({name:`stripe-`+M+`-background-opacity`,type:l.zeroOneNumber});var N=[],P=$K.arrowPrefixes=[`source`,`mid-source`,`target`,`mid-target`];[{name:`arrow-shape`,type:l.arrowShape,triggersBounds:c.any},{name:`arrow-color`,type:l.color},{name:`arrow-fill`,type:l.arrowFill},{name:`arrow-width`,type:l.arrowWidth}].forEach(function(e){P.forEach(function(t){var n=t+`-`+e.name,r=e.type,i=e.triggersBounds;N.push({name:n,type:r,triggersBounds:i})})},{});var F=$K.properties=[].concat(h,y,g,_,v,D,m,p,u,d,f,x,S,C,w,k,j,T,E,N,O),I=$K.propertyGroups={behavior:h,transition:y,visibility:g,overlay:_,underlay:v,ghost:D,commonLabel:m,labelDimensions:p,mainLabel:u,sourceLabel:d,targetLabel:f,nodeBody:x,nodeBorder:S,nodeOutline:C,backgroundImage:w,pie:k,stripe:j,compound:T,edgeLine:E,edgeArrow:N,core:O},L=$K.propertyGroupNames={};($K.propertyGroupKeys=Object.keys(I)).forEach(function(e){L[e]=I[e].map(function(e){return e.name}),I[e].forEach(function(t){return t.groupKey=e})});var R=$K.aliases=[{name:`content`,pointsTo:`label`},{name:`control-point-distance`,pointsTo:`control-point-distances`},{name:`control-point-weight`,pointsTo:`control-point-weights`},{name:`segment-distance`,pointsTo:`segment-distances`},{name:`segment-weight`,pointsTo:`segment-weights`},{name:`segment-radius`,pointsTo:`segment-radii`},{name:`edge-text-rotation`,pointsTo:`text-rotation`},{name:`padding-left`,pointsTo:`padding`},{name:`padding-right`,pointsTo:`padding`},{name:`padding-top`,pointsTo:`padding`},{name:`padding-bottom`,pointsTo:`padding`}];$K.propertyNames=F.map(function(e){return e.name});for(var ee=0;ee<F.length;ee++){var z=F[ee];F[z.name]=z}for(var B=0;B<R.length;B++){var V=R[B],H=F[V.pointsTo],te={name:V.name,alias:!0,pointsTo:H};F.push(te),F[V.name]=te}})(),$K.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},$K.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=pI({"selection-box-color":`#ddd`,"selection-box-opacity":.65,"selection-box-border-color":`#aaa`,"selection-box-border-width":1,"active-bg-color":`black`,"active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":`#000`,"outside-texture-bg-opacity":.125,events:`yes`,"text-events":`no`,"text-valign":`top`,"text-halign":`center`,"text-justification":`auto`,"line-height":1,color:`#000`,"box-selection":`contain`,"text-outline-color":`#000`,"text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":`none`,"text-transform":`none`,"text-wrap":`none`,"text-overflow-wrap":`whitespace`,"text-max-width":9999,"text-background-color":`#000`,"text-background-opacity":0,"text-background-shape":`rectangle`,"text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":`solid`,"text-border-color":`#000`,"font-family":`Helvetica Neue, Helvetica, sans-serif`,"font-style":`normal`,"font-weight":`normal`,"font-size":16,"min-zoomed-font-size":0,"text-rotation":`none`,"source-text-rotation":`none`,"target-text-rotation":`none`,visibility:`visible`,display:`element`,opacity:1,"z-compound-depth":`auto`,"z-index-compare":`auto`,"z-index":0,label:``,"text-margin-x":0,"text-margin-y":0,"source-label":``,"source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":``,"target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":`#000`,"overlay-padding":10,"overlay-shape":`round-rectangle`,"overlay-corner-radius":`auto`,"underlay-opacity":0,"underlay-color":`#000`,"underlay-padding":10,"underlay-shape":`round-rectangle`,"underlay-corner-radius":`auto`,"transition-property":`none`,"transition-duration":0,"transition-delay":0,"transition-timing-function":`linear`,"box-select-labels":`no`,"background-blacken":0,"background-color":`#999`,"background-fill":`solid`,"background-opacity":1,"background-image":`none`,"background-image-crossorigin":`anonymous`,"background-image-opacity":1,"background-image-containment":`inside`,"background-image-smoothing":`yes`,"background-position-x":`50%`,"background-position-y":`50%`,"background-offset-x":0,"background-offset-y":0,"background-width-relative-to":`include-padding`,"background-height-relative-to":`include-padding`,"background-repeat":`no-repeat`,"background-fit":`none`,"background-clip":`node`,"background-width":`auto`,"background-height":`auto`,"border-color":`#000`,"border-opacity":1,"border-width":0,"border-style":`solid`,"border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":`butt`,"border-join":`miter`,"border-position":`center`,"outline-color":`#999`,"outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":`solid`,height:30,width:30,shape:`ellipse`,"shape-polygon-points":`-1, -1, 1, -1, 1, 1, -1, 1`,"corner-radius":`auto`,"bounds-expansion":0,"background-gradient-direction":`to-bottom`,"background-gradient-stop-colors":`#999`,"background-gradient-stop-positions":`0%`,ghost:`no`,"ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":`width`,position:`origin`,"compound-sizing-wrt-labels":`include`,"min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":`100%`,"pie-hole":0,"pie-start-angle":`0deg`},[{name:`pie-{{i}}-background-color`,value:`black`},{name:`pie-{{i}}-background-size`,value:`0%`},{name:`pie-{{i}}-background-opacity`,value:1}].reduce(function(e,t){for(var n=1;n<=$K.pieBackgroundN;n++){var r=t.name.replace(`{{i}}`,n);e[r]=t.value}return e},{}),{"stripe-size":`100%`,"stripe-direction":`horizontal`},[{name:`stripe-{{i}}-background-color`,value:`black`},{name:`stripe-{{i}}-background-size`,value:`0%`},{name:`stripe-{{i}}-background-opacity`,value:1}].reduce(function(e,t){for(var n=1;n<=$K.stripeBackgroundN;n++){var r=t.name.replace(`{{i}}`,n);e[r]=t.value}return e},{}),{"line-style":`solid`,"line-color":`#999`,"line-fill":`solid`,"line-cap":`butt`,"line-opacity":1,"line-outline-width":0,"line-outline-color":`#000`,"line-gradient-stop-colors":`#999`,"line-gradient-stop-positions":`0%`,"control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":`arc-radius`,"taxi-turn":`50%`,"taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":`auto`,"edge-distances":`intersection`,"curve-style":`haystack`,"haystack-radius":0,"arrow-scale":1,"loop-direction":`-45deg`,"loop-sweep":`-90deg`,"source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":`outside-to-node`,"target-endpoint":`outside-to-node`,"line-dash-pattern":[6,3],"line-dash-offset":0},[{name:`arrow-shape`,value:`none`},{name:`arrow-color`,value:`#999`},{name:`arrow-fill`,value:`filled`},{name:`arrow-width`,value:1}].reduce(function(e,t){return $K.arrowPrefixes.forEach(function(n){var r=n+`-`+t.name;e[r]=t.value}),e},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a];n[a]=this.parse(a,o)}}return e.defaultProperties=n,e.defaultProperties},$K.addDefaultStylesheet=function(){this.selector(`:parent`).css({shape:`rectangle`,padding:10,"background-color":`#eee`,"border-color":`#ccc`,"border-width":1}).selector(`edge`).css({width:3}).selector(`:loop`).css({"curve-style":`bezier`}).selector(`edge:compound`).css({"curve-style":`bezier`,"source-endpoint":`outside-to-line`,"target-endpoint":`outside-to-line`}).selector(`:selected`).css({"background-color":`#0169D9`,"line-color":`#0169D9`,"source-arrow-color":`#0169D9`,"target-arrow-color":`#0169D9`,"mid-source-arrow-color":`#0169D9`,"mid-target-arrow-color":`#0169D9`}).selector(`:parent:selected`).css({"background-color":`#CCE1F9`,"border-color":`#aec8e5`}).selector(`:active`).css({"overlay-color":`black`,"overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var eq={};eq.parse=function(e,t,n,r){var i=this;if(FF(t))return i.parseImplWarn(e,t,n,r);var a=r===`mapping`||r===!0||r===!1||r==null?`dontcare`:r,o=n?`t`:`f`,s=kL(e,``+t,o,a),c=i.propCache=i.propCache||[],l;return(l=c[s])||(l=c[s]=i.parseImplWarn(e,t,n,r)),(n||r===`mapping`)&&(l=KL(l),l&&(l.value=KL(l.value))),l},eq.parseImplWarn=function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return!i&&t!=null&&WL(`The style property \`${e}: ${t}\` is invalid`),i&&(i.name===`width`||i.name===`height`)&&t===`label`&&WL("The style value of `label` is deprecated for `"+i.name+"`"),i},eq.parseImpl=function(e,t,n,r){var i=this;e=$F(e);var a=i.properties[e],o=t,s=i.types;if(!a||t===void 0)return null;a.alias&&(a=a.pointsTo,e=a.name);var c=PF(t);c&&(t=t.trim());var l=a.type;if(!l)return null;if(n&&(t===``||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(FF(t))return{name:e,value:t,strValue:`fn`,mapped:s.fn,bypass:n};var u,d;if(!(!c||r||t.length<7||t[1]!==`a`)){if(t.length>=7&&t[0]===`d`&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var f=s.data;return{name:e,value:u,strValue:``+t,mapped:f,field:u[1],bypass:n}}else if(t.length>=10&&t[0]===`m`&&(d=new RegExp(s.mapData.regex).exec(t))){if(n||l.multiple)return!1;var p=s.mapData;if(!(l.color||l.number))return!1;var m=this.parse(e,d[4]);if(!m||m.mapped)return!1;var h=this.parse(e,d[5]);if(!h||h.mapped)return!1;if(m.pfValue===h.pfValue||m.strValue===h.strValue)return WL("`"+e+`: `+t+"` is not a valid mapper because the output range is zero; converting to `"+e+`: `+m.strValue+"`"),this.parse(e,m.strValue);if(l.color){var g=m.value,_=h.value;if(g[0]===_[0]&&g[1]===_[1]&&g[2]===_[2]&&(g[3]===_[3]||(g[3]==null||g[3]===1)&&(_[3]==null||_[3]===1)))return!1}return{name:e,value:d,strValue:``+t,mapped:p,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:m.value,valueMax:h.value,bypass:n}}}if(l.multiple&&r!==`multiple`){var v=c?t.split(/\s+/):IF(t)?t:[t];if(l.evenMultiple&&v.length%2!=0)return null;for(var y=[],b=[],x=[],S=``,C=!1,w=0;w<v.length;w++){var T=i.parse(e,v[w],n,`multiple`);C||=PF(T.value),y.push(T.value),x.push(T.pfValue==null?T.value:T.pfValue),b.push(T.units),S+=(w>0?` `:``)+T.strValue}return l.validate&&!l.validate(y,b)?null:l.singleEnum&&C?y.length===1&&PF(y[0])?{name:e,value:y[0],strValue:y[0],bypass:n}:null:{name:e,value:y,pfValue:x,strValue:S,bypass:n,units:b}}var E=function(){for(var r=0;r<l.enums.length;r++)if(l.enums[r]===t)return{name:e,value:t,strValue:``+t,bypass:n};return null};if(l.number){var D,O=`px`;if(l.units&&(D=l.units),l.implicitUnits&&(O=l.implicitUnits),!l.unitless)if(c){var k=`px|em`+(l.allowPercent?`|\\%`:``);D&&(k=D);var A=t.match(`^(`+iI+`)(`+k+`)?$`);A&&(t=A[1],D=A[2]||O)}else (!D||l.implicitUnits)&&(D=O);if(t=parseFloat(t),isNaN(t)&&l.enums===void 0)return null;if(isNaN(t)&&l.enums!==void 0)return t=o,E();if(l.integer&&!zF(t)||l.min!==void 0&&(t<l.min||l.strictMin&&t===l.min)||l.max!==void 0&&(t>l.max||l.strictMax&&t===l.max))return null;var j={name:e,value:t,strValue:``+t+(D||``),units:D,bypass:n};return l.unitless||D!==`px`&&D!==`em`?j.pfValue=t:j.pfValue=D===`px`||!D?t:this.getEmSizeInPixels()*t,(D===`ms`||D===`s`)&&(j.pfValue=D===`ms`?t:1e3*t),(D===`deg`||D===`rad`)&&(j.pfValue=D===`rad`?t:zR(t)),D===`%`&&(j.pfValue=t/100),j}else if(l.propList){var M=[],N=``+t;if(N!==`none`){for(var P=N.split(/\s*,\s*|\s+/),F=0;F<P.length;F++){var I=P[F].trim();i.properties[I]?M.push(I):WL("`"+I+"` is not a valid property name")}if(M.length===0)return null}return{name:e,value:M,strValue:M.length===0?`none`:M.join(` `),bypass:n}}else if(l.color){var L=vI(t);return L?{name:e,value:L,pfValue:L,strValue:`rgb(`+L[0]+`,`+L[1]+`,`+L[2]+`)`,bypass:n}:null}else if(l.regex||l.regexes){if(l.enums){var R=E();if(R)return R}for(var ee=l.regexes?l.regexes:[l.regex],z=0;z<ee.length;z++){var B=new RegExp(ee[z]).exec(t);if(B)return{name:e,value:l.singleRegexMatchValue?B[1]:B,strValue:``+t,bypass:n}}return null}else if(l.string)return{name:e,value:``+t,strValue:``+t,bypass:n};else if(l.enums)return E();else return null};var tq=function(e){if(!(this instanceof tq))return new tq(e);if(!WF(e)){HL(`A style must have a core reference`);return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},nq=tq.prototype;nq.instanceString=function(){return`style`},nq.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach(function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1}),this},nq.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},nq.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},nq.selector=function(e){var t=e===`core`?null:new BW(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},nq.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var i=e.properties[r],a=n[i.name];a===void 0&&(a=n[eI(i.name)]),a!==void 0&&this.cssRule(i.name,a)}else t.length===2&&this.cssRule(t[0],t[1]);return this},nq.style=nq.css,nq.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.name.match(/stripe-(\d+)-background-size/)&&n.value&&(this._private.hasStripe=!0),n.mapped&&this[r].mappedProperties.push(n),this[r].selector||(this._private.coreStyle[n.name]=n)}return this},nq.append=function(e){return GF(e)?e.appendToStyle(this):IF(e)?this.appendFromJson(e):PF(e)&&this.appendFromString(e),this},tq.fromJson=function(e,t){var n=new tq(e);return n.fromJson(t),n},tq.fromString=function(e,t){return new tq(e).fromString(t)},[GK,JK,YK,XK,ZK,QK,$K,eq].forEach(function(e){pI(nq,e)}),tq.types=nq.types,tq.properties=nq.properties,tq.propertyGroups=nq.propertyGroups,tq.propertyGroupNames=nq.propertyGroupNames,tq.propertyGroupKeys=nq.propertyGroupKeys;var rq={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return GF(e)?t.style=e.generateStyle(this):IF(e)?t.style=tq.fromJson(this,e):PF(e)?t.style=tq.fromString(this,e):t.style=tq(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},iq=`single`,aq={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType??=iq,e!==void 0)(e===`additive`||e===`single`)&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,n,r,i,a,o;switch(e.length){case 0:return t;case 1:if(PF(e[0]))return n=e[0],t[n];if(LF(e[0])){if(!this._private.panningEnabled)return this;i=e[0],a=i.x,o=i.y,$(a)&&(t.x=a),$(o)&&(t.y=o),this.emit(`pan viewport`)}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],r=e[1],(n===`x`||n===`y`)&&$(r)&&(t[n]=r),this.emit(`pan viewport`);break}return this.notify(`viewport`),this},panBy:function(e,t){var n=arguments,r=this._private.pan,i,a,o,s,c;if(!this._private.panningEnabled)return this;switch(n.length){case 1:LF(e)&&(o=n[0],s=o.x,c=o.y,$(s)&&(r.x+=s),$(c)&&(r.y+=c),this.emit(`pan viewport`));break;case 2:i=e,a=t,(i===`x`||i===`y`)&&$(a)&&(r[i]+=a),this.emit(`pan viewport`);break}return this.notify(`viewport`),this},gc:function(){this.notify(`gc`)},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit(`pan zoom viewport`),this.notify(`viewport`)}return this},getFitViewport:function(e,t){if($(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(PF(e)){var r=e;e=this.$(r)}else if(YF(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else VF(e)||(e=this.mutableElements());if(!(VF(e)&&e.empty())){n||=e.boundingBox();var a=this.width(),o=this.height(),s;if(t=$(t)?t:0,!isNaN(a)&&!isNaN(o)&&a>0&&o>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){s=Math.min((a-2*t)/n.w,(o-2*t)/n.h),s=s>this._private.maxZoom?this._private.maxZoom:s,s=s<this._private.minZoom?this._private.minZoom:s;var c={x:(a-s*(n.x1+n.x2))/2,y:(o-s*(n.y1+n.y2))/2};return{zoom:s,pan:c}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var r=e;e=r.min,t=r.max}return $(e)&&$(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):$(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:$(t)&&e===void 0&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,n=t.pan,r=t.zoom,i,a,o=!1;if(t.zoomingEnabled||(o=!0),$(e)?a=e:LF(e)&&(a=e.level,e.position==null?e.renderedPosition!=null&&(i=e.renderedPosition):i=MR(e.position,r,n),i!=null&&!t.panningEnabled&&(o=!0)),a=a>t.maxZoom?t.maxZoom:a,a=a<t.minZoom?t.minZoom:a,o||!$(a)||a===r||i!=null&&(!$(i.x)||!$(i.y)))return null;if(i!=null){var s=n,c=r,l=a;return{zoomed:!0,panned:!0,zoom:l,pan:{x:-l/c*(i.x-s.x)+i.x,y:-l/c*(i.y-s.y)+i.y}}}else return{zoomed:!0,panned:!1,zoom:a,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit(`zoom`+(t.panned?` pan`:``)+` viewport`),this.notify(`viewport`),this)},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;if(!e||($(e.zoom)||(n=!1),LF(e.pan)||(r=!1),!n&&!r))return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push(`zoom`))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var c=e.pan;$(c.x)&&(t.pan.x=c.x,o=!1),$(c.y)&&(t.pan.y=c.y,o=!1),o||i.push(`pan`)}return i.length>0&&(i.push(`viewport`),this.emit(i.join(` `)),this.notify(`viewport`)),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit(`pan viewport`),this.notify(`viewport`)),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(PF(e)){var n=e;e=this.mutableElements().filter(n)}else VF(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),i=this.width(),a=this.height();return t=t===void 0?this._private.zoom:t,{x:(i-t*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled||this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?function(){var e=n.window().getComputedStyle(t),r=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-r(`padding-left`)-r(`padding-right`),height:t.clientHeight-r(`padding-top`)-r(`padding-bottom`)}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};aq.centre=aq.center,aq.autolockNodes=aq.autolock,aq.autoungrabifyNodes=aq.autoungrabify;var oq={data:gW.data({field:`data`,bindingEvent:`data`,allowBinding:!0,allowSetting:!0,settingEvent:`data`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeData:gW.removeData({field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0}),scratch:gW.data({field:`scratch`,bindingEvent:`scratch`,allowBinding:!0,allowSetting:!0,settingEvent:`scratch`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeScratch:gW.removeData({field:`scratch`,event:`scratch`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0})};oq.attr=oq.data,oq.removeAttr=oq.removeData;var sq=function(e){var t=this;e=pI({},e);var n=e.container;n&&!BF(n)&&BF(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r||={},r&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=DF!==void 0&&n!==void 0&&!e.headless,o=e;o.layout=pI({name:a?`grid`:`null`},o.layout),o.renderer=pI({name:a?`canvas`:`null`},o.renderer);var s=function(e,t,n){return t===void 0?n===void 0?e:n:t},c=this._private={container:n,ready:!1,options:o,elements:new xK(this),listeners:[],aniEles:new xK(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?a:o.styleEnabled,zoom:$(o.zoom)?o.zoom:1,pan:{x:LF(o.pan)&&$(o.pan.x)?o.pan.x:0,y:LF(o.pan)&&$(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var l=function(e,t){if(e.some(XF))return gV.all(e).then(t);t(e)};c.styleEnabled&&t.setStyle([]);var u=pI({},o,o.renderer);t.initRenderer(u);var d=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),e!=null&&(LF(e)||IF(e))&&t.add(e),t.one(`layoutready`,function(e){t.notifications(!0),t.emit(e),t.one(`load`,n),t.emitAndNotify(`load`)}).one(`layoutstop`,function(){t.one(`done`,r),t.emit(`done`)});var a=pI({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};l([o.style,o.elements],function(e){var n=e[0],a=e[1];c.styleEnabled&&t.style().append(n),d(a,function(){t.startAnimationLoop(),c.ready=!0,FF(o.ready)&&t.on(`ready`,o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on(`ready`,n)}r&&(r.readies=[]),t.emit(`ready`)},o.done)})},cq=sq.prototype;pI(cq,{instanceString:function(){return`core`},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit(`ready`,[],e):this.on(`ready`,e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit(`destroy`),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(this._private.container==null)return DF;var e=this._private.container.ownerDocument;return e===void 0||e==null?DF:e.defaultView||DF},mount:function(e){if(e!=null){var t=this,n=t._private,r=n.options;return!BF(e)&&BF(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(pI({},r,r.renderer,{name:r.renderer.name===`null`?`canvas`:r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit(`mount`),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:`null`}),e.emit(`unmount`),e},options:function(){return KL(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),i=function(e){return t.getElementById(e.id())};if(LF(e)){if(t.startBatch(),e.elements){var a={},o=function(e,n){for(var r=[],i=[],o=0;o<e.length;o++){var s=e[o];if(!s.data.id){WL(`cy.json() cannot handle elements without an ID attribute`);continue}var c=``+s.data.id,l=t.getElementById(c);a[c]=!0,l.length===0?(n&&(s.group=n),r.push(s)):i.push({ele:l,json:s})}t.add(r);for(var u=0;u<i.length;u++){var d=i[u],f=d.ele,p=d.json;f.json(p)}};if(IF(e.elements))o(e.elements);else for(var s=[`nodes`,`edges`],c=0;c<s.length;c++){var l=s[c],u=e.elements[l];IF(u)&&o(u,l)}var d=t.collection();r.filter(function(e){return!a[e.id()]}).forEach(function(e){e.isParent()?d.merge(e):e.remove()}),d.forEach(function(e){return e.children().move({parent:null})}),d.forEach(function(e){return i(e).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var f=[`minZoom`,`maxZoom`,`zoomingEnabled`,`userZoomingEnabled`,`panningEnabled`,`userPanningEnabled`,`boxSelectionEnabled`,`autolock`,`autoungrabify`,`autounselectify`,`multiClickDebounceTime`],p=0;p<f.length;p++){var m=f[p];e[m]!=null&&t[m](e[m])}return t.endBatch(),this}else{var h=!!e,g={};h?g.elements=this.elements().map(function(e){return e.json()}):(g.elements={},r.forEach(function(e){var t=e.group();g.elements[t]||(g.elements[t]=[]),g.elements[t].push(e.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=KL(t.data());var _=n.options;return g.zoomingEnabled=n.zoomingEnabled,g.userZoomingEnabled=n.userZoomingEnabled,g.zoom=n.zoom,g.minZoom=n.minZoom,g.maxZoom=n.maxZoom,g.panningEnabled=n.panningEnabled,g.userPanningEnabled=n.userPanningEnabled,g.pan=KL(n.pan),g.boxSelectionEnabled=n.boxSelectionEnabled,g.renderer=KL(_.renderer),g.hideEdgesOnViewport=_.hideEdgesOnViewport,g.textureOnViewport=_.textureOnViewport,g.wheelSensitivity=_.wheelSensitivity,g.motionBlur=_.motionBlur,g.multiClickDebounceTime=_.multiClickDebounceTime,g}}}),cq.$id=cq.getElementById,[CK,FK,RK,zK,BK,VK,UK,WK,rq,aq,oq].forEach(function(e){pI(cq,e)});var lq={fit:!0,directed:!1,direction:`downward`,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},uq={maximal:!1,acyclic:!1},dq=function(e){return e.scratch(`breadthfirst`)},fq=function(e,t){return e.scratch(`breadthfirst`,t)};function pq(e){this.options=pI({},lq,uq,e)}pq.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().filter(function(e){return e.isChildless()}),i=n,a=e.directed,o=e.acyclic||e.maximal||e.maximalAdjustments>0,s=!!e.boundingBox,c=XR(s?e.boundingBox:structuredClone(t.extent())),l;if(VF(e.roots))l=e.roots;else if(IF(e.roots)){for(var u=[],d=0;d<e.roots.length;d++){var f=e.roots[d],p=t.getElementById(f);u.push(p)}l=t.collection(u)}else if(PF(e.roots))l=t.$(e.roots);else if(a)l=r.roots();else{var m=n.components();l=t.collection();for(var h=function(){var e=m[g],t=e.maxDegree(!1),n=e.filter(function(e){return e.degree(!1)===t});l=l.add(n)},g=0;g<m.length;g++)h()}var _=[],v={},y=function(e,t){_[t]??(_[t]=[]);var n=_[t].length;_[t].push(e),fq(e,{index:n,depth:t})},b=function(e,t){var n=dq(e),r=n.depth,i=n.index;_[r][i]=null,e.isChildless()&&y(e,t)};i.bfs({roots:l,directed:e.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();a.isChildless()&&y(a,i),v[o]=!0}});for(var x=[],S=0;S<r.length;S++){var C=r[S];v[C.id()]||x.push(C)}var w=function(e){for(var t=_[e],n=0;n<t.length;n++){var r=t[n];if(r==null){t.splice(n,1),n--;continue}fq(r,{depth:e,index:n})}},T=function(t,r){for(var i=dq(t),a=t.incomers().filter(function(e){return e.isNode()&&n.has(e)}),o=-1,s=t.id(),c=0;c<a.length;c++){var l=a[c],u=dq(l);o=Math.max(o,u.depth)}if(i.depth<=o){if(!e.acyclic&&r[s])return null;var d=o+1;return b(t,d),r[s]=d,!0}return!1};if(a&&o){var E=[],D={},O=function(e){return E.push(e)},k=function(){return E.shift()};for(r.forEach(function(e){return E.push(e)});E.length>0;){var A=k(),j=T(A,D);if(j)A.outgoers().filter(function(e){return e.isNode()&&n.has(e)}).forEach(O);else if(j===null){WL("Detected double maximal shift for node `"+A.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var M=0;if(e.avoidOverlap)for(var N=0;N<r.length;N++){var P=r[N].layoutDimensions(e),F=P.w,I=P.h;M=Math.max(M,F,I)}var L={},R=function(e){if(L[e.id()])return L[e.id()];for(var t=dq(e).depth,n=e.neighborhood(),i=0,a=0,o=0;o<n.length;o++){var s=n[o];if(!(s.isEdge()||s.isParent()||!r.has(s))){var c=dq(s);if(c!=null){var l=c.index,u=c.depth;if(!(l==null||u==null)){var d=_[u].length;u<t&&(i+=l/d,a++)}}}}return a=Math.max(1,a),i/=a,a===0&&(i=0),L[e.id()]=i,i},ee=function(e,t){var n=R(e)-R(t);return n===0?dI(e.id(),t.id()):n};e.depthSort!==void 0&&(ee=e.depthSort);for(var z=_.length,B=0;B<z;B++)_[B].sort(ee),w(B);for(var V=[],H=0;H<x.length;H++)V.push(x[H]);V.length&&(_.unshift(V),z=_.length,function(){for(var e=0;e<z;e++)w(e)}());for(var te=0,ne=0;ne<z;ne++)te=Math.max(_[ne].length,te);var U={x:c.x1+c.w/2,y:c.y1+c.h/2},re=r.reduce(function(t,n){return function(e){return{w:t.w===-1?e.w:(t.w+e.w)/2,h:t.h===-1?e.h:(t.h+e.h)/2}}(n.boundingBox({includeLabels:e.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),ie=Math.max(z===1?0:s?(c.h-e.padding*2-re.h)/(z-1):(c.h-e.padding*2-re.h)/(z+1),M),ae=_.reduce(function(e,t){return Math.max(e,t.length)},0),oe=function(t){var n=dq(t),r=n.depth,i=n.index;if(e.circle){var a=Math.min(c.w/2/z,c.h/2/z);a=Math.max(a,M);var o=a*r+a-(z>0&&_[0].length<=3?a/2:0),l=2*Math.PI/_[r].length*i;return r===0&&_[0].length===1&&(o=1),{x:U.x+o*Math.cos(l),y:U.y+o*Math.sin(l)}}else{var u=_[r].length,d=Math.max(u===1?0:s?(c.w-e.padding*2-re.w)/((e.grid?ae:u)-1):(c.w-e.padding*2-re.w)/((e.grid?ae:u)+1),M);return{x:U.x+(i+1-(u+1)/2)*d,y:U.y+(r+1-(z+1)/2)*ie}}},se={downward:0,leftward:90,upward:180,rightward:-90};return Object.keys(se).indexOf(e.direction)===-1&&HL(`Invalid direction '${e.direction}' specified for breadthfirst layout. Valid values are: ${Object.keys(se).join(`, `)}`),n.nodes().layoutPositions(this,e,function(t){return NL(oe(t),c,se[e.direction])}),this};var mq={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function hq(e){this.options=pI({},mq,e)}hq.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=t.counterclockwise===void 0?t.clockwise:!t.counterclockwise,a=r.nodes().not(`:parent`);t.sort&&(a=a.sort(t.sort));for(var o=XR(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},c=(t.sweep===void 0?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),l,u=0,d=0;d<a.length;d++){var f=a[d].layoutDimensions(t),p=f.w,m=f.h;u=Math.max(u,p,m)}if(l=$(t.radius)?t.radius:a.length<=1?0:Math.min(o.h,o.w)/2-u,a.length>1&&t.avoidOverlap){u*=1.75;var h=Math.cos(c)-Math.cos(0),g=Math.sin(c)-Math.sin(0),_=Math.sqrt(u*u/(h*h+g*g));l=Math.max(_,l)}return r.nodes().layoutPositions(this,t,function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=l*Math.cos(r),o=l*Math.sin(r);return{x:s.x+a,y:s.y+o}}),this};var gq={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function _q(e){this.options=pI({},gq,e)}_q.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise===void 0?t.clockwise:!t.counterclockwise,r=e.cy,i=t.eles,a=i.nodes().not(`:parent`),o=XR(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},c=[],l=0,u=0;u<a.length;u++){var d=a[u],f=void 0;f=t.concentric(d),c.push({value:f,node:d}),d._private.scratch.concentric=f}a.updateStyle();for(var p=0;p<a.length;p++){var m=a[p].layoutDimensions(t);l=Math.max(l,m.w,m.h)}c.sort(function(e,t){return t.value-e.value});for(var h=t.levelWidth(a),g=[[]],_=g[0],v=0;v<c.length;v++){var y=c[v];_.length>0&&Math.abs(_[0].value-y.value)>=h&&(_=[],g.push(_)),_.push(y)}var b=l+t.minNodeSpacing;if(!t.avoidOverlap){var x=g.length>0&&g[0].length>1,S=(Math.min(o.w,o.h)/2-b)/(g.length+x?1:0);b=Math.min(b,S)}for(var C=0,w=0;w<g.length;w++){var T=g[w],E=T.dTheta=(t.sweep===void 0?2*Math.PI-2*Math.PI/T.length:t.sweep)/Math.max(1,T.length-1);if(T.length>1&&t.avoidOverlap){var D=Math.cos(E)-Math.cos(0),O=Math.sin(E)-Math.sin(0),k=Math.sqrt(b*b/(D*D+O*O));C=Math.max(k,C)}T.r=C,C+=b}if(t.equidistant){for(var A=0,j=0,M=0;M<g.length;M++){var N=g[M].r-j;A=Math.max(A,N)}j=0;for(var P=0;P<g.length;P++){var F=g[P];P===0&&(j=F.r),F.r=j,j+=A}}for(var I={},L=0;L<g.length;L++)for(var R=g[L],ee=R.dTheta,z=R.r,B=0;B<R.length;B++){var V=R[B],H=t.startAngle+(n?1:-1)*ee*B,te={x:s.x+z*Math.cos(H),y:s.y+z*Math.sin(H)};I[V.node.id()]=te}return i.nodes().layoutPositions(this,t,function(e){return I[e.id()]}),this};var vq,yq={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function bq(e){this.options=pI({},yq,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges().filter(function(e){var n=e.source().data(`id`),r=e.target().data(`id`),i=t.some(function(e){return e.data(`id`)===n}),a=t.some(function(e){return e.data(`id`)===r});return!i||!a});this.options.eles=this.options.eles.not(n)}bq.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:`layoutstart`,layout:n}),vq=!0===e.debug;var r=xq(t,n,e);vq&&wq(r),e.randomize&&Tq(r);var i=_L(),a=function(){Dq(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter||(Oq(r,e),r.temperature*=e.coolingFactor,r.temperature<e.minTemp))},s=function(){if(e.animate===!0||e.animate===!1)a(),n.one(`layoutstop`,e.stop),n.emit({type:`layoutstop`,layout:n});else{var t=e.eles.nodes(),i=Eq(r,e,t);t.layoutPositions(n,e,i)}},c=0,l=!0;if(e.animate===!0){var u=function(){for(var t=0;l&&t<e.refresh;)l=o(c),c++,t++;l?(_L()-i>=e.animationThreshold&&a(),gL(u)):(Bq(r,e),s())};u()}else{for(;l;)l=o(c),c++;Bq(r,e),s()}return this},bq.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit(`layoutstop`),this},bq.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var xq=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=XR(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),c={},l=0;l<s.length;l++)for(var u=s[l],d=0;d<u.length;d++){var f=u[d];c[f.id()]=l}for(var l=0;l<o.nodeSize;l++){var p=i[l],m=p.layoutDimensions(n),h={};h.isLocked=p.locked(),h.id=p.data(`id`),h.parentId=p.data(`parent`),h.cmptId=c[p.id()],h.children=[],h.positionX=p.position(`x`),h.positionY=p.position(`y`),h.offsetX=0,h.offsetY=0,h.height=m.w,h.width=m.h,h.maxX=h.positionX+h.width/2,h.minX=h.positionX-h.width/2,h.maxY=h.positionY+h.height/2,h.minY=h.positionY-h.height/2,h.padLeft=parseFloat(p.style(`padding`)),h.padRight=parseFloat(p.style(`padding`)),h.padTop=parseFloat(p.style(`padding`)),h.padBottom=parseFloat(p.style(`padding`)),h.nodeRepulsion=FF(n.nodeRepulsion)?n.nodeRepulsion(p):n.nodeRepulsion,o.layoutNodes.push(h),o.idToIndex[h.id]=l}for(var g=[],_=0,v=-1,y=[],l=0;l<o.nodeSize;l++){var p=o.layoutNodes[l],b=p.parentId;b==null?(g[++v]=p.id,y.push(p.id)):o.layoutNodes[o.idToIndex[b]].children.push(p.id)}for(o.graphSet.push(y);_<=v;){var x=g[_++],S=o.idToIndex[x],f=o.layoutNodes[S],C=f.children;if(C.length>0){o.graphSet.push(C);for(var l=0;l<C.length;l++)g[++v]=C[l]}}for(var l=0;l<o.graphSet.length;l++)for(var w=o.graphSet[l],d=0;d<w.length;d++){var T=o.idToIndex[w[d]];o.indexToGraph[T]=l}for(var l=0;l<o.edgeSize;l++){var E=r[l],D={};D.id=E.data(`id`),D.sourceId=E.data(`source`),D.targetId=E.data(`target`);var O=FF(n.idealEdgeLength)?n.idealEdgeLength(E):n.idealEdgeLength,k=FF(n.edgeElasticity)?n.edgeElasticity(E):n.edgeElasticity,A=o.idToIndex[D.sourceId],j=o.idToIndex[D.targetId];if(o.indexToGraph[A]!=o.indexToGraph[j]){for(var M=Sq(D.sourceId,D.targetId,o),N=o.graphSet[M],P=0,h=o.layoutNodes[A];N.indexOf(h.id)===-1;)h=o.layoutNodes[o.idToIndex[h.parentId]],P++;for(h=o.layoutNodes[j];N.indexOf(h.id)===-1;)h=o.layoutNodes[o.idToIndex[h.parentId]],P++;O*=P*n.nestingFactor}D.idealLength=O,D.elasticity=k,o.layoutEdges.push(D)}return o},Sq=function(e,t,n){var r=Cq(e,t,0,n);return 2>r.count?0:r.graph},Cq=function(e,t,n,r){var i=r.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var a=0,o=0;o<i.length;o++){var s=i[o],c=r.idToIndex[s],l=r.layoutNodes[c].children;if(l.length!==0){var u=r.indexToGraph[r.idToIndex[l[0]]],d=Cq(e,t,u,r);if(d.count!==0)if(d.count===1){if(a++,a===2)break}else return d}}return{count:a,graph:n}},wq,Tq=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];a.children.length===0&&!a.isLocked&&(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},Eq=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(t){var n=e.layoutNodes[e.idToIndex[t.data(`id`)]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data(`id`)]];if(t.boundingBox){var s=i.w===0?.5:(o.positionX-i.x1)/i.w,c=i.h===0?.5:(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+c*r.h}}else return{x:o.positionX,y:o.positionY}}},Dq=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=Eq(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one(`layoutready`,n.ready),r.emit({type:`layoutready`,layout:this}))},Oq=function(e,t,n){kq(e,t),Pq(e),Fq(e,t),Iq(e),Lq(e)},kq=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var c=e.layoutNodes[e.idToIndex[r[s]]];jq(o,c,e,t)}},Aq=function(e){return-1+2*e*Math.random()},jq=function(e,t,n,r){if(!(e.cmptId!==t.cmptId&&!n.isCompound)){var i=t.positionX-e.positionX,a=t.positionY-e.positionY,o=1;i===0&&a===0&&(i=Aq(o),a=Aq(o));var s=Mq(e,t,i,a);if(s>0)var c=r.nodeOverlap*s,l=Math.sqrt(i*i+a*a),u=c*i/l,d=c*a/l;else var f=Nq(e,i,a),p=Nq(t,-1*i,-1*a),m=p.x-f.x,h=p.y-f.y,g=m*m+h*h,l=Math.sqrt(g),c=(e.nodeRepulsion+t.nodeRepulsion)/g,u=c*m/l,d=c*h/l;e.isLocked||(e.offsetX-=u,e.offsetY-=d),t.isLocked||(t.offsetX+=u,t.offsetY+=d)}},Mq=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},Nq=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,c=a/o,l={};return t===0&&0<n||t===0&&0>n?(l.x=r,l.y=i+a/2,l):0<t&&-1*c<=s&&s<=c?(l.x=r+o/2,l.y=i+o*n/2/t,l):0>t&&-1*c<=s&&s<=c?(l.x=r-o/2,l.y=i-o*n/2/t,l):0<n&&(s<=-1*c||s>=c)?(l.x=r+a*t/2/n,l.y=i+a/2,l):0>n&&(s<=-1*c||s>=c)?(l.x=r-a*t/2/n,l.y=i-a/2,l):l},Pq=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],c=s.positionX-a.positionX,l=s.positionY-a.positionY;if(!(c===0&&l===0)){var u=Nq(a,c,l),d=Nq(s,-1*c,-1*l),f=d.x-u.x,p=d.y-u.y,m=Math.sqrt(f*f+p*p),h=(r.idealLength-m)**2/r.elasticity;if(m!==0)var g=h*f/m,_=h*p/m;else var g=0,_=0;a.isLocked||(a.offsetX+=g,a.offsetY+=_),s.isLocked||(s.offsetX-=g,s.offsetY-=_)}}},Fq=function(e,t){if(t.gravity!==0)for(var n=1,r=0;r<e.graphSet.length;r++){var i=e.graphSet[r],a=i.length;if(r===0)var o=e.clientHeight/2,s=e.clientWidth/2;else var c=e.layoutNodes[e.idToIndex[i[0]]],l=e.layoutNodes[e.idToIndex[c.parentId]],o=l.positionX,s=l.positionY;for(var u=0;u<a;u++){var d=e.layoutNodes[e.idToIndex[i[u]]];if(!d.isLocked){var f=o-d.positionX,p=s-d.positionY,m=Math.sqrt(f*f+p*p);if(m>n){var h=t.gravity*f/m,g=t.gravity*p/m;d.offsetX+=h,d.offsetY+=g}}}}},Iq=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],c=s.children;if(0<c.length&&!s.isLocked){for(var l=s.offsetX,u=s.offsetY,d=0;d<c.length;d++){var f=e.layoutNodes[e.idToIndex[c[d]]];f.offsetX+=l,f.offsetY+=u,n[++i]=c[d]}s.offsetX=0,s.offsetY=0}}},Lq=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length||r.isLocked)){var i=Rq(r.offsetX,r.offsetY,e.temperature);r.positionX+=i.x,r.positionY+=i.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,zq(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},Rq=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},zq=function(e,t){var n=e.parentId;if(n!=null){var r=t.layoutNodes[t.idToIndex[n]],i=!1;if((r.maxX==null||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,i=!0),(r.minX==null||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,i=!0),(r.maxY==null||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,i=!0),(r.minY==null||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,i=!0),i)return zq(r,t)}},Bq=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}for(var s=0,i=0;i<r.length;i++){var c=r[i];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var l=0;l<c.length;l++){var u=c[l];c.x1=Math.min(c.x1,u.positionX-u.width/2),c.x2=Math.max(c.x2,u.positionX+u.width/2),c.y1=Math.min(c.y1,u.positionY-u.height/2),c.y2=Math.max(c.y2,u.positionY+u.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,s+=c.w*c.h}}r.sort(function(e,t){return t.w*t.h-e.w*e.h});for(var d=0,f=0,p=0,m=0,h=Math.sqrt(s)*e.clientWidth/e.clientHeight,i=0;i<r.length;i++){var c=r[i];if(c){for(var l=0;l<c.length;l++){var u=c[l];u.isLocked||(u.positionX+=d-c.x1,u.positionY+=f-c.y1)}d+=c.w+t.componentSpacing,p+=c.w+t.componentSpacing,m=Math.max(m,c.h),p>h&&(f+=m+t.componentSpacing,d=0,p=0,m=0)}}},Vq={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Hq(e){this.options=pI({},Vq,e)}Hq.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(`:parent`);t.sort&&(i=i.sort(t.sort));var a=XR(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(a.h===0||a.w===0)r.nodes().layoutPositions(this,t,function(e){return{x:a.x1,y:a.y1}});else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),c=Math.round(s),l=Math.round(a.w/a.h*s),u=function(e){if(e==null)return Math.min(c,l);Math.min(c,l)==c?c=e:l=e},d=function(e){if(e==null)return Math.max(c,l);Math.max(c,l)==c?c=e:l=e},f=t.rows,p=t.cols==null?t.columns:t.cols;if(f!=null&&p!=null)c=f,l=p;else if(f!=null&&p==null)c=f,l=Math.ceil(o/c);else if(f==null&&p!=null)l=p,c=Math.ceil(o/l);else if(l*c>o){var m=u(),h=d();(m-1)*h>=o?u(m-1):(h-1)*m>=o&&d(h-1)}else for(;l*c<o;){var g=u(),_=d();(_+1)*g>=o?d(_+1):u(g+1)}var v=a.w/l,y=a.h/c;if(t.condense&&(v=0,y=0),t.avoidOverlap)for(var b=0;b<i.length;b++){var x=i[b],S=x._private.position;(S.x==null||S.y==null)&&(S.x=0,S.y=0);var C=x.layoutDimensions(t),w=t.avoidOverlapPadding,T=C.w+w,E=C.h+w;v=Math.max(v,T),y=Math.max(y,E)}for(var D={},O=function(e,t){return!!D[`c-`+e+`-`+t]},k=function(e,t){D[`c-`+e+`-`+t]=!0},A=0,j=0,M=function(){j++,j>=l&&(j=0,A++)},N={},P=0;P<i.length;P++){var F=i[P],I=t.position(F);if(I&&(I.row!==void 0||I.col!==void 0)){var L={row:I.row,col:I.col};if(L.col===void 0)for(L.col=0;O(L.row,L.col);)L.col++;else if(L.row===void 0)for(L.row=0;O(L.row,L.col);)L.row++;N[F.id()]=L,k(L.row,L.col)}}i.layoutPositions(this,t,function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var i=N[e.id()];if(i)n=i.col*v+v/2+a.x1,r=i.row*y+y/2+a.y1;else{for(;O(A,j);)M();n=j*v+v/2+a.x1,r=A*y+y/2+a.y1,k(A,j),M()}return{x:n,y:r}})}return this};var Uq={ready:function(){},stop:function(){}};function Wq(e){this.options=pI({},Uq,e)}Wq.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit(`layoutstart`),t.nodes().positions(function(){return{x:0,y:0}}),n.one(`layoutready`,e.ready),n.emit(`layoutready`),n.one(`layoutstop`,e.stop),n.emit(`layoutstop`),this},Wq.prototype.stop=function(){return this};var Gq={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Kq(e){this.options=pI({},Gq,e)}Kq.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=FF(e.positions);function r(t){return e.positions==null?jR(t.position()):n?e.positions(t):e.positions[t._private.data.id]??null}return t.layoutPositions(this,e,function(e,t){var n=r(e);return e.locked()||n==null?!1:n}),this};var qq={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Jq(e){this.options=pI({},qq,e)}Jq.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=XR(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}}),this};var Yq=[{name:`breadthfirst`,impl:pq},{name:`circle`,impl:hq},{name:`concentric`,impl:_q},{name:`cose`,impl:bq},{name:`grid`,impl:Hq},{name:`null`,impl:Wq},{name:`preset`,impl:Kq},{name:`random`,impl:Jq}];function Xq(e){this.options=e,this.notifications=0}var Zq=function(){},Qq=function(){throw Error(`A headless instance can not render images`)};Xq.prototype={recalculateRenderedStyle:Zq,notify:function(){this.notifications++},init:Zq,isHeadless:function(){return!0},png:Qq,jpg:Qq};var $q={};$q.arrowShapeWidth=.3,$q.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,c=i.x+n/2+o,l=i.y-n/2-o,u=i.y+n/2+o;return s<=e&&e<=c&&l<=t&&t<=u},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=e*Math.sin(r)+t*Math.cos(r),s=a*n,c=o*n;return{x:s+i.x,y:c+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],c=e[o+1];a.push(r(s,c,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).pfValue*2},s=function(r,s){PF(s)&&(s=e[s]),e[r]=pI({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){return vz(e,t,a(i(this.points,n+2*s,r,o)))},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl(`polygon`)(e,o)},spacing:function(e){return 0},gap:o},s)};s(`none`,{collide:zL,roughCollide:zL,draw:VL,spacing:BL,gap:BL}),s(`triangle`,{points:[-.15,-.3,0,0,.15,-.3]}),s(`arrow`,`triangle`),s(`triangle-backcurve`,{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var c=i(this.points,n,a,o),l=this.controlPoint,u=r(l[0],l[1],n,a,o);t.arrowShapeImpl(this.name)(e,c,u)},gap:function(e){return o(e)*.8}}),s(`triangle-tee`,{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,c){var l=a(i(this.points,n+2*c,r,o)),u=a(i(this.pointsTee,n+2*c,r,o));return vz(e,t,l)||vz(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),c=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,c)}}),s(`circle-triangle`,{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,c){var l=o,u=(l.x-e)**2+(l.y-t)**2<=((n+2*c)*this.radius)**2;return vz(e,t,a(i(this.points,n+2*c,r,o)))||u},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.radius}}),s(`triangle-cross`,{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e,i=3,a=5;return n[i]=n[i]-r,n[a]=n[a]-r,n},collide:function(e,t,n,r,o,s,c){var l=a(i(this.points,n+2*c,r,o)),u=a(i(this.crossLinePts(n,s),n+2*c,r,o));return vz(e,t,l)||vz(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),c=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,c)}}),s(`vee`,{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return o(e)*.525}}),s(`circle`,{radius:.15,collide:function(e,t,n,r,i,a,o){var s=i;return(s.x-e)**2+(s.y-t)**2<=((n+2*o)*this.radius)**2},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.radius}}),s(`tee`,{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s(`square`,{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s(`diamond`,{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).value}}),s(`chevron`,{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return .95*e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).value}})};var eJ={};eJ.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),c=n.zoom();return[((e-i)/o-s.x)/c,((t-a)/o-s.y)/c]},eJ.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i={left:r(`padding-left`),right:r(`padding-right`),top:r(`padding-top`),bottom:r(`padding-bottom`)},a={left:r(`border-left-width`),right:r(`border-right-width`),top:r(`border-top-width`),bottom:r(`border-bottom-width`)},o=e.clientWidth,s=e.clientHeight,c=i.left+i.right,l=i.top+i.bottom,u=a.left+a.right,d=t.width/(o+u),f=o-c,p=s-l,m=t.left+i.left+a.left,h=t.top+i.top+a.top;return this.containerBB=[m,h,f,p,d]},eJ.invalidateContainerClientCoordsCache=function(){this.containerBB=null},eJ.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},eJ.findNearestElements=function(e,t,n,r){var i=this,a=this,o=a.getCachedZSortedEles(),s=[],c=a.cy.zoom(),l=a.cy.hasCompoundNodes(),u=(r?24:8)/c,d=(r?8:2)/c,f=(r?8:2)/c,p=1/0,m,h;n&&(o=o.interactive);function g(e,t){if(e.isNode()){if(h)return;h=e,s.push(e)}if(e.isEdge()&&(t==null||t<p))if(m){if(m.pstyle(`z-compound-depth`).value===e.pstyle(`z-compound-depth`).value&&m.pstyle(`z-compound-depth`).value===e.pstyle(`z-compound-depth`).value){for(var n=0;n<s.length;n++)if(s[n].isEdge()){s[n]=e,m=e,p=t??p;break}}}else s.push(e),m=e,p=t??p}function _(n){var r=n.outerWidth()+2*d,o=n.outerHeight()+2*d,s=r/2,c=o/2,l=n.position(),u=n.pstyle(`corner-radius`).value===`auto`?`auto`:n.pstyle(`corner-radius`).pfValue,f=n._private.rscratch;if(l.x-s<=e&&e<=l.x+s&&l.y-c<=t&&t<=l.y+c&&a.nodeShapes[i.getNodeShape(n)].checkPoint(e,t,0,r,o,l.x,l.y,u,f))return g(n,0),!0}function v(n){var r=n._private,o=r.rscratch,c=n.pstyle(`width`).pfValue,d=n.pstyle(`arrow-scale`).value,f=c/2+u,p=f*f,m=f*2,h=r.source,v=r.target,y;if(o.edgeType===`segments`||o.edgeType===`straight`||o.edgeType===`haystack`){for(var b=o.allpts,x=0;x+3<b.length;x+=2)if(fz(e,t,b[x],b[x+1],b[x+2],b[x+3],m)&&p>(y=_z(e,t,b[x],b[x+1],b[x+2],b[x+3])))return g(n,y),!0}else if(o.edgeType===`bezier`||o.edgeType===`multibezier`||o.edgeType===`self`||o.edgeType===`compound`){for(var b=o.allpts,x=0;x+5<o.allpts.length;x+=4)if(pz(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5],m)&&p>(y=gz(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5])))return g(n,y),!0}for(var h=h||r.source,v=v||r.target,S=i.getArrowWidth(c,d),C=[{name:`source`,x:o.arrowStartX,y:o.arrowStartY,angle:o.srcArrowAngle},{name:`target`,x:o.arrowEndX,y:o.arrowEndY,angle:o.tgtArrowAngle},{name:`mid-source`,x:o.midX,y:o.midY,angle:o.midsrcArrowAngle},{name:`mid-target`,x:o.midX,y:o.midY,angle:o.midtgtArrowAngle}],x=0;x<C.length;x++){var w=C[x],T=a.arrowShapes[n.pstyle(w.name+`-arrow-shape`).value],E=n.pstyle(`width`).pfValue;if(T.roughCollide(e,t,S,w.angle,{x:w.x,y:w.y},E,u)&&T.collide(e,t,S,w.angle,{x:w.x,y:w.y},E,u))return g(n),!0}l&&s.length>0&&(_(h),_(v))}function y(e,t,n){return tR(e,t,n)}function b(n,r){var i=n._private,a=f,o=r?r+`-`:``;n.boundingBox();var s=i.labelBounds[r||`main`],c=n.pstyle(o+`label`).value;if(!(n.pstyle(`text-events`).strValue!==`yes`||!c)){var l=y(i.rscratch,`labelX`,r),u=y(i.rscratch,`labelY`,r),d=y(i.rscratch,`labelAngle`,r),p=n.pstyle(o+`text-margin-x`).pfValue,m=n.pstyle(o+`text-margin-y`).pfValue,h=s.x1-a-p,_=s.x2+a-p,v=s.y1-a-m,b=s.y2+a-m;if(d){var x=Math.cos(d),S=Math.sin(d),C=function(e,t){return e-=l,t-=u,{x:e*x-t*S+l,y:e*S+t*x+u}},w=C(h,v),T=C(h,b),E=C(_,v),D=C(_,b);if(vz(e,t,[w.x+p,w.y+m,E.x+p,E.y+m,D.x+p,D.y+m,T.x+p,T.y+m]))return g(n),!0}else if(az(s,e,t))return g(n),!0}}for(var x=o.length-1;x>=0;x--){var S=o[x];S.isNode()?_(S)||b(S):v(S)||b(S)||b(S,`source`)||b(S,`target`)}return s},eJ.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=2/this.cy.zoom(),o=[],s=Math.min(e,n),c=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r);e=s,n=c,t=l,r=u;var d=XR({x1:e,y1:t,x2:n,y2:r}),f=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}],p=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function m(e,t,n){return tR(e,t,n)}function h(e,t){var n=e._private,r=a,i=``;e.boundingBox();var o=n.labelBounds.main;if(!o)return null;var s=m(n.rscratch,`labelX`,t),c=m(n.rscratch,`labelY`,t),l=m(n.rscratch,`labelAngle`,t),u=e.pstyle(i+`text-margin-x`).pfValue,d=e.pstyle(i+`text-margin-y`).pfValue,f=o.x1-r-u,p=o.x2+r-u,h=o.y1-r-d,g=o.y2+r-d;if(l){var _=Math.cos(l),v=Math.sin(l),y=function(e,t){return e-=s,t-=c,{x:e*_-t*v+s,y:e*v+t*_+c}};return[y(f,h),y(p,h),y(p,g),y(f,g)]}else return[{x:f,y:h},{x:p,y:h},{x:p,y:g},{x:f,y:g}]}function g(e,t,n,r){function i(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return i(e,n,r)!==i(t,n,r)&&i(e,t,n)!==i(e,t,r)}for(var _=0;_<i.length;_++){var v=i[_];if(v.isNode()){var y=v,b=y.pstyle(`text-events`).strValue===`yes`,x=y.pstyle(`box-selection`).strValue,S=y.pstyle(`box-select-labels`).strValue===`yes`;if(x===`none`)continue;var C=(x===`overlap`||S)&&b,w=y.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:C});if(x===`contain`){var T=!1;if(S&&b){var E=h(y);E&&Bz(E,f)&&(o.push(y),T=!0)}!T&&sz(d,w)&&o.push(y)}else if(x===`overlap`&&iz(d,w)){var D=y.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if(Bz([{x:D.x1,y:D.y1},{x:D.x2,y:D.y1},{x:D.x2,y:D.y2},{x:D.x1,y:D.y2}],f))o.push(y);else{var O=h(y);O&&Bz(O,f)&&o.push(y)}}}else{var k=v,A=k._private,j=A.rscratch,M=k.pstyle(`box-selection`).strValue;if(M===`none`)continue;if(M===`contain`){if(j.startX!=null&&j.startY!=null&&!az(d,j.startX,j.startY)||j.endX!=null&&j.endY!=null&&!az(d,j.endX,j.endY))continue;if(j.edgeType===`bezier`||j.edgeType===`multibezier`||j.edgeType===`self`||j.edgeType===`compound`||j.edgeType===`segments`||j.edgeType===`haystack`){for(var N=A.rstyle.bezierPts||A.rstyle.linePts||A.rstyle.haystackPts,P=!0,F=0;F<N.length;F++)if(!oz(d,N[F])){P=!1;break}P&&o.push(k)}else j.edgeType===`straight`&&o.push(k)}else if(M===`overlap`){var I=!1;if(j.startX!=null&&j.startY!=null&&j.endX!=null&&j.endY!=null&&(az(d,j.startX,j.startY)||az(d,j.endX,j.endY)))o.push(k),I=!0;else if(!I&&j.edgeType===`haystack`){for(var L=A.rstyle.haystackPts,R=0;R<L.length;R++)if(oz(d,L[R])){o.push(k),I=!0;break}}if(!I){var ee=A.rstyle.bezierPts||A.rstyle.linePts||A.rstyle.haystackPts;if((!ee||ee.length<2)&&j.edgeType===`straight`&&j.startX!=null&&j.startY!=null&&j.endX!=null&&j.endY!=null&&(ee=[{x:j.startX,y:j.startY},{x:j.endX,y:j.endY}]),!ee||ee.length<2)continue;for(var z=0;z<ee.length-1;z++){for(var B=ee[z],V=ee[z+1],H=0;H<p.length;H++){var te=xF(p[H],2),ne=te[0],U=te[1];if(g(B,V,ne,U)){o.push(k),I=!0;break}}if(I)break}}}}}return o};var tJ={};tJ.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType===`haystack`,r=t.edgeType===`bezier`,i=t.edgeType===`multibezier`,a=t.edgeType===`segments`,o=t.edgeType===`compound`,s=t.edgeType===`self`,c,l,u,d,f,p,m,h;if(n?(u=t.haystackPts[0],d=t.haystackPts[1],f=t.haystackPts[2],p=t.haystackPts[3]):(u=t.arrowStartX,d=t.arrowStartY,f=t.arrowEndX,p=t.arrowEndY),m=t.midX,h=t.midY,a)c=u-t.segpts[0],l=d-t.segpts[1];else if(i||o||s||r){var g=t.allpts,_=KR(g[0],g[2],g[4],.1),v=KR(g[1],g[3],g[5],.1);c=u-_,l=d-v}else c=u-m,l=d-h;t.srcArrowAngle=BR(c,l);var m=t.midX,h=t.midY;if(n&&(m=(u+f)/2,h=(d+p)/2),c=f-u,l=p-d,a){var g=t.allpts;if(g.length/2%2==0){var y=g.length/2,b=y-2;c=g[y]-g[b],l=g[y+1]-g[b+1]}else if(t.isRound)c=t.midVector[1],l=-t.midVector[0];else{var y=g.length/2-1,b=y-2;c=g[y]-g[b],l=g[y+1]-g[b+1]}}else if(i||o||s){var g=t.allpts,x=t.ctrlpts,S,C,w,T;if(x.length/2%2==0){var E=g.length/2-1,D=E+2,O=D+2;S=KR(g[E],g[D],g[O],0),C=KR(g[E+1],g[D+1],g[O+1],0),w=KR(g[E],g[D],g[O],1e-4),T=KR(g[E+1],g[D+1],g[O+1],1e-4)}else{var D=g.length/2-1,E=D-2,O=D+2;S=KR(g[E],g[D],g[O],.4999),C=KR(g[E+1],g[D+1],g[O+1],.4999),w=KR(g[E],g[D],g[O],.5),T=KR(g[E+1],g[D+1],g[O+1],.5)}c=w-S,l=T-C}if(t.midtgtArrowAngle=BR(c,l),t.midDispX=c,t.midDispY=l,c*=-1,l*=-1,a){var g=t.allpts;if(g.length/2%2!=0&&!t.isRound){var y=g.length/2-1,k=y+2;c=-(g[k]-g[y]),l=-(g[k+1]-g[y+1])}}if(t.midsrcArrowAngle=BR(c,l),a)c=f-t.segpts[t.segpts.length-2],l=p-t.segpts[t.segpts.length-1];else if(i||o||s||r){var g=t.allpts,A=g.length,_=KR(g[A-6],g[A-4],g[A-2],.9),v=KR(g[A-5],g[A-3],g[A-1],.9);c=f-_,l=p-v}else c=f-m,l=p-h;t.tgtArrowAngle=BR(c,l)},tJ.getArrowWidth=tJ.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+`, `+t];return r||(r=Math.max((e*13.37)**.9,29)*t,n[e+`, `+t]=r,r)};var nJ,rJ,iJ={},aJ={},oJ,sJ,cJ,lJ,uJ,dJ,fJ,pJ,mJ,hJ,gJ,_J,vJ,yJ,bJ,xJ=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},SJ=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},CJ=function(e,t,n,r,i){if(e===bJ?SJ(aJ,iJ):xJ(t,e,iJ),xJ(t,n,aJ),oJ=iJ.nx*aJ.ny-iJ.ny*aJ.nx,sJ=iJ.nx*aJ.nx-iJ.ny*-aJ.ny,uJ=Math.asin(Math.max(-1,Math.min(1,oJ))),Math.abs(uJ)<1e-6){nJ=t.x,rJ=t.y,fJ=mJ=0;return}cJ=1,lJ=!1,sJ<0?uJ<0?uJ=Math.PI+uJ:(uJ=Math.PI-uJ,cJ=-1,lJ=!0):uJ>0&&(cJ=-1,lJ=!0),mJ=t.radius===void 0?r:t.radius,dJ=uJ/2,hJ=Math.min(iJ.len/2,aJ.len/2),i?(pJ=Math.abs(Math.cos(dJ)*mJ/Math.sin(dJ)),pJ>hJ?(pJ=hJ,fJ=Math.abs(pJ*Math.sin(dJ)/Math.cos(dJ))):fJ=mJ):(pJ=Math.min(hJ,mJ),fJ=Math.abs(pJ*Math.sin(dJ)/Math.cos(dJ))),vJ=t.x+aJ.nx*pJ,yJ=t.y+aJ.ny*pJ,nJ=vJ-aJ.ny*fJ*cJ,rJ=yJ+aJ.nx*fJ*cJ,gJ=t.x+iJ.nx*pJ,_J=t.y+iJ.ny*pJ,bJ=t};function wJ(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function TJ(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(CJ(e,t,n,r,i),{cx:nJ,cy:rJ,radius:fJ,startX:gJ,startY:_J,stopX:vJ,stopY:yJ,startAngle:iJ.ang+Math.PI/2*cJ,endAngle:aJ.ang-Math.PI/2*cJ,counterClockwise:lJ})}var EJ=.01,DJ=Math.sqrt(2*EJ),OJ={};OJ.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,i=t.vectorNormInverse,a,o=e.pstyle(`source-endpoint`),s=e.pstyle(`target-endpoint`),c=o.units!=null&&s.units!=null,l=function(e,t,n,r){var i=r-t,a=n-e,o=Math.sqrt(a*a+i*i);return{x:-i/o,y:a/o}};switch(e.pstyle(`edge-distances`).value){case`node-position`:a=n;break;case`intersection`:a=r;break;case`endpoints`:if(c){var u=xF(this.manualEndptToPx(e.source()[0],o),2),d=u[0],f=u[1],p=xF(this.manualEndptToPx(e.target()[0],s),2),m=p[0],h=p[1],g={x1:d,y1:f,x2:m,y2:h};i=l(d,f,m,h),a=g}else WL(`Edge ${e.id()} has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).`),a=r;break}return{midptPts:a,vectorNormInverse:i}},OJ.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=Math.random()*2*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=Math.random()*2*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,c=o.position(),l=s.position(),u=o.width(),d=s.width(),f=o.height(),p=s.height(),m=n.pstyle(`haystack-radius`).value/2;i.haystackPts=i.allpts=[i.source.x*u*m+c.x,i.source.y*f*m+c.y,i.target.x*d*m+l.x,i.target.y*p*m+l.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType=`haystack`,i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},OJ.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle(`segment-weights`),i=e.pstyle(`segment-distances`),a=e.pstyle(`segment-radii`),o=e.pstyle(`radius-type`),s=Math.min(r.pfValue.length,i.pfValue.length),c=a.pfValue[a.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];n.edgeType=`segments`,n.segpts=[],n.radii=[],n.isArcRadius=[];for(var u=0;u<s;u++){var d=r.pfValue[u],f=i.pfValue[u],p=1-d,m=d,h=this.findMidptPtsEtc(e,t),g=h.midptPts,_=h.vectorNormInverse,v={x:g.x1*p+g.x2*m,y:g.y1*p+g.y2*m};n.segpts.push(v.x+_.x*f,v.y+_.y*f),n.radii.push(a.pfValue[u]===void 0?c:a.pfValue[u]),n.isArcRadius.push((o.pfValue[u]===void 0?l:o.pfValue[u])===`arc-radius`)}},OJ.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle(`control-point-distances`),c=s?s.pfValue[0]:void 0,l=e.pstyle(`loop-direction`).pfValue,u=e.pstyle(`loop-sweep`).pfValue,d=e.pstyle(`control-point-step-size`).pfValue;i.edgeType=`self`;var f=n,p=d;r&&(f=0,p=c);var m=l-Math.PI/2,h=m-u/2,g=m+u/2,_=String(l+`_`+u);f=a[_]===void 0?a[_]=0:++a[_],i.ctrlpts=[o.x+Math.cos(h)*1.4*p*(f/3+1),o.y+Math.sin(h)*1.4*p*(f/3+1),o.x+Math.cos(g)*1.4*p*(f/3+1),o.y+Math.sin(g)*1.4*p*(f/3+1)]},OJ.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType=`compound`;var a=t.srcPos,o=t.tgtPos,s=t.srcW,c=t.srcH,l=t.tgtW,u=t.tgtH,d=e.pstyle(`control-point-step-size`).pfValue,f=e.pstyle(`control-point-distances`),p=f?f.pfValue[0]:void 0,m=n,h=d;r&&(m=0,h=p);var g=50,_={x:a.x-s/2,y:a.y-c/2},v={x:o.x-l/2,y:o.y-u/2},y={x:Math.min(_.x,v.x),y:Math.min(_.y,v.y)},b=.5,x=Math.max(b,Math.log(s*EJ)),S=Math.max(b,Math.log(l*EJ));i.ctrlpts=[y.x,y.y-(1+g**1.12/100)*h*(m/3+1)*x,y.x-(1+g**1.12/100)*h*(m/3+1)*S,y.y]},OJ.findStraightEdgePoints=function(e){e._private.rscratch.edgeType=`straight`},OJ.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=e.pstyle(`control-point-step-size`).pfValue,s=e.pstyle(`control-point-distances`),c=e.pstyle(`control-point-weights`),l=s&&c?Math.min(s.value.length,c.value.length):1,u=s?s.pfValue[0]:void 0,d=c.value[0],f=r;a.edgeType=f?`multibezier`:`bezier`,a.ctrlpts=[];for(var p=0;p<l;p++){var m=(.5-t.eles.length/2+n)*o*(i?-1:1),h=void 0,g=HR(m);f&&(u=s?s.pfValue[p]:o,d=c.value[p]),h=r?u:u===void 0?void 0:g*u;var _=h===void 0?m:h,v=1-d,y=d,b=this.findMidptPtsEtc(e,t),x=b.midptPts,S=b.vectorNormInverse,C={x:x.x1*v+x.x2*y,y:x.y1*v+x.y2*y};a.ctrlpts.push(C.x+S.x*_,C.y+S.y*_)}},OJ.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType=`segments`;var r=`vertical`,i=`horizontal`,a=`leftward`,o=`rightward`,s=`downward`,c=`upward`,l=`auto`,u=t.posPts,d=t.srcW,f=t.srcH,p=t.tgtW,m=t.tgtH,h=e.pstyle(`edge-distances`).value!==`node-position`,g=e.pstyle(`taxi-direction`).value,_=g,v=e.pstyle(`taxi-turn`),y=v.units===`%`,b=v.pfValue,x=b<0,S=e.pstyle(`taxi-turn-min-distance`).pfValue,C=h?(d+p)/2:0,w=h?(f+m)/2:0,T=u.x2-u.x1,E=u.y2-u.y1,D=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},O=D(T,C),k=D(E,w),A=!1;_===l?g=Math.abs(O)>Math.abs(k)?i:r:_===c||_===s?(g=r,A=!0):(_===a||_===o)&&(g=i,A=!0);var j=g===r,M=j?k:O,N=j?E:T,P=HR(N),F=!1;!(A&&(y||x))&&(_===s&&N<0||_===c&&N>0||_===a&&N>0||_===o&&N<0)&&(P*=-1,M=P*Math.abs(M),F=!0);var I=y?(b<0?1+b:b)*M:(b<0?M:0)+b*P,L=function(e){return Math.abs(e)<S||Math.abs(e)>=Math.abs(M)},R=L(I),ee=L(Math.abs(M)-Math.abs(I));if((R||ee)&&!F)if(j){var z=Math.abs(N)<=f/2,B=Math.abs(T)<=p/2;if(z){var V=(u.x1+u.x2)/2;n.segpts=[V,u.y1,V,u.y2]}else if(B){var H=(u.y1+u.y2)/2;n.segpts=[u.x1,H,u.x2,H]}else n.segpts=[u.x1,u.y2]}else{var te=Math.abs(N)<=d/2,ne=Math.abs(E)<=m/2;if(te){var U=(u.y1+u.y2)/2;n.segpts=[u.x1,U,u.x2,U]}else if(ne){var re=(u.x1+u.x2)/2;n.segpts=[re,u.y1,re,u.y2]}else n.segpts=[u.x2,u.y1]}else if(j){var ie=u.y1+I+(h?f/2*P:0);n.segpts=[u.x1,ie,u.x2,ie]}else{var ae=u.x1+I+(h?d/2*P:0);n.segpts=[ae,u.y1,ae,u.y2]}if(n.isRound){var oe=e.pstyle(`taxi-radius`).value,se=e.pstyle(`radius-type`).value[0]===`arc-radius`;n.radii=Array(n.segpts.length/2).fill(oe),n.isArcRadius=Array(n.segpts.length/2).fill(se)}},OJ.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType===`bezier`){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,c=t.tgtH,l=t.srcShape,u=t.tgtShape,d=t.srcCornerRadius,f=t.tgtCornerRadius,p=t.srcRs,m=t.tgtRs,h=!$(n.startX)||!$(n.startY),g=!$(n.arrowStartX)||!$(n.arrowStartY),_=!$(n.endX)||!$(n.endY),v=!$(n.arrowEndX)||!$(n.arrowEndY),y=3*(this.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.arrowShapeWidth),b=UR({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=b<y,S=UR({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),C=S<y,w=!1;if(h||g||x){w=!0;var T={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},E=Math.sqrt(T.x*T.x+T.y*T.y),D={x:T.x/E,y:T.y/E},O=Math.max(a,o),k={x:n.ctrlpts[0]+D.x*2*O,y:n.ctrlpts[1]+D.y*2*O},A=l.intersectLine(r.x,r.y,a,o,k.x,k.y,0,d,p);x?(n.ctrlpts[0]=n.ctrlpts[0]+D.x*(y-b),n.ctrlpts[1]=n.ctrlpts[1]+D.y*(y-b)):(n.ctrlpts[0]=A[0]+D.x*y,n.ctrlpts[1]=A[1]+D.y*y)}if(_||v||C){w=!0;var j={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},M=Math.sqrt(j.x*j.x+j.y*j.y),N={x:j.x/M,y:j.y/M},P=Math.max(a,o),F={x:n.ctrlpts[0]+N.x*2*P,y:n.ctrlpts[1]+N.y*2*P},I=u.intersectLine(i.x,i.y,s,c,F.x,F.y,0,f,m);C?(n.ctrlpts[0]=n.ctrlpts[0]+N.x*(y-S),n.ctrlpts[1]=n.ctrlpts[1]+N.y*(y-S)):(n.ctrlpts[0]=I[0]+N.x*y,n.ctrlpts[1]=I[1]+N.y*y)}w&&this.findEndpoints(e)}},OJ.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType===`multibezier`||t.edgeType===`bezier`||t.edgeType===`self`||t.edgeType===`compound`){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,i;t.ctrlpts.length/2%2==0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,i=.5,t.midX=KR(t.allpts[r],t.allpts[r+2],t.allpts[r+4],i),t.midY=KR(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],i))}else if(t.edgeType===`straight`)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType===`segments`){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var a=2;a+3<t.allpts.length;a+=2){var o=t.radii[a/2-1],s=t.isArcRadius[a/2-1];t.roundCorners.push(TJ({x:t.allpts[a-2],y:t.allpts[a-1]},{x:t.allpts[a],y:t.allpts[a+1],radius:o},{x:t.allpts[a+2],y:t.allpts[a+3]},o,s))}}if(t.segpts.length%4==0){var c=t.segpts.length/2,l=c-2;t.midX=(t.segpts[l]+t.segpts[c])/2,t.midY=(t.segpts[l+1]+t.segpts[c+1])/2}else{var u=t.segpts.length/2-1;if(!t.isRound)t.midX=t.segpts[u],t.midY=t.segpts[u+1];else{var d={x:t.segpts[u],y:t.segpts[u+1]},f=t.roundCorners[u/2];if(f.radius===0){var p={x:t.segpts[u+2],y:t.segpts[u+3]};t.midX=d.x,t.midY=d.y,t.midVector=[d.y-p.y,p.x-d.x]}else{var m=[d.x-f.cx,d.y-f.cy],h=f.radius/Math.sqrt(m[0]**2+m[1]**2);m=m.map(function(e){return e*h}),t.midX=f.cx+m[0],t.midY=f.cy+m[1],t.midVector=m}}}}},OJ.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||$(t.startX)&&$(t.startY)&&$(t.endX)&&$(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,WL("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},OJ.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy.hasCompoundNodes(),i=new rR,a=function(e,t){return[].concat(SF(e),[+!!t]).join(`-`)},o=[],s=[],c=0;c<e.length;c++){var l=e[c],u=l._private,d=l.pstyle(`curve-style`).value;if(!(l.removed()||!l.takesUpSpace())){if(d===`haystack`){s.push(l);continue}var f=d===`unbundled-bezier`||rI(d,`segments`)||d===`straight`||d===`straight-triangle`||rI(d,`taxi`),p=d===`unbundled-bezier`||d===`bezier`,m=u.source,h=u.target,g=[m.poolIndex(),h.poolIndex()].sort(),_=a(g,f),v=i.get(_);v??(v={eles:[]},o.push({pairId:g,edgeIsUnbundled:f}),i.set(_,v)),v.eles.push(l),f&&(v.hasUnbundled=!0),p&&(v.hasBezier=!0)}}for(var y=function(){var e=o[b],s=e.pairId,c=e.edgeIsUnbundled,l=a(s,c),u=i.get(l),d;if(!u.hasUnbundled){var f=u.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});$L(u.eles),f.forEach(function(e){return u.eles.push(e)}),u.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var p=u.eles[0],m=p.source(),h=p.target();if(m.poolIndex()>h.poolIndex()){var g=m;m=h,h=g}var _=u.srcPos=m.position(),v=u.tgtPos=h.position(),y=u.srcW=m.outerWidth(),x=u.srcH=m.outerHeight(),S=u.tgtW=h.outerWidth(),C=u.tgtH=h.outerHeight(),w=u.srcShape=n.nodeShapes[t.getNodeShape(m)],T=u.tgtShape=n.nodeShapes[t.getNodeShape(h)],E=u.srcCornerRadius=m.pstyle(`corner-radius`).value===`auto`?`auto`:m.pstyle(`corner-radius`).pfValue,D=u.tgtCornerRadius=h.pstyle(`corner-radius`).value===`auto`?`auto`:h.pstyle(`corner-radius`).pfValue,O=u.tgtRs=h._private.rscratch,k=u.srcRs=m._private.rscratch;u.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var A=0;A<u.eles.length;A++){var j=u.eles[A],M=j[0]._private.rscratch,N=j.pstyle(`curve-style`).value,P=N===`unbundled-bezier`||rI(N,`segments`)||rI(N,`taxi`),F=!m.same(j.source());if(!u.calculatedIntersection&&m!==h&&(u.hasBezier||u.hasUnbundled)){u.calculatedIntersection=!0;var I=w.intersectLine(_.x,_.y,y,x,v.x,v.y,0,E,k),L=u.srcIntn=I,R=T.intersectLine(v.x,v.y,S,C,_.x,_.y,0,D,O),ee=u.tgtIntn=R,z=u.intersectionPts={x1:I[0],x2:R[0],y1:I[1],y2:R[1]},B=u.posPts={x1:_.x,x2:v.x,y1:_.y,y2:v.y},V=R[1]-I[1],H=R[0]-I[0],te=Math.sqrt(H*H+V*V);$(te)&&te>=DJ||(te=Math.sqrt(Math.max(H*H,EJ)+Math.max(V*V,EJ)));var ne=u.vector={x:H,y:V},U=u.vectorNorm={x:ne.x/te,y:ne.y/te},re={x:-U.y,y:U.x};u.nodesOverlap=!$(te)||T.checkPoint(I[0],I[1],0,S,C,v.x,v.y,D,O)||w.checkPoint(R[0],R[1],0,y,x,_.x,_.y,E,k),u.vectorNormInverse=re,d={nodesOverlap:u.nodesOverlap,dirCounts:u.dirCounts,calculatedIntersection:!0,hasBezier:u.hasBezier,hasUnbundled:u.hasUnbundled,eles:u.eles,srcPos:v,srcRs:O,tgtPos:_,tgtRs:k,srcW:S,srcH:C,tgtW:y,tgtH:x,srcIntn:ee,tgtIntn:L,srcShape:T,tgtShape:w,posPts:{x1:B.x2,y1:B.y2,x2:B.x1,y2:B.y1},intersectionPts:{x1:z.x2,y1:z.y2,x2:z.x1,y2:z.y1},vector:{x:-ne.x,y:-ne.y},vectorNorm:{x:-U.x,y:-U.y},vectorNormInverse:{x:-re.x,y:-re.y}}}var ie=F?d:u;M.nodesOverlap=ie.nodesOverlap,M.srcIntn=ie.srcIntn,M.tgtIntn=ie.tgtIntn,M.isRound=N.startsWith(`round`),r&&(m.isParent()||m.isChild()||h.isParent()||h.isChild())&&(m.parents().anySame(h)||h.parents().anySame(m)||m.same(h)&&m.isParent())?t.findCompoundLoopPoints(j,ie,A,P):m===h?t.findLoopPoints(j,ie,A,P):N.endsWith(`segments`)?t.findSegmentsPoints(j,ie):N.endsWith(`taxi`)?t.findTaxiPoints(j,ie):N===`straight`||!P&&u.eles.length%2==1&&A===Math.floor(u.eles.length/2)?t.findStraightEdgePoints(j):t.findBezierPoints(j,ie,A,P,F),t.findEndpoints(j),t.tryToCorrectInvalidPoints(j,ie),t.checkForInvalidEdgeWarning(j),t.storeAllpts(j),t.storeEdgeProjections(j),t.calculateArrowAngles(j),t.recalculateEdgeLabelProjections(j),t.calculateLabelAngles(j)}},b=0;b<o.length;b++)y();this.findHaystackPoints(s)}};function kJ(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}OJ.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),t.edgeType===`segments`)return kJ(t.segpts)},OJ.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n===`bezier`||n===`multibezier`||n===`self`||n===`compound`)return kJ(t.ctrlpts)},OJ.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var AJ={};AJ.manualEndptToPx=function(e,t){var n=this,r=e.position(),i=e.outerWidth(),a=e.outerHeight(),o=e._private.rscratch;if(t.value.length===2){var s=[t.pfValue[0],t.pfValue[1]];return t.units[0]===`%`&&(s[0]*=i),t.units[1]===`%`&&(s[1]*=a),s[0]+=r.x,s[1]+=r.y,s}else{var c=t.pfValue[0];c=-Math.PI/2+c;var l=2*Math.max(i,a),u=[r.x+Math.cos(c)*l,r.y+Math.sin(c)*l];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,i,a,u[0],u[1],0,e.pstyle(`corner-radius`).value===`auto`?`auto`:e.pstyle(`corner-radius`).pfValue,o)}},AJ.findEndpoints=function(e){var t,n,r=this,i,a=e.source()[0],o=e.target()[0],s=a.position(),c=o.position(),l=e.pstyle(`target-arrow-shape`).value,u=e.pstyle(`source-arrow-shape`).value,d=e.pstyle(`target-distance-from-node`).pfValue,f=e.pstyle(`source-distance-from-node`).pfValue,p=a._private.rscratch,m=o._private.rscratch,h=e.pstyle(`curve-style`).value,g=e._private.rscratch,_=g.edgeType,v=rI(h,`taxi`),y=_===`self`||_===`compound`,b=_===`bezier`||_===`multibezier`||y,x=_!==`bezier`,S=_===`straight`||_===`segments`,C=_===`segments`,w=b||x||S,T=y||v,E=e.pstyle(`source-endpoint`),D=T?`outside-to-node`:E.value,O=a.pstyle(`corner-radius`).value===`auto`?`auto`:a.pstyle(`corner-radius`).pfValue,k=e.pstyle(`target-endpoint`),A=T?`outside-to-node`:k.value,j=o.pstyle(`corner-radius`).value===`auto`?`auto`:o.pstyle(`corner-radius`).pfValue;g.srcManEndpt=E,g.tgtManEndpt=k;var M,N,P,F,I=((k==null||(t=k.pfValue)==null?void 0:t.length)===2?k.pfValue:null)??[0,0],L=((E==null||(n=E.pfValue)==null?void 0:n.length)===2?E.pfValue:null)??[0,0];if(b){var R=[g.ctrlpts[0],g.ctrlpts[1]];M=x?[g.ctrlpts[g.ctrlpts.length-2],g.ctrlpts[g.ctrlpts.length-1]]:R,N=R}else if(S){var ee=C?g.segpts.slice(0,2):[c.x+I[0],c.y+I[1]];M=C?g.segpts.slice(g.segpts.length-2):[s.x+L[0],s.y+L[1]],N=ee}if(A===`inside-to-node`)i=[c.x,c.y];else if(k.units)i=this.manualEndptToPx(o,k);else if(A===`outside-to-line`)i=g.tgtIntn;else if(A===`outside-to-node`||A===`outside-to-node-or-label`?P=M:(A===`outside-to-line`||A===`outside-to-line-or-label`)&&(P=[s.x,s.y]),i=r.nodeShapes[this.getNodeShape(o)].intersectLine(c.x,c.y,o.outerWidth(),o.outerHeight(),P[0],P[1],0,j,m),A===`outside-to-node-or-label`||A===`outside-to-line-or-label`){var z=o._private.rscratch,B=z.labelWidth,V=z.labelHeight,H=z.labelX,te=z.labelY,ne=B/2,U=V/2,re=o.pstyle(`text-valign`).value;re===`top`?te-=U:re===`bottom`&&(te+=U);var ie=o.pstyle(`text-halign`).value;ie===`left`?H-=ne:ie===`right`&&(H+=ne);var ae=kz(P[0],P[1],[H-ne,te-U,H+ne,te-U,H+ne,te+U,H-ne,te+U],c.x,c.y);if(ae.length>0){var oe=s,se=WR(oe,PR(i)),ce=WR(oe,PR(ae)),le=se;ce<se&&(i=ae,le=ce),ae.length>2&&WR(oe,{x:ae[2],y:ae[3]})<le&&(i=[ae[2],ae[3]])}}var ue=jz(i,M,r.arrowShapes[l].spacing(e)+d),de=jz(i,M,r.arrowShapes[l].gap(e)+d);if(g.endX=de[0],g.endY=de[1],g.arrowEndX=ue[0],g.arrowEndY=ue[1],D===`inside-to-node`)i=[s.x,s.y];else if(E.units)i=this.manualEndptToPx(a,E);else if(D===`outside-to-line`)i=g.srcIntn;else if(D===`outside-to-node`||D===`outside-to-node-or-label`?F=N:(D===`outside-to-line`||D===`outside-to-line-or-label`)&&(F=[c.x,c.y]),i=r.nodeShapes[this.getNodeShape(a)].intersectLine(s.x,s.y,a.outerWidth(),a.outerHeight(),F[0],F[1],0,O,p),D===`outside-to-node-or-label`||D===`outside-to-line-or-label`){var fe=a._private.rscratch,pe=fe.labelWidth,me=fe.labelHeight,he=fe.labelX,ge=fe.labelY,_e=pe/2,ve=me/2,ye=a.pstyle(`text-valign`).value;ye===`top`?ge-=ve:ye===`bottom`&&(ge+=ve);var be=a.pstyle(`text-halign`).value;be===`left`?he-=_e:be===`right`&&(he+=_e);var xe=kz(F[0],F[1],[he-_e,ge-ve,he+_e,ge-ve,he+_e,ge+ve,he-_e,ge+ve],s.x,s.y);if(xe.length>0){var Se=c,Ce=WR(Se,PR(i)),we=WR(Se,PR(xe)),Te=Ce;we<Ce&&(i=[xe[0],xe[1]],Te=we),xe.length>2&&WR(Se,{x:xe[2],y:xe[3]})<Te&&(i=[xe[2],xe[3]])}}var Ee=jz(i,N,r.arrowShapes[u].spacing(e)+f),De=jz(i,N,r.arrowShapes[u].gap(e)+f);g.startX=De[0],g.startY=De[1],g.arrowStartX=Ee[0],g.arrowStartY=Ee[1],w&&(!$(g.startX)||!$(g.startY)||!$(g.endX)||!$(g.endY)?g.badLine=!0:g.badLine=!1)},AJ.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case`haystack`:return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},AJ.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case`haystack`:return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}};var jJ={};function MJ(e,t,n){for(var r=function(e,t,n,r){return KR(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}jJ.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r===`multibezier`||r===`bezier`||r===`self`||r===`compound`){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)MJ(this,e,n.allpts.slice(i,i+6))}else if(r===`segments`)for(var a=t.rstyle.linePts=[],i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]});else if(r===`haystack`){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.arrowShapeWidth},jJ.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var NJ={};NJ.recalculateNodeLabelProjection=function(e){var t=e.pstyle(`label`).strValue;if(!qF(t)){var n,r,i=e._private,a=e.width(),o=e.height(),s=e.padding(),c=e.position(),l=e.pstyle(`text-halign`).strValue,u=e.pstyle(`text-valign`).strValue,d=i.rscratch,f=i.rstyle;switch(l){case`left`:n=c.x-a/2-s;break;case`right`:n=c.x+a/2+s;break;default:n=c.x}switch(u){case`top`:r=c.y-o/2-s;break;case`bottom`:r=c.y+o/2+s;break;default:r=c.y}d.labelX=n,d.labelY=r,f.labelX=n,f.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var PJ=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n*=-1),n},FJ=function(e,t){return PJ(t.x-e.x,t.y-e.y)},IJ=function(e,t,n,r){var i=YR(0,r-.001,1),a=YR(0,r+.001,1);return FJ(qR(e,t,n,i),qR(e,t,n,a))};NJ.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle(`label`).strValue,source:e.pstyle(`source-label`).strValue,target:e.pstyle(`target-label`).strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){nR(n.rscratch,e,t,r),nR(n.rstyle,e,t,r)};o(`labelX`,null,t.x),o(`labelY`,null,t.y),o(`labelAutoAngle`,null,PJ(r.midDispX,r.midDispY));var s=function(){if(s.cache)return s.cache;for(var e=[],t=0;t+5<r.allpts.length;t+=4){var a={x:r.allpts[t],y:r.allpts[t+1]},o={x:r.allpts[t+2],y:r.allpts[t+3]},c={x:r.allpts[t+4],y:r.allpts[t+5]};e.push({p0:a,p1:o,p2:c,startDist:0,length:0,segments:[]})}var l=n.rstyle.bezierPts,u=i.bezierProjPcts.length;function d(e,t,n,r,i){var a=UR(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var f=0;f<e.length;f++){var p=e[f],m=e[f-1];m&&(p.startDist=m.startDist+m.length),d(p,p.p0,l[f*u],0,i.bezierProjPcts[0]);for(var h=0;h<u-1;h++)d(p,l[f*u+h],l[f*u+h+1],i.bezierProjPcts[h],i.bezierProjPcts[h+1]);d(p,l[f*u+u-1],p.p2,i.bezierProjPcts[u-1],1)}return s.cache=e},c=function(n){var i,c=n===`source`;if(a[n]){var l=e.pstyle(n+`-text-offset`).pfValue;switch(r.edgeType){case`self`:case`compound`:case`bezier`:case`multibezier`:for(var u=s(),d,f=0,p=0,m=0;m<u.length;m++){for(var h=u[c?m:u.length-1-m],g=0;g<h.segments.length;g++){var _=h.segments[c?g:h.segments.length-1-g],v=m===u.length-1&&g===h.segments.length-1;if(f=p,p+=_.length,p>=l||v){d={cp:h,segment:_};break}}if(d)break}var y=d.cp,b=d.segment,x=(l-f)/b.length,S=b.t1-b.t0,C=c?b.t0+S*x:b.t1-S*x;C=YR(0,C,1),t=qR(y.p0,y.p1,y.p2,C),i=IJ(y.p0,y.p1,y.p2,C);break;case`straight`:case`segments`:case`haystack`:for(var w=0,T,E,D,O,k=r.allpts.length,A=0;A+3<k&&(c?(D={x:r.allpts[A],y:r.allpts[A+1]},O={x:r.allpts[A+2],y:r.allpts[A+3]}):(D={x:r.allpts[k-2-A],y:r.allpts[k-1-A]},O={x:r.allpts[k-4-A],y:r.allpts[k-3-A]}),T=UR(D,O),E=w,w+=T,!(w>=l));A+=2);var j=(l-E)/T;j=YR(0,j,1),t=JR(D,O,j),i=FJ(D,O);break}o(`labelX`,n,t.x),o(`labelY`,n,t.y),o(`labelAutoAngle`,n,i)}};c(`source`),c(`target`),this.applyLabelDimensions(e)}},NJ.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,`source`),this.applyPrefixedLabelDimensions(e,`target`))},NJ.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=OL(r,e._private.labelDimsKey);if(tR(n.rscratch,`prefixedLabelDimsKey`,t)!==i){nR(n.rscratch,`prefixedLabelDimsKey`,t,i);var a=this.calculateLabelDimensions(e,r),o=e.pstyle(`line-height`).pfValue,s=e.pstyle(`text-wrap`).strValue,c=tR(n.rscratch,`labelWrapCachedLines`,t)||[],l=s===`wrap`?Math.max(c.length,1):1,u=a.height/l,d=u*o,f=a.width,p=a.height+(l-1)*(o-1)*u;nR(n.rstyle,`labelWidth`,t,f),nR(n.rscratch,`labelWidth`,t,f),nR(n.rstyle,`labelHeight`,t,p),nR(n.rscratch,`labelHeight`,t,p),nR(n.rscratch,`labelLineHeight`,t,d)}},NJ.getLabelText=function(e,t){var n=e._private,r=t?t+`-`:``,i=e.pstyle(r+`label`).strValue,a=e.pstyle(`text-transform`).value,o=function(e,r){return r?(nR(n.rscratch,e,t,r),r):tR(n.rscratch,e,t)};if(!i)return``;a==`none`||(a==`uppercase`?i=i.toUpperCase():a==`lowercase`&&(i=i.toLowerCase()));var s=e.pstyle(`text-wrap`).value;if(s===`wrap`){var c=o(`labelKey`);if(c!=null&&o(`labelWrapKey`)===c)return o(`labelWrapCachedText`);for(var l=`​`,u=i.split(`
@@ -401,7 +401,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
401
401
  ${e.picking?`if(outColor.a == 0.0) discard;
402
402
  else outColor = vIndex;`:``}
403
403
  }
404
- `);i.aPosition=t.getAttribLocation(i,`aPosition`),i.aIndex=t.getAttribLocation(i,`aIndex`),i.aVertType=t.getAttribLocation(i,`aVertType`),i.aTransform=t.getAttribLocation(i,`aTransform`),i.aAtlasId=t.getAttribLocation(i,`aAtlasId`),i.aTex=t.getAttribLocation(i,`aTex`),i.aPointAPointB=t.getAttribLocation(i,`aPointAPointB`),i.aPointCPointD=t.getAttribLocation(i,`aPointCPointD`),i.aLineWidth=t.getAttribLocation(i,`aLineWidth`),i.aColor=t.getAttribLocation(i,`aColor`),i.aCornerRadius=t.getAttribLocation(i,`aCornerRadius`),i.aBorderColor=t.getAttribLocation(i,`aBorderColor`),i.uPanZoomMatrix=t.getUniformLocation(i,`uPanZoomMatrix`),i.uAtlasSize=t.getUniformLocation(i,`uAtlasSize`),i.uBGColor=t.getUniformLocation(i,`uBGColor`),i.uZoom=t.getUniformLocation(i,`uZoom`),i.uTextures=[];for(var a=0;a<this.batchManager.getMaxAtlasesPerBatch();a++)i.uTextures.push(t.getUniformLocation(i,`uTexture${a}`));return i}},{key:`_createVAO`,value:function(){var e=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=e.length/2;var t=this.maxInstances,n=this.gl,r=this.program,i=n.createVertexArray();return n.bindVertexArray(i),kX(n,`vec2`,r.aPosition,e),this.transformBuffer=jX(n,t,r.aTransform),this.indexBuffer=AX(n,t,`vec4`,r.aIndex),this.vertTypeBuffer=AX(n,t,`int`,r.aVertType),this.atlasIdBuffer=AX(n,t,`int`,r.aAtlasId),this.texBuffer=AX(n,t,`vec4`,r.aTex),this.pointAPointBBuffer=AX(n,t,`vec4`,r.aPointAPointB),this.pointCPointDBuffer=AX(n,t,`vec4`,r.aPointCPointD),this.lineWidthBuffer=AX(n,t,`vec2`,r.aLineWidth),this.colorBuffer=AX(n,t,`vec4`,r.aColor),this.cornerRadiusBuffer=AX(n,t,`vec4`,r.aCornerRadius),this.borderColorBuffer=AX(n,t,`vec4`,r.aBorderColor),n.bindVertexArray(null),i}},{key:`buffers`,get:function(){var e=this;return this._buffers||=Object.keys(this).filter(function(e){return rI(e,`Buffer`)}).map(function(t){return e[t]}),this._buffers}},{key:`startFrame`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:XX.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:`startBatch`,value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:`endFrame`,value:function(){this.endBatch()}},{key:`_isVisible`,value:function(e,t){return e.visible()?t&&t.isVisible?t.isVisible(e):!0:!1}},{key:`drawTexture`,value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,a=r.getRenderTypeOpts(n);if(this._isVisible(e,a)&&!(e.isEdge()&&!this._isValidEdge(e))){if(this.renderTarget.picking&&a.getTexPickingMode){var o=a.getTexPickingMode(e);if(o===ZX.IGNORE)return;if(o==ZX.USE_BB){this.drawPickingRectangle(e,t,n);return}}var s=hF(r.getAtlasInfo(e,n)),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=l.atlas,d=l.tex1,f=l.tex2;i.canAddToCurrentBatch(u)||this.endBatch();for(var p=i.getAtlasIndexForBatch(u),m=0,h=[[d,!0],[f,!1]];m<h.length;m++){var g=xF(h[m],2),_=g[0],v=g[1];if(_.w!=0){var y=this.instanceCount;this.vertTypeBuffer.getView(y)[0]=QX,CX(t,this.indexBuffer.getView(y));var b=this.atlasIdBuffer.getView(y);b[0]=p;var x=this.texBuffer.getView(y);x[0]=_.x,x[1]=_.y,x[2]=_.w,x[3]=_.h;var S=this.transformBuffer.getMatrixView(y);this.setTransformMatrix(e,S,a,l,v),this.instanceCount++,v||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(e){s.e(e)}finally{s.f()}}}},{key:`setTransformMatrix`,value:function(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;if(n.shapeProps&&n.shapeProps.padding&&(a=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,c=r.tex2,l=s.w/(s.w+c.w);i||(l=1-l);var u=this._getAdjustedBB(o,a,i,l);this._applyTransformMatrix(t,u,n,e)}else{var d=n.getBoundingBox(e),f=this._getAdjustedBB(d,a,!0,1);this._applyTransformMatrix(t,f,n,e)}}},{key:`_applyTransformMatrix`,value:function(e,t,n,r){var i,a;FX(e);var o=n.getRotation?n.getRotation(r):0;if(o!==0){var s=n.getRotationPoint(r),c=s.x,l=s.y;LX(e,e,[c,l]),RX(e,e,o);var u=n.getRotationOffset(r);i=u.x+(t.xOffset||0),a=u.y+(t.yOffset||0)}else i=t.x1,a=t.y1;LX(e,e,[i,a]),zX(e,e,[t.w,t.h])}},{key:`_getAdjustedBB`,value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h,c=e.yOffset;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(l=o-u,i+=l,o=u),{x1:i,y1:a,w:o,h:s,xOffset:l,yOffset:c}}},{key:`drawPickingRectangle`,value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=nZ,CX(t,this.indexBuffer.getView(i)),SX([0,0,0],1,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);this.setTransformMatrix(e,a,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:`drawNode`,value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var i=r.shapeProps,a=this._getVertTypeForShape(e,i.shape);if(a===void 0||r.isSimple&&!r.isSimple(e,this.renderTarget)){this.drawTexture(e,t,n);return}var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=a,a===rZ||a===iZ){var s=r.getBoundingBox(e),c=this._getCornerRadius(e,i.radius,s),l=this.cornerRadiusBuffer.getView(o);l[0]=c,l[1]=c,l[2]=c,l[3]=c,a===iZ&&(l[0]=0,l[2]=0)}CX(t,this.indexBuffer.getView(o));var u=this.renderTarget.picking?1:n===`node-body`?e.effectiveOpacity():1,d=this.renderTarget.picking?1:e.pstyle(i.opacity).value*u,f=e.pstyle(i.color).value;SX(f,d,this.colorBuffer.getView(o));var p=this.lineWidthBuffer.getView(o);if(p[0]=0,p[1]=0,i.border){var m=e.pstyle(`border-width`).value;if(m>0){var h=e.pstyle(`border-color`).value;SX(h,u*e.pstyle(`border-opacity`).value,this.borderColorBuffer.getView(o));var g=e.pstyle(`border-position`).value;if(g===`inside`)p[0]=0,p[1]=-m;else if(g===`outside`)p[0]=m,p[1]=0;else{var _=m/2;p[0]=_,p[1]=-_}}}var v=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,v,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:`_getVertTypeForShape`,value:function(e,t){switch(e.pstyle(t).value){case`rectangle`:return nZ;case`ellipse`:return aZ;case`roundrectangle`:case`round-rectangle`:return rZ;case`bottom-round-rectangle`:return iZ;default:return}}},{key:`_getCornerRadius`,value:function(e,t,n){var r=n.w,i=n.h;if(e.pstyle(t).value===`auto`)return Fz(r,i);var a=e.pstyle(t).pfValue,o=r/2,s=i/2;return Math.min(a,s,o)}},{key:`drawEdgeArrow`,value:function(e,t,n){if(e.visible()){var r=e._private.rscratch,i,a,o;if(n===`source`?(i=r.arrowStartX,a=r.arrowStartY,o=r.srcArrowAngle):(i=r.arrowEndX,a=r.arrowEndY,o=r.tgtArrowAngle),!(isNaN(i)||i==null||isNaN(a)||a==null||isNaN(o)||o==null)&&e.pstyle(n+`-arrow-shape`).value!==`none`){var s=e.pstyle(n+`-arrow-color`).value,c=e.pstyle(`opacity`).value*e.pstyle(`line-opacity`).value,l=e.pstyle(`width`).pfValue,u=e.pstyle(`arrow-scale`).value,d=this.r.getArrowWidth(l,u),f=this.instanceCount,p=this.transformBuffer.getMatrixView(f);FX(p),LX(p,p,[i,a]),zX(p,p,[d,d]),RX(p,p,o),this.vertTypeBuffer.getView(f)[0]=tZ,CX(t,this.indexBuffer.getView(f)),SX(s,c,this.colorBuffer.getView(f)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:`drawEdgeLine`,value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle(`opacity`).value,i=e.pstyle(`line-opacity`).value,a=e.pstyle(`width`).pfValue,o=e.pstyle(`line-color`).value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=$X,CX(t,this.indexBuffer.getView(c)),SX(o,s,this.colorBuffer.getView(c));var l=this.lineWidthBuffer.getView(c);l[0]=a;var u=this.pointAPointBBuffer.getView(c);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var d=0;d<n.length-2;d+=2){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=eZ,CX(t,this.indexBuffer.getView(f)),SX(o,s,this.colorBuffer.getView(f));var p=this.lineWidthBuffer.getView(f);p[0]=a;var m=n[d-2],h=n[d-1],g=n[d],_=n[d+1],v=n[d+2],y=n[d+3],b=n[d+4],x=n[d+5];d==0&&(m=2*g-v+.001,h=2*_-y+.001),d==n.length-4&&(b=2*v-g+.001,x=2*y-_+.001);var S=this.pointAPointBBuffer.getView(f);S[0]=m,S[1]=h,S[2]=g,S[3]=_;var C=this.pointCPointDBuffer.getView(f);C[0]=v,C[1]=y,C[2]=b,C[3]=x,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:`_isValidEdge`,value:function(e){var t=e._private.rscratch;return!(t.badLine||t.allpts==null||isNaN(t.allpts[0]))}},{key:`_getEdgePoints`,value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(n.length==4)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:`_getNumSegments`,value:function(e){return Math.min(15,this.maxInstances)}},{key:`_getCurveSegmentPoints`,value:function(e,t){if(e.length==4)return e;for(var n=Array((t+1)*2),r=0;r<=t;r++)if(r==0)n[0]=e[0],n[1]=e[1];else if(r==t)n[r*2]=e[e.length-2],n[r*2+1]=e[e.length-1];else{var i=r/t;this._setCurvePoint(e,i,n,r*2)}return n}},{key:`_setCurvePoint`,value:function(e,t,n,r){if(e.length<=2)n[r]=e[0],n[r+1]=e[1];else{for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this._setCurvePoint(i,t,n,r)}}},{key:`endBatch`,value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,r=this.instanceCount;if(r!==0){var i=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(i),e.bindVertexArray(t);var a=hF(this.buffers),o;try{for(a.s();!(o=a.n()).done;)o.value.bufferSubData(r)}catch(e){a.e(e)}finally{a.f()}for(var s=this.batchManager.getAtlases(),c=0;c<s.length;c++)s[c].bufferIfNeeded(e);for(var l=0;l<s.length;l++)e.activeTexture(e.TEXTURE0+l),e.bindTexture(e.TEXTURE_2D,s[l].texture),e.uniform1i(i.uTextures[l],l);e.uniform1f(i.uZoom,vX(this.r)),e.uniformMatrix3fv(i.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(i.uAtlasSize,this.batchManager.getAtlasSize());var u=SX(this.bgColor,1);e.uniform4fv(i.uBGColor,u),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:r,atlasCount:s.length}),this.startBatch()}}},{key:`getDebugInfo`,value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(e,t){return e+t.atlasCount},0),n=this.batchDebugInfo,r=n.reduce(function(e,t){return e+t.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}])}(),sZ={};sZ.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=cZ(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=MX(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new oZ(n,r,e);var i=function(e){return function(t){return n.getTextAngle(t,e)}},a=function(e){return function(t){var n=t.pstyle(e);return n&&n.value}},o=function(e){return function(t){return t.pstyle(`${e}-opacity`).value>0}},s=function(e){return e.pstyle(`text-events`).strValue===`yes`?ZX.USE_BB:ZX.IGNORE},c=function(e){var t=e.position(),n=t.x,r=t.y,i=e.outerWidth(),a=e.outerHeight();return{w:i,h:a,x1:n-i/2,y1:r-a/2}};n.drawing.addAtlasCollection(`node`,{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection(`label`,{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType(`node-body`,{collection:`node`,getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType(`node-body`,{getBoundingBox:c,isSimple:bX,shapeProps:{shape:`shape`,color:`background-color`,opacity:`background-opacity`,radius:`corner-radius`,border:!0}}),n.drawing.addSimpleShapeRenderType(`node-overlay`,{getBoundingBox:c,isVisible:o(`overlay`),shapeProps:{shape:`overlay-shape`,color:`overlay-color`,opacity:`overlay-opacity`,padding:`overlay-padding`,radius:`overlay-corner-radius`}}),n.drawing.addSimpleShapeRenderType(`node-underlay`,{getBoundingBox:c,isVisible:o(`underlay`),shapeProps:{shape:`underlay-shape`,color:`underlay-color`,opacity:`underlay-opacity`,padding:`underlay-padding`,radius:`underlay-corner-radius`}}),n.drawing.addTextureAtlasRenderType(`label`,{collection:`label`,getTexPickingMode:s,getKey:uZ(t.getLabelKey,null),getBoundingBox:dZ(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a(`label`)}),n.drawing.addTextureAtlasRenderType(`edge-source-label`,{collection:`label`,getTexPickingMode:s,getKey:uZ(t.getSourceLabelKey,`source`),getBoundingBox:dZ(t.getSourceLabelBox,`source`),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i(`source`),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a(`source-label`)}),n.drawing.addTextureAtlasRenderType(`edge-target-label`,{collection:`label`,getTexPickingMode:s,getKey:uZ(t.getTargetLabelKey,`target`),getBoundingBox:dZ(t.getTargetLabelBox,`target`),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i(`target`),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a(`target-label`)});var l=fL(function(){console.log(`garbage collect flag set`),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(e,t){var r=!1;t&&t.length>0&&(r|=n.drawing.invalidate(t)),r&&l()}),fZ(n)};function cZ(e){var t=e.cy.container();return vI(t&&t.style&&t.style.backgroundColor||`white`)}function lZ(e,t){var n=e._private.rscratch;return tR(n,`labelWrapCachedLines`,t)||[]}var uZ=function(e,t){return function(n){var r=e(n),i=lZ(n,t);return i.length>1?i.map(function(e,t){return`${r}_${t}`}):r}},dZ=function(e,t){return function(n,r){var i=e(n);if(typeof r==`string`){var a=r.indexOf(`_`);if(a>0){var o=Number(r.substring(a+1)),s=lZ(n,t),c=i.h/s.length,l=c*o,u=i.y1+l;return{x1:i.x1,w:i.w,y1:u,h:c,yOffset:l}}}return i}};function fZ(e){var t=e.render;e.render=function(n){n||={};var r=e.cy;e.webgl&&(r.zoom()>oY?(pZ(e),t.call(e,n)):(mZ(e),CZ(e,n,XX.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return xZ(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),t===`viewport`||t===`bounds`?e.pickingFrameBuffer.needsDraw=!0:t===`background`&&e.drawing.invalidate(n,{type:`node-body`})}}function pZ(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function mZ(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function hZ(e){var t=e.canvasWidth,n=e.canvasHeight,r=_X(e),i=r.pan,a=r.zoom,o=PX();LX(o,o,[i.x,i.y]),zX(o,o,[a,a]);var s=PX();BX(s,t,n);var c=PX();return IX(c,s,o),c}function gZ(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=_X(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function _Z(e,t){e.drawSelectionRectangle(t,function(t){return gZ(e,t)})}function vZ(e){var t=e.data.contexts[e.NODE];t.save(),gZ(e,t),t.strokeStyle=`rgba(0, 0, 0, 0.3)`,t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function yZ(e){var t=function(t,n,r){for(var i=t.atlasManager.getAtlasCollection(n),a=e.data.contexts[e.NODE],o=i.atlases,s=0;s<o.length;s++){var c=o[s].canvas;if(c){var l=c.width,u=c.height,d=l*s,f=c.height*r,p=.4;a.save(),a.scale(p,p),a.drawImage(c,d,f),a.strokeStyle=`black`,a.rect(d,f,l,u),a.stroke(),a.restore()}}},n=0;t(e.drawing,`node`,n++),t(e.drawing,`label`,n++)}function bZ(e,t,n,r,i){var a,o,s,c,l=_X(e),u=l.pan,d=l.zoom,f=xF(yX(e,u,d,t,n),2),p=f[0],m=f[1],h=6;if(a=p-h/2,o=m-h/2,s=h,c=h,s===0||c===0)return[];var g=e.data.contexts[e.WEBGL];g.bindFramebuffer(g.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(g.viewport(0,0,g.canvas.width,g.canvas.height),CZ(e,null,XX.PICKING),e.pickingFrameBuffer.needsDraw=!1);var _=s*c,v=new Uint8Array(_*4);g.readPixels(a,o,s,c,g.RGBA,g.UNSIGNED_BYTE,v),g.bindFramebuffer(g.FRAMEBUFFER,null);for(var y=new Set,b=0;b<_;b++){var x=wX(v.slice(b*4,b*4+4))-1;x>=0&&y.add(x)}return y}function xZ(e,t,n){var r=bZ(e,t,n),i=e.getCachedZSortedEles(),a,o,s=hF(r),c;try{for(s.s();!(c=s.n()).done;){var l=i[c.value];if(!a&&l.isNode()&&(a=l),!o&&l.isEdge()&&(o=l),a&&o)break}}catch(e){s.e(e)}finally{s.f()}return[a,o].filter(Boolean)}function SZ(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,`node-underlay`),r.drawNode(n,t,`node-body`),r.drawTexture(n,t,`label`),r.drawNode(n,t,`node-overlay`)):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,`source`),r.drawEdgeArrow(n,t,`target`),r.drawTexture(n,t,`label`),r.drawTexture(n,t,`edge-source-label`),r.drawTexture(n,t,`edge-target-label`))}function CZ(e,t,n){var r;e.webglDebug&&(r=performance.now());var i=e.drawing,a=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&_Z(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var o=e.data.contexts[e.WEBGL];n.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=hZ(e),c=e.getCachedZSortedEles();if(a=c.length,i.startFrame(s,n),n.screen){for(var l=0;l<c.nondrag.length;l++)SZ(e,l,c.nondrag[l]);for(var u=0;u<c.drag.length;u++)SZ(e,u,c.drag[u])}else if(n.picking)for(var d=0;d<c.length;d++)SZ(e,d,c[d]);i.endFrame(),n.screen&&e.webglDebugShowAtlases&&(vZ(e),yZ(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var f=performance.now(),p=!1,m=Math.ceil(f-r),h=i.getDebugInfo(),g=[`${a} elements`,`${h.totalInstances} instances`,`${h.batchCount} batches`,`${h.totalAtlases} atlases`,`${h.wrappedCount} wrapped textures`,`${h.simpleCount} simple shapes`].join(`, `);if(p)console.log(`WebGL (${n.name}) - time ${m}ms, ${g}`);else{console.log(`WebGL (${n.name}) - frame time ${m}ms`),console.log(`Totals:`),console.log(` ${g}`),console.log(`Texture Atlases Used:`);var _=h.atlasInfo,v=hF(_),y;try{for(v.s();!(y=v.n()).done;){var b=y.value;console.log(` ${b.type}: ${b.keyCount} keys, ${b.atlasCount} atlases`)}}catch(e){v.e(e)}finally{v.f()}console.log(``)}}e.data.gc&&(console.log(`Garbage Collect!`),e.data.gc=!1,i.gc())}var wZ={};wZ.drawPolygonPath=function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var c=1;c<a.length/2;c++)e.lineTo(t+o*a[c*2],n+s*a[c*2+1]);e.closePath()},wZ.drawRoundPolygonPath=function(e,t,n,r,i,a,o){o.forEach(function(t){return wJ(e,t)}),e.closePath()},wZ.drawRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?Fz(r,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,c),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.arcTo(t-o,n-s,t,n-s,c),e.lineTo(t,n-s),e.closePath()},wZ.drawBottomRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?Fz(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},wZ.drawCutRectanglePath=function(e,t,n,r,i,a,o){var s=r/2,c=i/2,l=o===`auto`?Lz():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+l,n-c),e.lineTo(t+s-l,n-c),e.lineTo(t+s,n-c+l),e.lineTo(t+s,n+c-l),e.lineTo(t+s-l,n+c),e.lineTo(t-s+l,n+c),e.lineTo(t-s,n+c-l),e.lineTo(t-s,n-c+l),e.closePath()},wZ.drawBarrelPath=function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,c=t+a,l=n-o,u=n+o,d=zz(r,i),f=d.widthOffset,p=d.heightOffset,m=d.ctrlPtOffsetPct*f;e.beginPath&&e.beginPath(),e.moveTo(s,l+p),e.lineTo(s,u-p),e.quadraticCurveTo(s+m,u,s+f,u),e.lineTo(c-f,u),e.quadraticCurveTo(c-m,u,c,u-p),e.lineTo(c,l+p),e.quadraticCurveTo(c-m,l,c-f,l),e.lineTo(s+f,l),e.quadraticCurveTo(s+m,l,s,l+p),e.closePath()};for(var TZ=Math.sin(0),EZ=Math.cos(0),DZ={},OZ={},kZ=Math.PI/40,AZ=0*Math.PI;AZ<2*Math.PI;AZ+=kZ)DZ[AZ]=Math.sin(AZ),OZ[AZ]=Math.cos(AZ);wZ.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,c=i/2,l=0*Math.PI;l<2*Math.PI;l+=kZ)a=t-s*DZ[l]*TZ+s*OZ[l]*EZ,o=n+c*OZ[l]*TZ+c*DZ[l]*EZ,l===0?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var jZ={};jZ.createBuffer=function(e,t){var n=document.createElement(`canvas`);return n.width=e,n.height=t,[n,n.getContext(`2d`)]},jZ.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=$(e.maxWidth)||$(e.maxHeight),s=this.getPixelRatio(),c=1;if(e.scale!==void 0)i*=e.scale,a*=e.scale,c=e.scale;else if(o){var l=1/0,u=1/0;$(e.maxWidth)&&(l=c*e.maxWidth/i),$(e.maxHeight)&&(u=c*e.maxHeight/a),c=Math.min(l,u),i*=c,a*=c}o||(i*=s,a*=s,c*=s);var d=document.createElement(`canvas`);d.width=i,d.height=a,d.style.width=i+`px`,d.style.height=a+`px`;var f=d.getContext(`2d`);if(i>0&&a>0){f.clearRect(0,0,i,a),f.globalCompositeOperation=`source-over`;var p=this.getCachedZSortedEles();if(e.full)f.translate(-n.x1*c,-n.y1*c),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(n.x1*c,n.y1*c);else{var m=t.pan(),h={x:m.x*c,y:m.y*c};c*=t.zoom(),f.translate(h.x,h.y),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(-h.x,-h.y)}e.bg&&(f.globalCompositeOperation=`destination-over`,f.fillStyle=e.bg,f.rect(0,0,i,a),f.fill())}return d};function MZ(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}function NZ(e){var t=e.indexOf(`,`);return e.substr(t+1)}function PZ(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case`blob-promise`:return new gV(function(r,i){try{t.toBlob(function(e){e==null?i(Error("`canvas.toBlob()` sent a null value in its callback")):r(e)},n,e.quality)}catch(e){i(e)}});case`blob`:return MZ(NZ(r()),n);case`base64`:return NZ(r());default:return r()}}jZ.png=function(e){return PZ(e,this.bufferCanvasImage(e),`image/png`)},jZ.jpg=function(e){return PZ(e,this.bufferCanvasImage(e),`image/jpeg`)};var FZ={};FZ.nodeShapeImpl=function(e,t,n,r,i,a,o,s){switch(e){case`ellipse`:return this.drawEllipsePath(t,n,r,i,a);case`polygon`:return this.drawPolygonPath(t,n,r,i,a,o);case`round-polygon`:return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case`roundrectangle`:case`round-rectangle`:return this.drawRoundRectanglePath(t,n,r,i,a,s);case`cutrectangle`:case`cut-rectangle`:return this.drawCutRectanglePath(t,n,r,i,a,o,s);case`bottomroundrectangle`:case`bottom-round-rectangle`:return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case`barrel`:return this.drawBarrelPath(t,n,r,i,a)}};var IZ=RZ,LZ=RZ.prototype;LZ.CANVAS_LAYERS=3,LZ.SELECT_BOX=0,LZ.DRAG=1,LZ.NODE=2,LZ.WEBGL=3,LZ.CANVAS_TYPES=[`2d`,`2d`,`2d`,`webgl2`],LZ.BUFFER_COUNT=3,LZ.TEXTURE_BUFFER=0,LZ.MOTIONBLUR_BUFFER_NODE=1,LZ.MOTIONBLUR_BUFFER_DRAG=2;function RZ(e){var t=this,n=t.cy.window().document;e.webgl&&(LZ.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log(`webgl rendering enabled`)),t.data={canvases:Array(LZ.CANVAS_LAYERS),contexts:Array(LZ.CANVAS_LAYERS),canvasNeedsRedraw:Array(LZ.CANVAS_LAYERS),bufferCanvases:Array(LZ.BUFFER_COUNT),bufferContexts:Array(LZ.CANVAS_LAYERS)};var r=`-webkit-tap-highlight-color`,i=`rgba(0,0,0,0)`;t.data.canvasContainer=n.createElement(`div`);var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position=`relative`,a.zIndex=`0`,a.overflow=`hidden`;var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=i;var s={"-webkit-user-select":`none`,"-moz-user-select":`-moz-none`,"user-select":`none`,"-webkit-tap-highlight-color":`rgba(0,0,0,0)`,"outline-style":`none`};ZF()&&(s[`-ms-touch-action`]=`none`,s[`touch-action`]=`none`);for(var c=0;c<LZ.CANVAS_LAYERS;c++){var l=t.data.canvases[c]=n.createElement(`canvas`),u=LZ.CANVAS_TYPES[c];t.data.contexts[c]=l.getContext(u),t.data.contexts[c]||HL(`Could not create canvas of type `+u),Object.keys(s).forEach(function(e){l.style[e]=s[e]}),l.style.position=`absolute`,l.setAttribute(`data-id`,`layer`+c),l.style.zIndex=String(LZ.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[LZ.NODE].setAttribute(`data-id`,`layer`+LZ.NODE+`-node`),t.data.canvases[LZ.SELECT_BOX].setAttribute(`data-id`,`layer`+LZ.SELECT_BOX+`-selectbox`),t.data.canvases[LZ.DRAG].setAttribute(`data-id`,`layer`+LZ.DRAG+`-drag`),t.data.canvases[LZ.WEBGL]&&t.data.canvases[LZ.WEBGL].setAttribute(`data-id`,`layer`+LZ.WEBGL+`-webgl`);for(var c=0;c<LZ.BUFFER_COUNT;c++)t.data.bufferCanvases[c]=n.createElement(`canvas`),t.data.bufferContexts[c]=t.data.bufferCanvases[c].getContext(`2d`),t.data.bufferCanvases[c].style.position=`absolute`,t.data.bufferCanvases[c].setAttribute(`data-id`,`buffer`+c),t.data.bufferCanvases[c].style.zIndex=String(-c-1),t.data.bufferCanvases[c].style.visibility=`hidden`;t.pathsEnabled=!0;var d=XR(),f=function(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}},p=function(e){return{x:-e.w/2,y:-e.h/2}},m=function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},h=function(e){return e[0]._private.nodeKey},g=function(e){return e[0]._private.labelStyleKey},_=function(e){return e[0]._private.sourceLabelStyleKey},v=function(e){return e[0]._private.targetLabelStyleKey},y=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},b=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`main`,a)},x=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`source`,a)},S=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`target`,a)},C=function(e){return e.boundingBox(),e[0]._private.bodyBounds},w=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||d},T=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||d},E=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||d},D=function(e,t){return t},O=function(e){return f(C(e))},k=function(e,t,n){var r=e?e+`-`:``;return{x:t.x+n.pstyle(r+`text-margin-x`).pfValue,y:t.y+n.pstyle(r+`text-margin-y`).pfValue}},A=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},j=function(e){return k(``,A(e,`labelX`,`labelY`),e)},M=function(e){return k(`source`,A(e,`sourceLabelX`,`sourceLabelY`),e)},N=function(e){return k(`target`,A(e,`targetLabelX`,`targetLabelY`),e)},P=function(e){return p(C(e))},F=function(e){return p(T(e))},I=function(e){return p(E(e))},L=function(e){var t=w(e),n=p(w(e));if(e.isNode()){switch(e.pstyle(`text-halign`).value){case`left`:n.x=-t.w-(t.leftPad||0);break;case`right`:n.x=-(t.rightPad||0);break}switch(e.pstyle(`text-valign`).value){case`top`:n.y=-t.h-(t.topPad||0);break;case`bottom`:n.y=-(t.botPad||0);break}}return n},R=t.data.eleTxrCache=new SY(t,{getKey:h,doesEleInvalidateKey:m,drawElement:y,getBoundingBox:C,getRotationPoint:O,getRotationOffset:P,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),ee=t.data.lblTxrCache=new SY(t,{getKey:g,drawElement:b,getBoundingBox:w,getRotationPoint:j,getRotationOffset:L,isVisible:D}),z=t.data.slbTxrCache=new SY(t,{getKey:_,drawElement:x,getBoundingBox:T,getRotationPoint:M,getRotationOffset:F,isVisible:D}),B=t.data.tlbTxrCache=new SY(t,{getKey:v,drawElement:S,getBoundingBox:E,getRotationPoint:N,getRotationOffset:I,isVisible:D}),V=t.data.lyrTxrCache=new zY(t);t.onUpdateEleCalcs(function(e,t){R.invalidateElements(t),ee.invalidateElements(t),z.invalidateElements(t),B.invalidateElements(t),V.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var H=function(e){for(var t=0;t<e.length;t++)V.enqueueElementRefinement(e[t].ele)};R.onDequeue(H),ee.onDequeue(H),z.onDequeue(H),B.onDequeue(H),e.webgl&&t.initWebgl(e,{getStyleKey:h,getLabelKey:g,getSourceLabelKey:_,getTargetLabelKey:v,drawElement:y,drawLabel:b,drawSourceLabel:x,drawTargetLabel:S,getElementBox:C,getLabelBox:w,getSourceLabelBox:T,getTargetLabelBox:E,getElementRotationPoint:O,getElementRotationOffset:P,getLabelRotationPoint:j,getSourceLabelRotationPoint:M,getTargetLabelRotationPoint:N,getLabelRotationOffset:L,getSourceLabelRotationOffset:F,getTargetLabelRotationOffset:I})}LZ.redrawHint=function(e,t){var n=this;switch(e){case`eles`:n.data.canvasNeedsRedraw[LZ.NODE]=t;break;case`drag`:n.data.canvasNeedsRedraw[LZ.DRAG]=t;break;case`select`:n.data.canvasNeedsRedraw[LZ.SELECT_BOX]=t;break;case`gc`:n.data.gc=!0;break}};var zZ=typeof Path2D<`u`;LZ.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},LZ.usePaths=function(){return zZ&&this.pathsEnabled},LZ.setImgSmoothing=function(e,t){e.imageSmoothingEnabled==null?(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t):e.imageSmoothingEnabled=t},LZ.getImgSmoothing=function(e){return e.imageSmoothingEnabled==null?e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled:e.imageSmoothingEnabled},LZ.makeOffscreenCanvas=function(e,t){var n;return(typeof OffscreenCanvas>`u`?`undefined`:TF(OffscreenCanvas))===`undefined`?(n=this.cy.window().document.createElement(`canvas`),n.width=e,n.height=t):n=new OffscreenCanvas(e,t),n},[UY,XY,rX,aX,oX,lX,dX,sZ,wZ,jZ,FZ].forEach(function(e){pI(LZ,e)});var BZ=[{type:`layout`,extensions:Yq},{type:`renderer`,extensions:[{name:`null`,impl:Xq},{name:`base`,impl:ZJ},{name:`canvas`,impl:IZ}]}],VZ={},HZ={};function UZ(e,t,n){var r=n,i=function(n){WL("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if(e===`core`){if(sq.prototype[t])return i(t);sq.prototype[t]=n}else if(e===`collection`){if(xK.prototype[t])return i(t);xK.prototype[t]=n}else if(e===`layout`){for(var a=function(e){this.options=e,n.call(this,e),LF(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],c=0;c<s.length;c++){var l=s[c];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var u=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return u?u.call(this):this.emit(`layoutstop`),this},o.destroy||=function(){return this},o.cy=function(){return this._private.cy};var d=function(e){return e._private.cy},f={addEventFields:function(e,t){t.layout=e,t.cy=d(e),t.target=e},bubble:function(){return!0},parent:function(e){return d(e)}};pI(o,{createEmitter:function(){return this._private.emitter=new UG(f,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),gW.eventAliasesOn(o),r=a}else if(e===`renderer`&&t!==`null`&&t!==`base`){var p=WZ(`renderer`,`base`),m=p.prototype,h=n,g=n.prototype,_=function(){p.apply(this,arguments),h.apply(this,arguments)},v=_.prototype;for(var y in m){var b=m[y];if(g[y]!=null)return i(y);v[y]=b}for(var x in g)v[x]=g[x];m.clientFunctions.forEach(function(e){v[e]=v[e]||function(){HL("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=_}else if(e===`__proto__`||e===`constructor`||e===`prototype`)return HL(e+` is an illegal type to be registered, possibly lead to prototype pollutions`);return bI({map:VZ,keys:[e,t],value:r})}function WZ(e,t){return xI({map:VZ,keys:[e,t]})}function GZ(e,t,n,r,i){return bI({map:HZ,keys:[e,t,n,r],value:i})}function KZ(e,t,n,r){return xI({map:HZ,keys:[e,t,n,r]})}var qZ=function(){if(arguments.length===2)return WZ.apply(null,arguments);if(arguments.length===3)return UZ.apply(null,arguments);if(arguments.length===4)return KZ.apply(null,arguments);if(arguments.length===5)return GZ.apply(null,arguments);HL(`Invalid extension access syntax`)};sq.prototype.extension=qZ,BZ.forEach(function(e){e.extensions.forEach(function(t){UZ(e.type,t.name,t.impl)})});var JZ=function(){if(!(this instanceof JZ))return new JZ;this.length=0},YZ=JZ.prototype;YZ.instanceString=function(){return`stylesheet`},YZ.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},YZ.css=function(e,t){var n=this.length-1;if(PF(e))this[n].properties.push({name:e,value:t});else if(LF(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(s!=null){var c=tq.properties[o]||tq.properties[eI(o)];if(c!=null){var l=c.name,u=s;this[n].properties.push({name:l,value:u})}}}return this},YZ.style=YZ.css,YZ.generateStyle=function(e){var t=new tq(e);return this.appendToStyle(t)},YZ.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var XZ=`3.33.4`,ZZ=function(e){if(e===void 0&&(e={}),LF(e))return new sq(e);if(PF(e))return qZ.apply(qZ,arguments)};ZZ.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(ZZ),e.apply(null,t),this},ZZ.warnings=function(e){return UL(e)},ZZ.version=XZ,ZZ.stylesheet=ZZ.Stylesheet=JZ;var QZ=/^#{1,6}\s+/,$Z=/[*_`~]+/g,eQ=/\s+/g;function tQ(e){return e.replace(QZ,``).replace($Z,``).replace(eQ,` `).trim()}var nQ={sage:`#abcfb8`,ochre:`#edbf7f`,terracotta:`#ffb4a1`,neutral:`#8b928c`,dimNeutral:`#6e7370`,onSurface:`#e5e2e1`,surface:`#111111`},rQ={concept:nQ.sage,component:nQ.ochre,bug:nQ.terracotta,tool:nQ.neutral,file:nQ.neutral,spore:nQ.sage,session:nQ.ochre,other:nQ.dimNeutral},iQ=nQ.dimNeutral,aQ=24,oQ=60,sQ=12,cQ=10,lQ=8,uQ=1.5,dQ=.25,fQ=.7,pQ=9,mQ=.7,hQ=4,gQ=.6,_Q=1e4,vQ=120,yQ=.2,bQ=600,xQ=300,SQ=.95,CQ=1.2,wQ=50,TQ=20,EQ={concept:`Concept`,component:`Component`,bug:`Bug`,tool:`Tool`,file:`File`,spore:`Spore`,session:`Session`,other:`Other`};function DQ(e,t){return t?oQ*1.2:aQ+Math.min(e/sQ,1)*(oQ-aQ)}function OQ(e){let t=tQ(e);return t.length<=TQ?t:t.slice(0,TQ-1)+`…`}function kQ(e){return rQ[e?.toLowerCase()]??iQ}function AQ(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)%360}function jQ(e){e.elements().removeClass(`faded`),e.elements().unselect(),e.edges().style({"line-opacity":dQ,"text-opacity":0,width:uQ})}function MQ(e,t){if(!t){jQ(e);return}let n=e.$id(t);if(n.length===0){jQ(e);return}jQ(e),n.select();let r=n.closedNeighborhood();e.elements().not(r).addClass(`faded`),n.connectedEdges().style({"line-opacity":fQ,"text-opacity":0,width:2})}function NQ({nodes:e,edges:t,onNodeSelect:n,centerId:r,centerNodeType:i,selectedNodeId:a}){let o=(0,W.useRef)(null),s=(0,W.useRef)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(null),u=(0,W.useRef)(n);u.current=n;let d=(0,W.useMemo)(()=>new Map(e.map(e=>[e.id,e])),[e]),f=(0,W.useMemo)(()=>{let n=new Map;for(let t of e)n.set(t.id,0);for(let e of t)n.set(e.source_id,(n.get(e.source_id)??0)+1),n.set(e.target_id,(n.get(e.target_id)??0)+1);return n},[e,t]),p=(0,W.useMemo)(()=>[{selector:`node`,style:{label:`data(label)`,"background-color":e=>kQ(e.data(`type`)),"background-opacity":.9,color:nQ.onSurface,"font-size":cQ,"font-family":`Inter, system-ui, sans-serif`,"text-valign":`bottom`,"text-margin-y":lQ,"text-outline-color":nQ.surface,"text-outline-width":2,"text-outline-opacity":.8,"text-wrap":`wrap`,"text-max-width":`120px`,width:`data(nodeSize)`,height:`data(nodeSize)`,"border-width":0,"border-color":nQ.sage,"border-opacity":0,"overlay-opacity":0}},{selector:`node.center`,style:{"border-width":2,"border-color":nQ.onSurface,"border-opacity":.4,"text-outline-color":nQ.surface,"text-outline-width":3,"font-weight":`bold`}},{selector:`node:active`,style:{"overlay-opacity":.08,"overlay-color":nQ.sage}},{selector:`node:selected`,style:{"border-width":hQ,"border-color":e=>kQ(e.data(`type`)),"border-opacity":gQ,"background-opacity":1}},{selector:`edge`,style:{width:uQ,"line-color":nQ.neutral,"line-opacity":dQ,"curve-style":`unbundled-bezier`,"control-point-distances":[40],"control-point-weights":[.5],"target-arrow-shape":`triangle`,"target-arrow-color":nQ.neutral,"arrow-scale":mQ,label:`data(label)`,"font-size":pQ,"font-family":`Inter, system-ui, sans-serif`,color:nQ.neutral,"text-opacity":0,"text-rotation":`autorotate`,"text-margin-y":-8,"text-outline-color":nQ.surface,"text-outline-width":2,"text-outline-opacity":.7}},{selector:`edge:active`,style:{"text-opacity":1,"line-opacity":fQ}},{selector:`node.faded`,style:{opacity:.3}},{selector:`edge.faded`,style:{opacity:.1}}],[]),m=(0,W.useCallback)(n=>{let i=o.current?.getBoundingClientRect(),a={x:i?i.width/2:0,y:i?i.height/2:0};return[...e.map(e=>{let i=EQ[e.type?.toLowerCase()]??EQ.other,o=e.id===r,s=n?.get(e.id);if(!s){let i=t.find(t=>t.source_id===e.id||t.target_id===e.id),o=i?i.source_id===e.id?i.target_id:i.source_id:r,c=(o&&n?.get(o))??a,l=AQ(e.id)*Math.PI/180,u=o===r?150:110;s={x:c.x+Math.cos(l)*u,y:c.y+Math.sin(l)*u}}return{data:{id:e.id,label:`${OQ(e.name)}\n${i}`,fullLabel:e.name,type:e.type,isCenter:o,degree:f.get(e.id)??0,nodeSize:DQ(f.get(e.id)??0,o)},position:s,classes:o?`center`:``}}),...t.map((e,t)=>({data:{id:`edge-${t}`,source:e.source_id,target:e.target_id,label:e.label??``,weight:e.weight??1}}))]},[r,f,t,e]),h=(0,W.useCallback)((e,t)=>{if(!t){e.resize(),MQ(e,a??null);return}let n=r&&i===`session`?e.layout({name:`cose`,animate:!0,animationDuration:bQ,nodeRepulsion:()=>_Q*1.5,idealEdgeLength:()=>vQ*1.35,gravity:yQ*.75,nodeDimensionsIncludeLabels:!0,fit:!0,padding:wQ*1.2,randomize:!1}):r?e.layout({name:`concentric`,animate:!0,animationDuration:xQ,fit:!0,padding:wQ,spacingFactor:CQ,avoidOverlap:!0,concentric:e=>e.id()===r?3:e.closedNeighborhood().some(e=>e.isNode()&&e.id()===r)?2:1,levelWidth:()=>1,nodeDimensionsIncludeLabels:!0}):e.layout({name:`cose`,animate:!0,animationDuration:bQ,nodeRepulsion:()=>_Q,idealEdgeLength:()=>vQ,gravity:yQ,nodeDimensionsIncludeLabels:!0,fit:!0,padding:wQ});n.on(`layoutstop`,()=>{let e=s.current;if(!e)return;let t=e.$(`node.center`);if(t.length>0){let n=t.closedNeighborhood();e.fit(n,wQ*1.5),e.zoom()<SQ&&(e.zoom(SQ),e.center(t))}else e.fit(void 0,wQ);MQ(e,a??null)}),n.run()},[r,i,a]);return(0,W.useEffect)(()=>{let e=o.current;if(!e)return;function t(){let t=e.getBoundingClientRect();if(t.width===0||t.height===0||s.current)return;let n=ZZ({container:e,elements:[],style:p,layout:{name:`preset`},userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,minZoom:.3,maxZoom:3});n.on(`tap`,`node`,e=>{let t=e.target.data(),n=d.get(t.id);u.current?.(n??{id:t.id,name:t.fullLabel??t.label,type:t.type})}),n.on(`tap`,e=>{e.target===n&&u.current?.(null)}),n.on(`mouseover`,`edge`,e=>{e.target.style(`text-opacity`,1),e.target.style(`line-opacity`,fQ)}),n.on(`mouseout`,`edge`,e=>{let t=n.$(`node:selected`);t.length>0&&t.connectedEdges().contains(e.target)||(e.target.style(`text-opacity`,0),e.target.style(`line-opacity`,dQ))}),s.current=n}return t(),c.current?.disconnect(),c.current=new ResizeObserver(()=>{s.current?s.current.resize():t()}),c.current.observe(e),()=>{c.current?.disconnect(),c.current=null,s.current?.destroy(),s.current=null}},[d,p]),(0,W.useEffect)(()=>{let e=s.current;if(!e)return;let t=new Map;e.nodes().forEach(e=>{t.set(e.id(),{x:e.position(`x`),y:e.position(`y`)})}),e.elements().remove(),e.add(m(t));let n=l.current!==(r??null);l.current=r??null,h(e,n||t.size===0)},[m,r,h]),(0,W.useEffect)(()=>{let e=s.current;e&&MQ(e,a??null)},[a]),{containerRef:o,resetView:(0,W.useCallback)(()=>{let e=s.current;e&&(jQ(e),e.fit(void 0,wQ))},[])}}function PQ({nodes:e,edges:t,onNodeSelect:n,selectedNode:r,centerId:i,centerNodeType:a,isLoading:o}){let{containerRef:s,resetView:c}=NQ({nodes:e,edges:t,onNodeSelect:n,centerId:i,centerNodeType:a,selectedNodeId:r?.id??null});return(0,G.jsxs)(`div`,{className:`absolute inset-0`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 rounded-md bg-surface-container-lowest`,style:{backgroundImage:`radial-gradient(circle at 2px 2px, rgba(139, 146, 140, 0.05) 1px, transparent 0)`,backgroundSize:`40px 40px`}}),(0,G.jsx)(`div`,{ref:s,className:`absolute inset-0 rounded-md`,style:{width:`100%`,height:`100%`}}),(0,G.jsxs)(`div`,{className:`absolute bottom-3 left-3 z-10 flex items-center gap-3`,children:[e.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 font-mono text-[10px] text-on-surface-variant/60 mr-1`,children:[(0,G.jsxs)(`span`,{children:[e.length,` nodes`]}),(0,G.jsxs)(`span`,{children:[t.length,` edges`]})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:c,className:`gap-1.5 h-7 text-[10px] px-2 bg-surface-container-high/40 backdrop-blur-xs`,children:[(0,G.jsx)($a,{className:`h-3 w-3`}),`Reset View`]})]}),!o&&e.length===0&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No nodes to display`})})]})}var FQ=400,IQ={concept:`default`,component:`warning`,bug:`destructive`,tool:`secondary`,file:`secondary`,spore:`default`,session:`warning`},LQ={concept:`bg-primary`,component:`bg-secondary`,bug:`bg-tertiary`,tool:`bg-outline`,file:`bg-outline`,spore:`bg-primary`,session:`bg-secondary`};function RQ({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`flex justify-between items-baseline py-1`,children:[(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface text-right max-w-[160px] truncate`,children:t})]})}function zQ(e){return e.type===`session`?`/sessions/${e.id}`:e.type===`spore`?`/mycelium?tab=spores&spore=${e.id}`:null}function BQ({node:e,edges:t,nodes:n,metadata:r,markdownPreview:i,connectedSpores:a,onClose:o,onNodeSelect:s,onFocusNode:c,onNavigateToSpore:l,isConnectionsLoading:u}){let d=Nn();if(!e)return null;let f=e.type.toLowerCase(),p=IQ[f]??`secondary`,m=LQ[f]??`bg-outline`,h=new Map((n??[]).map(e=>[e.id,e])),g=[];for(let n of t??[])if(n.source_id===e.id){let e=h.get(n.target_id);e&&g.push({nodeId:e.id,nodeName:e.name,nodeType:e.type,edgeLabel:n.label??`connected`,direction:`outgoing`,status:e.status})}else if(n.target_id===e.id){let e=h.get(n.source_id);e&&g.push({nodeId:e.id,nodeName:e.name,nodeType:e.type,edgeLabel:n.label??`connected`,direction:`incoming`,status:e.status})}g.sort((e,t)=>e.nodeName.localeCompare(t.nodeName));let _=i??e.content,v=_&&_.length>FQ?_.slice(0,FQ)+`…`:_,y=e.type===`spore`?`Observation`:e.type===`session`?`Summary`:`Notes`;return(0,G.jsxs)(Q,{glass:!0,className:`absolute top-3 right-3 bottom-3 z-20 w-[320px] overflow-y-auto flex flex-col shadow-lg border border-outline-variant/15 rounded-md`,children:[(0,G.jsx)(`div`,{className:`p-4 pb-3`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,G.jsx)(`div`,{className:`h-2 w-2 rounded-full ${m} shrink-0`}),(0,G.jsx)(X,{variant:p,className:`text-[10px] uppercase`,children:e.observation_type??e.type})]}),(0,G.jsx)(`h2`,{className:`font-serif text-lg text-on-surface leading-tight break-words`,children:tQ(e.name)}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-3 mt-2`,children:zQ(e)&&(0,G.jsxs)(`button`,{onClick:()=>{e.type===`spore`&&l?l(e.id):d(zQ(e))},className:`inline-flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-primary transition-colors group cursor-pointer`,children:[(0,G.jsxs)(`span`,{children:[`View `,e.type]}),(0,G.jsx)(va,{className:`h-3 w-3 group-hover:translate-x-0.5 transition-transform`})]})})]}),o&&(0,G.jsx)(`button`,{onClick:o,className:`shrink-0 rounded-md p-1 text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high transition-colors`,children:(0,G.jsx)(So,{className:`h-4 w-4`})})]})}),(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-0.5`,children:[(0,G.jsx)(MM,{children:`Metadata`}),(0,G.jsxs)(`div`,{className:`mt-1.5`,children:[(0,G.jsx)(RQ,{label:`Type`,value:e.observation_type??e.type}),(0,G.jsx)(RQ,{label:`ID`,value:e.id.slice(0,12)+`…`}),e.status&&(0,G.jsx)(RQ,{label:`Status`,value:e.status}),e.created_at!=null&&(0,G.jsx)(RQ,{label:`Created`,value:new Date(e.created_at).toLocaleDateString()}),e.mention_count!=null&&e.mention_count>0&&(0,G.jsx)(RQ,{label:`Mentions`,value:String(e.mention_count)}),(0,G.jsx)(RQ,{label:`Connections`,value:String(g.length)}),e.depth!==void 0&&(0,G.jsx)(RQ,{label:`Depth`,value:String(e.depth)}),r&&Object.entries(r).map(([e,t])=>(0,G.jsx)(RQ,{label:e,value:t},e))]})]}),v&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-1.5`,children:[(0,G.jsx)(MM,{children:y}),(0,G.jsx)(Q,{level:`lowest`,className:`p-3`,children:(0,G.jsx)(fO,{content:v,className:`text-xs leading-relaxed text-on-surface-variant`})})]})]}),(g.length>0||u)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(MM,{children:[`Connections (`,g.length,`)`]}),u&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-3 w-3 animate-spin`}),`Updating`]})]}),(0,G.jsx)(`div`,{className:`space-y-1`,children:g.map((e,t)=>(0,G.jsxs)(`div`,{className:`group w-full rounded-md border border-transparent px-2 py-2 transition-colors hover:border-outline-variant/10 hover:bg-surface-container-high/50`,children:[(0,G.jsx)(`button`,{type:`button`,className:`w-full text-left`,onClick:()=>{let t=h.get(e.nodeId);s?.(t??{id:e.nodeId,name:e.nodeName,type:e.nodeType,status:e.status},`inspector`)},children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`div`,{className:`mt-1 h-2 w-2 rounded-full ${LQ[e.nodeType.toLowerCase()]??`bg-outline`} shrink-0`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate font-sans text-xs text-on-surface transition-colors group-hover:text-primary`,children:tQ(e.nodeName)}),(0,G.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 text-[9px] uppercase tracking-wider text-on-surface-variant/60`,children:[(0,G.jsx)(`span`,{children:e.nodeType}),(0,G.jsx)(`span`,{children:`•`}),(0,G.jsx)(`span`,{children:e.edgeLabel})]})]}),(0,G.jsx)(qi,{className:`mt-0.5 h-3 w-3 shrink-0 text-on-surface-variant/50 ${e.direction===`incoming`?`rotate-180`:``}`})]})}),(0,G.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-2 text-[10px] uppercase tracking-wide`,onClick:()=>{let t=h.get(e.nodeId);c?.(t??{id:e.nodeId,name:e.nodeName,type:e.nodeType,status:e.status})},children:`Focus`})})]},`${e.nodeId}-${e.edgeLabel}-${t}`))})]})]}),a&&a.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-1.5`,children:[(0,G.jsx)(MM,{children:`Connected Spores`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:a.map(e=>(0,G.jsx)(X,{variant:`secondary`,className:`cursor-pointer text-[10px] hover:bg-surface-container-highest transition-colors`,children:e.name},e.id))})]})]})]})}function VQ({searchPlaceholder:e=`Search...`,searchValue:t,onSearchChange:n,filters:r=[],filterValues:i={},onFilterChange:a,inputRef:o}){return(0,G.jsxs)(Q,{level:`bright`,className:`flex items-center gap-3 px-4 py-2 rounded-md`,children:[(0,G.jsx)(no,{className:`h-3.5 w-3.5 text-on-surface-variant shrink-0`}),(0,G.jsx)(Kf,{ref:o,placeholder:e,value:t,onChange:e=>n(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1`,"aria-label":e}),r.map(e=>(0,G.jsx)(`div`,{className:`w-40 shrink-0`,children:(0,G.jsxs)(c_,{value:i[e.key]??`all`,onValueChange:t=>a?.(e.key,t),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:e.label})}),(0,G.jsx)(d_,{children:e.options.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})},e.key))]})}function HQ(e){switch(e){case`wisdom`:return`bg-primary/15 text-primary`;case`discovery`:return`bg-primary/15 text-primary`;case`decision`:return`bg-secondary/15 text-secondary`;case`trade_off`:return`bg-secondary/15 text-secondary`;case`gotcha`:return`bg-tertiary/15 text-tertiary`;case`bug_fix`:return`bg-tertiary/15 text-tertiary`;default:return`bg-surface-container text-on-surface-variant`}}function UQ(e){switch(e){case`active`:return`bg-primary/15 text-primary`;case`consolidated`:return`bg-surface-container-high text-on-surface-variant`;case`superseded`:return`bg-tertiary/10 text-tertiary/70`;default:return`bg-surface-container text-on-surface-variant`}}function WQ(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}var GQ=120,KQ=1e3,qQ=[{key:`type`,label:`Type`,options:[`all`,`gotcha`,`decision`,`discovery`,`trade_off`,`bug_fix`].map(e=>({value:e,label:e===`all`?`All types`:WQ(e)}))},{key:`status`,label:`Status`,options:[`all`,`active`,`superseded`,`consolidated`].map(e=>({value:e,label:e===`all`?`All statuses`:WQ(e)}))}];function JQ(e){return new Date(e*KQ).toLocaleDateString()}function YQ({spore:e,onClick:t,isSelected:n}){return(0,G.jsx)(Q,{level:n?`high`:`low`,className:J(`p-4 cursor-pointer transition-all duration-150 hover:bg-surface-container-high hover:shadow-[inset_3px_0_0_var(--primary)] rounded-lg`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,n&&`ring-1 ring-primary/30`),onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},tabIndex:0,role:`button`,"aria-label":`${WQ(e.observation_type)} spore: ${ev(e.content,GQ)}`,"aria-pressed":n,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold`,HQ(e.observation_type)),children:WQ(e.observation_type)}),(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold`,UQ(e.status)),children:WQ(e.status)}),e.importance!==null&&(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:e.importance.toFixed(1)}),(0,G.jsx)(xM,{annotation:e.release_state})]}),(0,G.jsx)(fO,{content:e.content,compact:!0,className:`text-on-surface line-clamp-2`})]}),(0,G.jsxs)(`div`,{className:`shrink-0 text-right space-y-1`,children:[e.session_id&&(0,G.jsx)(`div`,{className:`font-mono text-xs text-on-surface-variant`,children:tv(e.session_id)}),(0,G.jsx)(`div`,{className:`font-sans text-xs text-on-surface-variant`,children:JQ(e.created_at)})]})]})})}function XQ(){return(0,G.jsx)(Q,{level:`low`,className:`p-4 rounded-lg`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`div`,{className:`h-5 w-16 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-5 w-14 animate-pulse rounded bg-surface-container`})]}),(0,G.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-surface-container`})]}),(0,G.jsxs)(`div`,{className:`shrink-0 space-y-1`,children:[(0,G.jsx)(`div`,{className:`h-3 w-14 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-16 animate-pulse rounded bg-surface-container`})]})]})})}function ZQ({onSelectSpore:e,selectedSporeId:t}){let{searchInput:n,debouncedSearch:r,filterValues:i,offset:a,setOffset:o,handleSearchChange:s,handleFilterChange:c,activeFilter:l}=GN({initialFilters:{type:`all`,status:`all`}}),u=l(`type`),d=l(`status`),{data:f,isLoading:p,isError:m,error:h}=hN({type:u,status:d,search:r,limit:50,offset:a}),g=f?.spores??[],_=f?.total??0;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(VQ,{searchPlaceholder:`Search spores...`,searchValue:n,onSearchChange:s,filters:qQ,filterValues:i,onFilterChange:c}),m?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-destructive`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load spores`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:h instanceof Error?h.message:`Unknown error`})]}):(0,G.jsx)(`div`,{className:`space-y-2`,children:p?[1,2,3,4,5].map(e=>(0,G.jsx)(XQ,{},e)):g.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(lo,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:_===0&&!r&&!u&&!d?`No spores yet`:`No matching spores`}),_===0&&!r&&!u&&!d&&(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Spores are extracted from session activity by the agent`})]}):g.map(n=>(0,G.jsx)(YQ,{spore:n,onClick:()=>e(n),isSelected:n.id===t},n.id))}),(0,G.jsx)(fM,{total:_,offset:a,limit:50,onPageChange:o})]})}var QQ=12,$Q=8;function e$({type:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold`,HQ(e)),children:WQ(e)})}function t$({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold`,UQ(e)),children:WQ(e)})}function n$({label:e,value:t,children:n}){return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 py-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-on-surface-variant`,children:e}),n??(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface text-right break-all`,children:t})]})}function r$({id:e,onBack:t,onNavigateToSpore:n,onNavigateToGraph:r}){let i=Nn(),{data:a,isLoading:o,isError:s,error:c}=gN(e);if(o)return(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans`,children:`Loading spore...`})]});if(s||!a)return(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-destructive`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Spore not found`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:c instanceof Error?c.message:`Unknown error`})]});let l=(()=>{if(!a.tags)return[];if(a.tags.startsWith(`[`))try{return JSON.parse(a.tags)}catch{}return a.tags.split(`,`).map(e=>e.trim()).filter(Boolean)})();return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Spores`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(e$,{type:a.observation_type}),(0,G.jsx)(t$,{status:a.status}),(0,G.jsx)(xM,{annotation:a.release_state}),a.importance!==null&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Importance: `,(0,G.jsx)(`span`,{className:`text-on-surface font-medium`,children:a.importance.toFixed(1)})]}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant ml-auto`,children:Q_(a.created_at)})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-5`,children:[(0,G.jsx)(MM,{className:`mb-2`,children:`Observation`}),(0,G.jsx)(fO,{content:a.content})]}),a.context&&(0,G.jsxs)(Q,{level:`low`,className:`p-5`,children:[(0,G.jsx)(MM,{className:`mb-2`,children:`Context`}),(0,G.jsx)(fO,{content:a.context})]}),l.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map(e=>(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-surface-container px-2.5 py-0.5 font-sans text-xs text-on-surface-variant`,children:e},e))}),(a.predecessor_id||a.successor_id)&&(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-2`,children:[(0,G.jsx)(MM,{children:`Resolution History`}),a.predecessor_id&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:`Supersedes`}),(0,G.jsxs)(`button`,{className:`font-mono text-primary hover:underline flex items-center gap-1`,onClick:()=>n?.(a.predecessor_id),children:[a.predecessor_id.slice(0,$Q),(0,G.jsx)(qi,{className:`h-3 w-3`})]})]}),a.successor_id&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:`Superseded by`}),(0,G.jsxs)(`button`,{className:`font-mono text-primary hover:underline flex items-center gap-1`,onClick:()=>n?.(a.successor_id),children:[a.successor_id.slice(0,$Q),(0,G.jsx)(qi,{className:`h-3 w-3`})]})]})]}),(0,G.jsxs)(Q,{glass:!0,className:`p-5`,children:[(0,G.jsx)(MM,{className:`mb-2`,children:`Metadata`}),(0,G.jsxs)(`div`,{className:`text-sm`,children:[(0,G.jsx)(n$,{label:`ID`,value:a.id}),(0,G.jsx)(n$,{label:`Created`,value:$_(a.created_at)}),(0,G.jsx)(n$,{label:`Updated`,value:$_(a.updated_at)}),a.session_id&&(0,G.jsx)(n$,{label:`Session`,children:(0,G.jsxs)(`button`,{className:`font-mono text-xs text-primary hover:underline flex items-center gap-1`,onClick:()=>i(`/sessions/${a.session_id}`),children:[a.session_id.slice(0,QQ),(0,G.jsx)(va,{className:`h-3 w-3`})]})}),a.agent_id&&(0,G.jsx)(n$,{label:`Agent`,value:a.agent_id})]})]})]})}var i$=new Set([`spore`,`session`,`other`]),a$=200,o$=`right-[332px]`,s$=6,c$=`h-[calc(100vh-285px)]`,l$=[{id:`graph`,label:`Graph`,description:`connection map`},{id:`spores`,label:`Spores`,description:`captured knowledge`}],u$=`tab`,d$=`spore`,f$=new Set([`graph`,`spores`]);function p$(){let e=new URLSearchParams(window.location.search),t=e.get(u$),n=e.get(d$)??void 0;return{tab:n?`spores`:t&&f$.has(t)?t:`graph`,sporeId:n}}function m$(e,t){let n=new URLSearchParams;e!==`graph`&&n.set(u$,e),t&&n.set(d$,t);let r=n.toString(),i=r?`${window.location.pathname}?${r}`:window.location.pathname;window.history.pushState(null,``,i)}function h$(e){if(!e)return[];let t=[];return`center`in e&&e.center&&t.push(e.center),e.nodes&&t.push(...e.nodes),t}function g$(e,t){let n=e.findIndex(e=>e.id===t.id);return n>=0?[...e.slice(0,n),t].slice(-3):[...e,t].slice(-3)}function _$({onNavigateToSpore:e}){let[t,n]=(0,W.useState)(`focus`),[r,i]=(0,W.useState)(null),[a,o]=(0,W.useState)(1),[s]=(0,W.useState)(new Set(i$)),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)([]),{data:m,isLoading:h}=yN(),g=t===`focus`&&r!==null,{data:_,isLoading:v}=vN(t===`global`||c.length>0),{data:y,isLoading:b}=_N(r??void 0,a,g),x=u!==null&&u.id!==r,{data:S,isLoading:C}=_N(u?.id,1,x),w=t===`global`?_:y,T=t===`global`?v:h||g&&b,E=(_?.nodes?.length??0)>a$;(0,W.useEffect)(()=>{if(!r&&m?.recommended_id){let e=m.seeds.find(e=>e.id===m.recommended_id),t=(e?.type===`session`?m.seeds.find(e=>e.type!==`session`):null)??e??m.seeds[0];t&&(i(t.id),d(t),p(e=>g$(e,t)))}},[r,m]),(0,W.useEffect)(()=>{t===`focus`&&r&&y?.center?.id===r&&(d(y.center),p(e=>e.length===0?[y.center]:g$(e,y.center)))},[r,y,t]);let D=u?.id===r?y:S,O=u?.id===r?b:C,k=(0,W.useMemo)(()=>h$(D),[D]),A=D?.edges??[],j=(0,W.useMemo)(()=>h$(w),[w]),M=(0,W.useMemo)(()=>j.filter(e=>{let t=e.type.toLowerCase(),n=i$.has(t)?t:`other`;return!!s.has(n)}),[j,s]),N=(0,W.useMemo)(()=>{let e=w?.edges??[],t=new Set(M.map(e=>e.id));return e.filter(e=>t.has(e.source_id)&&t.has(e.target_id))},[w?.edges,M]),P=(0,W.useCallback)((e,t=`canvas`)=>{d(e)},[t]),F=(0,W.useCallback)(e=>{p(t=>g$(t,e)),i(e.id),d(e),n(`focus`)},[]),I=(0,W.useCallback)(()=>{n(`global`)},[]),L=(0,W.useCallback)(()=>{!r&&u&&(p(e=>g$(e,u)),i(u.id)),n(`focus`)},[r,u]),R=(0,W.useCallback)(e=>{p(t=>{let n=t.findIndex(t=>t.id===e.id);return n>=0?t.slice(0,n+1):t}),i(e.id),d(e),n(`focus`)},[]),ee=(0,W.useCallback)(()=>{p(e=>{if(e.length<=1)return e;let t=e.slice(0,-1),r=t[t.length-1];return r&&(i(r.id),d(r),n(`focus`)),t})},[]),z=(0,W.useMemo)(()=>{let e=_?.nodes??[];return e.length>0?e:j},[_?.nodes,j]),B=c?z.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t).filter(e=>tQ(e.name).toLowerCase().includes(c.toLowerCase())).slice(0,s$):[];return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg border border-outline-variant/20 bg-surface-container/72 px-4 py-3 shadow-xs`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative min-w-[260px] flex-1 max-w-[420px]`,children:[(0,G.jsx)(no,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-on-surface-variant/60`}),(0,G.jsx)(Kf,{placeholder:`Find a node or idea...`,value:c,onChange:e=>l(e.target.value),className:`h-9 pl-9`})]}),(0,G.jsxs)(`div`,{className:`flex rounded-lg border border-outline-variant/10 bg-surface-container-high p-1 shadow-xs`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:J(`h-8 px-3 gap-1.5 transition-all`,t===`global`?`bg-surface-container-lowest text-primary shadow-xs`:`text-on-surface-variant hover:text-on-surface`),onClick:I,children:[(0,G.jsx)(Ga,{className:`h-3.5 w-3.5`}),(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Overview`})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!r&&!u,className:J(`h-8 px-3 gap-1.5 transition-all`,t===`focus`?`bg-surface-container-lowest text-primary shadow-xs`:`text-on-surface-variant hover:text-on-surface`,!r&&!u&&`cursor-not-allowed opacity-50`),onClick:L,children:[(0,G.jsx)(po,{className:`h-3.5 w-3.5`}),(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Focus`})]})]}),t===`focus`&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1 rounded-lg border border-outline-variant/10 bg-surface-container-high p-1 shadow-xs`,children:[(0,G.jsx)(`span`,{className:`px-2 font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`Depth`}),[1,2,3].map(e=>(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:J(`h-7 min-w-7 rounded-md border px-2 font-mono text-[10px] transition-all`,a===e?`border-primary/40 bg-primary/15 text-primary shadow-xs font-bold`:`border-transparent text-on-surface-variant hover:border-outline-variant/20 hover:text-on-surface`),onClick:()=>o(e),children:e},e))]})]}),B.length>0&&(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 pt-1`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.16em] text-on-surface-variant`,children:`Jump To`}),B.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>F(e),className:J(`max-w-[220px] truncate rounded-full border px-3 py-1 text-[11px] transition-colors`,u?.id===e.id?`border-primary/40 bg-primary/10 text-on-surface`:`border-outline-variant/20 bg-surface-container-low/50 text-on-surface-variant hover:text-on-surface`),title:tQ(e.name),children:tQ(e.name)},e.id))]}),c&&B.length===0&&_&&(0,G.jsxs)(`div`,{className:`mt-3 border-t border-outline-variant/10 pt-3 text-sm text-on-surface-variant`,children:['No graph nodes matched `"',c,'"`.']}),f.length>0&&(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-outline-variant/10 pt-3`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.16em] text-on-surface-variant`,children:`Trail`}),f.length>1&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`h-7 shrink-0 px-2 text-[10px]`,onClick:ee,children:`Back`}),f.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>R(e),className:J(`max-w-[180px] truncate rounded-full border px-3 py-1 text-[11px] transition-colors`,r===e.id?`border-primary/40 bg-primary/10 text-on-surface`:`border-outline-variant/20 bg-surface-container-low/50 text-on-surface-variant hover:text-on-surface`),title:tQ(e.name),children:tQ(e.name)},e.id))]})]}),(0,G.jsxs)(`div`,{className:J(`relative`,c$),children:[T&&(0,G.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center rounded-md bg-surface-container-lowest/50 backdrop-blur-[2px] transition-opacity`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent`}),(0,G.jsxs)(`span`,{className:`text-xs font-mono animate-pulse text-on-surface-variant`,children:[`Cultivating `,t,` graph...`]})]})}),(0,G.jsx)(`div`,{className:J(`absolute inset-y-3 left-3`,u?o$:`right-3`),children:(0,G.jsx)(PQ,{nodes:M,edges:N,onNodeSelect:P,selectedNode:u,centerId:t===`focus`?r:null,centerNodeType:t===`focus`?y?.center?.type??null:null,isLoading:T})}),t===`global`&&E&&(0,G.jsxs)(`div`,{className:J(`absolute bottom-3 left-3 z-10 flex max-w-[280px] flex-col items-start gap-2 rounded-lg border border-warning/20 bg-warning-container/80 p-3 text-on-warning-container shadow-lg backdrop-blur-xs`,u?o$:`right-3`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ma,{className:`h-4 w-4 shrink-0 text-warning`}),(0,G.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-wider`,children:`Overview Snapshot`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-on-warning-container/80`,children:[`This overview still contains `,_?.nodes?.length,` nodes. Use Focus mode for navigation and step through connections from the drawer.`]}),(0,G.jsx)(Y,{variant:`destructive`,size:`sm`,className:`mt-1 h-7 w-full px-3 text-[10px]`,onClick:L,children:`Return to Focus`})]}),(0,G.jsx)(BQ,{node:u,edges:A,nodes:k,onClose:()=>{d(null)},onNodeSelect:P,onFocusNode:F,onNavigateToSpore:e,isConnectionsLoading:O})]})]})}function v$(){let e=An(),t=p$(),[n,r]=(0,W.useState)(t.tab),[i,a]=(0,W.useState)(t.sporeId?{id:t.sporeId}:null),o=(0,W.useRef)(!1),s=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(!o.current){o.current=!0;return}if(s.current){s.current=!1;return}m$(n,i?.id)},[n,i?.id]),(0,W.useEffect)(()=>{s.current=!0;let e=p$();r(e.tab),a(e.sporeId?{id:e.sporeId}:null)},[e.search,e.key]);function c(e){a(e)}function l(){a(null)}function u(e){a({id:e})}function d(e){r(e),e!==`spores`&&a(null)}return(0,G.jsxs)(`div`,{className:`p-6 space-y-6`,children:[(0,G.jsx)(YN,{title:`Mycelium`,subtitle:`Derived intelligence — spores, entity graph, and synthesized context.`}),(0,G.jsx)(PP,{tabs:l$.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:e=>d(e),columns:2}),n===`graph`&&(0,G.jsx)(_$,{onNavigateToSpore:e=>{r(`spores`),a({id:e})}}),n===`spores`&&(i?(0,G.jsx)(r$,{id:i.id,onBack:l,onNavigateToSpore:u}):(0,G.jsx)(ZQ,{onSelectSpore:c}))]})}function y$({chip:e}){return(0,G.jsxs)(`span`,{"data-capability":e.id,title:e.title,className:J(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors`,`border-outline-variant/30 bg-surface-container text-on-surface`,`hover:bg-surface-container-high hover:border-outline-variant/60`),children:[(0,G.jsx)(wk,{tone:e.tone,sizePx:5}),(0,G.jsx)(`span`,{children:e.label})]})}function b$({chip:e,href:t}){return(0,G.jsx)(ri,{to:t,"aria-label":`${e.label} — open feature`,className:`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40 rounded-full`,children:(0,G.jsx)(y$,{chip:e})})}function x$(e){let t=[],n=`agent=${encodeURIComponent(e.name)}`;if(e.supportsSessions&&t.push({id:`sessions`,label:`Sessions`,to:`/sessions?${n}`,tone:`sage`,title:`Prompts, tool calls, and responses captured from this symbiont`}),e.supportsSessionStartInjection&&(t.push({id:`cortex-instructions`,label:`Cortex Instructions`,to:`/cortex?tab=instructions`,tone:`sage`,title:`Project-scoped instructions injected at session start`}),t.push({id:`cortex-digest`,label:`Cortex Digest`,to:`/cortex?tab=digest`,tone:`sage`,title:`Project state digest injected at session start`})),e.supportsCanopyInjection&&t.push({id:`cortex-canopy`,label:`Cortex Canopy`,to:`/cortex?tab=canopy`,tone:`sage`,title:`File-read context injected on tool use`}),e.supportsSubagentStartInjection&&t.push({id:`cortex-subagent`,label:`Subagent context`,to:`/cortex?tab=instructions`,tone:`sage`,title:`Myco can inject a Cortex primer when this symbiont starts a subagent`}),e.supportsSessions&&t.push({id:`cortex-spores`,label:`Cortex Spores`,to:`/mycelium?tab=spores`,tone:`sage`,title:`Durable knowledge mined from this symbiont’s sessions`}),e.supportsPlanCapture&&t.push({id:`plans`,label:`Plans`,to:`/sessions?${n}&has_plan=true`,tone:`sage`,title:`Plans this symbiont produced`}),e.supportsSkills&&t.push({id:`skills`,label:`Skills`,to:`/skills`,tone:`sage`,title:`Myco skills exposed inside this symbiont`}),e.supportsMcp){let n=e.mcpActive===!0;t.push({id:`mcp`,label:n?`MCP`:`MCP (quiet)`,to:`/skills`,tone:n?`sage`:`outline`,title:n?`Myco MCP tools called within the last 7 days`:`MCP is configured but no recent tool calls were observed`})}return t}function S$(e){return e.detected?e.globallyInstalled?{label:`Available`,tone:`sage`}:{label:`Detected`,tone:`ochre`}:{label:`Not detected`,tone:`outline`}}function C$({symbiont:e,onSetOverride:t,overrideDisabled:n=!1,overrideDisabledReason:r,busy:i=!1}){let a=S$(e),o=ys(),s=(0,W.useMemo)(()=>x$(e),[e]);function c(e){t(e)}return(0,G.jsx)(uM,{accent:`sage`,interactive:!1,"data-symbiont":e.name,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5 min-w-0 flex-1`,children:[(0,G.jsx)(wk,{tone:a.tone,className:`mt-1.5 shrink-0`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 flex-wrap`,children:[(0,G.jsx)(`h3`,{className:`font-serif italic text-sm text-on-surface truncate leading-snug`,children:e.displayName}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:e.name}),(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:[`· `,a.label]})]}),e.detected&&!e.globallyInstalled&&(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:[`Not connected yet — use `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Re-detect now`}),` above to wire Myco into this agent, or run `,(0,G.jsx)(`code`,{className:`rounded bg-surface-container px-1 py-0.5 font-mono text-[11px]`,children:`myco update`}),`.`]}),s.length>0&&(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:s.map(e=>(0,G.jsx)(b$,{chip:e,href:o(e.to)},e.id))})]})]}),e.detected&&(0,G.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,title:n?r:void 0,children:(0,G.jsx)(XN,{checked:e.enabled,onCheckedChange:c,disabled:i||n})})]})})}function w$(){let e=We(),t=_s();return st({mutationFn:async e=>{if(!t)throw Error(`No project selected`);return ns(`/projects/${t.project.project_id}/symbionts-customization`,e)},onSuccess:()=>{e.invalidateQueries({queryKey:[`symbionts`]})}})}function T$(){let e=We(),t=_s();return st({mutationFn:async e=>{if(!t)throw Error(`No project selected`);return rs(`/projects/${t.project.project_id}/symbionts`,e)},onSuccess:()=>{e.invalidateQueries({queryKey:[`symbionts`]})}})}function E$(){let{data:e,isLoading:t,refetch:n}=mM(),r=We(),i=_s(),a=T$(),o=w$(),[s,c]=(0,W.useState)(!1),l=e?.symbionts??[],u=l.filter(e=>e.detected),d=l.filter(e=>!e.detected),f=!!e?.projectCustomizationActive,p=!i;async function m(){c(!0);try{await q(`/symbionts/detect`,{method:`POST`}),await r.invalidateQueries({queryKey:[`symbionts`]}),await n()}finally{c(!1)}}function h(e){p||o.mutate({enabled:e})}let g=o.isPending,_=a.isPending||g,v=p||!f,y=p?`Select a project to override this symbiont per-project.`:f?void 0:`Turn on "Customize for this project" to override individual symbionts here.`;return(0,G.jsxs)(bj,{children:[(0,G.jsx)(YN,{title:`Symbionts`,description:`Coding agents Myco supports on this machine, and the Myco features available for each.`,actions:(0,G.jsxs)(Y,{onClick:m,disabled:s,variant:`outline`,size:`sm`,children:[(0,G.jsx)(Qa,{className:`h-4 w-4 mr-1.5 ${s?`animate-spin`:``}`}),s?`Detecting…`:`Re-detect now`]})}),(0,G.jsx)(Q,{className:`px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-sans text-sm text-on-surface`,children:`Customize for this project`}),(0,G.jsx)(`div`,{className:`mt-0.5 font-sans text-xs text-on-surface-variant`,children:p?`Select a project from the switcher to enable per-project customization.`:f?`This project overrides which symbionts are active. Toggle individual symbionts below.`:`Using the global defaults. Turn on to override individual symbionts for this project.`})]}),(0,G.jsx)(XN,{checked:f,onCheckedChange:h,disabled:p||g})]})}),t?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant`,children:`Loading…`}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(Q,{children:u.length===0?(0,G.jsx)(`p`,{className:`px-4 py-6 text-sm text-on-surface-variant`,children:`No coding agents detected. Myco picks them up automatically once one is installed.`}):u.map(e=>(0,G.jsx)(C$,{symbiont:e,busy:_,overrideDisabled:v,overrideDisabledReason:y,onSetOverride:t=>{v||a.mutate({symbionts:{[e.name]:{enabled:t}}})}},e.name))}),d.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(MM,{children:`Not detected`}),(0,G.jsx)(Q,{children:d.map(e=>(0,G.jsx)(C$,{symbiont:e,onSetOverride:()=>{}},e.name))})]})]})]})}function D$({selectedCount:e,onClear:t,onCompare:n,minSelected:r=2,primaryLabel:i=`Compare`,nounSingular:a=`run`,nounPlural:o=`runs`,className:s}){if(e===0)return null;let c=e===1?a:o;return(0,G.jsxs)(`div`,{role:`region`,"aria-label":`Selection actions`,className:J(`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3 rounded-full bg-surface-container-high px-4 py-2 shadow-lg border border-outline-variant/30`,s),children:[(0,G.jsxs)(`span`,{className:`font-sans text-sm text-on-surface`,children:[e,` selected`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`default`,className:`gap-2`,disabled:e<r,onClick:n,children:[(0,G.jsx)(Aa,{className:`h-3.5 w-3.5`}),i,` `,e,` `,c]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`gap-2 text-on-surface-variant`,onClick:t,children:[(0,G.jsx)(So,{className:`h-3.5 w-3.5`}),`Clear selection`]})]})}var O$=/[\s/_.:-]+/,k$=/[\s/_.:-]+/g,A$=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function j$(e){return e.trim().toLowerCase()}function M$(e){return j$(e).split(O$).filter(Boolean)}function N$(e){return e.length>1&&e.every(e=>e.length>=2)}function P$(e,t){let n=j$(t);if(n===``)return 0;let r=j$(e.label),i=j$(e.value),a=j$(`${e.label} ${e.value} ${e.searchText??``}`),o=M$(n),s=M$(a),c=n.replace(k$,``),l=a.replace(k$,``);return r===n||i===n?0:r.startsWith(n)||i.startsWith(n)?1:r.includes(n)||i.includes(n)||a.includes(n)?2:s.some(e=>e.startsWith(n))?3:N$(o)&&o.every(e=>a.includes(e))?4:c!==``&&l.includes(c)?5:null}function F$({options:e,value:t,onValueChange:n,placeholder:r=`Select an option`,searchPlaceholder:i=`Search...`,emptyMessage:a=`No matching options.`,disabled:o=!1,sortOptions:s=!1,className:c,triggerClassName:l,contentClassName:u,monospace:d=!1,renderOption:f,renderValue:p}){let[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(``),v=(0,W.useDeferredValue)(g),y=(0,W.useRef)(null),b=(0,W.useRef)(null),x=(0,W.useRef)(null),S=(0,W.useId)(),C=(0,W.useMemo)(()=>{let t=[...e];return s&&t.sort((e,t)=>A$.compare(e.label,t.label)||A$.compare(e.value,t.value)),t},[e,s]),w=(0,W.useMemo)(()=>{let e=C.map(e=>({option:e,rank:P$(e,v)})).filter(e=>e.rank!==null);return e.sort((e,t)=>e.rank-t.rank||A$.compare(e.option.label,t.option.label)||A$.compare(e.option.value,t.option.value)),e.map(e=>e.option)},[v,C]),T=C.find(e=>e.value===t)??(t?{value:t,label:t}:void 0);return(0,W.useEffect)(()=>{if(!m){_(``);return}let e=window.requestAnimationFrame(()=>{x.current?.focus(),x.current?.select()});return()=>window.cancelAnimationFrame(e)},[m]),(0,W.useEffect)(()=>{if(!m)return;let e=e=>{y.current?.contains(e.target)||h(!1)},t=e=>{e.key===`Escape`&&(h(!1),b.current?.focus())};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[m]),(0,G.jsxs)(`div`,{ref:y,className:J(`relative`,c),children:[(0,G.jsxs)(`button`,{ref:b,type:`button`,disabled:o,"aria-expanded":m,"aria-controls":S,className:J(`flex h-9 w-full items-center justify-between rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-left text-sm shadow-xs transition-colors focus-visible:outline-hidden focus-visible:border-primary/40 disabled:cursor-not-allowed disabled:opacity-50`,l),onClick:()=>h(e=>!e),children:[(0,G.jsx)(`span`,{className:J(`truncate text-on-surface`,!T&&`text-on-surface-variant/60`),children:T?p?.(T)??(0,G.jsx)(`span`,{className:J(d&&`font-mono`),children:T.label}):r}),(0,G.jsx)($i,{className:`h-4 w-4 shrink-0 opacity-50`})]}),m?(0,G.jsxs)(`div`,{className:J(`absolute left-0 right-0 z-50 mt-1 rounded-md border border-[var(--ghost-border)] bg-surface-container-highest shadow-ambient`,u),children:[(0,G.jsx)(`div`,{className:`border-b border-[var(--ghost-border)] p-2`,children:(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(no,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-on-surface-variant/70`}),(0,G.jsx)(Kf,{ref:x,value:g,onChange:e=>_(e.target.value),placeholder:i,className:`pl-9`})]})}),(0,G.jsx)(`div`,{id:S,role:`listbox`,className:`max-h-72 overflow-y-auto p-1`,children:w.length>0?w.map(e=>{let r=e.value===t;return(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":r,className:J(`flex w-full items-center justify-between rounded-xs px-2 py-1.5 text-left text-sm text-on-surface outline-hidden transition-colors hover:bg-surface-bright focus-visible:bg-surface-bright`,r&&`bg-surface-bright`),onClick:()=>{n(e.value),h(!1),b.current?.focus()},children:[(0,G.jsx)(`span`,{className:J(`truncate`,d&&`font-mono`),children:f?.(e)??e.label}),r?(0,G.jsx)(Qi,{className:`ml-2 h-4 w-4 shrink-0`}):null]},e.value)}):(0,G.jsx)(`div`,{className:`px-2 py-3 text-sm text-on-surface-variant`,children:a})})]}):null]})}var I$=`claude-sdk`,L$=`openai-agents`,R$=[`anthropic`,`ollama`,`lmstudio`,`openai`,`openrouter`,`openai-compatible`],z$=32768,B$=2e5,V$={anthropic:{harness:I$,supportedHarnesses:[I$],defaultContextWindowTokens:B$},ollama:{harness:I$,supportedHarnesses:[I$,L$],defaultContextWindowTokens:z$},lmstudio:{harness:I$,supportedHarnesses:[I$,L$],defaultContextWindowTokens:z$},openai:{harness:L$,supportedHarnesses:[L$],defaultContextWindowTokens:B$},openrouter:{harness:L$,supportedHarnesses:[L$],defaultContextWindowTokens:B$},"openai-compatible":{harness:L$,supportedHarnesses:[L$],defaultContextWindowTokens:128e3}};function H$(e){if(e)return V$[e]}function U$(e){return H$(e)?.harness}function W$(e){return H$(e)?.supportedHarnesses??[]}function G$(e,t){return!e||!t?!1:W$(e).includes(t)}var K$=3e4,q$=Array.from(new Set(Object.values(V$).flatMap(e=>e.supportedHarnesses)));function J$(e){return q$.includes(e)?e:``}function Y$(e){return R$.includes(e)?e:``}var X$=[`low`,`default`,`high`],Z$={ollama:`http://localhost:11434`,lmstudio:`http://localhost:1234`};function Q$(e,t,n){return e===`openai-compatible`&&t?Z$[t]:n??``}function $$(e){return e?U$(e)??``:``}function e1(e){return e?U$(e):void 0}function t1(e,t){return G$(e||void 0,t||void 0)}function n1(e,t,n){let r=e??`default`;return t?.reasoning_map?.[r]??t?.model??n??``}function r1(e,t,n){let r=t.find(t=>t.type===e),i=new Set(r?.models??[]),a=r?.models?.[0]??``,o=(...e)=>r?.models?.find(t=>e.some(e=>t.includes(e)))??``;return{harness:n&&t1(e,n)?n:r?.harness??$$(e),type:e,localBackend:``,model:a,reasoningLow:i.size>0?e===`anthropic`?o(`haiku`):e===`openai`?o(`nano`):a:``,reasoningDefault:i.size>0?(e===`anthropic`?o(`sonnet`):e===`openai`?o(`mini`):a)||a:``,reasoningHigh:i.size>0?e===`anthropic`?o(`opus`):e===`openai`?(e=>r?.models?.find(t=>t===e)??``)(`gpt-5.4`):``:``,baseUrl:r?.baseUrl??``,contextLength:``}}function i1(e){if(e.type===``)return;let t=e.type===`ollama`||e.type===`lmstudio`||e.type===`openai-compatible`,n={...e.reasoningLow?{low:e.reasoningLow}:{},...e.reasoningDefault?{default:e.reasoningDefault}:{},...e.reasoningHigh?{high:e.reasoningHigh}:{}};return{type:e.type,...e.type===`openai-compatible`&&e.localBackend?{local_backend:e.localBackend}:{},...e.model?{model:e.model}:{},...Object.keys(n).length>0?{reasoning_map:n}:{},...t&&e.baseUrl?{base_url:e.baseUrl}:{},...t&&e.contextLength?{context_length:Number(e.contextLength)}:{}}}function a1(e){return ot({queryKey:xs([`task-config`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}/config`,{signal:t}),enabled:e!==void 0,staleTime:K$})}function o1(){return ot({queryKey:xs([`providers`]),queryFn:({signal:e})=>q(`/providers`,{signal:e}),staleTime:K$})}function s1(){return st({mutationFn:e=>ts(`/providers/test`,e)})}function c1(){let e=We();return st({mutationFn:({taskId:e,config:t})=>ns(`/agent/tasks/${e}/config`,t),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`task-config`,n.taskId]})}})}var l1=new Set([`openai-compatible`]);function u1(e,t,n,r){let i=e?l1.has(e):!1,a=!!e&&(!i||!!t);return ot({queryKey:xs([`models`,e,t,n,r]),queryFn:({signal:i})=>{let a=new URLSearchParams({provider:e});return t&&a.set(`base_url`,t),n&&a.set(`type`,n),r&&a.set(`local_backend`,r),q(`/models?${a.toString()}`,{signal:i})},enabled:a,staleTime:Os})}var d1=new Set([`ollama`,`lmstudio`,`openai-compatible`]);function f1({providerType:e,localBackend:t=``,baseUrl:n,model:r,modelPlaceholder:i,providers:a,onModelChange:o,label:s=`Model`}){let c=a.find(t=>t.type===e),l=e!==``,u=n||Q$(e,t,c?.baseUrl),d=u1(e||null,u,`llm`,t||null),f=d.data?.models??c?.models??[],p=d1.has(e),m=f.length>0,h=d.isPending&&l,g=c?.authConfigured===!1?`Configure an API key to load models.`:c?.available===!1?`Provider unavailable.`:`No models returned.`,_=i??`Select a model`;return l?(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:s}),h?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-sm text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),`Loading models...`]}):m?(0,G.jsx)(F$,{value:r,onValueChange:o,placeholder:_,searchPlaceholder:`Search models...`,emptyMessage:`No models match that search.`,options:f.map(e=>({value:e,label:e})),sortOptions:!0,monospace:!0}):p?(0,G.jsx)(Kf,{value:r,onChange:e=>o(e.target.value),placeholder:c?.available===!1?`Provider offline`:`Enter model name`,disabled:c?.available===!1}):(0,G.jsx)(`div`,{className:`rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2`,children:(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:g})})]}):null}var p1={"claude-sdk":`Claude Agents`,"openai-agents":`OpenAI Agents`},m1={anthropic:`Anthropic`,ollama:`Ollama`,lmstudio:`LM Studio`,openai:`OpenAI`,openrouter:`OpenRouter`,"openai-compatible":`OpenAI-compatible`},h1={anthropic:da,ollama:ro,lmstudio:ma,openai:da,openrouter:da,"openai-compatible":ro},g1=[{value:`lmstudio`,label:`LM Studio`},{value:`ollama`,label:`Ollama`}];function _1({harness:e,providerType:t,localBackend:n=``,model:r,baseUrl:i,contextLength:a,modelPlaceholder:o,providers:s,isLoadingProviders:c,showHarnessSelector:l=!0,showModelSelector:u=!0,onHarnessChange:d,onProviderChange:f,onLocalBackendChange:p,onModelChange:m,onBaseUrlChange:h,onContextLengthChange:g,onBaseUrlBlur:_,onContextLengthBlur:v}){let y=s.filter(t=>t1(t.type,e)),b=s.find(e=>e.type===t),x=t===`ollama`||t===`lmstudio`||t===`openai-compatible`,S=i||Q$(t,n,b?.baseUrl);return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[l&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Runtime`}),(0,G.jsxs)(c_,{value:e,onValueChange:d,children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:`Select a runtime`})}),(0,G.jsx)(d_,{children:Object.entries(p1).map(([e,t])=>(0,G.jsx)(f_,{value:e,children:t},e))})]})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:y.map(e=>{let n=h1[e.type];return n?(0,G.jsxs)(`button`,{onClick:()=>f(e.type),className:`
404
+ `);i.aPosition=t.getAttribLocation(i,`aPosition`),i.aIndex=t.getAttribLocation(i,`aIndex`),i.aVertType=t.getAttribLocation(i,`aVertType`),i.aTransform=t.getAttribLocation(i,`aTransform`),i.aAtlasId=t.getAttribLocation(i,`aAtlasId`),i.aTex=t.getAttribLocation(i,`aTex`),i.aPointAPointB=t.getAttribLocation(i,`aPointAPointB`),i.aPointCPointD=t.getAttribLocation(i,`aPointCPointD`),i.aLineWidth=t.getAttribLocation(i,`aLineWidth`),i.aColor=t.getAttribLocation(i,`aColor`),i.aCornerRadius=t.getAttribLocation(i,`aCornerRadius`),i.aBorderColor=t.getAttribLocation(i,`aBorderColor`),i.uPanZoomMatrix=t.getUniformLocation(i,`uPanZoomMatrix`),i.uAtlasSize=t.getUniformLocation(i,`uAtlasSize`),i.uBGColor=t.getUniformLocation(i,`uBGColor`),i.uZoom=t.getUniformLocation(i,`uZoom`),i.uTextures=[];for(var a=0;a<this.batchManager.getMaxAtlasesPerBatch();a++)i.uTextures.push(t.getUniformLocation(i,`uTexture${a}`));return i}},{key:`_createVAO`,value:function(){var e=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=e.length/2;var t=this.maxInstances,n=this.gl,r=this.program,i=n.createVertexArray();return n.bindVertexArray(i),kX(n,`vec2`,r.aPosition,e),this.transformBuffer=jX(n,t,r.aTransform),this.indexBuffer=AX(n,t,`vec4`,r.aIndex),this.vertTypeBuffer=AX(n,t,`int`,r.aVertType),this.atlasIdBuffer=AX(n,t,`int`,r.aAtlasId),this.texBuffer=AX(n,t,`vec4`,r.aTex),this.pointAPointBBuffer=AX(n,t,`vec4`,r.aPointAPointB),this.pointCPointDBuffer=AX(n,t,`vec4`,r.aPointCPointD),this.lineWidthBuffer=AX(n,t,`vec2`,r.aLineWidth),this.colorBuffer=AX(n,t,`vec4`,r.aColor),this.cornerRadiusBuffer=AX(n,t,`vec4`,r.aCornerRadius),this.borderColorBuffer=AX(n,t,`vec4`,r.aBorderColor),n.bindVertexArray(null),i}},{key:`buffers`,get:function(){var e=this;return this._buffers||=Object.keys(this).filter(function(e){return rI(e,`Buffer`)}).map(function(t){return e[t]}),this._buffers}},{key:`startFrame`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:XX.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:`startBatch`,value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:`endFrame`,value:function(){this.endBatch()}},{key:`_isVisible`,value:function(e,t){return e.visible()?t&&t.isVisible?t.isVisible(e):!0:!1}},{key:`drawTexture`,value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,a=r.getRenderTypeOpts(n);if(this._isVisible(e,a)&&!(e.isEdge()&&!this._isValidEdge(e))){if(this.renderTarget.picking&&a.getTexPickingMode){var o=a.getTexPickingMode(e);if(o===ZX.IGNORE)return;if(o==ZX.USE_BB){this.drawPickingRectangle(e,t,n);return}}var s=hF(r.getAtlasInfo(e,n)),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=l.atlas,d=l.tex1,f=l.tex2;i.canAddToCurrentBatch(u)||this.endBatch();for(var p=i.getAtlasIndexForBatch(u),m=0,h=[[d,!0],[f,!1]];m<h.length;m++){var g=xF(h[m],2),_=g[0],v=g[1];if(_.w!=0){var y=this.instanceCount;this.vertTypeBuffer.getView(y)[0]=QX,CX(t,this.indexBuffer.getView(y));var b=this.atlasIdBuffer.getView(y);b[0]=p;var x=this.texBuffer.getView(y);x[0]=_.x,x[1]=_.y,x[2]=_.w,x[3]=_.h;var S=this.transformBuffer.getMatrixView(y);this.setTransformMatrix(e,S,a,l,v),this.instanceCount++,v||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(e){s.e(e)}finally{s.f()}}}},{key:`setTransformMatrix`,value:function(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;if(n.shapeProps&&n.shapeProps.padding&&(a=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,c=r.tex2,l=s.w/(s.w+c.w);i||(l=1-l);var u=this._getAdjustedBB(o,a,i,l);this._applyTransformMatrix(t,u,n,e)}else{var d=n.getBoundingBox(e),f=this._getAdjustedBB(d,a,!0,1);this._applyTransformMatrix(t,f,n,e)}}},{key:`_applyTransformMatrix`,value:function(e,t,n,r){var i,a;FX(e);var o=n.getRotation?n.getRotation(r):0;if(o!==0){var s=n.getRotationPoint(r),c=s.x,l=s.y;LX(e,e,[c,l]),RX(e,e,o);var u=n.getRotationOffset(r);i=u.x+(t.xOffset||0),a=u.y+(t.yOffset||0)}else i=t.x1,a=t.y1;LX(e,e,[i,a]),zX(e,e,[t.w,t.h])}},{key:`_getAdjustedBB`,value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h,c=e.yOffset;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(l=o-u,i+=l,o=u),{x1:i,y1:a,w:o,h:s,xOffset:l,yOffset:c}}},{key:`drawPickingRectangle`,value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=nZ,CX(t,this.indexBuffer.getView(i)),SX([0,0,0],1,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);this.setTransformMatrix(e,a,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:`drawNode`,value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var i=r.shapeProps,a=this._getVertTypeForShape(e,i.shape);if(a===void 0||r.isSimple&&!r.isSimple(e,this.renderTarget)){this.drawTexture(e,t,n);return}var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=a,a===rZ||a===iZ){var s=r.getBoundingBox(e),c=this._getCornerRadius(e,i.radius,s),l=this.cornerRadiusBuffer.getView(o);l[0]=c,l[1]=c,l[2]=c,l[3]=c,a===iZ&&(l[0]=0,l[2]=0)}CX(t,this.indexBuffer.getView(o));var u=this.renderTarget.picking?1:n===`node-body`?e.effectiveOpacity():1,d=this.renderTarget.picking?1:e.pstyle(i.opacity).value*u,f=e.pstyle(i.color).value;SX(f,d,this.colorBuffer.getView(o));var p=this.lineWidthBuffer.getView(o);if(p[0]=0,p[1]=0,i.border){var m=e.pstyle(`border-width`).value;if(m>0){var h=e.pstyle(`border-color`).value;SX(h,u*e.pstyle(`border-opacity`).value,this.borderColorBuffer.getView(o));var g=e.pstyle(`border-position`).value;if(g===`inside`)p[0]=0,p[1]=-m;else if(g===`outside`)p[0]=m,p[1]=0;else{var _=m/2;p[0]=_,p[1]=-_}}}var v=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,v,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:`_getVertTypeForShape`,value:function(e,t){switch(e.pstyle(t).value){case`rectangle`:return nZ;case`ellipse`:return aZ;case`roundrectangle`:case`round-rectangle`:return rZ;case`bottom-round-rectangle`:return iZ;default:return}}},{key:`_getCornerRadius`,value:function(e,t,n){var r=n.w,i=n.h;if(e.pstyle(t).value===`auto`)return Fz(r,i);var a=e.pstyle(t).pfValue,o=r/2,s=i/2;return Math.min(a,s,o)}},{key:`drawEdgeArrow`,value:function(e,t,n){if(e.visible()){var r=e._private.rscratch,i,a,o;if(n===`source`?(i=r.arrowStartX,a=r.arrowStartY,o=r.srcArrowAngle):(i=r.arrowEndX,a=r.arrowEndY,o=r.tgtArrowAngle),!(isNaN(i)||i==null||isNaN(a)||a==null||isNaN(o)||o==null)&&e.pstyle(n+`-arrow-shape`).value!==`none`){var s=e.pstyle(n+`-arrow-color`).value,c=e.pstyle(`opacity`).value*e.pstyle(`line-opacity`).value,l=e.pstyle(`width`).pfValue,u=e.pstyle(`arrow-scale`).value,d=this.r.getArrowWidth(l,u),f=this.instanceCount,p=this.transformBuffer.getMatrixView(f);FX(p),LX(p,p,[i,a]),zX(p,p,[d,d]),RX(p,p,o),this.vertTypeBuffer.getView(f)[0]=tZ,CX(t,this.indexBuffer.getView(f)),SX(s,c,this.colorBuffer.getView(f)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:`drawEdgeLine`,value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle(`opacity`).value,i=e.pstyle(`line-opacity`).value,a=e.pstyle(`width`).pfValue,o=e.pstyle(`line-color`).value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=$X,CX(t,this.indexBuffer.getView(c)),SX(o,s,this.colorBuffer.getView(c));var l=this.lineWidthBuffer.getView(c);l[0]=a;var u=this.pointAPointBBuffer.getView(c);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var d=0;d<n.length-2;d+=2){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=eZ,CX(t,this.indexBuffer.getView(f)),SX(o,s,this.colorBuffer.getView(f));var p=this.lineWidthBuffer.getView(f);p[0]=a;var m=n[d-2],h=n[d-1],g=n[d],_=n[d+1],v=n[d+2],y=n[d+3],b=n[d+4],x=n[d+5];d==0&&(m=2*g-v+.001,h=2*_-y+.001),d==n.length-4&&(b=2*v-g+.001,x=2*y-_+.001);var S=this.pointAPointBBuffer.getView(f);S[0]=m,S[1]=h,S[2]=g,S[3]=_;var C=this.pointCPointDBuffer.getView(f);C[0]=v,C[1]=y,C[2]=b,C[3]=x,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:`_isValidEdge`,value:function(e){var t=e._private.rscratch;return!(t.badLine||t.allpts==null||isNaN(t.allpts[0]))}},{key:`_getEdgePoints`,value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(n.length==4)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:`_getNumSegments`,value:function(e){return Math.min(15,this.maxInstances)}},{key:`_getCurveSegmentPoints`,value:function(e,t){if(e.length==4)return e;for(var n=Array((t+1)*2),r=0;r<=t;r++)if(r==0)n[0]=e[0],n[1]=e[1];else if(r==t)n[r*2]=e[e.length-2],n[r*2+1]=e[e.length-1];else{var i=r/t;this._setCurvePoint(e,i,n,r*2)}return n}},{key:`_setCurvePoint`,value:function(e,t,n,r){if(e.length<=2)n[r]=e[0],n[r+1]=e[1];else{for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this._setCurvePoint(i,t,n,r)}}},{key:`endBatch`,value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,r=this.instanceCount;if(r!==0){var i=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(i),e.bindVertexArray(t);var a=hF(this.buffers),o;try{for(a.s();!(o=a.n()).done;)o.value.bufferSubData(r)}catch(e){a.e(e)}finally{a.f()}for(var s=this.batchManager.getAtlases(),c=0;c<s.length;c++)s[c].bufferIfNeeded(e);for(var l=0;l<s.length;l++)e.activeTexture(e.TEXTURE0+l),e.bindTexture(e.TEXTURE_2D,s[l].texture),e.uniform1i(i.uTextures[l],l);e.uniform1f(i.uZoom,vX(this.r)),e.uniformMatrix3fv(i.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(i.uAtlasSize,this.batchManager.getAtlasSize());var u=SX(this.bgColor,1);e.uniform4fv(i.uBGColor,u),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:r,atlasCount:s.length}),this.startBatch()}}},{key:`getDebugInfo`,value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(e,t){return e+t.atlasCount},0),n=this.batchDebugInfo,r=n.reduce(function(e,t){return e+t.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}])}(),sZ={};sZ.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=cZ(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=MX(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new oZ(n,r,e);var i=function(e){return function(t){return n.getTextAngle(t,e)}},a=function(e){return function(t){var n=t.pstyle(e);return n&&n.value}},o=function(e){return function(t){return t.pstyle(`${e}-opacity`).value>0}},s=function(e){return e.pstyle(`text-events`).strValue===`yes`?ZX.USE_BB:ZX.IGNORE},c=function(e){var t=e.position(),n=t.x,r=t.y,i=e.outerWidth(),a=e.outerHeight();return{w:i,h:a,x1:n-i/2,y1:r-a/2}};n.drawing.addAtlasCollection(`node`,{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection(`label`,{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType(`node-body`,{collection:`node`,getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType(`node-body`,{getBoundingBox:c,isSimple:bX,shapeProps:{shape:`shape`,color:`background-color`,opacity:`background-opacity`,radius:`corner-radius`,border:!0}}),n.drawing.addSimpleShapeRenderType(`node-overlay`,{getBoundingBox:c,isVisible:o(`overlay`),shapeProps:{shape:`overlay-shape`,color:`overlay-color`,opacity:`overlay-opacity`,padding:`overlay-padding`,radius:`overlay-corner-radius`}}),n.drawing.addSimpleShapeRenderType(`node-underlay`,{getBoundingBox:c,isVisible:o(`underlay`),shapeProps:{shape:`underlay-shape`,color:`underlay-color`,opacity:`underlay-opacity`,padding:`underlay-padding`,radius:`underlay-corner-radius`}}),n.drawing.addTextureAtlasRenderType(`label`,{collection:`label`,getTexPickingMode:s,getKey:uZ(t.getLabelKey,null),getBoundingBox:dZ(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a(`label`)}),n.drawing.addTextureAtlasRenderType(`edge-source-label`,{collection:`label`,getTexPickingMode:s,getKey:uZ(t.getSourceLabelKey,`source`),getBoundingBox:dZ(t.getSourceLabelBox,`source`),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i(`source`),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a(`source-label`)}),n.drawing.addTextureAtlasRenderType(`edge-target-label`,{collection:`label`,getTexPickingMode:s,getKey:uZ(t.getTargetLabelKey,`target`),getBoundingBox:dZ(t.getTargetLabelBox,`target`),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i(`target`),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a(`target-label`)});var l=fL(function(){console.log(`garbage collect flag set`),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(e,t){var r=!1;t&&t.length>0&&(r|=n.drawing.invalidate(t)),r&&l()}),fZ(n)};function cZ(e){var t=e.cy.container();return vI(t&&t.style&&t.style.backgroundColor||`white`)}function lZ(e,t){var n=e._private.rscratch;return tR(n,`labelWrapCachedLines`,t)||[]}var uZ=function(e,t){return function(n){var r=e(n),i=lZ(n,t);return i.length>1?i.map(function(e,t){return`${r}_${t}`}):r}},dZ=function(e,t){return function(n,r){var i=e(n);if(typeof r==`string`){var a=r.indexOf(`_`);if(a>0){var o=Number(r.substring(a+1)),s=lZ(n,t),c=i.h/s.length,l=c*o,u=i.y1+l;return{x1:i.x1,w:i.w,y1:u,h:c,yOffset:l}}}return i}};function fZ(e){var t=e.render;e.render=function(n){n||={};var r=e.cy;e.webgl&&(r.zoom()>oY?(pZ(e),t.call(e,n)):(mZ(e),CZ(e,n,XX.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return xZ(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),t===`viewport`||t===`bounds`?e.pickingFrameBuffer.needsDraw=!0:t===`background`&&e.drawing.invalidate(n,{type:`node-body`})}}function pZ(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function mZ(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function hZ(e){var t=e.canvasWidth,n=e.canvasHeight,r=_X(e),i=r.pan,a=r.zoom,o=PX();LX(o,o,[i.x,i.y]),zX(o,o,[a,a]);var s=PX();BX(s,t,n);var c=PX();return IX(c,s,o),c}function gZ(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=_X(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function _Z(e,t){e.drawSelectionRectangle(t,function(t){return gZ(e,t)})}function vZ(e){var t=e.data.contexts[e.NODE];t.save(),gZ(e,t),t.strokeStyle=`rgba(0, 0, 0, 0.3)`,t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function yZ(e){var t=function(t,n,r){for(var i=t.atlasManager.getAtlasCollection(n),a=e.data.contexts[e.NODE],o=i.atlases,s=0;s<o.length;s++){var c=o[s].canvas;if(c){var l=c.width,u=c.height,d=l*s,f=c.height*r,p=.4;a.save(),a.scale(p,p),a.drawImage(c,d,f),a.strokeStyle=`black`,a.rect(d,f,l,u),a.stroke(),a.restore()}}},n=0;t(e.drawing,`node`,n++),t(e.drawing,`label`,n++)}function bZ(e,t,n,r,i){var a,o,s,c,l=_X(e),u=l.pan,d=l.zoom,f=xF(yX(e,u,d,t,n),2),p=f[0],m=f[1],h=6;if(a=p-h/2,o=m-h/2,s=h,c=h,s===0||c===0)return[];var g=e.data.contexts[e.WEBGL];g.bindFramebuffer(g.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(g.viewport(0,0,g.canvas.width,g.canvas.height),CZ(e,null,XX.PICKING),e.pickingFrameBuffer.needsDraw=!1);var _=s*c,v=new Uint8Array(_*4);g.readPixels(a,o,s,c,g.RGBA,g.UNSIGNED_BYTE,v),g.bindFramebuffer(g.FRAMEBUFFER,null);for(var y=new Set,b=0;b<_;b++){var x=wX(v.slice(b*4,b*4+4))-1;x>=0&&y.add(x)}return y}function xZ(e,t,n){var r=bZ(e,t,n),i=e.getCachedZSortedEles(),a,o,s=hF(r),c;try{for(s.s();!(c=s.n()).done;){var l=i[c.value];if(!a&&l.isNode()&&(a=l),!o&&l.isEdge()&&(o=l),a&&o)break}}catch(e){s.e(e)}finally{s.f()}return[a,o].filter(Boolean)}function SZ(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,`node-underlay`),r.drawNode(n,t,`node-body`),r.drawTexture(n,t,`label`),r.drawNode(n,t,`node-overlay`)):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,`source`),r.drawEdgeArrow(n,t,`target`),r.drawTexture(n,t,`label`),r.drawTexture(n,t,`edge-source-label`),r.drawTexture(n,t,`edge-target-label`))}function CZ(e,t,n){var r;e.webglDebug&&(r=performance.now());var i=e.drawing,a=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&_Z(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var o=e.data.contexts[e.WEBGL];n.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=hZ(e),c=e.getCachedZSortedEles();if(a=c.length,i.startFrame(s,n),n.screen){for(var l=0;l<c.nondrag.length;l++)SZ(e,l,c.nondrag[l]);for(var u=0;u<c.drag.length;u++)SZ(e,u,c.drag[u])}else if(n.picking)for(var d=0;d<c.length;d++)SZ(e,d,c[d]);i.endFrame(),n.screen&&e.webglDebugShowAtlases&&(vZ(e),yZ(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var f=performance.now(),p=!1,m=Math.ceil(f-r),h=i.getDebugInfo(),g=[`${a} elements`,`${h.totalInstances} instances`,`${h.batchCount} batches`,`${h.totalAtlases} atlases`,`${h.wrappedCount} wrapped textures`,`${h.simpleCount} simple shapes`].join(`, `);if(p)console.log(`WebGL (${n.name}) - time ${m}ms, ${g}`);else{console.log(`WebGL (${n.name}) - frame time ${m}ms`),console.log(`Totals:`),console.log(` ${g}`),console.log(`Texture Atlases Used:`);var _=h.atlasInfo,v=hF(_),y;try{for(v.s();!(y=v.n()).done;){var b=y.value;console.log(` ${b.type}: ${b.keyCount} keys, ${b.atlasCount} atlases`)}}catch(e){v.e(e)}finally{v.f()}console.log(``)}}e.data.gc&&(console.log(`Garbage Collect!`),e.data.gc=!1,i.gc())}var wZ={};wZ.drawPolygonPath=function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var c=1;c<a.length/2;c++)e.lineTo(t+o*a[c*2],n+s*a[c*2+1]);e.closePath()},wZ.drawRoundPolygonPath=function(e,t,n,r,i,a,o){o.forEach(function(t){return wJ(e,t)}),e.closePath()},wZ.drawRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?Fz(r,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,c),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.arcTo(t-o,n-s,t,n-s,c),e.lineTo(t,n-s),e.closePath()},wZ.drawBottomRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?Fz(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},wZ.drawCutRectanglePath=function(e,t,n,r,i,a,o){var s=r/2,c=i/2,l=o===`auto`?Lz():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+l,n-c),e.lineTo(t+s-l,n-c),e.lineTo(t+s,n-c+l),e.lineTo(t+s,n+c-l),e.lineTo(t+s-l,n+c),e.lineTo(t-s+l,n+c),e.lineTo(t-s,n+c-l),e.lineTo(t-s,n-c+l),e.closePath()},wZ.drawBarrelPath=function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,c=t+a,l=n-o,u=n+o,d=zz(r,i),f=d.widthOffset,p=d.heightOffset,m=d.ctrlPtOffsetPct*f;e.beginPath&&e.beginPath(),e.moveTo(s,l+p),e.lineTo(s,u-p),e.quadraticCurveTo(s+m,u,s+f,u),e.lineTo(c-f,u),e.quadraticCurveTo(c-m,u,c,u-p),e.lineTo(c,l+p),e.quadraticCurveTo(c-m,l,c-f,l),e.lineTo(s+f,l),e.quadraticCurveTo(s+m,l,s,l+p),e.closePath()};for(var TZ=Math.sin(0),EZ=Math.cos(0),DZ={},OZ={},kZ=Math.PI/40,AZ=0*Math.PI;AZ<2*Math.PI;AZ+=kZ)DZ[AZ]=Math.sin(AZ),OZ[AZ]=Math.cos(AZ);wZ.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,c=i/2,l=0*Math.PI;l<2*Math.PI;l+=kZ)a=t-s*DZ[l]*TZ+s*OZ[l]*EZ,o=n+c*OZ[l]*TZ+c*DZ[l]*EZ,l===0?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var jZ={};jZ.createBuffer=function(e,t){var n=document.createElement(`canvas`);return n.width=e,n.height=t,[n,n.getContext(`2d`)]},jZ.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=$(e.maxWidth)||$(e.maxHeight),s=this.getPixelRatio(),c=1;if(e.scale!==void 0)i*=e.scale,a*=e.scale,c=e.scale;else if(o){var l=1/0,u=1/0;$(e.maxWidth)&&(l=c*e.maxWidth/i),$(e.maxHeight)&&(u=c*e.maxHeight/a),c=Math.min(l,u),i*=c,a*=c}o||(i*=s,a*=s,c*=s);var d=document.createElement(`canvas`);d.width=i,d.height=a,d.style.width=i+`px`,d.style.height=a+`px`;var f=d.getContext(`2d`);if(i>0&&a>0){f.clearRect(0,0,i,a),f.globalCompositeOperation=`source-over`;var p=this.getCachedZSortedEles();if(e.full)f.translate(-n.x1*c,-n.y1*c),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(n.x1*c,n.y1*c);else{var m=t.pan(),h={x:m.x*c,y:m.y*c};c*=t.zoom(),f.translate(h.x,h.y),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(-h.x,-h.y)}e.bg&&(f.globalCompositeOperation=`destination-over`,f.fillStyle=e.bg,f.rect(0,0,i,a),f.fill())}return d};function MZ(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}function NZ(e){var t=e.indexOf(`,`);return e.substr(t+1)}function PZ(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case`blob-promise`:return new gV(function(r,i){try{t.toBlob(function(e){e==null?i(Error("`canvas.toBlob()` sent a null value in its callback")):r(e)},n,e.quality)}catch(e){i(e)}});case`blob`:return MZ(NZ(r()),n);case`base64`:return NZ(r());default:return r()}}jZ.png=function(e){return PZ(e,this.bufferCanvasImage(e),`image/png`)},jZ.jpg=function(e){return PZ(e,this.bufferCanvasImage(e),`image/jpeg`)};var FZ={};FZ.nodeShapeImpl=function(e,t,n,r,i,a,o,s){switch(e){case`ellipse`:return this.drawEllipsePath(t,n,r,i,a);case`polygon`:return this.drawPolygonPath(t,n,r,i,a,o);case`round-polygon`:return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case`roundrectangle`:case`round-rectangle`:return this.drawRoundRectanglePath(t,n,r,i,a,s);case`cutrectangle`:case`cut-rectangle`:return this.drawCutRectanglePath(t,n,r,i,a,o,s);case`bottomroundrectangle`:case`bottom-round-rectangle`:return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case`barrel`:return this.drawBarrelPath(t,n,r,i,a)}};var IZ=RZ,LZ=RZ.prototype;LZ.CANVAS_LAYERS=3,LZ.SELECT_BOX=0,LZ.DRAG=1,LZ.NODE=2,LZ.WEBGL=3,LZ.CANVAS_TYPES=[`2d`,`2d`,`2d`,`webgl2`],LZ.BUFFER_COUNT=3,LZ.TEXTURE_BUFFER=0,LZ.MOTIONBLUR_BUFFER_NODE=1,LZ.MOTIONBLUR_BUFFER_DRAG=2;function RZ(e){var t=this,n=t.cy.window().document;e.webgl&&(LZ.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log(`webgl rendering enabled`)),t.data={canvases:Array(LZ.CANVAS_LAYERS),contexts:Array(LZ.CANVAS_LAYERS),canvasNeedsRedraw:Array(LZ.CANVAS_LAYERS),bufferCanvases:Array(LZ.BUFFER_COUNT),bufferContexts:Array(LZ.CANVAS_LAYERS)};var r=`-webkit-tap-highlight-color`,i=`rgba(0,0,0,0)`;t.data.canvasContainer=n.createElement(`div`);var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position=`relative`,a.zIndex=`0`,a.overflow=`hidden`;var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=i;var s={"-webkit-user-select":`none`,"-moz-user-select":`-moz-none`,"user-select":`none`,"-webkit-tap-highlight-color":`rgba(0,0,0,0)`,"outline-style":`none`};ZF()&&(s[`-ms-touch-action`]=`none`,s[`touch-action`]=`none`);for(var c=0;c<LZ.CANVAS_LAYERS;c++){var l=t.data.canvases[c]=n.createElement(`canvas`),u=LZ.CANVAS_TYPES[c];t.data.contexts[c]=l.getContext(u),t.data.contexts[c]||HL(`Could not create canvas of type `+u),Object.keys(s).forEach(function(e){l.style[e]=s[e]}),l.style.position=`absolute`,l.setAttribute(`data-id`,`layer`+c),l.style.zIndex=String(LZ.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[LZ.NODE].setAttribute(`data-id`,`layer`+LZ.NODE+`-node`),t.data.canvases[LZ.SELECT_BOX].setAttribute(`data-id`,`layer`+LZ.SELECT_BOX+`-selectbox`),t.data.canvases[LZ.DRAG].setAttribute(`data-id`,`layer`+LZ.DRAG+`-drag`),t.data.canvases[LZ.WEBGL]&&t.data.canvases[LZ.WEBGL].setAttribute(`data-id`,`layer`+LZ.WEBGL+`-webgl`);for(var c=0;c<LZ.BUFFER_COUNT;c++)t.data.bufferCanvases[c]=n.createElement(`canvas`),t.data.bufferContexts[c]=t.data.bufferCanvases[c].getContext(`2d`),t.data.bufferCanvases[c].style.position=`absolute`,t.data.bufferCanvases[c].setAttribute(`data-id`,`buffer`+c),t.data.bufferCanvases[c].style.zIndex=String(-c-1),t.data.bufferCanvases[c].style.visibility=`hidden`;t.pathsEnabled=!0;var d=XR(),f=function(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}},p=function(e){return{x:-e.w/2,y:-e.h/2}},m=function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},h=function(e){return e[0]._private.nodeKey},g=function(e){return e[0]._private.labelStyleKey},_=function(e){return e[0]._private.sourceLabelStyleKey},v=function(e){return e[0]._private.targetLabelStyleKey},y=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},b=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`main`,a)},x=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`source`,a)},S=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`target`,a)},C=function(e){return e.boundingBox(),e[0]._private.bodyBounds},w=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||d},T=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||d},E=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||d},D=function(e,t){return t},O=function(e){return f(C(e))},k=function(e,t,n){var r=e?e+`-`:``;return{x:t.x+n.pstyle(r+`text-margin-x`).pfValue,y:t.y+n.pstyle(r+`text-margin-y`).pfValue}},A=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},j=function(e){return k(``,A(e,`labelX`,`labelY`),e)},M=function(e){return k(`source`,A(e,`sourceLabelX`,`sourceLabelY`),e)},N=function(e){return k(`target`,A(e,`targetLabelX`,`targetLabelY`),e)},P=function(e){return p(C(e))},F=function(e){return p(T(e))},I=function(e){return p(E(e))},L=function(e){var t=w(e),n=p(w(e));if(e.isNode()){switch(e.pstyle(`text-halign`).value){case`left`:n.x=-t.w-(t.leftPad||0);break;case`right`:n.x=-(t.rightPad||0);break}switch(e.pstyle(`text-valign`).value){case`top`:n.y=-t.h-(t.topPad||0);break;case`bottom`:n.y=-(t.botPad||0);break}}return n},R=t.data.eleTxrCache=new SY(t,{getKey:h,doesEleInvalidateKey:m,drawElement:y,getBoundingBox:C,getRotationPoint:O,getRotationOffset:P,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),ee=t.data.lblTxrCache=new SY(t,{getKey:g,drawElement:b,getBoundingBox:w,getRotationPoint:j,getRotationOffset:L,isVisible:D}),z=t.data.slbTxrCache=new SY(t,{getKey:_,drawElement:x,getBoundingBox:T,getRotationPoint:M,getRotationOffset:F,isVisible:D}),B=t.data.tlbTxrCache=new SY(t,{getKey:v,drawElement:S,getBoundingBox:E,getRotationPoint:N,getRotationOffset:I,isVisible:D}),V=t.data.lyrTxrCache=new zY(t);t.onUpdateEleCalcs(function(e,t){R.invalidateElements(t),ee.invalidateElements(t),z.invalidateElements(t),B.invalidateElements(t),V.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var H=function(e){for(var t=0;t<e.length;t++)V.enqueueElementRefinement(e[t].ele)};R.onDequeue(H),ee.onDequeue(H),z.onDequeue(H),B.onDequeue(H),e.webgl&&t.initWebgl(e,{getStyleKey:h,getLabelKey:g,getSourceLabelKey:_,getTargetLabelKey:v,drawElement:y,drawLabel:b,drawSourceLabel:x,drawTargetLabel:S,getElementBox:C,getLabelBox:w,getSourceLabelBox:T,getTargetLabelBox:E,getElementRotationPoint:O,getElementRotationOffset:P,getLabelRotationPoint:j,getSourceLabelRotationPoint:M,getTargetLabelRotationPoint:N,getLabelRotationOffset:L,getSourceLabelRotationOffset:F,getTargetLabelRotationOffset:I})}LZ.redrawHint=function(e,t){var n=this;switch(e){case`eles`:n.data.canvasNeedsRedraw[LZ.NODE]=t;break;case`drag`:n.data.canvasNeedsRedraw[LZ.DRAG]=t;break;case`select`:n.data.canvasNeedsRedraw[LZ.SELECT_BOX]=t;break;case`gc`:n.data.gc=!0;break}};var zZ=typeof Path2D<`u`;LZ.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},LZ.usePaths=function(){return zZ&&this.pathsEnabled},LZ.setImgSmoothing=function(e,t){e.imageSmoothingEnabled==null?(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t):e.imageSmoothingEnabled=t},LZ.getImgSmoothing=function(e){return e.imageSmoothingEnabled==null?e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled:e.imageSmoothingEnabled},LZ.makeOffscreenCanvas=function(e,t){var n;return(typeof OffscreenCanvas>`u`?`undefined`:TF(OffscreenCanvas))===`undefined`?(n=this.cy.window().document.createElement(`canvas`),n.width=e,n.height=t):n=new OffscreenCanvas(e,t),n},[UY,XY,rX,aX,oX,lX,dX,sZ,wZ,jZ,FZ].forEach(function(e){pI(LZ,e)});var BZ=[{type:`layout`,extensions:Yq},{type:`renderer`,extensions:[{name:`null`,impl:Xq},{name:`base`,impl:ZJ},{name:`canvas`,impl:IZ}]}],VZ={},HZ={};function UZ(e,t,n){var r=n,i=function(n){WL("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if(e===`core`){if(sq.prototype[t])return i(t);sq.prototype[t]=n}else if(e===`collection`){if(xK.prototype[t])return i(t);xK.prototype[t]=n}else if(e===`layout`){for(var a=function(e){this.options=e,n.call(this,e),LF(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],c=0;c<s.length;c++){var l=s[c];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var u=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return u?u.call(this):this.emit(`layoutstop`),this},o.destroy||=function(){return this},o.cy=function(){return this._private.cy};var d=function(e){return e._private.cy},f={addEventFields:function(e,t){t.layout=e,t.cy=d(e),t.target=e},bubble:function(){return!0},parent:function(e){return d(e)}};pI(o,{createEmitter:function(){return this._private.emitter=new UG(f,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),gW.eventAliasesOn(o),r=a}else if(e===`renderer`&&t!==`null`&&t!==`base`){var p=WZ(`renderer`,`base`),m=p.prototype,h=n,g=n.prototype,_=function(){p.apply(this,arguments),h.apply(this,arguments)},v=_.prototype;for(var y in m){var b=m[y];if(g[y]!=null)return i(y);v[y]=b}for(var x in g)v[x]=g[x];m.clientFunctions.forEach(function(e){v[e]=v[e]||function(){HL("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=_}else if(e===`__proto__`||e===`constructor`||e===`prototype`)return HL(e+` is an illegal type to be registered, possibly lead to prototype pollutions`);return bI({map:VZ,keys:[e,t],value:r})}function WZ(e,t){return xI({map:VZ,keys:[e,t]})}function GZ(e,t,n,r,i){return bI({map:HZ,keys:[e,t,n,r],value:i})}function KZ(e,t,n,r){return xI({map:HZ,keys:[e,t,n,r]})}var qZ=function(){if(arguments.length===2)return WZ.apply(null,arguments);if(arguments.length===3)return UZ.apply(null,arguments);if(arguments.length===4)return KZ.apply(null,arguments);if(arguments.length===5)return GZ.apply(null,arguments);HL(`Invalid extension access syntax`)};sq.prototype.extension=qZ,BZ.forEach(function(e){e.extensions.forEach(function(t){UZ(e.type,t.name,t.impl)})});var JZ=function(){if(!(this instanceof JZ))return new JZ;this.length=0},YZ=JZ.prototype;YZ.instanceString=function(){return`stylesheet`},YZ.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},YZ.css=function(e,t){var n=this.length-1;if(PF(e))this[n].properties.push({name:e,value:t});else if(LF(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(s!=null){var c=tq.properties[o]||tq.properties[eI(o)];if(c!=null){var l=c.name,u=s;this[n].properties.push({name:l,value:u})}}}return this},YZ.style=YZ.css,YZ.generateStyle=function(e){var t=new tq(e);return this.appendToStyle(t)},YZ.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var XZ=`3.33.4`,ZZ=function(e){if(e===void 0&&(e={}),LF(e))return new sq(e);if(PF(e))return qZ.apply(qZ,arguments)};ZZ.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(ZZ),e.apply(null,t),this},ZZ.warnings=function(e){return UL(e)},ZZ.version=XZ,ZZ.stylesheet=ZZ.Stylesheet=JZ;var QZ=/^#{1,6}\s+/,$Z=/[*_`~]+/g,eQ=/\s+/g;function tQ(e){return e.replace(QZ,``).replace($Z,``).replace(eQ,` `).trim()}var nQ={sage:`#abcfb8`,ochre:`#edbf7f`,terracotta:`#ffb4a1`,neutral:`#8b928c`,dimNeutral:`#6e7370`,onSurface:`#e5e2e1`,surface:`#111111`},rQ={concept:nQ.sage,component:nQ.ochre,bug:nQ.terracotta,tool:nQ.neutral,file:nQ.neutral,spore:nQ.sage,session:nQ.ochre,other:nQ.dimNeutral},iQ=nQ.dimNeutral,aQ=24,oQ=60,sQ=12,cQ=10,lQ=8,uQ=1.5,dQ=.25,fQ=.7,pQ=9,mQ=.7,hQ=4,gQ=.6,_Q=1e4,vQ=120,yQ=.2,bQ=600,xQ=300,SQ=.95,CQ=1.2,wQ=50,TQ=20,EQ={concept:`Concept`,component:`Component`,bug:`Bug`,tool:`Tool`,file:`File`,spore:`Spore`,session:`Session`,other:`Other`};function DQ(e,t){return t?oQ*1.2:aQ+Math.min(e/sQ,1)*(oQ-aQ)}function OQ(e){let t=tQ(e);return t.length<=TQ?t:t.slice(0,TQ-1)+`…`}function kQ(e){return rQ[e?.toLowerCase()]??iQ}function AQ(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)%360}function jQ(e){e.elements().removeClass(`faded`),e.elements().unselect(),e.edges().style({"line-opacity":dQ,"text-opacity":0,width:uQ})}function MQ(e,t){if(!t){jQ(e);return}let n=e.$id(t);if(n.length===0){jQ(e);return}jQ(e),n.select();let r=n.closedNeighborhood();e.elements().not(r).addClass(`faded`),n.connectedEdges().style({"line-opacity":fQ,"text-opacity":0,width:2})}function NQ({nodes:e,edges:t,onNodeSelect:n,centerId:r,centerNodeType:i,selectedNodeId:a}){let o=(0,W.useRef)(null),s=(0,W.useRef)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(null),u=(0,W.useRef)(n);u.current=n;let d=(0,W.useMemo)(()=>new Map(e.map(e=>[e.id,e])),[e]),f=(0,W.useMemo)(()=>{let n=new Map;for(let t of e)n.set(t.id,0);for(let e of t)n.set(e.source_id,(n.get(e.source_id)??0)+1),n.set(e.target_id,(n.get(e.target_id)??0)+1);return n},[e,t]),p=(0,W.useMemo)(()=>[{selector:`node`,style:{label:`data(label)`,"background-color":e=>kQ(e.data(`type`)),"background-opacity":.9,color:nQ.onSurface,"font-size":cQ,"font-family":`Inter, system-ui, sans-serif`,"text-valign":`bottom`,"text-margin-y":lQ,"text-outline-color":nQ.surface,"text-outline-width":2,"text-outline-opacity":.8,"text-wrap":`wrap`,"text-max-width":`120px`,width:`data(nodeSize)`,height:`data(nodeSize)`,"border-width":0,"border-color":nQ.sage,"border-opacity":0,"overlay-opacity":0}},{selector:`node.center`,style:{"border-width":2,"border-color":nQ.onSurface,"border-opacity":.4,"text-outline-color":nQ.surface,"text-outline-width":3,"font-weight":`bold`}},{selector:`node:active`,style:{"overlay-opacity":.08,"overlay-color":nQ.sage}},{selector:`node:selected`,style:{"border-width":hQ,"border-color":e=>kQ(e.data(`type`)),"border-opacity":gQ,"background-opacity":1}},{selector:`edge`,style:{width:uQ,"line-color":nQ.neutral,"line-opacity":dQ,"curve-style":`unbundled-bezier`,"control-point-distances":[40],"control-point-weights":[.5],"target-arrow-shape":`triangle`,"target-arrow-color":nQ.neutral,"arrow-scale":mQ,label:`data(label)`,"font-size":pQ,"font-family":`Inter, system-ui, sans-serif`,color:nQ.neutral,"text-opacity":0,"text-rotation":`autorotate`,"text-margin-y":-8,"text-outline-color":nQ.surface,"text-outline-width":2,"text-outline-opacity":.7}},{selector:`edge:active`,style:{"text-opacity":1,"line-opacity":fQ}},{selector:`node.faded`,style:{opacity:.3}},{selector:`edge.faded`,style:{opacity:.1}}],[]),m=(0,W.useCallback)(n=>{let i=o.current?.getBoundingClientRect(),a={x:i?i.width/2:0,y:i?i.height/2:0};return[...e.map(e=>{let i=EQ[e.type?.toLowerCase()]??EQ.other,o=e.id===r,s=n?.get(e.id);if(!s){let i=t.find(t=>t.source_id===e.id||t.target_id===e.id),o=i?i.source_id===e.id?i.target_id:i.source_id:r,c=(o&&n?.get(o))??a,l=AQ(e.id)*Math.PI/180,u=o===r?150:110;s={x:c.x+Math.cos(l)*u,y:c.y+Math.sin(l)*u}}return{data:{id:e.id,label:`${OQ(e.name)}\n${i}`,fullLabel:e.name,type:e.type,isCenter:o,degree:f.get(e.id)??0,nodeSize:DQ(f.get(e.id)??0,o)},position:s,classes:o?`center`:``}}),...t.map((e,t)=>({data:{id:`edge-${t}`,source:e.source_id,target:e.target_id,label:e.label??``,weight:e.weight??1}}))]},[r,f,t,e]),h=(0,W.useCallback)((e,t)=>{if(!t){e.resize(),MQ(e,a??null);return}let n=r&&i===`session`?e.layout({name:`cose`,animate:!0,animationDuration:bQ,nodeRepulsion:()=>_Q*1.5,idealEdgeLength:()=>vQ*1.35,gravity:yQ*.75,nodeDimensionsIncludeLabels:!0,fit:!0,padding:wQ*1.2,randomize:!1}):r?e.layout({name:`concentric`,animate:!0,animationDuration:xQ,fit:!0,padding:wQ,spacingFactor:CQ,avoidOverlap:!0,concentric:e=>e.id()===r?3:e.closedNeighborhood().some(e=>e.isNode()&&e.id()===r)?2:1,levelWidth:()=>1,nodeDimensionsIncludeLabels:!0}):e.layout({name:`cose`,animate:!0,animationDuration:bQ,nodeRepulsion:()=>_Q,idealEdgeLength:()=>vQ,gravity:yQ,nodeDimensionsIncludeLabels:!0,fit:!0,padding:wQ});n.on(`layoutstop`,()=>{let e=s.current;if(!e)return;let t=e.$(`node.center`);if(t.length>0){let n=t.closedNeighborhood();e.fit(n,wQ*1.5),e.zoom()<SQ&&(e.zoom(SQ),e.center(t))}else e.fit(void 0,wQ);MQ(e,a??null)}),n.run()},[r,i,a]);return(0,W.useEffect)(()=>{let e=o.current;if(!e)return;function t(){let t=e.getBoundingClientRect();if(t.width===0||t.height===0||s.current)return;let n=ZZ({container:e,elements:[],style:p,layout:{name:`preset`},userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,minZoom:.3,maxZoom:3});n.on(`tap`,`node`,e=>{let t=e.target.data(),n=d.get(t.id);u.current?.(n??{id:t.id,name:t.fullLabel??t.label,type:t.type})}),n.on(`tap`,e=>{e.target===n&&u.current?.(null)}),n.on(`mouseover`,`edge`,e=>{e.target.style(`text-opacity`,1),e.target.style(`line-opacity`,fQ)}),n.on(`mouseout`,`edge`,e=>{let t=n.$(`node:selected`);t.length>0&&t.connectedEdges().contains(e.target)||(e.target.style(`text-opacity`,0),e.target.style(`line-opacity`,dQ))}),s.current=n}return t(),c.current?.disconnect(),c.current=new ResizeObserver(()=>{s.current?s.current.resize():t()}),c.current.observe(e),()=>{c.current?.disconnect(),c.current=null,s.current?.destroy(),s.current=null}},[d,p]),(0,W.useEffect)(()=>{let e=s.current;if(!e)return;let t=new Map;e.nodes().forEach(e=>{t.set(e.id(),{x:e.position(`x`),y:e.position(`y`)})}),e.elements().remove(),e.add(m(t));let n=l.current!==(r??null);l.current=r??null,h(e,n||t.size===0)},[m,r,h]),(0,W.useEffect)(()=>{let e=s.current;e&&MQ(e,a??null)},[a]),{containerRef:o,resetView:(0,W.useCallback)(()=>{let e=s.current;e&&(jQ(e),e.fit(void 0,wQ))},[])}}function PQ({nodes:e,edges:t,onNodeSelect:n,selectedNode:r,centerId:i,centerNodeType:a,isLoading:o}){let{containerRef:s,resetView:c}=NQ({nodes:e,edges:t,onNodeSelect:n,centerId:i,centerNodeType:a,selectedNodeId:r?.id??null});return(0,G.jsxs)(`div`,{className:`absolute inset-0`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 rounded-md bg-surface-container-lowest`,style:{backgroundImage:`radial-gradient(circle at 2px 2px, rgba(139, 146, 140, 0.05) 1px, transparent 0)`,backgroundSize:`40px 40px`}}),(0,G.jsx)(`div`,{ref:s,className:`absolute inset-0 rounded-md`,style:{width:`100%`,height:`100%`}}),(0,G.jsxs)(`div`,{className:`absolute bottom-3 left-3 z-10 flex items-center gap-3`,children:[e.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 font-mono text-[10px] text-on-surface-variant/60 mr-1`,children:[(0,G.jsxs)(`span`,{children:[e.length,` nodes`]}),(0,G.jsxs)(`span`,{children:[t.length,` edges`]})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:c,className:`gap-1.5 h-7 text-[10px] px-2 bg-surface-container-high/40 backdrop-blur-xs`,children:[(0,G.jsx)($a,{className:`h-3 w-3`}),`Reset View`]})]}),!o&&e.length===0&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No nodes to display`})})]})}var FQ=400,IQ={concept:`default`,component:`warning`,bug:`destructive`,tool:`secondary`,file:`secondary`,spore:`default`,session:`warning`},LQ={concept:`bg-primary`,component:`bg-secondary`,bug:`bg-tertiary`,tool:`bg-outline`,file:`bg-outline`,spore:`bg-primary`,session:`bg-secondary`};function RQ({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`flex justify-between items-baseline py-1`,children:[(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface text-right max-w-[160px] truncate`,children:t})]})}function zQ(e){return e.type===`session`?`/sessions/${e.id}`:e.type===`spore`?`/mycelium?tab=spores&spore=${e.id}`:null}function BQ({node:e,edges:t,nodes:n,metadata:r,markdownPreview:i,connectedSpores:a,onClose:o,onNodeSelect:s,onFocusNode:c,onNavigateToSpore:l,isConnectionsLoading:u}){let d=Nn();if(!e)return null;let f=e.type.toLowerCase(),p=IQ[f]??`secondary`,m=LQ[f]??`bg-outline`,h=new Map((n??[]).map(e=>[e.id,e])),g=[];for(let n of t??[])if(n.source_id===e.id){let e=h.get(n.target_id);e&&g.push({nodeId:e.id,nodeName:e.name,nodeType:e.type,edgeLabel:n.label??`connected`,direction:`outgoing`,status:e.status})}else if(n.target_id===e.id){let e=h.get(n.source_id);e&&g.push({nodeId:e.id,nodeName:e.name,nodeType:e.type,edgeLabel:n.label??`connected`,direction:`incoming`,status:e.status})}g.sort((e,t)=>e.nodeName.localeCompare(t.nodeName));let _=i??e.content,v=_&&_.length>FQ?_.slice(0,FQ)+`…`:_,y=e.type===`spore`?`Observation`:e.type===`session`?`Summary`:`Notes`;return(0,G.jsxs)(Q,{glass:!0,className:`absolute top-3 right-3 bottom-3 z-20 w-[320px] overflow-y-auto flex flex-col shadow-lg border border-outline-variant/15 rounded-md`,children:[(0,G.jsx)(`div`,{className:`p-4 pb-3`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,G.jsx)(`div`,{className:`h-2 w-2 rounded-full ${m} shrink-0`}),(0,G.jsx)(X,{variant:p,className:`text-[10px] uppercase`,children:e.observation_type??e.type})]}),(0,G.jsx)(`h2`,{className:`font-serif text-lg text-on-surface leading-tight break-words`,children:tQ(e.name)}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-3 mt-2`,children:zQ(e)&&(0,G.jsxs)(`button`,{onClick:()=>{e.type===`spore`&&l?l(e.id):d(zQ(e))},className:`inline-flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-primary transition-colors group cursor-pointer`,children:[(0,G.jsxs)(`span`,{children:[`View `,e.type]}),(0,G.jsx)(va,{className:`h-3 w-3 group-hover:translate-x-0.5 transition-transform`})]})})]}),o&&(0,G.jsx)(`button`,{onClick:o,className:`shrink-0 rounded-md p-1 text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high transition-colors`,children:(0,G.jsx)(So,{className:`h-4 w-4`})})]})}),(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-0.5`,children:[(0,G.jsx)(MM,{children:`Metadata`}),(0,G.jsxs)(`div`,{className:`mt-1.5`,children:[(0,G.jsx)(RQ,{label:`Type`,value:e.observation_type??e.type}),(0,G.jsx)(RQ,{label:`ID`,value:e.id.slice(0,12)+`…`}),e.status&&(0,G.jsx)(RQ,{label:`Status`,value:e.status}),e.created_at!=null&&(0,G.jsx)(RQ,{label:`Created`,value:new Date(e.created_at).toLocaleDateString()}),e.mention_count!=null&&e.mention_count>0&&(0,G.jsx)(RQ,{label:`Mentions`,value:String(e.mention_count)}),(0,G.jsx)(RQ,{label:`Connections`,value:String(g.length)}),e.depth!==void 0&&(0,G.jsx)(RQ,{label:`Depth`,value:String(e.depth)}),r&&Object.entries(r).map(([e,t])=>(0,G.jsx)(RQ,{label:e,value:t},e))]})]}),v&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-1.5`,children:[(0,G.jsx)(MM,{children:y}),(0,G.jsx)(Q,{level:`lowest`,className:`p-3`,children:(0,G.jsx)(fO,{content:v,className:`text-xs leading-relaxed text-on-surface-variant`})})]})]}),(g.length>0||u)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(MM,{children:[`Connections (`,g.length,`)`]}),u&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-3 w-3 animate-spin`}),`Updating`]})]}),(0,G.jsx)(`div`,{className:`space-y-1`,children:g.map((e,t)=>(0,G.jsxs)(`div`,{className:`group w-full rounded-md border border-transparent px-2 py-2 transition-colors hover:border-outline-variant/10 hover:bg-surface-container-high/50`,children:[(0,G.jsx)(`button`,{type:`button`,className:`w-full text-left`,onClick:()=>{let t=h.get(e.nodeId);s?.(t??{id:e.nodeId,name:e.nodeName,type:e.nodeType,status:e.status},`inspector`)},children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`div`,{className:`mt-1 h-2 w-2 rounded-full ${LQ[e.nodeType.toLowerCase()]??`bg-outline`} shrink-0`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate font-sans text-xs text-on-surface transition-colors group-hover:text-primary`,children:tQ(e.nodeName)}),(0,G.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 text-[9px] uppercase tracking-wider text-on-surface-variant/60`,children:[(0,G.jsx)(`span`,{children:e.nodeType}),(0,G.jsx)(`span`,{children:`•`}),(0,G.jsx)(`span`,{children:e.edgeLabel})]})]}),(0,G.jsx)(qi,{className:`mt-0.5 h-3 w-3 shrink-0 text-on-surface-variant/50 ${e.direction===`incoming`?`rotate-180`:``}`})]})}),(0,G.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-2 text-[10px] uppercase tracking-wide`,onClick:()=>{let t=h.get(e.nodeId);c?.(t??{id:e.nodeId,name:e.nodeName,type:e.nodeType,status:e.status})},children:`Focus`})})]},`${e.nodeId}-${e.edgeLabel}-${t}`))})]})]}),a&&a.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-1.5`,children:[(0,G.jsx)(MM,{children:`Connected Spores`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:a.map(e=>(0,G.jsx)(X,{variant:`secondary`,className:`cursor-pointer text-[10px] hover:bg-surface-container-highest transition-colors`,children:e.name},e.id))})]})]})]})}function VQ({searchPlaceholder:e=`Search...`,searchValue:t,onSearchChange:n,filters:r=[],filterValues:i={},onFilterChange:a,inputRef:o}){return(0,G.jsxs)(Q,{level:`bright`,className:`flex items-center gap-3 px-4 py-2 rounded-md`,children:[(0,G.jsx)(no,{className:`h-3.5 w-3.5 text-on-surface-variant shrink-0`}),(0,G.jsx)(Kf,{ref:o,placeholder:e,value:t,onChange:e=>n(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1`,"aria-label":e}),r.map(e=>(0,G.jsx)(`div`,{className:`w-40 shrink-0`,children:(0,G.jsxs)(c_,{value:i[e.key]??`all`,onValueChange:t=>a?.(e.key,t),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:e.label})}),(0,G.jsx)(d_,{children:e.options.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]})},e.key))]})}function HQ(e){switch(e){case`wisdom`:return`bg-primary/15 text-primary`;case`discovery`:return`bg-primary/15 text-primary`;case`decision`:return`bg-secondary/15 text-secondary`;case`trade_off`:return`bg-secondary/15 text-secondary`;case`gotcha`:return`bg-tertiary/15 text-tertiary`;case`bug_fix`:return`bg-tertiary/15 text-tertiary`;default:return`bg-surface-container text-on-surface-variant`}}function UQ(e){switch(e){case`active`:return`bg-primary/15 text-primary`;case`consolidated`:return`bg-surface-container-high text-on-surface-variant`;case`superseded`:return`bg-tertiary/10 text-tertiary/70`;case`obsolete`:return`bg-surface-container text-on-surface-variant/60`;default:return`bg-surface-container text-on-surface-variant`}}function WQ(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}var GQ=120,KQ=1e3,qQ=[{key:`type`,label:`Type`,options:[`all`,`gotcha`,`decision`,`discovery`,`trade_off`,`bug_fix`].map(e=>({value:e,label:e===`all`?`All types`:WQ(e)}))},{key:`status`,label:`Status`,options:[`all`,`active`,`superseded`,`consolidated`,`obsolete`].map(e=>({value:e,label:e===`all`?`All statuses`:WQ(e)}))}];function JQ(e){return new Date(e*KQ).toLocaleDateString()}function YQ({spore:e,onClick:t,isSelected:n}){return(0,G.jsx)(Q,{level:n?`high`:`low`,className:J(`p-4 cursor-pointer transition-all duration-150 hover:bg-surface-container-high hover:shadow-[inset_3px_0_0_var(--primary)] rounded-lg`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,n&&`ring-1 ring-primary/30`),onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},tabIndex:0,role:`button`,"aria-label":`${WQ(e.observation_type)} spore: ${ev(e.content,GQ)}`,"aria-pressed":n,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold`,HQ(e.observation_type)),children:WQ(e.observation_type)}),(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold`,UQ(e.status)),children:WQ(e.status)}),e.importance!==null&&(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:e.importance.toFixed(1)}),(0,G.jsx)(xM,{annotation:e.release_state})]}),(0,G.jsx)(fO,{content:e.content,compact:!0,className:`text-on-surface line-clamp-2`})]}),(0,G.jsxs)(`div`,{className:`shrink-0 text-right space-y-1`,children:[e.session_id&&(0,G.jsx)(`div`,{className:`font-mono text-xs text-on-surface-variant`,children:tv(e.session_id)}),(0,G.jsx)(`div`,{className:`font-sans text-xs text-on-surface-variant`,children:JQ(e.created_at)})]})]})})}function XQ(){return(0,G.jsx)(Q,{level:`low`,className:`p-4 rounded-lg`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`div`,{className:`h-5 w-16 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-5 w-14 animate-pulse rounded bg-surface-container`})]}),(0,G.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-surface-container`})]}),(0,G.jsxs)(`div`,{className:`shrink-0 space-y-1`,children:[(0,G.jsx)(`div`,{className:`h-3 w-14 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-16 animate-pulse rounded bg-surface-container`})]})]})})}function ZQ({onSelectSpore:e,selectedSporeId:t}){let{searchInput:n,debouncedSearch:r,filterValues:i,offset:a,setOffset:o,handleSearchChange:s,handleFilterChange:c,activeFilter:l}=GN({initialFilters:{type:`all`,status:`all`}}),u=l(`type`),d=l(`status`),{data:f,isLoading:p,isError:m,error:h}=hN({type:u,status:d,search:r,limit:50,offset:a}),g=f?.spores??[],_=f?.total??0;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(VQ,{searchPlaceholder:`Search spores...`,searchValue:n,onSearchChange:s,filters:qQ,filterValues:i,onFilterChange:c}),m?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-destructive`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load spores`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:h instanceof Error?h.message:`Unknown error`})]}):(0,G.jsx)(`div`,{className:`space-y-2`,children:p?[1,2,3,4,5].map(e=>(0,G.jsx)(XQ,{},e)):g.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(lo,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:_===0&&!r&&!u&&!d?`No spores yet`:`No matching spores`}),_===0&&!r&&!u&&!d&&(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Spores are extracted from session activity by the agent`})]}):g.map(n=>(0,G.jsx)(YQ,{spore:n,onClick:()=>e(n),isSelected:n.id===t},n.id))}),(0,G.jsx)(fM,{total:_,offset:a,limit:50,onPageChange:o})]})}var QQ=12,$Q=8;function e$({type:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold`,HQ(e)),children:WQ(e)})}function t$({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold`,UQ(e)),children:WQ(e)})}function n$({label:e,value:t,children:n}){return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 py-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-on-surface-variant`,children:e}),n??(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface text-right break-all`,children:t})]})}function r$({id:e,onBack:t,onNavigateToSpore:n,onNavigateToGraph:r}){let i=Nn(),{data:a,isLoading:o,isError:s,error:c}=gN(e);if(o)return(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans`,children:`Loading spore...`})]});if(s||!a)return(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-destructive`,children:[(0,G.jsx)(ra,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Spore not found`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:c instanceof Error?c.message:`Unknown error`})]});let l=(()=>{if(!a.tags)return[];if(a.tags.startsWith(`[`))try{return JSON.parse(a.tags)}catch{}return a.tags.split(`,`).map(e=>e.trim()).filter(Boolean)})();return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ki,{className:`h-4 w-4`}),`Spores`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(e$,{type:a.observation_type}),(0,G.jsx)(t$,{status:a.status}),(0,G.jsx)(xM,{annotation:a.release_state}),a.importance!==null&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Importance: `,(0,G.jsx)(`span`,{className:`text-on-surface font-medium`,children:a.importance.toFixed(1)})]}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant ml-auto`,children:Q_(a.created_at)})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-5`,children:[(0,G.jsx)(MM,{className:`mb-2`,children:`Observation`}),(0,G.jsx)(fO,{content:a.content})]}),a.context&&(0,G.jsxs)(Q,{level:`low`,className:`p-5`,children:[(0,G.jsx)(MM,{className:`mb-2`,children:`Context`}),(0,G.jsx)(fO,{content:a.context})]}),l.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map(e=>(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-surface-container px-2.5 py-0.5 font-sans text-xs text-on-surface-variant`,children:e},e))}),(a.predecessor_id||a.successor_id)&&(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-2`,children:[(0,G.jsx)(MM,{children:`Resolution History`}),a.predecessor_id&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:`Supersedes`}),(0,G.jsxs)(`button`,{className:`font-mono text-primary hover:underline flex items-center gap-1`,onClick:()=>n?.(a.predecessor_id),children:[a.predecessor_id.slice(0,$Q),(0,G.jsx)(qi,{className:`h-3 w-3`})]})]}),a.successor_id&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:`Superseded by`}),(0,G.jsxs)(`button`,{className:`font-mono text-primary hover:underline flex items-center gap-1`,onClick:()=>n?.(a.successor_id),children:[a.successor_id.slice(0,$Q),(0,G.jsx)(qi,{className:`h-3 w-3`})]})]})]}),(0,G.jsxs)(Q,{glass:!0,className:`p-5`,children:[(0,G.jsx)(MM,{className:`mb-2`,children:`Metadata`}),(0,G.jsxs)(`div`,{className:`text-sm`,children:[(0,G.jsx)(n$,{label:`ID`,value:a.id}),(0,G.jsx)(n$,{label:`Created`,value:$_(a.created_at)}),(0,G.jsx)(n$,{label:`Updated`,value:$_(a.updated_at)}),a.session_id&&(0,G.jsx)(n$,{label:`Session`,children:(0,G.jsxs)(`button`,{className:`font-mono text-xs text-primary hover:underline flex items-center gap-1`,onClick:()=>i(`/sessions/${a.session_id}`),children:[a.session_id.slice(0,QQ),(0,G.jsx)(va,{className:`h-3 w-3`})]})}),a.agent_id&&(0,G.jsx)(n$,{label:`Agent`,value:a.agent_id})]})]})]})}var i$=new Set([`spore`,`session`,`other`]),a$=200,o$=`right-[332px]`,s$=6,c$=`h-[calc(100vh-285px)]`,l$=[{id:`graph`,label:`Graph`,description:`connection map`},{id:`spores`,label:`Spores`,description:`captured knowledge`}],u$=`tab`,d$=`spore`,f$=new Set([`graph`,`spores`]);function p$(){let e=new URLSearchParams(window.location.search),t=e.get(u$),n=e.get(d$)??void 0;return{tab:n?`spores`:t&&f$.has(t)?t:`graph`,sporeId:n}}function m$(e,t){let n=new URLSearchParams;e!==`graph`&&n.set(u$,e),t&&n.set(d$,t);let r=n.toString(),i=r?`${window.location.pathname}?${r}`:window.location.pathname;window.history.pushState(null,``,i)}function h$(e){if(!e)return[];let t=[];return`center`in e&&e.center&&t.push(e.center),e.nodes&&t.push(...e.nodes),t}function g$(e,t){let n=e.findIndex(e=>e.id===t.id);return n>=0?[...e.slice(0,n),t].slice(-3):[...e,t].slice(-3)}function _$({onNavigateToSpore:e}){let[t,n]=(0,W.useState)(`focus`),[r,i]=(0,W.useState)(null),[a,o]=(0,W.useState)(1),[s]=(0,W.useState)(new Set(i$)),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)([]),{data:m,isLoading:h}=yN(),g=t===`focus`&&r!==null,{data:_,isLoading:v}=vN(t===`global`||c.length>0),{data:y,isLoading:b}=_N(r??void 0,a,g),x=u!==null&&u.id!==r,{data:S,isLoading:C}=_N(u?.id,1,x),w=t===`global`?_:y,T=t===`global`?v:h||g&&b,E=(_?.nodes?.length??0)>a$;(0,W.useEffect)(()=>{if(!r&&m?.recommended_id){let e=m.seeds.find(e=>e.id===m.recommended_id),t=(e?.type===`session`?m.seeds.find(e=>e.type!==`session`):null)??e??m.seeds[0];t&&(i(t.id),d(t),p(e=>g$(e,t)))}},[r,m]),(0,W.useEffect)(()=>{t===`focus`&&r&&y?.center?.id===r&&(d(y.center),p(e=>e.length===0?[y.center]:g$(e,y.center)))},[r,y,t]);let D=u?.id===r?y:S,O=u?.id===r?b:C,k=(0,W.useMemo)(()=>h$(D),[D]),A=D?.edges??[],j=(0,W.useMemo)(()=>h$(w),[w]),M=(0,W.useMemo)(()=>j.filter(e=>{let t=e.type.toLowerCase(),n=i$.has(t)?t:`other`;return!!s.has(n)}),[j,s]),N=(0,W.useMemo)(()=>{let e=w?.edges??[],t=new Set(M.map(e=>e.id));return e.filter(e=>t.has(e.source_id)&&t.has(e.target_id))},[w?.edges,M]),P=(0,W.useCallback)((e,t=`canvas`)=>{d(e)},[t]),F=(0,W.useCallback)(e=>{p(t=>g$(t,e)),i(e.id),d(e),n(`focus`)},[]),I=(0,W.useCallback)(()=>{n(`global`)},[]),L=(0,W.useCallback)(()=>{!r&&u&&(p(e=>g$(e,u)),i(u.id)),n(`focus`)},[r,u]),R=(0,W.useCallback)(e=>{p(t=>{let n=t.findIndex(t=>t.id===e.id);return n>=0?t.slice(0,n+1):t}),i(e.id),d(e),n(`focus`)},[]),ee=(0,W.useCallback)(()=>{p(e=>{if(e.length<=1)return e;let t=e.slice(0,-1),r=t[t.length-1];return r&&(i(r.id),d(r),n(`focus`)),t})},[]),z=(0,W.useMemo)(()=>{let e=_?.nodes??[];return e.length>0?e:j},[_?.nodes,j]),B=c?z.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t).filter(e=>tQ(e.name).toLowerCase().includes(c.toLowerCase())).slice(0,s$):[];return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg border border-outline-variant/20 bg-surface-container/72 px-4 py-3 shadow-xs`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative min-w-[260px] flex-1 max-w-[420px]`,children:[(0,G.jsx)(no,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-on-surface-variant/60`}),(0,G.jsx)(Kf,{placeholder:`Find a node or idea...`,value:c,onChange:e=>l(e.target.value),className:`h-9 pl-9`})]}),(0,G.jsxs)(`div`,{className:`flex rounded-lg border border-outline-variant/10 bg-surface-container-high p-1 shadow-xs`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:J(`h-8 px-3 gap-1.5 transition-all`,t===`global`?`bg-surface-container-lowest text-primary shadow-xs`:`text-on-surface-variant hover:text-on-surface`),onClick:I,children:[(0,G.jsx)(Ga,{className:`h-3.5 w-3.5`}),(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Overview`})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!r&&!u,className:J(`h-8 px-3 gap-1.5 transition-all`,t===`focus`?`bg-surface-container-lowest text-primary shadow-xs`:`text-on-surface-variant hover:text-on-surface`,!r&&!u&&`cursor-not-allowed opacity-50`),onClick:L,children:[(0,G.jsx)(po,{className:`h-3.5 w-3.5`}),(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Focus`})]})]}),t===`focus`&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1 rounded-lg border border-outline-variant/10 bg-surface-container-high p-1 shadow-xs`,children:[(0,G.jsx)(`span`,{className:`px-2 font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`Depth`}),[1,2,3].map(e=>(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:J(`h-7 min-w-7 rounded-md border px-2 font-mono text-[10px] transition-all`,a===e?`border-primary/40 bg-primary/15 text-primary shadow-xs font-bold`:`border-transparent text-on-surface-variant hover:border-outline-variant/20 hover:text-on-surface`),onClick:()=>o(e),children:e},e))]})]}),B.length>0&&(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 pt-1`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.16em] text-on-surface-variant`,children:`Jump To`}),B.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>F(e),className:J(`max-w-[220px] truncate rounded-full border px-3 py-1 text-[11px] transition-colors`,u?.id===e.id?`border-primary/40 bg-primary/10 text-on-surface`:`border-outline-variant/20 bg-surface-container-low/50 text-on-surface-variant hover:text-on-surface`),title:tQ(e.name),children:tQ(e.name)},e.id))]}),c&&B.length===0&&_&&(0,G.jsxs)(`div`,{className:`mt-3 border-t border-outline-variant/10 pt-3 text-sm text-on-surface-variant`,children:['No graph nodes matched `"',c,'"`.']}),f.length>0&&(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-outline-variant/10 pt-3`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.16em] text-on-surface-variant`,children:`Trail`}),f.length>1&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`h-7 shrink-0 px-2 text-[10px]`,onClick:ee,children:`Back`}),f.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>R(e),className:J(`max-w-[180px] truncate rounded-full border px-3 py-1 text-[11px] transition-colors`,r===e.id?`border-primary/40 bg-primary/10 text-on-surface`:`border-outline-variant/20 bg-surface-container-low/50 text-on-surface-variant hover:text-on-surface`),title:tQ(e.name),children:tQ(e.name)},e.id))]})]}),(0,G.jsxs)(`div`,{className:J(`relative`,c$),children:[T&&(0,G.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center rounded-md bg-surface-container-lowest/50 backdrop-blur-[2px] transition-opacity`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent`}),(0,G.jsxs)(`span`,{className:`text-xs font-mono animate-pulse text-on-surface-variant`,children:[`Cultivating `,t,` graph...`]})]})}),(0,G.jsx)(`div`,{className:J(`absolute inset-y-3 left-3`,u?o$:`right-3`),children:(0,G.jsx)(PQ,{nodes:M,edges:N,onNodeSelect:P,selectedNode:u,centerId:t===`focus`?r:null,centerNodeType:t===`focus`?y?.center?.type??null:null,isLoading:T})}),t===`global`&&E&&(0,G.jsxs)(`div`,{className:J(`absolute bottom-3 left-3 z-10 flex max-w-[280px] flex-col items-start gap-2 rounded-lg border border-warning/20 bg-warning-container/80 p-3 text-on-warning-container shadow-lg backdrop-blur-xs`,u?o$:`right-3`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ma,{className:`h-4 w-4 shrink-0 text-warning`}),(0,G.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-wider`,children:`Overview Snapshot`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-on-warning-container/80`,children:[`This overview still contains `,_?.nodes?.length,` nodes. Use Focus mode for navigation and step through connections from the drawer.`]}),(0,G.jsx)(Y,{variant:`destructive`,size:`sm`,className:`mt-1 h-7 w-full px-3 text-[10px]`,onClick:L,children:`Return to Focus`})]}),(0,G.jsx)(BQ,{node:u,edges:A,nodes:k,onClose:()=>{d(null)},onNodeSelect:P,onFocusNode:F,onNavigateToSpore:e,isConnectionsLoading:O})]})]})}function v$(){let e=An(),t=p$(),[n,r]=(0,W.useState)(t.tab),[i,a]=(0,W.useState)(t.sporeId?{id:t.sporeId}:null),o=(0,W.useRef)(!1),s=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(!o.current){o.current=!0;return}if(s.current){s.current=!1;return}m$(n,i?.id)},[n,i?.id]),(0,W.useEffect)(()=>{s.current=!0;let e=p$();r(e.tab),a(e.sporeId?{id:e.sporeId}:null)},[e.search,e.key]);function c(e){a(e)}function l(){a(null)}function u(e){a({id:e})}function d(e){r(e),e!==`spores`&&a(null)}return(0,G.jsxs)(`div`,{className:`p-6 space-y-6`,children:[(0,G.jsx)(YN,{title:`Mycelium`,subtitle:`Derived intelligence — spores, entity graph, and synthesized context.`}),(0,G.jsx)(PP,{tabs:l$.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:e=>d(e),columns:2}),n===`graph`&&(0,G.jsx)(_$,{onNavigateToSpore:e=>{r(`spores`),a({id:e})}}),n===`spores`&&(i?(0,G.jsx)(r$,{id:i.id,onBack:l,onNavigateToSpore:u}):(0,G.jsx)(ZQ,{onSelectSpore:c}))]})}function y$({chip:e}){return(0,G.jsxs)(`span`,{"data-capability":e.id,title:e.title,className:J(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors`,`border-outline-variant/30 bg-surface-container text-on-surface`,`hover:bg-surface-container-high hover:border-outline-variant/60`),children:[(0,G.jsx)(wk,{tone:e.tone,sizePx:5}),(0,G.jsx)(`span`,{children:e.label})]})}function b$({chip:e,href:t}){return(0,G.jsx)(ri,{to:t,"aria-label":`${e.label} — open feature`,className:`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40 rounded-full`,children:(0,G.jsx)(y$,{chip:e})})}function x$(e){let t=[],n=`agent=${encodeURIComponent(e.name)}`;if(e.supportsSessions&&t.push({id:`sessions`,label:`Sessions`,to:`/sessions?${n}`,tone:`sage`,title:`Prompts, tool calls, and responses captured from this symbiont`}),e.supportsSessionStartInjection&&(t.push({id:`cortex-instructions`,label:`Cortex Instructions`,to:`/cortex?tab=instructions`,tone:`sage`,title:`Project-scoped instructions injected at session start`}),t.push({id:`cortex-digest`,label:`Cortex Digest`,to:`/cortex?tab=digest`,tone:`sage`,title:`Project state digest injected at session start`})),e.supportsCanopyInjection&&t.push({id:`cortex-canopy`,label:`Cortex Canopy`,to:`/cortex?tab=canopy`,tone:`sage`,title:`File-read context injected on tool use`}),e.supportsSubagentStartInjection&&t.push({id:`cortex-subagent`,label:`Subagent context`,to:`/cortex?tab=instructions`,tone:`sage`,title:`Myco can inject a Cortex primer when this symbiont starts a subagent`}),e.supportsSessions&&t.push({id:`cortex-spores`,label:`Cortex Spores`,to:`/mycelium?tab=spores`,tone:`sage`,title:`Durable knowledge mined from this symbiont’s sessions`}),e.supportsPlanCapture&&t.push({id:`plans`,label:`Plans`,to:`/sessions?${n}&has_plan=true`,tone:`sage`,title:`Plans this symbiont produced`}),e.supportsSkills&&t.push({id:`skills`,label:`Skills`,to:`/skills`,tone:`sage`,title:`Myco skills exposed inside this symbiont`}),e.supportsMcp){let n=e.mcpActive===!0;t.push({id:`mcp`,label:n?`MCP`:`MCP (quiet)`,to:`/skills`,tone:n?`sage`:`outline`,title:n?`Myco MCP tools called within the last 7 days`:`MCP is configured but no recent tool calls were observed`})}return t}function S$(e){return e.detected?e.globallyInstalled?{label:`Available`,tone:`sage`}:{label:`Detected`,tone:`ochre`}:{label:`Not detected`,tone:`outline`}}function C$({symbiont:e,onSetOverride:t,overrideDisabled:n=!1,overrideDisabledReason:r,busy:i=!1}){let a=S$(e),o=ys(),s=(0,W.useMemo)(()=>x$(e),[e]);function c(e){t(e)}return(0,G.jsx)(uM,{accent:`sage`,interactive:!1,"data-symbiont":e.name,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5 min-w-0 flex-1`,children:[(0,G.jsx)(wk,{tone:a.tone,className:`mt-1.5 shrink-0`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 flex-wrap`,children:[(0,G.jsx)(`h3`,{className:`font-serif italic text-sm text-on-surface truncate leading-snug`,children:e.displayName}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:e.name}),(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:[`· `,a.label]})]}),e.detected&&!e.globallyInstalled&&(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:[`Not connected yet — use `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Re-detect now`}),` above to wire Myco into this agent, or run `,(0,G.jsx)(`code`,{className:`rounded bg-surface-container px-1 py-0.5 font-mono text-[11px]`,children:`myco update`}),`.`]}),s.length>0&&(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:s.map(e=>(0,G.jsx)(b$,{chip:e,href:o(e.to)},e.id))})]})]}),e.detected&&(0,G.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,title:n?r:void 0,children:(0,G.jsx)(XN,{checked:e.enabled,onCheckedChange:c,disabled:i||n})})]})})}function w$(){let e=We(),t=_s();return st({mutationFn:async e=>{if(!t)throw Error(`No project selected`);return ns(`/projects/${t.project.project_id}/symbionts-customization`,e)},onSuccess:()=>{e.invalidateQueries({queryKey:[`symbionts`]})}})}function T$(){let e=We(),t=_s();return st({mutationFn:async e=>{if(!t)throw Error(`No project selected`);return rs(`/projects/${t.project.project_id}/symbionts`,e)},onSuccess:()=>{e.invalidateQueries({queryKey:[`symbionts`]})}})}function E$(){let{data:e,isLoading:t,refetch:n}=mM(),r=We(),i=_s(),a=T$(),o=w$(),[s,c]=(0,W.useState)(!1),l=e?.symbionts??[],u=l.filter(e=>e.detected),d=l.filter(e=>!e.detected),f=!!e?.projectCustomizationActive,p=!i;async function m(){c(!0);try{await q(`/symbionts/detect`,{method:`POST`}),await r.invalidateQueries({queryKey:[`symbionts`]}),await n()}finally{c(!1)}}function h(e){p||o.mutate({enabled:e})}let g=o.isPending,_=a.isPending||g,v=p||!f,y=p?`Select a project to override this symbiont per-project.`:f?void 0:`Turn on "Customize for this project" to override individual symbionts here.`;return(0,G.jsxs)(bj,{children:[(0,G.jsx)(YN,{title:`Symbionts`,description:`Coding agents Myco supports on this machine, and the Myco features available for each.`,actions:(0,G.jsxs)(Y,{onClick:m,disabled:s,variant:`outline`,size:`sm`,children:[(0,G.jsx)(Qa,{className:`h-4 w-4 mr-1.5 ${s?`animate-spin`:``}`}),s?`Detecting…`:`Re-detect now`]})}),(0,G.jsx)(Q,{className:`px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-sans text-sm text-on-surface`,children:`Customize for this project`}),(0,G.jsx)(`div`,{className:`mt-0.5 font-sans text-xs text-on-surface-variant`,children:p?`Select a project from the switcher to enable per-project customization.`:f?`This project overrides which symbionts are active. Toggle individual symbionts below.`:`Using the global defaults. Turn on to override individual symbionts for this project.`})]}),(0,G.jsx)(XN,{checked:f,onCheckedChange:h,disabled:p||g})]})}),t?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant`,children:`Loading…`}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(Q,{children:u.length===0?(0,G.jsx)(`p`,{className:`px-4 py-6 text-sm text-on-surface-variant`,children:`No coding agents detected. Myco picks them up automatically once one is installed.`}):u.map(e=>(0,G.jsx)(C$,{symbiont:e,busy:_,overrideDisabled:v,overrideDisabledReason:y,onSetOverride:t=>{v||a.mutate({symbionts:{[e.name]:{enabled:t}}})}},e.name))}),d.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(MM,{children:`Not detected`}),(0,G.jsx)(Q,{children:d.map(e=>(0,G.jsx)(C$,{symbiont:e,onSetOverride:()=>{}},e.name))})]})]})]})}function D$({selectedCount:e,onClear:t,onCompare:n,minSelected:r=2,primaryLabel:i=`Compare`,nounSingular:a=`run`,nounPlural:o=`runs`,className:s}){if(e===0)return null;let c=e===1?a:o;return(0,G.jsxs)(`div`,{role:`region`,"aria-label":`Selection actions`,className:J(`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3 rounded-full bg-surface-container-high px-4 py-2 shadow-lg border border-outline-variant/30`,s),children:[(0,G.jsxs)(`span`,{className:`font-sans text-sm text-on-surface`,children:[e,` selected`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`default`,className:`gap-2`,disabled:e<r,onClick:n,children:[(0,G.jsx)(Aa,{className:`h-3.5 w-3.5`}),i,` `,e,` `,c]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`gap-2 text-on-surface-variant`,onClick:t,children:[(0,G.jsx)(So,{className:`h-3.5 w-3.5`}),`Clear selection`]})]})}var O$=/[\s/_.:-]+/,k$=/[\s/_.:-]+/g,A$=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function j$(e){return e.trim().toLowerCase()}function M$(e){return j$(e).split(O$).filter(Boolean)}function N$(e){return e.length>1&&e.every(e=>e.length>=2)}function P$(e,t){let n=j$(t);if(n===``)return 0;let r=j$(e.label),i=j$(e.value),a=j$(`${e.label} ${e.value} ${e.searchText??``}`),o=M$(n),s=M$(a),c=n.replace(k$,``),l=a.replace(k$,``);return r===n||i===n?0:r.startsWith(n)||i.startsWith(n)?1:r.includes(n)||i.includes(n)||a.includes(n)?2:s.some(e=>e.startsWith(n))?3:N$(o)&&o.every(e=>a.includes(e))?4:c!==``&&l.includes(c)?5:null}function F$({options:e,value:t,onValueChange:n,placeholder:r=`Select an option`,searchPlaceholder:i=`Search...`,emptyMessage:a=`No matching options.`,disabled:o=!1,sortOptions:s=!1,className:c,triggerClassName:l,contentClassName:u,monospace:d=!1,renderOption:f,renderValue:p}){let[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(``),v=(0,W.useDeferredValue)(g),y=(0,W.useRef)(null),b=(0,W.useRef)(null),x=(0,W.useRef)(null),S=(0,W.useId)(),C=(0,W.useMemo)(()=>{let t=[...e];return s&&t.sort((e,t)=>A$.compare(e.label,t.label)||A$.compare(e.value,t.value)),t},[e,s]),w=(0,W.useMemo)(()=>{let e=C.map(e=>({option:e,rank:P$(e,v)})).filter(e=>e.rank!==null);return e.sort((e,t)=>e.rank-t.rank||A$.compare(e.option.label,t.option.label)||A$.compare(e.option.value,t.option.value)),e.map(e=>e.option)},[v,C]),T=C.find(e=>e.value===t)??(t?{value:t,label:t}:void 0);return(0,W.useEffect)(()=>{if(!m){_(``);return}let e=window.requestAnimationFrame(()=>{x.current?.focus(),x.current?.select()});return()=>window.cancelAnimationFrame(e)},[m]),(0,W.useEffect)(()=>{if(!m)return;let e=e=>{y.current?.contains(e.target)||h(!1)},t=e=>{e.key===`Escape`&&(h(!1),b.current?.focus())};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[m]),(0,G.jsxs)(`div`,{ref:y,className:J(`relative`,c),children:[(0,G.jsxs)(`button`,{ref:b,type:`button`,disabled:o,"aria-expanded":m,"aria-controls":S,className:J(`flex h-9 w-full items-center justify-between rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-left text-sm shadow-xs transition-colors focus-visible:outline-hidden focus-visible:border-primary/40 disabled:cursor-not-allowed disabled:opacity-50`,l),onClick:()=>h(e=>!e),children:[(0,G.jsx)(`span`,{className:J(`truncate text-on-surface`,!T&&`text-on-surface-variant/60`),children:T?p?.(T)??(0,G.jsx)(`span`,{className:J(d&&`font-mono`),children:T.label}):r}),(0,G.jsx)($i,{className:`h-4 w-4 shrink-0 opacity-50`})]}),m?(0,G.jsxs)(`div`,{className:J(`absolute left-0 right-0 z-50 mt-1 rounded-md border border-[var(--ghost-border)] bg-surface-container-highest shadow-ambient`,u),children:[(0,G.jsx)(`div`,{className:`border-b border-[var(--ghost-border)] p-2`,children:(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(no,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-on-surface-variant/70`}),(0,G.jsx)(Kf,{ref:x,value:g,onChange:e=>_(e.target.value),placeholder:i,className:`pl-9`})]})}),(0,G.jsx)(`div`,{id:S,role:`listbox`,className:`max-h-72 overflow-y-auto p-1`,children:w.length>0?w.map(e=>{let r=e.value===t;return(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":r,className:J(`flex w-full items-center justify-between rounded-xs px-2 py-1.5 text-left text-sm text-on-surface outline-hidden transition-colors hover:bg-surface-bright focus-visible:bg-surface-bright`,r&&`bg-surface-bright`),onClick:()=>{n(e.value),h(!1),b.current?.focus()},children:[(0,G.jsx)(`span`,{className:J(`truncate`,d&&`font-mono`),children:f?.(e)??e.label}),r?(0,G.jsx)(Qi,{className:`ml-2 h-4 w-4 shrink-0`}):null]},e.value)}):(0,G.jsx)(`div`,{className:`px-2 py-3 text-sm text-on-surface-variant`,children:a})})]}):null]})}var I$=`claude-sdk`,L$=`openai-agents`,R$=[`anthropic`,`ollama`,`lmstudio`,`openai`,`openrouter`,`openai-compatible`],z$=32768,B$=2e5,V$={anthropic:{harness:I$,supportedHarnesses:[I$],defaultContextWindowTokens:B$},ollama:{harness:I$,supportedHarnesses:[I$,L$],defaultContextWindowTokens:z$},lmstudio:{harness:I$,supportedHarnesses:[I$,L$],defaultContextWindowTokens:z$},openai:{harness:L$,supportedHarnesses:[L$],defaultContextWindowTokens:B$},openrouter:{harness:L$,supportedHarnesses:[L$],defaultContextWindowTokens:B$},"openai-compatible":{harness:L$,supportedHarnesses:[L$],defaultContextWindowTokens:128e3}};function H$(e){if(e)return V$[e]}function U$(e){return H$(e)?.harness}function W$(e){return H$(e)?.supportedHarnesses??[]}function G$(e,t){return!e||!t?!1:W$(e).includes(t)}var K$=3e4,q$=Array.from(new Set(Object.values(V$).flatMap(e=>e.supportedHarnesses)));function J$(e){return q$.includes(e)?e:``}function Y$(e){return R$.includes(e)?e:``}var X$=[`low`,`default`,`high`],Z$={ollama:`http://localhost:11434`,lmstudio:`http://localhost:1234`};function Q$(e,t,n){return e===`openai-compatible`&&t?Z$[t]:n??``}function $$(e){return e?U$(e)??``:``}function e1(e){return e?U$(e):void 0}function t1(e,t){return G$(e||void 0,t||void 0)}function n1(e,t,n){let r=e??`default`;return t?.reasoning_map?.[r]??t?.model??n??``}function r1(e,t,n){let r=t.find(t=>t.type===e),i=new Set(r?.models??[]),a=r?.models?.[0]??``,o=(...e)=>r?.models?.find(t=>e.some(e=>t.includes(e)))??``;return{harness:n&&t1(e,n)?n:r?.harness??$$(e),type:e,localBackend:``,model:a,reasoningLow:i.size>0?e===`anthropic`?o(`haiku`):e===`openai`?o(`nano`):a:``,reasoningDefault:i.size>0?(e===`anthropic`?o(`sonnet`):e===`openai`?o(`mini`):a)||a:``,reasoningHigh:i.size>0?e===`anthropic`?o(`opus`):e===`openai`?(e=>r?.models?.find(t=>t===e)??``)(`gpt-5.4`):``:``,baseUrl:r?.baseUrl??``,contextLength:``}}function i1(e){if(e.type===``)return;let t=e.type===`ollama`||e.type===`lmstudio`||e.type===`openai-compatible`,n={...e.reasoningLow?{low:e.reasoningLow}:{},...e.reasoningDefault?{default:e.reasoningDefault}:{},...e.reasoningHigh?{high:e.reasoningHigh}:{}};return{type:e.type,...e.type===`openai-compatible`&&e.localBackend?{local_backend:e.localBackend}:{},...e.model?{model:e.model}:{},...Object.keys(n).length>0?{reasoning_map:n}:{},...t&&e.baseUrl?{base_url:e.baseUrl}:{},...t&&e.contextLength?{context_length:Number(e.contextLength)}:{}}}function a1(e){return ot({queryKey:xs([`task-config`,e]),queryFn:({signal:t})=>q(`/agent/tasks/${e}/config`,{signal:t}),enabled:e!==void 0,staleTime:K$})}function o1(){return ot({queryKey:xs([`providers`]),queryFn:({signal:e})=>q(`/providers`,{signal:e}),staleTime:K$})}function s1(){return st({mutationFn:e=>ts(`/providers/test`,e)})}function c1(){let e=We();return st({mutationFn:({taskId:e,config:t})=>ns(`/agent/tasks/${e}/config`,t),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`task-config`,n.taskId]})}})}var l1=new Set([`openai-compatible`]);function u1(e,t,n,r){let i=e?l1.has(e):!1,a=!!e&&(!i||!!t);return ot({queryKey:xs([`models`,e,t,n,r]),queryFn:({signal:i})=>{let a=new URLSearchParams({provider:e});return t&&a.set(`base_url`,t),n&&a.set(`type`,n),r&&a.set(`local_backend`,r),q(`/models?${a.toString()}`,{signal:i})},enabled:a,staleTime:Os})}var d1=new Set([`ollama`,`lmstudio`,`openai-compatible`]);function f1({providerType:e,localBackend:t=``,baseUrl:n,model:r,modelPlaceholder:i,providers:a,onModelChange:o,label:s=`Model`}){let c=a.find(t=>t.type===e),l=e!==``,u=n||Q$(e,t,c?.baseUrl),d=u1(e||null,u,`llm`,t||null),f=d.data?.models??c?.models??[],p=d1.has(e),m=f.length>0,h=d.isPending&&l,g=c?.authConfigured===!1?`Configure an API key to load models.`:c?.available===!1?`Provider unavailable.`:`No models returned.`,_=i??`Select a model`;return l?(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:s}),h?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-sm text-on-surface-variant`,children:[(0,G.jsx)(Ra,{className:`h-4 w-4 animate-spin`}),`Loading models...`]}):m?(0,G.jsx)(F$,{value:r,onValueChange:o,placeholder:_,searchPlaceholder:`Search models...`,emptyMessage:`No models match that search.`,options:f.map(e=>({value:e,label:e})),sortOptions:!0,monospace:!0}):p?(0,G.jsx)(Kf,{value:r,onChange:e=>o(e.target.value),placeholder:c?.available===!1?`Provider offline`:`Enter model name`,disabled:c?.available===!1}):(0,G.jsx)(`div`,{className:`rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2`,children:(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:g})})]}):null}var p1={"claude-sdk":`Claude Agents`,"openai-agents":`OpenAI Agents`},m1={anthropic:`Anthropic`,ollama:`Ollama`,lmstudio:`LM Studio`,openai:`OpenAI`,openrouter:`OpenRouter`,"openai-compatible":`OpenAI-compatible`},h1={anthropic:da,ollama:ro,lmstudio:ma,openai:da,openrouter:da,"openai-compatible":ro},g1=[{value:`lmstudio`,label:`LM Studio`},{value:`ollama`,label:`Ollama`}];function _1({harness:e,providerType:t,localBackend:n=``,model:r,baseUrl:i,contextLength:a,modelPlaceholder:o,providers:s,isLoadingProviders:c,showHarnessSelector:l=!0,showModelSelector:u=!0,onHarnessChange:d,onProviderChange:f,onLocalBackendChange:p,onModelChange:m,onBaseUrlChange:h,onContextLengthChange:g,onBaseUrlBlur:_,onContextLengthBlur:v}){let y=s.filter(t=>t1(t.type,e)),b=s.find(e=>e.type===t),x=t===`ollama`||t===`lmstudio`||t===`openai-compatible`,S=i||Q$(t,n,b?.baseUrl);return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[l&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Runtime`}),(0,G.jsxs)(c_,{value:e,onValueChange:d,children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:`Select a runtime`})}),(0,G.jsx)(d_,{children:Object.entries(p1).map(([e,t])=>(0,G.jsx)(f_,{value:e,children:t},e))})]})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:y.map(e=>{let n=h1[e.type];return n?(0,G.jsxs)(`button`,{onClick:()=>f(e.type),className:`
405
405
  flex flex-col items-center gap-1.5 rounded-md border px-3 py-2.5 transition-colors
406
406
  ${t===e.type?`border-primary/40 bg-primary/5 text-on-surface`:`border-[var(--ghost-border)] bg-surface-container-lowest text-on-surface-variant hover:border-primary/20`}
407
407
  `,children:[(0,G.jsx)(n,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-xs font-medium`,children:m1[e.type]??e.type}),!c&&(0,G.jsx)(X,{variant:e.authConfigured===!1||!e.available?`destructive`:`secondary`,className:`text-[10px] px-1.5 py-0`,children:e.authConfigured===!1?`key required`:e.available?`online`:`offline`})]},e.type):null})}),x&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Base URL`}),(0,G.jsx)(Kf,{value:i,onChange:e=>h(e.target.value),onBlur:_,placeholder:S})]}),t===`openai-compatible`&&p&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Local Backend`}),(0,G.jsxs)(c_,{value:n||`lmstudio`,onValueChange:e=>p(e),children:[(0,G.jsx)(u_,{children:(0,G.jsx)(l_,{placeholder:`Select a backend`})}),(0,G.jsx)(d_,{children:g1.map(e=>(0,G.jsx)(f_,{value:e.value,children:e.label},e.value))})]}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:`OpenAI-compatible chat endpoints look the same, but local backends still need different model-loading and context handling.`})]}),x&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Context Length`}),(0,G.jsx)(Kf,{type:`number`,value:a,onChange:e=>g(e.target.value),onBlur:v,placeholder:`32768 (default)`}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:`Leave blank to use the 32K default. Myco creates a Modelfile variant at this size so the model loads at the size you asked for, not its (much larger) native default.`})]}),u&&(0,G.jsx)(f1,{providerType:t,localBackend:n,baseUrl:i,model:r,modelPlaceholder:o,providers:s,onModelChange:m})]})}function v1({phase:e,override:t,taskHarness:n,taskProviderType:r,taskModel:i,taskReasoningMap:a,providers:o,isLoadingProviders:s,onChange:c}){let[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(t.provider?.model!==void 0||t.model!==void 0),p=t.reasoningLevel??e.reasoningLevel??`default`,m=t.provider?.model??t.model??e.model??n1(p,{model:i||void 0,reasoning_map:a},i)??`(unresolved)`,h=t.provider!==void 0||t.model!==void 0||t.reasoningLevel!==void 0||t.maxTurns!==void 0;return(0,G.jsxs)(`div`,{className:`border border-[var(--ghost-border)] rounded-md`,children:[(0,G.jsxs)(`button`,{onClick:()=>u(!l),className:`flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-surface-container-low/50 transition-colors rounded-md`,children:[l?(0,G.jsx)($i,{className:`h-3.5 w-3.5 text-on-surface-variant`}):(0,G.jsx)(ta,{className:`h-3.5 w-3.5 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface`,children:e.name}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[p,` · max `,t.maxTurns??e.maxTurns,` turns`]}),h&&(0,G.jsx)(X,{variant:`secondary`,className:`text-[10px] ml-auto`,children:`override`})]}),l&&(0,G.jsxs)(`div`,{className:`px-3 pb-3 space-y-3 border-t border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`div`,{className:`pt-3 space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Reasoning Level`}),(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-low border border-[var(--ghost-border)] rounded-md px-3 py-2 text-sm font-mono text-on-surface focus:outline-none focus:ring-1 focus:ring-primary`,value:t.reasoningLevel??``,onChange:e=>{let n=e.target.value;c({...t,reasoningLevel:n===``?void 0:n})},children:[(0,G.jsxs)(`option`,{value:``,children:[`inherit (`,e.reasoningLevel??`default`,`)`]}),X$.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsxs)(`p`,{className:`font-sans text-[11px] text-on-surface-variant`,children:[`Resolves to `,(0,G.jsx)(`span`,{className:`font-mono`,children:m}),` via the provider's reasoning map.`]})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Max Turns`}),(0,G.jsx)(Kf,{type:`number`,value:t.maxTurns??``,onChange:e=>c({...t,maxTurns:e.target.value?Number(e.target.value):void 0}),placeholder:String(e.maxTurns)})]}),(0,G.jsxs)(`div`,{className:`border-t border-[var(--ghost-border)] pt-3`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>f(!d),className:`flex items-center gap-1 text-xs text-on-surface-variant hover:text-on-surface`,children:[d?(0,G.jsx)($i,{className:`h-3 w-3`}):(0,G.jsx)(ta,{className:`h-3 w-3`}),`Advanced — pin provider / model`]}),d&&(0,G.jsxs)(`div`,{className:`pt-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant pb-2`,children:`Pinning a model overrides the reasoning map for this phase. Future model upgrades won't propagate here until you clear it.`}),(0,G.jsx)(_1,{harness:n,providerType:t.provider?.type??r,localBackend:t.provider?.local_backend??``,model:t.provider?.model??t.model??``,baseUrl:t.provider?.base_url??``,contextLength:t.provider?.context_length==null?``:String(t.provider.context_length),modelPlaceholder:m,providers:o,isLoadingProviders:s,showHarnessSelector:!1,onHarnessChange:()=>{},onProviderChange:e=>{let n=o.find(t=>t.type===e)?.baseUrl;c({...t,provider:{type:e,base_url:n},model:void 0})},onLocalBackendChange:e=>c({...t,provider:{...t.provider??{type:r},local_backend:e||void 0}}),onModelChange:e=>c({...t,provider:{...t.provider??{type:r},model:e},model:void 0}),onBaseUrlChange:e=>c({...t,provider:{...t.provider??{type:r},base_url:e}}),onContextLengthChange:e=>c({...t,provider:{...t.provider??{type:r},context_length:e?Number(e):void 0}})})]})]}),h&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>c(null),className:`text-xs text-on-surface-variant`,children:`Clear Phase Override`})]})]})}var y1=/\b(session_id|batch_id|target_session)\s*[:=]\s*(?:"([^"]+)"|'([^']+)'|([A-Za-z0-9_-]+))/gi;function b1(e){let t={};if(!e)return t;let n=new RegExp(y1.source,`gi`),r;for(;(r=n.exec(e))!==null;){let e=r[1].toLowerCase(),n=r[2]??r[3]??r[4];n&&t[e]===void 0&&(t[e]=n)}return t}var x1=new Set([`instruction`]);function S1(e,t={}){if(!e)return[];let{includeAutoResolved:n=!1}=t,r=new Set,i=[];for(let t of e.matchAll(/\{\{(\w+)\}\}/g)){let e=t[1];!n&&x1.has(e)||r.has(e)||(r.add(e),i.push(e))}return i}var C1=[`anthropic`,`ollama`,`lmstudio`,`openai`,`openrouter`,`openai-compatible`];function w1(e){return C1.includes(e)?e:`openai-compatible`}function T1(e){if(!e)return;let t={type:e.type};return e.local_backend&&(t.localBackend=e.local_backend),e.base_url&&(t.baseUrl=e.base_url),e.model&&(t.model=e.model),e.reasoning_map&&(t.reasoningMap=e.reasoning_map),e.context_length&&(t.contextLength=e.context_length),t}function E1(e){if(!e)return;let t={type:w1(e.type)};return e.localBackend&&(t.local_backend=e.localBackend),e.baseUrl&&(t.base_url=e.baseUrl),e.model&&(t.model=e.model),e.reasoningMap&&(t.reasoning_map=e.reasoningMap),typeof e.contextLength==`number`&&(t.context_length=e.contextLength),t}function D1(e){if(!e)return;let t={type:w1(e.type)};return e.model&&(t.model=e.model),e.reasoning_map&&(t.reasoning_map=e.reasoning_map),t}function O1(e){if(e)return X$.includes(e)?e:void 0}var k1=[`claude-sdk`,`openai-agents`];function A1(e){if(e)return k1.includes(e)?e:void 0}function j1(e,t){let n=e.task??``,r=t.find(e=>e.name===n),i=n!==``&&r===void 0,a=e.instruction??``,o=b1(a),s={};if(r){let e=new Set(S1(r.prompt,{includeAutoResolved:!0}));for(let[t,n]of Object.entries(o))e.has(t)&&(s[t]=n)}else for(let[e,t]of Object.entries(o))s[e]=t;let c=e.execution_overrides??null,l=A1(c?.harness),u=O1(c?.reasoningLevel),d=c?.model||void 0,f=E1(c?.provider),p={};if(c?.phases)for(let[e,t]of Object.entries(c.phases)){let n=E1(t.provider),r=t.model&&t.model.length>0?t.model:void 0,i=typeof t.maxTurns==`number`?t.maxTurns:void 0,a=O1(t.reasoningLevel);if(n!==void 0||r!==void 0||i!==void 0||a!==void 0){let t={};n&&(t.provider=n),a&&(t.reasoningLevel=a),r&&(t.model=r),i!==void 0&&(t.maxTurns=i),p[e]=t}}let m=l!==void 0||u!==void 0||d!==void 0||f!==void 0||Object.keys(p).length>0;return{taskName:n,taskMissing:i,instruction:a,dryRun:e.dry_run===!0,varValues:s,harness:l,reasoningLevel:u,model:d,provider:f,phaseOverrides:p,hasAnyOverride:m}}function M1(){return{harness:``,type:``,localBackend:``,model:``,reasoningLow:``,reasoningDefault:``,reasoningHigh:``,baseUrl:``,contextLength:``}}function N1(e,t){return(e?.harness?J$(e.harness):``)||(e?.provider?.type?e1(Y$(e.provider.type)||void 0):void 0)||(t?.harness?J$(t.harness):``)||((t?.providerType?e1(Y$(t.providerType)||void 0):void 0)??``)}function P1(e,t){let n=e?.provider?.type?Y$(e.provider.type):``;return n===``?{harness:N1(e,t),type:t?.providerType?Y$(t.providerType):``,localBackend:t?.localBackend??``,model:e?.model??t?.model??``,reasoningLow:t?.reasoningMap?.low??``,reasoningDefault:t?.reasoningMap?.default??e?.model??t?.model??``,reasoningHigh:t?.reasoningMap?.high??``,baseUrl:t?.baseUrl??``,contextLength:t?.contextLength==null?``:String(t.contextLength)}:{harness:N1(e,t),type:n,localBackend:e?.provider?.local_backend??t?.localBackend??``,model:e?.provider?.model??e?.model??``,reasoningLow:e?.provider?.reasoning_map?.low??``,reasoningDefault:e?.provider?.reasoning_map?.default??e?.provider?.model??e?.model??``,reasoningHigh:e?.provider?.reasoning_map?.high??``,baseUrl:e?.provider?.base_url??``,contextLength:e?.provider?.context_length?.toString()??``}}function F1(e,t){return e.harness===t.harness&&e.type===t.type&&e.localBackend===t.localBackend&&e.model===t.model&&e.reasoningLow===t.reasoningLow&&e.reasoningDefault===t.reasoningDefault&&e.reasoningHigh===t.reasoningHigh&&e.baseUrl===t.baseUrl&&e.contextLength===t.contextLength}function I1(e,t){return e===``||t.length===0||t.includes(e)?e:``}function L1(e,t){return i1({...e,reasoningLow:I1(e.reasoningLow,t),reasoningDefault:I1(e.reasoningDefault,t),reasoningHigh:I1(e.reasoningHigh,t)})}function R1(e){return e===``||e===Q$(`openai-compatible`,`ollama`)||e===Q$(`openai-compatible`,`lmstudio`)}function z1(e,t){let n=J$(e),r=t.find(e=>t1(e.type,n));return r?r1(r.type,t,n||void 0):{...M1(),harness:n}}function B1({source:e,defaults:t,providers:n}){let r=(0,W.useMemo)(()=>P1(e,t),[e?.harness,e?.model,e?.provider?.type,e?.provider?.local_backend,e?.provider?.model,e?.provider?.reasoning_map?.low,e?.provider?.reasoning_map?.default,e?.provider?.reasoning_map?.high,e?.provider?.base_url,e?.provider?.context_length,t?.harness,t?.providerType,t?.localBackend,t?.model,t?.reasoningMap?.low,t?.reasoningMap?.default,t?.reasoningMap?.high,t?.baseUrl,t?.contextLength]),[i,a]=(0,W.useState)(r),[o,s]=(0,W.useState)(r),c=(0,W.useRef)(i);c.current=i,(0,W.useEffect)(()=>{a(r),s(e=>F1(e,c.current)?r:e)},[r]);let l=!F1(o,i),u=(0,W.useCallback)(e=>{let t=J$(e);s(r=>t1(r.type,t)?{...r,harness:t}:z1(e,n))},[n]),d=(0,W.useCallback)(e=>{let t=Y$(e);s(r=>r1(e,n,t1(t,r.harness)?r.harness:void 0))},[n]),f=(0,W.useCallback)(e=>{s(t=>({...t,model:e,reasoningDefault:t.reasoningDefault||e}))},[]),p=(0,W.useCallback)(e=>{s(t=>({...t,localBackend:e,...t.type===`openai-compatible`&&e&&R1(t.baseUrl)?{baseUrl:Q$(t.type,e)}:{},...t.type===`openai-compatible`?{model:``,reasoningLow:``,reasoningDefault:``,reasoningHigh:``}:{}}))},[]),m=(0,W.useCallback)((e,t)=>{s(n=>({...n,...e===`low`?{reasoningLow:t}:{},...e==="default"?{reasoningDefault:t}:{},...e===`high`?{reasoningHigh:t}:{}}))},[]),h=(0,W.useCallback)(e=>{s(t=>({...t,baseUrl:e}))},[]),g=(0,W.useCallback)(e=>{s(t=>({...t,contextLength:e}))},[]),_=(0,W.useCallback)(()=>{s(i)},[i]);return{draft:o,savedDraft:i,isDirty:l,setDraft:s,commitDraft:(0,W.useCallback)(e=>{let t=e??o;a(t),s(t)},[o]),resetDraft:_,clearDraft:(0,W.useCallback)(()=>{s(M1())},[]),handleHarnessChange:u,handleProviderChange:d,handleModelChange:f,handleLocalBackendChange:p,handleReasoningChange:m,handleBaseUrlChange:h,handleContextLengthChange:g}}function V1(e){let{data:t}=RA(),n=t?.tasks??[],r=e?n.find(t=>t.name===e):void 0,{effective:i}=LO(),a=i?.agent?.provider,o=a?.type&&Y$(a.type)||void 0,s=i?.agent?.harness,{data:c}=a1(e),l=c?.config,u=r?.execution,d=u?.provider?.type&&Y$(u.provider.type)||void 0,f=l?.harness??u?.harness??s??e1(l?.provider?.type)??e1(o)??e1(d)??`claude-sdk`,p=u?.reasoningLevel??r?.reasoningLevel,m=l?.provider??D1(u?.provider)??a,h=m?.type??`anthropic`,g=l?.provider?.model??l?.model??u?.model??r?.model??a?.model;return{taskRow:r,harness:f,provider:m,providerType:h,modelFallback:g,reasoning:p,resolvedModel:n1(p,m,g),draftSource:(0,W.useMemo)(()=>({harness:l?.harness??u?.harness,provider:m,model:g}),[l?.harness,u?.harness,m,g]),draftDefaults:{harness:f,providerType:h,localBackend:m?.local_backend,model:g,reasoningMap:m?.reasoning_map,baseUrl:m?.base_url,contextLength:m?.context_length}}}function H1(e){if(e===void 0)return;let t=e.trim();return t.length>0?t:void 0}function U1(e,t){return e===t?!0:!e||!t?!1:W1(e)===W1(t)}function W1(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(W1).join(`,`)}]`;let t=e;return`{${Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${W1(t[e])}`).join(`,`)}}`}function G1(e,t){let n={};e.harness&&e.harness!==t.harness&&(n.harness=e.harness),e.reasoningLevel&&e.reasoningLevel!==t.reasoningLevel&&(n.reasoningLevel=e.reasoningLevel);let r=H1(e.model);r&&r!==t.model&&(n.model=r),e.provider&&!U1(e.provider,t.provider)&&(n.provider=T1(e.provider));let i=new Map;for(let e of t.phases??[])i.set(e.name,{reasoningLevel:e.reasoningLevel,model:e.model,provider:e.provider,maxTurns:e.maxTurns});let a={};for(let[t,n]of Object.entries(e.phases)){let e=i.get(t)??{},r={};n.reasoningLevel&&n.reasoningLevel!==e.reasoningLevel&&(r.reasoningLevel=n.reasoningLevel);let o=H1(n.model);o&&o!==e.model&&(r.model=o),n.provider&&!U1(n.provider,e.provider)&&(r.provider=T1(n.provider)),n.maxTurns!==void 0&&n.maxTurns!==e.maxTurns&&(r.maxTurns=n.maxTurns),(r.reasoningLevel!==void 0||r.model!==void 0||r.provider!==void 0||r.maxTurns!==void 0)&&(a[t]=r)}if(Object.keys(a).length>0&&(n.phases=a),!(n.harness===void 0&&n.reasoningLevel===void 0&&n.model===void 0&&n.provider===void 0&&n.phases===void 0))return n}function K1(e,t){let n=G1(e,t);if(!n)return 0;let r=0;if(n.harness!==void 0&&r++,n.reasoningLevel!==void 0&&r++,n.model!==void 0&&r++,n.provider!==void 0&&r++,n.phases)for(let e of Object.values(n.phases))e.reasoningLevel!==void 0&&r++,e.model!==void 0&&r++,e.provider!==void 0&&r++,e.maxTurns!==void 0&&r++;return r}var q1={session_id:`Session ID`},J1={session_id:`e.g. 36858a44-4ef7-4448-96e8-382e992e8ba4`},Y1=`__task_default__`,X1=`skill-survey`;function Z1(e){return q1[e]??e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Q1(e){return e.displayName??e.name}function $1({open:e,onOpenChange:t,preselectedTask:n,onTriggered:r,sourceRun:i}){let[a,o]=(0,W.useState)(void 0),[s,c]=(0,W.useState)({}),[l,u]=(0,W.useState)(``),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(null),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(void 0),[y,b]=(0,W.useState)({}),{data:x,isLoading:S}=RA(),{mutate:C,isPending:w,error:T}=WA(),{data:E,isPending:D}=o1(),O=E?.providers??[],k=x?.tasks??[],A=k.find(e=>e.isDefault),j=n?.name??a??A?.name??k[0]?.name??``,{taskRow:M,harness:N,provider:P,providerType:F,modelFallback:I,reasoning:L,resolvedModel:R,draftSource:ee,draftDefaults:z}=V1(j||void 0),B=n??M,{draft:V,isDirty:H,handleHarnessChange:te,handleProviderChange:ne,handleModelChange:U,handleLocalBackendChange:re,handleBaseUrlChange:ie,handleContextLengthChange:ae,setDraft:oe}=B1({source:ee,defaults:z,providers:O}),se=V.baseUrl||O.find(e=>e.type===V.type)?.baseUrl||``,ce=u1(V.type||null,se||void 0,`llm`,V.localBackend||null).data?.models??O.find(e=>e.type===V.type)?.models??[],le=(0,W.useRef)(null);(0,W.useEffect)(()=>{e||(o(void 0),c({}),u(``),f(!1),m(null),g(!1),v(void 0),b({}),le.current=null)},[e]),(0,W.useEffect)(()=>{if(!e||!i||k.length===0&&S||le.current===i.id)return;let t=j1(i,k);o(t.taskName||void 0),c(t.varValues),u(t.instruction),f(t.dryRun),v(t.reasoningLevel),b(t.phaseOverrides),t.provider?oe({harness:J$(t.harness??z.harness??`claude-sdk`)||`claude-sdk`,type:Y$(t.provider.type),localBackend:t.provider.local_backend??``,model:t.provider.model??``,reasoningLow:t.provider.reasoning_map?.low??``,reasoningDefault:t.provider.reasoning_map?.default??``,reasoningHigh:t.provider.reasoning_map?.high??``,baseUrl:t.provider.base_url??``,contextLength:t.provider.context_length==null?``:String(t.provider.context_length)}):t.harness&&oe(e=>({...e,harness:t.harness})),t.hasAnyOverride&&g(!0),le.current=i.id},[e,i,k.length,S]);let ue=(0,W.useRef)(j);(0,W.useEffect)(()=>{ue.current!==j&&(ue.current=j,!(i&&le.current===i.id)&&(v(void 0),b({})))},[j,i]);let de=(0,W.useMemo)(()=>S1(B?.prompt),[B?.prompt]),fe=(0,W.useMemo)(()=>{if(H)return L1(V,ce)},[V,ce,H]),pe=(0,W.useMemo)(()=>{if(H&&V.harness)return V.harness===N?void 0:V.harness},[V.harness,N,H]),me=(0,W.useMemo)(()=>{let e=B?.phases??[];return{harness:N,reasoningLevel:L,model:R||void 0,provider:P,phases:e.map(e=>({name:e.name,reasoningLevel:e.reasoningLevel,model:e.model,maxTurns:e.maxTurns}))}},[B?.phases,N,L,R,P]),he=(0,W.useMemo)(()=>({harness:pe,reasoningLevel:_,model:void 0,provider:fe,phases:y}),[pe,_,fe,y]),ge=K1(he,me),_e=pe??N,ve=_??L,ye=fe??P,be=ye?.type??F,xe=n1(ve,ye,fe?.model??I),Se=i!==void 0&&i.task!==null&&!k.some(e=>e.name===i.task),Ce=B?Q1(B):i?.task??``,we=i?Se?`Rerun ${Ce} (task definition not found)`:`Rerun ${Ce}`:n?`Run ${Q1(n)}`:`Trigger Agent Run`,Te=i?`Starts a new run with the same settings as the source. The source run is untouched.`:n?void 0:`Run the Myco agent now. It will process unprocessed sessions and update the vault.`;function Ee(e,t){c(n=>({...n,[e]:t}))}function De(e,t){b(n=>{let r={...n};return t===null?delete r[e]:r[e]=t,r})}function Oe(){m(null);let e=[];for(let t of de){let n=s[t]?.trim();n&&e.push(`${t}: ${n}`)}let n=l.trim();n&&e.push(n);let i=e.length>0?e.join(`