veoflow 0.5.5 → 0.5.6

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.
@@ -6,7 +6,7 @@ var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function
6
6
  `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{be=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ye(n):``}function Se(e,t){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye(`Lazy`);case 13:return e.child!==t&&t!==null?ye(`Suspense Fallback`):ye(`Suspense`);case 19:return ye(`SuspenseList`);case 0:case 15:return xe(e.type,!1);case 11:return xe(e.type.render,!1);case 1:return xe(e.type,!0);case 31:return ye(`Activity`);case 30:return ye(`ViewTransition`);default:return``}}function Ce(e){try{var t=``,n=null;do t+=Se(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
7
  Error generating stack: `+e.message+`
8
8
  `+e.stack}}var we=Object.prototype.hasOwnProperty,Te=t.unstable_scheduleCallback,Ee=t.unstable_cancelCallback,X=t.unstable_shouldYield,De=t.unstable_requestPaint,Oe=t.unstable_now,ke=t.unstable_getCurrentPriorityLevel,Ae=t.unstable_ImmediatePriority,je=t.unstable_UserBlockingPriority,Me=t.unstable_NormalPriority,Ne=t.unstable_LowPriority,Pe=t.unstable_IdlePriority,Fe=t.log,Ie=t.unstable_setDisableYieldValue,Le=null,Re=null;function ze(e){if(typeof Fe==`function`&&Ie(e),Re&&typeof Re.setStrictMode==`function`)try{Re.setStrictMode(Le,e)}catch{}}var Be=Math.clz32?Math.clz32:Ue,Ve=Math.log,He=Math.LN2;function Ue(e){return e>>>=0,e===0?32:31-(Ve(e)/He|0)|0}var We=256,Ge=262144,Ke=4194304;function qe(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&-e;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 Z(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=qe(n))):i=qe(o):i=qe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=qe(n))):i=qe(o)):i=qe(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 Je(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ye(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-Be(n),i=1<<r;t|=e[r],n&=~i}return t}function Xe(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 Ze(){var e=Ke;return Ke<<=1,!(Ke&62914560)&&(Ke=4194304),e}function Qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $e(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function et(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-Be(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&&tt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function tt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Be(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function nt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Be(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function rt(e,t){var n=t&-t;return n=n&42?1:it(n),(n&(e.suspendedLanes|t))===0?n:0}function it(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 at(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ot(){var e=Y.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function st(e,t){var n=Y.p;try{return Y.p=e,t()}finally{Y.p=n}}var ct=Math.random().toString(36).slice(2),lt=`__reactFiber$`+ct,ut=`__reactProps$`+ct,dt=`__reactContainer$`+ct,ft=`__reactEvents$`+ct,pt=`__reactListeners$`+ct,mt=`__reactHandles$`+ct,ht=`__reactResources$`+ct,gt=`__reactMarker$`+ct,_t=`__reactLoad$`+ct;function vt(e){delete e[lt],delete e[ut],delete e[pt],delete e[mt]}function yt(e){var t;if(t=e[lt])return t;for(var n=e.parentNode;n;){if(t=n[dt]||n[lt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[lt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function bt(e){if(e=e[lt]||e[dt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function xt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function St(e){var t=e[ht];return t||=e[ht]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ct(e){e[gt]=!0}function wt(e){e[_t]=void 0}var Tt=new Set,Et={};function Dt(e,t){Ot(e,t),Ot(e+`Capture`,t)}function Ot(e,t){for(Et[e]=t,e=0;e<t.length;e++)Tt.add(t[e])}var Q=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]*$`),kt={},At={};function jt(e){return we.call(At,e)?!0:we.call(kt,e)?!1:Q.test(e)?At[e]=!0:(kt[e]=!0,!1)}var Mt=!1;function Nt(){var e=Mt;return Mt=!1,e}function Pt(e,t,n){if(jt(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 Ft(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 It(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 Lt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Rt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function zt(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 Bt(e){if(!e._valueTracker){var t=Rt(e)?`checked`:`value`;e._valueTracker=zt(e,t,``+e[t])}}function Vt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Rt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var Ht=/[\n"\\]/g;function Ut(e){return e.replace(Ht,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Wt(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=``+Lt(t)):e.value!==``+Lt(t)&&(e.value=``+Lt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Kt(e,Lt(n)):o===`number`&&e.value==t?Kt(e,Lt(e.value)):Kt(e,Lt(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=``+Lt(s):e.removeAttribute(`name`)}function Gt(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)){Bt(e);return}n=n==null?``:``+Lt(n),t=t==null?n:``+Lt(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),Bt(e)}function Kt(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function qt(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=``+Lt(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 Jt(e,t,n){if(t!=null&&(t=``+Lt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Lt(n)}function Yt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(s(92));if(q(r)){if(1<r.length)throw Error(s(93));r=r[0]}n=r}n??=``,t=n}n=Lt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Bt(e)}function Xt(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 Qt(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 $t(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(s(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]=``,Mt=!0);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&(Qt(e,i,r),Mt=!0)}else for(var a in t)t.hasOwnProperty(a)&&Qt(e,a,t[a])}function en(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 tn=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`],[`maskType`,`mask-type`],[`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`]]),nn=/^[\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 rn(e){return nn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function an(){}var on=null;function sn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var cn=null,ln=null;function un(e){var t=bt(e);if(t&&(e=t.stateNode)){var n=e[ut]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Wt(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="`+Ut(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[ut]||null;if(!i)throw Error(s(90));Wt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Vt(r)}break a;case`textarea`:Jt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&qt(e,!!n.multiple,t,!1)}}}var dn=!1;function fn(e,t,n){if(dn)return e(t,n);dn=!0;try{return e(t)}finally{if(dn=!1,(cn!==null||ln!==null)&&(Id(),cn&&(t=cn,e=ln,ln=cn=null,un(t),e)))for(t=0;t<e.length;t++)un(e[t])}}function pn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[ut]||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(s(231,t,typeof n));return n}var mn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,hn=!1;if(mn)try{var gn={};Object.defineProperty(gn,"passive",{get:function(){hn=!0}}),window.addEventListener(`test`,gn,gn),window.removeEventListener(`test`,gn,gn)}catch{hn=!1}var _n=null,vn=null,yn=null;function bn(){if(yn)return yn;var e,t=vn,n=t.length,r,i=`value`in _n?_n.value:_n.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 yn=i.slice(e,1<r?1-r:void 0)}function xn(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 Sn(){return!0}function Cn(){return!1}function wn(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)?Sn:Cn,this.isPropagationStopped=Cn,this}return D(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=Sn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Sn)},persist:function(){},isPersistent:Sn}),t}var Tn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},En=wn(Tn),Dn=D({},Tn,{view:0,detail:0}),On=wn(Dn),kn,An,jn,Mn=D({},Dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Un,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!==jn&&(jn&&e.type===`mousemove`?(kn=e.screenX-jn.screenX,An=e.screenY-jn.screenY):An=kn=0,jn=e),kn)},movementY:function(e){return`movementY`in e?e.movementY:An}}),Nn=wn(Mn),Pn=wn(D({},Mn,{dataTransfer:0})),Fn=wn(D({},Dn,{relatedTarget:0})),In=wn(D({},Tn,{animationName:0,elapsedTime:0,pseudoElement:0})),Ln=wn(D({},Tn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Rn=wn(D({},Tn,{data:0})),zn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Bn={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`},Vn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Hn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vn[e])?!!t[e]:!1}function Un(){return Hn}var Wn=wn(D({},Dn,{key:function(e){if(e.key){var t=zn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=xn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Bn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Un,charCode:function(e){return e.type===`keypress`?xn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?xn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Gn=wn(D({},Mn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Kn=wn(D({},Tn,{submitter:0})),qn=wn(D({},Dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Un})),Jn=wn(D({},Tn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Yn=wn(D({},Mn,{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})),Xn=wn(D({},Tn,{newState:0,oldState:0,source:0})),Zn=[9,13,27,32],Qn=mn&&`CompositionEvent`in window,$n=null;mn&&`documentMode`in document&&($n=document.documentMode);var er=mn&&`TextEvent`in window&&!$n,tr=mn&&(!Qn||$n&&8<$n&&11>=$n),nr=` `,rr=!1;function ir(e,t){switch(e){case`keyup`:return Zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ar(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var or=!1;function sr(e,t){switch(e){case`compositionend`:return ar(t);case`keypress`:return t.which===32?(rr=!0,nr):null;case`textInput`:return e=t.data,e===nr&&rr?null:e;default:return null}}function cr(e,t){if(or)return e===`compositionend`||!Qn&&ir(e,t)?(e=bn(),yn=vn=_n=null,or=!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 tr&&t.locale!==`ko`?null:t.data;default:return null}}var lr={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 ur(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!lr[e.type]:t===`textarea`}function dr(e,t,n,r){cn?ln?ln.push(r):ln=[r]:cn=r,t=qf(t,`onChange`),0<t.length&&(n=new En(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var fr=null,pr=null;function mr(e){zf(e,0)}function hr(e){if(Vt(xt(e)))return e}function gr(e,t){if(e===`change`)return t}var _r=!1;if(mn){var vr;if(mn){var yr=`oninput`in document;if(!yr){var br=document.createElement(`div`);br.setAttribute(`oninput`,`return;`),yr=typeof br.oninput==`function`}vr=yr}else vr=!1;_r=vr&&(!document.documentMode||9<document.documentMode)}function xr(){fr&&(fr.detachEvent(`onpropertychange`,Sr),pr=fr=null)}function Sr(e){if(e.propertyName===`value`&&hr(pr)){var t=[];dr(t,pr,e,sn(e)),fn(mr,t)}}function Cr(e,t,n){e===`focusin`?(xr(),fr=t,pr=n,fr.attachEvent(`onpropertychange`,Sr)):e===`focusout`&&xr()}function wr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return hr(pr)}function Tr(e,t){if(e===`click`)return hr(t)}function Er(e,t){if(e===`input`||e===`change`)return hr(t)}function Dr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Or=typeof Object.is==`function`?Object.is:Dr;function kr(e,t){if(Or(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!we.call(t,i)||!Or(e[i],t[i]))return!1}return!0}function Ar(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function jr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Mr(e,t){var n=jr(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=jr(n)}}function Nr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ar(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=Ar(e.document)}return t}function Fr(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 Ir=mn&&`documentMode`in document&&11>=document.documentMode,Lr=null,Rr=null,zr=null,Br=!1;function Vr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Br||Lr==null||Lr!==Ar(r)||(r=Lr,`selectionStart`in r&&Fr(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}),zr&&kr(zr,r)||(zr=r,r=qf(Rr,`onSelect`),0<r.length&&(t=new En(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Lr)))}function Hr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ur={animationend:Hr(`Animation`,`AnimationEnd`),animationiteration:Hr(`Animation`,`AnimationIteration`),animationstart:Hr(`Animation`,`AnimationStart`),transitionrun:Hr(`Transition`,`TransitionRun`),transitionstart:Hr(`Transition`,`TransitionStart`),transitioncancel:Hr(`Transition`,`TransitionCancel`),transitionend:Hr(`Transition`,`TransitionEnd`)},Wr={},Gr={};mn&&(Gr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ur.animationend.animation,delete Ur.animationiteration.animation,delete Ur.animationstart.animation),`TransitionEvent`in window||delete Ur.transitionend.transition);function Kr(e){if(Wr[e])return Wr[e];if(!Ur[e])return e;var t=Ur[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Gr)return Wr[e]=t[n];return e}var qr=Kr(`animationend`),Jr=Kr(`animationiteration`),Yr=Kr(`animationstart`),Xr=Kr(`transitionrun`),Zr=Kr(`transitionstart`),Qr=Kr(`transitioncancel`),$r=Kr(`transitionend`),ei=new Map,ti=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(` `);ti.push(`scrollEnd`);function ni(e,t){ei.set(e,t),Dt(t,[e])}var ri=0;function ii(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=_d.identifierPrefix;var n=ri++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function ai(e){if(e==null||typeof e==`string`)return e;var t=null,n=Td;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function oi(e,t){return e=ai(e),t=ai(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var si=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)},ci=[],li=0,ui=0;function di(){for(var e=li,t=ui=li=0;t<e;){var n=ci[t];ci[t++]=null;var r=ci[t];ci[t++]=null;var i=ci[t];ci[t++]=null;var a=ci[t];if(ci[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&&hi(n,i,a)}}function fi(e,t,n,r){ci[li++]=e,ci[li++]=t,ci[li++]=n,ci[li++]=r,ui|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function pi(e,t,n,r){return fi(e,t,n,r),gi(e)}function mi(e,t){return fi(e,null,null,t),gi(e)}function hi(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-Be(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function gi(e){if(50<Ed)throw Ed=0,Dd=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var _i={};function vi(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 yi(e,t,n,r){return new vi(e,t,n,r)}function bi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xi(e,t){var n=e.alternate;return n===null?(n=yi(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&1206910976,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 Si(e,t){e.flags&=1206910978;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 Ci(e,t,n,r,i,a){var o=0;if(r=e,typeof r==`function`)bi(r)&&(o=1);else if(typeof r==`string`)o=qm(e,n,le.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case V:return e=yi(31,n,t,i),e.elementType=V,e.lanes=a,e;case j:return wi(n.children,i,a,t);case M:o=8,i|=24;break;case N:return e=yi(12,n,t,i|2),e.elementType=N,e.lanes=a,e;case L:return e=yi(13,n,t,i),e.elementType=L,e.lanes=a,e;case R:return e=yi(19,n,t,i),e.elementType=R,e.lanes=a,e;case H:case W:return e=i|32,e=yi(30,n,t,e),e.elementType=W,e.lanes=a,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case F:o=10;break a;case P:o=9;break a;case I:o=11;break a;case z:o=14;break a;case B:o=16,r=null;break a}o=29,n=Error(s(130,e===null?`null`:typeof e,``)),r=null}return t=yi(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function wi(e,t,n,r){return e=yi(7,e,r,t),e.lanes=n,e}function Ti(e,t,n){return e=yi(6,e,null,t),e.lanes=n,e}function Ei(e){var t=yi(18,null,null,0);return t.stateNode=e,t}function Di(e,t,n){return t=yi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Oi=new WeakMap;function ki(e,t){if(typeof e==`object`&&e){var n=Oi.get(e);return n===void 0?(t={value:e,source:t,stack:Ce(t)},Oi.set(e,t),t):n}return{value:e,source:t,stack:Ce(t)}}var Ai=[],ji=0,Mi=null,Ni=0,Pi=[],Fi=0,Ii=null,Li=1,Ri=``;function zi(e,t){Ai[ji++]=Ni,Ai[ji++]=Mi,Mi=e,Ni=t}function Bi(e,t,n){Pi[Fi++]=Li,Pi[Fi++]=Ri,Pi[Fi++]=Ii,Ii=e;var r=Li;e=Ri;var i=32-Be(r)-1;r&=~(1<<i),n+=1;var a=32-Be(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Li=1<<32-Be(t)+i|n<<i|r,Ri=a+e}else Li=1<<a|n<<i|r,Ri=e}function Vi(e){e.return!==null&&(zi(e,1),Bi(e,1,0))}function Hi(e){for(;e===Mi;)Mi=Ai[--ji],Ai[ji]=null,Ni=Ai[--ji],Ai[ji]=null;for(;e===Ii;)Ii=Pi[--Fi],Pi[Fi]=null,Ri=Pi[--Fi],Pi[Fi]=null,Li=Pi[--Fi],Pi[Fi]=null}function Ui(e,t){Pi[Fi++]=Li,Pi[Fi++]=Ri,Pi[Fi++]=Ii,Li=t.id,Ri=t.overflow,Ii=e}var Wi=null,Gi=null,Ki=!1,qi=null,Ji=!1,Yi=Error(s(519));function Xi(e){throw na(ki(Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Yi}function Zi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[lt]=e,t[ut]=r,n){case`dialog`:Bf(`cancel`,t),Bf(`close`,t);break;case`iframe`:case`object`:case`embed`:Bf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Lf.length;n++)Bf(Lf[n],t);break;case`source`:Bf(`error`,t);break;case`img`:case`image`:case`link`:Bf(`error`,t),Bf(`load`,t);break;case`details`:Bf(`toggle`,t);break;case`input`:Bf(`invalid`,t),Gt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Bf(`invalid`,t);break;case`textarea`:Bf(`invalid`,t),Yt(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||$f(t.textContent,n)?(r.popover!=null&&(Bf(`beforetoggle`,t),Bf(`toggle`,t)),r.onScroll!=null&&Bf(`scroll`,t),r.onScrollEnd!=null&&Bf(`scrollend`,t),r.onClick!=null&&(t.onclick=an),t=!0):t=!1,t||Xi(e,!0)}function Qi(e){for(Wi=e.return;Wi;)switch(Wi.tag){case 5:case 31:case 13:Ji=!1;return;case 27:case 3:Ji=!0;return;default:Wi=Wi.return}}function $i(e){if(e!==Wi)return!1;if(!Ki)return Qi(e),Ki=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||pp(e.type,e.memoizedProps)),n=!n),n&&Gi&&Xi(e),Qi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Gi=dm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Gi=dm(e)}else t===27?(t=Gi,Sp(e.type)?(e=um,um=null,Gi=e):Gi=t):Gi=Wi?lm(e.stateNode.nextSibling):null;return!0}function ea(){Gi=Wi=null,Ki=!1}function ta(){var e=qi;return e!==null&&(ld===null?ld=e:ld.push.apply(ld,e),qi=null),e}function na(e){qi===null?qi=[e]:qi.push(e)}var ra=oe(null),ia=null,aa=null;function oa(e,t,n){ce(ra,t._currentValue),t._currentValue=n}function sa(e){e._currentValue=ra.current,se(ra)}function ca(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 la(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var o=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),ca(a.return,n,e),r||(o=null);break a}a=c.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(s(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),ca(o,n,e),o=null}else i.tag===13&&i.memoizedState!==null&&i.memoizedState.dehydrated===null?(i.lanes|=n,o=i.alternate,o!==null&&(o.lanes|=n),ca(i.return,n,e),o=i.child,o=o===null?null:o.sibling):o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function ua(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(s(387));if(o=o.memoizedProps,o!==null){var c=i.type;Or(i.pendingProps.value,o.value)||(e===null?e=[c]:e.push(c))}}else if(i===fe.current){if(o=i.alternate,o===null)throw Error(s(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[sh]:e.push(sh))}i=i.return}return e!==null&&la(t,e,n,r),t.flags|=262144,e!==null}function da(e){for(e=e.firstContext;e!==null;){if(!Or(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function fa(e){ia=e,aa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function pa(e){return ha(ia,e)}function ma(e,t){return ia===null&&fa(e),ha(e,t)}function ha(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},aa===null){if(e===null)throw Error(s(308));aa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else aa=aa.next=t;return n}var ga=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()})}},_a=t.unstable_scheduleCallback,va=t.unstable_NormalPriority,ya={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ba(){return{controller:new ga,data:new Map,refCount:0}}function xa(e){e.refCount--,e.refCount===0&&_a(va,function(){e.controller.abort()})}function Sa(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Ca=null;function wa(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ta=null,Ea=0,Da=0,Oa=null;function ka(e,t){if(Ta===null){var n=Ta=[];Ea=0,Da=Mf(),Oa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ea++,t.then(Aa,Aa),t}function Aa(){if(--Ea===0&&(Ca=null,Ta!==null)){Oa!==null&&(Oa.status=`fulfilled`);var e=Ta;Ta=null,Da=0,Oa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ja(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 Ma=J.S;J.S=function(e,t){if(fd=Oe(),typeof t==`object`&&t&&typeof t.then==`function`&&ka(e,t),Ca!==null)for(var n=vf;n!==null;)Sa(n,Ca),n=n.next;if(n=e.types,n!==null){for(var r=vf;r!==null;)Sa(r,n),r=r.next;if(Da!==0){r=Ca,r===null&&(r=Ca=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ma!==null&&Ma(e,t)};var Na=oe(null);function Pa(){var e=Na.current;return e===null?qu.pooledCache:e}function Fa(e,t){t===null?ce(Na,Na.current):ce(Na,t.pool)}function Ia(){var e=Pa();return e===null?null:{parent:ya._currentValue,pool:e}}var La=Error(s(460)),Ra=Error(s(474)),za=Error(s(542)),Ba={then:function(){}};function Va(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ha(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(an,an),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ka(e),e===void 0&&!(`reason`in t)?Error(s(600)):e;default:if(typeof t.status==`string`)t.then(an,an);else{if(e=qu,e!==null&&100<e.shellSuspendCounter)throw Error(s(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,Ka(e),e}throw Wa=t,La}}function Ua(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Wa=e,La):e}}var Wa=null;function Ga(){if(Wa===null)throw Error(s(459));var e=Wa;return Wa=null,e}function Ka(e){if(e===La||e===za)throw Error(s(483))}var qa=null,Ja=0;function Ya(e){var t=Ja;return Ja+=1,qa===null&&(qa=[]),Ha(qa,e,t)}function Xa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Za(e,t){throw t.$$typeof===O?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Qa(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 i(e,t){return e=xi(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function o(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ti(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===j?(e=d(e,t,n.props.children,r,n.key),Xa(e,n),e):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===B&&Ua(a)===t.type)?(t=i(t,n.props),Xa(t,n),t.return=e,t):(t=Ci(n.type,n.key,n.props,null,e.mode,r),Xa(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=Di(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=wi(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ti(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case k:return n=Ci(t.type,t.key,t.props,null,e.mode,n),Xa(n,t),n.return=e,n;case A:return t=Di(t,e.mode,n),t.return=e,t;case B:return t=Ua(t),f(e,t,n)}if(q(t)||te(t))return t=wi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ya(t),n);if(t.$$typeof===F)return f(e,ma(e,t),n);Za(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 k:return n.key===i?l(e,t,n,r):null;case A:return n.key===i?u(e,t,n,r):null;case B:return n=Ua(n),p(e,t,n,r)}if(q(n)||te(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ya(n),r);if(n.$$typeof===F)return p(e,t,ma(e,n),r);Za(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 k:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case A:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case B:return r=Ua(r),m(e,t,n,r,i)}if(q(r)||te(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ya(r),i);if(r.$$typeof===F)return m(e,t,n,ma(t,r),i);Za(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=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),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Ki&&zi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return Ki&&zi(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(_.key===null?h:_.key)),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Ki&&zi(i,h),l}function g(i,o,c,l){if(c==null)throw Error(s(151));for(var u=null,d=null,h=o,g=o=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Ki&&zi(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return Ki&&zi(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Ki&&zi(i,g),u}function _(e,r,a,c){if(typeof a==`object`&&a&&a.type===j&&a.key===null&&a.props.ref===void 0&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case k:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===j){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),Xa(c,a),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===B&&Ua(l)===r.type){n(e,r.sibling),c=i(r,a.props),Xa(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===j?(c=wi(a.props.children,e.mode,c,a.key),Xa(c,a),c.return=e,e=c):(c=Ci(a.type,a.key,a.props,null,e.mode,c),Xa(c,a),c.return=e,e=c)}return o(e);case A:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Di(a,e.mode,c),c.return=e,e=c}return o(e);case B:return a=Ua(a),_(e,r,a,c)}if(q(a))return h(e,r,a,c);if(te(a)){if(l=te(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return _(e,r,Ya(a),c);if(a.$$typeof===F)return _(e,r,ma(e,a),c);Za(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=Ti(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{Ja=0;var i=_(e,t,n,r);return qa=null,i}catch(t){if(t===La||t===za)throw t;var a=yi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var $a=Qa(!0),eo=Qa(!1),to=!1;function no(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ro(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 io(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ao(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ku&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=gi(e),hi(e,null,n),t}return fi(e,r,t,n),gi(e)}function oo(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,nt(e,n)}}function so(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 co=!1;function lo(){if(co){var e=Oa;if(e!==null)throw e}}function uo(e,t,n,r){co=!1;var i=e.updateQueue;to=!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?(Yu&f)===f:(r&f)===f){f!==0&&f===Da&&(co=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=D({},d,f);break a;case 2:to=!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),rd|=o,e.lanes=o,e.memoizedState=d}}function fo(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function po(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)fo(n[e],t)}var mo=oe(null),ho=oe(0);function go(e,t){e=td,ce(ho,e),ce(mo,t),td=e|t.baseLanes}function _o(){ce(ho,td),ce(mo,mo.current)}function vo(){td=ho.current,se(mo),se(ho)}var yo=oe(null),bo=null;function xo(e){var t=e.alternate;ce(Eo,Eo.current&1),ce(yo,e),bo===null&&(t===null||mo.current!==null||t.memoizedState!==null)&&(bo=e)}function So(e){ce(Eo,Eo.current),ce(yo,e),bo===null&&(bo=e)}function Co(e){e.tag===22?(ce(Eo,Eo.current),ce(yo,e),bo===null&&(bo=e)):wo()}function wo(){ce(Eo,Eo.current),ce(yo,yo.current)}function To(e){se(yo),bo===e&&(bo=null),se(Eo)}var Eo=oe(0);function Do(e,t){ce(yo,yo.current),ce(Eo,t)}function Oo(e){se(Eo),se(yo),bo===e&&(bo=null)}function ko(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||om(n)||sm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){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,jo=null,Mo=null,No=null,Po=!1,Fo=!1,Io=!1,Lo=0,Ro=0,zo=null,Bo=0;function Vo(){throw Error(s(321))}function Ho(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Or(e[n],t[n]))return!1;return!0}function Uo(e,t,n,r,i,a){return Ao=a,jo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,J.H=e===null||e.memoizedState===null?oc:sc,Io=!1,a=n(r,i),Io=!1,Fo&&(a=Go(t,n,r,i)),Wo(e),a}function Wo(e){J.H=ac;var t=Mo!==null&&Mo.next!==null;if(Ao=0,No=Mo=jo=null,Po=!1,Ro=0,zo=null,t)throw Error(s(300));e===null||wc||(e=e.dependencies,e!==null&&da(e)&&(wc=!0))}function Go(e,t,n,r){jo=e;var i=0;do{if(Fo&&(zo=null),Ro=0,Fo=!1,25<=i)throw Error(s(301));if(i+=1,No=Mo=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}J.H=cc,a=t(n,r)}while(Fo);return a}function Ko(){var e=J.H,t=e.useState()[0];return t=typeof t.then==`function`?$o(t):t,e=e.useState()[0],(Mo===null?null:Mo.memoizedState)!==e&&(jo.flags|=1024),t}function qo(){var e=Lo!==0;return Lo=0,e}function Jo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Yo(e){if(Po){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Po=!1}Ao=0,No=Mo=jo=null,Fo=!1,Ro=Lo=0,zo=null}function Xo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return No===null?jo.memoizedState=No=e:No=No.next=e,No}function Zo(){if(Mo===null){var e=jo.alternate;e=e===null?null:e.memoizedState}else e=Mo.next;var t=No===null?jo.memoizedState:No.next;if(t!==null)No=t,Mo=e;else{if(e===null)throw jo.alternate===null?Error(s(467)):Error(s(310));Mo=e,e={memoizedState:Mo.memoizedState,baseState:Mo.baseState,baseQueue:Mo.baseQueue,queue:Mo.queue,next:null},No===null?jo.memoizedState=No=e:No=No.next=e}return No}function Qo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $o(e){var t=Ro;return Ro+=1,zo===null&&(zo=[]),e=Ha(zo,e,t),t=jo,(No===null?t.memoizedState:No.next)===null&&(t=t.alternate,J.H=t===null||t.memoizedState===null?oc:sc),e}function es(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return $o(e);if(e.$$typeof===ee)return;if(e.$$typeof===F)return pa(e)}throw Error(s(438,String(e)))}function ts(e){var t=null,n=jo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=jo.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=Qo(),jo.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]=U;return t.index++,n}function ns(e,t){return typeof t==`function`?t(e):t}function rs(e){return is(Zo(),Mo,e)}function is(e,t,n){var r=e.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=o=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Ao&f)===f:(Yu&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===Da&&(d=!0);else if((Ao&p)===p){u=u.next,p===Da&&(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,o=a):l=l.next=f,jo.lanes|=p,rd|=p;f=u.action,Io&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,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,o=a):l=l.next=p,jo.lanes|=f,rd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?o=a:l.next=c,!Or(a,e.memoizedState)&&(wc=!0,d&&(n=Oa,n!==null)))throw n;e.memoizedState=a,e.baseState=o,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function as(e){var t=Zo(),n=t.queue;if(n===null)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);Or(a,t.memoizedState)||(wc=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function os(e,t,n){var r=jo,i=Zo(),a=Ki;if(a){if(n===void 0)throw Error(s(407));n=n()}else n=t();var o=!Or((Mo||i).memoizedState,n);if(o&&(i.memoizedState=n,wc=!0),i=i.queue,js(ls.bind(null,r,i,e),[e]),e=i.getSnapshot!==t||o||No!==null&&!!(No.memoizedState.tag&1),Es(e?9:8,{destroy:void 0},cs.bind(null,r,i,n,t),null),e){if(r.flags|=2048,qu===null)throw Error(s(349));a||Ao&127||ss(r,t,n)}return n}function ss(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=jo.updateQueue,t===null?(t=Qo(),jo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function cs(e,t,n,r){t.value=n,t.getSnapshot=r,us(t)&&ds(e)}function ls(e,t,n){return n(function(){us(t)&&ds(e)})}function us(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Or(e,n)}catch{return!0}}function ds(e){var t=mi(e,2);t!==null&&jd(t,e,2)}function fs(e){var t=Xo();if(typeof e==`function`){var n=e;if(e=n(),Io){ze(!0);try{n()}finally{ze(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:e},t}function ps(e,t,n,r){return e.baseState=n,is(e,Mo,typeof r==`function`?r:ns)}function ms(e,t,n,r,i){if(nc(e))throw Error(s(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};J.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,hs(t,a)):(a.next=n.next,t.pending=n.next=a)}}function hs(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=J.T,o={};o.types=a===null?null:a.types,J.T=o;try{var s=n(i,r),c=J.S;c!==null&&c(o,s),gs(e,t,s)}catch(n){vs(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),J.T=a}}else try{a=n(i,r),gs(e,t,a)}catch(n){vs(e,t,n)}}function gs(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){_s(e,t,n)},function(n){return vs(e,t,n)}):_s(e,t,n)}function _s(e,t,n){t.status=`fulfilled`,t.value=n,ys(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,hs(e,n)))}function vs(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,ys(t),t=t.next;while(t!==r)}e.action=null}function ys(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function bs(e,t){return t}function xs(e,t){if(Ki){var n=qu.formState;if(n!==null){a:{var r=jo;if(Ki){if(Gi){b:{for(var i=Gi,a=Ji;i.nodeType!==8;){if(!a){i=null;break b}if(i=lm(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Gi=lm(i.nextSibling),r=i.data===`F!`;break a}}Xi(r)}r=!1}r&&(t=n[0])}}return n=Xo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bs,lastRenderedState:t},n.queue=r,n=$s.bind(null,jo,r),r.dispatch=n,r=fs(!1),a=tc.bind(null,jo,!1,r.queue),r=Xo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=ms.bind(null,jo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ss(e){return Cs(Zo(),Mo,e)}function Cs(e,t,n){if(t=is(e,t,bs)[0],e=rs(ns)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=$o(t)}catch(e){throw e===La?za:e}else r=t;t=Zo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(jo.flags|=2048,Es(9,{destroy:void 0},ws.bind(null,i,n),null)),[r,a,e]}function ws(e,t){e.action=t}function Ts(e){var t=Zo(),n=Mo;if(n!==null)return Cs(t,n,e);Zo(),t=t.memoizedState,n=Zo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Es(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=jo.updateQueue,t===null&&(t=Qo(),jo.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 Ds(){return Zo().memoizedState}function Os(e,t,n,r){var i=Xo();jo.flags|=e,i.memoizedState=Es(1|t,{destroy:void 0},n,r===void 0?null:r)}function ks(e,t,n,r){var i=Zo();r=r===void 0?null:r;var a=i.memoizedState.inst;Mo!==null&&r!==null&&Ho(r,Mo.memoizedState.deps)?i.memoizedState=Es(t,a,n,r):(jo.flags|=e,i.memoizedState=Es(1|t,a,n,r))}function As(e,t){Os(8390656,8,e,t)}function js(e,t){ks(2048,8,e,t)}function Ms(e){jo.flags|=4;var t=jo.updateQueue;if(t===null)t=Qo(),jo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ns(e){var t=Zo().memoizedState;return Ms({ref:t,nextImpl:e}),function(){if(Ku&2)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function Ps(e,t){return ks(4,2,e,t)}function Fs(e,t){return ks(4,4,e,t)}function Is(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ls(e,t,n){n=n==null?null:n.concat([e]),ks(4,4,Is.bind(null,t,e),n)}function Rs(){}function zs(e,t){var n=Zo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Ho(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Bs(e,t){var n=Zo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Ho(t,r[1]))return r[0];if(r=e(),Io){ze(!0);try{e()}finally{ze(!1)}}return n.memoizedState=[r,t],r}function Vs(e,t,n){return n===void 0||Ao&1073741824&&!(Yu&261930)?e.memoizedState=t:(e.memoizedState=n,e=kd(),jo.lanes|=e,rd|=e,n)}function Hs(e,t,n,r){return Or(n,t)?n:mo.current===null?!(Ao&106)||Ao&1073741824&&!(Yu&261930)?(wc=!0,e.memoizedState=n):(e=kd(),jo.lanes|=e,rd|=e,t):(e=Vs(e,n,r),Or(e,t)||(wc=!0),e)}function Us(e,t,n,r,i){var a=Y.p;Y.p=a!==0&&8>a?a:8;var o=J.T,s={};s.types=o===null?null:o.types,J.T=s,tc(e,!1,t,n);try{var c=i(),l=J.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ec(e,t,ja(c,r),Od(e)):ec(e,t,r,Od(e))}catch(n){ec(e,t,{then:function(){},status:`rejected`,reason:n},Od())}finally{Y.p=a,o!==null&&s.types!==null&&(o.types=s.types),J.T=o}}function Ws(){}function Gs(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=Ks(e).queue;Us(e,i,t,re,n===null?Ws:function(){return qs(e),n(r)})}function Ks(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:re},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function qs(e){var t=Ks(e);t.next===null&&(t=e.alternate.memoizedState),ec(e,t.next.queue,{},Od())}function Js(){return pa(sh)}function Ys(){return Zo().memoizedState}function Xs(){return Zo().memoizedState}function Zs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Od();e=io(n);var r=ao(t,e,n);r!==null&&(jd(r,t,n),oo(r,t,n)),t={cache:ba()},e.payload=t;return}t=t.return}}function Qs(e,t,n){var r=Od();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},nc(e)?rc(t,n):(n=pi(e,t,n,r),n!==null&&(jd(n,e,r),ic(n,t,r)))}function $s(e,t,n){ec(e,t,n,Od())}function ec(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(nc(e))rc(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,Or(s,o))return fi(e,t,i,0),qu===null&&di(),!1}catch{}if(n=pi(e,t,i,r),n!==null)return jd(n,e,r),ic(n,t,r),!0}return!1}function tc(e,t,n,r){if(r={lane:2,revertLane:Mf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},nc(e)){if(t)throw Error(s(479))}else t=pi(e,n,r,2),t!==null&&jd(t,e,2)}function nc(e){var t=e.alternate;return e===jo||t!==null&&t===jo}function rc(e,t){Fo=Po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ic(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nt(e,n)}}var ac={readContext:pa,use:es,useCallback:Vo,useContext:Vo,useEffect:Vo,useImperativeHandle:Vo,useLayoutEffect:Vo,useInsertionEffect:Vo,useMemo:Vo,useReducer:Vo,useRef:Vo,useState:Vo,useDebugValue:Vo,useDeferredValue:Vo,useTransition:Vo,useSyncExternalStore:Vo,useId:Vo,useHostTransitionStatus:Vo,useFormState:Vo,useActionState:Vo,useOptimistic:Vo,useMemoCache:Vo,useCacheRefresh:Vo,useEffectEvent:Vo},oc={readContext:pa,use:es,useCallback:function(e,t){return Xo().memoizedState=[e,t===void 0?null:t],e},useContext:pa,useEffect:As,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Os(4194308,4,Is.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Os(4194308,4,e,t)},useInsertionEffect:function(e,t){Os(4,2,e,t)},useMemo:function(e,t){var n=Xo();t=t===void 0?null:t;var r=e();if(Io){ze(!0);try{e()}finally{ze(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Xo();if(n!==void 0){var i=n(t);if(Io){ze(!0);try{n(t)}finally{ze(!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=Qs.bind(null,jo,e),[r.memoizedState,e]},useRef:function(e){var t=Xo();return e={current:e},t.memoizedState=e},useState:function(e){e=fs(e);var t=e.queue,n=$s.bind(null,jo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Rs,useDeferredValue:function(e,t){return Vs(Xo(),e,t)},useTransition:function(){var e=fs(!1);return e=Us.bind(null,jo,e.queue,!0,!1),Xo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=jo,i=Xo();if(Ki){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),qu===null)throw Error(s(349));Yu&127||ss(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,As(ls.bind(null,r,a,e),[e]),r.flags|=2048,Es(9,{destroy:void 0},cs.bind(null,r,a,n,t),null),n},useId:function(){var e=Xo(),t=qu.identifierPrefix;if(Ki){var n=Ri,r=Li;n=(r&~(1<<32-Be(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Lo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Bo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Js,useFormState:xs,useActionState:xs,useOptimistic:function(e){var t=Xo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=tc.bind(null,jo,!0,n),n.dispatch=t,[e,t]},useMemoCache:ts,useCacheRefresh:function(){return Xo().memoizedState=Zs.bind(null,jo)},useEffectEvent:function(e){var t=Xo(),n={impl:e};return t.memoizedState=n,function(){if(Ku&2)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},sc={readContext:pa,use:es,useCallback:zs,useContext:pa,useEffect:js,useImperativeHandle:Ls,useInsertionEffect:Ps,useLayoutEffect:Fs,useMemo:Bs,useReducer:rs,useRef:Ds,useState:function(){return rs(ns)},useDebugValue:Rs,useDeferredValue:function(e,t){return Hs(Zo(),Mo.memoizedState,e,t)},useTransition:function(){var e=rs(ns)[0],t=Zo().memoizedState;return[typeof e==`boolean`?e:$o(e),t]},useSyncExternalStore:os,useId:Ys,useHostTransitionStatus:Js,useFormState:Ss,useActionState:Ss,useOptimistic:function(e,t){return ps(Zo(),Mo,e,t)},useMemoCache:ts,useCacheRefresh:Xs,useEffectEvent:Ns},cc={readContext:pa,use:es,useCallback:zs,useContext:pa,useEffect:js,useImperativeHandle:Ls,useInsertionEffect:Ps,useLayoutEffect:Fs,useMemo:Bs,useReducer:as,useRef:Ds,useState:function(){return as(ns)},useDebugValue:Rs,useDeferredValue:function(e,t){var n=Zo();return Mo===null?Vs(n,e,t):Hs(n,Mo.memoizedState,e,t)},useTransition:function(){var e=as(ns)[0],t=Zo().memoizedState;return[typeof e==`boolean`?e:$o(e),t]},useSyncExternalStore:os,useId:Ys,useHostTransitionStatus:Js,useFormState:Ts,useActionState:Ts,useOptimistic:function(e,t){var n=Zo();return Mo===null?(n.baseState=e,[e,n.queue.dispatch]):ps(n,Mo,e,t)},useMemoCache:ts,useCacheRefresh:Xs,useEffectEvent:Ns};function lc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:D({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var uc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Od(),i=io(r);i.payload=t,n!=null&&(i.callback=n),t=ao(e,i,r),t!==null&&(jd(t,e,r),oo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Od(),i=io(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ao(e,i,r),t!==null&&(jd(t,e,r),oo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Od(),r=io(n);r.tag=2,t!=null&&(r.callback=t),t=ao(e,r,n),t!==null&&(jd(t,e,n),oo(t,e,n))}};function dc(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?!kr(n,r)||!kr(i,a):!0}function fc(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&&uc.enqueueReplaceState(t,t.state,null)}function pc(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=D({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function mc(e){si(e)}function hc(e){console.error(e)}function gc(e){si(e)}function _c(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function vc(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 yc(e,t,n){return n=io(n),n.tag=3,n.payload={element:null},n.callback=function(){_c(e,t)},n}function bc(e){return e=io(e),e.tag=3,e}function xc(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(){vc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){vc(t,n,r),typeof i!=`function`&&(hd===null?hd=new Set([this]):hd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Sc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ua(t,n,i,!0),n=yo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return bo===null?Ud():n.alternate===null&&nd===0&&(nd=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===Ba?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),ff(e,r,i)),!1;case 22:return n.flags|=65536,r===Ba?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)),ff(e,r,i)),!1}throw Error(s(435,n.tag))}return ff(e,r,i),Ud(),!1}if(Ki)return t=yo.current,t===null?(r!==Yi&&(t=Error(s(423),{cause:r}),na(ki(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=ki(r,n),i=yc(e.stateNode,r,i),so(e,i),nd!==4&&(nd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Yi&&(e=Error(s(422),{cause:r}),na(ki(e,n)))),!1;var a=Error(s(520),{cause:r});if(a=ki(a,n),cd===null?cd=[a]:cd.push(a),nd!==4&&(nd=2),t===null)return!0;r=ki(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=yc(n.stateNode,r,e),so(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(hd===null||!hd.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=bc(i),xc(i,e,n,r),so(n,i),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Cc=Error(s(461)),wc=!1;function Tc(e,t,n,r){t.child=e===null?eo(t,null,n,r):$a(t,e.child,n,r)}function Ec(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 fa(t),r=Uo(e,t,n,o,a,i),s=qo(),e!==null&&!wc?(Jo(e,t,i),el(e,t,i)):(Ki&&s&&Vi(t),t.flags|=1,Tc(e,t,r,i),t.child)}function Dc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!bi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Oc(e,t,a,r,i)):(e=Ci(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!tl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?kr:n,n(o,r)&&e.ref===t.ref)return el(e,t,i)}return t.flags|=1,e=xi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Oc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(kr(a,r)&&e.ref===t.ref){if(wc=!1,t.pendingProps=r=a,tl(e,i))e.flags&131072&&(wc=!0);else return t.lanes=e.lanes,el(e,t,i)}}return Ic(e,t,n,r,i)}function kc(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 jc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Fa(t,a===null?null:a.cachePool),a===null?_o():go(t,a),Co(t);else return r=t.lanes=536870912,jc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Fa(t,null),_o(),wo()):(Fa(t,a.cachePool),go(t,a),wo(),t.memoizedState=null);return Tc(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 jc(e,t,n,r,i){var a=Pa();return a=a===null?null:{parent:ya._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Fa(t,null),_o(),Co(t),e!==null&&ua(e,t,r,!0),t.childLanes=i,null}function Mc(e,t){return t=Gc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Nc(e,t,n){return $a(t,e.child,null,n),e=Mc(t,t.pendingProps),e.flags|=2,To(t),t.memoizedState=null,e}function Pc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(Ki){if(r.mode===`hidden`)return e=Mc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Ac(null,e);if(So(t),(e=Gi)?(e=am(e,Ji),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ii===null?null:{id:Li,overflow:Ri},retryLane:536870912,hydrationErrors:null},n=Ei(e),n.return=t,t.child=n,Wi=t,Gi=null)):e=null,e===null)throw Xi(t);return t.lanes=536870912,null}return Mc(t,r)}var a=e.memoizedState;if(a!==null){var o=a.dehydrated;if(So(t),i){if(t.flags&256)t.flags&=-257,t=Nc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558))}else if(wc||ua(e,t,n,!1),i=(n&e.childLanes)!==0,wc||i){if(mo.current===null){if(r=qu,r!==null&&(o=rt(r,n),o!==0&&o!==a.retryLane))throw a.retryLane=o,mi(e,o),jd(r,e,o),Cc;Ud()}t=Nc(e,t,n)}else e=a.treeContext,Gi=lm(o.nextSibling),Wi=t,Ki=!0,qi=null,Ji=!1,e!==null&&Ui(t,e),t=Mc(t,r),t.flags|=134221824;return t}return e=xi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Fc(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(s(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Ic(e,t,n,r,i){return fa(t),n=Uo(e,t,n,r,void 0,i),r=qo(),e!==null&&!wc?(Jo(e,t,i),el(e,t,i)):(Ki&&r&&Vi(t),t.flags|=1,Tc(e,t,n,i),t.child)}function Lc(e,t,n,r,i,a){return fa(t),t.updateQueue=null,n=Go(t,r,n,i),Wo(e),r=qo(),e!==null&&!wc?(Jo(e,t,a),el(e,t,a)):(Ki&&r&&Vi(t),t.flags|=1,Tc(e,t,n,a),t.child)}function Rc(e,t,n,r,i){if(fa(t),t.stateNode===null){var a=_i,o=n.contextType;typeof o==`object`&&o&&(a=pa(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=uc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},no(t),o=n.contextType,a.context=typeof o==`object`&&o?pa(o):_i,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(lc(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&&uc.enqueueReplaceState(a,a.state,null),uo(t,r,a,i),lo(),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=pc(n,s);a.props=c;var l=a.context,u=n.contextType;o=_i,typeof u==`object`&&u&&(o=pa(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)&&fc(t,a,r,o),to=!1;var f=t.memoizedState;a.state=f,uo(t,r,a,i),lo(),l=t.memoizedState,s||f!==l||to?(typeof d==`function`&&(lc(t,n,d,r),l=t.memoizedState),(c=to||dc(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,ro(e,t),o=t.memoizedProps,u=pc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=_i,typeof l==`object`&&l&&(c=pa(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)&&fc(t,a,r,c),to=!1,f=t.memoizedState,a.state=f,uo(t,r,a,i),lo();var p=t.memoizedState;o!==d||f!==p||to||e!==null&&e.dependencies!==null&&da(e.dependencies)?(typeof s==`function`&&(lc(t,n,s,r),p=t.memoizedState),(u=to||dc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&da(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,Fc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=$a(t,e.child,null,i),t.child=$a(t,null,n,i)):Tc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=el(e,t,i),e}function zc(e,t,n,r){return ea(),t.flags|=256,Tc(e,t,n,r),t.child}var Bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vc(e){return{baseLanes:e,cachePool:Ia()}}function Hc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=od),e}function Uc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Eo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(Ki){if(i?xo(t):wo(),(e=Gi)?(e=am(e,Ji),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ii===null?null:{id:Li,overflow:Ri},retryLane:536870912,hydrationErrors:null},n=Ei(e),n.return=t,t.child=n,Wi=t,Gi=null)):e=null,e===null)throw Xi(t);return t.lanes=sm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(wo(),i=t.mode,a=Gc({mode:`hidden`,children:a},i),r=wi(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Vc(n),r.childLanes=Hc(e,o,n),t.memoizedState=Bc,Ac(null,r)):(xo(t),Wc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return qc(e,t,a,o,r,c,s,n)}return i?(wo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=xi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=wi(i,a,n,null),i.flags|=2):i=xi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Ac(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Vc(n):(a=i.cachePool,a===null?a=Ia():(s=ya._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Hc(e,o,n),t.memoizedState=Bc,Ac(e.child,r)):(xo(t),n=e.child,e=n.sibling,n=xi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Wc(e,t){return t=Gc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Gc(e,t){return e=yi(22,e,null,t),e.lanes=0,e}function Kc(e,t,n){return $a(t,e.child,null,n),e=Wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qc(e,t,n,r,i,a,o,c){if(n)return t.flags&256?(xo(t),t.flags&=-257,Kc(e,t,c)):t.memoizedState===null?(wo(),a=i.fallback,o=t.mode,i=Gc({mode:`visible`,children:i.children},o),a=wi(a,o,c,null),a.flags|=2,i.return=t,a.return=t,i.sibling=a,t.child=i,$a(t,e.child,null,c),i=t.child,i.memoizedState=Vc(c),i.childLanes=Hc(e,r,c),t.memoizedState=Bc,Ac(null,i)):(wo(),t.child=e.child,t.flags|=128,null);if(xo(t),sm(a)){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(i=Error(s(419)),i.stack=``,i.digest=r,na({value:i,source:null,stack:null})),Kc(e,t,c)}if(wc||ua(e,t,c,!1),r=(c&e.childLanes)!==0,wc||r){if(mo.current!==null)return Kc(e,t,c);if(r=qu,r!==null&&(i=rt(r,c),i!==0&&i!==o.retryLane))throw o.retryLane=i,mi(e,i),jd(r,e,i),Cc;return om(a)||Ud(),Kc(e,t,c)}return om(a)?(t.flags|=192,t.child=e.child,null):(e=o.treeContext,Gi=lm(a.nextSibling),Wi=t,Ki=!0,qi=null,Ji=!1,e!==null&&Ui(t,e),t=Wc(t,i.children),t.flags|=134221824,t)}function Jc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ca(e.return,t,n)}function Yc(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&ko(n)===null&&(t=e),e=e.sibling}return t}function Xc(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 Zc(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function Qc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Eo.current;if(t.flags&128)return Do(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Do(t,o),i===`backwards`&&e!==null?(Zc(e),Tc(e,t,r,n),Zc(e)):Tc(e,t,r,n),r=Ki?Ni:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Jc(e,n,t);else if(e.tag===19)Jc(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`backwards`:n=Yc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,Zc(t)),Xc(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ko(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Xc(t,!0,n,null,a,r);break;case`together`:Xc(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=Yc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Xc(t,!1,i,n,a,r)}return t.child}function $c(e,t,n){var r=t.pendingProps;return oa(t,t.type,r.value),Tc(e,t,r.children,n),t.child}function el(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),rd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ua(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,n=xi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=xi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function tl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&da(e)))}function nl(e,t,n){switch(t.tag){case 3:pe(t,t.stateNode.containerInfo),oa(t,ya,e.memoizedState.cache),ea();break;case 27:case 5:he(t);break;case 4:pe(t,t.stateNode.containerInfo);break;case 10:oa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,So(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return xo(t),t.flags|=128,null;r=ua(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?Uc(e,t,n):(xo(t),e=el(e,t,n),e===null?null:e.sibling)}xo(t);break;case 19:if(t.flags&128)return Qc(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(ua(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Qc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Do(t,Eo.current),r)break;return null;case 22:return t.lanes=0,kc(e,t,n,t.pendingProps);case 24:oa(t,ya,e.memoizedState.cache)}return el(e,t,n)}function rl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)wc=!0;else{if(!tl(e,n)&&!(t.flags&128))return wc=!1,nl(e,t,n);wc=!!(e.flags&131072)}}else wc=!1,Ki&&t.flags&1048576&&Bi(t,Ni,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ua(t.elementType),t.type=e,typeof e==`function`)bi(e)?(r=pc(e,r),t.tag=1,t=Rc(null,t,e,r,n)):(t.tag=0,t=Ic(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===I){t.tag=11,t=Ec(null,t,e,r,n);break a}if(i===z){t.tag=14,t=Dc(null,t,e,r,n);break a}if(i===F){t.tag=10,t.type=e,t=$c(null,t,n);break a}}throw t=K(e)||e,Error(s(306,t,``))}}return t;case 0:return Ic(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=pc(r,t.pendingProps),Rc(e,t,r,i,n);case 3:a:{if(pe(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,ro(e,t),uo(t,r,null,n);var o=t.memoizedState;if(r=o.cache,oa(t,ya,r),r!==a.cache&&la(t,[ya],n,!0),lo(),r=o.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=zc(e,t,r,n);break a}if(r!==i){i=ki(Error(s(424)),t),na(i),t=zc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Gi=lm(e.firstChild),Wi=t,Ki=!0,qi=null,Ji=!0,n=eo(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ea(),r===i){t=el(e,t,n);break a}Tc(e,t,r,n)}t=t.child}return t;case 26:return Fc(e,t),e===null?(n=Nm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ki||(t.stateNode=fp(t.type,t.pendingProps,de.current,t)):t.memoizedState=Nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return he(t),e===null&&Ki&&(r=t.stateNode=hm(t.type,t.pendingProps,de.current),Wi=t,Ji=!0,i=Gi,Sp(t.type)?(um=i,Gi=lm(r.firstChild)):Gi=i),Tc(e,t,t.pendingProps.children,n),Fc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ki&&((i=r=Gi)&&(r=rm(r,t.type,t.pendingProps,Ji),r===null?i=!1:(t.stateNode=r,Wi=t,Gi=lm(r.firstChild),Ji=!1,i=!0)),i||Xi(t)),he(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,r=a.children,pp(i,a)?r=null:o!==null&&pp(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=Uo(e,t,Ko,null,null,n),sh._currentValue=i),Fc(e,t),Tc(e,t,r,n),t.child;case 6:return e===null&&Ki&&((e=n=Gi)&&(n=im(n,t.pendingProps,Ji),n===null?e=!1:(t.stateNode=n,Wi=t,Gi=null,e=!0)),e||Xi(t)),null;case 13:return Uc(e,t,n);case 4:return pe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=$a(t,null,r,n):Tc(e,t,r,n),t.child;case 11:return Ec(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Fc(e,t),Tc(e,t,r,n),t.child;case 8:return Tc(e,t,t.pendingProps.children,n),t.child;case 12:return Tc(e,t,t.pendingProps.children,n),t.child;case 10:return $c(e,t,n);case 9:return i=t.type._context,r=t.pendingProps.children,fa(t),i=pa(i),r=r(i),t.flags|=1,Tc(e,t,r,n),t.child;case 14:return Dc(e,t,t.type,t.pendingProps,n);case 15:return Oc(e,t,t.type,t.pendingProps,n);case 19:return Qc(e,t,n);case 31:return Pc(e,t,n);case 22:return kc(e,t,n,t.pendingProps);case 24:return fa(t),r=pa(ya),e===null?(i=Pa(),i===null&&(i=qu,a=ba(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},no(t),oa(t,ya,i)):((e.lanes&n)!==0&&(ro(e,t),uo(t,null,null,n),lo()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,oa(t,ya,r),r!==i.cache&&la(t,[ya],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),oa(t,ya,r))),Tc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:Ki&&Vi(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Fc(e,t),Tc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function il(e){e.flags|=4}function al(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Jm(t,r):Jm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Bd())e.flags|=8192;else throw Wa=Ba,Ra}}else e.flags&=-16777217}function ol(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t)){if(Bd())e.flags|=8192;else throw Wa=Ba,Ra}}function sl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ze(),e.lanes|=t,sd|=t)}function cl(e,t){if(!Ki)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,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;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function ll(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&1206910976,r|=i.flags&1206910976,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 ul(e,t,n){var r=t.pendingProps;switch(Hi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ll(t),null;case 1:return ll(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),sa(ya),me(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&($i(t)?il(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ta())),ll(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(il(t),a===null?(ll(t),al(t,i,null,r,n)):(ll(t),ol(t,a))):a?a===e.memoizedState?(ll(t),t.flags&=-16777217):(il(t),ll(t),ol(t,a)):(e=e.memoizedProps,e!==r&&il(t),ll(t),al(t,i,e,r,n)),null;case 27:if(ge(t),n=de.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&il(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return ll(t),t.subtreeFlags&=-33554433,null}e=le.current,$i(t)?Zi(t,e):(e=hm(i,r,n),t.stateNode=e,il(t))}return ll(t),t.subtreeFlags&=-33554433,null;case 5:if(ge(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&il(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return ll(t),t.subtreeFlags&=-33554433,null}if(a=le.current,$i(t))Zi(t,a);else{var o=lp(de.current);switch(a){case 1:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=o.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[lt]=t,a[ut]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(np(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&il(t)}}return ll(t),t.subtreeFlags&=-33554433,al(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&il(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=de.current,$i(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Wi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[lt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||$f(e.nodeValue,n)),e||Xi(t,!0)}else e=lp(e).createTextNode(r),e[lt]=t,t.stateNode=e}return ll(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=$i(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[lt]=t}else ea(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ll(t),e=!1}else n=ta(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(To(t),t):(To(t),null);if(t.flags&128)throw Error(s(558))}return ll(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=$i(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[lt]=t}else ea(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ll(t),i=!1}else i=ta(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(To(t),t):(To(t),null)}return To(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),sl(t,t.updateQueue),ll(t),null);case 4:return me(),e===null&&Uf(t.stateNode.containerInfo),t.flags|=67108864,ll(t),null;case 10:return sa(t.type),ll(t),null;case 19:if(Oo(t),r=t.memoizedState,r===null)return ll(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)cl(r,!1);else{if(nd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=ko(e),a!==null){for(t.flags|=128,cl(r,!1),e=a.updateQueue,t.updateQueue=e,sl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Si(n,e),n=n.sibling;return Do(t,Eo.current&1|2),Ki&&zi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Oe()>pd&&(t.flags|=128,i=!0,cl(r,!1),t.lanes=4194304)}}else{if(!i){if(e=ko(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,sl(t,e),cl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!a.alternate&&!Ki)return ll(t),null}else 2*Oe()-r.renderingStartTime>pd&&n!==536870912&&(t.flags|=128,i=!0,cl(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Oe(),e.sibling=null,a=Eo.current,a=i?a&1|2:a&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||Ki?Do(t,a):(n=a,ce(yo,t),ce(Eo,n),bo===null&&(bo=t)),Ki&&zi(t,r.treeForkCount),e}return ll(t),null;case 22:case 23:return To(t),vo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(ll(t),t.subtreeFlags&6&&(t.flags|=8192)):ll(t),n=t.updateQueue,n!==null&&sl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&se(Na),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),sa(ya),ll(t),null;case 25:return null;case 30:return t.flags|=33554432,ll(t),null}throw Error(s(156,t.tag))}function dl(e,t){switch(Hi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return sa(ya),me(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ge(t),null;case 31:if(t.memoizedState!==null){if(To(t),t.alternate===null)throw Error(s(340));ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(To(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Oo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return me(),null;case 10:return sa(t.type),null;case 22:case 23:return To(t),vo(),e!==null&&se(Na),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return sa(ya),null;case 25:return null;default:return null}}function fl(e,t){switch(Hi(t),t.tag){case 3:sa(ya),me();break;case 26:case 27:case 5:ge(t);break;case 4:me();break;case 31:t.memoizedState!==null&&To(t);break;case 13:To(t);break;case 19:Oo(t);break;case 10:sa(t.type);break;case 22:case 23:To(t),vo(),e!==null&&se(Na);break;case 24:sa(ya)}}function pl(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){df(t,t.return,e)}}function ml(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){df(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){df(t,t.return,e)}}function hl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{po(t,n)}catch(t){df(e,e.return,t)}}}function gl(e,t,n){n.props=pc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){df(e,t,n)}}function _l(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:var i=e.stateNode,a=ii(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);h(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){df(e,t,n)}}function vl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){df(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){df(e,t,n)}else n.current=null}}function yl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)em(e.stateNode,t[n])}function bl(e){for(var t=e.return;t!==null&&(Cl(t)&&em(e.stateNode,t.stateNode),!Sl(t));)t=t.return}function xl(e){for(var t=e.return;t!==null&&(Cl(t)&&tm(e.stateNode,t.stateNode),!Sl(t));)t=t.return}function Sl(e){return e.tag===5||e.tag===3||e.tag===27}function Cl(e){return e&&e.tag===7&&e.stateNode!==null}function wl(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){df(e,e.return,t)}}function Tl(e,t,n){try{var r=e.stateNode;ip(r,e.type,n,t),r[ut]=t}catch(t){df(e,e.return,t)}}function El(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sp(e.type)||e.tag===4}function Dl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||El(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&&Sp(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 Ol(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=an)),yl(e,r),Mt=!0;else if(i!==4&&(i===27&&(yl(e,r),r=null,Sp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Ol(e,t,n,r),e=e.sibling;e!==null;)Ol(e,t,n,r),e=e.sibling}function kl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),yl(e,r),Mt=!0;else if(i!==4&&(i===27&&(yl(e,r),r=null,Sp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(kl(e,t,n,r),e=e.sibling;e!==null;)kl(e,t,n,r),e=e.sibling}function Al(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);np(t,r,n),t[lt]=e,t[ut]=n}catch(t){df(e,e.return,t)}}var jl=!1,Ml=null;function Nl(e){(e.tag===30||e.subtreeFlags&33554432)&&(jl=!0)}var Pl=null;function Fl(){var e=Pl;return Pl=null,e}var Il=0;function Ll(e,t,n,r,i){return Il=0,Rl(e.child,t,n,r,i)}function Rl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Op(o);r.push(s),s.view&&(a=!0)}else a||Op(o).view&&(a=!0);jl=!0,Tp(o,Il===0?t:t+`_`+Il,n),Il++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Rl(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function zl(e,t){for(;e!==null;)e.tag===5?Ep(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||zl(e.child,t)),e=e.sibling}function Bl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Bl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(s(544));var n=t.name;t=oi(t.default,t.share),t!==`none`&&(Ll(e,n,t,null,!1)||zl(e.child,!1))}e=e.sibling}}function Vl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=ii(r,n),a=oi(r.default,n.paired?r.share:r.enter);a===`none`?Bl(e):Ll(e,i,a,null,!1)?(Bl(e),n.paired||t||Ad(e,r.onEnter)):zl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Vl(e,t),e=e.sibling;else Bl(e)}function Hl(e){if(Ml!==null&&Ml.size!==0){var t=Ml;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=oi(n.default,n.share);if(a!==`none`&&(Ll(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Ad(e,n.onShare)):zl(e.child,!1)),t.delete(r),t.size===0)break}}}Hl(e)}e=e.sibling}}}function Ul(e){if(e.tag===30){var t=e.memoizedProps,n=ii(t,e.stateNode),r=Ml===null?void 0:Ml.get(n),i=oi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Ll(e,n,i,null,!1)?r===void 0?Ad(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Ml.delete(n),Ad(e,t.onShare)):zl(e.child,!1)),Ml!==null&&Hl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ul(e),e=e.sibling;else Ml!==null&&Hl(e)}function Wl(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=ii(t,e.stateNode);t=oi(t.default,t.update),e.flags&=-5,t!==`none`&&Ll(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Wl(e);e=e.sibling}}function Gl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,zl(e.child,!1))}Gl(e)}e=e.sibling}}function Kl(e){if(e.tag===30)e.stateNode.paired=null,zl(e.child,!1),Gl(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Kl(e),e=e.sibling;else Gl(e)}function ql(e){for(e=e.child;e!==null;)e.tag===30?zl(e.child,!1):e.subtreeFlags&33554432&&ql(e),e=e.sibling}function Jl(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Il<a.length){var l=a[Il],u=Op(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Tp(c,Il===0?n:n+`_`+Il,i),s&&e.flags&4||(Pl===null&&(Pl=[]),Pl.push(c,Il===0?r:r+`_`+Il,t.memoizedProps)),Il++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:Jl(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function Yl(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=ii(n,r),a=oi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(kp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Il=0,i=Jl(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Ad(e,n.onUpdate))}else e.subtreeFlags&33554432&&Yl(e,t);e=e.sibling}}var Xl=!1,Zl=!1,Ql=!1,$l=!1,eu=typeof WeakSet==`function`?WeakSet:Set,tu=null,nu=!1,ru=!1,iu=!1,au=!1;function ou(e,t,n){if(e=e.containerInfo,sp=gh,e=Pr(e),Fr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(cp={focusedElem:e,selectionRange:r},gh=!1,n=(n&335544064)===n,tu=t,t=n?9270:1024;tu!==null;){if(e=tu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Ul(r[a]);if(e.alternate===null&&e.flags&2)n&&Nl(e),su(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Ul(r),su(n);continue}if(r!==null&&r.memoizedState!==null){n&&Nl(e),su(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,tu=r):(n&&Wl(e),su(n))}}Ml=null}function su(e){for(;tu!==null;){var t=tu,n=e,r=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(i&1024&&r!==null){n=void 0,i=r.memoizedProps,r=r.memoizedState;var a=t.stateNode;try{var o=pc(t.type,i);n=a.getSnapshotBeforeUpdate(o,r),a.__reactInternalSnapshotBeforeUpdate=n}catch(e){df(t,t.return,e)}}break;case 3:if(i&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)nm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:nm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=ii(r.memoizedProps,r.stateNode),i=t.memoizedProps,i=oi(i.default,i.update),i!==`none`&&Ll(r,n,i,r.memoizedState=[],!0));break;default:if(i&1024)throw Error(s(163))}if(r=t.sibling,r!==null){r.return=t.return,tu=r;break}tu=t.return}}function cu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Du(e,n),r&4&&pl(5,n);break;case 1:if(Du(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){df(n,n.return,e)}else{var i=pc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){df(n,n.return,e)}}}r&64&&hl(n),r&512&&_l(n,n.return);break;case 3:if(Du(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{po(e,t)}catch(e){df(n,n.return,e)}}break;case 27:t===null&&r&4&&Al(n);case 26:case 5:Du(e,n),t===null&&r&4&&wl(n),r&512&&_l(n,n.return);break;case 12:Du(e,n);break;case 31:Du(e,n),r&4&&gu(e,n);break;case 13:Du(e,n),r&4&&_u(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=hf.bind(null,n),cm(e,n))));break;case 22:if(r=n.memoizedState!==null||Xl,!r){var a=t!==null&&t.memoizedState!==null||Zl;t=Xl,i=Zl,Xl=r,(Zl=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),ku(e,n,r)):Du(e,n),Xl=t,Zl=i}break;case 30:Du(e,n),r&512&&_l(n,n.return);break;case 7:r&512&&_l(n,n.return);default:Du(e,n)}}function lu(e,t){for(e=e.child;e!==null;)uu(e,t),e=e.sibling}function uu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){df(e,e.return,t)}du(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Mt=!0}catch(t){df(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?wp(s,!0):wp(e.stateNode,!1)}catch(t){df(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&lu(e,t);break;default:lu(e,t)}}function du(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:uu(n,r);break a;case 22:n.memoizedState===null&&du(n,r);break a;default:du(n,r)}}e=e.sibling}}function fu(e){var t=e.alternate;t!==null&&(e.alternate=null,fu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&vt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var pu=null,mu=!1;function $(e,t,n){for(n=n.child;n!==null;)hu(e,t,n),n=n.sibling}function hu(e,t,n){if(Re&&typeof Re.onCommitFiberUnmount==`function`)try{Re.onCommitFiberUnmount(Le,n)}catch{}switch(n.tag){case 26:Zl||vl(n,t),$(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!Zl&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zl||vl(n,t),xl(n);var r=pu,i=mu;Sp(n.type)&&(pu=n.stateNode,mu=!1),$(e,t,n),gm(n.stateNode,n.type,n.memoizedProps),pu=r,mu=i;break;case 5:Zl||vl(n,t),xl(n);case 6:if(n.tag===6&&xl(n),r=pu,i=mu,pu=null,$(e,t,n),pu=r,mu=i,pu!==null){if(mu)try{(pu.nodeType===9?pu.body:pu.nodeName===`HTML`?pu.ownerDocument.body:pu).removeChild(n.stateNode),Mt=!0}catch(e){df(n,t,e)}else try{pu.removeChild(n.stateNode),Mt=!0}catch(e){df(n,t,e)}}break;case 18:pu!==null&&(mu?(e=pu,Cp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hh(e)):Cp(pu,n.stateNode));break;case 4:r=pu,i=mu,pu=n.stateNode.containerInfo,mu=!0,$(e,t,n),pu=r,mu=i;break;case 0:case 11:case 14:case 15:ml(2,n,t),Zl||ml(4,n,t),$(e,t,n);break;case 1:Zl||(vl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&gl(n,t,r)),$(e,t,n);break;case 21:$(e,t,n);break;case 22:Zl=(r=Zl)||n.memoizedState!==null,$(e,t,n),Zl=r;break;case 30:vl(n,t),$(e,t,n);break;case 7:Zl||vl(n,t),$(e,t,n);break;default:$(e,t,n)}}function gu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hh(e)}catch(e){df(t,t.return,e)}}}function _u(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hh(e)}catch(e){df(t,t.return,e)}}function vu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new eu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new eu),t;default:throw Error(s(435,e.tag))}}function yu(e,t){var n=vu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=gf.bind(null,e,t);t.then(r,r)}})}function bu(e,t,n){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var a=r[i],o=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Sp(l.type)){pu=l.stateNode,mu=!1;break a}break;case 5:pu=l.stateNode,mu=!1;break a;case 3:case 4:pu=l.stateNode.containerInfo,mu=!0;break a}l=l.return}if(pu===null)throw Error(s(160));hu(o,c,a),pu=null,mu=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Su(t,e,n),t=t.sibling}var xu=null;function Su(e,t,n){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(i&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var a=0;a<r.length;a++){var o=r[a];o.ref.impl=o.nextImpl}bu(t,e,n),Cu(e),i&4&&(ml(3,e,e.return),pl(3,e),ml(5,e,e.return));break;case 1:bu(t,e,n),Cu(e),i&512&&(Zl||r===null||vl(r,r.return)),i&64&&Xl&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(a=xu,bu(t,e,n),Cu(e),i&512&&(Zl||r===null||vl(r,r.return)),i&4){if(i=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(Xl)e.stateNode=fp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,i=a.ownerDocument||a;b:switch(t){case`title`:r=i.getElementsByTagName(`title`)[0],(!r||r[gt]||r[lt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=i.createElement(t),i.head.insertBefore(r,i.querySelector(`head > title`))),np(r,t,n),r[lt]=e,Ct(r),t=r;break a;case`link`:if(a=Gm(`link`,`href`,i).get(t+(n.href||``))){for(o=0;o<a.length;o++)if(r=a[o],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){a.splice(o,1);break b}}r=i.createElement(t),np(r,t,n),i.head.appendChild(r);break;case`meta`:if(a=Gm(`meta`,`content`,i).get(t+(n.content||``))){for(o=0;o<a.length;o++)if(r=a[o],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){a.splice(o,1);break b}}r=i.createElement(t),np(r,t,n),i.head.appendChild(r);break;default:throw Error(s(468,t))}r[lt]=e,Ct(r),t=r}e.stateNode=t}}else Xl||Km(a,e.type,e.stateNode)}else e.stateNode=Bm(a,n,e.memoizedProps)}else i===n?n===null&&e.stateNode!==null&&Tl(e,e.memoizedProps,r.memoizedProps):(i===null?(t=r.stateNode,t===null||Zl||t.parentNode.removeChild(t)):i.count--,n===null?Xl||Km(a,e.type,e.stateNode):Bm(a,n,e.memoizedProps))}break;case 27:bu(t,e,n),Cu(e),i&512&&(Zl||r===null||vl(r,r.return)),r!==null&&i&4&&Tl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(a=Ql,Ql=!1,bu(t,e,n),Ql=a,Cu(e),i&512&&(Zl||r===null||vl(r,r.return)),e.flags&32){t=e.stateNode;try{Xt(t,``),Mt=!0}catch(t){df(e,e.return,t)}}i&4&&e.stateNode!=null&&(t=e.memoizedProps,Tl(e,t,r===null?t:r.memoizedProps)),i&1024&&($l=!0);break;case 6:if(bu(t,e,n),Cu(e),i&4){if(e.stateNode===null)throw Error(s(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Mt=!0}catch(t){df(e,e.return,t)}}break;case 3:if(Mt=!1,Wm=null,a=xu,xu=bm(t.containerInfo),bu(t,e,n),xu=a,Cu(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Hh(t.containerInfo)}catch(t){df(e,e.return,t)}$l&&($l=!1,wu(e)),Mt=!1;break;case 4:i=Ql,Ql=Xl,r=Nt(),a=xu,xu=bm(e.stateNode.containerInfo),bu(t,e,n),Cu(e),xu=a,Mt&&ru&&(iu=!0),Mt=r,Ql=i;break;case 12:bu(t,e,n),Cu(e);break;case 31:bu(t,e,n),Cu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,yu(e,t)));break;case 13:bu(t,e,n),Cu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(dd=Oe()),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,yu(e,t)));break;case 22:a=e.memoizedState!==null,o=r!==null&&r.memoizedState!==null;var c=Xl,l=Zl,u=Ql;Xl=c||a,Ql=u||a,Zl=l||o,bu(t,e,n),Zl=l,Ql=u,Xl=c,Cu(e),i&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,!a||r===null||o||Xl||Zl||(t=o||Zl,n=Xl,r=Zl,Xl=a||Xl,Zl=t,Ou(e,2),Xl=n,Zl=r),!a&&Ql||lu(e,a)),i&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,yu(e,n))));break;case 19:bu(t,e,n),Cu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,yu(e,t)));break;case 30:i&512&&(Zl||r===null||vl(r,r.return)),i=Nt(),a=ru,o=(n&335544064)===n,c=e.memoizedProps,ru=o&&oi(c.default,c.update)!==`none`,bu(t,e,n),Cu(e),o&&r!==null&&Mt&&(e.flags|=4),ru=a,Mt=i;break;case 21:break;case 7:i&512&&(Zl||r===null||vl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:bu(t,e,n),Cu(e)}}function Cu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(El(r)){n=r;break}r=r.return}r=null;for(var i=e.return;i!==null;){if(Cl(i)){var a=i.stateNode;r===null?r=[a]:r.push(a)}if(Sl(i))break;i=i.return}var o=r;if(n==null)throw Error(s(160));switch(n.tag){case 27:var c=n.stateNode;kl(e,Dl(e),c,o);break;case 5:var l=n.stateNode;n.flags&32&&(Xt(l,``),n.flags&=-33),kl(e,Dl(e),l,o);break;case 3:case 4:var u=n.stateNode.containerInfo;Ol(e,Dl(e),u,o);break;default:throw Error(s(161))}}catch(t){df(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function wu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;wu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,gh=!0,t.reset(),gh=!1),e=e.sibling}}function Tu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Eu(t,e),t=t.sibling;else Yl(t,!1)}function Eu(e,t){var n=e.alternate;if(n===null)Vl(e,!1);else switch(e.tag){case 3:if(au=nu=!1,Fl(),Tu(t,e),!nu&&!iu){if(e=Pl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ep(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),au=!0}Pl=null;break;case 5:Tu(t,e);break;case 4:r=nu,nu=!1,Tu(t,e),nu&&(iu=!0),nu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Tu(t,e):Vl(e,!1));break;case 30:r=nu,i=Fl(),nu=!1,Tu(t,e),nu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=ii(a,o),o=ii(n.memoizedProps,o);var s=oi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Il=0,t=Jl(e,n,t,o,s,a,!0),Il!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Ad(e,e.memoizedProps.onUpdate),Pl=i):i!==null&&(i.push.apply(i,Pl),Pl=i),nu=e.flags&32?!0:r;break;default:Tu(t,e)}}function Du(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cu(e,t.alternate,t),t=t.sibling}function Ou(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:ml(4,n,n.return),Ou(n,r);break;case 1:vl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&gl(n,n.return,i),Ou(n,r);break;case 27:r&2&&gm(n.stateNode,n.type,n.memoizedProps);case 5:vl(n,n.return),n.tag!==5&&n.tag!==27||xl(n),Ou(n,r);break;case 6:xl(n);break;case 26:vl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||Zl||i.parentNode.removeChild(i),Ou(n,r);break;case 22:n.memoizedState===null&&Ou(n,r);break;case 30:vl(n,n.return),Ou(n,r);break;case 7:vl(n,n.return);default:Ou(n,r)}e=e.sibling}}function ku(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:ku(i,a,n),pl(4,a);break;case 1:if(ku(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){df(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)fo(l[i],c)}catch(e){df(r,r.return,e)}}s&&o&64&&hl(a),_l(a,a.return);break;case 27:n&2&&Al(a);case 5:a.tag!==5&&a.tag!==27||bl(a),ku(i,a,n),s&&r===null&&o&4&&wl(a),_l(a,a.return);break;case 6:bl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||Xl||Km(bm(c.ownerDocument),a.type,c),ku(i,a,n),s&&r===null&&o&4&&wl(a),_l(a,a.return);break;case 12:ku(i,a,n);break;case 31:ku(i,a,n),s&&o&4&&gu(i,a);break;case 13:ku(i,a,n),s&&o&4&&_u(i,a);break;case 22:a.memoizedState===null&&ku(i,a,n),_l(a,a.return);break;case 30:ku(i,a,n),_l(a,a.return);break;case 7:_l(a,a.return);default:ku(i,a,n)}t=t.sibling}}function Au(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&&xa(n))}function ju(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&xa(e))}function Mu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Nu(e,t,n,r),t=t.sibling;else i&&ql(t)}function Nu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Kl(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Mu(e,t,n,r),a&2048&&pl(9,t);break;case 1:Mu(e,t,n,r);break;case 3:Mu(e,t,n,r),i&&au&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&xa(a)));break;case 12:if(a&2048){Mu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){df(t,t.return,e)}}else Mu(e,t,n,r);break;case 31:Mu(e,t,n,r);break;case 13:Mu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&Kl(t),o._visibility&2?Mu(e,t,n,r):(o._visibility|=2,Pu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&Kl(s),o._visibility&2?Mu(e,t,n,r):Fu(e,t)),a&2048&&Au(s,t);break;case 24:Mu(e,t,n,r),a&2048&&ju(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(zl(a.child,!0),zl(t.child,!0))),Mu(e,t,n,r);break;default:Mu(e,t,n,r)}}function Pu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!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:Pu(a,o,s,c,i),pl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Pu(a,o,s,c,i)):u._visibility&2?Pu(a,o,s,c,i):Fu(a,o),i&&l&2048&&Au(o.alternate,o);break;case 24:Pu(a,o,s,c,i),i&&l&2048&&ju(o.alternate,o);break;default:Pu(a,o,s,c,i)}t=t.sibling}}function Fu(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:Fu(n,r),i&2048&&Au(r.alternate,r);break;case 24:Fu(n,r),i&2048&&ju(r.alternate,r);break;default:Fu(n,r)}t=t.sibling}}var Iu=8192;function Lu(e,t,n){if(e.subtreeFlags&Iu)for(e=e.child;e!==null;)Ru(e,t,n),e=e.sibling}function Ru(e,t,n){switch(e.tag){case 26:Lu(e,t,n),e.flags&Iu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Zm(n,e)):Qm(n,xu,e.memoizedState,e.memoizedProps));break;case 5:Lu(e,t,n),e.flags&Iu&&(e=e.stateNode,(t&335544128)===t&&Zm(n,e));break;case 3:case 4:var r=xu;xu=bm(e.stateNode.containerInfo),Lu(e,t,n),xu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Iu,Iu=16777216,Lu(e,t,n),Iu=r):Lu(e,t,n));break;case 30:if((e.flags&Iu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Ml===null&&(Ml=new Map),Ml.set(r,i)}Lu(e,t,n);break;default:Lu(e,t,n)}}function zu(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 Bu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tu=r,Uu(r,e)}zu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vu(e),e=e.sibling}function Vu(e){switch(e.tag){case 0:case 11:case 15:Bu(e),e.flags&2048&&ml(9,e,e.return);break;case 3:Bu(e);break;case 12:Bu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hu(e)):Bu(e);break;default:Bu(e)}}function Hu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tu=r,Uu(r,e)}zu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ml(8,t,t.return),Hu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Hu(t));break;default:Hu(t)}e=e.sibling}}function Uu(e,t){for(;tu!==null;){var n=tu;switch(n.tag){case 0:case 11:case 15:ml(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:xa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tu=r;else a:for(n=e;tu!==null;){r=tu;var i=r.sibling,a=r.return;if(fu(r),r===n){tu=null;break a}if(i!==null){i.return=a,tu=i;break a}tu=a}}}var Wu={getCacheForType:function(e){var t=pa(ya),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return pa(ya).controller.signal}},Gu=typeof WeakMap==`function`?WeakMap:Map,Ku=0,qu=null,Ju=null,Yu=0,Xu=0,Zu=null,Qu=!1,$u=!1,ed=!1,td=0,nd=0,rd=0,id=0,ad=0,od=0,sd=0,cd=null,ld=null,ud=!1,dd=0,fd=0,pd=1/0,md=null,hd=null,gd=0,_d=null,vd=null,yd=0,bd=0,xd=null,Sd=null,Cd=null,wd=null,Td=null,Ed=0,Dd=null;function Od(){return Ku&2&&Yu!==0?Yu&-Yu:J.T===null?ot():Mf()}function kd(){if(od===0){if(!(Yu&536870912)||Ki){var e=Ge;Ge<<=1,!(Ge&3932160)&&(Ge=262144),od=e}else od=536870912}return e=yo.current,e!==null&&(e.flags|=32),od}function Ad(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Pp(ii(e.memoizedProps,n))),wd===null&&(wd=[]),wd.push(t.bind(null,r))}}function jd(e,t,n){(e===qu&&(Xu===2||Xu===9)||e.cancelPendingCommit!==null)&&(Rd(e,0),Fd(e,Yu,od,!1)),$e(e,n),(!(Ku&2)||e!==qu)&&(e===qu&&(!(Ku&2)&&(id|=n),nd===4&&Fd(e,Yu,od,!1)),wf(e))}function Md(e,t,n){if(Ku&6)throw Error(s(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Je(e,t),i=r?Kd(e,t):Wd(e,t,!0),a=r;do{if(i===0){$u&&!r&&Fd(e,t,0,!1);break}if(n=e.current.alternate,a&&!Pd(n)){i=Wd(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var o=0;else o=e.pendingLanes&-536870913,o=o===0?o&536870912?536870912:0:o;if(o!==0){t=o;a:{var c=e;i=cd;var l=c.current.memoizedState.isDehydrated;if(l&&(Rd(c,o).flags|=256),o=Wd(c,o,!1),o!==2&&o!==6){if(ed&&!l){c.errorRecoveryDisabledLanes|=a,id|=a,i=4;break a}a=ld,ld=i,a!==null&&(ld===null?ld=a:ld.push.apply(ld,a))}i=o}if(a=!1,i!==2)continue}}if(i===1){Rd(e,0),Fd(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Fd(r,t,od,!Qu);break a;case 2:ld=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(i=dd+300-Oe(),10<i)){if(Fd(r,t,od,!Qu),Z(r,0,!0)!==0)break a;yd=t,r.timeoutHandle=gp(Nd.bind(null,r,n,ld,md,ud,t,od,id,sd,Qu,a,`Throttled`,-0,0),i);break a}Nd(r,n,ld,md,ud,t,od,id,sd,Qu,a,null,-0,0)}break}while(1);wf(e)}function Nd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;if(d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:an},Ml=null,Ru(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=nh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?dd-Oe():(a&4194048)===a?fd-Oe():0,m=eh(d,m),m!==null)){yd=a,e.cancelPendingCommit=m($d.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Fd(e,a,o,!l);return}$d(e,t,a,n,r,i,o,s,c,l,u,d)}function Pd(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(!Or(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 Fd(e,t,n,r){t=Ye(e,t),t&=~ad,t&=~id,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Be(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&tt(e,n,t)}function Id(){return Ku&6?!0:(Tf(0,!1),!1)}function Ld(){if(Ju!==null){if(Xu===0)var e=Ju.return;else e=Ju,aa=ia=null,Yo(e),qa=null,Ja=0,e=Ju;for(;e!==null;)fl(e.alternate,e),e=e.return;Ju=null}}function Rd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,_p(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),yd=0,Ld(),qu=e,Ju=n=xi(e.current,null),Yu=t,Xu=0,Zu=null,Qu=!1,$u=Je(e,t),ed=!1,sd=od=ad=id=rd=nd=0,ld=cd=null,ud=!1,td=Ye(e,t),di(),n}function zd(e,t){jo=null,J.H=ac,t===La||t===za?(t=Ga(),Xu=3):t===Ra?(t=Ga(),Xu=4):Xu=t===Cc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Zu=t,Ju===null&&(nd=1,_c(e,ki(t,e.current)))}function Bd(){var e=yo.current;return e===null?!0:(Yu&4194048)===Yu?bo===null:(Yu&62914560)===Yu||Yu&536870912?e===bo:!1}function Vd(){var e=J.H;return J.H=ac,e===null?ac:e}function Hd(){var e=J.A;return J.A=Wu,e}function Ud(){nd=4,Qu||(Yu&4194048)!==Yu&&yo.current!==null||($u=!0),!(rd&134217727)&&!(id&134217727)||qu===null||Fd(qu,Yu,od,!1)}function Wd(e,t,n){var r=Ku;Ku|=2;var i=Vd(),a=Hd();(qu!==e||Yu!==t)&&(md=null,Rd(e,t)),t=!1;var o=nd;a:do try{if(Xu!==0&&Ju!==null){var s=Ju,c=Zu;switch(Xu){case 8:Ld(),o=6;break a;case 3:case 2:case 9:case 6:yo.current===null&&(t=!0);var l=Xu;if(Xu=0,Zu=null,Xd(e,s,c,l),n&&$u){o=0;break a}break;default:l=Xu,Xu=0,Zu=null,Xd(e,s,c,l)}}Gd(),o=nd;break}catch(t){zd(e,t)}while(1);return t&&e.shellSuspendCounter++,aa=ia=null,Ku=r,J.H=i,J.A=a,Ju===null&&(qu=null,Yu=0,di()),o}function Gd(){for(;Ju!==null;)Jd(Ju)}function Kd(e,t){var n=Ku;Ku|=2;var r=Vd(),i=Hd();qu!==e||Yu!==t?(md=null,pd=Oe()+500,Rd(e,t)):$u=Je(e,t);a:do try{if(Xu!==0&&Ju!==null){t=Ju;var a=Zu;b:switch(Xu){case 1:Xu=0,Zu=null,Xd(e,t,a,1);break;case 2:case 9:if(Va(a)){Xu=0,Zu=null,Yd(t);break}t=function(){Xu!==2&&Xu!==9||qu!==e||(Xu=7),wf(e)},a.then(t,t);break a;case 3:Xu=7;break a;case 4:Xu=5;break a;case 7:Va(a)?(Xu=0,Zu=null,Yd(t)):(Xu=0,Zu=null,Xd(e,t,a,7));break;case 5:var o=null;switch(Ju.tag){case 26:o=Ju.memoizedState;case 5:case 27:var c=Ju;if(o?Ym(o):c.stateNode.complete){Xu=0,Zu=null;var l=c.sibling;if(l!==null)Ju=l;else{var u=c.return;u===null?Ju=null:(Ju=u,Zd(u))}break b}}Xu=0,Zu=null,Xd(e,t,a,5);break;case 6:Xu=0,Zu=null,Xd(e,t,a,6);break;case 8:Ld(),nd=6;break a;default:throw Error(s(462))}}qd();break}catch(t){zd(e,t)}while(1);return aa=ia=null,J.H=r,J.A=i,Ku=n,Ju===null?(qu=null,Yu=0,di(),nd):0}function qd(){for(;Ju!==null&&!X();)Jd(Ju)}function Jd(e){var t=rl(e.alternate,e,td);e.memoizedProps=e.pendingProps,t===null?Zd(e):Ju=t}function Yd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Lc(n,t,t.pendingProps,t.type,void 0,Yu);break;case 11:t=Lc(n,t,t.pendingProps,t.type.render,t.ref,Yu);break;case 5:Yo(t);var r=t;r===Wi&&(Ki?(Qi(r),r.tag===5&&r.stateNode!=null&&(Gi=r.stateNode)):(Qi(r),Ki=!0));default:fl(n,t),t=Ju=Si(t,td),t=rl(n,t,td)}e.memoizedProps=e.pendingProps,t===null?Zd(e):Ju=t}function Xd(e,t,n,r){aa=ia=null,Yo(t),qa=null,Ja=0;var i=t.return;try{if(Sc(e,i,t,n,Yu)){nd=1,_c(e,ki(n,e.current)),Ju=null;return}}catch(t){if(i!==null)throw Ju=i,t;nd=1,_c(e,ki(n,e.current)),Ju=null;return}t.flags&32768?(Ki||r===1?e=!0:$u||Yu&536870912?e=!1:(Qu=e=!0,(r===2||r===9||r===3||r===6)&&(r=yo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Qd(t,e)):Zd(t)}function Zd(e){var t=e;do{if(t.flags&32768){Qd(t,Qu);return}e=t.return;var n=ul(t.alternate,t,td);if(n!==null){Ju=n;return}if(t=t.sibling,t!==null){Ju=t;return}Ju=t=e}while(t!==null);nd===0&&(nd=5)}function Qd(e,t){do{var n=dl(e.alternate,e);if(n!==null){n.flags&=32767,Ju=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ju=e;return}Ju=e=n}while(e!==null);nd=6,Ju=null}function $d(e,t,n,r,i,a,o,c,l,u,d,f){e.cancelPendingCommit=null;do cf();while(gd!==0);if(Ku&6)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));e===qu&&(Ju=qu=null,Yu=0),vd=t,_d=e,yd=n,xd=i,Sd=r,ef(e,t,n,o,c,l,f)}}function ef(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(bd=s,s|=ui,et(e,n,s,r,i,a),wd=null,(n&335544064)===n?(Td=wa(e),r=10262):(Td=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,_f(Me,function(){return lf(),null})):(e.callbackNode=null,e.callbackPriority=0),jl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=J.T,J.T=null,i=Y.p,Y.p=2,a=Ku,Ku|=4;try{ou(e,t,n)}finally{Ku=a,Y.p=i,J.T=r}}gd=1,jl?Cd=Mp(o,e.containerInfo,Td,rf,af,nf,of,lf,tf,null,null):(rf(),af(),of())}function tf(e){if(gd!==0){var t=_d.onRecoverableError;t(e,{componentStack:null})}}function nf(){gd===3&&(gd=0,Eu(vd,_d),gd=4)}function rf(){if(gd===1){gd=0;var e=_d,t=vd,n=yd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=J.T,J.T=null;var i=Y.p;Y.p=2;var a=Ku;Ku|=4;try{ru=iu=!1,Su(t,e,n),n=cp;var o=Pr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Nr(s.ownerDocument.documentElement,s)){if(c!==null&&Fr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Mr(s,h),v=Mr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gh=!!sp,cp=sp=null}finally{Ku=a,Y.p=i,J.T=r}}e.current=t,gd=2}}function af(){if(gd===2){gd=0;var e=_d,t=vd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=J.T,J.T=null;var r=Y.p;Y.p=2;var i=Ku;Ku|=4;try{cu(e,t.alternate,t)}finally{Ku=i,Y.p=r,J.T=n}}gd=3}}function of(){if(gd===4||gd===3){gd=0;var e=Cd;Cd=null,De();var t=_d,n=vd,r=yd,i=Sd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?gd=5:(gd=0,vd=_d=null,sf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(hd=null),at(r),n=n.stateNode,Re&&typeof Re.onCommitFiberRoot==`function`)try{Re.onCommitFiberRoot(Le,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=J.T,a=Y.p,Y.p=2,J.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{J.T=n,Y.p=a}}if(i=wd,o=Td,Td=null,i!==null&&(wd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);yd&3&&cf(),wf(t),a=t.pendingLanes,r&261930&&a&42?t===Dd?Ed++:(Ed=0,Dd=t):(Ed=0,Dd=null),Tf(0,!1)}}function sf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,xa(t)))}function cf(){return Cd!==null&&(Cd.skipTransition(),Cd=null),rf(),af(),of(),lf()}function lf(){if(gd!==5)return!1;var e=_d,t=bd;bd=0;var n=at(yd),r=J.T,i=Y.p;try{Y.p=32>n?32:n,J.T=null,n=xd,xd=null;var a=_d,o=yd;if(gd=0,vd=_d=null,yd=0,Ku&6)throw Error(s(331));var c=Ku;if(Ku|=4,Vu(a.current),Nu(a,a.current,o,n),Ku=c,Tf(0,!1),Re&&typeof Re.onPostCommitFiberRoot==`function`)try{Re.onPostCommitFiberRoot(Le,a)}catch{}return!0}finally{Y.p=i,J.T=r,sf(e,t)}}function uf(e,t,n){t=ki(n,t),t=yc(e.stateNode,t,2),e=ao(e,t,2),e!==null&&($e(e,2),wf(e))}function df(e,t,n){if(e.tag===3)uf(e,e,n);else for(;t!==null;){if(t.tag===3){uf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(hd===null||!hd.has(r))){e=ki(n,e),n=bc(2),r=ao(t,n,2),r!==null&&(xc(n,r,t,e),$e(r,2),wf(r));break}}t=t.return}}function ff(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Gu;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)||(ed=!0,i.add(n),e=pf.bind(null,e,t,n),t.then(e,e))}function pf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,qu===e&&(Yu&n)===n&&(nd===4||nd===3&&(Yu&62914560)===Yu&&300>Oe()-dd?Ku&2?ad|=n:Rd(e,0):ad|=n,sd===Yu&&(sd=0)),wf(e)}function mf(e,t){t===0&&(t=Ze()),e=mi(e,t),e!==null&&($e(e,t),wf(e))}function hf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),mf(e,n)}function gf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),mf(e,n)}function _f(e,t){return Te(e,t)}var vf=null,yf=null,bf=!1,xf=!1,Sf=!1,Cf=0;function wf(e){e!==yf&&e.next===null&&(yf===null?vf=yf=e:yf=yf.next=e),xf=!0,bf||(bf=!0,jf())}function Tf(e,t){if(!Sf&&xf){Sf=!0;do for(var n=!1,r=vf;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-Be(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Af(r,a))}else a=Yu,a=Z(r,r===qu?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Je(r,a)||(n=!0,Af(r,a))}r=r.next}while(n);Sf=!1}}function Ef(){Df()}function Df(){xf=bf=!1;var e=0;Cf!==0&&hp()&&(e=Cf);for(var t=Oe(),n=null,r=vf;r!==null;){var i=r.next,a=Of(r,t);a===0?(r.next=null,n===null?vf=i:n.next=i,i===null&&(yf=n)):(n=r,(e!==0||a&3)&&(xf=!0)),r=i}gd!==0&&gd!==5||Tf(e,!1),Cf!==0&&(Cf=0)}function Of(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Be(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Xe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=qu,n=Yu,n=Z(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Xu===2||Xu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ee(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Je(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ee(r),at(n)){case 2:case 8:n=je;break;case 32:n=Me;break;case 268435456:n=Pe;break;default:n=Me}return r=kf.bind(null,e),n=Te(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ee(r),e.callbackPriority=2,e.callbackNode=null,2}function kf(e,t){if(gd!==0&&gd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(cf()&&e.callbackNode!==n)return null;var r=Yu;return r=Z(e,e===qu?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Md(e,r,t),Of(e,Oe()),e.callbackNode!=null&&e.callbackNode===n?kf.bind(null,e):null)}function Af(e,t){if(cf())return null;Md(e,t,!0)}function jf(){bp(function(){Ku&6?Te(Ae,Ef):Df()})}function Mf(){if(Cf===0){var e=Da;e===0&&(e=We,We<<=1,!(We&261888)&&(We=256)),Cf=e}return Cf}function Nf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:rn(e)}function Pf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Nf((i[ut]||null).action),o=r.submitter;o&&(t=(t=o[ut]||null)?Nf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new En(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Cf!==0){var e=new FormData(i,o);Gs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),Gs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Ff=0;Ff<ti.length;Ff++){var If=ti[Ff];ni(If.toLowerCase(),`on`+(If[0].toUpperCase()+If.slice(1)))}ni(qr,`onAnimationEnd`),ni(Jr,`onAnimationIteration`),ni(Yr,`onAnimationStart`),ni(`dblclick`,`onDoubleClick`),ni(`focusin`,`onFocus`),ni(`focusout`,`onBlur`),ni(Xr,`onTransitionRun`),ni(Zr,`onTransitionStart`),ni(Qr,`onTransitionCancel`),ni($r,`onTransitionEnd`),Ot(`onMouseEnter`,[`mouseout`,`mouseover`]),Ot(`onMouseLeave`,[`mouseout`,`mouseover`]),Ot(`onPointerEnter`,[`pointerout`,`pointerover`]),Ot(`onPointerLeave`,[`pointerout`,`pointerover`]),Dt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Dt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Dt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Dt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Dt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Dt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Lf=`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(` `),Rf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Lf));function zf(e,t){t=!!(t&4);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){si(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){si(e)}i.currentTarget=null,a=c}}}}function Bf(e,t){var n=t[ft];n===void 0&&(n=t[ft]=new Set);var r=e+`__bubble`;n.has(r)||(Wf(t,e,2,!1),n.add(r))}function Vf(e,t,n){var r=0;t&&(r|=4),Wf(n,e,r,t)}var Hf=`_reactListening`+Math.random().toString(36).slice(2);function Uf(e){if(!e[Hf]){e[Hf]=!0,Tt.forEach(function(t){t!==`selectionchange`&&(Rf.has(t)||Vf(t,!1,e),Vf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Hf]||(t[Hf]=!0,Vf(`selectionchange`,!1,t))}}function Wf(e,t,n,r){switch(Ch(t)){case 2:var i=_h;break;case 8:i=vh;break;default:i=yh}n=i.bind(null,t,n,e),i=void 0,!hn||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 Gf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=yt(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}fn(function(){var r=a,i=sn(n),o=[];a:{var s=ei.get(e);if(s!==void 0){var c=En,u=e;switch(e){case`keypress`:if(xn(n)===0)break a;case`keydown`:case`keyup`:c=Wn;break;case`focusin`:u=`focus`,c=Fn;break;case`focusout`:u=`blur`,c=Fn;break;case`beforeblur`:case`afterblur`:c=Fn;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`:c=Nn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Pn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=qn;break;case qr:case Jr:case Yr:c=In;break;case $r:c=Jn;break;case`scroll`:case`scrollend`:c=On;break;case`wheel`:c=Yn;break;case`copy`:case`cut`:case`paste`:c=Ln;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Gn;break;case`submit`:c=Kn;break;case`toggle`:case`beforetoggle`:c=Xn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;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=pn(m,p),g!=null&&d.push(Kf(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,s=e===`mouseout`||e===`pointerout`,c&&n!==on&&(u=n.relatedTarget||n.fromElement)&&(yt(u)||u[dt]))break a;(s||c)&&(u=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,s?(c=n.relatedTarget||n.toElement,s=r,c=c?yt(c):null,c!==null&&(f=l(c),d=c.tag,c!==f||d!==5&&d!==27&&d!==6)&&(c=null)):(s=null,c=r),s!==c&&(d=Nn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Gn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=s==null?u:xt(s),h=c==null?u:xt(c),u=new d(g,m+`leave`,s,n,i),u.target=f,u.relatedTarget=h,g=null,yt(i)===r&&(d=new d(p,m+`enter`,c,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=s&&c?E(s,c,Jf):null,s!==null&&Yf(o,u,s,d,!1),c!==null&&f!==null&&Yf(o,f,c,d,!0)))}a:{if(s=r?xt(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var _=gr;else if(ur(s)){if(_r)_=Er;else{_=wr;var v=Cr}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&en(r.elementType)&&(_=gr):_=Tr;if(_&&=_(e,r)){dr(o,_,n,i);break a}v&&v(e,s,r)}switch(v=r?xt(r):window,e){case`focusin`:(ur(v)||v.contentEditable===`true`)&&(Lr=v,Rr=r,zr=null);break;case`focusout`:zr=Rr=Lr=null;break;case`mousedown`:Br=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Br=!1,Vr(o,n,i);break;case`selectionchange`:if(Ir)break;case`keydown`:case`keyup`:Vr(o,n,i)}var y;if(Qn)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else or?ir(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(tr&&n.locale!==`ko`&&(or||b!==`onCompositionStart`?b===`onCompositionEnd`&&or&&(y=bn()):(_n=i,vn=`value`in _n?_n.value:_n.textContent,or=!0)),v=qf(r,b),0<v.length&&(b=new Rn(b,e,null,n,i),o.push({event:b,listeners:v}),y?b.data=y:(y=ar(n),y!==null&&(b.data=y)))),(y=er?sr(e,n):cr(e,n))&&(b=qf(r,`onBeforeInput`),0<b.length&&(v=new Rn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:v,listeners:b}),v.data=y)),Pf(o,e,r,n,i)}zf(o,t)})}function Kf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qf(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=pn(e,n),i!=null&&r.unshift(Kf(e,i,a)),i=pn(e,t),i!=null&&r.push(Kf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Jf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Yf(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=pn(n,a),l!=null&&o.unshift(Kf(n,l,c))):i||(l=pn(n,a),l!=null&&o.push(Kf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Xf=/\r\n?/g,Zf=/\u0000|\uFFFD/g;function Qf(e){return(typeof e==`string`?e:``+e).replace(Xf,`
9
- `).replace(Zf,``)}function $f(e,t){return t=Qf(t),Qf(e)===t}function ep(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||Xt(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&Xt(e,``+r);else return;break;case`className`:Ft(e,`class`,r);break;case`tabIndex`:Ft(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ft(e,n,r);break;case`style`:$t(e,r,a);return;case`data`:if(t!==`object`){Ft(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=rn(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}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&ep(e,t,`name`,i.name,i,null),ep(e,t,`formEncType`,i.formEncType,i,null),ep(e,t,`formMethod`,i.formMethod,i,null),ep(e,t,`formTarget`,i.formTarget,i,null)):(ep(e,t,`encType`,i.encType,i,null),ep(e,t,`method`,i.method,i,null),ep(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=rn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=an);return;case`onScroll`:r!=null&&Bf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Bf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(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=rn(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`credentialless`: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`:Bf(`beforetoggle`,e),Bf(`toggle`,e),Pt(e,`popover`,r);break;case`xlinkActuate`:It(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:It(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:It(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:It(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Pt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=tn.get(n)||n,Pt(e,n,r);else return}Mt=!0}function tp(e,t,n,r,i,a){switch(n){case`style`:$t(e,r,a);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)Xt(e,r);else if(typeof r==`number`||typeof r==`bigint`)Xt(e,``+r);else return;break;case`onScroll`:r!=null&&Bf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Bf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=an);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Et.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),a=n.slice(2,i?n.length-7:void 0),t=e[ut]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(a,t,i),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(a,r,i);break a}Mt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Pt(e,n,r)}return}Mt=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Bf(`error`,e),Bf(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var o=n[a];if(o!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:ep(e,t,a,o,n,null)}}i&&ep(e,t,`srcSet`,n.srcSet,n,null),r&&ep(e,t,`src`,n.src,n,null);return;case`input`:Bf(`invalid`,e);var c=a=o=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:o=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(s(137,t));break;default:ep(e,t,r,d,n,null)}}Gt(e,a,c,l,u,o,i,!1);return;case`select`:for(i in Bf(`invalid`,e),r=o=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:o=c;break;case`multiple`:r=c;default:ep(e,t,i,c,n,null)}t=a,n=o,e.multiple=!!r,t==null?n!=null&&qt(e,!!r,n,!0):qt(e,!!r,t,!1);return;case`textarea`:for(o in Bf(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(o)&&(c=n[o],c!=null))switch(o){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(s(91));break;default:ep(e,t,o,c,n,null)}Yt(e,r,i,a);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:ep(e,t,l,r,n,null)}return;case`dialog`:Bf(`beforetoggle`,e),Bf(`toggle`,e),Bf(`cancel`,e),Bf(`close`,e);break;case`iframe`:case`object`:Bf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Lf.length;r++)Bf(Lf[r],e);break;case`image`:Bf(`error`,e),Bf(`load`,e);break;case`details`:Bf(`toggle`,e);break;case`embed`:case`source`:case`link`:Bf(`error`,e),Bf(`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(s(137,t));default:ep(e,t,u,r,n,null)}return;default:if(en(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ep(e,t,c,r,n,null))}var rp={};function ip(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 i=null,a=null,o=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)||ep(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`:m!==f&&(Mt=!0),a=m;break;case`name`:m!==f&&(Mt=!0),i=m;break;case`checked`:m!==f&&(Mt=!0),u=m;break;case`defaultChecked`:m!==f&&(Mt=!0),d=m;break;case`value`:m!==f&&(Mt=!0),o=m;break;case`defaultValue`:m!==f&&(Mt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(s(137,t));break;default:m!==f&&ep(e,t,p,m,r,f)}}Wt(e,o,c,l,u,d,a,i);return;case`select`:for(a in m=o=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||ep(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:a!==l&&(Mt=!0),p=a;break;case`defaultValue`:a!==l&&(Mt=!0),c=a;break;case`multiple`:a!==l&&(Mt=!0),o=a;default:a!==l&&ep(e,t,i,a,r,l)}t=c,n=o,r=m,p==null?!!r!=!!n&&(t==null?qt(e,!!n,n?[]:``,!1):qt(e,!!n,t,!0)):qt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ep(e,t,c,null,r,i)}for(o in r)if(i=r[o],a=n[o],r.hasOwnProperty(o)&&(i!=null||a!=null))switch(o){case`value`:i!==a&&(Mt=!0),p=i;break;case`defaultValue`:i!==a&&(Mt=!0),m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(s(91));break;default:i!==a&&ep(e,t,o,i,r,a)}Jt(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:ep(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`:p!==m&&(Mt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ep(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)&&ep(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(s(137,t));break;default:ep(e,t,u,p,r,m)}return;default:if(en(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(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||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ep(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||ep(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){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&&ap(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&&ap(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 sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(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 dp(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 fp(e,t,n,r){return n=lp(n).createElement(e),n[lt]=r,n[ut]=t,np(n,e,t),Ct(n),n}function pp(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 mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(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),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[gt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(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 Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:D({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){h(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=b(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=lp(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag!==6&&(e=b(e),t.observe(e),!1)}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag!==6&&(e=b(e),t.unobserve(e),!1)}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=yt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=E(n,a,T),t===null?t=!1:(h(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=E(r,a,T),t===null?t=!1:(h(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(s(566));var t=[];h(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Zp(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var i=t[r];i.tag===6?(i=b(i),Zp(i,n)):b(i).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=b(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(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`:nm(n),vt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(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[gt])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=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(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 lm(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 um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(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 pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(s(452));return e;case`head`:if(e=t.head,!e)throw Error(s(453));return e;case`body`:if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ep(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===an&&(e.onclick=null),vt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);vt(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=Y.d;Y.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=Id();return e||t}function Cm(e){var t=bt(e);t!==null&&t.tag===5&&t.type===`form`?qs(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=Ut(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ut(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ut(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ut(n.imageSizes)+`"]`)):i+=`[href="`+Ut(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=D({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[_t]=!0,o.onload=o.onerror=function(){wt(o)}),Ct(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ut(r)+`"][href="`+Ut(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=D({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Ct(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=St(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=D({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Ct(c),np(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,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=St(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ct(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=St(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ct(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var i=(i=de.current)?bm(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=St(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,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=Pm(n.href);var a=St(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(Fm(e)))?a._p||(o.instance=a,o.state.loading=5):(a=vm.get(e),a||(a={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,a)),Lm(i,e,a,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=St(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Pm(e){return`href="`+Ut(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[_t]){r.loading=1;return}}else t=e.createElement(`link`),t[_t]=!0,t.onload=t.onerror=wt.bind(null,t),np(t,`link`,n),Ct(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+Ut(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ut(n.href)+`"]`);if(r)return t.instance=r,Ct(r),r;var i=D({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ct(r),np(r,`style`,i),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Pm(n.href);var a=e.querySelector(Fm(i));if(a)return t.state.loading|=4,t.instance=a,Ct(a),a;r=Im(n),(i=vm.get(i))&&Hm(r,i),a=(e.ownerDocument||e).createElement(`link`),Ct(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),t.state.loading|=4,Vm(a,n.precedence,e),t.instance=a;case`script`:return a=Rm(n.src),(i=e.querySelector(zm(a)))?(t.instance=i,Ct(i),i):(r=n,(i=vm.get(a))&&(r=D({},n),Um(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Ct(i),np(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(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 Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,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[gt]||a[lt]||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 Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(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 Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(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=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ct(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Ct(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(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=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.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=nh.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 sh={$$typeof:F,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qe(0),this.hiddenUpdates=Qe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=yi(3,null,null,t),e.current=a,a.stateNode=e,t=ba(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},no(a),e}function uh(e){return e?(e=_i,e):_i}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=io(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=ao(e,r,t),n!==null&&(jd(n,e,t),oo(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=mi(e,67108864);t!==null&&jd(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=Od();t=it(t);var n=mi(e,t);n!==null&&jd(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=J.T;J.T=null;var a=Y.p;try{Y.p=2,yh(e,t,n,r)}finally{Y.p=a,J.T=i}}function vh(e,t,n,r){var i=J.T;J.T=null;var a=Y.p;try{Y.p=8,yh(e,t,n,r)}finally{Y.p=a,J.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Gf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=bt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=qe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Be(o);s.entanglements[1]|=c,o&=~c}wf(a),!(Ku&6)&&(pd=Oe()+500,Tf(0,!1))}}break;case 31:case 13:s=mi(a,2),s!==null&&jd(s,a,2),Id(),ph(a,2)}if(a=bh(r),a===null&&Gf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Gf(e,t,r,null,n)}}function bh(e){return e=sn(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=yt(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(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 xh=e,null}function Ch(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`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`fullscreenerror`: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`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(ke()){case Ae:return 2;case je:return 8;case Me:case Ne:return 32;case Pe:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`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 Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=bt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=yt(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,st(e.priority,function(){hh(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,st(e.priority,function(){hh(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 Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);on=r,n.target.dispatchEvent(r),on=null}else return t=bt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=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(Sh(r||n)===null)continue;break}var a=bt(n);a!==null&&(e.splice(t,3),t-=3,Gs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.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[ut]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ut]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){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 Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var n=t.current;dh(n,Od(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),Id(),t[dt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=ot();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=r.version;if(Kh!==`19.3.0`)throw Error(s(527,Kh,`19.3.0`));Y.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(s(188)):(e=Object.keys(e).join(`,`),Error(s(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:J,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{Le=Jh.inject(qh),Re=Jh}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(s(299));var n=!1,r=``,i=mc,a=hc,o=gc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,i,a,o,Uh),e[dt]=t.current,Uf(e),new Wh(t)}})),c=e(((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=s()}));function l(e){if(e.carrying===void 0)return{weight:e.imports+e.calls+(e.references??0)};let t=e.calls+(e.references??0);return t===0&&e.carrying===0?null:{weight:t}}var u={"dynamic-dispatch":`type unknown`,untyped:`type unknown`,reflection:`reflection`,"computed-member":`computed name`,computed:`computed name`,metaprogramming:`built at run time`,"dynamic-sql":`SQL built at run time`,"imported-symbol":`imported, not linked`,"runtime-global":`built-in`,"builtin-value":`built-in value`,"template-binding":`awaiting its component`,"template-reference":`registered elsewhere`,candidates:`narrowed to candidates`,ambiguous:`could be several functions`,"not-exported":`not exported`,"not-found":`not found`,"not-a-function":`a value, not a function`,undeclared:`not declared by its type`,"no-body":`no body known`,"bodies-unknown":`not every body is known`,"unknown-wrapper":`wrapped in a function it can't see into`,"depth-limit":`too many imports deep to follow`,cycle:`imports go round in a cycle`,broken:`its import is broken`,pending:`its import waits for a source not added`,"not-analyzed":`its import reaches a file not analyzed`,default:`only a default is known`,member:`a member of a function`,truncated:`too deep to follow`,unresolved:`not resolved`};function d(e){return u[e]??e.replace(/-/g,` `)}var f=[`open`,`adjudicated`,`dynamic-only`];function p(e){return f.includes(e.status)}var m=/(^|\/)(__tests__|__mocks__|tests?|e2e|specs?|fixtures?)\/|\.(test|spec|e2e|stories)\.[a-z0-9]+$/i;function h(e){return m.test(e)}function g(e){return e.origin===void 0&&!h(e.path)}function _(e,t){return(t.get(e.source)??[]).some(t=>e.path===t||e.path.startsWith(`${t}/`))}function v(e){return t=>g(t)&&!_(t,e)}var y=n(),b=c(),x=(e,t)=>e?.runId===t?e:{runId:t,stages:[],finished:[]};function S(e,t){switch(t.type){case`run.started`:return{runId:t.runId,startedAt:new Date().toISOString(),stages:[],finished:[]};case`run.planned`:return e=x(e,t.runId),{...e,stages:t.stages,planned:{listed:t.sources.reduce((e,t)=>e+t.listed,0),toAnalyze:t.sources.reduce((e,t)=>e+t.toAnalyze,0),notAnalyzed:t.sources.reduce((e,t)=>e+Object.values(t.notAnalyzed).reduce((e,t)=>e+t,0),0)}};case`stage.started`:{e=x(e,t.runId);let{runId:n,startedAt:r,planned:i,stages:a,finished:o}=e;return{runId:n,...r?{startedAt:r}:{},...i?{planned:i}:{},stages:a.length?a:[t.stage],finished:o,stage:t.stage,index:t.index}}case`stage.progress`:{e=x(e,t.runId);let{done:n,total:r,unit:i,...a}=e,{type:o,projectId:s,runId:c,stage:l,...u}=t;return{...a,stage:l,...u}}case`stage.completed`:return e?.runId===t.runId?{...e,finished:[...e.finished,{stage:t.stage,durationMs:t.durationMs}]}:e;case`run.committed`:case`run.failed`:return e?.runId===t.runId?null:e;default:return e}}var C={stage1:`Reading files`,"template-link":`Linking component templates`,stage2:`Linking across files`},w=e=>e.toLocaleString(`en-US`);function T(e){if(e.stage===void 0)return{text:e.planned?`Planned: ${w(e.planned.toAnalyze)} files to analyze${e.planned.notAnalyzed?` (${w(e.planned.notAnalyzed)} not analyzed)`:``}`:`Planning…`,fraction:0};let t=e.stages.length>1&&e.index!==void 0?` · stage ${e.index+1} of ${e.stages.length}`:``,n=C[e.stage]??e.stage,r=``,i=null;if(e.phase===`saving results`)return{text:`${n}: saving results${t}`,fraction:1};if(e.phase){let t=e.total===void 0?``:e.done===void 0?` (${w(e.total)}${e.unit?` ${e.unit}`:``})`:`: ${w(e.done)} of ${w(e.total)}${e.unit&&e.unit!==`files`?` ${e.unit}`:``}`,n=e.steps&&e.steps>1?`, step ${e.step} of ${e.steps}`:``;r=e.phase===`reading files`?t:`: ${e.phase}${t}${n}`,e.done!==void 0&&e.total?i=e.done/e.total:e.steps&&e.step&&(i=(e.step-1)/e.steps)}return{text:`${n}${r}${t}`,fraction:i}}function E(e,t){let n=new Set([t]);for(let t=!0;t;){t=!1;for(let r of e)!n.has(r.file)&&n.has(r.from)&&(n.add(r.file),t=!0)}return e.filter(e=>!n.has(e.file))}var D={v:1,project:null,file:null,selection:null,panel:`evidence`,showUnresolved:!1,tab:`file`,group:null,pick:null,fileLevel:!1,showPending:!1,expand:[],source:null,run:null,history:!1,compare:null,only:null,area:null,reach:null,grouping:`declared`,differences:!1,reveal:[]},O=(e,t=!1)=>n=>t&&n[e]===void 0||typeof n[e]==`string`&&n[e].length>0?[]:[e],k=(e,t)=>n=>t.includes(n[e])?[]:[e],A=(...e)=>t=>e.flatMap(e=>e(t)),j=()=>[],M={selectProject:{description:`Show a project`,control:{kind:`select`,testId:`select-project`},check:O(`project`),apply:(e,t)=>({...D,project:t.project,panel:e.panel,tab:e.tab,...t.project===e.project?{run:e.run,history:e.history,compare:e.compare}:{}})},goHome:{description:`Go to the projects home: every project, its last run and its findings`,control:{kind:`button`,testId:`go-home`},check:j,apply:e=>({...D,panel:e.panel})},openFile:{description:`Show a file: its functions and calls (File tab), or its imports and cross-file calls (Imports tab)`,control:{kind:`tree`,testId:`open-file`},check:O(`file`),apply:(e,t)=>({...e,only:null,file:t.file,selection:null,fileLevel:e.tab===`imports`,pick:e.tab===`imports`?null:e.pick,reveal:t.file===e.file&&(e.tab!==`imports`||e.fileLevel)?e.reveal:[]})},select:{description:`Select a function, call or unresolved call site to see its evidence`,control:{kind:`canvas`,testId:`select`,shortcut:`Enter`},check:A(k(`kind`,[`function`,`call`,`site`]),O(`id`),O(`file`,!0)),apply:(e,t)=>({...e,file:t.file??e.file,selection:{kind:t.kind,id:t.id},reveal:(t.file??e.file)===e.file?e.reveal:[],panel:`evidence`,tab:`file`,fileLevel:!1,showUnresolved:t.kind===`site`||e.showUnresolved})},clearSelection:{description:`Clear the selection`,control:{kind:`button`,testId:`clear-selection`,shortcut:`Escape`},check:j,apply:e=>({...e,selection:null,pick:null})},showPanel:{description:`Show the evidence panel, the open-questions list or the last answer`,control:{kind:`tab`,testId:`show-panel`},check:k(`panel`,[`evidence`,`questions`,`answer`]),apply:(e,t)=>({...e,panel:t.panel})},showTab:{description:`Show the File tab (inside one file) or the Imports tab (how files depend on each other)`,control:{kind:`tab`,testId:`show-tab`},check:k(`tab`,[`file`,`imports`,`reach`]),apply:(e,t)=>t.tab===`reach`&&!e.reach?e:t.tab===`imports`&&e.tab===`file`&&e.file?{...e,tab:`imports`,fileLevel:!0,group:null,pick:null,only:null,expand:[],reveal:[]}:t.tab===`imports`&&e.tab===`imports`?{...e,fileLevel:!1,group:null,pick:null,only:null,expand:[],area:null,reveal:[]}:{...e,tab:t.tab}},openReach:{description:`Open the Reach tab on a function or file: what paths from it reach (forward) or what reaches it (backward), and where they stop`,control:{kind:`button`,testId:`open-reach`},check:A(O(`root`),e=>e.direction===void 0||e.direction===`forward`||e.direction===`backward`?[]:[`direction`]),apply:(e,t)=>({...e,tab:`reach`,reach:{root:t.root,direction:t.direction??e.reach?.direction??`forward`},pick:null,only:null})},pickNode:{description:`Pick a group on the Imports tab's map to see its details`,control:{kind:`canvas`,testId:`pick-node`},check:O(`id`),apply:(e,t)=>({...e,tab:`imports`,pick:t.id,panel:`evidence`})},openGroup:{description:`Open a group on the Imports tab (its files and imports), or go back to the project map`,control:{kind:`canvas`,testId:`open-group`},check:A(O(`group`,!0),O(`folder`,!0)),apply:(e,t)=>{let n=t.group===e.group||e.group===null?e.expand:[];return{...e,only:null,tab:`imports`,group:t.group??null,pick:null,fileLevel:!1,area:t.group?e.area:null,expand:t.folder&&!n.includes(t.folder)?[...n,t.folder].sort():n}}},openArea:{description:`Show one part of a large project map: a repository, or a folder in one (none: the whole map)`,control:{kind:`canvas`,testId:`open-area`},check:O(`area`,!0),apply:(e,t)=>({...e,only:null,tab:`imports`,group:null,pick:null,fileLevel:!1,area:t.area??null})},openImportsFile:{description:`Open a file on the Imports tab: its imports and its cross-file calls`,control:{kind:`canvas`,testId:`open-imports-file`},check:A(O(`file`),O(`group`,!0),O(`pick`,!0)),apply:(e,t)=>({...e,only:null,tab:`imports`,file:t.file,group:t.group??e.group,fileLevel:!0,reveal:t.file===e.file&&e.fileLevel?e.reveal:[],pick:t.pick??null,panel:t.pick?`evidence`:e.panel,selection:null})},revealFile:{description:`On a file's Imports level, show another file's imports and calls in place (or hide them again, with what was revealed from it)`,control:{kind:`canvas`,testId:`reveal-file`},check:A(O(`file`),O(`from`,!0)),apply:(e,t)=>e.reveal.some(e=>e.file===t.file)?{...e,reveal:E(e.reveal,t.file)}:t.file===e.file||!e.file||e.tab!==`imports`||!e.fileLevel?e:{...e,reveal:[...e.reveal,{file:t.file,from:t.from??e.file}]}},resetReveal:{description:`On a file's Imports level, hide every file revealed in place: the open file's own imports and calls only`,control:{kind:`button`,testId:`reset-reveal`},check:j,apply:e=>({...e,reveal:[]})},toggleFolder:{description:`Open or close a folder in a large group on the Imports tab`,control:{kind:`canvas`,testId:`toggle-folder`},check:O(`path`),apply:(e,t)=>({...e,expand:e.expand.includes(t.path)?e.expand.filter(e=>e!==t.path&&!e.startsWith(`${t.path}/`)):[...e.expand,t.path].sort()})},scopeSource:{description:`Limit the navigator, the map and Findings to one repository, or show all of them`,control:{kind:`select`,testId:`scope-source`},check:O(`source`,!0),apply:(e,t)=>({...e,only:null,source:t.source??null,group:t.source?null:e.group,pick:null,area:null})},openRun:{description:`Read the graph at another run (the draft of uncommitted edits, or an older run), or back at the latest`,control:{kind:`button`,testId:`open-run`},check:e=>e.run===void 0||Number.isInteger(e.run)&&e.run>0?[]:[`run`],apply:(e,t)=>({...e,run:t.run??null,compare:null,selection:null,pick:null})},toggleHistory:{description:`Open or close the History panel: runs by commit, and comparing two`,control:{kind:`toggle`,testId:`toggle-history`},check:j,apply:e=>({...e,history:!e.history})},compareRuns:{description:`Compare two runs (the change list and the diff on the canvas), or stop comparing`,control:{kind:`button`,testId:`compare-runs`},check:e=>{if(e.a===void 0&&e.b===void 0)return[];let t=e=>Number.isInteger(e)&&e>0;return[...t(e.a)?[]:[`a`],...t(e.b)?[]:[`b`]]},apply:(e,t)=>t.a===void 0||t.b===void 0?{...e,compare:null,run:null}:{...e,compare:{a:Math.min(t.a,t.b),b:Math.max(t.a,t.b)},run:Math.max(t.a,t.b),history:!0}},showOnlyLinks:{description:`Show only an item and what it links to (a group, a file or a function), or everything again`,control:{kind:`canvas`,testId:`show-only-links`},check:O(`id`,!0),apply:(e,t)=>({...e,only:t.id??null})},setGrouping:{description:`Group the project map by its packages and folders (declared), or by how its files connect (connected)`,control:{kind:`select`,testId:`set-grouping`},check:k(`grouping`,[`declared`,`connected`]),apply:(e,t)=>t.grouping===e.grouping?e:{...e,grouping:t.grouping,differences:t.grouping===`connected`&&e.differences,group:null,pick:null,area:null,expand:[],only:null}},toggleDifferences:{description:`Mark, on the map grouped by how files connect, the declared groups it splits or merges`,control:{kind:`toggle`,testId:`toggle-differences`},check:j,apply:e=>({...e,differences:!e.differences})},togglePending:{description:`Show or hide imports waiting for another source (pending)`,control:{kind:`toggle`,testId:`toggle-pending`},check:j,apply:e=>({...e,showPending:!e.showPending})},toggleUnresolved:{description:`Show or hide unresolved call sites in the graph`,control:{kind:`toggle`,testId:`toggle-unresolved`,shortcut:`u`},check:j,apply:e=>({...e,showUnresolved:!e.showUnresolved})}},N=class extends Error{code;fields;constructor(e,t,n=[]){super(t),this.code=e,this.fields=n}};function P(e,t){let n=Object.hasOwn(M,t.name)?M[t.name]:void 0;if(!n)throw new N(`unknown-command`,`no command ${t.name}`);let r=t.args??{},i=n.check(r);if(i.length>0)throw new N(`invalid-arguments`,`invalid arguments for ${t.name}: ${i.join(`, `)}`,i);return n.apply(e,r)}function F(e=D){return{past:[],present:e,future:[]}}function I(e,t){let n=P(e.present,t);return JSON.stringify(n)===JSON.stringify(e.present)?e:{past:[...e.past,e.present].slice(-200),present:n,future:[]}}function L(e){let t=e.past.at(-1);return t?{past:e.past.slice(0,-1),present:t,future:[e.present,...e.future]}:e}function R(e){let t=e.future[0];return t?{past:[...e.past,e.present],present:t,future:e.future.slice(1)}:e}function z(e){return encodeURIComponent(JSON.stringify(e))}function B(e){let t=e,n=e=>Number.isInteger(e)&&e>0;return t&&typeof t==`object`&&n(t.a)&&n(t.b)?{a:t.a,b:t.b}:null}function V(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.root==`string`&&t.root&&(t.direction===`forward`||t.direction===`backward`)?{root:t.root,direction:t.direction}:null}function H(e){if(!e)return D;let t;try{t=JSON.parse(decodeURIComponent(e))}catch{return D}if(!t||typeof t!=`object`||t.v!==1)return D;let n=e=>typeof e==`string`&&e.length>0?e:null,r=t.selection,i=r&&typeof r==`object`&&[`function`,`call`,`site`].includes(r.kind)&&n(r.id)?{kind:r.kind,id:r.id}:null;return{v:1,project:n(t.project),file:n(t.file),selection:i,panel:t.panel===`questions`||t.panel===`answer`?t.panel:`evidence`,showUnresolved:typeof t.showUnresolved==`boolean`?t.showUnresolved:D.showUnresolved,tab:t.tab===`imports`?`imports`:t.tab===`reach`&&V(t.reach)?`reach`:`file`,group:n(t.group),pick:n(t.pick),fileLevel:t.fileLevel===!0,showPending:t.showPending===!0,source:n(t.source),run:Number.isInteger(t.run)&&t.run>0?t.run:null,history:t.history===!0,compare:B(t.compare),only:n(t.only),area:n(t.area),reach:V(t.reach),grouping:t.grouping===`connected`?`connected`:`declared`,differences:t.grouping===`connected`&&t.differences===!0,expand:Array.isArray(t.expand)?t.expand.filter(e=>typeof e==`string`&&e.length>0):[],reveal:Array.isArray(t.reveal)?t.reveal.flatMap(e=>e&&typeof e==`object`&&n(e.file)&&n(e.from)?[{file:e.file,from:e.from}]:[]):[]}}var U={addFolder:{description:`Add a folder to the project and analyze it`,control:{kind:`button`,testId:`add-folder`},check:O(`root`)},analyze:{description:`Analyze the project again`,control:{kind:`button`,testId:`reanalyze`},check:j},analyzeDraft:{description:`Analyze the working tree's uncommitted edits as a draft, beside the current graph`,control:{kind:`button`,testId:`analyze-draft`},check:j},analyzeDebug:{description:`A debug run that stops after a chosen stage, beside the current graph: never committed, replaced by the next one`,control:{kind:`button`,testId:`analyze-debug`},check:O(`until`)},analyzeFrom:{description:`Analyze again from a later stage: the stages before it are reused when nothing they read changed since the latest run`,control:{kind:`button`,testId:`analyze-from`},check:O(`from`)},ask:{description:`Ask a question about the analyzed code (built-in questions offline; anything with a model)`,control:{kind:`button`,testId:`ask`,shortcut:`Mod+K`},check:O(`question`)},openSettings:{description:`Set the model provider: base URL, API key and model name`,control:{kind:`button`,testId:`settings`},check:j},analyzeSource:{description:`Analyze one repository again (the others stay at their commits)`,control:{kind:`button`,testId:`repo-analyze`},check:O(`source`)},chooseFiles:{description:`Choose which files are analyzed, opened at a folder or file (to leave it out, or add it back)`,control:{kind:`button`,testId:`repo-choose`},check:A(O(`source`),O(`path`,!0))},openProjectSettings:{description:`The project's settings, at a tab: its repositories (re-analyze, choose files, rename, edit rules, remove), analysis options, or the license`,control:{kind:`button`,testId:`project-settings`},check:(e=>e.tab===void 0?[]:k(`tab`,[`repositories`,`analysis`,`license`])(e))}};function W(e,t={}){let n=Object.hasOwn(U,e)?U[e]:void 0;if(!n)throw new N(`unknown-command`,`no action ${e}`);let r=n.check(t);if(r.length>0)throw new N(`invalid-arguments`,`invalid arguments for ${e}: ${r.join(`, `)}`,r)}function ee(e){return e.file?e.kind===`file`?[{name:`openFile`,args:{file:e.file}}]:e.kind===`function`||e.kind===`call`||e.kind===`site`?[{name:`openFile`,args:{file:e.file}},{name:`select`,args:{kind:e.kind,id:e.id,file:e.file}}]:[]:[]}var G=null;function te(e){return e?.details?.kind===`run`}function ne(e){G=e}async function K(e,t){let n=t?.method??`GET`;G!==null&&e.startsWith(`/api/projects/`)&&(n===`GET`||e.endsWith(`/snippet`)||e.endsWith(`/ask`))&&(e=`${e}${e.includes(`?`)?`&`:`?`}run=${G}`);let r=await fetch(e,{...t,headers:{"content-type":`application/json`,...t?.headers??{}}}),i=await r.json();if(!r.ok){let e=i.details,t=i.code,n=r.status===404?`gone`:r.status===403&&t===`entitlement`?`history`:null;throw n&&e?.kind===`run`&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`veo-run-gone`,{detail:{run:G,reason:n}})),i}return i}var q=e=>`/api/projects/${encodeURIComponent(e)}`,J=e=>new URLSearchParams(e).toString(),Y={projects:(e=!1)=>K(`/api/projects${e?`?findings=1`:``}`),createProject:(e,t)=>K(`/api/projects`,{method:`POST`,body:JSON.stringify(t===void 0?{name:e}:{name:e,root:t})}),projectDisk:e=>K(`${q(e)}/disk`),deleteProject:e=>K(q(e),{method:`DELETE`,body:`{}`}),addSource:(e,t)=>K(`${q(e)}/sources`,{method:`POST`,body:JSON.stringify({root:t})}),analyze:e=>K(`${q(e)}/runs`,{method:`POST`,body:`{}`}),history:e=>K(`${q(e)}/history?limit=200`),diff:(e,t,n)=>K(`${q(e)}/diff?${J({a:String(t),b:String(n),limit:`5000`})}`),cancelRun:e=>K(`${q(e)}/runs/cancel`,{method:`POST`,body:`{}`}),analyzeDraft:e=>K(`${q(e)}/runs?draft=true`,{method:`POST`,body:`{}`}),analyzeFrom:(e,t)=>K(`${q(e)}/runs?${J({from:t})}`,{method:`POST`,body:`{}`}),analyzeDebug:(e,t)=>K(`${q(e)}/runs?${J({debug:`true`,until:t})}`,{method:`POST`,body:`{}`}),stages:e=>K(`${q(e)}/stages`),status:e=>K(`${q(e)}/status`),files:e=>K(`${q(e)}/files`),search:(e,t,n,r=6)=>K(`${q(e)}/search?${J({label:t,text:n,limit:String(r)})}`),aggregate:(e,t,n,r=5,i=!1)=>K(`${q(e)}/aggregate?${J({label:t,groupBy:n,limit:String(r),...i?{ownCode:`true`}:{}})}`),fileCounts:e=>K(`${q(e)}/file-counts`),stale:e=>K(`${q(e)}/stale`),groups:(e,t,n=`declared`)=>{let r=new URLSearchParams;t&&r.set(`source`,t),n!==`declared`&&r.set(`grouping`,n);let i=r.toString();return K(`${q(e)}/groups${i?`?${i}`:``}`)},group:(e,t,n,r,i=`declared`)=>{let a=new URLSearchParams({group:t});for(let e of n)a.append(`expand`,e);return r&&a.set(`pending`,`true`),i!==`declared`&&a.set(`grouping`,i),K(`${q(e)}/group?${a.toString()}`)},libraries:(e,t)=>K(`${q(e)}/libraries${t?`?${J({source:t})}`:``}`),library:(e,t,n,r)=>K(`${q(e)}/library?${J({name:t,ecosystem:n,...r?{source:r}:{}})}`),imports:(e,t,n=`declared`)=>K(`${q(e)}/imports?${J({file:t,...n===`declared`?{}:{grouping:n}})}`),fileSummary:(e,t)=>K(`${q(e)}/file-summary?${J({file:t})}`),findings:(e,t,n,r=1e3,i=0)=>{let a=new URLSearchParams({limit:String(r),offset:String(i)});for(let e of t)a.append(`kind`,e);return n.file&&a.set(`file`,n.file),n.group&&a.set(`group`,n.group),n.source&&a.set(`source`,n.source),n.own&&a.set(`own`,`true`),n.grouping&&n.grouping!==`declared`&&a.set(`grouping`,n.grouping),K(`${q(e)}/findings?${a.toString()}`)},callsBetween:(e,t,n,r=0,i=`declared`)=>{let a=new URLSearchParams;i!==`declared`&&a.set(`grouping`,i);for(let e of t)a.append(`from`,e);for(let e of n)a.append(`to`,e);return a.set(`limit`,`200`),r&&a.set(`offset`,String(r)),K(`${q(e)}/cross-file-calls?${a.toString()}`)},crossFileCalls:(e,t,n)=>K(`${q(e)}/cross-file-calls?${J({file:t,direction:n,limit:`500`})}`),totals:(e,t=10,n,r=!1)=>K(`${q(e)}/totals?${J({top:String(t),...n?{source:n}:{},...r?{own:`true`}:{}})}`),reach:(e,t,n)=>K(`${q(e)}/reach?${J({...t.split(`:`).length>2?{function:t}:{file:t},direction:n})}`),references:(e,t,n=`out`)=>K(`${q(e)}/references?${J({function:t,direction:n,limit:`500`})}`),siteLinks:(e,t)=>K(`${q(e)}/site-links?${J({file:t})}`),explain:(e,t)=>K(`${q(e)}/explain?${J({id:t})}`),fileGraph:(e,t)=>K(`${q(e)}/file-graph?${J({file:t})}`),unresolved:(e,t,n)=>K(`${q(e)}/unresolved?${J({...t?{file:t}:{},...n?{limit:String(n.limit),offset:String(n.offset??0)}:{}})}`),snippet:(e,t,n)=>K(`${q(e)}/snippet`,{method:`POST`,body:JSON.stringify({file:t,span:n})}),ask:(e,t,n,r,i,a)=>K(`${q(e)}/ask`,{method:`POST`,body:JSON.stringify({question:t,...n?{mode:n}:{},...r?{file:r}:{},...a?{source:a}:{}}),...i?{signal:i}:{}}),suggestions:e=>K(`${q(e)}/suggestions`),settings:()=>K(`/api/settings`),saveSettings:e=>K(`/api/settings`,{method:`PUT`,body:JSON.stringify(e)}),testSettings:(e={})=>K(`/api/settings/test`,{method:`POST`,body:JSON.stringify(e)}),sources:e=>K(`${q(e)}/sources`),select:(e,t,n,r,i=!1)=>K(`${q(e)}/sources/${encodeURIComponent(t)}/select`,{method:`POST`,body:JSON.stringify({paths:n,selected:r,...i?{keep:i}:{}})}),browse:(e,t,n)=>K(`${q(e)}/sources/${encodeURIComponent(t)}/browse?${J({dir:n})}`),updateSource:(e,t,n)=>K(`${q(e)}/sources/${encodeURIComponent(t)}`,{method:`PATCH`,body:JSON.stringify(n)}),removeSource:(e,t)=>K(`${q(e)}/sources/${encodeURIComponent(t)}`,{method:`DELETE`,body:`{}`}),analyzeSource:(e,t)=>K(`${q(e)}/runs?${J({source:t})}`,{method:`POST`,body:`{}`}),license:e=>K(e?`${q(e)}/license`:`/api/license`),installLicense:e=>K(`/api/license`,{method:`PUT`,body:JSON.stringify({key:e})}),refreshLicense:()=>K(`/api/license/refresh`,{method:`POST`,body:`{}`}),projectSettings:e=>K(`${q(e)}/settings`),saveProjectSettings:(e,t)=>K(`${q(e)}/settings`,{method:`PUT`,body:JSON.stringify(t)})};function re(e,t){let n=`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/api/events`,r=null,i,a=!1,o=!1,s=()=>{a||(r=new WebSocket(n),r.onopen=()=>{o&&e(),o=!1},r.onmessage=e=>{try{t(JSON.parse(String(e.data)))}catch{}},r.onclose=()=>{a||(o=!0,i=setTimeout(s,1e3))})};return s(),()=>{a=!0,clearTimeout(i),r?.close()}}function ie(e){let t=[],n=0,r=``;for(let i of e)i===`<`?n++:i===`>`&&(n=Math.max(0,n-1)),i===`.`&&n===0?(t.push(r),r=``):r+=i;return t.push(r),t.filter(e=>e.length>0)}function ae(e,t){let n=/^<([a-z]+)(?::([^>]*))?>(?:#(\d+))?$/.exec(e);if(!n)return e;let[,r,i,a]=n,o=t===void 0?a?` #${a}`:``:` · line ${t}`;switch(r){case`callback`:return`${i??`anonymous`} callback${o}`;case`module`:return`file top level`;case`template`:return`template`;case`component`:return`component options`;case`iife`:return`immediately invoked function${o}`;case`anonymous`:return`anonymous function${o}`;case`object`:return`object literal${o}`;default:return`${r}${i?` ${i}`:``}${o}`}}function oe(e,t,n){if(!e.includes(`<`))return{name:e,parent:``};let r=ie(e),i=r.pop()??e,a=r.some(e=>e.startsWith(`<`)),o=/^<callback:([^>]*)>(?:#\d+)?$/.exec(i);return{name:n&&o?`${o[1]} “${n}”`:i===`<module>`||i===`<template>`?ae(i):ae(i,t),parent:a?r.map(e=>ae(e)).join(` › `):r.join(`.`)}}function se(e,t,n){let{name:r,parent:i}=oe(e,t,n);return i?`${r} (in ${i})`:r}var ce=/^<(callback|iife|anonymous)(?::([^>]*))?>(?:#\d+)?$/;function le(e){return ce.exec(ie(e).pop()??``)}function ue(e){return le(e)!==null}var de=new Set([`call`,`iife`]),fe=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),pe=24,me=e=>e.length>pe?e.startsWith(`(`)?`(…)`:`…`:e;function he(e){let t=/^(async\s+)?(?:<[^<>]*>\s*)?(\([^()]*\)|[\w$]+)\s*(?::\s*[^=()]+?)?\s*=>/.exec(e);if(t)return{text:`${t[1]??``}${me(t[2])} => …`,arrow:!0};let n=/^(async\s+)?function\b\s*(\*?)\s*([\w$]*)\s*\(([^()]*)\)/.exec(e);if(n){let e=n[3]?` ${n[3]}`:` `;return{text:`${n[1]??``}function${n[2]}${e}(${me(n[4])}) {…}`,arrow:!1}}return null}function ge(e,t){let n=fe(e);if(RegExp(`(?<![\\w$])${n}\\s*=\\s*\\{\\s*$`).test(t))return{call:e,extra:!1,jsx:!0};let r=RegExp(`(\\??\\.)?(?<![\\w$])${n}\\s*(?:<[^<>]*>)?\\s*\\(([^()]*)$`).exec(t);return r?{call:`${r[1]?`.`:``}${e}`,extra:r[2].trim()!==``,jsx:!1}:null}function _e(e,t,n){let r=le(e);if(!r||!t||n)return null;let i=he(t.head);if(!i)return null;let[,a,o]=r;if(a===`iife`)return`(${i.text})()`;if(a===`anonymous`||!o)return i.text;let s=ge(o,t.before);return s?.jsx?`${o}={${i.text}}`:!s&&de.has(o)?i.text:`${s?.call??o}(${s?.extra?`…, `:``}${i.text})`}function ve(e,t){let n=t instanceof Set?t:new Set(t),r=ie(e);for(r.pop();r.length>0;){let e=r.join(`.`);if(n.has(e))return e;r.pop()}return ue(e)&&n.has(`<module>`)&&e!==`<module>`?`<module>`:null}function ye(e,t,n,r){let i=le(e);if(!i)return null;let[,a,o]=i,s=!r||r===`<module>`,c=s?`the file's top level`:se(r),l=t?he(t.head):null,u=l?l.arrow?`An arrow function`:`A function expression`:`A function`;if(a===`iife`)return`A function run where it is written (an immediately invoked function), in ${c} (line ${n}).`;if(a===`anonymous`||!o)return`${u} with no name, in ${c} (line ${n}).`;let d=t?ge(o,t.before):null,f=d?.jsx?o:`${d?.call??o}()`;return`${u} handed to ${f} in ${c} (line ${n}). It has no name in the code; ${d?.jsx?`it runs when ${o} fires`:`${f} runs it`}, not ${s?`the top level`:c}.`}function be(e){let t=oe(e.qualifiedName,e.evidence.span.start.line,e.title);return{name:_e(e.qualifiedName,e.code,e.title)??t.name,parent:t.parent,unnamed:ue(e.qualifiedName)&&!e.title}}function xe(e){let t=oe(e.name,e.line,e.title),n=_e(e.name,e.code,e.title),r=ue(e.name)&&!e.title;return{name:`${r?`λ `:``}${n??t.name}`,parent:e.suite?`“${e.suite}”`:t.parent,unnamed:r,test:e.title!==void 0||e.suite!==void 0}}function Se(e){let{name:t,parent:n}=xe(e);return n?`${t} (in ${n})`:t}function Ce(e){return{stage1:`in-file analysis (Stage 1)`,"template-link":`template linking`,stage2:`import analysis (Stage 2)`}[e]??e}function we(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.round(t/60)} min ago`:t<86400?`${Math.round(t/3600)} h ago`:`${Math.round(t/86400)} days ago`}function Te(e,t=56){if(e.length<=t)return e;let n=e.split(`/`);if(n.length<3)return e;let r=n.pop(),i=n.shift();for(;n.length>0&&i.length+r.length+n[n.length-1].length+4<=t;)r=`${n.pop()}/${r}`;return`${i}/…/${r}`}var Ee=e((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})),X=e(((e,t)=>{t.exports=Ee()}))(),De=/^(who calls|callers of|what does|where is|functions in|open questions in)\s+(\S{2,})$/i;function Oe({project:e,modelName:t,disabled:n,loading:r,suggestions:i,recent:a,onAsk:o,busy:s,handle:c,palette:l,onOpenFunction:u}){let[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(!1),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(!1),b=e=>g(()=>{let t=typeof e==`function`?e(x.current):e;return t>=0?S.current[t]?.key??null:null}),x=(0,y.useRef)(-1),S=(0,y.useRef)([]),C=(0,y.useRef)(u);C.current=u;let w=(0,y.useRef)(null),[T,E]=(0,y.useState)([]),[D,O]=(0,y.useState)(new Map);(0,y.useEffect)(()=>{let t=De.exec(d.trim());if(!t||!e)return E([]);let[,n,r]=t,i=/^(functions in|open questions in)$/i.test(n)?`File`:`Function`,a=!1,o=setTimeout(()=>{Y.search(e,i,r,30).then(e=>{if(a)return;let t=/^what does$/i.test(n)?` call`:/^where is$/i.test(n)?` defined`:``,o=r.toLowerCase(),s=/(^|\/)(__tests__|tests?|e2e|specs?)\/|\.(test|spec)\.[a-z]+$/i,c=e=>e.toLowerCase()===o?0:e.toLowerCase().startsWith(o)?1:2,l=[...e.results].filter(e=>!e.name.includes(`<`)).sort((e,t)=>c(e.name)-c(t.name)||Number(s.test(e.path))-Number(s.test(t.path))||(t.callers??0)-(e.callers??0)).slice(0,6),u=l.map(e=>`${n.toLowerCase()} ${i===`File`?e.path:e.name}${t}`);E(u),O(new Map(l.map((e,t)=>[u[t],i===`File`?``:`${e.path.split(`/`).pop()}${e.callers===void 0?``:` · ${e.callers} caller${e.callers===1?``:`s`}`}`])))},()=>!a&&E([]))},120);return()=>{a=!0,clearTimeout(o)}},[d,e]);let[k,A]=(0,y.useState)([]);(0,y.useEffect)(()=>{let t=d.trim();if(!p||!e||!C.current||t.length<2||De.test(t)||/\s/.test(t))return A([]);let n=!1,r=setTimeout(()=>{Y.search(e,`Function`,t,6).then(e=>!n&&A(e.results.filter(e=>!e.name.includes(`<`))),()=>!n&&A([]))},120);return()=>{n=!0,clearTimeout(r)}},[d,e,p]);let j=(0,y.useMemo)(()=>{let e=[...T,...a,...i.filter(e=>!a.includes(e))],t=d.trim().toLowerCase(),n=new Set;return(t?e.filter(e=>T.includes(e)||e.toLowerCase().includes(t)&&e.toLowerCase()!==t):e).filter(e=>!n.has(e)&&n.add(e)).slice(0,l?6:8)},[T,a,i,d,l]),M=(0,y.useMemo)(()=>{let e=j.map(e=>({key:`ask:${e}`,group:`Ask`,label:e,...D.get(e)?{detail:D.get(e)}:a.includes(e)?{detail:`recent`}:{},run:()=>z(e)})),t=k.map(e=>({key:`fn:${e.id}`,group:`Functions`,label:e.name,detail:e.path,run:()=>C.current?.(e.id,e.id.slice(0,e.id.indexOf(`:`,e.id.indexOf(`:`)+1)))}));return[...e,...t,...l&&p?l(d):[]]},[j,k,l,d,D,a,p]);S.current=M;let N=d.trim(),P=h===null&&!_&&!/\s/.test(N)&&/[A-Z_.$0-9]/.test(N.slice(1))&&N.length>=2?M.findIndex(e=>e.group!==`Ask`):-1,F=h===null?P:M.findIndex(e=>e.key===h);x.current=h===null?-1:F;let I=p&&M.length>0;(0,y.useImperativeHandle)(c,()=>({prefill:e=>{f(e),m(!1),b(-1),requestAnimationFrame(()=>{let t=w.current;if(!t)return;t.focus();let n=e.indexOf(`<`),r=e.indexOf(`>`,n);n>=0&&r>n&&t.setSelectionRange(n,r+1)})}})),(0,y.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),w.current?.focus(),w.current?.select(),m(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let L=(0,y.useRef)(void 0),R=()=>{m(!1),b(-1)},z=e=>{let t=e.trim();!t||n||t.includes(`<`)||(o(t),f(t),R(),w.current?.blur())};return(0,X.jsxs)(`form`,{className:`ask`,role:`search`,onSubmit:e=>{e.preventDefault();let t=F>=0?M[F]:void 0;t?(t.run(),t.group!==`Ask`&&(f(``),R(),w.current?.blur())):z(d)},children:[(0,X.jsx)(`input`,{ref:w,"data-testid":`ask`,"aria-label":`Ask about this code`,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":I,"aria-controls":I?`ask-options`:void 0,"aria-activedescendant":I&&F>=0?`ask-option-${F}`:void 0,placeholder:r?`Loading…`:n?`Open a project to ask about its code`:l?`Ask, or go to a function, file, group or command… ⌘K`:`Ask about this code… ⌘K`,disabled:n,value:d,onChange:e=>{clearTimeout(L.current),v(!1),f(e.target.value),m(!0),b(-1)},onFocus:()=>{clearTimeout(L.current),m(!0)},onBlur:()=>{L.current=setTimeout(R,120)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),m(!0),b(e=>Math.min(M.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),(h===null||x.current<=0)&&v(!0),b(e=>Math.max(-1,e-1))):e.key===`Escape`?(R(),w.current?.blur()):e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),z(d))}}),s&&(0,X.jsx)(`span`,{className:`spinner`,"aria-label":`Answering`}),I&&(0,X.jsxs)(`ul`,{className:`ask-options`,id:`ask-options`,role:`listbox`,"data-testid":`ask-options`,children:[M.map((e,t)=>(0,X.jsxs)(y.Fragment,{children:[(t===0||M[t-1].group!==e.group)&&(0,X.jsx)(`li`,{className:`ask-group`,role:`presentation`,"aria-hidden":`true`,children:e.group}),(0,X.jsxs)(`li`,{id:`ask-option-${t}`,role:`option`,"aria-selected":t===F,className:t===F?`active`:``,"data-group":e.group,"data-key":e.key,"data-testid":`palette-item`,"aria-label":e.group===`Ask`?e.label:`${e.group}: ${e.label}`,onMouseDown:t=>{t.preventDefault(),e.run(),e.group!==`Ask`&&(f(``),R(),w.current?.blur())},children:[(0,X.jsx)(`span`,{children:e.label}),e.detail&&(0,X.jsx)(`small`,{className:`muted`,children:e.detail})]})]},e.key)),(0,X.jsx)(`li`,{className:`ask-hint`,role:`presentation`,children:t?`Or ask anything in plain words: it goes to ${t.split(`/`).pop()} (your question and the names and paths it looks up are sent to the provider).`:`These are answered offline. To ask anything else, add a model in Settings.`})]})]})}function ke(e,t){let n=[],r=e;for(;;){let e=null;for(let n of t){let t=r.indexOf(n.text);t<0||(!e||t<e.at||t===e.at&&n.text.length>e.c.text.length)&&(e={at:t,c:n})}if(!e)break;n.push(r.slice(0,e.at),e.c),r=r.slice(e.at+e.c.text.length)}return n.push(r),n}var Ae=`<(?:callback|module|iife|anonymous|object)(?::[^<>\\s]*)?>(?:#\\d+)?`,je=RegExp(`(?<![\\w$])(?:[A-Za-z_$][\\w$]*(?:\\.(?:[\\w$]+|${Ae}))*\\.${Ae}(?:\\.(?:[\\w$]+|${Ae}))*|${Ae})`,`g`);function Me({answer:e,onCite:t}){let n=e.citations??[],r=new Map,i=new Map;for(let t of[...e.results,...e.lookups??[]])t.kind===`function`&&t.line!==void 0&&r.set(t.label,t.line),(t.kind===`function`||t.kind===`call`)&&t.title&&i.set(t.label,t.title);let a=e=>e.replace(je,e=>se(e,r.get(e),i.get(e))),o=(e,r)=>ke(e,n).map((e,n)=>typeof e==`string`?a(e):e.verified?(0,X.jsx)(`button`,{className:`cite`,title:e.target?`Returned by a tool. Open it`:`Returned by a tool`,onClick:()=>t(e),children:e.text},`${r}.${n}`):(0,X.jsxs)(`span`,{className:`cite unverified`,title:`Not returned by any tool: check it`,"aria-label":`${e.text}, not returned by any tool`,children:[e.text,` ⚠`]},`${r}.${n}`)),s=(e,t)=>e.split(/(`[^`]+`|\*\*[^*]+\*\*)/).map((e,n)=>e.startsWith("`")&&e.endsWith("`")&&e.length>1?(0,X.jsx)(`code`,{children:o(e.slice(1,-1),`${t}.${n}`)},`${t}.${n}`):e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>3?(0,X.jsx)(`strong`,{children:o(e.slice(2,-2),`${t}.${n}`)},`${t}.${n}`):(0,X.jsx)(`span`,{children:o(e,`${t}.${n}`)},`${t}.${n}`)),c=[];for(let t of(e.prose??``).split(`
9
+ `).replace(Zf,``)}function $f(e,t){return t=Qf(t),Qf(e)===t}function ep(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||Xt(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&Xt(e,``+r);else return;break;case`className`:Ft(e,`class`,r);break;case`tabIndex`:Ft(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ft(e,n,r);break;case`style`:$t(e,r,a);return;case`data`:if(t!==`object`){Ft(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=rn(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}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&ep(e,t,`name`,i.name,i,null),ep(e,t,`formEncType`,i.formEncType,i,null),ep(e,t,`formMethod`,i.formMethod,i,null),ep(e,t,`formTarget`,i.formTarget,i,null)):(ep(e,t,`encType`,i.encType,i,null),ep(e,t,`method`,i.method,i,null),ep(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=rn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=an);return;case`onScroll`:r!=null&&Bf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Bf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(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=rn(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`credentialless`: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`:Bf(`beforetoggle`,e),Bf(`toggle`,e),Pt(e,`popover`,r);break;case`xlinkActuate`:It(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:It(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:It(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:It(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Pt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=tn.get(n)||n,Pt(e,n,r);else return}Mt=!0}function tp(e,t,n,r,i,a){switch(n){case`style`:$t(e,r,a);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)Xt(e,r);else if(typeof r==`number`||typeof r==`bigint`)Xt(e,``+r);else return;break;case`onScroll`:r!=null&&Bf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Bf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=an);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Et.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),a=n.slice(2,i?n.length-7:void 0),t=e[ut]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(a,t,i),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(a,r,i);break a}Mt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Pt(e,n,r)}return}Mt=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Bf(`error`,e),Bf(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var o=n[a];if(o!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:ep(e,t,a,o,n,null)}}i&&ep(e,t,`srcSet`,n.srcSet,n,null),r&&ep(e,t,`src`,n.src,n,null);return;case`input`:Bf(`invalid`,e);var c=a=o=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:o=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(s(137,t));break;default:ep(e,t,r,d,n,null)}}Gt(e,a,c,l,u,o,i,!1);return;case`select`:for(i in Bf(`invalid`,e),r=o=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:o=c;break;case`multiple`:r=c;default:ep(e,t,i,c,n,null)}t=a,n=o,e.multiple=!!r,t==null?n!=null&&qt(e,!!r,n,!0):qt(e,!!r,t,!1);return;case`textarea`:for(o in Bf(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(o)&&(c=n[o],c!=null))switch(o){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(s(91));break;default:ep(e,t,o,c,n,null)}Yt(e,r,i,a);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:ep(e,t,l,r,n,null)}return;case`dialog`:Bf(`beforetoggle`,e),Bf(`toggle`,e),Bf(`cancel`,e),Bf(`close`,e);break;case`iframe`:case`object`:Bf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Lf.length;r++)Bf(Lf[r],e);break;case`image`:Bf(`error`,e),Bf(`load`,e);break;case`details`:Bf(`toggle`,e);break;case`embed`:case`source`:case`link`:Bf(`error`,e),Bf(`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(s(137,t));default:ep(e,t,u,r,n,null)}return;default:if(en(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ep(e,t,c,r,n,null))}var rp={};function ip(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 i=null,a=null,o=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)||ep(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`:m!==f&&(Mt=!0),a=m;break;case`name`:m!==f&&(Mt=!0),i=m;break;case`checked`:m!==f&&(Mt=!0),u=m;break;case`defaultChecked`:m!==f&&(Mt=!0),d=m;break;case`value`:m!==f&&(Mt=!0),o=m;break;case`defaultValue`:m!==f&&(Mt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(s(137,t));break;default:m!==f&&ep(e,t,p,m,r,f)}}Wt(e,o,c,l,u,d,a,i);return;case`select`:for(a in m=o=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||ep(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:a!==l&&(Mt=!0),p=a;break;case`defaultValue`:a!==l&&(Mt=!0),c=a;break;case`multiple`:a!==l&&(Mt=!0),o=a;default:a!==l&&ep(e,t,i,a,r,l)}t=c,n=o,r=m,p==null?!!r!=!!n&&(t==null?qt(e,!!n,n?[]:``,!1):qt(e,!!n,t,!0)):qt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ep(e,t,c,null,r,i)}for(o in r)if(i=r[o],a=n[o],r.hasOwnProperty(o)&&(i!=null||a!=null))switch(o){case`value`:i!==a&&(Mt=!0),p=i;break;case`defaultValue`:i!==a&&(Mt=!0),m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(s(91));break;default:i!==a&&ep(e,t,o,i,r,a)}Jt(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:ep(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`:p!==m&&(Mt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ep(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)&&ep(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(s(137,t));break;default:ep(e,t,u,p,r,m)}return;default:if(en(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(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||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ep(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||ep(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){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&&ap(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&&ap(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 sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(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 dp(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 fp(e,t,n,r){return n=lp(n).createElement(e),n[lt]=r,n[ut]=t,np(n,e,t),Ct(n),n}function pp(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 mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(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),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[gt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(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 Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:D({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){h(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=b(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=lp(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag!==6&&(e=b(e),t.observe(e),!1)}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag!==6&&(e=b(e),t.unobserve(e),!1)}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=yt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=E(n,a,T),t===null?t=!1:(h(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=E(r,a,T),t===null?t=!1:(h(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(s(566));var t=[];h(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Zp(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var i=t[r];i.tag===6?(i=b(i),Zp(i,n)):b(i).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=b(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(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`:nm(n),vt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(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[gt])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=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(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 lm(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 um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(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 pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(s(452));return e;case`head`:if(e=t.head,!e)throw Error(s(453));return e;case`body`:if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ep(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===an&&(e.onclick=null),vt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);vt(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=Y.d;Y.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=Id();return e||t}function Cm(e){var t=bt(e);t!==null&&t.tag===5&&t.type===`form`?qs(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=Ut(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ut(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ut(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ut(n.imageSizes)+`"]`)):i+=`[href="`+Ut(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=D({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[_t]=!0,o.onload=o.onerror=function(){wt(o)}),Ct(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ut(r)+`"][href="`+Ut(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=D({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Ct(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=St(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=D({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Ct(c),np(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,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=St(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ct(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=St(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ct(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var i=(i=de.current)?bm(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=St(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,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=Pm(n.href);var a=St(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(Fm(e)))?a._p||(o.instance=a,o.state.loading=5):(a=vm.get(e),a||(a={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,a)),Lm(i,e,a,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=St(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Pm(e){return`href="`+Ut(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[_t]){r.loading=1;return}}else t=e.createElement(`link`),t[_t]=!0,t.onload=t.onerror=wt.bind(null,t),np(t,`link`,n),Ct(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+Ut(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ut(n.href)+`"]`);if(r)return t.instance=r,Ct(r),r;var i=D({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ct(r),np(r,`style`,i),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Pm(n.href);var a=e.querySelector(Fm(i));if(a)return t.state.loading|=4,t.instance=a,Ct(a),a;r=Im(n),(i=vm.get(i))&&Hm(r,i),a=(e.ownerDocument||e).createElement(`link`),Ct(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),t.state.loading|=4,Vm(a,n.precedence,e),t.instance=a;case`script`:return a=Rm(n.src),(i=e.querySelector(zm(a)))?(t.instance=i,Ct(i),i):(r=n,(i=vm.get(a))&&(r=D({},n),Um(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Ct(i),np(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(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 Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,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[gt]||a[lt]||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 Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(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 Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(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=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ct(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Ct(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(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=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.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=nh.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 sh={$$typeof:F,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qe(0),this.hiddenUpdates=Qe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=yi(3,null,null,t),e.current=a,a.stateNode=e,t=ba(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},no(a),e}function uh(e){return e?(e=_i,e):_i}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=io(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=ao(e,r,t),n!==null&&(jd(n,e,t),oo(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=mi(e,67108864);t!==null&&jd(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=Od();t=it(t);var n=mi(e,t);n!==null&&jd(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=J.T;J.T=null;var a=Y.p;try{Y.p=2,yh(e,t,n,r)}finally{Y.p=a,J.T=i}}function vh(e,t,n,r){var i=J.T;J.T=null;var a=Y.p;try{Y.p=8,yh(e,t,n,r)}finally{Y.p=a,J.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Gf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=bt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=qe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Be(o);s.entanglements[1]|=c,o&=~c}wf(a),!(Ku&6)&&(pd=Oe()+500,Tf(0,!1))}}break;case 31:case 13:s=mi(a,2),s!==null&&jd(s,a,2),Id(),ph(a,2)}if(a=bh(r),a===null&&Gf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Gf(e,t,r,null,n)}}function bh(e){return e=sn(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=yt(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(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 xh=e,null}function Ch(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`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`fullscreenerror`: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`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(ke()){case Ae:return 2;case je:return 8;case Me:case Ne:return 32;case Pe:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`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 Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=bt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=yt(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,st(e.priority,function(){hh(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,st(e.priority,function(){hh(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 Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);on=r,n.target.dispatchEvent(r),on=null}else return t=bt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=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(Sh(r||n)===null)continue;break}var a=bt(n);a!==null&&(e.splice(t,3),t-=3,Gs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.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[ut]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ut]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){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 Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var n=t.current;dh(n,Od(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),Id(),t[dt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=ot();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=r.version;if(Kh!==`19.3.0`)throw Error(s(527,Kh,`19.3.0`));Y.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(s(188)):(e=Object.keys(e).join(`,`),Error(s(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:J,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{Le=Jh.inject(qh),Re=Jh}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(s(299));var n=!1,r=``,i=mc,a=hc,o=gc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,i,a,o,Uh),e[dt]=t.current,Uf(e),new Wh(t)}})),c=e(((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=s()}));function l(e){if(e.carrying===void 0)return{weight:e.imports+e.calls+(e.references??0)};let t=e.calls+(e.references??0);return t===0&&e.carrying===0?null:{weight:t}}var u={"dynamic-dispatch":`type unknown`,untyped:`type unknown`,reflection:`reflection`,"computed-member":`computed name`,computed:`computed name`,metaprogramming:`built at run time`,"dynamic-sql":`SQL built at run time`,"imported-symbol":`imported, not linked`,"runtime-global":`built-in`,"builtin-value":`built-in value`,"template-binding":`awaiting its component`,"template-reference":`registered elsewhere`,candidates:`narrowed to candidates`,ambiguous:`could be several functions`,"not-exported":`not exported`,"not-found":`not found`,"not-a-function":`a value, not a function`,undeclared:`not declared by its type`,"no-body":`no body known`,"bodies-unknown":`not every body is known`,"unknown-wrapper":`wrapped in a function it can't see into`,"depth-limit":`too many imports deep to follow`,cycle:`imports go round in a cycle`,broken:`its import is broken`,pending:`its import waits for a source not added`,"not-analyzed":`its import reaches a file not analyzed`,default:`only a default is known`,member:`a member of a function`,truncated:`too deep to follow`,unresolved:`not resolved`};function d(e){return u[e]??e.replace(/-/g,` `)}var f=[`open`,`adjudicated`,`dynamic-only`];function p(e){return f.includes(e.status)}var m=/(^|\/)(__tests__|__mocks__|tests?|e2e|specs?|fixtures?)\/|\.(test|spec|e2e|stories)\.[a-z0-9]+$/i;function h(e){return m.test(e)}function g(e){return e.origin===void 0&&!h(e.path)}function _(e,t){return(t.get(e.source)??[]).some(t=>e.path===t||e.path.startsWith(`${t}/`))}function v(e){return t=>g(t)&&!_(t,e)}var y=n(),b=c(),x=(e,t)=>e?.runId===t?e:{runId:t,stages:[],finished:[]};function S(e,t){switch(t.type){case`run.started`:return{runId:t.runId,startedAt:new Date().toISOString(),stages:[],finished:[]};case`run.planned`:return e=x(e,t.runId),{...e,stages:t.stages,planned:{listed:t.sources.reduce((e,t)=>e+t.listed,0),toAnalyze:t.sources.reduce((e,t)=>e+t.toAnalyze,0),notAnalyzed:t.sources.reduce((e,t)=>e+Object.values(t.notAnalyzed).reduce((e,t)=>e+t,0),0)}};case`stage.started`:{e=x(e,t.runId);let{runId:n,startedAt:r,planned:i,stages:a,finished:o}=e;return{runId:n,...r?{startedAt:r}:{},...i?{planned:i}:{},stages:a.length?a:[t.stage],finished:o,stage:t.stage,index:t.index}}case`stage.progress`:{e=x(e,t.runId);let{done:n,total:r,unit:i,...a}=e,{type:o,projectId:s,runId:c,stage:l,...u}=t;return{...a,stage:l,...u}}case`stage.completed`:return e?.runId===t.runId?{...e,finished:[...e.finished,{stage:t.stage,durationMs:t.durationMs}]}:e;case`run.committed`:case`run.failed`:return e?.runId===t.runId?null:e;default:return e}}var C={stage1:`Reading files`,"template-link":`Linking component templates`,stage2:`Linking across files`},w=e=>e.toLocaleString(`en-US`);function T(e){if(e.stage===void 0)return{text:e.planned?`Planned: ${w(e.planned.toAnalyze)} files to analyze${e.planned.notAnalyzed?` (${w(e.planned.notAnalyzed)} not analyzed)`:``}`:`Planning…`,fraction:0};let t=e.stages.length>1&&e.index!==void 0?` · stage ${e.index+1} of ${e.stages.length}`:``,n=C[e.stage]??e.stage,r=``,i=null;if(e.phase===`saving results`)return{text:`${n}: saving results${t}`,fraction:1};if(e.phase){let t=e.total===void 0?``:e.done===void 0?` (${w(e.total)}${e.unit?` ${e.unit}`:``})`:`: ${w(e.done)} of ${w(e.total)}${e.unit&&e.unit!==`files`?` ${e.unit}`:``}`,n=e.steps&&e.steps>1?`, step ${e.step} of ${e.steps}`:``;r=e.phase===`reading files`?t:`: ${e.phase}${t}${n}`,e.done!==void 0&&e.total?i=e.done/e.total:e.steps&&e.step&&(i=(e.step-1)/e.steps)}return{text:`${n}${r}${t}`,fraction:i}}function E(e,t){let n=new Set([t]);for(let t=!0;t;){t=!1;for(let r of e)!n.has(r.file)&&n.has(r.from)&&(n.add(r.file),t=!0)}return e.filter(e=>!n.has(e.file))}var D={v:1,project:null,file:null,selection:null,panel:`evidence`,showUnresolved:!1,tab:`file`,group:null,pick:null,fileLevel:!1,showPending:!1,expand:[],source:null,run:null,history:!1,compare:null,only:null,area:null,reach:null,grouping:`declared`,differences:!1,reveal:[]},O=(e,t=!1)=>n=>t&&n[e]===void 0||typeof n[e]==`string`&&n[e].length>0?[]:[e],k=(e,t)=>n=>t.includes(n[e])?[]:[e],A=(...e)=>t=>e.flatMap(e=>e(t)),j=()=>[],M={selectProject:{description:`Show a project`,control:{kind:`select`,testId:`select-project`},check:O(`project`),apply:(e,t)=>({...D,project:t.project,panel:e.panel,tab:e.tab,...t.project===e.project?{run:e.run,history:e.history,compare:e.compare}:{}})},goHome:{description:`Go to the projects home: every project, its last run and its findings`,control:{kind:`button`,testId:`go-home`},check:j,apply:e=>({...D,panel:e.panel})},openFile:{description:`Show a file: its functions and calls (File tab), or its imports and cross-file calls (Imports tab)`,control:{kind:`tree`,testId:`open-file`},check:O(`file`),apply:(e,t)=>({...e,only:null,file:t.file,selection:null,fileLevel:e.tab===`imports`,pick:e.tab===`imports`?null:e.pick,reveal:t.file===e.file&&(e.tab!==`imports`||e.fileLevel)?e.reveal:[]})},select:{description:`Select a function, call or unresolved call site to see its evidence`,control:{kind:`canvas`,testId:`select`,shortcut:`Enter`},check:A(k(`kind`,[`function`,`call`,`site`]),O(`id`),O(`file`,!0)),apply:(e,t)=>({...e,file:t.file??e.file,selection:{kind:t.kind,id:t.id},reveal:(t.file??e.file)===e.file?e.reveal:[],panel:`evidence`,tab:`file`,fileLevel:!1,showUnresolved:t.kind===`site`||e.showUnresolved})},clearSelection:{description:`Clear the selection`,control:{kind:`button`,testId:`clear-selection`,shortcut:`Escape`},check:j,apply:e=>({...e,selection:null,pick:null})},showPanel:{description:`Show the evidence panel, the open-questions list or the last answer`,control:{kind:`tab`,testId:`show-panel`},check:k(`panel`,[`evidence`,`questions`,`answer`]),apply:(e,t)=>({...e,panel:t.panel})},showTab:{description:`Show the File tab (inside one file) or the Imports tab (how files depend on each other)`,control:{kind:`tab`,testId:`show-tab`},check:k(`tab`,[`file`,`imports`,`reach`]),apply:(e,t)=>t.tab===`reach`&&!e.reach?e:t.tab===`imports`&&e.tab===`file`&&e.file?{...e,tab:`imports`,fileLevel:!0,group:null,pick:null,only:null,expand:[],reveal:[]}:t.tab===`imports`&&e.tab===`imports`?{...e,fileLevel:!1,group:null,pick:null,only:null,expand:[],area:null,reveal:[]}:{...e,tab:t.tab}},openReach:{description:`Open the Reach tab on a function or file: what paths from it reach (forward) or what reaches it (backward), and where they stop`,control:{kind:`button`,testId:`open-reach`},check:A(O(`root`),e=>e.direction===void 0||e.direction===`forward`||e.direction===`backward`?[]:[`direction`]),apply:(e,t)=>({...e,tab:`reach`,reach:{root:t.root,direction:t.direction??e.reach?.direction??`forward`},pick:null,only:null})},pickNode:{description:`Pick a group on the Imports tab's map to see its details`,control:{kind:`canvas`,testId:`pick-node`},check:O(`id`),apply:(e,t)=>({...e,tab:`imports`,pick:t.id,panel:`evidence`})},openGroup:{description:`Open a group on the Imports tab (its files and imports), or go back to the project map`,control:{kind:`canvas`,testId:`open-group`},check:A(O(`group`,!0),O(`folder`,!0)),apply:(e,t)=>{let n=t.group===e.group||e.group===null?e.expand:[];return{...e,only:null,tab:`imports`,group:t.group??null,pick:null,fileLevel:!1,area:t.group?e.area:null,expand:t.folder&&!n.includes(t.folder)?[...n,t.folder].sort():n,reveal:[]}}},openArea:{description:`Show one part of a large project map: a repository, or a folder in one (none: the whole map)`,control:{kind:`canvas`,testId:`open-area`},check:O(`area`,!0),apply:(e,t)=>({...e,only:null,tab:`imports`,group:null,pick:null,fileLevel:!1,area:t.area??null,reveal:[]})},openImportsFile:{description:`Open a file on the Imports tab: its imports and its cross-file calls`,control:{kind:`canvas`,testId:`open-imports-file`},check:A(O(`file`),O(`group`,!0),O(`pick`,!0)),apply:(e,t)=>({...e,only:null,tab:`imports`,file:t.file,group:t.group??e.group,fileLevel:!0,reveal:t.file===e.file&&e.fileLevel?e.reveal:[],pick:t.pick??null,panel:t.pick?`evidence`:e.panel,selection:null})},revealFile:{description:`On a file's Imports level, show another file's imports and calls in place (or hide them again, with what was revealed from it)`,control:{kind:`canvas`,testId:`reveal-file`},check:A(O(`file`),O(`from`,!0)),apply:(e,t)=>e.reveal.some(e=>e.file===t.file)?{...e,reveal:E(e.reveal,t.file)}:t.file===e.file||!e.file||e.tab!==`imports`||!e.fileLevel?e:{...e,reveal:[...e.reveal,{file:t.file,from:t.from??e.file}]}},resetReveal:{description:`On a file's Imports level, hide every file revealed in place: the open file's own imports and calls only`,control:{kind:`button`,testId:`reset-reveal`},check:j,apply:e=>({...e,reveal:[]})},toggleFolder:{description:`Open or close a folder in a large group on the Imports tab`,control:{kind:`canvas`,testId:`toggle-folder`},check:O(`path`),apply:(e,t)=>({...e,expand:e.expand.includes(t.path)?e.expand.filter(e=>e!==t.path&&!e.startsWith(`${t.path}/`)):[...e.expand,t.path].sort()})},scopeSource:{description:`Limit the navigator, the map and Findings to one repository, or show all of them`,control:{kind:`select`,testId:`scope-source`},check:O(`source`,!0),apply:(e,t)=>({...e,only:null,source:t.source??null,group:t.source?null:e.group,pick:null,area:null})},openRun:{description:`Read the graph at another run (the draft of uncommitted edits, or an older run), or back at the latest`,control:{kind:`button`,testId:`open-run`},check:e=>e.run===void 0||Number.isInteger(e.run)&&e.run>0?[]:[`run`],apply:(e,t)=>({...e,run:t.run??null,compare:null,selection:null,pick:null})},toggleHistory:{description:`Open or close the History panel: runs by commit, and comparing two`,control:{kind:`toggle`,testId:`toggle-history`},check:j,apply:e=>({...e,history:!e.history})},compareRuns:{description:`Compare two runs (the change list and the diff on the canvas), or stop comparing`,control:{kind:`button`,testId:`compare-runs`},check:e=>{if(e.a===void 0&&e.b===void 0)return[];let t=e=>Number.isInteger(e)&&e>0;return[...t(e.a)?[]:[`a`],...t(e.b)?[]:[`b`]]},apply:(e,t)=>t.a===void 0||t.b===void 0?{...e,compare:null,run:null}:{...e,compare:{a:Math.min(t.a,t.b),b:Math.max(t.a,t.b)},run:Math.max(t.a,t.b),history:!0}},showOnlyLinks:{description:`Show only an item and what it links to (a group, a file or a function), or everything again`,control:{kind:`canvas`,testId:`show-only-links`},check:O(`id`,!0),apply:(e,t)=>({...e,only:t.id??null})},setGrouping:{description:`Group the project map by its packages and folders (declared), or by how its files connect (connected)`,control:{kind:`select`,testId:`set-grouping`},check:k(`grouping`,[`declared`,`connected`]),apply:(e,t)=>t.grouping===e.grouping?e:{...e,grouping:t.grouping,differences:t.grouping===`connected`&&e.differences,group:null,pick:null,area:null,expand:[],only:null}},toggleDifferences:{description:`Mark, on the map grouped by how files connect, the declared groups it splits or merges`,control:{kind:`toggle`,testId:`toggle-differences`},check:j,apply:e=>({...e,differences:!e.differences})},togglePending:{description:`Show or hide imports waiting for another source (pending)`,control:{kind:`toggle`,testId:`toggle-pending`},check:j,apply:e=>({...e,showPending:!e.showPending})},toggleUnresolved:{description:`Show or hide unresolved call sites in the graph`,control:{kind:`toggle`,testId:`toggle-unresolved`,shortcut:`u`},check:j,apply:e=>({...e,showUnresolved:!e.showUnresolved})}},N=class extends Error{code;fields;constructor(e,t,n=[]){super(t),this.code=e,this.fields=n}};function P(e,t){let n=Object.hasOwn(M,t.name)?M[t.name]:void 0;if(!n)throw new N(`unknown-command`,`no command ${t.name}`);let r=t.args??{},i=n.check(r);if(i.length>0)throw new N(`invalid-arguments`,`invalid arguments for ${t.name}: ${i.join(`, `)}`,i);return n.apply(e,r)}function F(e=D){return{past:[],present:e,future:[]}}function I(e,t){let n=P(e.present,t);return JSON.stringify(n)===JSON.stringify(e.present)?e:{past:[...e.past,e.present].slice(-200),present:n,future:[]}}function L(e){let t=e.past.at(-1);return t?{past:e.past.slice(0,-1),present:t,future:[e.present,...e.future]}:e}function R(e){let t=e.future[0];return t?{past:[...e.past,e.present],present:t,future:e.future.slice(1)}:e}function z(e){return encodeURIComponent(JSON.stringify(e))}function B(e){let t=e,n=e=>Number.isInteger(e)&&e>0;return t&&typeof t==`object`&&n(t.a)&&n(t.b)?{a:t.a,b:t.b}:null}function V(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.root==`string`&&t.root&&(t.direction===`forward`||t.direction===`backward`)?{root:t.root,direction:t.direction}:null}function H(e){if(!e)return D;let t;try{t=JSON.parse(decodeURIComponent(e))}catch{return D}if(!t||typeof t!=`object`||t.v!==1)return D;let n=e=>typeof e==`string`&&e.length>0?e:null,r=t.selection,i=r&&typeof r==`object`&&[`function`,`call`,`site`].includes(r.kind)&&n(r.id)?{kind:r.kind,id:r.id}:null;return{v:1,project:n(t.project),file:n(t.file),selection:i,panel:t.panel===`questions`||t.panel===`answer`?t.panel:`evidence`,showUnresolved:typeof t.showUnresolved==`boolean`?t.showUnresolved:D.showUnresolved,tab:t.tab===`imports`?`imports`:t.tab===`reach`&&V(t.reach)?`reach`:`file`,group:n(t.group),pick:n(t.pick),fileLevel:t.fileLevel===!0,showPending:t.showPending===!0,source:n(t.source),run:Number.isInteger(t.run)&&t.run>0?t.run:null,history:t.history===!0,compare:B(t.compare),only:n(t.only),area:n(t.area),reach:V(t.reach),grouping:t.grouping===`connected`?`connected`:`declared`,differences:t.grouping===`connected`&&t.differences===!0,expand:Array.isArray(t.expand)?t.expand.filter(e=>typeof e==`string`&&e.length>0):[],reveal:Array.isArray(t.reveal)?t.reveal.flatMap(e=>e&&typeof e==`object`&&n(e.file)&&n(e.from)?[{file:e.file,from:e.from}]:[]):[]}}var U={addFolder:{description:`Add a folder to the project and analyze it`,control:{kind:`button`,testId:`add-folder`},check:O(`root`)},analyze:{description:`Analyze the project again`,control:{kind:`button`,testId:`reanalyze`},check:j},analyzeDraft:{description:`Analyze the working tree's uncommitted edits as a draft, beside the current graph`,control:{kind:`button`,testId:`analyze-draft`},check:j},analyzeDebug:{description:`A debug run that stops after a chosen stage, beside the current graph: never committed, replaced by the next one`,control:{kind:`button`,testId:`analyze-debug`},check:O(`until`)},analyzeFrom:{description:`Analyze again from a later stage: the stages before it are reused when nothing they read changed since the latest run`,control:{kind:`button`,testId:`analyze-from`},check:O(`from`)},ask:{description:`Ask a question about the analyzed code (built-in questions offline; anything with a model)`,control:{kind:`button`,testId:`ask`,shortcut:`Mod+K`},check:O(`question`)},openSettings:{description:`Set the model provider: base URL, API key and model name`,control:{kind:`button`,testId:`settings`},check:j},analyzeSource:{description:`Analyze one repository again (the others stay at their commits)`,control:{kind:`button`,testId:`repo-analyze`},check:O(`source`)},chooseFiles:{description:`Choose which files are analyzed, opened at a folder or file (to leave it out, or add it back)`,control:{kind:`button`,testId:`repo-choose`},check:A(O(`source`),O(`path`,!0))},openProjectSettings:{description:`The project's settings, at a tab: its repositories (re-analyze, choose files, rename, edit rules, remove), analysis options, or the license`,control:{kind:`button`,testId:`project-settings`},check:(e=>e.tab===void 0?[]:k(`tab`,[`repositories`,`analysis`,`license`])(e))}};function W(e,t={}){let n=Object.hasOwn(U,e)?U[e]:void 0;if(!n)throw new N(`unknown-command`,`no action ${e}`);let r=n.check(t);if(r.length>0)throw new N(`invalid-arguments`,`invalid arguments for ${e}: ${r.join(`, `)}`,r)}function ee(e){return e.file?e.kind===`file`?[{name:`openFile`,args:{file:e.file}}]:e.kind===`function`||e.kind===`call`||e.kind===`site`?[{name:`openFile`,args:{file:e.file}},{name:`select`,args:{kind:e.kind,id:e.id,file:e.file}}]:[]:[]}var G=null;function te(e){return e?.details?.kind===`run`}function ne(e){G=e}async function K(e,t){let n=t?.method??`GET`;G!==null&&e.startsWith(`/api/projects/`)&&(n===`GET`||e.endsWith(`/snippet`)||e.endsWith(`/ask`))&&(e=`${e}${e.includes(`?`)?`&`:`?`}run=${G}`);let r=await fetch(e,{...t,headers:{"content-type":`application/json`,...t?.headers??{}}}),i=await r.json();if(!r.ok){let e=i.details,t=i.code,n=r.status===404?`gone`:r.status===403&&t===`entitlement`?`history`:null;throw n&&e?.kind===`run`&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`veo-run-gone`,{detail:{run:G,reason:n}})),i}return i}var q=e=>`/api/projects/${encodeURIComponent(e)}`,J=e=>new URLSearchParams(e).toString(),Y={projects:(e=!1)=>K(`/api/projects${e?`?findings=1`:``}`),createProject:(e,t)=>K(`/api/projects`,{method:`POST`,body:JSON.stringify(t===void 0?{name:e}:{name:e,root:t})}),projectDisk:e=>K(`${q(e)}/disk`),deleteProject:e=>K(q(e),{method:`DELETE`,body:`{}`}),addSource:(e,t)=>K(`${q(e)}/sources`,{method:`POST`,body:JSON.stringify({root:t})}),analyze:e=>K(`${q(e)}/runs`,{method:`POST`,body:`{}`}),history:e=>K(`${q(e)}/history?limit=200`),diff:(e,t,n)=>K(`${q(e)}/diff?${J({a:String(t),b:String(n),limit:`5000`})}`),cancelRun:e=>K(`${q(e)}/runs/cancel`,{method:`POST`,body:`{}`}),analyzeDraft:e=>K(`${q(e)}/runs?draft=true`,{method:`POST`,body:`{}`}),analyzeFrom:(e,t)=>K(`${q(e)}/runs?${J({from:t})}`,{method:`POST`,body:`{}`}),analyzeDebug:(e,t)=>K(`${q(e)}/runs?${J({debug:`true`,until:t})}`,{method:`POST`,body:`{}`}),stages:e=>K(`${q(e)}/stages`),status:e=>K(`${q(e)}/status`),files:e=>K(`${q(e)}/files`),search:(e,t,n,r=6)=>K(`${q(e)}/search?${J({label:t,text:n,limit:String(r)})}`),aggregate:(e,t,n,r=5,i=!1)=>K(`${q(e)}/aggregate?${J({label:t,groupBy:n,limit:String(r),...i?{ownCode:`true`}:{}})}`),fileCounts:e=>K(`${q(e)}/file-counts`),stale:e=>K(`${q(e)}/stale`),groups:(e,t,n=`declared`)=>{let r=new URLSearchParams;t&&r.set(`source`,t),n!==`declared`&&r.set(`grouping`,n);let i=r.toString();return K(`${q(e)}/groups${i?`?${i}`:``}`)},group:(e,t,n,r,i=`declared`)=>{let a=new URLSearchParams({group:t});for(let e of n)a.append(`expand`,e);return r&&a.set(`pending`,`true`),i!==`declared`&&a.set(`grouping`,i),K(`${q(e)}/group?${a.toString()}`)},libraries:(e,t)=>K(`${q(e)}/libraries${t?`?${J({source:t})}`:``}`),library:(e,t,n,r)=>K(`${q(e)}/library?${J({name:t,ecosystem:n,...r?{source:r}:{}})}`),imports:(e,t,n=`declared`)=>K(`${q(e)}/imports?${J({file:t,...n===`declared`?{}:{grouping:n}})}`),fileSummary:(e,t)=>K(`${q(e)}/file-summary?${J({file:t})}`),findings:(e,t,n,r=1e3,i=0)=>{let a=new URLSearchParams({limit:String(r),offset:String(i)});for(let e of t)a.append(`kind`,e);return n.file&&a.set(`file`,n.file),n.group&&a.set(`group`,n.group),n.source&&a.set(`source`,n.source),n.own&&a.set(`own`,`true`),n.grouping&&n.grouping!==`declared`&&a.set(`grouping`,n.grouping),K(`${q(e)}/findings?${a.toString()}`)},callsBetween:(e,t,n,r=0,i=`declared`)=>{let a=new URLSearchParams;i!==`declared`&&a.set(`grouping`,i);for(let e of t)a.append(`from`,e);for(let e of n)a.append(`to`,e);return a.set(`limit`,`200`),r&&a.set(`offset`,String(r)),K(`${q(e)}/cross-file-calls?${a.toString()}`)},crossFileCalls:(e,t,n)=>K(`${q(e)}/cross-file-calls?${J({file:t,direction:n,limit:`500`})}`),totals:(e,t=10,n,r=!1)=>K(`${q(e)}/totals?${J({top:String(t),...n?{source:n}:{},...r?{own:`true`}:{}})}`),reach:(e,t,n)=>K(`${q(e)}/reach?${J({...t.split(`:`).length>2?{function:t}:{file:t},direction:n})}`),references:(e,t,n=`out`)=>K(`${q(e)}/references?${J({function:t,direction:n,limit:`500`})}`),siteLinks:(e,t)=>K(`${q(e)}/site-links?${J({file:t})}`),explain:(e,t)=>K(`${q(e)}/explain?${J({id:t})}`),fileGraph:(e,t)=>K(`${q(e)}/file-graph?${J({file:t})}`),unresolved:(e,t,n)=>K(`${q(e)}/unresolved?${J({...t?{file:t}:{},...n?{limit:String(n.limit),offset:String(n.offset??0)}:{}})}`),snippet:(e,t,n)=>K(`${q(e)}/snippet`,{method:`POST`,body:JSON.stringify({file:t,span:n})}),ask:(e,t,n,r,i,a)=>K(`${q(e)}/ask`,{method:`POST`,body:JSON.stringify({question:t,...n?{mode:n}:{},...r?{file:r}:{},...a?{source:a}:{}}),...i?{signal:i}:{}}),suggestions:e=>K(`${q(e)}/suggestions`),settings:()=>K(`/api/settings`),saveSettings:e=>K(`/api/settings`,{method:`PUT`,body:JSON.stringify(e)}),testSettings:(e={})=>K(`/api/settings/test`,{method:`POST`,body:JSON.stringify(e)}),sources:e=>K(`${q(e)}/sources`),select:(e,t,n,r,i=!1)=>K(`${q(e)}/sources/${encodeURIComponent(t)}/select`,{method:`POST`,body:JSON.stringify({paths:n,selected:r,...i?{keep:i}:{}})}),browse:(e,t,n)=>K(`${q(e)}/sources/${encodeURIComponent(t)}/browse?${J({dir:n})}`),updateSource:(e,t,n)=>K(`${q(e)}/sources/${encodeURIComponent(t)}`,{method:`PATCH`,body:JSON.stringify(n)}),removeSource:(e,t)=>K(`${q(e)}/sources/${encodeURIComponent(t)}`,{method:`DELETE`,body:`{}`}),analyzeSource:(e,t)=>K(`${q(e)}/runs?${J({source:t})}`,{method:`POST`,body:`{}`}),license:e=>K(e?`${q(e)}/license`:`/api/license`),installLicense:e=>K(`/api/license`,{method:`PUT`,body:JSON.stringify({key:e})}),refreshLicense:()=>K(`/api/license/refresh`,{method:`POST`,body:`{}`}),projectSettings:e=>K(`${q(e)}/settings`),saveProjectSettings:(e,t)=>K(`${q(e)}/settings`,{method:`PUT`,body:JSON.stringify(t)})};function re(e,t){let n=`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/api/events`,r=null,i,a=!1,o=!1,s=()=>{a||(r=new WebSocket(n),r.onopen=()=>{o&&e(),o=!1},r.onmessage=e=>{try{t(JSON.parse(String(e.data)))}catch{}},r.onclose=()=>{a||(o=!0,i=setTimeout(s,1e3))})};return s(),()=>{a=!0,clearTimeout(i),r?.close()}}function ie(e){let t=[],n=0,r=``;for(let i of e)i===`<`?n++:i===`>`&&(n=Math.max(0,n-1)),i===`.`&&n===0?(t.push(r),r=``):r+=i;return t.push(r),t.filter(e=>e.length>0)}function ae(e,t){let n=/^<([a-z]+)(?::([^>]*))?>(?:#(\d+))?$/.exec(e);if(!n)return e;let[,r,i,a]=n,o=t===void 0?a?` #${a}`:``:` · line ${t}`;switch(r){case`callback`:return`${i??`anonymous`} callback${o}`;case`module`:return`file top level`;case`template`:return`template`;case`component`:return`component options`;case`iife`:return`immediately invoked function${o}`;case`anonymous`:return`anonymous function${o}`;case`object`:return`object literal${o}`;default:return`${r}${i?` ${i}`:``}${o}`}}function oe(e,t,n){if(!e.includes(`<`))return{name:e,parent:``};let r=ie(e),i=r.pop()??e,a=r.some(e=>e.startsWith(`<`)),o=/^<callback:([^>]*)>(?:#\d+)?$/.exec(i);return{name:n&&o?`${o[1]} “${n}”`:i===`<module>`||i===`<template>`?ae(i):ae(i,t),parent:a?r.map(e=>ae(e)).join(` › `):r.join(`.`)}}function se(e,t,n){let{name:r,parent:i}=oe(e,t,n);return i?`${r} (in ${i})`:r}var ce=/^<(callback|iife|anonymous)(?::([^>]*))?>(?:#\d+)?$/;function le(e){return ce.exec(ie(e).pop()??``)}function ue(e){return le(e)!==null}var de=new Set([`call`,`iife`]),fe=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),pe=24,me=e=>e.length>pe?e.startsWith(`(`)?`(…)`:`…`:e;function he(e){let t=/^(async\s+)?(?:<[^<>]*>\s*)?(\([^()]*\)|[\w$]+)\s*(?::\s*[^=()]+?)?\s*=>/.exec(e);if(t)return{text:`${t[1]??``}${me(t[2])} => …`,arrow:!0};let n=/^(async\s+)?function\b\s*(\*?)\s*([\w$]*)\s*\(([^()]*)\)/.exec(e);if(n){let e=n[3]?` ${n[3]}`:` `;return{text:`${n[1]??``}function${n[2]}${e}(${me(n[4])}) {…}`,arrow:!1}}return null}function ge(e,t){let n=fe(e);if(RegExp(`(?<![\\w$])${n}\\s*=\\s*\\{\\s*$`).test(t))return{call:e,extra:!1,jsx:!0};let r=RegExp(`(\\??\\.)?(?<![\\w$])${n}\\s*(?:<[^<>]*>)?\\s*\\(([^()]*)$`).exec(t);return r?{call:`${r[1]?`.`:``}${e}`,extra:r[2].trim()!==``,jsx:!1}:null}function _e(e,t,n){let r=le(e);if(!r||!t||n)return null;let i=he(t.head);if(!i)return null;let[,a,o]=r;if(a===`iife`)return`(${i.text})()`;if(a===`anonymous`||!o)return i.text;let s=ge(o,t.before);return s?.jsx?`${o}={${i.text}}`:!s&&de.has(o)?i.text:`${s?.call??o}(${s?.extra?`…, `:``}${i.text})`}function ve(e,t){let n=t instanceof Set?t:new Set(t),r=ie(e);for(r.pop();r.length>0;){let e=r.join(`.`);if(n.has(e))return e;r.pop()}return ue(e)&&n.has(`<module>`)&&e!==`<module>`?`<module>`:null}function ye(e,t,n,r){let i=le(e);if(!i)return null;let[,a,o]=i,s=!r||r===`<module>`,c=s?`the file's top level`:se(r),l=t?he(t.head):null,u=l?l.arrow?`An arrow function`:`A function expression`:`A function`;if(a===`iife`)return`A function run where it is written (an immediately invoked function), in ${c} (line ${n}).`;if(a===`anonymous`||!o)return`${u} with no name, in ${c} (line ${n}).`;let d=t?ge(o,t.before):null,f=d?.jsx?o:`${d?.call??o}()`;return`${u} handed to ${f} in ${c} (line ${n}). It has no name in the code; ${d?.jsx?`it runs when ${o} fires`:`${f} runs it`}, not ${s?`the top level`:c}.`}function be(e){let t=oe(e.qualifiedName,e.evidence.span.start.line,e.title);return{name:_e(e.qualifiedName,e.code,e.title)??t.name,parent:t.parent,unnamed:ue(e.qualifiedName)&&!e.title}}function xe(e){let t=oe(e.name,e.line,e.title),n=_e(e.name,e.code,e.title),r=ue(e.name)&&!e.title;return{name:`${r?`λ `:``}${n??t.name}`,parent:e.suite?`“${e.suite}”`:t.parent,unnamed:r,test:e.title!==void 0||e.suite!==void 0}}function Se(e){let{name:t,parent:n}=xe(e);return n?`${t} (in ${n})`:t}function Ce(e){return{stage1:`in-file analysis (Stage 1)`,"template-link":`template linking`,stage2:`import analysis (Stage 2)`}[e]??e}function we(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.round(t/60)} min ago`:t<86400?`${Math.round(t/3600)} h ago`:`${Math.round(t/86400)} days ago`}function Te(e,t=56){if(e.length<=t)return e;let n=e.split(`/`);if(n.length<3)return e;let r=n.pop(),i=n.shift();for(;n.length>0&&i.length+r.length+n[n.length-1].length+4<=t;)r=`${n.pop()}/${r}`;return`${i}/…/${r}`}var Ee=e((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})),X=e(((e,t)=>{t.exports=Ee()}))(),De=/^(who calls|callers of|what does|where is|functions in|open questions in)\s+(\S{2,})$/i;function Oe({project:e,modelName:t,disabled:n,loading:r,suggestions:i,recent:a,onAsk:o,busy:s,handle:c,palette:l,onOpenFunction:u}){let[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(!1),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(!1),b=e=>g(()=>{let t=typeof e==`function`?e(x.current):e;return t>=0?S.current[t]?.key??null:null}),x=(0,y.useRef)(-1),S=(0,y.useRef)([]);(0,y.useEffect)(()=>{f(``),m(!1),g(null),v(!1)},[e]);let C=(0,y.useRef)(u);C.current=u;let w=(0,y.useRef)(null),[T,E]=(0,y.useState)([]),[D,O]=(0,y.useState)(new Map);(0,y.useEffect)(()=>{let t=De.exec(d.trim());if(!t||!e)return E([]);let[,n,r]=t,i=/^(functions in|open questions in)$/i.test(n)?`File`:`Function`,a=!1,o=setTimeout(()=>{Y.search(e,i,r,30).then(e=>{if(a)return;let t=/^what does$/i.test(n)?` call`:/^where is$/i.test(n)?` defined`:``,o=r.toLowerCase(),s=/(^|\/)(__tests__|tests?|e2e|specs?)\/|\.(test|spec)\.[a-z]+$/i,c=e=>e.toLowerCase()===o?0:e.toLowerCase().startsWith(o)?1:2,l=[...e.results].filter(e=>!e.name.includes(`<`)).sort((e,t)=>c(e.name)-c(t.name)||Number(s.test(e.path))-Number(s.test(t.path))||(t.callers??0)-(e.callers??0)).slice(0,6),u=l.map(e=>`${n.toLowerCase()} ${i===`File`?e.path:e.name}${t}`);E(u),O(new Map(l.map((e,t)=>[u[t],i===`File`?``:`${e.path.split(`/`).pop()}${e.callers===void 0?``:` · ${e.callers} caller${e.callers===1?``:`s`}`}`])))},()=>!a&&E([]))},120);return()=>{a=!0,clearTimeout(o)}},[d,e]);let[k,A]=(0,y.useState)([]);(0,y.useEffect)(()=>{let t=d.trim();if(!p||!e||!C.current||t.length<2||De.test(t)||/\s/.test(t))return A([]);let n=!1,r=setTimeout(()=>{Y.search(e,`Function`,t,6).then(e=>!n&&A(e.results.filter(e=>!e.name.includes(`<`))),()=>!n&&A([]))},120);return()=>{n=!0,clearTimeout(r)}},[d,e,p]);let j=(0,y.useMemo)(()=>{let e=[...T,...a,...i.filter(e=>!a.includes(e))],t=d.trim().toLowerCase(),n=new Set;return(t?e.filter(e=>T.includes(e)||e.toLowerCase().includes(t)&&e.toLowerCase()!==t):e).filter(e=>!n.has(e)&&n.add(e)).slice(0,l?6:8)},[T,a,i,d,l]),M=(0,y.useMemo)(()=>{let e=j.map(e=>({key:`ask:${e}`,group:`Ask`,label:e,...D.get(e)?{detail:D.get(e)}:a.includes(e)?{detail:`recent`}:{},run:()=>z(e)})),t=k.map(e=>({key:`fn:${e.id}`,group:`Functions`,label:e.name,detail:e.path,run:()=>C.current?.(e.id,e.id.slice(0,e.id.indexOf(`:`,e.id.indexOf(`:`)+1)))}));return[...e,...t,...l&&p?l(d):[]]},[j,k,l,d,D,a,p]);S.current=M;let N=d.trim(),P=h===null&&!_&&!/\s/.test(N)&&/[A-Z_.$0-9]/.test(N.slice(1))&&N.length>=2?M.findIndex(e=>e.group!==`Ask`):-1,F=h===null?P:M.findIndex(e=>e.key===h);x.current=h===null?-1:F;let I=p&&M.length>0;(0,y.useImperativeHandle)(c,()=>({prefill:e=>{f(e),m(!1),b(-1),requestAnimationFrame(()=>{let t=w.current;if(!t)return;t.focus();let n=e.indexOf(`<`),r=e.indexOf(`>`,n);n>=0&&r>n&&t.setSelectionRange(n,r+1)})}})),(0,y.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),w.current?.focus(),w.current?.select(),m(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let L=(0,y.useRef)(void 0),R=()=>{m(!1),b(-1)},z=e=>{let t=e.trim();!t||n||t.includes(`<`)||(o(t),f(t),R(),w.current?.blur())};return(0,X.jsxs)(`form`,{className:`ask`,role:`search`,onSubmit:e=>{e.preventDefault();let t=F>=0?M[F]:void 0;t?(t.run(),t.group!==`Ask`&&(f(``),R(),w.current?.blur())):z(d)},children:[(0,X.jsx)(`input`,{ref:w,"data-testid":`ask`,"aria-label":`Ask about this code`,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":I,"aria-controls":I?`ask-options`:void 0,"aria-activedescendant":I&&F>=0?`ask-option-${F}`:void 0,placeholder:r?`Loading…`:n?`Open a project to ask about its code`:l?`Ask, or go to a function, file, group or command… ⌘K`:`Ask about this code… ⌘K`,disabled:n,value:d,onChange:e=>{clearTimeout(L.current),v(!1),f(e.target.value),m(!0),b(-1)},onFocus:()=>{clearTimeout(L.current),m(!0)},onBlur:()=>{L.current=setTimeout(R,120)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),m(!0),b(e=>Math.min(M.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),(h===null||x.current<=0)&&v(!0),b(e=>Math.max(-1,e-1))):e.key===`Escape`?(R(),w.current?.blur()):e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),z(d))}}),s&&(0,X.jsx)(`span`,{className:`spinner`,"aria-label":`Answering`}),I&&(0,X.jsxs)(`ul`,{className:`ask-options`,id:`ask-options`,role:`listbox`,"data-testid":`ask-options`,children:[M.map((e,t)=>(0,X.jsxs)(y.Fragment,{children:[(t===0||M[t-1].group!==e.group)&&(0,X.jsx)(`li`,{className:`ask-group`,role:`presentation`,"aria-hidden":`true`,children:e.group}),(0,X.jsxs)(`li`,{id:`ask-option-${t}`,role:`option`,"aria-selected":t===F,className:t===F?`active`:``,"data-group":e.group,"data-key":e.key,"data-testid":`palette-item`,"aria-label":e.group===`Ask`?e.label:`${e.group}: ${e.label}`,onMouseDown:t=>{t.preventDefault(),e.run(),e.group!==`Ask`&&(f(``),R(),w.current?.blur())},children:[(0,X.jsx)(`span`,{children:e.label}),e.detail&&(0,X.jsx)(`small`,{className:`muted`,children:e.detail})]})]},e.key)),(0,X.jsx)(`li`,{className:`ask-hint`,role:`presentation`,children:t?`Or ask anything in plain words: it goes to ${t.split(`/`).pop()} (your question and the names and paths it looks up are sent to the provider).`:`These are answered offline. To ask anything else, add a model in Settings.`})]})]})}function ke(e,t){let n=[],r=e;for(;;){let e=null;for(let n of t){let t=r.indexOf(n.text);t<0||(!e||t<e.at||t===e.at&&n.text.length>e.c.text.length)&&(e={at:t,c:n})}if(!e)break;n.push(r.slice(0,e.at),e.c),r=r.slice(e.at+e.c.text.length)}return n.push(r),n}var Ae=`<(?:callback|module|iife|anonymous|object)(?::[^<>\\s]*)?>(?:#\\d+)?`,je=RegExp(`(?<![\\w$])(?:[A-Za-z_$][\\w$]*(?:\\.(?:[\\w$]+|${Ae}))*\\.${Ae}(?:\\.(?:[\\w$]+|${Ae}))*|${Ae})`,`g`);function Me({answer:e,onCite:t}){let n=e.citations??[],r=new Map,i=new Map;for(let t of[...e.results,...e.lookups??[]])t.kind===`function`&&t.line!==void 0&&r.set(t.label,t.line),(t.kind===`function`||t.kind===`call`)&&t.title&&i.set(t.label,t.title);let a=e=>e.replace(je,e=>se(e,r.get(e),i.get(e))),o=(e,r)=>ke(e,n).map((e,n)=>typeof e==`string`?a(e):e.verified?(0,X.jsx)(`button`,{className:`cite`,title:e.target?`Returned by a tool. Open it`:`Returned by a tool`,onClick:()=>t(e),children:e.text},`${r}.${n}`):(0,X.jsxs)(`span`,{className:`cite unverified`,title:`Not returned by any tool: check it`,"aria-label":`${e.text}, not returned by any tool`,children:[e.text,` ⚠`]},`${r}.${n}`)),s=(e,t)=>e.split(/(`[^`]+`|\*\*[^*]+\*\*)/).map((e,n)=>e.startsWith("`")&&e.endsWith("`")&&e.length>1?(0,X.jsx)(`code`,{children:o(e.slice(1,-1),`${t}.${n}`)},`${t}.${n}`):e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>3?(0,X.jsx)(`strong`,{children:o(e.slice(2,-2),`${t}.${n}`)},`${t}.${n}`):(0,X.jsx)(`span`,{children:o(e,`${t}.${n}`)},`${t}.${n}`)),c=[];for(let t of(e.prose??``).split(`
10
10
  `)){let e=/^\s*(?:[-*•]|\d+[.)])\s+(.*)$/.exec(t),n=c[c.length-1];e?n?.list?n.lines.push(e[1]):c.push({list:!0,lines:[e[1]]}):t.trim()?n&&!n.list&&n.lines.length?n.lines.push(t):c.push({list:!1,lines:[t]}):c.push({list:!1,lines:[]})}return(0,X.jsx)(`div`,{className:`prose`,"data-testid":`answer-prose`,children:c.filter(e=>e.lines.length).map((e,t)=>e.list?(0,X.jsx)(`ul`,{children:e.lines.map((e,n)=>(0,X.jsx)(`li`,{children:s(e,`${t}.${n}`)},n))},t):(0,X.jsx)(`p`,{children:s(e.lines.join(` `),String(t))},t))})}var Ne=20;function Pe({r:e,active:t,onOpen:n}){let r=e.kind===`function`||e.kind===`call`?oe(e.label,e.kind===`call`?e.fnLine:e.line,e.title).name:e.label.replace(/^\? /,``);return e.kind===`group`||!e.file?(0,X.jsxs)(`div`,{className:`result static`,children:[(0,X.jsx)(`span`,{className:`label`,children:r}),e.detail&&(0,X.jsx)(`small`,{children:e.detail})]}):(0,X.jsxs)(`button`,{className:`result${t?` active`:``}`,"data-kind":e.kind,"aria-current":t||void 0,onClick:()=>n(e),children:[(0,X.jsxs)(`span`,{className:`label`,children:[(0,X.jsx)(`span`,{className:`kind ${e.kind}`,"aria-hidden":`true`,children:Le[e.kind]}),` `,r]}),e.detail&&(0,X.jsx)(`small`,{children:e.detail})]})}function Fe(e){let t=e.model??`the model`,n=e.toolCalls.length,r=e.citations??[],i=r.filter(e=>e.verified).length,a=[t,n===0?`no lookups`:`${n} lookup${n===1?``:`s`}`];return r.length&&a.push(`${i} of ${r.length} citation${r.length===1?``:`s`} checked ✓`),a.push(n===0?`only your question was sent`:`your question and the names, paths and lines it looked up were sent to the provider`),a.join(` · `)}function Ie({answer:e,busy:t,pending:n,elapsed:r,modelConfigured:i,selectedId:a,wide:o,onWide:s,onOpen:c,onAsk:l,onCancel:u,onTemplate:d,onSettings:f,onShowQuestions:p}){let[m,h]=(0,y.useState)(!1),g=(0,y.useRef)(null),_=(0,y.useRef)(null);(0,y.useEffect)(()=>{h(!1),_.current?.focus({preventScroll:!0}),g.current?.closest(`aside`)?.scrollTo({top:0})},[e]);let v=t&&(0,X.jsxs)(`p`,{className:`pending`,"data-testid":`answer-pending`,children:[`Answering “`,n,`”…`,r>=2?` ${r} s`:``,` `,(0,X.jsx)(`button`,{className:`link`,onClick:u,"data-testid":`ask-cancel`,children:`Cancel`})]});if(t&&!e)return(0,X.jsx)(`div`,{className:`answer`,children:v});if(!e)return(0,X.jsxs)(`div`,{className:`hint`,children:[(0,X.jsx)(`p`,{children:`Ask a question in the bar above (⌘K), for example “who calls <function>” or “largest files”.`}),!i&&(0,X.jsxs)(`p`,{children:[`Built-in questions work offline. To ask anything,`,` `,(0,X.jsx)(`button`,{className:`link`,onClick:f,children:`add a model in Settings`}),`.`]})]});let b=m?e.results:e.results.slice(0,Ne),x=e.lookups??[],S=e=>{e.target&&c(e.target)},C=(e.suggestions??[]).filter(e=>e.includes(`<`)),w=(e.suggestions??[]).filter(e=>!e.includes(`<`)),T=e.error!==void 0,E=T&&/auth|not-found|rate-limit/.test(e.error.code);return(0,X.jsxs)(`div`,{className:`answer${t?` busy`:``}`,"data-testid":`answer`,"aria-busy":t,ref:g,children:[v,(0,X.jsxs)(`div`,{className:`answer-head`,children:[(0,X.jsx)(`h3`,{className:`question`,tabIndex:-1,ref:_,children:e.question}),(0,X.jsx)(`button`,{className:`icon`,onClick:()=>s(!o),title:o?`Narrower panel`:`Wider panel`,"aria-label":o?`Narrower panel`:`Wider panel`,"data-testid":`answer-wide`,children:o?`⇥`:`⇤`})]}),e.via===`model`&&!T&&(0,X.jsx)(`p`,{className:`via muted small`,"data-testid":`answer-via`,children:Fe(e)}),T?(0,X.jsxs)(`div`,{className:`note`,"data-testid":`answer-summary`,role:`alert`,children:[(0,X.jsx)(`p`,{children:e.error.message}),(0,X.jsx)(`button`,{className:`link`,onClick:()=>l(e.question,e.mode===`model`||e.via===`model`?`model`:void 0),children:`Retry`}),E&&(0,X.jsxs)(X.Fragment,{children:[` · `,(0,X.jsx)(`button`,{className:`link`,onClick:f,children:`Open Settings`})]})]}):e.via===`model`&&e.prose?(0,X.jsxs)(X.Fragment,{children:[e.ungrounded&&(0,X.jsx)(`p`,{className:`note`,"data-testid":`answer-ungrounded`,children:`Not from your code: the model answered without looking anything up in the graph. Ask about a function or file by name for an answer backed by the graph.`}),(0,X.jsx)(Me,{answer:e,onCite:S})]}):(0,X.jsx)(`p`,{className:`summary`,"data-testid":`answer-summary`,children:e.summary}),e.via===`grammar`&&(0,X.jsxs)(`p`,{className:`via muted small`,"data-testid":`answer-via`,children:[`Answered from the analysis; no model was used.`,i&&(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>l(e.question,`model`),"data-testid":`ask-model`,children:`Ask the model instead`})]})]}),e.via===`help`&&!i&&(0,X.jsxs)(`p`,{className:`via muted small`,"data-testid":`answer-via`,children:[`No model is configured; nothing was sent anywhere.`,` `,(0,X.jsx)(`button`,{className:`link`,onClick:f,children:`Set up a model`})]}),e.intent===`open-questions-in-file`&&e.results[0]?.file&&(0,X.jsx)(`p`,{className:`small`,children:(0,X.jsx)(`button`,{className:`link`,onClick:()=>p(e.results[0].file),children:`Show them grouped in the Open questions tab`})}),e.note&&(0,X.jsx)(`p`,{className:`note`,children:e.note}),e.truncated&&(0,X.jsxs)(`p`,{className:`note`,children:[`Stopped early: `,e.truncated.reason,`.`]}),b.length>0&&(0,X.jsxs)(X.Fragment,{children:[e.via===`model`&&(0,X.jsx)(`h4`,{className:`results-title`,children:`In this answer`}),(0,X.jsx)(`ul`,{className:`results`,"data-testid":`answer-results`,children:b.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(Pe,{r:e,active:e.id===a,onOpen:c})},`${e.kind}:${e.id}`))})]}),e.results.length>Ne&&!m&&(0,X.jsxs)(`button`,{className:`more`,onClick:()=>h(!0),"data-testid":`answer-more`,children:[`Show all `,e.results.length]}),x.length>0&&(0,X.jsxs)(`details`,{className:`lookups`,open:b.length===0,"data-testid":`answer-lookups`,children:[(0,X.jsxs)(`summary`,{children:[`What the model looked at (`,e.toolCalls.length,` lookup`,e.toolCalls.length===1?``:`s`,`, `,x.length,` item`,x.length===1?``:`s`,`)`]}),(0,X.jsx)(`ul`,{className:`results`,children:x.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(Pe,{r:e,active:e.id===a,onOpen:c})},`${e.kind}:${e.id}`))})]}),(w.length>0||C.length>0)&&(0,X.jsxs)(`div`,{className:`chips`,"aria-label":`Suggested questions`,children:[w.map(e=>(0,X.jsx)(`button`,{className:`chip`,onClick:()=>l(e),children:e},e)),C.map(e=>(0,X.jsx)(`button`,{className:`chip template`,onClick:()=>d(e),title:`Fill in the name`,children:e},e))]})]})}var Le={function:`ƒ`,call:`→`,file:`▤`,site:`?`,group:`#`};function Re({project:e,id:t,start:n=!1}){let[r,i]=(0,y.useState)(null),a=()=>{i({id:t,items:null}),Y.explain(e,t).then(e=>i(n=>n?.id===t?{id:t,items:e.items}:n),e=>i(n=>n?.id===t?{id:t,items:[{id:`error`,summary:`Couldn't explain this: ${e.message}`,steps:[]}]}:n))};(0,y.useEffect)(()=>{n&&a()},[n,t]);let o=r?.id===t?r:null;return(0,X.jsx)(`div`,{className:`explain`,"data-testid":`explain`,children:o===null?(0,X.jsx)(`button`,{className:`button-link`,"data-command":`explain`,onClick:a,children:`Explain`}):o.items===null?(0,X.jsx)(`p`,{className:`muted small`,children:`Explaining…`}):o.items.map(e=>(0,X.jsxs)(`div`,{"data-testid":`explanation`,children:[(0,X.jsx)(`p`,{children:e.summary}),(0,X.jsx)(`ol`,{className:`steps`,children:e.steps.map((e,t)=>(0,X.jsx)(`li`,{children:e.detail},t))}),e.toResolve&&(0,X.jsxs)(`p`,{className:`small`,"data-testid":`explain-to-resolve`,children:[`To resolve it: `,e.toResolve]}),e.names&&e.names.length>0&&(0,X.jsx)(`ul`,{className:`explain-names`,"data-testid":`explain-names`,children:e.names.map(e=>(0,X.jsx)(`li`,{children:e.summary},e.local))})]},e.id))})}var ze=[[`multi-repo`,`Several repositories per project`],[`history`,`History older than 30 days`],[`agents`,`Agent tools`],[`topology`,`Deployment topology`],[`runtime`,`Runtime confirmation`],[`sharing`,`Sharing`],[`sso`,`Single sign-on`],[`audit`,`Audit log`],[`retention`,`Retention settings`]],Be={javascript:`JavaScript`,typescript:`TypeScript`,python:`Python`,go:`Go`,rust:`Rust`,java:`Java`,kotlin:`Kotlin`},Ve=new Set([`javascript`,`typescript`]);function He({license:e}){return e.source===`beta`?(0,X.jsxs)(`p`,{"data-testid":`license-source`,"data-source":`beta`,children:[(0,X.jsx)(`strong`,{children:`Beta license.`}),` Every language and feature is enabled until the paid launch: nothing is restricted.`]}):e.source===`free`?(0,X.jsxs)(`p`,{"data-testid":`license-source`,"data-source":`free`,children:[(0,X.jsx)(`strong`,{children:`Free.`}),` JavaScript and TypeScript, one repository per project, and the last 30 days of history.`]}):(0,X.jsxs)(`p`,{"data-testid":`license-source`,"data-source":`license`,children:[(0,X.jsxs)(`strong`,{children:[`License `,e.license,e.tier?` (${e.tier})`:``]}),` `,`for `,e.holder,e.validUntil?`, valid until ${e.validUntil}`:``,e.seats?`, ${e.seats} seat${e.seats===1?``:`s`}`:``,`.`]})}function Ue({onChanged:e}){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(null);(0,y.useEffect)(()=>{let e=!1;return Y.license().then(t=>!e&&n(t),t=>!e&&c({ok:!1,text:t.message})),()=>{e=!0}},[]);let l=async(t,r)=>{o(!0),c(null);try{return n(await t()),c({ok:!0,text:r}),e(),!0}catch(e){return c({ok:!1,text:e.message??String(e)}),!1}finally{o(!1)}};if(!t)return s?(0,X.jsx)(`p`,{className:`error`,children:s.text}):(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});let u=t.license;return(0,X.jsxs)(`div`,{className:`license-tab`,"data-testid":`license-tab`,children:[(0,X.jsx)(He,{...t}),u.problem&&(0,X.jsxs)(`p`,{className:`error`,role:`alert`,"data-testid":`license-problem`,"data-status":u.problem.status,children:[`The installed license isn't used: `,u.problem.message,`.`]}),u.source===`beta`&&(0,X.jsx)(`p`,{className:`muted small`,"data-testid":`license-beta-note`,children:`A license key replaces the beta license: only what the license includes stays enabled.`}),(0,X.jsx)(`h4`,{className:`muted small`,children:`Languages the license covers`}),(0,X.jsx)(`p`,{"data-testid":`license-languages`,children:Object.keys(Be).filter(e=>u.languages.includes(e)).map(e=>Be[e]).join(`, `)}),u.languages.some(e=>e in Be&&!Ve.has(e))&&(0,X.jsx)(`p`,{className:`muted small`,"data-testid":`license-languages-note`,children:`veoflow analyzes JavaScript and TypeScript today; the other languages are covered once veoflow reads them.`}),(0,X.jsx)(`h4`,{className:`muted small`,children:`Features`}),(0,X.jsx)(`ul`,{className:`license-features`,"data-testid":`license-features`,children:ze.map(([e,t])=>{let n=u.features.includes(e);return(0,X.jsxs)(`li`,{"data-feature":e,"data-included":n,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:n?`✓`:`–`}),` `,t,!n&&(0,X.jsx)(`span`,{className:`muted small`,children:` · not included`})]},e)})}),(0,X.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),l(()=>Y.installLicense(r),`License installed.`).then(e=>e&&i(``))},children:[(0,X.jsxs)(`label`,{children:[u.installed?`Replace the license key`:`Add a license key`,(0,X.jsx)(`textarea`,{"data-testid":`license-key`,value:r,spellCheck:!1,autoComplete:`off`,placeholder:`Paste the key from your license email`,onChange:e=>i(e.target.value)})]}),(0,X.jsxs)(`div`,{className:`actions`,children:[u.installed&&(0,X.jsx)(`button`,{type:`button`,"data-testid":`license-refresh`,disabled:a,onClick:()=>void l(()=>Y.refreshLicense(),`Checked the installed license again (offline: veoflow never phones home).`),children:`Check again`}),(0,X.jsx)(`button`,{type:`submit`,className:`primary`,"data-testid":`license-install`,disabled:a||!r.trim(),children:u.installed?`Replace`:`Add`})]})]}),s&&(0,X.jsx)(`p`,{className:s.ok?`muted small`:`error`,role:s.ok?`status`:`alert`,"data-testid":`license-note`,children:s.text})]})}function We({project:e,run:t,refresh:n,onManage:r}){let[i,a]=(0,y.useState)([]);return(0,y.useEffect)(()=>{let t=!1;return Y.license(e).then(e=>!t&&a(e.findings??[]),()=>!t&&a([])),()=>{t=!0}},[e,t,n]),i.length===0?null:(0,X.jsxs)(`div`,{className:`license-notices`,role:`note`,"data-testid":`license-notices`,children:[(0,X.jsx)(`ul`,{children:i.map(e=>(0,X.jsx)(`li`,{"data-kind":e.kind,children:e.message},e.id))}),(0,X.jsx)(`span`,{className:`muted small`,children:`As of the last analysis. `}),(0,X.jsx)(`button`,{className:`link small`,"data-command":`manage-license`,onClick:r,children:`License…`})]})}var Ge={selector:`.only-out`,style:{display:`none`}};function Ke(e,t){let n=e.elements(`.only-out`).nonempty();e.batch(()=>{if(e.elements().removeClass(`only-out`),!t)return;let n=e.getElementById(t);if(n.empty()||!n.isNode())return;let r=n.closedNeighborhood();e.elements().not(r).not(`[kind = "box"]`).addClass(`only-out`)}),(t&&!e.getElementById(t).empty()||!t&&n)&&e.fit(e.elements().not(`.only-out`).not(`.hidden`),40)}var qe=()=>typeof window<`u`&&window.matchMedia?window.matchMedia(`(prefers-color-scheme: dark)`):null;function Z(e){return typeof document>`u`?``:getComputedStyle(document.documentElement).getPropertyValue(`--${e}`).trim()}function Je(){return(0,y.useSyncExternalStore)(e=>{let t=qe();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},()=>qe()?.matches?`dark`:`light`,()=>`light`)}function Ye(e){if(!e)return null;let t=new Map,n=new Map,r=new Map,i=new Map;for(let a of e.items)(a.type===`IMPORTS`||a.type===`UnresolvedImport`)&&a.file&&i.set(a.file,`changed`),t.set(a.id,a.change),a.type===`File`&&n.set(a.id,a.change),a.type===`Group`&&r.set(a.id,a.change);for(let t of e.items)t.file&&t.type!==`File`&&!n.has(t.file)&&n.set(t.file,`changed`);for(let t of e.files)t.group&&!r.has(t.group.id)&&t.added+t.removed+t.changed>0&&r.set(t.group.id,`changed`);return{byId:t,byFile:n,byGroup:r,removed:e.items.filter(e=>e.change===`removed`),importsByFile:i,fileFacts:new Map(e.items.filter(e=>e.type===`File`).map(e=>[e.id,e.change]))}}var Xe=e=>e?`diff-${e}`:``,Ze=()=>[{selector:`node.diff-added`,style:{"border-width":3,"border-color":Z(`blue-52`),"border-style":`solid`}},{selector:`node.diff-removed`,style:{"border-width":2,"border-color":Z(`orange-66`),"border-style":`dashed`,opacity:.75}},{selector:`node.diff-changed`,style:{"border-width":4,"border-color":Z(`purple-51`),"border-style":`double`}},{selector:`edge.diff-added`,style:{"line-color":Z(`blue-52`),"target-arrow-color":Z(`blue-52`),width:3}},{selector:`edge.diff-removed`,style:{"line-color":Z(`orange-66`),"target-arrow-color":Z(`orange-66`),"line-style":`dashed`,width:2}},{selector:`edge.diff-changed`,style:{"line-color":Z(`purple-51`),"target-arrow-color":Z(`purple-51`),"line-style":`dotted`,width:3}}];function Qe(e,t){let n=t?[...t.byFile.keys()].map(e=>e.slice(e.indexOf(`:`)+1)):[];e.batch(()=>{e.elements().removeClass(`diff-added diff-removed diff-changed`),t&&e.elements().forEach(e=>{let r=e.id(),i=e.data(),a=t.byGroup.get(r)??t.byFile.get(r)??t.byId.get(r)??(i.edge?t.byId.get(i.edge):void 0)??(/^(caller|callee)\|/.test(r)?t.byId.get(r.slice(r.indexOf(`|`)+1)):void 0)??(i.file&&!/^(caller|callee)\|/.test(r)?t.fileFacts.get(i.file):void 0)??(i.calls??[]).map(e=>t.byId.get(e)).find(Boolean)??(i.kind===`imports`&&i.source?t.importsByFile.get(i.source):void 0)??(i.kind===`folder`&&i.path!==void 0&&n.some(e=>e.startsWith(`${i.path}/`))?`changed`:void 0);a&&e.addClass(`diff-${a}`)})})}function $e(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 et(e){if(Array.isArray(e))return e}function tt(e){if(Array.isArray(e))return $e(e)}function nt(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function rt(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,mt(r.key),r)}}function it(e,t,n){return t&&rt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function at(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=gt(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.
11
11
  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 ot(e,t,n){return(t=mt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function st(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function ct(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 lt(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
12
12
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ut(){throw TypeError(`Invalid attempt to spread non-iterable instance.
@@ -330,12 +330,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
330
330
  `);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),Eg(n,`vec2`,r.aPosition,e),this.transformBuffer=Og(n,t,r.aTransform),this.indexBuffer=Dg(n,t,`vec4`,r.aIndex),this.vertTypeBuffer=Dg(n,t,`int`,r.aVertType),this.atlasIdBuffer=Dg(n,t,`int`,r.aAtlasId),this.texBuffer=Dg(n,t,`vec4`,r.aTex),this.pointAPointBBuffer=Dg(n,t,`vec4`,r.aPointAPointB),this.pointCPointDBuffer=Dg(n,t,`vec4`,r.aPointCPointD),this.lineWidthBuffer=Dg(n,t,`vec2`,r.aLineWidth),this.colorBuffer=Dg(n,t,`vec4`,r.aColor),this.cornerRadiusBuffer=Dg(n,t,`vec4`,r.aCornerRadius),this.borderColorBuffer=Dg(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 qt(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]:qg.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===Jg.IGNORE)return;if(o==Jg.USE_BB){this.drawPickingRectangle(e,t,n);return}}var s=at(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=dt(h[m],2),_=g[0],v=g[1];if(_.w!=0){var y=this.instanceCount;this.vertTypeBuffer.getView(y)[0]=Yg,bg(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;Mg(e);var o=n.getRotation?n.getRotation(r):0;if(o!==0){var s=n.getRotationPoint(r),c=s.x,l=s.y;Pg(e,e,[c,l]),Fg(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;Pg(e,e,[i,a]),Ig(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]=$g,bg(t,this.indexBuffer.getView(i)),yg([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===e_||a===t_){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===t_&&(l[0]=0,l[2]=0)}bg(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;yg(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;yg(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 $g;case`ellipse`:return n_;case`roundrectangle`:case`round-rectangle`:return e_;case`bottom-round-rectangle`:return t_;default:return}}},{key:`_getCornerRadius`,value:function(e,t,n){var r=n.w,i=n.h;if(e.pstyle(t).value===`auto`)return Oa(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);Mg(p),Pg(p,p,[i,a]),Ig(p,p,[d,d]),Fg(p,p,o),this.vertTypeBuffer.getView(f)[0]=Qg,bg(t,this.indexBuffer.getView(f)),yg(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]=Xg,bg(t,this.indexBuffer.getView(c)),yg(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]=Zg,bg(t,this.indexBuffer.getView(f)),yg(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=at(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,hg(this.r)),e.uniformMatrix3fv(i.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(i.uAtlasSize,this.batchManager.getAtlasSize());var u=yg(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}}}])}(),i_={};i_.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=a_(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=kg(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new r_(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`?Jg.USE_BB:Jg.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:_g,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:s_(t.getLabelKey,null),getBoundingBox:c_(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:s_(t.getSourceLabelKey,`source`),getBoundingBox:c_(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:s_(t.getTargetLabelKey,`target`),getBoundingBox:c_(t.getTargetLabelBox,`target`),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i(`target`),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a(`target-label`)});var l=rr(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()}),l_(n)};function a_(e){var t=e.cy.container();return ln(t&&t.style&&t.style.backgroundColor||`white`)}function o_(e,t){var n=e._private.rscratch;return Kr(n,`labelWrapCachedLines`,t)||[]}var s_=function(e,t){return function(n){var r=e(n),i=o_(n,t);return i.length>1?i.map(function(e,t){return`${r}_${t}`}):r}},c_=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=o_(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 l_(e){var t=e.render;e.render=function(n){n||={};var r=e.cy;e.webgl&&(r.zoom()>rh?(u_(e),t.call(e,n)):(d_(e),b_(e,n,qg.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 v_(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 u_(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function d_(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 f_(e){var t=e.canvasWidth,n=e.canvasHeight,r=mg(e),i=r.pan,a=r.zoom,o=jg();Pg(o,o,[i.x,i.y]),Ig(o,o,[a,a]);var s=jg();Lg(s,t,n);var c=jg();return Ng(c,s,o),c}function p_(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=mg(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 m_(e,t){e.drawSelectionRectangle(t,function(t){return p_(e,t)})}function h_(e){var t=e.data.contexts[e.NODE];t.save(),p_(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 g_(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 __(e,t,n,r,i){var a,o,s,c,l=mg(e),u=l.pan,d=l.zoom,f=dt(gg(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),b_(e,null,qg.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=xg(v.slice(b*4,b*4+4))-1;x>=0&&y.add(x)}return y}function v_(e,t,n){var r=__(e,t,n),i=e.getCachedZSortedEles(),a,o,s=at(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 y_(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 b_(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]&&m_(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=f_(e),c=e.getCachedZSortedEles();if(a=c.length,i.startFrame(s,n),n.screen){for(var l=0;l<c.nondrag.length;l++)y_(e,l,c.nondrag[l]);for(var u=0;u<c.drag.length;u++)y_(e,u,c.drag[u])}else if(n.picking)for(var d=0;d<c.length;d++)y_(e,d,c[d]);i.endFrame(),n.screen&&e.webglDebugShowAtlases&&(h_(e),g_(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var f=performance.now(),p=Math.ceil(f-r),m=i.getDebugInfo(),h=[`${a} elements`,`${m.totalInstances} instances`,`${m.batchCount} batches`,`${m.totalAtlases} atlases`,`${m.wrappedCount} wrapped textures`,`${m.simpleCount} simple shapes`].join(`, `);console.log(`WebGL (${n.name}) - frame time ${p}ms`),console.log(`Totals:`),console.log(` ${h}`),console.log(`Texture Atlases Used:`);var g=m.atlasInfo,_=at(g),v;try{for(_.s();!(v=_.n()).done;){var y=v.value;console.log(` ${y.type}: ${y.keyCount} keys, ${y.atlasCount} atlases`)}}catch(e){_.e(e)}finally{_.f()}console.log(``)}e.data.gc&&(console.log(`Garbage Collect!`),e.data.gc=!1,i.gc())}var x_={};x_.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()},x_.drawRoundPolygonPath=function(e,t,n,r,i,a,o){o.forEach(function(t){return xm(e,t)}),e.closePath()},x_.drawRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?Oa(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()},x_.drawBottomRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?Oa(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()},x_.drawCutRectanglePath=function(e,t,n,r,i,a,o){var s=r/2,c=i/2,l=o===`auto`?Aa():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()},x_.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=Ma(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 S_=Math.sin(0),C_=Math.cos(0),w_={},T_={},E_=Math.PI/40,D_=0*Math.PI;D_<2*Math.PI;D_+=E_)w_[D_]=Math.sin(D_),T_[D_]=Math.cos(D_);x_.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+=E_)a=t-s*w_[l]*S_+s*T_[l]*C_,o=n+c*T_[l]*S_+c*w_[l]*C_,l===0?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var O_={};O_.createBuffer=function(e,t){var n=document.createElement(`canvas`);return n.width=e,n.height=t,[n,n.getContext(`2d`)]},O_.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=Q(e.maxWidth)||Q(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;Q(e.maxWidth)&&(l=c*e.maxWidth/i),Q(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 k_(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 A_(e){var t=e.indexOf(`,`);return e.substr(t+1)}function j_(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case`blob-promise`:return new us(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 k_(A_(r()),n);case`base64`:return A_(r());default:return r()}}O_.png=function(e){return j_(e,this.bufferCanvasImage(e),`image/png`)},O_.jpg=function(e){return j_(e,this.bufferCanvasImage(e),`image/jpeg`)};var M_={};M_.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 N_=F_,P_=F_.prototype;P_.CANVAS_LAYERS=3,P_.SELECT_BOX=0,P_.DRAG=1,P_.NODE=2,P_.WEBGL=3,P_.CANVAS_TYPES=[`2d`,`2d`,`2d`,`webgl2`],P_.BUFFER_COUNT=3,P_.TEXTURE_BUFFER=0,P_.MOTIONBLUR_BUFFER_NODE=1,P_.MOTIONBLUR_BUFFER_DRAG=2;function F_(e){var t=this,n=t.cy.window().document;e.webgl&&(P_.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log(`webgl rendering enabled`)),t.data={canvases:Array(P_.CANVAS_LAYERS),contexts:Array(P_.CANVAS_LAYERS),canvasNeedsRedraw:Array(P_.CANVAS_LAYERS),bufferCanvases:Array(P_.BUFFER_COUNT),bufferContexts:Array(P_.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`};Vt()&&(s[`-ms-touch-action`]=`none`,s[`touch-action`]=`none`);for(var c=0;c<P_.CANVAS_LAYERS;c++){var l=t.data.canvases[c]=n.createElement(`canvas`),u=P_.CANVAS_TYPES[c];t.data.contexts[c]=l.getContext(u),t.data.contexts[c]||Nr(`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(P_.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[P_.NODE].setAttribute(`data-id`,`layer`+P_.NODE+`-node`),t.data.canvases[P_.SELECT_BOX].setAttribute(`data-id`,`layer`+P_.SELECT_BOX+`-selectbox`),t.data.canvases[P_.DRAG].setAttribute(`data-id`,`layer`+P_.DRAG+`-drag`),t.data.canvases[P_.WEBGL]&&t.data.canvases[P_.WEBGL].setAttribute(`data-id`,`layer`+P_.WEBGL+`-webgl`);for(var c=0;c<P_.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=Ui(),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($u(e.pstyle(`text-halign`).value)){case`left`:n.x=-t.w-(t.leftPad||0);break;case`right`:n.x=-(t.rightPad||0)}switch(ed(e.pstyle(`text-valign`).value)){case`top`:n.y=-t.h-(t.topPad||0);break;case`bottom`:n.y=-(t.botPad||0)}}return n},R=t.data.eleTxrCache=new yh(t,{getKey:h,doesEleInvalidateKey:m,drawElement:y,getBoundingBox:C,getRotationPoint:O,getRotationOffset:P,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),z=t.data.lblTxrCache=new yh(t,{getKey:g,drawElement:b,getBoundingBox:w,getRotationPoint:j,getRotationOffset:L,isVisible:D}),B=t.data.slbTxrCache=new yh(t,{getKey:_,drawElement:x,getBoundingBox:T,getRotationPoint:M,getRotationOffset:F,isVisible:D}),V=t.data.tlbTxrCache=new yh(t,{getKey:v,drawElement:S,getBoundingBox:E,getRotationPoint:N,getRotationOffset:I,isVisible:D}),H=t.data.lyrTxrCache=new Ih(t);t.onUpdateEleCalcs(function(e,t){R.invalidateElements(t),z.invalidateElements(t),B.invalidateElements(t),V.invalidateElements(t),H.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var U=function(e){for(var t=0;t<e.length;t++)H.enqueueElementRefinement(e[t].ele)};R.onDequeue(U),z.onDequeue(U),B.onDequeue(U),V.onDequeue(U),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})}P_.redrawHint=function(e,t){var n=this;switch(e){case`eles`:n.data.canvasNeedsRedraw[P_.NODE]=t;break;case`drag`:n.data.canvasNeedsRedraw[P_.DRAG]=t;break;case`select`:n.data.canvasNeedsRedraw[P_.SELECT_BOX]=t;break;case`gc`:n.data.gc=!0}};var I_=typeof Path2D<`u`;P_.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},P_.usePaths=function(){return I_&&this.pathsEnabled},P_.setImgSmoothing=function(e,t){e.imageSmoothingEnabled==null?(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t):e.imageSmoothingEnabled=t},P_.getImgSmoothing=function(e){return e.imageSmoothingEnabled==null?e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled:e.imageSmoothingEnabled},P_.makeOffscreenCanvas=function(e,t){var n;return(typeof OffscreenCanvas>`u`?`undefined`:ht(OffscreenCanvas))===`undefined`?(n=this.cy.window().document.createElement(`canvas`),n.width=e,n.height=t):n=new OffscreenCanvas(e,t),n},[Bh,qh,eg,ng,rg,og,cg,i_,x_,O_,M_].forEach(function(e){rn(P_,e)});var L_=[{type:`layout`,extensions:Kp},{type:`renderer`,extensions:[{name:`null`,impl:qp},{name:`base`,impl:Jm},{name:`canvas`,impl:N_}]}],R_={},z_={};function B_(e,t,n){var r=n,i=function(n){Fr("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if(e===`core`){if(ip.prototype[t])return i(t);ip.prototype[t]=n}else if(e===`collection`){if(vf.prototype[t])return i(t);vf.prototype[t]=n}else if(e===`layout`){for(var a=function(e){this.options=e,n.call(this,e),Dt(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)}};rn(o,{createEmitter:function(){return this._private.emitter=new zd(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}}),uu.eventAliasesOn(o),r=a}else if(e===`renderer`&&t!==`null`&&t!==`base`){var p=V_(`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(){Nr("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=_}else if(e===`__proto__`||e===`constructor`||e===`prototype`)return Nr(e+` is an illegal type to be registered, possibly lead to prototype pollutions`);return dn({map:R_,keys:[e,t],value:r})}function V_(e,t){return fn({map:R_,keys:[e,t]})}function H_(e,t,n,r,i){return dn({map:z_,keys:[e,t,n,r],value:i})}function U_(e,t,n,r){return fn({map:z_,keys:[e,t,n,r]})}var W_=function(){if(arguments.length===2)return V_.apply(null,arguments);if(arguments.length===3)return B_.apply(null,arguments);if(arguments.length===4)return U_.apply(null,arguments);if(arguments.length===5)return H_.apply(null,arguments);Nr(`Invalid extension access syntax`)};ip.prototype.extension=W_,L_.forEach(function(e){e.extensions.forEach(function(t){B_(e.type,t.name,t.impl)})});var G_=function(){if(!(this instanceof G_))return new G_;this.length=0},K_=G_.prototype;K_.instanceString=function(){return`stylesheet`},K_.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},K_.css=function(e,t){var n=this.length-1;if(wt(e))this[n].properties.push({name:e,value:t});else if(Dt(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=Qf.properties[o]||Qf.properties[Wt(o)];if(c!=null){var l=c.name,u=s;this[n].properties.push({name:l,value:u})}}}return this},K_.style=K_.css,K_.generateStyle=function(e){var t=new Qf(e);return this.appendToStyle(t)},K_.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 q_=`3.34.3`,J_=function(e){if(e===void 0&&(e={}),Dt(e))return new ip(e);if(wt(e))return W_.apply(W_,arguments)};J_.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(J_),e.apply(null,t),this},J_.warnings=function(e){return Pr(e)},J_.version=q_,J_.stylesheet=J_.Stylesheet=G_;function Y_(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 X_(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Q_(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.
331
331
  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 Z_(e){"@babel/helpers - typeof";return Z_=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},Z_(e)}function Q_(e,t){if(e){if(typeof e==`string`)return Y_(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)?Y_(e,t):void 0}}var $_={nodeSep:void 0,edgeSep:void 0,rankSep:void 0,rankDir:void 0,align:void 0,acyclicer:void 0,ranker:void 0,minLen:function(e){return 1},edgeWeight:function(e){return 1},fit:!0,padding:30,spacingFactor:void 0,nodeDimensionsIncludeLabels:!1,useDagreEdgeControlPoints:!1,automaticDagreEdgeStyle:!1,dagreEdgeStyle:{"curve-style":`unbundled-bezier`,"control-point-weights":function(e){return e.scratch(`controlPointWeights`)},"control-point-distances":function(e){return e.scratch(`controlPointDistances`)},"edge-distances":`intersection`,"edge-ends-overlap":!1},animate:!1,animateFilter:function(e,t){return!0},animationDuration:500,animationEasing:void 0,boundingBox:void 0,transform:function(e,t){return t},ready:function(){},sort:void 0,stop:function(){}},ev=Object.assign==null?function(e){return[...arguments].slice(1).forEach(function(t){Object.keys(t).forEach(function(n){return e[n]=t[n]})}),e}:Object.assign.bind(Object),tv=Object.defineProperty,nv=(e,t,n)=>t in e?tv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rv=(e,t)=>{for(var n in t)tv(e,n,{get:t[n],enumerable:!0})},iv=(e,t,n)=>nv(e,t+``,n),av={};rv(av,{Graph:()=>cv,alg:()=>bv,json:()=>hv,version:()=>mv});var ov=Object.defineProperty,sv=(e,t)=>{for(var n in t)ov(e,n,{get:t[n],enumerable:!0})},cv=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let t of this.successors(e))n.add(t);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=dv(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=fv(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,lv(this._preds[a],i),lv(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?pv(this._isDirected,e):dv(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r==`object`?r:{label:r}}hasEdge(e,t,n){return(arguments.length===1?pv(this._isDirected,e):dv(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?pv(this._isDirected,e):dv(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],uv(this._preds[t],e),uv(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function lv(e,t){e[t]?e[t]++:e[t]=1}function uv(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function dv(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function fv(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function pv(e,t){return dv(e,t.v,t.w,t.name)}var mv=`4.0.1`,hv={};sv(hv,{read:()=>yv,write:()=>gv});function gv(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:_v(e),edges:vv(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function _v(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function vv(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function yv(e){let t=new cv(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var bv={};sv(bv,{CycleException:()=>Fv,bellmanFord:()=>Sv,components:()=>wv,dijkstra:()=>Dv,dijkstraAll:()=>kv,findCycles:()=>jv,floydWarshall:()=>Nv,isAcyclic:()=>Lv,postorder:()=>Vv,preorder:()=>Hv,prim:()=>Uv,shortestPaths:()=>Wv,tarjan:()=>Av,topsort:()=>Iv});var xv=()=>1;function Sv(e,t,n,r){return Cv(e,String(t),n||xv,r||function(t){return e.outEdges(t)})}function Cv(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=n(e);i[e.v].distance+t<i[e.w].distance&&(i[e.w]={distance:i[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;c({v:n,w:r})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function wv(e){let t={},n=[],r;function i(n){n in t||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var Tv=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},Ev=()=>1;function Dv(e,t,n,r){return Ov(e,String(t),n||Ev,r||function(t){return e.outEdges(t)})}function Ov(e,t,n,r){let i={},a=new Tv,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t],c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0&&(o=a.removeMin(),s=i[o],s.distance!==1/0);)r(o).forEach(c);return i}function kv(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=Dv(e,i,t,n),r},{})}function Av(e){let t=0,n=[],r={},i=[];function a(o){let s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){e in r?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){let e=[],t;do t=n.pop(),r[t].onStack=!1,e.push(t);while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function jv(e){return Av(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Mv=()=>1;function Nv(e,t,n){return Pv(e,t||Mv,n||function(t){return e.outEdges(t)})}function Pv(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){let t=r[e];i.forEach(function(n){let a=r[n];i.forEach(function(n){let r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}var Fv=class extends Error{constructor(...e){super(...e)}};function Iv(e){let t={},n={},r=[];function i(a){if(a in n)throw new Fv;a in t||(n[a]=!0,t[a]=!0,e.predecessors(a).forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new Fv;return r}function Lv(e){try{Iv(e)}catch(e){if(e instanceof Fv)return!1;throw e}return!0}function Rv(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=zv(e,t,n===`post`,o,a,r,i)}),i}function zv(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=zv(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function Bv(e,t,n){return Rv(e,t,n,function(e,t){return e.push(t),e},[])}function Vv(e,t){return Bv(e,t,`post`)}function Hv(e,t){return Bv(e,t,`pre`)}function Uv(e,t){let n=new cv,r={},i=new Tv,a;function o(e){let n=e.v===a?e.w:e.v,o=i.priority(n);if(o!==void 0){let s=t(e);s<o&&(r[n]=a,i.decrease(n,s))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(e){i.add(e,1/0),n.setNode(e)}),i.decrease(e.nodes()[0],0);let s=!1;for(;i.size()>0;){if(a=i.removeMin(),a in r)n.setEdge(a,r[a]);else{if(s)throw Error(`Input graph is not connected: `+e);s=!0}e.nodeEdges(a).forEach(o)}return n}function Wv(e,t,n,r){return Gv(e,t,n,r??(t=>e.outEdges(t)??[]))}function Gv(e,t,n,r){if(n===void 0)return Dv(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=r(a[o]);for(let e=0;e<s.length;e++){let t=s[e],r=t.v===a[o]?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return Sv(e,t,n,r)}return Dv(e,t,n,r)}function Kv(e,t,n,r){let i=r;for(;e.hasNode(i);)i=cy(r);return n.dummy=t,e.setNode(i,n),i}function qv(e){let t=new cv().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function Jv(e){let t=new cv({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function Yv(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function Xv(e){let t=ly(ry(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function Zv(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=ny(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function Qv(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=ny(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function $v(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),Kv(e,`border`,i,t)}function ey(e,t=ty){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var ty=65535;function ny(e,t){return t.length>ty?e(...ey(t).map(t=>e(...t))):e(...t)}function ry(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return ny(Math.max,t)}function iy(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function ay(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function oy(e,t){return t()}var sy=0;function cy(e){return e+(``+ ++sy)}function ly(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function uy(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function dy(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function fy(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var py=`\0`,my=`3.0.0`,hy=class{constructor(){iv(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return gy(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&gy(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,_y)),n=n._prev;return`[`+e.join(`, `)+`]`}};function gy(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function _y(e,t){if(e!==`_next`&&e!==`_prev`)return t}var vy=hy,yy=()=>1;function by(e,t){if(e.nodeCount()<=1)return[];let n=Cy(e,t||yy);return xy(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function xy(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)Sy(e,t,n,o);for(;o=i.dequeue();)Sy(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(Sy(e,t,n,o,!0)||[]);break}}}return r}function Sy(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,wy(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,wy(t,n,o)}),e.removeNode(r.v),o}function Cy(e,t){let n=new cv,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=Ty(i+r+3).map(()=>new vy),o=r+1;return n.nodes().forEach(e=>{wy(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function wy(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function Ty(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function Ey(e){(e.graph().acyclicer===`greedy`?by(e,t(e)):Dy(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,cy(`rev`))});function t(e){return t=>e.edge(t).weight}}function Dy(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function Oy(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function ky(e){e.graph().dummyChains=[],e.edges().forEach(t=>Ay(e,t))}function Ay(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d=0;for(++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=Kv(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function jy(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function My(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=ny(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function Ny(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Py=Fy;function Fy(e){let t=new cv({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;Iy(t,e)<i&&(a=Ly(t,e),a);)o=t.hasNode(a.v)?Ny(e,a):-Ny(e,a),Ry(t,e,o);return t}function Iy(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Ny(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function Ly(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=Ny(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function Ry(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:zy,postorder:By}=bv,Vy=Hy;Hy.initLowLimValues=Ky,Hy.initCutValues=Uy,Hy.calcCutValue=Gy,Hy.leaveEdge=Jy,Hy.enterEdge=Yy,Hy.exchangeEdges=Xy;function Hy(e){e=qv(e),My(e);let t=Py(e);Ky(t),Uy(t,e);let n,r;for(;n=Jy(t);)r=Yy(t,e,n),Xy(t,e,n,r)}function Uy(e,t){let n=By(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>Wy(e,t,n))}function Wy(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=Gy(e,t,n)}function Gy(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,Qy(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function Ky(e,t){arguments.length<2&&(t=e.nodes()[0]),qy(e,{},1,t)}function qy(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=qy(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function Jy(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Yy(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===$y(e,e.node(t.v),s)&&c!==$y(e,e.node(t.w),s)).reduce((e,n)=>Ny(t,n)<Ny(t,e)?n:e)}function Xy(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Ky(e),Uy(e,t),Zy(e,t)}function Zy(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=zy(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function Qy(e,t,n){return e.hasEdge(t,n)}function $y(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var eb=tb;function tb(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:ib(e);break;case`tight-tree`:rb(e);break;case`longest-path`:nb(e);break;case`none`:break;default:ib(e)}}var nb=My;function rb(e){My(e),Py(e)}function ib(e){Vy(e)}var ab=ob;function ob(e){let t=cb(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=sb(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function sb(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function cb(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(py).forEach(r),t}function lb(e){let t=Kv(e,`root`,{},`_root`),n=db(e),r=Object.values(n),i=ny(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=fb(e)+1;e.children(py).forEach(r=>ub(e,t,a,o,i,n,r)),e.graph().nodeRankFactor=a}function ub(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=$v(e,`_bt`),l=$v(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{ub(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function db(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(py).forEach(e=>n(e,1)),t}function fb(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function pb(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var mb=hb;function hb(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)gb(e,`borderLeft`,`_bl`,n,i,t),gb(e,`borderRight`,`_br`,n,i,t)}}e.children(py).forEach(t)}function gb(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=Kv(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function _b(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&yb(e)}function vb(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&xb(e),(t===`lr`||t===`rl`)&&(Cb(e),yb(e))}function yb(e){e.nodes().forEach(t=>bb(e.node(t))),e.edges().forEach(t=>bb(e.edge(t)))}function bb(e){let t=e.width;e.width=e.height,e.height=t}function xb(e){e.nodes().forEach(t=>Sb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Sb),Object.hasOwn(r,`y`)&&Sb(r)})}function Sb(e){e.y=-e.y}function Cb(e){e.nodes().forEach(t=>wb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(wb),Object.hasOwn(r,`x`)&&wb(r)})}function wb(e){let t=e.x;e.x=e.y,e.y=t}function Tb(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),r=n.map(t=>e.node(t).rank),i=ly(ny(Math.max,r)+1).map(()=>[]);function a(n){if(t[n])return;t[n]=!0;let r=e.node(n);i[r.rank].push(n);let o=e.successors(n);o&&o.forEach(a)}return n.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(a),i}function Eb(e,t){let n=0;for(let r=1;r<t.length;++r)n+=Db(e,t[r-1],t[r]);return n}function Db(e,t,n){let r=fy(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function Ob(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function kb(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),Ab(Object.values(n).filter(e=>!e.indegree))}function Ab(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&jb(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>uy(e,[`vs`,`i`,`barycenter`,`weight`]))}function jb(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Mb(e,t){let n=iy(e,e=>Object.hasOwn(e,`barycenter`)),r=n.lhs,i=n.rhs.sort((e,t)=>t.i-e.i),a=[],o=0,s=0,c=0;r.sort(Pb(!!t)),c=Nb(a,i,c),r.forEach(e=>{c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=Nb(a,i,c)});let l={vs:a.flat(1)};return s&&(l.barycenter=o/s,l.weight=s),l}function Nb(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Pb(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function Fb(e,t,n,r){let i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=i.filter(e=>e!==o&&e!==s));let l=Ob(e,i);l.forEach(t=>{if(e.children(t.v).length){let i=Fb(e,t.v,n,r);c[t.v]=i,Object.hasOwn(i,`barycenter`)&&Lb(t,i)}});let u=kb(l,n);Ib(u,c);let d=Mb(u,r);if(o&&s){d.vs=[o,d.vs,s].flat(1);let t=e.predecessors(o);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(s),i=e.node(r[0]);Object.hasOwn(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+n.order+i.order)/(d.weight+2),d.weight+=2}}return d}function Ib(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function Lb(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function Rb(e,t,n,r){r||=e.nodes();let i=zb(e),a=new cv({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function zb(e){let t;for(;e.hasNode(t=cy(`_root`)););return t}function Bb(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function Vb(e,t={}){if(typeof t.customOrder==`function`){t.customOrder(e,Vb);return}let n=ry(e),r=Hb(e,ly(1,n+1),`inEdges`),i=Hb(e,ly(n-1,-1,-1),`outEdges`),a=Tb(e);if(Wb(e,a),t.disableOptimalOrderHeuristic)return;let o=1/0,s,c=t.constraints||[];for(let t=0,n=0;n<4;++t,++n){Ub(t%2?r:i,t%4>=2,c),a=Xv(e);let l=Eb(e,a);l<o?(n=0,s=Object.assign({},a),o=l):l===o&&(s=structuredClone(a))}Wb(e,s)}function Hb(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return Rb(e,t,n,r.get(t)||[])})}function Ub(e,t,n){let r=new cv;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let i=e.graph().root,a=Fb(e,i,r,t);a.vs.forEach((t,n)=>e.node(t).order=n),Bb(e,r,a.vs)})}function Wb(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function Gb(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=qb(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Jb(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function Kb(e,t){let n={};function r(t,r,i,a,o){ly(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Jb(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function qb(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function Jb(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function Yb(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function Xb(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s&&s.length){let r=s.sort((e,t)=>{let n=o[e],r=o[t];return(n===void 0?0:n)-(r===void 0?0:r)}),c=(r.length-1)/2;for(let s=Math.floor(c),l=Math.ceil(c);s<=l;++s){let c=r[s];if(c===void 0)continue;let l=o[c];if(l!==void 0&&a[e]===e&&t<l&&!Yb(n,e,c)){let n=i[c];n!==void 0&&(a[c]=e,a[e]=i[e]=n,t=l)}}}})}),{root:i,align:a}}function Zb(e,t,n,r,i=!1){let a={},o=Qb(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function Qb(e,t,n,r){let i=new cv,a=e.graph(),o=rx(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function $b(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=ix(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function ex(e,t){let n=Object.values(t),r=ny(Math.min,n),i=ny(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-ny(Math.min,c);a!==`l`&&(l=i-ny(Math.max,c)),l&&(e[o]=dy(s,e=>e+l))})})}function tx(e,t=void 0){let n=e.ul;return n?dy(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function nx(e){let t=Xv(e),n=Object.assign(Gb(e,t),Kb(e,t)),r={},i;return[`u`,`d`].forEach(a=>{i=a===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(i=i.map(e=>Object.values(e).reverse()));let o=Xb(e,i,n,t=>(a===`u`?e.predecessors(t):e.successors(t))||[]),s=Zb(e,i,o.root,o.align,t===`r`);t===`r`&&(s=dy(s,e=>-e)),r[a+t]=s})}),ex(r,$b(e,r)),tx(r,e.graph().align)}function rx(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),c}}function ix(e,t){return e.node(t).width}function ax(e){e=Jv(e),ox(e),Object.entries(nx(e)).forEach(([t,n])=>e.node(t).x=n)}function ox(e){let t=Xv(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}function sx(e,t={}){let n=t.debugTiming?ay:oy;return n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>vx(e));return n(` runLayout`,()=>cx(r,n,t)),n(` updateInputGraph`,()=>lx(e,r)),r})}function cx(e,t,n){t(` makeSpaceForEdgeLabels`,()=>yx(e)),t(` removeSelfEdges`,()=>Ox(e)),t(` acyclic`,()=>Ey(e)),t(` nestingGraph.run`,()=>lb(e)),t(` rank`,()=>eb(Jv(e))),t(` injectEdgeLabelProxies`,()=>bx(e)),t(` removeEmptyRanks`,()=>Qv(e)),t(` nestingGraph.cleanup`,()=>pb(e)),t(` normalizeRanks`,()=>Zv(e)),t(` assignRankMinMax`,()=>xx(e)),t(` removeEdgeLabelProxies`,()=>Sx(e)),t(` normalize.run`,()=>ky(e)),t(` parentDummyChains`,()=>ab(e)),t(` addBorderSegments`,()=>mb(e)),t(` order`,()=>Vb(e,n)),t(` insertSelfEdges`,()=>kx(e)),t(` adjustCoordinateSystem`,()=>_b(e)),t(` position`,()=>ax(e)),t(` positionSelfEdges`,()=>Ax(e)),t(` removeBorderNodes`,()=>Dx(e)),t(` normalize.undo`,()=>jy(e)),t(` fixupEdgeLabelCoords`,()=>Tx(e)),t(` undoCoordinateSystem`,()=>vb(e)),t(` translateGraph`,()=>Cx(e)),t(` assignNodeIntersects`,()=>wx(e)),t(` reversePoints`,()=>Ex(e)),t(` acyclic.undo`,()=>Oy(e))}function lx(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var ux=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],dx={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},fx=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],px=[`width`,`height`,`rank`],mx={width:0,height:0},hx=[`minlen`,`weight`,`width`,`height`,`labeloffset`],gx={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},_x=[`labelpos`];function vx(e){let t=new cv({multigraph:!0,compound:!0}),n=Mx(e.graph());return t.setGraph(Object.assign({},dx,jx(n,ux),uy(n,fx))),e.nodes().forEach(n=>{let r=jx(Mx(e.node(n)),px);Object.keys(mx).forEach(e=>{r[e]===void 0&&(r[e]=mx[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=Mx(e.edge(n));t.setEdge(n,Object.assign({},gx,jx(r,hx),uy(r,_x)))}),t}function yx(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function bx(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);Kv(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function xx(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Sx(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Cx(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function wx(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(Yv(r,a)),n.points.push(Yv(i,o))})}function Tx(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function Ex(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Dx(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function Ox(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function kx(e){Xv(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{Kv(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function Ax(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`selfedge`){let r=n,i=e.node(r.e.v),a=i.x+i.width/2,o=i.y,s=n.x-a,c=i.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:a+2*s/3,y:o-c},{x:a+5*s/6,y:o-c},{x:a+s,y:o},{x:a+5*s/6,y:o+c},{x:a+2*s/3,y:o+c}],r.label.x=n.x,r.label.y=n.y}})}function jx(e,t){return dy(uy(e,t),Number)}function Mx(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}function Nx(e){let t=Xv(e),n=new cv({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}var Px={graphlib:av,version:my,layout:sx,debug:Nx,util:{time:ay,notime:oy}},Fx=function(e){return typeof e==`function`},Ix=.001;function Lx(e){if(e.isParent()){var t=e.children();if(t.length>0)return Lx(t[0])}return e}function Rx(e){this.options=ev({},$_,e)}function zx(e,t){return{x:Wx(e.x-t.x),y:Wx(e.y-t.y)}}function Bx(e,t){return Wx(e.x*t.x)+Wx(e.y*t.y)}function Vx(e){var t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t,len:t}}function Hx(e){return{x:-e.y,y:e.x}}function Ux(e,t){var n=Vx(zx(t,e)),r=n.x,i=n.y,a=n.len,o={x:r,y:i};return{src:e,tgt:t,dir:o,normal:Hx(o),len:a}}function Wx(e){return Math.abs(e)<Ix?e<0?-Ix:Ix:e}function Gx(e,t){var n=zx(e,t.src);return{weight:Wx(Bx(n,t.dir)/t.len),distance:Wx(Bx(n,t.normal))}}function Kx(e){var t=1/0,n=-1/0,r=X_(e),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;a.weight<t&&(t=a.weight),a.weight>n&&(n=a.weight)}}catch(e){r.e(e)}finally{r.f()}var o=n-t||1;return e.map(function(e){return{distance:e.distance,weight:(e.weight-t)/o}})}function qx(e,t){var n=Ux(t.source().position(),t.target().position()),r=Kx(e.points.map(function(e){return Gx(e,n)}));return{controlPointWeights:r.slice(1,-1).map(function(e){return e.weight}),controlPointDistances:r.slice(1,-1).map(function(e){return e.distance})}}Rx.prototype.run=function(){var e=this.options,t=this,n=e.cy,r=e.eles,i=function(e,t){return Fx(t)?t.apply(e,[e]):t},a=e.boundingBox||{x1:0,y1:0,w:n.width(),h:n.height()};a.x2===void 0&&(a.x2=a.x1+a.w),a.w===void 0&&(a.w=a.x2-a.x1),a.y2===void 0&&(a.y2=a.y1+a.h),a.h===void 0&&(a.h=a.y2-a.y1);var o=new Px.graphlib.Graph({multigraph:!0,compound:!0}),s={},c=function(e,t){t!=null&&(s[e]=t)};c(`nodesep`,e.nodeSep),c(`edgesep`,e.edgeSep),c(`ranksep`,e.rankSep),c(`rankdir`,e.rankDir),c(`align`,e.align),c(`ranker`,e.ranker),c(`acyclicer`,e.acyclicer),o.setGraph(s),o.setDefaultEdgeLabel(function(){return{}}),o.setDefaultNodeLabel(function(){return{}});var l=r.nodes();Fx(e.sort)&&(l=l.sort(e.sort));for(var u=0;u<l.length;u++){var d=l[u],f=d.layoutDimensions(e);o.setNode(d.id(),{width:f.w,height:f.h,shape:`ellipse`,name:d.id()})}for(var p=0;p<l.length;p++){var m=l[p];m.isChild()&&o.setParent(m.id(),m.parent().id())}var h=r.edges();Fx(e.sort)&&(h=h.sort(e.sort));for(var g=0;g<h.length;g++){var _=h[g],v=Lx(_.source()),y=Lx(_.target());o.setEdge(v.id(),y.id(),{minlen:i(_,e.minLen),weight:i(_,e.edgeWeight),name:_.id()},_.id())}Px.layout(o);for(var b=o.nodes(),x=0;x<b.length;x++){var S=b[x],C=o.node(S);n.getElementById(S).scratch().dagre=C}var w;e.boundingBox?(w={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0},l.forEach(function(e){var t=e.scratch().dagre;w.x1=Math.min(w.x1,t.x),w.x2=Math.max(w.x2,t.x),w.y1=Math.min(w.y1,t.y),w.y2=Math.max(w.y2,t.y)}),w.w=w.x2-w.x1,w.h=w.y2-w.y1):w=a;var T=function(t){if(e.boundingBox){var n=w.w===0?0:(t.x-w.x1)/w.w,r=w.h===0?0:(t.y-w.y1)/w.h;return{x:a.x1+n*a.w,y:a.y1+r*a.h}}return t};return l.layoutPositions(t,e,function(e){e=Z_(e)===`object`?e:this;var t=e.scratch().dagre;return T({x:t.x,y:t.y})}),e.useDagreEdgeControlPoints&&(e.automaticDagreEdgeStyle&&(n.edges().addClass(`useDagreEdgeControlPoints`),n.style().selector(`edge.useDagreEdgeControlPoints`).style(e.dagreEdgeStyle).update()),o.edges().forEach(function(e){var t=n.getElementById(e.name),r=o.edge(e);r&&r.points&&t.scratch(qx(r,t))})),this};var Jx=function(e){e&&e(`layout`,`dagre`,Rx)};typeof window<`u`&&window.cytoscape!==void 0&&Jx(window.cytoscape),J_.use(Jx);function Yx(e,t){let n=[...e.map(e=>e.id)].sort(),r=new Set(n),i=t.filter(e=>r.has(e.from)&&r.has(e.to)&&e.from!==e.to),a=new Set(i.flatMap(e=>[e.from,e.to])),o=n.filter(e=>a.has(e)),s=n.filter(e=>!a.has(e)),c=J_({headless:!0,styleEnabled:!0,elements:[...o.map(e=>({data:{id:e}})),...i.map(e=>({data:{id:`${e.from}->${e.to}`,source:e.from,target:e.to,weight:e.weight}})).sort((e,t)=>e.data.id<t.data.id?-1:1)],style:[{selector:`node`,style:{width:210,height:84,shape:`round-rectangle`}}]});c.layout({name:`dagre`,rankDir:`LR`,nodeSep:30,rankSep:80,edgeWeight:e=>Number(e.data(`weight`))||1,fit:!1,animate:!1}).run();let l={groups:{},packages:{x:0,y:0}},u=1/0,d=-1/0,f=1/0,p=-1/0;for(let e of c.nodes().toArray()){let t=e.position();l.groups[e.id()]={x:Math.round(t.x),y:Math.round(t.y)},u=Math.min(u,t.x),d=Math.max(d,t.x),f=Math.min(f,t.y),p=Math.max(p,t.y)}if(c.destroy(),s.length){let e=o.length?Math.floor((d-u)/240)+1:0,t=Math.max(e,Math.ceil(Math.sqrt(s.length*2))),n=o.length?u:0,r=o.length?p+84+60:0;s.forEach((e,i)=>{let a={x:Math.round(n+i%t*240),y:Math.round(r+Math.floor(i/t)*114)};l.groups[e]=a,d=Math.max(d,a.x),f=Math.min(f,a.y)})}return l.packages=n.length?{x:Math.round(d+210+80),y:Math.round(f)}:{x:0,y:0},l}var Xx=new Map;function Zx(e,t,n){let r=Xx.get(e);return r||(r=Yx(t,n),Xx.set(e,r),Xx.size>20&&Xx.delete(Xx.keys().next().value)),r}function Qx(e,t,n){let r=[...e.map(e=>e.id)].sort(),i=new Set(r),a=J_({headless:!0,styleEnabled:!0,elements:[...r.map(e=>({data:{id:e}})),...t.filter(e=>i.has(e.from)&&i.has(e.to)&&e.from!==e.to).map(e=>({data:{id:`${e.from}->${e.to}`,source:e.from,target:e.to}})).sort((e,t)=>e.data.id<t.data.id?-1:1)],style:[{selector:`node`,style:{width:160,height:50,shape:`round-rectangle`}}]});a.layout({name:`dagre`,rankDir:`LR`,nodeSep:18,rankSep:46,fit:!1,animate:!1}).run();let o={nodes:{},stubs:{},box:{x1:0,y1:0,x2:0,y2:0}},s=1/0,c=1/0,l=-1/0,u=-1/0;for(let e of a.nodes().toArray()){let t={x:Math.round(e.position().x),y:Math.round(e.position().y)};o.nodes[e.id()]=t,s=Math.min(s,t.x-80),l=Math.max(l,t.x+80),c=Math.min(c,t.y-25),u=Math.max(u,t.y+25)}a.destroy(),r.length===0&&([s,c,l,u]=[0,0,160,50]),o.box={x1:s-24,y1:c-36,x2:l+24,y2:u+24};let d=o.box.x2+56+90;return[...n.map(e=>e.id)].sort().forEach((e,t)=>{o.stubs[e]={x:Math.round(d),y:Math.round(o.box.y1+23+t*62)}}),o}var $x=(e,t)=>{let[n,...r]=t.split(` `),i=t===`broken import`||t===`pending import`?`${t}s`:[`${n}s`,...r].join(` `);return`${e.toLocaleString()} ${e===1?t:i}`},eS={"file-not-found":`file not found`,"not-exported":`not exported by the package`,"unknown-package":`unknown package`,"alias-not-configured":`path alias not configured`,"package-not-in-sources":`package in no source yet`,"path-not-in-sources":`folder in no source yet`,"default-excluded":`in a folder left out`,"excluded-by-rule":`left out by a rule`,"too-large":`file too large`,asset:`asset (not code)`,minified:`minified file`,"language-not-analyzed":`language not analyzed`};function tS(e,t){switch(e.kind){case`group`:return`${e.name}\n${$x(e.count,`import`)} · group`;case`ungrouped`:return`${e.source}\n${$x(e.count,`import`)} · other source`;case`packages`:{let n=e.packages.slice(0,3).map(t),r=e.packages.length-n.length;return`${n.join(`, `)}${r>0?` +${r}`:``}\nexternal packages`}default:return`${eS[e.reason]??e.reason}\n${$x(e.count,e.kind===`broken`?`broken import`:e.kind===`pending`?`pending import`:`import not analyzed`)}`}}var nS=22,rS=e=>e.length>nS?`${e.slice(0,21)}…`:e,iS=e=>e.length>nS?`…${e.slice(e.length-nS+1)}`:e;function aS(e,t){return t&&e.startsWith(`${t}/`)?e.slice(t.length+1):e}function oS({reply:e,pick:t,onPick:n,onOpenFile:r,onToggleFolder:i,onClear:a,marks:o=null,only:s=null,onContext:c}){let l=(0,y.useRef)(null),u=(0,y.useRef)(null),d=Je();(0,y.useEffect)(()=>{u.current?.style(cS())},[d]);let[f,p]=(0,y.useState)(!1),m=(0,y.useRef)(s);m.current=s;let h=(0,y.useRef)(c);h.current=c,(0,y.useEffect)(()=>{u.current&&Ke(u.current,s)},[s]);let g=(0,y.useRef)(o);g.current=o,(0,y.useEffect)(()=>{u.current&&Qe(u.current,o)},[o]);let _=(0,y.useRef)({onPick:n,onOpenFile:r,onToggleFolder:i,onClear:a});_.current={onPick:n,onOpenFile:r,onToggleFolder:i,onClear:a};let v=e.group.kind===`cluster`?``:e.group.root;(0,y.useEffect)(()=>{if(!l.current)return;let t=Qx(e.nodes,e.imports,e.stubs),n=t.box,r=e=>e.slice(e.lastIndexOf(`:`)+1),i=[{data:{id:`box`,kind:`box`,label:e.group.name,w:n.x2-n.x1,h:n.y2-n.y1},position:{x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},classes:`box`},...e.nodes.map(e=>{let n=e.findings,r=n.broken>0?` · ${$x(n.broken,`broken import`)}`:``;return e.kind===`folder`?{data:{id:e.id,kind:`folder`,path:e.path,label:`${iS(`${aS(e.path,v)}/`)} (${e.files})\nfolder${r}`},position:t.nodes[e.id],classes:n.broken>0?`folder broken`:`folder`}:{data:{id:e.id,kind:`file`,label:[rS(aS(e.path,v).split(`/`).pop()),...aS(e.path,v).includes(`/`)?[iS(aS(e.path,v).split(`/`).slice(0,-1).join(`/`))]:[],...r?[r.slice(3)]:[]].join(`
332
332
  `)},position:t.nodes[e.id],classes:[`file`,n.broken>0?`broken`:``,e.status===`not_analyzed`?`not-analyzed`:``].join(` `)}}),...e.stubs.map(e=>({data:{id:e.id,kind:`stub`,label:tS(e,r)},position:t.stubs[e.id],classes:`stub ${e.kind}`})),...[...e.calls??[],...e.callStubEdges??[]].map(e=>({data:{id:e.id,kind:`calls`,source:e.from,target:e.to,width:Math.min(1.5+Math.log2(e.count)*1.2,7),label:e.count>1?String(e.count):``,calls:e.calls,references:e.references},classes:e.to.startsWith(`stub|`)?`calls out`:`calls`})),...f?e.imports.map(e=>({data:{id:e.id,kind:`imports`,source:e.from,target:e.to,label:e.count>1?String(e.count):``},classes:`imports`})):[],...(f?e.stubEdges:[]).map(t=>{let n=e.stubs.find(e=>e.id===t.to);return{data:{id:t.id,kind:`out`,source:t.from,target:t.to,label:t.count>1?String(t.count):``},classes:`out ${n?.kind??``}`}})],a=J_({container:l.current,elements:i,layout:{name:`preset`},autounselectify:!0,minZoom:.1,maxZoom:2.5,style:cS()});return a.on(`tap`,`node`,e=>{let t=e.target.data(`kind`);(t===`file`||t===`folder`)&&_.current.onPick(e.target.id())}),a.on(`tap`,`edge`,e=>{e.target.data(`kind`)===`calls`&&_.current.onPick(e.target.id())}),a.on(`dbltap`,`node`,e=>{let t=e.target.data(`kind`);t===`file`?_.current.onOpenFile(e.target.id()):t===`folder`&&_.current.onToggleFolder(e.target.data(`path`))}),a.on(`tap`,e=>{e.target===a&&_.current.onClear()}),sS(a),u.current=a,l.current&&(l.current.veoCy=a),Ke(a,m.current),a.on(`cxttap`,`node, edge`,e=>{let t=e.target.data(),n=t.kind===`file`?`file`:t.kind===`folder`?`folder`:t.kind===`imports`||t.kind===`calls`?`edge`:null;if(!n||!l.current)return;let r=l.current.getBoundingClientRect(),i=e.renderedPosition??{x:0,y:0};h.current?.({kind:n,id:n===`file`&&typeof t.file==`string`?t.file:e.target.id(),data:t,x:r.left+i.x,y:r.top+i.y})}),Qe(a,g.current),()=>{u.current=null,a.destroy()}},[e,v,f]),(0,y.useEffect)(()=>{let e=u.current;e&&e.batch(()=>{e.elements().removeClass(`picked faded`);let n=t?e.getElementById(t):null;if(n&&n.nonempty()){let t=n.union(n.connectedEdges());t.addClass(`picked`),e.elements().not(t).not(t.connectedNodes()).not(`#box`).addClass(`faded`)}})},[t,e,f]);let b=e.nodes,x=t=>{let n=e.nodes.find(e=>e.id===t);n?.kind===`folder`?i(n.path):n&&r(n.id)},S=e=>{if(b.length===0)return;let r=t?b.findIndex(e=>e.id===t):-1;if(e.key===`ArrowRight`||e.key===`ArrowDown`)n(b[(r+1)%b.length].id);else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)n(b[(r-1+b.length)%b.length].id);else if(e.key===`Enter`&&t)x(t);else if(e.key===`Escape`)a();else return;e.preventDefault()},C=t=>e.nodes.find(e=>e.id===t)?.path??e.stubs.find(e=>e.id===t)?.name??t;return(0,X.jsxs)(`div`,{className:`graph-wrap`,children:[(0,X.jsxs)(`label`,{className:`toggle small muted group-imports-toggle`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-command":`toggle-group-imports`,checked:f,onChange:e=>p(e.target.checked)}),`File imports too`]}),(0,X.jsx)(`div`,{ref:l,className:`graph map`,"data-testid":`group-canvas`,tabIndex:0,role:`application`,"aria-label":`The group's files: arrow keys move between them, Enter opens a file or a folder`,onKeyDown:S}),(0,X.jsxs)(`ul`,{className:`visually-hidden`,"aria-label":`Files and folders`,children:[e.nodes.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`button`,{"data-command":`pick-node`,"data-id":e.id,tabIndex:-1,onClick:()=>n(e.id),children:e.path}),e.kind===`folder`?(0,X.jsxs)(`button`,{"data-command":`toggle-folder`,"data-path":e.path,tabIndex:-1,onClick:()=>i(e.path),children:[`Open `,e.path,`/`]}):(0,X.jsxs)(`button`,{"data-command":`open-imports-file`,"data-id":e.id,tabIndex:-1,onClick:()=>r(e.id),children:[`Open `,e.path]})]},e.id)),e.stubs.map(e=>(0,X.jsx)(`li`,{"data-testid":`stub`,"data-id":e.id,"data-count":e.count,children:tS(e,e=>e.slice(e.lastIndexOf(`:`)+1)).replace(`
333
- `,` · `)},e.id))]}),(0,X.jsx)(`ul`,{className:`visually-hidden`,"aria-label":`Calls between files`,children:[...e.calls??[],...e.callStubEdges??[]].map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"data-command":`pick-node`,"data-link":!0,"data-id":e.id,tabIndex:-1,onClick:()=>n(e.id),children:[C(e.from),` calls `,C(e.to),`: `,e.calls,` calls, `,e.references,` references`]})},e.id))}),(0,X.jsx)(`button`,{className:`fit`,onClick:()=>u.current&&sS(u.current),children:`Fit`})]})}function sS(e){e.fit(void 0,30);let t=e.zoom();if(t>1.2)e.zoom(1.2),e.center();else if(t<.75){let t=e.elements().boundingBox();e.zoom(.75),e.pan({x:30-t.x1*.75,y:30-t.y1*.75})}}function cS(){return[{selector:`node`,style:{shape:`round-rectangle`,width:160,height:50,label:`data(label)`,"text-wrap":`wrap`,"text-max-width":`144px`,"text-valign":`center`,"text-halign":`center`,"font-size":12,color:Z(`gray-26`),"background-color":Z(`gray-100`),"border-width":1,"border-color":Z(`gray-86`)}},{selector:`node.box`,style:{width:`data(w)`,height:`data(h)`,"background-color":Z(`gray-98-5`),"border-color":Z(`blue-87`),"border-width":2,"text-valign":`top`,"text-halign":`center`,"text-margin-y":22,"font-weight":`bold`,color:Z(`blue-47`),events:`no`,"z-compound-depth":`bottom`,"z-index":0}},{selector:`node.folder`,style:{"background-color":Z(`gray-97-3`),"border-style":`double`,"border-width":3}},{selector:`node.broken`,style:{"border-color":Z(`amber-74`)}},{selector:`node.not-analyzed`,style:{color:Z(`gray-66`),"border-style":`dashed`}},{selector:`node.stub`,style:{width:180,height:46,"border-style":`dashed`,"border-color":Z(`blue-62`),color:Z(`gray-26`)}},{selector:`node.stub.packages`,style:{"border-color":Z(`gray-81`),color:Z(`gray-44`)}},{selector:`node.stub.broken`,style:{"border-color":Z(`amber-74`),"background-color":Z(`gray-99-3`),color:Z(`amber-43`)}},{selector:`node.stub.not-analyzed, node.stub.pending`,style:{"border-color":Z(`gray-81`),"background-color":Z(`gray-99`),color:Z(`gray-51-2`)}},{selector:`edge`,style:{width:1.5,"curve-style":`bezier`,"line-color":Z(`blue-70`),"target-arrow-shape":`triangle`,"target-arrow-color":Z(`blue-70`),"arrow-scale":.8,label:`data(label)`,"font-size":10,color:Z(`gray-51-2`),"text-background-color":Z(`gray-100`),"text-background-opacity":1}},{selector:`edge.out`,style:{"line-style":`dashed`,"line-color":Z(`blue-76`),"target-arrow-color":Z(`blue-76`)}},{selector:`edge.imports, edge.out:not(.calls)`,style:{opacity:.35,width:1}},{selector:`edge.calls`,style:{width:`data(width)`,"line-color":Z(`blue-49`),"target-arrow-color":Z(`blue-49`),"line-style":`solid`,opacity:1}},{selector:`edge.calls.out`,style:{"line-style":`dashed`,"line-color":Z(`blue-62`)}},{selector:`edge.out.broken`,style:{"line-color":Z(`amber-74`),"target-arrow-color":Z(`amber-74`)}},...Ze(),Ge,{selector:`node.picked`,style:{"border-width":2,"border-color":Z(`blue-56`),"background-color":Z(`gray-97`)}},{selector:`edge.picked`,style:{"line-color":Z(`blue-56`),"target-arrow-color":Z(`blue-56`),width:2.5}},{selector:`.faded`,style:{opacity:.3}}]}var lS=`veoflow.allCode`,uS=`veoflow-all-code`;function dS(){try{return localStorage.getItem(lS)===`1`}catch{return!1}}function fS(){let[e,t]=(0,y.useState)(dS);return(0,y.useEffect)(()=>{let e=()=>t(dS());return window.addEventListener(uS,e),()=>window.removeEventListener(uS,e)},[]),[e,e=>{try{localStorage.setItem(lS,e?`1`:`0`)}catch{}t(e),window.dispatchEvent(new Event(uS))}]}var pS=(0,y.createContext)(`declared`),mS=()=>(0,y.useContext)(pS),hS=new Map,gS=`veoflow-groups-forget`;function _S(){for(let e of[...hS.keys()])e.startsWith(`["groups"`)&&hS.delete(e);window.dispatchEvent(new Event(gS))}function vS(e,t,n){let r=hS.get(e);return r||(r=n(),hS.set(e,r),r.then(n=>n.committedRun!==t&&hS.delete(e),()=>hS.delete(e)),hS.size>40&&hS.delete(hS.keys().next().value)),r}function yS(e,t,n,r,i){let[a,o]=(0,y.useState)({key:null,data:null,error:null});return(0,y.useEffect)(()=>{if(e===null)return;let r=!1;return vS(e,t,n).then(t=>!r&&o({key:e,scope:i,data:t,error:null}),t=>!r&&o({key:e,scope:i,data:null,error:t.message})),()=>{r=!0}},[e,r]),a.key===e?a:i!==void 0&&a.scope===i&&a.data?{data:a.data,error:null}:{data:null,error:null}}function bS(e,t,n=0,r=null){let[i,a]=(0,y.useState)(0);(0,y.useEffect)(()=>{let e=()=>a(e=>e+1);return window.addEventListener(gS,e),()=>window.removeEventListener(gS,e)},[]);let o=mS(),{data:s,error:c}=yS(e?JSON.stringify([`groups`,e,t,r,o]):null,t,()=>Y.groups(e,r,o),`${n}:${i}`);return{groups:s,error:c}}function xS(e,t,n,r,i,a=0){let o=[...r].sort(),s=mS(),{data:c,error:l}=yS(e&&n?JSON.stringify([`group`,e,t,n,o,i,s]):null,t,()=>Y.group(e,n,o,i,s),a,JSON.stringify([e,t,n,s]));return{group:c,error:l}}function SS(e,t,n){let r=mS(),{data:i,error:a}=yS(e&&n?JSON.stringify([`imports`,e,t,n,r]):null,t,()=>Y.imports(e,n,r),0);return{imports:i,error:a}}function CS(e,t,n){let r=mS(),[i,a]=(0,y.useState)(new Map),[o,s]=(0,y.useState)([]),c=JSON.stringify([e,t,r]),[l,u]=(0,y.useState)(c);l!==c&&(u(c),a(new Map),s([]));let d=n.join(`\0`);return(0,y.useEffect)(()=>{if(!e)return;let i=!1;for(let o of n){let n=n=>JSON.stringify([n,e,t,o,r]);Promise.all([vS(n(`calls-out`),t,()=>Y.crossFileCalls(e,o,`out`)),vS(n(`imports`),t,()=>Y.imports(e,o,r))]).then(([e,t])=>{i||(a(n=>n.get(o)?.out===e?n:new Map(n).set(o,{out:e,imports:t})),s(e=>e.includes(o)?e.filter(e=>e!==o):e))},()=>!i&&s(e=>e.includes(o)?e:[...e,o]))}return()=>{i=!0}},[d,c]),{loaded:i,failed:o.filter(e=>n.includes(e))}}function wS(e,t,n,r){let{data:i,error:a}=yS(e&&n?JSON.stringify([`reach`,e,t,n,r]):null,t,()=>Y.reach(e,n,r),0);return{reach:i,error:a}}function TS(e,t,n){let{data:r,error:i}=yS(e&&n?JSON.stringify([`calls`,e,t,n]):null,t,()=>Promise.all([Y.crossFileCalls(e,n,`out`),Y.crossFileCalls(e,n,`in`)]).then(([e,t])=>({committedRun:e.committedRun,out:e,in:t})),0);return{calls:r,error:i}}var ES=null,DS=e=>({onMouseDown:e=>{ES={x:e.clientX,y:e.clientY}},onClick:t=>{let n=ES!==null&&Math.hypot(t.clientX-ES.x,t.clientY-ES.y)>3;ES=null;let r=window.getSelection();n&&r&&!r.isCollapsed&&t.currentTarget.contains(r.anchorNode)||e()}}),OS=(e,t)=>!t&&(e===null||e.kind===`source`),kS=100;function AS(e,t,n,r,i){let[a]=fS(),o=OS(n,a),s=mS(),c=JSON.stringify([e,n,r,o,s]),l=JSON.stringify([c,t,i]),[u,d]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(!e)return;let t=!1;return Y.findings(e,r.length?r:[`broken`],n?.kind===`file`?{file:n.file,own:o,grouping:s}:n?.kind===`group`?{group:n.group,own:o,grouping:s}:n?.kind===`source`?{source:n.source,own:o,grouping:s}:{own:o,grouping:s},r.length?1e3:1).then(e=>!t&&d({key:l,same:c,data:e,error:null}),e=>!t&&d({key:l,same:c,data:null,error:e.message})),()=>{t=!0}},[l]),!u||u.same!==c?{data:null,error:null}:{data:u.data,error:u.key===l?u.error:null}}function jS({project:e,run:t,scope:n,wholeProject:r,canScope:i,showPending:a,refresh:o,filter:s,onFilter:c,onWholeProject:l,onTogglePending:u,onSelectSite:d,onOpenImport:f,onManageLicense:p}){let m=r?null:n,[h,g]=fS(),_=OS(m,h),v=mS(),{data:b}=AS(e,t,m,[],o),x=b?.counts,S=s??(x&&x.broken>0?`broken`:`open-call`),C=[S,...a&&S!==`open-call`?[`pending`]:[]],{data:w,error:T}=AS(e,t,m,C,o),[E,D]=(0,y.useState)(null),O=w&&E?.after===w?E.rows:[],k=[...w?.findings??[],...O],[A,j]=(0,y.useState)(!1),[M,N]=(0,y.useState)(``),P=()=>{w&&(j(!0),N(``),Y.findings(e,C,m?.kind===`file`?{file:m.file,own:_,grouping:v}:m?.kind===`group`?{group:m.group,own:_,grouping:v}:m?.kind===`source`?{source:m.source,own:_,grouping:v}:{own:_,grouping:v},1e3,k.length).then(e=>D({after:w,rows:[...O,...e.findings]}),e=>N(e.message)).finally(()=>j(!1)))},{groups:F}=bS(e,t),I=(0,y.useMemo)(()=>new Map((F?.groups??[]).map(e=>[e.id,e])),[F]),L=e=>{let t=e.group?I.get(e.group):void 0,n=t&&t.kind!==`cluster`&&t.root&&e.path.startsWith(`${t.root}/`)?e.path.slice(t.root.length+1):e.path;return`${t?`${t.name} › `:``}${n}:${e.line}`},R=n?.kind===`group`?I.get(n.group)?.name??`this group`:``,z=i&&n&&(0,X.jsxs)(`div`,{className:`scope`,role:`group`,"aria-label":`Findings scope`,children:[(0,X.jsx)(`button`,{"aria-pressed":!r,onClick:()=>l(!1),"data-testid":`questions-scope-file`,children:n.kind===`file`?`This file`:n.kind===`group`?`This group (${R})`:`This repository (${n.name??n.source})`}),(0,X.jsx)(`button`,{"aria-pressed":r,onClick:()=>l(!0),"data-testid":`questions-scope-project`,children:`Whole project`})]}),B=(e,t,n)=>(0,X.jsxs)(`button`,{className:`chip`,"aria-pressed":S===e,"data-testid":`findings-filter-${e}`,"data-count":n??``,onClick:()=>c(e),children:[t,` `,(0,X.jsx)(`small`,{children:n??`…`})]},e),V=k.filter(e=>e.kind===S),H=k.filter(e=>e.kind===`pending`);return(0,X.jsxs)(`div`,{className:`findings-panel`,"data-testid":`findings-panel`,children:[(0,X.jsx)(We,{project:e,run:t,refresh:o,onManage:p}),z,(0,X.jsxs)(`div`,{className:`chips`,role:`group`,"aria-label":`Kinds of findings`,children:[B(`broken`,`Broken imports`,x?.broken),B(`not-analyzed`,`Imports not analyzed`,x?.notAnalyzed),B(`open-call`,`Open calls`,x?.openCalls)]}),(0,X.jsxs)(`label`,{className:`toggle small muted`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-command":`toggle-pending`,checked:a,onChange:u}),`Show pending (waiting for another source)`,x?` · ${x.pending}`:``]}),(m===null||m.kind===`source`)&&(0,X.jsxs)(`label`,{className:`toggle small muted`,title:`Own code first: findings in tests, installed libraries, generated output and tools' files are counted when this is on`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`findings-all-code`,checked:h,onChange:e=>g(e.target.checked)}),`Libraries and tests too`]}),T?(0,X.jsx)(`p`,{className:`hint error`,children:T}):w?S===`open-call`?(0,X.jsx)(FS,{rows:V,where:L,project:e,onSelect:d}):(0,X.jsxs)(X.Fragment,{children:[S===`not-analyzed`&&(!m||m.kind===`source`)&&(0,X.jsx)(LS,{project:e,run:t,source:m?.source??null,refresh:o}),(0,X.jsx)(NS,{rows:V,empty:S===`broken`?`No broken imports.`:`No imports of files left out of analysis.`,where:L,project:e,onOpen:f})]}):(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`}),w&&a&&S!==`open-call`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Pending (`,H.length,`)`]}),(0,X.jsx)(NS,{rows:H,empty:`Nothing waits for another source.`,where:L,project:e,onOpen:f})]}),w&&w.total>k.length&&(0,X.jsxs)(`p`,{className:`hint small`,"data-testid":`findings-truncated`,children:[`Showing `,k.length.toLocaleString(`en-US`),` of `,w.total.toLocaleString(`en-US`),`.`,` `,(0,X.jsx)(`button`,{className:`link`,"data-testid":`findings-more`,disabled:A,onClick:P,children:A?`Loading…`:`Show more`}),M&&(0,X.jsxs)(`span`,{className:`error`,children:[` `,M]})]})]})}function MS({project:e,id:t}){let[n,r]=(0,y.useState)(!1);return n?(0,X.jsx)(Re,{project:e,id:t,start:!0}):(0,X.jsx)(`button`,{className:`link small`,"data-command":`explain-finding`,onClick:()=>r(!0),children:`Explain`})}function NS({rows:e,empty:t,where:n,project:r,onOpen:i}){let[a,o]=(0,y.useState)(kS);return e.length===0?(0,X.jsx)(`p`,{className:`hint`,children:t}):(0,X.jsxs)(`ul`,{className:`questions finding-rows`,"data-testid":`finding-rows`,children:[e.slice(0,a).map(e=>(0,X.jsxs)(`li`,{"data-kind":e.kind,children:[(0,X.jsx)(`div`,{className:`qrow`,children:(0,X.jsxs)(`button`,{"data-command":`open-finding`,"data-id":e.id,...DS(()=>i(e.file,e.id,e.group)),children:[(0,X.jsx)(`code`,{children:e.text}),(0,X.jsxs)(`small`,{children:[n(e),` · `,eS[e.reason]??e.reason,PS(e)]})]})}),(0,X.jsx)(MS,{project:r,id:e.id})]},e.id)),e.length>a&&(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link`,onClick:()=>o(a+kS),children:[e.length-a,` more…`]})})]})}function PS(e){let t=e.impact;return!t||t.opens<=1?``:` · opens ${`${t.atLeast?`at least `:``}${t.opens} function${t.opens===1?``:`s`}`}${t.groups>1?` in ${t.groups} groups`:``}${t.shared?`, shared with ${t.shared} more`:``}`}function FS({rows:e,where:t,project:n,onSelect:r}){let[i,a]=(0,y.useState)(kS),[o,s]=(0,y.useState)(null),c=(0,y.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.text);e?e.push(n):t.set(n.text,[n])}let n=e=>Math.max(0,...e.map(e=>e.impact?.opens??0)),r=e=>Number(e.every(e=>e.mayBe?.projectFunctions===0));return[...t].sort(([e,t],[i,a])=>r(t)-r(a)||n(a)-n(t)||a.length-t.length||(e<i?-1:+(e>i)))},[e]),l=e=>e.id.startsWith(`resolution|`)?e.id.slice(11):e.id;return e.length===0?(0,X.jsx)(`p`,{className:`hint`,children:`No open calls.`}):(0,X.jsxs)(`ul`,{className:`questions`,"data-testid":`questions`,children:[c.slice(0,i).map(([e,i])=>{let a=i[0],c=new Set(i.map(e=>e.file)).size,u=i.length===1?t(a):`×${i.length}${c>1?` in ${c} files`:``}`;return(0,X.jsxs)(`li`,{children:[(0,X.jsxs)(`div`,{className:`qrow`,children:[(0,X.jsxs)(`button`,{"data-command":`select`,"data-kind":`site`,"data-count":i.length,title:e,...DS(()=>r(l(a),a.file)),children:[(0,X.jsx)(`code`,{children:e}),(0,X.jsxs)(`small`,{children:[u,` ·`,` `,a.candidates?a.exhaustive===!1?`${a.candidates} known function${a.candidates===1?``:`s`}, may not be all`:a.candidates===1?`one possible function`:`one of ${a.candidates} functions`:d(a.reason),a.mayBe&&(0,X.jsxs)(`span`,{className:`may-be-builtin`,title:`Its receiver's type isn't known; ${a.mayBe.builtins.join(` or `)} is the standard library's${a.mayBe.projectFunctions?`, and ${a.mayBe.projectFunctions} of the project's functions share the name`:``}`,children:[` `,`· may be `,a.mayBe.builtins[0],a.mayBe.builtins.length>1?`…`:``]}),PS(i.reduce((e,t)=>(t.impact?.opens??0)>(e.impact?.opens??0)?t:e))]})]}),i.length>1&&(0,X.jsx)(`button`,{className:`icon expand`,"aria-expanded":o===e,"aria-label":`Show all ${i.length}`,onClick:()=>s(o===e?null:e),children:o===e?`▾`:`▸`})]}),i.length===1&&(0,X.jsx)(MS,{project:n,id:a.id}),o===e&&(0,X.jsx)(`ul`,{className:`occurrences`,children:i.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`button`,{"data-command":`select`,"data-kind":`site`,...DS(()=>r(l(e),e.file)),children:t(e)}),(0,X.jsx)(MS,{project:n,id:e.id})]},e.id))})]},e)}),c.length>i&&(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link`,onClick:()=>a(i+kS),children:[c.length-i,` more…`]})})]})}var IS={"language-not-analyzed":`language not analyzed yet`,"declaration-file":`type declarations`,"too-large":`over the size limit`,minified:`minified`,binary:`not text`,"invalid-utf8":`not UTF-8`,unreadable:`unreadable`,entitlement:`beyond the license`,frozen:`kept from an earlier analysis`,"parse-failure":`could not be parsed`,"internal-error":`the extractor failed`};function LS({project:e,run:t,source:n,refresh:r}){let i=`${e}|${t??``}|${n??``}`,[a,o]=(0,y.useState)(null);(0,y.useEffect)(()=>{let t=!1;return Y.totals(e,0,n??void 0).then(e=>!t&&o({key:i,files:e.files}),()=>!t&&o(null)),()=>{t=!0}},[i,r]);let s=a?.key===i?a.files:null,c=s?.notAnalyzed.reduce((e,t)=>e+t.files,0)??0;if(!s||c===0)return null;let l=e=>e.toLocaleString(`en-US`);return(0,X.jsxs)(`p`,{className:`small muted`,"data-testid":`unanalyzed-files`,children:[l(c),` of `,l(s.listed),` files aren't analyzed:`,` `,s.notAnalyzed.map(e=>`${l(e.files)} ${IS[e.reason]??e.reason}`).join(`, `),`. They're marked ⚠ in the file tree; below are imports that lead to such files.`]})}function RS(e,t,n=0){let r=e&&t?`${e}|${t.a}|${t.b}`:null,[i,a]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(!r||!e||!t)return;let n=!1;return Y.diff(e,t.a,t.b).then(e=>!n&&a({key:r,data:e,error:null}),e=>!n&&a({key:r,data:null,error:e.message})),()=>{n=!0}},[r,n]),i&&i.key===r?{data:i.data,error:i.error}:{data:null,error:null}}var zS={added:`+`,removed:`−`,changed:`~`},BS={added:`added`,removed:`removed`,changed:`changed`};function VS(e){let t=e.fact,n=e=>String(e??``).slice(String(e??``).lastIndexOf(`:`)+1);switch(e.type){case`Function`:return`function ${String(t.qualifiedName??t.name??n(e.id))}`;case`File`:return`file ${String(t.path??e.id)}`;case`CALLS`:case`CALLS_CROSS_FILE`:return`call ${n(t.from)} → ${n(t.to)}`;case`IMPORTS`:return`import ${String(t.specifier??``)}`;case`UnresolvedImport`:return`import ${String(t.specifier??``)} (${String(t.outcome??``)}${t.reason?`: ${String(t.reason)}`:``})`;case`UnresolvedCallSite`:return`open call ${String(t.expression??``)}`;case`SiteResolution`:return`call ${String(t.site??``).split(`|`)[3]??``} (${String(t.status??``)})`;case`Group`:return`group ${String(t.name??e.id)}`;case`DEPENDS_ON`:return`dependency ${String(t.from??``)} → ${String(t.to??``)}`;case`ExternalPackage`:return`package ${String(t.name??e.id)}`;case`Finding`:return`finding: ${String(t.message??t.kind??``)}`;default:return`${e.type} ${e.id}`}}function HS(e){let t=[];for(let[n,r]of Object.entries({Function:`functions`,File:`files`,IMPORTS:`imports`,CALLS:`calls`,CALLS_CROSS_FILE:`cross-file calls`,UnresolvedImport:`unresolved imports`})){let i=e.byType[n];if(!i||i.added+i.removed+i.changed===0)continue;let a=[i.added?`+${i.added}`:``,i.removed?`−${i.removed}`:``,i.changed?`${i.changed} changed`:``].filter(Boolean);t.push(`${a.join(`, `)} ${r}`)}let{added:n,removed:r,changed:i}=e.total;return t.length?t.join(` · `):n+r+i===0?`No changes`:`${n+r+i} changes`}function US(e,t){return e.type===`ExternalPackage`?!1:e.change===`removed`?e.file!==null&&e.type!==`File`&&!t.has(e.file):e.file!==null||e.type===`Group`||e.type===`DEPENDS_ON`}var WS=e=>e.startsWith(`sha256:`)?`folder`:e.slice(0,7),GS=e=>e?new Date(e).toLocaleString():``;function KS({run:e,previous:t,picked:n,viewing:r,onPick:i,onView:a}){let o=e.sources.filter(e=>!e.pinned),s=new Map((t?.sources??[]).map(e=>[e.sourceId,e.revision])),c=o.length?o:e.sources,l=t&&c.length>1?c.filter(e=>s.get(e.sourceId)!==e.revision):c,u=e=>[...e.reduce((e,t)=>{let n=`${WS(t.revision)}${t.branch?` (${t.branch})`:``}`;return e.set(n,[...e.get(n)??[],t.sourceId]),e},new Map).entries()].map(([e,t])=>`${t.join(`, `)} @ ${e}`),d=u(l),f=u(c).join(` · `),p=new Set(c.map(e=>e.revision)).size,m=l.length===0?`${p} repositories, none changed`:d.length>3?`${d.slice(0,3).join(` · `)} · +${d.length-3} more`:d.join(` · `),h=l.length>0&&l.length<c.length?`${l.length} of ${c.length} changed: `:``;return(0,X.jsxs)(`li`,{className:`run-row${r?` viewing`:``}`,"data-run":e.runId,children:[(0,X.jsx)(`label`,{className:`pick`,children:(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`compare-pick`,checked:n,onChange:e=>i(e.target.checked),"aria-label":`Compare run ${e.runId}`})}),(0,X.jsxs)(`span`,{className:`what`,children:[(0,X.jsxs)(`span`,{className:`title`,children:[(0,X.jsxs)(`strong`,{children:[`Run `,e.runId]}),e.current?(0,X.jsx)(`span`,{className:`badge`,children:`latest`}):null,e.kind===`branch`?(0,X.jsx)(`span`,{className:`badge`,children:`branch`}):null,e.kind===`draft`?(0,X.jsx)(`span`,{className:`badge`,children:`draft`}):null,e.kind===`debug`?(0,X.jsxs)(`span`,{className:`badge`,"data-testid":`debug-badge`,children:[`debug · until `,e.until]}):null]}),(0,X.jsxs)(`span`,{className:`commits`,title:f||void 0,children:[h,m||`no sources`]}),(0,X.jsxs)(`span`,{className:`muted small`,children:[e.reused?.length?(0,X.jsx)(`span`,{"data-testid":`run-reused`,children:`${e.reused.join(`, `)} reused · `}):null,e.trigger===`commit`?`commit hook`:e.trigger,` · +`,e.written.toLocaleString(`en-US`),` / −`,e.closed.toLocaleString(`en-US`),` facts · `,GS(e.finishedAt)]})]}),(0,X.jsx)(`button`,{className:`link`,"data-command":`open-run`,onClick:a,disabled:r,children:r?`Viewing`:`View`})]})}function qS({project:e,refresh:t,run:n,compare:r,diff:i,diffError:a,onView:o,onCompare:s,onClose:c,onLocate:l,stages:u=[],onDebug:d,onFrom:f}){let[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(``),_=u.slice(1),[v,b]=(0,y.useState)(null),[x,S]=(0,y.useState)(null),[C,w]=(0,y.useState)(r?[r.a,r.b]:[]);(0,y.useEffect)(()=>{r&&w([r.a,r.b])},[r?.a,r?.b]);let[T,E]=(0,y.useState)(``);(0,y.useEffect)(()=>{let t=!1;return Y.history(e).then(e=>!t&&(b(e),S(null)),e=>!t&&S(e.message)),()=>{t=!0}},[e,t]);let D=(e,t)=>w(n=>t?[...n.filter(t=>t!==e),e].slice(-2):n.filter(t=>t!==e)),O=C.length===2?{a:Math.min(...C),b:Math.max(...C)}:null,k=(0,y.useMemo)(()=>new Set((i?.items??[]).filter(e=>e.type===`File`&&e.change===`removed`).map(e=>e.id)),[i]),A=(0,y.useMemo)(()=>{if(!i)return[];let e=T.trim().toLowerCase(),t=new Map(i.files.map(e=>[e.file??`\0${e.source}`,e.group?.name??e.source])),n=new Map;for(let r of i.items){let i=VS(r);if(e&&!`${i} ${r.file??``} ${r.type}`.toLowerCase().includes(e))continue;let a=r.file??`\0${r.source}`,o=t.get(a)??r.source,s=n.get(o);s||n.set(o,s=new Map);let c=s.get(a);c||s.set(a,c=[]),c.push({item:r,words:i})}return[...n].sort(([e],[t])=>e<t?-1:1)},[i,T]);return(0,X.jsxs)(`div`,{className:`history-panel`,"data-testid":`history-panel`,children:[(0,X.jsxs)(`div`,{className:`history-head`,children:[(0,X.jsx)(`strong`,{children:`History`}),(0,X.jsx)(`button`,{className:`icon`,"data-command":`toggle-history`,"aria-label":`Close History`,onClick:c,children:`×`})]}),r?(0,X.jsxs)(`section`,{className:`changes`,"aria-label":`Changes`,"data-testid":`change-list`,children:[(0,X.jsxs)(`div`,{className:`compare-head`,children:[(0,X.jsxs)(`span`,{children:[`Changes from run `,r.a,` to run `,r.b]}),(0,X.jsx)(`button`,{className:`link`,"data-command":`compare-runs`,onClick:()=>s(null),children:`Stop comparing`})]}),a?(0,X.jsx)(`p`,{className:`error`,children:a}):i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`summary`,"data-testid":`change-summary`,children:HS(i)}),(0,X.jsxs)(`p`,{className:`legend muted small`,children:[`On the canvas:`,` `,(0,X.jsxs)(`span`,{className:`change added`,children:[(0,X.jsx)(`span`,{className:`sign`,children:`+`}),`added`]}),` `,`(solid blue border),`,` `,(0,X.jsxs)(`span`,{className:`change removed`,children:[(0,X.jsx)(`span`,{className:`sign`,children:`−`}),`removed`]}),` `,`(dashed orange),`,` `,(0,X.jsxs)(`span`,{className:`change changed`,children:[(0,X.jsx)(`span`,{className:`sign`,children:`~`}),`changed`]}),` `,`(double purple).`]}),i.latestOnly.length>0&&(0,X.jsxs)(`p`,{className:`muted small`,children:[`Not compared (plain folders have no history): `,i.latestOnly.join(`, `)]}),(0,X.jsx)(`input`,{type:`search`,className:`filter`,placeholder:`Filter changes`,"aria-label":`Filter changes`,"data-testid":`change-filter`,value:T,onChange:e=>E(e.target.value)}),A.map(([e,t])=>(0,X.jsxs)(`div`,{className:`change-group`,children:[(0,X.jsx)(`h4`,{children:e}),[...t].map(([e,t])=>(0,X.jsxs)(`div`,{className:`change-file`,children:[(0,X.jsx)(`div`,{className:`file-name`,children:e.startsWith(`\0`)?`(the repository)`:e.slice(e.indexOf(`:`)+1)}),(0,X.jsx)(`ul`,{children:t.map(({item:e,words:t})=>{let n=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sign`,"aria-hidden":`true`,children:zS[e.change]}),(0,X.jsxs)(`span`,{className:`visually-hidden`,children:[BS[e.change],`: `]}),t]});return(0,X.jsx)(`li`,{className:`change ${e.change}`,children:US(e,k)?(0,X.jsx)(`button`,{className:`link`,"data-testid":`change-item`,"data-id":e.id,"data-change":e.change,onClick:()=>l(e),children:n}):(0,X.jsx)(`span`,{"data-testid":`change-item`,"data-id":e.id,"data-change":e.change,children:n})},`${e.change}:${e.id}`)})})]},e))]},e)),i.truncated&&(0,X.jsxs)(`p`,{className:`muted small`,children:[`The first `,i.items.length,` of`,` `,i.total.added+i.total.removed+i.total.changed,` changes are listed.`]})]}):(0,X.jsx)(`p`,{className:`muted`,children:`Comparing…`})]}):null,x?(0,X.jsx)(`p`,{className:`error`,children:x}):null,v?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`compare-bar`,children:[(0,X.jsx)(`button`,{"data-command":`compare-runs`,disabled:!O,onClick:()=>O&&s(O),title:`Pick two runs to compare`,children:O?`Compare run ${O.a} with run ${O.b}`:`Pick two runs to compare`}),n!==null&&(0,X.jsx)(`button`,{className:`link`,"data-command":`open-run`,onClick:()=>o(null),children:`Back to latest`})]}),(0,X.jsxs)(`ol`,{className:`runs`,"aria-label":`Runs`,children:[v.draft&&(0,X.jsx)(KS,{run:v.draft,picked:C.includes(v.draft.runId),viewing:n===v.draft.runId,onPick:e=>D(v.draft.runId,e),onView:()=>o(v.draft.runId)}),v.debug&&(0,X.jsx)(KS,{run:v.debug,picked:C.includes(v.debug.runId),viewing:n===v.debug.runId,onPick:e=>D(v.debug.runId,e),onView:()=>o(v.debug.runId)}),v.runs.map((e,t)=>(0,X.jsx)(KS,{run:e,previous:v.runs[t+1],picked:C.includes(e.runId),viewing:n===null?e.current:n===e.runId,onPick:t=>D(e.runId,t),onView:()=>o(e.current?null:e.runId)},e.runId))]}),v.hidden>0&&(0,X.jsxs)(`p`,{className:`muted small`,children:[v.hidden,` older runs aren't shown: this license shows 30 days of history.`]}),v.latestOnly.length>0&&(0,X.jsxs)(`p`,{className:`muted small`,children:[`Not under version control, so latest only: `,v.latestOnly.join(`, `),`. History and diffs need git.`]}),d&&u.length>0&&v.runs.length>0&&(0,X.jsxs)(`form`,{className:`debug-run`,onSubmit:e=>{e.preventDefault(),d(p||u[0])},children:[(0,X.jsxs)(`label`,{className:`muted small`,children:[`Debug run: stop after`,` `,(0,X.jsx)(`select`,{"data-testid":`debug-until`,value:p||u[0],onChange:e=>m(e.target.value),children:u.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),(0,X.jsx)(`button`,{type:`submit`,"data-command":`analyze-debug`,"data-testid":`analyze-debug`,title:`Never committed: open it and compare it with the latest`,children:`Run`})]}),f&&_.length>0&&v.runs.length>0&&(0,X.jsxs)(`form`,{className:`debug-run`,onSubmit:e=>{e.preventDefault(),f(h||_.at(-1))},children:[(0,X.jsxs)(`label`,{className:`muted small`,children:[`Analyze again from`,` `,(0,X.jsx)(`select`,{"data-testid":`from-stage`,value:h||_.at(-1),onChange:e=>g(e.target.value),children:_.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),(0,X.jsx)(`button`,{type:`submit`,"data-command":`analyze-from`,"data-testid":`analyze-from`,title:`The stages before it are reused, when nothing they read has changed since the latest run`,children:`Run`})]}),(0,X.jsxs)(`p`,{className:`muted small hook-note`,children:[`A run for each commit: `,(0,X.jsx)(`code`,{children:`veoflow hook install`}),` in a repository.`]})]}):!x&&(0,X.jsx)(`p`,{className:`muted`,children:`Loading…`})]})}var JS=e=>e.startsWith(`sha256:`)?``:e.slice(0,7),YS=e=>e.split(`
333
+ `,` · `)},e.id))]}),(0,X.jsx)(`ul`,{className:`visually-hidden`,"aria-label":`Calls between files`,children:[...e.calls??[],...e.callStubEdges??[]].map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"data-command":`pick-node`,"data-link":!0,"data-id":e.id,tabIndex:-1,onClick:()=>n(e.id),children:[C(e.from),` calls `,C(e.to),`: `,e.calls,` calls, `,e.references,` references`]})},e.id))}),(0,X.jsx)(`button`,{className:`fit`,onClick:()=>u.current&&sS(u.current),children:`Fit`})]})}function sS(e){e.fit(void 0,30);let t=e.zoom();if(t>1.2)e.zoom(1.2),e.center();else if(t<.75){let t=e.elements().boundingBox();e.zoom(.75),e.pan({x:30-t.x1*.75,y:30-t.y1*.75})}}function cS(){return[{selector:`node`,style:{shape:`round-rectangle`,width:160,height:50,label:`data(label)`,"text-wrap":`wrap`,"text-max-width":`144px`,"text-valign":`center`,"text-halign":`center`,"font-size":12,color:Z(`gray-26`),"background-color":Z(`gray-100`),"border-width":1,"border-color":Z(`gray-86`)}},{selector:`node.box`,style:{width:`data(w)`,height:`data(h)`,"background-color":Z(`gray-98-5`),"border-color":Z(`blue-87`),"border-width":2,"text-valign":`top`,"text-halign":`center`,"text-margin-y":22,"font-weight":`bold`,color:Z(`blue-47`),events:`no`,"z-compound-depth":`bottom`,"z-index":0}},{selector:`node.folder`,style:{"background-color":Z(`gray-97-3`),"border-style":`double`,"border-width":3}},{selector:`node.broken`,style:{"border-color":Z(`amber-74`)}},{selector:`node.not-analyzed`,style:{color:Z(`gray-66`),"border-style":`dashed`}},{selector:`node.stub`,style:{width:180,height:46,"border-style":`dashed`,"border-color":Z(`blue-62`),color:Z(`gray-26`)}},{selector:`node.stub.packages`,style:{"border-color":Z(`gray-81`),color:Z(`gray-44`)}},{selector:`node.stub.broken`,style:{"border-color":Z(`amber-74`),"background-color":Z(`gray-99-3`),color:Z(`amber-43`)}},{selector:`node.stub.not-analyzed, node.stub.pending`,style:{"border-color":Z(`gray-81`),"background-color":Z(`gray-99`),color:Z(`gray-51-2`)}},{selector:`edge`,style:{width:1.5,"curve-style":`bezier`,"line-color":Z(`blue-70`),"target-arrow-shape":`triangle`,"target-arrow-color":Z(`blue-70`),"arrow-scale":.8,label:`data(label)`,"font-size":10,color:Z(`gray-51-2`),"text-background-color":Z(`gray-100`),"text-background-opacity":1}},{selector:`edge.out`,style:{"line-style":`dashed`,"line-color":Z(`blue-76`),"target-arrow-color":Z(`blue-76`)}},{selector:`edge.imports, edge.out:not(.calls)`,style:{opacity:.35,width:1}},{selector:`edge.calls`,style:{width:`data(width)`,"line-color":Z(`blue-49`),"target-arrow-color":Z(`blue-49`),"line-style":`solid`,opacity:1}},{selector:`edge.calls.out`,style:{"line-style":`dashed`,"line-color":Z(`blue-62`)}},{selector:`edge.out.broken`,style:{"line-color":Z(`amber-74`),"target-arrow-color":Z(`amber-74`)}},...Ze(),Ge,{selector:`node.picked`,style:{"border-width":2,"border-color":Z(`blue-56`),"background-color":Z(`gray-97`)}},{selector:`edge.picked`,style:{"line-color":Z(`blue-56`),"target-arrow-color":Z(`blue-56`),width:2.5}},{selector:`.faded`,style:{opacity:.3}}]}var lS=`veoflow.allCode`,uS=`veoflow-all-code`;function dS(){try{return localStorage.getItem(lS)===`1`}catch{return!1}}function fS(){let[e,t]=(0,y.useState)(dS);return(0,y.useEffect)(()=>{let e=()=>t(dS());return window.addEventListener(uS,e),()=>window.removeEventListener(uS,e)},[]),[e,e=>{try{localStorage.setItem(lS,e?`1`:`0`)}catch{}t(e),window.dispatchEvent(new Event(uS))}]}var pS=(0,y.createContext)(`declared`),mS=()=>(0,y.useContext)(pS),hS=new Map,gS=`veoflow-groups-forget`;function _S(){for(let e of[...hS.keys()])e.startsWith(`["groups"`)&&hS.delete(e);window.dispatchEvent(new Event(gS))}function vS(e,t,n){let r=hS.get(e);return r||(r=n(),hS.set(e,r),r.then(n=>n.committedRun!==t&&hS.delete(e),()=>hS.delete(e)),hS.size>40&&hS.delete(hS.keys().next().value)),r}function yS(e,t,n,r,i){let[a,o]=(0,y.useState)({key:null,data:null,error:null});return(0,y.useEffect)(()=>{if(e===null)return;let r=!1;return vS(e,t,n).then(t=>!r&&o({key:e,scope:i,data:t,error:null}),t=>!r&&o({key:e,scope:i,data:null,error:t.message})),()=>{r=!0}},[e,r]),a.key===e?a:i!==void 0&&a.scope===i&&a.data?{data:a.data,error:null}:{data:null,error:null}}function bS(e,t,n=0,r=null){let[i,a]=(0,y.useState)(0);(0,y.useEffect)(()=>{let e=()=>a(e=>e+1);return window.addEventListener(gS,e),()=>window.removeEventListener(gS,e)},[]);let o=mS(),{data:s,error:c}=yS(e?JSON.stringify([`groups`,e,t,r,o]):null,t,()=>Y.groups(e,r,o),`${n}:${i}`);return{groups:s,error:c}}function xS(e,t,n,r,i,a=0){let o=[...r].sort(),s=mS(),{data:c,error:l}=yS(e&&n?JSON.stringify([`group`,e,t,n,o,i,s]):null,t,()=>Y.group(e,n,o,i,s),a,JSON.stringify([e,t,n,s]));return{group:c,error:l}}function SS(e,t,n){let r=mS(),{data:i,error:a}=yS(e&&n?JSON.stringify([`imports`,e,t,n,r]):null,t,()=>Y.imports(e,n,r),0);return{imports:i,error:a}}function CS(e,t,n){let r=mS(),[i,a]=(0,y.useState)(new Map),[o,s]=(0,y.useState)([]),c=JSON.stringify([e,t,r]),[l,u]=(0,y.useState)(c);l!==c&&(u(c),a(new Map),s([]));let d=n.join(`\0`);return(0,y.useEffect)(()=>{if(!e)return;let i=!1;for(let o of n){let n=n=>JSON.stringify([n,e,t,o,r]);Promise.all([vS(n(`calls-out`),t,()=>Y.crossFileCalls(e,o,`out`)),vS(n(`imports`),t,()=>Y.imports(e,o,r))]).then(([e,t])=>{i||(a(n=>n.get(o)?.out===e?n:new Map(n).set(o,{out:e,imports:t})),s(e=>e.includes(o)?e.filter(e=>e!==o):e))},()=>!i&&s(e=>e.includes(o)?e:[...e,o]))}return()=>{i=!0}},[d,c]),{loaded:i,failed:o.filter(e=>n.includes(e))}}function wS(e,t,n,r){let{data:i,error:a}=yS(e&&n?JSON.stringify([`reach`,e,t,n,r]):null,t,()=>Y.reach(e,n,r),0);return{reach:i,error:a}}function TS(e,t,n){let{data:r,error:i}=yS(e&&n?JSON.stringify([`calls`,e,t,n]):null,t,()=>Promise.all([Y.crossFileCalls(e,n,`out`),Y.crossFileCalls(e,n,`in`)]).then(([e,t])=>({committedRun:e.committedRun,out:e,in:t})),0);return{calls:r,error:i}}var ES=null,DS=e=>({onMouseDown:e=>{ES={x:e.clientX,y:e.clientY}},onClick:t=>{let n=ES!==null&&Math.hypot(t.clientX-ES.x,t.clientY-ES.y)>3;ES=null;let r=window.getSelection();n&&r&&!r.isCollapsed&&t.currentTarget.contains(r.anchorNode)||e()}}),OS=(e,t)=>!t&&(e===null||e.kind===`source`),kS=100;function AS(e,t,n,r,i,a){let[o]=fS(),s=OS(n,o),c=mS(),l=a??c,u=JSON.stringify([e,n,r,s,l]),d=JSON.stringify([u,t,i]),[f,p]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(!e)return;let t=!1;return Y.findings(e,r.length?r:[`broken`],n?.kind===`file`?{file:n.file,own:s,grouping:l}:n?.kind===`group`?{group:n.group,own:s,grouping:l}:n?.kind===`source`?{source:n.source,own:s,grouping:l}:{own:s,grouping:l},r.length?1e3:1).then(e=>!t&&p({key:d,same:u,data:e,error:null}),e=>!t&&p({key:d,same:u,data:null,error:e.message})),()=>{t=!0}},[d]),!f||f.same!==u?{data:null,error:null}:{data:f.data,error:f.key===d?f.error:null}}function jS({project:e,run:t,scope:n,wholeProject:r,canScope:i,counts:a,showPending:o,refresh:s,filter:c,onFilter:l,onWholeProject:u,onTogglePending:d,onSelectSite:f,onOpenImport:p,onManageLicense:m}){let h=r?null:n,[g,_]=fS(),v=OS(h,g),b=mS(),x=c??(a&&a.broken>0?`broken`:`open-call`),S=[x,...o&&x!==`open-call`?[`pending`]:[]],{data:C,error:w}=AS(e,t,h,S,s),[T,E]=(0,y.useState)(null),D=C&&T?.after===C?T.rows:[],O=[...C?.findings??[],...D],[k,A]=(0,y.useState)(!1),[j,M]=(0,y.useState)(``),N=()=>{C&&(A(!0),M(``),Y.findings(e,S,h?.kind===`file`?{file:h.file,own:v,grouping:b}:h?.kind===`group`?{group:h.group,own:v,grouping:b}:h?.kind===`source`?{source:h.source,own:v,grouping:b}:{own:v,grouping:b},1e3,O.length).then(e=>E({after:C,rows:[...D,...e.findings]}),e=>M(e.message)).finally(()=>A(!1)))},{groups:P}=bS(e,t),F=(0,y.useMemo)(()=>new Map((P?.groups??[]).map(e=>[e.id,e])),[P]),I=e=>{let t=e.group?F.get(e.group):void 0,n=t&&t.kind!==`cluster`&&t.root&&e.path.startsWith(`${t.root}/`)?e.path.slice(t.root.length+1):e.path;return`${t?`${t.name} › `:``}${n}:${e.line}`},L=n?.kind===`group`?F.get(n.group)?.name??`this group`:``,R=i&&n&&(0,X.jsxs)(`div`,{className:`scope`,role:`group`,"aria-label":`Findings scope`,children:[(0,X.jsx)(`button`,{"aria-pressed":!r,onClick:()=>u(!1),"data-testid":`questions-scope-file`,children:n.kind===`file`?`This file`:n.kind===`group`?`This group (${L})`:`This repository (${n.name??n.source})`}),(0,X.jsx)(`button`,{"aria-pressed":r,onClick:()=>u(!0),"data-testid":`questions-scope-project`,children:`Whole project`})]}),z=(e,t,n)=>(0,X.jsxs)(`button`,{className:`chip`,"aria-pressed":x===e,"data-testid":`findings-filter-${e}`,"data-count":n??``,onClick:()=>l(e),children:[t,` `,(0,X.jsx)(`small`,{children:n??`…`})]},e),B=O.filter(e=>e.kind===x),V=O.filter(e=>e.kind===`pending`);return(0,X.jsxs)(`div`,{className:`findings-panel`,"data-testid":`findings-panel`,children:[(0,X.jsx)(We,{project:e,run:t,refresh:s,onManage:m}),R,(0,X.jsxs)(`div`,{className:`chips`,role:`group`,"aria-label":`Kinds of findings`,children:[z(`broken`,`Broken imports`,a?.broken),z(`not-analyzed`,`Imports not analyzed`,a?.notAnalyzed),z(`open-call`,`Open calls`,a?.openCalls)]}),(0,X.jsxs)(`label`,{className:`toggle small muted`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-command":`toggle-pending`,checked:o,onChange:d}),`Show pending (waiting for another source)`,a?` · ${a.pending}`:``]}),(h===null||h.kind===`source`)&&(0,X.jsxs)(`label`,{className:`toggle small muted`,title:`Own code first: findings in tests, installed libraries, generated output and tools' files are counted when this is on`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`findings-all-code`,checked:g,onChange:e=>_(e.target.checked)}),`Libraries and tests too`]}),w?(0,X.jsx)(`p`,{className:`hint error`,children:w}):C?x===`open-call`?(0,X.jsx)(FS,{rows:B,where:I,project:e,onSelect:f}):(0,X.jsxs)(X.Fragment,{children:[x===`not-analyzed`&&(!h||h.kind===`source`)&&(0,X.jsx)(LS,{project:e,run:t,source:h?.source??null,refresh:s}),(0,X.jsx)(NS,{rows:B,empty:x===`broken`?`No broken imports.`:`No imports of files left out of analysis.`,where:I,project:e,onOpen:p})]}):(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`}),C&&o&&x!==`open-call`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Pending (`,V.length,`)`]}),(0,X.jsx)(NS,{rows:V,empty:`Nothing waits for another source.`,where:I,project:e,onOpen:p})]}),C&&C.total>O.length&&(0,X.jsxs)(`p`,{className:`hint small`,"data-testid":`findings-truncated`,children:[`Showing `,O.length.toLocaleString(`en-US`),` of `,C.total.toLocaleString(`en-US`),`.`,` `,(0,X.jsx)(`button`,{className:`link`,"data-testid":`findings-more`,disabled:k,onClick:N,children:k?`Loading…`:`Show more`}),j&&(0,X.jsxs)(`span`,{className:`error`,children:[` `,j]})]})]})}function MS({project:e,id:t}){let[n,r]=(0,y.useState)(!1);return n?(0,X.jsx)(Re,{project:e,id:t,start:!0}):(0,X.jsx)(`button`,{className:`link small`,"data-command":`explain-finding`,onClick:()=>r(!0),children:`Explain`})}function NS({rows:e,empty:t,where:n,project:r,onOpen:i}){let[a,o]=(0,y.useState)(kS);return e.length===0?(0,X.jsx)(`p`,{className:`hint`,children:t}):(0,X.jsxs)(`ul`,{className:`questions finding-rows`,"data-testid":`finding-rows`,children:[e.slice(0,a).map(e=>(0,X.jsxs)(`li`,{"data-kind":e.kind,children:[(0,X.jsx)(`div`,{className:`qrow`,children:(0,X.jsxs)(`button`,{"data-command":`open-finding`,"data-id":e.id,...DS(()=>i(e.file,e.id,e.group)),children:[(0,X.jsx)(`code`,{children:e.text}),(0,X.jsxs)(`small`,{children:[n(e),` · `,eS[e.reason]??e.reason,PS(e)]})]})}),(0,X.jsx)(MS,{project:r,id:e.id})]},e.id)),e.length>a&&(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link`,onClick:()=>o(a+kS),children:[e.length-a,` more…`]})})]})}function PS(e){let t=e.impact;return!t||t.opens<=1?``:` · opens ${`${t.atLeast?`at least `:``}${t.opens} function${t.opens===1?``:`s`}`}${t.groups>1?` in ${t.groups} groups`:``}${t.shared?`, shared with ${t.shared} more`:``}`}function FS({rows:e,where:t,project:n,onSelect:r}){let[i,a]=(0,y.useState)(kS),[o,s]=(0,y.useState)(null),c=(0,y.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.text);e?e.push(n):t.set(n.text,[n])}let n=e=>Math.max(0,...e.map(e=>e.impact?.opens??0)),r=e=>Number(e.every(e=>e.mayBe?.projectFunctions===0));return[...t].sort(([e,t],[i,a])=>r(t)-r(a)||n(a)-n(t)||a.length-t.length||(e<i?-1:+(e>i)))},[e]),l=e=>e.id.startsWith(`resolution|`)?e.id.slice(11):e.id;return e.length===0?(0,X.jsx)(`p`,{className:`hint`,children:`No open calls.`}):(0,X.jsxs)(`ul`,{className:`questions`,"data-testid":`questions`,children:[c.slice(0,i).map(([e,i])=>{let a=i[0],c=new Set(i.map(e=>e.file)).size,u=i.length===1?t(a):`×${i.length}${c>1?` in ${c} files`:``}`;return(0,X.jsxs)(`li`,{children:[(0,X.jsxs)(`div`,{className:`qrow`,children:[(0,X.jsxs)(`button`,{"data-command":`select`,"data-kind":`site`,"data-count":i.length,title:e,...DS(()=>r(l(a),a.file)),children:[(0,X.jsx)(`code`,{children:e}),(0,X.jsxs)(`small`,{children:[u,` ·`,` `,a.candidates?a.exhaustive===!1?`${a.candidates} known function${a.candidates===1?``:`s`}, may not be all`:a.candidates===1?`one possible function`:`one of ${a.candidates} functions`:d(a.reason),a.mayBe&&(0,X.jsxs)(`span`,{className:`may-be-builtin`,title:`Its receiver's type isn't known; ${a.mayBe.builtins.join(` or `)} is the standard library's${a.mayBe.projectFunctions?`, and ${a.mayBe.projectFunctions} of the project's functions share the name`:``}`,children:[` `,`· may be `,a.mayBe.builtins[0],a.mayBe.builtins.length>1?`…`:``]}),PS(i.reduce((e,t)=>(t.impact?.opens??0)>(e.impact?.opens??0)?t:e))]})]}),i.length>1&&(0,X.jsx)(`button`,{className:`icon expand`,"aria-expanded":o===e,"aria-label":`Show all ${i.length}`,onClick:()=>s(o===e?null:e),children:o===e?`▾`:`▸`})]}),i.length===1&&(0,X.jsx)(MS,{project:n,id:a.id}),o===e&&(0,X.jsx)(`ul`,{className:`occurrences`,children:i.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`button`,{"data-command":`select`,"data-kind":`site`,...DS(()=>r(l(e),e.file)),children:t(e)}),(0,X.jsx)(MS,{project:n,id:e.id})]},e.id))})]},e)}),c.length>i&&(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link`,onClick:()=>a(i+kS),children:[c.length-i,` more…`]})})]})}var IS={"language-not-analyzed":`language not analyzed yet`,"declaration-file":`type declarations`,"too-large":`over the size limit`,minified:`minified`,binary:`not text`,"invalid-utf8":`not UTF-8`,unreadable:`unreadable`,entitlement:`beyond the license`,frozen:`kept from an earlier analysis`,"parse-failure":`could not be parsed`,"internal-error":`the extractor failed`};function LS({project:e,run:t,source:n,refresh:r}){let i=`${e}|${t??``}|${n??``}`,[a,o]=(0,y.useState)(null);(0,y.useEffect)(()=>{let t=!1;return Y.totals(e,0,n??void 0).then(e=>!t&&o({key:i,files:e.files}),()=>!t&&o(null)),()=>{t=!0}},[i,r]);let s=a?.key===i?a.files:null,c=s?.notAnalyzed.reduce((e,t)=>e+t.files,0)??0;if(!s||c===0)return null;let l=e=>e.toLocaleString(`en-US`);return(0,X.jsxs)(`p`,{className:`small muted`,"data-testid":`unanalyzed-files`,children:[l(c),` of `,l(s.listed),` files aren't analyzed:`,` `,s.notAnalyzed.map(e=>`${l(e.files)} ${IS[e.reason]??e.reason}`).join(`, `),`. They're marked ⚠ in the file tree; below are imports that lead to such files.`]})}function RS(e,t,n=0){let r=e&&t?`${e}|${t.a}|${t.b}`:null,[i,a]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(!r||!e||!t)return;let n=!1;return Y.diff(e,t.a,t.b).then(e=>!n&&a({key:r,data:e,error:null}),e=>!n&&a({key:r,data:null,error:e.message})),()=>{n=!0}},[r,n]),i&&i.key===r?{data:i.data,error:i.error}:{data:null,error:null}}var zS={added:`+`,removed:`−`,changed:`~`},BS={added:`added`,removed:`removed`,changed:`changed`};function VS(e){let t=e.fact,n=e=>String(e??``).slice(String(e??``).lastIndexOf(`:`)+1);switch(e.type){case`Function`:return`function ${String(t.qualifiedName??t.name??n(e.id))}`;case`File`:return`file ${String(t.path??e.id)}`;case`CALLS`:case`CALLS_CROSS_FILE`:return`call ${n(t.from)} → ${n(t.to)}`;case`IMPORTS`:return`import ${String(t.specifier??``)}`;case`UnresolvedImport`:return`import ${String(t.specifier??``)} (${String(t.outcome??``)}${t.reason?`: ${String(t.reason)}`:``})`;case`UnresolvedCallSite`:return`open call ${String(t.expression??``)}`;case`SiteResolution`:return`call ${String(t.site??``).split(`|`)[3]??``} (${String(t.status??``)})`;case`Group`:return`group ${String(t.name??e.id)}`;case`DEPENDS_ON`:return`dependency ${String(t.from??``)} → ${String(t.to??``)}`;case`ExternalPackage`:return`package ${String(t.name??e.id)}`;case`Finding`:return`finding: ${String(t.message??t.kind??``)}`;default:return`${e.type} ${e.id}`}}function HS(e){let t=[];for(let[n,r]of Object.entries({Function:`functions`,File:`files`,IMPORTS:`imports`,CALLS:`calls`,CALLS_CROSS_FILE:`cross-file calls`,UnresolvedImport:`unresolved imports`})){let i=e.byType[n];if(!i||i.added+i.removed+i.changed===0)continue;let a=[i.added?`+${i.added}`:``,i.removed?`−${i.removed}`:``,i.changed?`${i.changed} changed`:``].filter(Boolean);t.push(`${a.join(`, `)} ${r}`)}let{added:n,removed:r,changed:i}=e.total;return t.length?t.join(` · `):n+r+i===0?`No changes`:`${n+r+i} changes`}function US(e,t){return e.type===`ExternalPackage`?!1:e.change===`removed`?e.file!==null&&e.type!==`File`&&!t.has(e.file):e.file!==null||e.type===`Group`||e.type===`DEPENDS_ON`}var WS=e=>e.startsWith(`sha256:`)?`folder`:e.slice(0,7),GS=e=>e?new Date(e).toLocaleString():``;function KS({run:e,previous:t,picked:n,viewing:r,onPick:i,onView:a}){let o=e.sources.filter(e=>!e.pinned),s=new Map((t?.sources??[]).map(e=>[e.sourceId,e.revision])),c=o.length?o:e.sources,l=t&&c.length>1?c.filter(e=>s.get(e.sourceId)!==e.revision):c,u=e=>[...e.reduce((e,t)=>{let n=`${WS(t.revision)}${t.branch?` (${t.branch})`:``}`;return e.set(n,[...e.get(n)??[],t.sourceId]),e},new Map).entries()].map(([e,t])=>`${t.join(`, `)} @ ${e}`),d=u(l),f=u(c).join(` · `),p=new Set(c.map(e=>e.revision)).size,m=l.length===0?`${p} repositories, none changed`:d.length>3?`${d.slice(0,3).join(` · `)} · +${d.length-3} more`:d.join(` · `),h=l.length>0&&l.length<c.length?`${l.length} of ${c.length} changed: `:``;return(0,X.jsxs)(`li`,{className:`run-row${r?` viewing`:``}`,"data-run":e.runId,children:[(0,X.jsx)(`label`,{className:`pick`,children:(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`compare-pick`,checked:n,onChange:e=>i(e.target.checked),"aria-label":`Compare run ${e.runId}`})}),(0,X.jsxs)(`span`,{className:`what`,children:[(0,X.jsxs)(`span`,{className:`title`,children:[(0,X.jsxs)(`strong`,{children:[`Run `,e.runId]}),e.current?(0,X.jsx)(`span`,{className:`badge`,children:`latest`}):null,e.kind===`branch`?(0,X.jsx)(`span`,{className:`badge`,children:`branch`}):null,e.kind===`draft`?(0,X.jsx)(`span`,{className:`badge`,children:`draft`}):null,e.kind===`debug`?(0,X.jsxs)(`span`,{className:`badge`,"data-testid":`debug-badge`,children:[`debug · until `,e.until]}):null]}),(0,X.jsxs)(`span`,{className:`commits`,title:f||void 0,children:[h,m||`no sources`]}),(0,X.jsxs)(`span`,{className:`muted small`,children:[e.reused?.length?(0,X.jsx)(`span`,{"data-testid":`run-reused`,children:`${e.reused.join(`, `)} reused · `}):null,e.trigger===`commit`?`commit hook`:e.trigger,` · +`,e.written.toLocaleString(`en-US`),` / −`,e.closed.toLocaleString(`en-US`),` facts · `,GS(e.finishedAt)]})]}),(0,X.jsx)(`button`,{className:`link`,"data-command":`open-run`,onClick:a,disabled:r,children:r?`Viewing`:`View`})]})}function qS({project:e,refresh:t,run:n,compare:r,diff:i,diffError:a,onView:o,onCompare:s,onClose:c,onLocate:l,stages:u=[],onDebug:d,onFrom:f}){let[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(``),_=u.slice(1),[v,b]=(0,y.useState)(null),[x,S]=(0,y.useState)(null),[C,w]=(0,y.useState)(r?[r.a,r.b]:[]);(0,y.useEffect)(()=>{r&&w([r.a,r.b])},[r?.a,r?.b]);let[T,E]=(0,y.useState)(``);(0,y.useEffect)(()=>{let t=!1;return Y.history(e).then(e=>!t&&(b(e),S(null)),e=>!t&&S(e.message)),()=>{t=!0}},[e,t]);let D=(e,t)=>w(n=>t?[...n.filter(t=>t!==e),e].slice(-2):n.filter(t=>t!==e)),O=C.length===2?{a:Math.min(...C),b:Math.max(...C)}:null,k=(0,y.useMemo)(()=>new Set((i?.items??[]).filter(e=>e.type===`File`&&e.change===`removed`).map(e=>e.id)),[i]),A=(0,y.useMemo)(()=>{if(!i)return[];let e=T.trim().toLowerCase(),t=new Map(i.files.map(e=>[e.file??`\0${e.source}`,e.group?.name??e.source])),n=new Map;for(let r of i.items){let i=VS(r);if(e&&!`${i} ${r.file??``} ${r.type}`.toLowerCase().includes(e))continue;let a=r.file??`\0${r.source}`,o=t.get(a)??r.source,s=n.get(o);s||n.set(o,s=new Map);let c=s.get(a);c||s.set(a,c=[]),c.push({item:r,words:i})}return[...n].sort(([e],[t])=>e<t?-1:1)},[i,T]);return(0,X.jsxs)(`div`,{className:`history-panel`,"data-testid":`history-panel`,children:[(0,X.jsxs)(`div`,{className:`history-head`,children:[(0,X.jsx)(`strong`,{children:`History`}),(0,X.jsx)(`button`,{className:`icon`,"data-command":`toggle-history`,"aria-label":`Close History`,onClick:c,children:`×`})]}),r?(0,X.jsxs)(`section`,{className:`changes`,"aria-label":`Changes`,"data-testid":`change-list`,children:[(0,X.jsxs)(`div`,{className:`compare-head`,children:[(0,X.jsxs)(`span`,{children:[`Changes from run `,r.a,` to run `,r.b]}),(0,X.jsx)(`button`,{className:`link`,"data-command":`compare-runs`,onClick:()=>s(null),children:`Stop comparing`})]}),a?(0,X.jsx)(`p`,{className:`error`,children:a}):i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`summary`,"data-testid":`change-summary`,children:HS(i)}),(0,X.jsxs)(`p`,{className:`legend muted small`,children:[`On the canvas:`,` `,(0,X.jsxs)(`span`,{className:`change added`,children:[(0,X.jsx)(`span`,{className:`sign`,children:`+`}),`added`]}),` `,`(solid blue border),`,` `,(0,X.jsxs)(`span`,{className:`change removed`,children:[(0,X.jsx)(`span`,{className:`sign`,children:`−`}),`removed`]}),` `,`(dashed orange),`,` `,(0,X.jsxs)(`span`,{className:`change changed`,children:[(0,X.jsx)(`span`,{className:`sign`,children:`~`}),`changed`]}),` `,`(double purple).`]}),i.latestOnly.length>0&&(0,X.jsxs)(`p`,{className:`muted small`,children:[`Not compared (plain folders have no history): `,i.latestOnly.join(`, `)]}),(0,X.jsx)(`input`,{type:`search`,className:`filter`,placeholder:`Filter changes`,"aria-label":`Filter changes`,"data-testid":`change-filter`,value:T,onChange:e=>E(e.target.value)}),A.map(([e,t])=>(0,X.jsxs)(`div`,{className:`change-group`,children:[(0,X.jsx)(`h4`,{children:e}),[...t].map(([e,t])=>(0,X.jsxs)(`div`,{className:`change-file`,children:[(0,X.jsx)(`div`,{className:`file-name`,children:e.startsWith(`\0`)?`(the repository)`:e.slice(e.indexOf(`:`)+1)}),(0,X.jsx)(`ul`,{children:t.map(({item:e,words:t})=>{let n=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sign`,"aria-hidden":`true`,children:zS[e.change]}),(0,X.jsxs)(`span`,{className:`visually-hidden`,children:[BS[e.change],`: `]}),t]});return(0,X.jsx)(`li`,{className:`change ${e.change}`,children:US(e,k)?(0,X.jsx)(`button`,{className:`link`,"data-testid":`change-item`,"data-id":e.id,"data-change":e.change,onClick:()=>l(e),children:n}):(0,X.jsx)(`span`,{"data-testid":`change-item`,"data-id":e.id,"data-change":e.change,children:n})},`${e.change}:${e.id}`)})})]},e))]},e)),i.truncated&&(0,X.jsxs)(`p`,{className:`muted small`,children:[`The first `,i.items.length,` of`,` `,i.total.added+i.total.removed+i.total.changed,` changes are listed.`]})]}):(0,X.jsx)(`p`,{className:`muted`,children:`Comparing…`})]}):null,x?(0,X.jsx)(`p`,{className:`error`,children:x}):null,v?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`compare-bar`,children:[(0,X.jsx)(`button`,{"data-command":`compare-runs`,disabled:!O,onClick:()=>O&&s(O),title:`Pick two runs to compare`,children:O?`Compare run ${O.a} with run ${O.b}`:`Pick two runs to compare`}),n!==null&&(0,X.jsx)(`button`,{className:`link`,"data-command":`open-run`,onClick:()=>o(null),children:`Back to latest`})]}),(0,X.jsxs)(`ol`,{className:`runs`,"aria-label":`Runs`,children:[v.draft&&(0,X.jsx)(KS,{run:v.draft,picked:C.includes(v.draft.runId),viewing:n===v.draft.runId,onPick:e=>D(v.draft.runId,e),onView:()=>o(v.draft.runId)}),v.debug&&(0,X.jsx)(KS,{run:v.debug,picked:C.includes(v.debug.runId),viewing:n===v.debug.runId,onPick:e=>D(v.debug.runId,e),onView:()=>o(v.debug.runId)}),v.runs.map((e,t)=>(0,X.jsx)(KS,{run:e,previous:v.runs[t+1],picked:C.includes(e.runId),viewing:n===null?e.current:n===e.runId,onPick:t=>D(e.runId,t),onView:()=>o(e.current?null:e.runId)},e.runId))]}),v.hidden>0&&(0,X.jsxs)(`p`,{className:`muted small`,children:[v.hidden,` older runs aren't shown: this license shows 30 days of history.`]}),v.latestOnly.length>0&&(0,X.jsxs)(`p`,{className:`muted small`,children:[`Not under version control, so latest only: `,v.latestOnly.join(`, `),`. History and diffs need git.`]}),d&&u.length>0&&v.runs.length>0&&(0,X.jsxs)(`form`,{className:`debug-run`,onSubmit:e=>{e.preventDefault(),d(p||u[0])},children:[(0,X.jsxs)(`label`,{className:`muted small`,children:[`Debug run: stop after`,` `,(0,X.jsx)(`select`,{"data-testid":`debug-until`,value:p||u[0],onChange:e=>m(e.target.value),children:u.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),(0,X.jsx)(`button`,{type:`submit`,"data-command":`analyze-debug`,"data-testid":`analyze-debug`,title:`Never committed: open it and compare it with the latest`,children:`Run`})]}),f&&_.length>0&&v.runs.length>0&&(0,X.jsxs)(`form`,{className:`debug-run`,onSubmit:e=>{e.preventDefault(),f(h||_.at(-1))},children:[(0,X.jsxs)(`label`,{className:`muted small`,children:[`Analyze again from`,` `,(0,X.jsx)(`select`,{"data-testid":`from-stage`,value:h||_.at(-1),onChange:e=>g(e.target.value),children:_.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),(0,X.jsx)(`button`,{type:`submit`,"data-command":`analyze-from`,"data-testid":`analyze-from`,title:`The stages before it are reused, when nothing they read has changed since the latest run`,children:`Run`})]}),(0,X.jsxs)(`p`,{className:`muted small hook-note`,children:[`A run for each commit: `,(0,X.jsx)(`code`,{children:`veoflow hook install`}),` in a repository.`]})]}):!x&&(0,X.jsx)(`p`,{className:`muted`,children:`Loading…`})]})}var JS=e=>e.startsWith(`sha256:`)?``:e.slice(0,7),YS=e=>e.split(`
334
334
  `).map(e=>e.trim()).filter(Boolean);function XS({source:e,onSave:t,onCancel:n}){let[r,i]=(0,y.useState)(e.include.join(`
335
335
  `)),[a,o]=(0,y.useState)(e.exclude.join(`
336
- `));return(0,X.jsxs)(`form`,{className:`rules-editor`,"data-testid":`rules-editor`,onSubmit:e=>{e.preventDefault(),t({include:YS(r),exclude:YS(a)})},children:[(0,X.jsxs)(`p`,{className:`muted small`,children:[`Glob patterns, one per line, relative to the repository (`,(0,X.jsx)(`code`,{children:`src/legacy/`}),`,`,` `,(0,X.jsx)(`code`,{children:`**/*.test.ts`}),`). Applied at the next analysis; files left out are closed in the graph and kept in history.`]}),(0,X.jsxs)(`label`,{children:[`Include only`,(0,X.jsx)(`textarea`,{"data-testid":`rules-include`,value:r,onChange:e=>i(e.target.value)})]}),(0,X.jsxs)(`label`,{children:[`Leave out`,(0,X.jsx)(`textarea`,{"data-testid":`rules-exclude`,value:a,onChange:e=>o(e.target.value)})]}),(0,X.jsxs)(`div`,{className:`actions`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`}),(0,X.jsx)(`button`,{type:`submit`,className:`primary`,"data-testid":`rules-save`,children:`Save and re-analyze`})]})]})}function ZS({project:e,refresh:t,onAdd:n,onChooseFiles:r,onAnalyzeAll:i,onChanged:a,escape:o}){let[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(``),[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(null),[h,g]=(0,y.useState)(``),[_,v]=(0,y.useState)(null),[b,x]=(0,y.useState)(null),[S,C]=(0,y.useState)(null),[w,T]=(0,y.useState)({top:0,right:0}),[E,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(0);(0,y.useEffect)(()=>{let t=!1;return Y.sources(e).then(e=>!t&&c(e.sources.map(e=>({...e,optIn:e.optIn??[]}))),e=>!t&&u(e.message)),()=>{t=!0}},[e,t,O]);let A=async(e,t,n)=>{D(!0),u(``),n&&f(n);try{await e(),f(t),a()}catch(e){f(``),u(e.message??String(e))}finally{D(!1),k(e=>e+1)}},j=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(!S)return;j.current?.querySelector(`button`)?.focus();let e=e=>{e.type===`mousedown`&&j.current?.contains(e.target)||C(null)};return document.addEventListener(`mousedown`,e),window.addEventListener(`resize`,e),document.addEventListener(`scroll`,e,!0),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`resize`,e),document.removeEventListener(`scroll`,e,!0)}},[S]),o.current=()=>{if(S){let e=S;return C(null),document.querySelector(`tr[data-source="${CSS.escape(e)}"] [data-testid="repo-more"]`)?.focus(),!0}return p?(m(null),!0):b?(x(null),!0):_?(v(null),!0):!1};let M=(0,y.useRef)(null);if((0,y.useEffect)(()=>{(_||b)&&(M.current?.scrollIntoView({block:`nearest`}),M.current?.querySelector(`textarea, button`)?.focus())},[_,b]),(0,y.useEffect)(()=>{s&&(_&&!s.some(e=>e.id===_)&&v(null),b&&!s.some(e=>e.id===b)&&x(null))},[s,_,b]),!s)return(0,X.jsx)(`p`,{className:l?`error`:`muted`,children:l||`Loading…`});let N=_?s.find(e=>e.id===_):void 0;return(0,X.jsxs)(`div`,{className:`repositories`,"data-testid":`repositories`,children:[(0,X.jsxs)(`div`,{className:`repo-actions`,children:[(0,X.jsx)(`button`,{"data-testid":`repo-add`,onClick:n,children:`+ Add folder`}),(0,X.jsx)(`button`,{"data-testid":`repo-analyze-all`,disabled:E,onClick:i,children:`Re-analyze all`})]}),l&&(0,X.jsx)(`p`,{className:`error`,role:`alert`,children:l}),d&&(0,X.jsx)(`p`,{className:`muted small`,role:`status`,"data-testid":`repo-status`,children:d}),(0,X.jsxs)(`table`,{className:`repo-table`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{children:`Repository`}),(0,X.jsx)(`th`,{children:`Branch and commit`}),(0,X.jsx)(`th`,{children:`Analyzed`}),(0,X.jsx)(`th`,{children:`Files`}),(0,X.jsx)(`th`,{children:`Left out`}),(0,X.jsx)(`th`,{children:(0,X.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,X.jsx)(`tbody`,{children:s.map(t=>{let n=t.analysis,i=t.include.length+t.exclude.length;return(0,X.jsxs)(`tr`,{"data-source":t.id,children:[(0,X.jsxs)(`td`,{children:[p===t.id?(0,X.jsx)(`form`,{onSubmit:n=>{n.preventDefault(),m(null),A(()=>Y.updateSource(e,t.id,{name:h}),`Renamed ${t.id} to ${h||t.id}.`)},onBlur:e=>!e.currentTarget.contains(e.relatedTarget)&&m(null),children:(0,X.jsx)(`input`,{autoFocus:!0,"aria-label":`New name for ${t.id}`,"data-testid":`repo-name`,value:h,onChange:e=>g(e.target.value)})}):(0,X.jsx)(`strong`,{className:`repo-name`,children:t.name??t.id}),(0,X.jsx)(`div`,{className:`muted small path`,children:t.root}),n?.notices.map(e=>(0,X.jsx)(`div`,{className:`notice-line small`,children:e},e))]}),(0,X.jsx)(`td`,{className:`mono small`,children:n?n.kind===`plain`?`plain folder (latest only)`:`${n.branch??`detached`} · ${JS(n.revision)}${n.pinned?` (kept)`:``}`:`not analyzed yet`}),(0,X.jsx)(`td`,{className:`small`,children:n?we(n.analyzedAt):``}),(0,X.jsx)(`td`,{className:`small`,children:n?n.files:``}),(0,X.jsx)(`td`,{className:`small`,children:i?`${i} rule${i===1?``:`s`}`:`defaults`}),(0,X.jsxs)(`td`,{className:`row-actions`,children:[(0,X.jsx)(`button`,{className:`link`,"data-testid":`repo-analyze`,"aria-label":`Re-analyze ${t.name??t.id}`,disabled:E,onClick:()=>void A(()=>Y.analyzeSource(e,t.id),`Analyzing ${t.name??t.id} again (the others stay at their commits)…`,`Starting an analysis of ${t.name??t.id}…`),children:`Re-analyze`}),(0,X.jsx)(`button`,{className:`link`,"data-testid":`repo-choose`,"aria-label":`Choose files in ${t.name??t.id}`,onClick:()=>r(t.id),children:`Choose files…`}),(0,X.jsxs)(`span`,{className:`menu-wrap`,children:[(0,X.jsx)(`button`,{className:`icon`,"aria-label":`More for ${t.name??t.id}`,"aria-expanded":S===t.id,"data-testid":`repo-more`,disabled:E,onClick:e=>{let n=e.currentTarget.getBoundingClientRect();T({top:n.bottom+2,right:window.innerWidth-n.right}),C(S===t.id?null:t.id)},children:`⋯`}),S===t.id&&(0,X.jsxs)(`span`,{className:`menu`,role:`menu`,ref:j,style:{top:w.top,right:w.right},children:[(0,X.jsx)(`button`,{role:`menuitem`,"data-testid":`repo-rename`,onClick:()=>{C(null),g(t.name??t.id),m(t.id)},children:`Rename`}),(0,X.jsx)(`button`,{role:`menuitem`,"data-testid":`repo-rules`,onClick:()=>{C(null),v(t.id)},children:`Edit rules`}),(0,X.jsx)(`button`,{role:`menuitem`,"data-testid":`repo-remove`,onClick:()=>{C(null),x(t.id)},children:`Remove…`})]})]})]})]},t.id)})})]}),s.length===0&&(0,X.jsx)(`p`,{className:`muted`,children:`No repositories yet: + Add folder adds one.`}),N&&(0,X.jsx)(`div`,{ref:M,children:(0,X.jsx)(XS,{source:N,onCancel:()=>v(null),onSave:t=>{let n=N.id;v(null),A(async()=>{await Y.updateSource(e,n,t),await Y.analyzeSource(e,n)},`Rules saved; analyzing ${n} again…`)}},N.id)}),b&&(0,X.jsxs)(`div`,{className:`confirm`,role:`alertdialog`,"aria-labelledby":`remove-title`,"data-testid":`repo-remove-confirm`,children:[(0,X.jsx)(`p`,{id:`remove-title`,children:(0,X.jsxs)(`strong`,{children:[`Remove `,s.find(e=>e.id===b)?.name??b,` from this project?`]})}),(0,X.jsx)(`p`,{className:`muted small`,children:`Its files and links leave the current graph. History keeps the analysis: earlier runs still show it, and adding the folder again analyzes it afresh. The folder itself is not touched.`}),(0,X.jsxs)(`div`,{className:`actions`,children:[(0,X.jsx)(`button`,{onClick:()=>x(null),"data-testid":`repo-remove-cancel`,children:`Cancel`}),(0,X.jsx)(`button`,{className:`danger`,"data-testid":`repo-remove-yes`,disabled:E,onClick:()=>{let t=b;x(null),A(()=>Y.removeSource(e,t),`Removed ${t}; history keeps its analysis.`,`Removing ${t} (a run closes its facts)…`)},children:`Remove`})]})]})]})}function QS({project:e}){let[t,n]=(0,y.useState)(``),[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(null);return(0,y.useEffect)(()=>{Y.projectSettings(e).then(e=>{n(String(e.settings.maxFileMB)),i(e.settings.closedWorld)},e=>o({ok:!1,text:e.message}))},[e]),(0,X.jsxs)(`form`,{className:`analysis-settings`,onSubmit:n=>{n.preventDefault();let i=Number(t);if(!(i>0&&i<=64))return o({ok:!1,text:`The size limit is more than 0 and at most 64 MB.`});Y.saveProjectSettings(e,{maxFileMB:i,closedWorld:r}).then(e=>o({ok:!0,text:`Saved: files over ${e.settings.maxFileMB} MB are left out at the next analysis${e.settings.closedWorld?`, which treats the analyzed code as the whole program`:``}.`}),e=>o({ok:!1,text:e.message}))},children:[(0,X.jsxs)(`label`,{children:[`Size limit per file (MB)`,(0,X.jsx)(`input`,{type:`number`,min:.1,max:64,step:.1,required:!0,"data-testid":`analysis-max-mb`,value:t,onChange:e=>n(e.target.value)})]}),(0,X.jsxs)(`p`,{className:`muted small`,children:[`Larger files are listed but not analyzed, unless you choose them in Choose files. Folders of installed libraries, generated output and tools' workspaces (`,(0,X.jsx)(`code`,{children:`node_modules`}),`, `,(0,X.jsx)(`code`,{children:`dist`}),`,`,` `,(0,X.jsx)(`code`,{children:`build`}),`, …) are left out by default; Choose files shows them and can add them.`]}),(0,X.jsxs)(`label`,{className:`checkbox`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`analysis-closed-world`,checked:r,onChange:e=>i(e.target.checked)}),`Treat the analyzed code as the whole program (closed world)`]}),(0,X.jsx)(`p`,{className:`muted small`,children:`For an application, not a library: the callers of a function and the classes of a type that analysis sees are taken to be all there are, so more calls are linked. Each link this settles says “closed world”. Off by default.`}),(0,X.jsx)(`button`,{type:`submit`,className:`primary`,"data-testid":`analysis-save`,children:`Save`}),a&&(0,X.jsx)(`p`,{className:a.ok?`muted small`:`error`,role:a.ok?`status`:`alert`,children:a.text})]})}function $S({project:e,projectName:t,refresh:n,onClose:r,onAdd:i,onChooseFiles:a,onAnalyzeAll:o,onChanged:s,covered:c=!1,initialTab:l=`repositories`}){let[u,d]=(0,y.useState)(l),f=(0,y.useRef)(null),p=(0,y.useRef)(null),m=(0,y.useRef)(null);return(0,y.useEffect)(()=>{let e=document.activeElement;return p.current?.focus(),()=>e?.focus?.()},[]),(0,y.useEffect)(()=>{if(c)return;let e=e=>{if(e.key===`Escape`)e.stopPropagation(),m.current?.()||r();else if(e.key===`Tab`&&f.current){let t=[...f.current.querySelectorAll(`button:not([disabled]), input, textarea, select`)],n=t[0],r=t[t.length-1];f.current.contains(document.activeElement)?e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus()):(e.preventDefault(),n?.focus())}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[c,r]),(0,X.jsx)(`div`,{className:`backdrop`,onMouseDown:e=>e.target===e.currentTarget&&r(),children:(0,X.jsxs)(`div`,{className:`modal wide`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`project-settings-title`,"data-testid":`project-settings-dialog`,ref:f,children:[(0,X.jsxs)(`div`,{className:`modal-head`,children:[(0,X.jsxs)(`h2`,{id:`project-settings-title`,children:[t,`: settings`]}),(0,X.jsx)(`button`,{className:`icon`,"aria-label":`Close`,onClick:r,ref:p,children:`×`})]}),(0,X.jsx)(`div`,{className:`segmented`,role:`tablist`,"aria-label":`Project settings`,children:[`repositories`,`analysis`,`license`].map(e=>(0,X.jsx)(`button`,{role:`tab`,"aria-selected":u===e,"data-testid":`project-tab-${e}`,onClick:()=>d(e),children:e===`repositories`?`Repositories`:e===`analysis`?`Analysis`:`License`},e))}),u===`repositories`?(0,X.jsx)(ZS,{project:e,refresh:n,onAdd:i,onChooseFiles:a,onAnalyzeAll:o,onChanged:s,escape:m}):u===`analysis`?(0,X.jsx)(QS,{project:e}):(0,X.jsx)(Ue,{onChanged:s})]})})}var eC={library:`installed library code`,generated:`generated or built output`,tool:`a tool's or coding agent's workspace (settings, history, worktrees)`};function tC(e){return e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}var nC=(e,t)=>`${e}\0${t}`,rC=(e,t)=>JSON.stringify([e.include,e.exclude,e.optIn??[]])===JSON.stringify([t?.include??[],t?.exclude??[],t?.optIn??[]]);function iC({project:e,files:t,run:n,onAnalyze:r,onClose:i,only:a,at:o}){let[s,c]=(0,y.useState)([]),[l,u]=(0,y.useState)(new Map),[d,f]=(0,y.useState)(new Set),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(!1),[b,x]=(0,y.useState)(new Map),[S,C]=(0,y.useState)(new Map),[w,T]=(0,y.useState)(null),[E,D]=(0,y.useState)(``),O=(0,y.useRef)(new Set),k=s.length>1,A=(0,y.useCallback)(e=>n?.sources.find(t=>t.sourceId===e),[n]),j=(0,y.useCallback)(async(t,n)=>{let{entries:r}=await Y.browse(e,t,n);O.current.add(nC(t,n)),u(e=>new Map(e).set(nC(t,n),r))},[e]),M=(0,y.useCallback)(async()=>{await Promise.all([...O.current].map(e=>{let[t,n]=e.split(`\0`);return j(t,n).catch(()=>O.current.delete(e))}))},[j]);(0,y.useEffect)(()=>{let t=!1;return(async()=>{try{let[{sources:n},{settings:r}]=await Promise.all([Y.sources(e),Y.projectSettings(e)]);if(t)return;let i=n.map(e=>({...e,optIn:e.optIn??[]})).filter(e=>a===void 0||e.id===a);c(i),T(r.maxFileMB),D(String(r.maxFileMB)),await Promise.all(i.map(e=>j(e.id,``)))}catch(e){t||m(e.message??String(e))}})(),()=>{t=!0}},[e,j,a]),(0,y.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(h?g(null):i())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h,i]),(0,y.useEffect)(()=>{if(!o||!a||s.length===0)return;let e=o.split(`/`).filter(Boolean),t=e.slice(0,-1).map((t,n)=>e.slice(0,n+1).join(`/`));f(e=>new Set([...e,...t.map(e=>nC(a,e))])),Promise.all(t.filter(e=>!O.current.has(nC(a,e))).map(e=>j(a,e))).then(()=>requestAnimationFrame(()=>document.querySelector(`.picker-row[data-path="${CSS.escape(o)}"]`)?.scrollIntoView({block:`center`})),e=>m(e.message))},[o,a,s.length,j]);let N=(e,t)=>{let n=nC(e,t);f(e=>{let t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t}),O.current.has(n)||j(e,t).catch(e=>m(e.message))},P=(0,y.useMemo)(()=>{let e=[],t=(n,r,i)=>{for(let a of l.get(nC(n,r))??[]){if(a.kind===`file`&&!a.language&&!a.path.toLowerCase().endsWith(`.html`))continue;let r=a.kind===`dir`&&d.has(nC(n,a.path));e.push({source:n,entry:a,depth:i,open:r}),r&&t(n,a.path,i+1)}};for(let e of s)t(e.id,``,+!!k);return e},[l,d,s,k]),F=(e,t)=>{if(t.kind!==`dir`)return!1;let n=e=>e.replace(/^\/+/,``).startsWith(`${t.path}/`),r=l.get(nC(e.id,t.path));if(t.excludedBy)return e.optIn.some(n)?!0:!!r?.some(e=>!e.excludedBy);if(r?.some(e=>e.excludedBy&&(e.kind===`dir`||e.language))||e.exclude.some(e=>e.startsWith(`/`)&&n(e)))return!0;let i=A(e.id),a=t=>e.optIn.some(e=>t===e||t.startsWith(`${e}/`));return i?.defaultExcluded?.some(e=>n(e.path)&&!a(e.path))?!0:rC(e,i?.filter)&&!!i?.ruleExcluded?.some(e=>n(e.path)&&!a(e.path))},I=(e,n,r)=>{if(!r)return-t.filter(t=>t.source===e&&(t.path===n.path||t.path.startsWith(`${n.path}/`))).length;if(n.kind===`file`)return 1;let i=A(e);return i?.defaultExcluded?.find(e=>e.path===n.path)?.files??i?.ruleExcluded?.find(e=>e.path===n.path)?.files??null},L=async(t,n,r)=>{v(!0),m(``),x(e=>new Map(e).set(nC(t,n.path),r));try{let{source:i}=await Y.select(e,t,[n.path],r);c(e=>e.map(e=>e.id===t?{...i,optIn:i.optIn??[]}:e)),C(e=>{let i=new Map(e),a=nC(t,n.path);return i.has(a)?i.delete(a):i.set(a,I(t,n,r)),i}),await M()}catch(e){m(e.message??String(e))}finally{x(e=>{let r=new Map(e);return r.delete(nC(t,n.path)),r}),v(!1)}},R=(e,t,n)=>{if(!_){if(n&&t.excludedBy&&t.excludedBy!==`rule`){let n=t.path.slice(t.path.lastIndexOf(`/`)+1),r=A(e)?.defaultExcluded?.find(e=>e.path===t.path),i=t.kind===`dir`&&r?.files?` It has ${r.files.toLocaleString(`en-US`)} file${r.files===1?``:`s`}.`:``;if(t.excludedBy===`too-large`)g({source:e,entry:t,title:`Analyze ${n}?`,text:`${t.path} is ${tC(t.size??0)}, over the ${w??10} MB size limit. Files this large are usually generated or bundled code (minified builds, vendored bundles, source maps), and they slow analysis down. Files over 64 MB are never analyzed.`});else if(t.excludedBy===`minified`)g({source:e,entry:t,title:`Analyze ${n}?`,text:`${t.path} looks minified: most of it is on very long lines, as in a library build. A build adds thousands of functions that aren't your project's own code. Analyze it if it is your code.`});else{let r=eC[t.excludedBy]??eC.generated;g({source:e,entry:t,title:`Analyze ${n}?`,text:`${t.path} is ${r}, not your project's own code.${i} Analyzing it makes analysis slower and the graph larger. Its files will be marked as ${t.excludedBy} code and left out of "largest files" and "most called".`})}return}L(e,t,n)}},z=async()=>{let t=Number(E);if(!Number.isFinite(t)||t<=0||t>64){m(`The size limit must be a number of megabytes between 0 and 64.`);return}try{let{settings:n}=await Y.saveProjectSettings(e,{maxFileMB:t});T(n.maxFileMB),C(e=>new Map(e).set(`\0limit`,null)),await M()}catch(e){m(e.message??String(e))}},B=S.size>0||s.some(e=>!rC(e,A(e.id)?.filter))||w!==null&&n?.sources[0]?.maxFileBytes!==void 0&&n.sources[0].maxFileBytes!==w*1048576,V=0,H=0,U=!1;for(let[e,t]of S)e!==`\0limit`&&(t===null?U=!0:t>0?V+=t:H-=t);let W=e=>`${e} file${e===1?``:`s`}`,ee=[U?V?`${V}+ files added`:`files added`:V?`${W(V)} added`:``,H?`${W(H)} removed`:``].filter(Boolean).join(`, `);return(0,X.jsxs)(`div`,{className:`picker`,"data-testid":`file-picker`,children:[(0,X.jsxs)(`div`,{className:`picker-head`,children:[(0,X.jsx)(`strong`,{children:`Choose files`}),(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{onClick:i,"data-testid":`picker-done`,children:`Done`})]}),(0,X.jsx)(`p`,{className:`muted small picker-help`,children:`Unchecked files are left out of the graph. Greyed folders are left out by default: libraries and generated output.`}),(0,X.jsxs)(`label`,{className:`picker-limit`,children:[`Skip files over`,(0,X.jsx)(`input`,{type:`number`,min:1,max:64,step:1,value:E,"data-testid":`size-limit`,"aria-label":`Size limit in MB`,onChange:e=>D(e.target.value),onBlur:()=>E!==String(w)&&void z(),onKeyDown:e=>e.key===`Enter`&&void z()}),`MB`]}),p&&(0,X.jsx)(`p`,{className:`error small`,role:`alert`,children:p}),B&&(0,X.jsxs)(`div`,{className:`picker-pending`,"data-testid":`picker-pending`,children:[(0,X.jsxs)(`span`,{children:[ee?(0,X.jsx)(`strong`,{children:ee[0].toUpperCase()+ee.slice(1)}):`Changes`,` at the next analysis`]}),(0,X.jsx)(`button`,{className:`primary`,"data-testid":`picker-apply`,disabled:_,onClick:()=>{C(new Map),r()},children:`Apply & re-analyze`})]}),(0,X.jsxs)(`div`,{className:`picker-list`,role:`tree`,"aria-label":`Choose files`,children:[s.map(e=>k?(0,X.jsx)(`div`,{className:`picker-row source`,title:e.root,children:(0,X.jsx)(`strong`,{children:e.id})},`s:${e.id}`):null),P.map(({source:e,entry:t,depth:n,open:r})=>{let i=s.find(t=>t.id===e),a=b.get(nC(e,t.path))??!t.excludedBy,c=F(i,t),l=t.path.slice(t.path.lastIndexOf(`/`)+1),u=t.notAnalyzable?t.notAnalyzable===`declaration-file`?`type declarations`:t.notAnalyzable===`symlink`?`link`:`${tC(t.size??0)} · over 64 MB`:t.excludedBy===`library`?`library`:t.excludedBy===`generated`||t.excludedBy===`tool`?t.excludedBy:t.excludedBy===`too-large`?`${tC(t.size??0)} · too large`:t.excludedBy===`minified`?`minified`:t.excludedBy===`rule`?`excluded`:null,d=t.optedIn?t.origin??null:null;return(0,X.jsxs)(`div`,{className:`picker-row ${t.kind} ${a?``:`excluded`}${t.path===o?` target`:``}`,style:{paddingLeft:8+n*14},role:`treeitem`,"aria-expanded":t.kind===`dir`?r:void 0,"aria-level":n+1,"data-path":t.path,children:[t.kind===`dir`?(0,X.jsx)(`button`,{className:`caret`,"aria-label":`${r?`Close`:`Open`} ${l}`,onClick:()=>N(e,t.path),children:r?`▾`:`▸`}):(0,X.jsx)(`span`,{className:`caret`}),t.kind===`dir`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:a,"data-testid":`pick`,"aria-label":`Analyze ${l}`,ref:e=>{e&&(e.indeterminate=c)},"aria-checked":c?`mixed`:a,onChange:n=>R(e,t,n.target.checked)}),(0,X.jsx)(`button`,{className:`name button-link`,"data-command":`open-folder`,onClick:()=>N(e,t.path),children:l})]}):(0,X.jsxs)(`label`,{children:[t.notAnalyzable?(0,X.jsx)(`span`,{className:`caret`}):(0,X.jsx)(`input`,{type:`checkbox`,checked:a,"data-testid":`pick`,ref:e=>{e&&(e.indeterminate=c)},"aria-checked":c?`mixed`:a,onChange:n=>R(e,t,n.target.checked)}),(0,X.jsx)(`span`,{className:`name`,children:l})]}),u&&(0,X.jsx)(`small`,{className:`reason`,children:u}),d&&(0,X.jsx)(`small`,{className:`origin ${d}`,children:d})]},nC(e,t.path))}),s.length>0&&P.length===0&&!p&&(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`})]}),h&&(0,X.jsx)(`div`,{className:`backdrop`,onMouseDown:e=>e.target===e.currentTarget&&g(null),children:(0,X.jsxs)(`div`,{className:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pick-warning-title`,"data-testid":`pick-warning`,children:[(0,X.jsx)(`h2`,{id:`pick-warning-title`,children:h.title}),(0,X.jsx)(`p`,{children:h.text}),(0,X.jsxs)(`div`,{className:`buttons`,children:[(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{autoFocus:!0,onClick:()=>g(null),children:`Cancel`}),(0,X.jsx)(`button`,{className:`primary`,"data-testid":`pick-warning-confirm`,onClick:()=>{let e=h;g(null),L(e.source,e.entry,!0)},children:`Analyze anyway`})]})]})})]})}var aC=e=>e.toLocaleString(`en-US`);function oC(e){if(e.sites===0)return null;let t=e.sites-e.open,n=Math.floor(t/e.sites*100);return e.open>0?Math.min(n,99):n}function sC(e){let t=oC(e);return t===null?`No calls found`:`Paths: ${t}% of ${aC(e.sites)} call site${e.sites===1?``:`s`} go somewhere known${e.open?` · ${aC(e.open)} stop short`:``}`}function cC(e){return[{label:`within files`,count:e.withinFiles},{label:`across files`,count:e.acrossFiles},{label:`leave the project`,count:e.external},{label:`to one known body`,count:e.candidates.one},{label:`to a set of candidates`,count:e.candidates.several},{label:`stop short`,count:e.open}]}function lC({projects:e,progress:t=new Map,loading:n=!1,onOpen:r,onCreated:i,onAddFolder:a,onDeleted:o}){let[s]=fS(),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(``),[f,p]=(0,y.useState)(``),[m,h]=(0,y.useState)(!1),[g,_]=(0,y.useState)(null),[v,b]=(0,y.useState)(!1),x=e=>{_({id:e}),Y.projectDisk(e).then(({bytes:t})=>_(n=>n?.id===e?{...n,bytes:t}:n),()=>void 0)},S=async e=>{if(!v){b(!0);try{await Y.deleteProject(e),_(null),o(e)}catch(t){_(n=>n?.id===e?{...n,error:t.message??String(t)}:n)}finally{b(!1)}}},C=()=>{l(!1),d(``),p(``)},w=async()=>{if(!m){h(!0),p(``);try{let{project:e}=await Y.createProject(u.trim());C(),i(e.id)}catch(e){p(e.message??String(e))}finally{h(!1)}}};return(0,X.jsxs)(`section`,{className:`home`,"data-testid":`home`,"aria-labelledby":`home-title`,children:[(0,X.jsxs)(`div`,{className:`home-head`,children:[(0,X.jsx)(`h1`,{id:`home-title`,children:`Projects`}),(0,X.jsxs)(`div`,{className:`home-actions`,children:[(0,X.jsx)(`button`,{"data-testid":`new-project`,onClick:()=>l(!0),children:`+ New project`}),(0,X.jsx)(`button`,{className:`primary`,"data-testid":`home-add-folder`,onClick:a,children:`Add folder`})]})]}),c&&(0,X.jsxs)(`form`,{className:`new-project`,onSubmit:e=>{e.preventDefault(),w()},children:[(0,X.jsxs)(`label`,{children:[`Name`,(0,X.jsx)(`input`,{autoFocus:!0,"data-testid":`new-project-name`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>e.key===`Escape`&&C()})]}),(0,X.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!u.trim()||m,"data-testid":`new-project-create`,children:`Create`}),(0,X.jsx)(`button`,{type:`button`,onClick:C,children:`Cancel`}),f&&(0,X.jsx)(`p`,{className:`error`,role:`alert`,children:f})]}),n?(0,X.jsx)(`p`,{className:`muted`,children:`Loading…`}):e.length===0?(0,X.jsx)(`p`,{className:`muted`,children:`No projects yet. Add a folder to analyze its code.`}):(0,X.jsx)(`ul`,{className:`project-cards`,children:e.map(e=>{let n=!s&&e.ownFindings||e.findings,i=n?n.broken+n.notAnalyzed+n.openCalls:0;return(0,X.jsxs)(`li`,{"data-project":e.id,children:[(0,X.jsxs)(`button`,{className:`project-card`,"data-testid":`open-project`,onClick:()=>r(e.id),children:[(0,X.jsx)(`strong`,{children:e.name}),(0,X.jsx)(`span`,{className:`muted small`,"data-testid":`project-sources`,children:e.repositories===void 0?`${e.sources} source${e.sources===1?``:`s`}`:[e.repositories?`${e.repositories} repositor${e.repositories===1?`y`:`ies`}`:``,e.folders?`${e.folders} folder${e.folders===1?``:`s`}`:``].filter(Boolean).join(` · `)||`no sources`}),e.error?(0,X.jsxs)(`span`,{className:`error small`,"data-testid":`project-error`,children:[`Can't be read: `,e.error]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`small`,children:e.latest?e.latest.status===`running`?t.get(e.id)?T(t.get(e.id)).text:`Analyzing…`:e.latest.status===`failed`?e.latest.errorCode===`cancelled`?`Last analysis cancelled`:`Last analysis failed`:`Analyzed${e.latest.finishedAt?` ${we(e.latest.finishedAt)}`:``}`:`Not analyzed yet`}),e.analysis?.outdated.length?(0,X.jsx)(`span`,{className:`small outdated-note`,"data-testid":`project-outdated`,children:e.analysis.outdated.every(e=>e.was===null)?`Made before veoflow recorded its version: analyze again to see what this version finds`:`Made by ${e.analysis.veoflow?`veoflow ${e.analysis.veoflow}`:`another veoflow`}: analyze again to see what this version finds`}):null,!n&&e.findingsPending&&(0,X.jsx)(`span`,{className:`muted small`,"data-testid":`findings-pending`,children:`Counting findings…`}),e.files&&e.files.analyzed<e.files.listed&&(0,X.jsx)(`span`,{className:`small`,"data-testid":`files-not-analyzed`,children:e.files.analyzed===0?`None of ${e.files.listed.toLocaleString(`en-US`)} files analyzed`:`${(e.files.listed-e.files.analyzed).toLocaleString(`en-US`)} of ${e.files.listed.toLocaleString(`en-US`)} files not analyzed`}),e.files?.listed===0&&(0,X.jsx)(`span`,{className:`small`,"data-testid":`files-not-analyzed`,children:`No files veoflow analyzes`}),e.completeness&&!(e.files&&e.files.analyzed===0)&&(0,X.jsx)(`span`,{className:`small`,"data-testid":`project-paths`,children:sC(e.completeness)}),n&&!(e.files&&e.files.analyzed===0)&&(0,X.jsx)(`span`,{className:`muted small`,children:i===0?`No findings`:[n.broken?`${n.broken} broken import${n.broken===1?``:`s`}`:``,n.notAnalyzed?`${n.notAnalyzed} import${n.notAnalyzed===1?``:`s`} not analyzed`:``,n.openCalls?`${n.openCalls.toLocaleString(`en-US`)} open call${n.openCalls===1?``:`s`}`:``].filter(Boolean).join(` · `)})]})]}),(0,X.jsx)(`button`,{className:`project-delete`,"data-testid":`project-delete`,"aria-label":`Delete ${e.name}`,title:`Delete this project`,onClick:()=>x(e.id),children:`Delete…`}),g?.id===e.id&&(0,X.jsxs)(`div`,{className:`confirm`,role:`alertdialog`,"aria-labelledby":`delete-${e.id}`,"data-testid":`project-delete-confirm`,onKeyDown:e=>e.key===`Escape`&&_(null),children:[(0,X.jsx)(`p`,{id:`delete-${e.id}`,children:(0,X.jsxs)(`strong`,{children:[`Delete `,e.name,`?`]})}),(0,X.jsxs)(`p`,{className:`muted small`,children:[`Its graph, history and evidence`,g.bytes===void 0?``:` (${uC(g.bytes)})`,` are deleted, and the commit hooks veoflow installed for it. The folders it analyzed are not touched. This can't be undone.`]}),g.error&&(0,X.jsx)(`p`,{className:`error small`,role:`alert`,children:g.error}),(0,X.jsxs)(`div`,{className:`actions`,children:[(0,X.jsx)(`button`,{autoFocus:!0,onClick:()=>_(null),"data-testid":`project-delete-cancel`,children:`Cancel`}),(0,X.jsx)(`button`,{className:`danger`,"data-testid":`project-delete-yes`,disabled:v,onClick:()=>void S(e.id),children:`Delete project`})]})]})]},e.id)})})]})}function uC(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:`${Math.ceil(e/1024)} KB`}function dC({title:e,entries:t,x:n,y:r,onClose:i}){let a=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=document.activeElement;a.current?.querySelector(`button`)?.focus();let t=e=>{e.type===`mousedown`&&a.current?.contains(e.target)||i()},n=e=>{if(e.key===`Escape`){e.stopPropagation(),i();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.key!==`Home`&&e.key!==`End`)return;e.preventDefault();let t=[...a.current?.querySelectorAll(`button`)??[]],n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus()},r=e=>{a.current?.contains(e.relatedTarget)||i()},o=a.current;return document.addEventListener(`mousedown`,t),window.addEventListener(`resize`,t),document.addEventListener(`scroll`,t,!0),window.addEventListener(`keydown`,n,!0),o?.addEventListener(`focusout`,r),()=>{document.removeEventListener(`mousedown`,t),window.removeEventListener(`resize`,t),document.removeEventListener(`scroll`,t,!0),window.removeEventListener(`keydown`,n,!0),o?.removeEventListener(`focusout`,r),e&&e!==document.body&&document.contains(e)&&e.focus()}},[i]);let o=Math.max(4,Math.min(n,window.innerWidth-260)),s=Math.max(4,Math.min(r,window.innerHeight-40-t.length*30));return(0,X.jsxs)(`div`,{ref:a,className:`context-menu`,role:`menu`,"aria-label":e,"data-testid":`context-menu`,style:{left:o,top:s},children:[(0,X.jsx)(`div`,{className:`context-title`,"aria-hidden":`true`,children:e}),t.map(e=>(0,X.jsx)(`button`,{role:`menuitem`,tabIndex:-1,"data-command-name":e.command,onClick:()=>{i(),e.run()},children:e.label},e.label))]})}function fC(e,t){let n=e.trim().toLowerCase();if(!n)return 0;let r=t.toLowerCase(),i=r.indexOf(n);if(i>=0)return i;let a=0,o=0;for(let e of r)if(e===n[a]?a++:a>0&&o++,a===n.length)return 100+o;return null}function pC(e,t,n){return n===0?[]:t.map((t,n)=>({item:t,i:n,score:fC(e,t.label)})).filter(e=>e.score!==null).sort((e,t)=>e.score-t.score||e.i-t.i).slice(0,n).map(e=>e.item)}function mC(e,t){let{view:n,command:r}=t,i=e.trim(),a=[];if(n.project){let e=pC(i,t.files.map(e=>({...e,label:e.path})),i?5:0);for(let i of e)a.push({key:`file:${i.id}`,group:`Files`,label:i.path,run:()=>n.tab===`imports`?r(`openImportsFile`,{file:i.id}):r(`openFile`,{file:i.id})}),e.length<=2&&(n.tab===`imports`&&n.fileLevel&&n.reveal.some(e=>e.file===i.id)&&a.push({key:`reveal:${i.id}`,group:`Files`,label:`Hide ${i.path}'s imports here`,run:()=>r(`revealFile`,{file:i.id})}),n.tab===`imports`&&n.group!==null&&!n.fileLevel&&a.push({key:`only:${i.id}`,group:`Files`,label:`Show only links of ${i.path}`,run:()=>r(`showOnlyLinks`,{id:i.id})}),a.push({key:`leave:${i.id}`,group:`Files`,label:`Leave ${i.path} out of analysis…`,run:()=>t.action(`chooseFiles`,{source:i.id.slice(0,i.id.indexOf(`:`)),path:i.path})}));for(let e of pC(i,t.groups.map(e=>({...e,label:e.name})),i?4:0))a.push({key:`group:${e.id}`,group:`Groups`,label:e.name,detail:`open the group`,run:()=>r(`openGroup`,{group:e.id})}),a.push({key:`only:${e.id}`,group:`Groups`,label:`Show only links of ${e.name}`,run:()=>{(n.tab!==`imports`||n.group!==null||n.fileLevel)&&r(`openGroup`,{}),r(`showOnlyLinks`,{id:e.id})}}),a.push({key:`pick:${e.id}`,group:`Groups`,label:`Details of ${e.name}`,detail:`on the project map`,run:()=>{(n.tab!==`imports`||n.group!==null||n.fileLevel)&&r(`openGroup`,{}),r(`pickNode`,{id:e.id})}})}let o=[],s=(e,t,n,r)=>o.push({label:e,run:t,...n?{detail:n}:{},...r?{key:r}:{}});if(n.project){s(n.history?`Close History`:`History: runs by commit`,()=>r(`toggleHistory`)),n.compare&&s(`Stop comparing`,()=>r(`compareRuns`,{}));let e=/^(?:compare\s+)?(?:run\s*)?(\d+)\s*(?:\.\.|with|vs|and|,|\s)\s*(?:run\s*)?(\d+)$/i.exec(i);if(e){let[t,n]=[Number(e[1]),Number(e[2])];s(`Compare run ${Math.min(t,n)} with run ${Math.max(t,n)}`,()=>r(`compareRuns`,{a:t,b:n}))}n.run!==null&&s(`Back to latest`,()=>r(`openRun`,{}));let a=/^(?:view\s+)?run\s*(\d+)$/i.exec(i);a&&s(`View run ${a[1]}`,()=>r(`openRun`,{run:Number(a[1])})),s(`File tab`,()=>r(`showTab`,{tab:`file`}),`functions and calls inside a file`),s(`Imports tab`,()=>r(`showTab`,{tab:`imports`}),`how files depend on each other`),s(`Project map`,()=>r(`openArea`,{}),`the Imports tab from the top: the whole map`),n.grouping===`connected`?(s(`Group the map by packages & folders`,()=>r(`setGrouping`,{grouping:`declared`})),s(n.differences?`Hide the differences between groupings`:`Show the differences between groupings`,()=>r(`toggleDifferences`))):s(`Group the map by how files connect`,()=>r(`setGrouping`,{grouping:`connected`}),`modules joined by calls, a shared layer apart`),n.tab===`imports`&&n.fileLevel&&n.reveal.length>0&&s(`Hide the files revealed here`,()=>r(`resetReveal`),`back to the open file's own imports and calls`),s(`Show the code`,()=>r(`showPanel`,{panel:`evidence`})),s(`Show Findings`,()=>r(`showPanel`,{panel:`questions`})),s(n.showPending?`Hide pending imports`:`Show pending imports`,()=>r(`togglePending`)),s(n.showUnresolved?`Hide unresolved call sites`:`Show unresolved call sites`,()=>r(`toggleUnresolved`)),n.selection&&s(`Clear the selection`,()=>r(`clearSelection`));let o=n.selection?.kind===`function`?n.selection.id:null,c=o??n.file;if(c){let e=o?o.slice(o.indexOf(`:`,o.indexOf(`:`)+1)+1):c.slice(c.indexOf(`:`)+1);s(`Reach from ${e}`,()=>r(`openReach`,{root:c,direction:`forward`}),`what paths from it reach`),s(`What reaches ${e}`,()=>r(`openReach`,{root:c,direction:`backward`}),`the paths that lead to it`)}n.reach&&n.tab!==`reach`&&s(`Reach tab`,()=>r(`showTab`,{tab:`reach`})),n.only&&s(`Show everything again`,()=>r(`showOnlyLinks`,{}),`not only one item's links`);for(let e of t.sources)s(`Re-analyze ${e.name??e.id}`,()=>t.action(`analyzeSource`,{source:e.id}),`this repository only`,`analyze:${e.id}`);if(t.sources.length>1){n.source&&s(`Scope: all repositories`,()=>r(`scopeSource`,{}));for(let e of t.sources)e.id!==n.source&&s(`Scope: ${e.name??e.id}`,()=>r(`scopeSource`,{source:e.id}),`one repository only`,`scope:${e.id}`)}n.group&&i.includes(`/`)&&s(`Open or close folder ${i}`,()=>r(`toggleFolder`,{path:i.replace(/^\.?\//,``).replace(/\/$/,``)})),s(`Re-analyze the project`,()=>t.action(`analyze`)),t.canDraft&&s(`Analyze uncommitted edits`,()=>t.action(`analyzeDraft`),`a draft beside the graph`);for(let e of(t.stages??[]).slice(1))s(`Analyze again from ${e}`,()=>t.action(`analyzeFrom`,{from:e}),`the stages before it reused, when nothing they read changed`,`from:${e}`);for(let e of t.stages??[])s(`Debug run: stop after ${e}`,()=>t.action(`analyzeDebug`,{until:e}),`never committed; compare it with the latest`,`debug:${e}`);s(`Repositories…`,()=>t.action(`openProjectSettings`),`re-analyze, choose files, rename, remove`),s(`License…`,()=>t.action(`openProjectSettings`,{tab:`license`}),`what the license includes; add or replace a key`)}n.project&&s(`All projects (home)`,()=>r(`goHome`),`every project and its last run`),s(`Add a folder…`,()=>t.action(`addFolder`)),s(`Settings…`,()=>t.action(`openSettings`),`the model for questions`);for(let e of t.projects)e.id!==n.project&&s(`Switch to project ${e.name}`,()=>r(`selectProject`,{project:e.id}),void 0,`project:${e.id}`);let c=o.filter(e=>/^(Compare run|View run|Open or close folder)/.test(e.label)),l=pC(i,o.filter(e=>!c.includes(e)),i?6:0);for(let e of[...c,...l])a.push({key:`cmd:${e.key??e.label}`,group:`Commands`,label:e.label,run:e.run,...e.detail?{detail:e.detail}:{}});return a}var hC=e=>e.slice(e.lastIndexOf(`/`)+1),gC=20;function _C({project:e,file:t,run:n,onOpen:r,onShowImports:i}){let{calls:a,error:o}=TS(e,n,t);if(o)return(0,X.jsx)(`p`,{className:`small muted`,children:`Calls to and from other files couldn't be loaded.`});if(!a||a.out.total===0&&a.in.total===0)return null;let s=(e,t)=>{if(e.total===0)return null;let n=new Map;for(let r of e.calls){let e=t===`out`?r.from:r.to,i=t===`out`?r.to:r.from,a=n.get(i.id)??{there:i,here:new Set,n:0,line:r.evidence.span.start.line};a.here.add(Se(e)),a.n++,n.set(i.id,a)}let i=[...n.values()].sort((e,t)=>t.n-e.n||(e.there.path<t.there.path?-1:1)),a=e.total-e.calls.length;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[t===`out`?`Calls into other files`:`Called from other files`,` (`,e.total,n.size!==e.total&&a===0?`, ${n.size} function${n.size===1?``:`s`}`:``,`)`]}),(0,X.jsx)(`ul`,{className:`cross-calls`,"data-testid":`file-cross-calls-${t}`,children:i.slice(0,gC).map(({there:e,here:n,n:i,line:a})=>{let o=[...n],s=`${o.slice(0,2).join(`, `)}${o.length>2?` and ${o.length-2} more`:``}`;return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link-row`,"data-command":`open-cross-file`,title:`Open ${Se(e)} in ${e.path}`,onClick:()=>r({id:e.id,file:e.file}),children:[(0,X.jsxs)(`span`,{className:`name`,children:[(0,X.jsxs)(`span`,{className:`muted`,children:[hC(e.path),` › `]}),Se(e),i>1&&(0,X.jsxs)(`span`,{className:`times`,children:[` ×`,i]})]}),(0,X.jsxs)(`small`,{children:[t===`out`?`from ${s}`:`calls ${s}`,i===1?` · line ${a}`:``]})]})},e.id)})}),(i.length>gC||a>0)&&(0,X.jsxs)(`p`,{className:`small muted`,children:[i.length>gC?`${(i.length-gC).toLocaleString(`en-US`)} more functions`:`${a.toLocaleString(`en-US`)} more calls`,`: select a function to see its own.`]})]})};return(0,X.jsxs)(`div`,{className:`file-cross-calls`,"data-testid":`file-cross-calls`,children:[i&&(0,X.jsx)(`button`,{className:`button-link`,"data-command":`cross-calls-in-imports`,onClick:i,children:`⇄ See them drawn on the Imports tab`}),s(a.out,`out`),s(a.in,`in`)]})}var vC=`area|`,yC=`singles|`,bC=e=>e.root,xC=(e,t)=>t===``||e===t||e.startsWith(`${t}/`),SC=()=>({broken:0,notAnalyzed:0,pending:0,openCalls:0});function CC(e){let t=e.indexOf(`|`);return t<0?{source:e,path:``}:{source:e.slice(0,t),path:e.slice(t+1)}}function wC(e,t,n,r,i,a){let o=SC();for(let e of a)o.broken+=e.findings.broken,o.notAnalyzed+=e.findings.notAnalyzed,o.pending+=e.findings.pending,o.openCalls+=e.findings.openCalls;return{id:e,name:t,kind:n,why:`${a.length} group${a.length===1?``:`s`} in ${t}`,source:r,root:i,files:a.reduce((e,t)=>e+t.files,0),functions:a.reduce((e,t)=>e+t.functions,0),externalPackages:0,findings:o,members:a.length,memberIds:a.map(e=>e.id)}}function TC(e,t){let n=new Map,r=new Map;for(let i of e){let e=t.get(i.from),a=t.get(i.to);if(!e||!a||e===a)continue;let o=`${e}->${a}`,s=n.get(o);if(s){let e=(s.references??0)+(i.references??0),{carrying:t,references:r,...a}=s;n.set(o,{...a,imports:s.imports+i.imports,calls:s.calls+i.calls,...e?{references:e}:{},...s.carrying!==void 0&&i.carrying!==void 0?{carrying:s.carrying+i.carrying}:{}})}else n.set(o,{...i,id:o,from:e,to:a});if(l(i)){let e=r.get(o)??{from:new Set,to:new Set};e.from.add(i.from),e.to.add(i.to),r.set(o,e)}}return[...n.values()].map(e=>{let t=r.get(e.id),n=!e.from.startsWith(`group|`)||!e.to.startsWith(`group|`);return t&&n?{...e,groups:{from:t.from.size,to:t.to.size}}:e}).sort((e,t)=>e.id<t.id?-1:1)}function EC(e,t){let n=CC(t);return e.groups.filter(e=>e.source===n.source&&xC(bC(e),n.path))}function DC(e,t,n=new Set){let r=[...new Set(e.groups.map(e=>e.source))].sort(),i=t?CC(t):null,a=i?e.groups.filter(e=>e.source===i.source&&xC(bC(e),i.path)):e.groups,o=new Map,s=[],c=[],l=!1;if(a.length>30){let u=new Map;for(let e of a){let t,n,a;if(!i&&r.length>1)t=`${e.source}|`,n=e.source,a=``;else{let r=i?.path??``,o=r===``?bC(e):bC(e).slice(r.length+1),s=o.split(`/`)[0]??``;if(o===``||s===``){c.push(e);continue}a=r===``?s:`${r}/${s}`,t=`${e.source}|${a}`,n=`${a}/`}let o=u.get(t)??{name:n,source:e.source,root:a,members:[]};o.members.push(e),u.set(t,o)}if(u.size===1&&c.length===0){let[r]=u.keys();if(r!==t)return DC(e,r,n)}for(let[e,t]of u){if(t.members.length===1){c.push(t.members[0]);continue}l=!0;let n=`${vC}${e}`;s.push(wC(n,t.name,`area`,t.source,t.root,t.members));for(let e of t.members)o.set(e.id,n)}}else c.push(...a);let u=new Map;for(let e of c)if((e.kind===`cluster`||e.kind===`module`)&&e.files===1){let t=`${e.source}|${bC(e)}`;u.set(t,[...u.get(t)??[],e])}for(let e of c){let t=`${e.source}|${bC(e)}`;(e.kind===`cluster`||e.kind===`module`)&&e.files===1&&u.get(t).length>1&&!n.has(t)||(s.push(e),o.set(e.id,e.id))}for(let[e,t]of u){if(t.length<2||n.has(e))continue;let r=`${yC}${e}`,{source:i,path:a}=CC(e);s.push(wC(r,`${a?`${a}/`:`(top)`}`,`singles`,i,a,t));for(let e of t)o.set(e.id,r)}return s.sort((e,t)=>e.id<t.id?-1:1),{area:t,summary:l,map:{...e,groups:s,dependsOn:TC(e.dependsOn,o)}}}function OC(e,t){let{source:n,path:r}=CC(e),i=t?[{area:`${n}|`,label:n}]:[],a=r?r.split(`/`):[];for(let e=1;e<=a.length;e++)i.push({area:`${n}|${a.slice(0,e).join(`/`)}`,label:a[e-1]});return i}var kC=(e,t)=>`${e.toLocaleString(`en-US`)} ${t}${e===1?``:`s`}`;function AC({project:e,run:t,source:n,group:r,file:i,fileLevel:a,expand:o,showPending:s,onOpenGroup:c,onCloseGroup:l,onOpenFile:u,onToggleFolder:d,onCollapse:f,onMenu:p,sources:m=[],onScope:h,area:g=null,onAllGroups:_}){let[v,b]=(0,y.useState)(``),{groups:x,error:S}=bS(e,t,0,n),C=a&&i!==null,{imports:w}=SS(e,t,C?i:null),T=C?w?.file.group??null:r??(x&&x.total===1?x.groups[0]?.id??null:null),{group:E}=xS(e,t,T,C?[]:o,s),D=(0,y.useMemo)(()=>{let e=v.trim().toLowerCase(),t=new Map;for(let n of x?g&&!T?EC(x,g):x.groups:[])(!e||n.name.toLowerCase().includes(e)||n.id===T)&&t.set(n.source,[...t.get(n.source)??[],n]);for(let e of t.values())e.sort((e,t)=>e.name<t.name?-1:+(e.name>t.name));return[...t].sort((e,t)=>e[0]<t[0]?-1:1)},[x,v,T,g]),O=D.length,k=e=>{let t=e.id===T,n=t&&!C&&r===e.id,a=e.findings.broken;return(0,X.jsxs)(`li`,{children:[(0,X.jsxs)(`button`,{className:`outline-group${t?` current`:``}`,"data-command":`outline-group`,"data-id":e.id,"aria-expanded":t,title:`${e.name}: ${kC(e.files,`file`)}, ${kC(e.functions,`function`)}${a?`, ${kC(a,`broken import`)}`:``}${n?` (close it)`:``}`,onClick:()=>n?l():c(e.id),onContextMenu:p&&(t=>{t.preventDefault(),p({kind:`group`,id:e.id,data:{label:e.name},x:t.clientX,y:t.clientY})}),children:[(0,X.jsx)(`span`,{className:`caret`,"aria-hidden":`true`,children:t?`▾`:`▸`}),(0,X.jsx)(`span`,{className:`name`,children:e.name}),a>0&&(0,X.jsx)(`small`,{className:`badge broken`,title:kC(a,`broken import`),children:a}),(0,X.jsx)(`small`,{className:`count`,children:e.files})]}),t&&E&&(0,X.jsxs)(`ul`,{className:`outline-files`,children:[!C&&o.map(t=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`outline-folder open`,"data-command":`outline-folder`,"data-path":t,"aria-expanded":`true`,title:`${t}/: open on the canvas (close it)`,onClick:()=>d(t),children:[(0,X.jsx)(`span`,{className:`caret`,"aria-hidden":`true`,children:`▾`}),(0,X.jsxs)(`span`,{className:`name`,children:[aS(t,e.root),`/`]})]})},`open:${t}`)),E.nodes.map(t=>t.kind===`folder`?(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`outline-folder`,"data-command":`outline-folder`,"data-path":t.path,"aria-expanded":`false`,title:`${t.path}/: ${kC(t.files,`file`)} (open it on the canvas)`,onClick:()=>C?c(e.id,t.path):d(t.path),children:[(0,X.jsx)(`span`,{className:`caret`,"aria-hidden":`true`,children:`▸`}),(0,X.jsxs)(`span`,{className:`name`,children:[aS(t.path,e.root),`/`]}),(0,X.jsx)(`small`,{className:`count`,children:t.files})]})},t.id):(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`outline-file${t.id===i&&C?` current`:``}`,"data-command":`outline-file`,"data-file":t.id,title:t.path,onClick:()=>u(t.id,e.id),onContextMenu:p&&(e=>{e.preventDefault(),p({kind:`file`,id:t.id,data:{},x:e.clientX,y:e.clientY})}),children:[(0,X.jsx)(`span`,{className:`name`,children:aS(t.path,e.root)}),t.findings.broken>0&&(0,X.jsx)(`small`,{className:`badge broken`,children:t.findings.broken})]})},t.id))]})]},e.id)},[A,j]=(0,y.useState)(new Set),M=e=>{let t=e=>e.kind===`cluster`&&e.files===1,n=new Map;for(let r of e)t(r)&&n.set(r.root,[...n.get(r.root)??[],r]);let r=[],i=new Set;for(let a of e){let e=n.get(a.root);if(!t(a)||!e||e.length<2)r.push({type:`group`,g:a});else if(!i.has(a.root)){i.add(a.root);let t=`${a.source}|${a.root}`,n=A.has(t)||v.trim()!==``||e.some(e=>e.id===T);r.push({type:`singles`,key:t,root:a.root,members:e,open:n})}}return r};return(0,X.jsxs)(`nav`,{className:`nav outline`,"aria-label":`Groups`,"data-testid":`group-outline`,children:[(0,X.jsxs)(`div`,{className:`nav-head`,children:[(m.length>1||n)&&(0,X.jsxs)(`label`,{className:`nav-scope`,children:[(0,X.jsx)(`span`,{className:`small muted`,children:`Scope`}),(0,X.jsxs)(`select`,{"data-command":`scope-source`,value:n??``,onChange:e=>h?.(e.target.value||null),children:[(0,X.jsx)(`option`,{value:``,children:`All repositories`}),m.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.name??e.id},e.id))]})]}),(0,X.jsxs)(`div`,{className:`outline-head`,children:[(0,X.jsx)(`input`,{className:`nav-filter`,placeholder:`Filter ${x?kC(x.total,`group`):`groups`}…`,"aria-label":`Filter groups`,"data-testid":`outline-filter`,value:v,onChange:e=>b(e.target.value)}),(0,X.jsx)(`button`,{className:`icon`,title:`Hide this pane ( [ )`,"aria-label":`Hide the groups pane`,onClick:f,children:`⟨`})]}),(0,X.jsx)(`button`,{className:`outline-map${!T&&!C?` current`:``}`,"data-command":`outline-project-map`,onClick:()=>c(),title:`The project map: every group`,children:`⌂ Project map`})]}),(0,X.jsxs)(`div`,{className:`nav-list outline-list`,children:[S&&(0,X.jsx)(`p`,{className:`hint error`,children:S}),x&&g&&!T&&(0,X.jsxs)(`p`,{className:`small muted outline-area`,"data-testid":`outline-area`,children:[g.slice(g.indexOf(`|`)+1)?`In ${g.slice(g.indexOf(`|`)+1)}/:`:`In the ${g.slice(0,g.indexOf(`|`))} repository:`,` `,kC(EC(x,g).length,`group`),` ·`,` `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>(_??(()=>c()))(),children:`all groups`})]}),x&&!x.stage2&&(0,X.jsx)(`p`,{className:`hint`,children:`Groups come from import analysis (Stage 2), which hasn't run for this project.`}),D.map(([e,t])=>(0,X.jsxs)(`section`,{children:[O>1&&(0,X.jsx)(`h4`,{className:`outline-source`,children:e}),(0,X.jsx)(`ul`,{children:M(t).map(e=>e.type===`group`?k(e.g):(0,X.jsxs)(`li`,{children:[(0,X.jsxs)(`button`,{className:`outline-singles`,"data-command":`outline-singles`,"aria-expanded":e.open,title:`${e.members.length} groups of one file each in ${e.root||`the top folder`}`,onClick:()=>j(t=>{let n=new Set(t);return n.has(e.key)?n.delete(e.key):n.add(e.key),n}),children:[(0,X.jsx)(`span`,{className:`caret`,"aria-hidden":`true`,children:e.open?`▾`:`▸`}),(0,X.jsxs)(`span`,{className:`name`,children:[e.root?`${e.root}/`:`(top)`,` · `,e.members.length,` single files`]}),(0,X.jsx)(`small`,{className:`count`,children:e.members.length})]}),e.open&&(0,X.jsx)(`ul`,{className:`outline-singles-list`,children:e.members.map(k)})]},e.key))})]},e))]})]})}function jC(e){switch(e.context){case`argument`:return`to ${e.handedTo} (argument ${(e.argument??0)+1})`;case`jsx-attribute`:return`as ${e.handedTo}`;case`property`:return`as ${e.handedTo} in an object`;case`array-element`:return`in an array`;case`return`:return`as its result`;default:return`to ${e.handedTo}`}}function MC({project:e,fn:t,run:n,onOpen:r}){let[i,a]=(0,y.useState)(null);if((0,y.useEffect)(()=>{let n=!1;return Promise.all([Y.references(e,t,`out`),Y.references(e,t,`in`)]).then(([e,r])=>!n&&a({fn:t,out:e,in:r}),()=>!n&&a(`error`)),()=>{n=!0}},[e,t,n]),i===`error`||i===null||i.fn!==t||i.out.total===0&&i.in.total===0)return null;let o=e=>e.evidence.span.start.line,s=e=>e.truncated?`${e.total}; the first ${e.references.length} shown`:`${e.total}`;return(0,X.jsxs)(`div`,{className:`imported-calls handed-on`,"data-testid":`handed-on`,children:[i.out.references.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Hands on (`,s(i.out),`)`]}),i.out.references.map(e=>(0,X.jsxs)(`div`,{className:`imported-call`,"data-testid":`handed-on-out`,children:[(0,X.jsxs)(`span`,{className:`mono small`,children:[e.to.name,` · line `,o(e)]}),(0,X.jsxs)(`span`,{className:`small`,children:[`passes `,(0,X.jsx)(`strong`,{children:e.to.name}),e.to.file!==e.from.file&&(0,X.jsxs)(X.Fragment,{children:[` `,`in `,(0,X.jsx)(`span`,{className:`mono`,children:e.to.path})]}),` `,jC(e),`; whatever receives it may call it`]}),e.to.file!==e.from.file&&(0,X.jsx)(`span`,{className:`small links`,children:(0,X.jsx)(`button`,{className:`button-link`,"data-command":`open-handed-on`,onClick:()=>r({id:e.to.id,file:e.to.file}),children:`Open that file`})})]},e.id))]}),i.in.references.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Handed on by (`,s(i.in),`)`]}),i.in.references.map(e=>(0,X.jsxs)(`div`,{className:`imported-call`,"data-testid":`handed-on-in`,children:[(0,X.jsxs)(`span`,{className:`small`,children:[(0,X.jsx)(`strong`,{children:e.from.name}),` in `,(0,X.jsx)(`span`,{className:`mono`,children:e.from.path}),` passes it`,` `,jC(e),` · line `,o(e)]}),(0,X.jsx)(`span`,{className:`small links`,children:(0,X.jsx)(`button`,{className:`button-link`,"data-command":`open-handed-on`,onClick:()=>r({id:e.from.id,file:e.from.file}),children:`Open`})})]},e.id))]})]})}var NC=e=>e.reason===`imported-symbol`||e.reason===`template-reference`;function PC(e){let t=e.group;if(!t)return e.path;let n=t.root&&e.path.startsWith(`${t.root}/`)?e.path.slice(t.root.length+1):e.path;return`${t.name} › ${n}`}var FC={broken:`its import is broken`,pending:`its import waits for another source`,"not-analyzed":`its import leads to a file not analyzed`};function IC({project:e,graph:t,fn:n,onOpen:r,onShowImports:i}){let[a,o]=(0,y.useState)(null),s=t.file.id,c=t.unresolved.some(NC);(0,y.useEffect)(()=>{if(!c)return;let t=!1;return Y.siteLinks(e,s).then(e=>!t&&o({file:s,byId:new Map(e.links.map(e=>[e.site,e]))}),()=>!t&&o({file:s,byId:`error`})),()=>{t=!0}},[e,s,t.committedRun,c]);let l=t.unresolved.filter(e=>e.enclosingFn===n&&NC(e)&&!e.component).sort((e,t)=>e.evidence.span.start.offset-t.evidence.span.start.offset);if(l.length===0)return null;let u=a?.file===s?a.byId:null,d=u===`error`?null:u;return(0,X.jsxs)(`div`,{className:`imported-calls`,"data-testid":`imported-calls`,children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Calls into other files (`,l.length,`)`]}),u===`error`&&(0,X.jsx)(`p`,{className:`small muted`,children:`Where these calls lead couldn't be loaded.`}),l.map(e=>{let t=d?.get(e.id),n=e.importSpecifier?`imported from ${e.importSpecifier}`:`defined in another file`;return(0,X.jsxs)(`div`,{className:`imported-call`,"data-testid":`imported-call`,"data-site":e.id,children:[(0,X.jsxs)(`span`,{className:`mono small`,children:[e.expression,` · line `,e.evidence.span.start.line]}),u===`error`?(0,X.jsx)(`span`,{className:`small muted`,children:n}):d===null?(0,X.jsxs)(`span`,{className:`small muted`,children:[n,`…`]}):t?.status===`linked`&&t.target?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`small`,children:[`calls `,(0,X.jsx)(`strong`,{children:t.target.name}),` in`,` `,(0,X.jsx)(`span`,{className:`mono`,children:PC(t.target)}),`, found by`,` `,t.via===`import`||e.reason===`imported-symbol`?`import analysis`:`component linking`]}),(0,X.jsxs)(`span`,{className:`small links`,children:[(0,X.jsx)(`button`,{className:`button-link`,"data-command":`open-imported`,onClick:()=>r({id:t.target.id,file:t.target.file}),children:`Open that file`}),(0,X.jsx)(`button`,{className:`button-link`,"data-command":`show-in-imports`,onClick:i,children:`Show in Imports`})]})]}):t?.status===`external`?(0,X.jsxs)(`span`,{className:`small`,children:[`calls into the external package `,(0,X.jsx)(`strong`,{children:t.package?.name})]}):t?(0,X.jsxs)(`span`,{className:`small`,children:[n,`, not linked`,t.importOutcome?`: ${FC[t.importOutcome]}`:t.candidates?.length?t.exhaustive===!1?`: ${t.candidates.length} known function${t.candidates.length===1?``:`s`} could run (may not be all)`:`: it could be any of ${t.candidates.length} functions`:t.reason?`: ${t.reason}`:``]}):(0,X.jsxs)(`span`,{className:`small muted`,children:[n,`, not linked yet`]})]},e.id)})]})}var LC=(e,t)=>{let n=xe(e).name;return n.length>t?`${n.slice(0,t-1)}…`:n},RC=6,zC=e=>e.slice(e.indexOf(`:`)+1),BC=e=>e.split(`/`).slice(-2).join(`/`),VC=(e,t)=>e.label<t.label?-1:+(e.label>t.label);function HC(e,t,n,r,i){let a=r.calls?t.in.calls:[],o=new Map(i.map(e=>[e.file,e])),s=i=>i===e?{calls:r.calls?t.out.calls:[],imports:n}:{calls:r.calls?o.get(i).out.calls:[],imports:o.get(i).imports},c=new Map([[e,0]]),l=[e],u=new Map,d=new Set,f=(e,t)=>{let n=u.get(e)??[];n.push(t),u.set(e,n)},p=[],m=[],h=new Set([e]),g=!1;for(let t=0;t<l.length;t++){let n=l[t],i=c.get(n),a=s(n),u=n===e?`box`:`box|${n}`,_=new Map;for(let e of a.calls)e.to.file!==n&&(p.push({from:e.from.id,to:e.to,id:e.id,source:n}),_.has(e.to.id)||_.set(e.to.id,{id:`callee|${e.to.id}`,file:e.to.file,label:`${BC(e.to.path)} ›\n${LC(e.to,28)}`,target:e.to.id}));let v=new Map;if(r.imports&&a.imports)for(let e of a.imports.imports)e.outcome===`file`&&e.file&&e.file.id!==n&&!v.has(e.file.id)&&v.set(e.file.id,{id:`imported|${e.file.id}`,file:e.file.id,label:`${BC(e.file.path)}\nimported`,edge:e.id});for(let e of v.values())m.push({source:u,target:e.file,edge:e.edge});let y=[],b=new Set,x=t=>h.has(t)||y.includes(t)?!0:n!==e&&(y.length>=30||h.size>=200)?(h.size>=200&&(g=!0),b.add(t),!1):(y.push(t),h.add(t),!0);for(let t of[...[..._.values()].sort(VC),...[...v.values()].sort(VC)])if(!(t.file===e||c.has(t.file))){if(o.has(t.file)){if(!x(t.file))continue;c.set(t.file,i+1),l.push(t.file),f(i+1,{kind:`box`,file:t.file});continue}d.has(t.id)||x(t.file)&&(d.add(t.id),f(i+1,{kind:`port`,port:t,from:n}))}b.size>0&&f(i+1,{kind:`more`,from:n,skipped:b})}let _=e=>c.has(e),v=new Map,y=(e,t)=>{let n=v.get(e)??new Map;v.set(e,n);let r=xe(t).unnamed;n.has(t.id)||n.set(t.id,{label:r?LC(t,34):`ƒ ${LC(t,32)}`,line:t.line??0})};for(let t of a)y(e,t.to);for(let e of p)_(e.source)&&(y(e.source,s(e.source).calls.find(t=>t.id===e.id).from),_(e.to.file)&&y(e.to.file,e.to));let b=e=>[...v.get(e)??new Map].sort((e,t)=>e[1].line-t[1].line||(e[1].label<t[1].label?-1:+(e[1].label>t[1].label))).map(([e,t])=>({id:e,label:t.label})),x=new Map(a.filter(e=>!_(e.from.file)).map(e=>[e.from.id,{id:`caller|${e.from.id}`,file:e.from.file,label:`${BC(e.from.path)} ›\n${LC(e.from,28)}`}])),S=new Map;if(r.imports&&n)for(let t of n.importedBy.files)t.file.id!==e&&!_(t.file.id)&&!S.has(t.file.id)&&S.set(t.file.id,{id:`importer|${t.file.id}`,file:t.file.id,label:`${BC(t.file.path)}\nimports this file`,edge:t.id});let C=[...[...x.values()].sort(VC),...[...S.values()].sort(VC)],w=e=>-((e-1)*58)/2,T=[],E=(t,n,r)=>{let i=b(t),a=Math.max(i.length,1),o=t===e?`box`:`box|${t}`;T.push({data:{id:o,kind:`box`,file:t,label:zC(t),w:210,h:a*58+50},position:{x:n,y:r},classes:t===e?`box`:`box revealed`}),i.forEach((e,a)=>T.push({data:{id:e.id,kind:`function`,file:t,label:e.label},position:{x:n,y:r+w(i.length)+a*58+12},classes:`function`})),t!==e&&T.push({data:{id:`open|${t}`,kind:`open`,file:t,label:`Open ↗`},position:{x:n+105-30,y:r-(a*58+50)/2-12},classes:`open`})};E(e,0,0),T.push(...C.map((e,t)=>({data:{id:e.id,kind:`port`,side:`left`,file:e.file,label:e.label},position:{x:-330,y:w(C.length)+t*58},classes:e.id.startsWith(`importer|`)?`port file`:`port`})));let D=e=>e.kind===`box`?Math.max(b(e.file).length,1)*58+50+29:58,O=e=>e.kind===`more`?[...e.skipped].filter(e=>!h.has(e)).length:1;for(let[e,t]of[...u].sort((e,t)=>e[0]-t[0])){let n=t.filter(e=>O(e)>0),r=-n.reduce((e,t)=>e+D(t),0)/2;for(let t of n){let n=D(t),i=r+n/2;r+=n,t.kind===`box`?E(t.file,e*330,i):t.kind===`more`?T.push({data:{id:`more|${t.from}`,kind:`more`,side:`right`,file:t.from,label:`+ ${O(t)} more file${O(t)===1?``:`s`}\nopen ${BC(zC(t.from))} to see all`},position:{x:e*330,y:i},classes:`port more`}):T.push({data:{id:t.port.id,kind:`port`,side:`right`,file:t.port.file,from:t.from,label:t.port.label},position:{x:e*330,y:i},classes:t.port.id.startsWith(`imported|`)?`port file`:`port`})}}let k=new Set(T.map(e=>e.data.id)),A=new Map,j=(e,t,n)=>{if(!k.has(e)||!k.has(t))return;let r=`${e}->${t}`,i=A.get(r);i?i.calls.push(n):A.set(r,{id:n,source:e,target:t,calls:[n]})};for(let e of p)_(e.source)&&j(e.from,_(e.to.file)?e.to.id:`callee|${e.to.id}`,e.id);for(let e of a)_(e.from.file)||j(`caller|${e.from.id}`,e.to.id,e.id);for(let e of A.values())T.push({data:{id:e.id,kind:`call`,source:e.source,target:e.target,calls:e.calls,label:e.calls.length>1?`×${e.calls.length}`:``},classes:`call`});let M=m.filter(e=>k.has(e.source)&&(_(e.target)||k.has(`imported|${e.target}`))),N=M.length+S.size<=RC?`imports`:``,P=new Set;for(let t of M){let n=t.target===e?`box`:_(t.target)?`box|${t.target}`:`imported|${t.target}`,r=`edge|${t.edge}`;P.has(r)||(P.add(r),T.push({data:{id:r,edge:t.edge,kind:`import`,source:t.source,target:n,label:N},classes:`import`}))}for(let e of S.values())T.push({data:{id:`edge|${e.edge}`,edge:e.edge,kind:`import`,source:e.id,target:`box`,label:N},classes:`import`});return{elements:T,boxes:l.slice(1),cutShort:g}}function UC({file:e,calls:t,imports:n,show:r,pick:i,onPick:a,onOpenFile:o,onClear:s,marks:c=null,onContext:l,revealed:u=[],revealing:d=[],unreadable:f=[],onReveal:p=()=>{},onResetReveal:m=()=>{}}){let h=(0,y.useRef)(null),g=(0,y.useRef)(null),_=Je();(0,y.useEffect)(()=>{g.current?.style(KC())},[_]);let v=(0,y.useRef)(c);v.current=c;let b=(0,y.useRef)(l);b.current=l,(0,y.useEffect)(()=>{g.current&&Qe(g.current,c)},[c]);let x=(0,y.useRef)({onPick:a,onOpenFile:o,onClear:s,onReveal:p});x.current={onPick:a,onOpenFile:o,onClear:s,onReveal:p};let S=(0,y.useMemo)(()=>HC(e,t,n,r,u),[e,t,n,r.calls,r.imports,u]),C=S.elements,w=JSON.stringify([e,r.calls,r.imports,n!==null]),T=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(!h.current)return;let t=J_({container:h.current,elements:C,layout:{name:`preset`},autounselectify:!0,minZoom:.15,maxZoom:2.5,style:KC()}),n;t.on(`tap`,`node`,t=>{let r=t.target.data();if(!r.file)return;if(r.kind===`open`||r.kind===`more`)return x.current.onOpenFile(r.file);let i=r.kind===`port`&&r.side===`right`||r.kind===`box`&&r.file!==e;if(r.kind===`port`&&!i)return x.current.onOpenFile(r.file);if(!i)return;clearTimeout(n);let a=r.file,o=r.from??e;n=setTimeout(()=>x.current.onReveal(a,o),WC)}),t.on(`dbltap`,`node`,t=>{clearTimeout(n);let r=t.target.data();r.file&&(r.kind===`port`||r.kind===`box`&&r.file!==e)&&x.current.onOpenFile(r.file)}),t.on(`tap`,`edge`,e=>x.current.onPick(e.target.data(`edge`)??e.target.id())),t.on(`tap`,e=>{e.target===t&&x.current.onClear()});let r=T.current;return r&&r.key===w?t.viewport({zoom:r.zoom,pan:r.pan}):(t.fit(void 0,30),t.zoom()>1.2&&(t.zoom(1.2),t.center())),g.current=t,h.current&&(h.current.veoCy=t),Qe(t,v.current),t.on(`cxttap`,`node, edge`,t=>{let n=t.target.data(),r=n.kind===`function`?`function`:(n.kind===`port`||n.kind===`box`&&n.file!==e)&&n.file?`file`:n.kind===`call`||n.kind===`import`?`edge`:null;if(!r||!h.current)return;let i=h.current.getBoundingClientRect(),a=t.renderedPosition??{x:0,y:0};b.current?.({kind:r,id:r===`file`&&typeof n.file==`string`?n.file:t.target.id(),data:n,x:i.left+a.x,y:i.top+a.y})}),()=>{clearTimeout(n),T.current={key:w,zoom:t.zoom(),pan:{...t.pan()}},g.current=null,t.destroy()}},[C]),(0,y.useEffect)(()=>{let e=g.current;e&&(e.elements().removeClass(`picked`),i&&e.edges().filter(e=>(e.data(`calls`)??[]).includes(i)||e.data(`edge`)===i).addClass(`picked`))},[i,C]);let E=e=>C.filter(t=>t.data.kind===`port`&&t.data.side===e).map(e=>e.data.id).join(` `),D=[t.in,t.out].filter(e=>e.truncated),O=(r.calls?t.out.calls.length+t.in.calls.length:0)===0,k=[...new Map(C.filter(t=>t.data.kind===`port`&&t.data.side===`right`||t.data.kind===`box`&&t.data.file!==e).map(t=>[t.data.file,{file:t.data.file,from:t.data.from??e,path:t.data.file.slice(t.data.file.indexOf(`:`)+1)}])).values()],A=[...new Map([...t.in.calls.map(e=>e.from),...t.out.calls.map(e=>e.to)].map(e=>[e.file,e])).values()];return(0,X.jsxs)(`div`,{className:`graph-wrap`,children:[O&&r.calls&&(0,X.jsx)(`p`,{className:`hint overlay`,"data-testid":`no-cross-file-calls`,children:`No calls cross into or out of this file.`}),(0,X.jsx)(`div`,{ref:h,className:`graph map`,"data-testid":`file-canvas`,"data-calls":C.filter(e=>e.data.kind===`call`).length,"data-imports":C.filter(e=>e.data.kind===`import`).length,"data-ports-left":E(`left`),"data-ports-right":E(`right`),"data-revealed":S.boxes.join(` `)}),d.length>0&&(0,X.jsx)(`button`,{className:`reset-reveal`,"data-command":`reset-reveal`,onClick:m,children:`Reset`}),f.length>0&&(0,X.jsxs)(`p`,{className:`hint small overlay error`,"data-testid":`reveal-unreadable`,children:[`Couldn't read `,f.map(e=>e.slice(e.indexOf(`:`)+1)).join(`, `),` to reveal it.`]}),S.cutShort&&(0,X.jsxs)(`p`,{className:`hint small overlay`,"data-testid":`reveal-cut-short`,children:[`Some revealed files' links aren't drawn: at most `,GC,` files are drawn at once. Open a file to see all of its links.`]}),D.length>0&&(0,X.jsxs)(`p`,{className:`hint small overlay`,"data-testid":`calls-truncated`,children:[D.map(e=>`Showing ${e.calls.length} of ${e.total} calls ${e.direction===`in`?`into`:`out of`} this file`).join(`; `),`.`]}),(0,X.jsxs)(`details`,{className:`graph-key`,"data-testid":`imports-file-key`,children:[(0,X.jsx)(`summary`,{children:`Key`}),(0,X.jsxs)(`ul`,{children:[(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node`}),(0,X.jsx)(`span`,{children:`a function in this file that calls or is called across files`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node port`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`code`,{children:`file ›`}),` a function in another file: callers on the left, what this file calls on the right`]})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-line call`}),(0,X.jsx)(`span`,{children:`calls: one function calls the other (×2: two calls)`})]}),r.imports&&(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node port file`}),(0,X.jsx)(`span`,{children:`another file: one this file imports (right) or one importing it (left)`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node box`}),(0,X.jsx)(`span`,{children:`a file revealed here: click a file on the right to show its own calls and imports, again to hide them; double-click or Open to go to it`})]}),r.imports&&(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-line import`}),(0,X.jsx)(`span`,{children:`imports: a file imports another (the one this file imports, or one importing it)`})]})]})]}),(0,X.jsxs)(`ul`,{className:`visually-hidden`,"aria-label":`Cross-file calls`,children:[t.in.calls.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"data-command":`pick-node`,"data-kind":`call`,"data-id":e.id,"data-direction":`in`,tabIndex:-1,onClick:()=>a(e.id),children:[e.from.path,` › `,Se(e.from),` calls `,Se(e.to)]})},e.id)),t.out.calls.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"data-command":`pick-node`,"data-kind":`call`,"data-id":e.id,"data-direction":`out`,tabIndex:-1,onClick:()=>a(e.id),children:[Se(e.from),` calls `,e.to.path,` › `,Se(e.to)]})},e.id)),k.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(`button`,{"data-command":`reveal-file`,"data-id":e.file,tabIndex:-1,onClick:()=>p(e.file,e.from),children:d.includes(e.file)?`Hide ${e.path}'s imports here`:`Show ${e.path}'s imports here`})},`reveal:${e.file}`)),A.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"data-command":`open-imports-file`,"data-id":e.file,tabIndex:-1,onClick:()=>o(e.file),children:[`Open `,e.path]})},e.file))]}),(0,X.jsx)(`button`,{className:`fit`,onClick:()=>g.current?.fit(void 0,30),children:`Fit`})]})}var WC=250,GC=200;function KC(){return[{selector:`node`,style:{shape:`round-rectangle`,width:170,height:36,label:`data(label)`,"text-wrap":`wrap`,"text-max-width":`194px`,"text-valign":`center`,"text-halign":`center`,"font-size":12,color:Z(`gray-26`),"background-color":Z(`gray-100`),"border-width":1,"border-color":Z(`gray-86`),"z-index-compare":`manual`,"z-index":2}},{selector:`node.box`,style:{"background-color":Z(`gray-98-5`),"border-color":Z(`blue-87`),"border-width":2,"text-valign":`top`,"text-margin-y":18,color:Z(`blue-47`),"font-weight":`bold`,width:`data(w)`,height:`data(h)`,events:`no`,"z-index":0}},{selector:`node.box.revealed`,style:{"border-color":Z(`blue-62`),"border-style":`dashed`,color:Z(`blue-47`),events:`yes`}},{selector:`node.open`,style:{width:64,height:20,"font-size":10,color:Z(`blue-47`),"background-color":Z(`gray-100`),"border-color":Z(`blue-62`)}},{selector:`node.more`,style:{"border-style":`dotted`,color:Z(`gray-44`)}},{selector:`node.function`,style:{height:40,"text-max-width":`156px`,"text-overflow-wrap":`anywhere`}},{selector:`node.port`,style:{width:210,height:42,"border-style":`dashed`,"border-color":Z(`blue-62`)}},{selector:`node.port.file`,style:{"border-color":Z(`gray-81`),color:Z(`gray-44`)}},{selector:`edge`,style:{"z-index-compare":`manual`,"z-index":1,width:1.5,"curve-style":`bezier`,"line-color":Z(`blue-62`),"target-arrow-shape":`triangle`,"target-arrow-color":Z(`blue-62`),"arrow-scale":.8,label:`data(label)`,"font-size":10,color:Z(`gray-51-2`),"text-background-color":Z(`gray-100`),"text-background-opacity":1}},{selector:`edge.import`,style:{"line-color":Z(`gray-66`),"line-style":`dashed`,"target-arrow-shape":`vee`,"target-arrow-color":Z(`gray-51-2`),"arrow-scale":1.2,"font-size":9}},...Ze(),{selector:`.picked`,style:{"line-color":Z(`blue-56`),"target-arrow-color":Z(`blue-56`),width:3}}]}var qC=(e,t)=>`${e.toLocaleString()} ${t}${e===1?``:`s`}`;function JC(e){let t=`(${qC(e.imports,`import`)})`;return e.calls===0&&!e.references?`no calls linked ${t}`:[e.calls?qC(e.calls,`call`):``,e.references?qC(e.references,`reference`):``].filter(Boolean).join(`, `).concat(` ${t}`)}var YC=e=>!e.startsWith(`group|`);function XC(e,t){let n=JC(e),r=e.groups;return r?`${YC(e.from)?`${qC(r.from,`group`)} in ${t(e.from)}`:t(e.from)} ${YC(e.from)&&r.from!==1?`call`:`calls`} into ${YC(e.to)?YC(e.from)?`${r.to.toLocaleString()} in ${t(e.to)}`:`${qC(r.to,`group`)} in ${t(e.to)}`:t(e.to)}: ${n}`:`${t(e.from)} calls into ${t(e.to)}: ${n}`}var ZC={repository:`repository`,"workspace-package":`workspace package`,cluster:`cluster`,module:`module`,shared:`shared layer`,area:`folder`,singles:`single files`},QC=(e,t)=>`${e.toLocaleString()} ${t}${e===1?``:`s`}`,$C=.55;function ew(e){return e.resize(),e.elements().empty()?1:(e.fit(void 0,40),e.zoom()>1.2&&(e.zoom(1.2),e.center()),e.zoom())}function tw(e){let{members:t,kind:n}=e;if(t!==void 0)return n===`singles`?`${QC(t,`single file`)} · open them`:`${QC(t,`group`)} · open it`}var nw=(e,t=30)=>e.length>t?`${e.slice(0,t-1)}…`:e;function rw(e,t){if(!e||!t)return 0;let n=Math.abs(t.x-e.x)/290;return n>1.2||t.x<e.x?-(84*.9+12*Math.min(4,n)):0}var iw=(e,t)=>1+6*Math.sqrt(e/Math.max(1,t));function aw(e,t){return e.startsWith(`group|`)&&t.startsWith(`group|`)?`DEPENDS_ON|${e}|${t}`:`arrow|${encodeURIComponent(e)}|${encodeURIComponent(t)}`}function ow({map:e,layoutKey:t,pick:n,showPackages:r,onPick:i,onOpen:a,onClear:o,marks:s=null,only:c=null,onContext:u,differences:d=null}){let f=(0,y.useRef)(null),p=(0,y.useRef)(null),m=(0,y.useMemo)(()=>{let t=new Map;for(let e of d??[]){let n=e.declared.length>1?`merges ${e.declared.map(e=>e.name).join(`, `)}`:`part of ${e.declared[0]?.name??`a declared group`}, which is ${e.connected.length} groups here`;for(let r of e.connected)t.set(r.id,n)}for(let n of e.groups){let e=n.memberIds?.filter(e=>t.has(e))??[];e.length&&t.set(n.id,`${e.length} of its groups differ from the declared ones`)}return t},[d,e]),h=Je();(0,y.useEffect)(()=>{p.current?.style(sw())},[h]);let[g,_]=(0,y.useState)(!1),[v,b]=(0,y.useState)(!1),[x,S]=(0,y.useState)(null),C=(0,y.useRef)(!1),w=(0,y.useRef)(c);w.current=c;let T=(0,y.useRef)(u);T.current=u,(0,y.useEffect)(()=>{p.current&&Ke(p.current,c)},[c]);let E=(0,y.useRef)(s);E.current=s,(0,y.useEffect)(()=>{p.current&&Qe(p.current,s)},[s]);let D=(0,y.useRef)({x:0,y:0}),O=(0,y.useRef)({onPick:i,onOpen:a,onClear:o});return O.current={onPick:i,onOpen:a,onClear:o},(0,y.useEffect)(()=>{if(!f.current)return;let n={...Zx(t,e.groups,e.dependsOn.map(e=>({from:e.from,to:e.to,weight:e.imports+e.calls})))},r=e.groups.filter(e=>e.kind===`shared`);if(r.length){n.groups={...n.groups};let t=e.groups.filter(e=>e.kind!==`shared`).map(e=>n.groups[e.id]),i=Math.max(0,...t.map(e=>e?.y??0)),a=[];for(let o of r){let r=e.dependsOn.filter(e=>e.to===o.id&&n.groups[e.from]).map(e=>n.groups[e.from].x),s=t.map(e=>e?.x??0),c=r.length?r:s.length?s:[0],l=(Math.min(...c)+Math.max(...c))/2;for(;a.some(e=>Math.abs(e-l)<230);)l+=250;a.push(l),n.groups[o.id]={x:l,y:i+168}}}let i=e.dependsOn.flatMap(e=>{let t=l(e);return t?[{d:e,weight:t.weight}]:[]}),a=Math.max(1,...i.map(e=>e.weight)),o=new Map(e.groups.map(e=>[e.id,e.name])),s=e=>o.get(e)??e;D.current=n.packages;let c=new Set(e.groups.map(e=>e.source)).size>1,u=[...e.groups.map(e=>{let t=e.findings.broken;return{data:{id:e.id,kind:`group`,why:[e.why,m.get(e.id)?`Differs: ${m.get(e.id)}`:``].filter(Boolean).join(`
337
- `),label:[nw(e.name),tw(e)??nw(c?`${e.source} · ${ZC[e.kind]??e.kind}`:ZC[e.kind]??e.kind),t>0?`${QC(e.files,`file`)} · ${QC(t,`broken import`)}`:`${QC(e.files,`file`)} · ${QC(e.functions,`function`)}`].join(`
338
- `)},position:n.groups[e.id]??{x:0,y:0},classes:[`group`,t>0?`broken`:``,e.kind===`shared`?`shared`:``,d?m.has(e.id)?`differs`:`alike`:``].filter(Boolean).join(` `)}}),...i.map(({d:e,weight:t})=>({data:{bend:rw(n.groups[e.from],n.groups[e.to]),id:e.id,kind:`depends`,source:e.from,target:e.to,width:iw(t,a),count:t*3>=a&&t>1?String(t):``,label:t*3>=a&&t>1?String(t):``,sentence:XC(e,s)},classes:t===0?`depends unlinked`:`depends`}))],h=J_({container:f.current,elements:u,layout:{name:`preset`},autounselectify:!0,minZoom:.1,maxZoom:2.5,style:sw()});h.on(`tap`,`node`,e=>{e.target.data(`kind`)===`group`&&O.current.onPick(e.target.id())}),h.on(`dbltap`,`node`,e=>{e.target.data(`kind`)===`group`&&O.current.onOpen(e.target.id())}),h.on(`tap`,`edge`,e=>{e.target.data(`kind`)===`depends`&&O.current.onPick(aw(e.target.data(`source`),e.target.data(`target`)))}),h.on(`tap`,e=>{e.target===h&&O.current.onClear()}),h.on(`mouseover`,`edge`,e=>{let t=e.target.data(`sentence`),n=e.renderedPosition??{x:0,y:0};t&&S({text:t,x:n.x,y:n.y})}),h.on(`mouseout`,`edge`,()=>S(null)),h.on(`mouseover`,`node`,e=>{let t=e.target.data(`why`),n=e.renderedPosition??{x:0,y:0};t&&S({text:t,x:n.x,y:n.y})}),h.on(`mouseout`,`node`,()=>S(null)),h.on(`pan zoom`,()=>S(null)),C.current=!1,_(ew(h)<$C),h.on(`scrollzoom pinchzoom dragpan`,()=>{C.current=!0});let g=new ResizeObserver(()=>{C.current?h.resize():_(ew(h)<$C)});return f.current&&g.observe(f.current),p.current=h,f.current&&(f.current.veoCy=h),Ke(h,w.current),h.on(`cxttap`,`node, edge`,e=>{let t=e.target.data(),n=t.kind===`group`?`group`:t.kind===`depends`?`edge`:null;if(!n||!f.current)return;let r=f.current.getBoundingClientRect(),i=e.renderedPosition??{x:0,y:0};T.current?.({kind:n,id:n===`file`&&typeof t.file==`string`?t.file:e.target.id(),data:t,x:r.left+i.x,y:r.top+i.y})}),Qe(h,E.current),()=>{g.disconnect(),S(null),p.current=null,h.destroy()}},[e,t,d,m]),(0,y.useEffect)(()=>{let t=p.current;if(!t||(t.remove(`#packages, .uses`),!r||e.externalPackages.total===0))return;let n=[],i=e.externalPackages.top.slice(0,4).map(e=>e.name),a=e.externalPackages.total-i.length;n.push({data:{id:`packages`,kind:`packages`,label:[`External packages`,i.join(`, `),a>0?`+ ${a} more`:``].filter(Boolean).join(`
339
- `)},position:D.current,classes:`packages`});for(let t of e.groups)t.externalPackages>0&&n.push({data:{id:`packages|${t.id}`,kind:`uses`,source:t.id,target:`packages`,width:1,label:``,bend:0},classes:`uses`});t.add(n),C.current||_(ew(t)<$C)},[e,t,r]),(0,y.useEffect)(()=>{let e=p.current;e&&e.batch(()=>{e.elements().removeClass(`picked faded role-into role-from`),e.edges(`[kind = "depends"]`).forEach(e=>{e.data(`label`,e.data(`count`))});let t=(n?.startsWith(`DEPENDS_ON|`)||n?.startsWith(`arrow|`)?e.edges().filter(e=>aw(e.data(`source`),e.data(`target`))===n):null)??(n?e.getElementById(n):null);if(t&&t.nonempty()&&t.isEdge()){let n=t.union(t.connectedNodes());n.addClass(`picked`),e.elements().not(n).addClass(`faded`)}else if(t&&t.nonempty()){let n=t.connectedEdges(`[kind = "depends"]`);t.addClass(`picked`),n.forEach(e=>{let n=e.data(`source`)===t.id();e.addClass(n?`role-into`:`role-from`);let r=e.data(`count`);e.data(`label`,n?`▶${r?` ${r}`:``}`:`◀${r?` ${r}`:``}`)});let r=t.union(n);e.elements().not(r).not(r.connectedNodes()).addClass(`faded`)}})},[n,e,t,r]),(0,X.jsxs)(`div`,{className:`graph-wrap`,children:[(0,X.jsx)(`div`,{ref:f,className:`graph map`,"data-testid":`project-map`,tabIndex:0,role:`application`,"aria-label":`Project map: arrow keys move between groups, Enter opens one`,onKeyDown:t=>{let r=e.groups.map(e=>e.id);if(r.length===0)return;let s=n?r.indexOf(n):-1;if(t.key===`ArrowRight`||t.key===`ArrowDown`)i(r[(s+1)%r.length]);else if(t.key===`ArrowLeft`||t.key===`ArrowUp`)i(r[(s-1+r.length)%r.length]);else if(t.key===`Enter`&&n)a(n);else if(t.key===`Escape`)o();else return;t.preventDefault()}}),(0,X.jsx)(`ul`,{className:`visually-hidden`,"aria-label":`Groups`,children:e.groups.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`button`,{"data-command":`pick-node`,"data-id":e.id,"data-why":e.why,"data-differs":d?String(m.has(e.id)):void 0,tabIndex:-1,onClick:()=>i(e.id),children:e.name}),(0,X.jsxs)(`button`,{"data-command":`open-group`,"data-id":e.id,tabIndex:-1,onClick:()=>a(e.id),children:[`Open `,e.name]})]},e.id))}),(0,X.jsx)(`ul`,{className:`visually-hidden`,"aria-label":`Arrows`,children:e.dependsOn.filter(e=>l(e)).map(t=>(0,X.jsx)(`li`,{children:(0,X.jsx)(`button`,{"data-command":`pick-node`,"data-arrow":!0,"data-id":aw(t.from,t.to),tabIndex:-1,onClick:()=>i(aw(t.from,t.to)),children:XC(t,t=>e.groups.find(e=>e.id===t)?.name??t)})},t.id))}),x&&!v&&(0,X.jsx)(`div`,{className:`map-hover`,"data-testid":`arrow-hover`,role:`status`,style:{left:x.x+12,top:x.y+12},children:x.text}),!v&&(0,X.jsx)(`p`,{className:`overlay map-key small muted`,"data-testid":`map-key`,children:`A ──▶ B: A calls into B · callers left, what they call right`}),v&&(0,X.jsx)(`ul`,{className:`map-list`,"data-testid":`map-list`,"aria-label":`Groups`,children:e.groups.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link-row${e.id===n?` picked`:``}`,"data-command":`list-group`,"data-id":e.id,onClick:()=>i(e.id),onDoubleClick:()=>a(e.id),title:`${e.name}: ${e.source} · ${ZC[e.kind]??e.kind}${e.why?`. ${e.why}`:``} (double-click or Enter opens it)`,onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),a(e.id))},children:[(0,X.jsx)(`span`,{className:`name`,children:e.name}),(0,X.jsxs)(`small`,{children:[e.source,` · `,ZC[e.kind]??e.kind,` · `,QC(e.files,`file`),e.findings.broken>0?` · ${QC(e.findings.broken,`broken import`)}`:``]})]})},e.id))}),!v&&g&&(0,X.jsxs)(`p`,{className:`overlay bottom small muted map-note`,"data-testid":`map-too-small`,children:[`All `,e.groups.length,` groups are shown, zoomed out: scroll to zoom in, or`,` `,(0,X.jsx)(`button`,{className:`button-link`,onClick:()=>b(!0),children:`see them as a list`}),`.`]}),(0,X.jsxs)(`div`,{className:`map-controls`,children:[(0,X.jsx)(`button`,{"data-command":`map-as-list`,"aria-pressed":v,onClick:()=>b(!v),title:`The groups as a list`,children:v?`Map`:`List`}),!v&&(0,X.jsx)(`button`,{className:`fit`,"data-command":`fit-map`,onClick:()=>{p.current&&(C.current=!1,_(ew(p.current)<$C))},children:`Fit`})]})]})}function sw(){return[{selector:`node`,style:{shape:`round-rectangle`,width:210,height:84,label:`data(label)`,"text-wrap":`wrap`,"text-max-width":`190px`,"text-valign":`center`,"text-halign":`center`,"font-size":13,"line-height":1.45,color:Z(`gray-26`),"background-color":Z(`gray-98-3`),"border-width":1,"border-color":Z(`gray-86`)}},{selector:`node.broken`,style:{"border-color":Z(`amber-74`)}},{selector:`node.shared`,style:{"border-style":`dotted`,"border-width":2,"background-color":Z(`gray-100`)}},{selector:`node.differs`,style:{"underlay-color":Z(`purple-44`),"underlay-padding":5,"underlay-opacity":.55}},{selector:`node.alike`,style:{opacity:.5}},{selector:`node.packages`,style:{"background-color":Z(`gray-100`),"border-style":`dashed`,"border-color":Z(`gray-81`),color:Z(`gray-44`)}},{selector:`edge`,style:{width:`data(width)`,"curve-style":`unbundled-bezier`,"control-point-distances":`data(bend)`,"control-point-weights":.5,"line-color":Z(`gray-72`),"target-arrow-shape":`triangle`,"target-arrow-color":Z(`gray-72`),"arrow-scale":.8,label:`data(label)`,"font-size":11,color:Z(`gray-51-2`),"text-background-color":Z(`gray-100`),"text-background-opacity":1,"text-background-padding":`2px`}},{selector:`edge.unlinked`,style:{"line-style":`dashed`}},{selector:`edge.uses`,style:{"line-style":`dashed`,"line-color":Z(`gray-86`),"target-arrow-shape":`none`}},...Ze(),Ge,{selector:`node.picked`,style:{"border-width":2,"border-color":Z(`blue-56`),"background-color":Z(`gray-97`)}},{selector:`edge.picked`,style:{"line-color":Z(`blue-56`),"target-arrow-color":Z(`blue-56`)}},{selector:`edge.role-into`,style:{"line-color":Z(`blue-52-2`),"target-arrow-color":Z(`blue-52-2`),color:Z(`blue-52-2`)}},{selector:`edge.role-from`,style:{"line-color":Z(`orange-59`),"target-arrow-color":Z(`orange-59`),color:Z(`orange-59`)}},{selector:`.faded`,style:{opacity:.25}}]}var cw=e=>e.toLocaleString(`en-US`),lw=(e,t)=>`${cw(e)} ${t}${e===1?``:`s`}`;function uw(e,t=!0){return[t&&e.withinFile?`${lw(e.withinFile,`call`)} within it`:``,e.intoOtherFiles?`${cw(e.intoOtherFiles)} into other files`:``,e.leaveProject?`${cw(e.leaveProject)} leave the project`:``,e.candidates?`${cw(e.candidates)} narrowed to candidates`:``].filter(Boolean)}var dw=e=>e.map((e,t)=>(0,X.jsxs)(y.Fragment,{children:[t>0&&` · `,e]},t));function fw({project:e,file:t,version:n,onImports:r,onFindings:i}){let[a,o]=(0,y.useState)(null),s=a?.file===t&&a.project===e?a:null;if((0,y.useEffect)(()=>{let n=!0;return Y.fileSummary(e,t).then(e=>n&&o(e)).catch(()=>n&&o(null)),()=>{n=!1}},[e,t,n]),!s)return null;let{alone:c,acrossFiles:l}=s;if(c.sites===0&&(!l||l.imports.files+l.imports.packages+l.imports.unresolved===0))return null;let u=[...uw(c),c.open?`${cw(c.open)} open`:`none open`],d=[];if(l){let e=l.open?`${cw(l.open)} stop short`:`none stop short`,t=l.imports.files+l.imports.packages,n=t+l.imports.unresolved>0?`${lw(t,`import`)}${l.imports.unresolved?`, ${cw(l.imports.unresolved)} unresolved`:``}`:null;d=[...uw(l,!1),l.open&&i?(0,X.jsx)(`button`,{className:`link`,"data-testid":`file-summary-open`,title:`Findings for this file: its open calls (with those narrowed to candidates) and its imports that didn't resolve`,onClick:i,children:e}):e,...n?[r?(0,X.jsx)(`button`,{className:`link`,"data-testid":`file-summary-imports`,onClick:r,children:n}):n]:[]]}return(0,X.jsxs)(`p`,{className:`file-summary small muted`,"data-testid":`file-summary`,title:`Of its ${lw(c.sites,`call`)}: what reading this file on its own found, and what linking it to the rest of the project added`,children:[(0,X.jsxs)(`span`,{"data-testid":`file-summary-alone`,children:[(0,X.jsx)(`strong`,{children:`Reading this file alone:`}),` `,u.join(` · `)]}),(0,X.jsx)(`span`,{"data-testid":`file-summary-across`,children:l?(0,X.jsxs)(X.Fragment,{children:[` → `,(0,X.jsx)(`strong`,{children:`across files:`}),` `,dw(d)]}):` · cross-file analysis didn't run`})]})}var pw={declared:`Declared: repositories, workspace packages and their folders`,connected:`Connected: files that call each other, within their packages; a file most of a package uses is its shared layer`};function mw({project:e,projectName:t,run:n,group:r,source:i=null,pick:a,file:o,fileLevel:s,expand:c,showPending:l,tabs:u,onPick:d,onOpenGroup:f,onOpenFile:p,onToggleFolder:m,onTogglePending:h,onClear:g,onFileFindings:_,marks:v=null,only:b=null,onContext:x,area:S=null,onOpenArea:C=()=>{},grouping:w=`declared`,differences:T=!1,onSetGrouping:E=()=>{},onToggleDifferences:D=()=>{},reveal:O=[],onReveal:k=()=>{},onResetReveal:A=()=>{}}){let[j,M]=(0,y.useState)(0),{groups:N,error:P}=bS(e,n,j,i),[F,I]=(0,y.useState)(!1),[L,R]=fS(),z=s&&o!==null,{imports:B}=SS(e,n,z?o:null),{calls:V,error:H}=TS(e,n,z?o:null),U=(0,y.useMemo)(()=>z?O.map(e=>e.file):[],[z,O]),{loaded:W,failed:ee}=CS(e,n,U),G=(0,y.useMemo)(()=>U.flatMap(e=>{let t=W.get(e);return t?[{file:e,out:t.out,imports:t.imports}]:[]}),[U,W]),[te,ne]=(0,y.useState)({calls:!0,imports:!0}),K=z?B?B.file.group:null:r??(N&&N.total===1?N.groups[0].id:null),q=K?N?.groups.find(e=>e.id===K):void 0,[J,Y]=(0,y.useState)(0),{group:re,error:ie}=xS(e,n,z?null:K,c,l,J),[ae,oe]=(0,y.useState)(new Set),se=(0,y.useMemo)(()=>N&&!K&&!z?DC(N,S,ae):null,[N,K,z,S,ae]),ce=(0,y.useMemo)(()=>new Set(N?.groups.map(e=>e.source)).size>1,[N]),le=se?.area??S,ue=le?OC(le,ce):[],de=ue.map(e=>[(0,X.jsx)(`span`,{className:`muted`,children:`›`},`s:${e.area}`),(0,X.jsx)(`button`,{className:`link`,"data-command":`open-area`,onClick:()=>C(e.area),children:e.label},e.area)]),fe=e=>{e.startsWith(`area|`)?C(e.slice(vC.length)):e.startsWith(`singles|`)?oe(t=>new Set([...t,e.slice(yC.length)])):f(e)},pe=e=>e.startsWith(`area|`)||e.startsWith(`singles|`),me=(0,X.jsxs)(`div`,{className:`toolbar`,children:[u,(0,X.jsx)(`nav`,{className:`breadcrumb`,"aria-label":`Zoom`,"data-testid":`breadcrumb`,children:K?(0,X.jsxs)(X.Fragment,{children:[N?.total===1?(0,X.jsx)(`span`,{children:t}):(0,X.jsx)(`button`,{className:`link`,"data-command":`open-group`,onClick:()=>f(),children:t}),!z&&de,(0,X.jsx)(`span`,{className:`muted`,children:`›`}),z?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{className:`link`,"data-command":`open-group`,onClick:()=>f(K),children:q?.name??K}),(0,X.jsx)(`span`,{className:`muted`,children:`›`}),(0,X.jsx)(`strong`,{className:`mono`,title:gw(o),children:Te(aS(gw(o),_w(q)),48)})]}):(0,X.jsx)(`strong`,{children:q?.name??K})]}):z?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{className:`link`,"data-command":`open-group`,onClick:()=>f(),children:t}),(0,X.jsx)(`span`,{className:`muted`,children:`›`}),(0,X.jsx)(`strong`,{className:`mono`,title:gw(o),children:Te(gw(o),48)})]}):ue.length>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{className:`link`,"data-command":`open-group`,onClick:()=>f(),children:t}),de.slice(0,-1),(0,X.jsx)(`span`,{className:`muted`,children:`›`}),(0,X.jsx)(`strong`,{children:ue[ue.length-1].label})]}):(0,X.jsx)(`strong`,{children:t})}),(K||z||ue.length>0)&&N&&N.total>1&&(0,X.jsx)(`button`,{className:`small`,"data-command":`go-project-map`,title:`Back to the project map: every group, nothing picked`,onClick:()=>f(),children:`⌂ Project map`}),N&&!K&&N.stage2&&(0,X.jsx)(`span`,{className:`small muted toolbar-note`,children:se?.area?(()=>{let e=se.map.groups.reduce((e,t)=>e+(t.members??1),0);return`folder · ${e.toLocaleString()} group${e===1?``:`s`} of ${N.total.toLocaleString()}`})():`project map · ${N.total} group${N.total===1?``:`s`}`}),re&&!z&&(0,X.jsxs)(`span`,{className:`small muted toolbar-note`,children:[`group · `,re.group.files,` file`,re.group.files===1?``:`s`,` · `,re.group.source]}),K&&!z&&c.length>0&&(0,X.jsx)(`span`,{className:`open-folders small`,children:c.map(e=>(0,X.jsxs)(`span`,{className:`chip`,children:[aS(e,_w(q)),`/`,(0,X.jsx)(`button`,{className:`icon`,"data-command":`toggle-folder`,"data-testid":`close-folder`,"data-path":e,"aria-label":`Close the folder ${e}`,onClick:()=>m(e),children:`×`})]},e))}),z&&(0,X.jsx)(`span`,{className:`small muted toolbar-note`,children:`its imports and cross-file calls`}),(0,X.jsx)(`span`,{className:`spacer`}),N&&N.stage2&&!z&&!K&&(0,X.jsxs)(`span`,{className:`grouping`,"data-testid":`grouping`,children:[(0,X.jsxs)(`label`,{className:`small`,title:pw[w],children:[`Grouped by`,` `,(0,X.jsxs)(`select`,{"data-command":`set-grouping`,value:w,onChange:e=>E(e.target.value),children:[(0,X.jsx)(`option`,{value:`declared`,children:`packages & folders`}),(0,X.jsx)(`option`,{value:`connected`,children:`how files connect`})]})]}),w===`connected`&&(0,X.jsxs)(`label`,{className:`toggle`,title:`Mark the groups the declared grouping has otherwise: a package split into several, packages merged`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-command":`toggle-differences`,checked:T,onChange:D}),`Show differences`]})]}),z&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`label`,{className:`toggle`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`toggle-calls`,checked:te.calls,onChange:e=>ne({...te,calls:e.target.checked})}),`Cross-file calls`]}),(0,X.jsxs)(`label`,{className:`toggle`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`toggle-imports`,checked:te.imports,onChange:e=>ne({...te,imports:e.target.checked})}),`Imports`]})]}),K&&!z&&(0,X.jsxs)(`label`,{className:`toggle`,title:`Imports waiting for another source to be added`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-command":`toggle-pending`,checked:l,onChange:h}),`Pending imports`]}),N&&!K&&N.externalPackages.total>0&&(0,X.jsxs)(`label`,{className:`toggle`,title:`External packages are hidden by default: nearly every group imports the same few`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`toggle-packages`,checked:F,onChange:e=>I(e.target.checked)}),`External packages`]})]});if(P)return(0,X.jsxs)(X.Fragment,{children:[me,(0,X.jsxs)(`p`,{className:`hint error`,children:[P,` `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>M(e=>e+1),children:`Try again`})]})]});if(!N)return(0,X.jsxs)(X.Fragment,{children:[me,(0,X.jsx)(`p`,{className:`hint`,children:`Loading the imports…`})]});if(!N.stage2)return(0,X.jsxs)(X.Fragment,{children:[me,(0,X.jsx)(`p`,{className:`hint`,"data-testid":`imports-no-stage2`,children:`Imports haven't been analyzed in this project yet: Stage 2, which follows imports across files, hasn't run. Analyze the project again to see them.`})]});let he=N.stats.own,ge=he.files!==N.stats.files,_e=S&&se?.area?EC(N,se.area):null,ve=_e?new Set(_e.map(e=>e.id)):null,ye=_e?{files:_e.reduce((e,t)=>e+t.files,0),functions:_e.reduce((e,t)=>e+t.functions,0),crossFileCalls:N.dependsOn.filter(e=>ve.has(e.from)&&ve.has(e.to)).reduce((e,t)=>e+t.calls,0),brokenImports:_e.reduce((e,t)=>e+t.findings.broken,0),openCalls:_e.reduce((e,t)=>e+t.findings.openCalls,0)}:L||!ge?N.stats:{files:he.files,functions:he.functions,crossFileCalls:he.crossFileCalls,brokenImports:he.brokenImports??N.stats.brokenImports,openCalls:he.openCalls??N.stats.openCalls};return(0,X.jsxs)(X.Fragment,{children:[me,z&&o&&(0,X.jsx)(fw,{project:e,file:o,version:`${n}:${V?.out.committedRun??``}`,onFindings:_}),z?H?(0,X.jsx)(`p`,{className:`hint error`,children:H}):V?(0,X.jsx)(`div`,{className:`group-level`,"data-testid":`file-level`,children:(0,X.jsx)(UC,{marks:v,onContext:x,file:o,calls:V,imports:B,show:te,pick:a,onPick:d,onOpenFile:e=>p(e),onClear:g,revealed:G,revealing:U,unreadable:ee,onReveal:k,onResetReveal:A})}):(0,X.jsx)(`p`,{className:`hint`,children:`Loading the file…`}):K?ie?(0,X.jsxs)(`p`,{className:`hint error`,children:[ie,` `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>Y(e=>e+1),children:`Try again`})]}):re?(0,X.jsxs)(`div`,{className:`group-level`,"data-testid":`group-level`,children:[re.truncated&&(0,X.jsxs)(`p`,{className:`hint small`,children:[`Showing `,re.nodes.length,` of `,re.total,` files and folders.`]}),(0,X.jsx)(oS,{marks:v,onContext:x,only:b,reply:re,pick:a,onPick:d,onOpenFile:e=>p(e,K),onToggleFolder:m,onClear:g})]}):(0,X.jsx)(`p`,{className:`hint`,children:`Loading the group…`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`small muted map-method`,"data-testid":`map-method`,children:[pw[w],w===`connected`&&T&&N.differences&&(0,X.jsxs)(`span`,{"data-testid":`differences-count`,children:[` `,`·`,` `,N.differences.length===0?`no differences from the declared groups`:`${N.differences.length} difference${N.differences.length===1?``:`s`} from the declared groups, marked`]})]}),(0,X.jsxs)(`dl`,{className:`map-stats`,"data-testid":`map-stats`,children:[(0,X.jsx)(hw,{n:ye.files,label:`files`}),(0,X.jsx)(hw,{n:ye.functions,label:`functions`}),(0,X.jsx)(hw,{n:ye.crossFileCalls,label:_e?`calls between its groups`:`cross-file calls`}),(0,X.jsx)(hw,{n:ye.brokenImports,label:`broken imports`,tone:ye.brokenImports>0?`warn`:void 0}),(0,X.jsx)(hw,{n:ye.openCalls,label:`open calls`}),!_e&&(0,X.jsx)(hw,{n:N.externalPackages.total,label:F?`external packages`:`external packages (hidden)`}),ge&&!_e&&(0,X.jsxs)(`label`,{className:`toggle stats-scope`,title:`Own code: ${he.files.toLocaleString()} of ${N.stats.files.toLocaleString()} files. The rest are tests, installed libraries, generated output or tools' files.`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`stats-all-code`,checked:L,onChange:e=>R(e.target.checked)}),`Libraries and tests too`]})]}),N.total===0?(0,X.jsx)(`p`,{className:`hint`,children:`No groups: nothing was analyzed.`}):(0,X.jsx)(ow,{marks:v,onContext:x&&(e=>pe(e.id)?void 0:x(e)),only:b,map:se?.map??N,layoutKey:`${e}|${N.committedRun}|${i??``}|${se?.area??``}|${[...ae].join(`,`)}|${w}`,pick:a,showPackages:F,onPick:e=>pe(e)?fe(e):d(e),onOpen:fe,onClear:g,differences:w===`connected`&&T?N.differences??[]:null}),N.truncated&&(0,X.jsxs)(`p`,{className:`hint small`,children:[`Showing `,N.groups.length,` of `,N.total,` groups.`]})]})]})}function hw({n:e,label:t,tone:n}){return(0,X.jsxs)(`div`,{className:n,children:[(0,X.jsx)(`dd`,{children:e.toLocaleString()}),(0,X.jsx)(`dt`,{children:t})]})}var gw=e=>e.slice(e.indexOf(`:`)+1);function _w(e){return!e||e.kind===`cluster`?``:e.root}var vw=(e,t=34)=>e.length>t?`${e.slice(0,t-1)}…`:e,yw=e=>e.slice(e.lastIndexOf(`/`)+1);function bw(e){let t=[e.name,e.member].filter(Boolean).join(`.`)||`?`;return`${e.packageName??`runtime`}: ${t}`}function xw(e){let t=e.direction===`forward`?1:-1,n=[],r=new Map,i=[],a=e=>{let t=r.get(e)??0;r.set(e,t+1);let n={position:{x:0,y:0},depth:e,row:t};return i.push(n),n.position},o=new Map(e.functions.map(e=>[e.id,e.depth])),s=new Set(e.starts.map(e=>e.function));for(let t of e.functions)n.push({group:`nodes`,data:{id:t.id,kind:`function`,label:`${vw(t.name,26)}${s.has(t.id)?` ▸ start`:``}\n${vw(yw(t.path),28)}`,path:t.path,line:t.line,depth:t.depth},position:a(t.depth),classes:[`function`,...t.depth===0?[`root`]:[],...s.has(t.id)?[`start`]:[]].join(` `)});e.edges.forEach((e,t)=>{o.has(e.from)&&o.has(e.to)&&n.push({group:`edges`,data:{id:`hop|${t}`,source:e.from,target:e.to,kind:e.kind,label:e.kind===`call`||e.kind===`cross-file`?``:e.kind,path:e.evidence.file.slice(e.evidence.file.indexOf(`:`)+1),line:e.evidence.span.start.line,file:e.evidence.file},classes:e.trust===`candidate`?`hop candidate`:`hop`})});let c=new Map;for(let t of e.gaps){let e=`gap|${t.in}|${t.expression}|${t.reason}`,n=c.get(e);n?n.count++:c.set(e,{id:e,in:t.in,label:`? ${vw(t.expression,26)}\n${t.reason}`,kind:`gap`,count:1,file:t.evidence.file,line:t.evidence.span.start.line})}for(let t of e.exits){let e=bw(t.exit),n=`exit|${t.in}|${e}`,r=c.get(n);r?r.count++:c.set(n,{id:n,in:t.in,label:vw(e,30),kind:`exit`,count:1,file:t.evidence.file,line:t.evidence.span.start.line})}for(let e of[...c.values()].sort((e,t)=>e.id<t.id?-1:1)){let t=o.get(e.in);t!==void 0&&(n.push({group:`nodes`,data:{id:e.id,kind:e.kind,label:e.count>1?`${e.label} ×${e.count}`:e.label,file:e.file,line:e.line},position:a(t+1),classes:`port ${e.kind}`}),n.push({group:`edges`,data:{id:`to|${e.id}`,source:e.in,target:e.id,kind:e.kind,label:``,file:e.file,line:e.line},classes:`stop ${e.kind}`}))}let l=Math.max(0,...r.keys()),u=[],d=0;for(let e=0;e<=l;e++)u[e]=d,d+=Math.ceil((r.get(e)??1)/24)*270;for(let e of i)e.position.x=t*(u[e.depth]+Math.floor(e.row/24)*270),e.position.y=e.row%24*62;return n}var Sw=e=>e.slice(e.indexOf(`:`)+1),Cw=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function ww({project:e,run:t,root:n,direction:r,onDirection:i,onReach:a,onOpenFile:o,onContext:s}){let{reach:c,error:l}=wS(e,t,n,r),[u,d]=(0,y.useState)(null),f=(0,y.useRef)(null),p=(0,y.useRef)(null),m=Je();(0,y.useEffect)(()=>{p.current?.style(Tw())},[m]);let h=(0,y.useRef)({onReach:a,onContext:s});h.current={onReach:a,onContext:s};let g=(0,y.useMemo)(()=>c?xw(c):[],[c]);(0,y.useEffect)(()=>d(null),[n,r]),(0,y.useEffect)(()=>{if(!f.current||g.length===0)return;let e=J_({container:f.current,elements:g,layout:{name:`preset`},autounselectify:!0,minZoom:.1,maxZoom:2.5,style:Tw()});return e.on(`tap`,`edge`,t=>{e.elements().removeClass(`picked`),t.target.addClass(`picked`),d(t.target.data())}),e.on(`tap`,`node`,e=>{let t=e.target.data();t.kind===`function`?h.current.onReach(t.id):d(t)}),e.on(`cxttap`,`node`,e=>{let t=e.target.data();if(t.kind!==`function`||!f.current)return;let n=f.current.getBoundingClientRect(),r=e.renderedPosition??{x:0,y:0};h.current.onContext?.({kind:`function`,id:t.id,data:t,x:n.left+r.x,y:n.top+r.y})}),e.fit(void 0,30),e.zoom()>1.2&&(e.zoom(1.2),e.center()),p.current=e,()=>{p.current=null,e.destroy()}},[g]);let _=new Map((c?.functions??[]).map(e=>[e.id,e.name])),v=e=>_.get(e)??e,b=c?.counts,x=b?`in ${Cw(b.files,`file`)} across ${Cw(b.groups,`group`)}`:``,S=c?.functions.find(e=>e.id===n)?.name??Sw(n);return(0,X.jsxs)(`div`,{className:`reach`,"data-testid":`reach`,children:[(0,X.jsxs)(`div`,{className:`toolbar`,children:[(0,X.jsx)(`span`,{className:`file-title`,title:n,children:S}),(0,X.jsx)(`div`,{className:`segmented`,role:`group`,"aria-label":`Direction`,children:[`forward`,`backward`].map(e=>(0,X.jsx)(`button`,{"aria-pressed":r===e,"data-command":`open-reach`,"data-direction":e,title:e===`forward`?`What paths from it reach`:`What reaches it`,onClick:()=>i(e),children:e===`forward`?`Reaches →`:`← Reached by`},e))}),b&&(0,X.jsx)(`span`,{className:`reach-counts`,"data-testid":`reach-counts`,children:r===`forward`?`${b.functions?`reaches ${Cw(b.functions,`function`)} ${x}`:`reaches no other function`} · ${Cw(b.gaps,`gap`)} · ${Cw(b.exits,`exit`)}`:`${b.functions?`reached by ${Cw(b.functions,`function`)} ${x}`:`nothing reaches it`}${c.starts.length?` · ${Cw(c.starts.length,`start candidate`)}`:``}`}),c?.truncated&&(0,X.jsxs)(`span`,{className:`badge degraded`,"data-testid":`reach-truncated`,children:[`stopped at the `,c.truncated.reason,` budget, `,Cw(c.truncated.depth,`step`),` out`]})]}),l&&(0,X.jsx)(`div`,{className:`error`,children:l}),(0,X.jsx)(`div`,{className:`graph-wrap`,children:(0,X.jsx)(`div`,{className:`graph map`,ref:f,"data-testid":`reach-canvas`})}),u&&(0,X.jsxs)(`div`,{className:`reach-hop`,"data-testid":`reach-hop`,children:[(0,X.jsxs)(`span`,{children:[String(u.kind),` · `,String(u.file??``).slice(String(u.file??``).indexOf(`:`)+1),`:`,String(u.line??``)]}),typeof u.file==`string`&&(0,X.jsx)(`button`,{"data-command":`open-file`,onClick:()=>o(u.file,u.line),children:`Open`})]}),c&&(0,X.jsxs)(`details`,{className:`reach-list`,"data-testid":`reach-list`,children:[(0,X.jsx)(`summary`,{children:`As a list`}),(0,X.jsx)(`ol`,{children:c.functions.map(e=>(0,X.jsxs)(`li`,{"data-depth":e.depth,children:[` `.repeat(e.depth),(0,X.jsx)(`button`,{className:`link`,"data-command":`open-reach`,title:`Reach from this function instead`,onClick:()=>a(e.id),children:e.name}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[e.path,`:`,e.line]})]},e.id))}),(0,X.jsx)(`ul`,{"data-testid":`reach-hops`,children:c.edges.map((e,t)=>(0,X.jsxs)(`li`,{"data-kind":e.kind,"data-trust":e.trust,children:[(0,X.jsxs)(`button`,{"data-command":`reach-hop`,onClick:()=>d({kind:e.kind,file:e.evidence.file,line:e.evidence.span.start.line}),children:[v(e.from),` → `,v(e.to)]}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[e.kind,e.trust===`candidate`?` (candidate)`:``]})]},t))}),c.gaps.length>0&&(0,X.jsx)(`ul`,{"data-testid":`reach-gaps`,children:c.gaps.map(e=>(0,X.jsxs)(`li`,{children:[`? `,e.expression,` `,(0,X.jsx)(`span`,{className:`muted`,children:e.reason}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[Sw(e.evidence.file),`:`,e.evidence.span.start.line]})]},e.site))}),c.exits.length>0&&(0,X.jsx)(`ul`,{"data-testid":`reach-exits`,children:c.exits.map(e=>(0,X.jsxs)(`li`,{children:[e.expression,` `,(0,X.jsx)(`span`,{className:`muted`,children:e.exit.packageName??`runtime`}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[Sw(e.evidence.file),`:`,e.evidence.span.start.line]})]},e.id))})]})]})}function Tw(){return[{selector:`node`,style:{shape:`round-rectangle`,width:210,height:48,label:`data(label)`,"text-wrap":`wrap`,"text-max-width":`194px`,"text-valign":`center`,"text-halign":`center`,"font-size":14,color:Z(`gray-26`),"background-color":Z(`gray-100`),"border-width":1,"border-color":Z(`gray-86`)}},{selector:`node.root`,style:{"border-color":Z(`blue-56`),"border-width":2,"font-weight":`bold`}},{selector:`node.start`,style:{"border-color":Z(`green-57`),"border-width":2}},{selector:`node.port.gap`,style:{"border-style":`dotted`,"border-color":Z(`red-54`),color:Z(`red-44`),"background-color":Z(`gray-98-9`)}},{selector:`node.port.exit`,style:{"border-style":`double`,"border-width":3,"border-color":Z(`blue-62`),color:Z(`blue-47`)}},{selector:`edge`,style:{width:1.5,"curve-style":`bezier`,"line-color":Z(`gray-44`),"target-arrow-shape":`triangle`,"target-arrow-color":Z(`gray-44`),"arrow-scale":.8,label:`data(label)`,"font-size":11,color:Z(`gray-51-2`),"text-background-color":Z(`gray-100`),"text-background-opacity":1}},{selector:`edge.candidate`,style:{"line-style":`dashed`,"line-color":Z(`gray-67`)}},{selector:`edge.stop.gap`,style:{"line-style":`dotted`,"line-color":Z(`red-54`),"target-arrow-shape":`none`}},{selector:`edge.stop.exit`,style:{"line-color":Z(`blue-62`),"target-arrow-color":Z(`blue-62`)}},{selector:`.picked`,style:{"line-color":Z(`blue-56`),"target-arrow-color":Z(`blue-56`),width:3}}]}function Ew(e,t,n){let r=new Map,i=e=>{let t=r.get(e.id);return t||r.set(e.id,t={kind:`function`,end:e,out:[],into:[]}),t};for(let n of t)n.from.file===e&&i(n.from).out.push(n);for(let t of n)t.to.file===e&&i(t.to).into.push(t);let a=e=>e.end.title!==void 0&&e.end.suite!==void 0&&e.into.length===0&&e.out.length>0?`${e.end.suite}\u0000${[...new Set(e.out.map(e=>e.to.id))].sort().join(`\0`)}`:null,o=new Map;for(let e of r.values()){let t=a(e);t!==null&&o.set(t,[...o.get(t)??[],e])}let s=[],c=new Set;for(let e of r.values()){let t=a(e),n=t===null?void 0:o.get(t);if(!n||n.length<2){s.push(e);continue}if(c.has(t))continue;c.add(t);let r=new Map(n.flatMap(e=>e.out.map(e=>[e.to.id,e.to])));s.push({kind:`suite`,suite:e.end.suite,callees:[...r.values()],tests:n})}return s}var Dw={focus:3,site:2,call:1},Ow=e=>e.end.column<=1&&e.end.line>e.start.line?e.end.line-1:e.end.line;function kw(e,t){if(e.kind!==`call`||Ow(e)===e.start.line)return e;let n=Array.from(t(e.start.line)??``),r=n.indexOf(`(`,e.start.column-1),i=r>=0?r+2:n.length+1;return{...e,end:{line:e.start.line,column:i}}}function Aw(e,t){let n=t=>e.lines[t-e.startLine],r=t.map(e=>kw(e,n)),i=r.map(e=>(e.end.line-e.start.line)*1e4+(e.end.column-e.start.column)),a=new Map;r.forEach((t,n)=>{let r=Math.max(t.start.line,e.startLine),i=Math.min(Ow(t),e.startLine+e.lines.length-1);for(let e=r;e<=i;e++){let t=a.get(e);t?t.push(n):a.set(e,[n])}});let o=new Set;return e.lines.map((t,n)=>{let s=e.startLine+n,c=Array.from(t),l=c.map(()=>null);for(let e of a.get(s)??[]){let t=r[e],n=s===t.start.line?t.start.column-1:0,a=s===t.end.line?t.end.column-1:c.length;for(let o=Math.max(0,n);o<Math.min(c.length,a);o++){let n=l[o];(n==null||Dw[t.kind]>Dw[r[n].kind]||Dw[t.kind]===Dw[r[n].kind]&&i[e]<i[n])&&(l[o]=e)}}let u=[];return c.forEach((e,t)=>{let n=u[u.length-1],r=l[t]??null;if(n&&n.mark===r)n.text+=e;else{let t=r!==null&&!o.has(r);r!==null&&o.add(r),u.push({text:e,mark:r,first:t})}}),{n:s,runs:u,focus:r.some(e=>e.kind===`focus`&&s>=e.start.line&&s<=Ow(e))}})}function jw({snippet:e,marks:t,focusLine:n,testId:r,className:i}){let a=(0,y.useRef)(null),o=(0,y.useMemo)(()=>Aw(e,t),[e,t]);(0,y.useEffect)(()=>{let e=a.current,t=e?.querySelector(`[data-line="${n}"]`);e&&t&&(e.scrollTop=Math.max(0,t.offsetTop-e.clientHeight/3))},[e,n]);let s=e=>{let n=e?.closest(`[data-mark]`);if(!n)return!1;let r=t[Number(n.dataset.mark)];return r?.onClick?(r.onClick(),!0):!1};return(0,X.jsx)(`pre`,{className:`code ${i??``}`,"data-testid":r,ref:a,onClick:e=>s(e.target),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&s(e.target)&&e.preventDefault()},children:o.map(({n:e,runs:n,focus:r})=>(0,X.jsxs)(`div`,{"data-line":e,className:r?`focus-line`:``,children:[(0,X.jsx)(`span`,{className:`ln`,"aria-hidden":`true`,children:e}),` `,n.map((e,n)=>{if(e.mark===null)return e.text;let r=t[e.mark],i=r.kind===`focus`?`hit`:r.kind===`site`?`site-mark`:`call-mark`,a=!!r.onClick;return(0,X.jsx)(`span`,{className:`mark ${i}${a?` clickable`:``}`,"data-mark":e.mark,title:r.title,...a&&e.first?{role:`button`,tabIndex:0}:{},children:e.text},n)})]},e))})}function Mw({title:e,location:t,snippet:n,marks:r,focusLine:i,onClose:a}){let o=(0,y.useRef)(null),s=(0,y.useRef)(null);return(0,y.useEffect)(()=>{o.current?.focus();let e=e=>{if(e.key===`Escape`)e.stopPropagation(),a();else if(e.key===`Tab`&&s.current){let t=s.current.querySelectorAll(`button, [tabindex="0"]`),n=t[0],r=t[t.length-1];s.current.contains(document.activeElement)?e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus()):(e.preventDefault(),n?.focus())}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[a]),(0,X.jsx)(`div`,{className:`backdrop`,onMouseDown:e=>e.target===e.currentTarget&&a(),children:(0,X.jsxs)(`div`,{className:`modal code-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":e,"data-testid":`code-modal`,ref:s,tabIndex:-1,children:[(0,X.jsxs)(`div`,{className:`evidence-head`,children:[(0,X.jsx)(`h3`,{children:e}),(0,X.jsx)(`code`,{className:`muted small`,children:t}),(0,X.jsx)(`button`,{ref:o,className:`icon close`,"aria-label":`Close (Esc)`,title:`Close (Esc)`,onClick:a,children:`×`})]}),n?(0,X.jsx)(jw,{snippet:n,marks:r,focusLine:i,testId:`modal-code`,className:`large`}):(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`}),(0,X.jsx)(`p`,{className:`muted small`,children:`Use your browser's find (⌘F / Ctrl+F) to search the code.`})]})})}function Nw(e,t){let n=new Map(t.declared.map(e=>[e.id,e.name])),r=t.files.filter(t=>t.connected===e),i=`Declared in ${r.map(e=>`${n.get(e.declared)??e.declared} (${e.count} file${e.count===1?``:`s`})`).join(`, `)}`;if(t.declared.length===1)return t.connected.length>1?`${i}, which this grouping has as ${t.connected.length} groups`:i;let a=r.length>1?`: files of ${r.length} declared groups in one`:``,o=t.declared.length>r.length||t.connected.length>1?`; around it, ${t.declared.length} declared groups regroup as ${t.connected.length}`:``;return i+a+o}var Pw=(e,t,n=`${t}s`)=>`${e.toLocaleString(`en-US`)} ${e===1?t:n}`;function Fw({project:e,run:t,from:n,to:r,onOpenFile:i}){let[a,o]=(0,y.useState)([]),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1),d=mS(),f=JSON.stringify([e,t,n,r,d]),p=(0,y.useRef)(f);if(p.current=f,(0,y.useEffect)(()=>{let t=!1;return o([]),c(null),Y.callsBetween(e,n,r,0,d).then(e=>!t&&o([e]),e=>!t&&c(e.message)),()=>{t=!0}},[f]),s)return(0,X.jsx)(`p`,{className:`hint error`,children:s});let m=a[0];if(!m)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});let h=a.flatMap(e=>e.calls),g=m.pair.summary,_=new Map;for(let e of h)_.set(e.from.path,[..._.get(e.from.path)??[],e]);let v=()=>{if(l)return;let t=f;u(!0),Y.callsBetween(e,n,r,h.length,d).then(e=>{p.current===t&&o(t=>[...t,e])},e=>c(e.message)).finally(()=>u(!1))};return(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`pair-details`,children:[(0,X.jsxs)(`h3`,{children:[m.pair.from.name,` → `,m.pair.to.name]}),(0,X.jsxs)(`p`,{"data-testid":`pair-summary`,children:[m.pair.from.name,` calls into `,m.pair.to.name,`: `,Pw(g.calls,`call`),` from`,` `,Pw(g.callers,`function`),` to `,Pw(g.callees,`function`),g.references?`, ${Pw(g.references,`reference`)}`:``,` (`,Pw(g.imports,`import`),`)`]}),g.calls===0&&(0,X.jsx)(`p`,{className:`small muted`,children:g.references?`No calls: functions are handed on between them (references).`:`No calls: only imports link them.`}),[..._].map(([e,t])=>(0,X.jsxs)(`div`,{className:`pair-file`,children:[(0,X.jsx)(`h4`,{className:`small`,children:(0,X.jsx)(`button`,{className:`link`,onClick:()=>i(t[0].from.file),children:e})}),(0,X.jsx)(`ul`,{className:`plain`,"data-testid":`pair-calls`,children:t.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`button`,{className:`link`,onClick:()=>i(e.from.file),children:Se(e.from)}),` `,(0,X.jsxs)(`span`,{className:`small muted`,children:[`:`,e.evidence.span.start.line]}),` →`,` `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>i(e.to.file),children:Se(e.to)}),` `,(0,X.jsxs)(`span`,{className:`small muted`,children:[`(`,e.to.path,`)`]})]},e.id))})]},e)),h.length<m.total&&(0,X.jsx)(`button`,{className:`link small`,"data-testid":`pair-more`,disabled:l,onClick:v,children:l?`Loading…`:`${m.total-h.length} more calls…`}),m.pair.references.length>0&&(0,X.jsxs)(`details`,{children:[(0,X.jsxs)(`summary`,{className:`small`,children:[`References (`,g.references,`)`]}),(0,X.jsx)(`ul`,{className:`plain small`,children:m.pair.references.map(e=>(0,X.jsxs)(`li`,{children:[Se(e.from),` hands on `,Se(e.to),` (`,e.to.path,`) · `,e.context,` · line`,` `,e.evidence.span.start.line]},e.id))})]}),m.pair.imports.length>0&&(0,X.jsxs)(`details`,{children:[(0,X.jsxs)(`summary`,{className:`small`,children:[`Imports (`,g.imports,`)`]}),(0,X.jsx)(`ul`,{className:`plain small`,"data-testid":`pair-imports`,children:m.pair.imports.map(e=>(0,X.jsxs)(`li`,{children:[e.path,`:`,e.evidence.span.start.line,` · `,(0,X.jsx)(`code`,{children:e.specifier})]},e.id))})]})]})}var Iw={repository:`repository`,"workspace-package":`workspace package`,cluster:`cluster`,module:`module`,shared:`shared layer`};function Lw(e){let{project:t,run:n,pick:r,file:i,fileLevel:a}=e;return a&&i&&r?.startsWith(`CALLS_CROSS_FILE|`)?(0,X.jsx)(Jw,{project:t,run:n,file:i,call:r}):a&&i&&(r?.startsWith(`IMPORTS|`)||r?.startsWith(`unresolved-import|`))?(0,X.jsx)(Zw,{project:t,run:n,file:i,edge:r}):a&&i?(0,X.jsx)(Hw,{project:t,run:n,file:i,onOpenFile:e.onOpenFile}):r&&(r.startsWith(`DEPENDS_ON|`)||r.startsWith(`arrow|`))?(0,X.jsx)(Rw,{...e,arrow:r}):r&&r.startsWith(`calls|`)?(0,X.jsx)(zw,{...e,link:r}):r&&r.startsWith(`folder|`)?(0,X.jsx)(Gw,{...e,folder:r}):r&&!r.startsWith(`group|`)?(0,X.jsx)(Hw,{project:t,run:n,file:r,onOpenFile:e.onOpenFile,canOpen:!0}):(0,X.jsx)(Bw,{project:t,run:n,group:e.group,pick:r,onOpenGroup:e.onOpenGroup,onPick:e.onPick})}function Rw({project:e,run:t,arrow:n,onOpenFile:r}){let{groups:i}=bS(e,t);if(!i)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});let a=null;if(n.startsWith(`DEPENDS_ON|`)){let e=i.dependsOn.find(e=>e.id===n);e&&(a=[[e.from],[e.to]])}else{let[e,t]=n.slice(6).split(`|`).map(decodeURIComponent);e&&t&&(a=[[e],[t]])}return!a||a[0].length===0||a[1].length===0?(0,X.jsx)(`p`,{className:`hint`,children:`That arrow isn't on the map any more.`}):(0,X.jsx)(Fw,{project:e,run:t,from:a[0],to:a[1],onOpenFile:r})}function zw({project:e,run:t,group:n,link:r,expand:i,showPending:a,onOpenFile:o}){let{group:s}=xS(e,t,n,i,a);if(!s)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});let c=[...s.calls,...s.callStubEdges].find(e=>e.id===r);return c?(0,X.jsx)(Fw,{project:e,run:t,from:[c.from],to:[(e=>e.startsWith(`stub|`)?e.slice(5):e)(c.to)],onOpenFile:o}):(0,X.jsx)(`p`,{className:`hint`,children:`That link isn't drawn any more.`})}function Bw({project:e,run:t,group:n,pick:r,onOpenGroup:i,onPick:a}){let{groups:o}=bS(e,t),s=n??(o?.total===1?o.groups[0].id:r),c=s&&o?o.groups.find(e=>e.id===s):void 0;if(!o)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});if(!o.stage2)return(0,X.jsx)(`p`,{className:`hint`,children:`Stage 2 hasn't run on this project, so there are no groups yet.`});if(!c)return(0,X.jsx)(`p`,{className:`hint`,children:`Pick a group on the map to see what it holds and what it depends on; double-click or press Enter to open it.`});let u=e=>o.groups.find(t=>t.id===e)?.name??e,d=o.dependsOn.filter(e=>e.from===c.id&&l(e)),f=o.dependsOn.filter(e=>e.to===c.id&&l(e)),p=o.dependsOn.filter(e=>(e.from===c.id||e.to===c.id)&&!l(e)),m=c.findings,h=(e,t,r)=>e.length===0?(0,X.jsx)(`p`,{className:`small muted`,"data-testid":r,children:`None`}):(0,X.jsx)(`ul`,{className:`plain`,"data-testid":r,children:e.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`button`,{className:`link`,onClick:()=>n?i(e[t]):a(e[t]),children:u(e[t])}),` `,(0,X.jsx)(`span`,{className:`small muted`,children:l(e)?JC(e):`${e.imports} import${e.imports===1?``:`s`}, no call`})]},e.id))});return(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`group-details`,children:[(0,X.jsx)(`h3`,{children:c.name}),(0,X.jsxs)(`p`,{className:`muted small`,children:[c.source,` · `,Iw[c.kind]??c.kind,c.root?` · ${c.root}`:``]}),c.why&&(0,X.jsx)(`p`,{className:`small`,"data-testid":`group-why`,children:c.why}),(()=>{let e=o.differences?.find(e=>e.connected.some(e=>e.id===c.id));return e?(0,X.jsx)(`p`,{className:`small`,"data-testid":`group-differs`,children:Nw(c.id,e)}):null})(),(0,X.jsxs)(`p`,{children:[c.files.toLocaleString(),` files · `,c.functions.toLocaleString(),` functions · `,c.externalPackages,` `,`external package`,c.externalPackages===1?``:`s`]}),m.broken+m.notAnalyzed+m.openCalls+m.pending>0&&(0,X.jsx)(`p`,{className:`small`,"data-testid":`group-findings`,children:[m.broken?`${m.broken} broken import${m.broken===1?``:`s`}`:``,m.notAnalyzed?`${m.notAnalyzed} import${m.notAnalyzed===1?``:`s`} of files not analyzed`:``,m.openCalls?`${m.openCalls} open question${m.openCalls===1?``:`s`}`:``,m.pending?`${m.pending} pending`:``].filter(Boolean).join(` · `)}),(0,X.jsx)(`h4`,{className:`small role-into`,children:`▶ Calls into`}),h(d,`to`,`calls-into`),(0,X.jsx)(`h4`,{className:`small role-from`,children:`◀ Called from`}),h(f,`from`,`called-from`),p.some(e=>e.from===c.id)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h4`,{className:`muted small`,title:`Type-only, value-only or unused imports: no path, so no arrow`,children:`Imports from, no calls`}),h(p.filter(e=>e.from===c.id),`to`,`imports-only`)]}),p.some(e=>e.to===c.id)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h4`,{className:`muted small`,title:`Type-only, value-only or unused imports: no path, so no arrow`,children:`Imported by, no calls`}),h(p.filter(e=>e.to===c.id),`from`,`imported-only`)]}),!n&&o.total>1&&(0,X.jsxs)(`button`,{"data-command":`open-group`,"data-testid":`open-picked`,onClick:()=>i(c.id),children:[`Open `,c.name]})]})}var Vw=e=>e.slice(e.indexOf(`:`)+1);function Hw({project:e,run:t,file:n,onOpenFile:r,canOpen:i=!1}){let{imports:a,error:o}=SS(e,t,n),{groups:s}=bS(e,t),{calls:c,error:l}=TS(e,t,i?null:n);if(o)return(0,X.jsx)(`p`,{className:`hint error`,children:o});if(!a)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});let u=a.file.group?s?.groups.find(e=>e.id===a.file.group):void 0,d=u&&u.kind!==`cluster`?u.root:``;return(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`file-details`,children:[(0,X.jsx)(`h3`,{className:`mono`,children:aS(a.file.path,d)}),(0,X.jsx)(`p`,{className:`muted small`,children:u?`${u.name} · ${u.source}`:Vw(n)}),l&&(0,X.jsxs)(`p`,{className:`small error`,children:[`Calls across files: `,l]}),c&&(0,X.jsx)(Ww,{file:n,calls:c,onOpenFile:r}),(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Imports (`,a.total,`)`]}),a.imports.length===0?(0,X.jsx)(`p`,{className:`small muted`,children:`None`}):(0,X.jsx)(`ul`,{className:`plain`,"data-testid":`file-imports`,children:a.imports.map(e=>(0,X.jsxs)(`li`,{className:e.outcome===`broken`?`broken`:void 0,"data-outcome":e.outcome,children:[(0,X.jsx)(`span`,{className:`mono small`,children:e.specifier}),` `,e.outcome===`file`&&e.file?(0,X.jsx)(`button`,{className:`link small`,onClick:()=>r(e.file.id),children:e.file.path}):e.outcome===`package`&&e.package?(0,X.jsxs)(`span`,{className:`small muted`,children:[`package `,e.package.name,e.package.version?` ${e.package.version}`:``]}):(0,X.jsxs)(`span`,{className:`small outcome`,children:[`(`,e.outcome===`not-analyzed`?`not analyzed`:e.outcome,`:`,` `,eS[e.reason??``]??e.reason,`)`]})]},e.id))}),a.truncated&&(0,X.jsxs)(`p`,{className:`small muted`,children:[`Showing `,a.imports.length,` of `,a.total,`.`]}),(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Imported by (`,a.importedBy.total,`)`]}),a.importedBy.files.length===0?(0,X.jsx)(`p`,{className:`small muted`,children:`None`}):(0,X.jsx)(`ul`,{className:`plain`,"data-testid":`file-importers`,children:a.importedBy.files.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(`button`,{className:`link small`,onClick:()=>r(e.file.id),children:e.file.path})},e.id))}),i&&(0,X.jsx)(`button`,{"data-command":`open-imports-file`,"data-testid":`open-picked-file`,onClick:()=>r(n),children:`Open file`})]})}function Uw({end:e}){let{name:t,parent:n,test:r}=xe(e);return(0,X.jsxs)(X.Fragment,{children:[r&&(0,X.jsx)(`small`,{className:`tag`,children:`test`}),` `,(0,X.jsx)(`strong`,{title:e.name,children:t}),n&&(0,X.jsxs)(`span`,{className:`small muted`,children:[` in `,n]})]})}function Ww({file:e,calls:t,onOpenFile:n}){let r=Ew(e,t.out.calls,t.in.calls);if(r.length===0)return(0,X.jsx)(`p`,{className:`small muted`,children:`No calls to or from other files.`});let i=r.reduce((e,t)=>e+(t.kind===`suite`?t.tests.length:1),0),a=t.out.truncated||t.in.truncated,o=e=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{className:`link`,title:e.to.name,onClick:()=>n(e.to.file),children:Se(e.to)}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[`(`,e.to.path,`)`]})]});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Functions calling across files (`,i,`)`]}),(0,X.jsx)(`ul`,{className:`plain`,"data-testid":`file-function-calls`,children:r.map(e=>e.kind===`suite`?(0,X.jsx)(`li`,{"data-testid":`suite-calls`,children:(0,X.jsxs)(`details`,{children:[(0,X.jsxs)(`summary`,{children:[(0,X.jsx)(`small`,{className:`tag`,children:`test`}),` `,(0,X.jsxs)(`strong`,{children:[`“`,e.suite,`”`]}),(0,X.jsxs)(`span`,{className:`small`,children:[` `,`· `,e.tests.length,` tests call`,` `,e.callees.map((e,t)=>(0,X.jsxs)(`span`,{children:[t>0&&`, `,(0,X.jsx)(`button`,{className:`link`,title:e.name,onClick:()=>n(e.file),children:Se(e)}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[`(`,e.path,`)`]})]},e.id))]})]}),(0,X.jsx)(`ul`,{className:`plain small suite-tests`,children:e.tests.map(e=>(0,X.jsxs)(`li`,{"data-function":e.end.id,children:[(0,X.jsx)(`span`,{title:e.end.name,children:xe(e.end).name}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[`· line `,e.out.map(e=>e.evidence.span.start.line).join(`, `)]})]},e.end.id))})]})},`suite|${e.tests[0].end.id}`):(0,X.jsxs)(`li`,{"data-function":e.end.id,children:[(0,X.jsx)(Uw,{end:e.end}),e.out.length>0&&(0,X.jsxs)(`div`,{className:`small`,children:[`calls`,` `,e.out.map((e,t)=>(0,X.jsxs)(`span`,{children:[t>0&&`, `,o(e),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[`at line `,e.evidence.span.start.line]})]},e.id))]}),e.into.length>0&&(0,X.jsxs)(`div`,{className:`small`,children:[`called by`,` `,e.into.map((e,t)=>(0,X.jsxs)(`span`,{children:[t>0&&`, `,(0,X.jsx)(`button`,{className:`link`,title:e.from.name,onClick:()=>n(e.from.file),children:Se(e.from)}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[`(`,e.from.path,`)`]})]},e.id))]})]},e.end.id))}),a&&(0,X.jsx)(`p`,{className:`small muted`,children:`The first 500 calls each way are listed.`})]})}function Gw({project:e,run:t,group:n,folder:r,expand:i,showPending:a,onToggleFolder:o}){let{groups:s}=bS(e,t),{group:c}=xS(e,t,n??(s?.total===1?s.groups[0].id:null),i,a),l=c?.nodes.find(e=>e.id===r);return!l||l.kind!==`folder`?(0,X.jsx)(`p`,{className:`hint`,children:`Pick a file or a folder in the group.`}):(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`folder-details`,children:[(0,X.jsxs)(`h3`,{className:`mono`,children:[l.path,`/`]}),(0,X.jsxs)(`p`,{children:[l.files.toLocaleString(),` files`]}),l.findings.broken>0&&(0,X.jsxs)(`p`,{className:`small`,children:[l.findings.broken,` broken import`,l.findings.broken===1?``:`s`]}),(0,X.jsx)(`button`,{"data-command":`toggle-folder`,onClick:()=>o(l.path),children:`Open the folder`})]})}function Kw({project:e,run:t,file:n,span:r}){let[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(!1),c=(0,y.useCallback)(()=>s(!1),[]),l=`${t}|${n}|${r.start.offset}|${r.end.offset}`;if((0,y.useEffect)(()=>{let t=!1;return a(null),Y.snippet(e,n,r).then(e=>!t&&a(e),()=>!t&&a(`error`)),()=>{t=!0}},[e,l]),!i)return null;if(i===`error`)return(0,X.jsx)(`p`,{className:`small muted`,children:`The code couldn't be loaded.`});let u=[{start:r.start,end:r.end,kind:`focus`}];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(jw,{snippet:i,marks:u,focusLine:r.start.line,testId:`snippet`}),(0,X.jsx)(`button`,{className:`button-link small`,"data-testid":`expand-code`,onClick:()=>s(!0),children:`Expand`}),o&&(0,X.jsx)(Mw,{title:Vw(n),location:`${Vw(n)}:${r.start.line}`,snippet:i,marks:u,focusLine:r.start.line,onClose:c})]})}function qw({file:e,span:t}){return(0,X.jsx)(`p`,{className:`location small`,"data-testid":`evidence-location`,children:(0,X.jsxs)(`code`,{children:[Vw(e),`:`,t.start.line,`:`,t.start.column]})})}function Jw({project:e,run:t,file:n,call:r}){let{calls:i}=TS(e,t,n),a=i?[...i.out.calls,...i.in.calls].find(e=>e.id===r):void 0;if(!i)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});if(!a)return(0,X.jsx)(`p`,{className:`hint`,children:`Pick a call or an import on the canvas.`});let o=a.via===`import`?`found by import analysis${a.hops?.length?`, through ${a.hops.length} re-export${a.hops.length===1?``:`s`}`:``}`:a.via===`component`?`found by component linking`:a.via===`injection`?`found by dependency injection: the class the framework provides`:a.via===`returned`?`found by following what a function returns`:a.via===`flow`?`found by following where the value comes from: fields, instances and methods`:a.via===`closed-world`?`found assuming the analyzed code is the whole program (closed world, a project setting)`:`found by the template link`,s=a.steps?.find(e=>e.kind===`import`);return(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`call-details`,children:[(0,X.jsxs)(`h3`,{"data-testid":`evidence-title`,children:[Se(a.from),` calls `,Se(a.to)]}),(0,X.jsxs)(`p`,{className:`muted small`,children:[`across files · `,o]}),s&&(0,X.jsx)(`p`,{className:`small`,"data-testid":`call-import`,children:s.detail}),a.hops&&a.hops.length>0&&(0,X.jsxs)(`p`,{className:`small muted`,children:[`through `,a.hops.join(` › `)]}),a.provenance&&(0,X.jsxs)(`p`,{className:`muted small`,"data-testid":`evidence-provenance`,children:[`Found by `,Ce(a.provenance.stage),` · run `,a.provenance.run]}),(0,X.jsx)(qw,{file:a.evidence.file,span:a.evidence.span}),(0,X.jsx)(Kw,{project:e,run:t,file:a.evidence.file,span:a.evidence.span}),(0,X.jsx)(Re,{project:e,id:a.id},a.id)]})}function Yw(e){if(e.uses===null)return`its use isn't known`;if(e.unused)return`never used`;let t=[],n=e.uses;return n.calls&&t.push(`called ${n.calls}×`),n.jsx&&t.push(`rendered ${n.jsx}×`),n.values&&t.push(`used ${n.values}×`),n.types&&t.push(`as a type ${n.types}×`),n.extends&&t.push(`extended`),n.reexports&&t.push(`exported again`),t.join(`, `)}function Xw({names:e}){return(0,X.jsxs)(`div`,{className:`imported-names`,"data-testid":`import-names`,children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Names (`,e.length,`)`]}),(0,X.jsx)(`ul`,{children:e.map(e=>(0,X.jsxs)(`li`,{"data-testid":`import-name`,"data-unused":e.unused||void 0,children:[(0,X.jsx)(`span`,{className:`mono small`,children:e.local}),` `,(0,X.jsxs)(`span`,{className:`small`,children:[e.target?e.target.kind===`package`?`from ${e.target.label}`:`${e.target.kind===`symbol`?`${e.target.symbolKind} `:e.target.kind===`module`?`module `:``}${e.target.kind===`module`?``:e.target.label}${e.target.path?` in ${e.target.path}`:``}`:e.outcome===`not-exported`?`not exported there`:`doesn't resolve (${e.outcome})`,` · `,(0,X.jsx)(`span`,{className:e.unused?`unused`:`muted`,children:Yw(e)})]})]},e.id))})]})}function Zw({project:e,run:t,file:n,edge:r}){let{imports:i}=SS(e,t,n);if(!i)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});let a=i.imports.find(e=>e.id===r),o=i.importedBy.files.find(e=>e.id===r);if(!a&&!o)return(0,X.jsx)(`p`,{className:`hint`,children:`Pick a call or an import on the canvas.`});let s=a?.evidence??o.evidence;return(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`import-details`,children:[(0,X.jsx)(`h3`,{"data-testid":`evidence-title`,children:a?`imports ${a.specifier}`:`${o.file.path} imports this file`}),a?.file&&(0,X.jsxs)(`p`,{className:`small`,children:[`resolves to `,a.file.path]}),a&&!a.file&&!a.package&&(0,X.jsxs)(`p`,{className:`small`,"data-testid":`import-outcome`,children:[a.outcome===`not-analyzed`?`not analyzed`:a.outcome,`:`,` `,eS[a.reason??``]??a.reason]}),a?.steps.map((e,t)=>(0,X.jsx)(`p`,{className:`small muted`,children:e.detail},t)),a?.names&&a.names.length>0&&(0,X.jsx)(Xw,{names:a.names}),(a?.provenance??o?.provenance)&&(0,X.jsxs)(`p`,{className:`muted small`,"data-testid":`evidence-provenance`,children:[`Found by `,Ce((a?.provenance??o.provenance).stage),` · run`,` `,(a?.provenance??o.provenance).run]}),(0,X.jsx)(qw,{file:s.file,span:s.span}),(0,X.jsx)(Kw,{project:e,run:t,file:s.file,span:s.span}),(0,X.jsx)(Re,{project:e,id:r},r)]})}var Qw=o(),$w=(e,t)=>`${e.toLocaleString(`en-US`)} ${t}${e===1?``:`s`}`,eT=8,tT=50,nT={installed:`installed by a package manager`,packages:`copied packages with their own manifests`,banners:`a library banner or versioned name`};function rT(e){return`${[e.name==="default"||e.name===null?``:e.name,e.member??``].filter(Boolean).join(e.member?.startsWith(`(`)?``:`.`)||`default`}${e.instance?` (on an instance)`:``}`}function iT({project:e,source:t,pkg:n,onOpen:r}){let[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(null),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(!1);(0,y.useEffect)(()=>{if(!i||o)return;let r=!0;return Y.library(e,n.name,n.ecosystem,t).then(e=>r&&s(e)).catch(e=>r&&l(e.message)),()=>{r=!1}},[i,o,e,n.name,n.ecosystem,t]);let f=n.files>0&&n.ownFiles===0,p=o?u?o.members:o.members.slice(0,eT):[];return(0,X.jsxs)(`li`,{children:[(0,X.jsxs)(`button`,{className:`library-row`,"data-testid":`library-package`,"data-name":n.name,"aria-expanded":i,title:`${n.name}${n.versions.length?` ${n.versions.join(`, `)}`:``}: imported by ${$w(n.files,`file`)} (${n.ownFiles.toLocaleString(`en-US`)} own code) in ${$w(n.groups,`group`)} · ${$w(n.calls,`call`)}${n.references?`, ${$w(n.references,`reference`)}`:``}`,onClick:()=>a(e=>!e),children:[(0,X.jsx)(`span`,{className:`caret`,"aria-hidden":`true`,children:i?`▾`:`▸`}),(0,X.jsx)(`span`,{className:`name`,children:n.name}),n.versions.length>0&&(0,X.jsx)(`small`,{className:`muted`,children:n.versions.join(`, `)}),n.typeOnly&&(0,X.jsx)(`small`,{className:`tag`,title:"Every import of it is `import type`: nothing of it runs",children:`types`}),f&&(0,X.jsx)(`small`,{className:`tag`,title:`Imported only by tests, libraries or generated files`,children:`not own code`}),(0,X.jsx)(`small`,{className:`count`,children:n.files})]}),i&&(0,X.jsxs)(`div`,{className:`library-detail`,"data-testid":`library-detail`,children:[c&&(0,X.jsx)(`p`,{className:`hint error`,children:c}),!o&&!c&&(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`}),o&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`small muted`,children:o.members.length===0?n.typeOnly?`Only its types are imported.`:`Nothing of it is called where the analysis can tell.`:`Used: ${$w(n.calls,`call`)}${n.references?`, ${$w(n.references,`reference`)}`:``}`}),p.length>0&&(0,X.jsx)(`ul`,{className:`library-members`,children:p.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`code`,{children:rT(e)}),(0,X.jsx)(`small`,{className:`count`,children:e.calls+e.references})]},`${e.name}|${e.member}|${e.instance}`))}),o.members.length>eT&&(0,X.jsx)(`button`,{className:`link small`,onClick:()=>d(e=>!e),children:u?`fewer`:`${o.members.length-eT} more`}),(0,X.jsx)(`p`,{className:`small muted`,children:`Imported by`}),(0,X.jsx)(`ul`,{className:`library-files`,children:o.importers.slice(0,tT).map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(`button`,{className:`link`,"data-command":`library-file`,"data-file":e.path,title:`${e.path}${e.group?` (${e.group.name})`:``}${e.own?``:`: not own code`}${e.forms.includes(`type-only`)?` · types`:``}`,onClick:()=>r(e.file),children:e.path})},e.file))}),o.importers.length>tT&&(0,X.jsxs)(`p`,{className:`small muted`,children:[`and `,$w(o.importers.length-tT,`more file`)]})]})]})]})}function aT({project:e,run:t,source:n,filter:r,onOpen:i}){let[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(``);if((0,y.useEffect)(()=>{let t=!0;return c(``),Y.libraries(e,n).then(e=>t&&o(e)).catch(e=>t&&c(e.message)),()=>{t=!1}},[e,n,t]),s)return(0,X.jsx)(`p`,{className:`hint error`,children:s});if(!a)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading libraries…`});let l=r.trim().toLowerCase(),u=a.packages.filter(e=>!l||e.name.toLowerCase().includes(l)),d=a.copied.filter(e=>!l||e.path.toLowerCase().includes(l)),f=a.leftOut.filter(e=>!l||e.path.toLowerCase().includes(l)),p=new Set([...a.copied,...a.leftOut].map(e=>e.source)).size>1,m=e=>p?`${e.source}/${e.path}`:e.path;return(0,X.jsxs)(`div`,{className:`libraries`,"data-testid":`libraries`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`h4`,{className:`outline-source`,children:[`Installed packages `,(0,X.jsx)(`small`,{className:`muted`,children:a.total})]}),a.stage2?u.length===0?(0,X.jsx)(`p`,{className:`hint`,children:l?`No packages match.`:`No file imports an installed package.`}):(0,X.jsx)(`ul`,{children:u.map(r=>(0,X.jsx)(iT,{project:e,source:n,pkg:r,onOpen:i},`${n??``}|${t??``}|${r.ecosystem}:${r.name}`))}):(0,X.jsx)(`p`,{className:`hint`,children:`Packages come from import analysis (Stage 2), which hasn't run for this project.`}),a.truncated&&(0,X.jsxs)(`p`,{className:`small muted`,children:[`The first `,$w(a.packages.length,`package`),`.`]})]}),d.length>0&&(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`h4`,{className:`outline-source`,title:`Third-party code copied into the project (plan D66)`,children:[`Copied into the project `,(0,X.jsx)(`small`,{className:`muted`,children:d.length})]}),(0,X.jsx)(`ul`,{children:d.map(e=>(0,X.jsxs)(`li`,{className:`library-row`,"data-testid":`library-copied`,title:`${m(e)}: ${nT[e.why]}${e.names.length?` (${e.names.join(`, `)})`:``}. ${e.state===`kept`?`Kept: analyzed as the project's own code.`:`Not decided: counted apart from own code until you keep it or leave it out.`}`,children:[(0,X.jsxs)(`span`,{className:`name`,children:[m(e),e.kind===`dir`?`/`:``]}),(0,X.jsx)(`small`,{className:`tag${e.state===`pending`?` warn`:``}`,children:e.state===`kept`?`kept`:`not decided`}),(0,X.jsx)(`small`,{className:`count`,children:e.files})]},`${e.source}|${e.path}`))})]}),f.length>0&&(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`h4`,{className:`outline-source`,title:`Library folders left out by default (plan D36, D57); Choose files… analyzes them`,children:[`Left out by default `,(0,X.jsx)(`small`,{className:`muted`,children:f.length})]}),(0,X.jsx)(`ul`,{children:f.map(e=>(0,X.jsxs)(`li`,{className:`library-row`,"data-testid":`library-left-out`,title:`${m(e)}/: ${e.files===null?`not read`:$w(e.files,`file`)}, not analyzed`,children:[(0,X.jsxs)(`span`,{className:`name`,children:[m(e),`/`]}),(0,X.jsx)(`small`,{className:`count`,children:e.files??`–`})]},`${e.source}|${e.path}`))})]})]})}var oT=24,sT=12,cT=300,lT=new Set([`apps`,`packages`,`services`,`libs`,`modules`,`crates`,`projects`]),uT=/(^|\/)([\w-]+\.config\.[cm]?[jt]sx?|\.?[\w-]*rc\.[cm]?[jt]s|(vite|vitest|jest|webpack|rollup|babel|eslint|prettier|tailwind|postcss|playwright|next|nuxt|svelte|astro|tsup|knip|commitlint|stylelint)\.[\w.-]*[cm]?[jt]s)$/i;function dT(e){return h(e)?`tests`:uT.test(e)?`config`:`source`}var fT=e=>e.status!==`analyzed`,pT={"parse-failure":`could not be parsed`,"declaration-file":`type declarations`,"language-not-analyzed":`language not analyzed yet`,"too-large":`too large`,binary:`not text`,minified:`minified`,"invalid-utf8":`not UTF-8 text`,unreadable:`could not be read`,entitlement:`beyond the license`,frozen:`kept from an earlier analysis (beyond the license)`},mT={degraded:`partly analyzed`,not_analyzed:`not analyzed`,parse_error:`could not be parsed`},hT=(e,t)=>e<t?-1:+(e>t);function gT(e,t,n){let r={key:``,name:``,dirs:new Map,files:[],total:0,functions:0};for(let i of e){let e=(n?`${i.source}/${i.path}`:i.path).split(`/`);e.pop();let a=r,o=t[i.id]?.functions??0;a.total++,a.functions+=o;let s=``;for(let t of e){s=s?`${s}/${t}`:t;let e=a.dirs.get(t);e||(e={key:s,name:t,dirs:new Map,files:[],total:0,functions:0},a.dirs.set(t,e)),a=e,a.total++,a.functions+=o}a.files.push(i)}return r}function _T(e,t=!1,n=0){for(let[r,i]of e.dirs)e.dirs.set(r,_T(i,t,n+1));if(e.key!==``&&!(t&&n===1)&&e.files.length===0&&e.dirs.size===1){let t=[...e.dirs.values()][0];return{...t,name:`${e.name}/${t.name}`}}return e}function vT(e,t,n){let r=[],i=(e,a)=>{let o=[...e.dirs.values()].sort((e,t)=>{if(a===0){let n=+!lT.has(e.name.split(`/`)[0]),r=+!lT.has(t.name.split(`/`)[0]);if(n!==r)return n-r}return hT(e.name,t.name)});for(let e of o){let n=t.has(e.key);r.push({type:`dir`,key:e.key,name:e.name,depth:a,open:n,total:e.total,functions:e.functions}),n&&i(e,a+1)}for(let t of[...e.files].sort((e,t)=>hT(e.path,t.path))){let e=n[t.id];r.push({type:`file`,file:t,depth:a,label:t.path.slice(t.path.lastIndexOf(`/`)+1),...e?{hint:`${e.functions}ƒ`}:{}})}};return i(e,0),r}var yT=60;function bT(e,t){let n=new Set,r=e=>{for(let t of e.dirs.values())n.add(t.key),r(t)};if(t<=yT)return r(e),n;for(let t of e.dirs.values())if(n.add(t.key),lT.has(t.name.split(`/`).pop())||lT.has(t.name.split(`/`)[0]))for(let e of t.dirs.values())n.add(e.key);return n}var xT=e=>`veoflow.tree.${e}`;function ST(e){try{let t=localStorage.getItem(xT(e)),n=t?JSON.parse(t):[];return n.length>0?new Set(n):null}catch{return null}}function CT(e,t){try{localStorage.setItem(xT(e),JSON.stringify([...t]))}catch{}}function wT({project:e,files:t,counts:n,current:r,onOpen:i,run:a=null,onAnalyze:o,sources:s=[],scope:c=null,onScope:l,onCollapse:u,onImports:d,onMenu:f,hidden:p=!1,onReveal:m}){let[h,g]=(0,y.useState)(!1),[_,v]=(0,y.useState)(``),[b,x]=(0,y.useState)({source:!0,tests:!1,config:!0}),[S,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(!1),E=(0,y.useRef)(null);a?.status===`committed`&&(E.current=a.runId);let[D,O]=(0,y.useState)(new Set),[k,A]=(0,y.useState)(0),[j,M]=(0,y.useState)(600),[N,P]=(0,y.useState)(0),F=(0,y.useRef)(null),I=(0,y.useRef)(null),L=t;t=(0,y.useMemo)(()=>c?L.filter(e=>e.source===c):L,[L,c]);let R=(0,y.useMemo)(()=>s.length>1||new Set(L.map(e=>e.source)).size>1,[L,s.length]),z=(0,y.useMemo)(()=>new Map(s.map(e=>[e.id,e])),[s]),B=e=>{let t=z.get(e)?.analysis;return t?t.kind===`git`?`${t.branch??`detached`} · ${t.revision.slice(0,7)} · ${we(t.analyzedAt)}`:`plain folder · latest only`:``},V=(0,y.useMemo)(()=>{let e={source:0,tests:0,config:0,attention:0};for(let n of t)e[dT(n.path)]++,fT(n)&&e.attention++;return e},[t]),H=(0,y.useMemo)(()=>t.filter(e=>S?fT(e):e.id===r||b[dT(e.path)]||fT(e)),[t,b,S,r]),U=(0,y.useMemo)(()=>{let e=_T(gT(H,n,R),R);return c&&R?e.dirs.get(c)??{...e,dirs:new Map,files:[]}:e},[H,n,R,c]),W=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!W.current&&e&&t.length!==0&&(W.current=!0,O(ST(e)??bT(U,t.length)))},[e,t,U]);let ee=t.find(e=>e.id===r);(0,y.useEffect)(()=>{if(!ee)return;let e=(R?`${ee.source}/${ee.path}`:ee.path).split(`/`);e.pop(),O(t=>{let n=new Set(t),r=``,i=!1;for(let t of e)r=r?`${r}/${t}`:t,n.has(r)||(n.add(r),i=!0);return i?n:t})},[ee?.id]);let G=(0,y.useMemo)(()=>{let e=_.trim().toLowerCase();return e?t.map(t=>{let n=t.path.toLowerCase(),r=n.slice(n.lastIndexOf(`/`)+1);return{f:t,rank:r.replace(/\.[^.]+$/,``)===e||r===e?0:r.startsWith(e)?1:r.includes(e)?2:n.includes(e)?3:-1,kind:dT(t.path)===`source`?0:1}}).filter(e=>e.rank>=0).sort((e,t)=>e.rank-t.rank||e.kind-t.kind||e.f.path.length-t.f.path.length||hT(e.f.path,t.f.path)).slice(0,cT).map(({f:e})=>{let t=e.path.includes(`/`)?e.path.slice(0,e.path.lastIndexOf(`/`)):``,n=R?z.get(e.source)?.name??e.source:``;return{type:`file`,file:e,depth:0,label:e.path.slice(e.path.lastIndexOf(`/`)+1),hint:[n,t].filter(Boolean).join(` · `)}}):vT(U,D,n)},[_,U,D,n,t,R,z]);(0,y.useEffect)(()=>{W.current&&e&&CT(e,D)},[D,e]),(0,y.useEffect)(()=>{N>=G.length&&P(Math.max(0,G.length-1))},[G.length,N]),(0,y.useEffect)(()=>{let e=F.current;if(!e)return;let t=new ResizeObserver(()=>M(e.clientHeight));return t.observe(e),()=>t.disconnect()},[]);let te=(0,y.useRef)(null),ne=_.trim()!==``;(0,y.useEffect)(()=>{if(p)return;let e=r?`${r}\0${ne}`:null;if(!r||te.current===e)return;let t=G.findIndex(e=>e.type===`file`&&e.file.id===r);if(t<0||!F.current)return;te.current=e;let n=t*oT,i=F.current;(n<i.scrollTop||n+oT>i.scrollTop+i.clientHeight)&&(i.scrollTop=Math.max(0,n-i.clientHeight/3),A(i.scrollTop)),P(t)},[r,G,ne,p]),(0,y.useLayoutEffect)(()=>{!p&&F.current&&A(F.current.scrollTop)},[p]);let K=(0,y.useRef)(p);K.current=p;let q=(0,y.useRef)(m);q.current=m,(0,y.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`p`){if(document.querySelector(`[role="dialog"], [role="menu"]`))return;e.preventDefault(),K.current&&q.current?.(),setTimeout(()=>{I.current?.focus(),I.current?.select()},0)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let J=e=>O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Y=e=>{let t=Math.max(0,Math.min(G.length-1,e)),n=F.current;if(n){let e=t*oT,r=n.scrollTop;e<r?r=e:e+oT>r+n.clientHeight&&(r=e+oT-n.clientHeight),n.scrollTop=r,(0,Qw.flushSync)(()=>{A(r),P(t)})}else P(t);F.current?.querySelector(`[data-row="${t}"]`)?.focus({preventScroll:!0})},re=e=>{let t=G[e]?.depth??0;for(let n=e-1;n>=0;n--)if(G[n].type===`dir`&&G[n].depth<t)return n;return-1},ie=e=>{let t=G[N];if(e.key===`ArrowDown`)Y(N+1);else if(e.key===`ArrowUp`)Y(N-1);else if(e.key===`Home`)Y(0);else if(e.key===`End`)Y(G.length-1);else if(e.key===`ArrowRight`&&t?.type===`dir`)t.open?Y(N+1):J(t.key);else if(e.key===`ArrowLeft`){if(t?.type===`dir`&&t.open)J(t.key);else{let e=re(N);e>=0&&Y(e)}}else return;e.preventDefault()},ae=Math.max(0,Math.floor(k/oT)-sT),oe=Math.min(G.length,Math.ceil((k+j)/oT)+sT),se=(e,t)=>V[e]===0?null:(0,X.jsxs)(`button`,{className:`chip`,"aria-pressed":!S&&!w&&b[e],"data-testid":`chip-${e}`,disabled:V[e]===0,onClick:()=>{C(!1),w?(T(!1),x(t=>({...t,[e]:!0}))):x(t=>({...t,[e]:!t[e]}))},children:[t,` `,(0,X.jsx)(`small`,{children:V[e]})]}),ce=(0,y.useMemo)(()=>{let e=0,t=0;for(let n of a?.sources??[])e+=n.defaultExcluded?.length??0,t+=(n.ruleExcluded?.length??0)+(n.ruleExcludedMore??0);return{folders:e,paths:t}},[a]);return h&&e?(0,X.jsx)(`nav`,{className:`nav`,"aria-label":`Files`,hidden:p,children:(0,X.jsx)(iC,{project:e,files:t,run:a,onAnalyze:()=>{o?.(),g(!1)},onClose:()=>g(!1)})}):(0,X.jsxs)(`nav`,{className:`nav`,"aria-label":`Files`,hidden:p,children:[(0,X.jsxs)(`div`,{className:`nav-head`,children:[(s.length>1||c)&&(0,X.jsxs)(`label`,{className:`nav-scope`,children:[(0,X.jsx)(`span`,{className:`small muted`,children:`Scope`}),(0,X.jsxs)(`select`,{"data-command":`scope-source`,value:c??``,onChange:e=>l?.(e.target.value||null),children:[(0,X.jsx)(`option`,{value:``,children:`All repositories`}),s.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.name??e.id},e.id))]})]}),(0,X.jsxs)(`div`,{className:`outline-head`,children:[(0,X.jsx)(`input`,{ref:I,className:`nav-filter`,"data-testid":`file-filter`,type:`search`,placeholder:w?`Filter libraries…`:`Filter ${t.length} files… ⌘P`,"aria-label":w?`Filter libraries`:`Filter files`,value:_,onChange:e=>{v(e.target.value),F.current&&(F.current.scrollTop=0),P(0)},onKeyDown:e=>{if(e.key===`Enter`&&_.trim()&&!w){let e=G.find(e=>e.type===`file`);e?.type===`file`&&i(e.file.id)}else e.key===`ArrowDown`?(e.preventDefault(),w?F.current?.parentElement?.querySelector(`.libraries button, [data-testid="library-package"]`)?.focus():Y(0)):e.key===`Escape`&&v(``)}}),u&&(0,X.jsx)(`button`,{className:`icon`,title:`Hide this pane ( [ )`,"aria-label":`Hide the files pane`,onClick:u,children:`⟨`})]}),(0,X.jsxs)(`div`,{className:`nav-chips`,role:`group`,"aria-label":`Show`,children:[se(`source`,`Source`),se(`tests`,`Tests`),se(`config`,`Config`),V.attention>0&&(0,X.jsxs)(`button`,{className:`chip attention`,"aria-pressed":S&&!w,"data-testid":`chip-attention`,title:`Files that were not fully analyzed`,onClick:()=>{C(e=>w||!e),T(!1)},children:[`⚠ `,(0,X.jsx)(`small`,{children:V.attention})]}),e&&(t.length>0||w)&&(0,X.jsx)(`button`,{className:`chip`,"aria-pressed":w,"data-testid":`chip-libraries`,title:`The libraries the project uses: installed packages, copied libraries, and folders left out`,onClick:()=>{C(!1),T(e=>!e)},children:`Libraries`})]})]}),w&&e&&(0,X.jsx)(`div`,{className:`nav-list`,children:(0,X.jsx)(aT,{project:e,run:E.current,source:c,filter:_,onOpen:i})}),(0,X.jsxs)(`div`,{className:`nav-list`,hidden:w&&!!e,ref:F,role:`tree`,"aria-label":`Files`,onScroll:e=>A(e.currentTarget.scrollTop),onKeyDown:ie,children:[G.length===0&&t.length>0&&(0,X.jsx)(`p`,{className:`hint`,children:`No files match.`}),(0,X.jsx)(`div`,{style:{height:G.length*oT,position:`relative`},children:G.slice(ae,oe).map((e,t)=>{let n=ae+t,a={top:n*oT,paddingLeft:8+e.depth*14};if(e.type===`dir`&&R&&!c&&e.depth===0&&z.has(e.key))return(0,X.jsxs)(`button`,{"data-row":n,role:`treeitem`,"aria-expanded":e.open,"aria-level":1,"aria-setsize":G.length,"aria-posinset":n+1,tabIndex:n===N?0:-1,className:`row dir repo`,"data-testid":`repo-row`,"data-source":e.key,style:a,title:z.get(e.key)?.root??e.key,onClick:()=>{P(n),J(e.key)},children:[(0,X.jsx)(`span`,{className:`caret`,children:e.open?`▾`:`▸`}),(0,X.jsx)(`strong`,{className:`name`,children:z.get(e.key)?.name??e.key}),(0,X.jsx)(`small`,{className:`muted repo-hint`,children:B(e.key)}),(0,X.jsx)(`small`,{className:`count`,title:`${e.total} files, ${e.functions} functions`,children:e.total})]},`r:${e.key}`);if(e.type===`dir`)return(0,X.jsxs)(`button`,{"data-row":n,role:`treeitem`,"aria-expanded":e.open,"aria-level":e.depth+1,"aria-setsize":G.length,"aria-posinset":n+1,tabIndex:n===N?0:-1,className:`row dir`,style:a,title:e.key,onClick:()=>{P(n),J(e.key)},children:[(0,X.jsx)(`span`,{className:`caret`,children:e.open?`▾`:`▸`}),(0,X.jsx)(`span`,{className:`name`,children:e.name}),(0,X.jsx)(`small`,{className:`count`,title:`${e.total} files, ${e.functions} functions`,children:e.total})]},`d:${e.key}`);let o=e.file;return[(0,X.jsxs)(`button`,{"data-row":n,role:`treeitem`,"aria-level":e.depth+1,"aria-setsize":G.length,"aria-posinset":n+1,"aria-selected":o.id===r,tabIndex:n===N?0:-1,"data-command":`open-file`,"data-file":o.path,className:`row file ${o.id===r?`current`:``} ${o.status}`,style:a,title:o.status===`analyzed`?o.path:`${o.path}: ${mT[o.status]??o.status}${o.reason?` (${pT[o.reason]??o.reason})`:``}`,onClick:()=>{P(n),i(o.id)},onContextMenu:f&&(e=>{e.preventDefault(),f({kind:`file`,id:o.id,data:{},x:e.clientX,y:e.clientY})}),children:[(0,X.jsx)(`span`,{className:`caret`}),(0,X.jsxs)(`span`,{className:`name`,children:[e.label,_.trim()&&e.hint?(0,X.jsxs)(`small`,{className:`muted`,children:[` `,e.hint]}):null]}),o.origin&&(0,X.jsx)(`small`,{className:`origin ${o.origin}`,title:o.origin===`library`?`Installed library code, not the project's own`:o.origin===`tool`?`A tool's or coding agent's workspace, not the project's own code`:`Generated output, not the project's own code`,children:o.origin}),fT(o)?(0,X.jsxs)(`small`,{className:`warn`,"aria-label":`${mT[o.status]??o.status}${o.reason?`: ${pT[o.reason]??o.reason}`:``}`,children:[`⚠ `,pT[o.reason??``]??o.reason??o.status]}):!_.trim()&&e.hint&&(0,X.jsx)(`small`,{className:`count`,children:e.hint})]},`f:${o.id}`),d&&o.status!==`not_analyzed`&&(0,X.jsx)(`button`,{className:`row-action`,"aria-hidden":`true`,"data-command":`file-imports`,"data-file":o.path,style:{top:n*oT},tabIndex:-1,title:`Imports of ${e.label}: what it imports and what depends on it (Imports tab)`,onClick:()=>d(o.id),children:`⇄`},`i:${o.id}`)]})})]}),e&&o&&(0,X.jsxs)(`div`,{className:`nav-foot`,children:[(0,X.jsx)(`small`,{className:`muted`,"data-testid":`left-out`,children:ce.folders+ce.paths===0?``:`Left out: ${[ce.folders?`${ce.folders} by default (libraries, generated, tools)`:``,ce.paths?`${ce.paths} by your choice`:``].filter(Boolean).join(`, `)}`}),(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{"data-testid":`choose-files`,onClick:()=>g(!0),title:`Choose which files are analyzed`,children:`Choose files…`})]})]})}J_.use(Jx);function TT(e){try{return ET(e)}catch{return DT(e)}}function ET(e){let t=J_({headless:!0,styleEnabled:!0,elements:[...e.nodes.map(e=>({data:{id:e.id,w:e.w,h:e.h}})),...e.edges.map(e=>({data:{id:e.id,source:e.source,target:e.target}}))],style:[{selector:`node`,style:{width:`data(w)`,height:`data(h)`}}]}),n=e=>t.layout({name:`dagre`,rankDir:e,nodeSep:14,rankSep:e===`LR`?70:50,fit:!1,animate:!1}).run();try{n(`LR`);let r=t.elements().boundingBox(),{w:i,h:a}=e.canvas;r.w*e.fitZoom>i-2*e.pad&&r.w/Math.max(1,r.h)>i/a&&n(`TB`)}catch(e){throw t.destroy(),e}let r={};for(let e of t.nodes().toArray())r[e.id()]={...e.position()};return t.destroy(),r}function DT(e){let t=Math.max(1,Math.ceil(Math.sqrt(e.nodes.length))),n=Math.max(40,...e.nodes.map(e=>e.w))+24,r={};return e.nodes.forEach((e,i)=>{r[e.id]={x:i%t*n,y:Math.floor(i/t)*40}}),r}var OT=null,kT=typeof Worker>`u`,AT=0,jT=new Map,MT=e=>new Promise(t=>setTimeout(()=>t(TT(e)),0));function NT(){try{let e=new Worker(new URL(`/assets/callLayout.worker-BugXMtxI.js`,``+import.meta.url),{type:`module`});return e.addEventListener(`message`,e=>{let t=jT.get(e.data.id);t&&(jT.delete(e.data.id),e.data.error===void 0?t.resolve(e.data.positions):(console.error(`veoflow: laying out this graph failed; placed in a grid`,e.data.error),t.resolve(DT(t.input))))}),e.addEventListener(`error`,t=>{console.error(`veoflow: the layout worker failed; laying out on the page instead`,t),kT=!0,e.terminate(),OT=null;for(let[e,t]of jT)jT.delete(e),MT(t.input).then(t.resolve)}),e}catch{return kT=!0,null}}function PT(e){if(jT.size>0&&OT&&(OT.terminate(),OT=null,jT.clear()),!kT&&!OT&&(OT=NT()),!OT)return MT(e);let t=++AT;return new Promise(n=>{jT.set(t,{input:e,resolve:n}),OT.postMessage({id:t,input:e})})}var FT=2,IT=40,LT=25,RT=7;function zT(e){let t=VT.get(e);if(t)return t;let n=BT(e),r=new Set(e.calls.map(e=>`${e.from}\u0000${e.to}`)),i=[];for(let t of e.functions){let e=n.get(t.id);e&&e!==t.id&&!r.has(`${e}\u0000${t.id}`)&&i.push({id:`inside:${t.id}`,parent:e,child:t.id})}return VT.set(e,i),i}function BT(e){let t=new Map(e.functions.map(e=>[e.qualifiedName,e.id])),n=new Set(t.keys()),r=new Map;for(let i of e.functions){let e=ve(i.qualifiedName,n),a=e===null?void 0:t.get(e);a&&r.set(i.id,a)}return r}var VT=new WeakMap;function HT(e,t,n=null){let r=new Map,i=(e,t)=>{e!==t&&(r.has(e)||r.set(e,new Set),r.get(e).add(t))};for(let t of e.calls)i(t.from,t.to),i(t.to,t.from);for(let{parent:t,child:n}of zT(e))i(t,n),i(n,t);let a=e=>r.get(e)?.size??0,o=(e,t)=>[...e].sort((e,t)=>a(t)-a(e)||(e<t?-1:1)).slice(0,t),s=new Set(e.functions.map(e=>e.id));if(n&&s.has(n[0])&&s.has(n[1])){let e=new Set(n);for(let t of n)for(let n of o(r.get(t)??[],RT))e.add(n);return e}if(t&&s.has(t)){let e=new Set([t]),n=o(r.get(t)??[],LT);for(let t of n)e.add(t);for(let t=1;t<FT&&e.size<IT;t++)for(let t of n)for(let n of o(r.get(t)??[],5))e.size<IT&&e.add(n);return e}return new Set(o(s,IT))}var UT=e=>`site:${e}`,WT=(e,t)=>`pair:${e}->${t}`;J_.use(Jx);var GT=.85,KT=1.25,qT=45,JT=.68,YT=4,XT=36,ZT=e=>Math.max(36,String(e.data(`label`)).length*7+18);function QT(e){let t=e.nodes(`[kind = "function"], [kind = "port"], [kind = "ghost"]`).not(`.hidden`),n=`[kind = "call"], [kind = "ghost-call"], [kind = "inside"]`,r=e.edges(n).not(`.hidden`),i=t.filter(e=>e.connectedEdges(n).not(`.hidden`).empty());return{fns:t,isolated:i,connected:t.difference(i).union(r)}}var $T=300;function eE(e){let{connected:t}=QT(e);return{nodes:t.nodes().toArray().map(e=>({id:e.id(),w:e.outerWidth(),h:e.outerHeight()})),edges:t.edges().map(e=>({id:e.id(),source:e.source().id(),target:e.target().id()})),canvas:{w:Math.max(1,e.width()),h:Math.max(1,e.height())},fitZoom:JT,pad:XT}}function tE(e,t){let{fns:n,isolated:r,connected:i}=QT(e),a=e=>i.layout({name:`dagre`,rankDir:e,nodeSep:14,rankSep:e===`LR`?70:50,fit:!1}).run(),o={w:Math.max(1,e.width()),h:Math.max(1,e.height())};if(t)e.batch(()=>{for(let e of i.nodes().toArray()){let n=t[e.id()];n&&e.position(n)}});else if(i.nonempty()){a(`LR`);let e=i.boundingBox();e.w*JT>o.w-72&&e.w/Math.max(1,e.h)>o.w/o.h&&a(`TB`)}let s=r.toArray(),c=i.nonempty()?i.boundingBox():{x1:0,y1:0,x2:0,y2:0,w:0,h:0},l=i.nonempty()?c.y2+48:0,u=Math.max(0,...s.map(e=>ZT(e)))+24,d=Math.max(YT,Math.floor(Math.max(c.w,o.w/GT-72)/u));s.forEach((e,t)=>{e.position({x:c.x1+t%d*u+u/2,y:l+Math.floor(t/d)*34})});for(let e of n.toArray()){let t=e.outgoers(`node[kind = "site"]`).not(`.hidden`).toArray();if(t.length===0)continue;let n=e.position(),r=n.x+ZT(e)/2+48;t.forEach((e,i)=>e.position({x:r+ZT(e)/2,y:n.y+(i-(t.length-1)/2)*26}))}}function nE(e,t){if(t.empty())return;e.fit(t,XT);let n=e.zoom(),r=t.nodes().length<=qT?JT:GT;if(n>KT)e.zoom(KT),e.center(t);else if(n<r){let n=t.boundingBox();e.zoom(r),e.pan({x:XT-n.x1*r,y:XT-n.y1*r})}}function rE(e,t){if(t.edges().nonempty()||t.nodes(`[kind = "site"]`).nonempty()){nE(e,t.union(t.edges().connectedNodes()).union(t.nodes().incomers(`node`)));return}let n=t,r=n.renderedBoundingBox(),i=e.width(),a=e.height();r.x1>=0&&r.y1>=0&&r.x2<=i&&r.y2<=a||e.animate({center:{eles:n}},{duration:250})}function iE({graph:e,showUnresolved:t,selection:n,onSelect:r,onClear:i,focus:a,sitesFor:o,answered:s,marks:c,only:l=null,onContext:u,extraSite:d=null}){let f=(0,y.useRef)(null),m=(0,y.useRef)(null),h=Je();(0,y.useEffect)(()=>{m.current?.style(aE())},[h]);let g=(0,y.useRef)(l);g.current=l;let _=(0,y.useRef)(u);_.current=u,(0,y.useEffect)(()=>{m.current&&Ke(m.current,l)},[l]);let v=(0,y.useRef)(0),[b,x]=(0,y.useState)(!1),[S,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(0);(0,y.useEffect)(()=>{let n=new Set(e.functions.map(e=>e.id)),a=new Map;for(let t of e.calls){if(!t.crossFile)continue;let e=n.has(t.from)?t.to:t.from;if(n.has(e)||a.has(e))continue;let r=t.function.path.split(`/`).pop()??t.function.path;a.set(e,`${r} › ${oe(t.function.qualifiedName,void 0,t.function.title).name}`)}for(let e of a.keys())n.add(e);let o=new Set(e.calls.filter(e=>e.from===e.to).map(e=>e.from)),s=new Map;for(let t of e.calls){if(t.from===t.to||!n.has(t.from)||!n.has(t.to))continue;let e=WT(t.from,t.to),r=s.get(e);r?r.calls.push(t.id):s.set(e,{from:t.from,to:t.to,calls:[t.id]})}let c=e.functions.map(e=>{let t=be(e);return t.unnamed?`λ ${t.name}`:t.name}),l=new Map(e.functions.map(e=>[e.id,e.qualifiedName])),u=new Map(e.functions.map(e=>[e.id,e])),h=zT(e),v=BT(e),y=e=>{let t=v.get(e);return t===void 0?null:l.get(t)??null},b=new Set(c.filter((e,t)=>c.indexOf(e)!==t)),x=[...e.functions.map((e,t)=>{let n=c[t],r=b.has(n)&&!n.includes(`· line`)?`${n} · line ${e.evidence.span.start.line}`:n,i=ye(e.qualifiedName,e.code,e.evidence.span.start.line,y(e.id));return{data:{id:e.id,label:o.has(e.id)?`${r} ↻`:r,kind:`function`,...i?{hover:i}:{}},classes:e.qualifiedName===`<module>`?`module`:be(e).unnamed?`unnamed`:``}}),...[...a].map(([e,t])=>({data:{id:e,label:t,kind:`port`},classes:`port`})),...h.map(e=>{let t=l.get(e.parent)??``,n=u.get(e.child),r=n?_e(n.qualifiedName,n.code,n.title)??se(n.qualifiedName):``;return{data:{id:e.id,source:e.parent,target:e.child,kind:`inside`,label:``,hover:`${r} is written inside ${t===`<module>`?`the file's top level`:se(t)}. A dotted line shows where a function is written, not a call.`},classes:`inside`}}),...[...s].map(([e,t])=>({data:{id:e,source:t.from,target:t.to,kind:`call`,calls:t.calls,label:t.calls.length>1?`×${t.calls.length}`:``}}))];if(t||d){let r=new Map;for(let i of e.unresolved){if(!n.has(i.enclosingFn)||!(t&&p(i))&&i.id!==d)continue;let e=`${i.enclosingFn}\u0000${i.expression}\u0000${i.status}`,a=r.get(e);a?a.ids.push(i.id):r.set(e,{fn:i.enclosingFn,expression:i.expression,ids:[i.id],status:i.status})}for(let e of r.values()){let t=UT(e.ids[0]),n=e.expression.length>40?`${e.expression.slice(0,39)}…`:e.expression;x.push({data:{id:t,label:e.ids.length>1?`${n} ×${e.ids.length}`:n,kind:`site`,ids:e.ids},classes:`site ${e.status}`},{data:{id:`edge:${t}`,source:e.fn,target:t,kind:`site-edge`,label:``},classes:`site-edge`})}}let S=J_({container:f.current,elements:x,autounselectify:!0,layout:{name:`preset`},minZoom:.15,maxZoom:3,style:aE()});return S.on(`tap`,`node, edge`,e=>{let t=e.target.data(`kind`),n=e.target.id();t===`function`?r({kind:`function`,id:n}):t===`inside`?r({kind:`function`,id:e.target.target().id()}):t===`call`?r({kind:`call`,id:e.target.data(`calls`)[0]}):t===`site`&&r({kind:`site`,id:e.target.data(`ids`)[0]})}),S.on(`tap`,e=>{e.target===S&&i()}),S.on(`mouseover`,`node, edge`,e=>{let t=e.target.data(`hover`),n=e.renderedPosition??e.target.renderedMidpoint?.()??{x:0,y:0};C(t?{text:t,x:n.x,y:n.y}:null)}),S.on(`mouseout`,`node, edge`,()=>C(null)),S.on(`pan zoom drag remove`,()=>C(null)),m.current=S,Ke(S,g.current),S.on(`cxttap`,`node, edge`,e=>{let t=e.target.data(),n=t.kind===`function`?`function`:t.kind===`call`?`edge`:null;if(!n||!f.current)return;let r=f.current.getBoundingClientRect(),i=e.renderedPosition??{x:0,y:0};_.current?.({kind:n,id:n===`file`&&typeof t.file==`string`?t.file:e.target.id(),data:t,x:r.left+i.x,y:r.top+i.y})}),f.current&&(f.current.veoCy=S),()=>{m.current=null,C(null),S.destroy()}},[e,t,r,i,d]);let E=(c?.removed??[]).filter(t=>t.file===e.file.id&&(t.type===`Function`||t.type===`CALLS`)).map(e=>e.id).join(`
340
- `);(0,y.useEffect)(()=>{let t=m.current;t&&t.batch(()=>{if(t.elements(`.ghost`).remove(),t.elements().removeClass(`diff-added diff-removed diff-changed`),!c)return;t.nodes(`[kind = "function"]`).forEach(e=>{let t=c.byId.get(e.id());t&&e.addClass(Xe(t))}),t.edges(`[kind = "call"]`).forEach(e=>{let t=e.data(`calls`).map(e=>c.byId.get(e)).find(Boolean);t&&e.addClass(Xe(t))});let n=new Set(t.nodes().map(e=>e.id())),r=new Set,i=[];for(let t of c.removed){if(t.type!==`Function`||t.file!==e.file.id||n.has(t.id))continue;let a=t.fact;r.add(t.id),i.push({data:{id:t.id,label:`${a.qualifiedName??a.name??t.id} (removed)`,kind:`ghost`},classes:`diff-removed ghost`})}for(let e of c.removed){if(e.type!==`CALLS`)continue;let t=e.fact,a=e=>!!e&&(n.has(e)||r.has(e));a(t.from)&&a(t.to)&&t.from!==t.to&&i.push({data:{id:`gone:${e.id}`,source:t.from,target:t.to,kind:`ghost-call`,label:``},classes:`diff-removed ghost`})}i.length&&t.add(i)})},[c,e,t,d]);let D=a?o:null;return(0,y.useEffect)(()=>{let e=m.current;if(!e)return;e.batch(()=>{if(e.elements().removeClass(`hidden`),a){let t=e.nodes().filter(e=>e.data(`kind`)===`function`?!a.has(e.id()):e.incomers(`node`).first().id()!==D);t.addClass(`hidden`),t.connectedEdges().addClass(`hidden`)}});let t=++v.current;if(QT(e).connected.nodes().length<=$T){tE(e),nE(e,e.elements().not(`.hidden`)),g.current&&Ke(e,g.current),x(!1);return}x(!0),PT(eE(e)).then(n=>{t===v.current&&m.current===e&&(tE(e,n),nE(e,e.elements().not(`.hidden`)),g.current&&Ke(e,g.current),x(!1),T(e=>e+1))})},[a,e,t,D,E,d]),(0,y.useEffect)(()=>{let t=m.current;if(!t||(t.batch(()=>{t.elements().removeClass(`picked faded`)}),f.current?.setAttribute(`data-picked`,``),!n))return;let r=n.kind===`site`?t.nodes(`[kind = "site"]`).filter(e=>e.data(`ids`).includes(n.id)):t.getElementById(n.id);if(r.empty()&&n.kind===`call`&&(r=t.edges().filter(e=>(e.data(`calls`)??[]).includes(n.id)),r.empty())){let i=e.calls.find(e=>e.id===n.id);i&&(r=t.getElementById(i.from))}if(r.empty())return;f.current?.setAttribute(`data-picked`,`${n.kind}:${n.id}`);let i=r.union(r.nodes().closedNeighborhood()).union(r.edges().connectedNodes());t.batch(()=>{r.addClass(`picked`),a||t.elements().not(i).addClass(`faded`)}),rE(t,r)},[n,e,t,a,w,d]),(0,y.useEffect)(()=>{let e=m.current;e&&e.batch(()=>{e.nodes().removeClass(`answered`),s&&e.nodes().filter(e=>s.has(e.id())).addClass(`answered`)})},[s,e,t,a,d]),(0,X.jsxs)(`div`,{className:`graph-wrap`,children:[(0,X.jsx)(`div`,{className:`graph`,ref:f,"data-testid":`graph`,"data-laying-out":b||void 0}),b&&(0,X.jsx)(`div`,{className:`laying-out`,children:`Laying out…`}),S&&(0,X.jsx)(`div`,{className:`graph-hover`,role:`tooltip`,"data-testid":`graph-hover`,style:{left:S.x+12,top:S.y+12},children:S.text}),(0,X.jsxs)(`details`,{className:`graph-key`,"data-testid":`graph-key`,children:[(0,X.jsx)(`summary`,{children:`Key`}),(0,X.jsxs)(`ul`,{children:[(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node`}),(0,X.jsx)(`span`,{children:`a function`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node unnamed`,children:`λ`}),(0,X.jsxs)(`span`,{children:[`a function with no name in the code, shown as its code: `,(0,X.jsx)(`code`,{children:`.map(l => …)`}),` is the arrow function handed to `,(0,X.jsx)(`code`,{children:`.map()`})]})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node module`}),(0,X.jsx)(`span`,{children:`the file's top level: what runs when the file is loaded`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-line call`}),(0,X.jsx)(`span`,{children:`calls (×2: two call sites)`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-line inside`}),(0,X.jsx)(`span`,{children:`written inside: where a function is written, not a call`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-line site`}),(0,X.jsx)(`span`,{children:`a call the analysis couldn't tie to a function here`})]})]})]}),(0,X.jsx)(`button`,{className:`fit`,title:`Fit the graph to the view`,"aria-label":`Fit the graph to the view`,onClick:()=>{let e=m.current;e&&nE(e,e.elements().not(`.hidden`))},children:`Fit`})]})}function aE(){return[{selector:`node`,style:{label:`data(label)`,"font-size":12,"text-valign":`center`,"text-halign":`center`,shape:`round-rectangle`,width:ZT,height:22,"background-color":Z(`gray-95`),"border-width":1,"border-color":Z(`blue-62`),color:Z(`gray-26`)}},{selector:`node.module`,style:{"background-color":Z(`gray-95-2`),"border-color":Z(`gray-66`),"font-weight":`bold`}},{selector:`node.unnamed`,style:{"font-style":`italic`,"background-color":Z(`gray-96-7`),"border-color":Z(`purple-66`),"border-style":`dashed`}},{selector:`node.port`,style:{"background-color":Z(`gray-100`),"border-style":`dashed`,"border-color":Z(`blue-63`),color:Z(`gray-45`)}},{selector:`node.site`,style:{"background-color":Z(`gray-100`),"border-style":`dashed`,"border-color":Z(`orange-64`),color:Z(`amber-51`)}},{selector:`node.site.awaiting-link, node.site.external`,style:{"border-color":Z(`gray-68`),color:Z(`gray-57`)}},{selector:`edge`,style:{width:1.5,"curve-style":`bezier`,"target-arrow-shape":`triangle`,"line-color":Z(`blue-72`),"target-arrow-color":Z(`blue-72`),label:`data(label)`,"font-size":10,color:Z(`gray-51`),"text-background-color":Z(`gray-99`),"text-background-opacity":1,"text-background-padding":`2px`}},{selector:`edge.inside`,style:{"line-style":`dotted`,width:1.5,"line-color":Z(`purple-70`),"target-arrow-shape":`none`}},{selector:`edge.site-edge`,style:{"line-style":`dashed`,"line-color":Z(`amber-74`),"target-arrow-color":Z(`amber-74`)}},...Ze(),Ge,{selector:`.hidden`,style:{display:`none`}},{selector:`node.answered`,style:{"border-width":2,"border-color":Z(`amber-73`),"background-color":Z(`amber-97`)}},{selector:`.faded`,style:{opacity:.22}},{selector:`node.picked`,style:{"border-width":2,"border-color":Z(`blue-51`),"background-color":Z(`gray-91`)}},{selector:`edge.picked`,style:{"line-color":Z(`blue-51`),"target-arrow-color":Z(`blue-51`),width:3}}]}var oE=(e,t,n)=>(e.find(e=>e.id===t)?.kept??[]).some(e=>n===e||n.startsWith(`${e}/`)),sE={installed:`installed packages`,packages:`copied packages with their own manifests`,banners:`library banners or versioned names`},cE=3,lE=(e,t)=>`veoflow.librariesLater.${e}.${t}`,uE=(e,t)=>`veoflow.librariesSeen.${e}.${t}`,dE=e=>{try{return localStorage.getItem(e)===`1`}catch{return!1}};function fE({project:e,run:t,sources:n,onAnalyze:r,onKept:i,onChooseFiles:a}){let[o,s]=(0,y.useState)({}),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(()=>t?dE(lE(e,t.runId)):!1),[f,p]=(0,y.useState)(()=>!t||!dE(uE(e,t.runId)));(0,y.useEffect)(()=>{if(t)try{localStorage.setItem(uE(e,t.runId),`1`)}catch{}},[e,t?.runId]);let m=(t?.sources??[]).flatMap(e=>(e.libraries??[]).filter(t=>!oE(n,e.sourceId,t.path)).map(t=>({...t,source:e.sourceId}))),h=m.filter(e=>!o[`${e.source}:${e.path}`]),g=Object.values(o).filter(e=>e===`out`).length;if(!t||u||m.length===0||h.length===0&&g===0)return null;let _=async(t,n)=>{l(``);try{await Y.select(e,t.source,[t.path],!n,!n),s(e=>({...e,[`${t.source}:${t.path}`]:n?`out`:`kept`})),n||i()}catch(e){l(e.message??String(e))}},v=e=>`${e.toLocaleString(`en-US`)} file${e===1?``:`s`}`,b=()=>{try{localStorage.setItem(lE(e,t.runId),`1`)}catch{}d(!0)};return!f&&h.length>0&&g===0?(0,X.jsxs)(`section`,{className:`library-offer folded`,"data-testid":`library-offer`,"data-folded":!0,"aria-label":`Third-party libraries`,children:[(0,X.jsx)(`span`,{children:h.length===1?h[0].kind===`dir`?`${h[0].path}/ looks like ${v(h[0].files)} of third-party libraries`:`${h[0].path} looks like a third-party library`:`${h.length} folders or files look like third-party libraries`}),(0,X.jsx)(`button`,{className:`link`,"data-testid":`library-review`,onClick:()=>p(!0),children:`Review`}),(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{className:`link small`,title:`Hide this until the next analysis`,onClick:b,children:`Later`})]}):(0,X.jsxs)(`section`,{className:`library-offer`,"data-testid":`library-offer`,"aria-label":`Third-party libraries`,children:[h.length>0&&(0,X.jsx)(`ul`,{children:h.slice(0,cE).map(e=>(0,X.jsxs)(`li`,{"data-path":e.path,children:[(0,X.jsxs)(`span`,{className:`what`,children:[(0,X.jsxs)(`strong`,{className:`mono`,children:[e.path,e.kind===`dir`?`/`:``]}),` `,`looks like`,` `,e.kind===`dir`?`${v(e.files)} of third-party libraries`:`a third-party library`,` `,(0,X.jsxs)(`small`,{className:`muted`,children:[`(`,sE[e.why],`: `,e.names.join(`, `),`)`]})]}),(0,X.jsx)(`button`,{"data-testid":`library-leave-out`,onClick:()=>void _(e,!0),children:`Leave out`}),(0,X.jsx)(`button`,{className:`quiet`,"data-testid":`library-keep`,title:`Keep analyzing it, and don't offer it again`,onClick:()=>void _(e,!1),children:`Keep analyzing`})]},`${e.source}:${e.path}`))}),(0,X.jsxs)(`div`,{className:`offer-foot`,children:[h.length>cE&&(0,X.jsxs)(`button`,{className:`link`,onClick:()=>a(h[cE].source),children:[h.length-cE,` more…`]}),g>0&&(0,X.jsxs)(`span`,{children:[g,` left out at the next analysis.`,` `,(0,X.jsx)(`button`,{className:`link`,"data-testid":`library-analyze`,onClick:r,children:`Analyze now`})]}),c&&(0,X.jsx)(`span`,{className:`error small`,children:c}),(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{className:`link small`,title:`Hide this until the next analysis`,onClick:b,children:`Later`})]})]})}var pE=e=>/ looks like .*third-party librar/.test(e);function mE({run:e,quiet:t=!1}){let n=e?.sources??[],r=n.flatMap(e=>(e.notices??[]).filter(e=>!pE(e)).map(t=>n.length>1?`${e.sourceId}: ${t}`:t));return r.length?(0,X.jsx)(`ul`,{className:`run-notices${t?` quiet`:``}`,"data-testid":`run-notices`,"aria-label":`Notes from the analysis`,children:r.map(e=>(0,X.jsx)(`li`,{children:e},e))}):null}function hE({analysis:e}){let t=e.outdated.every(e=>e.was===null);return(0,X.jsxs)(`p`,{className:`outdated-note`,"data-testid":`graph-outdated`,children:[t?`This graph was made before veoflow recorded which analysis made it, so it may be older than this version's.`:`This graph was made by ${e.veoflow?`veoflow ${e.veoflow}`:`another veoflow`}; ${e.outdated.map(e=>e.stage).join(`, `)} ${e.outdated.length===1?`has`:`have`} changed since.`,` `,`Analyze again to see what this version finds.`]})}function gE({project:e,files:t,run:n,counts:r,source:i,sources:a,onOpen:o,onQuestions:s}){let[c,l]=(0,y.useState)(null),[u,d]=fS();(0,y.useEffect)(()=>{let t=!1;return Y.totals(e,30,i??void 0,!u).then(e=>!t&&l(e),()=>!t&&l(`error`)),()=>{t=!0}},[e,t,i,u,a]);let f=c&&c!==`error`?c:null,p=(0,y.useMemo)(()=>(f?.mostCalled??[]).filter(e=>dT(e.path)===`source`).slice(0,5).map(e=>({key:e.id,name:e.name,count:e.calls})),[f]),m=f?.pendingLibraries,h=(0,y.useMemo)(()=>v(new Map(Object.entries(m??{}))),[m]),g=(0,y.useMemo)(()=>t.filter(e=>(!i||e.id.startsWith(`${i}:`))&&(u||h(e))),[t,i,u,h]),_=(0,y.useMemo)(()=>t.some(e=>!h(e)),[t,h]),b=(0,y.useMemo)(()=>g.reduce((e,t)=>e+(r[t.id]?.functions??0),0),[g,r]),x=(0,y.useMemo)(()=>g.filter(e=>dT(e.path)===`source`&&!e.origin).map(e=>({f:e,n:r[e.id]?.functions??0})).filter(e=>e.n>0).sort((e,t)=>t.n-e.n||(e.f.path<t.f.path?-1:1)).slice(0,5),[g,r]),S=(0,y.useMemo)(()=>new Map(t.map(e=>[e.id,e.path])),[t]),C=(0,y.useMemo)(()=>new Set(g.map(e=>e.id.slice(0,e.id.indexOf(`:`)))).size>1,[g]),w=e=>e.toLocaleString(`en-US`);return(0,X.jsxs)(`div`,{className:`overview`,"data-testid":`overview`,children:[(0,X.jsx)(mE,{run:n,quiet:!0}),f?.analysis?.outdated.length?(0,X.jsx)(hE,{analysis:f.analysis}):null,f?.stage2&&f.completeness.sites>0&&(0,X.jsxs)(`section`,{className:`paths`,"data-testid":`overview-paths`,children:[(0,X.jsx)(`strong`,{children:sC(f.completeness)}),(0,X.jsxs)(`small`,{children:[cC(f.completeness).filter(e=>e.count>0).map(e=>`${w(e.count)} ${e.label}`).join(` · `),f.completeness.openByReason.length>0&&` — they stop: ${f.completeness.openByReason.slice(0,3).map(e=>`${w(e.sites)} ${e.reason}`).join(`, `)}`]})]}),(0,X.jsxs)(`dl`,{className:`stats`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`files`}),(0,X.jsx)(`dd`,{children:w(g.length)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`functions`}),(0,X.jsx)(`dd`,{children:w(b)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`dt`,{children:[`calls`,f?.stage2&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`br`,{}),(0,X.jsxs)(`small`,{children:[w(f.calls.acrossFiles),` across files`]})]})]}),(0,X.jsx)(`dd`,{"data-testid":`overview-calls`,children:f?w(f.calls.withinFiles+f.calls.acrossFiles):c===`error`?`?`:`…`})]}),(0,X.jsxs)(`div`,{className:`muted-stat`,children:[(0,X.jsxs)(`dt`,{children:[`open calls`,(0,X.jsx)(`br`,{}),(0,X.jsx)(`small`,{children:`calls the analysis couldn't follow`})]}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(`button`,{className:`stat-link`,"data-testid":`overview-open-calls`,onClick:s,title:`Show them in Findings (the same count as there)`,children:f?w(f.openCalls):c===`error`?`?`:`…`})})]}),_&&(0,X.jsxs)(`label`,{className:`toggle stats-scope`,title:`Own code first: tests, installed libraries, generated output and tools' files are counted when this is on`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`overview-all-code`,checked:u,onChange:e=>d(e.target.checked)}),`Libraries and tests too`]})]}),(0,X.jsxs)(`div`,{className:`columns`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{children:`Largest files`}),(0,X.jsx)(`ul`,{children:x.map(({f:e,n:t})=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link-row`,onClick:()=>o(e.id),title:e.path,children:[(0,X.jsx)(`span`,{className:`name`,children:C?`${e.id.slice(0,e.id.indexOf(`:`))} › ${e.path}`:e.path}),(0,X.jsxs)(`small`,{children:[t,` function`,t===1?``:`s`]})]})},e.id))})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{children:`Most called`}),(0,X.jsx)(`ul`,{children:p.map(e=>{let t=e.key.slice(0,e.key.lastIndexOf(`:`));return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link-row`,onClick:()=>o(t),title:`${e.name??e.key} in ${S.get(t)??t}`,children:[(0,X.jsxs)(`span`,{className:`name`,children:[oe(e.name??e.key).name,p.filter(t=>t.name===e.name).length>1&&(0,X.jsxs)(`small`,{className:`muted`,children:[` `,(S.get(t)??t).split(`/`).pop()]})]}),(0,X.jsxs)(`small`,{children:[e.count,` call`,e.count===1?``:`s`]})]})},e.key)})})]})]}),(0,X.jsx)(`p`,{className:`muted small`,children:`Open a file on the left, or ask a question above (⌘K).`})]})}function _E({onClose:e,onSaved:t}){let[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(null),[f,p]=(0,y.useState)(!1),m=(0,y.useRef)(null);(0,y.useEffect)(()=>{Y.settings().then(({model:e})=>{r(e),a(e.baseUrl),s(e.model),setTimeout(()=>m.current?.focus(),0)},e=>d({ok:!1,text:`Could not load the settings: ${e.message??String(e)}`}))},[]),(0,y.useEffect)(()=>{let t=t=>t.key===`Escape`&&e();return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let h=async(e={})=>{p(!0),d(null);try{let{model:n}=await Y.saveSettings({baseUrl:i,model:o,...c.trim()?{apiKey:c.trim()}:{},...e});return r(n),l(``),t(n),n}catch(e){return d({ok:!1,text:e.message??String(e)}),null}finally{p(!1)}},[g,_]=(0,y.useState)(!1),v=async(t=!1)=>{if(!t&&(c.trim()||n?.apiKeySet)){p(!0),d(null);let e=!1;try{let t=await Y.testSettings({baseUrl:i,model:o,...c.trim()?{apiKey:c.trim()}:{}});e=t.ok,t.ok||d({ok:!1,text:t.message})}catch(e){d({ok:!1,text:e.message??String(e)})}finally{p(!1)}if(!e){_(!0);return}}await h()&&e()},b=async()=>{p(!0),d(null);try{let e=await Y.testSettings({baseUrl:i,model:o,...c.trim()?{apiKey:c.trim()}:{}});d({ok:e.ok&&e.toolCalls,text:e.message})}catch(e){d({ok:!1,text:e.message??String(e)})}finally{p(!1)}};return(0,X.jsx)(`div`,{className:`backdrop`,onMouseDown:t=>t.target===t.currentTarget&&e(),children:(0,X.jsxs)(`form`,{className:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,"data-testid":`settings-dialog`,onSubmit:e=>{e.preventDefault(),v()},children:[(0,X.jsx)(`h2`,{id:`settings-title`,children:`Settings`}),(0,X.jsxs)(`p`,{className:`muted`,children:[`Built-in questions work without a model. To ask anything, connect a model through`,` `,(0,X.jsx)(`a`,{href:`https://openrouter.ai/keys`,target:`_blank`,rel:`noreferrer`,children:`OpenRouter`}),` `,`(or any OpenAI-compatible endpoint) with your own key.`]}),(0,X.jsxs)(`fieldset`,{disabled:!n,className:`plain`,children:[(0,X.jsxs)(`label`,{children:[`Model`,(0,X.jsx)(`input`,{ref:m,"data-testid":`settings-model`,value:o,onChange:e=>s(e.target.value),placeholder:`anthropic/claude-sonnet-5.5`,spellCheck:!1}),(0,X.jsx)(`small`,{className:`muted`,children:`An OpenRouter model id that supports tool calls.`})]}),(0,X.jsxs)(`label`,{children:[`API key`,(0,X.jsx)(`input`,{"data-testid":`settings-key`,type:`password`,autoComplete:`off`,value:c,onChange:e=>l(e.target.value),placeholder:n?.apiKeySet?`Saved (…${n.apiKeyHint})${n.keySource===`env`?` from OPENROUTER_API_KEY`:``}`:`sk-or-…`,spellCheck:!1}),(0,X.jsx)(`small`,{className:`muted`,children:`Stored only on this computer, in the veoflow folder (readable by you only). It is never shown again.`})]}),(0,X.jsxs)(`details`,{children:[(0,X.jsx)(`summary`,{children:`Advanced`}),(0,X.jsxs)(`label`,{children:[`Base URL`,(0,X.jsx)(`input`,{"data-testid":`settings-base-url`,value:i,onChange:e=>a(e.target.value),placeholder:`https://openrouter.ai/api/v1`,spellCheck:!1})]})]})]}),(0,X.jsx)(`p`,{className:`muted small`,children:`When a model answers, your question and the graph data it looks up (names, file paths, line numbers) are sent to the provider. Nothing is sent for built-in questions.`}),u&&(0,X.jsx)(`p`,{className:u.ok?`ok`:`error`,role:`status`,"data-testid":`settings-status`,children:u.text}),(0,X.jsxs)(`div`,{className:`buttons`,children:[n?.apiKeySet&&n.keySource===`config`&&(0,X.jsx)(`button`,{type:`button`,className:`danger`,disabled:f,onClick:()=>void h({apiKey:null}),"data-testid":`settings-remove-key`,children:`Remove key`}),(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{type:`button`,disabled:f||!n,onClick:()=>void b(),"data-testid":`settings-test`,children:`Test connection`}),(0,X.jsx)(`button`,{type:`button`,onClick:e,children:`Cancel`}),g&&(0,X.jsx)(`button`,{type:`button`,disabled:f,onClick:()=>void v(!0),"data-testid":`settings-save-anyway`,children:`Save anyway`}),(0,X.jsx)(`button`,{type:`submit`,className:`primary`,disabled:f||!n,"data-testid":`settings-save`,children:`Save`})]})]})})}function vE(e,t){if(t.type===`undo`)return L(e);if(t.type===`redo`)return R(e);if(t.type===`load`)return z(t.view)===z(e.present)?e:{past:[...e.past,e.present],present:t.view,future:[]};let n={name:t.name,...t.args?{args:t.args}:{}};try{return t.type===`reset`?{...e,present:I(F(e.present),n).present}:I(e,n)}catch(t){return console.warn(t),e}}var yE=[{id:`stage1`,name:`Functions & calls`,release:`R1`},{id:`stage2`,name:`Cross-file links`,release:`R2`},{id:`stage3`,name:`APIs & data`,release:`R4`},{id:`stage4`,name:`Runtime`,release:`R11`},{id:`stage5`,name:`Deployment`,release:`R10`}];function bE(){let[e,t]=(0,y.useReducer)(vE,void 0,()=>F(H(location.hash.slice(1)))),n=e.present,r=(0,y.useCallback)((e,n)=>t({type:`command`,name:e,...n?{args:n}:{}}),[]),[i,a]=(0,y.useState)([]),o=(0,y.useRef)(!0),[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)([]),[d,f]=(0,y.useState)({}),[m,h]=(0,y.useState)(null),[g,_]=(0,y.useState)(`file`),[v,b]=(0,y.useState)(``),x=(0,y.useRef)(n.tab);x.current=n.tab;let[C,w]=(0,y.useState)(()=>{try{return localStorage.getItem(`veoflow.navCollapsed`)===`1`}catch{return!1}}),T=(0,y.useCallback)(e=>{w(t=>{let n=typeof e==`function`?e(t):e;try{localStorage.setItem(`veoflow.navCollapsed`,n?`1`:`0`)}catch{}return n})},[]),E=(0,y.useRef)(0),[D,O]=(0,y.useState)(null),[k,A]=(0,y.useState)(!1),[j,N]=(0,y.useState)(!1),[P,I]=(0,y.useState)(null),[L,R]=(0,y.useState)(null),[B,V]=(0,y.useState)(null),[G,K]=(0,y.useState)([]),[q,J]=(0,y.useState)([]),ie=(0,y.useMemo)(()=>new Set(q.flatMap(e=>[...e.changed,...e.removed].map(t=>`${e.sourceId}:${t}`))),[q]),[ae,se]=(0,y.useState)(`pending`),ce=(0,y.useRef)(!1);ce.current=ae===`running`;let[le,ue]=(0,y.useState)(``),[de,fe]=(0,y.useState)(new Map),[pe,me]=(0,y.useState)(``),[he,ge]=(0,y.useState)(``),[_e,ve]=(0,y.useState)(!1),[ye,be]=(0,y.useState)(null),[xe,Se]=(0,y.useState)(null),[Ce,we]=(0,y.useState)(null),[Ee,De]=(0,y.useReducer)(e=>e+1,0);ne(n.run);let ke=(0,y.useRef)(!0);(0,y.useEffect)(()=>{if(ke.current){ke.current=!1;return}De()},[n.run]);let Ae=(0,y.useRef)(n);Ae.current=n,(0,y.useEffect)(()=>{let e=e=>{let{run:n,reason:r}=e.detail??{};Ae.current.run&&n===Ae.current.run&&(t({type:`reset`,name:`openRun`,args:{}}),ge(r===`history`?`That run is older than the 30 days of history this license shows, so the latest analysis is shown.`:`That run is no longer available (a newer draft or analysis replaced it), so the latest analysis is shown.`))};return window.addEventListener(`veo-run-gone`,e),()=>window.removeEventListener(`veo-run-gone`,e)},[]);let je=n.run??P,Me=RS(n.project,n.compare,Ee),Ne=(0,y.useMemo)(()=>Ye(Me.data),[Me.data]),{groups:Pe}=bS(n.project,je,0,n.source),Fe=(0,y.useCallback)((e,t)=>r(`select`,{kind:`function`,id:e,file:t}),[r]),Le=(0,y.useCallback)(e=>{let t=e.file,i=e=>n.tab!==e&&r(`showTab`,{tab:e});if(e.change===`removed`){t&&e.type!==`File`&&Ne?.fileFacts.get(t)!==`removed`&&(i(`file`),r(`openFile`,{file:t}));return}switch(e.type){case`Function`:if(t)return r(`select`,{kind:`function`,id:e.id,file:t});break;case`CALLS`:case`CALLS_CROSS_FILE`:if(t)return r(`select`,{kind:`call`,id:e.id,file:t});break;case`UnresolvedCallSite`:if(t)return r(`select`,{kind:`site`,id:e.id,file:t});break;case`IMPORTS`:case`UnresolvedImport`:if(t)return r(`openImportsFile`,{file:t,pick:e.id});break;case`Group`:return i(`imports`),n.grouping!==`declared`&&r(`setGrouping`,{grouping:`declared`}),r(`openGroup`,{group:e.id});case`DEPENDS_ON`:return i(`imports`),n.grouping!==`declared`&&r(`setGrouping`,{grouping:`declared`}),r(`openGroup`,{group:String(e.fact.from)})}t&&(i(`file`),r(`openFile`,{file:t}))},[r,n.tab,n.grouping,Ne]),[Re,ze]=(0,y.useState)(null),[Be,Ve]=(0,y.useState)(null),He=(0,y.useRef)(n.project);He.current=n.project;let Ue=(0,y.useRef)(n.file);Ue.current=n.file;let We=(0,y.useRef)(n.source);We.current=n.source;let[Ge,Ke]=(0,y.useState)(!1),[qe,Z]=(0,y.useState)([]),[Je,Xe]=(0,y.useState)([]),[Ze,Qe]=(0,y.useState)(null),[$e,et]=(0,y.useState)(!1),[tt,nt]=(0,y.useState)(!1),[rt,it]=(0,y.useState)(0),at=(0,y.useRef)(null),ot=(0,y.useRef)(null),[st,ct]=(0,y.useState)(!1),[lt,ut]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(it(0),!Ge)return;let e=Date.now(),t=setInterval(()=>it(Math.round((Date.now()-e)/1e3)),1e3);return()=>clearInterval(t)},[Ge,Be]),(0,y.useEffect)(()=>{Y.settings().then(e=>Qe(e.model),()=>void 0)},[]);let dt=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=`#${z(n)}`,t=JSON.stringify([n.project,n.file,n.selection,n.tab,n.group,n.fileLevel]);if(location.hash!==e){let r=z(H(location.hash.slice(1)))===z(n);dt.current!==null&&dt.current!==t&&!r?window.history.pushState(null,``,e):window.history.replaceState(null,``,e)}dt.current=t},[n]),(0,y.useEffect)(()=>{let e=()=>t({type:`load`,view:H(location.hash.slice(1))});return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),(0,y.useEffect)(()=>{if(n.project||!i.some(e=>e.findingsPending))return;let e=setTimeout(()=>{Y.projects(!0).then(({projects:e})=>a(e),()=>void 0)},2e3);return()=>clearTimeout(e)},[i,n.project]),(0,y.useEffect)(()=>{let e=!1;return Y.projects(!n.project).then(({projects:r})=>{if(e)return;a(r),c(!0);let i=r.some(e=>e.id===n.project);n.project&&!i&&me(`Project ${n.project} was not found.`),(o.current&&!n.project||n.project&&!i)&&t(r.length===1?{type:`reset`,name:`selectProject`,args:{project:r[0].id}}:{type:`reset`,name:`goHome`,args:{}}),o.current=!1},t=>!e&&me(t.message)),()=>{e=!0}},[Ee,n.project===null]),(0,y.useEffect)(()=>{if(!n.project)return Xe([]);let e=!1;return Y.suggestions(n.project).then(t=>!e&&Xe(t.suggestions),()=>!e&&Xe([])),()=>{e=!0}},[n.project,Ee]),(0,y.useEffect)(()=>{u([]),f({}),ze(null),Ke(!1),Ve(null),wt.current++,ue(``),O(null),A(!1),N(!1),I(null),se(`pending`),R(null),V(null),K([]),J([])},[n.project]),(0,y.useEffect)(()=>{if(!n.project){u([]);return}let e=!1,t=n.project;return Y.files(t).then(t=>{e||(u(t.files),N(!0))},()=>{e||(u([]),N(!0))}),Y.fileCounts(t).then(t=>!e&&f(t.counts),()=>!e&&f({})),Y.status(t).then(n=>{e||(O(n.latest),R(n.draft??null),V(n.debug??null),I(n.committedRun),A(!0),n.progress&&fe(e=>e.has(t)?e:new Map(e).set(t,n.progress)),se(n.runInProgress?`running`:n.latest?.status===`failed`?`failed`:n.latest?`done`:`pending`))},()=>void 0),()=>{e=!0}},[n.project,Ee]),(0,y.useEffect)(()=>{if(J([]),!n.project||P===null)return;let e=n.project,t=!1,r=()=>!ce.current&&void Y.stale(e).then(e=>!t&&J(e.committedRun===P?e.sources:[]),()=>void 0);return r(),window.addEventListener(`focus`,r),()=>{t=!0,window.removeEventListener(`focus`,r)}},[n.project,P]);let[ft,pt]=(0,y.useState)([]),mt=(0,y.useMemo)(()=>n.file&&(n.tab===`file`||n.fileLevel)?{kind:`file`,file:n.file}:n.tab===`imports`&&n.group?{kind:`group`,group:n.group}:n.source?{kind:`source`,source:n.source,name:ft.find(e=>e.id===n.source)?.name}:null,[n.file,n.tab,n.fileLevel,n.group,n.source,ft]);(0,y.useEffect)(()=>{if(!n.project)return pt([]);let e=!1;return Y.sources(n.project).then(t=>!e&&pt(t.sources.map(e=>({...e,optIn:e.optIn??[]}))),()=>void 0),()=>{e=!0}},[n.project,Ee]),(0,y.useEffect)(()=>{n.source&&ft.length>0&&!ft.some(e=>e.id===n.source)&&t({type:`reset`,name:`scopeSource`,args:{}})},[n.source,ft]);let{data:ht}=AS(n.project,je,g===`project`?null:mt,[],Ee),gt=ht?ht.counts.broken+ht.counts.notAnalyzed+ht.counts.openCalls:null,[_t,vt]=(0,y.useState)(null),yt=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(!n.project||!n.file){h(null);return}n.file!==yt.current&&ge(``),yt.current=n.file,h(e=>e&&e.file.id===n.file?e:null),ct(!1);let e=!1,r=n.file;return Y.fileGraph(n.project,r).then(t=>!e&&h(t),r=>{e||te(r)||(h(null),ge(n.run===null?`That file wasn't in the latest analysis, so the project overview is shown instead.`:`That file isn't in run ${n.run}, so the project overview is shown instead.`),t({type:`reset`,name:`selectProject`,args:{project:n.project}}))}),()=>{e=!0}},[n.project,n.file,Ee]),(0,y.useEffect)(()=>re(De,e=>{if(typeof e.projectId==`string`&&fe(t=>{let n=t.get(e.projectId)??null,r=S(n,e);if(r===n)return t;let i=new Map(t);return r?i.set(e.projectId,r):i.delete(e.projectId),i}),!n.project){(e.type===`run.started`||e.type===`run.committed`||e.type===`run.failed`)&&De();return}e.projectId===n.project&&(e.type===`run.started`?(se(`running`),ue(`Analyzing…`)):e.type===`stage.completed`?ue(`Analyzing…`):e.type===`run.committed`?(J([]),se(`done`),ue(`Analyzed just now`),De()):e.type===`run.failed`&&(se(`failed`),ue(`Analysis failed: ${String(e.error)}`),De()))}),[n.project]),(0,y.useEffect)(()=>{let e=e=>{let n=e.target;if(document.querySelector(`[role="dialog"], [role="menu"]`)||n.closest(`input:not([type="checkbox"]):not([type="radio"]), textarea, select, [contenteditable], [role=dialog]`))return;if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()===`z`){e.preventDefault(),t({type:e.shiftKey?`redo`:`undo`});return}if(e.metaKey||e.ctrlKey||e.altKey)return;let i=E.current&&Date.now()-E.current<1200;if(E.current=0,i&&e.key===`m`){r(`openGroup`,{});return}e.key===`Escape`?r(`clearSelection`):e.key===`u`?r(`toggleUnresolved`):e.key===`1`?r(`showTab`,{tab:`file`}):e.key===`2`?x.current!==`imports`&&r(`showTab`,{tab:`imports`}):e.key===`3`?r(`showTab`,{tab:`reach`}):e.key===`[`?T(e=>!e):e.key===`g`&&(E.current=Date.now())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let bt=(0,y.useCallback)(e=>r(`select`,e),[r]),xt=(0,y.useCallback)(()=>r(`clearSelection`),[r]),St=(0,y.useCallback)(()=>{_(`file`),r(`showPanel`,{panel:`questions`})},[r]),Ct=async(e,t)=>{if(b(``),!PE(e)){b(`Enter an absolute path (for example /Users/you/app), not "${e}"`);return}let i=t?ye??n.project:null;try{W(`addFolder`,{root:e}),i||(i=(await Y.createProject(e.split(/[\\/]/).filter(Boolean).pop()??`project`,e)).project.id,r(`selectProject`,{project:i})),await Y.addSource(i,e)}catch(e){b(e.message??String(e));return}ve(!1),be(null),b(``),se(`running`);try{await Y.analyze(i)}catch(e){me(e.message??String(e))}De()},wt=(0,y.useRef)(0),Tt=(0,y.useRef)(null),Et=async(e,i)=>{if(!n.project)return;W(`ask`,{question:e});let a=++wt.current,o=n.project;Tt.current?.abort();let s=new AbortController;Tt.current=s,t({type:`reset`,name:`showPanel`,args:{panel:`answer`}}),Ke(!0),Ve(e),Z(t=>[e,...t.filter(t=>t!==e)].slice(0,5));let c;try{c=await Y.ask(o,e,i,Ue.current,s.signal,We.current)}catch(t){let n=t;c={question:e,via:`help`,...i?{mode:i}:{},summary:`Could not answer: ${n.message??String(t)}`,results:[],toolCalls:[],error:{code:n.code??`error`,message:n.message??String(t)}}}if(a!==wt.current||He.current!==o)return;let l=c.results[0];l?.kind===`function`&&l.file===Ue.current&&(c.intent===`callers`||c.intent===`callees`||c.intent===`definition`)&&(r(`select`,{kind:`function`,id:l.id,file:l.file}),t({type:`reset`,name:`showPanel`,args:{panel:`answer`}})),ze(c),Ke(!1),Ve(null)},Dt=e=>{for(let t of ee(e))r(t.name,t.args);t({type:`reset`,name:`showPanel`,args:{panel:`answer`}})},Ot=()=>{Tt.current?.abort(),wt.current++,Ke(!1),Ve(null)},Q=()=>{n.project&&(W(`analyzeDraft`),me(``),ue(`Analyzing your uncommitted edits as a draft…`),Y.analyzeDraft(n.project).catch(e=>{me(e.message),De()}))},kt=e=>{n.project&&(W(`analyzeFrom`,{from:e}),me(``),ue(`Analyzing again from ${e}…`),Y.analyzeFrom(n.project,e).catch(e=>{me(e.message),De()}))},At=e=>{n.project&&(W(`analyzeDebug`,{until:e}),me(``),ue(`Debug run: analyzing up to ${e}…`),Y.analyzeDebug(n.project,e).catch(e=>{me(e.message),De()}))};(0,y.useEffect)(()=>{if(!n.project)return;let e=!1;return Y.stages(n.project).then(t=>!e&&K(t.pipeline),()=>!e&&K([])),()=>{e=!0}},[n.project]);let[jt,Mt]=(0,y.useState)(null),Nt=(0,y.useCallback)(()=>Mt(null),[]),Pt=e=>{let t=e=>e.slice(0,e.indexOf(`:`)),i=e=>decodeURIComponent(e.slice(e.indexOf(`:`)+1)),a=e=>e.slice(0,e.indexOf(`:`,e.indexOf(`:`)+1)),o=(e,t)=>({label:`Leave it out of analysis…`,command:`chooseFiles`,run:()=>we({source:e,...t?{path:t}:{}})}),s=e=>({label:`Re-analyze its repository`,command:`analyzeSource`,run:()=>void Ft(e)}),c=e=>({label:`Broken imports in it`,command:`showPanel`,run:()=>{e(),vt(`broken`),r(`showPanel`,{panel:`questions`})}});if(e.kind===`group`){let[,t=``,i=``]=e.id.split(`|`);return{title:String(e.data.label??e.id).split(`
341
- `)[0],entries:[{label:`Open`,command:`openGroup`,run:()=>r(`openGroup`,{group:e.id})},{label:`Show only its links`,command:`showOnlyLinks`,run:()=>{(n.group!==null||n.fileLevel)&&r(`openGroup`,{}),r(`showOnlyLinks`,{id:e.id})}},{label:`What depends on it`,command:`pickNode`,run:()=>r(`pickNode`,{id:e.id})},c(()=>r(`openGroup`,{group:e.id})),s(t),.../^(cluster|module|shared):/.test(i)?[]:[o(t,i||void 0)]]}}if(e.kind===`file`){let a=t(e.id);return{title:i(e.id),entries:[{label:`Open`,command:n.tab===`imports`?`openImportsFile`:`openFile`,run:()=>n.tab===`imports`?r(`openImportsFile`,{file:e.id}):r(`openFile`,{file:e.id})},...n.tab===`imports`&&!n.fileLevel?[{label:`Show only its links`,command:`showOnlyLinks`,run:()=>r(`showOnlyLinks`,{id:e.id})}]:[],{label:n.tab===`imports`?`What depends on it`:`⇄ Imports of this file`,command:`openImportsFile`,run:()=>r(`openImportsFile`,{file:e.id})},c(()=>r(`openImportsFile`,{file:e.id})),{label:`Reach from this file`,command:`openReach`,run:()=>r(`openReach`,{root:e.id,direction:`forward`})},s(a),o(a,i(e.id))]}}if(e.kind===`folder`){let t=e.id.split(`|`)[2]??``,n=String(e.data.path??``);return{title:`${n}/`,entries:[{label:`Open or close`,command:`toggleFolder`,run:()=>r(`toggleFolder`,{path:n})},s(t),o(t,n)]}}if(e.kind===`function`){let c=a(e.id),l=e.id.slice(c.length+1);return{title:l,entries:[{label:`Open`,command:`select`,run:()=>r(`select`,{kind:`function`,id:e.id,file:c})},...n.tab===`file`&&Zt===`graph`?[{label:`Show only its links`,command:`showOnlyLinks`,run:()=>r(`showOnlyLinks`,{id:e.id})}]:[],{label:`Who calls it`,command:`ask`,run:()=>void Et(`who calls ${l}`)},{label:`Reach from here`,command:`openReach`,run:()=>r(`openReach`,{root:e.id,direction:`forward`})},{label:`What reaches it`,command:`openReach`,run:()=>r(`openReach`,{root:e.id,direction:`backward`})},s(t(c)),{...o(t(c),i(c)),label:`Leave its file out of analysis…`}]}}let l=e.data,u=e=>[{label:`Go to its start`,command:`openGroup`,run:()=>l.source&&e(l.source)},{label:`Go to its end`,command:`openGroup`,run:()=>l.target&&e(l.target)}];if(l.kind===`call`&&l.calls?.length&&n.tab===`file`)return{title:`Call`,entries:[{label:`Open`,command:`select`,run:()=>r(`select`,{kind:`call`,id:l.calls[0]})}]};if(l.kind===`depends`)return{title:`Dependency`,entries:[{label:`Show its calls`,command:`pickNode`,run:()=>l.source&&l.target&&r(`pickNode`,{id:aw(l.source,l.target)})},...u(e=>r(`openGroup`,{group:e}))]};if(l.kind===`calls`)return{title:`Calls`,entries:[{label:`Show its calls`,command:`pickNode`,run:()=>r(`pickNode`,{id:e.id})},...u(e=>e.startsWith(`stub|`)?r(`openGroup`,{group:e.slice(5)}):e.startsWith(`folder|`)?r(`toggleFolder`,{path:e.split(`|`).slice(4).join(`|`)}):r(`openImportsFile`,{file:e}))]};if(l.kind===`imports`)return{title:`Imports`,entries:u(e=>e.startsWith(`folder|`)?r(`toggleFolder`,{path:e.split(`|`).slice(4).join(`|`)}):r(`openImportsFile`,{file:e})).map(e=>({...e,command:`openImportsFile`}))};let d=e.data.edge??e.id;return{title:`Link`,entries:[{label:`Open`,command:`pickNode`,run:()=>r(`pickNode`,{id:d})}]}};(0,y.useEffect)(()=>{let e=e=>{if(!(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)||e.target.closest?.(`input, textarea, select, [role=dialog], [role=menu]`))return;let r=document.querySelector(`.graph-wrap .graph`)?.getBoundingClientRect(),i={x:r?r.left+r.width/2:200,y:r?r.top+r.height/3:200},a=null;if(n.tab===`file`&&n.selection?.kind===`function`?a={kind:`function`,id:n.selection.id,data:{},...i}:n.tab===`imports`&&n.pick&&(n.pick.startsWith(`group|`)||/^[^|]+:/.test(n.pick))&&(a={kind:n.pick.startsWith(`group|`)?`group`:`file`,id:n.pick,data:{},...i}),!a)return;e.preventDefault();let o=Pe?.groups.find(e=>e.id===a.id);o&&(a.data={label:o.name}),t=!0,Mt(a)},t=!1,r=e=>{t&&e.preventDefault(),t=!1};return window.addEventListener(`keydown`,e),window.addEventListener(`contextmenu`,r),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`contextmenu`,r)}},[n.tab,n.selection,n.pick,Pe]);let Ft=async e=>{if(n.project){try{await Y.analyzeSource(n.project,e)}catch(e){me(e.message??String(e))}De()}},It=()=>{n.project&&(W(`analyze`),me(``),se(`running`),Y.analyze(n.project).catch(e=>{me(e.message),De()}))},Lt=(0,y.useCallback)(e=>mC(e,{view:n,projects:i.map(e=>({id:e.id,name:e.name})),sources:ft.map(e=>({id:e.id,...e.name?{name:e.name}:{}})),files:l.map(e=>({id:e.id,path:e.path})),groups:(Pe?.groups??[]).map(e=>({id:e.id,name:e.name})),canDraft:ft.some(e=>e.analysis?.kind===`git`),stages:P===null?[]:G,command:(e,t)=>r(e,t??{}),action:(e,t)=>{e!==`addFolder`&&W(e,t??{}),e===`analyze`?It():e===`analyzeSource`?Ft(String(t?.source)):e===`chooseFiles`?we({source:String(t?.source),...t?.path?{path:String(t.path)}:{}}):e===`analyzeDraft`?Q():e===`analyzeDebug`?At(String(t?.until)):e===`analyzeFrom`?kt(String(t?.from)):e===`addFolder`?ve(!0):e===`openSettings`?et(!0):e===`openProjectSettings`&&Se(t?.tab??`repositories`)}}),[n,i,ft,l,Pe,r]),Rt=m!==null&&m.functions.length>80&&!st,zt=n.selection?.kind===`function`?n.selection.id:n.selection?.kind===`call`?m?.calls.find(e=>e.id===n.selection.id)?.from??null:n.selection?.kind===`site`?m?.unresolved.find(e=>e.id===n.selection.id)?.enclosingFn??null:null,Bt=zt&&m?.functions.some(e=>e.id===zt)?zt:null,Vt=n.selection?.kind===`call`?m?.calls.find(e=>e.id===n.selection.id):void 0,Ht=Vt?[Vt.from,Vt.to]:null,Ut=Ht?.join(`|`)??``,Wt=(0,y.useMemo)(()=>Rt&&m?HT(m,Bt,Ut?Ut.split(`|`):null):null,[Rt,m,Bt,Ut]),Gt=m?m.unresolved.filter(p).length:0,Kt=n.selection?.kind===`site`?m?.unresolved.find(e=>e.id===n.selection.id):void 0,qt=Kt&&!(n.showUnresolved&&p(Kt))?Kt.id:null,Jt=(0,y.useMemo)(()=>{if(!Re||!m)return null;let e=new Set(Re.results.filter(e=>e.kind===`function`&&e.file===m.file.id).map(e=>e.id));return e.size?e:null},[Re,m]),Yt=Bt?(()=>{let e=m?.functions.find(e=>e.id===Bt);return oe(e?.qualifiedName??``,void 0,e?.title).name})():``,Xt=Bt?new Set((m?.calls??[]).flatMap(e=>e.from===Bt&&e.to!==Bt?[e.to]:e.to===Bt&&e.from!==Bt?[e.from]:[])).size:0,Zt=lt??(m&&m.calls.length===0?`list`:`graph`),Qt=n.tab===`file`&&!n.file&&n.panel===`answer`&&(Re!==null||Ge),$t=n.tab===`imports`&&P!==null&&l.length>0,en=(0,X.jsx)(Ie,{answer:Re,busy:Ge,pending:Be,elapsed:rt,modelConfigured:Ze?.configured??!1,selectedId:n.selection?.id??null,wide:tt,onWide:nt,onOpen:Dt,onAsk:(e,t)=>void Et(e,t),onCancel:Ot,onTemplate:e=>ot.current?.prefill(e),onSettings:()=>et(!0),onShowQuestions:e=>{r(`openFile`,{file:e}),_(`file`),t({type:`reset`,name:`showPanel`,args:{panel:`questions`}})}});return(0,X.jsx)(pS.Provider,{value:n.grouping,children:(0,X.jsxs)(`div`,{className:`app`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(`button`,{className:`logo`,"aria-label":`veoflow: all projects (home)`,"data-command":`go-home`,title:M.goHome.description,onClick:()=>r(`goHome`,{}),children:`veoflow`}),(0,X.jsxs)(`select`,{"data-command":`select-project`,"aria-label":`Project`,className:`project`,value:i.some(e=>e.id===n.project)?n.project??``:``,onChange:e=>r(`selectProject`,{project:e.target.value}),children:[(0,X.jsx)(`option`,{value:``,disabled:!0,children:i.length===0?`No project yet`:`Choose a project`}),i.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),n.project&&(0,X.jsx)(AE,{tab:n.tab,reach:n.reach!==null,onTab:e=>r(`showTab`,{tab:e})}),(0,X.jsxs)(`button`,{"data-testid":`add-folder`,className:`quiet`,title:U.addFolder.description,"aria-label":`Add a folder`,onClick:()=>ve(!0),children:[`+`,(0,X.jsx)(`span`,{className:`wide-only`,children:` Add folder`})]}),(0,X.jsx)(Oe,{project:n.project,modelName:Ze?.configured?Ze.model:null,disabled:!n.project||l.length===0,loading:!!n.project&&l.length===0&&!k,suggestions:Je,recent:qe,busy:Ge,onAsk:e=>void Et(e),handle:ot,palette:Lt,onOpenFunction:Fe}),n.project&&(0,X.jsx)(xE,{stage1:ae,message:le,progress:ae===`running`?de.get(n.project)??null:null,...ae!==`running`&&D?.errorCode===`stage-inputs-changed`?{onFullRun:It}:{},latest:D,loading:!!n.project&&!k,...n.project&&ae===`running`?{onCancel:()=>{let e=n.project;le!==`Cancelling…`&&(ue(`Cancelling…`),Y.cancelRun(e).then(()=>{ue(``),De()},e=>ue(`Couldn't cancel: ${e.message}`)))}}:{}}),n.project&&ft.some(e=>e.analysis?.kind===`git`)&&(0,X.jsx)(`button`,{"data-testid":`analyze-draft`,className:`icon`,title:U.analyzeDraft.description,"aria-label":`Analyze uncommitted edits`,onClick:Q,children:`✎`}),n.project&&(0,X.jsx)(`button`,{"data-testid":`reanalyze`,className:`icon`,title:`${U.analyze.description}`,"aria-label":`Analyze again`,onClick:It,children:`↻`}),n.project&&(0,X.jsx)(`button`,{"data-command":`toggle-history`,className:`quiet${n.history?` active`:``}`,"aria-pressed":n.history,title:M.toggleHistory.description,onClick:()=>r(`toggleHistory`,{}),children:`History`}),(0,X.jsx)(`button`,{"data-testid":`undo`,disabled:e.past.length===0,onClick:()=>t({type:`undo`}),title:`Undo (⌘Z)`,"aria-label":`Undo`,className:`icon`,children:(0,X.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M6 3 2 7l4 4M2.5 7H10a4 4 0 0 1 0 8H7`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`})})}),(0,X.jsx)(`button`,{"data-testid":`redo`,disabled:e.future.length===0,onClick:()=>t({type:`redo`}),title:`Redo (⇧⌘Z)`,"aria-label":`Redo`,className:`icon`,children:(0,X.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M10 3l4 4-4 4M13.5 7H6a4 4 0 0 0 0 8h3`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`})})}),n.project&&(0,X.jsx)(`button`,{"data-testid":`project-settings`,className:`quiet`,title:U.openProjectSettings.description,onClick:()=>{W(`openProjectSettings`),Se(`repositories`)},children:`Repositories`}),(0,X.jsx)(`button`,{"data-testid":`settings`,className:`icon`,title:U.openSettings.description,"aria-label":`Settings`,ref:at,onClick:()=>{W(`openSettings`),et(!0)},children:(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,"aria-hidden":`true`,children:[(0,X.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinejoin:`round`,d:`M10.3 3h3.4l.5 2.4 1.7.7 2-1.4 2.4 2.4-1.4 2 .7 1.7 2.4.5v3.4l-2.4.5-.7 1.7 1.4 2-2.4 2.4-2-1.4-1.7.7-.5 2.4h-3.4l-.5-2.4-1.7-.7-2 1.4-2.4-2.4 1.4-2-.7-1.7L3 13.7v-3.4l2.4-.5.7-1.7-1.4-2 2.4-2.4 2 1.4 1.7-.7z`}),(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`})]})})]}),he&&(0,X.jsxs)(`div`,{className:`notice`,role:`status`,"data-testid":`notice`,children:[(0,X.jsx)(`span`,{children:he}),(0,X.jsx)(`button`,{className:`icon`,"aria-label":`Dismiss`,onClick:()=>ge(``),children:`×`})]}),n.only&&(0,X.jsxs)(`div`,{className:`notice`,role:`status`,"data-testid":`only-banner`,children:[(0,X.jsxs)(`span`,{children:[`Showing only`,` `,n.only.startsWith(`group|`)?n.only.split(`|`).slice(2).join(`|`).replace(/^cluster:/,``)||n.only.split(`|`)[1]:n.only.slice(n.only.indexOf(`:`)+1),` `,`and what it links to.`]}),(0,X.jsx)(`button`,{"data-command":`show-only-links`,onClick:()=>r(`showOnlyLinks`,{}),children:`Show everything`})]}),n.project?n.run!==null&&(n.compare!==null||n.run!==P)?(0,X.jsxs)(`div`,{className:`notice draft`,role:`status`,"data-testid":`draft-banner`,children:[(0,X.jsx)(`span`,{children:n.compare?`Comparing run ${n.compare.a} with run ${n.compare.b}: the canvas shows run ${n.compare.b}, its changes marked.`:n.run===L?.runId?`You're viewing a draft of your uncommitted edits (run ${n.run}). The latest analysis is unchanged.`:n.run===B?.runId?`You're viewing a debug run that stopped after ${B.stages.at(-1)?.stage??`?`} (run ${n.run}): it shows only what those stages produced, and is never committed. The latest analysis is unchanged.`:`You're viewing run ${n.run}, not the latest analysis.`}),n.run===B?.runId&&P!==null&&!n.compare&&(0,X.jsx)(`button`,{"data-command":`compare-runs`,"data-testid":`debug-compare`,onClick:()=>r(`compareRuns`,{a:P,b:B.runId}),children:`Compare with latest`}),(0,X.jsx)(`button`,{"data-command":`open-run`,onClick:()=>r(`openRun`,{}),children:`Back to latest`})]}):(0,X.jsxs)(X.Fragment,{children:[L&&(0,X.jsxs)(`div`,{className:`notice`,role:`status`,"data-testid":`draft-ready`,children:[(0,X.jsxs)(`span`,{children:[`A draft of your uncommitted edits is ready (run `,L.runId,`).`]}),(0,X.jsx)(`button`,{"data-command":`open-run`,onClick:()=>r(`openRun`,{run:L.runId}),children:`Open it`})]}),B&&(0,X.jsxs)(`div`,{className:`notice`,role:`status`,"data-testid":`debug-ready`,children:[(0,X.jsxs)(`span`,{children:[`A debug run that stopped after `,B.stages.at(-1)?.stage??`?`,` is ready (run`,` `,B.runId,`).`]}),(0,X.jsx)(`button`,{"data-command":`open-run`,onClick:()=>r(`openRun`,{run:B.runId}),children:`Open it`})]})]}):null,n.project&&q.length>0&&ae!==`running`&&(0,X.jsxs)(`div`,{className:`notice`,role:`status`,"data-testid":`stale-evidence`,children:[(0,X.jsx)(`span`,{children:IE(q)}),(0,X.jsx)(`button`,{onClick:It,"data-testid":`stale-reanalyze`,children:`Re-analyze`})]}),pe&&(0,X.jsxs)(`div`,{className:`error`,role:`alert`,"data-testid":`error`,children:[(0,X.jsx)(`span`,{children:pe}),(0,X.jsx)(`button`,{className:`icon`,"aria-label":`Dismiss`,onClick:()=>me(``),children:`×`})]}),_e&&(0,X.jsx)(SE,{current:i.find(e=>e.id===(ye??n.project))?.name??(ye?`the new project`:null),intoByDefault:ye!==null||i.find(e=>e.id===n.project)?.sources===0,onAdd:(e,t)=>void Ct(e,t),onCancel:()=>{ve(!1),be(null),b(``)},error:v}),xe&&n.project&&(0,X.jsx)($S,{initialTab:xe,project:n.project,projectName:i.find(e=>e.id===n.project)?.name??n.project,refresh:Ee,onClose:()=>Se(null),onAdd:()=>{Se(null),ve(!0)},onChooseFiles:e=>we({source:e}),onAnalyzeAll:It,onChanged:De,covered:Ce!==null},xe),jt&&(()=>{let e=Pt(jt);return(0,X.jsx)(dC,{title:e.title,entries:e.entries,x:jt.x,y:jt.y,onClose:Nt})})(),Ce!==null&&n.project&&(0,X.jsx)(iC,{project:n.project,only:Ce.source,...Ce.path?{at:Ce.path}:{},files:l,run:D,onAnalyze:()=>{It(),we(null)},onClose:()=>we(null)}),$e&&(0,X.jsx)(_E,{onClose:()=>{et(!1),at.current?.focus()},onSaved:e=>Qe(e)}),!n.project&&(0,X.jsx)(lC,{projects:i,progress:de,loading:!s,onOpen:e=>r(`selectProject`,{project:e}),onCreated:e=>{De(),r(`selectProject`,{project:e}),be(e),ve(!0)},onAddFolder:()=>ve(!0),onDeleted:()=>De()}),n.project&&(0,X.jsxs)(`main`,{className:[tt&&n.panel===`answer`&&!Qt?`wide-aside`:``,C?`nav-hidden`:``].filter(Boolean).join(` `),children:[C?(0,X.jsx)(`div`,{className:`nav-collapsed-bar`,children:(0,X.jsx)(`button`,{className:`icon`,"data-command":`show-nav`,title:`Show the ${$t?`groups`:`files`} pane ( [ )`,"aria-label":`Show the ${$t?`groups`:`files`} pane`,onClick:()=>T(!1),children:`⟩`})}):$t?(0,X.jsx)(AC,{project:n.project,run:je,source:n.source,group:n.group,file:n.file,fileLevel:n.fileLevel,expand:n.expand,showPending:n.showPending,onOpenGroup:(e,t)=>r(`openGroup`,e?{group:e,...t?{folder:t}:{}}:{}),onCloseGroup:()=>r(n.area?`openArea`:`openGroup`,n.area?{area:n.area}:{}),onOpenFile:(e,t)=>r(`openImportsFile`,t?{file:e,group:t}:{file:e}),onToggleFolder:e=>r(`toggleFolder`,{path:e}),onCollapse:()=>T(!0),onMenu:Mt,sources:ft,onScope:e=>r(`scopeSource`,e?{source:e}:{}),area:n.area??null}):null,(0,X.jsx)(wT,{hidden:C||$t,onReveal:()=>{T(!1),n.tab!==`file`&&r(`showTab`,{tab:`file`})},onCollapse:()=>T(!0),project:n.project,files:l,counts:d,current:n.file,onOpen:e=>r(`openFile`,{file:e}),onImports:e=>r(`openImportsFile`,{file:e}),onMenu:Mt,run:D,onAnalyze:()=>{n.project&&(se(`running`),Y.analyze(n.project).catch(e=>me(e.message)))},sources:ft,scope:n.source,onScope:e=>r(`scopeSource`,e?{source:e}:{})},n.project??``),(0,X.jsxs)(`section`,{className:`center`,children:[(0,X.jsx)(fE,{project:n.project,run:D?.runId===P?D:null,sources:ft,onAnalyze:It,onKept:()=>{_S(),De()},onChooseFiles:e=>we({source:e})},`${n.project}:${P}`),n.project&&n.tab===`reach`&&n.reach&&P!==null?(0,X.jsx)(ww,{project:n.project,run:je,root:n.reach.root,direction:n.reach.direction,onDirection:e=>r(`openReach`,{root:n.reach.root,direction:e}),onReach:e=>r(`openReach`,{root:e}),onOpenFile:e=>{r(`openFile`,{file:e}),r(`showTab`,{tab:`file`})},onContext:Mt}):n.project&&n.tab===`reach`&&P===null?(0,X.jsx)(`div`,{className:`empty`,"data-testid":`reach-empty`,children:`Reach needs an analysis: run one, and open Reach from a function or file.`}):n.project&&$t?(0,X.jsx)(mw,{marks:Ne,only:n.only,onContext:Mt,project:n.project,projectName:i.find(e=>e.id===n.project)?.name??n.project,run:je,group:n.group,area:n.area,onOpenArea:e=>r(`openArea`,e?{area:e}:{}),source:n.source,grouping:n.grouping,differences:n.differences,onSetGrouping:e=>r(`setGrouping`,{grouping:e}),onToggleDifferences:()=>r(`toggleDifferences`),reveal:n.reveal,onReveal:(e,t)=>r(`revealFile`,{file:e,from:t}),onResetReveal:()=>r(`resetReveal`),pick:n.pick,file:n.file,fileLevel:n.fileLevel,expand:n.expand,showPending:n.showPending,onPick:e=>r(`pickNode`,{id:e}),onOpenGroup:e=>r(`openGroup`,e?{group:e}:{}),onOpenFile:(e,t)=>r(`openImportsFile`,t?{file:e,group:t}:{file:e}),onToggleFolder:e=>r(`toggleFolder`,{path:e}),onTogglePending:()=>r(`togglePending`),onClear:xt,onFileFindings:St}):m?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`toolbar`,children:[(0,X.jsx)(`span`,{className:`file-title`,"data-testid":`file-title`,title:m.file.path,children:Te(m.file.path)}),m.file.status===`degraded`&&(0,X.jsx)(`span`,{className:`badge degraded`,"data-testid":`degraded`,title:m.file.reason??``,children:`partly analyzed`}),(0,X.jsx)(`span`,{className:`spacer`}),m.file.status!==`not_analyzed`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{"data-command":`file-to-imports`,title:`This file on the Imports tab: what it imports, what depends on it, its calls across files (2)`,onClick:()=>r(`openImportsFile`,{file:m.file.id}),children:[`⇄ Imports`,(0,X.jsx)(`span`,{className:`wide-only`,children:` of this file`})]}),(0,X.jsxs)(`div`,{className:`segmented`,role:`group`,"aria-label":`Show as`,children:[(0,X.jsx)(`button`,{"aria-pressed":Zt===`graph`,"data-testid":`show-graph`,onClick:()=>ut(`graph`),children:`Graph`}),(0,X.jsx)(`button`,{"aria-pressed":Zt===`list`,"data-testid":`show-list`,onClick:()=>ut(`list`),children:`List`})]}),(0,X.jsxs)(`label`,{className:`toggle`,title:`Calls within this file the analysis could not resolve, drawn in the graph (press u): ${Gt} of the ${m.unresolved.length} unresolved calls here; the rest are imports or built-ins.${ht&&n.file&&g===`file`&&mt?.kind===`file`&&ht.counts.openCalls!==Gt?` Findings lists ${ht.counts.openCalls} open calls for this file: it adds calls through imports that couldn't be linked.`:``}`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-command":`toggle-unresolved`,checked:n.showUnresolved&&Gt>0,disabled:Gt===0,onChange:()=>r(`toggleUnresolved`)}),`Open questions (`,FE(Gt),`)`]}),m.functions.length>80&&Zt===`graph`&&(0,X.jsxs)(`label`,{className:`toggle`,title:`Large files show the selection and its neighbours`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`whole-file`,checked:st,onChange:e=>ct(e.target.checked)}),`Whole file`]})]})]}),m.file.status!==`not_analyzed`&&n.project&&(0,X.jsx)(fw,{project:n.project,file:m.file.id,version:je,onImports:()=>r(`openImportsFile`,{file:m.file.id}),onFindings:St}),Wt&&Zt===`graph`&&(0,X.jsxs)(`p`,{className:`focus-note`,"data-testid":`focus-note`,children:[Bt?Xt===0?`${Yt} calls nothing else in this file, and nothing here calls it. `:`${Yt} and ${Math.min(Xt,Wt.size-1)} of its ${Xt} direct neighbours${Wt.size-1>Xt?`, with some of theirs`:``}. `:Ht?`This call, its two functions and a few of their neighbours. `:`The ${Wt.size} most connected of ${m.functions.length} functions. Select one to focus on it${n.showUnresolved?` and see its open questions`:``}. `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>ut(`list`),children:`See all in the list`})]}),m.findings.length>0&&(0,X.jsx)(`ul`,{className:`findings`,"data-testid":`findings`,children:m.findings.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`strong`,{children:e.kind}),`: `,e.message]},e.id))}),m.file.status===`not_analyzed`?(0,X.jsx)(`p`,{className:`hint`,"data-testid":`not-analyzed`,children:wE(m.file.reason)}):Zt===`graph`?(0,X.jsx)(iE,{marks:Ne,only:n.only,onContext:Mt,graph:m,showUnresolved:n.showUnresolved,selection:n.selection,onSelect:bt,onClear:xt,focus:Wt,sitesFor:Bt,answered:Jt,extraSite:qt}):(0,X.jsx)(CE,{graph:m,showUnresolved:n.showUnresolved,selection:n.selection,onSelect:bt,extraSite:qt,onContext:Mt})]}):n.file?(0,X.jsxs)(`p`,{className:`hint`,"data-testid":`loading-file`,children:[`Loading `,l.find(e=>e.id===n.file)?.path??`the file`,`…`]}):Qt?(0,X.jsx)(`div`,{className:`centre-answer`,children:en}):n.project&&l.length>0?(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(gE,{project:n.project,files:l,run:D?.runId===P?D:null,counts:d,source:n.source??null,sources:ft,onOpen:e=>r(`openFile`,{file:e}),onQuestions:()=>{vt(`open-call`),r(`showPanel`,{panel:`questions`})}})}):n.project&&k&&j&&P!==null?(0,X.jsxs)(`div`,{className:`overview`,"data-testid":`overview-empty`,children:[(0,X.jsx)(`p`,{className:`hint`,children:`No files were analyzed in this project.`}),(0,X.jsx)(mE,{run:D?.runId===P?D:null})]}):(0,X.jsx)(`p`,{className:`hint`,children:n.project&&(!k||!j)?`Loading ${i.find(e=>e.id===n.project)?.name??`the project`}…`:(0,X.jsxs)(X.Fragment,{children:[`Add a folder to analyze it.`,` `,(0,X.jsx)(`button`,{className:`primary`,"data-testid":`empty-add-folder`,onClick:()=>ve(!0),children:`Add folder`})]})})]}),(0,X.jsx)(`aside`,{children:n.history&&n.project?(0,X.jsx)(qS,{project:n.project,refresh:Ee,run:n.run,compare:n.compare,diff:Me.data,diffError:Me.error,onView:e=>r(`openRun`,e===null?{}:{run:e}),onCompare:e=>r(`compareRuns`,e??{}),onClose:()=>r(`toggleHistory`,{}),onLocate:Le,stages:G,onDebug:At,onFrom:kt}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`tabs`,role:`tablist`,children:[(Re||Ge||n.panel===`answer`)&&!Qt&&(0,X.jsx)(`button`,{role:`tab`,"data-command":`show-panel`,"data-testid":`answer-tab`,"aria-selected":n.panel===`answer`,onClick:()=>r(`showPanel`,{panel:`answer`}),children:`Answer`}),(0,X.jsx)(`button`,{role:`tab`,"data-command":`show-panel`,"aria-selected":n.panel===`evidence`,title:$t?`What is picked on the canvas, in detail`:`The code that proves what is selected`,onClick:()=>r(`showPanel`,{panel:`evidence`}),children:`Selected`}),(0,X.jsxs)(`button`,{role:`tab`,"data-command":`show-panel`,"data-testid":`questions-tab`,"aria-selected":n.panel===`questions`,title:mt&&g===`file`?`What the analysis couldn't settle in this ${mt.kind}`:`What the analysis couldn't settle in the project`,onClick:()=>r(`showPanel`,{panel:`questions`}),children:[mt&&g===`file`?`Findings here`:`Findings`,` (`,gt===null?`…`:FE(gt),`)`]})]}),n.panel===`answer`&&!Qt?en:n.panel===`evidence`||n.panel===`answer`?(0,X.jsxs)(X.Fragment,{children:[Re&&!Qt&&(0,X.jsx)(`button`,{className:`link back`,onClick:()=>t({type:`reset`,name:`showPanel`,args:{panel:`answer`}}),children:`← Back to the answer`}),$t&&n.project?(0,X.jsx)(Lw,{project:n.project,run:je,group:n.group,pick:n.pick,file:n.file,fileLevel:n.fileLevel,expand:n.expand,showPending:n.showPending,onPick:e=>r(`pickNode`,{id:e}),onOpenGroup:e=>r(`openGroup`,{group:e}),onOpenFile:e=>r(`openImportsFile`,{file:e}),onToggleFolder:e=>r(`toggleFolder`,{path:e})}):(0,X.jsx)(TE,{project:n.project,graph:m,changedOnDisk:ie,selection:n.selection,onClear:xt,onSelect:bt,onOpenFunction:e=>r(`select`,{kind:`function`,...e}),onShowImports:()=>r(`showTab`,{tab:`imports`}),sources:ft})]}):n.project&&(0,X.jsx)(jS,{project:n.project,run:je,scope:mt,wholeProject:g===`project`,canScope:mt!==null,showPending:n.showPending,refresh:Ee,onWholeProject:e=>_(e?`project`:`file`),onTogglePending:()=>r(`togglePending`),filter:_t,onFilter:vt,onSelectSite:(e,t)=>r(`select`,{kind:`site`,id:e,file:t}),onOpenImport:(e,t,n)=>r(`openImportsFile`,n?{file:e,pick:t,group:n}:{file:e,pick:t}),onManageLicense:()=>{W(`openProjectSettings`,{tab:`license`}),Se(`license`)}})]})})]})]})})}function xE({stage1:e,message:t,progress:n=null,onFullRun:r,latest:i,loading:a,onCancel:o}){let[,s]=(0,y.useState)(0);(0,y.useEffect)(()=>{if(!n)return;let e=setInterval(()=>s(e=>e+1),1e3);return()=>clearInterval(e)},[n===null]);let c=n&&t!==`Cancelling…`?T(n):null,l=n?.startedAt?Date.parse(n.startedAt):null,u=c&&l?Math.max(0,Math.round((Date.now()-l)/1e3)):null,d=(c?`${c.text}${u===null?``:` · ${u<60?`${u} s`:`${Math.floor(u/60)} min ${u%60} s`}`}`:``)||t||(i?i.status===`failed`?i.errorCode===`cancelled`?`Analysis cancelled; the graph is as it was`:`Analysis failed${i.error?`: ${i.error}`:``}`:i.status===`running`?`Analyzing…`:`Analyzed${i.finishedAt?` ${we(i.finishedAt)}`:``}`:a?`Loading…`:``);return(0,X.jsxs)(`ol`,{className:`timeline`,"data-testid":`timeline`,children:[n&&n.stages.length>0?n.stages.map((e,t)=>{let r=n.finished.find(t=>t.stage===e),i=r?`done`:e===n.stage?`running`:`pending`;return(0,X.jsx)(`li`,{className:i,"data-stage":e,"data-state":i,title:`${C[e]??e}${r?`: done in ${(r.durationMs/1e3).toFixed(1)} s`:i===`running`?`: running`:`: next`}`,children:(0,X.jsx)(`span`,{className:`dot`})},e)}):null,!(n&&n.stages.length>0)&&yE.filter(e=>e.release===`R1`).map(t=>{let n=t.id===`stage1`?e:`future`;return(0,X.jsx)(`li`,{className:n,"data-stage":t.id,"data-state":n,title:t.name,children:(0,X.jsx)(`span`,{className:`dot`})},t.id)}),(0,X.jsxs)(`li`,{className:`message`,"data-testid":`run-message`,title:i?`${d} · run ${i.runId}`:d||void 0,children:[(0,X.jsx)(`span`,{className:`status-text`,"data-testid":`run-status-text`,children:d}),c&&(0,X.jsx)(`span`,{className:`run-bar`,"data-testid":`run-bar`,role:`progressbar`,"aria-label":`Analysis progress`,...c.fraction===null?{}:{"aria-valuenow":Math.round(c.fraction*100)},children:(0,X.jsx)(`span`,{style:{width:`${Math.round((c.fraction??0)*100)}%`}})}),r&&(0,X.jsx)(`button`,{className:`link`,"data-testid":`full-run`,onClick:r,children:`Analyze the whole project`}),o&&(0,X.jsx)(`button`,{className:`link`,"data-testid":`cancel-run`,disabled:t===`Cancelling…`,onClick:o,title:`Stop this analysis; the graph stays as it was`,children:`Cancel`})]})]})}function SE({current:e,onAdd:t,onCancel:n,error:r,intoByDefault:i=!1}){let[a,o]=(0,y.useState)(i),[s,c]=(0,y.useState)(``),l=(0,y.useRef)(null);return(0,y.useEffect)(()=>l.current?.focus(),[]),(0,y.useEffect)(()=>{let e=e=>e.key===`Escape`&&n();return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,X.jsx)(`div`,{className:`backdrop`,onMouseDown:e=>e.target===e.currentTarget&&n(),children:(0,X.jsxs)(`form`,{className:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`add-title`,onSubmit:e=>{e.preventDefault(),s.trim()&&t(s.trim(),a)},children:[(0,X.jsx)(`h2`,{id:`add-title`,children:`Add a folder`}),(0,X.jsxs)(`label`,{children:[`Folder to analyze`,(0,X.jsx)(`input`,{ref:l,"data-testid":`folder-path`,value:s,onChange:e=>c(e.target.value),placeholder:`/Users/you/projects/app`,spellCheck:!1}),r?(0,X.jsx)(`small`,{className:`field-error`,role:`alert`,children:r}):(0,X.jsx)(`small`,{className:`muted`,children:`The absolute path of a git repository or any folder. It is read, never changed.`})]}),e&&(0,X.jsxs)(`label`,{className:`inline`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`add-into-current`,checked:a,onChange:e=>o(e.target.checked)}),`Add it to `,e,` instead of a new project (to analyze several repositories together)`]}),(0,X.jsxs)(`div`,{className:`buttons`,children:[(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`}),(0,X.jsx)(`button`,{type:`submit`,className:`primary`,"data-testid":`add-folder-submit`,children:`Add and analyze`})]})]})})}function CE({graph:e,showUnresolved:t,selection:n,onSelect:r,extraSite:i=null,onContext:a}){let o=new Map(e.functions.map(e=>[e.id,be(e).name])),s=[...e.functions].sort((e,t)=>e.evidence.span.start.line-t.evidence.span.start.line),c=e.unresolved.filter(e=>t&&p(e)&&e.id!==i).sort((e,t)=>e.evidence.span.start.line-t.evidence.span.start.line),l=i?e.unresolved.find(e=>e.id===i):void 0,u=(e,t,i)=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"data-command":`select`,"data-kind":e.kind,"data-id":e.id,className:n?.kind===e.kind&&n.id===e.id?`selected`:``,onClick:()=>r(e),onContextMenu:t=>{let n=e.kind===`function`?`function`:e.kind===`call`?`edge`:null;n&&a&&(t.preventDefault(),a({kind:n,id:e.id,data:n===`edge`?{kind:`call`,calls:[e.id]}:{},x:t.clientX,y:t.clientY}))},children:[t,i&&(0,X.jsxs)(`small`,{className:`muted`,children:[` `,i]})]})},`${e.kind}:${e.id}`);return(0,X.jsxs)(`div`,{className:`elements`,"data-testid":`elements`,children:[(0,X.jsxs)(`h4`,{children:[`Functions (`,e.functions.length,`)`]}),(0,X.jsx)(`ul`,{children:s.map(e=>{let t=be(e);return u({kind:`function`,id:e.id},`${t.unnamed?`λ`:`ƒ`} ${t.name}`,t.parent?`in ${t.parent}`:void 0)})}),e.calls.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{children:[`Calls (`,e.calls.length,`)`]}),(0,X.jsx)(`ul`,{children:e.calls.map(e=>u({kind:`call`,id:e.id},`${o.get(e.from)??NE(e)} → ${o.get(e.to)??NE(e)} (line ${e.evidence.span.start.line})`))})]}),l&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h4`,{children:`Selected call site`}),(0,X.jsx)(`ul`,{children:u({kind:`site`,id:l.id},`? ${l.expression}`,`line ${l.evidence.span.start.line} · ${l.status===`awaiting-link`?`not linked across files`:l.status}`)})]}),c.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{children:[`Open questions (`,c.length,`)`]}),(0,X.jsx)(`ul`,{children:c.map(e=>u({kind:`site`,id:e.id},`? ${e.expression}`,`${d(e.reason)}, line ${e.evidence.span.start.line}`))})]})]})}function wE(e){switch(e){case`declaration-file`:return`Type declarations only (.d.ts): there are no functions to show.`;case`language-not-analyzed`:return`This language is not analyzed yet; Python, Go and Rust arrive in a later release.`;case`too-large`:return`This file is too large to analyze.`;case`binary`:return`This is not a text file.`;case`minified`:return`Minified code (built output, not source); choose it in Choose files to analyze it anyway.`;default:return`This file was not analyzed${e?` (${e})`:``}.`}}function TE({project:e,graph:t,changedOnDisk:n,selection:r,onClear:i,onSelect:a,onOpenFunction:o,onShowImports:s,sources:c}){let[l,u]=(0,y.useState)(null),[d,f]=(0,y.useState)(!1),[p,m]=(0,y.useState)(null),h=(0,y.useRef)(null),g=(0,y.useMemo)(()=>new Map(c.map(e=>[e.id,e.root])),[c]),_=(0,y.useMemo)(()=>{if(!t||!r)return null;if(r.kind===`function`){let e=t.functions.find(e=>e.id===r.id),n=e&&oe(e.qualifiedName,void 0,e.title);return e&&n&&{title:`function ${n.name}`,parent:n.parent,detail:[e.kind===`module`?DE.module:e.kind===`function`?``:DE[e.kind]??e.kind,e.exported?`exported`:``,e.isAsync?`async`:``].filter(Boolean).join(`, `),evidence:e.evidence,provenance:e.provenance,frame:e.id,whole:e.qualifiedName===`<module>`}}if(r.kind===`call`){let e=t.calls.find(e=>e.id===r.id),n=e=>{let n=t.functions.find(t=>t.id===e);return n?oe(n.qualifiedName,void 0,n.title).name:e};return e&&{title:`${n(e.from)} calls ${n(e.to)}`,parent:``,detail:`${OE[e.form]??`${e.form} call`} on line ${e.evidence.span.start.line}${e.resolution===`static-exact`?``:`, ${kE[e.resolution]??e.resolution}`}`,evidence:e.evidence,provenance:e.provenance,frame:e.from,whole:!1}}let e=t.unresolved.find(e=>e.id===r.id);return e&&{title:`Open question: ${e.expression}`,parent:``,detail:jE(e),evidence:e.evidence,provenance:e.provenance,frame:e.enclosingFn,whole:!1}},[t,r]),v=(0,y.useMemo)(()=>{if(!t||!_)return null;let e=t.functions.find(e=>e.id===_.frame)?.evidence.span??_.evidence.span,n=_.evidence.span,i=e=>{let n=t.functions.find(t=>t.id===e);return n?oe(n.qualifiedName,void 0,n.title).name:e},o=t.calls.filter(e=>e.from===_.frame&&e.id!==r?.id).map(e=>({start:e.evidence.span.start,end:e.evidence.span.end,kind:`call`,title:`Calls ${i(e.to)} (select)`,onClick:()=>a({kind:`call`,id:e.id})}));r?.kind!==`function`&&o.push({start:n.start,end:n.end,kind:`focus`});let s=e.end.line-e.start.line+1,c=Math.max(e.start.line,Math.min(n.start.line-30,e.end.line-EE+1));return{frame:e,panel:s<=EE?e:{start:{...e.start,line:c},end:{...e.end,line:Math.min(e.end.line,c+EE-1)}},marks:o,focusLine:n.start.line,clipped:s>EE}},[t,_,r,a]),b=_?.evidence.file??null,x=v?`${b}|${v.panel.start.line}|${v.panel.end.line}`:``,S=v?.clipped?`${b}|${v.frame.start.line}|${v.frame.end.line}`:``;(0,y.useEffect)(()=>{if(!e||!b||!v){u(null);return}let t=!1;return Y.snippet(e,b,v.panel).then(e=>!t&&u(e),()=>!t&&u(null)),()=>{t=!0}},[e,x]),(0,y.useEffect)(()=>{if(!d||!e||!b||!v||!S)return;let t=!1;return Y.snippet(e,b,v.frame).then(e=>!t&&m(e),()=>!t&&m(null)),()=>{t=!0}},[d,e,S]);let C=v?.clipped?p:l;if((0,y.useEffect)(()=>{_||f(!1)},[_]),!_)return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`hint`,children:`Select a function or a call, in the graph or the list, to see the code that proves it.`}),e&&t&&(0,X.jsx)(_C,{project:e,file:t.file.id,run:t.committedRun,onOpen:o,onShowImports:s})]});let{span:w}=_.evidence,T=_.evidence.file.slice(0,_.evidence.file.indexOf(`:`)),E=t?.file.path??``,D=g.get(T)?ME(`${g.get(T)}/${E}`):null;return(0,X.jsxs)(`div`,{className:`evidence`,"data-testid":`evidence`,children:[(0,X.jsxs)(`div`,{className:`evidence-head`,children:[(0,X.jsx)(`h3`,{"data-testid":`evidence-title`,children:_.title}),(0,X.jsx)(`button`,{className:`icon close`,"data-command":`clear-selection`,"aria-label":`Clear the selection (Esc)`,title:`Clear the selection (Esc)`,onClick:i,children:`×`})]}),_.parent&&(0,X.jsxs)(`p`,{className:`muted small`,children:[`in `,_.parent]}),_.detail&&(0,X.jsx)(`p`,{children:_.detail}),e&&t&&r?.kind===`function`&&(0,X.jsx)(IC,{project:e,graph:t,fn:r.id,onOpen:o,onShowImports:s}),e&&t&&r?.kind===`function`&&(0,X.jsx)(MC,{project:e,fn:r.id,run:t.committedRun,onOpen:o}),e&&r&&r.kind!==`function`&&(0,X.jsx)(Re,{project:e,id:r.id},r.id),_.provenance&&(0,X.jsxs)(`p`,{className:`muted small`,"data-testid":`evidence-provenance`,children:[`Found by `,Ce(_.provenance.stage),` · run `,_.provenance.run]}),n.has(_.evidence.file)&&(0,X.jsx)(`p`,{className:`muted small`,"data-testid":`evidence-changed`,children:`This file changed on disk since it was analyzed. The code shown is what was analyzed; the editor may open it at a different line. Re-analyze to update.`}),(0,X.jsxs)(`p`,{className:`location`,"data-testid":`evidence-location`,children:[(0,X.jsxs)(`code`,{children:[E,`:`,w.start.line,`:`,w.start.column]}),D&&(0,X.jsx)(`a`,{className:`button-link`,"data-testid":`open-in-editor`,href:`vscode://file${D}:${w.start.line}:${w.start.column}`,children:`Open in editor`}),l&&(0,X.jsx)(`button`,{className:`button-link`,ref:h,onClick:()=>f(!0),"data-testid":`expand-code`,children:`Expand`})]}),l&&v&&(0,X.jsx)(jw,{snippet:l,marks:v.marks,focusLine:v.focusLine,testId:`snippet`}),l&&v&&v.marks.some(e=>e.kind===`call`)&&(0,X.jsxs)(`p`,{className:`muted small legend`,children:[r?.kind!==`function`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`mark hit`,children:`The selection`}),`;`,` `]}),(0,X.jsx)(`span`,{className:`mark call-mark`,children:`highlighted`}),` calls in this function; click one to see it.`]}),l&&v?.clipped&&(0,X.jsxs)(`p`,{className:`muted small`,children:[`Showing lines `,l.startLine,`–`,l.startLine+l.lines.length-1,`.`,` `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>f(!0),children:`Expand to see all of it`})]}),(0,X.jsxs)(`p`,{className:`commit muted small`,title:_.evidence.commit,children:[`at commit `,(0,X.jsx)(`code`,{children:_.evidence.commit.slice(0,12)}),` `,(0,X.jsx)(`button`,{className:`link`,"data-testid":`copy-commit`,"aria-label":`Copy the full commit`,onClick:()=>void navigator.clipboard?.writeText(_.evidence.commit),children:`copy`})]}),d&&v&&(0,X.jsx)(Mw,{title:_.title,location:`${E}:${w.start.line}`,snippet:C,marks:v.marks,focusLine:v.focusLine,onClose:()=>{f(!1),h.current?.focus()}})]})}var EE=400,DE={function:`Function`,method:`Method`,arrow:`Arrow function`,constructor:`Constructor`,getter:`Getter`,setter:`Setter`,module:`The file's top-level code`},OE={plain:`Called`,member:`Called as a method`,optional:`Called with ?.`,new:`Constructed with new`,super:`Called through super`,"call-apply":`Called with call/apply`,bind:`Bound with bind`,"tagged-template":`Called as a tagged template`,decorator:`Applied as a decorator`,jsx:`Rendered as a JSX element`,iife:`Called immediately`},kE={"static-exact":`resolved exactly`,"static-inferred":`resolved by inference`,"dynamic-only":`seen only at run time`,"runtime-confirmed":`confirmed at run time`};function AE({tab:e,reach:t,onTab:n}){return(0,X.jsx)(`div`,{className:`segmented view-tabs`,role:`tablist`,"aria-label":`View`,children:(t?[`file`,`imports`,`reach`]:[`file`,`imports`]).map(t=>(0,X.jsx)(`button`,{role:`tab`,"aria-selected":e===t,"data-command":`show-tab`,"data-tab":t,title:t===`file`?`Files: inside one file, its functions and calls (1)`:t===`imports`?`Imports: how files and groups depend on each other (2)`:`Reach: where paths from or to one function or file go (3)`,onClick:()=>n(t),children:t===`file`?`Files`:t===`imports`?`Imports`:`Reach`},t))})}function jE(e){switch(e.reason){case`dynamic-dispatch`:return`Type unknown: the call is on a value whose type the analysis doesn't know (dynamic dispatch), so it can't tell which function runs.`;case`reflection`:return`Reflection: called through eval, Reflect or Function, so the target is unknown.`;case`template-binding`:return`Awaiting its component: a call in a template file, resolved once a component declaring the template is analyzed.`;case`template-reference`:return`Registered elsewhere: a component or directive registered outside this file (a global or a module), so its definition isn't linked.`;case`imported-symbol`:return`Imported${e.importSpecifier?` from '${e.importSpecifier}'`:``}: calls across files are not linked yet.`;case`runtime-global`:return`Built-in: part of the language or runtime, outside the code analyzed.`;case`builtin-value`:return`On a built-in value: the value it is called on is a string, number, DOM element or other runtime value, so it runs the runtime's code.`;default:return`${e.reason} (${e.status})`}}function ME(e){let t=e.replace(/\\/g,`/`);return encodeURI(t.startsWith(`/`)?t:`/${t}`).replace(/#/g,`%23`).replace(/\?/g,`%3F`)}function NE(e){return`${oe(e.function.qualifiedName,void 0,e.function.title).name} (${e.function.path})`}function PE(e){return e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)||e.startsWith(`\\\\`)}function FE(e){return e<1e3?String(e):e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}k`:`${Math.round(e/100)/10}k`.replace(/\.0k$/,`k`)}function IE(e){let t=e=>e.root.split(/[\\/]/).filter(Boolean).at(-1)??e.sourceId,n=e=>e.changed.length+e.removed.length;if(e.length===1){let r=e[0],i=n(r),a=i===1?r.changed[0]??r.removed[0]:`${i} files`;return`${t(r)} changed on disk since it was analyzed (${a}), so some evidence may point at old lines.`}return`${e.map(t).join(`, `)} changed on disk since they were analyzed, so some evidence may point at old lines.`}(0,b.createRoot)(document.getElementById(`root`)).render((0,X.jsx)(y.StrictMode,{children:(0,X.jsx)(bE,{})}));
336
+ `));return(0,X.jsxs)(`form`,{className:`rules-editor`,"data-testid":`rules-editor`,onSubmit:e=>{e.preventDefault(),t({include:YS(r),exclude:YS(a)})},children:[(0,X.jsxs)(`p`,{className:`muted small`,children:[`Glob patterns, one per line, relative to the repository (`,(0,X.jsx)(`code`,{children:`src/legacy/`}),`,`,` `,(0,X.jsx)(`code`,{children:`**/*.test.ts`}),`). Applied at the next analysis; files left out are closed in the graph and kept in history.`]}),(0,X.jsxs)(`label`,{children:[`Include only`,(0,X.jsx)(`textarea`,{"data-testid":`rules-include`,value:r,onChange:e=>i(e.target.value)})]}),(0,X.jsxs)(`label`,{children:[`Leave out`,(0,X.jsx)(`textarea`,{"data-testid":`rules-exclude`,value:a,onChange:e=>o(e.target.value)})]}),(0,X.jsxs)(`div`,{className:`actions`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`}),(0,X.jsx)(`button`,{type:`submit`,className:`primary`,"data-testid":`rules-save`,children:`Save and re-analyze`})]})]})}function ZS({project:e,refresh:t,onAdd:n,onChooseFiles:r,onAnalyzeAll:i,onChanged:a,escape:o}){let[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(``),[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(null),[h,g]=(0,y.useState)(``),[_,v]=(0,y.useState)(null),[b,x]=(0,y.useState)(null),[S,C]=(0,y.useState)(null),[w,T]=(0,y.useState)({top:0,right:0}),[E,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(0);(0,y.useEffect)(()=>{let t=!1;return Y.sources(e).then(e=>!t&&c(e.sources.map(e=>({...e,optIn:e.optIn??[]}))),e=>!t&&u(e.message)),()=>{t=!0}},[e,t,O]);let A=async(e,t,n)=>{D(!0),u(``),n&&f(n);try{await e(),f(t),a()}catch(e){f(``),u(e.message??String(e))}finally{D(!1),k(e=>e+1)}},j=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(!S)return;j.current?.querySelector(`button`)?.focus();let e=e=>{e.type===`mousedown`&&j.current?.contains(e.target)||C(null)};return document.addEventListener(`mousedown`,e),window.addEventListener(`resize`,e),document.addEventListener(`scroll`,e,!0),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`resize`,e),document.removeEventListener(`scroll`,e,!0)}},[S]),o.current=()=>{if(S){let e=S;return C(null),document.querySelector(`tr[data-source="${CSS.escape(e)}"] [data-testid="repo-more"]`)?.focus(),!0}return p?(m(null),!0):b?(x(null),!0):_?(v(null),!0):!1};let M=(0,y.useRef)(null);if((0,y.useEffect)(()=>{(_||b)&&(M.current?.scrollIntoView({block:`nearest`}),M.current?.querySelector(`textarea, button`)?.focus())},[_,b]),(0,y.useEffect)(()=>{s&&(_&&!s.some(e=>e.id===_)&&v(null),b&&!s.some(e=>e.id===b)&&x(null))},[s,_,b]),!s)return(0,X.jsx)(`p`,{className:l?`error`:`muted`,children:l||`Loading…`});let N=_?s.find(e=>e.id===_):void 0;return(0,X.jsxs)(`div`,{className:`repositories`,"data-testid":`repositories`,children:[(0,X.jsxs)(`div`,{className:`repo-actions`,children:[(0,X.jsx)(`button`,{"data-testid":`repo-add`,onClick:n,children:`+ Add folder`}),(0,X.jsx)(`button`,{"data-testid":`repo-analyze-all`,disabled:E,onClick:i,children:`Re-analyze all`})]}),l&&(0,X.jsx)(`p`,{className:`error`,role:`alert`,children:l}),d&&(0,X.jsx)(`p`,{className:`muted small`,role:`status`,"data-testid":`repo-status`,children:d}),(0,X.jsxs)(`table`,{className:`repo-table`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{children:`Repository`}),(0,X.jsx)(`th`,{children:`Branch and commit`}),(0,X.jsx)(`th`,{children:`Analyzed`}),(0,X.jsx)(`th`,{children:`Files`}),(0,X.jsx)(`th`,{children:`Left out`}),(0,X.jsx)(`th`,{children:(0,X.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,X.jsx)(`tbody`,{children:s.map(t=>{let n=t.analysis,i=t.include.length+t.exclude.length;return(0,X.jsxs)(`tr`,{"data-source":t.id,children:[(0,X.jsxs)(`td`,{children:[p===t.id?(0,X.jsx)(`form`,{onSubmit:n=>{n.preventDefault(),m(null),A(()=>Y.updateSource(e,t.id,{name:h}),`Renamed ${t.id} to ${h||t.id}.`)},onBlur:e=>!e.currentTarget.contains(e.relatedTarget)&&m(null),children:(0,X.jsx)(`input`,{autoFocus:!0,"aria-label":`New name for ${t.id}`,"data-testid":`repo-name`,value:h,onChange:e=>g(e.target.value)})}):(0,X.jsx)(`strong`,{className:`repo-name`,children:t.name??t.id}),(0,X.jsx)(`div`,{className:`muted small path`,children:t.root}),n?.notices.map(e=>(0,X.jsx)(`div`,{className:`notice-line small`,children:e},e))]}),(0,X.jsx)(`td`,{className:`mono small`,children:n?n.kind===`plain`?`plain folder (latest only)`:`${n.branch??`detached`} · ${JS(n.revision)}${n.pinned?` (kept)`:``}`:`not analyzed yet`}),(0,X.jsx)(`td`,{className:`small`,children:n?we(n.analyzedAt):``}),(0,X.jsx)(`td`,{className:`small`,children:n?n.files:``}),(0,X.jsx)(`td`,{className:`small`,children:i?`${i} rule${i===1?``:`s`}`:`defaults`}),(0,X.jsxs)(`td`,{className:`row-actions`,children:[(0,X.jsx)(`button`,{className:`link`,"data-testid":`repo-analyze`,"aria-label":`Re-analyze ${t.name??t.id}`,disabled:E,onClick:()=>void A(()=>Y.analyzeSource(e,t.id),`Analyzing ${t.name??t.id} again (the others stay at their commits)…`,`Starting an analysis of ${t.name??t.id}…`),children:`Re-analyze`}),(0,X.jsx)(`button`,{className:`link`,"data-testid":`repo-choose`,"aria-label":`Choose files in ${t.name??t.id}`,onClick:()=>r(t.id),children:`Choose files…`}),(0,X.jsxs)(`span`,{className:`menu-wrap`,children:[(0,X.jsx)(`button`,{className:`icon`,"aria-label":`More for ${t.name??t.id}`,"aria-expanded":S===t.id,"data-testid":`repo-more`,disabled:E,onClick:e=>{let n=e.currentTarget.getBoundingClientRect();T({top:n.bottom+2,right:window.innerWidth-n.right}),C(S===t.id?null:t.id)},children:`⋯`}),S===t.id&&(0,X.jsxs)(`span`,{className:`menu`,role:`menu`,ref:j,style:{top:w.top,right:w.right},children:[(0,X.jsx)(`button`,{role:`menuitem`,"data-testid":`repo-rename`,onClick:()=>{C(null),g(t.name??t.id),m(t.id)},children:`Rename`}),(0,X.jsx)(`button`,{role:`menuitem`,"data-testid":`repo-rules`,onClick:()=>{C(null),v(t.id)},children:`Edit rules`}),(0,X.jsx)(`button`,{role:`menuitem`,"data-testid":`repo-remove`,onClick:()=>{C(null),x(t.id)},children:`Remove…`})]})]})]})]},t.id)})})]}),s.length===0&&(0,X.jsx)(`p`,{className:`muted`,children:`No repositories yet: + Add folder adds one.`}),N&&(0,X.jsx)(`div`,{ref:M,children:(0,X.jsx)(XS,{source:N,onCancel:()=>v(null),onSave:t=>{let n=N.id;v(null),A(async()=>{await Y.updateSource(e,n,t),await Y.analyzeSource(e,n)},`Rules saved; analyzing ${n} again…`)}},N.id)}),b&&(0,X.jsxs)(`div`,{className:`confirm`,role:`alertdialog`,"aria-labelledby":`remove-title`,"data-testid":`repo-remove-confirm`,children:[(0,X.jsx)(`p`,{id:`remove-title`,children:(0,X.jsxs)(`strong`,{children:[`Remove `,s.find(e=>e.id===b)?.name??b,` from this project?`]})}),(0,X.jsx)(`p`,{className:`muted small`,children:`Its files and links leave the current graph. History keeps the analysis: earlier runs still show it, and adding the folder again analyzes it afresh. The folder itself is not touched.`}),(0,X.jsxs)(`div`,{className:`actions`,children:[(0,X.jsx)(`button`,{onClick:()=>x(null),"data-testid":`repo-remove-cancel`,children:`Cancel`}),(0,X.jsx)(`button`,{className:`danger`,"data-testid":`repo-remove-yes`,disabled:E,onClick:()=>{let t=b;x(null),A(()=>Y.removeSource(e,t),`Removed ${t}; history keeps its analysis.`,`Removing ${t} (a run closes its facts)…`)},children:`Remove`})]})]})]})}function QS({project:e}){let[t,n]=(0,y.useState)(``),[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(null);return(0,y.useEffect)(()=>{Y.projectSettings(e).then(e=>{n(String(e.settings.maxFileMB)),i(e.settings.closedWorld)},e=>o({ok:!1,text:e.message}))},[e]),(0,X.jsxs)(`form`,{className:`analysis-settings`,onSubmit:n=>{n.preventDefault();let i=Number(t);if(!(i>0&&i<=64))return o({ok:!1,text:`The size limit is more than 0 and at most 64 MB.`});Y.saveProjectSettings(e,{maxFileMB:i,closedWorld:r}).then(e=>o({ok:!0,text:`Saved: files over ${e.settings.maxFileMB} MB are left out at the next analysis${e.settings.closedWorld?`, which treats the analyzed code as the whole program`:``}.`}),e=>o({ok:!1,text:e.message}))},children:[(0,X.jsxs)(`label`,{children:[`Size limit per file (MB)`,(0,X.jsx)(`input`,{type:`number`,min:.1,max:64,step:.1,required:!0,"data-testid":`analysis-max-mb`,value:t,onChange:e=>n(e.target.value)})]}),(0,X.jsxs)(`p`,{className:`muted small`,children:[`Larger files are listed but not analyzed, unless you choose them in Choose files. Folders of installed libraries, generated output and tools' workspaces (`,(0,X.jsx)(`code`,{children:`node_modules`}),`, `,(0,X.jsx)(`code`,{children:`dist`}),`,`,` `,(0,X.jsx)(`code`,{children:`build`}),`, …) are left out by default; Choose files shows them and can add them.`]}),(0,X.jsxs)(`label`,{className:`checkbox`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`analysis-closed-world`,checked:r,onChange:e=>i(e.target.checked)}),`Treat the analyzed code as the whole program (closed world)`]}),(0,X.jsx)(`p`,{className:`muted small`,children:`For an application, not a library: the callers of a function and the classes of a type that analysis sees are taken to be all there are, so more calls are linked. Each link this settles says “closed world”. Off by default.`}),(0,X.jsx)(`button`,{type:`submit`,className:`primary`,"data-testid":`analysis-save`,children:`Save`}),a&&(0,X.jsx)(`p`,{className:a.ok?`muted small`:`error`,role:a.ok?`status`:`alert`,children:a.text})]})}function $S({project:e,projectName:t,refresh:n,onClose:r,onAdd:i,onChooseFiles:a,onAnalyzeAll:o,onChanged:s,covered:c=!1,initialTab:l=`repositories`}){let[u,d]=(0,y.useState)(l),f=(0,y.useRef)(null),p=(0,y.useRef)(null),m=(0,y.useRef)(null);return(0,y.useEffect)(()=>{let e=document.activeElement;return p.current?.focus(),()=>e?.focus?.()},[]),(0,y.useEffect)(()=>{if(c)return;let e=e=>{if(e.key===`Escape`)e.stopPropagation(),m.current?.()||r();else if(e.key===`Tab`&&f.current){let t=[...f.current.querySelectorAll(`button:not([disabled]), input, textarea, select`)],n=t[0],r=t[t.length-1];f.current.contains(document.activeElement)?e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus()):(e.preventDefault(),n?.focus())}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[c,r]),(0,X.jsx)(`div`,{className:`backdrop`,onMouseDown:e=>e.target===e.currentTarget&&r(),children:(0,X.jsxs)(`div`,{className:`modal wide`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`project-settings-title`,"data-testid":`project-settings-dialog`,ref:f,children:[(0,X.jsxs)(`div`,{className:`modal-head`,children:[(0,X.jsxs)(`h2`,{id:`project-settings-title`,children:[t,`: settings`]}),(0,X.jsx)(`button`,{className:`icon`,"aria-label":`Close`,onClick:r,ref:p,children:`×`})]}),(0,X.jsx)(`div`,{className:`segmented`,role:`tablist`,"aria-label":`Project settings`,children:[`repositories`,`analysis`,`license`].map(e=>(0,X.jsx)(`button`,{role:`tab`,"aria-selected":u===e,"data-testid":`project-tab-${e}`,onClick:()=>d(e),children:e===`repositories`?`Repositories`:e===`analysis`?`Analysis`:`License`},e))}),u===`repositories`?(0,X.jsx)(ZS,{project:e,refresh:n,onAdd:i,onChooseFiles:a,onAnalyzeAll:o,onChanged:s,escape:m}):u===`analysis`?(0,X.jsx)(QS,{project:e}):(0,X.jsx)(Ue,{onChanged:s})]})})}var eC={library:`installed library code`,generated:`generated or built output`,tool:`a tool's or coding agent's workspace (settings, history, worktrees)`};function tC(e){return e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}var nC=(e,t)=>`${e}\0${t}`,rC=(e,t)=>JSON.stringify([e.include,e.exclude,e.optIn??[]])===JSON.stringify([t?.include??[],t?.exclude??[],t?.optIn??[]]);function iC({project:e,files:t,run:n,onAnalyze:r,onClose:i,only:a,at:o}){let[s,c]=(0,y.useState)([]),[l,u]=(0,y.useState)(new Map),[d,f]=(0,y.useState)(new Set),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(!1),[b,x]=(0,y.useState)(new Map),[S,C]=(0,y.useState)(new Map),[w,T]=(0,y.useState)(null),[E,D]=(0,y.useState)(``),O=(0,y.useRef)(new Set),k=s.length>1,A=(0,y.useCallback)(e=>n?.sources.find(t=>t.sourceId===e),[n]),j=(0,y.useCallback)(async(t,n)=>{let{entries:r}=await Y.browse(e,t,n);O.current.add(nC(t,n)),u(e=>new Map(e).set(nC(t,n),r))},[e]),M=(0,y.useCallback)(async()=>{await Promise.all([...O.current].map(e=>{let[t,n]=e.split(`\0`);return j(t,n).catch(()=>O.current.delete(e))}))},[j]);(0,y.useEffect)(()=>{let t=!1;return(async()=>{try{let[{sources:n},{settings:r}]=await Promise.all([Y.sources(e),Y.projectSettings(e)]);if(t)return;let i=n.map(e=>({...e,optIn:e.optIn??[]})).filter(e=>a===void 0||e.id===a);c(i),T(r.maxFileMB),D(String(r.maxFileMB)),await Promise.all(i.map(e=>j(e.id,``)))}catch(e){t||m(e.message??String(e))}})(),()=>{t=!0}},[e,j,a]),(0,y.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(h?g(null):i())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h,i]),(0,y.useEffect)(()=>{if(!o||!a||s.length===0)return;let e=o.split(`/`).filter(Boolean),t=e.slice(0,-1).map((t,n)=>e.slice(0,n+1).join(`/`));f(e=>new Set([...e,...t.map(e=>nC(a,e))])),Promise.all(t.filter(e=>!O.current.has(nC(a,e))).map(e=>j(a,e))).then(()=>requestAnimationFrame(()=>document.querySelector(`.picker-row[data-path="${CSS.escape(o)}"]`)?.scrollIntoView({block:`center`})),e=>m(e.message))},[o,a,s.length,j]);let N=(e,t)=>{let n=nC(e,t);f(e=>{let t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t}),O.current.has(n)||j(e,t).catch(e=>m(e.message))},P=(0,y.useMemo)(()=>{let e=[],t=(n,r,i)=>{for(let a of l.get(nC(n,r))??[]){if(a.kind===`file`&&!a.language&&!a.path.toLowerCase().endsWith(`.html`))continue;let r=a.kind===`dir`&&d.has(nC(n,a.path));e.push({source:n,entry:a,depth:i,open:r}),r&&t(n,a.path,i+1)}};for(let e of s)t(e.id,``,+!!k);return e},[l,d,s,k]),F=(e,t)=>{if(t.kind!==`dir`)return!1;let n=e=>e.replace(/^\/+/,``).startsWith(`${t.path}/`),r=l.get(nC(e.id,t.path));if(t.excludedBy)return e.optIn.some(n)?!0:!!r?.some(e=>!e.excludedBy);if(r?.some(e=>e.excludedBy&&(e.kind===`dir`||e.language))||e.exclude.some(e=>e.startsWith(`/`)&&n(e)))return!0;let i=A(e.id),a=t=>e.optIn.some(e=>t===e||t.startsWith(`${e}/`));return i?.defaultExcluded?.some(e=>n(e.path)&&!a(e.path))?!0:rC(e,i?.filter)&&!!i?.ruleExcluded?.some(e=>n(e.path)&&!a(e.path))},I=(e,n,r)=>{if(!r)return-t.filter(t=>t.source===e&&(t.path===n.path||t.path.startsWith(`${n.path}/`))).length;if(n.kind===`file`)return 1;let i=A(e);return i?.defaultExcluded?.find(e=>e.path===n.path)?.files??i?.ruleExcluded?.find(e=>e.path===n.path)?.files??null},L=async(t,n,r)=>{v(!0),m(``),x(e=>new Map(e).set(nC(t,n.path),r));try{let{source:i}=await Y.select(e,t,[n.path],r);c(e=>e.map(e=>e.id===t?{...i,optIn:i.optIn??[]}:e)),C(e=>{let i=new Map(e),a=nC(t,n.path);return i.has(a)?i.delete(a):i.set(a,I(t,n,r)),i}),await M()}catch(e){m(e.message??String(e))}finally{x(e=>{let r=new Map(e);return r.delete(nC(t,n.path)),r}),v(!1)}},R=(e,t,n)=>{if(!_){if(n&&t.excludedBy&&t.excludedBy!==`rule`){let n=t.path.slice(t.path.lastIndexOf(`/`)+1),r=A(e)?.defaultExcluded?.find(e=>e.path===t.path),i=t.kind===`dir`&&r?.files?` It has ${r.files.toLocaleString(`en-US`)} file${r.files===1?``:`s`}.`:``;if(t.excludedBy===`too-large`)g({source:e,entry:t,title:`Analyze ${n}?`,text:`${t.path} is ${tC(t.size??0)}, over the ${w??10} MB size limit. Files this large are usually generated or bundled code (minified builds, vendored bundles, source maps), and they slow analysis down. Files over 64 MB are never analyzed.`});else if(t.excludedBy===`minified`)g({source:e,entry:t,title:`Analyze ${n}?`,text:`${t.path} looks minified: most of it is on very long lines, as in a library build. A build adds thousands of functions that aren't your project's own code. Analyze it if it is your code.`});else{let r=eC[t.excludedBy]??eC.generated;g({source:e,entry:t,title:`Analyze ${n}?`,text:`${t.path} is ${r}, not your project's own code.${i} Analyzing it makes analysis slower and the graph larger. Its files will be marked as ${t.excludedBy} code and left out of "largest files" and "most called".`})}return}L(e,t,n)}},z=async()=>{let t=Number(E);if(!Number.isFinite(t)||t<=0||t>64){m(`The size limit must be a number of megabytes between 0 and 64.`);return}try{let{settings:n}=await Y.saveProjectSettings(e,{maxFileMB:t});T(n.maxFileMB),C(e=>new Map(e).set(`\0limit`,null)),await M()}catch(e){m(e.message??String(e))}},B=S.size>0||s.some(e=>!rC(e,A(e.id)?.filter))||w!==null&&n?.sources[0]?.maxFileBytes!==void 0&&n.sources[0].maxFileBytes!==w*1048576,V=0,H=0,U=!1;for(let[e,t]of S)e!==`\0limit`&&(t===null?U=!0:t>0?V+=t:H-=t);let W=e=>`${e} file${e===1?``:`s`}`,ee=[U?V?`${V}+ files added`:`files added`:V?`${W(V)} added`:``,H?`${W(H)} removed`:``].filter(Boolean).join(`, `);return(0,X.jsxs)(`div`,{className:`picker`,"data-testid":`file-picker`,children:[(0,X.jsxs)(`div`,{className:`picker-head`,children:[(0,X.jsx)(`strong`,{children:`Choose files`}),(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{onClick:i,"data-testid":`picker-done`,children:`Done`})]}),(0,X.jsx)(`p`,{className:`muted small picker-help`,children:`Unchecked files are left out of the graph. Greyed folders are left out by default: libraries and generated output.`}),(0,X.jsxs)(`label`,{className:`picker-limit`,children:[`Skip files over`,(0,X.jsx)(`input`,{type:`number`,min:1,max:64,step:1,value:E,"data-testid":`size-limit`,"aria-label":`Size limit in MB`,onChange:e=>D(e.target.value),onBlur:()=>E!==String(w)&&void z(),onKeyDown:e=>e.key===`Enter`&&void z()}),`MB`]}),p&&(0,X.jsx)(`p`,{className:`error small`,role:`alert`,children:p}),B&&(0,X.jsxs)(`div`,{className:`picker-pending`,"data-testid":`picker-pending`,children:[(0,X.jsxs)(`span`,{children:[ee?(0,X.jsx)(`strong`,{children:ee[0].toUpperCase()+ee.slice(1)}):`Changes`,` at the next analysis`]}),(0,X.jsx)(`button`,{className:`primary`,"data-testid":`picker-apply`,disabled:_,onClick:()=>{C(new Map),r()},children:`Apply & re-analyze`})]}),(0,X.jsxs)(`div`,{className:`picker-list`,role:`tree`,"aria-label":`Choose files`,children:[s.map(e=>k?(0,X.jsx)(`div`,{className:`picker-row source`,title:e.root,children:(0,X.jsx)(`strong`,{children:e.id})},`s:${e.id}`):null),P.map(({source:e,entry:t,depth:n,open:r})=>{let i=s.find(t=>t.id===e),a=b.get(nC(e,t.path))??!t.excludedBy,c=F(i,t),l=t.path.slice(t.path.lastIndexOf(`/`)+1),u=t.notAnalyzable?t.notAnalyzable===`declaration-file`?`type declarations`:t.notAnalyzable===`symlink`?`link`:`${tC(t.size??0)} · over 64 MB`:t.excludedBy===`library`?`library`:t.excludedBy===`generated`||t.excludedBy===`tool`?t.excludedBy:t.excludedBy===`too-large`?`${tC(t.size??0)} · too large`:t.excludedBy===`minified`?`minified`:t.excludedBy===`rule`?`excluded`:null,d=t.optedIn?t.origin??null:null;return(0,X.jsxs)(`div`,{className:`picker-row ${t.kind} ${a?``:`excluded`}${t.path===o?` target`:``}`,style:{paddingLeft:8+n*14},role:`treeitem`,"aria-expanded":t.kind===`dir`?r:void 0,"aria-level":n+1,"data-path":t.path,children:[t.kind===`dir`?(0,X.jsx)(`button`,{className:`caret`,"aria-label":`${r?`Close`:`Open`} ${l}`,onClick:()=>N(e,t.path),children:r?`▾`:`▸`}):(0,X.jsx)(`span`,{className:`caret`}),t.kind===`dir`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:a,"data-testid":`pick`,"aria-label":`Analyze ${l}`,ref:e=>{e&&(e.indeterminate=c)},"aria-checked":c?`mixed`:a,onChange:n=>R(e,t,n.target.checked)}),(0,X.jsx)(`button`,{className:`name button-link`,"data-command":`open-folder`,onClick:()=>N(e,t.path),children:l})]}):(0,X.jsxs)(`label`,{children:[t.notAnalyzable?(0,X.jsx)(`span`,{className:`caret`}):(0,X.jsx)(`input`,{type:`checkbox`,checked:a,"data-testid":`pick`,ref:e=>{e&&(e.indeterminate=c)},"aria-checked":c?`mixed`:a,onChange:n=>R(e,t,n.target.checked)}),(0,X.jsx)(`span`,{className:`name`,children:l})]}),u&&(0,X.jsx)(`small`,{className:`reason`,children:u}),d&&(0,X.jsx)(`small`,{className:`origin ${d}`,children:d})]},nC(e,t.path))}),s.length>0&&P.length===0&&!p&&(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`})]}),h&&(0,X.jsx)(`div`,{className:`backdrop`,onMouseDown:e=>e.target===e.currentTarget&&g(null),children:(0,X.jsxs)(`div`,{className:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pick-warning-title`,"data-testid":`pick-warning`,children:[(0,X.jsx)(`h2`,{id:`pick-warning-title`,children:h.title}),(0,X.jsx)(`p`,{children:h.text}),(0,X.jsxs)(`div`,{className:`buttons`,children:[(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{autoFocus:!0,onClick:()=>g(null),children:`Cancel`}),(0,X.jsx)(`button`,{className:`primary`,"data-testid":`pick-warning-confirm`,onClick:()=>{let e=h;g(null),L(e.source,e.entry,!0)},children:`Analyze anyway`})]})]})})]})}var aC=e=>e.toLocaleString(`en-US`);function oC(e){if(e.sites===0)return null;let t=e.sites-e.open,n=Math.floor(t/e.sites*100);return e.open>0?Math.min(n,99):n}function sC(e){let t=oC(e);return t===null?`No calls found`:`Paths: ${t}% of ${aC(e.sites)} call site${e.sites===1?``:`s`} go somewhere known${e.open?` · ${aC(e.open)} stop short`:``}`}function cC(e){return[{label:`within files`,count:e.withinFiles},{label:`across files`,count:e.acrossFiles},{label:`leave the project`,count:e.external},{label:`to one known body`,count:e.candidates.one},{label:`to a set of candidates`,count:e.candidates.several},{label:`stop short`,count:e.open}]}function lC({projects:e,progress:t=new Map,loading:n=!1,onOpen:r,onCreated:i,onAddFolder:a,onDeleted:o}){let[s]=fS(),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(``),[f,p]=(0,y.useState)(``),[m,h]=(0,y.useState)(!1),[g,_]=(0,y.useState)(null),[v,b]=(0,y.useState)(!1),x=e=>{_({id:e}),Y.projectDisk(e).then(({bytes:t})=>_(n=>n?.id===e?{...n,bytes:t}:n),()=>void 0)},S=async e=>{if(!v){b(!0);try{await Y.deleteProject(e),_(null),o(e)}catch(t){_(n=>n?.id===e?{...n,error:t.message??String(t)}:n)}finally{b(!1)}}},C=()=>{l(!1),d(``),p(``)},w=async()=>{if(!m){h(!0),p(``);try{let{project:e}=await Y.createProject(u.trim());C(),i(e.id)}catch(e){p(e.message??String(e))}finally{h(!1)}}};return(0,X.jsxs)(`section`,{className:`home`,"data-testid":`home`,"aria-labelledby":`home-title`,children:[(0,X.jsxs)(`div`,{className:`home-head`,children:[(0,X.jsx)(`h1`,{id:`home-title`,children:`Projects`}),(0,X.jsxs)(`div`,{className:`home-actions`,children:[(0,X.jsx)(`button`,{"data-testid":`new-project`,onClick:()=>l(!0),children:`+ New project`}),(0,X.jsx)(`button`,{className:`primary`,"data-testid":`home-add-folder`,onClick:a,children:`Add folder`})]})]}),c&&(0,X.jsxs)(`form`,{className:`new-project`,onSubmit:e=>{e.preventDefault(),w()},children:[(0,X.jsxs)(`label`,{children:[`Name`,(0,X.jsx)(`input`,{autoFocus:!0,"data-testid":`new-project-name`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>e.key===`Escape`&&C()})]}),(0,X.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!u.trim()||m,"data-testid":`new-project-create`,children:`Create`}),(0,X.jsx)(`button`,{type:`button`,onClick:C,children:`Cancel`}),f&&(0,X.jsx)(`p`,{className:`error`,role:`alert`,children:f})]}),n?(0,X.jsx)(`p`,{className:`muted`,children:`Loading…`}):e.length===0?(0,X.jsx)(`p`,{className:`muted`,children:`No projects yet. Add a folder to analyze its code.`}):(0,X.jsx)(`ul`,{className:`project-cards`,children:e.map(e=>{let n=!s&&e.ownFindings||e.findings,i=n?n.broken+n.notAnalyzed+n.openCalls:0;return(0,X.jsxs)(`li`,{"data-project":e.id,children:[(0,X.jsxs)(`button`,{className:`project-card`,"data-testid":`open-project`,onClick:()=>r(e.id),children:[(0,X.jsx)(`strong`,{children:e.name}),(0,X.jsx)(`span`,{className:`muted small`,"data-testid":`project-sources`,children:e.repositories===void 0?`${e.sources} source${e.sources===1?``:`s`}`:[e.repositories?`${e.repositories} repositor${e.repositories===1?`y`:`ies`}`:``,e.folders?`${e.folders} folder${e.folders===1?``:`s`}`:``].filter(Boolean).join(` · `)||`no sources`}),e.error?(0,X.jsxs)(`span`,{className:`error small`,"data-testid":`project-error`,children:[`Can't be read: `,e.error]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`small`,children:e.latest?e.latest.status===`running`?t.get(e.id)?T(t.get(e.id)).text:`Analyzing…`:e.latest.status===`failed`?e.latest.errorCode===`cancelled`?`Last analysis cancelled`:`Last analysis failed`:`Analyzed${e.latest.finishedAt?` ${we(e.latest.finishedAt)}`:``}`:`Not analyzed yet`}),e.analysis?.outdated.length?(0,X.jsx)(`span`,{className:`small outdated-note`,"data-testid":`project-outdated`,children:e.analysis.outdated.every(e=>e.was===null)?`Made before veoflow recorded its version: analyze again to see what this version finds`:`Made by ${e.analysis.veoflow?`veoflow ${e.analysis.veoflow}`:`another veoflow`}: analyze again to see what this version finds`}):null,!n&&e.findingsPending&&(0,X.jsx)(`span`,{className:`muted small`,"data-testid":`findings-pending`,children:`Counting findings…`}),e.files&&e.files.analyzed<e.files.listed&&(0,X.jsx)(`span`,{className:`small`,"data-testid":`files-not-analyzed`,children:e.files.analyzed===0?`None of ${e.files.listed.toLocaleString(`en-US`)} files analyzed`:`${(e.files.listed-e.files.analyzed).toLocaleString(`en-US`)} of ${e.files.listed.toLocaleString(`en-US`)} files not analyzed`}),e.files?.listed===0&&(0,X.jsx)(`span`,{className:`small`,"data-testid":`files-not-analyzed`,children:`No files veoflow analyzes`}),e.completeness&&!(e.files&&e.files.analyzed===0)&&(0,X.jsx)(`span`,{className:`small`,"data-testid":`project-paths`,children:sC(e.completeness)}),n&&!(e.files&&e.files.analyzed===0)&&(0,X.jsx)(`span`,{className:`muted small`,children:i===0?`No findings`:[n.broken?`${n.broken} broken import${n.broken===1?``:`s`}`:``,n.notAnalyzed?`${n.notAnalyzed} import${n.notAnalyzed===1?``:`s`} not analyzed`:``,n.openCalls?`${n.openCalls.toLocaleString(`en-US`)} open call${n.openCalls===1?``:`s`}`:``].filter(Boolean).join(` · `)})]})]}),(0,X.jsx)(`button`,{className:`project-delete`,"data-testid":`project-delete`,"aria-label":`Delete ${e.name}`,title:`Delete this project`,onClick:()=>x(e.id),children:`Delete…`}),g?.id===e.id&&(0,X.jsxs)(`div`,{className:`confirm`,role:`alertdialog`,"aria-labelledby":`delete-${e.id}`,"data-testid":`project-delete-confirm`,onKeyDown:e=>e.key===`Escape`&&_(null),children:[(0,X.jsx)(`p`,{id:`delete-${e.id}`,children:(0,X.jsxs)(`strong`,{children:[`Delete `,e.name,`?`]})}),(0,X.jsxs)(`p`,{className:`muted small`,children:[`Its graph, history and evidence`,g.bytes===void 0?``:` (${uC(g.bytes)})`,` are deleted, and the commit hooks veoflow installed for it. The folders it analyzed are not touched. This can't be undone.`]}),g.error&&(0,X.jsx)(`p`,{className:`error small`,role:`alert`,children:g.error}),(0,X.jsxs)(`div`,{className:`actions`,children:[(0,X.jsx)(`button`,{autoFocus:!0,onClick:()=>_(null),"data-testid":`project-delete-cancel`,children:`Cancel`}),(0,X.jsx)(`button`,{className:`danger`,"data-testid":`project-delete-yes`,disabled:v,onClick:()=>void S(e.id),children:`Delete project`})]})]})]},e.id)})})]})}function uC(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:`${Math.ceil(e/1024)} KB`}function dC({title:e,entries:t,x:n,y:r,onClose:i}){let a=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=document.activeElement;a.current?.querySelector(`button`)?.focus();let t=e=>{e.type===`mousedown`&&a.current?.contains(e.target)||i()},n=e=>{if(e.key===`Escape`){e.stopPropagation(),i();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.key!==`Home`&&e.key!==`End`)return;e.preventDefault();let t=[...a.current?.querySelectorAll(`button`)??[]],n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus()},r=e=>{a.current?.contains(e.relatedTarget)||i()},o=a.current;return document.addEventListener(`mousedown`,t),window.addEventListener(`resize`,t),document.addEventListener(`scroll`,t,!0),window.addEventListener(`keydown`,n,!0),o?.addEventListener(`focusout`,r),()=>{document.removeEventListener(`mousedown`,t),window.removeEventListener(`resize`,t),document.removeEventListener(`scroll`,t,!0),window.removeEventListener(`keydown`,n,!0),o?.removeEventListener(`focusout`,r),e&&e!==document.body&&document.contains(e)&&e.focus()}},[i]);let o=Math.max(4,Math.min(n,window.innerWidth-260)),s=Math.max(4,Math.min(r,window.innerHeight-40-t.length*30));return(0,X.jsxs)(`div`,{ref:a,className:`context-menu`,role:`menu`,"aria-label":e,"data-testid":`context-menu`,style:{left:o,top:s},children:[(0,X.jsx)(`div`,{className:`context-title`,"aria-hidden":`true`,children:e}),t.map(e=>(0,X.jsx)(`button`,{role:`menuitem`,tabIndex:-1,"data-command-name":e.command,onClick:()=>{i(),e.run()},children:e.label},e.label))]})}function fC(e,t){let n=e.trim().toLowerCase();if(!n)return 0;let r=t.toLowerCase(),i=r.indexOf(n);if(i>=0)return i;let a=0,o=0;for(let e of r)if(e===n[a]?a++:a>0&&o++,a===n.length)return 100+o;return null}function pC(e,t,n){return n===0?[]:t.map((t,n)=>({item:t,i:n,score:fC(e,t.label)})).filter(e=>e.score!==null).sort((e,t)=>e.score-t.score||e.i-t.i).slice(0,n).map(e=>e.item)}function mC(e,t){let{view:n,command:r}=t,i=e.trim(),a=[];if(n.project){let e=pC(i,t.files.map(e=>({...e,label:e.path})),i?5:0);for(let i of e)a.push({key:`file:${i.id}`,group:`Files`,label:i.path,run:()=>n.tab===`imports`?r(`openImportsFile`,{file:i.id}):r(`openFile`,{file:i.id})}),e.length<=2&&(n.tab===`imports`&&n.fileLevel&&n.reveal.some(e=>e.file===i.id)&&a.push({key:`reveal:${i.id}`,group:`Files`,label:`Hide ${i.path}'s imports here`,run:()=>r(`revealFile`,{file:i.id})}),n.tab===`imports`&&n.group!==null&&!n.fileLevel&&a.push({key:`only:${i.id}`,group:`Files`,label:`Show only links of ${i.path}`,run:()=>r(`showOnlyLinks`,{id:i.id})}),a.push({key:`leave:${i.id}`,group:`Files`,label:`Leave ${i.path} out of analysis…`,run:()=>t.action(`chooseFiles`,{source:i.id.slice(0,i.id.indexOf(`:`)),path:i.path})}));for(let e of pC(i,t.groups.map(e=>({...e,label:e.name})),i?4:0))a.push({key:`group:${e.id}`,group:`Groups`,label:e.name,detail:`open the group`,run:()=>r(`openGroup`,{group:e.id})}),a.push({key:`only:${e.id}`,group:`Groups`,label:`Show only links of ${e.name}`,run:()=>{(n.tab!==`imports`||n.group!==null||n.fileLevel)&&r(`openGroup`,{}),r(`showOnlyLinks`,{id:e.id})}}),a.push({key:`pick:${e.id}`,group:`Groups`,label:`Details of ${e.name}`,detail:`on the project map`,run:()=>{(n.tab!==`imports`||n.group!==null||n.fileLevel)&&r(`openGroup`,{}),r(`pickNode`,{id:e.id})}})}let o=[],s=(e,t,n,r)=>o.push({label:e,run:t,...n?{detail:n}:{},...r?{key:r}:{}});if(n.project){s(n.history?`Close History`:`History: runs by commit`,()=>r(`toggleHistory`)),n.compare&&s(`Stop comparing`,()=>r(`compareRuns`,{}));let e=/^(?:compare\s+)?(?:run\s*)?(\d+)\s*(?:\.\.|with|vs|and|,|\s)\s*(?:run\s*)?(\d+)$/i.exec(i);if(e){let[t,n]=[Number(e[1]),Number(e[2])];s(`Compare run ${Math.min(t,n)} with run ${Math.max(t,n)}`,()=>r(`compareRuns`,{a:t,b:n}))}n.run!==null&&s(`Back to latest`,()=>r(`openRun`,{}));let a=/^(?:view\s+)?run\s*(\d+)$/i.exec(i);a&&s(`View run ${a[1]}`,()=>r(`openRun`,{run:Number(a[1])})),s(`File tab`,()=>r(`showTab`,{tab:`file`}),`functions and calls inside a file`),s(`Imports tab`,()=>r(`showTab`,{tab:`imports`}),`how files depend on each other`),s(`Project map`,()=>r(`openArea`,{}),`the Imports tab from the top: the whole map`),n.grouping===`connected`?(s(`Group the map by packages & folders`,()=>r(`setGrouping`,{grouping:`declared`})),s(n.differences?`Hide the differences between groupings`:`Show the differences between groupings`,()=>r(`toggleDifferences`))):s(`Group the map by how files connect`,()=>r(`setGrouping`,{grouping:`connected`}),`modules joined by calls, a shared layer apart`),n.tab===`imports`&&n.fileLevel&&n.reveal.length>0&&s(`Hide the files revealed here`,()=>r(`resetReveal`),`back to the open file's own imports and calls`),s(`Show the code`,()=>r(`showPanel`,{panel:`evidence`})),s(`Show Findings`,()=>r(`showPanel`,{panel:`questions`})),s(n.showPending?`Hide pending imports`:`Show pending imports`,()=>r(`togglePending`)),s(n.showUnresolved?`Hide unresolved call sites`:`Show unresolved call sites`,()=>r(`toggleUnresolved`)),n.selection&&s(`Clear the selection`,()=>r(`clearSelection`));let o=n.selection?.kind===`function`?n.selection.id:null,c=o??n.file;if(c){let e=o?o.slice(o.indexOf(`:`,o.indexOf(`:`)+1)+1):c.slice(c.indexOf(`:`)+1);s(`Reach from ${e}`,()=>r(`openReach`,{root:c,direction:`forward`}),`what paths from it reach`),s(`What reaches ${e}`,()=>r(`openReach`,{root:c,direction:`backward`}),`the paths that lead to it`)}n.reach&&n.tab!==`reach`&&s(`Reach tab`,()=>r(`showTab`,{tab:`reach`})),n.only&&s(`Show everything again`,()=>r(`showOnlyLinks`,{}),`not only one item's links`);for(let e of t.sources)s(`Re-analyze ${e.name??e.id}`,()=>t.action(`analyzeSource`,{source:e.id}),`this repository only`,`analyze:${e.id}`);if(t.sources.length>1){n.source&&s(`Scope: all repositories`,()=>r(`scopeSource`,{}));for(let e of t.sources)e.id!==n.source&&s(`Scope: ${e.name??e.id}`,()=>r(`scopeSource`,{source:e.id}),`one repository only`,`scope:${e.id}`)}n.group&&i.includes(`/`)&&s(`Open or close folder ${i}`,()=>r(`toggleFolder`,{path:i.replace(/^\.?\//,``).replace(/\/$/,``)})),s(`Re-analyze the project`,()=>t.action(`analyze`)),t.canDraft&&s(`Analyze uncommitted edits`,()=>t.action(`analyzeDraft`),`a draft beside the graph`);for(let e of(t.stages??[]).slice(1))s(`Analyze again from ${e}`,()=>t.action(`analyzeFrom`,{from:e}),`the stages before it reused, when nothing they read changed`,`from:${e}`);for(let e of t.stages??[])s(`Debug run: stop after ${e}`,()=>t.action(`analyzeDebug`,{until:e}),`never committed; compare it with the latest`,`debug:${e}`);s(`Repositories…`,()=>t.action(`openProjectSettings`),`re-analyze, choose files, rename, remove`),s(`License…`,()=>t.action(`openProjectSettings`,{tab:`license`}),`what the license includes; add or replace a key`)}n.project&&s(`All projects (home)`,()=>r(`goHome`),`every project and its last run`),s(`Add a folder…`,()=>t.action(`addFolder`)),s(`Settings…`,()=>t.action(`openSettings`),`the model for questions`);for(let e of t.projects)e.id!==n.project&&s(`Switch to project ${e.name}`,()=>r(`selectProject`,{project:e.id}),void 0,`project:${e.id}`);let c=o.filter(e=>/^(Compare run|View run|Open or close folder)/.test(e.label)),l=pC(i,o.filter(e=>!c.includes(e)),i?6:0);for(let e of[...c,...l])a.push({key:`cmd:${e.key??e.label}`,group:`Commands`,label:e.label,run:e.run,...e.detail?{detail:e.detail}:{}});return a}var hC=e=>e.slice(e.lastIndexOf(`/`)+1),gC=20;function _C({project:e,file:t,run:n,onOpen:r,onShowImports:i}){let{calls:a,error:o}=TS(e,n,t);if(o)return(0,X.jsx)(`p`,{className:`small muted`,children:`Calls to and from other files couldn't be loaded.`});if(!a||a.out.total===0&&a.in.total===0)return null;let s=(e,t)=>{if(e.total===0)return null;let n=new Map;for(let r of e.calls){let e=t===`out`?r.from:r.to,i=t===`out`?r.to:r.from,a=n.get(i.id)??{there:i,here:new Set,n:0,line:r.evidence.span.start.line};a.here.add(Se(e)),a.n++,n.set(i.id,a)}let i=[...n.values()].sort((e,t)=>t.n-e.n||(e.there.path<t.there.path?-1:1)),a=e.total-e.calls.length;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[t===`out`?`Calls into other files`:`Called from other files`,` (`,e.total,n.size!==e.total&&a===0?`, ${n.size} function${n.size===1?``:`s`}`:``,`)`]}),(0,X.jsx)(`ul`,{className:`cross-calls`,"data-testid":`file-cross-calls-${t}`,children:i.slice(0,gC).map(({there:e,here:n,n:i,line:a})=>{let o=[...n],s=`${o.slice(0,2).join(`, `)}${o.length>2?` and ${o.length-2} more`:``}`,c=`${t===`out`?`from ${s}`:`calls ${s}`}${i===1?` · line ${a}`:``}`;return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link-row`,"data-command":`open-cross-file`,title:`Open ${Se(e)} in ${e.path}`,onClick:()=>r({id:e.id,file:e.file}),children:[(0,X.jsxs)(`span`,{className:`name`,children:[(0,X.jsxs)(`span`,{className:`muted`,children:[hC(e.path),` › `]}),Se(e),i>1&&(0,X.jsxs)(`span`,{className:`times`,children:[` ×`,i]})]}),(0,X.jsx)(`small`,{title:c,children:c})]})},e.id)})}),(i.length>gC||a>0)&&(0,X.jsxs)(`p`,{className:`small muted`,children:[i.length>gC?`${(i.length-gC).toLocaleString(`en-US`)} more functions`:`${a.toLocaleString(`en-US`)} more calls`,`: select a function to see its own.`]})]})};return(0,X.jsxs)(`div`,{className:`file-cross-calls`,"data-testid":`file-cross-calls`,children:[i&&(0,X.jsx)(`button`,{className:`button-link`,"data-command":`cross-calls-in-imports`,onClick:i,children:`⇄ See them drawn on the Imports tab`}),s(a.out,`out`),s(a.in,`in`)]})}var vC=`area|`,yC=`singles|`,bC=e=>e.root,xC=(e,t)=>t===``||e===t||e.startsWith(`${t}/`),SC=()=>({broken:0,notAnalyzed:0,pending:0,openCalls:0});function CC(e){let t=e.indexOf(`|`);return t<0?{source:e,path:``}:{source:e.slice(0,t),path:e.slice(t+1)}}function wC(e,t,n,r,i,a){let o=SC();for(let e of a)o.broken+=e.findings.broken,o.notAnalyzed+=e.findings.notAnalyzed,o.pending+=e.findings.pending,o.openCalls+=e.findings.openCalls;return{id:e,name:t,kind:n,why:`${a.length} group${a.length===1?``:`s`} in ${t}`,source:r,root:i,files:a.reduce((e,t)=>e+t.files,0),functions:a.reduce((e,t)=>e+t.functions,0),externalPackages:0,findings:o,members:a.length,memberIds:a.map(e=>e.id)}}function TC(e,t){let n=new Map,r=new Map;for(let i of e){let e=t.get(i.from),a=t.get(i.to);if(!e||!a||e===a)continue;let o=`${e}->${a}`,s=n.get(o);if(s){let e=(s.references??0)+(i.references??0),{carrying:t,references:r,...a}=s;n.set(o,{...a,imports:s.imports+i.imports,calls:s.calls+i.calls,...e?{references:e}:{},...s.carrying!==void 0&&i.carrying!==void 0?{carrying:s.carrying+i.carrying}:{}})}else n.set(o,{...i,id:o,from:e,to:a});if(l(i)){let e=r.get(o)??{from:new Set,to:new Set};e.from.add(i.from),e.to.add(i.to),r.set(o,e)}}return[...n.values()].map(e=>{let t=r.get(e.id),n=!e.from.startsWith(`group|`)||!e.to.startsWith(`group|`);return t&&n?{...e,groups:{from:t.from.size,to:t.to.size}}:e}).sort((e,t)=>e.id<t.id?-1:1)}function EC(e,t){let n=CC(t);return e.groups.filter(e=>e.source===n.source&&xC(bC(e),n.path))}function DC(e,t,n=new Set){let r=[...new Set(e.groups.map(e=>e.source))].sort(),i=t?CC(t):null,a=i?e.groups.filter(e=>e.source===i.source&&xC(bC(e),i.path)):e.groups,o=new Map,s=[],c=[],l=!1;if(a.length>30){let u=new Map;for(let e of a){let t,n,a;if(!i&&r.length>1)t=`${e.source}|`,n=e.source,a=``;else{let r=i?.path??``,o=r===``?bC(e):bC(e).slice(r.length+1),s=o.split(`/`)[0]??``;if(o===``||s===``){c.push(e);continue}a=r===``?s:`${r}/${s}`,t=`${e.source}|${a}`,n=`${a}/`}let o=u.get(t)??{name:n,source:e.source,root:a,members:[]};o.members.push(e),u.set(t,o)}if(u.size===1&&c.length===0){let[r]=u.keys();if(r!==t)return DC(e,r,n)}for(let[e,t]of u){if(t.members.length===1){c.push(t.members[0]);continue}l=!0;let n=`${vC}${e}`;s.push(wC(n,t.name,`area`,t.source,t.root,t.members));for(let e of t.members)o.set(e.id,n)}}else c.push(...a);let u=new Map;for(let e of c)if((e.kind===`cluster`||e.kind===`module`)&&e.files===1){let t=`${e.source}|${bC(e)}`;u.set(t,[...u.get(t)??[],e])}for(let e of c){let t=`${e.source}|${bC(e)}`;(e.kind===`cluster`||e.kind===`module`)&&e.files===1&&u.get(t).length>1&&!n.has(t)||(s.push(e),o.set(e.id,e.id))}for(let[e,t]of u){if(t.length<2||n.has(e))continue;let r=`${yC}${e}`,{source:i,path:a}=CC(e);s.push(wC(r,`${a?`${a}/`:`(top)`}`,`singles`,i,a,t));for(let e of t)o.set(e.id,r)}return s.sort((e,t)=>e.id<t.id?-1:1),{area:t,summary:l,map:{...e,groups:s,dependsOn:TC(e.dependsOn,o)}}}function OC(e,t){let{source:n,path:r}=CC(e),i=t?[{area:`${n}|`,label:n}]:[],a=r?r.split(`/`):[];for(let e=1;e<=a.length;e++)i.push({area:`${n}|${a.slice(0,e).join(`/`)}`,label:a[e-1]});return i}var kC=(e,t)=>`${e.toLocaleString(`en-US`)} ${t}${e===1?``:`s`}`;function AC({project:e,run:t,source:n,group:r,file:i,fileLevel:a,expand:o,showPending:s,onOpenGroup:c,onCloseGroup:l,onOpenFile:u,onToggleFolder:d,onCollapse:f,onMenu:p,sources:m=[],onScope:h,area:g=null,onAllGroups:_}){let[v,b]=(0,y.useState)(``),{groups:x,error:S}=bS(e,t,0,n),C=a&&i!==null,{imports:w}=SS(e,t,C?i:null),T=C?w?.file.group??null:r??(x&&x.total===1?x.groups[0]?.id??null:null),{group:E}=xS(e,t,T,C?[]:o,s),D=(0,y.useMemo)(()=>{let e=v.trim().toLowerCase(),t=new Map;for(let n of x?g&&!T?EC(x,g):x.groups:[])(!e||n.name.toLowerCase().includes(e)||n.id===T)&&t.set(n.source,[...t.get(n.source)??[],n]);for(let e of t.values())e.sort((e,t)=>e.name<t.name?-1:+(e.name>t.name));return[...t].sort((e,t)=>e[0]<t[0]?-1:1)},[x,v,T,g]),O=D.length,k=e=>{let t=e.id===T,n=t&&!C&&r===e.id,a=e.findings.broken;return(0,X.jsxs)(`li`,{children:[(0,X.jsxs)(`button`,{className:`outline-group${t?` current`:``}`,"data-command":`outline-group`,"data-id":e.id,"aria-expanded":t,title:`${e.name}: ${kC(e.files,`file`)}, ${kC(e.functions,`function`)}${a?`, ${kC(a,`broken import`)}`:``}${n?` (close it)`:``}`,onClick:()=>n?l():c(e.id),onContextMenu:p&&(t=>{t.preventDefault(),p({kind:`group`,id:e.id,data:{label:e.name},x:t.clientX,y:t.clientY})}),children:[(0,X.jsx)(`span`,{className:`caret`,"aria-hidden":`true`,children:t?`▾`:`▸`}),(0,X.jsx)(`span`,{className:`name`,children:e.name}),a>0&&(0,X.jsx)(`small`,{className:`badge broken`,title:kC(a,`broken import`),children:a}),(0,X.jsx)(`small`,{className:`count`,children:e.files})]}),t&&E&&(0,X.jsxs)(`ul`,{className:`outline-files`,children:[!C&&o.map(t=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`outline-folder open`,"data-command":`outline-folder`,"data-path":t,"aria-expanded":`true`,title:`${t}/: open on the canvas (close it)`,onClick:()=>d(t),children:[(0,X.jsx)(`span`,{className:`caret`,"aria-hidden":`true`,children:`▾`}),(0,X.jsxs)(`span`,{className:`name`,children:[aS(t,e.root),`/`]})]})},`open:${t}`)),E.nodes.map(t=>t.kind===`folder`?(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`outline-folder`,"data-command":`outline-folder`,"data-path":t.path,"aria-expanded":`false`,title:`${t.path}/: ${kC(t.files,`file`)} (open it on the canvas)`,onClick:()=>C?c(e.id,t.path):d(t.path),children:[(0,X.jsx)(`span`,{className:`caret`,"aria-hidden":`true`,children:`▸`}),(0,X.jsxs)(`span`,{className:`name`,children:[aS(t.path,e.root),`/`]}),(0,X.jsx)(`small`,{className:`count`,children:t.files})]})},t.id):(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`outline-file${t.id===i&&C?` current`:``}`,"data-command":`outline-file`,"data-file":t.id,title:t.path,onClick:()=>u(t.id,e.id),onContextMenu:p&&(e=>{e.preventDefault(),p({kind:`file`,id:t.id,data:{},x:e.clientX,y:e.clientY})}),children:[(0,X.jsx)(`span`,{className:`name`,children:aS(t.path,e.root)}),t.findings.broken>0&&(0,X.jsx)(`small`,{className:`badge broken`,children:t.findings.broken})]})},t.id))]})]},e.id)},[A,j]=(0,y.useState)(new Set),M=e=>{let t=e=>e.kind===`cluster`&&e.files===1,n=new Map;for(let r of e)t(r)&&n.set(r.root,[...n.get(r.root)??[],r]);let r=[],i=new Set;for(let a of e){let e=n.get(a.root);if(!t(a)||!e||e.length<2)r.push({type:`group`,g:a});else if(!i.has(a.root)){i.add(a.root);let t=`${a.source}|${a.root}`,n=A.has(t)||v.trim()!==``||e.some(e=>e.id===T);r.push({type:`singles`,key:t,root:a.root,members:e,open:n})}}return r};return(0,X.jsxs)(`nav`,{className:`nav outline`,"aria-label":`Groups`,"data-testid":`group-outline`,children:[(0,X.jsxs)(`div`,{className:`nav-head`,children:[(m.length>1||n)&&(0,X.jsxs)(`label`,{className:`nav-scope`,children:[(0,X.jsx)(`span`,{className:`small muted`,children:`Scope`}),(0,X.jsxs)(`select`,{"data-command":`scope-source`,value:n??``,onChange:e=>h?.(e.target.value||null),children:[(0,X.jsx)(`option`,{value:``,children:`All repositories`}),m.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.name??e.id},e.id))]})]}),(0,X.jsxs)(`div`,{className:`outline-head`,children:[(0,X.jsx)(`input`,{className:`nav-filter`,placeholder:`Filter ${x?kC(x.total,`group`):`groups`}…`,"aria-label":`Filter groups`,"data-testid":`outline-filter`,value:v,onChange:e=>b(e.target.value)}),(0,X.jsx)(`button`,{className:`icon`,title:`Hide this pane ( [ )`,"aria-label":`Hide the groups pane`,onClick:f,children:`⟨`})]}),(0,X.jsx)(`button`,{className:`outline-map${!T&&!C?` current`:``}`,"data-command":`outline-project-map`,onClick:()=>c(),title:`The project map: every group`,children:`⌂ Project map`})]}),(0,X.jsxs)(`div`,{className:`nav-list outline-list`,children:[S&&(0,X.jsx)(`p`,{className:`hint error`,children:S}),x&&g&&!T&&(0,X.jsxs)(`p`,{className:`small muted outline-area`,"data-testid":`outline-area`,children:[g.slice(g.indexOf(`|`)+1)?`In ${g.slice(g.indexOf(`|`)+1)}/:`:`In the ${g.slice(0,g.indexOf(`|`))} repository:`,` `,kC(EC(x,g).length,`group`),` ·`,` `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>(_??(()=>c()))(),children:`all groups`})]}),x&&!x.stage2&&(0,X.jsx)(`p`,{className:`hint`,children:`Groups come from import analysis (Stage 2), which hasn't run for this project.`}),D.map(([e,t])=>(0,X.jsxs)(`section`,{children:[O>1&&(0,X.jsx)(`h4`,{className:`outline-source`,children:e}),(0,X.jsx)(`ul`,{children:M(t).map(e=>e.type===`group`?k(e.g):(0,X.jsxs)(`li`,{children:[(0,X.jsxs)(`button`,{className:`outline-singles`,"data-command":`outline-singles`,"aria-expanded":e.open,title:`${e.members.length} groups of one file each in ${e.root||`the top folder`}`,onClick:()=>j(t=>{let n=new Set(t);return n.has(e.key)?n.delete(e.key):n.add(e.key),n}),children:[(0,X.jsx)(`span`,{className:`caret`,"aria-hidden":`true`,children:e.open?`▾`:`▸`}),(0,X.jsxs)(`span`,{className:`name`,children:[e.root?`${e.root}/`:`(top)`,` · `,e.members.length,` single files`]}),(0,X.jsx)(`small`,{className:`count`,children:e.members.length})]}),e.open&&(0,X.jsx)(`ul`,{className:`outline-singles-list`,children:e.members.map(k)})]},e.key))})]},e))]})]})}function jC(e){switch(e.context){case`argument`:return`to ${e.handedTo} (argument ${(e.argument??0)+1})`;case`jsx-attribute`:return`as ${e.handedTo}`;case`property`:return`as ${e.handedTo} in an object`;case`array-element`:return`in an array`;case`return`:return`as its result`;default:return`to ${e.handedTo}`}}function MC({project:e,fn:t,run:n,onOpen:r}){let[i,a]=(0,y.useState)(null);if((0,y.useEffect)(()=>{let n=!1;return Promise.all([Y.references(e,t,`out`),Y.references(e,t,`in`)]).then(([e,r])=>!n&&a({fn:t,out:e,in:r}),()=>!n&&a(`error`)),()=>{n=!0}},[e,t,n]),i===`error`||i===null||i.fn!==t||i.out.total===0&&i.in.total===0)return null;let o=e=>e.evidence.span.start.line,s=e=>e.truncated?`${e.total}; the first ${e.references.length} shown`:`${e.total}`;return(0,X.jsxs)(`div`,{className:`imported-calls handed-on`,"data-testid":`handed-on`,children:[i.out.references.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Hands on (`,s(i.out),`)`]}),i.out.references.map(e=>(0,X.jsxs)(`div`,{className:`imported-call`,"data-testid":`handed-on-out`,children:[(0,X.jsxs)(`span`,{className:`mono small`,children:[e.to.name,` · line `,o(e)]}),(0,X.jsxs)(`span`,{className:`small`,children:[`passes `,(0,X.jsx)(`strong`,{children:e.to.name}),e.to.file!==e.from.file&&(0,X.jsxs)(X.Fragment,{children:[` `,`in `,(0,X.jsx)(`span`,{className:`mono`,children:e.to.path})]}),` `,jC(e),`; whatever receives it may call it`]}),e.to.file!==e.from.file&&(0,X.jsx)(`span`,{className:`small links`,children:(0,X.jsx)(`button`,{className:`button-link`,"data-command":`open-handed-on`,onClick:()=>r({id:e.to.id,file:e.to.file}),children:`Open that file`})})]},e.id))]}),i.in.references.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Handed on by (`,s(i.in),`)`]}),i.in.references.map(e=>(0,X.jsxs)(`div`,{className:`imported-call`,"data-testid":`handed-on-in`,children:[(0,X.jsxs)(`span`,{className:`small`,children:[(0,X.jsx)(`strong`,{children:e.from.name}),` in `,(0,X.jsx)(`span`,{className:`mono`,children:e.from.path}),` passes it`,` `,jC(e),` · line `,o(e)]}),(0,X.jsx)(`span`,{className:`small links`,children:(0,X.jsx)(`button`,{className:`button-link`,"data-command":`open-handed-on`,onClick:()=>r({id:e.from.id,file:e.from.file}),children:`Open`})})]},e.id))]})]})}var NC=e=>e.reason===`imported-symbol`||e.reason===`template-reference`;function PC(e){let t=e.group;if(!t)return e.path;let n=t.root&&e.path.startsWith(`${t.root}/`)?e.path.slice(t.root.length+1):e.path;return`${t.name} › ${n}`}var FC={broken:`its import is broken`,pending:`its import waits for another source`,"not-analyzed":`its import leads to a file not analyzed`};function IC({project:e,graph:t,fn:n,onOpen:r,onShowImports:i}){let[a,o]=(0,y.useState)(null),s=t.file.id,c=t.unresolved.some(NC);(0,y.useEffect)(()=>{if(!c)return;let t=!1;return Y.siteLinks(e,s).then(e=>!t&&o({file:s,byId:new Map(e.links.map(e=>[e.site,e]))}),()=>!t&&o({file:s,byId:`error`})),()=>{t=!0}},[e,s,t.committedRun,c]);let l=t.unresolved.filter(e=>e.enclosingFn===n&&NC(e)&&!e.component).sort((e,t)=>e.evidence.span.start.offset-t.evidence.span.start.offset);if(l.length===0)return null;let u=a?.file===s?a.byId:null,d=u===`error`?null:u;return(0,X.jsxs)(`div`,{className:`imported-calls`,"data-testid":`imported-calls`,children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Calls into other files (`,l.length,`)`]}),u===`error`&&(0,X.jsx)(`p`,{className:`small muted`,children:`Where these calls lead couldn't be loaded.`}),l.map(e=>{let t=d?.get(e.id),n=e.importSpecifier?`imported from ${e.importSpecifier}`:`defined in another file`;return(0,X.jsxs)(`div`,{className:`imported-call`,"data-testid":`imported-call`,"data-site":e.id,children:[(0,X.jsxs)(`span`,{className:`mono small`,children:[e.expression,` · line `,e.evidence.span.start.line]}),u===`error`?(0,X.jsx)(`span`,{className:`small muted`,children:n}):d===null?(0,X.jsxs)(`span`,{className:`small muted`,children:[n,`…`]}):t?.status===`linked`&&t.target?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`small`,children:[`calls `,(0,X.jsx)(`strong`,{children:t.target.name}),` in`,` `,(0,X.jsx)(`span`,{className:`mono`,children:PC(t.target)}),`, found by`,` `,t.via===`import`||e.reason===`imported-symbol`?`import analysis`:`component linking`]}),(0,X.jsxs)(`span`,{className:`small links`,children:[(0,X.jsx)(`button`,{className:`button-link`,"data-command":`open-imported`,onClick:()=>r({id:t.target.id,file:t.target.file}),children:`Open that file`}),(0,X.jsx)(`button`,{className:`button-link`,"data-command":`show-in-imports`,onClick:i,children:`Show in Imports`})]})]}):t?.status===`external`?(0,X.jsxs)(`span`,{className:`small`,children:[`calls into the external package `,(0,X.jsx)(`strong`,{children:t.package?.name})]}):t?(0,X.jsxs)(`span`,{className:`small`,children:[n,`, not linked`,t.importOutcome?`: ${FC[t.importOutcome]}`:t.candidates?.length?t.exhaustive===!1?`: ${t.candidates.length} known function${t.candidates.length===1?``:`s`} could run (may not be all)`:`: it could be any of ${t.candidates.length} functions`:t.reason?`: ${t.reason}`:``]}):(0,X.jsxs)(`span`,{className:`small muted`,children:[n,`, not linked yet`]})]},e.id)})]})}var LC=(e,t)=>{let n=xe(e).name;return n.length>t?`${n.slice(0,t-1)}…`:n},RC=6,zC=e=>e.slice(e.indexOf(`:`)+1),BC=e=>e.split(`/`).slice(-2).join(`/`),VC=(e,t)=>e.label<t.label?-1:+(e.label>t.label);function HC(e,t,n,r,i){let a=r.calls?t.in.calls:[],o=new Map(i.map(e=>[e.file,e])),s=i=>i===e?{calls:r.calls?t.out.calls:[],imports:n}:{calls:r.calls?o.get(i).out.calls:[],imports:o.get(i).imports},c=new Map([[e,0]]),l=[e],u=new Map,d=new Set,f=(e,t)=>{let n=u.get(e)??[];n.push(t),u.set(e,n)},p=[],m=[],h=new Set([e]),g=!1;for(let t=0;t<l.length;t++){let n=l[t],i=c.get(n),a=s(n),u=n===e?`box`:`box|${n}`,_=new Map;for(let e of a.calls)e.to.file!==n&&(p.push({from:e.from.id,to:e.to,id:e.id,source:n}),_.has(e.to.id)||_.set(e.to.id,{id:`callee|${e.to.id}`,file:e.to.file,label:`${BC(e.to.path)} ›\n${LC(e.to,28)}`,target:e.to.id}));let v=new Map;if(r.imports&&a.imports)for(let e of a.imports.imports)e.outcome===`file`&&e.file&&e.file.id!==n&&!v.has(e.file.id)&&v.set(e.file.id,{id:`imported|${e.file.id}`,file:e.file.id,label:`${BC(e.file.path)}\nimported`,edge:e.id});for(let e of v.values())m.push({source:u,target:e.file,edge:e.edge});let y=[],b=new Set,x=e=>h.has(e)||y.includes(e)?!0:y.length>=30&&!o.has(e)||h.size>=200?(h.size>=200&&(g=!0),b.add(e),!1):(y.push(e),h.add(e),!0);for(let t of[...[..._.values()].sort(VC),...[...v.values()].sort(VC)])if(!(t.file===e||c.has(t.file))){if(o.has(t.file)){if(!x(t.file))continue;c.set(t.file,i+1),l.push(t.file),f(i+1,{kind:`box`,file:t.file});continue}d.has(t.id)||x(t.file)&&(d.add(t.id),f(i+1,{kind:`port`,port:t,from:n}))}b.size>0&&f(i+1,{kind:`more`,from:n,skipped:b})}let _=e=>c.has(e),v=new Map,y=(e,t)=>{let n=v.get(e)??new Map;v.set(e,n);let r=xe(t).unnamed;n.has(t.id)||n.set(t.id,{label:r?LC(t,34):`ƒ ${LC(t,32)}`,line:t.line??0})};for(let e of p)_(e.source)&&(y(e.source,s(e.source).calls.find(t=>t.id===e.id).from),_(e.to.file)&&y(e.to.file,e.to));let b=e=>[...v.get(e)??new Map].sort((e,t)=>e[1].line-t[1].line||(e[1].label<t[1].label?-1:+(e[1].label>t[1].label))).map(([e,t])=>({id:e,label:t.label})),x=new Map(a.filter(e=>!_(e.from.file)).map(e=>[e.from.id,{id:`caller|${e.from.id}`,file:e.from.file,label:`${BC(e.from.path)} ›\n${LC(e.from,28)}`}])),S=new Map;if(r.imports&&n)for(let t of n.importedBy.files)t.file.id!==e&&!_(t.file.id)&&!S.has(t.file.id)&&S.set(t.file.id,{id:`importer|${t.file.id}`,file:t.file.id,label:`${BC(t.file.path)}\nimports this file`,edge:t.id});let C=[...[...x.values()].sort(VC),...[...S.values()].sort(VC)],w=new Set,T=new Set,E=C.filter(e=>w.has(e.file)?!0:w.size>=30?(T.add(e.file),!1):(w.add(e.file),!0)),D=E.length+ +!!T.size;for(let t of a)w.has(t.from.file)&&y(e,t.to);let O=e=>-((e-1)*58)/2,k=(t,n)=>`+ ${t} more file${t===1?``:`s`}\n${n===e?`all are listed in Details`:`open ${BC(zC(n))} to see all`}`,A=[],j=(t,n,r)=>{let i=b(t),a=Math.max(i.length,1),o=t===e?`box`:`box|${t}`;A.push({data:{id:o,kind:`box`,file:t,label:zC(t),w:210,h:a*58+50},position:{x:n,y:r},classes:t===e?`box`:`box revealed`}),i.forEach((e,a)=>A.push({data:{id:e.id,kind:`function`,file:t,label:e.label},position:{x:n,y:r+O(i.length)+a*58+12},classes:`function`})),t!==e&&A.push({data:{id:`open|${t}`,kind:`open`,file:t,label:`Open ↗`},position:{x:n+105-30,y:r-(a*58+50)/2-12},classes:`open`})};j(e,0,0),A.push(...E.map((e,t)=>({data:{id:e.id,kind:`port`,side:`left`,file:e.file,label:e.label},position:{x:-330,y:O(D)+t*58},classes:e.id.startsWith(`importer|`)?`port file`:`port`}))),T.size&&A.push({data:{id:`more|left|${e}`,kind:`more`,side:`left`,file:e,label:k(T.size,e)},position:{x:-330,y:O(D)+E.length*58},classes:`port more`});let M=e=>e.kind===`box`?Math.max(b(e.file).length,1)*58+50+29:58,N=e=>e.kind===`more`?[...e.skipped].filter(e=>!h.has(e)).length:1;for(let[e,t]of[...u].sort((e,t)=>e[0]-t[0])){let n=t.filter(e=>N(e)>0),r=-n.reduce((e,t)=>e+M(t),0)/2;for(let t of n){let n=M(t),i=r+n/2;r+=n,t.kind===`box`?j(t.file,e*330,i):t.kind===`more`?A.push({data:{id:`more|${t.from}`,kind:`more`,side:`right`,file:t.from,label:k(N(t),t.from)},position:{x:e*330,y:i},classes:`port more`}):A.push({data:{id:t.port.id,kind:`port`,side:`right`,file:t.port.file,from:t.from,label:t.port.label},position:{x:e*330,y:i},classes:t.port.id.startsWith(`imported|`)?`port file`:`port`})}}let P=new Set(A.map(e=>e.data.id)),F=new Map,I=(e,t,n)=>{if(!P.has(e)||!P.has(t))return;let r=`${e}->${t}`,i=F.get(r);i?i.calls.push(n):F.set(r,{id:n,source:e,target:t,calls:[n]})};for(let e of p)_(e.source)&&I(e.from,_(e.to.file)?e.to.id:`callee|${e.to.id}`,e.id);for(let e of a)_(e.from.file)||I(`caller|${e.from.id}`,e.to.id,e.id);for(let e of F.values())A.push({data:{id:e.id,kind:`call`,source:e.source,target:e.target,calls:e.calls,label:e.calls.length>1?`×${e.calls.length}`:``},classes:`call`});let L=m.filter(e=>P.has(e.source)&&(_(e.target)||P.has(`imported|${e.target}`))),R=L.length+S.size<=RC?`imports`:``,z=new Set;for(let t of L){let n=t.target===e?`box`:_(t.target)?`box|${t.target}`:`imported|${t.target}`,r=`edge|${t.edge}`;z.has(r)||(z.add(r),A.push({data:{id:r,edge:t.edge,kind:`import`,source:t.source,target:n,label:R},classes:`import`}))}for(let e of S.values())P.has(e.id)&&A.push({data:{id:`edge|${e.edge}`,edge:e.edge,kind:`import`,source:e.id,target:`box`,label:R},classes:`import`});return{elements:A,boxes:l.slice(1),cutShort:g}}function UC({file:e,calls:t,imports:n,show:r,pick:i,onPick:a,onOpenFile:o,onClear:s,marks:c=null,onContext:l,revealed:u=[],revealing:d=[],unreadable:f=[],onReveal:p=()=>{},onResetReveal:m=()=>{}}){let h=(0,y.useRef)(null),g=(0,y.useRef)(null),_=Je();(0,y.useEffect)(()=>{g.current?.style(KC())},[_]);let v=(0,y.useRef)(c);v.current=c;let b=(0,y.useRef)(l);b.current=l,(0,y.useEffect)(()=>{g.current&&Qe(g.current,c)},[c]);let x=(0,y.useRef)({onPick:a,onOpenFile:o,onClear:s,onReveal:p});x.current={onPick:a,onOpenFile:o,onClear:s,onReveal:p};let S=(0,y.useMemo)(()=>HC(e,t,n,r,u),[e,t,n,r.calls,r.imports,u]),C=S.elements,w=JSON.stringify([e,r.calls,r.imports,n!==null]),T=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(!h.current)return;let t=J_({container:h.current,elements:C,layout:{name:`preset`},autounselectify:!0,minZoom:.15,maxZoom:2.5,style:KC()}),n;t.on(`tap`,`node`,t=>{let r=t.target.data();if(!r.file)return;if(r.kind===`open`)return x.current.onOpenFile(r.file);if(r.kind===`more`)return r.file===e?x.current.onPick(e):x.current.onOpenFile(r.file);let i=r.kind===`port`&&r.side===`right`||r.kind===`box`&&r.file!==e;if(r.kind===`port`&&!i)return x.current.onOpenFile(r.file);if(!i)return;clearTimeout(n);let a=r.file,o=r.from??e;n=setTimeout(()=>x.current.onReveal(a,o),WC)}),t.on(`dbltap`,`node`,t=>{clearTimeout(n);let r=t.target.data();r.file&&(r.kind===`port`||r.kind===`box`&&r.file!==e)&&x.current.onOpenFile(r.file)}),t.on(`tap`,`edge`,e=>x.current.onPick(e.target.data(`edge`)??e.target.id())),t.on(`tap`,e=>{e.target===t&&x.current.onClear()});let r=T.current;return r&&r.key===w?t.viewport({zoom:r.zoom,pan:r.pan}):(t.fit(void 0,30),t.zoom()>1.2&&(t.zoom(1.2),t.center())),g.current=t,h.current&&(h.current.veoCy=t),Qe(t,v.current),t.on(`cxttap`,`node, edge`,t=>{let n=t.target.data(),r=n.kind===`function`?`function`:(n.kind===`port`||n.kind===`box`&&n.file!==e)&&n.file?`file`:n.kind===`call`||n.kind===`import`?`edge`:null;if(!r||!h.current)return;let i=h.current.getBoundingClientRect(),a=t.renderedPosition??{x:0,y:0};b.current?.({kind:r,id:r===`file`&&typeof n.file==`string`?n.file:t.target.id(),data:n,x:i.left+a.x,y:i.top+a.y})}),()=>{clearTimeout(n),T.current={key:w,zoom:t.zoom(),pan:{...t.pan()}},g.current=null,t.destroy()}},[C]),(0,y.useEffect)(()=>{let e=g.current;e&&(e.elements().removeClass(`picked`),i&&e.edges().filter(e=>(e.data(`calls`)??[]).includes(i)||e.data(`edge`)===i).addClass(`picked`))},[i,C]);let E=e=>C.filter(t=>t.data.kind===`port`&&t.data.side===e).map(e=>e.data.id).join(` `),D=[t.in,t.out].filter(e=>e.truncated),O=(r.calls?t.out.calls.length+t.in.calls.length:0)===0,k=[...new Map(C.filter(t=>t.data.kind===`port`&&t.data.side===`right`||t.data.kind===`box`&&t.data.file!==e).map(t=>[t.data.file,{file:t.data.file,from:t.data.from??e,path:t.data.file.slice(t.data.file.indexOf(`:`)+1)}])).values()],A=[...new Map([...t.in.calls.map(e=>e.from),...t.out.calls.map(e=>e.to)].map(e=>[e.file,e])).values()];return(0,X.jsxs)(`div`,{className:`graph-wrap`,children:[O&&r.calls&&(0,X.jsx)(`p`,{className:`hint overlay`,"data-testid":`no-cross-file-calls`,children:`No calls cross into or out of this file.`}),(0,X.jsx)(`div`,{ref:h,className:`graph map`,"data-testid":`file-canvas`,"data-calls":C.filter(e=>e.data.kind===`call`).length,"data-imports":C.filter(e=>e.data.kind===`import`).length,"data-ports-left":E(`left`),"data-ports-right":E(`right`),"data-revealed":S.boxes.join(` `)}),d.length>0&&(0,X.jsx)(`button`,{className:`reset-reveal`,"data-command":`reset-reveal`,onClick:m,children:`Reset`}),f.length>0&&(0,X.jsxs)(`p`,{className:`hint small overlay error`,"data-testid":`reveal-unreadable`,children:[`Couldn't read `,f.map(e=>e.slice(e.indexOf(`:`)+1)).join(`, `),` to reveal it.`]}),S.cutShort&&(0,X.jsxs)(`p`,{className:`hint small overlay`,"data-testid":`reveal-cut-short`,children:[`Some revealed files' links aren't drawn: at most `,GC,` files are drawn at once. Open a file to see all of its links.`]}),D.length>0&&(0,X.jsxs)(`p`,{className:`hint small overlay`,"data-testid":`calls-truncated`,children:[D.map(e=>`Showing ${e.calls.length} of ${e.total} calls ${e.direction===`in`?`into`:`out of`} this file`).join(`; `),`.`]}),(0,X.jsxs)(`details`,{className:`graph-key`,"data-testid":`imports-file-key`,children:[(0,X.jsx)(`summary`,{children:`Key`}),(0,X.jsxs)(`ul`,{children:[(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node`}),(0,X.jsx)(`span`,{children:`a function in this file that calls or is called across files`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node port`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`code`,{children:`file ›`}),` a function in another file: callers on the left, what this file calls on the right`]})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-line call`}),(0,X.jsx)(`span`,{children:`calls: one function calls the other (×2: two calls)`})]}),r.imports&&(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node port file`}),(0,X.jsx)(`span`,{children:`another file: one this file imports (right) or one importing it (left)`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node box`}),(0,X.jsx)(`span`,{children:`a file revealed here: click a file on the right to show its own calls and imports, again to hide them; double-click or Open to go to it`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node port more`}),(0,X.jsxs)(`span`,{children:[`+ N more: a column draws at most `,30,` files; click it for the full lists in Details (a revealed file's opens it)`]})]}),r.imports&&(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-line import`}),(0,X.jsx)(`span`,{children:`imports: a file imports another (the one this file imports, or one importing it)`})]})]})]}),(0,X.jsxs)(`ul`,{className:`visually-hidden`,"aria-label":`Cross-file calls`,children:[t.in.calls.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"data-command":`pick-node`,"data-kind":`call`,"data-id":e.id,"data-direction":`in`,tabIndex:-1,onClick:()=>a(e.id),children:[e.from.path,` › `,Se(e.from),` calls `,Se(e.to)]})},e.id)),t.out.calls.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"data-command":`pick-node`,"data-kind":`call`,"data-id":e.id,"data-direction":`out`,tabIndex:-1,onClick:()=>a(e.id),children:[Se(e.from),` calls `,e.to.path,` › `,Se(e.to)]})},e.id)),k.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(`button`,{"data-command":`reveal-file`,"data-id":e.file,tabIndex:-1,onClick:()=>p(e.file,e.from),children:d.includes(e.file)?`Hide ${e.path}'s imports here`:`Show ${e.path}'s imports here`})},`reveal:${e.file}`)),A.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"data-command":`open-imports-file`,"data-id":e.file,tabIndex:-1,onClick:()=>o(e.file),children:[`Open `,e.path]})},e.file))]}),(0,X.jsx)(`button`,{className:`fit`,onClick:()=>g.current?.fit(void 0,30),children:`Fit`})]})}var WC=250,GC=200;function KC(){return[{selector:`node`,style:{shape:`round-rectangle`,width:170,height:36,label:`data(label)`,"text-wrap":`wrap`,"text-max-width":`194px`,"text-valign":`center`,"text-halign":`center`,"font-size":12,color:Z(`gray-26`),"background-color":Z(`gray-100`),"border-width":1,"border-color":Z(`gray-86`),"z-index-compare":`manual`,"z-index":2}},{selector:`node.box`,style:{"background-color":Z(`gray-98-5`),"border-color":Z(`blue-87`),"border-width":2,"text-valign":`top`,"text-margin-y":18,color:Z(`blue-47`),"font-weight":`bold`,width:`data(w)`,height:`data(h)`,events:`no`,"z-index":0}},{selector:`node.box.revealed`,style:{"border-color":Z(`blue-62`),"border-style":`dashed`,color:Z(`blue-47`),events:`yes`}},{selector:`node.open`,style:{width:64,height:20,"font-size":10,color:Z(`blue-47`),"background-color":Z(`gray-100`),"border-color":Z(`blue-62`)}},{selector:`node.more`,style:{"border-style":`dotted`,color:Z(`gray-44`)}},{selector:`node.function`,style:{height:40,"text-max-width":`156px`,"text-overflow-wrap":`anywhere`}},{selector:`node.port`,style:{width:210,height:42,"border-style":`dashed`,"border-color":Z(`blue-62`)}},{selector:`node.port.file`,style:{"border-color":Z(`gray-81`),color:Z(`gray-44`)}},{selector:`edge`,style:{"z-index-compare":`manual`,"z-index":1,width:1.5,"curve-style":`bezier`,"line-color":Z(`blue-62`),"target-arrow-shape":`triangle`,"target-arrow-color":Z(`blue-62`),"arrow-scale":.8,label:`data(label)`,"font-size":10,color:Z(`gray-51-2`),"text-background-color":Z(`gray-100`),"text-background-opacity":1}},{selector:`edge.import`,style:{"line-color":Z(`gray-66`),"line-style":`dashed`,"target-arrow-shape":`vee`,"target-arrow-color":Z(`gray-51-2`),"arrow-scale":1.2,"font-size":9}},...Ze(),{selector:`.picked`,style:{"line-color":Z(`blue-56`),"target-arrow-color":Z(`blue-56`),width:3}}]}var qC=(e,t)=>`${e.toLocaleString()} ${t}${e===1?``:`s`}`;function JC(e){let t=`(${qC(e.imports,`import`)})`;return e.calls===0&&!e.references?`no calls linked ${t}`:[e.calls?qC(e.calls,`call`):``,e.references?qC(e.references,`reference`):``].filter(Boolean).join(`, `).concat(` ${t}`)}var YC=e=>!e.startsWith(`group|`);function XC(e,t){let n=JC(e),r=e.groups;return r?`${YC(e.from)?`${qC(r.from,`group`)} in ${t(e.from)}`:t(e.from)} ${YC(e.from)&&r.from!==1?`call`:`calls`} into ${YC(e.to)?YC(e.from)?`${r.to.toLocaleString()} in ${t(e.to)}`:`${qC(r.to,`group`)} in ${t(e.to)}`:t(e.to)}: ${n}`:`${t(e.from)} calls into ${t(e.to)}: ${n}`}function ZC(e,t){let n=new Map(t.declared.map(e=>[e.id,e.name])),r=t.files.filter(t=>t.connected===e),i=`Declared in ${r.map(e=>`${n.get(e.declared)??e.declared} (${e.count} file${e.count===1?``:`s`})`).join(`, `)}`;if(t.declared.length===1)return t.connected.length>1?`${i}, which this grouping has as ${t.connected.length} groups`:i;let a=r.length>1?`: files of ${r.length} declared groups in one`:``,o=t.declared.length>r.length||t.connected.length>1?`; around it, ${t.declared.length} declared groups regroup as ${t.connected.length}`:``;return i+a+o}function QC(e,t){let n=new Map;for(let e of t){let t=e.declared.length>1?`merges ${e.declared.map(e=>e.name).join(`, `)}`:`part of ${e.declared[0]?.name??`a declared group`}, which is ${e.connected.length} groups here`;for(let r of e.connected)n.set(r.id,t)}for(let t of e){let e=t.memberIds?.filter(e=>n.has(e))??[];e.length&&n.set(t.id,`${e.length} of its groups differ from the declared ones`)}return n}function $C(e,t){let n=QC(e,t);return e.filter(e=>n.has(e.id)).length}function ew(e){return e===0?`no groups differ from the declared grouping`:`${e} group${e===1?` differs`:`s differ`} from the declared grouping, outlined`}var tw={repository:`repository`,"workspace-package":`workspace package`,cluster:`cluster`,module:`module`,shared:`shared layer`,area:`folder`,singles:`single files`},nw=(e,t)=>`${e.toLocaleString()} ${t}${e===1?``:`s`}`,rw=.55;function iw(e){return e.resize(),e.elements().empty()?1:(e.fit(void 0,40),e.zoom()>1.2&&(e.zoom(1.2),e.center()),e.zoom())}function aw(e){let{members:t,kind:n}=e;if(t!==void 0)return n===`singles`?`${nw(t,`single file`)} · open them`:`${nw(t,`group`)} · open it`}var ow=(e,t=30)=>e.length>t?`${e.slice(0,t-1)}…`:e;function sw(e,t){if(!e||!t)return 0;let n=Math.abs(t.x-e.x)/290;return n>1.2||t.x<e.x?-(84*.9+12*Math.min(4,n)):0}var cw=(e,t)=>1+6*Math.sqrt(e/Math.max(1,t));function lw(e,t){return e.startsWith(`group|`)&&t.startsWith(`group|`)?`DEPENDS_ON|${e}|${t}`:`arrow|${encodeURIComponent(e)}|${encodeURIComponent(t)}`}function uw({map:e,layoutKey:t,pick:n,showPackages:r,onPick:i,onOpen:a,onClear:o,marks:s=null,only:c=null,onContext:u,differences:d=null}){let f=(0,y.useRef)(null),p=(0,y.useRef)(null),m=(0,y.useMemo)(()=>QC(e.groups,d??[]),[d,e]),h=Je();(0,y.useEffect)(()=>{p.current?.style(dw())},[h]);let[g,_]=(0,y.useState)(!1),[v,b]=(0,y.useState)(!1),[x,S]=(0,y.useState)(null),C=(0,y.useRef)(!1),w=(0,y.useRef)(c);w.current=c;let T=(0,y.useRef)(u);T.current=u,(0,y.useEffect)(()=>{p.current&&Ke(p.current,c)},[c]);let E=(0,y.useRef)(s);E.current=s,(0,y.useEffect)(()=>{p.current&&Qe(p.current,s)},[s]);let D=(0,y.useRef)({x:0,y:0}),O=(0,y.useRef)({onPick:i,onOpen:a,onClear:o});return O.current={onPick:i,onOpen:a,onClear:o},(0,y.useEffect)(()=>{if(!f.current)return;let n={...Zx(t,e.groups,e.dependsOn.map(e=>({from:e.from,to:e.to,weight:e.imports+e.calls})))},r=e.groups.filter(e=>e.kind===`shared`);if(r.length){n.groups={...n.groups};let t=e.groups.filter(e=>e.kind!==`shared`).map(e=>n.groups[e.id]),i=Math.max(0,...t.map(e=>e?.y??0)),a=[];for(let o of r){let r=e.dependsOn.filter(e=>e.to===o.id&&n.groups[e.from]).map(e=>n.groups[e.from].x),s=t.map(e=>e?.x??0),c=r.length?r:s.length?s:[0],l=(Math.min(...c)+Math.max(...c))/2;for(;a.some(e=>Math.abs(e-l)<230);)l+=250;a.push(l),n.groups[o.id]={x:l,y:i+168}}}let i=e.dependsOn.flatMap(e=>{let t=l(e);return t?[{d:e,weight:t.weight}]:[]}),a=Math.max(1,...i.map(e=>e.weight)),o=new Map(e.groups.map(e=>[e.id,e.name])),s=e=>o.get(e)??e;D.current=n.packages;let c=new Set(e.groups.map(e=>e.source)).size>1,u=[...e.groups.map(e=>{let t=e.findings.broken;return{data:{id:e.id,kind:`group`,why:[e.why,m.get(e.id)?`Differs: ${m.get(e.id)}`:``].filter(Boolean).join(`
337
+ `),label:[ow(e.name),aw(e)??ow(c?`${e.source} · ${tw[e.kind]??e.kind}`:tw[e.kind]??e.kind),t>0?`${nw(e.files,`file`)} · ${nw(t,`broken import`)}`:`${nw(e.files,`file`)} · ${nw(e.functions,`function`)}`].join(`
338
+ `)},position:n.groups[e.id]??{x:0,y:0},classes:[`group`,t>0?`broken`:``,e.kind===`shared`?`shared`:``,d?m.has(e.id)?`differs`:`alike`:``].filter(Boolean).join(` `)}}),...i.map(({d:e,weight:t})=>({data:{bend:sw(n.groups[e.from],n.groups[e.to]),id:e.id,kind:`depends`,source:e.from,target:e.to,width:cw(t,a),count:t*3>=a&&t>1?String(t):``,label:t*3>=a&&t>1?String(t):``,sentence:XC(e,s)},classes:t===0?`depends unlinked`:`depends`}))],h=J_({container:f.current,elements:u,layout:{name:`preset`},autounselectify:!0,minZoom:.1,maxZoom:2.5,style:dw()});h.on(`tap`,`node`,e=>{e.target.data(`kind`)===`group`&&O.current.onPick(e.target.id())}),h.on(`dbltap`,`node`,e=>{e.target.data(`kind`)===`group`&&O.current.onOpen(e.target.id())}),h.on(`tap`,`edge`,e=>{e.target.data(`kind`)===`depends`&&O.current.onPick(lw(e.target.data(`source`),e.target.data(`target`)))}),h.on(`tap`,e=>{e.target===h&&O.current.onClear()}),h.on(`mouseover`,`edge`,e=>{let t=e.target.data(`sentence`),n=e.renderedPosition??{x:0,y:0};t&&S({text:t,x:n.x,y:n.y})}),h.on(`mouseout`,`edge`,()=>S(null)),h.on(`mouseover`,`node`,e=>{let t=e.target.data(`why`),n=e.renderedPosition??{x:0,y:0};t&&S({text:t,x:n.x,y:n.y})}),h.on(`mouseout`,`node`,()=>S(null)),h.on(`pan zoom`,()=>S(null)),C.current=!1,_(iw(h)<rw),h.on(`scrollzoom pinchzoom dragpan`,()=>{C.current=!0});let g=new ResizeObserver(()=>{C.current?h.resize():_(iw(h)<rw)});return f.current&&g.observe(f.current),p.current=h,f.current&&(f.current.veoCy=h),Ke(h,w.current),h.on(`cxttap`,`node, edge`,e=>{let t=e.target.data(),n=t.kind===`group`?`group`:t.kind===`depends`?`edge`:null;if(!n||!f.current)return;let r=f.current.getBoundingClientRect(),i=e.renderedPosition??{x:0,y:0};T.current?.({kind:n,id:n===`file`&&typeof t.file==`string`?t.file:e.target.id(),data:t,x:r.left+i.x,y:r.top+i.y})}),Qe(h,E.current),()=>{g.disconnect(),S(null),p.current=null,h.destroy()}},[e,t,d,m]),(0,y.useEffect)(()=>{let t=p.current;if(!t||(t.remove(`#packages, .uses`),!r||e.externalPackages.total===0))return;let n=[],i=e.externalPackages.top.slice(0,4).map(e=>e.name),a=e.externalPackages.total-i.length;n.push({data:{id:`packages`,kind:`packages`,label:[`External packages`,i.join(`, `),a>0?`+ ${a} more`:``].filter(Boolean).join(`
339
+ `)},position:D.current,classes:`packages`});for(let t of e.groups)t.externalPackages>0&&n.push({data:{id:`packages|${t.id}`,kind:`uses`,source:t.id,target:`packages`,width:1,label:``,bend:0},classes:`uses`});t.add(n),C.current||_(iw(t)<rw)},[e,t,r]),(0,y.useEffect)(()=>{let e=p.current;e&&e.batch(()=>{e.elements().removeClass(`picked faded role-into role-from`),e.edges(`[kind = "depends"]`).forEach(e=>{e.data(`label`,e.data(`count`))});let t=(n?.startsWith(`DEPENDS_ON|`)||n?.startsWith(`arrow|`)?e.edges().filter(e=>lw(e.data(`source`),e.data(`target`))===n):null)??(n?e.getElementById(n):null);if(t&&t.nonempty()&&t.isEdge()){let n=t.union(t.connectedNodes());n.addClass(`picked`),e.elements().not(n).addClass(`faded`)}else if(t&&t.nonempty()){let n=t.connectedEdges(`[kind = "depends"]`);t.addClass(`picked`),n.forEach(e=>{let n=e.data(`source`)===t.id();e.addClass(n?`role-into`:`role-from`);let r=e.data(`count`);e.data(`label`,n?`▶${r?` ${r}`:``}`:`◀${r?` ${r}`:``}`)});let r=t.union(n);e.elements().not(r).not(r.connectedNodes()).addClass(`faded`)}})},[n,e,t,r]),(0,X.jsxs)(`div`,{className:`graph-wrap`,children:[(0,X.jsx)(`div`,{ref:f,className:`graph map`,"data-testid":`project-map`,tabIndex:0,role:`application`,"aria-label":`Project map: arrow keys move between groups, Enter opens one`,onKeyDown:t=>{let r=e.groups.map(e=>e.id);if(r.length===0)return;let s=n?r.indexOf(n):-1;if(t.key===`ArrowRight`||t.key===`ArrowDown`)i(r[(s+1)%r.length]);else if(t.key===`ArrowLeft`||t.key===`ArrowUp`)i(r[(s-1+r.length)%r.length]);else if(t.key===`Enter`&&n)a(n);else if(t.key===`Escape`)o();else return;t.preventDefault()}}),(0,X.jsx)(`ul`,{className:`visually-hidden`,"aria-label":`Groups`,children:e.groups.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`button`,{"data-command":`pick-node`,"data-id":e.id,"data-why":e.why,"data-differs":d?String(m.has(e.id)):void 0,tabIndex:-1,onClick:()=>i(e.id),children:e.name}),(0,X.jsxs)(`button`,{"data-command":`open-group`,"data-id":e.id,tabIndex:-1,onClick:()=>a(e.id),children:[`Open `,e.name]})]},e.id))}),(0,X.jsx)(`ul`,{className:`visually-hidden`,"aria-label":`Arrows`,children:e.dependsOn.filter(e=>l(e)).map(t=>(0,X.jsx)(`li`,{children:(0,X.jsx)(`button`,{"data-command":`pick-node`,"data-arrow":!0,"data-id":lw(t.from,t.to),tabIndex:-1,onClick:()=>i(lw(t.from,t.to)),children:XC(t,t=>e.groups.find(e=>e.id===t)?.name??t)})},t.id))}),x&&!v&&(0,X.jsx)(`div`,{className:`map-hover`,"data-testid":`arrow-hover`,role:`status`,style:{left:x.x+12,top:x.y+12},children:x.text}),!v&&(0,X.jsxs)(`p`,{className:`overlay map-key small muted`,"data-testid":`map-key`,children:[`A ──▶ B: A calls into B · callers left, what they call right`,d&&` · outlined: a group the declared grouping has otherwise; the rest recede`]}),v&&(0,X.jsx)(`ul`,{className:`map-list`,"data-testid":`map-list`,"aria-label":`Groups`,children:e.groups.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link-row${e.id===n?` picked`:``}`,"data-command":`list-group`,"data-id":e.id,onClick:()=>i(e.id),onDoubleClick:()=>a(e.id),title:`${e.name}: ${e.source} · ${tw[e.kind]??e.kind}${e.why?`. ${e.why}`:``} (double-click or Enter opens it)`,onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),a(e.id))},children:[(0,X.jsx)(`span`,{className:`name`,children:e.name}),(0,X.jsxs)(`small`,{children:[e.source,` · `,tw[e.kind]??e.kind,` · `,nw(e.files,`file`),e.findings.broken>0?` · ${nw(e.findings.broken,`broken import`)}`:``]})]})},e.id))}),!v&&g&&(0,X.jsxs)(`p`,{className:`overlay bottom small muted map-note`,"data-testid":`map-too-small`,children:[`All `,e.groups.length,` groups are shown, zoomed out: scroll to zoom in, or`,` `,(0,X.jsx)(`button`,{className:`button-link`,onClick:()=>b(!0),children:`see them as a list`}),`.`]}),(0,X.jsxs)(`div`,{className:`map-controls`,children:[(0,X.jsx)(`button`,{"data-command":`map-as-list`,"aria-pressed":v,onClick:()=>b(!v),title:`The groups as a list`,children:v?`Map`:`List`}),!v&&(0,X.jsx)(`button`,{className:`fit`,"data-command":`fit-map`,onClick:()=>{p.current&&(C.current=!1,_(iw(p.current)<rw))},children:`Fit`})]})]})}function dw(){return[{selector:`node`,style:{shape:`round-rectangle`,width:210,height:84,label:`data(label)`,"text-wrap":`wrap`,"text-max-width":`190px`,"text-valign":`center`,"text-halign":`center`,"font-size":13,"line-height":1.45,color:Z(`gray-26`),"background-color":Z(`gray-98-3`),"border-width":1,"border-color":Z(`gray-86`)}},{selector:`node.broken`,style:{"border-color":Z(`amber-74`)}},{selector:`node.shared`,style:{"border-style":`dotted`,"border-width":2,"background-color":Z(`gray-100`)}},{selector:`node.differs`,style:{"underlay-color":Z(`purple-44`),"underlay-padding":5,"underlay-opacity":.55}},{selector:`node.alike`,style:{opacity:.5}},{selector:`node.packages`,style:{"background-color":Z(`gray-100`),"border-style":`dashed`,"border-color":Z(`gray-81`),color:Z(`gray-44`)}},{selector:`edge`,style:{width:`data(width)`,"curve-style":`unbundled-bezier`,"control-point-distances":`data(bend)`,"control-point-weights":.5,"line-color":Z(`gray-72`),"target-arrow-shape":`triangle`,"target-arrow-color":Z(`gray-72`),"arrow-scale":.8,label:`data(label)`,"font-size":11,color:Z(`gray-51-2`),"text-background-color":Z(`gray-100`),"text-background-opacity":1,"text-background-padding":`2px`}},{selector:`edge.unlinked`,style:{"line-style":`dashed`}},{selector:`edge.uses`,style:{"line-style":`dashed`,"line-color":Z(`gray-86`),"target-arrow-shape":`none`}},...Ze(),Ge,{selector:`node.picked`,style:{"border-width":2,"border-color":Z(`blue-56`),"background-color":Z(`gray-97`)}},{selector:`edge.picked`,style:{"line-color":Z(`blue-56`),"target-arrow-color":Z(`blue-56`)}},{selector:`edge.role-into`,style:{"line-color":Z(`blue-52-2`),"target-arrow-color":Z(`blue-52-2`),color:Z(`blue-52-2`)}},{selector:`edge.role-from`,style:{"line-color":Z(`orange-59`),"target-arrow-color":Z(`orange-59`),color:Z(`orange-59`)}},{selector:`.faded`,style:{opacity:.25}}]}var fw=e=>e.toLocaleString(`en-US`),pw=(e,t)=>`${fw(e)} ${t}${e===1?``:`s`}`;function mw(e,t=!0){return[t&&e.withinFile?`${pw(e.withinFile,`call`)} within it`:``,e.intoOtherFiles?`${fw(e.intoOtherFiles)} into other files`:``,e.leaveProject?`${fw(e.leaveProject)} leave the project`:``,e.candidates?`${fw(e.candidates)} narrowed to candidates`:``].filter(Boolean)}var hw=e=>e.map((e,t)=>(0,X.jsxs)(y.Fragment,{children:[t>0&&` · `,e]},t));function gw({project:e,file:t,version:n,onImports:r,onFindings:i}){let[a,o]=(0,y.useState)(null),s=a?.file===t&&a.project===e?a:null;if((0,y.useEffect)(()=>{let n=!0;return Y.fileSummary(e,t).then(e=>n&&o(e)).catch(()=>n&&o(null)),()=>{n=!1}},[e,t,n]),!s)return null;let{alone:c,acrossFiles:l}=s;if(c.sites===0&&(!l||l.imports.files+l.imports.packages+l.imports.unresolved===0))return null;let u=[...mw(c),c.open?`${fw(c.open)} open`:`none open`],d=[];if(l){let e=l.open?`${fw(l.open)} stop short`:`none stop short`,t=l.imports.files+l.imports.packages,n=t+l.imports.unresolved>0?`${pw(t,`import`)}${l.imports.unresolved?`, ${fw(l.imports.unresolved)} unresolved`:``}`:null;d=[...mw(l,!1),l.open&&i?(0,X.jsx)(`button`,{className:`link`,"data-testid":`file-summary-open`,title:`Findings for this file: its open calls (with those narrowed to candidates) and its imports that didn't resolve`,onClick:i,children:e}):e,...n?[r?(0,X.jsx)(`button`,{className:`link`,"data-testid":`file-summary-imports`,onClick:r,children:n}):n]:[]]}return(0,X.jsxs)(`p`,{className:`file-summary small muted`,"data-testid":`file-summary`,title:`Of its ${pw(c.sites,`call`)}: what reading this file on its own found, and what linking it to the rest of the project added`,children:[(0,X.jsxs)(`span`,{"data-testid":`file-summary-alone`,children:[(0,X.jsx)(`strong`,{children:`Reading this file alone:`}),` `,u.join(` · `)]}),(0,X.jsx)(`span`,{"data-testid":`file-summary-across`,children:l?(0,X.jsxs)(X.Fragment,{children:[` → `,(0,X.jsx)(`strong`,{children:`across files:`}),` `,hw(d)]}):` · cross-file analysis didn't run`})]})}var _w={declared:`Declared: repositories, workspace packages and their folders`,connected:`Connected: files that call each other, within their packages; a file most of a package uses is its shared layer`};function vw({project:e,projectName:t,run:n,group:r,source:i=null,pick:a,file:o,fileLevel:s,expand:c,showPending:l,tabs:u,onPick:d,onOpenGroup:f,onOpenFile:p,onToggleFolder:m,onTogglePending:h,onClear:g,onFileFindings:_,marks:v=null,only:b=null,onContext:x,area:S=null,onOpenArea:C=()=>{},grouping:w=`declared`,differences:T=!1,onSetGrouping:E=()=>{},onToggleDifferences:D=()=>{},reveal:O=[],onReveal:k=()=>{},onResetReveal:A=()=>{}}){let[j,M]=(0,y.useState)(0),{groups:N,error:P}=bS(e,n,j,i),[F,I]=(0,y.useState)(!1),[L,R]=fS(),z=s&&o!==null,{imports:B}=SS(e,n,z?o:null),{calls:V,error:H}=TS(e,n,z?o:null),U=(0,y.useMemo)(()=>z?O.map(e=>e.file):[],[z,O]),{loaded:W,failed:ee}=CS(e,n,U),G=(0,y.useMemo)(()=>U.flatMap(e=>{let t=W.get(e);return t?[{file:e,out:t.out,imports:t.imports}]:[]}),[U,W]),[te,ne]=(0,y.useState)({calls:!0,imports:!0}),K=z?B?B.file.group:null:r??(N&&N.total===1?N.groups[0].id:null),q=K?N?.groups.find(e=>e.id===K):void 0,[J,Y]=(0,y.useState)(0),{group:re,error:ie}=xS(e,n,z?null:K,c,l,J),[ae,oe]=(0,y.useState)(new Set),se=(0,y.useMemo)(()=>N&&!K&&!z?DC(N,S,ae):null,[N,K,z,S,ae]),ce=(0,y.useMemo)(()=>new Set(N?.groups.map(e=>e.source)).size>1,[N]),le=se?.area??S,ue=le?OC(le,ce):[],de=ue.map(e=>[(0,X.jsx)(`span`,{className:`muted`,children:`›`},`s:${e.area}`),(0,X.jsx)(`button`,{className:`link`,"data-command":`open-area`,onClick:()=>C(e.area),children:e.label},e.area)]),fe=e=>{e.startsWith(`area|`)?C(e.slice(vC.length)):e.startsWith(`singles|`)?oe(t=>new Set([...t,e.slice(yC.length)])):f(e)},pe=e=>e.startsWith(`area|`)||e.startsWith(`singles|`),me=(0,X.jsxs)(`div`,{className:`toolbar`,children:[u,(0,X.jsx)(`nav`,{className:`breadcrumb`,"aria-label":`Zoom`,"data-testid":`breadcrumb`,children:K?(0,X.jsxs)(X.Fragment,{children:[N?.total===1?(0,X.jsx)(`span`,{children:t}):(0,X.jsx)(`button`,{className:`link`,"data-command":`open-group`,onClick:()=>f(),children:t}),!z&&de,(0,X.jsx)(`span`,{className:`muted`,children:`›`}),z?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{className:`link`,"data-command":`open-group`,onClick:()=>f(K),children:q?.name??K}),(0,X.jsx)(`span`,{className:`muted`,children:`›`}),(0,X.jsx)(`strong`,{className:`mono`,title:bw(o),children:Te(aS(bw(o),xw(q)),48)})]}):(0,X.jsx)(`strong`,{children:q?.name??K})]}):z?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{className:`link`,"data-command":`open-group`,onClick:()=>f(),children:t}),(0,X.jsx)(`span`,{className:`muted`,children:`›`}),(0,X.jsx)(`strong`,{className:`mono`,title:bw(o),children:Te(bw(o),48)})]}):ue.length>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{className:`link`,"data-command":`open-group`,onClick:()=>f(),children:t}),de.slice(0,-1),(0,X.jsx)(`span`,{className:`muted`,children:`›`}),(0,X.jsx)(`strong`,{children:ue[ue.length-1].label})]}):(0,X.jsx)(`strong`,{children:t})}),(K||z||ue.length>0)&&N&&N.total>1&&(0,X.jsx)(`button`,{className:`small`,"data-command":`go-project-map`,title:`Back to the project map: every group, nothing picked`,onClick:()=>f(),children:`⌂ Project map`}),N&&!K&&N.stage2&&(0,X.jsx)(`span`,{className:`small muted toolbar-note`,children:se?.area?(()=>{let e=se.map.groups.reduce((e,t)=>e+(t.members??1),0);return`folder · ${e.toLocaleString()} group${e===1?``:`s`} of ${N.total.toLocaleString()}`})():`project map · ${N.total} group${N.total===1?``:`s`}`}),re&&!z&&(0,X.jsxs)(`span`,{className:`small muted toolbar-note`,children:[`group · `,re.group.files,` file`,re.group.files===1?``:`s`,` · `,re.group.source]}),K&&!z&&c.length>0&&(0,X.jsx)(`span`,{className:`open-folders small`,children:c.map(e=>(0,X.jsxs)(`span`,{className:`chip`,children:[aS(e,xw(q)),`/`,(0,X.jsx)(`button`,{className:`icon`,"data-command":`toggle-folder`,"data-testid":`close-folder`,"data-path":e,"aria-label":`Close the folder ${e}`,onClick:()=>m(e),children:`×`})]},e))}),z&&(0,X.jsx)(`span`,{className:`small muted toolbar-note`,children:`its imports and cross-file calls`}),(0,X.jsx)(`span`,{className:`spacer`}),N&&N.stage2&&!z&&!K&&(0,X.jsxs)(`span`,{className:`grouping`,"data-testid":`grouping`,children:[(0,X.jsxs)(`label`,{className:`small`,title:_w[w],children:[`Grouped by`,` `,(0,X.jsxs)(`select`,{"data-command":`set-grouping`,value:w,onChange:e=>E(e.target.value),children:[(0,X.jsx)(`option`,{value:`declared`,children:`packages & folders`}),(0,X.jsx)(`option`,{value:`connected`,children:`how files connect`})]})]}),w===`connected`&&(0,X.jsxs)(`label`,{className:`toggle`,title:`Mark the groups the declared grouping has otherwise: a package split into several, packages merged`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-command":`toggle-differences`,checked:T,onChange:D}),`Show differences`]})]}),z&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`label`,{className:`toggle`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`toggle-calls`,checked:te.calls,onChange:e=>ne({...te,calls:e.target.checked})}),`Cross-file calls`]}),(0,X.jsxs)(`label`,{className:`toggle`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`toggle-imports`,checked:te.imports,onChange:e=>ne({...te,imports:e.target.checked})}),`Imports`]})]}),K&&!z&&(0,X.jsxs)(`label`,{className:`toggle`,title:`Imports waiting for another source to be added`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-command":`toggle-pending`,checked:l,onChange:h}),`Pending imports`]}),N&&!K&&N.externalPackages.total>0&&(0,X.jsxs)(`label`,{className:`toggle`,title:`External packages are hidden by default: nearly every group imports the same few`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`toggle-packages`,checked:F,onChange:e=>I(e.target.checked)}),`External packages`]})]});if(P)return(0,X.jsxs)(X.Fragment,{children:[me,(0,X.jsxs)(`p`,{className:`hint error`,children:[P,` `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>M(e=>e+1),children:`Try again`})]})]});if(!N)return(0,X.jsxs)(X.Fragment,{children:[me,(0,X.jsx)(`p`,{className:`hint`,children:`Loading the imports…`})]});if(!N.stage2)return(0,X.jsxs)(X.Fragment,{children:[me,(0,X.jsx)(`p`,{className:`hint`,"data-testid":`imports-no-stage2`,children:`Imports haven't been analyzed in this project yet: Stage 2, which follows imports across files, hasn't run. Analyze the project again to see them.`})]});let he=N.stats.own,ge=he.files!==N.stats.files,_e=S&&se?.area?EC(N,se.area):null,ve=_e?new Set(_e.map(e=>e.id)):null,ye=_e?{files:_e.reduce((e,t)=>e+t.files,0),functions:_e.reduce((e,t)=>e+t.functions,0),crossFileCalls:N.dependsOn.filter(e=>ve.has(e.from)&&ve.has(e.to)).reduce((e,t)=>e+t.calls,0),brokenImports:_e.reduce((e,t)=>e+t.findings.broken,0),openCalls:_e.reduce((e,t)=>e+t.findings.openCalls,0)}:L||!ge?N.stats:{files:he.files,functions:he.functions,crossFileCalls:he.crossFileCalls,brokenImports:he.brokenImports??N.stats.brokenImports,openCalls:he.openCalls??N.stats.openCalls};return(0,X.jsxs)(X.Fragment,{children:[me,z&&o&&(0,X.jsx)(gw,{project:e,file:o,version:`${n}:${V?.out.committedRun??``}`,onFindings:_}),z?H?(0,X.jsx)(`p`,{className:`hint error`,children:H}):V?(0,X.jsx)(`div`,{className:`group-level`,"data-testid":`file-level`,children:(0,X.jsx)(UC,{marks:v,onContext:x,file:o,calls:V,imports:B,show:te,pick:a,onPick:d,onOpenFile:e=>p(e),onClear:g,revealed:G,revealing:U,unreadable:ee,onReveal:k,onResetReveal:A})}):(0,X.jsx)(`p`,{className:`hint`,children:`Loading the file…`}):K?ie?(0,X.jsxs)(`p`,{className:`hint error`,children:[ie,` `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>Y(e=>e+1),children:`Try again`})]}):re?(0,X.jsxs)(`div`,{className:`group-level`,"data-testid":`group-level`,children:[re.truncated&&(0,X.jsxs)(`p`,{className:`hint small`,children:[`Showing `,re.nodes.length,` of `,re.total,` files and folders.`]}),(0,X.jsx)(oS,{marks:v,onContext:x,only:b,reply:re,pick:a,onPick:d,onOpenFile:e=>p(e,K),onToggleFolder:m,onClear:g})]}):(0,X.jsx)(`p`,{className:`hint`,children:`Loading the group…`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`small muted map-method`,"data-testid":`map-method`,children:[_w[w],w===`connected`&&T&&N.differences&&(0,X.jsxs)(`span`,{"data-testid":`differences-count`,children:[` `,`· `,ew($C((se?.map??N).groups,N.differences))]})]}),(0,X.jsxs)(`dl`,{className:`map-stats`,"data-testid":`map-stats`,children:[(0,X.jsx)(yw,{n:ye.files,label:`files`}),(0,X.jsx)(yw,{n:ye.functions,label:`functions`}),(0,X.jsx)(yw,{n:ye.crossFileCalls,label:_e?`calls between its groups`:`cross-file calls`}),(0,X.jsx)(yw,{n:ye.brokenImports,label:`broken imports`,tone:ye.brokenImports>0?`warn`:void 0}),(0,X.jsx)(yw,{n:ye.openCalls,label:`open calls`}),!_e&&(0,X.jsx)(yw,{n:N.externalPackages.total,label:F?`external packages`:`external packages (hidden)`}),ge&&!_e&&(0,X.jsxs)(`label`,{className:`toggle stats-scope`,title:`Own code: ${he.files.toLocaleString()} of ${N.stats.files.toLocaleString()} files. The rest are tests, installed libraries, generated output or tools' files.`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`stats-all-code`,checked:L,onChange:e=>R(e.target.checked)}),`Libraries and tests too`]})]}),N.total===0?(0,X.jsx)(`p`,{className:`hint`,children:`No groups: nothing was analyzed.`}):(0,X.jsx)(uw,{marks:v,onContext:x&&(e=>e.id.startsWith(`singles|`)?void 0:x(e)),only:b,map:se?.map??N,layoutKey:`${e}|${N.committedRun}|${i??``}|${se?.area??``}|${[...ae].join(`,`)}|${w}`,pick:a,showPackages:F,onPick:e=>pe(e)?fe(e):d(e),onOpen:fe,onClear:g,differences:w===`connected`&&T?N.differences??[]:null}),N.truncated&&(0,X.jsxs)(`p`,{className:`hint small`,children:[`Showing `,N.groups.length,` of `,N.total,` groups.`]})]})]})}function yw({n:e,label:t,tone:n}){return(0,X.jsxs)(`div`,{className:n,children:[(0,X.jsx)(`dd`,{children:e.toLocaleString()}),(0,X.jsx)(`dt`,{children:t})]})}var bw=e=>e.slice(e.indexOf(`:`)+1);function xw(e){return!e||e.kind===`cluster`?``:e.root}var Sw=(e,t=34)=>e.length>t?`${e.slice(0,t-1)}…`:e,Cw=e=>e.slice(e.lastIndexOf(`/`)+1);function ww(e){let t=[e.name,e.member].filter(Boolean).join(`.`)||`?`;return`${e.packageName??`runtime`}: ${t}`}function Tw(e){let t=e.direction===`forward`?1:-1,n=[],r=new Map,i=[],a=e=>{let t=r.get(e)??0;r.set(e,t+1);let n={position:{x:0,y:0},depth:e,row:t};return i.push(n),n.position},o=new Map(e.functions.map(e=>[e.id,e.depth])),s=new Set(e.starts.map(e=>e.function));for(let t of e.functions)n.push({group:`nodes`,data:{id:t.id,kind:`function`,label:`${Sw(t.name,26)}${s.has(t.id)?` ▸ start`:``}\n${Sw(Cw(t.path),28)}`,path:t.path,line:t.line,depth:t.depth},position:a(t.depth),classes:[`function`,...t.depth===0?[`root`]:[],...s.has(t.id)?[`start`]:[]].join(` `)});e.edges.forEach((e,t)=>{o.has(e.from)&&o.has(e.to)&&n.push({group:`edges`,data:{id:`hop|${t}`,source:e.from,target:e.to,kind:e.kind,label:e.kind===`call`||e.kind===`cross-file`?``:e.kind,path:e.evidence.file.slice(e.evidence.file.indexOf(`:`)+1),line:e.evidence.span.start.line,file:e.evidence.file},classes:e.trust===`candidate`?`hop candidate`:`hop`})});let c=new Map;for(let t of e.gaps){let e=`gap|${t.in}|${t.expression}|${t.reason}`,n=c.get(e);n?n.count++:c.set(e,{id:e,in:t.in,label:`? ${Sw(t.expression,26)}\n${t.reason}`,kind:`gap`,count:1,file:t.evidence.file,line:t.evidence.span.start.line})}for(let t of e.exits){let e=ww(t.exit),n=`exit|${t.in}|${e}`,r=c.get(n);r?r.count++:c.set(n,{id:n,in:t.in,label:Sw(e,30),kind:`exit`,count:1,file:t.evidence.file,line:t.evidence.span.start.line})}for(let e of[...c.values()].sort((e,t)=>e.id<t.id?-1:1)){let t=o.get(e.in);t!==void 0&&(n.push({group:`nodes`,data:{id:e.id,kind:e.kind,label:e.count>1?`${e.label} ×${e.count}`:e.label,file:e.file,line:e.line},position:a(t+1),classes:`port ${e.kind}`}),n.push({group:`edges`,data:{id:`to|${e.id}`,source:e.in,target:e.id,kind:e.kind,label:``,file:e.file,line:e.line},classes:`stop ${e.kind}`}))}let l=Math.max(0,...r.keys()),u=[],d=0;for(let e=0;e<=l;e++)u[e]=d,d+=Math.ceil((r.get(e)??1)/24)*270;for(let e of i)e.position.x=t*(u[e.depth]+Math.floor(e.row/24)*270),e.position.y=e.row%24*62;return n}var Ew=e=>e.slice(e.indexOf(`:`)+1),Dw=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function Ow({project:e,run:t,root:n,direction:r,onDirection:i,onReach:a,onOpenFile:o,onContext:s}){let{reach:c,error:l}=wS(e,t,n,r),[u,d]=(0,y.useState)(null),f=(0,y.useRef)(null),p=(0,y.useRef)(null),m=Je();(0,y.useEffect)(()=>{p.current?.style(kw())},[m]);let h=(0,y.useRef)({onReach:a,onContext:s});h.current={onReach:a,onContext:s};let g=(0,y.useMemo)(()=>c?Tw(c):[],[c]);(0,y.useEffect)(()=>d(null),[n,r]),(0,y.useEffect)(()=>{if(!f.current||g.length===0)return;let e=J_({container:f.current,elements:g,layout:{name:`preset`},autounselectify:!0,minZoom:.1,maxZoom:2.5,style:kw()});return e.on(`tap`,`edge`,t=>{e.elements().removeClass(`picked`),t.target.addClass(`picked`),d(t.target.data())}),e.on(`tap`,`node`,e=>{let t=e.target.data();t.kind===`function`?h.current.onReach(t.id):d(t)}),e.on(`cxttap`,`node`,e=>{let t=e.target.data();if(t.kind!==`function`||!f.current)return;let n=f.current.getBoundingClientRect(),r=e.renderedPosition??{x:0,y:0};h.current.onContext?.({kind:`function`,id:t.id,data:t,x:n.left+r.x,y:n.top+r.y})}),e.fit(void 0,30),e.zoom()>1.2&&(e.zoom(1.2),e.center()),p.current=e,()=>{p.current=null,e.destroy()}},[g]);let _=new Map((c?.functions??[]).map(e=>[e.id,e.name])),v=e=>_.get(e)??e,b=c?.counts,x=b?`in ${Dw(b.files,`file`)} across ${Dw(b.groups,`group`)}`:``,S=c?.functions.find(e=>e.id===n)?.name??Ew(n);return(0,X.jsxs)(`div`,{className:`reach`,"data-testid":`reach`,children:[(0,X.jsxs)(`div`,{className:`toolbar`,children:[(0,X.jsx)(`span`,{className:`file-title`,title:n,children:S}),(0,X.jsx)(`div`,{className:`segmented`,role:`group`,"aria-label":`Direction`,children:[`forward`,`backward`].map(e=>(0,X.jsx)(`button`,{"aria-pressed":r===e,"data-command":`open-reach`,"data-direction":e,title:e===`forward`?`What paths from it reach`:`What reaches it`,onClick:()=>i(e),children:e===`forward`?`Reaches →`:`← Reached by`},e))}),b&&(0,X.jsx)(`span`,{className:`reach-counts`,"data-testid":`reach-counts`,children:r===`forward`?`${b.functions?`reaches ${Dw(b.functions,`function`)} ${x}`:`reaches no other function`} · ${Dw(b.gaps,`gap`)} · ${Dw(b.exits,`exit`)}`:`${b.functions?`reached by ${Dw(b.functions,`function`)} ${x}`:`nothing reaches it`}${c.starts.length?` · ${Dw(c.starts.length,`start candidate`)}`:``}`}),c?.truncated&&(0,X.jsxs)(`span`,{className:`badge degraded`,"data-testid":`reach-truncated`,children:[`stopped at the `,c.truncated.reason,` budget, `,Dw(c.truncated.depth,`step`),` out`]})]}),l&&(0,X.jsx)(`div`,{className:`error`,children:l}),(0,X.jsx)(`div`,{className:`graph-wrap`,children:(0,X.jsx)(`div`,{className:`graph map`,ref:f,"data-testid":`reach-canvas`})}),u&&(0,X.jsxs)(`div`,{className:`reach-hop`,"data-testid":`reach-hop`,children:[(0,X.jsxs)(`span`,{children:[String(u.kind),` · `,String(u.file??``).slice(String(u.file??``).indexOf(`:`)+1),`:`,String(u.line??``)]}),typeof u.file==`string`&&(0,X.jsx)(`button`,{"data-command":`open-file`,onClick:()=>o(u.file,u.line),children:`Open`})]}),c&&(0,X.jsxs)(`details`,{className:`reach-list`,"data-testid":`reach-list`,children:[(0,X.jsx)(`summary`,{children:`As a list`}),(0,X.jsx)(`ol`,{children:c.functions.map(e=>(0,X.jsxs)(`li`,{"data-depth":e.depth,children:[` `.repeat(e.depth),(0,X.jsx)(`button`,{className:`link`,"data-command":`open-reach`,title:`Reach from this function instead`,onClick:()=>a(e.id),children:e.name}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[e.path,`:`,e.line]})]},e.id))}),(0,X.jsx)(`ul`,{"data-testid":`reach-hops`,children:c.edges.map((e,t)=>(0,X.jsxs)(`li`,{"data-kind":e.kind,"data-trust":e.trust,children:[(0,X.jsxs)(`button`,{"data-command":`reach-hop`,onClick:()=>d({kind:e.kind,file:e.evidence.file,line:e.evidence.span.start.line}),children:[v(e.from),` → `,v(e.to)]}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[e.kind,e.trust===`candidate`?` (candidate)`:``]})]},t))}),c.gaps.length>0&&(0,X.jsx)(`ul`,{"data-testid":`reach-gaps`,children:c.gaps.map(e=>(0,X.jsxs)(`li`,{children:[`? `,e.expression,` `,(0,X.jsx)(`span`,{className:`muted`,children:e.reason}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[Ew(e.evidence.file),`:`,e.evidence.span.start.line]})]},e.site))}),c.exits.length>0&&(0,X.jsx)(`ul`,{"data-testid":`reach-exits`,children:c.exits.map(e=>(0,X.jsxs)(`li`,{children:[e.expression,` `,(0,X.jsx)(`span`,{className:`muted`,children:e.exit.packageName??`runtime`}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[Ew(e.evidence.file),`:`,e.evidence.span.start.line]})]},e.id))})]})]})}function kw(){return[{selector:`node`,style:{shape:`round-rectangle`,width:210,height:48,label:`data(label)`,"text-wrap":`wrap`,"text-max-width":`194px`,"text-valign":`center`,"text-halign":`center`,"font-size":14,color:Z(`gray-26`),"background-color":Z(`gray-100`),"border-width":1,"border-color":Z(`gray-86`)}},{selector:`node.root`,style:{"border-color":Z(`blue-56`),"border-width":2,"font-weight":`bold`}},{selector:`node.start`,style:{"border-color":Z(`green-57`),"border-width":2}},{selector:`node.port.gap`,style:{"border-style":`dotted`,"border-color":Z(`red-54`),color:Z(`red-44`),"background-color":Z(`gray-98-9`)}},{selector:`node.port.exit`,style:{"border-style":`double`,"border-width":3,"border-color":Z(`blue-62`),color:Z(`blue-47`)}},{selector:`edge`,style:{width:1.5,"curve-style":`bezier`,"line-color":Z(`gray-44`),"target-arrow-shape":`triangle`,"target-arrow-color":Z(`gray-44`),"arrow-scale":.8,label:`data(label)`,"font-size":11,color:Z(`gray-51-2`),"text-background-color":Z(`gray-100`),"text-background-opacity":1}},{selector:`edge.candidate`,style:{"line-style":`dashed`,"line-color":Z(`gray-67`)}},{selector:`edge.stop.gap`,style:{"line-style":`dotted`,"line-color":Z(`red-54`),"target-arrow-shape":`none`}},{selector:`edge.stop.exit`,style:{"line-color":Z(`blue-62`),"target-arrow-color":Z(`blue-62`)}},{selector:`.picked`,style:{"line-color":Z(`blue-56`),"target-arrow-color":Z(`blue-56`),width:3}}]}function Aw(e,t,n){let r=new Map,i=e=>{let t=r.get(e.id);return t||r.set(e.id,t={kind:`function`,end:e,out:[],into:[]}),t};for(let n of t)n.from.file===e&&i(n.from).out.push(n);for(let t of n)t.to.file===e&&i(t.to).into.push(t);let a=e=>e.end.title!==void 0&&e.end.suite!==void 0&&e.into.length===0&&e.out.length>0?`${e.end.suite}\u0000${[...new Set(e.out.map(e=>e.to.id))].sort().join(`\0`)}`:null,o=new Map;for(let e of r.values()){let t=a(e);t!==null&&o.set(t,[...o.get(t)??[],e])}let s=[],c=new Set;for(let e of r.values()){let t=a(e),n=t===null?void 0:o.get(t);if(!n||n.length<2){s.push(e);continue}if(c.has(t))continue;c.add(t);let r=new Map(n.flatMap(e=>e.out.map(e=>[e.to.id,e.to])));s.push({kind:`suite`,suite:e.end.suite,callees:[...r.values()],tests:n})}return s}var jw={focus:3,site:2,call:1},Mw=e=>e.end.column<=1&&e.end.line>e.start.line?e.end.line-1:e.end.line;function Nw(e,t){if(e.kind!==`call`||Mw(e)===e.start.line)return e;let n=Array.from(t(e.start.line)??``),r=n.indexOf(`(`,e.start.column-1),i=r>=0?r+2:n.length+1;return{...e,end:{line:e.start.line,column:i}}}function Pw(e,t){let n=t=>e.lines[t-e.startLine],r=t.map(e=>Nw(e,n)),i=r.map(e=>(e.end.line-e.start.line)*1e4+(e.end.column-e.start.column)),a=new Map;r.forEach((t,n)=>{let r=Math.max(t.start.line,e.startLine),i=Math.min(Mw(t),e.startLine+e.lines.length-1);for(let e=r;e<=i;e++){let t=a.get(e);t?t.push(n):a.set(e,[n])}});let o=new Set;return e.lines.map((t,n)=>{let s=e.startLine+n,c=Array.from(t),l=c.map(()=>null);for(let e of a.get(s)??[]){let t=r[e],n=s===t.start.line?t.start.column-1:0,a=s===t.end.line?t.end.column-1:c.length;for(let o=Math.max(0,n);o<Math.min(c.length,a);o++){let n=l[o];(n==null||jw[t.kind]>jw[r[n].kind]||jw[t.kind]===jw[r[n].kind]&&i[e]<i[n])&&(l[o]=e)}}let u=[];return c.forEach((e,t)=>{let n=u[u.length-1],r=l[t]??null;if(n&&n.mark===r)n.text+=e;else{let t=r!==null&&!o.has(r);r!==null&&o.add(r),u.push({text:e,mark:r,first:t})}}),{n:s,runs:u,focus:r.some(e=>e.kind===`focus`&&s>=e.start.line&&s<=Mw(e))}})}function Fw({snippet:e,marks:t,focusLine:n,testId:r,className:i}){let a=(0,y.useRef)(null),o=(0,y.useMemo)(()=>Pw(e,t),[e,t]);(0,y.useEffect)(()=>{let e=a.current,t=e?.querySelector(`[data-line="${n}"]`);e&&t&&(e.scrollTop=Math.max(0,t.offsetTop-e.clientHeight/3))},[e,n]);let s=e=>{let n=e?.closest(`[data-mark]`);if(!n)return!1;let r=t[Number(n.dataset.mark)];return r?.onClick?(r.onClick(),!0):!1};return(0,X.jsx)(`pre`,{className:`code ${i??``}`,"data-testid":r,ref:a,onClick:e=>s(e.target),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&s(e.target)&&e.preventDefault()},children:o.map(({n:e,runs:n,focus:r})=>(0,X.jsxs)(`div`,{"data-line":e,className:r?`focus-line`:``,children:[(0,X.jsx)(`span`,{className:`ln`,"aria-hidden":`true`,children:e}),` `,n.map((e,n)=>{if(e.mark===null)return e.text;let r=t[e.mark],i=r.kind===`focus`?`hit`:r.kind===`site`?`site-mark`:`call-mark`,a=!!r.onClick;return(0,X.jsx)(`span`,{className:`mark ${i}${a?` clickable`:``}`,"data-mark":e.mark,title:r.title,...a&&e.first?{role:`button`,tabIndex:0}:{},children:e.text},n)})]},e))})}function Iw({title:e,location:t,snippet:n,marks:r,focusLine:i,onClose:a}){let o=(0,y.useRef)(null),s=(0,y.useRef)(null);return(0,y.useEffect)(()=>{o.current?.focus();let e=e=>{if(e.key===`Escape`)e.stopPropagation(),a();else if(e.key===`Tab`&&s.current){let t=s.current.querySelectorAll(`button, [tabindex="0"]`),n=t[0],r=t[t.length-1];s.current.contains(document.activeElement)?e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus()):(e.preventDefault(),n?.focus())}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[a]),(0,X.jsx)(`div`,{className:`backdrop`,onMouseDown:e=>e.target===e.currentTarget&&a(),children:(0,X.jsxs)(`div`,{className:`modal code-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":e,"data-testid":`code-modal`,ref:s,tabIndex:-1,children:[(0,X.jsxs)(`div`,{className:`evidence-head`,children:[(0,X.jsx)(`h3`,{children:e}),(0,X.jsx)(`code`,{className:`muted small`,children:t}),(0,X.jsx)(`button`,{ref:o,className:`icon close`,"aria-label":`Close (Esc)`,title:`Close (Esc)`,onClick:a,children:`×`})]}),n?(0,X.jsx)(Fw,{snippet:n,marks:r,focusLine:i,testId:`modal-code`,className:`large`}):(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`}),(0,X.jsx)(`p`,{className:`muted small`,children:`Use your browser's find (⌘F / Ctrl+F) to search the code.`})]})})}var Lw=(e,t,n=`${t}s`)=>`${e.toLocaleString(`en-US`)} ${e===1?t:n}`;function Rw({project:e,run:t,from:n,to:r,onOpenFile:i}){let[a,o]=(0,y.useState)([]),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1),d=mS(),f=JSON.stringify([e,t,n,r,d]),p=(0,y.useRef)(f);if(p.current=f,(0,y.useEffect)(()=>{let t=!1;return o([]),c(null),Y.callsBetween(e,n,r,0,d).then(e=>!t&&o([e]),e=>!t&&c(e.message)),()=>{t=!0}},[f]),s)return(0,X.jsx)(`p`,{className:`hint error`,children:s});let m=a[0];if(!m)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});let h=a.flatMap(e=>e.calls),g=m.pair.summary,_=new Map;for(let e of h)_.set(e.from.path,[..._.get(e.from.path)??[],e]);let v=()=>{if(l)return;let t=f;u(!0),Y.callsBetween(e,n,r,h.length,d).then(e=>{p.current===t&&o(t=>[...t,e])},e=>c(e.message)).finally(()=>u(!1))};return(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`pair-details`,children:[(0,X.jsxs)(`h3`,{children:[m.pair.from.name,` → `,m.pair.to.name]}),(0,X.jsxs)(`p`,{"data-testid":`pair-summary`,children:[m.pair.from.name,` calls into `,m.pair.to.name,`: `,Lw(g.calls,`call`),` from`,` `,Lw(g.callers,`function`),` to `,Lw(g.callees,`function`),g.references?`, ${Lw(g.references,`reference`)}`:``,` (`,Lw(g.imports,`import`),`)`]}),g.calls===0&&(0,X.jsx)(`p`,{className:`small muted`,children:g.references?`No calls: functions are handed on between them (references).`:`No calls: only imports link them.`}),[..._].map(([e,t])=>(0,X.jsxs)(`div`,{className:`pair-file`,children:[(0,X.jsx)(`h4`,{className:`small`,children:(0,X.jsx)(`button`,{className:`link`,onClick:()=>i(t[0].from.file),children:e})}),(0,X.jsx)(`ul`,{className:`plain`,"data-testid":`pair-calls`,children:t.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`button`,{className:`link`,onClick:()=>i(e.from.file),children:Se(e.from)}),` `,(0,X.jsxs)(`span`,{className:`small muted`,children:[`:`,e.evidence.span.start.line]}),` →`,` `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>i(e.to.file),children:Se(e.to)}),` `,(0,X.jsxs)(`span`,{className:`small muted`,children:[`(`,e.to.path,`)`]})]},e.id))})]},e)),h.length<m.total&&(0,X.jsx)(`button`,{className:`link small`,"data-testid":`pair-more`,disabled:l,onClick:v,children:l?`Loading…`:`${m.total-h.length} more calls…`}),m.pair.references.length>0&&(0,X.jsxs)(`details`,{children:[(0,X.jsxs)(`summary`,{className:`small`,children:[`References (`,g.references,`)`]}),(0,X.jsx)(`ul`,{className:`plain small`,children:m.pair.references.map(e=>(0,X.jsxs)(`li`,{children:[Se(e.from),` hands on `,Se(e.to),` (`,e.to.path,`) · `,e.context,` · line`,` `,e.evidence.span.start.line]},e.id))})]}),m.pair.imports.length>0&&(0,X.jsxs)(`details`,{children:[(0,X.jsxs)(`summary`,{className:`small`,children:[`Imports (`,g.imports,`)`]}),(0,X.jsx)(`ul`,{className:`plain small`,"data-testid":`pair-imports`,children:m.pair.imports.map(e=>(0,X.jsxs)(`li`,{children:[e.path,`:`,e.evidence.span.start.line,` · `,(0,X.jsx)(`code`,{children:e.specifier})]},e.id))})]})]})}var zw={repository:`repository`,"workspace-package":`workspace package`,cluster:`cluster`,module:`module`,shared:`shared layer`};function Bw(e){let{project:t,run:n,pick:r,file:i,fileLevel:a}=e;return a&&i&&r?.startsWith(`CALLS_CROSS_FILE|`)?(0,X.jsx)(Zw,{project:t,run:n,file:i,call:r}):a&&i&&(r?.startsWith(`IMPORTS|`)||r?.startsWith(`unresolved-import|`))?(0,X.jsx)(eT,{project:t,run:n,file:i,edge:r}):a&&i?(0,X.jsx)(Gw,{project:t,run:n,file:i,onOpenFile:e.onOpenFile}):r&&(r.startsWith(`DEPENDS_ON|`)||r.startsWith(`arrow|`))?(0,X.jsx)(Vw,{...e,arrow:r}):r&&r.startsWith(`calls|`)?(0,X.jsx)(Hw,{...e,link:r}):r&&r.startsWith(`folder|`)?(0,X.jsx)(Jw,{...e,folder:r}):r&&!r.startsWith(`group|`)?(0,X.jsx)(Gw,{project:t,run:n,file:r,onOpenFile:e.onOpenFile,canOpen:!0}):(0,X.jsx)(Uw,{project:t,run:n,group:e.group,pick:r,onOpenGroup:e.onOpenGroup,onPick:e.onPick})}function Vw({project:e,run:t,arrow:n,onOpenFile:r}){let{groups:i}=bS(e,t);if(!i)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});let a=null;if(n.startsWith(`DEPENDS_ON|`)){let e=i.dependsOn.find(e=>e.id===n);e&&(a=[[e.from],[e.to]])}else{let[e,t]=n.slice(6).split(`|`).map(decodeURIComponent);e&&t&&(a=[[e],[t]])}return!a||a[0].length===0||a[1].length===0?(0,X.jsx)(`p`,{className:`hint`,children:`That arrow isn't on the map any more.`}):(0,X.jsx)(Rw,{project:e,run:t,from:a[0],to:a[1],onOpenFile:r})}function Hw({project:e,run:t,group:n,link:r,expand:i,showPending:a,onOpenFile:o}){let{group:s}=xS(e,t,n,i,a);if(!s)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});let c=[...s.calls,...s.callStubEdges].find(e=>e.id===r);return c?(0,X.jsx)(Rw,{project:e,run:t,from:[c.from],to:[(e=>e.startsWith(`stub|`)?e.slice(5):e)(c.to)],onOpenFile:o}):(0,X.jsx)(`p`,{className:`hint`,children:`That link isn't drawn any more.`})}function Uw({project:e,run:t,group:n,pick:r,onOpenGroup:i,onPick:a}){let{groups:o}=bS(e,t),s=n??(o?.total===1?o.groups[0].id:r),c=s&&o?o.groups.find(e=>e.id===s):void 0;if(!o)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});if(!o.stage2)return(0,X.jsx)(`p`,{className:`hint`,children:`Stage 2 hasn't run on this project, so there are no groups yet.`});if(!c)return(0,X.jsx)(`p`,{className:`hint`,children:`Pick a group on the map to see what it holds and what it depends on; double-click or press Enter to open it.`});let u=e=>o.groups.find(t=>t.id===e)?.name??e,d=o.dependsOn.filter(e=>e.from===c.id&&l(e)),f=o.dependsOn.filter(e=>e.to===c.id&&l(e)),p=o.dependsOn.filter(e=>(e.from===c.id||e.to===c.id)&&!l(e)),m=c.findings,h=(e,t,r)=>e.length===0?(0,X.jsx)(`p`,{className:`small muted`,"data-testid":r,children:`None`}):(0,X.jsx)(`ul`,{className:`plain`,"data-testid":r,children:e.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`button`,{className:`link`,onClick:()=>n?i(e[t]):a(e[t]),children:u(e[t])}),` `,(0,X.jsx)(`span`,{className:`small muted`,children:l(e)?JC(e):`${e.imports} import${e.imports===1?``:`s`}, no call`})]},e.id))});return(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`group-details`,children:[(0,X.jsx)(`h3`,{children:c.name}),(0,X.jsxs)(`p`,{className:`muted small`,children:[c.source,` · `,zw[c.kind]??c.kind,c.root?` · ${c.root}`:``]}),c.why&&(0,X.jsx)(`p`,{className:`small`,"data-testid":`group-why`,children:c.why}),(()=>{let e=o.differences?.find(e=>e.connected.some(e=>e.id===c.id));return e?(0,X.jsx)(`p`,{className:`small`,"data-testid":`group-differs`,children:ZC(c.id,e)}):null})(),(0,X.jsxs)(`p`,{children:[c.files.toLocaleString(),` files · `,c.functions.toLocaleString(),` functions · `,c.externalPackages,` `,`external package`,c.externalPackages===1?``:`s`]}),m.broken+m.notAnalyzed+m.openCalls+m.pending>0&&(0,X.jsx)(`p`,{className:`small`,"data-testid":`group-findings`,children:[m.broken?`${m.broken} broken import${m.broken===1?``:`s`}`:``,m.notAnalyzed?`${m.notAnalyzed} import${m.notAnalyzed===1?``:`s`} of files not analyzed`:``,m.openCalls?`${m.openCalls} open question${m.openCalls===1?``:`s`}`:``,m.pending?`${m.pending} pending`:``].filter(Boolean).join(` · `)}),(0,X.jsx)(`h4`,{className:`small role-into`,children:`▶ Calls into`}),h(d,`to`,`calls-into`),(0,X.jsx)(`h4`,{className:`small role-from`,children:`◀ Called from`}),h(f,`from`,`called-from`),p.some(e=>e.from===c.id)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h4`,{className:`muted small`,title:`Type-only, value-only or unused imports: no path, so no arrow`,children:`Imports from, no calls`}),h(p.filter(e=>e.from===c.id),`to`,`imports-only`)]}),p.some(e=>e.to===c.id)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h4`,{className:`muted small`,title:`Type-only, value-only or unused imports: no path, so no arrow`,children:`Imported by, no calls`}),h(p.filter(e=>e.to===c.id),`from`,`imported-only`)]}),!n&&o.total>1&&(0,X.jsxs)(`button`,{"data-command":`open-group`,"data-testid":`open-picked`,onClick:()=>i(c.id),children:[`Open `,c.name]})]})}var Ww=e=>e.slice(e.indexOf(`:`)+1);function Gw({project:e,run:t,file:n,onOpenFile:r,canOpen:i=!1}){let{imports:a,error:o}=SS(e,t,n),{groups:s}=bS(e,t),{calls:c,error:l}=TS(e,t,i?null:n);if(o)return(0,X.jsx)(`p`,{className:`hint error`,children:o});if(!a)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});let u=a.file.group?s?.groups.find(e=>e.id===a.file.group):void 0,d=u&&u.kind!==`cluster`?u.root:``;return(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`file-details`,children:[(0,X.jsx)(`h3`,{className:`mono`,children:aS(a.file.path,d)}),(0,X.jsx)(`p`,{className:`muted small`,children:u?`${u.name} · ${u.source}`:Ww(n)}),l&&(0,X.jsxs)(`p`,{className:`small error`,children:[`Calls across files: `,l]}),c&&(0,X.jsx)(qw,{file:n,calls:c,onOpenFile:r}),(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Imports (`,a.total,`)`]}),a.imports.length===0?(0,X.jsx)(`p`,{className:`small muted`,children:`None`}):(0,X.jsx)(`ul`,{className:`plain`,"data-testid":`file-imports`,children:a.imports.map(e=>(0,X.jsxs)(`li`,{className:e.outcome===`broken`?`broken`:void 0,"data-outcome":e.outcome,children:[(0,X.jsx)(`span`,{className:`mono small`,children:e.specifier}),` `,e.outcome===`file`&&e.file?(0,X.jsx)(`button`,{className:`link small`,onClick:()=>r(e.file.id),children:e.file.path}):e.outcome===`package`&&e.package?(0,X.jsxs)(`span`,{className:`small muted`,children:[`package `,e.package.name,e.package.version?` ${e.package.version}`:``]}):(0,X.jsxs)(`span`,{className:`small outcome`,children:[`(`,e.outcome===`not-analyzed`?`not analyzed`:e.outcome,`:`,` `,eS[e.reason??``]??e.reason,`)`]})]},e.id))}),a.truncated&&(0,X.jsxs)(`p`,{className:`small muted`,children:[`Showing `,a.imports.length,` of `,a.total,`.`]}),(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Imported by (`,a.importedBy.total,`)`]}),a.importedBy.files.length===0?(0,X.jsx)(`p`,{className:`small muted`,children:`None`}):(0,X.jsx)(`ul`,{className:`plain`,"data-testid":`file-importers`,children:a.importedBy.files.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(`button`,{className:`link small`,onClick:()=>r(e.file.id),children:e.file.path})},e.id))}),i&&(0,X.jsx)(`button`,{"data-command":`open-imports-file`,"data-testid":`open-picked-file`,onClick:()=>r(n),children:`Open file`})]})}function Kw({end:e}){let{name:t,parent:n,test:r}=xe(e);return(0,X.jsxs)(X.Fragment,{children:[r&&(0,X.jsx)(`small`,{className:`tag`,children:`test`}),` `,(0,X.jsx)(`strong`,{title:e.name,children:t}),n&&(0,X.jsxs)(`span`,{className:`small muted`,children:[` in `,n]})]})}function qw({file:e,calls:t,onOpenFile:n}){let r=Aw(e,t.out.calls,t.in.calls);if(r.length===0)return(0,X.jsx)(`p`,{className:`small muted`,children:`No calls to or from other files.`});let i=r.reduce((e,t)=>e+(t.kind===`suite`?t.tests.length:1),0),a=t.out.truncated||t.in.truncated,o=e=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{className:`link`,title:e.to.name,onClick:()=>n(e.to.file),children:Se(e.to)}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[`(`,e.to.path,`)`]})]});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Functions calling across files (`,i,`)`]}),(0,X.jsx)(`ul`,{className:`plain`,"data-testid":`file-function-calls`,children:r.map(e=>e.kind===`suite`?(0,X.jsx)(`li`,{"data-testid":`suite-calls`,children:(0,X.jsxs)(`details`,{children:[(0,X.jsxs)(`summary`,{children:[(0,X.jsx)(`small`,{className:`tag`,children:`test`}),` `,(0,X.jsxs)(`strong`,{children:[`“`,e.suite,`”`]}),(0,X.jsxs)(`span`,{className:`small`,children:[` `,`· `,e.tests.length,` tests call`,` `,e.callees.map((e,t)=>(0,X.jsxs)(`span`,{children:[t>0&&`, `,(0,X.jsx)(`button`,{className:`link`,title:e.name,onClick:()=>n(e.file),children:Se(e)}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[`(`,e.path,`)`]})]},e.id))]})]}),(0,X.jsx)(`ul`,{className:`plain small suite-tests`,children:e.tests.map(e=>(0,X.jsxs)(`li`,{"data-function":e.end.id,children:[(0,X.jsx)(`span`,{title:e.end.name,children:xe(e.end).name}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[`· line `,e.out.map(e=>e.evidence.span.start.line).join(`, `)]})]},e.end.id))})]})},`suite|${e.tests[0].end.id}`):(0,X.jsxs)(`li`,{"data-function":e.end.id,children:[(0,X.jsx)(Kw,{end:e.end}),e.out.length>0&&(0,X.jsxs)(`div`,{className:`small`,children:[`calls`,` `,e.out.map((e,t)=>(0,X.jsxs)(`span`,{children:[t>0&&`, `,o(e),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[`at line `,e.evidence.span.start.line]})]},e.id))]}),e.into.length>0&&(0,X.jsxs)(`div`,{className:`small`,children:[`called by`,` `,e.into.map((e,t)=>(0,X.jsxs)(`span`,{children:[t>0&&`, `,(0,X.jsx)(`button`,{className:`link`,title:e.from.name,onClick:()=>n(e.from.file),children:Se(e.from)}),` `,(0,X.jsxs)(`span`,{className:`muted`,children:[`(`,e.from.path,`)`]})]},e.id))]})]},e.end.id))}),a&&(0,X.jsx)(`p`,{className:`small muted`,children:`The first 500 calls each way are listed.`})]})}function Jw({project:e,run:t,group:n,folder:r,expand:i,showPending:a,onToggleFolder:o}){let{groups:s}=bS(e,t),{group:c}=xS(e,t,n??(s?.total===1?s.groups[0].id:null),i,a),l=c?.nodes.find(e=>e.id===r);return!l||l.kind!==`folder`?(0,X.jsx)(`p`,{className:`hint`,children:`Pick a file or a folder in the group.`}):(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`folder-details`,children:[(0,X.jsxs)(`h3`,{className:`mono`,children:[l.path,`/`]}),(0,X.jsxs)(`p`,{children:[l.files.toLocaleString(),` files`]}),l.findings.broken>0&&(0,X.jsxs)(`p`,{className:`small`,children:[l.findings.broken,` broken import`,l.findings.broken===1?``:`s`]}),(0,X.jsx)(`button`,{"data-command":`toggle-folder`,onClick:()=>o(l.path),children:`Open the folder`})]})}function Yw({project:e,run:t,file:n,span:r}){let[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(!1),c=(0,y.useCallback)(()=>s(!1),[]),l=`${t}|${n}|${r.start.offset}|${r.end.offset}`;if((0,y.useEffect)(()=>{let t=!1;return a(null),Y.snippet(e,n,r).then(e=>!t&&a(e),()=>!t&&a(`error`)),()=>{t=!0}},[e,l]),!i)return null;if(i===`error`)return(0,X.jsx)(`p`,{className:`small muted`,children:`The code couldn't be loaded.`});let u=[{start:r.start,end:r.end,kind:`focus`}];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fw,{snippet:i,marks:u,focusLine:r.start.line,testId:`snippet`}),(0,X.jsx)(`button`,{className:`button-link small`,"data-testid":`expand-code`,onClick:()=>s(!0),children:`Expand`}),o&&(0,X.jsx)(Iw,{title:Ww(n),location:`${Ww(n)}:${r.start.line}`,snippet:i,marks:u,focusLine:r.start.line,onClose:c})]})}function Xw({file:e,span:t}){return(0,X.jsx)(`p`,{className:`location small`,"data-testid":`evidence-location`,children:(0,X.jsxs)(`code`,{children:[Ww(e),`:`,t.start.line,`:`,t.start.column]})})}function Zw({project:e,run:t,file:n,call:r}){let{calls:i}=TS(e,t,n),a=i?[...i.out.calls,...i.in.calls].find(e=>e.id===r):void 0;if(!i)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});if(!a)return(0,X.jsx)(`p`,{className:`hint`,children:`Pick a call or an import on the canvas.`});let o=a.via===`import`?`found by import analysis${a.hops?.length?`, through ${a.hops.length} re-export${a.hops.length===1?``:`s`}`:``}`:a.via===`component`?`found by component linking`:a.via===`injection`?`found by dependency injection: the class the framework provides`:a.via===`returned`?`found by following what a function returns`:a.via===`flow`?`found by following where the value comes from: fields, instances and methods`:a.via===`closed-world`?`found assuming the analyzed code is the whole program (closed world, a project setting)`:`found by the template link`,s=a.steps?.find(e=>e.kind===`import`);return(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`call-details`,children:[(0,X.jsxs)(`h3`,{"data-testid":`evidence-title`,children:[Se(a.from),` calls `,Se(a.to)]}),(0,X.jsxs)(`p`,{className:`muted small`,children:[`across files · `,o]}),s&&(0,X.jsx)(`p`,{className:`small`,"data-testid":`call-import`,children:s.detail}),a.hops&&a.hops.length>0&&(0,X.jsxs)(`p`,{className:`small muted`,children:[`through `,a.hops.join(` › `)]}),a.provenance&&(0,X.jsxs)(`p`,{className:`muted small`,"data-testid":`evidence-provenance`,children:[`Found by `,Ce(a.provenance.stage),` · run `,a.provenance.run]}),(0,X.jsx)(Xw,{file:a.evidence.file,span:a.evidence.span}),(0,X.jsx)(Yw,{project:e,run:t,file:a.evidence.file,span:a.evidence.span}),(0,X.jsx)(Re,{project:e,id:a.id},a.id)]})}function Qw(e){if(e.uses===null)return`its use isn't known`;if(e.unused)return`never used`;let t=[],n=e.uses;return n.calls&&t.push(`called ${n.calls}×`),n.jsx&&t.push(`rendered ${n.jsx}×`),n.values&&t.push(`used ${n.values}×`),n.types&&t.push(`as a type ${n.types}×`),n.extends&&t.push(`extended`),n.reexports&&t.push(`exported again`),t.join(`, `)}function $w({names:e}){return(0,X.jsxs)(`div`,{className:`imported-names`,"data-testid":`import-names`,children:[(0,X.jsxs)(`h4`,{className:`muted small`,children:[`Names (`,e.length,`)`]}),(0,X.jsx)(`ul`,{children:e.map(e=>(0,X.jsxs)(`li`,{"data-testid":`import-name`,"data-unused":e.unused||void 0,children:[(0,X.jsx)(`span`,{className:`mono small`,children:e.local}),` `,(0,X.jsxs)(`span`,{className:`small`,children:[e.target?e.target.kind===`package`?`from ${e.target.label}`:`${e.target.kind===`symbol`?`${e.target.symbolKind} `:e.target.kind===`module`?`module `:``}${e.target.kind===`module`?``:e.target.label}${e.target.path?` in ${e.target.path}`:``}`:e.outcome===`not-exported`?`not exported there`:`doesn't resolve (${e.outcome})`,` · `,(0,X.jsx)(`span`,{className:e.unused?`unused`:`muted`,children:Qw(e)})]})]},e.id))})]})}function eT({project:e,run:t,file:n,edge:r}){let{imports:i}=SS(e,t,n);if(!i)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`});let a=i.imports.find(e=>e.id===r),o=i.importedBy.files.find(e=>e.id===r);if(!a&&!o)return(0,X.jsx)(`p`,{className:`hint`,children:`Pick a call or an import on the canvas.`});let s=a?.evidence??o.evidence;return(0,X.jsxs)(`div`,{className:`evidence imports-details`,"data-testid":`import-details`,children:[(0,X.jsx)(`h3`,{"data-testid":`evidence-title`,children:a?`imports ${a.specifier}`:`${o.file.path} imports this file`}),a?.file&&(0,X.jsxs)(`p`,{className:`small`,children:[`resolves to `,a.file.path]}),a&&!a.file&&!a.package&&(0,X.jsxs)(`p`,{className:`small`,"data-testid":`import-outcome`,children:[a.outcome===`not-analyzed`?`not analyzed`:a.outcome,`:`,` `,eS[a.reason??``]??a.reason]}),a?.steps.map((e,t)=>(0,X.jsx)(`p`,{className:`small muted`,children:e.detail},t)),a?.names&&a.names.length>0&&(0,X.jsx)($w,{names:a.names}),(a?.provenance??o?.provenance)&&(0,X.jsxs)(`p`,{className:`muted small`,"data-testid":`evidence-provenance`,children:[`Found by `,Ce((a?.provenance??o.provenance).stage),` · run`,` `,(a?.provenance??o.provenance).run]}),(0,X.jsx)(Xw,{file:s.file,span:s.span}),(0,X.jsx)(Yw,{project:e,run:t,file:s.file,span:s.span}),(0,X.jsx)(Re,{project:e,id:r},r)]})}var tT=o(),nT=(e,t)=>`${e.toLocaleString(`en-US`)} ${t}${e===1?``:`s`}`,rT=8,iT=50,aT={installed:`installed by a package manager`,packages:`copied packages with their own manifests`,banners:`a library banner or versioned name`};function oT(e){return`${[e.name==="default"||e.name===null?``:e.name,e.member??``].filter(Boolean).join(e.member?.startsWith(`(`)?``:`.`)||`default`}${e.instance?` (on an instance)`:``}`}function sT({project:e,source:t,pkg:n,onOpen:r}){let[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(null),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(!1);(0,y.useEffect)(()=>{if(!i||o)return;let r=!0;return Y.library(e,n.name,n.ecosystem,t).then(e=>r&&s(e)).catch(e=>r&&l(e.message)),()=>{r=!1}},[i,o,e,n.name,n.ecosystem,t]);let f=n.files>0&&n.ownFiles===0,p=o?u?o.members:o.members.slice(0,rT):[];return(0,X.jsxs)(`li`,{children:[(0,X.jsxs)(`button`,{className:`library-row`,"data-testid":`library-package`,"data-name":n.name,"aria-expanded":i,title:`${n.name}${n.versions.length?` ${n.versions.join(`, `)}`:``}: imported by ${nT(n.files,`file`)} (${n.ownFiles.toLocaleString(`en-US`)} own code) in ${nT(n.groups,`group`)} · ${nT(n.calls,`call`)}${n.references?`, ${nT(n.references,`reference`)}`:``}`,onClick:()=>a(e=>!e),children:[(0,X.jsx)(`span`,{className:`caret`,"aria-hidden":`true`,children:i?`▾`:`▸`}),(0,X.jsx)(`span`,{className:`name`,children:n.name}),n.versions.length>0&&(0,X.jsx)(`small`,{className:`muted`,children:n.versions.join(`, `)}),n.typeOnly&&(0,X.jsx)(`small`,{className:`tag`,title:"Every import of it is `import type`: nothing of it runs",children:`types`}),f&&(0,X.jsx)(`small`,{className:`tag`,title:`Imported only by tests, libraries or generated files`,children:`not own code`}),(0,X.jsx)(`small`,{className:`count`,children:n.files})]}),i&&(0,X.jsxs)(`div`,{className:`library-detail`,"data-testid":`library-detail`,children:[c&&(0,X.jsx)(`p`,{className:`hint error`,children:c}),!o&&!c&&(0,X.jsx)(`p`,{className:`hint`,children:`Loading…`}),o&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`small muted`,children:o.members.length===0?n.typeOnly?`Only its types are imported.`:`Nothing of it is called where the analysis can tell.`:`Used: ${nT(n.calls,`call`)}${n.references?`, ${nT(n.references,`reference`)}`:``}`}),p.length>0&&(0,X.jsx)(`ul`,{className:`library-members`,children:p.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`code`,{children:oT(e)}),(0,X.jsx)(`small`,{className:`count`,children:e.calls+e.references})]},`${e.name}|${e.member}|${e.instance}`))}),o.members.length>rT&&(0,X.jsx)(`button`,{className:`link small`,onClick:()=>d(e=>!e),children:u?`fewer`:`${o.members.length-rT} more`}),(0,X.jsx)(`p`,{className:`small muted`,children:`Imported by`}),(0,X.jsx)(`ul`,{className:`library-files`,children:o.importers.slice(0,iT).map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(`button`,{className:`link`,"data-command":`library-file`,"data-file":e.path,title:`${e.path}${e.group?` (${e.group.name})`:``}${e.own?``:`: not own code`}${e.forms.includes(`type-only`)?` · types`:``}`,onClick:()=>r(e.file),children:e.path})},e.file))}),o.importers.length>iT&&(0,X.jsxs)(`p`,{className:`small muted`,children:[`and `,nT(o.importers.length-iT,`more file`)]})]})]})]})}function cT({project:e,run:t,source:n,filter:r,onOpen:i}){let[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(``);if((0,y.useEffect)(()=>{let t=!0;return c(``),Y.libraries(e,n).then(e=>t&&o(e)).catch(e=>t&&c(e.message)),()=>{t=!1}},[e,n,t]),s)return(0,X.jsx)(`p`,{className:`hint error`,children:s});if(!a)return(0,X.jsx)(`p`,{className:`hint`,children:`Loading libraries…`});let l=r.trim().toLowerCase(),u=a.packages.filter(e=>!l||e.name.toLowerCase().includes(l)),d=a.copied.filter(e=>!l||e.path.toLowerCase().includes(l)),f=a.leftOut.filter(e=>!l||e.path.toLowerCase().includes(l)),p=new Set([...a.copied,...a.leftOut].map(e=>e.source)).size>1,m=e=>p?`${e.source}/${e.path}`:e.path;return(0,X.jsxs)(`div`,{className:`libraries`,"data-testid":`libraries`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`h4`,{className:`outline-source`,children:[`Installed packages `,(0,X.jsx)(`small`,{className:`muted`,children:a.total})]}),a.stage2?u.length===0?(0,X.jsx)(`p`,{className:`hint`,children:l?`No packages match.`:`No file imports an installed package.`}):(0,X.jsx)(`ul`,{children:u.map(r=>(0,X.jsx)(sT,{project:e,source:n,pkg:r,onOpen:i},`${n??``}|${t??``}|${r.ecosystem}:${r.name}`))}):(0,X.jsx)(`p`,{className:`hint`,children:`Packages come from import analysis (Stage 2), which hasn't run for this project.`}),a.truncated&&(0,X.jsxs)(`p`,{className:`small muted`,children:[`The first `,nT(a.packages.length,`package`),`.`]})]}),d.length>0&&(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`h4`,{className:`outline-source`,title:`Third-party code copied into the project (plan D66)`,children:[`Copied into the project `,(0,X.jsx)(`small`,{className:`muted`,children:d.length})]}),(0,X.jsx)(`ul`,{children:d.map(e=>(0,X.jsxs)(`li`,{className:`library-row`,"data-testid":`library-copied`,title:`${m(e)}: ${aT[e.why]}${e.names.length?` (${e.names.join(`, `)})`:``}. ${e.state===`kept`?`Kept: analyzed as the project's own code.`:`Not decided: counted apart from own code until you keep it or leave it out.`}`,children:[(0,X.jsxs)(`span`,{className:`name`,children:[m(e),e.kind===`dir`?`/`:``]}),(0,X.jsx)(`small`,{className:`tag${e.state===`pending`?` warn`:``}`,children:e.state===`kept`?`kept`:`not decided`}),(0,X.jsx)(`small`,{className:`count`,children:e.files})]},`${e.source}|${e.path}`))})]}),f.length>0&&(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`h4`,{className:`outline-source`,title:`Library folders left out by default (plan D36, D57); Choose files… analyzes them`,children:[`Left out by default `,(0,X.jsx)(`small`,{className:`muted`,children:f.length})]}),(0,X.jsx)(`ul`,{children:f.map(e=>(0,X.jsxs)(`li`,{className:`library-row`,"data-testid":`library-left-out`,title:`${m(e)}/: ${e.files===null?`not read`:nT(e.files,`file`)}, not analyzed`,children:[(0,X.jsxs)(`span`,{className:`name`,children:[m(e),`/`]}),(0,X.jsx)(`small`,{className:`count`,children:e.files??`–`})]},`${e.source}|${e.path}`))})]})]})}var lT=24,uT=12,dT=300,fT=new Set([`apps`,`packages`,`services`,`libs`,`modules`,`crates`,`projects`]),pT=/(^|\/)([\w-]+\.config\.[cm]?[jt]sx?|\.?[\w-]*rc\.[cm]?[jt]s|(vite|vitest|jest|webpack|rollup|babel|eslint|prettier|tailwind|postcss|playwright|next|nuxt|svelte|astro|tsup|knip|commitlint|stylelint)\.[\w.-]*[cm]?[jt]s)$/i;function mT(e){return h(e)?`tests`:pT.test(e)?`config`:`source`}var hT=e=>e.status!==`analyzed`,gT={"parse-failure":`could not be parsed`,"declaration-file":`type declarations`,"language-not-analyzed":`language not analyzed yet`,"too-large":`too large`,binary:`not text`,minified:`minified`,"invalid-utf8":`not UTF-8 text`,unreadable:`could not be read`,entitlement:`beyond the license`,frozen:`kept from an earlier analysis (beyond the license)`},_T={degraded:`partly analyzed`,not_analyzed:`not analyzed`,parse_error:`could not be parsed`},vT=(e,t)=>e<t?-1:+(e>t);function yT(e,t,n){let r={key:``,name:``,dirs:new Map,files:[],total:0,functions:0};for(let i of e){let e=(n?`${i.source}/${i.path}`:i.path).split(`/`);e.pop();let a=r,o=t[i.id]?.functions??0;a.total++,a.functions+=o;let s=``;for(let t of e){s=s?`${s}/${t}`:t;let e=a.dirs.get(t);e||(e={key:s,name:t,dirs:new Map,files:[],total:0,functions:0},a.dirs.set(t,e)),a=e,a.total++,a.functions+=o}a.files.push(i)}return r}function bT(e,t=!1,n=0){for(let[r,i]of e.dirs)e.dirs.set(r,bT(i,t,n+1));if(e.key!==``&&!(t&&n===1)&&e.files.length===0&&e.dirs.size===1){let t=[...e.dirs.values()][0];return{...t,name:`${e.name}/${t.name}`}}return e}function xT(e,t,n){let r=[],i=(e,a)=>{let o=[...e.dirs.values()].sort((e,t)=>{if(a===0){let n=+!fT.has(e.name.split(`/`)[0]),r=+!fT.has(t.name.split(`/`)[0]);if(n!==r)return n-r}return vT(e.name,t.name)});for(let e of o){let n=t.has(e.key);r.push({type:`dir`,key:e.key,name:e.name,depth:a,open:n,total:e.total,functions:e.functions}),n&&i(e,a+1)}for(let t of[...e.files].sort((e,t)=>vT(e.path,t.path))){let e=n[t.id];r.push({type:`file`,file:t,depth:a,label:t.path.slice(t.path.lastIndexOf(`/`)+1),...e?{hint:`${e.functions}ƒ`}:{}})}};return i(e,0),r}var ST=60;function CT(e,t){let n=new Set,r=e=>{for(let t of e.dirs.values())n.add(t.key),r(t)};if(t<=ST)return r(e),n;for(let t of e.dirs.values())if(n.add(t.key),fT.has(t.name.split(`/`).pop())||fT.has(t.name.split(`/`)[0]))for(let e of t.dirs.values())n.add(e.key);return n}var wT=e=>`veoflow.tree.${e}`;function TT(e){try{let t=localStorage.getItem(wT(e)),n=t?JSON.parse(t):[];return n.length>0?new Set(n):null}catch{return null}}function ET(e,t){try{localStorage.setItem(wT(e),JSON.stringify([...t]))}catch{}}function DT({project:e,files:t,counts:n,current:r,onOpen:i,run:a=null,onAnalyze:o,sources:s=[],scope:c=null,onScope:l,onCollapse:u,onImports:d,onMenu:f,hidden:p=!1,onReveal:m}){let[h,g]=(0,y.useState)(!1),[_,v]=(0,y.useState)(``),[b,x]=(0,y.useState)({source:!0,tests:!1,config:!0}),[S,C]=(0,y.useState)(!1),[w,T]=(0,y.useState)(!1),E=(0,y.useRef)(null);a?.status===`committed`&&(E.current=a.runId);let[D,O]=(0,y.useState)(new Set),[k,A]=(0,y.useState)(0),[j,M]=(0,y.useState)(600),[N,P]=(0,y.useState)(0),F=(0,y.useRef)(null),I=(0,y.useRef)(null),L=t;t=(0,y.useMemo)(()=>c?L.filter(e=>e.source===c):L,[L,c]);let R=(0,y.useMemo)(()=>s.length>1||new Set(L.map(e=>e.source)).size>1,[L,s.length]),z=(0,y.useMemo)(()=>new Map(s.map(e=>[e.id,e])),[s]),B=e=>{let t=z.get(e)?.analysis;return t?t.kind===`git`?`${t.branch??`detached`} · ${t.revision.slice(0,7)} · ${we(t.analyzedAt)}`:`plain folder · latest only`:``},V=(0,y.useMemo)(()=>{let e={source:0,tests:0,config:0,attention:0};for(let n of t)e[mT(n.path)]++,hT(n)&&e.attention++;return e},[t]),H=(0,y.useMemo)(()=>t.filter(e=>S?hT(e):e.id===r||b[mT(e.path)]||hT(e)),[t,b,S,r]),U=(0,y.useMemo)(()=>{let e=bT(yT(H,n,R),R);return c&&R?e.dirs.get(c)??{...e,dirs:new Map,files:[]}:e},[H,n,R,c]),W=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!W.current&&e&&t.length!==0&&(W.current=!0,O(TT(e)??CT(U,t.length)))},[e,t,U]);let ee=t.find(e=>e.id===r);(0,y.useEffect)(()=>{if(!ee)return;let e=(R?`${ee.source}/${ee.path}`:ee.path).split(`/`);e.pop(),O(t=>{let n=new Set(t),r=``,i=!1;for(let t of e)r=r?`${r}/${t}`:t,n.has(r)||(n.add(r),i=!0);return i?n:t})},[ee?.id]);let G=(0,y.useMemo)(()=>{let e=_.trim().toLowerCase();return e?t.map(t=>{let n=t.path.toLowerCase(),r=n.slice(n.lastIndexOf(`/`)+1);return{f:t,rank:r.replace(/\.[^.]+$/,``)===e||r===e?0:r.startsWith(e)?1:r.includes(e)?2:n.includes(e)?3:-1,kind:mT(t.path)===`source`?0:1}}).filter(e=>e.rank>=0).sort((e,t)=>e.rank-t.rank||e.kind-t.kind||e.f.path.length-t.f.path.length||vT(e.f.path,t.f.path)).slice(0,dT).map(({f:e})=>{let t=e.path.includes(`/`)?e.path.slice(0,e.path.lastIndexOf(`/`)):``,n=R?z.get(e.source)?.name??e.source:``;return{type:`file`,file:e,depth:0,label:e.path.slice(e.path.lastIndexOf(`/`)+1),hint:[n,t].filter(Boolean).join(` · `)}}):xT(U,D,n)},[_,U,D,n,t,R,z]);(0,y.useEffect)(()=>{W.current&&e&&ET(e,D)},[D,e]),(0,y.useEffect)(()=>{N>=G.length&&P(Math.max(0,G.length-1))},[G.length,N]),(0,y.useEffect)(()=>{let e=F.current;if(!e)return;let t=new ResizeObserver(()=>M(e.clientHeight));return t.observe(e),()=>t.disconnect()},[]);let te=(0,y.useRef)(null),ne=_.trim()!==``;(0,y.useEffect)(()=>{if(p)return;let e=r?`${r}\0${ne}`:null;if(!r||te.current===e)return;let t=G.findIndex(e=>e.type===`file`&&e.file.id===r);if(t<0||!F.current)return;te.current=e;let n=t*lT,i=F.current;(n<i.scrollTop||n+lT>i.scrollTop+i.clientHeight)&&(i.scrollTop=Math.max(0,n-i.clientHeight/3),A(i.scrollTop)),P(t)},[r,G,ne,p]),(0,y.useLayoutEffect)(()=>{!p&&F.current&&A(F.current.scrollTop)},[p]);let K=(0,y.useRef)(p);K.current=p;let q=(0,y.useRef)(m);q.current=m,(0,y.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`p`){if(document.querySelector(`[role="dialog"], [role="menu"]`))return;e.preventDefault(),K.current&&q.current?.(),setTimeout(()=>{I.current?.focus(),I.current?.select()},0)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let J=e=>O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Y=e=>{let t=Math.max(0,Math.min(G.length-1,e)),n=F.current;if(n){let e=t*lT,r=n.scrollTop;e<r?r=e:e+lT>r+n.clientHeight&&(r=e+lT-n.clientHeight),n.scrollTop=r,(0,tT.flushSync)(()=>{A(r),P(t)})}else P(t);F.current?.querySelector(`[data-row="${t}"]`)?.focus({preventScroll:!0})},re=e=>{let t=G[e]?.depth??0;for(let n=e-1;n>=0;n--)if(G[n].type===`dir`&&G[n].depth<t)return n;return-1},ie=e=>{let t=G[N];if(e.key===`ArrowDown`)Y(N+1);else if(e.key===`ArrowUp`)Y(N-1);else if(e.key===`Home`)Y(0);else if(e.key===`End`)Y(G.length-1);else if(e.key===`ArrowRight`&&t?.type===`dir`)t.open?Y(N+1):J(t.key);else if(e.key===`ArrowLeft`){if(t?.type===`dir`&&t.open)J(t.key);else{let e=re(N);e>=0&&Y(e)}}else return;e.preventDefault()},ae=Math.max(0,Math.floor(k/lT)-uT),oe=Math.min(G.length,Math.ceil((k+j)/lT)+uT),se=(e,t)=>V[e]===0?null:(0,X.jsxs)(`button`,{className:`chip`,"aria-pressed":!S&&!w&&b[e],"data-testid":`chip-${e}`,disabled:V[e]===0,onClick:()=>{C(!1),w?(T(!1),x(t=>({...t,[e]:!0}))):x(t=>({...t,[e]:!t[e]}))},children:[t,` `,(0,X.jsx)(`small`,{children:V[e]})]}),ce=(0,y.useMemo)(()=>{let e=0,t=0;for(let n of a?.sources??[])e+=n.defaultExcluded?.length??0,t+=(n.ruleExcluded?.length??0)+(n.ruleExcludedMore??0);return{folders:e,paths:t}},[a]);return h&&e?(0,X.jsx)(`nav`,{className:`nav`,"aria-label":`Files`,hidden:p,children:(0,X.jsx)(iC,{project:e,files:t,run:a,onAnalyze:()=>{o?.(),g(!1)},onClose:()=>g(!1)})}):(0,X.jsxs)(`nav`,{className:`nav`,"aria-label":`Files`,hidden:p,children:[(0,X.jsxs)(`div`,{className:`nav-head`,children:[(s.length>1||c)&&(0,X.jsxs)(`label`,{className:`nav-scope`,children:[(0,X.jsx)(`span`,{className:`small muted`,children:`Scope`}),(0,X.jsxs)(`select`,{"data-command":`scope-source`,value:c??``,onChange:e=>l?.(e.target.value||null),children:[(0,X.jsx)(`option`,{value:``,children:`All repositories`}),s.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.name??e.id},e.id))]})]}),(0,X.jsxs)(`div`,{className:`outline-head`,children:[(0,X.jsx)(`input`,{ref:I,className:`nav-filter`,"data-testid":`file-filter`,type:`search`,placeholder:w?`Filter libraries…`:`Filter ${t.length} files… ⌘P`,"aria-label":w?`Filter libraries`:`Filter files`,value:_,onChange:e=>{v(e.target.value),F.current&&(F.current.scrollTop=0),P(0)},onKeyDown:e=>{if(e.key===`Enter`&&_.trim()&&!w){let e=G.find(e=>e.type===`file`);e?.type===`file`&&i(e.file.id)}else e.key===`ArrowDown`?(e.preventDefault(),w?F.current?.parentElement?.querySelector(`.libraries button, [data-testid="library-package"]`)?.focus():Y(0)):e.key===`Escape`&&v(``)}}),u&&(0,X.jsx)(`button`,{className:`icon`,title:`Hide this pane ( [ )`,"aria-label":`Hide the files pane`,onClick:u,children:`⟨`})]}),(0,X.jsxs)(`div`,{className:`nav-chips`,role:`group`,"aria-label":`Show`,children:[se(`source`,`Source`),se(`tests`,`Tests`),se(`config`,`Config`),V.attention>0&&(0,X.jsxs)(`button`,{className:`chip attention`,"aria-pressed":S&&!w,"data-testid":`chip-attention`,title:`Files that were not fully analyzed`,onClick:()=>{C(e=>w||!e),T(!1)},children:[`⚠ `,(0,X.jsx)(`small`,{children:V.attention})]}),e&&(t.length>0||w)&&(0,X.jsx)(`button`,{className:`chip`,"aria-pressed":w,"data-testid":`chip-libraries`,title:`The libraries the project uses: installed packages, copied libraries, and folders left out`,onClick:()=>{C(!1),T(e=>!e)},children:`Libraries`})]})]}),w&&e&&(0,X.jsx)(`div`,{className:`nav-list`,children:(0,X.jsx)(cT,{project:e,run:E.current,source:c,filter:_,onOpen:i})}),(0,X.jsxs)(`div`,{className:`nav-list`,hidden:w&&!!e,ref:F,role:`tree`,"aria-label":`Files`,onScroll:e=>A(e.currentTarget.scrollTop),onKeyDown:ie,children:[G.length===0&&t.length>0&&(0,X.jsx)(`p`,{className:`hint`,children:`No files match.`}),(0,X.jsx)(`div`,{style:{height:G.length*lT,position:`relative`},children:G.slice(ae,oe).map((e,t)=>{let n=ae+t,a={top:n*lT,paddingLeft:8+e.depth*14};if(e.type===`dir`&&R&&!c&&e.depth===0&&z.has(e.key))return(0,X.jsxs)(`button`,{"data-row":n,role:`treeitem`,"aria-expanded":e.open,"aria-level":1,"aria-setsize":G.length,"aria-posinset":n+1,tabIndex:n===N?0:-1,className:`row dir repo`,"data-testid":`repo-row`,"data-source":e.key,style:a,title:z.get(e.key)?.root??e.key,onClick:()=>{P(n),J(e.key)},children:[(0,X.jsx)(`span`,{className:`caret`,children:e.open?`▾`:`▸`}),(0,X.jsx)(`strong`,{className:`name`,children:z.get(e.key)?.name??e.key}),(0,X.jsx)(`small`,{className:`muted repo-hint`,children:B(e.key)}),(0,X.jsx)(`small`,{className:`count`,title:`${e.total} files, ${e.functions} functions`,children:e.total})]},`r:${e.key}`);if(e.type===`dir`)return(0,X.jsxs)(`button`,{"data-row":n,role:`treeitem`,"aria-expanded":e.open,"aria-level":e.depth+1,"aria-setsize":G.length,"aria-posinset":n+1,tabIndex:n===N?0:-1,className:`row dir`,style:a,title:e.key,onClick:()=>{P(n),J(e.key)},children:[(0,X.jsx)(`span`,{className:`caret`,children:e.open?`▾`:`▸`}),(0,X.jsx)(`span`,{className:`name`,children:e.name}),(0,X.jsx)(`small`,{className:`count`,title:`${e.total} files, ${e.functions} functions`,children:e.total})]},`d:${e.key}`);let o=e.file;return[(0,X.jsxs)(`button`,{"data-row":n,role:`treeitem`,"aria-level":e.depth+1,"aria-setsize":G.length,"aria-posinset":n+1,"aria-selected":o.id===r,tabIndex:n===N?0:-1,"data-command":`open-file`,"data-file":o.path,className:`row file ${o.id===r?`current`:``} ${o.status}`,style:a,title:o.status===`analyzed`?o.path:`${o.path}: ${_T[o.status]??o.status}${o.reason?` (${gT[o.reason]??o.reason})`:``}`,onClick:()=>{P(n),i(o.id)},onContextMenu:f&&(e=>{e.preventDefault(),f({kind:`file`,id:o.id,data:{},x:e.clientX,y:e.clientY})}),children:[(0,X.jsx)(`span`,{className:`caret`}),(0,X.jsxs)(`span`,{className:`name`,children:[e.label,_.trim()&&e.hint?(0,X.jsxs)(`small`,{className:`muted`,children:[` `,e.hint]}):null]}),o.origin&&(0,X.jsx)(`small`,{className:`origin ${o.origin}`,title:o.origin===`library`?`Installed library code, not the project's own`:o.origin===`tool`?`A tool's or coding agent's workspace, not the project's own code`:`Generated output, not the project's own code`,children:o.origin}),hT(o)?(0,X.jsxs)(`small`,{className:`warn`,"aria-label":`${_T[o.status]??o.status}${o.reason?`: ${gT[o.reason]??o.reason}`:``}`,children:[`⚠ `,gT[o.reason??``]??o.reason??o.status]}):!_.trim()&&e.hint&&(0,X.jsx)(`small`,{className:`count`,children:e.hint})]},`f:${o.id}`),d&&o.status!==`not_analyzed`&&(0,X.jsx)(`button`,{className:`row-action`,"aria-hidden":`true`,"data-command":`file-imports`,"data-file":o.path,style:{top:n*lT},tabIndex:-1,title:`Imports of ${e.label}: what it imports and what depends on it (Imports tab)`,onClick:()=>d(o.id),children:`⇄`},`i:${o.id}`)]})})]}),e&&o&&(0,X.jsxs)(`div`,{className:`nav-foot`,children:[(0,X.jsx)(`small`,{className:`muted`,"data-testid":`left-out`,children:ce.folders+ce.paths===0?``:`Left out: ${[ce.folders?`${ce.folders} by default (libraries, generated, tools)`:``,ce.paths?`${ce.paths} by your choice`:``].filter(Boolean).join(`, `)}`}),(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{"data-testid":`choose-files`,onClick:()=>g(!0),title:`Choose which files are analyzed`,children:`Choose files…`})]})]})}J_.use(Jx);var OT=14,kT={LR:70,TB:50};function AT(e){try{return MT(e)}catch{return LT(e)}}function jT(e){return{w:Math.max(1,(e.canvas.w-2*e.pad)/e.fitZoom),h:Math.max(1,(e.canvas.h-2*e.pad)/e.fitZoom)}}function MT(e){let t=jT(e),n=NT(e,`LR`,t);if(n.zoom>=e.fitZoom)return n.positions;let r=NT(e,`TB`,t);return r.zoom>n.zoom?r.positions:n.positions}function NT(e,t,n){let{nodes:r,edges:i,blocks:a}=PT(e,t,n),o=J_({headless:!0,styleEnabled:!0,elements:[...r.map(e=>({data:{id:e.id,w:e.w,h:e.h}})),...i.map(e=>({data:{id:e.id,source:e.source,target:e.target}}))],style:[{selector:`node`,style:{width:`data(w)`,height:`data(h)`}}]}),s={};try{o.layout({name:`dagre`,rankDir:t,nodeSep:OT,rankSep:kT[t],fit:!1,animate:!1}).run();for(let e of o.nodes().toArray())s[e.id()]={...e.position()}}finally{o.destroy()}for(let e of a){let n=s[e.id];delete s[e.id],FT(e,n,t,s)}let c=IT(e.nodes,s);return{positions:s,zoom:e.fitZoom*Math.min(n.w/c.w,n.h/c.h)}}function PT(e,t,n){let r=new Map;for(let t of e.edges)for(let e of t.source===t.target?[t.source]:[t.source,t.target])r.has(e)||r.set(e,[]),r.get(e).push(t);let i=new Map;for(let t of e.nodes){let e=r.get(t.id)??[];if(e.length===0)continue;let n=e.every(e=>e.source!==t.id&&e.target===t.id),a=e.every(e=>e.source===t.id&&e.target!==t.id);if(!n&&!a)continue;let o=n?e[0].source:e[0].target;if(!e.every(e=>(n?e.source:e.target)===o))continue;let s=`${o}\u0000${n?`out`:`in`}`;i.has(s)||i.set(s,{owner:o,out:n,leaves:[]}),i.get(s).leaves.push(t)}let a=[],o=new Set;for(let[e,r]of i){let i={w:Math.max(...r.leaves.map(e=>e.w)),h:Math.max(...r.leaves.map(e=>e.h))},s=t===`LR`?(n.h+OT)/(i.h+OT):(n.w+OT)/(i.w+OT),c=Math.max(1,Math.floor(s));if(r.leaves.length<=c)continue;let l=Math.ceil(r.leaves.length/c),u=Math.ceil(r.leaves.length/l),d=(e,t)=>e*(t+OT)-OT,f={id:`block:${e}`,w:d(t===`LR`?l:u,i.w),h:d(t===`LR`?u:l,i.h),leaves:r.leaves,cell:i,perLine:u};a.push(f);for(let e of r.leaves)o.add(e.id)}if(a.length===0)return{nodes:e.nodes,edges:e.edges,blocks:a};let s=[...e.nodes.filter(e=>!o.has(e.id)),...a.map(e=>({id:e.id,w:e.w,h:e.h}))],c=e.edges.filter(e=>!o.has(e.source)&&!o.has(e.target));for(let[e,t]of i){let n=`block:${e}`;a.some(e=>e.id===n)&&c.push(t.out?{id:`edge:${n}`,source:t.owner,target:n}:{id:`edge:${n}`,source:n,target:t.owner})}return{nodes:s,edges:c,blocks:a}}function FT(e,t,n,r){let i=t.x-e.w/2,a=t.y-e.h/2;e.leaves.forEach((t,o)=>{let s=Math.floor(o/e.perLine),c=o%e.perLine,[l,u]=n===`LR`?[s,c]:[c,s];r[t.id]={x:i+l*(e.cell.w+OT)+e.cell.w/2,y:a+u*(e.cell.h+OT)+e.cell.h/2}})}function IT(e,t){let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let o of e){let e=t[o.id];e&&(n=Math.min(n,e.x-o.w/2),i=Math.max(i,e.x+o.w/2),r=Math.min(r,e.y-o.h/2),a=Math.max(a,e.y+o.h/2))}return{w:Math.max(1,i-n),h:Math.max(1,a-r)}}function LT(e){let t=Math.max(1,Math.ceil(Math.sqrt(e.nodes.length))),n=Math.max(40,...e.nodes.map(e=>e.w))+24,r={};return e.nodes.forEach((e,i)=>{r[e.id]={x:i%t*n,y:Math.floor(i/t)*40}}),r}var RT=null,zT=typeof Worker>`u`,BT=0,VT=new Map,HT=e=>new Promise(t=>setTimeout(()=>t(AT(e)),0));function UT(){try{let e=new Worker(new URL(`/assets/callLayout.worker-Bq-i56H_.js`,``+import.meta.url),{type:`module`});return e.addEventListener(`message`,e=>{let t=VT.get(e.data.id);t&&(VT.delete(e.data.id),e.data.error===void 0?t.resolve(e.data.positions):(console.error(`veoflow: laying out this graph failed; placed in a grid`,e.data.error),t.resolve(LT(t.input))))}),e.addEventListener(`error`,t=>{console.error(`veoflow: the layout worker failed; laying out on the page instead`,t),zT=!0,e.terminate(),RT=null;for(let[e,t]of VT)VT.delete(e),HT(t.input).then(t.resolve)}),e}catch{return zT=!0,null}}function WT(e){if(VT.size>0&&RT&&(RT.terminate(),RT=null,VT.clear()),!zT&&!RT&&(RT=UT()),!RT)return HT(e);let t=++BT;return new Promise(n=>{VT.set(t,{input:e,resolve:n}),RT.postMessage({id:t,input:e})})}var GT=2,KT=40,qT=25,JT=7;function YT(e){let t=ZT.get(e);if(t)return t;let n=XT(e),r=new Set(e.calls.map(e=>`${e.from}\u0000${e.to}`)),i=[];for(let t of e.functions){let e=n.get(t.id);e&&e!==t.id&&!r.has(`${e}\u0000${t.id}`)&&i.push({id:`inside:${t.id}`,parent:e,child:t.id})}return ZT.set(e,i),i}function XT(e){let t=new Map(e.functions.map(e=>[e.qualifiedName,e.id])),n=new Set(t.keys()),r=new Map;for(let i of e.functions){let e=ve(i.qualifiedName,n),a=e===null?void 0:t.get(e);a&&r.set(i.id,a)}return r}var ZT=new WeakMap;function QT(e,t,n=null){let r=new Map,i=(e,t)=>{e!==t&&(r.has(e)||r.set(e,new Set),r.get(e).add(t))};for(let t of e.calls)i(t.from,t.to),i(t.to,t.from);for(let{parent:t,child:n}of YT(e))i(t,n),i(n,t);let a=e=>r.get(e)?.size??0,o=(e,t)=>[...e].sort((e,t)=>a(t)-a(e)||(e<t?-1:1)).slice(0,t),s=new Set(e.functions.map(e=>e.id));if(n&&s.has(n[0])&&s.has(n[1])){let e=new Set(n);for(let t of n)for(let n of o(r.get(t)??[],JT))e.add(n);return e}if(t&&s.has(t)){let e=new Set([t]),n=o(r.get(t)??[],qT);for(let t of n)e.add(t);for(let t=1;t<GT&&e.size<KT;t++)for(let t of n)for(let n of o(r.get(t)??[],5))e.size<KT&&e.add(n);return e}return new Set(o(s,KT))}var $T=e=>`site:${e}`,eE=(e,t)=>`pair:${e}->${t}`,tE=.85,nE=1.25,rE=45,iE=.68,aE=.15,oE=.05,sE=4,cE=36,lE=e=>Math.max(36,String(e.data(`label`)).length*7+18);function uE(e){let t=e.nodes(`[kind = "function"], [kind = "port"], [kind = "ghost"]`).not(`.hidden`),n=`[kind = "call"], [kind = "ghost-call"], [kind = "inside"]`,r=e.edges(n).not(`.hidden`),i=t.filter(e=>e.connectedEdges(n).not(`.hidden`).empty());return{fns:t,isolated:i,connected:t.difference(i).union(r)}}var dE=300;function fE(e){let{connected:t}=uE(e);return e.resize(),{nodes:t.nodes().toArray().map(e=>({id:e.id(),w:e.outerWidth(),h:e.outerHeight()})),edges:t.edges().map(e=>({id:e.id(),source:e.source().id(),target:e.target().id()})),canvas:{w:Math.max(1,e.width()),h:Math.max(1,e.height())},fitZoom:iE,pad:cE}}function pE(e,t){let{fns:n,isolated:r,connected:i}=uE(e),a={w:Math.max(1,e.width()),h:Math.max(1,e.height())};if(!t&&i.nonempty()&&(t=AT(fE(e))),t){let n=t;e.batch(()=>{for(let e of i.nodes().toArray()){let t=n[e.id()];t&&e.position(t)}})}let o=r.toArray(),s=i.nonempty()?i.boundingBox():{x1:0,y1:0,x2:0,y2:0,w:0,h:0},c=i.nonempty()?s.y2+48:0,l=Math.max(0,...o.map(e=>lE(e)))+24,u=Math.max(sE,Math.floor(Math.max(s.w,a.w/tE-72)/l));o.forEach((e,t)=>{e.position({x:s.x1+t%u*l+l/2,y:c+Math.floor(t/u)*34})});for(let e of n.toArray()){let t=e.outgoers(`node[kind = "site"]`).not(`.hidden`).toArray();if(t.length===0)continue;let n=e.position(),r=n.x+lE(e)/2+48;t.forEach((e,i)=>e.position({x:r+lE(e)/2,y:n.y+(i-(t.length-1)/2)*26}))}}function mE(e,t,n){if(t.empty())return;e.resize();let r=t.boundingBox(),i=Math.min((e.width()-72)/Math.max(1,r.w),(e.height()-72)/Math.max(1,r.h));e.minZoom(n?Math.max(oE,Math.min(aE,i)):aE),e.fit(t,cE);let a=e.zoom(),o=n?0:t.nodes().length<=rE?iE:tE;a>nE?(e.zoom(nE),e.center(t)):a<o&&(e.zoom(o),e.pan({x:cE-r.x1*o,y:cE-r.y1*o}))}function hE(e){let t=e.elements().not(`.hidden`);mE(e,t,t.nodes().length<=rE)}function gE(e,t){if(t.edges().nonempty()||t.nodes(`[kind = "site"]`).nonempty()){mE(e,t.union(t.edges().connectedNodes()).union(t.nodes().incomers(`node`)),!1);return}let n=t,r=n.renderedBoundingBox(),i=e.width(),a=e.height();r.x1>=0&&r.y1>=0&&r.x2<=i&&r.y2<=a||e.animate({center:{eles:n}},{duration:250})}function _E({graph:e,showUnresolved:t,selection:n,onSelect:r,onClear:i,focus:a,sitesFor:o,answered:s,marks:c,only:l=null,onContext:u,extraSite:d=null}){let f=(0,y.useRef)(null),m=(0,y.useRef)(null),h=Je();(0,y.useEffect)(()=>{m.current?.style(vE())},[h]);let g=(0,y.useRef)(l);g.current=l;let _=(0,y.useRef)(u);_.current=u,(0,y.useEffect)(()=>{m.current&&Ke(m.current,l)},[l]);let v=(0,y.useRef)(0),b=(0,y.useRef)(null),[x,S]=(0,y.useState)(!1),[C,w]=(0,y.useState)(null),[T,E]=(0,y.useState)(0);(0,y.useEffect)(()=>{let n=new Set(e.functions.map(e=>e.id)),a=new Map;for(let t of e.calls){if(!t.crossFile)continue;let e=n.has(t.from)?t.to:t.from;if(n.has(e)||a.has(e))continue;let r=t.function.path.split(`/`).pop()??t.function.path;a.set(e,`${r} › ${oe(t.function.qualifiedName,void 0,t.function.title).name}`)}for(let e of a.keys())n.add(e);let o=new Set(e.calls.filter(e=>e.from===e.to).map(e=>e.from)),s=new Map;for(let t of e.calls){if(t.from===t.to||!n.has(t.from)||!n.has(t.to))continue;let e=eE(t.from,t.to),r=s.get(e);r?r.calls.push(t.id):s.set(e,{from:t.from,to:t.to,calls:[t.id]})}let c=e.functions.map(e=>{let t=be(e);return t.unnamed?`λ ${t.name}`:t.name}),l=new Map(e.functions.map(e=>[e.id,e.qualifiedName])),u=new Map(e.functions.map(e=>[e.id,e])),h=YT(e),v=XT(e),y=e=>{let t=v.get(e);return t===void 0?null:l.get(t)??null},x=new Set(c.filter((e,t)=>c.indexOf(e)!==t)),S=[...e.functions.map((e,t)=>{let n=c[t],r=x.has(n)&&!n.includes(`· line`)?`${n} · line ${e.evidence.span.start.line}`:n,i=ye(e.qualifiedName,e.code,e.evidence.span.start.line,y(e.id));return{data:{id:e.id,label:o.has(e.id)?`${r} ↻`:r,kind:`function`,...i?{hover:i}:{}},classes:e.qualifiedName===`<module>`?`module`:be(e).unnamed?`unnamed`:``}}),...[...a].map(([e,t])=>({data:{id:e,label:t,kind:`port`},classes:`port`})),...h.map(e=>{let t=l.get(e.parent)??``,n=u.get(e.child),r=n?_e(n.qualifiedName,n.code,n.title)??se(n.qualifiedName):``;return{data:{id:e.id,source:e.parent,target:e.child,kind:`inside`,label:``,hover:`${r} is written inside ${t===`<module>`?`the file's top level`:se(t)}. A dotted line shows where a function is written, not a call.`},classes:`inside`}}),...[...s].map(([e,t])=>({data:{id:e,source:t.from,target:t.to,kind:`call`,calls:t.calls,label:t.calls.length>1?`×${t.calls.length}`:``}}))];if(t||d){let r=new Map;for(let i of e.unresolved){if(!n.has(i.enclosingFn)||!(t&&p(i))&&i.id!==d)continue;let e=`${i.enclosingFn}\u0000${i.expression}\u0000${i.status}`,a=r.get(e);a?a.ids.push(i.id):r.set(e,{fn:i.enclosingFn,expression:i.expression,ids:[i.id],status:i.status})}for(let e of r.values()){let t=$T(e.ids[0]),n=e.expression.length>40?`${e.expression.slice(0,39)}…`:e.expression;S.push({data:{id:t,label:e.ids.length>1?`${n} ×${e.ids.length}`:n,kind:`site`,ids:e.ids},classes:`site ${e.status}`},{data:{id:`edge:${t}`,source:e.fn,target:t,kind:`site-edge`,label:``},classes:`site-edge`})}}let C=J_({container:f.current,elements:S,autounselectify:!0,layout:{name:`preset`},minZoom:aE,maxZoom:3,style:vE()});C.on(`tap`,`node, edge`,e=>{let t=e.target.data(`kind`),n=e.target.id();t===`function`?r({kind:`function`,id:n}):t===`inside`?r({kind:`function`,id:e.target.target().id()}):t===`call`?r({kind:`call`,id:e.target.data(`calls`)[0]}):t===`site`&&r({kind:`site`,id:e.target.data(`ids`)[0]})}),C.on(`tap`,e=>{e.target===C&&i()}),C.on(`mouseover`,`node, edge`,e=>{let t=e.target.data(`hover`),n=e.renderedPosition??e.target.renderedMidpoint?.()??{x:0,y:0};w(t?{text:t,x:n.x,y:n.y}:null)}),C.on(`mouseout`,`node, edge`,()=>w(null)),C.on(`pan zoom drag remove`,()=>w(null)),C.on(`scrollzoom pinchzoom dragpan`,()=>{b.current=null});let T={w:C.width(),h:C.height()},E=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{if(m.current!==C)return;C.resize();let e={w:C.width(),h:C.height()};(e.w!==T.w||e.h!==T.h)&&(T=e,b.current?.())});return f.current&&E?.observe(f.current),m.current=C,Ke(C,g.current),C.on(`cxttap`,`node, edge`,e=>{let t=e.target.data(),n=t.kind===`function`?`function`:t.kind===`call`?`edge`:null;if(!n||!f.current)return;let r=f.current.getBoundingClientRect(),i=e.renderedPosition??{x:0,y:0};_.current?.({kind:n,id:n===`file`&&typeof t.file==`string`?t.file:e.target.id(),data:t,x:r.left+i.x,y:r.top+i.y})}),f.current&&(f.current.veoCy=C),()=>{E?.disconnect(),b.current=null,m.current=null,w(null),C.destroy()}},[e,t,r,i,d]);let D=(c?.removed??[]).filter(t=>t.file===e.file.id&&(t.type===`Function`||t.type===`CALLS`)).map(e=>e.id).join(`
340
+ `);(0,y.useEffect)(()=>{let t=m.current;t&&t.batch(()=>{if(t.elements(`.ghost`).remove(),t.elements().removeClass(`diff-added diff-removed diff-changed`),!c)return;t.nodes(`[kind = "function"]`).forEach(e=>{let t=c.byId.get(e.id());t&&e.addClass(Xe(t))}),t.edges(`[kind = "call"]`).forEach(e=>{let t=e.data(`calls`).map(e=>c.byId.get(e)).find(Boolean);t&&e.addClass(Xe(t))});let n=new Set(t.nodes().map(e=>e.id())),r=new Set,i=[];for(let t of c.removed){if(t.type!==`Function`||t.file!==e.file.id||n.has(t.id))continue;let a=t.fact;r.add(t.id),i.push({data:{id:t.id,label:`${a.qualifiedName??a.name??t.id} (removed)`,kind:`ghost`},classes:`diff-removed ghost`})}for(let e of c.removed){if(e.type!==`CALLS`)continue;let t=e.fact,a=e=>!!e&&(n.has(e)||r.has(e));a(t.from)&&a(t.to)&&t.from!==t.to&&i.push({data:{id:`gone:${e.id}`,source:t.from,target:t.to,kind:`ghost-call`,label:``},classes:`diff-removed ghost`})}i.length&&t.add(i)})},[c,e,t,d]);let O=a?o:null;return(0,y.useEffect)(()=>{let e=m.current;if(!e)return;e.batch(()=>{if(e.elements().removeClass(`hidden`),a){let t=e.nodes().filter(e=>e.data(`kind`)===`function`?!a.has(e.id()):e.incomers(`node`).first().id()!==O);t.addClass(`hidden`),t.connectedEdges().addClass(`hidden`)}});let t=++v.current;if(uE(e).connected.nodes().length<=dE){pE(e),hE(e),b.current=()=>hE(e),g.current&&Ke(e,g.current),S(!1);return}S(!0),WT(fE(e)).then(n=>{t===v.current&&m.current===e&&(pE(e,n),hE(e),b.current=()=>hE(e),g.current&&Ke(e,g.current),S(!1),E(e=>e+1))})},[a,e,t,O,D,d]),(0,y.useEffect)(()=>{let t=m.current;if(!t)return;t.batch(()=>{t.elements().removeClass(`picked faded`)}),f.current?.setAttribute(`data-picked`,``);let r=()=>hE(t);if(!n){b.current&&=r;return}let i=n.kind===`site`?t.nodes(`[kind = "site"]`).filter(e=>e.data(`ids`).includes(n.id)):t.getElementById(n.id);if(i.empty()&&n.kind===`call`&&(i=t.edges().filter(e=>(e.data(`calls`)??[]).includes(n.id)),i.empty())){let r=e.calls.find(e=>e.id===n.id);r&&(i=t.getElementById(r.from))}if(i.empty()){b.current&&=r;return}f.current?.setAttribute(`data-picked`,`${n.kind}:${n.id}`);let o=i.union(i.nodes().closedNeighborhood()).union(i.edges().connectedNodes());t.batch(()=>{i.addClass(`picked`),a||t.elements().not(o).addClass(`faded`)}),gE(t,i),b.current=()=>{r(),gE(t,i)}},[n,e,t,a,T,d]),(0,y.useEffect)(()=>{let e=m.current;e&&e.batch(()=>{e.nodes().removeClass(`answered`),s&&e.nodes().filter(e=>s.has(e.id())).addClass(`answered`)})},[s,e,t,a,d]),(0,X.jsxs)(`div`,{className:`graph-wrap`,children:[(0,X.jsx)(`div`,{className:`graph`,ref:f,"data-testid":`graph`,"data-laying-out":x||void 0}),x&&(0,X.jsx)(`div`,{className:`laying-out`,children:`Laying out…`}),C&&(0,X.jsx)(`div`,{className:`graph-hover`,role:`tooltip`,"data-testid":`graph-hover`,style:{left:C.x+12,top:C.y+12},children:C.text}),(0,X.jsxs)(`details`,{className:`graph-key`,"data-testid":`graph-key`,children:[(0,X.jsx)(`summary`,{children:`Key`}),(0,X.jsxs)(`ul`,{children:[(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node`}),(0,X.jsx)(`span`,{children:`a function`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node unnamed`,children:`λ`}),(0,X.jsxs)(`span`,{children:[`a function with no name in the code, shown as its code: `,(0,X.jsx)(`code`,{children:`.map(l => …)`}),` is the arrow function handed to `,(0,X.jsx)(`code`,{children:`.map()`})]})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-node module`}),(0,X.jsx)(`span`,{children:`the file's top level: what runs when the file is loaded`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-line call`}),(0,X.jsx)(`span`,{children:`calls (×2: two call sites)`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-line inside`}),(0,X.jsx)(`span`,{children:`written inside: where a function is written, not a call`})]}),(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`key-line site`}),(0,X.jsx)(`span`,{children:`a call the analysis couldn't tie to a function here`})]})]})]}),(0,X.jsx)(`button`,{className:`fit`,title:`Fit the graph to the view`,"aria-label":`Fit the graph to the view`,onClick:()=>{let e=m.current;if(!e)return;let t=()=>mE(e,e.elements().not(`.hidden`),!0);t(),b.current=t},children:`Fit`})]})}function vE(){return[{selector:`node`,style:{label:`data(label)`,"font-size":12,"text-valign":`center`,"text-halign":`center`,shape:`round-rectangle`,width:lE,height:22,"background-color":Z(`gray-95`),"border-width":1,"border-color":Z(`blue-62`),color:Z(`gray-26`)}},{selector:`node.module`,style:{"background-color":Z(`gray-95-2`),"border-color":Z(`gray-66`),"font-weight":`bold`}},{selector:`node.unnamed`,style:{"font-style":`italic`,"background-color":Z(`gray-96-7`),"border-color":Z(`purple-66`),"border-style":`dashed`}},{selector:`node.port`,style:{"background-color":Z(`gray-100`),"border-style":`dashed`,"border-color":Z(`blue-63`),color:Z(`gray-45`)}},{selector:`node.site`,style:{"background-color":Z(`gray-100`),"border-style":`dashed`,"border-color":Z(`orange-64`),color:Z(`amber-51`)}},{selector:`node.site.awaiting-link, node.site.external`,style:{"border-color":Z(`gray-68`),color:Z(`gray-57`)}},{selector:`edge`,style:{width:1.5,"curve-style":`bezier`,"target-arrow-shape":`triangle`,"line-color":Z(`blue-72`),"target-arrow-color":Z(`blue-72`),label:`data(label)`,"font-size":10,color:Z(`gray-51`),"text-background-color":Z(`gray-99`),"text-background-opacity":1,"text-background-padding":`2px`}},{selector:`edge.inside`,style:{"line-style":`dotted`,width:1.5,"line-color":Z(`purple-70`),"target-arrow-shape":`none`}},{selector:`edge.site-edge`,style:{"line-style":`dashed`,"line-color":Z(`amber-74`),"target-arrow-color":Z(`amber-74`)}},...Ze(),Ge,{selector:`.hidden`,style:{display:`none`}},{selector:`node.answered`,style:{"border-width":2,"border-color":Z(`amber-73`),"background-color":Z(`amber-97`)}},{selector:`.faded`,style:{opacity:.22}},{selector:`node.picked`,style:{"border-width":2,"border-color":Z(`blue-51`),"background-color":Z(`gray-91`)}},{selector:`edge.picked`,style:{"line-color":Z(`blue-51`),"target-arrow-color":Z(`blue-51`),width:3}}]}var yE=(e,t,n)=>(e.find(e=>e.id===t)?.kept??[]).some(e=>n===e||n.startsWith(`${e}/`)),bE={installed:`installed packages`,packages:`copied packages with their own manifests`,banners:`library banners or versioned names`},xE=3,SE=(e,t)=>`veoflow.librariesLater.${e}.${t}`,CE=(e,t)=>`veoflow.librariesSeen.${e}.${t}`,wE=e=>{try{return localStorage.getItem(e)===`1`}catch{return!1}};function TE({project:e,run:t,sources:n,onAnalyze:r,onKept:i,onChooseFiles:a}){let[o,s]=(0,y.useState)({}),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(()=>t?wE(SE(e,t.runId)):!1),[f,p]=(0,y.useState)(()=>!t||!wE(CE(e,t.runId)));(0,y.useEffect)(()=>{if(t)try{localStorage.setItem(CE(e,t.runId),`1`)}catch{}},[e,t?.runId]);let m=(t?.sources??[]).flatMap(e=>(e.libraries??[]).filter(t=>!yE(n,e.sourceId,t.path)).map(t=>({...t,source:e.sourceId}))),h=m.filter(e=>!o[`${e.source}:${e.path}`]),g=Object.values(o).filter(e=>e===`out`).length;if(!t||u||m.length===0||h.length===0&&g===0)return null;let _=async(t,n)=>{l(``);try{await Y.select(e,t.source,[t.path],!n,!n),s(e=>({...e,[`${t.source}:${t.path}`]:n?`out`:`kept`})),n||i()}catch(e){l(e.message??String(e))}},v=e=>`${e.toLocaleString(`en-US`)} file${e===1?``:`s`}`,b=()=>{try{localStorage.setItem(SE(e,t.runId),`1`)}catch{}d(!0)};return!f&&h.length>0&&g===0?(0,X.jsxs)(`section`,{className:`library-offer folded`,"data-testid":`library-offer`,"data-folded":!0,"aria-label":`Third-party libraries`,children:[(0,X.jsx)(`span`,{children:h.length===1?h[0].kind===`dir`?`${h[0].path}/ looks like ${v(h[0].files)} of third-party libraries`:`${h[0].path} looks like a third-party library`:`${h.length} folders or files look like third-party libraries`}),(0,X.jsx)(`button`,{className:`link`,"data-testid":`library-review`,onClick:()=>p(!0),children:`Review`}),(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{className:`link small`,title:`Hide this until the next analysis`,onClick:b,children:`Later`})]}):(0,X.jsxs)(`section`,{className:`library-offer`,"data-testid":`library-offer`,"aria-label":`Third-party libraries`,children:[h.length>0&&(0,X.jsx)(`ul`,{children:h.slice(0,xE).map(e=>(0,X.jsxs)(`li`,{"data-path":e.path,children:[(0,X.jsxs)(`span`,{className:`what`,children:[(0,X.jsxs)(`strong`,{className:`mono`,children:[e.path,e.kind===`dir`?`/`:``]}),` `,`looks like`,` `,e.kind===`dir`?`${v(e.files)} of third-party libraries`:`a third-party library`,` `,(0,X.jsxs)(`small`,{className:`muted`,children:[`(`,bE[e.why],`: `,e.names.join(`, `),`)`]})]}),(0,X.jsx)(`button`,{"data-testid":`library-leave-out`,onClick:()=>void _(e,!0),children:`Leave out`}),(0,X.jsx)(`button`,{className:`quiet`,"data-testid":`library-keep`,title:`Keep analyzing it, and don't offer it again`,onClick:()=>void _(e,!1),children:`Keep analyzing`})]},`${e.source}:${e.path}`))}),(0,X.jsxs)(`div`,{className:`offer-foot`,children:[h.length>xE&&(0,X.jsxs)(`button`,{className:`link`,onClick:()=>a(h[xE].source),children:[h.length-xE,` more…`]}),g>0&&(0,X.jsxs)(`span`,{children:[g,` left out at the next analysis.`,` `,(0,X.jsx)(`button`,{className:`link`,"data-testid":`library-analyze`,onClick:r,children:`Analyze now`})]}),c&&(0,X.jsx)(`span`,{className:`error small`,children:c}),(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{className:`link small`,title:`Hide this until the next analysis`,onClick:b,children:`Later`})]})]})}var EE=e=>/ looks like .*third-party librar/.test(e);function DE({run:e,quiet:t=!1}){let n=e?.sources??[],r=n.flatMap(e=>(e.notices??[]).filter(e=>!EE(e)).map(t=>n.length>1?`${e.sourceId}: ${t}`:t));return r.length?(0,X.jsx)(`ul`,{className:`run-notices${t?` quiet`:``}`,"data-testid":`run-notices`,"aria-label":`Notes from the analysis`,children:r.map(e=>(0,X.jsx)(`li`,{children:e},e))}):null}function OE({analysis:e}){let t=e.outdated.every(e=>e.was===null);return(0,X.jsxs)(`p`,{className:`outdated-note`,"data-testid":`graph-outdated`,children:[t?`This graph was made before veoflow recorded which analysis made it, so it may be older than this version's.`:`This graph was made by ${e.veoflow?`veoflow ${e.veoflow}`:`another veoflow`}; ${e.outdated.map(e=>e.stage).join(`, `)} ${e.outdated.length===1?`has`:`have`} changed since.`,` `,`Analyze again to see what this version finds.`]})}function kE({project:e,files:t,run:n,counts:r,source:i,sources:a,onOpen:o,onQuestions:s}){let[c,l]=(0,y.useState)(null),[u,d]=fS();(0,y.useEffect)(()=>{let t=!1;return Y.totals(e,30,i??void 0,!u).then(e=>!t&&l(e),()=>!t&&l(`error`)),()=>{t=!0}},[e,t,i,u,a]);let f=c&&c!==`error`?c:null,p=(0,y.useMemo)(()=>(f?.mostCalled??[]).filter(e=>mT(e.path)===`source`).slice(0,5).map(e=>({key:e.id,name:e.name,count:e.calls})),[f]),m=f?.pendingLibraries,h=(0,y.useMemo)(()=>v(new Map(Object.entries(m??{}))),[m]),g=(0,y.useMemo)(()=>t.filter(e=>(!i||e.id.startsWith(`${i}:`))&&(u||h(e))),[t,i,u,h]),_=(0,y.useMemo)(()=>t.some(e=>!h(e)),[t,h]),b=(0,y.useMemo)(()=>g.reduce((e,t)=>e+(r[t.id]?.functions??0),0),[g,r]),x=(0,y.useMemo)(()=>g.filter(e=>mT(e.path)===`source`&&!e.origin).map(e=>({f:e,n:r[e.id]?.functions??0})).filter(e=>e.n>0).sort((e,t)=>t.n-e.n||(e.f.path<t.f.path?-1:1)).slice(0,5),[g,r]),S=(0,y.useMemo)(()=>new Map(t.map(e=>[e.id,e.path])),[t]),C=(0,y.useMemo)(()=>new Set(g.map(e=>e.id.slice(0,e.id.indexOf(`:`)))).size>1,[g]),w=e=>e.toLocaleString(`en-US`);return(0,X.jsxs)(`div`,{className:`overview`,"data-testid":`overview`,children:[(0,X.jsx)(DE,{run:n,quiet:!0}),f?.analysis?.outdated.length?(0,X.jsx)(OE,{analysis:f.analysis}):null,f?.stage2&&f.completeness.sites>0&&(0,X.jsxs)(`section`,{className:`paths`,"data-testid":`overview-paths`,children:[(0,X.jsx)(`strong`,{children:sC(f.completeness)}),(0,X.jsxs)(`small`,{children:[cC(f.completeness).filter(e=>e.count>0).map(e=>`${w(e.count)} ${e.label}`).join(` · `),f.completeness.openByReason.length>0&&` — they stop: ${f.completeness.openByReason.slice(0,3).map(e=>`${w(e.sites)} ${e.reason}`).join(`, `)}`]})]}),(0,X.jsxs)(`dl`,{className:`stats`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`files`}),(0,X.jsx)(`dd`,{children:w(g.length)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`functions`}),(0,X.jsx)(`dd`,{children:w(b)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`dt`,{children:[`calls`,f?.stage2&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`br`,{}),(0,X.jsxs)(`small`,{children:[w(f.calls.acrossFiles),` across files`]})]})]}),(0,X.jsx)(`dd`,{"data-testid":`overview-calls`,children:f?w(f.calls.withinFiles+f.calls.acrossFiles):c===`error`?`?`:`…`})]}),(0,X.jsxs)(`div`,{className:`muted-stat`,children:[(0,X.jsxs)(`dt`,{children:[`open calls`,(0,X.jsx)(`br`,{}),(0,X.jsx)(`small`,{children:`calls the analysis couldn't follow`})]}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(`button`,{className:`stat-link`,"data-testid":`overview-open-calls`,onClick:s,title:`Show them in Findings (the same count as there)`,children:f?w(f.openCalls):c===`error`?`?`:`…`})})]}),_&&(0,X.jsxs)(`label`,{className:`toggle stats-scope`,title:`Own code first: tests, installed libraries, generated output and tools' files are counted when this is on`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`overview-all-code`,checked:u,onChange:e=>d(e.target.checked)}),`Libraries and tests too`]})]}),(0,X.jsxs)(`div`,{className:`columns`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{children:`Largest files`}),(0,X.jsx)(`ul`,{children:x.map(({f:e,n:t})=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link-row`,onClick:()=>o(e.id),title:e.path,children:[(0,X.jsx)(`span`,{className:`name`,children:C?`${e.id.slice(0,e.id.indexOf(`:`))} › ${e.path}`:e.path}),(0,X.jsxs)(`small`,{children:[t,` function`,t===1?``:`s`]})]})},e.id))})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{children:`Most called`}),(0,X.jsx)(`ul`,{children:p.map(e=>{let t=e.key.slice(0,e.key.lastIndexOf(`:`));return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{className:`link-row`,onClick:()=>o(t),title:`${e.name??e.key} in ${S.get(t)??t}`,children:[(0,X.jsxs)(`span`,{className:`name`,children:[oe(e.name??e.key).name,p.filter(t=>t.name===e.name).length>1&&(0,X.jsxs)(`small`,{className:`muted`,children:[` `,(S.get(t)??t).split(`/`).pop()]})]}),(0,X.jsxs)(`small`,{children:[e.count,` call`,e.count===1?``:`s`]})]})},e.key)})})]})]}),(0,X.jsx)(`p`,{className:`muted small`,children:`Open a file on the left, or ask a question above (⌘K).`})]})}function AE({onClose:e,onSaved:t}){let[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(null),[f,p]=(0,y.useState)(!1),m=(0,y.useRef)(null);(0,y.useEffect)(()=>{Y.settings().then(({model:e})=>{r(e),a(e.baseUrl),s(e.model),setTimeout(()=>m.current?.focus(),0)},e=>d({ok:!1,text:`Could not load the settings: ${e.message??String(e)}`}))},[]),(0,y.useEffect)(()=>{let t=t=>t.key===`Escape`&&e();return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let h=async(e={})=>{p(!0),d(null);try{let{model:n}=await Y.saveSettings({baseUrl:i,model:o,...c.trim()?{apiKey:c.trim()}:{},...e});return r(n),l(``),t(n),n}catch(e){return d({ok:!1,text:e.message??String(e)}),null}finally{p(!1)}},[g,_]=(0,y.useState)(!1),v=async(t=!1)=>{if(!t&&(c.trim()||n?.apiKeySet)){p(!0),d(null);let e=!1;try{let t=await Y.testSettings({baseUrl:i,model:o,...c.trim()?{apiKey:c.trim()}:{}});e=t.ok,t.ok||d({ok:!1,text:t.message})}catch(e){d({ok:!1,text:e.message??String(e)})}finally{p(!1)}if(!e){_(!0);return}}await h()&&e()},b=async()=>{p(!0),d(null);try{let e=await Y.testSettings({baseUrl:i,model:o,...c.trim()?{apiKey:c.trim()}:{}});d({ok:e.ok&&e.toolCalls,text:e.message})}catch(e){d({ok:!1,text:e.message??String(e)})}finally{p(!1)}};return(0,X.jsx)(`div`,{className:`backdrop`,onMouseDown:t=>t.target===t.currentTarget&&e(),children:(0,X.jsxs)(`form`,{className:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,"data-testid":`settings-dialog`,onSubmit:e=>{e.preventDefault(),v()},children:[(0,X.jsx)(`h2`,{id:`settings-title`,children:`Settings`}),(0,X.jsxs)(`p`,{className:`muted`,children:[`Built-in questions work without a model. To ask anything, connect a model through`,` `,(0,X.jsx)(`a`,{href:`https://openrouter.ai/keys`,target:`_blank`,rel:`noreferrer`,children:`OpenRouter`}),` `,`(or any OpenAI-compatible endpoint) with your own key.`]}),(0,X.jsxs)(`fieldset`,{disabled:!n,className:`plain`,children:[(0,X.jsxs)(`label`,{children:[`Model`,(0,X.jsx)(`input`,{ref:m,"data-testid":`settings-model`,value:o,onChange:e=>s(e.target.value),placeholder:`anthropic/claude-sonnet-5.5`,spellCheck:!1}),(0,X.jsx)(`small`,{className:`muted`,children:`An OpenRouter model id that supports tool calls.`})]}),(0,X.jsxs)(`label`,{children:[`API key`,(0,X.jsx)(`input`,{"data-testid":`settings-key`,type:`password`,autoComplete:`off`,value:c,onChange:e=>l(e.target.value),placeholder:n?.apiKeySet?`Saved (…${n.apiKeyHint})${n.keySource===`env`?` from OPENROUTER_API_KEY`:``}`:`sk-or-…`,spellCheck:!1}),(0,X.jsx)(`small`,{className:`muted`,children:`Stored only on this computer, in the veoflow folder (readable by you only). It is never shown again.`})]}),(0,X.jsxs)(`details`,{children:[(0,X.jsx)(`summary`,{children:`Advanced`}),(0,X.jsxs)(`label`,{children:[`Base URL`,(0,X.jsx)(`input`,{"data-testid":`settings-base-url`,value:i,onChange:e=>a(e.target.value),placeholder:`https://openrouter.ai/api/v1`,spellCheck:!1})]})]})]}),(0,X.jsx)(`p`,{className:`muted small`,children:`When a model answers, your question and the graph data it looks up (names, file paths, line numbers) are sent to the provider. Nothing is sent for built-in questions.`}),u&&(0,X.jsx)(`p`,{className:u.ok?`ok`:`error`,role:`status`,"data-testid":`settings-status`,children:u.text}),(0,X.jsxs)(`div`,{className:`buttons`,children:[n?.apiKeySet&&n.keySource===`config`&&(0,X.jsx)(`button`,{type:`button`,className:`danger`,disabled:f,onClick:()=>void h({apiKey:null}),"data-testid":`settings-remove-key`,children:`Remove key`}),(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{type:`button`,disabled:f||!n,onClick:()=>void b(),"data-testid":`settings-test`,children:`Test connection`}),(0,X.jsx)(`button`,{type:`button`,onClick:e,children:`Cancel`}),g&&(0,X.jsx)(`button`,{type:`button`,disabled:f,onClick:()=>void v(!0),"data-testid":`settings-save-anyway`,children:`Save anyway`}),(0,X.jsx)(`button`,{type:`submit`,className:`primary`,disabled:f||!n,"data-testid":`settings-save`,children:`Save`})]})]})})}function jE(e,t){if(t.type===`undo`)return L(e);if(t.type===`redo`)return R(e);if(t.type===`load`)return z(t.view)===z(e.present)?e:{past:[...e.past,e.present],present:t.view,future:[]};let n={name:t.name,...t.args?{args:t.args}:{}};try{return t.type===`reset`?{...e,present:I(F(e.present),n).present}:I(e,n)}catch(t){return console.warn(t),e}}var ME=[{id:`stage1`,name:`Functions & calls`,release:`R1`},{id:`stage2`,name:`Cross-file links`,release:`R2`},{id:`stage3`,name:`APIs & data`,release:`R4`},{id:`stage4`,name:`Runtime`,release:`R11`},{id:`stage5`,name:`Deployment`,release:`R10`}];function NE(){let[e,t]=(0,y.useReducer)(jE,void 0,()=>F(H(location.hash.slice(1)))),n=e.present,r=(0,y.useCallback)((e,n)=>t({type:`command`,name:e,...n?{args:n}:{}}),[]),[i,a]=(0,y.useState)([]),o=(0,y.useRef)(!0),[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)([]),[d,f]=(0,y.useState)({}),[m,h]=(0,y.useState)(null),[g,_]=(0,y.useState)(`file`),[v,b]=(0,y.useState)(``),x=(0,y.useRef)(n.tab);x.current=n.tab;let[C,w]=(0,y.useState)(()=>{try{return localStorage.getItem(`veoflow.navCollapsed`)===`1`}catch{return!1}}),T=(0,y.useCallback)(e=>{w(t=>{let n=typeof e==`function`?e(t):e;try{localStorage.setItem(`veoflow.navCollapsed`,n?`1`:`0`)}catch{}return n})},[]),E=(0,y.useRef)(0),[D,O]=(0,y.useState)(null),[k,A]=(0,y.useState)(!1),[j,N]=(0,y.useState)(!1),[P,I]=(0,y.useState)(null),[L,R]=(0,y.useState)(null),[B,V]=(0,y.useState)(null),[G,K]=(0,y.useState)([]),[q,J]=(0,y.useState)([]),ie=(0,y.useMemo)(()=>new Set(q.flatMap(e=>[...e.changed,...e.removed].map(t=>`${e.sourceId}:${t}`))),[q]),[ae,se]=(0,y.useState)(`pending`),ce=(0,y.useRef)(!1);ce.current=ae===`running`;let[le,ue]=(0,y.useState)(``),[de,fe]=(0,y.useState)(new Map),[pe,me]=(0,y.useState)(``),[he,ge]=(0,y.useState)(``),[_e,ve]=(0,y.useState)(!1),[ye,be]=(0,y.useState)(null),[xe,Se]=(0,y.useState)(null),[Ce,we]=(0,y.useState)(null),[Ee,De]=(0,y.useReducer)(e=>e+1,0);ne(n.run);let ke=(0,y.useRef)(!0);(0,y.useEffect)(()=>{if(ke.current){ke.current=!1;return}De()},[n.run]);let Ae=(0,y.useRef)(n);Ae.current=n,(0,y.useEffect)(()=>{let e=e=>{let{run:n,reason:r}=e.detail??{};Ae.current.run&&n===Ae.current.run&&(t({type:`reset`,name:`openRun`,args:{}}),ge(r===`history`?`That run is older than the 30 days of history this license shows, so the latest analysis is shown.`:`That run is no longer available (a newer draft or analysis replaced it), so the latest analysis is shown.`))};return window.addEventListener(`veo-run-gone`,e),()=>window.removeEventListener(`veo-run-gone`,e)},[]);let je=n.run??P,Me=RS(n.project,n.compare,Ee),Ne=(0,y.useMemo)(()=>Ye(Me.data),[Me.data]),{groups:Pe}=bS(n.project,je,0,n.source),Fe=(0,y.useCallback)((e,t)=>r(`select`,{kind:`function`,id:e,file:t}),[r]),Le=(0,y.useCallback)(e=>{let t=e.file,i=e=>n.tab!==e&&r(`showTab`,{tab:e});if(e.change===`removed`){t&&e.type!==`File`&&Ne?.fileFacts.get(t)!==`removed`&&(i(`file`),r(`openFile`,{file:t}));return}switch(e.type){case`Function`:if(t)return r(`select`,{kind:`function`,id:e.id,file:t});break;case`CALLS`:case`CALLS_CROSS_FILE`:if(t)return r(`select`,{kind:`call`,id:e.id,file:t});break;case`UnresolvedCallSite`:if(t)return r(`select`,{kind:`site`,id:e.id,file:t});break;case`IMPORTS`:case`UnresolvedImport`:if(t)return r(`openImportsFile`,{file:t,pick:e.id});break;case`Group`:return i(`imports`),n.grouping!==`declared`&&r(`setGrouping`,{grouping:`declared`}),r(`openGroup`,{group:e.id});case`DEPENDS_ON`:return i(`imports`),n.grouping!==`declared`&&r(`setGrouping`,{grouping:`declared`}),r(`openGroup`,{group:String(e.fact.from)})}t&&(i(`file`),r(`openFile`,{file:t}))},[r,n.tab,n.grouping,Ne]),[Re,ze]=(0,y.useState)(null),[Be,Ve]=(0,y.useState)(null),He=(0,y.useRef)(n.project);He.current=n.project;let Ue=(0,y.useRef)(n.file);Ue.current=n.file;let We=(0,y.useRef)(n.source);We.current=n.source;let[Ge,Ke]=(0,y.useState)(!1),[qe,Z]=(0,y.useState)([]),[Je,Xe]=(0,y.useState)([]),[Ze,Qe]=(0,y.useState)(null),[$e,et]=(0,y.useState)(!1),[tt,nt]=(0,y.useState)(!1),[rt,it]=(0,y.useState)(0),at=(0,y.useRef)(null),ot=(0,y.useRef)(null),[st,ct]=(0,y.useState)(!1),[lt,ut]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(it(0),!Ge)return;let e=Date.now(),t=setInterval(()=>it(Math.round((Date.now()-e)/1e3)),1e3);return()=>clearInterval(t)},[Ge,Be]),(0,y.useEffect)(()=>{Y.settings().then(e=>Qe(e.model),()=>void 0)},[]);let dt=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=`#${z(n)}`,t=JSON.stringify([n.project,n.file,n.selection,n.tab,n.group,n.fileLevel]);if(location.hash!==e){let r=z(H(location.hash.slice(1)))===z(n);dt.current!==null&&dt.current!==t&&!r?window.history.pushState(null,``,e):window.history.replaceState(null,``,e)}dt.current=t},[n]),(0,y.useEffect)(()=>{let e=()=>t({type:`load`,view:H(location.hash.slice(1))});return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),(0,y.useEffect)(()=>{if(n.project||!i.some(e=>e.findingsPending))return;let e=setTimeout(()=>{Y.projects(!0).then(({projects:e})=>a(e),()=>void 0)},2e3);return()=>clearTimeout(e)},[i,n.project]),(0,y.useEffect)(()=>{let e=!1;return Y.projects(!n.project).then(({projects:r})=>{if(e)return;a(r),c(!0);let i=r.some(e=>e.id===n.project);n.project&&!i&&me(`Project ${n.project} was not found.`),(o.current&&!n.project||n.project&&!i)&&t(r.length===1?{type:`reset`,name:`selectProject`,args:{project:r[0].id}}:{type:`reset`,name:`goHome`,args:{}}),o.current=!1},t=>!e&&me(t.message)),()=>{e=!0}},[Ee,n.project===null]),(0,y.useEffect)(()=>{if(!n.project)return Xe([]);let e=!1;return Y.suggestions(n.project).then(t=>!e&&Xe(t.suggestions),()=>!e&&Xe([])),()=>{e=!0}},[n.project,Ee]),(0,y.useEffect)(()=>{u([]),f({}),ze(null),Ke(!1),Ve(null),wt.current++,ue(``),O(null),A(!1),N(!1),I(null),se(`pending`),R(null),V(null),K([]),J([])},[n.project]),(0,y.useEffect)(()=>{if(!n.project){u([]);return}let e=!1,t=n.project;return Y.files(t).then(t=>{e||(u(t.files),N(!0))},()=>{e||(u([]),N(!0))}),Y.fileCounts(t).then(t=>!e&&f(t.counts),()=>!e&&f({})),Y.status(t).then(n=>{e||(O(n.latest),R(n.draft??null),V(n.debug??null),I(n.committedRun),A(!0),n.progress&&fe(e=>e.has(t)?e:new Map(e).set(t,n.progress)),se(n.runInProgress?`running`:n.latest?.status===`failed`?`failed`:n.latest?`done`:`pending`))},()=>void 0),()=>{e=!0}},[n.project,Ee]),(0,y.useEffect)(()=>{if(J([]),!n.project||P===null)return;let e=n.project,t=!1,r=()=>!ce.current&&void Y.stale(e).then(e=>!t&&J(e.committedRun===P?e.sources:[]),()=>void 0);return r(),window.addEventListener(`focus`,r),()=>{t=!0,window.removeEventListener(`focus`,r)}},[n.project,P]);let[ft,pt]=(0,y.useState)([]),mt=(0,y.useMemo)(()=>n.file&&(n.tab===`file`||n.fileLevel)?{kind:`file`,file:n.file}:n.tab===`imports`&&n.group?{kind:`group`,group:n.group}:n.source?{kind:`source`,source:n.source,name:ft.find(e=>e.id===n.source)?.name}:null,[n.file,n.tab,n.fileLevel,n.group,n.source,ft]);(0,y.useEffect)(()=>{if(!n.project)return pt([]);let e=!1;return Y.sources(n.project).then(t=>!e&&pt(t.sources.map(e=>({...e,optIn:e.optIn??[]}))),()=>void 0),()=>{e=!0}},[n.project,Ee]),(0,y.useEffect)(()=>{n.source&&ft.length>0&&!ft.some(e=>e.id===n.source)&&t({type:`reset`,name:`scopeSource`,args:{}})},[n.source,ft]);let{data:ht}=AS(n.project,je,g===`project`?null:mt,[],Ee,n.grouping),gt=ht?ht.counts.broken+ht.counts.notAnalyzed+ht.counts.openCalls:null,[_t,vt]=(0,y.useState)(null),yt=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(!n.project||!n.file){h(null);return}n.file!==yt.current&&ge(``),yt.current=n.file,h(e=>e&&e.file.id===n.file?e:null),ct(!1);let e=!1,r=n.file;return Y.fileGraph(n.project,r).then(t=>!e&&h(t),r=>{e||te(r)||(h(null),ge(n.run===null?`That file wasn't in the latest analysis, so the project overview is shown instead.`:`That file isn't in run ${n.run}, so the project overview is shown instead.`),t({type:`reset`,name:`selectProject`,args:{project:n.project}}))}),()=>{e=!0}},[n.project,n.file,Ee]),(0,y.useEffect)(()=>re(De,e=>{if(typeof e.projectId==`string`&&fe(t=>{let n=t.get(e.projectId)??null,r=S(n,e);if(r===n)return t;let i=new Map(t);return r?i.set(e.projectId,r):i.delete(e.projectId),i}),!n.project){(e.type===`run.started`||e.type===`run.committed`||e.type===`run.failed`)&&De();return}e.projectId===n.project&&(e.type===`run.started`?(se(`running`),ue(`Analyzing…`)):e.type===`stage.completed`?ue(`Analyzing…`):e.type===`run.committed`?(J([]),se(`done`),ue(`Analyzed just now`),De()):e.type===`run.failed`&&(se(`failed`),ue(`Analysis failed: ${String(e.error)}`),De()))}),[n.project]),(0,y.useEffect)(()=>{let e=e=>{let n=e.target;if(document.querySelector(`[role="dialog"], [role="menu"]`)||n.closest(`input:not([type="checkbox"]):not([type="radio"]), textarea, select, [contenteditable], [role=dialog]`))return;if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()===`z`){e.preventDefault(),t({type:e.shiftKey?`redo`:`undo`});return}if(e.metaKey||e.ctrlKey||e.altKey)return;let i=E.current&&Date.now()-E.current<1200;if(E.current=0,i&&e.key===`m`){r(`openGroup`,{});return}e.key===`Escape`?r(`clearSelection`):e.key===`u`?r(`toggleUnresolved`):e.key===`1`?r(`showTab`,{tab:`file`}):e.key===`2`?x.current!==`imports`&&r(`showTab`,{tab:`imports`}):e.key===`3`?r(`showTab`,{tab:`reach`}):e.key===`[`?T(e=>!e):e.key===`g`&&(E.current=Date.now())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let bt=(0,y.useCallback)(e=>r(`select`,e),[r]),xt=(0,y.useCallback)(()=>r(`clearSelection`),[r]),St=(0,y.useCallback)(()=>{_(`file`),r(`showPanel`,{panel:`questions`})},[r]),Ct=async(e,t)=>{if(b(``),!qE(e)){b(`Enter an absolute path (for example /Users/you/app), not "${e}"`);return}let i=t?ye??n.project:null;try{W(`addFolder`,{root:e}),i||(i=(await Y.createProject(e.split(/[\\/]/).filter(Boolean).pop()??`project`,e)).project.id,r(`selectProject`,{project:i})),await Y.addSource(i,e)}catch(e){b(e.message??String(e));return}ve(!1),be(null),b(``),se(`running`);try{await Y.analyze(i)}catch(e){me(e.message??String(e))}De()},wt=(0,y.useRef)(0),Tt=(0,y.useRef)(null),Et=async(e,i)=>{if(!n.project)return;W(`ask`,{question:e});let a=++wt.current,o=n.project;Tt.current?.abort();let s=new AbortController;Tt.current=s,t({type:`reset`,name:`showPanel`,args:{panel:`answer`}}),Ke(!0),Ve(e),Z(t=>[e,...t.filter(t=>t!==e)].slice(0,5));let c;try{c=await Y.ask(o,e,i,Ue.current,s.signal,We.current)}catch(t){let n=t;c={question:e,via:`help`,...i?{mode:i}:{},summary:`Could not answer: ${n.message??String(t)}`,results:[],toolCalls:[],error:{code:n.code??`error`,message:n.message??String(t)}}}if(a!==wt.current||He.current!==o)return;let l=c.results[0];l?.kind===`function`&&l.file===Ue.current&&(c.intent===`callers`||c.intent===`callees`||c.intent===`definition`)&&(r(`select`,{kind:`function`,id:l.id,file:l.file}),t({type:`reset`,name:`showPanel`,args:{panel:`answer`}})),ze(c),Ke(!1),Ve(null)},Dt=e=>{for(let t of ee(e))r(t.name,t.args);t({type:`reset`,name:`showPanel`,args:{panel:`answer`}})},Ot=()=>{Tt.current?.abort(),wt.current++,Ke(!1),Ve(null)},Q=()=>{n.project&&(W(`analyzeDraft`),me(``),ue(`Analyzing your uncommitted edits as a draft…`),Y.analyzeDraft(n.project).catch(e=>{me(e.message),De()}))},kt=e=>{n.project&&(W(`analyzeFrom`,{from:e}),me(``),ue(`Analyzing again from ${e}…`),Y.analyzeFrom(n.project,e).catch(e=>{me(e.message),De()}))},At=e=>{n.project&&(W(`analyzeDebug`,{until:e}),me(``),ue(`Debug run: analyzing up to ${e}…`),Y.analyzeDebug(n.project,e).catch(e=>{me(e.message),De()}))};(0,y.useEffect)(()=>{if(!n.project)return;let e=!1;return Y.stages(n.project).then(t=>!e&&K(t.pipeline),()=>!e&&K([])),()=>{e=!0}},[n.project]);let[jt,Mt]=(0,y.useState)(null),Nt=(0,y.useCallback)(()=>Mt(null),[]),Pt=e=>{let t=e=>e.slice(0,e.indexOf(`:`)),i=e=>decodeURIComponent(e.slice(e.indexOf(`:`)+1)),a=e=>e.slice(0,e.indexOf(`:`,e.indexOf(`:`)+1)),o=(e,t)=>({label:`Leave it out of analysis…`,command:`chooseFiles`,run:()=>we({source:e,...t?{path:t}:{}})}),s=e=>({label:`Re-analyze its repository`,command:`analyzeSource`,run:()=>void Ft(e)}),c=e=>({label:`Broken imports in it`,command:`showPanel`,run:()=>{e(),vt(`broken`),r(`showPanel`,{panel:`questions`})}});if(e.kind===`group`&&e.id.startsWith(`area|`)){let t=e.id.slice(5);return{title:String(e.data.label??t).split(`
341
+ `)[0],entries:[{label:`Open`,command:`openArea`,run:()=>r(`openArea`,{area:t})},{label:`Show only its links`,command:`showOnlyLinks`,run:()=>r(`showOnlyLinks`,{id:e.id})}]}}if(e.kind===`group`){let[,t=``,i=``]=e.id.split(`|`);return{title:String(e.data.label??e.id).split(`
342
+ `)[0],entries:[{label:`Open`,command:`openGroup`,run:()=>r(`openGroup`,{group:e.id})},{label:`Show only its links`,command:`showOnlyLinks`,run:()=>{(n.group!==null||n.fileLevel)&&r(`openGroup`,{}),r(`showOnlyLinks`,{id:e.id})}},{label:`What depends on it`,command:`pickNode`,run:()=>r(`pickNode`,{id:e.id})},c(()=>r(`openGroup`,{group:e.id})),s(t),.../^(cluster|module|shared):/.test(i)?[]:[o(t,i||void 0)]]}}if(e.kind===`file`){let a=t(e.id);return{title:i(e.id),entries:[{label:`Open`,command:n.tab===`imports`?`openImportsFile`:`openFile`,run:()=>n.tab===`imports`?r(`openImportsFile`,{file:e.id}):r(`openFile`,{file:e.id})},...n.tab===`imports`&&!n.fileLevel?[{label:`Show only its links`,command:`showOnlyLinks`,run:()=>r(`showOnlyLinks`,{id:e.id})}]:[],{label:n.tab===`imports`?`What depends on it`:`⇄ Imports of this file`,command:`openImportsFile`,run:()=>r(`openImportsFile`,{file:e.id})},c(()=>r(`openImportsFile`,{file:e.id})),{label:`Reach from this file`,command:`openReach`,run:()=>r(`openReach`,{root:e.id,direction:`forward`})},s(a),o(a,i(e.id))]}}if(e.kind===`folder`){let t=e.id.split(`|`)[2]??``,n=String(e.data.path??``);return{title:`${n}/`,entries:[{label:`Open or close`,command:`toggleFolder`,run:()=>r(`toggleFolder`,{path:n})},s(t),o(t,n)]}}if(e.kind===`function`){let c=a(e.id),l=e.id.slice(c.length+1);return{title:l,entries:[{label:`Open`,command:`select`,run:()=>r(`select`,{kind:`function`,id:e.id,file:c})},...n.tab===`file`&&Zt===`graph`?[{label:`Show only its links`,command:`showOnlyLinks`,run:()=>r(`showOnlyLinks`,{id:e.id})}]:[],{label:`Who calls it`,command:`ask`,run:()=>void Et(`who calls ${l}`)},{label:`Reach from here`,command:`openReach`,run:()=>r(`openReach`,{root:e.id,direction:`forward`})},{label:`What reaches it`,command:`openReach`,run:()=>r(`openReach`,{root:e.id,direction:`backward`})},s(t(c)),{...o(t(c),i(c)),label:`Leave its file out of analysis…`}]}}let l=e.data,u=e=>[{label:`Go to its start`,command:`openGroup`,run:()=>l.source&&e(l.source)},{label:`Go to its end`,command:`openGroup`,run:()=>l.target&&e(l.target)}];if(l.kind===`call`&&l.calls?.length&&n.tab===`file`)return{title:`Call`,entries:[{label:`Open`,command:`select`,run:()=>r(`select`,{kind:`call`,id:l.calls[0]})}]};if(l.kind===`depends`)return{title:`Dependency`,entries:[{label:`Show its calls`,command:`pickNode`,run:()=>l.source&&l.target&&r(`pickNode`,{id:lw(l.source,l.target)})},...u(e=>r(`openGroup`,{group:e}))]};if(l.kind===`calls`)return{title:`Calls`,entries:[{label:`Show its calls`,command:`pickNode`,run:()=>r(`pickNode`,{id:e.id})},...u(e=>e.startsWith(`stub|`)?r(`openGroup`,{group:e.slice(5)}):e.startsWith(`folder|`)?r(`toggleFolder`,{path:e.split(`|`).slice(4).join(`|`)}):r(`openImportsFile`,{file:e}))]};if(l.kind===`imports`)return{title:`Imports`,entries:u(e=>e.startsWith(`folder|`)?r(`toggleFolder`,{path:e.split(`|`).slice(4).join(`|`)}):r(`openImportsFile`,{file:e})).map(e=>({...e,command:`openImportsFile`}))};let d=e.data.edge??e.id;return{title:`Link`,entries:[{label:`Open`,command:`pickNode`,run:()=>r(`pickNode`,{id:d})}]}};(0,y.useEffect)(()=>{let e=e=>{if(!(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)||e.target.closest?.(`input, textarea, select, [role=dialog], [role=menu]`))return;let r=document.querySelector(`.graph-wrap .graph`)?.getBoundingClientRect(),i={x:r?r.left+r.width/2:200,y:r?r.top+r.height/3:200},a=null;if(n.tab===`file`&&n.selection?.kind===`function`?a={kind:`function`,id:n.selection.id,data:{},...i}:n.tab===`imports`&&n.pick&&(n.pick.startsWith(`group|`)||/^[^|]+:/.test(n.pick))&&(a={kind:n.pick.startsWith(`group|`)?`group`:`file`,id:n.pick,data:{},...i}),!a)return;e.preventDefault();let o=Pe?.groups.find(e=>e.id===a.id);o&&(a.data={label:o.name}),t=!0,Mt(a)},t=!1,r=e=>{t&&e.preventDefault(),t=!1};return window.addEventListener(`keydown`,e),window.addEventListener(`contextmenu`,r),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`contextmenu`,r)}},[n.tab,n.selection,n.pick,Pe]);let Ft=async e=>{if(n.project){try{await Y.analyzeSource(n.project,e)}catch(e){me(e.message??String(e))}De()}},It=()=>{n.project&&(W(`analyze`),me(``),se(`running`),Y.analyze(n.project).catch(e=>{me(e.message),De()}))},Lt=(0,y.useCallback)(e=>mC(e,{view:n,projects:i.map(e=>({id:e.id,name:e.name})),sources:ft.map(e=>({id:e.id,...e.name?{name:e.name}:{}})),files:l.map(e=>({id:e.id,path:e.path})),groups:(Pe?.groups??[]).map(e=>({id:e.id,name:e.name})),canDraft:ft.some(e=>e.analysis?.kind===`git`),stages:P===null?[]:G,command:(e,t)=>r(e,t??{}),action:(e,t)=>{e!==`addFolder`&&W(e,t??{}),e===`analyze`?It():e===`analyzeSource`?Ft(String(t?.source)):e===`chooseFiles`?we({source:String(t?.source),...t?.path?{path:String(t.path)}:{}}):e===`analyzeDraft`?Q():e===`analyzeDebug`?At(String(t?.until)):e===`analyzeFrom`?kt(String(t?.from)):e===`addFolder`?ve(!0):e===`openSettings`?et(!0):e===`openProjectSettings`&&Se(t?.tab??`repositories`)}}),[n,i,ft,l,Pe,r]),Rt=m!==null&&m.functions.length>80&&!st,zt=n.selection?.kind===`function`?n.selection.id:n.selection?.kind===`call`?m?.calls.find(e=>e.id===n.selection.id)?.from??null:n.selection?.kind===`site`?m?.unresolved.find(e=>e.id===n.selection.id)?.enclosingFn??null:null,Bt=zt&&m?.functions.some(e=>e.id===zt)?zt:null,Vt=n.selection?.kind===`call`?m?.calls.find(e=>e.id===n.selection.id):void 0,Ht=Vt?[Vt.from,Vt.to]:null,Ut=Ht?.join(`|`)??``,Wt=(0,y.useMemo)(()=>Rt&&m?QT(m,Bt,Ut?Ut.split(`|`):null):null,[Rt,m,Bt,Ut]),Gt=m?m.unresolved.filter(p).length:0,Kt=n.selection?.kind===`site`?m?.unresolved.find(e=>e.id===n.selection.id):void 0,qt=Kt&&!(n.showUnresolved&&p(Kt))?Kt.id:null,Jt=(0,y.useMemo)(()=>{if(!Re||!m)return null;let e=new Set(Re.results.filter(e=>e.kind===`function`&&e.file===m.file.id).map(e=>e.id));return e.size?e:null},[Re,m]),Yt=Bt?(()=>{let e=m?.functions.find(e=>e.id===Bt);return oe(e?.qualifiedName??``,void 0,e?.title).name})():``,Xt=Bt?new Set((m?.calls??[]).flatMap(e=>e.from===Bt&&e.to!==Bt?[e.to]:e.to===Bt&&e.from!==Bt?[e.from]:[])).size:0,Zt=lt??(m&&m.calls.length===0?`list`:`graph`),Qt=n.tab===`file`&&!n.file&&n.panel===`answer`&&(Re!==null||Ge),$t=n.tab===`imports`&&P!==null&&l.length>0,en=(0,X.jsx)(Ie,{answer:Re,busy:Ge,pending:Be,elapsed:rt,modelConfigured:Ze?.configured??!1,selectedId:n.selection?.id??null,wide:tt,onWide:nt,onOpen:Dt,onAsk:(e,t)=>void Et(e,t),onCancel:Ot,onTemplate:e=>ot.current?.prefill(e),onSettings:()=>et(!0),onShowQuestions:e=>{r(`openFile`,{file:e}),_(`file`),t({type:`reset`,name:`showPanel`,args:{panel:`questions`}})}});return(0,X.jsx)(pS.Provider,{value:n.grouping,children:(0,X.jsxs)(`div`,{className:`app`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(`button`,{className:`logo`,"aria-label":`veoflow: all projects (home)`,"data-command":`go-home`,title:M.goHome.description,onClick:()=>r(`goHome`,{}),children:`veoflow`}),(0,X.jsxs)(`select`,{"data-command":`select-project`,"aria-label":`Project`,className:`project`,value:i.some(e=>e.id===n.project)?n.project??``:``,onChange:e=>r(`selectProject`,{project:e.target.value}),children:[(0,X.jsx)(`option`,{value:``,disabled:!0,children:i.length===0?`No project yet`:`Choose a project`}),i.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),n.project&&(0,X.jsx)(UE,{tab:n.tab,reach:n.reach!==null,onTab:e=>r(`showTab`,{tab:e})}),(0,X.jsxs)(`button`,{"data-testid":`add-folder`,className:`quiet`,title:U.addFolder.description,"aria-label":`Add a folder`,onClick:()=>ve(!0),children:[`+`,(0,X.jsx)(`span`,{className:`wide-only`,children:` Add folder`})]}),(0,X.jsx)(Oe,{project:n.project,modelName:Ze?.configured?Ze.model:null,disabled:!n.project||l.length===0,loading:!!n.project&&l.length===0&&!k,suggestions:Je,recent:qe,busy:Ge,onAsk:e=>void Et(e),handle:ot,palette:Lt,onOpenFunction:Fe}),n.project&&(0,X.jsx)(PE,{stage1:ae,message:le,progress:ae===`running`?de.get(n.project)??null:null,...ae!==`running`&&D?.errorCode===`stage-inputs-changed`?{onFullRun:It}:{},latest:D,loading:!!n.project&&!k,...n.project&&ae===`running`?{onCancel:()=>{let e=n.project;le!==`Cancelling…`&&(ue(`Cancelling…`),Y.cancelRun(e).then(()=>{ue(``),De()},e=>ue(`Couldn't cancel: ${e.message}`)))}}:{}}),n.project&&ft.some(e=>e.analysis?.kind===`git`)&&(0,X.jsx)(`button`,{"data-testid":`analyze-draft`,className:`icon`,title:U.analyzeDraft.description,"aria-label":`Analyze uncommitted edits`,onClick:Q,children:`✎`}),n.project&&(0,X.jsx)(`button`,{"data-testid":`reanalyze`,className:`icon`,title:`${U.analyze.description}`,"aria-label":`Analyze again`,onClick:It,children:`↻`}),n.project&&(0,X.jsx)(`button`,{"data-command":`toggle-history`,className:`quiet${n.history?` active`:``}`,"aria-pressed":n.history,title:M.toggleHistory.description,onClick:()=>r(`toggleHistory`,{}),children:`History`}),(0,X.jsx)(`button`,{"data-testid":`undo`,disabled:e.past.length===0,onClick:()=>t({type:`undo`}),title:`Undo (⌘Z)`,"aria-label":`Undo`,className:`icon`,children:(0,X.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M6 3 2 7l4 4M2.5 7H10a4 4 0 0 1 0 8H7`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`})})}),(0,X.jsx)(`button`,{"data-testid":`redo`,disabled:e.future.length===0,onClick:()=>t({type:`redo`}),title:`Redo (⇧⌘Z)`,"aria-label":`Redo`,className:`icon`,children:(0,X.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`,children:(0,X.jsx)(`path`,{d:`M10 3l4 4-4 4M13.5 7H6a4 4 0 0 0 0 8h3`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`})})}),n.project&&(0,X.jsx)(`button`,{"data-testid":`project-settings`,className:`quiet`,title:U.openProjectSettings.description,onClick:()=>{W(`openProjectSettings`),Se(`repositories`)},children:`Repositories`}),(0,X.jsx)(`button`,{"data-testid":`settings`,className:`icon`,title:U.openSettings.description,"aria-label":`Settings`,ref:at,onClick:()=>{W(`openSettings`),et(!0)},children:(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,"aria-hidden":`true`,children:[(0,X.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinejoin:`round`,d:`M10.3 3h3.4l.5 2.4 1.7.7 2-1.4 2.4 2.4-1.4 2 .7 1.7 2.4.5v3.4l-2.4.5-.7 1.7 1.4 2-2.4 2.4-2-1.4-1.7.7-.5 2.4h-3.4l-.5-2.4-1.7-.7-2 1.4-2.4-2.4 1.4-2-.7-1.7L3 13.7v-3.4l2.4-.5.7-1.7-1.4-2 2.4-2.4 2 1.4 1.7-.7z`}),(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`})]})})]}),he&&(0,X.jsxs)(`div`,{className:`notice`,role:`status`,"data-testid":`notice`,children:[(0,X.jsx)(`span`,{children:he}),(0,X.jsx)(`button`,{className:`icon`,"aria-label":`Dismiss`,onClick:()=>ge(``),children:`×`})]}),n.only&&(0,X.jsxs)(`div`,{className:`notice`,role:`status`,"data-testid":`only-banner`,children:[(0,X.jsxs)(`span`,{children:[`Showing only`,` `,n.only.startsWith(`group|`)?n.only.split(`|`).slice(2).join(`|`).replace(/^cluster:/,``)||n.only.split(`|`)[1]:n.only.startsWith(`area|`)?n.only.split(`|`).slice(2).join(`|`)?`${n.only.split(`|`).slice(2).join(`|`)}/`:n.only.split(`|`)[1]:n.only.slice(n.only.indexOf(`:`)+1),` `,`and what it links to.`]}),(0,X.jsx)(`button`,{"data-command":`show-only-links`,onClick:()=>r(`showOnlyLinks`,{}),children:`Show everything`})]}),n.project?n.run!==null&&(n.compare!==null||n.run!==P)?(0,X.jsxs)(`div`,{className:`notice draft`,role:`status`,"data-testid":`draft-banner`,children:[(0,X.jsx)(`span`,{children:n.compare?`Comparing run ${n.compare.a} with run ${n.compare.b}: the canvas shows run ${n.compare.b}, its changes marked.`:n.run===L?.runId?`You're viewing a draft of your uncommitted edits (run ${n.run}). The latest analysis is unchanged.`:n.run===B?.runId?`You're viewing a debug run that stopped after ${B.stages.at(-1)?.stage??`?`} (run ${n.run}): it shows only what those stages produced, and is never committed. The latest analysis is unchanged.`:`You're viewing run ${n.run}, not the latest analysis.`}),n.run===B?.runId&&P!==null&&!n.compare&&(0,X.jsx)(`button`,{"data-command":`compare-runs`,"data-testid":`debug-compare`,onClick:()=>r(`compareRuns`,{a:P,b:B.runId}),children:`Compare with latest`}),(0,X.jsx)(`button`,{"data-command":`open-run`,onClick:()=>r(`openRun`,{}),children:`Back to latest`})]}):(0,X.jsxs)(X.Fragment,{children:[L&&(0,X.jsxs)(`div`,{className:`notice`,role:`status`,"data-testid":`draft-ready`,children:[(0,X.jsxs)(`span`,{children:[`A draft of your uncommitted edits is ready (run `,L.runId,`).`]}),(0,X.jsx)(`button`,{"data-command":`open-run`,onClick:()=>r(`openRun`,{run:L.runId}),children:`Open it`})]}),B&&(0,X.jsxs)(`div`,{className:`notice`,role:`status`,"data-testid":`debug-ready`,children:[(0,X.jsxs)(`span`,{children:[`A debug run that stopped after `,B.stages.at(-1)?.stage??`?`,` is ready (run`,` `,B.runId,`).`]}),(0,X.jsx)(`button`,{"data-command":`open-run`,onClick:()=>r(`openRun`,{run:B.runId}),children:`Open it`})]})]}):null,n.project&&q.length>0&&ae!==`running`&&(0,X.jsxs)(`div`,{className:`notice`,role:`status`,"data-testid":`stale-evidence`,children:[(0,X.jsx)(`span`,{children:YE(q)}),(0,X.jsx)(`button`,{onClick:It,"data-testid":`stale-reanalyze`,children:`Re-analyze`})]}),pe&&(0,X.jsxs)(`div`,{className:`error`,role:`alert`,"data-testid":`error`,children:[(0,X.jsx)(`span`,{children:pe}),(0,X.jsx)(`button`,{className:`icon`,"aria-label":`Dismiss`,onClick:()=>me(``),children:`×`})]}),_e&&(0,X.jsx)(FE,{current:i.find(e=>e.id===(ye??n.project))?.name??(ye?`the new project`:null),intoByDefault:ye!==null||i.find(e=>e.id===n.project)?.sources===0,onAdd:(e,t)=>void Ct(e,t),onCancel:()=>{ve(!1),be(null),b(``)},error:v}),xe&&n.project&&(0,X.jsx)($S,{initialTab:xe,project:n.project,projectName:i.find(e=>e.id===n.project)?.name??n.project,refresh:Ee,onClose:()=>Se(null),onAdd:()=>{Se(null),ve(!0)},onChooseFiles:e=>we({source:e}),onAnalyzeAll:It,onChanged:De,covered:Ce!==null},xe),jt&&(()=>{let e=Pt(jt);return(0,X.jsx)(dC,{title:e.title,entries:e.entries,x:jt.x,y:jt.y,onClose:Nt})})(),Ce!==null&&n.project&&(0,X.jsx)(iC,{project:n.project,only:Ce.source,...Ce.path?{at:Ce.path}:{},files:l,run:D,onAnalyze:()=>{It(),we(null)},onClose:()=>we(null)}),$e&&(0,X.jsx)(AE,{onClose:()=>{et(!1),at.current?.focus()},onSaved:e=>Qe(e)}),!n.project&&(0,X.jsx)(lC,{projects:i,progress:de,loading:!s,onOpen:e=>r(`selectProject`,{project:e}),onCreated:e=>{De(),r(`selectProject`,{project:e}),be(e),ve(!0)},onAddFolder:()=>ve(!0),onDeleted:()=>De()}),n.project&&(0,X.jsxs)(`main`,{className:[tt&&n.panel===`answer`&&!Qt?`wide-aside`:``,C?`nav-hidden`:``].filter(Boolean).join(` `),children:[C?(0,X.jsx)(`div`,{className:`nav-collapsed-bar`,children:(0,X.jsx)(`button`,{className:`icon`,"data-command":`show-nav`,title:`Show the ${$t?`groups`:`files`} pane ( [ )`,"aria-label":`Show the ${$t?`groups`:`files`} pane`,onClick:()=>T(!1),children:`⟩`})}):$t?(0,X.jsx)(AC,{project:n.project,run:je,source:n.source,group:n.group,file:n.file,fileLevel:n.fileLevel,expand:n.expand,showPending:n.showPending,onOpenGroup:(e,t)=>r(`openGroup`,e?{group:e,...t?{folder:t}:{}}:{}),onCloseGroup:()=>r(n.area?`openArea`:`openGroup`,n.area?{area:n.area}:{}),onOpenFile:(e,t)=>r(`openImportsFile`,t?{file:e,group:t}:{file:e}),onToggleFolder:e=>r(`toggleFolder`,{path:e}),onCollapse:()=>T(!0),onMenu:Mt,sources:ft,onScope:e=>r(`scopeSource`,e?{source:e}:{}),area:n.area??null}):null,(0,X.jsx)(DT,{hidden:C||$t,onReveal:()=>{T(!1),n.tab!==`file`&&r(`showTab`,{tab:`file`})},onCollapse:()=>T(!0),project:n.project,files:l,counts:d,current:n.file,onOpen:e=>r(`openFile`,{file:e}),onImports:e=>r(`openImportsFile`,{file:e}),onMenu:Mt,run:D,onAnalyze:()=>{n.project&&(se(`running`),Y.analyze(n.project).catch(e=>me(e.message)))},sources:ft,scope:n.source,onScope:e=>r(`scopeSource`,e?{source:e}:{})},n.project??``),(0,X.jsxs)(`section`,{className:`center`,children:[(0,X.jsx)(TE,{project:n.project,run:D?.runId===P?D:null,sources:ft,onAnalyze:It,onKept:()=>{_S(),De()},onChooseFiles:e=>we({source:e})},`${n.project}:${P}`),n.project&&n.tab===`reach`&&n.reach&&P!==null?(0,X.jsx)(Ow,{project:n.project,run:je,root:n.reach.root,direction:n.reach.direction,onDirection:e=>r(`openReach`,{root:n.reach.root,direction:e}),onReach:e=>r(`openReach`,{root:e}),onOpenFile:e=>{r(`openFile`,{file:e}),r(`showTab`,{tab:`file`})},onContext:Mt}):n.project&&n.tab===`reach`&&P===null?(0,X.jsx)(`div`,{className:`empty`,"data-testid":`reach-empty`,children:`Reach needs an analysis: run one, and open Reach from a function or file.`}):n.project&&$t?(0,X.jsx)(vw,{marks:Ne,only:n.only,onContext:Mt,project:n.project,projectName:i.find(e=>e.id===n.project)?.name??n.project,run:je,group:n.group,area:n.area,onOpenArea:e=>r(`openArea`,e?{area:e}:{}),source:n.source,grouping:n.grouping,differences:n.differences,onSetGrouping:e=>r(`setGrouping`,{grouping:e}),onToggleDifferences:()=>r(`toggleDifferences`),reveal:n.reveal,onReveal:(e,t)=>r(`revealFile`,{file:e,from:t}),onResetReveal:()=>r(`resetReveal`),pick:n.pick,file:n.file,fileLevel:n.fileLevel,expand:n.expand,showPending:n.showPending,onPick:e=>r(`pickNode`,{id:e}),onOpenGroup:e=>r(`openGroup`,e?{group:e}:{}),onOpenFile:(e,t)=>r(`openImportsFile`,t?{file:e,group:t}:{file:e}),onToggleFolder:e=>r(`toggleFolder`,{path:e}),onTogglePending:()=>r(`togglePending`),onClear:xt,onFileFindings:St}):m?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`toolbar`,children:[(0,X.jsx)(`span`,{className:`file-title`,"data-testid":`file-title`,title:m.file.path,children:Te(m.file.path)}),m.file.status===`degraded`&&(0,X.jsx)(`span`,{className:`badge degraded`,"data-testid":`degraded`,title:m.file.reason??``,children:`partly analyzed`}),(0,X.jsx)(`span`,{className:`spacer`}),m.file.status!==`not_analyzed`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{"data-command":`file-to-imports`,title:`This file on the Imports tab: what it imports, what depends on it, its calls across files (2)`,onClick:()=>r(`openImportsFile`,{file:m.file.id}),children:[`⇄ Imports`,(0,X.jsx)(`span`,{className:`wide-only`,children:` of this file`})]}),(0,X.jsxs)(`div`,{className:`segmented`,role:`group`,"aria-label":`Show as`,children:[(0,X.jsx)(`button`,{"aria-pressed":Zt===`graph`,"data-testid":`show-graph`,onClick:()=>ut(`graph`),children:`Graph`}),(0,X.jsx)(`button`,{"aria-pressed":Zt===`list`,"data-testid":`show-list`,onClick:()=>ut(`list`),children:`List`})]}),(0,X.jsxs)(`label`,{className:`toggle`,title:`Calls within this file the analysis could not resolve, drawn in the graph (press u): ${Gt} of the ${m.unresolved.length} unresolved calls here; the rest are imports or built-ins.${ht&&n.file&&g===`file`&&mt?.kind===`file`&&ht.counts.openCalls!==Gt?` Findings lists ${ht.counts.openCalls} open calls for this file: it adds calls through imports that couldn't be linked.`:``}`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-command":`toggle-unresolved`,checked:n.showUnresolved&&Gt>0,disabled:Gt===0,onChange:()=>r(`toggleUnresolved`)}),`Open questions (`,JE(Gt),`)`]}),m.functions.length>80&&Zt===`graph`&&(0,X.jsxs)(`label`,{className:`toggle`,title:`Large files show the selection and its neighbours`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`whole-file`,checked:st,onChange:e=>ct(e.target.checked)}),`Whole file`]})]})]}),m.file.status!==`not_analyzed`&&n.project&&(0,X.jsx)(gw,{project:n.project,file:m.file.id,version:je,onImports:()=>r(`openImportsFile`,{file:m.file.id}),onFindings:St}),Wt&&Zt===`graph`&&(0,X.jsxs)(`p`,{className:`focus-note`,"data-testid":`focus-note`,children:[Bt?Xt===0?`${Yt} calls nothing else in this file, and nothing here calls it. `:`${Yt} and ${Math.min(Xt,Wt.size-1)} of its ${Xt} direct neighbours${Wt.size-1>Xt?`, with some of theirs`:``}. `:Ht?`This call, its two functions and a few of their neighbours. `:`The ${Wt.size} most connected of ${m.functions.length} functions. Select one to focus on it${n.showUnresolved?` and see its open questions`:``}. `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>ut(`list`),children:`See all in the list`})]}),m.findings.length>0&&(0,X.jsx)(`ul`,{className:`findings`,"data-testid":`findings`,children:m.findings.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`strong`,{children:e.kind}),`: `,e.message]},e.id))}),m.file.status===`not_analyzed`?(0,X.jsx)(`p`,{className:`hint`,"data-testid":`not-analyzed`,children:LE(m.file.reason)}):Zt===`graph`?(0,X.jsx)(_E,{marks:Ne,only:n.only,onContext:Mt,graph:m,showUnresolved:n.showUnresolved,selection:n.selection,onSelect:bt,onClear:xt,focus:Wt,sitesFor:Bt,answered:Jt,extraSite:qt}):(0,X.jsx)(IE,{graph:m,showUnresolved:n.showUnresolved,selection:n.selection,onSelect:bt,extraSite:qt,onContext:Mt})]}):n.file?(0,X.jsxs)(`p`,{className:`hint`,"data-testid":`loading-file`,children:[`Loading `,l.find(e=>e.id===n.file)?.path??`the file`,`…`]}):Qt?(0,X.jsx)(`div`,{className:`centre-answer`,children:en}):n.project&&l.length>0?(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(kE,{project:n.project,files:l,run:D?.runId===P?D:null,counts:d,source:n.source??null,sources:ft,onOpen:e=>r(`openFile`,{file:e}),onQuestions:()=>{vt(`open-call`),r(`showPanel`,{panel:`questions`})}})}):n.project&&k&&j&&P!==null?(0,X.jsxs)(`div`,{className:`overview`,"data-testid":`overview-empty`,children:[(0,X.jsx)(`p`,{className:`hint`,children:`No files were analyzed in this project.`}),(0,X.jsx)(DE,{run:D?.runId===P?D:null})]}):(0,X.jsx)(`p`,{className:`hint`,children:n.project&&(!k||!j)?`Loading ${i.find(e=>e.id===n.project)?.name??`the project`}…`:(0,X.jsxs)(X.Fragment,{children:[`Add a folder to analyze it.`,` `,(0,X.jsx)(`button`,{className:`primary`,"data-testid":`empty-add-folder`,onClick:()=>ve(!0),children:`Add folder`})]})})]}),(0,X.jsx)(`aside`,{children:n.history&&n.project?(0,X.jsx)(qS,{project:n.project,refresh:Ee,run:n.run,compare:n.compare,diff:Me.data,diffError:Me.error,onView:e=>r(`openRun`,e===null?{}:{run:e}),onCompare:e=>r(`compareRuns`,e??{}),onClose:()=>r(`toggleHistory`,{}),onLocate:Le,stages:G,onDebug:At,onFrom:kt}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`tabs`,role:`tablist`,children:[(Re||Ge||n.panel===`answer`)&&!Qt&&(0,X.jsx)(`button`,{role:`tab`,"data-command":`show-panel`,"data-testid":`answer-tab`,"aria-selected":n.panel===`answer`,onClick:()=>r(`showPanel`,{panel:`answer`}),children:`Answer`}),(0,X.jsx)(`button`,{role:`tab`,"data-command":`show-panel`,"aria-selected":n.panel===`evidence`,title:$t?`What is picked on the canvas, in detail`:`The code that proves what is selected`,onClick:()=>r(`showPanel`,{panel:`evidence`}),children:`Selected`}),(0,X.jsxs)(`button`,{role:`tab`,"data-command":`show-panel`,"data-testid":`questions-tab`,"aria-selected":n.panel===`questions`,title:mt&&g===`file`?`What the analysis couldn't settle in this ${mt.kind}`:`What the analysis couldn't settle in the project`,onClick:()=>r(`showPanel`,{panel:`questions`}),children:[mt&&g===`file`?`Findings here`:`Findings`,gt===null?``:` (${JE(gt)})`]})]}),n.panel===`answer`&&!Qt?en:n.panel===`evidence`||n.panel===`answer`?(0,X.jsxs)(X.Fragment,{children:[Re&&!Qt&&(0,X.jsx)(`button`,{className:`link back`,onClick:()=>t({type:`reset`,name:`showPanel`,args:{panel:`answer`}}),children:`← Back to the answer`}),$t&&n.project?(0,X.jsx)(Bw,{project:n.project,run:je,group:n.group,pick:n.pick,file:n.file,fileLevel:n.fileLevel,expand:n.expand,showPending:n.showPending,onPick:e=>r(`pickNode`,{id:e}),onOpenGroup:e=>r(`openGroup`,{group:e}),onOpenFile:e=>r(`openImportsFile`,{file:e}),onToggleFolder:e=>r(`toggleFolder`,{path:e})}):(0,X.jsx)(RE,{project:n.project,graph:m,changedOnDisk:ie,selection:n.selection,onClear:xt,onSelect:bt,onOpenFunction:e=>r(`select`,{kind:`function`,...e}),onShowImports:()=>r(`showTab`,{tab:`imports`}),sources:ft})]}):n.project&&(0,X.jsx)(jS,{project:n.project,run:je,scope:mt,wholeProject:g===`project`,canScope:mt!==null,counts:ht?.counts??null,showPending:n.showPending,refresh:Ee,onWholeProject:e=>_(e?`project`:`file`),onTogglePending:()=>r(`togglePending`),filter:_t,onFilter:vt,onSelectSite:(e,t)=>r(`select`,{kind:`site`,id:e,file:t}),onOpenImport:(e,t,n)=>r(`openImportsFile`,n?{file:e,pick:t,group:n}:{file:e,pick:t}),onManageLicense:()=>{W(`openProjectSettings`,{tab:`license`}),Se(`license`)}})]})})]})]})})}function PE({stage1:e,message:t,progress:n=null,onFullRun:r,latest:i,loading:a,onCancel:o}){let[,s]=(0,y.useState)(0);(0,y.useEffect)(()=>{if(!n)return;let e=setInterval(()=>s(e=>e+1),1e3);return()=>clearInterval(e)},[n===null]);let c=n&&t!==`Cancelling…`?T(n):null,l=n?.startedAt?Date.parse(n.startedAt):null,u=c&&l?Math.max(0,Math.round((Date.now()-l)/1e3)):null,d=(c?`${c.text}${u===null?``:` · ${u<60?`${u} s`:`${Math.floor(u/60)} min ${u%60} s`}`}`:``)||t||(i?i.status===`failed`?i.errorCode===`cancelled`?`Analysis cancelled; the graph is as it was`:`Analysis failed${i.error?`: ${i.error}`:``}`:i.status===`running`?`Analyzing…`:`Analyzed${i.finishedAt?` ${we(i.finishedAt)}`:``}`:a?`Loading…`:``);return(0,X.jsxs)(`ol`,{className:`timeline`,"data-testid":`timeline`,children:[n&&n.stages.length>0?n.stages.map((e,t)=>{let r=n.finished.find(t=>t.stage===e),i=r?`done`:e===n.stage?`running`:`pending`;return(0,X.jsx)(`li`,{className:i,"data-stage":e,"data-state":i,title:`${C[e]??e}${r?`: done in ${(r.durationMs/1e3).toFixed(1)} s`:i===`running`?`: running`:`: next`}`,children:(0,X.jsx)(`span`,{className:`dot`})},e)}):null,!(n&&n.stages.length>0)&&ME.filter(e=>e.release===`R1`).map(t=>{let n=t.id===`stage1`?e:`future`;return(0,X.jsx)(`li`,{className:n,"data-stage":t.id,"data-state":n,title:t.name,children:(0,X.jsx)(`span`,{className:`dot`})},t.id)}),(0,X.jsxs)(`li`,{className:`message`,"data-testid":`run-message`,title:i?`${d} · run ${i.runId}`:d||void 0,children:[(0,X.jsx)(`span`,{className:`status-text`,"data-testid":`run-status-text`,children:d}),c&&(0,X.jsx)(`span`,{className:`run-bar`,"data-testid":`run-bar`,role:`progressbar`,"aria-label":`Analysis progress`,...c.fraction===null?{}:{"aria-valuenow":Math.round(c.fraction*100)},children:(0,X.jsx)(`span`,{style:{width:`${Math.round((c.fraction??0)*100)}%`}})}),r&&(0,X.jsx)(`button`,{className:`link`,"data-testid":`full-run`,onClick:r,children:`Analyze the whole project`}),o&&(0,X.jsx)(`button`,{className:`link`,"data-testid":`cancel-run`,disabled:t===`Cancelling…`,onClick:o,title:`Stop this analysis; the graph stays as it was`,children:`Cancel`})]})]})}function FE({current:e,onAdd:t,onCancel:n,error:r,intoByDefault:i=!1}){let[a,o]=(0,y.useState)(i),[s,c]=(0,y.useState)(``),l=(0,y.useRef)(null);return(0,y.useEffect)(()=>l.current?.focus(),[]),(0,y.useEffect)(()=>{let e=e=>e.key===`Escape`&&n();return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,X.jsx)(`div`,{className:`backdrop`,onMouseDown:e=>e.target===e.currentTarget&&n(),children:(0,X.jsxs)(`form`,{className:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`add-title`,onSubmit:e=>{e.preventDefault(),s.trim()&&t(s.trim(),a)},children:[(0,X.jsx)(`h2`,{id:`add-title`,children:`Add a folder`}),(0,X.jsxs)(`label`,{children:[`Folder to analyze`,(0,X.jsx)(`input`,{ref:l,"data-testid":`folder-path`,value:s,onChange:e=>c(e.target.value),placeholder:`/Users/you/projects/app`,spellCheck:!1}),r?(0,X.jsx)(`small`,{className:`field-error`,role:`alert`,children:r}):(0,X.jsx)(`small`,{className:`muted`,children:`The absolute path of a git repository or any folder. It is read, never changed.`})]}),e&&(0,X.jsxs)(`label`,{className:`inline`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-testid":`add-into-current`,checked:a,onChange:e=>o(e.target.checked)}),`Add it to `,e,` instead of a new project (to analyze several repositories together)`]}),(0,X.jsxs)(`div`,{className:`buttons`,children:[(0,X.jsx)(`span`,{className:`spacer`}),(0,X.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`}),(0,X.jsx)(`button`,{type:`submit`,className:`primary`,"data-testid":`add-folder-submit`,children:`Add and analyze`})]})]})})}function IE({graph:e,showUnresolved:t,selection:n,onSelect:r,extraSite:i=null,onContext:a}){let o=new Map(e.functions.map(e=>[e.id,be(e).name])),s=[...e.functions].sort((e,t)=>e.evidence.span.start.line-t.evidence.span.start.line),c=e.unresolved.filter(e=>t&&p(e)&&e.id!==i).sort((e,t)=>e.evidence.span.start.line-t.evidence.span.start.line),l=i?e.unresolved.find(e=>e.id===i):void 0,u=(e,t,i)=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"data-command":`select`,"data-kind":e.kind,"data-id":e.id,className:n?.kind===e.kind&&n.id===e.id?`selected`:``,onClick:()=>r(e),onContextMenu:t=>{let n=e.kind===`function`?`function`:e.kind===`call`?`edge`:null;n&&a&&(t.preventDefault(),a({kind:n,id:e.id,data:n===`edge`?{kind:`call`,calls:[e.id]}:{},x:t.clientX,y:t.clientY}))},children:[t,i&&(0,X.jsxs)(`small`,{className:`muted`,children:[` `,i]})]})},`${e.kind}:${e.id}`);return(0,X.jsxs)(`div`,{className:`elements`,"data-testid":`elements`,children:[(0,X.jsxs)(`h4`,{children:[`Functions (`,e.functions.length,`)`]}),(0,X.jsx)(`ul`,{children:s.map(e=>{let t=be(e);return u({kind:`function`,id:e.id},`${t.unnamed?`λ`:`ƒ`} ${t.name}`,t.parent?`in ${t.parent}`:void 0)})}),e.calls.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{children:[`Calls (`,e.calls.length,`)`]}),(0,X.jsx)(`ul`,{children:e.calls.map(e=>u({kind:`call`,id:e.id},`${o.get(e.from)??KE(e)} → ${o.get(e.to)??KE(e)} (line ${e.evidence.span.start.line})`))})]}),l&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h4`,{children:`Selected call site`}),(0,X.jsx)(`ul`,{children:u({kind:`site`,id:l.id},`? ${l.expression}`,`line ${l.evidence.span.start.line} · ${l.status===`awaiting-link`?`not linked across files`:l.status}`)})]}),c.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h4`,{children:[`Open questions (`,c.length,`)`]}),(0,X.jsx)(`ul`,{children:c.map(e=>u({kind:`site`,id:e.id},`? ${e.expression}`,`${d(e.reason)}, line ${e.evidence.span.start.line}`))})]})]})}function LE(e){switch(e){case`declaration-file`:return`Type declarations only (.d.ts): there are no functions to show.`;case`language-not-analyzed`:return`This language is not analyzed yet; Python, Go and Rust arrive in a later release.`;case`too-large`:return`This file is too large to analyze.`;case`binary`:return`This is not a text file.`;case`minified`:return`Minified code (built output, not source); choose it in Choose files to analyze it anyway.`;default:return`This file was not analyzed${e?` (${e})`:``}.`}}function RE({project:e,graph:t,changedOnDisk:n,selection:r,onClear:i,onSelect:a,onOpenFunction:o,onShowImports:s,sources:c}){let[l,u]=(0,y.useState)(null),[d,f]=(0,y.useState)(!1),[p,m]=(0,y.useState)(null),h=(0,y.useRef)(null),g=(0,y.useMemo)(()=>new Map(c.map(e=>[e.id,e.root])),[c]),_=(0,y.useMemo)(()=>{if(!t||!r)return null;if(r.kind===`function`){let e=t.functions.find(e=>e.id===r.id),n=e&&oe(e.qualifiedName,void 0,e.title);return e&&n&&{title:`function ${n.name}`,parent:n.parent,detail:[e.kind===`module`?BE.module:e.kind===`function`?``:BE[e.kind]??e.kind,e.exported?`exported`:``,e.isAsync?`async`:``].filter(Boolean).join(`, `),evidence:e.evidence,provenance:e.provenance,frame:e.id,whole:e.qualifiedName===`<module>`}}if(r.kind===`call`){let e=t.calls.find(e=>e.id===r.id),n=e=>{let n=t.functions.find(t=>t.id===e);return n?oe(n.qualifiedName,void 0,n.title).name:e};return e&&{title:`${n(e.from)} calls ${n(e.to)}`,parent:``,detail:`${VE[e.form]??`${e.form} call`} on line ${e.evidence.span.start.line}${e.resolution===`static-exact`?``:`, ${HE[e.resolution]??e.resolution}`}`,evidence:e.evidence,provenance:e.provenance,frame:e.from,whole:!1}}let e=t.unresolved.find(e=>e.id===r.id);return e&&{title:`Open question: ${e.expression}`,parent:``,detail:WE(e),evidence:e.evidence,provenance:e.provenance,frame:e.enclosingFn,whole:!1}},[t,r]),v=(0,y.useMemo)(()=>{if(!t||!_)return null;let e=t.functions.find(e=>e.id===_.frame)?.evidence.span??_.evidence.span,n=_.evidence.span,i=e=>{let n=t.functions.find(t=>t.id===e);return n?oe(n.qualifiedName,void 0,n.title).name:e},o=t.calls.filter(e=>e.from===_.frame&&e.id!==r?.id).map(e=>({start:e.evidence.span.start,end:e.evidence.span.end,kind:`call`,title:`Calls ${i(e.to)} (select)`,onClick:()=>a({kind:`call`,id:e.id})}));r?.kind!==`function`&&o.push({start:n.start,end:n.end,kind:`focus`});let s=e.end.line-e.start.line+1,c=Math.max(e.start.line,Math.min(n.start.line-30,e.end.line-zE+1));return{frame:e,panel:s<=zE?e:{start:{...e.start,line:c},end:{...e.end,line:Math.min(e.end.line,c+zE-1)}},marks:o,focusLine:n.start.line,clipped:s>zE}},[t,_,r,a]),b=_?.evidence.file??null,x=v?`${b}|${v.panel.start.line}|${v.panel.end.line}`:``,S=v?.clipped?`${b}|${v.frame.start.line}|${v.frame.end.line}`:``;(0,y.useEffect)(()=>{if(!e||!b||!v){u(null);return}let t=!1;return Y.snippet(e,b,v.panel).then(e=>!t&&u(e),()=>!t&&u(null)),()=>{t=!0}},[e,x]),(0,y.useEffect)(()=>{if(!d||!e||!b||!v||!S)return;let t=!1;return Y.snippet(e,b,v.frame).then(e=>!t&&m(e),()=>!t&&m(null)),()=>{t=!0}},[d,e,S]);let C=v?.clipped?p:l;if((0,y.useEffect)(()=>{_||f(!1)},[_]),!_)return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`hint`,children:`Select a function or a call, in the graph or the list, to see the code that proves it.`}),e&&t&&(0,X.jsx)(_C,{project:e,file:t.file.id,run:t.committedRun,onOpen:o,onShowImports:s})]});let{span:w}=_.evidence,T=_.evidence.file.slice(0,_.evidence.file.indexOf(`:`)),E=t?.file.path??``,D=g.get(T)?GE(`${g.get(T)}/${E}`):null;return(0,X.jsxs)(`div`,{className:`evidence`,"data-testid":`evidence`,children:[(0,X.jsxs)(`div`,{className:`evidence-head`,children:[(0,X.jsx)(`h3`,{"data-testid":`evidence-title`,children:_.title}),(0,X.jsx)(`button`,{className:`icon close`,"data-command":`clear-selection`,"aria-label":`Clear the selection (Esc)`,title:`Clear the selection (Esc)`,onClick:i,children:`×`})]}),_.parent&&(0,X.jsxs)(`p`,{className:`muted small`,children:[`in `,_.parent]}),_.detail&&(0,X.jsx)(`p`,{children:_.detail}),e&&t&&r?.kind===`function`&&(0,X.jsx)(IC,{project:e,graph:t,fn:r.id,onOpen:o,onShowImports:s}),e&&t&&r?.kind===`function`&&(0,X.jsx)(MC,{project:e,fn:r.id,run:t.committedRun,onOpen:o}),e&&r&&r.kind!==`function`&&(0,X.jsx)(Re,{project:e,id:r.id},r.id),_.provenance&&(0,X.jsxs)(`p`,{className:`muted small`,"data-testid":`evidence-provenance`,children:[`Found by `,Ce(_.provenance.stage),` · run `,_.provenance.run]}),n.has(_.evidence.file)&&(0,X.jsx)(`p`,{className:`muted small`,"data-testid":`evidence-changed`,children:`This file changed on disk since it was analyzed. The code shown is what was analyzed; the editor may open it at a different line. Re-analyze to update.`}),(0,X.jsxs)(`p`,{className:`location`,"data-testid":`evidence-location`,children:[(0,X.jsxs)(`code`,{children:[E,`:`,w.start.line,`:`,w.start.column]}),D&&(0,X.jsx)(`a`,{className:`button-link`,"data-testid":`open-in-editor`,href:`vscode://file${D}:${w.start.line}:${w.start.column}`,children:`Open in editor`}),l&&(0,X.jsx)(`button`,{className:`button-link`,ref:h,onClick:()=>f(!0),"data-testid":`expand-code`,children:`Expand`})]}),l&&v&&(0,X.jsx)(Fw,{snippet:l,marks:v.marks,focusLine:v.focusLine,testId:`snippet`}),l&&v&&v.marks.some(e=>e.kind===`call`)&&(0,X.jsxs)(`p`,{className:`muted small legend`,children:[r?.kind!==`function`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`mark hit`,children:`The selection`}),`;`,` `]}),(0,X.jsx)(`span`,{className:`mark call-mark`,children:`highlighted`}),` calls in this function; click one to see it.`]}),l&&v?.clipped&&(0,X.jsxs)(`p`,{className:`muted small`,children:[`Showing lines `,l.startLine,`–`,l.startLine+l.lines.length-1,`.`,` `,(0,X.jsx)(`button`,{className:`link`,onClick:()=>f(!0),children:`Expand to see all of it`})]}),(0,X.jsxs)(`p`,{className:`commit muted small`,title:_.evidence.commit,children:[`at commit `,(0,X.jsx)(`code`,{children:_.evidence.commit.slice(0,12)}),` `,(0,X.jsx)(`button`,{className:`link`,"data-testid":`copy-commit`,"aria-label":`Copy the full commit`,onClick:()=>void navigator.clipboard?.writeText(_.evidence.commit),children:`copy`})]}),d&&v&&(0,X.jsx)(Iw,{title:_.title,location:`${E}:${w.start.line}`,snippet:C,marks:v.marks,focusLine:v.focusLine,onClose:()=>{f(!1),h.current?.focus()}})]})}var zE=400,BE={function:`Function`,method:`Method`,arrow:`Arrow function`,constructor:`Constructor`,getter:`Getter`,setter:`Setter`,module:`The file's top-level code`},VE={plain:`Called`,member:`Called as a method`,optional:`Called with ?.`,new:`Constructed with new`,super:`Called through super`,"call-apply":`Called with call/apply`,bind:`Bound with bind`,"tagged-template":`Called as a tagged template`,decorator:`Applied as a decorator`,jsx:`Rendered as a JSX element`,iife:`Called immediately`},HE={"static-exact":`resolved exactly`,"static-inferred":`resolved by inference`,"dynamic-only":`seen only at run time`,"runtime-confirmed":`confirmed at run time`};function UE({tab:e,reach:t,onTab:n}){return(0,X.jsx)(`div`,{className:`segmented view-tabs`,role:`tablist`,"aria-label":`View`,children:(t?[`file`,`imports`,`reach`]:[`file`,`imports`]).map(t=>(0,X.jsx)(`button`,{role:`tab`,"aria-selected":e===t,"data-command":`show-tab`,"data-tab":t,title:t===`file`?`Files: inside one file, its functions and calls (1)`:t===`imports`?`Imports: how files and groups depend on each other (2)`:`Reach: where paths from or to one function or file go (3)`,onClick:()=>n(t),children:t===`file`?`Files`:t===`imports`?`Imports`:`Reach`},t))})}function WE(e){switch(e.reason){case`dynamic-dispatch`:return`Type unknown: the call is on a value whose type the analysis doesn't know (dynamic dispatch), so it can't tell which function runs.`;case`reflection`:return`Reflection: called through eval, Reflect or Function, so the target is unknown.`;case`template-binding`:return`Awaiting its component: a call in a template file, resolved once a component declaring the template is analyzed.`;case`template-reference`:return`Registered elsewhere: a component or directive registered outside this file (a global or a module), so its definition isn't linked.`;case`imported-symbol`:return`Imported${e.importSpecifier?` from '${e.importSpecifier}'`:``}: calls across files are not linked yet.`;case`runtime-global`:return`Built-in: part of the language or runtime, outside the code analyzed.`;case`builtin-value`:return`On a built-in value: the value it is called on is a string, number, DOM element or other runtime value, so it runs the runtime's code.`;default:return`${e.reason} (${e.status})`}}function GE(e){let t=e.replace(/\\/g,`/`);return encodeURI(t.startsWith(`/`)?t:`/${t}`).replace(/#/g,`%23`).replace(/\?/g,`%3F`)}function KE(e){return`${oe(e.function.qualifiedName,void 0,e.function.title).name} (${e.function.path})`}function qE(e){return e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)||e.startsWith(`\\\\`)}function JE(e){return e<1e3?String(e):e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}k`:`${Math.round(e/100)/10}k`.replace(/\.0k$/,`k`)}function YE(e){let t=e=>e.root.split(/[\\/]/).filter(Boolean).at(-1)??e.sourceId,n=e=>e.changed.length+e.removed.length;if(e.length===1){let r=e[0],i=n(r),a=i===1?r.changed[0]??r.removed[0]:`${i} files`;return`${t(r)} changed on disk since it was analyzed (${a}), so some evidence may point at old lines.`}return`${e.map(t).join(`, `)} changed on disk since they were analyzed, so some evidence may point at old lines.`}(0,b.createRoot)(document.getElementById(`root`)).render((0,X.jsx)(y.StrictMode,{children:(0,X.jsx)(NE,{})}));