ccdeck 3.24.1 → 3.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,296 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();var Ju=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var np={exports:{}},Dl={},rp={exports:{}},ut={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var xk;function II(){if(xk)return ut;xk=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.iterator;function y(L){return L===null||typeof L!="object"?null:(L=m&&L[m]||L["@@iterator"],typeof L=="function"?L:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,k={};function S(L,K,de){this.props=L,this.context=K,this.refs=k,this.updater=de||w}S.prototype.isReactComponent={},S.prototype.setState=function(L,K){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,K,"setState")},S.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function b(){}b.prototype=S.prototype;function j(L,K,de){this.props=L,this.context=K,this.refs=k,this.updater=de||w}var E=j.prototype=new b;E.constructor=j,N(E,S.prototype),E.isPureReactComponent=!0;var C=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function D(L,K,de){var O,Y={},B=null,te=null;if(K!=null)for(O in K.ref!==void 0&&(te=K.ref),K.key!==void 0&&(B=""+K.key),K)T.call(K,O)&&!$.hasOwnProperty(O)&&(Y[O]=K[O]);var le=arguments.length-2;if(le===1)Y.children=de;else if(1<le){for(var pe=Array(le),ye=0;ye<le;ye++)pe[ye]=arguments[ye+2];Y.children=pe}if(L&&L.defaultProps)for(O in le=L.defaultProps,le)Y[O]===void 0&&(Y[O]=le[O]);return{$$typeof:e,type:L,key:B,ref:te,props:Y,_owner:R.current}}function U(L,K){return{$$typeof:e,type:L.type,key:K,ref:L.ref,props:L.props,_owner:L._owner}}function P(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function V(L){var K={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(de){return K[de]})}var J=/\/+/g;function ee(L,K){return typeof L=="object"&&L!==null&&L.key!=null?V(""+L.key):K.toString(36)}function M(L,K,de,O,Y){var B=typeof L;(B==="undefined"||B==="boolean")&&(L=null);var te=!1;if(L===null)te=!0;else switch(B){case"string":case"number":te=!0;break;case"object":switch(L.$$typeof){case e:case t:te=!0}}if(te)return te=L,Y=Y(te),L=O===""?"."+ee(te,0):O,C(Y)?(de="",L!=null&&(de=L.replace(J,"$&/")+"/"),M(Y,K,de,"",function(ye){return ye})):Y!=null&&(P(Y)&&(Y=U(Y,de+(!Y.key||te&&te.key===Y.key?"":(""+Y.key).replace(J,"$&/")+"/")+L)),K.push(Y)),1;if(te=0,O=O===""?".":O+":",C(L))for(var le=0;le<L.length;le++){B=L[le];var pe=O+ee(B,le);te+=M(B,K,de,pe,Y)}else if(pe=y(L),typeof pe=="function")for(L=pe.call(L),le=0;!(B=L.next()).done;)B=B.value,pe=O+ee(B,le++),te+=M(B,K,de,pe,Y);else if(B==="object")throw K=String(L),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return te}function Z(L,K,de){if(L==null)return L;var O=[],Y=0;return M(L,O,"","",function(B){return K.call(de,B,Y++)}),O}function G(L){if(L._status===-1){var K=L._result;K=K(),K.then(function(de){(L._status===0||L._status===-1)&&(L._status=1,L._result=de)},function(de){(L._status===0||L._status===-1)&&(L._status=2,L._result=de)}),L._status===-1&&(L._status=0,L._result=K)}if(L._status===1)return L._result.default;throw L._result}var I={current:null},q={transition:null},H={ReactCurrentDispatcher:I,ReactCurrentBatchConfig:q,ReactCurrentOwner:R};function W(){throw Error("act(...) is not supported in production builds of React.")}return ut.Children={map:Z,forEach:function(L,K,de){Z(L,function(){K.apply(this,arguments)},de)},count:function(L){var K=0;return Z(L,function(){K++}),K},toArray:function(L){return Z(L,function(K){return K})||[]},only:function(L){if(!P(L))throw Error("React.Children.only expected to receive a single React element child.");return L}},ut.Component=S,ut.Fragment=n,ut.Profiler=a,ut.PureComponent=j,ut.StrictMode=r,ut.Suspense=f,ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,ut.act=W,ut.cloneElement=function(L,K,de){if(L==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+L+".");var O=N({},L.props),Y=L.key,B=L.ref,te=L._owner;if(K!=null){if(K.ref!==void 0&&(B=K.ref,te=R.current),K.key!==void 0&&(Y=""+K.key),L.type&&L.type.defaultProps)var le=L.type.defaultProps;for(pe in K)T.call(K,pe)&&!$.hasOwnProperty(pe)&&(O[pe]=K[pe]===void 0&&le!==void 0?le[pe]:K[pe])}var pe=arguments.length-2;if(pe===1)O.children=de;else if(1<pe){le=Array(pe);for(var ye=0;ye<pe;ye++)le[ye]=arguments[ye+2];O.children=le}return{$$typeof:e,type:L.type,key:Y,ref:B,props:O,_owner:te}},ut.createContext=function(L){return L={$$typeof:c,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},L.Provider={$$typeof:l,_context:L},L.Consumer=L},ut.createElement=D,ut.createFactory=function(L){var K=D.bind(null,L);return K.type=L,K},ut.createRef=function(){return{current:null}},ut.forwardRef=function(L){return{$$typeof:u,render:L}},ut.isValidElement=P,ut.lazy=function(L){return{$$typeof:h,_payload:{_status:-1,_result:L},_init:G}},ut.memo=function(L,K){return{$$typeof:p,type:L,compare:K===void 0?null:K}},ut.startTransition=function(L){var K=q.transition;q.transition={};try{L()}finally{q.transition=K}},ut.unstable_act=W,ut.useCallback=function(L,K){return I.current.useCallback(L,K)},ut.useContext=function(L){return I.current.useContext(L)},ut.useDebugValue=function(){},ut.useDeferredValue=function(L){return I.current.useDeferredValue(L)},ut.useEffect=function(L,K){return I.current.useEffect(L,K)},ut.useId=function(){return I.current.useId()},ut.useImperativeHandle=function(L,K,de){return I.current.useImperativeHandle(L,K,de)},ut.useInsertionEffect=function(L,K){return I.current.useInsertionEffect(L,K)},ut.useLayoutEffect=function(L,K){return I.current.useLayoutEffect(L,K)},ut.useMemo=function(L,K){return I.current.useMemo(L,K)},ut.useReducer=function(L,K,de){return I.current.useReducer(L,K,de)},ut.useRef=function(L){return I.current.useRef(L)},ut.useState=function(L){return I.current.useState(L)},ut.useSyncExternalStore=function(L,K,de){return I.current.useSyncExternalStore(L,K,de)},ut.useTransition=function(){return I.current.useTransition()},ut.version="18.3.1",ut}var bk;function wc(){return bk||(bk=1,rp.exports=II()),rp.exports}/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var kk;function $I(){if(kk)return Dl;kk=1;var e=wc(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(u,f,p){var h,m={},y=null,w=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(w=f.ref);for(h in f)r.call(f,h)&&!l.hasOwnProperty(h)&&(m[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)m[h]===void 0&&(m[h]=f[h]);return{$$typeof:t,type:u,key:y,ref:w,props:m,_owner:a.current}}return Dl.Fragment=n,Dl.jsx=c,Dl.jsxs=c,Dl}var _k;function OI(){return _k||(_k=1,np.exports=$I()),np.exports}var i=OI(),ed={},sp={exports:{}},Bn={},ap={exports:{}},op={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var Nk;function LI(){return Nk||(Nk=1,(function(e){function t(q,H){var W=q.length;q.push(H);e:for(;0<W;){var L=W-1>>>1,K=q[L];if(0<a(K,H))q[L]=H,q[W]=K,W=L;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var H=q[0],W=q.pop();if(W!==H){q[0]=W;e:for(var L=0,K=q.length,de=K>>>1;L<de;){var O=2*(L+1)-1,Y=q[O],B=O+1,te=q[B];if(0>a(Y,W))B<K&&0>a(te,Y)?(q[L]=te,q[B]=W,L=B):(q[L]=Y,q[O]=W,L=O);else if(B<K&&0>a(te,W))q[L]=te,q[B]=W,L=B;else break e}}return H}function a(q,H){var W=q.sortIndex-H.sortIndex;return W!==0?W:q.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],p=[],h=1,m=null,y=3,w=!1,N=!1,k=!1,S=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(q){for(var H=n(p);H!==null;){if(H.callback===null)r(p);else if(H.startTime<=q)r(p),H.sortIndex=H.expirationTime,t(f,H);else break;H=n(p)}}function C(q){if(k=!1,E(q),!N)if(n(f)!==null)N=!0,G(T);else{var H=n(p);H!==null&&I(C,H.startTime-q)}}function T(q,H){N=!1,k&&(k=!1,b(D),D=-1),w=!0;var W=y;try{for(E(H),m=n(f);m!==null&&(!(m.expirationTime>H)||q&&!V());){var L=m.callback;if(typeof L=="function"){m.callback=null,y=m.priorityLevel;var K=L(m.expirationTime<=H);H=e.unstable_now(),typeof K=="function"?m.callback=K:m===n(f)&&r(f),E(H)}else r(f);m=n(f)}if(m!==null)var de=!0;else{var O=n(p);O!==null&&I(C,O.startTime-H),de=!1}return de}finally{m=null,y=W,w=!1}}var R=!1,$=null,D=-1,U=5,P=-1;function V(){return!(e.unstable_now()-P<U)}function J(){if($!==null){var q=e.unstable_now();P=q;var H=!0;try{H=$(!0,q)}finally{H?ee():(R=!1,$=null)}}else R=!1}var ee;if(typeof j=="function")ee=function(){j(J)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,Z=M.port2;M.port1.onmessage=J,ee=function(){Z.postMessage(null)}}else ee=function(){S(J,0)};function G(q){$=q,R||(R=!0,ee())}function I(q,H){D=S(function(){q(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,G(T))},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(q){switch(y){case 1:case 2:case 3:var H=3;break;default:H=y}var W=y;y=H;try{return q()}finally{y=W}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(q,H){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var W=y;y=q;try{return H()}finally{y=W}},e.unstable_scheduleCallback=function(q,H,W){var L=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?L+W:L):W=L,q){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=W+K,q={id:h++,callback:H,priorityLevel:q,startTime:W,expirationTime:K,sortIndex:-1},W>L?(q.sortIndex=W,t(p,q),n(f)===null&&q===n(p)&&(k?(b(D),D=-1):k=!0,I(C,W-L))):(q.sortIndex=K,t(f,q),N||w||(N=!0,G(T))),q},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(q){var H=y;return function(){var W=y;y=H;try{return q.apply(this,arguments)}finally{y=W}}}})(op)),op}var Sk;function PI(){return Sk||(Sk=1,ap.exports=LI()),ap.exports}/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var jk;function DI(){if(jk)return Bn;jk=1;var e=wc(),t=PI();function n(s){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+s,d=1;d<arguments.length;d++)o+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+s+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,a={};function l(s,o){c(s,o),c(s+"Capture",o)}function c(s,o){for(a[s]=o,s=0;s<o.length;s++)r.add(o[s])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[: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]*$/,h={},m={};function y(s){return f.call(m,s)?!0:f.call(h,s)?!1:p.test(s)?m[s]=!0:(h[s]=!0,!1)}function w(s,o,d,g){if(d!==null&&d.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return g?!1:d!==null?!d.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function N(s,o,d,g){if(o===null||typeof o>"u"||w(s,o,d,g))return!0;if(g)return!1;if(d!==null)switch(d.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function k(s,o,d,g,v,_,A){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=g,this.attributeNamespace=v,this.mustUseProperty=d,this.propertyName=s,this.type=o,this.sanitizeURL=_,this.removeEmptyString=A}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){S[s]=new k(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var o=s[0];S[o]=new k(o,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){S[s]=new k(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){S[s]=new k(s,2,!1,s,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s){S[s]=new k(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){S[s]=new k(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){S[s]=new k(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){S[s]=new k(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){S[s]=new k(s,5,!1,s.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function j(s){return s[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s){var o=s.replace(b,j);S[o]=new k(o,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var o=s.replace(b,j);S[o]=new k(o,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var o=s.replace(b,j);S[o]=new k(o,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){S[s]=new k(s,1,!1,s.toLowerCase(),null,!1,!1)}),S.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){S[s]=new k(s,1,!1,s.toLowerCase(),null,!0,!0)});function E(s,o,d,g){var v=S.hasOwnProperty(o)?S[o]:null;(v!==null?v.type!==0:g||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,d,v,g)&&(d=null),g||v===null?y(o)&&(d===null?s.removeAttribute(o):s.setAttribute(o,""+d)):v.mustUseProperty?s[v.propertyName]=d===null?v.type===3?!1:"":d:(o=v.attributeName,g=v.attributeNamespace,d===null?s.removeAttribute(o):(v=v.type,d=v===3||v===4&&d===!0?"":""+d,g?s.setAttributeNS(g,o,d):s.setAttribute(o,d))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),R=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),V=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),q=Symbol.iterator;function H(s){return s===null||typeof s!="object"?null:(s=q&&s[q]||s["@@iterator"],typeof s=="function"?s:null)}var W=Object.assign,L;function K(s){if(L===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);L=o&&o[1]||""}return`
34
- `+L+s}var de=!1;function O(s,o){if(!s||de)return"";de=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(ue){var g=ue}Reflect.construct(s,[],o)}else{try{o.call()}catch(ue){g=ue}s.call(o.prototype)}else{try{throw Error()}catch(ue){g=ue}s()}}catch(ue){if(ue&&g&&typeof ue.stack=="string"){for(var v=ue.stack.split(`
35
- `),_=g.stack.split(`
36
- `),A=v.length-1,X=_.length-1;1<=A&&0<=X&&v[A]!==_[X];)X--;for(;1<=A&&0<=X;A--,X--)if(v[A]!==_[X]){if(A!==1||X!==1)do if(A--,X--,0>X||v[A]!==_[X]){var ne=`
37
- `+v[A].replace(" at new "," at ");return s.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",s.displayName)),ne}while(1<=A&&0<=X);break}}}finally{de=!1,Error.prepareStackTrace=d}return(s=s?s.displayName||s.name:"")?K(s):""}function Y(s){switch(s.tag){case 5:return K(s.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return s=O(s.type,!1),s;case 11:return s=O(s.type.render,!1),s;case 1:return s=O(s.type,!0),s;default:return""}}function B(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case $:return"Fragment";case R:return"Portal";case U:return"Profiler";case D:return"StrictMode";case ee:return"Suspense";case M:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case V:return(s.displayName||"Context")+".Consumer";case P:return(s._context.displayName||"Context")+".Provider";case J:var o=s.render;return s=s.displayName,s||(s=o.displayName||o.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case Z:return o=s.displayName||null,o!==null?o:B(s.type)||"Memo";case G:o=s._payload,s=s._init;try{return B(s(o))}catch{}}return null}function te(s){var o=s.type;switch(s.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=o.render,s=s.displayName||s.name||"",o.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return B(o);case 8:return o===D?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function le(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function pe(s){var o=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function ye(s){var o=pe(s)?"checked":"value",d=Object.getOwnPropertyDescriptor(s.constructor.prototype,o),g=""+s[o];if(!s.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,_=d.set;return Object.defineProperty(s,o,{configurable:!0,get:function(){return v.call(this)},set:function(A){g=""+A,_.call(this,A)}}),Object.defineProperty(s,o,{enumerable:d.enumerable}),{getValue:function(){return g},setValue:function(A){g=""+A},stopTracking:function(){s._valueTracker=null,delete s[o]}}}}function Ie(s){s._valueTracker||(s._valueTracker=ye(s))}function Te(s){if(!s)return!1;var o=s._valueTracker;if(!o)return!0;var d=o.getValue(),g="";return s&&(g=pe(s)?s.checked?"true":"false":s.value),s=g,s!==d?(o.setValue(s),!0):!1}function Re(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function Me(s,o){var d=o.checked;return W({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??s._wrapperState.initialChecked})}function xe(s,o){var d=o.defaultValue==null?"":o.defaultValue,g=o.checked!=null?o.checked:o.defaultChecked;d=le(o.value!=null?o.value:d),s._wrapperState={initialChecked:g,initialValue:d,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function He(s,o){o=o.checked,o!=null&&E(s,"checked",o,!1)}function Ne(s,o){He(s,o);var d=le(o.value),g=o.type;if(d!=null)g==="number"?(d===0&&s.value===""||s.value!=d)&&(s.value=""+d):s.value!==""+d&&(s.value=""+d);else if(g==="submit"||g==="reset"){s.removeAttribute("value");return}o.hasOwnProperty("value")?Ze(s,o.type,d):o.hasOwnProperty("defaultValue")&&Ze(s,o.type,le(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(s.defaultChecked=!!o.defaultChecked)}function _e(s,o,d){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var g=o.type;if(!(g!=="submit"&&g!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+s._wrapperState.initialValue,d||o===s.value||(s.value=o),s.defaultValue=o}d=s.name,d!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,d!==""&&(s.name=d)}function Ze(s,o,d){(o!=="number"||Re(s.ownerDocument)!==s)&&(d==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+d&&(s.defaultValue=""+d))}var ct=Array.isArray;function Ke(s,o,d,g){if(s=s.options,o){o={};for(var v=0;v<d.length;v++)o["$"+d[v]]=!0;for(d=0;d<s.length;d++)v=o.hasOwnProperty("$"+s[d].value),s[d].selected!==v&&(s[d].selected=v),v&&g&&(s[d].defaultSelected=!0)}else{for(d=""+le(d),o=null,v=0;v<s.length;v++){if(s[v].value===d){s[v].selected=!0,g&&(s[v].defaultSelected=!0);return}o!==null||s[v].disabled||(o=s[v])}o!==null&&(o.selected=!0)}}function ce(s,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return W({},o,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function je(s,o){var d=o.value;if(d==null){if(d=o.children,o=o.defaultValue,d!=null){if(o!=null)throw Error(n(92));if(ct(d)){if(1<d.length)throw Error(n(93));d=d[0]}o=d}o==null&&(o=""),d=o}s._wrapperState={initialValue:le(d)}}function $e(s,o){var d=le(o.value),g=le(o.defaultValue);d!=null&&(d=""+d,d!==s.value&&(s.value=d),o.defaultValue==null&&s.defaultValue!==d&&(s.defaultValue=d)),g!=null&&(s.defaultValue=""+g)}function Je(s){var o=s.textContent;o===s._wrapperState.initialValue&&o!==""&&o!==null&&(s.value=o)}function qe(s){switch(s){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function pt(s,o){return s==null||s==="http://www.w3.org/1999/xhtml"?qe(o):s==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var ge,be=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,d,g,v){MSApp.execUnsafeLocalFunction(function(){return s(o,d,g,v)})}:s})(function(s,o){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=o;else{for(ge=ge||document.createElement("div"),ge.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ge.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;o.firstChild;)s.appendChild(o.firstChild)}});function Ve(s,o){if(o){var d=s.firstChild;if(d&&d===s.lastChild&&d.nodeType===3){d.nodeValue=o;return}}s.textContent=o}var nt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},at=["Webkit","ms","Moz","O"];Object.keys(nt).forEach(function(s){at.forEach(function(o){o=o+s.charAt(0).toUpperCase()+s.substring(1),nt[o]=nt[s]})});function he(s,o,d){return o==null||typeof o=="boolean"||o===""?"":d||typeof o!="number"||o===0||nt.hasOwnProperty(s)&&nt[s]?(""+o).trim():o+"px"}function rt(s,o){s=s.style;for(var d in o)if(o.hasOwnProperty(d)){var g=d.indexOf("--")===0,v=he(d,o[d],g);d==="float"&&(d="cssFloat"),g?s.setProperty(d,v):s[d]=v}}var ot=W({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function jt(s,o){if(o){if(ot[s]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,s));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function xt(s,o){if(s.indexOf("-")===-1)return typeof o.is=="string";switch(s){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 wt=null;function kn(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Zt=null,me=null,it=null;function ht(s){if(s=_l(s)){if(typeof Zt!="function")throw Error(n(280));var o=s.stateNode;o&&(o=pu(o),Zt(s.stateNode,s.type,o))}}function Qe(s){me?it?it.push(s):it=[s]:me=s}function sn(){if(me){var s=me,o=it;if(it=me=null,ht(s),o)for(s=0;s<o.length;s++)ht(o[s])}}function an(s,o){return s(o)}function Dt(){}var pn=!1;function Qt(s,o,d){if(pn)return s(o,d);pn=!0;try{return an(s,o,d)}finally{pn=!1,(me!==null||it!==null)&&(Dt(),sn())}}function mn(s,o){var d=s.stateNode;if(d===null)return null;var g=pu(d);if(g===null)return null;d=g[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(s=s.type,g=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!g;break e;default:s=!1}if(s)return null;if(d&&typeof d!="function")throw Error(n(231,o,typeof d));return d}var nr=!1;if(u)try{var Tn={};Object.defineProperty(Tn,"passive",{get:function(){nr=!0}}),window.addEventListener("test",Tn,Tn),window.removeEventListener("test",Tn,Tn)}catch{nr=!1}function _n(s,o,d,g,v,_,A,X,ne){var ue=Array.prototype.slice.call(arguments,3);try{o.apply(d,ue)}catch(ve){this.onError(ve)}}var vr=!1,An=null,Rn=!1,Mn=null,qs={onError:function(s){vr=!0,An=s}};function Fs(s,o,d,g,v,_,A,X,ne){vr=!1,An=null,_n.apply(qs,arguments)}function fs(s,o,d,g,v,_,A,X,ne){if(Fs.apply(this,arguments),vr){if(vr){var ue=An;vr=!1,An=null}else throw Error(n(198));Rn||(Rn=!0,Mn=ue)}}function Q(s){var o=s,d=s;if(s.alternate)for(;o.return;)o=o.return;else{s=o;do o=s,(o.flags&4098)!==0&&(d=o.return),s=o.return;while(s)}return o.tag===3?d:null}function Ce(s){if(s.tag===13){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function Ue(s){if(Q(s)!==s)throw Error(n(188))}function Le(s){var o=s.alternate;if(!o){if(o=Q(s),o===null)throw Error(n(188));return o!==s?null:s}for(var d=s,g=o;;){var v=d.return;if(v===null)break;var _=v.alternate;if(_===null){if(g=v.return,g!==null){d=g;continue}break}if(v.child===_.child){for(_=v.child;_;){if(_===d)return Ue(v),s;if(_===g)return Ue(v),o;_=_.sibling}throw Error(n(188))}if(d.return!==g.return)d=v,g=_;else{for(var A=!1,X=v.child;X;){if(X===d){A=!0,d=v,g=_;break}if(X===g){A=!0,g=v,d=_;break}X=X.sibling}if(!A){for(X=_.child;X;){if(X===d){A=!0,d=_,g=v;break}if(X===g){A=!0,g=_,d=v;break}X=X.sibling}if(!A)throw Error(n(189))}}if(d.alternate!==g)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?s:o}function Pe(s){return s=Le(s),s!==null?ft(s):null}function ft(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var o=ft(s);if(o!==null)return o;s=s.sibling}return null}var Ct=t.unstable_scheduleCallback,$t=t.unstable_cancelCallback,Wr=t.unstable_shouldYield,bt=t.unstable_requestPaint,kt=t.unstable_now,Bs=t.unstable_getCurrentPriorityLevel,ps=t.unstable_ImmediatePriority,Ea=t.unstable_UserBlockingPriority,Vr=t.unstable_NormalPriority,Ca=t.unstable_LowPriority,Mo=t.unstable_IdlePriority,ms=null,In=null;function gs(s){if(In&&typeof In.onCommitFiberRoot=="function")try{In.onCommitFiberRoot(ms,s,void 0,(s.current.flags&128)===128)}catch{}}var $n=Math.clz32?Math.clz32:Mc,Uh=Math.log,Io=Math.LN2;function Mc(s){return s>>>=0,s===0?32:31-(Uh(s)/Io|0)|0}var ys=64,Ta=4194304;function zs(s){switch(s&-s){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: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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function Gr(s,o){var d=s.pendingLanes;if(d===0)return 0;var g=0,v=s.suspendedLanes,_=s.pingedLanes,A=d&268435455;if(A!==0){var X=A&~v;X!==0?g=zs(X):(_&=A,_!==0&&(g=zs(_)))}else A=d&~v,A!==0?g=zs(A):_!==0&&(g=zs(_));if(g===0)return 0;if(o!==0&&o!==g&&(o&v)===0&&(v=g&-g,_=o&-o,v>=_||v===16&&(_&4194240)!==0))return o;if((g&4)!==0&&(g|=d&16),o=s.entangledLanes,o!==0)for(s=s.entanglements,o&=g;0<o;)d=31-$n(o),v=1<<d,g|=s[d],o&=~v;return g}function Wh(s,o){switch(s){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64: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 o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ic(s,o){for(var d=s.suspendedLanes,g=s.pingedLanes,v=s.expirationTimes,_=s.pendingLanes;0<_;){var A=31-$n(_),X=1<<A,ne=v[A];ne===-1?((X&d)===0||(X&g)!==0)&&(v[A]=Wh(X,o)):ne<=o&&(s.expiredLanes|=X),_&=~X}}function $o(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function $c(){var s=ys;return ys<<=1,(ys&4194240)===0&&(ys=64),s}function Oo(s){for(var o=[],d=0;31>d;d++)o.push(s);return o}function xr(s,o,d){s.pendingLanes|=o,o!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,o=31-$n(o),s[o]=d}function Vh(s,o){var d=s.pendingLanes&~o;s.pendingLanes=o,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=o,s.mutableReadLanes&=o,s.entangledLanes&=o,o=s.entanglements;var g=s.eventTimes;for(s=s.expirationTimes;0<d;){var v=31-$n(d),_=1<<v;o[v]=0,g[v]=-1,s[v]=-1,d&=~_}}function Lo(s,o){var d=s.entangledLanes|=o;for(s=s.entanglements;d;){var g=31-$n(d),v=1<<g;v&o|s[g]&o&&(s[g]|=o),d&=~v}}var st=0;function Aa(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Oc,Ra,zt,Lc,br,Hs=!1,Ma=[],Kr=null,on=null,Un=null,Ia=new Map,$a=new Map,kr=[],Pc="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 submit".split(" ");function ws(s,o){switch(s){case"focusin":case"focusout":Kr=null;break;case"dragenter":case"dragleave":on=null;break;case"mouseover":case"mouseout":Un=null;break;case"pointerover":case"pointerout":Ia.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":$a.delete(o.pointerId)}}function Us(s,o,d,g,v,_){return s===null||s.nativeEvent!==_?(s={blockedOn:o,domEventName:d,eventSystemFlags:g,nativeEvent:_,targetContainers:[v]},o!==null&&(o=_l(o),o!==null&&Ra(o)),s):(s.eventSystemFlags|=g,o=s.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),s)}function Dc(s,o,d,g,v){switch(o){case"focusin":return Kr=Us(Kr,s,o,d,g,v),!0;case"dragenter":return on=Us(on,s,o,d,g,v),!0;case"mouseover":return Un=Us(Un,s,o,d,g,v),!0;case"pointerover":var _=v.pointerId;return Ia.set(_,Us(Ia.get(_)||null,s,o,d,g,v)),!0;case"gotpointercapture":return _=v.pointerId,$a.set(_,Us($a.get(_)||null,s,o,d,g,v)),!0}return!1}function Oa(s){var o=eo(s.target);if(o!==null){var d=Q(o);if(d!==null){if(o=d.tag,o===13){if(o=Ce(d),o!==null){s.blockedOn=o,br(s.priority,function(){zt(d)});return}}else if(o===3&&d.stateNode.current.memoizedState.isDehydrated){s.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Ws(s){if(s.blockedOn!==null)return!1;for(var o=s.targetContainers;0<o.length;){var d=Do(s.domEventName,s.eventSystemFlags,o[0],s.nativeEvent);if(d===null){d=s.nativeEvent;var g=new d.constructor(d.type,d);wt=g,d.target.dispatchEvent(g),wt=null}else return o=_l(d),o!==null&&Ra(o),s.blockedOn=d,!1;o.shift()}return!0}function Zi(s,o,d){Ws(s)&&d.delete(o)}function qc(){Hs=!1,Kr!==null&&Ws(Kr)&&(Kr=null),on!==null&&Ws(on)&&(on=null),Un!==null&&Ws(Un)&&(Un=null),Ia.forEach(Zi),$a.forEach(Zi)}function Vs(s,o){s.blockedOn===o&&(s.blockedOn=null,Hs||(Hs=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,qc)))}function Gs(s){function o(v){return Vs(v,s)}if(0<Ma.length){Vs(Ma[0],s);for(var d=1;d<Ma.length;d++){var g=Ma[d];g.blockedOn===s&&(g.blockedOn=null)}}for(Kr!==null&&Vs(Kr,s),on!==null&&Vs(on,s),Un!==null&&Vs(Un,s),Ia.forEach(o),$a.forEach(o),d=0;d<kr.length;d++)g=kr[d],g.blockedOn===s&&(g.blockedOn=null);for(;0<kr.length&&(d=kr[0],d.blockedOn===null);)Oa(d),d.blockedOn===null&&kr.shift()}var Rt=C.ReactCurrentBatchConfig,vs=!0;function Po(s,o,d,g){var v=st,_=Rt.transition;Rt.transition=null;try{st=1,Ji(s,o,d,g)}finally{st=v,Rt.transition=_}}function Qi(s,o,d,g){var v=st,_=Rt.transition;Rt.transition=null;try{st=4,Ji(s,o,d,g)}finally{st=v,Rt.transition=_}}function Ji(s,o,d,g){if(vs){var v=Do(s,o,d,g);if(v===null)ei(s,o,g,_r,d),ws(s,g);else if(Dc(v,s,o,d,g))g.stopPropagation();else if(ws(s,g),o&4&&-1<Pc.indexOf(s)){for(;v!==null;){var _=_l(v);if(_!==null&&Oc(_),_=Do(s,o,d,g),_===null&&ei(s,o,g,_r,d),_===v)break;v=_}v!==null&&g.stopPropagation()}else ei(s,o,g,null,d)}}var _r=null;function Do(s,o,d,g){if(_r=null,s=kn(g),s=eo(s),s!==null)if(o=Q(s),o===null)s=null;else if(d=o.tag,d===13){if(s=Ce(o),s!==null)return s;s=null}else if(d===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;s=null}else o!==s&&(s=null);return _r=s,null}function Ks(s){switch(s){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Bs()){case ps:return 1;case Ea:return 4;case Vr:case Ca:return 16;case Mo:return 536870912;default:return 16}default:return 16}}var Yr=null,Xr=null,qo=null;function el(){if(qo)return qo;var s,o=Xr,d=o.length,g,v="value"in Yr?Yr.value:Yr.textContent,_=v.length;for(s=0;s<d&&o[s]===v[s];s++);var A=d-s;for(g=1;g<=A&&o[d-g]===v[_-g];g++);return qo=v.slice(s,1<g?1-g:void 0)}function Fo(s){var o=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&o===13&&(s=13)):s=o,s===10&&(s=13),32<=s||s===13?s:0}function La(){return!0}function Fc(){return!1}function qt(s){function o(d,g,v,_,A){this._reactName=d,this._targetInst=v,this.type=g,this.nativeEvent=_,this.target=A,this.currentTarget=null;for(var X in s)s.hasOwnProperty(X)&&(d=s[X],this[X]=d?d(_):_[X]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?La:Fc,this.isPropagationStopped=Fc,this}return W(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=La)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=La)},persist:function(){},isPersistent:La}),o}var rr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bo=qt(rr),Nr=W({},rr,{view:0,detail:0}),Bc=qt(Nr),Pa,Wn,Da,ln=W({},Nr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sr,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Da&&(Da&&s.type==="mousemove"?(Pa=s.screenX-Da.screenX,Wn=s.screenY-Da.screenY):Wn=Pa=0,Da=s),Pa)},movementY:function(s){return"movementY"in s?s.movementY:Wn}}),zo=qt(ln),tl=W({},ln,{dataTransfer:0}),zc=qt(tl),Ho=W({},Nr,{relatedTarget:0}),qa=qt(Ho),Hc=W({},rr,{animationName:0,elapsedTime:0,pseudoElement:0}),nl=qt(Hc),Uc=W({},rr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Gh=qt(Uc),xs=W({},rr,{data:0}),Uo=qt(xs),Wc={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rl={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"},Vc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sl(s){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(s):(s=Vc[s])?!!o[s]:!1}function Sr(){return sl}var Gc=W({},Nr,{key:function(s){if(s.key){var o=Wc[s.key]||s.key;if(o!=="Unidentified")return o}return s.type==="keypress"?(s=Fo(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?rl[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sr,charCode:function(s){return s.type==="keypress"?Fo(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Fo(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Kh=qt(Gc),Kc=W({},ln,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),al=qt(Kc),Yh=W({},Nr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sr}),cn=qt(Yh),Yc=W({},rr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Wo=qt(Yc),Ys=W({},ln,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Fa=qt(Ys),ol=[9,13,27,32],Ba=u&&"CompositionEvent"in window,Zr=null;u&&"documentMode"in document&&(Zr=document.documentMode);var za=u&&"TextEvent"in window&&!Zr,il=u&&(!Ba||Zr&&8<Zr&&11>=Zr),Xc=" ",Zc=!1;function Ha(s,o){switch(s){case"keyup":return ol.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qc(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Xs=!1;function ll(s,o){switch(s){case"compositionend":return Qc(o);case"keypress":return o.which!==32?null:(Zc=!0,Xc);case"textInput":return s=o.data,s===Xc&&Zc?null:s;default:return null}}function Qr(s,o){if(Xs)return s==="compositionend"||!Ba&&Ha(s,o)?(s=el(),qo=Xr=Yr=null,Xs=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return il&&o.locale!=="ko"?null:o.data;default:return null}}var Ua={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 cl(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o==="input"?!!Ua[s.type]:o==="textarea"}function Jc(s,o,d,g){Qe(g),o=Ja(o,"onChange"),0<o.length&&(d=new Bo("onChange","change",null,d,g),s.push({event:d,listeners:o}))}var Wa=null,Zs=null;function Xh(s){cu(s,0)}function Vo(s){var o=ni(s);if(Te(o))return s}function gn(s,o){if(s==="change")return o}var eu=!1;if(u){var ul;if(u){var dl="oninput"in document;if(!dl){var Va=document.createElement("div");Va.setAttribute("oninput","return;"),dl=typeof Va.oninput=="function"}ul=dl}else ul=!1;eu=ul&&(!document.documentMode||9<document.documentMode)}function Ga(){Wa&&(Wa.detachEvent("onpropertychange",tu),Zs=Wa=null)}function tu(s){if(s.propertyName==="value"&&Vo(Zs)){var o=[];Jc(o,Zs,s,kn(s)),Qt(Xh,o)}}function jr(s,o,d){s==="focusin"?(Ga(),Wa=o,Zs=d,Wa.attachEvent("onpropertychange",tu)):s==="focusout"&&Ga()}function nu(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Vo(Zs)}function Zh(s,o){if(s==="click")return Vo(o)}function ru(s,o){if(s==="input"||s==="change")return Vo(o)}function su(s,o){return s===o&&(s!==0||1/s===1/o)||s!==s&&o!==o}var Vn=typeof Object.is=="function"?Object.is:su;function Jr(s,o){if(Vn(s,o))return!0;if(typeof s!="object"||s===null||typeof o!="object"||o===null)return!1;var d=Object.keys(s),g=Object.keys(o);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var v=d[g];if(!f.call(o,v)||!Vn(s[v],o[v]))return!1}return!0}function au(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Go(s,o){var d=au(s);s=0;for(var g;d;){if(d.nodeType===3){if(g=s+d.textContent.length,s<=o&&g>=o)return{node:d,offset:o-s};s=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=au(d)}}function hl(s,o){return s&&o?s===o?!0:s&&s.nodeType===3?!1:o&&o.nodeType===3?hl(s,o.parentNode):"contains"in s?s.contains(o):s.compareDocumentPosition?!!(s.compareDocumentPosition(o)&16):!1:!1}function fl(){for(var s=window,o=Re();o instanceof s.HTMLIFrameElement;){try{var d=typeof o.contentWindow.location.href=="string"}catch{d=!1}if(d)s=o.contentWindow;else break;o=Re(s.document)}return o}function Ko(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o&&(o==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||o==="textarea"||s.contentEditable==="true")}function pl(s){var o=fl(),d=s.focusedElem,g=s.selectionRange;if(o!==d&&d&&d.ownerDocument&&hl(d.ownerDocument.documentElement,d)){if(g!==null&&Ko(d)){if(o=g.start,s=g.end,s===void 0&&(s=o),"selectionStart"in d)d.selectionStart=o,d.selectionEnd=Math.min(s,d.value.length);else if(s=(o=d.ownerDocument||document)&&o.defaultView||window,s.getSelection){s=s.getSelection();var v=d.textContent.length,_=Math.min(g.start,v);g=g.end===void 0?_:Math.min(g.end,v),!s.extend&&_>g&&(v=g,g=_,_=v),v=Go(d,_);var A=Go(d,g);v&&A&&(s.rangeCount!==1||s.anchorNode!==v.node||s.anchorOffset!==v.offset||s.focusNode!==A.node||s.focusOffset!==A.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),s.removeAllRanges(),_>g?(s.addRange(o),s.extend(A.node,A.offset)):(o.setEnd(A.node,A.offset),s.addRange(o)))}}for(o=[],s=d;s=s.parentNode;)s.nodeType===1&&o.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<o.length;d++)s=o[d],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var Yo=u&&"documentMode"in document&&11>=document.documentMode,es=null,Xo=null,ts=null,Ka=!1;function Ya(s,o,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Ka||es==null||es!==Re(g)||(g=es,"selectionStart"in g&&Ko(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),ts&&Jr(ts,g)||(ts=g,g=Ja(Xo,"onSelect"),0<g.length&&(o=new Bo("onSelect","select",null,o,d),s.push({event:o,listeners:g}),o.target=es)))}function Qs(s,o){var d={};return d[s.toLowerCase()]=o.toLowerCase(),d["Webkit"+s]="webkit"+o,d["Moz"+s]="moz"+o,d}var Gn={animationend:Qs("Animation","AnimationEnd"),animationiteration:Qs("Animation","AnimationIteration"),animationstart:Qs("Animation","AnimationStart"),transitionend:Qs("Transition","TransitionEnd")},Zo={},ml={};u&&(ml=document.createElement("div").style,"AnimationEvent"in window||(delete Gn.animationend.animation,delete Gn.animationiteration.animation,delete Gn.animationstart.animation),"TransitionEvent"in window||delete Gn.transitionend.transition);function Ft(s){if(Zo[s])return Zo[s];if(!Gn[s])return s;var o=Gn[s],d;for(d in o)if(o.hasOwnProperty(d)&&d in ml)return Zo[s]=o[d];return s}var gl=Ft("animationend"),yl=Ft("animationiteration"),ou=Ft("animationstart"),iu=Ft("transitionend"),wl=new Map,Xa="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ns(s,o){wl.set(s,o),l(o,[s])}for(var Er=0;Er<Xa.length;Er++){var Za=Xa[Er],Qo=Za.toLowerCase(),vl=Za[0].toUpperCase()+Za.slice(1);ns(Qo,"on"+vl)}ns(gl,"onAnimationEnd"),ns(yl,"onAnimationIteration"),ns(ou,"onAnimationStart"),ns("dblclick","onDoubleClick"),ns("focusin","onFocus"),ns("focusout","onBlur"),ns(iu,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qa="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(" "),lu=new Set("cancel close invalid load scroll toggle".split(" ").concat(Qa));function xl(s,o,d){var g=s.type||"unknown-event";s.currentTarget=d,fs(g,o,void 0,s),s.currentTarget=null}function cu(s,o){o=(o&4)!==0;for(var d=0;d<s.length;d++){var g=s[d],v=g.event;g=g.listeners;e:{var _=void 0;if(o)for(var A=g.length-1;0<=A;A--){var X=g[A],ne=X.instance,ue=X.currentTarget;if(X=X.listener,ne!==_&&v.isPropagationStopped())break e;xl(v,X,ue),_=ne}else for(A=0;A<g.length;A++){if(X=g[A],ne=X.instance,ue=X.currentTarget,X=X.listener,ne!==_&&v.isPropagationStopped())break e;xl(v,X,ue),_=ne}}}if(Rn)throw s=Mn,Rn=!1,Mn=null,s}function _t(s,o){var d=o[Ot];d===void 0&&(d=o[Ot]=new Set);var g=s+"__bubble";d.has(g)||(uu(o,s,2,!1),d.add(g))}function Jo(s,o,d){var g=0;o&&(g|=4),uu(d,s,g,o)}var rs="_reactListening"+Math.random().toString(36).slice(2);function bs(s){if(!s[rs]){s[rs]=!0,r.forEach(function(d){d!=="selectionchange"&&(lu.has(d)||Jo(d,!1,s),Jo(d,!0,s))});var o=s.nodeType===9?s:s.ownerDocument;o===null||o[rs]||(o[rs]=!0,Jo("selectionchange",!1,o))}}function uu(s,o,d,g){switch(Ks(o)){case 1:var v=Po;break;case 4:v=Qi;break;default:v=Ji}d=v.bind(null,o,d,s),v=void 0,!nr||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),g?v!==void 0?s.addEventListener(o,d,{capture:!0,passive:v}):s.addEventListener(o,d,!0):v!==void 0?s.addEventListener(o,d,{passive:v}):s.addEventListener(o,d,!1)}function ei(s,o,d,g,v){var _=g;if((o&1)===0&&(o&2)===0&&g!==null)e:for(;;){if(g===null)return;var A=g.tag;if(A===3||A===4){var X=g.stateNode.containerInfo;if(X===v||X.nodeType===8&&X.parentNode===v)break;if(A===4)for(A=g.return;A!==null;){var ne=A.tag;if((ne===3||ne===4)&&(ne=A.stateNode.containerInfo,ne===v||ne.nodeType===8&&ne.parentNode===v))return;A=A.return}for(;X!==null;){if(A=eo(X),A===null)return;if(ne=A.tag,ne===5||ne===6){g=_=A;continue e}X=X.parentNode}}g=g.return}Qt(function(){var ue=_,ve=kn(d),ke=[];e:{var we=wl.get(s);if(we!==void 0){var Oe=Bo,Fe=s;switch(s){case"keypress":if(Fo(d)===0)break e;case"keydown":case"keyup":Oe=Kh;break;case"focusin":Fe="focus",Oe=qa;break;case"focusout":Fe="blur",Oe=qa;break;case"beforeblur":case"afterblur":Oe=qa;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Oe=zo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Oe=zc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Oe=cn;break;case gl:case yl:case ou:Oe=nl;break;case iu:Oe=Wo;break;case"scroll":Oe=Bc;break;case"wheel":Oe=Fa;break;case"copy":case"cut":case"paste":Oe=Gh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Oe=al}var Be=(o&4)!==0,Bt=!Be&&s==="scroll",oe=Be?we!==null?we+"Capture":null:we;Be=[];for(var re=ue,ie;re!==null;){ie=re;var Ee=ie.stateNode;if(ie.tag===5&&Ee!==null&&(ie=Ee,oe!==null&&(Ee=mn(re,oe),Ee!=null&&Be.push(Js(re,Ee,ie)))),Bt)break;re=re.return}0<Be.length&&(we=new Oe(we,Fe,null,d,ve),ke.push({event:we,listeners:Be}))}}if((o&7)===0){e:{if(we=s==="mouseover"||s==="pointerover",Oe=s==="mouseout"||s==="pointerout",we&&d!==wt&&(Fe=d.relatedTarget||d.fromElement)&&(eo(Fe)||Fe[Sn]))break e;if((Oe||we)&&(we=ve.window===ve?ve:(we=ve.ownerDocument)?we.defaultView||we.parentWindow:window,Oe?(Fe=d.relatedTarget||d.toElement,Oe=ue,Fe=Fe?eo(Fe):null,Fe!==null&&(Bt=Q(Fe),Fe!==Bt||Fe.tag!==5&&Fe.tag!==6)&&(Fe=null)):(Oe=null,Fe=ue),Oe!==Fe)){if(Be=zo,Ee="onMouseLeave",oe="onMouseEnter",re="mouse",(s==="pointerout"||s==="pointerover")&&(Be=al,Ee="onPointerLeave",oe="onPointerEnter",re="pointer"),Bt=Oe==null?we:ni(Oe),ie=Fe==null?we:ni(Fe),we=new Be(Ee,re+"leave",Oe,d,ve),we.target=Bt,we.relatedTarget=ie,Ee=null,eo(ve)===ue&&(Be=new Be(oe,re+"enter",Fe,d,ve),Be.target=ie,Be.relatedTarget=Bt,Ee=Be),Bt=Ee,Oe&&Fe)t:{for(Be=Oe,oe=Fe,re=0,ie=Be;ie;ie=ks(ie))re++;for(ie=0,Ee=oe;Ee;Ee=ks(Ee))ie++;for(;0<re-ie;)Be=ks(Be),re--;for(;0<ie-re;)oe=ks(oe),ie--;for(;re--;){if(Be===oe||oe!==null&&Be===oe.alternate)break t;Be=ks(Be),oe=ks(oe)}Be=null}else Be=null;Oe!==null&&bl(ke,we,Oe,Be,!1),Fe!==null&&Bt!==null&&bl(ke,Bt,Fe,Be,!0)}}e:{if(we=ue?ni(ue):window,Oe=we.nodeName&&we.nodeName.toLowerCase(),Oe==="select"||Oe==="input"&&we.type==="file")var ze=gn;else if(cl(we))if(eu)ze=ru;else{ze=nu;var Ye=jr}else(Oe=we.nodeName)&&Oe.toLowerCase()==="input"&&(we.type==="checkbox"||we.type==="radio")&&(ze=Zh);if(ze&&(ze=ze(s,ue))){Jc(ke,ze,d,ve);break e}Ye&&Ye(s,we,ue),s==="focusout"&&(Ye=we._wrapperState)&&Ye.controlled&&we.type==="number"&&Ze(we,"number",we.value)}switch(Ye=ue?ni(ue):window,s){case"focusin":(cl(Ye)||Ye.contentEditable==="true")&&(es=Ye,Xo=ue,ts=null);break;case"focusout":ts=Xo=es=null;break;case"mousedown":Ka=!0;break;case"contextmenu":case"mouseup":case"dragend":Ka=!1,Ya(ke,d,ve);break;case"selectionchange":if(Yo)break;case"keydown":case"keyup":Ya(ke,d,ve)}var Xe;if(Ba)e:{switch(s){case"compositionstart":var et="onCompositionStart";break e;case"compositionend":et="onCompositionEnd";break e;case"compositionupdate":et="onCompositionUpdate";break e}et=void 0}else Xs?Ha(s,d)&&(et="onCompositionEnd"):s==="keydown"&&d.keyCode===229&&(et="onCompositionStart");et&&(il&&d.locale!=="ko"&&(Xs||et!=="onCompositionStart"?et==="onCompositionEnd"&&Xs&&(Xe=el()):(Yr=ve,Xr="value"in Yr?Yr.value:Yr.textContent,Xs=!0)),Ye=Ja(ue,et),0<Ye.length&&(et=new Uo(et,s,null,d,ve),ke.push({event:et,listeners:Ye}),Xe?et.data=Xe:(Xe=Qc(d),Xe!==null&&(et.data=Xe)))),(Xe=za?ll(s,d):Qr(s,d))&&(ue=Ja(ue,"onBeforeInput"),0<ue.length&&(ve=new Uo("onBeforeInput","beforeinput",null,d,ve),ke.push({event:ve,listeners:ue}),ve.data=Xe))}cu(ke,o)})}function Js(s,o,d){return{instance:s,listener:o,currentTarget:d}}function Ja(s,o){for(var d=o+"Capture",g=[];s!==null;){var v=s,_=v.stateNode;v.tag===5&&_!==null&&(v=_,_=mn(s,d),_!=null&&g.unshift(Js(s,_,v)),_=mn(s,o),_!=null&&g.push(Js(s,_,v))),s=s.return}return g}function ks(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function bl(s,o,d,g,v){for(var _=o._reactName,A=[];d!==null&&d!==g;){var X=d,ne=X.alternate,ue=X.stateNode;if(ne!==null&&ne===g)break;X.tag===5&&ue!==null&&(X=ue,v?(ne=mn(d,_),ne!=null&&A.unshift(Js(d,ne,X))):v||(ne=mn(d,_),ne!=null&&A.push(Js(d,ne,X)))),d=d.return}A.length!==0&&s.push({event:o,listeners:A})}var F=/\r\n?/g,z=/\u0000|\uFFFD/g;function se(s){return(typeof s=="string"?s:""+s).replace(F,`
38
- `).replace(z,"")}function ae(s,o,d){if(o=se(o),se(s)!==o&&d)throw Error(n(425))}function Ae(){}var Se=null,Ge=null;function lt(s,o){return s==="textarea"||s==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var vt=typeof setTimeout=="function"?setTimeout:void 0,tt=typeof clearTimeout=="function"?clearTimeout:void 0,Nn=typeof Promise=="function"?Promise:void 0,ti=typeof queueMicrotask=="function"?queueMicrotask:typeof Nn<"u"?function(s){return Nn.resolve(null).then(s).catch(du)}:vt;function du(s){setTimeout(function(){throw s})}function kl(s,o){var d=o,g=0;do{var v=d.nextSibling;if(s.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(g===0){s.removeChild(v),Gs(o);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=v}while(d);Gs(o)}function Cr(s){for(;s!=null;s=s.nextSibling){var o=s.nodeType;if(o===1||o===3)break;if(o===8){if(o=s.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return s}function hu(s){s=s.previousSibling;for(var o=0;s;){if(s.nodeType===8){var d=s.data;if(d==="$"||d==="$!"||d==="$?"){if(o===0)return s;o--}else d==="/$"&&o++}s=s.previousSibling}return null}var _s=Math.random().toString(36).slice(2),On="__reactFiber$"+_s,Tr="__reactProps$"+_s,Sn="__reactContainer$"+_s,Ot="__reactEvents$"+_s,fu="__reactListeners$"+_s,ZM="__reactHandles$"+_s;function eo(s){var o=s[On];if(o)return o;for(var d=s.parentNode;d;){if(o=d[Sn]||d[On]){if(d=o.alternate,o.child!==null||d!==null&&d.child!==null)for(s=hu(s);s!==null;){if(d=s[On])return d;s=hu(s)}return o}s=d,d=s.parentNode}return null}function _l(s){return s=s[On]||s[Sn],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function ni(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function pu(s){return s[Tr]||null}var Qh=[],ri=-1;function ea(s){return{current:s}}function Et(s){0>ri||(s.current=Qh[ri],Qh[ri]=null,ri--)}function St(s,o){ri++,Qh[ri]=s.current,s.current=o}var ta={},yn=ea(ta),Ln=ea(!1),to=ta;function si(s,o){var d=s.type.contextTypes;if(!d)return ta;var g=s.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===o)return g.__reactInternalMemoizedMaskedChildContext;var v={},_;for(_ in d)v[_]=o[_];return g&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=o,s.__reactInternalMemoizedMaskedChildContext=v),v}function Pn(s){return s=s.childContextTypes,s!=null}function mu(){Et(Ln),Et(yn)}function z0(s,o,d){if(yn.current!==ta)throw Error(n(168));St(yn,o),St(Ln,d)}function H0(s,o,d){var g=s.stateNode;if(o=o.childContextTypes,typeof g.getChildContext!="function")return d;g=g.getChildContext();for(var v in g)if(!(v in o))throw Error(n(108,te(s)||"Unknown",v));return W({},d,g)}function gu(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||ta,to=yn.current,St(yn,s),St(Ln,Ln.current),!0}function U0(s,o,d){var g=s.stateNode;if(!g)throw Error(n(169));d?(s=H0(s,o,to),g.__reactInternalMemoizedMergedChildContext=s,Et(Ln),Et(yn),St(yn,s)):Et(Ln),St(Ln,d)}var Ns=null,yu=!1,Jh=!1;function W0(s){Ns===null?Ns=[s]:Ns.push(s)}function QM(s){yu=!0,W0(s)}function na(){if(!Jh&&Ns!==null){Jh=!0;var s=0,o=st;try{var d=Ns;for(st=1;s<d.length;s++){var g=d[s];do g=g(!0);while(g!==null)}Ns=null,yu=!1}catch(v){throw Ns!==null&&(Ns=Ns.slice(s+1)),Ct(ps,na),v}finally{st=o,Jh=!1}}return null}var ai=[],oi=0,wu=null,vu=0,sr=[],ar=0,no=null,Ss=1,js="";function ro(s,o){ai[oi++]=vu,ai[oi++]=wu,wu=s,vu=o}function V0(s,o,d){sr[ar++]=Ss,sr[ar++]=js,sr[ar++]=no,no=s;var g=Ss;s=js;var v=32-$n(g)-1;g&=~(1<<v),d+=1;var _=32-$n(o)+v;if(30<_){var A=v-v%5;_=(g&(1<<A)-1).toString(32),g>>=A,v-=A,Ss=1<<32-$n(o)+v|d<<v|g,js=_+s}else Ss=1<<_|d<<v|g,js=s}function ef(s){s.return!==null&&(ro(s,1),V0(s,1,0))}function tf(s){for(;s===wu;)wu=ai[--oi],ai[oi]=null,vu=ai[--oi],ai[oi]=null;for(;s===no;)no=sr[--ar],sr[ar]=null,js=sr[--ar],sr[ar]=null,Ss=sr[--ar],sr[ar]=null}var Kn=null,Yn=null,Tt=!1,Ar=null;function G0(s,o){var d=cr(5,null,null,0);d.elementType="DELETED",d.stateNode=o,d.return=s,o=s.deletions,o===null?(s.deletions=[d],s.flags|=16):o.push(d)}function K0(s,o){switch(s.tag){case 5:var d=s.type;return o=o.nodeType!==1||d.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(s.stateNode=o,Kn=s,Yn=Cr(o.firstChild),!0):!1;case 6:return o=s.pendingProps===""||o.nodeType!==3?null:o,o!==null?(s.stateNode=o,Kn=s,Yn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(d=no!==null?{id:Ss,overflow:js}:null,s.memoizedState={dehydrated:o,treeContext:d,retryLane:1073741824},d=cr(18,null,null,0),d.stateNode=o,d.return=s,s.child=d,Kn=s,Yn=null,!0):!1;default:return!1}}function nf(s){return(s.mode&1)!==0&&(s.flags&128)===0}function rf(s){if(Tt){var o=Yn;if(o){var d=o;if(!K0(s,o)){if(nf(s))throw Error(n(418));o=Cr(d.nextSibling);var g=Kn;o&&K0(s,o)?G0(g,d):(s.flags=s.flags&-4097|2,Tt=!1,Kn=s)}}else{if(nf(s))throw Error(n(418));s.flags=s.flags&-4097|2,Tt=!1,Kn=s}}}function Y0(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Kn=s}function xu(s){if(s!==Kn)return!1;if(!Tt)return Y0(s),Tt=!0,!1;var o;if((o=s.tag!==3)&&!(o=s.tag!==5)&&(o=s.type,o=o!=="head"&&o!=="body"&&!lt(s.type,s.memoizedProps)),o&&(o=Yn)){if(nf(s))throw X0(),Error(n(418));for(;o;)G0(s,o),o=Cr(o.nextSibling)}if(Y0(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));e:{for(s=s.nextSibling,o=0;s;){if(s.nodeType===8){var d=s.data;if(d==="/$"){if(o===0){Yn=Cr(s.nextSibling);break e}o--}else d!=="$"&&d!=="$!"&&d!=="$?"||o++}s=s.nextSibling}Yn=null}}else Yn=Kn?Cr(s.stateNode.nextSibling):null;return!0}function X0(){for(var s=Yn;s;)s=Cr(s.nextSibling)}function ii(){Yn=Kn=null,Tt=!1}function sf(s){Ar===null?Ar=[s]:Ar.push(s)}var JM=C.ReactCurrentBatchConfig;function Nl(s,o,d){if(s=d.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var g=d.stateNode}if(!g)throw Error(n(147,s));var v=g,_=""+s;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===_?o.ref:(o=function(A){var X=v.refs;A===null?delete X[_]:X[_]=A},o._stringRef=_,o)}if(typeof s!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,s))}return s}function bu(s,o){throw s=Object.prototype.toString.call(o),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":s))}function Z0(s){var o=s._init;return o(s._payload)}function Q0(s){function o(oe,re){if(s){var ie=oe.deletions;ie===null?(oe.deletions=[re],oe.flags|=16):ie.push(re)}}function d(oe,re){if(!s)return null;for(;re!==null;)o(oe,re),re=re.sibling;return null}function g(oe,re){for(oe=new Map;re!==null;)re.key!==null?oe.set(re.key,re):oe.set(re.index,re),re=re.sibling;return oe}function v(oe,re){return oe=ua(oe,re),oe.index=0,oe.sibling=null,oe}function _(oe,re,ie){return oe.index=ie,s?(ie=oe.alternate,ie!==null?(ie=ie.index,ie<re?(oe.flags|=2,re):ie):(oe.flags|=2,re)):(oe.flags|=1048576,re)}function A(oe){return s&&oe.alternate===null&&(oe.flags|=2),oe}function X(oe,re,ie,Ee){return re===null||re.tag!==6?(re=Xf(ie,oe.mode,Ee),re.return=oe,re):(re=v(re,ie),re.return=oe,re)}function ne(oe,re,ie,Ee){var ze=ie.type;return ze===$?ve(oe,re,ie.props.children,Ee,ie.key):re!==null&&(re.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===G&&Z0(ze)===re.type)?(Ee=v(re,ie.props),Ee.ref=Nl(oe,re,ie),Ee.return=oe,Ee):(Ee=Wu(ie.type,ie.key,ie.props,null,oe.mode,Ee),Ee.ref=Nl(oe,re,ie),Ee.return=oe,Ee)}function ue(oe,re,ie,Ee){return re===null||re.tag!==4||re.stateNode.containerInfo!==ie.containerInfo||re.stateNode.implementation!==ie.implementation?(re=Zf(ie,oe.mode,Ee),re.return=oe,re):(re=v(re,ie.children||[]),re.return=oe,re)}function ve(oe,re,ie,Ee,ze){return re===null||re.tag!==7?(re=ho(ie,oe.mode,Ee,ze),re.return=oe,re):(re=v(re,ie),re.return=oe,re)}function ke(oe,re,ie){if(typeof re=="string"&&re!==""||typeof re=="number")return re=Xf(""+re,oe.mode,ie),re.return=oe,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case T:return ie=Wu(re.type,re.key,re.props,null,oe.mode,ie),ie.ref=Nl(oe,null,re),ie.return=oe,ie;case R:return re=Zf(re,oe.mode,ie),re.return=oe,re;case G:var Ee=re._init;return ke(oe,Ee(re._payload),ie)}if(ct(re)||H(re))return re=ho(re,oe.mode,ie,null),re.return=oe,re;bu(oe,re)}return null}function we(oe,re,ie,Ee){var ze=re!==null?re.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return ze!==null?null:X(oe,re,""+ie,Ee);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case T:return ie.key===ze?ne(oe,re,ie,Ee):null;case R:return ie.key===ze?ue(oe,re,ie,Ee):null;case G:return ze=ie._init,we(oe,re,ze(ie._payload),Ee)}if(ct(ie)||H(ie))return ze!==null?null:ve(oe,re,ie,Ee,null);bu(oe,ie)}return null}function Oe(oe,re,ie,Ee,ze){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number")return oe=oe.get(ie)||null,X(re,oe,""+Ee,ze);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case T:return oe=oe.get(Ee.key===null?ie:Ee.key)||null,ne(re,oe,Ee,ze);case R:return oe=oe.get(Ee.key===null?ie:Ee.key)||null,ue(re,oe,Ee,ze);case G:var Ye=Ee._init;return Oe(oe,re,ie,Ye(Ee._payload),ze)}if(ct(Ee)||H(Ee))return oe=oe.get(ie)||null,ve(re,oe,Ee,ze,null);bu(re,Ee)}return null}function Fe(oe,re,ie,Ee){for(var ze=null,Ye=null,Xe=re,et=re=0,tn=null;Xe!==null&&et<ie.length;et++){Xe.index>et?(tn=Xe,Xe=null):tn=Xe.sibling;var gt=we(oe,Xe,ie[et],Ee);if(gt===null){Xe===null&&(Xe=tn);break}s&&Xe&&gt.alternate===null&&o(oe,Xe),re=_(gt,re,et),Ye===null?ze=gt:Ye.sibling=gt,Ye=gt,Xe=tn}if(et===ie.length)return d(oe,Xe),Tt&&ro(oe,et),ze;if(Xe===null){for(;et<ie.length;et++)Xe=ke(oe,ie[et],Ee),Xe!==null&&(re=_(Xe,re,et),Ye===null?ze=Xe:Ye.sibling=Xe,Ye=Xe);return Tt&&ro(oe,et),ze}for(Xe=g(oe,Xe);et<ie.length;et++)tn=Oe(Xe,oe,et,ie[et],Ee),tn!==null&&(s&&tn.alternate!==null&&Xe.delete(tn.key===null?et:tn.key),re=_(tn,re,et),Ye===null?ze=tn:Ye.sibling=tn,Ye=tn);return s&&Xe.forEach(function(da){return o(oe,da)}),Tt&&ro(oe,et),ze}function Be(oe,re,ie,Ee){var ze=H(ie);if(typeof ze!="function")throw Error(n(150));if(ie=ze.call(ie),ie==null)throw Error(n(151));for(var Ye=ze=null,Xe=re,et=re=0,tn=null,gt=ie.next();Xe!==null&&!gt.done;et++,gt=ie.next()){Xe.index>et?(tn=Xe,Xe=null):tn=Xe.sibling;var da=we(oe,Xe,gt.value,Ee);if(da===null){Xe===null&&(Xe=tn);break}s&&Xe&&da.alternate===null&&o(oe,Xe),re=_(da,re,et),Ye===null?ze=da:Ye.sibling=da,Ye=da,Xe=tn}if(gt.done)return d(oe,Xe),Tt&&ro(oe,et),ze;if(Xe===null){for(;!gt.done;et++,gt=ie.next())gt=ke(oe,gt.value,Ee),gt!==null&&(re=_(gt,re,et),Ye===null?ze=gt:Ye.sibling=gt,Ye=gt);return Tt&&ro(oe,et),ze}for(Xe=g(oe,Xe);!gt.done;et++,gt=ie.next())gt=Oe(Xe,oe,et,gt.value,Ee),gt!==null&&(s&&gt.alternate!==null&&Xe.delete(gt.key===null?et:gt.key),re=_(gt,re,et),Ye===null?ze=gt:Ye.sibling=gt,Ye=gt);return s&&Xe.forEach(function(MI){return o(oe,MI)}),Tt&&ro(oe,et),ze}function Bt(oe,re,ie,Ee){if(typeof ie=="object"&&ie!==null&&ie.type===$&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case T:e:{for(var ze=ie.key,Ye=re;Ye!==null;){if(Ye.key===ze){if(ze=ie.type,ze===$){if(Ye.tag===7){d(oe,Ye.sibling),re=v(Ye,ie.props.children),re.return=oe,oe=re;break e}}else if(Ye.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===G&&Z0(ze)===Ye.type){d(oe,Ye.sibling),re=v(Ye,ie.props),re.ref=Nl(oe,Ye,ie),re.return=oe,oe=re;break e}d(oe,Ye);break}else o(oe,Ye);Ye=Ye.sibling}ie.type===$?(re=ho(ie.props.children,oe.mode,Ee,ie.key),re.return=oe,oe=re):(Ee=Wu(ie.type,ie.key,ie.props,null,oe.mode,Ee),Ee.ref=Nl(oe,re,ie),Ee.return=oe,oe=Ee)}return A(oe);case R:e:{for(Ye=ie.key;re!==null;){if(re.key===Ye)if(re.tag===4&&re.stateNode.containerInfo===ie.containerInfo&&re.stateNode.implementation===ie.implementation){d(oe,re.sibling),re=v(re,ie.children||[]),re.return=oe,oe=re;break e}else{d(oe,re);break}else o(oe,re);re=re.sibling}re=Zf(ie,oe.mode,Ee),re.return=oe,oe=re}return A(oe);case G:return Ye=ie._init,Bt(oe,re,Ye(ie._payload),Ee)}if(ct(ie))return Fe(oe,re,ie,Ee);if(H(ie))return Be(oe,re,ie,Ee);bu(oe,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,re!==null&&re.tag===6?(d(oe,re.sibling),re=v(re,ie),re.return=oe,oe=re):(d(oe,re),re=Xf(ie,oe.mode,Ee),re.return=oe,oe=re),A(oe)):d(oe,re)}return Bt}var li=Q0(!0),J0=Q0(!1),ku=ea(null),_u=null,ci=null,af=null;function of(){af=ci=_u=null}function lf(s){var o=ku.current;Et(ku),s._currentValue=o}function cf(s,o,d){for(;s!==null;){var g=s.alternate;if((s.childLanes&o)!==o?(s.childLanes|=o,g!==null&&(g.childLanes|=o)):g!==null&&(g.childLanes&o)!==o&&(g.childLanes|=o),s===d)break;s=s.return}}function ui(s,o){_u=s,af=ci=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&o)!==0&&(Dn=!0),s.firstContext=null)}function or(s){var o=s._currentValue;if(af!==s)if(s={context:s,memoizedValue:o,next:null},ci===null){if(_u===null)throw Error(n(308));ci=s,_u.dependencies={lanes:0,firstContext:s}}else ci=ci.next=s;return o}var so=null;function uf(s){so===null?so=[s]:so.push(s)}function eb(s,o,d,g){var v=o.interleaved;return v===null?(d.next=d,uf(o)):(d.next=v.next,v.next=d),o.interleaved=d,Es(s,g)}function Es(s,o){s.lanes|=o;var d=s.alternate;for(d!==null&&(d.lanes|=o),d=s,s=s.return;s!==null;)s.childLanes|=o,d=s.alternate,d!==null&&(d.childLanes|=o),d=s,s=s.return;return d.tag===3?d.stateNode:null}var ra=!1;function df(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function tb(s,o){s=s.updateQueue,o.updateQueue===s&&(o.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Cs(s,o){return{eventTime:s,lane:o,tag:0,payload:null,callback:null,next:null}}function sa(s,o,d){var g=s.updateQueue;if(g===null)return null;if(g=g.shared,(mt&2)!==0){var v=g.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),g.pending=o,Es(s,d)}return v=g.interleaved,v===null?(o.next=o,uf(g)):(o.next=v.next,v.next=o),g.interleaved=o,Es(s,d)}function Nu(s,o,d){if(o=o.updateQueue,o!==null&&(o=o.shared,(d&4194240)!==0)){var g=o.lanes;g&=s.pendingLanes,d|=g,o.lanes=d,Lo(s,d)}}function nb(s,o){var d=s.updateQueue,g=s.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var v=null,_=null;if(d=d.firstBaseUpdate,d!==null){do{var A={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};_===null?v=_=A:_=_.next=A,d=d.next}while(d!==null);_===null?v=_=o:_=_.next=o}else v=_=o;d={baseState:g.baseState,firstBaseUpdate:v,lastBaseUpdate:_,shared:g.shared,effects:g.effects},s.updateQueue=d;return}s=d.lastBaseUpdate,s===null?d.firstBaseUpdate=o:s.next=o,d.lastBaseUpdate=o}function Su(s,o,d,g){var v=s.updateQueue;ra=!1;var _=v.firstBaseUpdate,A=v.lastBaseUpdate,X=v.shared.pending;if(X!==null){v.shared.pending=null;var ne=X,ue=ne.next;ne.next=null,A===null?_=ue:A.next=ue,A=ne;var ve=s.alternate;ve!==null&&(ve=ve.updateQueue,X=ve.lastBaseUpdate,X!==A&&(X===null?ve.firstBaseUpdate=ue:X.next=ue,ve.lastBaseUpdate=ne))}if(_!==null){var ke=v.baseState;A=0,ve=ue=ne=null,X=_;do{var we=X.lane,Oe=X.eventTime;if((g&we)===we){ve!==null&&(ve=ve.next={eventTime:Oe,lane:0,tag:X.tag,payload:X.payload,callback:X.callback,next:null});e:{var Fe=s,Be=X;switch(we=o,Oe=d,Be.tag){case 1:if(Fe=Be.payload,typeof Fe=="function"){ke=Fe.call(Oe,ke,we);break e}ke=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=Be.payload,we=typeof Fe=="function"?Fe.call(Oe,ke,we):Fe,we==null)break e;ke=W({},ke,we);break e;case 2:ra=!0}}X.callback!==null&&X.lane!==0&&(s.flags|=64,we=v.effects,we===null?v.effects=[X]:we.push(X))}else Oe={eventTime:Oe,lane:we,tag:X.tag,payload:X.payload,callback:X.callback,next:null},ve===null?(ue=ve=Oe,ne=ke):ve=ve.next=Oe,A|=we;if(X=X.next,X===null){if(X=v.shared.pending,X===null)break;we=X,X=we.next,we.next=null,v.lastBaseUpdate=we,v.shared.pending=null}}while(!0);if(ve===null&&(ne=ke),v.baseState=ne,v.firstBaseUpdate=ue,v.lastBaseUpdate=ve,o=v.shared.interleaved,o!==null){v=o;do A|=v.lane,v=v.next;while(v!==o)}else _===null&&(v.shared.lanes=0);io|=A,s.lanes=A,s.memoizedState=ke}}function rb(s,o,d){if(s=o.effects,o.effects=null,s!==null)for(o=0;o<s.length;o++){var g=s[o],v=g.callback;if(v!==null){if(g.callback=null,g=d,typeof v!="function")throw Error(n(191,v));v.call(g)}}}var Sl={},ss=ea(Sl),jl=ea(Sl),El=ea(Sl);function ao(s){if(s===Sl)throw Error(n(174));return s}function hf(s,o){switch(St(El,o),St(jl,s),St(ss,Sl),s=o.nodeType,s){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:pt(null,"");break;default:s=s===8?o.parentNode:o,o=s.namespaceURI||null,s=s.tagName,o=pt(o,s)}Et(ss),St(ss,o)}function di(){Et(ss),Et(jl),Et(El)}function sb(s){ao(El.current);var o=ao(ss.current),d=pt(o,s.type);o!==d&&(St(jl,s),St(ss,d))}function ff(s){jl.current===s&&(Et(ss),Et(jl))}var Mt=ea(0);function ju(s){for(var o=s;o!==null;){if(o.tag===13){var d=o.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var pf=[];function mf(){for(var s=0;s<pf.length;s++)pf[s]._workInProgressVersionPrimary=null;pf.length=0}var Eu=C.ReactCurrentDispatcher,gf=C.ReactCurrentBatchConfig,oo=0,It=null,Vt=null,Jt=null,Cu=!1,Cl=!1,Tl=0,eI=0;function wn(){throw Error(n(321))}function yf(s,o){if(o===null)return!1;for(var d=0;d<o.length&&d<s.length;d++)if(!Vn(s[d],o[d]))return!1;return!0}function wf(s,o,d,g,v,_){if(oo=_,It=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Eu.current=s===null||s.memoizedState===null?sI:aI,s=d(g,v),Cl){_=0;do{if(Cl=!1,Tl=0,25<=_)throw Error(n(301));_+=1,Jt=Vt=null,o.updateQueue=null,Eu.current=oI,s=d(g,v)}while(Cl)}if(Eu.current=Ru,o=Vt!==null&&Vt.next!==null,oo=0,Jt=Vt=It=null,Cu=!1,o)throw Error(n(300));return s}function vf(){var s=Tl!==0;return Tl=0,s}function as(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?It.memoizedState=Jt=s:Jt=Jt.next=s,Jt}function ir(){if(Vt===null){var s=It.alternate;s=s!==null?s.memoizedState:null}else s=Vt.next;var o=Jt===null?It.memoizedState:Jt.next;if(o!==null)Jt=o,Vt=s;else{if(s===null)throw Error(n(310));Vt=s,s={memoizedState:Vt.memoizedState,baseState:Vt.baseState,baseQueue:Vt.baseQueue,queue:Vt.queue,next:null},Jt===null?It.memoizedState=Jt=s:Jt=Jt.next=s}return Jt}function Al(s,o){return typeof o=="function"?o(s):o}function xf(s){var o=ir(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var g=Vt,v=g.baseQueue,_=d.pending;if(_!==null){if(v!==null){var A=v.next;v.next=_.next,_.next=A}g.baseQueue=v=_,d.pending=null}if(v!==null){_=v.next,g=g.baseState;var X=A=null,ne=null,ue=_;do{var ve=ue.lane;if((oo&ve)===ve)ne!==null&&(ne=ne.next={lane:0,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null}),g=ue.hasEagerState?ue.eagerState:s(g,ue.action);else{var ke={lane:ve,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null};ne===null?(X=ne=ke,A=g):ne=ne.next=ke,It.lanes|=ve,io|=ve}ue=ue.next}while(ue!==null&&ue!==_);ne===null?A=g:ne.next=X,Vn(g,o.memoizedState)||(Dn=!0),o.memoizedState=g,o.baseState=A,o.baseQueue=ne,d.lastRenderedState=g}if(s=d.interleaved,s!==null){v=s;do _=v.lane,It.lanes|=_,io|=_,v=v.next;while(v!==s)}else v===null&&(d.lanes=0);return[o.memoizedState,d.dispatch]}function bf(s){var o=ir(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var g=d.dispatch,v=d.pending,_=o.memoizedState;if(v!==null){d.pending=null;var A=v=v.next;do _=s(_,A.action),A=A.next;while(A!==v);Vn(_,o.memoizedState)||(Dn=!0),o.memoizedState=_,o.baseQueue===null&&(o.baseState=_),d.lastRenderedState=_}return[_,g]}function ab(){}function ob(s,o){var d=It,g=ir(),v=o(),_=!Vn(g.memoizedState,v);if(_&&(g.memoizedState=v,Dn=!0),g=g.queue,kf(cb.bind(null,d,g,s),[s]),g.getSnapshot!==o||_||Jt!==null&&Jt.memoizedState.tag&1){if(d.flags|=2048,Rl(9,lb.bind(null,d,g,v,o),void 0,null),en===null)throw Error(n(349));(oo&30)!==0||ib(d,o,v)}return v}function ib(s,o,d){s.flags|=16384,s={getSnapshot:o,value:d},o=It.updateQueue,o===null?(o={lastEffect:null,stores:null},It.updateQueue=o,o.stores=[s]):(d=o.stores,d===null?o.stores=[s]:d.push(s))}function lb(s,o,d,g){o.value=d,o.getSnapshot=g,ub(o)&&db(s)}function cb(s,o,d){return d(function(){ub(o)&&db(s)})}function ub(s){var o=s.getSnapshot;s=s.value;try{var d=o();return!Vn(s,d)}catch{return!0}}function db(s){var o=Es(s,1);o!==null&&$r(o,s,1,-1)}function hb(s){var o=as();return typeof s=="function"&&(s=s()),o.memoizedState=o.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Al,lastRenderedState:s},o.queue=s,s=s.dispatch=rI.bind(null,It,s),[o.memoizedState,s]}function Rl(s,o,d,g){return s={tag:s,create:o,destroy:d,deps:g,next:null},o=It.updateQueue,o===null?(o={lastEffect:null,stores:null},It.updateQueue=o,o.lastEffect=s.next=s):(d=o.lastEffect,d===null?o.lastEffect=s.next=s:(g=d.next,d.next=s,s.next=g,o.lastEffect=s)),s}function fb(){return ir().memoizedState}function Tu(s,o,d,g){var v=as();It.flags|=s,v.memoizedState=Rl(1|o,d,void 0,g===void 0?null:g)}function Au(s,o,d,g){var v=ir();g=g===void 0?null:g;var _=void 0;if(Vt!==null){var A=Vt.memoizedState;if(_=A.destroy,g!==null&&yf(g,A.deps)){v.memoizedState=Rl(o,d,_,g);return}}It.flags|=s,v.memoizedState=Rl(1|o,d,_,g)}function pb(s,o){return Tu(8390656,8,s,o)}function kf(s,o){return Au(2048,8,s,o)}function mb(s,o){return Au(4,2,s,o)}function gb(s,o){return Au(4,4,s,o)}function yb(s,o){if(typeof o=="function")return s=s(),o(s),function(){o(null)};if(o!=null)return s=s(),o.current=s,function(){o.current=null}}function wb(s,o,d){return d=d!=null?d.concat([s]):null,Au(4,4,yb.bind(null,o,s),d)}function _f(){}function vb(s,o){var d=ir();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&yf(o,g[1])?g[0]:(d.memoizedState=[s,o],s)}function xb(s,o){var d=ir();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&yf(o,g[1])?g[0]:(s=s(),d.memoizedState=[s,o],s)}function bb(s,o,d){return(oo&21)===0?(s.baseState&&(s.baseState=!1,Dn=!0),s.memoizedState=d):(Vn(d,o)||(d=$c(),It.lanes|=d,io|=d,s.baseState=!0),o)}function tI(s,o){var d=st;st=d!==0&&4>d?d:4,s(!0);var g=gf.transition;gf.transition={};try{s(!1),o()}finally{st=d,gf.transition=g}}function kb(){return ir().memoizedState}function nI(s,o,d){var g=la(s);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},_b(s))Nb(o,d);else if(d=eb(s,o,d,g),d!==null){var v=En();$r(d,s,g,v),Sb(d,o,g)}}function rI(s,o,d){var g=la(s),v={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(_b(s))Nb(o,v);else{var _=s.alternate;if(s.lanes===0&&(_===null||_.lanes===0)&&(_=o.lastRenderedReducer,_!==null))try{var A=o.lastRenderedState,X=_(A,d);if(v.hasEagerState=!0,v.eagerState=X,Vn(X,A)){var ne=o.interleaved;ne===null?(v.next=v,uf(o)):(v.next=ne.next,ne.next=v),o.interleaved=v;return}}catch{}finally{}d=eb(s,o,v,g),d!==null&&(v=En(),$r(d,s,g,v),Sb(d,o,g))}}function _b(s){var o=s.alternate;return s===It||o!==null&&o===It}function Nb(s,o){Cl=Cu=!0;var d=s.pending;d===null?o.next=o:(o.next=d.next,d.next=o),s.pending=o}function Sb(s,o,d){if((d&4194240)!==0){var g=o.lanes;g&=s.pendingLanes,d|=g,o.lanes=d,Lo(s,d)}}var Ru={readContext:or,useCallback:wn,useContext:wn,useEffect:wn,useImperativeHandle:wn,useInsertionEffect:wn,useLayoutEffect:wn,useMemo:wn,useReducer:wn,useRef:wn,useState:wn,useDebugValue:wn,useDeferredValue:wn,useTransition:wn,useMutableSource:wn,useSyncExternalStore:wn,useId:wn,unstable_isNewReconciler:!1},sI={readContext:or,useCallback:function(s,o){return as().memoizedState=[s,o===void 0?null:o],s},useContext:or,useEffect:pb,useImperativeHandle:function(s,o,d){return d=d!=null?d.concat([s]):null,Tu(4194308,4,yb.bind(null,o,s),d)},useLayoutEffect:function(s,o){return Tu(4194308,4,s,o)},useInsertionEffect:function(s,o){return Tu(4,2,s,o)},useMemo:function(s,o){var d=as();return o=o===void 0?null:o,s=s(),d.memoizedState=[s,o],s},useReducer:function(s,o,d){var g=as();return o=d!==void 0?d(o):o,g.memoizedState=g.baseState=o,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},g.queue=s,s=s.dispatch=nI.bind(null,It,s),[g.memoizedState,s]},useRef:function(s){var o=as();return s={current:s},o.memoizedState=s},useState:hb,useDebugValue:_f,useDeferredValue:function(s){return as().memoizedState=s},useTransition:function(){var s=hb(!1),o=s[0];return s=tI.bind(null,s[1]),as().memoizedState=s,[o,s]},useMutableSource:function(){},useSyncExternalStore:function(s,o,d){var g=It,v=as();if(Tt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=o(),en===null)throw Error(n(349));(oo&30)!==0||ib(g,o,d)}v.memoizedState=d;var _={value:d,getSnapshot:o};return v.queue=_,pb(cb.bind(null,g,_,s),[s]),g.flags|=2048,Rl(9,lb.bind(null,g,_,d,o),void 0,null),d},useId:function(){var s=as(),o=en.identifierPrefix;if(Tt){var d=js,g=Ss;d=(g&~(1<<32-$n(g)-1)).toString(32)+d,o=":"+o+"R"+d,d=Tl++,0<d&&(o+="H"+d.toString(32)),o+=":"}else d=eI++,o=":"+o+"r"+d.toString(32)+":";return s.memoizedState=o},unstable_isNewReconciler:!1},aI={readContext:or,useCallback:vb,useContext:or,useEffect:kf,useImperativeHandle:wb,useInsertionEffect:mb,useLayoutEffect:gb,useMemo:xb,useReducer:xf,useRef:fb,useState:function(){return xf(Al)},useDebugValue:_f,useDeferredValue:function(s){var o=ir();return bb(o,Vt.memoizedState,s)},useTransition:function(){var s=xf(Al)[0],o=ir().memoizedState;return[s,o]},useMutableSource:ab,useSyncExternalStore:ob,useId:kb,unstable_isNewReconciler:!1},oI={readContext:or,useCallback:vb,useContext:or,useEffect:kf,useImperativeHandle:wb,useInsertionEffect:mb,useLayoutEffect:gb,useMemo:xb,useReducer:bf,useRef:fb,useState:function(){return bf(Al)},useDebugValue:_f,useDeferredValue:function(s){var o=ir();return Vt===null?o.memoizedState=s:bb(o,Vt.memoizedState,s)},useTransition:function(){var s=bf(Al)[0],o=ir().memoizedState;return[s,o]},useMutableSource:ab,useSyncExternalStore:ob,useId:kb,unstable_isNewReconciler:!1};function Rr(s,o){if(s&&s.defaultProps){o=W({},o),s=s.defaultProps;for(var d in s)o[d]===void 0&&(o[d]=s[d]);return o}return o}function Nf(s,o,d,g){o=s.memoizedState,d=d(g,o),d=d==null?o:W({},o,d),s.memoizedState=d,s.lanes===0&&(s.updateQueue.baseState=d)}var Mu={isMounted:function(s){return(s=s._reactInternals)?Q(s)===s:!1},enqueueSetState:function(s,o,d){s=s._reactInternals;var g=En(),v=la(s),_=Cs(g,v);_.payload=o,d!=null&&(_.callback=d),o=sa(s,_,v),o!==null&&($r(o,s,v,g),Nu(o,s,v))},enqueueReplaceState:function(s,o,d){s=s._reactInternals;var g=En(),v=la(s),_=Cs(g,v);_.tag=1,_.payload=o,d!=null&&(_.callback=d),o=sa(s,_,v),o!==null&&($r(o,s,v,g),Nu(o,s,v))},enqueueForceUpdate:function(s,o){s=s._reactInternals;var d=En(),g=la(s),v=Cs(d,g);v.tag=2,o!=null&&(v.callback=o),o=sa(s,v,g),o!==null&&($r(o,s,g,d),Nu(o,s,g))}};function jb(s,o,d,g,v,_,A){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(g,_,A):o.prototype&&o.prototype.isPureReactComponent?!Jr(d,g)||!Jr(v,_):!0}function Eb(s,o,d){var g=!1,v=ta,_=o.contextType;return typeof _=="object"&&_!==null?_=or(_):(v=Pn(o)?to:yn.current,g=o.contextTypes,_=(g=g!=null)?si(s,v):ta),o=new o(d,_),s.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Mu,s.stateNode=o,o._reactInternals=s,g&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=v,s.__reactInternalMemoizedMaskedChildContext=_),o}function Cb(s,o,d,g){s=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(d,g),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(d,g),o.state!==s&&Mu.enqueueReplaceState(o,o.state,null)}function Sf(s,o,d,g){var v=s.stateNode;v.props=d,v.state=s.memoizedState,v.refs={},df(s);var _=o.contextType;typeof _=="object"&&_!==null?v.context=or(_):(_=Pn(o)?to:yn.current,v.context=si(s,_)),v.state=s.memoizedState,_=o.getDerivedStateFromProps,typeof _=="function"&&(Nf(s,o,_,d),v.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&Mu.enqueueReplaceState(v,v.state,null),Su(s,d,v,g),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308)}function hi(s,o){try{var d="",g=o;do d+=Y(g),g=g.return;while(g);var v=d}catch(_){v=`
39
- Error generating stack: `+_.message+`
40
- `+_.stack}return{value:s,source:o,stack:v,digest:null}}function jf(s,o,d){return{value:s,source:null,stack:d??null,digest:o??null}}function Ef(s,o){try{console.error(o.value)}catch(d){setTimeout(function(){throw d})}}var iI=typeof WeakMap=="function"?WeakMap:Map;function Tb(s,o,d){d=Cs(-1,d),d.tag=3,d.payload={element:null};var g=o.value;return d.callback=function(){qu||(qu=!0,zf=g),Ef(s,o)},d}function Ab(s,o,d){d=Cs(-1,d),d.tag=3;var g=s.type.getDerivedStateFromError;if(typeof g=="function"){var v=o.value;d.payload=function(){return g(v)},d.callback=function(){Ef(s,o)}}var _=s.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(d.callback=function(){Ef(s,o),typeof g!="function"&&(oa===null?oa=new Set([this]):oa.add(this));var A=o.stack;this.componentDidCatch(o.value,{componentStack:A!==null?A:""})}),d}function Rb(s,o,d){var g=s.pingCache;if(g===null){g=s.pingCache=new iI;var v=new Set;g.set(o,v)}else v=g.get(o),v===void 0&&(v=new Set,g.set(o,v));v.has(d)||(v.add(d),s=bI.bind(null,s,o,d),o.then(s,s))}function Mb(s){do{var o;if((o=s.tag===13)&&(o=s.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return s;s=s.return}while(s!==null);return null}function Ib(s,o,d,g,v){return(s.mode&1)===0?(s===o?s.flags|=65536:(s.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(o=Cs(-1,1),o.tag=2,sa(d,o,1))),d.lanes|=1),s):(s.flags|=65536,s.lanes=v,s)}var lI=C.ReactCurrentOwner,Dn=!1;function jn(s,o,d,g){o.child=s===null?J0(o,null,d,g):li(o,s.child,d,g)}function $b(s,o,d,g,v){d=d.render;var _=o.ref;return ui(o,v),g=wf(s,o,d,g,_,v),d=vf(),s!==null&&!Dn?(o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~v,Ts(s,o,v)):(Tt&&d&&ef(o),o.flags|=1,jn(s,o,g,v),o.child)}function Ob(s,o,d,g,v){if(s===null){var _=d.type;return typeof _=="function"&&!Yf(_)&&_.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(o.tag=15,o.type=_,Lb(s,o,_,g,v)):(s=Wu(d.type,null,g,o,o.mode,v),s.ref=o.ref,s.return=o,o.child=s)}if(_=s.child,(s.lanes&v)===0){var A=_.memoizedProps;if(d=d.compare,d=d!==null?d:Jr,d(A,g)&&s.ref===o.ref)return Ts(s,o,v)}return o.flags|=1,s=ua(_,g),s.ref=o.ref,s.return=o,o.child=s}function Lb(s,o,d,g,v){if(s!==null){var _=s.memoizedProps;if(Jr(_,g)&&s.ref===o.ref)if(Dn=!1,o.pendingProps=g=_,(s.lanes&v)!==0)(s.flags&131072)!==0&&(Dn=!0);else return o.lanes=s.lanes,Ts(s,o,v)}return Cf(s,o,d,g,v)}function Pb(s,o,d){var g=o.pendingProps,v=g.children,_=s!==null?s.memoizedState:null;if(g.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},St(pi,Xn),Xn|=d;else{if((d&1073741824)===0)return s=_!==null?_.baseLanes|d:d,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:s,cachePool:null,transitions:null},o.updateQueue=null,St(pi,Xn),Xn|=s,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=_!==null?_.baseLanes:d,St(pi,Xn),Xn|=g}else _!==null?(g=_.baseLanes|d,o.memoizedState=null):g=d,St(pi,Xn),Xn|=g;return jn(s,o,v,d),o.child}function Db(s,o){var d=o.ref;(s===null&&d!==null||s!==null&&s.ref!==d)&&(o.flags|=512,o.flags|=2097152)}function Cf(s,o,d,g,v){var _=Pn(d)?to:yn.current;return _=si(o,_),ui(o,v),d=wf(s,o,d,g,_,v),g=vf(),s!==null&&!Dn?(o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~v,Ts(s,o,v)):(Tt&&g&&ef(o),o.flags|=1,jn(s,o,d,v),o.child)}function qb(s,o,d,g,v){if(Pn(d)){var _=!0;gu(o)}else _=!1;if(ui(o,v),o.stateNode===null)$u(s,o),Eb(o,d,g),Sf(o,d,g,v),g=!0;else if(s===null){var A=o.stateNode,X=o.memoizedProps;A.props=X;var ne=A.context,ue=d.contextType;typeof ue=="object"&&ue!==null?ue=or(ue):(ue=Pn(d)?to:yn.current,ue=si(o,ue));var ve=d.getDerivedStateFromProps,ke=typeof ve=="function"||typeof A.getSnapshotBeforeUpdate=="function";ke||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(X!==g||ne!==ue)&&Cb(o,A,g,ue),ra=!1;var we=o.memoizedState;A.state=we,Su(o,g,A,v),ne=o.memoizedState,X!==g||we!==ne||Ln.current||ra?(typeof ve=="function"&&(Nf(o,d,ve,g),ne=o.memoizedState),(X=ra||jb(o,d,X,g,we,ne,ue))?(ke||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"&&(o.flags|=4194308)):(typeof A.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=g,o.memoizedState=ne),A.props=g,A.state=ne,A.context=ue,g=X):(typeof A.componentDidMount=="function"&&(o.flags|=4194308),g=!1)}else{A=o.stateNode,tb(s,o),X=o.memoizedProps,ue=o.type===o.elementType?X:Rr(o.type,X),A.props=ue,ke=o.pendingProps,we=A.context,ne=d.contextType,typeof ne=="object"&&ne!==null?ne=or(ne):(ne=Pn(d)?to:yn.current,ne=si(o,ne));var Oe=d.getDerivedStateFromProps;(ve=typeof Oe=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(X!==ke||we!==ne)&&Cb(o,A,g,ne),ra=!1,we=o.memoizedState,A.state=we,Su(o,g,A,v);var Fe=o.memoizedState;X!==ke||we!==Fe||Ln.current||ra?(typeof Oe=="function"&&(Nf(o,d,Oe,g),Fe=o.memoizedState),(ue=ra||jb(o,d,ue,g,we,Fe,ne)||!1)?(ve||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(g,Fe,ne),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(g,Fe,ne)),typeof A.componentDidUpdate=="function"&&(o.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof A.componentDidUpdate!="function"||X===s.memoizedProps&&we===s.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||X===s.memoizedProps&&we===s.memoizedState||(o.flags|=1024),o.memoizedProps=g,o.memoizedState=Fe),A.props=g,A.state=Fe,A.context=ne,g=ue):(typeof A.componentDidUpdate!="function"||X===s.memoizedProps&&we===s.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||X===s.memoizedProps&&we===s.memoizedState||(o.flags|=1024),g=!1)}return Tf(s,o,d,g,_,v)}function Tf(s,o,d,g,v,_){Db(s,o);var A=(o.flags&128)!==0;if(!g&&!A)return v&&U0(o,d,!1),Ts(s,o,_);g=o.stateNode,lI.current=o;var X=A&&typeof d.getDerivedStateFromError!="function"?null:g.render();return o.flags|=1,s!==null&&A?(o.child=li(o,s.child,null,_),o.child=li(o,null,X,_)):jn(s,o,X,_),o.memoizedState=g.state,v&&U0(o,d,!0),o.child}function Fb(s){var o=s.stateNode;o.pendingContext?z0(s,o.pendingContext,o.pendingContext!==o.context):o.context&&z0(s,o.context,!1),hf(s,o.containerInfo)}function Bb(s,o,d,g,v){return ii(),sf(v),o.flags|=256,jn(s,o,d,g),o.child}var Af={dehydrated:null,treeContext:null,retryLane:0};function Rf(s){return{baseLanes:s,cachePool:null,transitions:null}}function zb(s,o,d){var g=o.pendingProps,v=Mt.current,_=!1,A=(o.flags&128)!==0,X;if((X=A)||(X=s!==null&&s.memoizedState===null?!1:(v&2)!==0),X?(_=!0,o.flags&=-129):(s===null||s.memoizedState!==null)&&(v|=1),St(Mt,v&1),s===null)return rf(o),s=o.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((o.mode&1)===0?o.lanes=1:s.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(A=g.children,s=g.fallback,_?(g=o.mode,_=o.child,A={mode:"hidden",children:A},(g&1)===0&&_!==null?(_.childLanes=0,_.pendingProps=A):_=Vu(A,g,0,null),s=ho(s,g,d,null),_.return=o,s.return=o,_.sibling=s,o.child=_,o.child.memoizedState=Rf(d),o.memoizedState=Af,s):Mf(o,A));if(v=s.memoizedState,v!==null&&(X=v.dehydrated,X!==null))return cI(s,o,A,g,X,v,d);if(_){_=g.fallback,A=o.mode,v=s.child,X=v.sibling;var ne={mode:"hidden",children:g.children};return(A&1)===0&&o.child!==v?(g=o.child,g.childLanes=0,g.pendingProps=ne,o.deletions=null):(g=ua(v,ne),g.subtreeFlags=v.subtreeFlags&14680064),X!==null?_=ua(X,_):(_=ho(_,A,d,null),_.flags|=2),_.return=o,g.return=o,g.sibling=_,o.child=g,g=_,_=o.child,A=s.child.memoizedState,A=A===null?Rf(d):{baseLanes:A.baseLanes|d,cachePool:null,transitions:A.transitions},_.memoizedState=A,_.childLanes=s.childLanes&~d,o.memoizedState=Af,g}return _=s.child,s=_.sibling,g=ua(_,{mode:"visible",children:g.children}),(o.mode&1)===0&&(g.lanes=d),g.return=o,g.sibling=null,s!==null&&(d=o.deletions,d===null?(o.deletions=[s],o.flags|=16):d.push(s)),o.child=g,o.memoizedState=null,g}function Mf(s,o){return o=Vu({mode:"visible",children:o},s.mode,0,null),o.return=s,s.child=o}function Iu(s,o,d,g){return g!==null&&sf(g),li(o,s.child,null,d),s=Mf(o,o.pendingProps.children),s.flags|=2,o.memoizedState=null,s}function cI(s,o,d,g,v,_,A){if(d)return o.flags&256?(o.flags&=-257,g=jf(Error(n(422))),Iu(s,o,A,g)):o.memoizedState!==null?(o.child=s.child,o.flags|=128,null):(_=g.fallback,v=o.mode,g=Vu({mode:"visible",children:g.children},v,0,null),_=ho(_,v,A,null),_.flags|=2,g.return=o,_.return=o,g.sibling=_,o.child=g,(o.mode&1)!==0&&li(o,s.child,null,A),o.child.memoizedState=Rf(A),o.memoizedState=Af,_);if((o.mode&1)===0)return Iu(s,o,A,null);if(v.data==="$!"){if(g=v.nextSibling&&v.nextSibling.dataset,g)var X=g.dgst;return g=X,_=Error(n(419)),g=jf(_,g,void 0),Iu(s,o,A,g)}if(X=(A&s.childLanes)!==0,Dn||X){if(g=en,g!==null){switch(A&-A){case 4:v=2;break;case 16:v=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(g.suspendedLanes|A))!==0?0:v,v!==0&&v!==_.retryLane&&(_.retryLane=v,Es(s,v),$r(g,s,v,-1))}return Kf(),g=jf(Error(n(421))),Iu(s,o,A,g)}return v.data==="$?"?(o.flags|=128,o.child=s.child,o=kI.bind(null,s),v._reactRetry=o,null):(s=_.treeContext,Yn=Cr(v.nextSibling),Kn=o,Tt=!0,Ar=null,s!==null&&(sr[ar++]=Ss,sr[ar++]=js,sr[ar++]=no,Ss=s.id,js=s.overflow,no=o),o=Mf(o,g.children),o.flags|=4096,o)}function Hb(s,o,d){s.lanes|=o;var g=s.alternate;g!==null&&(g.lanes|=o),cf(s.return,o,d)}function If(s,o,d,g,v){var _=s.memoizedState;_===null?s.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:v}:(_.isBackwards=o,_.rendering=null,_.renderingStartTime=0,_.last=g,_.tail=d,_.tailMode=v)}function Ub(s,o,d){var g=o.pendingProps,v=g.revealOrder,_=g.tail;if(jn(s,o,g.children,d),g=Mt.current,(g&2)!==0)g=g&1|2,o.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=o.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Hb(s,d,o);else if(s.tag===19)Hb(s,d,o);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===o)break e;for(;s.sibling===null;){if(s.return===null||s.return===o)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}g&=1}if(St(Mt,g),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(d=o.child,v=null;d!==null;)s=d.alternate,s!==null&&ju(s)===null&&(v=d),d=d.sibling;d=v,d===null?(v=o.child,o.child=null):(v=d.sibling,d.sibling=null),If(o,!1,v,d,_);break;case"backwards":for(d=null,v=o.child,o.child=null;v!==null;){if(s=v.alternate,s!==null&&ju(s)===null){o.child=v;break}s=v.sibling,v.sibling=d,d=v,v=s}If(o,!0,d,null,_);break;case"together":If(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function $u(s,o){(o.mode&1)===0&&s!==null&&(s.alternate=null,o.alternate=null,o.flags|=2)}function Ts(s,o,d){if(s!==null&&(o.dependencies=s.dependencies),io|=o.lanes,(d&o.childLanes)===0)return null;if(s!==null&&o.child!==s.child)throw Error(n(153));if(o.child!==null){for(s=o.child,d=ua(s,s.pendingProps),o.child=d,d.return=o;s.sibling!==null;)s=s.sibling,d=d.sibling=ua(s,s.pendingProps),d.return=o;d.sibling=null}return o.child}function uI(s,o,d){switch(o.tag){case 3:Fb(o),ii();break;case 5:sb(o);break;case 1:Pn(o.type)&&gu(o);break;case 4:hf(o,o.stateNode.containerInfo);break;case 10:var g=o.type._context,v=o.memoizedProps.value;St(ku,g._currentValue),g._currentValue=v;break;case 13:if(g=o.memoizedState,g!==null)return g.dehydrated!==null?(St(Mt,Mt.current&1),o.flags|=128,null):(d&o.child.childLanes)!==0?zb(s,o,d):(St(Mt,Mt.current&1),s=Ts(s,o,d),s!==null?s.sibling:null);St(Mt,Mt.current&1);break;case 19:if(g=(d&o.childLanes)!==0,(s.flags&128)!==0){if(g)return Ub(s,o,d);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),St(Mt,Mt.current),g)break;return null;case 22:case 23:return o.lanes=0,Pb(s,o,d)}return Ts(s,o,d)}var Wb,$f,Vb,Gb;Wb=function(s,o){for(var d=o.child;d!==null;){if(d.tag===5||d.tag===6)s.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===o)break;for(;d.sibling===null;){if(d.return===null||d.return===o)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},$f=function(){},Vb=function(s,o,d,g){var v=s.memoizedProps;if(v!==g){s=o.stateNode,ao(ss.current);var _=null;switch(d){case"input":v=Me(s,v),g=Me(s,g),_=[];break;case"select":v=W({},v,{value:void 0}),g=W({},g,{value:void 0}),_=[];break;case"textarea":v=ce(s,v),g=ce(s,g),_=[];break;default:typeof v.onClick!="function"&&typeof g.onClick=="function"&&(s.onclick=Ae)}jt(d,g);var A;d=null;for(ue in v)if(!g.hasOwnProperty(ue)&&v.hasOwnProperty(ue)&&v[ue]!=null)if(ue==="style"){var X=v[ue];for(A in X)X.hasOwnProperty(A)&&(d||(d={}),d[A]="")}else ue!=="dangerouslySetInnerHTML"&&ue!=="children"&&ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&ue!=="autoFocus"&&(a.hasOwnProperty(ue)?_||(_=[]):(_=_||[]).push(ue,null));for(ue in g){var ne=g[ue];if(X=v!=null?v[ue]:void 0,g.hasOwnProperty(ue)&&ne!==X&&(ne!=null||X!=null))if(ue==="style")if(X){for(A in X)!X.hasOwnProperty(A)||ne&&ne.hasOwnProperty(A)||(d||(d={}),d[A]="");for(A in ne)ne.hasOwnProperty(A)&&X[A]!==ne[A]&&(d||(d={}),d[A]=ne[A])}else d||(_||(_=[]),_.push(ue,d)),d=ne;else ue==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,X=X?X.__html:void 0,ne!=null&&X!==ne&&(_=_||[]).push(ue,ne)):ue==="children"?typeof ne!="string"&&typeof ne!="number"||(_=_||[]).push(ue,""+ne):ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&(a.hasOwnProperty(ue)?(ne!=null&&ue==="onScroll"&&_t("scroll",s),_||X===ne||(_=[])):(_=_||[]).push(ue,ne))}d&&(_=_||[]).push("style",d);var ue=_;(o.updateQueue=ue)&&(o.flags|=4)}},Gb=function(s,o,d,g){d!==g&&(o.flags|=4)};function Ml(s,o){if(!Tt)switch(s.tailMode){case"hidden":o=s.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?s.tail=null:d.sibling=null;break;case"collapsed":d=s.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?o||s.tail===null?s.tail=null:s.tail.sibling=null:g.sibling=null}}function vn(s){var o=s.alternate!==null&&s.alternate.child===s.child,d=0,g=0;if(o)for(var v=s.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags&14680064,g|=v.flags&14680064,v.return=s,v=v.sibling;else for(v=s.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags,g|=v.flags,v.return=s,v=v.sibling;return s.subtreeFlags|=g,s.childLanes=d,o}function dI(s,o,d){var g=o.pendingProps;switch(tf(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vn(o),null;case 1:return Pn(o.type)&&mu(),vn(o),null;case 3:return g=o.stateNode,di(),Et(Ln),Et(yn),mf(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(s===null||s.child===null)&&(xu(o)?o.flags|=4:s===null||s.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Ar!==null&&(Wf(Ar),Ar=null))),$f(s,o),vn(o),null;case 5:ff(o);var v=ao(El.current);if(d=o.type,s!==null&&o.stateNode!=null)Vb(s,o,d,g,v),s.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!g){if(o.stateNode===null)throw Error(n(166));return vn(o),null}if(s=ao(ss.current),xu(o)){g=o.stateNode,d=o.type;var _=o.memoizedProps;switch(g[On]=o,g[Tr]=_,s=(o.mode&1)!==0,d){case"dialog":_t("cancel",g),_t("close",g);break;case"iframe":case"object":case"embed":_t("load",g);break;case"video":case"audio":for(v=0;v<Qa.length;v++)_t(Qa[v],g);break;case"source":_t("error",g);break;case"img":case"image":case"link":_t("error",g),_t("load",g);break;case"details":_t("toggle",g);break;case"input":xe(g,_),_t("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!_.multiple},_t("invalid",g);break;case"textarea":je(g,_),_t("invalid",g)}jt(d,_),v=null;for(var A in _)if(_.hasOwnProperty(A)){var X=_[A];A==="children"?typeof X=="string"?g.textContent!==X&&(_.suppressHydrationWarning!==!0&&ae(g.textContent,X,s),v=["children",X]):typeof X=="number"&&g.textContent!==""+X&&(_.suppressHydrationWarning!==!0&&ae(g.textContent,X,s),v=["children",""+X]):a.hasOwnProperty(A)&&X!=null&&A==="onScroll"&&_t("scroll",g)}switch(d){case"input":Ie(g),_e(g,_,!0);break;case"textarea":Ie(g),Je(g);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(g.onclick=Ae)}g=v,o.updateQueue=g,g!==null&&(o.flags|=4)}else{A=v.nodeType===9?v:v.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=qe(d)),s==="http://www.w3.org/1999/xhtml"?d==="script"?(s=A.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof g.is=="string"?s=A.createElement(d,{is:g.is}):(s=A.createElement(d),d==="select"&&(A=s,g.multiple?A.multiple=!0:g.size&&(A.size=g.size))):s=A.createElementNS(s,d),s[On]=o,s[Tr]=g,Wb(s,o,!1,!1),o.stateNode=s;e:{switch(A=xt(d,g),d){case"dialog":_t("cancel",s),_t("close",s),v=g;break;case"iframe":case"object":case"embed":_t("load",s),v=g;break;case"video":case"audio":for(v=0;v<Qa.length;v++)_t(Qa[v],s);v=g;break;case"source":_t("error",s),v=g;break;case"img":case"image":case"link":_t("error",s),_t("load",s),v=g;break;case"details":_t("toggle",s),v=g;break;case"input":xe(s,g),v=Me(s,g),_t("invalid",s);break;case"option":v=g;break;case"select":s._wrapperState={wasMultiple:!!g.multiple},v=W({},g,{value:void 0}),_t("invalid",s);break;case"textarea":je(s,g),v=ce(s,g),_t("invalid",s);break;default:v=g}jt(d,v),X=v;for(_ in X)if(X.hasOwnProperty(_)){var ne=X[_];_==="style"?rt(s,ne):_==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,ne!=null&&be(s,ne)):_==="children"?typeof ne=="string"?(d!=="textarea"||ne!=="")&&Ve(s,ne):typeof ne=="number"&&Ve(s,""+ne):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(a.hasOwnProperty(_)?ne!=null&&_==="onScroll"&&_t("scroll",s):ne!=null&&E(s,_,ne,A))}switch(d){case"input":Ie(s),_e(s,g,!1);break;case"textarea":Ie(s),Je(s);break;case"option":g.value!=null&&s.setAttribute("value",""+le(g.value));break;case"select":s.multiple=!!g.multiple,_=g.value,_!=null?Ke(s,!!g.multiple,_,!1):g.defaultValue!=null&&Ke(s,!!g.multiple,g.defaultValue,!0);break;default:typeof v.onClick=="function"&&(s.onclick=Ae)}switch(d){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return vn(o),null;case 6:if(s&&o.stateNode!=null)Gb(s,o,s.memoizedProps,g);else{if(typeof g!="string"&&o.stateNode===null)throw Error(n(166));if(d=ao(El.current),ao(ss.current),xu(o)){if(g=o.stateNode,d=o.memoizedProps,g[On]=o,(_=g.nodeValue!==d)&&(s=Kn,s!==null))switch(s.tag){case 3:ae(g.nodeValue,d,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&ae(g.nodeValue,d,(s.mode&1)!==0)}_&&(o.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[On]=o,o.stateNode=g}return vn(o),null;case 13:if(Et(Mt),g=o.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(Tt&&Yn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)X0(),ii(),o.flags|=98560,_=!1;else if(_=xu(o),g!==null&&g.dehydrated!==null){if(s===null){if(!_)throw Error(n(318));if(_=o.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));_[On]=o}else ii(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;vn(o),_=!1}else Ar!==null&&(Wf(Ar),Ar=null),_=!0;if(!_)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=d,o):(g=g!==null,g!==(s!==null&&s.memoizedState!==null)&&g&&(o.child.flags|=8192,(o.mode&1)!==0&&(s===null||(Mt.current&1)!==0?Gt===0&&(Gt=3):Kf())),o.updateQueue!==null&&(o.flags|=4),vn(o),null);case 4:return di(),$f(s,o),s===null&&bs(o.stateNode.containerInfo),vn(o),null;case 10:return lf(o.type._context),vn(o),null;case 17:return Pn(o.type)&&mu(),vn(o),null;case 19:if(Et(Mt),_=o.memoizedState,_===null)return vn(o),null;if(g=(o.flags&128)!==0,A=_.rendering,A===null)if(g)Ml(_,!1);else{if(Gt!==0||s!==null&&(s.flags&128)!==0)for(s=o.child;s!==null;){if(A=ju(s),A!==null){for(o.flags|=128,Ml(_,!1),g=A.updateQueue,g!==null&&(o.updateQueue=g,o.flags|=4),o.subtreeFlags=0,g=d,d=o.child;d!==null;)_=d,s=g,_.flags&=14680066,A=_.alternate,A===null?(_.childLanes=0,_.lanes=s,_.child=null,_.subtreeFlags=0,_.memoizedProps=null,_.memoizedState=null,_.updateQueue=null,_.dependencies=null,_.stateNode=null):(_.childLanes=A.childLanes,_.lanes=A.lanes,_.child=A.child,_.subtreeFlags=0,_.deletions=null,_.memoizedProps=A.memoizedProps,_.memoizedState=A.memoizedState,_.updateQueue=A.updateQueue,_.type=A.type,s=A.dependencies,_.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),d=d.sibling;return St(Mt,Mt.current&1|2),o.child}s=s.sibling}_.tail!==null&&kt()>mi&&(o.flags|=128,g=!0,Ml(_,!1),o.lanes=4194304)}else{if(!g)if(s=ju(A),s!==null){if(o.flags|=128,g=!0,d=s.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),Ml(_,!0),_.tail===null&&_.tailMode==="hidden"&&!A.alternate&&!Tt)return vn(o),null}else 2*kt()-_.renderingStartTime>mi&&d!==1073741824&&(o.flags|=128,g=!0,Ml(_,!1),o.lanes=4194304);_.isBackwards?(A.sibling=o.child,o.child=A):(d=_.last,d!==null?d.sibling=A:o.child=A,_.last=A)}return _.tail!==null?(o=_.tail,_.rendering=o,_.tail=o.sibling,_.renderingStartTime=kt(),o.sibling=null,d=Mt.current,St(Mt,g?d&1|2:d&1),o):(vn(o),null);case 22:case 23:return Gf(),g=o.memoizedState!==null,s!==null&&s.memoizedState!==null!==g&&(o.flags|=8192),g&&(o.mode&1)!==0?(Xn&1073741824)!==0&&(vn(o),o.subtreeFlags&6&&(o.flags|=8192)):vn(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function hI(s,o){switch(tf(o),o.tag){case 1:return Pn(o.type)&&mu(),s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 3:return di(),Et(Ln),Et(yn),mf(),s=o.flags,(s&65536)!==0&&(s&128)===0?(o.flags=s&-65537|128,o):null;case 5:return ff(o),null;case 13:if(Et(Mt),s=o.memoizedState,s!==null&&s.dehydrated!==null){if(o.alternate===null)throw Error(n(340));ii()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 19:return Et(Mt),null;case 4:return di(),null;case 10:return lf(o.type._context),null;case 22:case 23:return Gf(),null;case 24:return null;default:return null}}var Ou=!1,xn=!1,fI=typeof WeakSet=="function"?WeakSet:Set,De=null;function fi(s,o){var d=s.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(g){Lt(s,o,g)}else d.current=null}function Of(s,o,d){try{d()}catch(g){Lt(s,o,g)}}var Kb=!1;function pI(s,o){if(Se=vs,s=fl(),Ko(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var v=g.anchorOffset,_=g.focusNode;g=g.focusOffset;try{d.nodeType,_.nodeType}catch{d=null;break e}var A=0,X=-1,ne=-1,ue=0,ve=0,ke=s,we=null;t:for(;;){for(var Oe;ke!==d||v!==0&&ke.nodeType!==3||(X=A+v),ke!==_||g!==0&&ke.nodeType!==3||(ne=A+g),ke.nodeType===3&&(A+=ke.nodeValue.length),(Oe=ke.firstChild)!==null;)we=ke,ke=Oe;for(;;){if(ke===s)break t;if(we===d&&++ue===v&&(X=A),we===_&&++ve===g&&(ne=A),(Oe=ke.nextSibling)!==null)break;ke=we,we=ke.parentNode}ke=Oe}d=X===-1||ne===-1?null:{start:X,end:ne}}else d=null}d=d||{start:0,end:0}}else d=null;for(Ge={focusedElem:s,selectionRange:d},vs=!1,De=o;De!==null;)if(o=De,s=o.child,(o.subtreeFlags&1028)!==0&&s!==null)s.return=o,De=s;else for(;De!==null;){o=De;try{var Fe=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Fe!==null){var Be=Fe.memoizedProps,Bt=Fe.memoizedState,oe=o.stateNode,re=oe.getSnapshotBeforeUpdate(o.elementType===o.type?Be:Rr(o.type,Be),Bt);oe.__reactInternalSnapshotBeforeUpdate=re}break;case 3:var ie=o.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ee){Lt(o,o.return,Ee)}if(s=o.sibling,s!==null){s.return=o.return,De=s;break}De=o.return}return Fe=Kb,Kb=!1,Fe}function Il(s,o,d){var g=o.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var v=g=g.next;do{if((v.tag&s)===s){var _=v.destroy;v.destroy=void 0,_!==void 0&&Of(o,d,_)}v=v.next}while(v!==g)}}function Lu(s,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var d=o=o.next;do{if((d.tag&s)===s){var g=d.create;d.destroy=g()}d=d.next}while(d!==o)}}function Lf(s){var o=s.ref;if(o!==null){var d=s.stateNode;switch(s.tag){case 5:s=d;break;default:s=d}typeof o=="function"?o(s):o.current=s}}function Yb(s){var o=s.alternate;o!==null&&(s.alternate=null,Yb(o)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(o=s.stateNode,o!==null&&(delete o[On],delete o[Tr],delete o[Ot],delete o[fu],delete o[ZM])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function Xb(s){return s.tag===5||s.tag===3||s.tag===4}function Zb(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Xb(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Pf(s,o,d){var g=s.tag;if(g===5||g===6)s=s.stateNode,o?d.nodeType===8?d.parentNode.insertBefore(s,o):d.insertBefore(s,o):(d.nodeType===8?(o=d.parentNode,o.insertBefore(s,d)):(o=d,o.appendChild(s)),d=d._reactRootContainer,d!=null||o.onclick!==null||(o.onclick=Ae));else if(g!==4&&(s=s.child,s!==null))for(Pf(s,o,d),s=s.sibling;s!==null;)Pf(s,o,d),s=s.sibling}function Df(s,o,d){var g=s.tag;if(g===5||g===6)s=s.stateNode,o?d.insertBefore(s,o):d.appendChild(s);else if(g!==4&&(s=s.child,s!==null))for(Df(s,o,d),s=s.sibling;s!==null;)Df(s,o,d),s=s.sibling}var un=null,Mr=!1;function aa(s,o,d){for(d=d.child;d!==null;)Qb(s,o,d),d=d.sibling}function Qb(s,o,d){if(In&&typeof In.onCommitFiberUnmount=="function")try{In.onCommitFiberUnmount(ms,d)}catch{}switch(d.tag){case 5:xn||fi(d,o);case 6:var g=un,v=Mr;un=null,aa(s,o,d),un=g,Mr=v,un!==null&&(Mr?(s=un,d=d.stateNode,s.nodeType===8?s.parentNode.removeChild(d):s.removeChild(d)):un.removeChild(d.stateNode));break;case 18:un!==null&&(Mr?(s=un,d=d.stateNode,s.nodeType===8?kl(s.parentNode,d):s.nodeType===1&&kl(s,d),Gs(s)):kl(un,d.stateNode));break;case 4:g=un,v=Mr,un=d.stateNode.containerInfo,Mr=!0,aa(s,o,d),un=g,Mr=v;break;case 0:case 11:case 14:case 15:if(!xn&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){v=g=g.next;do{var _=v,A=_.destroy;_=_.tag,A!==void 0&&((_&2)!==0||(_&4)!==0)&&Of(d,o,A),v=v.next}while(v!==g)}aa(s,o,d);break;case 1:if(!xn&&(fi(d,o),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(X){Lt(d,o,X)}aa(s,o,d);break;case 21:aa(s,o,d);break;case 22:d.mode&1?(xn=(g=xn)||d.memoizedState!==null,aa(s,o,d),xn=g):aa(s,o,d);break;default:aa(s,o,d)}}function Jb(s){var o=s.updateQueue;if(o!==null){s.updateQueue=null;var d=s.stateNode;d===null&&(d=s.stateNode=new fI),o.forEach(function(g){var v=_I.bind(null,s,g);d.has(g)||(d.add(g),g.then(v,v))})}}function Ir(s,o){var d=o.deletions;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];try{var _=s,A=o,X=A;e:for(;X!==null;){switch(X.tag){case 5:un=X.stateNode,Mr=!1;break e;case 3:un=X.stateNode.containerInfo,Mr=!0;break e;case 4:un=X.stateNode.containerInfo,Mr=!0;break e}X=X.return}if(un===null)throw Error(n(160));Qb(_,A,v),un=null,Mr=!1;var ne=v.alternate;ne!==null&&(ne.return=null),v.return=null}catch(ue){Lt(v,o,ue)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)ek(o,s),o=o.sibling}function ek(s,o){var d=s.alternate,g=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(Ir(o,s),os(s),g&4){try{Il(3,s,s.return),Lu(3,s)}catch(Be){Lt(s,s.return,Be)}try{Il(5,s,s.return)}catch(Be){Lt(s,s.return,Be)}}break;case 1:Ir(o,s),os(s),g&512&&d!==null&&fi(d,d.return);break;case 5:if(Ir(o,s),os(s),g&512&&d!==null&&fi(d,d.return),s.flags&32){var v=s.stateNode;try{Ve(v,"")}catch(Be){Lt(s,s.return,Be)}}if(g&4&&(v=s.stateNode,v!=null)){var _=s.memoizedProps,A=d!==null?d.memoizedProps:_,X=s.type,ne=s.updateQueue;if(s.updateQueue=null,ne!==null)try{X==="input"&&_.type==="radio"&&_.name!=null&&He(v,_),xt(X,A);var ue=xt(X,_);for(A=0;A<ne.length;A+=2){var ve=ne[A],ke=ne[A+1];ve==="style"?rt(v,ke):ve==="dangerouslySetInnerHTML"?be(v,ke):ve==="children"?Ve(v,ke):E(v,ve,ke,ue)}switch(X){case"input":Ne(v,_);break;case"textarea":$e(v,_);break;case"select":var we=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!_.multiple;var Oe=_.value;Oe!=null?Ke(v,!!_.multiple,Oe,!1):we!==!!_.multiple&&(_.defaultValue!=null?Ke(v,!!_.multiple,_.defaultValue,!0):Ke(v,!!_.multiple,_.multiple?[]:"",!1))}v[Tr]=_}catch(Be){Lt(s,s.return,Be)}}break;case 6:if(Ir(o,s),os(s),g&4){if(s.stateNode===null)throw Error(n(162));v=s.stateNode,_=s.memoizedProps;try{v.nodeValue=_}catch(Be){Lt(s,s.return,Be)}}break;case 3:if(Ir(o,s),os(s),g&4&&d!==null&&d.memoizedState.isDehydrated)try{Gs(o.containerInfo)}catch(Be){Lt(s,s.return,Be)}break;case 4:Ir(o,s),os(s);break;case 13:Ir(o,s),os(s),v=s.child,v.flags&8192&&(_=v.memoizedState!==null,v.stateNode.isHidden=_,!_||v.alternate!==null&&v.alternate.memoizedState!==null||(Bf=kt())),g&4&&Jb(s);break;case 22:if(ve=d!==null&&d.memoizedState!==null,s.mode&1?(xn=(ue=xn)||ve,Ir(o,s),xn=ue):Ir(o,s),os(s),g&8192){if(ue=s.memoizedState!==null,(s.stateNode.isHidden=ue)&&!ve&&(s.mode&1)!==0)for(De=s,ve=s.child;ve!==null;){for(ke=De=ve;De!==null;){switch(we=De,Oe=we.child,we.tag){case 0:case 11:case 14:case 15:Il(4,we,we.return);break;case 1:fi(we,we.return);var Fe=we.stateNode;if(typeof Fe.componentWillUnmount=="function"){g=we,d=we.return;try{o=g,Fe.props=o.memoizedProps,Fe.state=o.memoizedState,Fe.componentWillUnmount()}catch(Be){Lt(g,d,Be)}}break;case 5:fi(we,we.return);break;case 22:if(we.memoizedState!==null){rk(ke);continue}}Oe!==null?(Oe.return=we,De=Oe):rk(ke)}ve=ve.sibling}e:for(ve=null,ke=s;;){if(ke.tag===5){if(ve===null){ve=ke;try{v=ke.stateNode,ue?(_=v.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(X=ke.stateNode,ne=ke.memoizedProps.style,A=ne!=null&&ne.hasOwnProperty("display")?ne.display:null,X.style.display=he("display",A))}catch(Be){Lt(s,s.return,Be)}}}else if(ke.tag===6){if(ve===null)try{ke.stateNode.nodeValue=ue?"":ke.memoizedProps}catch(Be){Lt(s,s.return,Be)}}else if((ke.tag!==22&&ke.tag!==23||ke.memoizedState===null||ke===s)&&ke.child!==null){ke.child.return=ke,ke=ke.child;continue}if(ke===s)break e;for(;ke.sibling===null;){if(ke.return===null||ke.return===s)break e;ve===ke&&(ve=null),ke=ke.return}ve===ke&&(ve=null),ke.sibling.return=ke.return,ke=ke.sibling}}break;case 19:Ir(o,s),os(s),g&4&&Jb(s);break;case 21:break;default:Ir(o,s),os(s)}}function os(s){var o=s.flags;if(o&2){try{e:{for(var d=s.return;d!==null;){if(Xb(d)){var g=d;break e}d=d.return}throw Error(n(160))}switch(g.tag){case 5:var v=g.stateNode;g.flags&32&&(Ve(v,""),g.flags&=-33);var _=Zb(s);Df(s,_,v);break;case 3:case 4:var A=g.stateNode.containerInfo,X=Zb(s);Pf(s,X,A);break;default:throw Error(n(161))}}catch(ne){Lt(s,s.return,ne)}s.flags&=-3}o&4096&&(s.flags&=-4097)}function mI(s,o,d){De=s,tk(s)}function tk(s,o,d){for(var g=(s.mode&1)!==0;De!==null;){var v=De,_=v.child;if(v.tag===22&&g){var A=v.memoizedState!==null||Ou;if(!A){var X=v.alternate,ne=X!==null&&X.memoizedState!==null||xn;X=Ou;var ue=xn;if(Ou=A,(xn=ne)&&!ue)for(De=v;De!==null;)A=De,ne=A.child,A.tag===22&&A.memoizedState!==null?sk(v):ne!==null?(ne.return=A,De=ne):sk(v);for(;_!==null;)De=_,tk(_),_=_.sibling;De=v,Ou=X,xn=ue}nk(s)}else(v.subtreeFlags&8772)!==0&&_!==null?(_.return=v,De=_):nk(s)}}function nk(s){for(;De!==null;){var o=De;if((o.flags&8772)!==0){var d=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:xn||Lu(5,o);break;case 1:var g=o.stateNode;if(o.flags&4&&!xn)if(d===null)g.componentDidMount();else{var v=o.elementType===o.type?d.memoizedProps:Rr(o.type,d.memoizedProps);g.componentDidUpdate(v,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var _=o.updateQueue;_!==null&&rb(o,_,g);break;case 3:var A=o.updateQueue;if(A!==null){if(d=null,o.child!==null)switch(o.child.tag){case 5:d=o.child.stateNode;break;case 1:d=o.child.stateNode}rb(o,A,d)}break;case 5:var X=o.stateNode;if(d===null&&o.flags&4){d=X;var ne=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ne.autoFocus&&d.focus();break;case"img":ne.src&&(d.src=ne.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var ue=o.alternate;if(ue!==null){var ve=ue.memoizedState;if(ve!==null){var ke=ve.dehydrated;ke!==null&&Gs(ke)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}xn||o.flags&512&&Lf(o)}catch(we){Lt(o,o.return,we)}}if(o===s){De=null;break}if(d=o.sibling,d!==null){d.return=o.return,De=d;break}De=o.return}}function rk(s){for(;De!==null;){var o=De;if(o===s){De=null;break}var d=o.sibling;if(d!==null){d.return=o.return,De=d;break}De=o.return}}function sk(s){for(;De!==null;){var o=De;try{switch(o.tag){case 0:case 11:case 15:var d=o.return;try{Lu(4,o)}catch(ne){Lt(o,d,ne)}break;case 1:var g=o.stateNode;if(typeof g.componentDidMount=="function"){var v=o.return;try{g.componentDidMount()}catch(ne){Lt(o,v,ne)}}var _=o.return;try{Lf(o)}catch(ne){Lt(o,_,ne)}break;case 5:var A=o.return;try{Lf(o)}catch(ne){Lt(o,A,ne)}}}catch(ne){Lt(o,o.return,ne)}if(o===s){De=null;break}var X=o.sibling;if(X!==null){X.return=o.return,De=X;break}De=o.return}}var gI=Math.ceil,Pu=C.ReactCurrentDispatcher,qf=C.ReactCurrentOwner,lr=C.ReactCurrentBatchConfig,mt=0,en=null,Ht=null,dn=0,Xn=0,pi=ea(0),Gt=0,$l=null,io=0,Du=0,Ff=0,Ol=null,qn=null,Bf=0,mi=1/0,As=null,qu=!1,zf=null,oa=null,Fu=!1,ia=null,Bu=0,Ll=0,Hf=null,zu=-1,Hu=0;function En(){return(mt&6)!==0?kt():zu!==-1?zu:zu=kt()}function la(s){return(s.mode&1)===0?1:(mt&2)!==0&&dn!==0?dn&-dn:JM.transition!==null?(Hu===0&&(Hu=$c()),Hu):(s=st,s!==0||(s=window.event,s=s===void 0?16:Ks(s.type)),s)}function $r(s,o,d,g){if(50<Ll)throw Ll=0,Hf=null,Error(n(185));xr(s,d,g),((mt&2)===0||s!==en)&&(s===en&&((mt&2)===0&&(Du|=d),Gt===4&&ca(s,dn)),Fn(s,g),d===1&&mt===0&&(o.mode&1)===0&&(mi=kt()+500,yu&&na()))}function Fn(s,o){var d=s.callbackNode;Ic(s,o);var g=Gr(s,s===en?dn:0);if(g===0)d!==null&&$t(d),s.callbackNode=null,s.callbackPriority=0;else if(o=g&-g,s.callbackPriority!==o){if(d!=null&&$t(d),o===1)s.tag===0?QM(ok.bind(null,s)):W0(ok.bind(null,s)),ti(function(){(mt&6)===0&&na()}),d=null;else{switch(Aa(g)){case 1:d=ps;break;case 4:d=Ea;break;case 16:d=Vr;break;case 536870912:d=Mo;break;default:d=Vr}d=pk(d,ak.bind(null,s))}s.callbackPriority=o,s.callbackNode=d}}function ak(s,o){if(zu=-1,Hu=0,(mt&6)!==0)throw Error(n(327));var d=s.callbackNode;if(gi()&&s.callbackNode!==d)return null;var g=Gr(s,s===en?dn:0);if(g===0)return null;if((g&30)!==0||(g&s.expiredLanes)!==0||o)o=Uu(s,g);else{o=g;var v=mt;mt|=2;var _=lk();(en!==s||dn!==o)&&(As=null,mi=kt()+500,co(s,o));do try{vI();break}catch(X){ik(s,X)}while(!0);of(),Pu.current=_,mt=v,Ht!==null?o=0:(en=null,dn=0,o=Gt)}if(o!==0){if(o===2&&(v=$o(s),v!==0&&(g=v,o=Uf(s,v))),o===1)throw d=$l,co(s,0),ca(s,g),Fn(s,kt()),d;if(o===6)ca(s,g);else{if(v=s.current.alternate,(g&30)===0&&!yI(v)&&(o=Uu(s,g),o===2&&(_=$o(s),_!==0&&(g=_,o=Uf(s,_))),o===1))throw d=$l,co(s,0),ca(s,g),Fn(s,kt()),d;switch(s.finishedWork=v,s.finishedLanes=g,o){case 0:case 1:throw Error(n(345));case 2:uo(s,qn,As);break;case 3:if(ca(s,g),(g&130023424)===g&&(o=Bf+500-kt(),10<o)){if(Gr(s,0)!==0)break;if(v=s.suspendedLanes,(v&g)!==g){En(),s.pingedLanes|=s.suspendedLanes&v;break}s.timeoutHandle=vt(uo.bind(null,s,qn,As),o);break}uo(s,qn,As);break;case 4:if(ca(s,g),(g&4194240)===g)break;for(o=s.eventTimes,v=-1;0<g;){var A=31-$n(g);_=1<<A,A=o[A],A>v&&(v=A),g&=~_}if(g=v,g=kt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*gI(g/1960))-g,10<g){s.timeoutHandle=vt(uo.bind(null,s,qn,As),g);break}uo(s,qn,As);break;case 5:uo(s,qn,As);break;default:throw Error(n(329))}}}return Fn(s,kt()),s.callbackNode===d?ak.bind(null,s):null}function Uf(s,o){var d=Ol;return s.current.memoizedState.isDehydrated&&(co(s,o).flags|=256),s=Uu(s,o),s!==2&&(o=qn,qn=d,o!==null&&Wf(o)),s}function Wf(s){qn===null?qn=s:qn.push.apply(qn,s)}function yI(s){for(var o=s;;){if(o.flags&16384){var d=o.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var g=0;g<d.length;g++){var v=d[g],_=v.getSnapshot;v=v.value;try{if(!Vn(_(),v))return!1}catch{return!1}}}if(d=o.child,o.subtreeFlags&16384&&d!==null)d.return=o,o=d;else{if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function ca(s,o){for(o&=~Ff,o&=~Du,s.suspendedLanes|=o,s.pingedLanes&=~o,s=s.expirationTimes;0<o;){var d=31-$n(o),g=1<<d;s[d]=-1,o&=~g}}function ok(s){if((mt&6)!==0)throw Error(n(327));gi();var o=Gr(s,0);if((o&1)===0)return Fn(s,kt()),null;var d=Uu(s,o);if(s.tag!==0&&d===2){var g=$o(s);g!==0&&(o=g,d=Uf(s,g))}if(d===1)throw d=$l,co(s,0),ca(s,o),Fn(s,kt()),d;if(d===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=o,uo(s,qn,As),Fn(s,kt()),null}function Vf(s,o){var d=mt;mt|=1;try{return s(o)}finally{mt=d,mt===0&&(mi=kt()+500,yu&&na())}}function lo(s){ia!==null&&ia.tag===0&&(mt&6)===0&&gi();var o=mt;mt|=1;var d=lr.transition,g=st;try{if(lr.transition=null,st=1,s)return s()}finally{st=g,lr.transition=d,mt=o,(mt&6)===0&&na()}}function Gf(){Xn=pi.current,Et(pi)}function co(s,o){s.finishedWork=null,s.finishedLanes=0;var d=s.timeoutHandle;if(d!==-1&&(s.timeoutHandle=-1,tt(d)),Ht!==null)for(d=Ht.return;d!==null;){var g=d;switch(tf(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&mu();break;case 3:di(),Et(Ln),Et(yn),mf();break;case 5:ff(g);break;case 4:di();break;case 13:Et(Mt);break;case 19:Et(Mt);break;case 10:lf(g.type._context);break;case 22:case 23:Gf()}d=d.return}if(en=s,Ht=s=ua(s.current,null),dn=Xn=o,Gt=0,$l=null,Ff=Du=io=0,qn=Ol=null,so!==null){for(o=0;o<so.length;o++)if(d=so[o],g=d.interleaved,g!==null){d.interleaved=null;var v=g.next,_=d.pending;if(_!==null){var A=_.next;_.next=v,g.next=A}d.pending=g}so=null}return s}function ik(s,o){do{var d=Ht;try{if(of(),Eu.current=Ru,Cu){for(var g=It.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}Cu=!1}if(oo=0,Jt=Vt=It=null,Cl=!1,Tl=0,qf.current=null,d===null||d.return===null){Gt=1,$l=o,Ht=null;break}e:{var _=s,A=d.return,X=d,ne=o;if(o=dn,X.flags|=32768,ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var ue=ne,ve=X,ke=ve.tag;if((ve.mode&1)===0&&(ke===0||ke===11||ke===15)){var we=ve.alternate;we?(ve.updateQueue=we.updateQueue,ve.memoizedState=we.memoizedState,ve.lanes=we.lanes):(ve.updateQueue=null,ve.memoizedState=null)}var Oe=Mb(A);if(Oe!==null){Oe.flags&=-257,Ib(Oe,A,X,_,o),Oe.mode&1&&Rb(_,ue,o),o=Oe,ne=ue;var Fe=o.updateQueue;if(Fe===null){var Be=new Set;Be.add(ne),o.updateQueue=Be}else Fe.add(ne);break e}else{if((o&1)===0){Rb(_,ue,o),Kf();break e}ne=Error(n(426))}}else if(Tt&&X.mode&1){var Bt=Mb(A);if(Bt!==null){(Bt.flags&65536)===0&&(Bt.flags|=256),Ib(Bt,A,X,_,o),sf(hi(ne,X));break e}}_=ne=hi(ne,X),Gt!==4&&(Gt=2),Ol===null?Ol=[_]:Ol.push(_),_=A;do{switch(_.tag){case 3:_.flags|=65536,o&=-o,_.lanes|=o;var oe=Tb(_,ne,o);nb(_,oe);break e;case 1:X=ne;var re=_.type,ie=_.stateNode;if((_.flags&128)===0&&(typeof re.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(oa===null||!oa.has(ie)))){_.flags|=65536,o&=-o,_.lanes|=o;var Ee=Ab(_,X,o);nb(_,Ee);break e}}_=_.return}while(_!==null)}uk(d)}catch(ze){o=ze,Ht===d&&d!==null&&(Ht=d=d.return);continue}break}while(!0)}function lk(){var s=Pu.current;return Pu.current=Ru,s===null?Ru:s}function Kf(){(Gt===0||Gt===3||Gt===2)&&(Gt=4),en===null||(io&268435455)===0&&(Du&268435455)===0||ca(en,dn)}function Uu(s,o){var d=mt;mt|=2;var g=lk();(en!==s||dn!==o)&&(As=null,co(s,o));do try{wI();break}catch(v){ik(s,v)}while(!0);if(of(),mt=d,Pu.current=g,Ht!==null)throw Error(n(261));return en=null,dn=0,Gt}function wI(){for(;Ht!==null;)ck(Ht)}function vI(){for(;Ht!==null&&!Wr();)ck(Ht)}function ck(s){var o=fk(s.alternate,s,Xn);s.memoizedProps=s.pendingProps,o===null?uk(s):Ht=o,qf.current=null}function uk(s){var o=s;do{var d=o.alternate;if(s=o.return,(o.flags&32768)===0){if(d=dI(d,o,Xn),d!==null){Ht=d;return}}else{if(d=hI(d,o),d!==null){d.flags&=32767,Ht=d;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Gt=6,Ht=null;return}}if(o=o.sibling,o!==null){Ht=o;return}Ht=o=s}while(o!==null);Gt===0&&(Gt=5)}function uo(s,o,d){var g=st,v=lr.transition;try{lr.transition=null,st=1,xI(s,o,d,g)}finally{lr.transition=v,st=g}return null}function xI(s,o,d,g){do gi();while(ia!==null);if((mt&6)!==0)throw Error(n(327));d=s.finishedWork;var v=s.finishedLanes;if(d===null)return null;if(s.finishedWork=null,s.finishedLanes=0,d===s.current)throw Error(n(177));s.callbackNode=null,s.callbackPriority=0;var _=d.lanes|d.childLanes;if(Vh(s,_),s===en&&(Ht=en=null,dn=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Fu||(Fu=!0,pk(Vr,function(){return gi(),null})),_=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||_){_=lr.transition,lr.transition=null;var A=st;st=1;var X=mt;mt|=4,qf.current=null,pI(s,d),ek(d,s),pl(Ge),vs=!!Se,Ge=Se=null,s.current=d,mI(d),bt(),mt=X,st=A,lr.transition=_}else s.current=d;if(Fu&&(Fu=!1,ia=s,Bu=v),_=s.pendingLanes,_===0&&(oa=null),gs(d.stateNode),Fn(s,kt()),o!==null)for(g=s.onRecoverableError,d=0;d<o.length;d++)v=o[d],g(v.value,{componentStack:v.stack,digest:v.digest});if(qu)throw qu=!1,s=zf,zf=null,s;return(Bu&1)!==0&&s.tag!==0&&gi(),_=s.pendingLanes,(_&1)!==0?s===Hf?Ll++:(Ll=0,Hf=s):Ll=0,na(),null}function gi(){if(ia!==null){var s=Aa(Bu),o=lr.transition,d=st;try{if(lr.transition=null,st=16>s?16:s,ia===null)var g=!1;else{if(s=ia,ia=null,Bu=0,(mt&6)!==0)throw Error(n(331));var v=mt;for(mt|=4,De=s.current;De!==null;){var _=De,A=_.child;if((De.flags&16)!==0){var X=_.deletions;if(X!==null){for(var ne=0;ne<X.length;ne++){var ue=X[ne];for(De=ue;De!==null;){var ve=De;switch(ve.tag){case 0:case 11:case 15:Il(8,ve,_)}var ke=ve.child;if(ke!==null)ke.return=ve,De=ke;else for(;De!==null;){ve=De;var we=ve.sibling,Oe=ve.return;if(Yb(ve),ve===ue){De=null;break}if(we!==null){we.return=Oe,De=we;break}De=Oe}}}var Fe=_.alternate;if(Fe!==null){var Be=Fe.child;if(Be!==null){Fe.child=null;do{var Bt=Be.sibling;Be.sibling=null,Be=Bt}while(Be!==null)}}De=_}}if((_.subtreeFlags&2064)!==0&&A!==null)A.return=_,De=A;else e:for(;De!==null;){if(_=De,(_.flags&2048)!==0)switch(_.tag){case 0:case 11:case 15:Il(9,_,_.return)}var oe=_.sibling;if(oe!==null){oe.return=_.return,De=oe;break e}De=_.return}}var re=s.current;for(De=re;De!==null;){A=De;var ie=A.child;if((A.subtreeFlags&2064)!==0&&ie!==null)ie.return=A,De=ie;else e:for(A=re;De!==null;){if(X=De,(X.flags&2048)!==0)try{switch(X.tag){case 0:case 11:case 15:Lu(9,X)}}catch(ze){Lt(X,X.return,ze)}if(X===A){De=null;break e}var Ee=X.sibling;if(Ee!==null){Ee.return=X.return,De=Ee;break e}De=X.return}}if(mt=v,na(),In&&typeof In.onPostCommitFiberRoot=="function")try{In.onPostCommitFiberRoot(ms,s)}catch{}g=!0}return g}finally{st=d,lr.transition=o}}return!1}function dk(s,o,d){o=hi(d,o),o=Tb(s,o,1),s=sa(s,o,1),o=En(),s!==null&&(xr(s,1,o),Fn(s,o))}function Lt(s,o,d){if(s.tag===3)dk(s,s,d);else for(;o!==null;){if(o.tag===3){dk(o,s,d);break}else if(o.tag===1){var g=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(oa===null||!oa.has(g))){s=hi(d,s),s=Ab(o,s,1),o=sa(o,s,1),s=En(),o!==null&&(xr(o,1,s),Fn(o,s));break}}o=o.return}}function bI(s,o,d){var g=s.pingCache;g!==null&&g.delete(o),o=En(),s.pingedLanes|=s.suspendedLanes&d,en===s&&(dn&d)===d&&(Gt===4||Gt===3&&(dn&130023424)===dn&&500>kt()-Bf?co(s,0):Ff|=d),Fn(s,o)}function hk(s,o){o===0&&((s.mode&1)===0?o=1:(o=Ta,Ta<<=1,(Ta&130023424)===0&&(Ta=4194304)));var d=En();s=Es(s,o),s!==null&&(xr(s,o,d),Fn(s,d))}function kI(s){var o=s.memoizedState,d=0;o!==null&&(d=o.retryLane),hk(s,d)}function _I(s,o){var d=0;switch(s.tag){case 13:var g=s.stateNode,v=s.memoizedState;v!==null&&(d=v.retryLane);break;case 19:g=s.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(o),hk(s,d)}var fk;fk=function(s,o,d){if(s!==null)if(s.memoizedProps!==o.pendingProps||Ln.current)Dn=!0;else{if((s.lanes&d)===0&&(o.flags&128)===0)return Dn=!1,uI(s,o,d);Dn=(s.flags&131072)!==0}else Dn=!1,Tt&&(o.flags&1048576)!==0&&V0(o,vu,o.index);switch(o.lanes=0,o.tag){case 2:var g=o.type;$u(s,o),s=o.pendingProps;var v=si(o,yn.current);ui(o,d),v=wf(null,o,g,s,v,d);var _=vf();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Pn(g)?(_=!0,gu(o)):_=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,df(o),v.updater=Mu,o.stateNode=v,v._reactInternals=o,Sf(o,g,s,d),o=Tf(null,o,g,!0,_,d)):(o.tag=0,Tt&&_&&ef(o),jn(null,o,v,d),o=o.child),o;case 16:g=o.elementType;e:{switch($u(s,o),s=o.pendingProps,v=g._init,g=v(g._payload),o.type=g,v=o.tag=SI(g),s=Rr(g,s),v){case 0:o=Cf(null,o,g,s,d);break e;case 1:o=qb(null,o,g,s,d);break e;case 11:o=$b(null,o,g,s,d);break e;case 14:o=Ob(null,o,g,Rr(g.type,s),d);break e}throw Error(n(306,g,""))}return o;case 0:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:Rr(g,v),Cf(s,o,g,v,d);case 1:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:Rr(g,v),qb(s,o,g,v,d);case 3:e:{if(Fb(o),s===null)throw Error(n(387));g=o.pendingProps,_=o.memoizedState,v=_.element,tb(s,o),Su(o,g,null,d);var A=o.memoizedState;if(g=A.element,_.isDehydrated)if(_={element:g,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},o.updateQueue.baseState=_,o.memoizedState=_,o.flags&256){v=hi(Error(n(423)),o),o=Bb(s,o,g,d,v);break e}else if(g!==v){v=hi(Error(n(424)),o),o=Bb(s,o,g,d,v);break e}else for(Yn=Cr(o.stateNode.containerInfo.firstChild),Kn=o,Tt=!0,Ar=null,d=J0(o,null,g,d),o.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(ii(),g===v){o=Ts(s,o,d);break e}jn(s,o,g,d)}o=o.child}return o;case 5:return sb(o),s===null&&rf(o),g=o.type,v=o.pendingProps,_=s!==null?s.memoizedProps:null,A=v.children,lt(g,v)?A=null:_!==null&&lt(g,_)&&(o.flags|=32),Db(s,o),jn(s,o,A,d),o.child;case 6:return s===null&&rf(o),null;case 13:return zb(s,o,d);case 4:return hf(o,o.stateNode.containerInfo),g=o.pendingProps,s===null?o.child=li(o,null,g,d):jn(s,o,g,d),o.child;case 11:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:Rr(g,v),$b(s,o,g,v,d);case 7:return jn(s,o,o.pendingProps,d),o.child;case 8:return jn(s,o,o.pendingProps.children,d),o.child;case 12:return jn(s,o,o.pendingProps.children,d),o.child;case 10:e:{if(g=o.type._context,v=o.pendingProps,_=o.memoizedProps,A=v.value,St(ku,g._currentValue),g._currentValue=A,_!==null)if(Vn(_.value,A)){if(_.children===v.children&&!Ln.current){o=Ts(s,o,d);break e}}else for(_=o.child,_!==null&&(_.return=o);_!==null;){var X=_.dependencies;if(X!==null){A=_.child;for(var ne=X.firstContext;ne!==null;){if(ne.context===g){if(_.tag===1){ne=Cs(-1,d&-d),ne.tag=2;var ue=_.updateQueue;if(ue!==null){ue=ue.shared;var ve=ue.pending;ve===null?ne.next=ne:(ne.next=ve.next,ve.next=ne),ue.pending=ne}}_.lanes|=d,ne=_.alternate,ne!==null&&(ne.lanes|=d),cf(_.return,d,o),X.lanes|=d;break}ne=ne.next}}else if(_.tag===10)A=_.type===o.type?null:_.child;else if(_.tag===18){if(A=_.return,A===null)throw Error(n(341));A.lanes|=d,X=A.alternate,X!==null&&(X.lanes|=d),cf(A,d,o),A=_.sibling}else A=_.child;if(A!==null)A.return=_;else for(A=_;A!==null;){if(A===o){A=null;break}if(_=A.sibling,_!==null){_.return=A.return,A=_;break}A=A.return}_=A}jn(s,o,v.children,d),o=o.child}return o;case 9:return v=o.type,g=o.pendingProps.children,ui(o,d),v=or(v),g=g(v),o.flags|=1,jn(s,o,g,d),o.child;case 14:return g=o.type,v=Rr(g,o.pendingProps),v=Rr(g.type,v),Ob(s,o,g,v,d);case 15:return Lb(s,o,o.type,o.pendingProps,d);case 17:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:Rr(g,v),$u(s,o),o.tag=1,Pn(g)?(s=!0,gu(o)):s=!1,ui(o,d),Eb(o,g,v),Sf(o,g,v,d),Tf(null,o,g,!0,s,d);case 19:return Ub(s,o,d);case 22:return Pb(s,o,d)}throw Error(n(156,o.tag))};function pk(s,o){return Ct(s,o)}function NI(s,o,d,g){this.tag=s,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function cr(s,o,d,g){return new NI(s,o,d,g)}function Yf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function SI(s){if(typeof s=="function")return Yf(s)?1:0;if(s!=null){if(s=s.$$typeof,s===J)return 11;if(s===Z)return 14}return 2}function ua(s,o){var d=s.alternate;return d===null?(d=cr(s.tag,o,s.key,s.mode),d.elementType=s.elementType,d.type=s.type,d.stateNode=s.stateNode,d.alternate=s,s.alternate=d):(d.pendingProps=o,d.type=s.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=s.flags&14680064,d.childLanes=s.childLanes,d.lanes=s.lanes,d.child=s.child,d.memoizedProps=s.memoizedProps,d.memoizedState=s.memoizedState,d.updateQueue=s.updateQueue,o=s.dependencies,d.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},d.sibling=s.sibling,d.index=s.index,d.ref=s.ref,d}function Wu(s,o,d,g,v,_){var A=2;if(g=s,typeof s=="function")Yf(s)&&(A=1);else if(typeof s=="string")A=5;else e:switch(s){case $:return ho(d.children,v,_,o);case D:A=8,v|=8;break;case U:return s=cr(12,d,o,v|2),s.elementType=U,s.lanes=_,s;case ee:return s=cr(13,d,o,v),s.elementType=ee,s.lanes=_,s;case M:return s=cr(19,d,o,v),s.elementType=M,s.lanes=_,s;case I:return Vu(d,v,_,o);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case P:A=10;break e;case V:A=9;break e;case J:A=11;break e;case Z:A=14;break e;case G:A=16,g=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return o=cr(A,d,o,v),o.elementType=s,o.type=g,o.lanes=_,o}function ho(s,o,d,g){return s=cr(7,s,g,o),s.lanes=d,s}function Vu(s,o,d,g){return s=cr(22,s,g,o),s.elementType=I,s.lanes=d,s.stateNode={isHidden:!1},s}function Xf(s,o,d){return s=cr(6,s,null,o),s.lanes=d,s}function Zf(s,o,d){return o=cr(4,s.children!==null?s.children:[],s.key,o),o.lanes=d,o.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},o}function jI(s,o,d,g,v){this.tag=o,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Oo(0),this.expirationTimes=Oo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Oo(0),this.identifierPrefix=g,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Qf(s,o,d,g,v,_,A,X,ne){return s=new jI(s,o,d,X,ne),o===1?(o=1,_===!0&&(o|=8)):o=0,_=cr(3,null,null,o),s.current=_,_.stateNode=s,_.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},df(_),s}function EI(s,o,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:g==null?null:""+g,children:s,containerInfo:o,implementation:d}}function mk(s){if(!s)return ta;s=s._reactInternals;e:{if(Q(s)!==s||s.tag!==1)throw Error(n(170));var o=s;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(Pn(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(s.tag===1){var d=s.type;if(Pn(d))return H0(s,d,o)}return o}function gk(s,o,d,g,v,_,A,X,ne){return s=Qf(d,g,!0,s,v,_,A,X,ne),s.context=mk(null),d=s.current,g=En(),v=la(d),_=Cs(g,v),_.callback=o??null,sa(d,_,v),s.current.lanes=v,xr(s,v,g),Fn(s,g),s}function Gu(s,o,d,g){var v=o.current,_=En(),A=la(v);return d=mk(d),o.context===null?o.context=d:o.pendingContext=d,o=Cs(_,A),o.payload={element:s},g=g===void 0?null:g,g!==null&&(o.callback=g),s=sa(v,o,A),s!==null&&($r(s,v,A,_),Nu(s,v,A)),A}function Ku(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function yk(s,o){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var d=s.retryLane;s.retryLane=d!==0&&d<o?d:o}}function Jf(s,o){yk(s,o),(s=s.alternate)&&yk(s,o)}function CI(){return null}var wk=typeof reportError=="function"?reportError:function(s){console.error(s)};function ep(s){this._internalRoot=s}Yu.prototype.render=ep.prototype.render=function(s){var o=this._internalRoot;if(o===null)throw Error(n(409));Gu(s,o,null,null)},Yu.prototype.unmount=ep.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var o=s.containerInfo;lo(function(){Gu(null,s,null,null)}),o[Sn]=null}};function Yu(s){this._internalRoot=s}Yu.prototype.unstable_scheduleHydration=function(s){if(s){var o=Lc();s={blockedOn:null,target:s,priority:o};for(var d=0;d<kr.length&&o!==0&&o<kr[d].priority;d++);kr.splice(d,0,s),d===0&&Oa(s)}};function tp(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function Xu(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function vk(){}function TI(s,o,d,g,v){if(v){if(typeof g=="function"){var _=g;g=function(){var ue=Ku(A);_.call(ue)}}var A=gk(o,g,s,0,null,!1,!1,"",vk);return s._reactRootContainer=A,s[Sn]=A.current,bs(s.nodeType===8?s.parentNode:s),lo(),A}for(;v=s.lastChild;)s.removeChild(v);if(typeof g=="function"){var X=g;g=function(){var ue=Ku(ne);X.call(ue)}}var ne=Qf(s,0,!1,null,null,!1,!1,"",vk);return s._reactRootContainer=ne,s[Sn]=ne.current,bs(s.nodeType===8?s.parentNode:s),lo(function(){Gu(o,ne,d,g)}),ne}function Zu(s,o,d,g,v){var _=d._reactRootContainer;if(_){var A=_;if(typeof v=="function"){var X=v;v=function(){var ne=Ku(A);X.call(ne)}}Gu(o,A,s,v)}else A=TI(d,o,s,v,g);return Ku(A)}Oc=function(s){switch(s.tag){case 3:var o=s.stateNode;if(o.current.memoizedState.isDehydrated){var d=zs(o.pendingLanes);d!==0&&(Lo(o,d|1),Fn(o,kt()),(mt&6)===0&&(mi=kt()+500,na()))}break;case 13:lo(function(){var g=Es(s,1);if(g!==null){var v=En();$r(g,s,1,v)}}),Jf(s,1)}},Ra=function(s){if(s.tag===13){var o=Es(s,134217728);if(o!==null){var d=En();$r(o,s,134217728,d)}Jf(s,134217728)}},zt=function(s){if(s.tag===13){var o=la(s),d=Es(s,o);if(d!==null){var g=En();$r(d,s,o,g)}Jf(s,o)}},Lc=function(){return st},br=function(s,o){var d=st;try{return st=s,o()}finally{st=d}},Zt=function(s,o,d){switch(o){case"input":if(Ne(s,d),o=d.name,d.type==="radio"&&o!=null){for(d=s;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<d.length;o++){var g=d[o];if(g!==s&&g.form===s.form){var v=pu(g);if(!v)throw Error(n(90));Te(g),Ne(g,v)}}}break;case"textarea":$e(s,d);break;case"select":o=d.value,o!=null&&Ke(s,!!d.multiple,o,!1)}},an=Vf,Dt=lo;var AI={usingClientEntryPoint:!1,Events:[_l,ni,pu,Qe,sn,Vf]},Pl={findFiberByHostInstance:eo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},RI={bundleType:Pl.bundleType,version:Pl.version,rendererPackageName:Pl.rendererPackageName,rendererConfig:Pl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=Pe(s),s===null?null:s.stateNode},findFiberByHostInstance:Pl.findFiberByHostInstance||CI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qu.isDisabled&&Qu.supportsFiber)try{ms=Qu.inject(RI),In=Qu}catch{}}return Bn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=AI,Bn.createPortal=function(s,o){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!tp(o))throw Error(n(200));return EI(s,o,null,d)},Bn.createRoot=function(s,o){if(!tp(s))throw Error(n(299));var d=!1,g="",v=wk;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(g=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Qf(s,1,!1,null,null,d,!1,g,v),s[Sn]=o.current,bs(s.nodeType===8?s.parentNode:s),new ep(o)},Bn.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var o=s._reactInternals;if(o===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=Pe(o),s=s===null?null:s.stateNode,s},Bn.flushSync=function(s){return lo(s)},Bn.hydrate=function(s,o,d){if(!Xu(o))throw Error(n(200));return Zu(null,s,o,!0,d)},Bn.hydrateRoot=function(s,o,d){if(!tp(s))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,v=!1,_="",A=wk;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(_=d.identifierPrefix),d.onRecoverableError!==void 0&&(A=d.onRecoverableError)),o=gk(o,null,s,1,d??null,v,!1,_,A),s[Sn]=o.current,bs(s),g)for(s=0;s<g.length;s++)d=g[s],v=d._getVersion,v=v(d._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[d,v]:o.mutableSourceEagerHydrationData.push(d,v);return new Yu(o)},Bn.render=function(s,o,d){if(!Xu(o))throw Error(n(200));return Zu(null,s,o,!1,d)},Bn.unmountComponentAtNode=function(s){if(!Xu(s))throw Error(n(40));return s._reactRootContainer?(lo(function(){Zu(null,null,s,!1,function(){s._reactRootContainer=null,s[Sn]=null})}),!0):!1},Bn.unstable_batchedUpdates=Vf,Bn.unstable_renderSubtreeIntoContainer=function(s,o,d,g){if(!Xu(d))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return Zu(s,o,d,!1,g)},Bn.version="18.3.1-next-f1338f8080-20240426",Bn}var Ek;function WT(){if(Ek)return sp.exports;Ek=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),sp.exports=DI(),sp.exports}var Ck;function qI(){if(Ck)return ed;Ck=1;var e=WT();return ed.createRoot=e.createRoot,ed.hydrateRoot=e.hydrateRoot,ed}var FI=qI();const BI="modulepreload",zI=function(e){return"/"+e},Tk={},VT=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let c=function(p){return Promise.all(p.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(p=>{if(p=zI(p),p in Tk)return;Tk[p]=!0;const h=p.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":BI,h||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),h)return new Promise((w,N)=>{y.addEventListener("load",w),y.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&l(u.reason);return t().catch(l)})};var x=wc();const fe=Dx(x);function fn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=fn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var ip={exports:{}},lp={},cp={exports:{}},up={};/**
41
- * @license React
42
- * use-sync-external-store-shim.production.js
43
- *
44
- * Copyright (c) Meta Platforms, Inc. and affiliates.
45
- *
46
- * This source code is licensed under the MIT license found in the
47
- * LICENSE file in the root directory of this source tree.
48
- */var Ak;function HI(){if(Ak)return up;Ak=1;var e=wc();function t(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,l=e.useLayoutEffect,c=e.useDebugValue;function u(m,y){var w=y(),N=r({inst:{value:w,getSnapshot:y}}),k=N[0].inst,S=N[1];return l(function(){k.value=w,k.getSnapshot=y,f(k)&&S({inst:k})},[m,w,y]),a(function(){return f(k)&&S({inst:k}),m(function(){f(k)&&S({inst:k})})},[m]),c(w),w}function f(m){var y=m.getSnapshot;m=m.value;try{var w=y();return!n(m,w)}catch{return!0}}function p(m,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return up.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,up}var Rk;function UI(){return Rk||(Rk=1,cp.exports=HI()),cp.exports}/**
49
- * @license React
50
- * use-sync-external-store-shim/with-selector.production.js
51
- *
52
- * Copyright (c) Meta Platforms, Inc. and affiliates.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE file in the root directory of this source tree.
56
- */var Mk;function WI(){if(Mk)return lp;Mk=1;var e=wc(),t=UI();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return lp.useSyncExternalStoreWithSelector=function(p,h,m,y,w){var N=l(null);if(N.current===null){var k={hasValue:!1,value:null};N.current=k}else k=N.current;N=u(function(){function b(R){if(!j){if(j=!0,E=R,R=y(R),w!==void 0&&k.hasValue){var $=k.value;if(w($,R))return C=$}return C=R}if($=C,r(E,R))return $;var D=y(R);return w!==void 0&&w($,D)?(E=R,$):(E=R,C=D)}var j=!1,E,C,T=m===void 0?null:m;return[function(){return b(h())},T===null?void 0:function(){return b(T())}]},[h,m,y,w]);var S=a(p,N[0],N[1]);return c(function(){k.hasValue=!0,k.value=S},[S]),f(S),S},lp}var Ik;function VI(){return Ik||(Ik=1,ip.exports=WI()),ip.exports}var GI=VI();const KI=Dx(GI),YI={},$k=e=>{let t;const n=new Set,r=(h,m)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const w=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,w))}},a=()=>t,f={setState:r,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(YI?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(r,a,f);return f},XI=e=>e?$k(e):$k,{useDebugValue:ZI}=fe,{useSyncExternalStoreWithSelector:QI}=KI,JI=e=>e;function GT(e,t=JI,n){const r=QI(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ZI(r),r}const Ok=(e,t)=>{const n=XI(e),r=(a,l=t)=>GT(n,a,l);return Object.assign(r,n),r},e$=(e,t)=>e?Ok(e,t):Ok;function Xt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var t$={value:()=>{}};function ch(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new jd(n)}function jd(e){this._=e}function n$(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}jd.prototype=ch.prototype={constructor:jd,on:function(e,t){var n=this._,r=n$(e+"",n),a,l=-1,c=r.length;if(arguments.length<2){for(;++l<c;)if((a=(e=r[l]).type)&&(a=r$(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<c;)if(a=(e=r[l]).type)n[a]=Lk(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Lk(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new jd(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),r=0,a,l;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],r=0,a=l.length;r<a;++r)l[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,l=r.length;a<l;++a)r[a].value.apply(t,n)}};function r$(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function Lk(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=t$,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var sx="http://www.w3.org/1999/xhtml";const Pk={svg:"http://www.w3.org/2000/svg",xhtml:sx,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function uh(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Pk.hasOwnProperty(t)?{space:Pk[t],local:e}:e}function s$(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===sx&&t.documentElement.namespaceURI===sx?t.createElement(e):t.createElementNS(n,e)}}function a$(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function KT(e){var t=uh(e);return(t.local?a$:s$)(t)}function o$(){}function qx(e){return e==null?o$:function(){return this.querySelector(e)}}function i$(e){typeof e!="function"&&(e=qx(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,u=r[a]=new Array(c),f,p,h=0;h<c;++h)(f=l[h])&&(p=e.call(f,f.__data__,h,l))&&("__data__"in f&&(p.__data__=f.__data__),u[h]=p);return new er(r,this._parents)}function l$(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function c$(){return[]}function YT(e){return e==null?c$:function(){return this.querySelectorAll(e)}}function u$(e){return function(){return l$(e.apply(this,arguments))}}function d$(e){typeof e=="function"?e=u$(e):e=YT(e);for(var t=this._groups,n=t.length,r=[],a=[],l=0;l<n;++l)for(var c=t[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&(r.push(e.call(f,f.__data__,p,c)),a.push(f));return new er(r,a)}function XT(e){return function(){return this.matches(e)}}function ZT(e){return function(t){return t.matches(e)}}var h$=Array.prototype.find;function f$(e){return function(){return h$.call(this.children,e)}}function p$(){return this.firstElementChild}function m$(e){return this.select(e==null?p$:f$(typeof e=="function"?e:ZT(e)))}var g$=Array.prototype.filter;function y$(){return Array.from(this.children)}function w$(e){return function(){return g$.call(this.children,e)}}function v$(e){return this.selectAll(e==null?y$:w$(typeof e=="function"?e:ZT(e)))}function x$(e){typeof e!="function"&&(e=XT(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,u=r[a]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new er(r,this._parents)}function QT(e){return new Array(e.length)}function b$(){return new er(this._enter||this._groups.map(QT),this._parents)}function Pd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Pd.prototype={constructor:Pd,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function k$(e){return function(){return e}}function _$(e,t,n,r,a,l){for(var c=0,u,f=t.length,p=l.length;c<p;++c)(u=t[c])?(u.__data__=l[c],r[c]=u):n[c]=new Pd(e,l[c]);for(;c<f;++c)(u=t[c])&&(a[c]=u)}function N$(e,t,n,r,a,l,c){var u,f,p=new Map,h=t.length,m=l.length,y=new Array(h),w;for(u=0;u<h;++u)(f=t[u])&&(y[u]=w=c.call(f,f.__data__,u,t)+"",p.has(w)?a[u]=f:p.set(w,f));for(u=0;u<m;++u)w=c.call(e,l[u],u,l)+"",(f=p.get(w))?(r[u]=f,f.__data__=l[u],p.delete(w)):n[u]=new Pd(e,l[u]);for(u=0;u<h;++u)(f=t[u])&&p.get(y[u])===f&&(a[u]=f)}function S$(e){return e.__data__}function j$(e,t){if(!arguments.length)return Array.from(this,S$);var n=t?N$:_$,r=this._parents,a=this._groups;typeof e!="function"&&(e=k$(e));for(var l=a.length,c=new Array(l),u=new Array(l),f=new Array(l),p=0;p<l;++p){var h=r[p],m=a[p],y=m.length,w=E$(e.call(h,h&&h.__data__,p,r)),N=w.length,k=u[p]=new Array(N),S=c[p]=new Array(N),b=f[p]=new Array(y);n(h,m,k,S,b,w,t);for(var j=0,E=0,C,T;j<N;++j)if(C=k[j]){for(j>=E&&(E=j+1);!(T=S[E])&&++E<N;);C._next=T||null}}return c=new er(c,r),c._enter=u,c._exit=f,c}function E$(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function C$(){return new er(this._exit||this._groups.map(QT),this._parents)}function T$(e,t,n){var r=this.enter(),a=this,l=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?l.remove():n(l),r&&a?r.merge(a).order():a}function A$(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,l=r.length,c=Math.min(a,l),u=new Array(a),f=0;f<c;++f)for(var p=n[f],h=r[f],m=p.length,y=u[f]=new Array(m),w,N=0;N<m;++N)(w=p[N]||h[N])&&(y[N]=w);for(;f<a;++f)u[f]=n[f];return new er(u,this._parents)}function R$(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],a=r.length-1,l=r[a],c;--a>=0;)(c=r[a])&&(l&&c.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(c,l),l=c);return this}function M$(e){e||(e=I$);function t(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var n=this._groups,r=n.length,a=new Array(r),l=0;l<r;++l){for(var c=n[l],u=c.length,f=a[l]=new Array(u),p,h=0;h<u;++h)(p=c[h])&&(f[h]=p);f.sort(t)}return new er(a,this._parents).order()}function I$(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function $$(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function O$(){return Array.from(this)}function L$(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length;a<l;++a){var c=r[a];if(c)return c}return null}function P$(){let e=0;for(const t of this)++e;return e}function D$(){return!this.node()}function q$(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a=t[n],l=0,c=a.length,u;l<c;++l)(u=a[l])&&e.call(u,u.__data__,l,a);return this}function F$(e){return function(){this.removeAttribute(e)}}function B$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function z$(e,t){return function(){this.setAttribute(e,t)}}function H$(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function U$(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function W$(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function V$(e,t){var n=uh(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?B$:F$:typeof t=="function"?n.local?W$:U$:n.local?H$:z$)(n,t))}function JT(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function G$(e){return function(){this.style.removeProperty(e)}}function K$(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Y$(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function X$(e,t,n){return arguments.length>1?this.each((t==null?G$:typeof t=="function"?Y$:K$)(e,t,n??"")):Li(this.node(),e)}function Li(e,t){return e.style.getPropertyValue(t)||JT(e).getComputedStyle(e,null).getPropertyValue(t)}function Z$(e){return function(){delete this[e]}}function Q$(e,t){return function(){this[e]=t}}function J$(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function e3(e,t){return arguments.length>1?this.each((t==null?Z$:typeof t=="function"?J$:Q$)(e,t)):this.node()[e]}function e2(e){return e.trim().split(/^|\s+/)}function Fx(e){return e.classList||new t2(e)}function t2(e){this._node=e,this._names=e2(e.getAttribute("class")||"")}t2.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function n2(e,t){for(var n=Fx(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function r2(e,t){for(var n=Fx(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function t3(e){return function(){n2(this,e)}}function n3(e){return function(){r2(this,e)}}function r3(e,t){return function(){(t.apply(this,arguments)?n2:r2)(this,e)}}function s3(e,t){var n=e2(e+"");if(arguments.length<2){for(var r=Fx(this.node()),a=-1,l=n.length;++a<l;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?r3:t?t3:n3)(n,t))}function a3(){this.textContent=""}function o3(e){return function(){this.textContent=e}}function i3(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function l3(e){return arguments.length?this.each(e==null?a3:(typeof e=="function"?i3:o3)(e)):this.node().textContent}function c3(){this.innerHTML=""}function u3(e){return function(){this.innerHTML=e}}function d3(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function h3(e){return arguments.length?this.each(e==null?c3:(typeof e=="function"?d3:u3)(e)):this.node().innerHTML}function f3(){this.nextSibling&&this.parentNode.appendChild(this)}function p3(){return this.each(f3)}function m3(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function g3(){return this.each(m3)}function y3(e){var t=typeof e=="function"?e:KT(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function w3(){return null}function v3(e,t){var n=typeof e=="function"?e:KT(e),r=t==null?w3:typeof t=="function"?t:qx(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function x3(){var e=this.parentNode;e&&e.removeChild(this)}function b3(){return this.each(x3)}function k3(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _3(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function N3(e){return this.select(e?_3:k3)}function S3(e){return arguments.length?this.property("__data__",e):this.node().__data__}function j3(e){return function(t){e.call(this,t,this.__data__)}}function E3(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function C3(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n<a;++n)l=t[n],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++r]=l;++r?t.length=r:delete this.__on}}}function T3(e,t,n){return function(){var r=this.__on,a,l=j3(t);if(r){for(var c=0,u=r.length;c<u;++c)if((a=r[c]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=n),a.value=t;return}}this.addEventListener(e.type,l,n),a={type:e.type,name:e.name,value:t,listener:l,options:n},r?r.push(a):this.__on=[a]}}function A3(e,t,n){var r=E3(e+""),a,l=r.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,p=u.length,h;f<p;++f)for(a=0,h=u[f];a<l;++a)if((c=r[a]).type===h.type&&c.name===h.name)return h.value}return}for(u=t?T3:C3,a=0;a<l;++a)this.each(u(r[a],t,n));return this}function s2(e,t,n){var r=JT(e),a=r.CustomEvent;typeof a=="function"?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function R3(e,t){return function(){return s2(this,e,t)}}function M3(e,t){return function(){return s2(this,e,t.apply(this,arguments))}}function I3(e,t){return this.each((typeof t=="function"?M3:R3)(e,t))}function*$3(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length,c;a<l;++a)(c=r[a])&&(yield c)}var a2=[null];function er(e,t){this._groups=e,this._parents=t}function vc(){return new er([[document.documentElement]],a2)}function O3(){return this}er.prototype=vc.prototype={constructor:er,select:i$,selectAll:d$,selectChild:m$,selectChildren:v$,filter:x$,data:j$,enter:b$,exit:C$,join:T$,merge:A$,selection:O3,order:R$,sort:M$,call:$$,nodes:O$,node:L$,size:P$,empty:D$,each:q$,attr:V$,style:X$,property:e3,classed:s3,text:l3,html:h3,raise:p3,lower:g3,append:y3,insert:v3,remove:b3,clone:N3,datum:S3,on:A3,dispatch:I3,[Symbol.iterator]:$3};function hr(e){return typeof e=="string"?new er([[document.querySelector(e)]],[document.documentElement]):new er([[e]],a2)}function L3(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Lr(e,t){if(e=L3(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const P3={passive:!1},sc={capture:!0,passive:!1};function dp(e){e.stopImmediatePropagation()}function Ri(e){e.preventDefault(),e.stopImmediatePropagation()}function o2(e){var t=e.document.documentElement,n=hr(e).on("dragstart.drag",Ri,sc);"onselectstart"in t?n.on("selectstart.drag",Ri,sc):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function i2(e,t){var n=e.document.documentElement,r=hr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ri,sc),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const td=e=>()=>e;function ax(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:c,y:u,dx:f,dy:p,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}ax.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function D3(e){return!e.ctrlKey&&!e.button}function q3(){return this.parentNode}function F3(e,t){return t??{x:e.x,y:e.y}}function B3(){return navigator.maxTouchPoints||"ontouchstart"in this}function z3(){var e=D3,t=q3,n=F3,r=B3,a={},l=ch("start","drag","end"),c=0,u,f,p,h,m=0;function y(C){C.on("mousedown.drag",w).filter(r).on("touchstart.drag",S).on("touchmove.drag",b,P3).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,T){if(!(h||!e.call(this,C,T))){var R=E(this,t.call(this,C,T),C,T,"mouse");R&&(hr(C.view).on("mousemove.drag",N,sc).on("mouseup.drag",k,sc),o2(C.view),dp(C),p=!1,u=C.clientX,f=C.clientY,R("start",C))}}function N(C){if(Ri(C),!p){var T=C.clientX-u,R=C.clientY-f;p=T*T+R*R>m}a.mouse("drag",C)}function k(C){hr(C.view).on("mousemove.drag mouseup.drag",null),i2(C.view,p),Ri(C),a.mouse("end",C)}function S(C,T){if(e.call(this,C,T)){var R=C.changedTouches,$=t.call(this,C,T),D=R.length,U,P;for(U=0;U<D;++U)(P=E(this,$,C,T,R[U].identifier,R[U]))&&(dp(C),P("start",C,R[U]))}}function b(C){var T=C.changedTouches,R=T.length,$,D;for($=0;$<R;++$)(D=a[T[$].identifier])&&(Ri(C),D("drag",C,T[$]))}function j(C){var T=C.changedTouches,R=T.length,$,D;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),$=0;$<R;++$)(D=a[T[$].identifier])&&(dp(C),D("end",C,T[$]))}function E(C,T,R,$,D,U){var P=l.copy(),V=Lr(U||R,T),J,ee,M;if((M=n.call(C,new ax("beforestart",{sourceEvent:R,target:y,identifier:D,active:c,x:V[0],y:V[1],dx:0,dy:0,dispatch:P}),$))!=null)return J=M.x-V[0]||0,ee=M.y-V[1]||0,function Z(G,I,q){var H=V,W;switch(G){case"start":a[D]=Z,W=c++;break;case"end":delete a[D],--c;case"drag":V=Lr(q||I,T),W=c;break}P.call(G,C,new ax(G,{sourceEvent:I,subject:M,target:y,identifier:D,active:W,x:V[0]+J,y:V[1]+ee,dx:V[0]-H[0],dy:V[1]-H[1],dispatch:P}),$)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:td(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:td(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:td(C),y):n},y.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:td(!!C),y):r},y.on=function(){var C=l.on.apply(l,arguments);return C===l?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function Bx(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function l2(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function xc(){}var ac=.7,Dd=1/ac,Mi="\\s*([+-]?\\d+)\\s*",oc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ls="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",H3=/^#([0-9a-f]{3,8})$/,U3=new RegExp(`^rgb\\(${Mi},${Mi},${Mi}\\)$`),W3=new RegExp(`^rgb\\(${ls},${ls},${ls}\\)$`),V3=new RegExp(`^rgba\\(${Mi},${Mi},${Mi},${oc}\\)$`),G3=new RegExp(`^rgba\\(${ls},${ls},${ls},${oc}\\)$`),K3=new RegExp(`^hsl\\(${oc},${ls},${ls}\\)$`),Y3=new RegExp(`^hsla\\(${oc},${ls},${ls},${oc}\\)$`),Dk={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Bx(xc,ic,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qk,formatHex:qk,formatHex8:X3,formatHsl:Z3,formatRgb:Fk,toString:Fk});function qk(){return this.rgb().formatHex()}function X3(){return this.rgb().formatHex8()}function Z3(){return c2(this).formatHsl()}function Fk(){return this.rgb().formatRgb()}function ic(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=H3.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Bk(t):n===3?new zn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?nd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?nd(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=U3.exec(e))?new zn(t[1],t[2],t[3],1):(t=W3.exec(e))?new zn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=V3.exec(e))?nd(t[1],t[2],t[3],t[4]):(t=G3.exec(e))?nd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=K3.exec(e))?Uk(t[1],t[2]/100,t[3]/100,1):(t=Y3.exec(e))?Uk(t[1],t[2]/100,t[3]/100,t[4]):Dk.hasOwnProperty(e)?Bk(Dk[e]):e==="transparent"?new zn(NaN,NaN,NaN,0):null}function Bk(e){return new zn(e>>16&255,e>>8&255,e&255,1)}function nd(e,t,n,r){return r<=0&&(e=t=n=NaN),new zn(e,t,n,r)}function Q3(e){return e instanceof xc||(e=ic(e)),e?(e=e.rgb(),new zn(e.r,e.g,e.b,e.opacity)):new zn}function ox(e,t,n,r){return arguments.length===1?Q3(e):new zn(e,t,n,r??1)}function zn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Bx(zn,ox,l2(xc,{brighter(e){return e=e==null?Dd:Math.pow(Dd,e),new zn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ac:Math.pow(ac,e),new zn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new zn(yo(this.r),yo(this.g),yo(this.b),qd(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:zk,formatHex:zk,formatHex8:J3,formatRgb:Hk,toString:Hk}));function zk(){return`#${mo(this.r)}${mo(this.g)}${mo(this.b)}`}function J3(){return`#${mo(this.r)}${mo(this.g)}${mo(this.b)}${mo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Hk(){const e=qd(this.opacity);return`${e===1?"rgb(":"rgba("}${yo(this.r)}, ${yo(this.g)}, ${yo(this.b)}${e===1?")":`, ${e})`}`}function qd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function mo(e){return e=yo(e),(e<16?"0":"")+e.toString(16)}function Uk(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Dr(e,t,n,r)}function c2(e){if(e instanceof Dr)return new Dr(e.h,e.s,e.l,e.opacity);if(e instanceof xc||(e=ic(e)),!e)return new Dr;if(e instanceof Dr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),c=NaN,u=l-a,f=(l+a)/2;return u?(t===l?c=(n-r)/u+(n<r)*6:n===l?c=(r-t)/u+2:c=(t-n)/u+4,u/=f<.5?l+a:2-l-a,c*=60):u=f>0&&f<1?0:c,new Dr(c,u,f,e.opacity)}function eO(e,t,n,r){return arguments.length===1?c2(e):new Dr(e,t,n,r??1)}function Dr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Bx(Dr,eO,l2(xc,{brighter(e){return e=e==null?Dd:Math.pow(Dd,e),new Dr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ac:Math.pow(ac,e),new Dr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new zn(hp(e>=240?e-240:e+120,a,r),hp(e,a,r),hp(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Dr(Wk(this.h),rd(this.s),rd(this.l),qd(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=qd(this.opacity);return`${e===1?"hsl(":"hsla("}${Wk(this.h)}, ${rd(this.s)*100}%, ${rd(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Wk(e){return e=(e||0)%360,e<0?e+360:e}function rd(e){return Math.max(0,Math.min(1,e||0))}function hp(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const u2=e=>()=>e;function tO(e,t){return function(n){return e+n*t}}function nO(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function rO(e){return(e=+e)==1?d2:function(t,n){return n-t?nO(t,n,e):u2(isNaN(t)?n:t)}}function d2(e,t){var n=t-e;return n?tO(e,n):u2(isNaN(e)?t:e)}const Vk=(function e(t){var n=rO(t);function r(a,l){var c=n((a=ox(a)).r,(l=ox(l)).r),u=n(a.g,l.g),f=n(a.b,l.b),p=d2(a.opacity,l.opacity);return function(h){return a.r=c(h),a.g=u(h),a.b=f(h),a.opacity=p(h),a+""}}return r.gamma=e,r})(1);function ma(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var ix=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fp=new RegExp(ix.source,"g");function sO(e){return function(){return e}}function aO(e){return function(t){return e(t)+""}}function oO(e,t){var n=ix.lastIndex=fp.lastIndex=0,r,a,l,c=-1,u=[],f=[];for(e=e+"",t=t+"";(r=ix.exec(e))&&(a=fp.exec(t));)(l=a.index)>n&&(l=t.slice(n,l),u[c]?u[c]+=l:u[++c]=l),(r=r[0])===(a=a[0])?u[c]?u[c]+=a:u[++c]=a:(u[++c]=null,f.push({i:c,x:ma(r,a)})),n=fp.lastIndex;return n<t.length&&(l=t.slice(n),u[c]?u[c]+=l:u[++c]=l),u.length<2?f[0]?aO(f[0].x):sO(t):(t=f.length,function(p){for(var h=0,m;h<t;++h)u[(m=f[h]).i]=m.x(p);return u.join("")})}var Gk=180/Math.PI,lx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function h2(e,t,n,r,a,l){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*n+t*r)&&(n-=e*f,r-=t*f),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,f/=u),e*r<t*n&&(e=-e,t=-t,f=-f,c=-c),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*Gk,skewX:Math.atan(f)*Gk,scaleX:c,scaleY:u}}var sd;function iO(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?lx:h2(t.a,t.b,t.c,t.d,t.e,t.f)}function lO(e){return e==null||(sd||(sd=document.createElementNS("http://www.w3.org/2000/svg","g")),sd.setAttribute("transform",e),!(e=sd.transform.baseVal.consolidate()))?lx:(e=e.matrix,h2(e.a,e.b,e.c,e.d,e.e,e.f))}function f2(e,t,n,r){function a(p){return p.length?p.pop()+" ":""}function l(p,h,m,y,w,N){if(p!==m||h!==y){var k=w.push("translate(",null,t,null,n);N.push({i:k-4,x:ma(p,m)},{i:k-2,x:ma(h,y)})}else(m||y)&&w.push("translate("+m+t+y+n)}function c(p,h,m,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:m.push(a(m)+"rotate(",null,r)-2,x:ma(p,h)})):h&&m.push(a(m)+"rotate("+h+r)}function u(p,h,m,y){p!==h?y.push({i:m.push(a(m)+"skewX(",null,r)-2,x:ma(p,h)}):h&&m.push(a(m)+"skewX("+h+r)}function f(p,h,m,y,w,N){if(p!==m||h!==y){var k=w.push(a(w)+"scale(",null,",",null,")");N.push({i:k-4,x:ma(p,m)},{i:k-2,x:ma(h,y)})}else(m!==1||y!==1)&&w.push(a(w)+"scale("+m+","+y+")")}return function(p,h){var m=[],y=[];return p=e(p),h=e(h),l(p.translateX,p.translateY,h.translateX,h.translateY,m,y),c(p.rotate,h.rotate,m,y),u(p.skewX,h.skewX,m,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,m,y),p=h=null,function(w){for(var N=-1,k=y.length,S;++N<k;)m[(S=y[N]).i]=S.x(w);return m.join("")}}}var cO=f2(iO,"px, ","px)","deg)"),uO=f2(lO,", ",")",")"),dO=1e-12;function Kk(e){return((e=Math.exp(e))+1/e)/2}function hO(e){return((e=Math.exp(e))-1/e)/2}function fO(e){return((e=Math.exp(2*e))-1)/(e+1)}const pO=(function e(t,n,r){function a(l,c){var u=l[0],f=l[1],p=l[2],h=c[0],m=c[1],y=c[2],w=h-u,N=m-f,k=w*w+N*N,S,b;if(k<dO)b=Math.log(y/p)/t,S=function($){return[u+$*w,f+$*N,p*Math.exp(t*$*b)]};else{var j=Math.sqrt(k),E=(y*y-p*p+r*k)/(2*p*n*j),C=(y*y-p*p-r*k)/(2*y*n*j),T=Math.log(Math.sqrt(E*E+1)-E),R=Math.log(Math.sqrt(C*C+1)-C);b=(R-T)/t,S=function($){var D=$*b,U=Kk(T),P=p/(n*j)*(U*fO(t*D+T)-hO(T));return[u+P*w,f+P*N,p*U/Kk(t*D+T)]}}return S.duration=b*1e3*t/Math.SQRT2,S}return a.rho=function(l){var c=Math.max(.001,+l),u=c*c,f=u*u;return e(c,u,f)},a})(Math.SQRT2,2,4);var Pi=0,Yl=0,ql=0,p2=1e3,Fd,Xl,Bd=0,xo=0,dh=0,lc=typeof performance=="object"&&performance.now?performance:Date,m2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function zx(){return xo||(m2(mO),xo=lc.now()+dh)}function mO(){xo=0}function zd(){this._call=this._time=this._next=null}zd.prototype=g2.prototype={constructor:zd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?zx():+n)+(t==null?0:+t),!this._next&&Xl!==this&&(Xl?Xl._next=this:Fd=this,Xl=this),this._call=e,this._time=n,cx()},stop:function(){this._call&&(this._call=null,this._time=1/0,cx())}};function g2(e,t,n){var r=new zd;return r.restart(e,t,n),r}function gO(){zx(),++Pi;for(var e=Fd,t;e;)(t=xo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Pi}function Yk(){xo=(Bd=lc.now())+dh,Pi=Yl=0;try{gO()}finally{Pi=0,wO(),xo=0}}function yO(){var e=lc.now(),t=e-Bd;t>p2&&(dh-=t,Bd=e)}function wO(){for(var e,t=Fd,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Fd=n);Xl=e,cx(r)}function cx(e){if(!Pi){Yl&&(Yl=clearTimeout(Yl));var t=e-xo;t>24?(e<1/0&&(Yl=setTimeout(Yk,e-lc.now()-dh)),ql&&(ql=clearInterval(ql))):(ql||(Bd=lc.now(),ql=setInterval(yO,p2)),Pi=1,m2(Yk))}}function Xk(e,t,n){var r=new zd;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var vO=ch("start","end","cancel","interrupt"),xO=[],y2=0,Zk=1,ux=2,Ed=3,Qk=4,dx=5,Cd=6;function hh(e,t,n,r,a,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;bO(e,n,{name:t,index:r,group:a,on:vO,tween:xO,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:y2})}function Hx(e,t){var n=Hr(e,t);if(n.state>y2)throw new Error("too late; already scheduled");return n}function ds(e,t){var n=Hr(e,t);if(n.state>Ed)throw new Error("too late; already running");return n}function Hr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function bO(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=g2(l,0,n.time);function l(p){n.state=Zk,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var h,m,y,w;if(n.state!==Zk)return f();for(h in r)if(w=r[h],w.name===n.name){if(w.state===Ed)return Xk(c);w.state===Qk?(w.state=Cd,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete r[h]):+h<t&&(w.state=Cd,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete r[h])}if(Xk(function(){n.state===Ed&&(n.state=Qk,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=ux,n.on.call("start",e,e.__data__,n.index,n.group),n.state===ux){for(n.state=Ed,a=new Array(y=n.tween.length),h=0,m=-1;h<y;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=w);a.length=m+1}}function u(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=dx,1),m=-1,y=a.length;++m<y;)a[m].call(e,h);n.state===dx&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Cd,n.timer.stop(),delete r[t];for(var p in r)return;delete e.__transition}}function Td(e,t){var n=e.__transition,r,a,l=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((r=n[c]).name!==t){l=!1;continue}a=r.state>ux&&r.state<dx,r.state=Cd,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[c]}l&&delete e.__transition}}function kO(e){return this.each(function(){Td(this,e)})}function _O(e,t){var n,r;return function(){var a=ds(this,e),l=a.tween;if(l!==n){r=n=l;for(var c=0,u=r.length;c<u;++c)if(r[c].name===t){r=r.slice(),r.splice(c,1);break}}a.tween=r}}function NO(e,t,n){var r,a;if(typeof n!="function")throw new Error;return function(){var l=ds(this,e),c=l.tween;if(c!==r){a=(r=c).slice();for(var u={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=u;break}f===p&&a.push(u)}l.tween=a}}function SO(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Hr(this.node(),n).tween,a=0,l=r.length,c;a<l;++a)if((c=r[a]).name===e)return c.value;return null}return this.each((t==null?_O:NO)(n,e,t))}function Ux(e,t,n){var r=e._id;return e.each(function(){var a=ds(this,r);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return Hr(a,r).value[t]}}function w2(e,t){var n;return(typeof t=="number"?ma:t instanceof ic?Vk:(n=ic(t))?(t=n,Vk):oO)(e,t)}function jO(e){return function(){this.removeAttribute(e)}}function EO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function CO(e,t,n){var r,a=n+"",l;return function(){var c=this.getAttribute(e);return c===a?null:c===r?l:l=t(r=c,n)}}function TO(e,t,n){var r,a=n+"",l;return function(){var c=this.getAttributeNS(e.space,e.local);return c===a?null:c===r?l:l=t(r=c,n)}}function AO(e,t,n){var r,a,l;return function(){var c,u=n(this),f;return u==null?void this.removeAttribute(e):(c=this.getAttribute(e),f=u+"",c===f?null:c===r&&f===a?l:(a=f,l=t(r=c,u)))}}function RO(e,t,n){var r,a,l;return function(){var c,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),f=u+"",c===f?null:c===r&&f===a?l:(a=f,l=t(r=c,u)))}}function MO(e,t){var n=uh(e),r=n==="transform"?uO:w2;return this.attrTween(e,typeof t=="function"?(n.local?RO:AO)(n,r,Ux(this,"attr."+e,t)):t==null?(n.local?EO:jO)(n):(n.local?TO:CO)(n,r,t))}function IO(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function $O(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function OO(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&$O(e,l)),n}return a._value=t,a}function LO(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&IO(e,l)),n}return a._value=t,a}function PO(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=uh(e);return this.tween(n,(r.local?OO:LO)(r,t))}function DO(e,t){return function(){Hx(this,e).delay=+t.apply(this,arguments)}}function qO(e,t){return t=+t,function(){Hx(this,e).delay=t}}function FO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?DO:qO)(t,e)):Hr(this.node(),t).delay}function BO(e,t){return function(){ds(this,e).duration=+t.apply(this,arguments)}}function zO(e,t){return t=+t,function(){ds(this,e).duration=t}}function HO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?BO:zO)(t,e)):Hr(this.node(),t).duration}function UO(e,t){if(typeof t!="function")throw new Error;return function(){ds(this,e).ease=t}}function WO(e){var t=this._id;return arguments.length?this.each(UO(t,e)):Hr(this.node(),t).ease}function VO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ds(this,e).ease=n}}function GO(e){if(typeof e!="function")throw new Error;return this.each(VO(this._id,e))}function KO(e){typeof e!="function"&&(e=XT(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,u=r[a]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new Os(r,this._parents,this._name,this._id)}function YO(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,l=Math.min(r,a),c=new Array(r),u=0;u<l;++u)for(var f=t[u],p=n[u],h=f.length,m=c[u]=new Array(h),y,w=0;w<h;++w)(y=f[w]||p[w])&&(m[w]=y);for(;u<r;++u)c[u]=t[u];return new Os(c,this._parents,this._name,this._id)}function XO(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function ZO(e,t,n){var r,a,l=XO(t)?Hx:ds;return function(){var c=l(this,e),u=c.on;u!==r&&(a=(r=u).copy()).on(t,n),c.on=a}}function QO(e,t){var n=this._id;return arguments.length<2?Hr(this.node(),n).on.on(e):this.each(ZO(n,e,t))}function JO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function e4(){return this.on("end.remove",JO(this._id))}function t4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=qx(e));for(var r=this._groups,a=r.length,l=new Array(a),c=0;c<a;++c)for(var u=r[c],f=u.length,p=l[c]=new Array(f),h,m,y=0;y<f;++y)(h=u[y])&&(m=e.call(h,h.__data__,y,u))&&("__data__"in h&&(m.__data__=h.__data__),p[y]=m,hh(p[y],t,n,y,p,Hr(h,n)));return new Os(l,this._parents,t,n)}function n4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=YT(e));for(var r=this._groups,a=r.length,l=[],c=[],u=0;u<a;++u)for(var f=r[u],p=f.length,h,m=0;m<p;++m)if(h=f[m]){for(var y=e.call(h,h.__data__,m,f),w,N=Hr(h,n),k=0,S=y.length;k<S;++k)(w=y[k])&&hh(w,t,n,k,y,N);l.push(y),c.push(h)}return new Os(l,c,t,n)}var r4=vc.prototype.constructor;function s4(){return new r4(this._groups,this._parents)}function a4(e,t){var n,r,a;return function(){var l=Li(this,e),c=(this.style.removeProperty(e),Li(this,e));return l===c?null:l===n&&c===r?a:a=t(n=l,r=c)}}function v2(e){return function(){this.style.removeProperty(e)}}function o4(e,t,n){var r,a=n+"",l;return function(){var c=Li(this,e);return c===a?null:c===r?l:l=t(r=c,n)}}function i4(e,t,n){var r,a,l;return function(){var c=Li(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),Li(this,e))),c===f?null:c===r&&f===a?l:(a=f,l=t(r=c,u))}}function l4(e,t){var n,r,a,l="style."+t,c="end."+l,u;return function(){var f=ds(this,e),p=f.on,h=f.value[l]==null?u||(u=v2(t)):void 0;(p!==n||a!==h)&&(r=(n=p).copy()).on(c,a=h),f.on=r}}function c4(e,t,n){var r=(e+="")=="transform"?cO:w2;return t==null?this.styleTween(e,a4(e,r)).on("end.style."+e,v2(e)):typeof t=="function"?this.styleTween(e,i4(e,r,Ux(this,"style."+e,t))).each(l4(this._id,e)):this.styleTween(e,o4(e,r,t),n).on("end.style."+e,null)}function u4(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function d4(e,t,n){var r,a;function l(){var c=t.apply(this,arguments);return c!==a&&(r=(a=c)&&u4(e,c,n)),r}return l._value=t,l}function h4(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,d4(e,t,n??""))}function f4(e){return function(){this.textContent=e}}function p4(e){return function(){var t=e(this);this.textContent=t??""}}function m4(e){return this.tween("text",typeof e=="function"?p4(Ux(this,"text",e)):f4(e==null?"":e+""))}function g4(e){return function(t){this.textContent=e.call(this,t)}}function y4(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&g4(a)),t}return r._value=e,r}function w4(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,y4(e))}function v4(){for(var e=this._name,t=this._id,n=x2(),r=this._groups,a=r.length,l=0;l<a;++l)for(var c=r[l],u=c.length,f,p=0;p<u;++p)if(f=c[p]){var h=Hr(f,t);hh(f,e,n,p,c,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Os(r,this._parents,e,n)}function x4(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(l,c){var u={value:c},f={value:function(){--a===0&&l()}};n.each(function(){var p=ds(this,r),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),p.on=t}),a===0&&l()})}var b4=0;function Os(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function x2(){return++b4}var Rs=vc.prototype;Os.prototype={constructor:Os,select:t4,selectAll:n4,selectChild:Rs.selectChild,selectChildren:Rs.selectChildren,filter:KO,merge:YO,selection:s4,transition:v4,call:Rs.call,nodes:Rs.nodes,node:Rs.node,size:Rs.size,empty:Rs.empty,each:Rs.each,on:QO,attr:MO,attrTween:PO,style:c4,styleTween:h4,text:m4,textTween:w4,remove:e4,tween:SO,delay:FO,duration:HO,ease:WO,easeVarying:GO,end:x4,[Symbol.iterator]:Rs[Symbol.iterator]};function k4(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var _4={time:null,delay:0,duration:250,ease:k4};function N4(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function S4(e){var t,n;e instanceof Os?(t=e._id,e=e._name):(t=x2(),(n=_4).time=zx(),e=e==null?null:e+"");for(var r=this._groups,a=r.length,l=0;l<a;++l)for(var c=r[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&hh(f,e,t,p,c,n||N4(f,t));return new Os(r,this._parents,e,t)}vc.prototype.interrupt=kO;vc.prototype.transition=S4;const ad=e=>()=>e;function j4(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:a}})}function Ms(e,t,n){this.k=e,this.x=t,this.y=n}Ms.prototype={constructor:Ms,scale:function(e){return e===1?this:new Ms(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ms(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $s=new Ms(1,0,0);Ms.prototype;function pp(e){e.stopImmediatePropagation()}function Fl(e){e.preventDefault(),e.stopImmediatePropagation()}function E4(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function C4(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Jk(){return this.__zoom||$s}function T4(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function A4(){return navigator.maxTouchPoints||"ontouchstart"in this}function R4(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),c>l?(l+c)/2:Math.min(0,l)||Math.max(0,c))}function b2(){var e=E4,t=C4,n=R4,r=T4,a=A4,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=pO,p=ch("start","zoom","end"),h,m,y,w=500,N=150,k=0,S=10;function b(M){M.property("__zoom",Jk).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",U).on("dblclick.zoom",P).filter(a).on("touchstart.zoom",V).on("touchmove.zoom",J).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(M,Z,G,I){var q=M.selection?M.selection():M;q.property("__zoom",Jk),M!==q?T(M,Z,G,I):q.interrupt().each(function(){R(this,arguments).event(I).start().zoom(null,typeof Z=="function"?Z.apply(this,arguments):Z).end()})},b.scaleBy=function(M,Z,G,I){b.scaleTo(M,function(){var q=this.__zoom.k,H=typeof Z=="function"?Z.apply(this,arguments):Z;return q*H},G,I)},b.scaleTo=function(M,Z,G,I){b.transform(M,function(){var q=t.apply(this,arguments),H=this.__zoom,W=G==null?C(q):typeof G=="function"?G.apply(this,arguments):G,L=H.invert(W),K=typeof Z=="function"?Z.apply(this,arguments):Z;return n(E(j(H,K),W,L),q,c)},G,I)},b.translateBy=function(M,Z,G,I){b.transform(M,function(){return n(this.__zoom.translate(typeof Z=="function"?Z.apply(this,arguments):Z,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),c)},null,I)},b.translateTo=function(M,Z,G,I,q){b.transform(M,function(){var H=t.apply(this,arguments),W=this.__zoom,L=I==null?C(H):typeof I=="function"?I.apply(this,arguments):I;return n($s.translate(L[0],L[1]).scale(W.k).translate(typeof Z=="function"?-Z.apply(this,arguments):-Z,typeof G=="function"?-G.apply(this,arguments):-G),H,c)},I,q)};function j(M,Z){return Z=Math.max(l[0],Math.min(l[1],Z)),Z===M.k?M:new Ms(Z,M.x,M.y)}function E(M,Z,G){var I=Z[0]-G[0]*M.k,q=Z[1]-G[1]*M.k;return I===M.x&&q===M.y?M:new Ms(M.k,I,q)}function C(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function T(M,Z,G,I){M.on("start.zoom",function(){R(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(I).end()}).tween("zoom",function(){var q=this,H=arguments,W=R(q,H).event(I),L=t.apply(q,H),K=G==null?C(L):typeof G=="function"?G.apply(q,H):G,de=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),O=q.__zoom,Y=typeof Z=="function"?Z.apply(q,H):Z,B=f(O.invert(K).concat(de/O.k),Y.invert(K).concat(de/Y.k));return function(te){if(te===1)te=Y;else{var le=B(te),pe=de/le[2];te=new Ms(pe,K[0]-le[0]*pe,K[1]-le[1]*pe)}W.zoom(null,te)}})}function R(M,Z,G){return!G&&M.__zooming||new $(M,Z)}function $(M,Z){this.that=M,this.args=Z,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,Z),this.taps=0}$.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,Z){return this.mouse&&M!=="mouse"&&(this.mouse[1]=Z.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=Z.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=Z.invert(this.touch1[0])),this.that.__zoom=Z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var Z=hr(this.that).datum();p.call(M,this.that,new j4(M,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:p}),Z)}};function D(M,...Z){if(!e.apply(this,arguments))return;var G=R(this,Z).event(M),I=this.__zoom,q=Math.max(l[0],Math.min(l[1],I.k*Math.pow(2,r.apply(this,arguments)))),H=Lr(M);if(G.wheel)(G.mouse[0][0]!==H[0]||G.mouse[0][1]!==H[1])&&(G.mouse[1]=I.invert(G.mouse[0]=H)),clearTimeout(G.wheel);else{if(I.k===q)return;G.mouse=[H,I.invert(H)],Td(this),G.start()}Fl(M),G.wheel=setTimeout(W,N),G.zoom("mouse",n(E(j(I,q),G.mouse[0],G.mouse[1]),G.extent,c));function W(){G.wheel=null,G.end()}}function U(M,...Z){if(y||!e.apply(this,arguments))return;var G=M.currentTarget,I=R(this,Z,!0).event(M),q=hr(M.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",de,!0),H=Lr(M,G),W=M.clientX,L=M.clientY;o2(M.view),pp(M),I.mouse=[H,this.__zoom.invert(H)],Td(this),I.start();function K(O){if(Fl(O),!I.moved){var Y=O.clientX-W,B=O.clientY-L;I.moved=Y*Y+B*B>k}I.event(O).zoom("mouse",n(E(I.that.__zoom,I.mouse[0]=Lr(O,G),I.mouse[1]),I.extent,c))}function de(O){q.on("mousemove.zoom mouseup.zoom",null),i2(O.view,I.moved),Fl(O),I.event(O).end()}}function P(M,...Z){if(e.apply(this,arguments)){var G=this.__zoom,I=Lr(M.changedTouches?M.changedTouches[0]:M,this),q=G.invert(I),H=G.k*(M.shiftKey?.5:2),W=n(E(j(G,H),I,q),t.apply(this,Z),c);Fl(M),u>0?hr(this).transition().duration(u).call(T,W,I,M):hr(this).call(b.transform,W,I,M)}}function V(M,...Z){if(e.apply(this,arguments)){var G=M.touches,I=G.length,q=R(this,Z,M.changedTouches.length===I).event(M),H,W,L,K;for(pp(M),W=0;W<I;++W)L=G[W],K=Lr(L,this),K=[K,this.__zoom.invert(K),L.identifier],q.touch0?!q.touch1&&q.touch0[2]!==K[2]&&(q.touch1=K,q.taps=0):(q.touch0=K,H=!0,q.taps=1+!!h);h&&(h=clearTimeout(h)),H&&(q.taps<2&&(m=K[0],h=setTimeout(function(){h=null},w)),Td(this),q.start())}}function J(M,...Z){if(this.__zooming){var G=R(this,Z).event(M),I=M.changedTouches,q=I.length,H,W,L,K;for(Fl(M),H=0;H<q;++H)W=I[H],L=Lr(W,this),G.touch0&&G.touch0[2]===W.identifier?G.touch0[0]=L:G.touch1&&G.touch1[2]===W.identifier&&(G.touch1[0]=L);if(W=G.that.__zoom,G.touch1){var de=G.touch0[0],O=G.touch0[1],Y=G.touch1[0],B=G.touch1[1],te=(te=Y[0]-de[0])*te+(te=Y[1]-de[1])*te,le=(le=B[0]-O[0])*le+(le=B[1]-O[1])*le;W=j(W,Math.sqrt(te/le)),L=[(de[0]+Y[0])/2,(de[1]+Y[1])/2],K=[(O[0]+B[0])/2,(O[1]+B[1])/2]}else if(G.touch0)L=G.touch0[0],K=G.touch0[1];else return;G.zoom("touch",n(E(W,L,K),G.extent,c))}}function ee(M,...Z){if(this.__zooming){var G=R(this,Z).event(M),I=M.changedTouches,q=I.length,H,W;for(pp(M),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),H=0;H<q;++H)W=I[H],G.touch0&&G.touch0[2]===W.identifier?delete G.touch0:G.touch1&&G.touch1[2]===W.identifier&&delete G.touch1;if(G.touch1&&!G.touch0&&(G.touch0=G.touch1,delete G.touch1),G.touch0)G.touch0[1]=this.__zoom.invert(G.touch0[0]);else if(G.end(),G.taps===2&&(W=Lr(W,this),Math.hypot(m[0]-W[0],m[1]-W[1])<S)){var L=hr(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return b.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:ad(+M),b):r},b.filter=function(M){return arguments.length?(e=typeof M=="function"?M:ad(!!M),b):e},b.touchable=function(M){return arguments.length?(a=typeof M=="function"?M:ad(!!M),b):a},b.extent=function(M){return arguments.length?(t=typeof M=="function"?M:ad([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),b):t},b.scaleExtent=function(M){return arguments.length?(l[0]=+M[0],l[1]=+M[1],b):[l[0],l[1]]},b.translateExtent=function(M){return arguments.length?(c[0][0]=+M[0][0],c[1][0]=+M[1][0],c[0][1]=+M[0][1],c[1][1]=+M[1][1],b):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},b.constrain=function(M){return arguments.length?(n=M,b):n},b.duration=function(M){return arguments.length?(u=+M,b):u},b.interpolate=function(M){return arguments.length?(f=M,b):f},b.on=function(){var M=p.on.apply(p,arguments);return M===p?b:M},b.clickDistance=function(M){return arguments.length?(k=(M=+M)*M,b):Math.sqrt(k)},b.tapDistance=function(M){return arguments.length?(S=+M,b):S},b}var mr=WT();const fh=x.createContext(null),M4=fh.Provider,Ls={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},k2=Ls.error001();function yt(e,t){const n=x.useContext(fh);if(n===null)throw new Error(k2);return GT(n,e,t)}const Ut=()=>{const e=x.useContext(fh);if(e===null)throw new Error(k2);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},I4=e=>e.userSelectionActive?"none":"all";function Wx({position:e,children:t,className:n,style:r,...a}){const l=yt(I4),c=`${e}`.split("-");return fe.createElement("div",{className:fn(["react-flow__panel",n,...c]),style:{...r,pointerEvents:l},...a},t)}function $4({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:fe.createElement(Wx,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},fe.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const O4=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:a=!0,labelBgStyle:l={},labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...h})=>{const m=x.useRef(null),[y,w]=x.useState({x:0,y:0,width:0,height:0}),N=fn(["react-flow__edge-textwrapper",p]);return x.useEffect(()=>{if(m.current){const k=m.current.getBBox();w({x:k.x,y:k.y,width:k.width,height:k.height})}},[n]),typeof n>"u"||!n?null:fe.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...h},a&&fe.createElement("rect",{width:y.width+2*c[0],x:-c[0],y:-c[1],height:y.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),fe.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:r},n),f)};var L4=x.memo(O4);const Vx=e=>({width:e.offsetWidth,height:e.offsetHeight}),Di=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Gx=(e={x:0,y:0},t)=>({x:Di(e.x,t[0][0],t[1][0]),y:Di(e.y,t[0][1],t[1][1])}),e1=(e,t,n)=>e<t?Di(Math.abs(e-t),1,50)/50:e>n?-Di(Math.abs(e-n),1,50)/50:0,_2=(e,t)=>{const n=e1(e.x,35,t.width-35)*20,r=e1(e.y,35,t.height-35)*20;return[n,r]},N2=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},S2=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),cc=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),j2=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),t1=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),P4=(e,t)=>j2(S2(cc(e),cc(t))),hx=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},D4=e=>fr(e.width)&&fr(e.height)&&fr(e.x)&&fr(e.y),fr=e=>!isNaN(e)&&isFinite(e),Pt=Symbol.for("internals"),E2=["Enter"," ","Escape"],q4=(e,t)=>{},F4=e=>"nativeEvent"in e;function fx(e){var a,l;const t=F4(e)?e.nativeEvent:e,n=((l=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:l[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const C2=e=>"clientX"in e,ba=(e,t)=>{var l,c;const n=C2(e),r=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,a=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Hd=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},bc=({id:e,path:t,labelX:n,labelY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w=20})=>fe.createElement(fe.Fragment,null,fe.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&fe.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&fr(n)&&fr(r)?fe.createElement(L4,{x:n,y:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);bc.displayName="BaseEdge";function Bl(e,t,n){return n===void 0?n:r=>{const a=t().edges.find(l=>l.id===e);a&&n(r,{...a})}}function T2({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n<e?n+a:n-a,c=Math.abs(r-t)/2,u=r<t?r+c:r-c;return[l,u,a,c]}function A2({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u}){const f=e*.125+a*.375+c*.375+n*.125,p=t*.125+l*.375+u*.375+r*.125,h=Math.abs(f-e),m=Math.abs(p-t);return[f,p,h,m]}var bo;(function(e){e.Strict="strict",e.Loose="loose"})(bo||(bo={}));var go;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(go||(go={}));var uc;(function(e){e.Partial="partial",e.Full="full"})(uc||(uc={}));var ya;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ya||(ya={}));var Ud;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ud||(Ud={}));var We;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(We||(We={}));function n1({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===We.Left||e===We.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function R2({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:r,targetY:a,targetPosition:l=We.Top}){const[c,u]=n1({pos:n,x1:e,y1:t,x2:r,y2:a}),[f,p]=n1({pos:l,x1:r,y1:a,x2:e,y2:t}),[h,m,y,w]=A2({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${c},${u} ${f},${p} ${r},${a}`,h,m,y,w]}const Kx=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a=We.Bottom,targetPosition:l=We.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:k})=>{const[S,b,j]=R2({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:l});return fe.createElement(bc,{path:S,labelX:b,labelY:j,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:k})});Kx.displayName="SimpleBezierEdge";const r1={[We.Left]:{x:-1,y:0},[We.Right]:{x:1,y:0},[We.Top]:{x:0,y:-1},[We.Bottom]:{x:0,y:1}},B4=({source:e,sourcePosition:t=We.Bottom,target:n})=>t===We.Left||t===We.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},s1=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function z4({source:e,sourcePosition:t=We.Bottom,target:n,targetPosition:r=We.Top,center:a,offset:l}){const c=r1[t],u=r1[r],f={x:e.x+c.x*l,y:e.y+c.y*l},p={x:n.x+u.x*l,y:n.y+u.y*l},h=B4({source:f,sourcePosition:t,target:p}),m=h.x!==0?"x":"y",y=h[m];let w=[],N,k;const S={x:0,y:0},b={x:0,y:0},[j,E,C,T]=T2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*u[m]===-1){N=a.x??j,k=a.y??E;const $=[{x:N,y:f.y},{x:N,y:p.y}],D=[{x:f.x,y:k},{x:p.x,y:k}];c[m]===y?w=m==="x"?$:D:w=m==="x"?D:$}else{const $=[{x:f.x,y:p.y}],D=[{x:p.x,y:f.y}];if(m==="x"?w=c.x===y?D:$:w=c.y===y?$:D,t===r){const ee=Math.abs(e[m]-n[m]);if(ee<=l){const M=Math.min(l-1,l-ee);c[m]===y?S[m]=(f[m]>e[m]?-1:1)*M:b[m]=(p[m]>n[m]?-1:1)*M}}if(t!==r){const ee=m==="x"?"y":"x",M=c[m]===u[ee],Z=f[ee]>p[ee],G=f[ee]<p[ee];(c[m]===1&&(!M&&Z||M&&G)||c[m]!==1&&(!M&&G||M&&Z))&&(w=m==="x"?$:D)}const U={x:f.x+S.x,y:f.y+S.y},P={x:p.x+b.x,y:p.y+b.y},V=Math.max(Math.abs(U.x-w[0].x),Math.abs(P.x-w[0].x)),J=Math.max(Math.abs(U.y-w[0].y),Math.abs(P.y-w[0].y));V>=J?(N=(U.x+P.x)/2,k=w[0].y):(N=w[0].x,k=(U.y+P.y)/2)}return[[e,{x:f.x+S.x,y:f.y+S.y},...w,{x:p.x+b.x,y:p.y+b.y},n],N,k,C,T]}function H4(e,t,n,r){const a=Math.min(s1(e,t)/2,s1(t,n)/2,r),{x:l,y:c}=t;if(e.x===l&&l===n.x||e.y===c&&c===n.y)return`L${l} ${c}`;if(e.y===c){const p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${l+a*p},${c}Q ${l},${c} ${l},${c+a*h}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${l},${c+a*f}Q ${l},${c} ${l+a*u},${c}`}function px({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:r,targetY:a,targetPosition:l=We.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[h,m,y,w,N]=z4({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:l,center:{x:u,y:f},offset:p});return[h.reduce((S,b,j)=>{let E="";return j>0&&j<h.length-1?E=H4(h[j-1],b,h[j+1],c):E=`${j===0?"M":"L"}${b.x} ${b.y}`,S+=E,S},""),m,y,w,N]}const ph=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:m=We.Bottom,targetPosition:y=We.Top,markerEnd:w,markerStart:N,pathOptions:k,interactionWidth:S})=>{const[b,j,E]=px({sourceX:e,sourceY:t,sourcePosition:m,targetX:n,targetY:r,targetPosition:y,borderRadius:k==null?void 0:k.borderRadius,offset:k==null?void 0:k.offset});return fe.createElement(bc,{path:b,labelX:j,labelY:E,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:N,interactionWidth:S})});ph.displayName="SmoothStepEdge";const Yx=x.memo(e=>{var t;return fe.createElement(ph,{...e,pathOptions:x.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Yx.displayName="StepEdge";function U4({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,c,u]=T2({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,c,u]}const Xx=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[N,k,S]=U4({sourceX:e,sourceY:t,targetX:n,targetY:r});return fe.createElement(bc,{path:N,labelX:k,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})});Xx.displayName="StraightEdge";function od(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function a1({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case We.Left:return[t-od(t-r,l),n];case We.Right:return[t+od(r-t,l),n];case We.Top:return[t,n-od(n-a,l)];case We.Bottom:return[t,n+od(a-n,l)]}}function Zx({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:r,targetY:a,targetPosition:l=We.Top,curvature:c=.25}){const[u,f]=a1({pos:n,x1:e,y1:t,x2:r,y2:a,c}),[p,h]=a1({pos:l,x1:r,y1:a,x2:e,y2:t,c}),[m,y,w,N]=A2({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${u},${f} ${p},${h} ${r},${a}`,m,y,w,N]}const Wd=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a=We.Bottom,targetPosition:l=We.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,pathOptions:k,interactionWidth:S})=>{const[b,j,E]=Zx({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:l,curvature:k==null?void 0:k.curvature});return fe.createElement(bc,{path:b,labelX:j,labelY:E,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:S})});Wd.displayName="BezierEdge";const Qx=x.createContext(null),W4=Qx.Provider;Qx.Consumer;const V4=()=>x.useContext(Qx),G4=e=>"id"in e&&"source"in e&&"target"in e,K4=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,mx=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,Y4=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),X4=(e,t)=>{if(!e.source||!e.target)return t;let n;return G4(e)?n={...e}:n={...e,id:K4(e)},Y4(n,t)?t:t.concat(n)},gx=({x:e,y:t},[n,r,a],l,[c,u])=>{const f={x:(e-n)/a,y:(t-r)/a};return l?{x:c*Math.round(f.x/c),y:u*Math.round(f.y/u)}:f},M2=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r}),wo=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],a={x:e.position.x-n,y:e.position.y-r};return{...a,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:a}},mh=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const{x:l,y:c}=wo(a,t).positionAbsolute;return S2(r,cc({x:l,y:c,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return j2(n)},I2=(e,t,[n,r,a]=[0,0,1],l=!1,c=!1,u=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-r)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:m,height:y,selectable:w=!0,hidden:N=!1}=h;if(c&&!w||N)return!1;const{positionAbsolute:k}=wo(h,u),S={x:k.x,y:k.y,width:m||0,height:y||0},b=hx(f,S),j=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&b>0,C=(m||0)*(y||0);(j||E||b>=C||h.dragging)&&p.push(h)}),p},$2=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},O2=(e,t,n,r,a,l=.1)=>{const c=t/(e.width*(1+l)),u=n/(e.height*(1+l)),f=Math.min(c,u),p=Di(f,r,a),h=e.x+e.width/2,m=e.y+e.height/2,y=t/2-h*p,w=n/2-m*p;return{x:y,y:w,zoom:p}},po=(e,t=0)=>e.transition().duration(t);function o1(e,t,n,r){return(t[n]||[]).reduce((a,l)=>{var c,u;return`${e.id}-${l.id}-${n}`!==r&&a.push({id:l.id||null,type:n,nodeId:e.id,x:(((c=e.positionAbsolute)==null?void 0:c.x)??0)+l.x+l.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+l.y+l.height/2}),a},[])}function Z4(e,t,n,r,a,l){const{x:c,y:u}=ba(e),p=t.elementsFromPoint(c,u).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const k=Jx(void 0,p),S=p.getAttribute("data-handleid"),b=l({nodeId:N,id:S,type:k});if(b){const j=a.find(E=>E.nodeId===N&&E.type===k&&E.id===S);return{handle:{id:S,type:k,nodeId:N,x:(j==null?void 0:j.x)||n.x,y:(j==null?void 0:j.y)||n.y},validHandleResult:b}}}}let h=[],m=1/0;if(a.forEach(N=>{const k=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(k<=r){const S=l(N);k<=m&&(k<m?h=[{handle:N,validHandleResult:S}]:k===m&&h.push({handle:N,validHandleResult:S}),m=k)}}),!h.length)return{handle:null,validHandleResult:L2()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:N})=>N.isValid),w=h.some(({handle:N})=>N.type==="target");return h.find(({handle:N,validHandleResult:k})=>w?N.type==="target":y?k.isValid:!0)||h[0]}const Q4={source:null,target:null,sourceHandle:null,targetHandle:null},L2=()=>({handleDomNode:null,isValid:!1,connection:Q4,endHandle:null});function P2(e,t,n,r,a,l,c){const u=a==="target",f=c.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...L2(),handleDomNode:f};if(f){const h=Jx(void 0,f),m=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),N=f.classList.contains("connectableend"),k={source:u?m:n,sourceHandle:u?y:r,target:u?n:m,targetHandle:u?r:y};p.connection=k,w&&N&&(t===bo.Strict?u&&h==="source"||!u&&h==="target":m!==n||y!==r)&&(p.endHandle={nodeId:m,handleId:y,type:h},p.isValid=l(k))}return p}function J4({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((a,l)=>{if(l[Pt]){const{handleBounds:c}=l[Pt];let u=[],f=[];c&&(u=o1(l,c,"source",`${t}-${n}-${r}`),f=o1(l,c,"target",`${t}-${n}-${r}`)),a.push(...u,...f)}return a},[])}function Jx(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function mp(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function eL(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function D2({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:a,getState:l,setState:c,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const h=N2(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:k,panBy:S,getNodes:b,cancelConnection:j}=l();let E=0,C;const{x:T,y:R}=ba(e),$=h==null?void 0:h.elementFromPoint(T,R),D=Jx(f,$),U=y==null?void 0:y.getBoundingClientRect();if(!U||!D)return;let P,V=ba(e,U),J=!1,ee=null,M=!1,Z=null;const G=J4({nodes:b(),nodeId:n,handleId:t,handleType:D}),I=()=>{if(!w)return;const[W,L]=_2(V,U);S({x:W,y:L}),E=requestAnimationFrame(I)};c({connectionPosition:V,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:D,connectionStartHandle:{nodeId:n,handleId:t,type:D},connectionEndHandle:null}),k==null||k(e,{nodeId:n,handleId:t,handleType:D});function q(W){const{transform:L}=l();V=ba(W,U);const{handle:K,validHandleResult:de}=Z4(W,h,gx(V,L,!1,[1,1]),N,G,O=>P2(O,m,n,t,a?"target":"source",u,h));if(C=K,J||(I(),J=!0),Z=de.handleDomNode,ee=de.connection,M=de.isValid,c({connectionPosition:C&&M?M2({x:C.x,y:C.y},L):V,connectionStatus:eL(!!C,M),connectionEndHandle:de.endHandle}),!C&&!M&&!Z)return mp(P);ee.source!==ee.target&&Z&&(mp(P),P=Z,Z.classList.add("connecting","react-flow__handle-connecting"),Z.classList.toggle("valid",M),Z.classList.toggle("react-flow__handle-valid",M))}function H(W){var L,K;(C||Z)&&ee&&M&&(r==null||r(ee)),(K=(L=l()).onConnectEnd)==null||K.call(L,W),f&&(p==null||p(W)),mp(P),j(),cancelAnimationFrame(E),J=!1,M=!1,ee=null,Z=null,h.removeEventListener("mousemove",q),h.removeEventListener("mouseup",H),h.removeEventListener("touchmove",q),h.removeEventListener("touchend",H)}h.addEventListener("mousemove",q),h.addEventListener("mouseup",H),h.addEventListener("touchmove",q),h.addEventListener("touchend",H)}const i1=()=>!0,tL=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),nL=(e,t,n)=>r=>{const{connectionStartHandle:a,connectionEndHandle:l,connectionClickStartHandle:c}=r;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n,clickConnecting:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.handleId)===t&&(c==null?void 0:c.type)===n}},q2=x.forwardRef(({type:e="source",position:t=We.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:c,onConnect:u,children:f,className:p,onMouseDown:h,onTouchStart:m,...y},w)=>{var U,P;const N=c||null,k=e==="target",S=Ut(),b=V4(),{connectOnClick:j,noPanClassName:E}=yt(tL,Xt),{connecting:C,clickConnecting:T}=yt(nL(b,N,e),Xt);b||(P=(U=S.getState()).onError)==null||P.call(U,"010",Ls.error010());const R=V=>{const{defaultEdgeOptions:J,onConnect:ee,hasDefaultEdges:M}=S.getState(),Z={...J,...V};if(M){const{edges:G,setEdges:I}=S.getState();I(X4(Z,G))}ee==null||ee(Z),u==null||u(Z)},$=V=>{if(!b)return;const J=C2(V);a&&(J&&V.button===0||!J)&&D2({event:V,handleId:N,nodeId:b,onConnect:R,isTarget:k,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||i1}),J?h==null||h(V):m==null||m(V)},D=V=>{const{onClickConnectStart:J,onClickConnectEnd:ee,connectionClickStartHandle:M,connectionMode:Z,isValidConnection:G}=S.getState();if(!b||!M&&!a)return;if(!M){J==null||J(V,{nodeId:b,handleId:N,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:N}});return}const I=N2(V.target),q=n||G||i1,{connection:H,isValid:W}=P2({nodeId:b,id:N,type:e},Z,M.nodeId,M.handleId||null,M.type,q,I);W&&R(H),ee==null||ee(V),S.setState({connectionClickStartHandle:null})};return fe.createElement("div",{"data-handleid":N,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${N}-${e}`,className:fn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!k,target:k,connectable:r,connectablestart:a,connectableend:l,connecting:T,connectionindicator:r&&(a&&!C||l&&C)}]),onMouseDown:$,onTouchStart:$,onClick:j?D:void 0,ref:w,...y},f)});q2.displayName="Handle";var ko=x.memo(q2);const F2=({data:e,isConnectable:t,targetPosition:n=We.Top,sourcePosition:r=We.Bottom})=>fe.createElement(fe.Fragment,null,fe.createElement(ko,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,fe.createElement(ko,{type:"source",position:r,isConnectable:t}));F2.displayName="DefaultNode";var yx=x.memo(F2);const B2=({data:e,isConnectable:t,sourcePosition:n=We.Bottom})=>fe.createElement(fe.Fragment,null,e==null?void 0:e.label,fe.createElement(ko,{type:"source",position:n,isConnectable:t}));B2.displayName="InputNode";var z2=x.memo(B2);const H2=({data:e,isConnectable:t,targetPosition:n=We.Top})=>fe.createElement(fe.Fragment,null,fe.createElement(ko,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);H2.displayName="OutputNode";var U2=x.memo(H2);const e0=()=>null;e0.displayName="GroupNode";const rL=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),id=e=>e.id;function sL(e,t){return Xt(e.selectedNodes.map(id),t.selectedNodes.map(id))&&Xt(e.selectedEdges.map(id),t.selectedEdges.map(id))}const W2=x.memo(({onSelectionChange:e})=>{const t=Ut(),{selectedNodes:n,selectedEdges:r}=yt(rL,sL);return x.useEffect(()=>{const a={nodes:n,edges:r};e==null||e(a),t.getState().onSelectionChange.forEach(l=>l(a))},[n,r,e]),null});W2.displayName="SelectionListener";const aL=e=>!!e.onSelectionChange;function oL({onSelectionChange:e}){const t=yt(aL);return e||t?fe.createElement(W2,{onSelectionChange:e}):null}const iL=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function yi(e,t){x.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function dt(e,t,n){x.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const lL=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:a,onConnectStart:l,onConnectEnd:c,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:k,maxZoom:S,nodeExtent:b,onNodesChange:j,onEdgesChange:E,elementsSelectable:C,connectionMode:T,snapGrid:R,snapToGrid:$,translateExtent:D,connectOnClick:U,defaultEdgeOptions:P,fitView:V,fitViewOptions:J,onNodesDelete:ee,onEdgesDelete:M,onNodeDrag:Z,onNodeDragStart:G,onNodeDragStop:I,onSelectionDrag:q,onSelectionDragStart:H,onSelectionDragStop:W,noPanClassName:L,nodeOrigin:K,rfId:de,autoPanOnConnect:O,autoPanOnNodeDrag:Y,onError:B,connectionRadius:te,isValidConnection:le,nodeDragThreshold:pe})=>{const{setNodes:ye,setEdges:Ie,setDefaultNodesAndEdges:Te,setMinZoom:Re,setMaxZoom:Me,setTranslateExtent:xe,setNodeExtent:He,reset:Ne}=yt(iL,Xt),_e=Ut();return x.useEffect(()=>{const Ze=r==null?void 0:r.map(ct=>({...ct,...P}));return Te(n,Ze),()=>{Ne()}},[]),dt("defaultEdgeOptions",P,_e.setState),dt("connectionMode",T,_e.setState),dt("onConnect",a,_e.setState),dt("onConnectStart",l,_e.setState),dt("onConnectEnd",c,_e.setState),dt("onClickConnectStart",u,_e.setState),dt("onClickConnectEnd",f,_e.setState),dt("nodesDraggable",p,_e.setState),dt("nodesConnectable",h,_e.setState),dt("nodesFocusable",m,_e.setState),dt("edgesFocusable",y,_e.setState),dt("edgesUpdatable",w,_e.setState),dt("elementsSelectable",C,_e.setState),dt("elevateNodesOnSelect",N,_e.setState),dt("snapToGrid",$,_e.setState),dt("snapGrid",R,_e.setState),dt("onNodesChange",j,_e.setState),dt("onEdgesChange",E,_e.setState),dt("connectOnClick",U,_e.setState),dt("fitViewOnInit",V,_e.setState),dt("fitViewOnInitOptions",J,_e.setState),dt("onNodesDelete",ee,_e.setState),dt("onEdgesDelete",M,_e.setState),dt("onNodeDrag",Z,_e.setState),dt("onNodeDragStart",G,_e.setState),dt("onNodeDragStop",I,_e.setState),dt("onSelectionDrag",q,_e.setState),dt("onSelectionDragStart",H,_e.setState),dt("onSelectionDragStop",W,_e.setState),dt("noPanClassName",L,_e.setState),dt("nodeOrigin",K,_e.setState),dt("rfId",de,_e.setState),dt("autoPanOnConnect",O,_e.setState),dt("autoPanOnNodeDrag",Y,_e.setState),dt("onError",B,_e.setState),dt("connectionRadius",te,_e.setState),dt("isValidConnection",le,_e.setState),dt("nodeDragThreshold",pe,_e.setState),yi(e,ye),yi(t,Ie),yi(k,Re),yi(S,Me),yi(D,xe),yi(b,He),null},l1={display:"none"},cL={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},V2="react-flow__node-desc",G2="react-flow__edge-desc",uL="react-flow__aria-live",dL=e=>e.ariaLiveMessage;function hL({rfId:e}){const t=yt(dL);return fe.createElement("div",{id:`${uL}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:cL},t)}function fL({rfId:e,disableKeyboardA11y:t}){return fe.createElement(fe.Fragment,null,fe.createElement("div",{id:`${V2}-${e}`,style:l1},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),fe.createElement("div",{id:`${G2}-${e}`,style:l1},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&fe.createElement(hL,{rfId:e}))}var dc=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=x.useState(!1),a=x.useRef(!1),l=x.useRef(new Set([])),[c,u]=x.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=p.reduce((m,y)=>m.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return x.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=w=>{if(a.current=w.ctrlKey||w.metaKey||w.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&fx(w))return!1;const k=u1(w.code,u);l.current.add(w[k]),c1(c,l.current,!1)&&(w.preventDefault(),r(!0))},m=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&fx(w))return!1;const k=u1(w.code,u);c1(c,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(w[k]),w.key==="Meta"&&l.current.clear(),a.current=!1},y=()=>{l.current.clear(),r(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,r]),n};function c1(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function u1(e,t){return t.includes(e)?"code":"key"}function K2(e,t,n,r){var u,f;const a=e.parentNode||e.parentId;if(!a)return n;const l=t.get(a),c=wo(l,r);return K2(l,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((u=l[Pt])==null?void 0:u.z)??0)>(n.z??0)?((f=l[Pt])==null?void 0:f.z)??0:n.z??0},r)}function Y2(e,t,n){e.forEach(r=>{var l;const a=r.parentNode||r.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[r.id]){const{x:c,y:u,z:f}=K2(r,e,{...r.position,z:((l=r[Pt])==null?void 0:l.z)??0},t);r.positionAbsolute={x:c,y:u},r[Pt].z=f,n!=null&&n[r.id]&&(r[Pt].isParent=!0)}})}function gp(e,t,n,r){const a=new Map,l={},c=r?1e3:0;return e.forEach(u=>{var w;const f=(fr(u.zIndex)?u.zIndex:0)+(u.selected?c:0),p=t.get(u.id),h={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},m=u.parentNode||u.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(h,Pt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[Pt])==null?void 0:w.handleBounds,z:f}}),a.set(u.id,h)}),Y2(a,n,l),a}function X2(e,t={}){const{getNodes:n,width:r,height:a,minZoom:l,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:m}=e(),y=t.initial&&!p&&h;if(u&&f&&(y||!t.initial)){const N=n().filter(S=>{var j;const b=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(j=t.nodes)!=null&&j.length?b&&t.nodes.some(E=>E.id===S.id):b}),k=N.every(S=>S.width&&S.height);if(N.length>0&&k){const S=mh(N,m),{x:b,y:j,zoom:E}=O2(S,r,a,t.minZoom??l,t.maxZoom??c,t.padding??.1),C=$s.translate(b,j).scale(E);return typeof t.duration=="number"&&t.duration>0?u.transform(po(f,t.duration),C):u.transform(f,C),!0}}return!1}function pL(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Pt]:r[Pt],selected:n.selected})}),new Map(t)}function mL(e,t){return t.map(n=>{const r=e.find(a=>a.id===n.id);return r&&(n.selected=r.selected),n})}function ld({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:a,edges:l,onNodesChange:c,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&r({nodeInternals:pL(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&r({edges:mL(t,l)}),u==null||u(t))}const wi=()=>{},gL={zoomIn:wi,zoomOut:wi,zoomTo:wi,getZoom:()=>1,setViewport:wi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:wi,fitBounds:wi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},yL=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),wL=()=>{const e=Ut(),{d3Zoom:t,d3Selection:n}=yt(yL,Xt);return x.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(po(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(po(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,l)=>t.scaleTo(po(n,l==null?void 0:l.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,l)=>{const[c,u,f]=e.getState().transform,p=$s.translate(a.x??c,a.y??u).scale(a.zoom??f);t.transform(po(n,l==null?void 0:l.duration),p)},getViewport:()=>{const[a,l,c]=e.getState().transform;return{x:a,y:l,zoom:c}},fitView:a=>X2(e.getState,a),setCenter:(a,l,c)=>{const{width:u,height:f,maxZoom:p}=e.getState(),h=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,m=u/2-a*h,y=f/2-l*h,w=$s.translate(m,y).scale(h);t.transform(po(n,c==null?void 0:c.duration),w)},fitBounds:(a,l)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:m,zoom:y}=O2(a,c,u,f,p,(l==null?void 0:l.padding)??.1),w=$s.translate(h,m).scale(y);t.transform(po(n,l==null?void 0:l.duration),w)},project:a=>{const{transform:l,snapToGrid:c,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),gx(a,l,c,u)},screenToFlowPosition:a=>{const{transform:l,snapToGrid:c,snapGrid:u,domNode:f}=e.getState();if(!f)return a;const{x:p,y:h}=f.getBoundingClientRect(),m={x:a.x-p,y:a.y-h};return gx(m,l,c,u)},flowToScreenPosition:a=>{const{transform:l,domNode:c}=e.getState();if(!c)return a;const{x:u,y:f}=c.getBoundingClientRect(),p=M2(a,l);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:gL,[t,n])};function kc(){const e=wL(),t=Ut(),n=x.useCallback(()=>t.getState().getNodes().map(k=>({...k})),[]),r=x.useCallback(k=>t.getState().nodeInternals.get(k),[]),a=x.useCallback(()=>{const{edges:k=[]}=t.getState();return k.map(S=>({...S}))},[]),l=x.useCallback(k=>{const{edges:S=[]}=t.getState();return S.find(b=>b.id===k)},[]),c=x.useCallback(k=>{const{getNodes:S,setNodes:b,hasDefaultNodes:j,onNodesChange:E}=t.getState(),C=S(),T=typeof k=="function"?k(C):k;if(j)b(T);else if(E){const R=T.length===0?C.map($=>({type:"remove",id:$.id})):T.map($=>({item:$,type:"reset"}));E(R)}},[]),u=x.useCallback(k=>{const{edges:S=[],setEdges:b,hasDefaultEdges:j,onEdgesChange:E}=t.getState(),C=typeof k=="function"?k(S):k;if(j)b(C);else if(E){const T=C.length===0?S.map(R=>({type:"remove",id:R.id})):C.map(R=>({item:R,type:"reset"}));E(T)}},[]),f=x.useCallback(k=>{const S=Array.isArray(k)?k:[k],{getNodes:b,setNodes:j,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const R=[...b(),...S];j(R)}else if(C){const T=S.map(R=>({item:R,type:"add"}));C(T)}},[]),p=x.useCallback(k=>{const S=Array.isArray(k)?k:[k],{edges:b=[],setEdges:j,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)j([...b,...S]);else if(C){const T=S.map(R=>({item:R,type:"add"}));C(T)}},[]),h=x.useCallback(()=>{const{getNodes:k,edges:S=[],transform:b}=t.getState(),[j,E,C]=b;return{nodes:k().map(T=>({...T})),edges:S.map(T=>({...T})),viewport:{x:j,y:E,zoom:C}}},[]),m=x.useCallback(({nodes:k,edges:S})=>{const{nodeInternals:b,getNodes:j,edges:E,hasDefaultNodes:C,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:$,onNodesChange:D,onEdgesChange:U}=t.getState(),P=(k||[]).map(Z=>Z.id),V=(S||[]).map(Z=>Z.id),J=j().reduce((Z,G)=>{const I=G.parentNode||G.parentId,q=!P.includes(G.id)&&I&&Z.find(W=>W.id===I);return(typeof G.deletable=="boolean"?G.deletable:!0)&&(P.includes(G.id)||q)&&Z.push(G),Z},[]),ee=E.filter(Z=>typeof Z.deletable=="boolean"?Z.deletable:!0),M=ee.filter(Z=>V.includes(Z.id));if(J||M){const Z=$2(J,ee),G=[...M,...Z],I=G.reduce((q,H)=>(q.includes(H.id)||q.push(H.id),q),[]);if((T||C)&&(T&&t.setState({edges:E.filter(q=>!I.includes(q.id))}),C&&(J.forEach(q=>{b.delete(q.id)}),t.setState({nodeInternals:new Map(b)}))),I.length>0&&($==null||$(G),U&&U(I.map(q=>({id:q,type:"remove"})))),J.length>0&&(R==null||R(J),D)){const q=J.map(H=>({id:H.id,type:"remove"}));D(q)}}},[]),y=x.useCallback(k=>{const S=D4(k),b=S?null:t.getState().nodeInternals.get(k.id);return!S&&!b?[null,null,S]:[S?k:t1(b),b,S]},[]),w=x.useCallback((k,S=!0,b)=>{const[j,E,C]=y(k);return j?(b||t.getState().getNodes()).filter(T=>{if(!C&&(T.id===E.id||!T.positionAbsolute))return!1;const R=t1(T),$=hx(R,j);return S&&$>0||$>=j.width*j.height}):[]},[]),N=x.useCallback((k,S,b=!0)=>{const[j]=y(k);if(!j)return!1;const E=hx(j,S);return b&&E>0||E>=j.width*j.height},[]);return x.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:a,getEdge:l,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:h,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:N}),[e,n,r,a,l,c,u,f,p,h,m,w,N])}const vL={actInsideInputWithModifier:!1};var xL=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Ut(),{deleteElements:r}=kc(),a=dc(e,vL),l=dc(t);x.useEffect(()=>{if(a){const{edges:c,getNodes:u}=n.getState(),f=u().filter(h=>h.selected),p=c.filter(h=>h.selected);r({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),x.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])};function bL(e){const t=Ut();x.useEffect(()=>{let n;const r=()=>{var l,c;if(!e.current)return;const a=Vx(e.current);(a.height===0||a.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",Ls.error004())),t.setState({width:a.width||500,height:a.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const t0={position:"absolute",width:"100%",height:"100%",top:0,left:0},kL=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,cd=e=>({x:e.x,y:e.y,zoom:e.k}),vi=(e,t)=>e.target.closest(`.${t}`),d1=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),h1=e=>{const t=e.ctrlKey&&Hd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},_L=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),NL=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:a=!0,zoomOnPinch:l=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=go.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:k,zoomActivationKeyCode:S,preventScrolling:b=!0,children:j,noWheelClassName:E,noPanClassName:C})=>{const T=x.useRef(),R=Ut(),$=x.useRef(!1),D=x.useRef(!1),U=x.useRef(null),P=x.useRef({x:0,y:0,zoom:0}),{d3Zoom:V,d3Selection:J,d3ZoomHandler:ee,userSelectionActive:M}=yt(_L,Xt),Z=dc(S),G=x.useRef(0),I=x.useRef(!1),q=x.useRef();return bL(U),x.useEffect(()=>{if(U.current){const H=U.current.getBoundingClientRect(),W=b2().scaleExtent([N,k]).translateExtent(w),L=hr(U.current).call(W),K=$s.translate(y.x,y.y).scale(Di(y.zoom,N,k)),de=[[0,0],[H.width,H.height]],O=W.constrain()(K,de,w);W.transform(L,O),W.wheelDelta(h1),R.setState({d3Zoom:W,d3Selection:L,d3ZoomHandler:L.on("wheel.zoom"),transform:[O.x,O.y,O.k],domNode:U.current.closest(".react-flow")})}},[]),x.useEffect(()=>{J&&V&&(c&&!Z&&!M?J.on("wheel.zoom",H=>{if(vi(H,E))return!1;H.preventDefault(),H.stopImmediatePropagation();const W=J.property("__zoom").k||1;if(H.ctrlKey&&l){const le=Lr(H),pe=h1(H),ye=W*Math.pow(2,pe);V.scaleTo(J,ye,le,H);return}const L=H.deltaMode===1?20:1;let K=f===go.Vertical?0:H.deltaX*L,de=f===go.Horizontal?0:H.deltaY*L;!Hd()&&H.shiftKey&&f!==go.Vertical&&(K=H.deltaY*L,de=0),V.translateBy(J,-(K/W)*u,-(de/W)*u,{internal:!0});const O=cd(J.property("__zoom")),{onViewportChangeStart:Y,onViewportChange:B,onViewportChangeEnd:te}=R.getState();clearTimeout(q.current),I.current||(I.current=!0,t==null||t(H,O),Y==null||Y(O)),I.current&&(e==null||e(H,O),B==null||B(O),q.current=setTimeout(()=>{n==null||n(H,O),te==null||te(O),I.current=!1},150))},{passive:!1}):typeof ee<"u"&&J.on("wheel.zoom",function(H,W){if(!b&&H.type==="wheel"&&!H.ctrlKey||vi(H,E))return null;H.preventDefault(),ee.call(this,H,W)},{passive:!1}))},[M,c,f,J,V,ee,Z,l,b,E,t,e,n]),x.useEffect(()=>{V&&V.on("start",H=>{var K,de;if(!H.sourceEvent||H.sourceEvent.internal)return null;G.current=(K=H.sourceEvent)==null?void 0:K.button;const{onViewportChangeStart:W}=R.getState(),L=cd(H.transform);$.current=!0,P.current=L,((de=H.sourceEvent)==null?void 0:de.type)==="mousedown"&&R.setState({paneDragging:!0}),W==null||W(L),t==null||t(H.sourceEvent,L)})},[V,t]),x.useEffect(()=>{V&&(M&&!$.current?V.on("zoom",null):M||V.on("zoom",H=>{var L;const{onViewportChange:W}=R.getState();if(R.setState({transform:[H.transform.x,H.transform.y,H.transform.k]}),D.current=!!(r&&d1(m,G.current??0)),(e||W)&&!((L=H.sourceEvent)!=null&&L.internal)){const K=cd(H.transform);W==null||W(K),e==null||e(H.sourceEvent,K)}}))},[M,V,e,m,r]),x.useEffect(()=>{V&&V.on("end",H=>{if(!H.sourceEvent||H.sourceEvent.internal)return null;const{onViewportChangeEnd:W}=R.getState();if($.current=!1,R.setState({paneDragging:!1}),r&&d1(m,G.current??0)&&!D.current&&r(H.sourceEvent),D.current=!1,(n||W)&&kL(P.current,H.transform)){const L=cd(H.transform);P.current=L,clearTimeout(T.current),T.current=setTimeout(()=>{W==null||W(L),n==null||n(H.sourceEvent,L)},c?150:0)}})},[V,c,m,n,r]),x.useEffect(()=>{V&&V.filter(H=>{const W=Z||a,L=l&&H.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&H.button===1&&H.type==="mousedown"&&(vi(H,"react-flow__node")||vi(H,"react-flow__edge")))return!0;if(!m&&!W&&!c&&!p&&!l||M||!p&&H.type==="dblclick"||vi(H,E)&&H.type==="wheel"||vi(H,C)&&(H.type!=="wheel"||c&&H.type==="wheel"&&!Z)||!l&&H.ctrlKey&&H.type==="wheel"||!W&&!c&&!L&&H.type==="wheel"||!m&&(H.type==="mousedown"||H.type==="touchstart")||Array.isArray(m)&&!m.includes(H.button)&&H.type==="mousedown")return!1;const K=Array.isArray(m)&&m.includes(H.button)||!H.button||H.button<=1;return(!H.ctrlKey||H.type==="wheel")&&K})},[M,V,a,l,c,p,m,h,Z]),fe.createElement("div",{className:"react-flow__renderer",ref:U,style:t0},j)},SL=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function jL(){const{userSelectionActive:e,userSelectionRect:t}=yt(SL,Xt);return e&&t?fe.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function f1(e,t){const n=t.parentNode||t.parentId,r=e.find(a=>a.id===n);if(r){const a=t.position.x+t.width-r.width,l=t.position.y+t.height-r.height;if(a>0||l>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,a>0&&(r.style.width+=a),l>0&&(r.style.height+=l),t.position.x<0){const c=Math.abs(t.position.x);r.position.x=r.position.x-c,r.style.width+=c,t.position.x=0}if(t.position.y<0){const c=Math.abs(t.position.y);r.position.y=r.position.y-c,r.style.height+=c,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function EL(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,a)=>{const l=e.filter(u=>u.id===a.id);if(l.length===0)return r.push(a),r;const c={...a};for(const u of l)if(u)switch(u.type){case"select":{c.selected=u.selected;break}case"position":{typeof u.position<"u"&&(c.position=u.position),typeof u.positionAbsolute<"u"&&(c.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(c.dragging=u.dragging),c.expandParent&&f1(r,c);break}case"dimensions":{typeof u.dimensions<"u"&&(c.width=u.dimensions.width,c.height=u.dimensions.height),typeof u.updateStyle<"u"&&(c.style={...c.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(c.resizing=u.resizing),c.expandParent&&f1(r,c);break}case"remove":return r}return r.push(c),r},n)}function CL(e,t){return EL(e,t)}const ga=(e,t)=>({id:e,type:"select",selected:t});function Ei(e,t){return e.reduce((n,r)=>{const a=t.includes(r.id);return!r.selected&&a?(r.selected=!0,n.push(ga(r.id,!0))):r.selected&&!a&&(r.selected=!1,n.push(ga(r.id,!1))),n},[])}const yp=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},TL=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Z2=x.memo(({isSelecting:e,selectionMode:t=uc.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:m})=>{const y=x.useRef(null),w=Ut(),N=x.useRef(0),k=x.useRef(0),S=x.useRef(),{userSelectionActive:b,elementsSelectable:j,dragging:E}=yt(TL,Xt),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,k.current=0},T=ee=>{l==null||l(ee),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=ee=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){ee.preventDefault();return}c==null||c(ee)},$=u?ee=>u(ee):void 0,D=ee=>{const{resetSelectedElements:M,domNode:Z}=w.getState();if(S.current=Z==null?void 0:Z.getBoundingClientRect(),!j||!e||ee.button!==0||ee.target!==y.current||!S.current)return;const{x:G,y:I}=ba(ee,S.current);M(),w.setState({userSelectionRect:{width:0,height:0,startX:G,startY:I,x:G,y:I}}),r==null||r(ee)},U=ee=>{const{userSelectionRect:M,nodeInternals:Z,edges:G,transform:I,onNodesChange:q,onEdgesChange:H,nodeOrigin:W,getNodes:L}=w.getState();if(!e||!S.current||!M)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const K=ba(ee,S.current),de=M.startX??0,O=M.startY??0,Y={...M,x:K.x<de?K.x:de,y:K.y<O?K.y:O,width:Math.abs(K.x-de),height:Math.abs(K.y-O)},B=L(),te=I2(Z,Y,I,t===uc.Partial,!0,W),le=$2(te,G).map(ye=>ye.id),pe=te.map(ye=>ye.id);if(N.current!==pe.length){N.current=pe.length;const ye=Ei(B,pe);ye.length&&(q==null||q(ye))}if(k.current!==le.length){k.current=le.length;const ye=Ei(G,le);ye.length&&(H==null||H(ye))}w.setState({userSelectionRect:Y})},P=ee=>{if(ee.button!==0)return;const{userSelectionRect:M}=w.getState();!b&&M&&ee.target===y.current&&(T==null||T(ee)),w.setState({nodesSelectionActive:N.current>0}),C(),a==null||a(ee)},V=ee=>{b&&(w.setState({nodesSelectionActive:N.current>0}),a==null||a(ee)),C()},J=j&&(e||b);return fe.createElement("div",{className:fn(["react-flow__pane",{dragging:E,selection:e}]),onClick:J?void 0:yp(T,y),onContextMenu:yp(R,y),onWheel:yp($,y),onMouseEnter:J?void 0:f,onMouseDown:J?D:void 0,onMouseMove:J?U:p,onMouseUp:J?P:void 0,onMouseLeave:J?V:h,ref:y,style:t0},m,fe.createElement(jL,null))});Z2.displayName="Pane";function Q2(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:Q2(r,t):!1}function p1(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function AL(e,t,n,r){return Array.from(e.values()).filter(a=>(a.selected||a.id===r)&&(!a.parentNode||a.parentId||!Q2(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var l,c;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((l=a.positionAbsolute)==null?void 0:l.x)??0),y:n.y-(((c=a.positionAbsolute)==null?void 0:c.y)??0)},delta:{x:0,y:0},extent:a.extent,parentNode:a.parentNode||a.parentId,parentId:a.parentNode||a.parentId,width:a.width,height:a.height,expandParent:a.expandParent}})}function RL(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function J2(e,t,n,r,a=[0,0],l){const c=RL(e,e.extent||r);let u=c;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const m=n.get(f),{x:y,y:w}=wo(m,a).positionAbsolute;u=m&&fr(y)&&fr(w)&&fr(m.width)&&fr(m.height)?[[y+e.width*a[0],w+e.height*a[1]],[y+m.width-e.width+e.width*a[0],w+m.height-e.height+e.height*a[1]]]:u}else l==null||l("005",Ls.error005()),u=c;else if(e.extent&&f&&e.extent!=="parent"){const m=n.get(f),{x:y,y:w}=wo(m,a).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(f){const m=n.get(f);p=wo(m,a).positionAbsolute}const h=u&&u!=="parent"?Gx(t,u):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function wp({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(a=>({...n.get(a.id),position:a.position,positionAbsolute:a.positionAbsolute}));return[e?r.find(a=>a.id===e):r[0],r]}const m1=(e,t,n,r)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const l=Array.from(a),c=t.getBoundingClientRect(),u={x:c.width*r[0],y:c.height*r[1]};return l.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-c.left-u.x)/n,y:(p.top-c.top-u.y)/n,...Vx(f)}})};function zl(e,t,n){return n===void 0?n:r=>{const a=t().nodeInternals.get(e);a&&n(r,{...a})}}function wx({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:c,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f==null||f("012",Ls.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=r==null?void 0:r.current)==null?void 0:h.blur()})):a([e])}function ML(){const e=Ut();return x.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:a,snapToGrid:l}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,f={x:(c-r[0])/r[2],y:(u-r[1])/r[2]};return{xSnapped:l?a[0]*Math.round(f.x/a[0]):f.x,ySnapped:l?a[1]*Math.round(f.y/a[1]):f.y,...f}},[])}function vp(e){return(t,n,r)=>e==null?void 0:e(t,r)}function eA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,selectNodesOnDrag:c}){const u=Ut(),[f,p]=x.useState(!1),h=x.useRef([]),m=x.useRef({x:null,y:null}),y=x.useRef(0),w=x.useRef(null),N=x.useRef({x:0,y:0}),k=x.useRef(null),S=x.useRef(!1),b=x.useRef(!1),j=x.useRef(!1),E=ML();return x.useEffect(()=>{if(e!=null&&e.current){const C=hr(e.current),T=({x:D,y:U})=>{const{nodeInternals:P,onNodeDrag:V,onSelectionDrag:J,updateNodePositions:ee,nodeExtent:M,snapGrid:Z,snapToGrid:G,nodeOrigin:I,onError:q}=u.getState();m.current={x:D,y:U};let H=!1,W={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&M){const K=mh(h.current,I);W=cc(K)}if(h.current=h.current.map(K=>{const de={x:D-K.distance.x,y:U-K.distance.y};G&&(de.x=Z[0]*Math.round(de.x/Z[0]),de.y=Z[1]*Math.round(de.y/Z[1]));const O=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];h.current.length>1&&M&&!K.extent&&(O[0][0]=K.positionAbsolute.x-W.x+M[0][0],O[1][0]=K.positionAbsolute.x+(K.width??0)-W.x2+M[1][0],O[0][1]=K.positionAbsolute.y-W.y+M[0][1],O[1][1]=K.positionAbsolute.y+(K.height??0)-W.y2+M[1][1]);const Y=J2(K,de,P,O,I,q);return H=H||K.position.x!==Y.position.x||K.position.y!==Y.position.y,K.position=Y.position,K.positionAbsolute=Y.positionAbsolute,K}),!H)return;ee(h.current,!0,!0),p(!0);const L=a?V:vp(J);if(L&&k.current){const[K,de]=wp({nodeId:a,dragItems:h.current,nodeInternals:P});L(k.current,K,de)}},R=()=>{if(!w.current)return;const[D,U]=_2(N.current,w.current);if(D!==0||U!==0){const{transform:P,panBy:V}=u.getState();m.current.x=(m.current.x??0)-D/P[2],m.current.y=(m.current.y??0)-U/P[2],V({x:D,y:U})&&T(m.current)}y.current=requestAnimationFrame(R)},$=D=>{var I;const{nodeInternals:U,multiSelectionActive:P,nodesDraggable:V,unselectNodesAndEdges:J,onNodeDragStart:ee,onSelectionDragStart:M}=u.getState();b.current=!0;const Z=a?ee:vp(M);(!c||!l)&&!P&&a&&((I=U.get(a))!=null&&I.selected||J()),a&&l&&c&&wx({id:a,store:u,nodeRef:e});const G=E(D);if(m.current=G,h.current=AL(U,V,G,a),Z&&h.current){const[q,H]=wp({nodeId:a,dragItems:h.current,nodeInternals:U});Z(D.sourceEvent,q,H)}};if(t)C.on(".drag",null);else{const D=z3().on("start",U=>{const{domNode:P,nodeDragThreshold:V}=u.getState();V===0&&$(U),j.current=!1;const J=E(U);m.current=J,w.current=(P==null?void 0:P.getBoundingClientRect())||null,N.current=ba(U.sourceEvent,w.current)}).on("drag",U=>{var ee,M;const P=E(U),{autoPanOnNodeDrag:V,nodeDragThreshold:J}=u.getState();if(U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1&&(j.current=!0),!j.current){if(!S.current&&b.current&&V&&(S.current=!0,R()),!b.current){const Z=P.xSnapped-(((ee=m==null?void 0:m.current)==null?void 0:ee.x)??0),G=P.ySnapped-(((M=m==null?void 0:m.current)==null?void 0:M.y)??0);Math.sqrt(Z*Z+G*G)>J&&$(U)}(m.current.x!==P.xSnapped||m.current.y!==P.ySnapped)&&h.current&&b.current&&(k.current=U.sourceEvent,N.current=ba(U.sourceEvent,w.current),T(P))}}).on("end",U=>{if(!(!b.current||j.current)&&(p(!1),S.current=!1,b.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:P,nodeInternals:V,onNodeDragStop:J,onSelectionDragStop:ee}=u.getState(),M=a?J:vp(ee);if(P(h.current,!1,!1),M){const[Z,G]=wp({nodeId:a,dragItems:h.current,nodeInternals:V});M(U.sourceEvent,Z,G)}}}).filter(U=>{const P=U.target;return!U.button&&(!n||!p1(P,`.${n}`,e))&&(!r||p1(P,r,e))});return C.call(D),()=>{C.on(".drag",null)}}}},[e,t,n,r,l,u,a,c,E]),f}function tA(){const e=Ut();return x.useCallback(n=>{const{nodeInternals:r,nodeExtent:a,updateNodePositions:l,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),m=c().filter(j=>j.selected&&(j.draggable||h&&typeof j.draggable>"u")),y=u?f[0]:5,w=u?f[1]:5,N=n.isShiftPressed?4:1,k=n.x*y*N,S=n.y*w*N,b=m.map(j=>{if(j.positionAbsolute){const E={x:j.positionAbsolute.x+k,y:j.positionAbsolute.y+S};u&&(E.x=f[0]*Math.round(E.x/f[0]),E.y=f[1]*Math.round(E.y/f[1]));const{positionAbsolute:C,position:T}=J2(j,E,r,a,void 0,p);j.position=T,j.positionAbsolute=C}return j});l(b,!0,!1)},[])}const Ii={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Hl=e=>{const t=({id:n,type:r,data:a,xPos:l,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:k,style:S,className:b,isDraggable:j,isSelectable:E,isConnectable:C,isFocusable:T,selectNodesOnDrag:R,sourcePosition:$,targetPosition:D,hidden:U,resizeObserver:P,dragHandle:V,zIndex:J,isParent:ee,noDragClassName:M,noPanClassName:Z,initialized:G,disableKeyboardA11y:I,ariaLabel:q,rfId:H,hasHandleBounds:W})=>{const L=Ut(),K=x.useRef(null),de=x.useRef(null),O=x.useRef($),Y=x.useRef(D),B=x.useRef(r),te=E||j||h||m||y||w,le=tA(),pe=zl(n,L.getState,m),ye=zl(n,L.getState,y),Ie=zl(n,L.getState,w),Te=zl(n,L.getState,N),Re=zl(n,L.getState,k),Me=Ne=>{const{nodeDragThreshold:_e}=L.getState();if(E&&(!R||!j||_e>0)&&wx({id:n,store:L,nodeRef:K}),h){const Ze=L.getState().nodeInternals.get(n);Ze&&h(Ne,{...Ze})}},xe=Ne=>{if(!fx(Ne)&&!I)if(E2.includes(Ne.key)&&E){const _e=Ne.key==="Escape";wx({id:n,store:L,unselect:_e,nodeRef:K})}else j&&p&&Object.prototype.hasOwnProperty.call(Ii,Ne.key)&&(L.setState({ariaLiveMessage:`Moved selected node ${Ne.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~c}`}),le({x:Ii[Ne.key].x,y:Ii[Ne.key].y,isShiftPressed:Ne.shiftKey}))};x.useEffect(()=>()=>{de.current&&(P==null||P.unobserve(de.current),de.current=null)},[]),x.useEffect(()=>{if(K.current&&!U){const Ne=K.current;(!G||!W||de.current!==Ne)&&(de.current&&(P==null||P.unobserve(de.current)),P==null||P.observe(Ne),de.current=Ne)}},[U,G,W]),x.useEffect(()=>{const Ne=B.current!==r,_e=O.current!==$,Ze=Y.current!==D;K.current&&(Ne||_e||Ze)&&(Ne&&(B.current=r),_e&&(O.current=$),Ze&&(Y.current=D),L.getState().updateNodeDimensions([{id:n,nodeElement:K.current,forceUpdate:!0}]))},[n,r,$,D]);const He=eA({nodeRef:K,disabled:U||!j,noDragClassName:M,handleSelector:V,nodeId:n,isSelectable:E,selectNodesOnDrag:R});return U?null:fe.createElement("div",{className:fn(["react-flow__node",`react-flow__node-${r}`,{[Z]:j},b,{selected:p,selectable:E,parent:ee,dragging:He}]),ref:K,style:{zIndex:J,transform:`translate(${u}px,${f}px)`,pointerEvents:te?"all":"none",visibility:G?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:pe,onMouseMove:ye,onMouseLeave:Ie,onContextMenu:Te,onClick:Me,onDoubleClick:Re,onKeyDown:T?xe:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":I?void 0:`${V2}-${H}`,"aria-label":q},fe.createElement(W4,{value:n},fe.createElement(e,{id:n,data:a,type:r,xPos:l,yPos:c,selected:p,isConnectable:C,sourcePosition:$,targetPosition:D,dragging:He,dragHandle:V,zIndex:J})))};return t.displayName="NodeWrapper",x.memo(t)};const IL=e=>{const t=e.getNodes().filter(n=>n.selected);return{...mh(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function $L({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ut(),{width:a,height:l,x:c,y:u,transformString:f,userSelectionActive:p}=yt(IL,Xt),h=tA(),m=x.useRef(null);if(x.useEffect(()=>{var N;n||(N=m.current)==null||N.focus({preventScroll:!0})},[n]),eA({nodeRef:m}),p||!a||!l)return null;const y=e?N=>{const k=r.getState().getNodes().filter(S=>S.selected);e(N,k)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Ii,N.key)&&h({x:Ii[N.key].x,y:Ii[N.key].y,isShiftPressed:N.shiftKey})};return fe.createElement("div",{className:fn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},fe.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:a,height:l,top:u,left:c}}))}var OL=x.memo($L);const LL=e=>e.nodesSelectionActive,nA=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:k,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:j,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:$,panOnScrollMode:D,zoomOnDoubleClick:U,panOnDrag:P,defaultViewport:V,translateExtent:J,minZoom:ee,maxZoom:M,preventScrolling:Z,onSelectionContextMenu:G,noWheelClassName:I,noPanClassName:q,disableKeyboardA11y:H})=>{const W=yt(LL),L=dc(m),K=dc(b),de=K||P,O=K||R,Y=L||y&&de!==!0;return xL({deleteKeyCode:u,multiSelectionKeyCode:S}),fe.createElement(NL,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:O,panOnScrollSpeed:$,panOnScrollMode:D,zoomOnDoubleClick:U,panOnDrag:!L&&de,defaultViewport:V,translateExtent:J,minZoom:ee,maxZoom:M,zoomActivationKeyCode:j,preventScrolling:Z,noWheelClassName:I,noPanClassName:q},fe.createElement(Z2,{onSelectionStart:N,onSelectionEnd:k,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:de,isSelecting:!!Y,selectionMode:w},e,W&&fe.createElement(OL,{onSelectionContextMenu:G,noPanClassName:q,disableKeyboardA11y:H})))};nA.displayName="FlowRenderer";var PL=x.memo(nA);function DL(e){return yt(x.useCallback(n=>e?I2(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function qL(e){const t={input:Hl(e.input||z2),default:Hl(e.default||yx),output:Hl(e.output||U2),group:Hl(e.group||e0)},n={},r=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,l)=>(a[l]=Hl(e[l]||yx),a),n);return{...t,...r}}const FL=({x:e,y:t,width:n,height:r,origin:a})=>!n||!r?{x:e,y:t}:a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:e,y:t}:{x:e-n*a[0],y:t-r*a[1]},BL=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),rA=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,updateNodeDimensions:l,onError:c}=yt(BL,Xt),u=DL(e.onlyRenderVisibleElements),f=x.useRef(),p=x.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));l(y)});return f.current=h,h},[]);return x.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),fe.createElement("div",{className:"react-flow__nodes",style:t0},u.map(h=>{var T,R,$;let m=h.type||"default";e.nodeTypes[m]||(c==null||c("003",Ls.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),N=!!(h.selectable||a&&typeof h.selectable>"u"),k=!!(h.connectable||n&&typeof h.connectable>"u"),S=!!(h.focusable||r&&typeof h.focusable>"u"),b=e.nodeExtent?Gx(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,j=(b==null?void 0:b.x)??0,E=(b==null?void 0:b.y)??0,C=FL({x:j,y:E,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return fe.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||We.Bottom,targetPosition:h.targetPosition||We.Top,hidden:h.hidden,xPos:j,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:w,isSelectable:N,isConnectable:k,isFocusable:S,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((T=h[Pt])==null?void 0:T.z)??0,isParent:!!((R=h[Pt])!=null&&R.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!(($=h[Pt])!=null&&$.handleBounds)})}))};rA.displayName="NodeRenderer";var zL=x.memo(rA);const HL=(e,t,n)=>n===We.Left?e-t:n===We.Right?e+t:e,UL=(e,t,n)=>n===We.Top?e-t:n===We.Bottom?e+t:e,g1="react-flow__edgeupdater",y1=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:c,type:u})=>fe.createElement("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:c,className:fn([g1,`${g1}-${u}`]),cx:HL(t,r,e),cy:UL(n,r,e),r,stroke:"transparent",fill:"transparent"}),WL=()=>!0;var xi=e=>{const t=({id:n,className:r,type:a,data:l,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:k,style:S,source:b,target:j,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:$,targetPosition:D,elementsSelectable:U,hidden:P,sourceHandleId:V,targetHandleId:J,onContextMenu:ee,onMouseEnter:M,onMouseMove:Z,onMouseLeave:G,reconnectRadius:I,onReconnect:q,onReconnectStart:H,onReconnectEnd:W,markerEnd:L,markerStart:K,rfId:de,ariaLabel:O,isFocusable:Y,isReconnectable:B,pathOptions:te,interactionWidth:le,disableKeyboardA11y:pe})=>{const ye=x.useRef(null),[Ie,Te]=x.useState(!1),[Re,Me]=x.useState(!1),xe=Ut(),He=x.useMemo(()=>`url('#${mx(K,de)}')`,[K,de]),Ne=x.useMemo(()=>`url('#${mx(L,de)}')`,[L,de]);if(P)return null;const _e=nt=>{var xt;const{edges:at,addSelectedEdges:he,unselectNodesAndEdges:rt,multiSelectionActive:ot}=xe.getState(),jt=at.find(wt=>wt.id===n);jt&&(U&&(xe.setState({nodesSelectionActive:!1}),jt.selected&&ot?(rt({nodes:[],edges:[jt]}),(xt=ye.current)==null||xt.blur()):he([n])),c&&c(nt,jt))},Ze=Bl(n,xe.getState,u),ct=Bl(n,xe.getState,ee),Ke=Bl(n,xe.getState,M),ce=Bl(n,xe.getState,Z),je=Bl(n,xe.getState,G),$e=(nt,at)=>{if(nt.button!==0)return;const{edges:he,isValidConnection:rt}=xe.getState(),ot=at?j:b,jt=(at?J:V)||null,xt=at?"target":"source",wt=rt||WL,kn=at,Zt=he.find(ht=>ht.id===n);Me(!0),H==null||H(nt,Zt,xt);const me=ht=>{Me(!1),W==null||W(ht,Zt,xt)};D2({event:nt,handleId:jt,nodeId:ot,onConnect:ht=>q==null?void 0:q(Zt,ht),isTarget:kn,getState:xe.getState,setState:xe.setState,isValidConnection:wt,edgeUpdaterType:xt,onReconnectEnd:me})},Je=nt=>$e(nt,!0),qe=nt=>$e(nt,!1),pt=()=>Te(!0),ge=()=>Te(!1),be=!U&&!c,Ve=nt=>{var at;if(!pe&&E2.includes(nt.key)&&U){const{unselectNodesAndEdges:he,addSelectedEdges:rt,edges:ot}=xe.getState();nt.key==="Escape"?((at=ye.current)==null||at.blur(),he({edges:[ot.find(xt=>xt.id===n)]})):rt([n])}};return fe.createElement("g",{className:fn(["react-flow__edge",`react-flow__edge-${a}`,r,{selected:f,animated:p,inactive:be,updating:Ie}]),onClick:_e,onDoubleClick:Ze,onContextMenu:ct,onMouseEnter:Ke,onMouseMove:ce,onMouseLeave:je,onKeyDown:Y?Ve:void 0,tabIndex:Y?0:void 0,role:Y?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":O===null?void 0:O||`Edge from ${b} to ${j}`,"aria-describedby":Y?`${G2}-${de}`:void 0,ref:ye},!Re&&fe.createElement(e,{id:n,source:b,target:j,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:k,data:l,style:S,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:$,targetPosition:D,sourceHandleId:V,targetHandleId:J,markerStart:He,markerEnd:Ne,pathOptions:te,interactionWidth:le}),B&&fe.createElement(fe.Fragment,null,(B==="source"||B===!0)&&fe.createElement(y1,{position:$,centerX:E,centerY:C,radius:I,onMouseDown:Je,onMouseEnter:pt,onMouseOut:ge,type:"source"}),(B==="target"||B===!0)&&fe.createElement(y1,{position:D,centerX:T,centerY:R,radius:I,onMouseDown:qe,onMouseEnter:pt,onMouseOut:ge,type:"target"})))};return t.displayName="EdgeWrapper",x.memo(t)};function VL(e){const t={default:xi(e.default||Wd),straight:xi(e.bezier||Xx),step:xi(e.step||Yx),smoothstep:xi(e.step||ph),simplebezier:xi(e.simplebezier||Kx)},n={},r=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,l)=>(a[l]=xi(e[l]||Wd),a),n);return{...t,...r}}function w1(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,a=((n==null?void 0:n.y)||0)+t.y,l=(n==null?void 0:n.width)||t.width,c=(n==null?void 0:n.height)||t.height;switch(e){case We.Top:return{x:r+l/2,y:a};case We.Right:return{x:r+l,y:a+c/2};case We.Bottom:return{x:r+l/2,y:a+c};case We.Left:return{x:r,y:a+c/2}}}function v1(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const GL=(e,t,n,r,a,l)=>{const c=w1(n,e,t),u=w1(l,r,a);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function KL({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:a,targetHeight:l,width:c,height:u,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+r,t.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=cc({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:c/f[2],height:u/f[2]}),m=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),y=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(m*y)>0}function x1(e){var r,a,l,c,u;const t=((r=e==null?void 0:e[Pt])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)<"u"&&typeof((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const YL=[{level:0,isMaxLevel:!0,edges:[]}];function XL(e,t,n=!1){let r=-1;const a=e.reduce((c,u)=>{var h,m;const f=fr(u.zIndex);let p=f?u.zIndex:0;if(n){const y=t.get(u.target),w=t.get(u.source),N=u.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),k=Math.max(((h=w==null?void 0:w[Pt])==null?void 0:h.z)||0,((m=y==null?void 0:y[Pt])==null?void 0:m.z)||0,1e3);p=(f?u.zIndex:0)+(N?k:0)}return c[p]?c[p].push(u):c[p]=[u],r=p>r?p:r,c},{}),l=Object.entries(a).map(([c,u])=>{const f=+c;return{edges:u,level:f,isMaxLevel:f===r}});return l.length===0?YL:l}function ZL(e,t,n){const r=yt(x.useCallback(a=>e?a.edges.filter(l=>{const c=t.get(l.source),u=t.get(l.target);return(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&KL({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:u.width,targetHeight:u.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return XL(r,t,n)}const QL=({color:e="none",strokeWidth:t=1})=>fe.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),JL=({color:e="none",strokeWidth:t=1})=>fe.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),b1={[Ud.Arrow]:QL,[Ud.ArrowClosed]:JL};function eP(e){const t=Ut();return x.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(b1,e)?b1[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",Ls.error009(e)),null)},[e])}const tP=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=eP(t);return f?fe.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:u,refX:"0",refY:"0"},fe.createElement(f,{color:n,strokeWidth:c})):null},nP=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=mx(c,t);r.includes(u)||(a.push({id:u,color:c.color||e,...c}),r.push(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))},sA=({defaultColor:e,rfId:t})=>{const n=yt(x.useCallback(nP({defaultColor:e,rfId:t}),[e,t]),(r,a)=>!(r.length!==a.length||r.some((l,c)=>l.id!==a[c].id)));return fe.createElement("defs",null,n.map(r=>fe.createElement(tP,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};sA.displayName="MarkerDefinitions";var rP=x.memo(sA);const sP=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),aA=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:a,noPanClassName:l,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:k,children:S,disableKeyboardA11y:b})=>{const{edgesFocusable:j,edgesUpdatable:E,elementsSelectable:C,width:T,height:R,connectionMode:$,nodeInternals:D,onError:U}=yt(sP,Xt),P=ZL(t,D,n);return T?fe.createElement(fe.Fragment,null,P.map(({level:V,edges:J,isMaxLevel:ee})=>fe.createElement("svg",{key:V,style:{zIndex:V},width:T,height:R,className:"react-flow__edges react-flow__container"},ee&&fe.createElement(rP,{defaultColor:e,rfId:r}),fe.createElement("g",null,J.map(M=>{const[Z,G,I]=x1(D.get(M.source)),[q,H,W]=x1(D.get(M.target));if(!I||!W)return null;let L=M.type||"default";a[L]||(U==null||U("011",Ls.error011(L)),L="default");const K=a[L]||a.default,de=$===bo.Strict?H.target:(H.target??[]).concat(H.source??[]),O=v1(G.source,M.sourceHandle),Y=v1(de,M.targetHandle),B=(O==null?void 0:O.position)||We.Bottom,te=(Y==null?void 0:Y.position)||We.Top,le=!!(M.focusable||j&&typeof M.focusable>"u"),pe=M.reconnectable||M.updatable,ye=typeof y<"u"&&(pe||E&&typeof pe>"u");if(!O||!Y)return U==null||U("008",Ls.error008(O,M)),null;const{sourceX:Ie,sourceY:Te,targetX:Re,targetY:Me}=GL(Z,O,B,q,Y,te);return fe.createElement(K,{key:M.id,id:M.id,className:fn([M.className,l]),type:L,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:Ie,sourceY:Te,targetX:Re,targetY:Me,sourcePosition:B,targetPosition:te,elementsSelectable:C,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:k,rfId:r,ariaLabel:M.ariaLabel,isFocusable:le,isReconnectable:ye,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:b})})))),S):null};aA.displayName="EdgeRenderer";var aP=x.memo(aA);const oP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function iP({children:e}){const t=yt(oP);return fe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function lP(e){const t=kc(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const cP={[We.Left]:We.Right,[We.Right]:We.Left,[We.Top]:We.Bottom,[We.Bottom]:We.Top},oA=({nodeId:e,handleType:t,style:n,type:r=ya.Bezier,CustomComponent:a,connectionStatus:l})=>{var R,$,D;const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:h}=yt(x.useCallback(U=>({fromNode:U.nodeInternals.get(e),handleId:U.connectionHandleId,toX:(U.connectionPosition.x-U.transform[0])/U.transform[2],toY:(U.connectionPosition.y-U.transform[1])/U.transform[2],connectionMode:U.connectionMode}),[e]),Xt),m=(R=c==null?void 0:c[Pt])==null?void 0:R.handleBounds;let y=m==null?void 0:m[t];if(h===bo.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const w=u?y.find(U=>U.id===u):y[0],N=w?w.x+w.width/2:(c.width??0)/2,k=w?w.y+w.height/2:c.height??0,S=((($=c.positionAbsolute)==null?void 0:$.x)??0)+N,b=(((D=c.positionAbsolute)==null?void 0:D.y)??0)+k,j=w==null?void 0:w.position,E=j?cP[j]:null;if(!j||!E)return null;if(a)return fe.createElement(a,{connectionLineType:r,connectionLineStyle:n,fromNode:c,fromHandle:w,fromX:S,fromY:b,toX:f,toY:p,fromPosition:j,toPosition:E,connectionStatus:l});let C="";const T={sourceX:S,sourceY:b,sourcePosition:j,targetX:f,targetY:p,targetPosition:E};return r===ya.Bezier?[C]=Zx(T):r===ya.Step?[C]=px({...T,borderRadius:0}):r===ya.SmoothStep?[C]=px(T):r===ya.SimpleBezier?[C]=R2(T):C=`M${S},${b} ${f},${p}`,fe.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};oA.displayName="ConnectionLine";const uP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function dP({containerStyle:e,style:t,type:n,component:r}){const{nodeId:a,handleType:l,nodesConnectable:c,width:u,height:f,connectionStatus:p}=yt(uP,Xt);return!(a&&l&&u&&c)?null:fe.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},fe.createElement("g",{className:fn(["react-flow__connection",p])},fe.createElement(oA,{nodeId:a,handleType:l,style:t,type:n,CustomComponent:r,connectionStatus:p})))}function k1(e,t){return x.useRef(null),Ut(),x.useMemo(()=>t(e),[e])}const iA=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:a,onInit:l,onNodeClick:c,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:k,onSelectionEnd:S,connectionLineType:b,connectionLineStyle:j,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:R,selectionMode:$,multiSelectionKeyCode:D,panActivationKeyCode:U,zoomActivationKeyCode:P,deleteKeyCode:V,onlyRenderVisibleElements:J,elementsSelectable:ee,selectNodesOnDrag:M,defaultViewport:Z,translateExtent:G,minZoom:I,maxZoom:q,preventScrolling:H,defaultMarkerColor:W,zoomOnScroll:L,zoomOnPinch:K,panOnScroll:de,panOnScrollSpeed:O,panOnScrollMode:Y,zoomOnDoubleClick:B,panOnDrag:te,onPaneClick:le,onPaneMouseEnter:pe,onPaneMouseMove:ye,onPaneMouseLeave:Ie,onPaneScroll:Te,onPaneContextMenu:Re,onEdgeContextMenu:Me,onEdgeMouseEnter:xe,onEdgeMouseMove:He,onEdgeMouseLeave:Ne,onReconnect:_e,onReconnectStart:Ze,onReconnectEnd:ct,reconnectRadius:Ke,noDragClassName:ce,noWheelClassName:je,noPanClassName:$e,elevateEdgesOnSelect:Je,disableKeyboardA11y:qe,nodeOrigin:pt,nodeExtent:ge,rfId:be})=>{const Ve=k1(e,qL),nt=k1(t,VL);return lP(l),fe.createElement(PL,{onPaneClick:le,onPaneMouseEnter:pe,onPaneMouseMove:ye,onPaneMouseLeave:Ie,onPaneContextMenu:Re,onPaneScroll:Te,deleteKeyCode:V,selectionKeyCode:T,selectionOnDrag:R,selectionMode:$,onSelectionStart:k,onSelectionEnd:S,multiSelectionKeyCode:D,panActivationKeyCode:U,zoomActivationKeyCode:P,elementsSelectable:ee,onMove:n,onMoveStart:r,onMoveEnd:a,zoomOnScroll:L,zoomOnPinch:K,zoomOnDoubleClick:B,panOnScroll:de,panOnScrollSpeed:O,panOnScrollMode:Y,panOnDrag:te,defaultViewport:Z,translateExtent:G,minZoom:I,maxZoom:q,onSelectionContextMenu:N,preventScrolling:H,noDragClassName:ce,noWheelClassName:je,noPanClassName:$e,disableKeyboardA11y:qe},fe.createElement(iP,null,fe.createElement(aP,{edgeTypes:nt,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:J,onEdgeContextMenu:Me,onEdgeMouseEnter:xe,onEdgeMouseMove:He,onEdgeMouseLeave:Ne,onReconnect:_e,onReconnectStart:Ze,onReconnectEnd:ct,reconnectRadius:Ke,defaultMarkerColor:W,noPanClassName:$e,elevateEdgesOnSelect:!!Je,disableKeyboardA11y:qe,rfId:be},fe.createElement(dP,{style:j,type:b,component:E,containerStyle:C})),fe.createElement("div",{className:"react-flow__edgelabel-renderer"}),fe.createElement(zL,{nodeTypes:Ve,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:M,onlyRenderVisibleElements:J,noPanClassName:$e,noDragClassName:ce,disableKeyboardA11y:qe,nodeOrigin:pt,nodeExtent:ge,rfId:be})))};iA.displayName="GraphView";var hP=x.memo(iA);const vx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ha={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:vx,nodeExtent:vx,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:bo.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:q4,isValidConnection:void 0},fP=()=>e$((e,t)=>({...ha,setNodes:n=>{const{nodeInternals:r,nodeOrigin:a,elevateNodesOnSelect:l}=t();e({nodeInternals:gp(n,r,a,l)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(a=>({...r,...a}))})},setDefaultNodesAndEdges:(n,r)=>{const a=typeof n<"u",l=typeof r<"u",c=a?gp(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:l?r:[],hasDefaultNodes:a,hasDefaultEdges:l})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:a,fitViewOnInit:l,fitViewOnInitDone:c,fitViewOnInitOptions:u,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=n.reduce((k,S)=>{const b=a.get(S.id);if(b!=null&&b.hidden)a.set(b.id,{...b,[Pt]:{...b[Pt],handleBounds:void 0}});else if(b){const j=Vx(S.nodeElement);!!(j.width&&j.height&&(b.width!==j.width||b.height!==j.height||S.forceUpdate))&&(a.set(b.id,{...b,[Pt]:{...b[Pt],handleBounds:{source:m1(".source",S.nodeElement,y,p),target:m1(".target",S.nodeElement,y,p)}},...j}),k.push({id:b.id,type:"dimensions",dimensions:j}))}return k},[]);Y2(a,p);const N=c||l&&!c&&X2(t,{initial:!0,...u});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(r==null||r(w))},updateNodePositions:(n,r=!0,a=!1)=>{const{triggerNodeChanges:l}=t(),c=n.map(u=>{const f={id:u.id,type:"position",dragging:a};return r&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});l(c)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:a,hasDefaultNodes:l,nodeOrigin:c,getNodes:u,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(l){const p=CL(n,u()),h=gp(p,a,c,f);e({nodeInternals:h})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:a,getNodes:l}=t();let c,u=null;r?c=n.map(f=>ga(f,!0)):(c=Ei(l(),n),u=Ei(a,[])),ld({changedNodes:c,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:a,getNodes:l}=t();let c,u=null;r?c=n.map(f=>ga(f,!0)):(c=Ei(a,n),u=Ei(l(),[])),ld({changedNodes:u,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:a,getNodes:l}=t(),c=n||l(),u=r||a,f=c.map(h=>(h.selected=!1,ga(h.id,!1))),p=u.map(h=>ga(h.id,!1));ld({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:a}=t();r==null||r.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:a}=t();r==null||r.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),l=r().filter(u=>u.selected).map(u=>ga(u.id,!1)),c=n.filter(u=>u.selected).map(u=>ga(u.id,!1));ld({changedNodes:l,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(a=>{a.positionAbsolute=Gx(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:a,height:l,d3Zoom:c,d3Selection:u,translateExtent:f}=t();if(!c||!u||!n.x&&!n.y)return!1;const p=$s.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),h=[[0,0],[a,l]],m=c==null?void 0:c.constrain()(p,h,f);return c.transform(u,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>e({connectionNodeId:ha.connectionNodeId,connectionHandleId:ha.connectionHandleId,connectionHandleType:ha.connectionHandleType,connectionStatus:ha.connectionStatus,connectionStartHandle:ha.connectionStartHandle,connectionEndHandle:ha.connectionEndHandle}),reset:()=>e({...ha})}),Object.is),n0=({children:e})=>{const t=x.useRef(null);return t.current||(t.current=fP()),fe.createElement(M4,{value:t.current},e)};n0.displayName="ReactFlowProvider";const lA=({children:e})=>x.useContext(fh)?fe.createElement(fe.Fragment,null,e):fe.createElement(n0,null,e);lA.displayName="ReactFlowWrapper";const pP={input:z2,default:yx,output:U2,group:e0},mP={default:Wd,straight:Xx,step:Yx,smoothstep:ph,simplebezier:Kx},gP=[0,0],yP=[15,15],wP={x:0,y:0,zoom:1},vP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},cA=x.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l=pP,edgeTypes:c=mP,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:k,onClickConnectStart:S,onClickConnectEnd:b,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:$,onNodeDrag:D,onNodeDragStop:U,onNodesDelete:P,onEdgesDelete:V,onSelectionChange:J,onSelectionDragStart:ee,onSelectionDrag:M,onSelectionDragStop:Z,onSelectionContextMenu:G,onSelectionStart:I,onSelectionEnd:q,connectionMode:H=bo.Strict,connectionLineType:W=ya.Bezier,connectionLineStyle:L,connectionLineComponent:K,connectionLineContainerStyle:de,deleteKeyCode:O="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:B=!1,selectionMode:te=uc.Full,panActivationKeyCode:le="Space",multiSelectionKeyCode:pe=Hd()?"Meta":"Control",zoomActivationKeyCode:ye=Hd()?"Meta":"Control",snapToGrid:Ie=!1,snapGrid:Te=yP,onlyRenderVisibleElements:Re=!1,selectNodesOnDrag:Me=!0,nodesDraggable:xe,nodesConnectable:He,nodesFocusable:Ne,nodeOrigin:_e=gP,edgesFocusable:Ze,edgesUpdatable:ct,elementsSelectable:Ke,defaultViewport:ce=wP,minZoom:je=.5,maxZoom:$e=2,translateExtent:Je=vx,preventScrolling:qe=!0,nodeExtent:pt,defaultMarkerColor:ge="#b1b1b7",zoomOnScroll:be=!0,zoomOnPinch:Ve=!0,panOnScroll:nt=!1,panOnScrollSpeed:at=.5,panOnScrollMode:he=go.Free,zoomOnDoubleClick:rt=!0,panOnDrag:ot=!0,onPaneClick:jt,onPaneMouseEnter:xt,onPaneMouseMove:wt,onPaneMouseLeave:kn,onPaneScroll:Zt,onPaneContextMenu:me,children:it,onEdgeContextMenu:ht,onEdgeDoubleClick:Qe,onEdgeMouseEnter:sn,onEdgeMouseMove:an,onEdgeMouseLeave:Dt,onEdgeUpdate:pn,onEdgeUpdateStart:Qt,onEdgeUpdateEnd:mn,onReconnect:nr,onReconnectStart:Tn,onReconnectEnd:_n,reconnectRadius:vr=10,edgeUpdaterRadius:An=10,onNodesChange:Rn,onEdgesChange:Mn,noDragClassName:qs="nodrag",noWheelClassName:Fs="nowheel",noPanClassName:fs="nopan",fitView:Q=!1,fitViewOptions:Ce,connectOnClick:Ue=!0,attributionPosition:Le,proOptions:Pe,defaultEdgeOptions:ft,elevateNodesOnSelect:Ct=!0,elevateEdgesOnSelect:$t=!1,disableKeyboardA11y:Wr=!1,autoPanOnConnect:bt=!0,autoPanOnNodeDrag:kt=!0,connectionRadius:Bs=20,isValidConnection:ps,onError:Ea,style:Vr,id:Ca,nodeDragThreshold:Mo,...ms},In)=>{const gs=Ca||"1";return fe.createElement("div",{...ms,style:{...Vr,...vP},ref:In,className:fn(["react-flow",a]),"data-testid":"rf__wrapper",id:Ca},fe.createElement(lA,null,fe.createElement(hP,{onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:l,edgeTypes:c,connectionLineType:W,connectionLineStyle:L,connectionLineComponent:K,connectionLineContainerStyle:de,selectionKeyCode:Y,selectionOnDrag:B,selectionMode:te,deleteKeyCode:O,multiSelectionKeyCode:pe,panActivationKeyCode:le,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Re,selectNodesOnDrag:Me,defaultViewport:ce,translateExtent:Je,minZoom:je,maxZoom:$e,preventScrolling:qe,zoomOnScroll:be,zoomOnPinch:Ve,zoomOnDoubleClick:rt,panOnScroll:nt,panOnScrollSpeed:at,panOnScrollMode:he,panOnDrag:ot,onPaneClick:jt,onPaneMouseEnter:xt,onPaneMouseMove:wt,onPaneMouseLeave:kn,onPaneScroll:Zt,onPaneContextMenu:me,onSelectionContextMenu:G,onSelectionStart:I,onSelectionEnd:q,onEdgeContextMenu:ht,onEdgeDoubleClick:Qe,onEdgeMouseEnter:sn,onEdgeMouseMove:an,onEdgeMouseLeave:Dt,onReconnect:nr??pn,onReconnectStart:Tn??Qt,onReconnectEnd:_n??mn,reconnectRadius:vr??An,defaultMarkerColor:ge,noDragClassName:qs,noWheelClassName:Fs,noPanClassName:fs,elevateEdgesOnSelect:$t,rfId:gs,disableKeyboardA11y:Wr,nodeOrigin:_e,nodeExtent:pt}),fe.createElement(lL,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:w,onConnectStart:N,onConnectEnd:k,onClickConnectStart:S,onClickConnectEnd:b,nodesDraggable:xe,nodesConnectable:He,nodesFocusable:Ne,edgesFocusable:Ze,edgesUpdatable:ct,elementsSelectable:Ke,elevateNodesOnSelect:Ct,minZoom:je,maxZoom:$e,nodeExtent:pt,onNodesChange:Rn,onEdgesChange:Mn,snapToGrid:Ie,snapGrid:Te,connectionMode:H,translateExtent:Je,connectOnClick:Ue,defaultEdgeOptions:ft,fitView:Q,fitViewOptions:Ce,onNodesDelete:P,onEdgesDelete:V,onNodeDragStart:$,onNodeDrag:D,onNodeDragStop:U,onSelectionDrag:M,onSelectionDragStart:ee,onSelectionDragStop:Z,noPanClassName:fs,nodeOrigin:_e,rfId:gs,autoPanOnConnect:bt,autoPanOnNodeDrag:kt,onError:Ea,connectionRadius:Bs,isValidConnection:ps,nodeDragThreshold:Mo}),fe.createElement(oL,{onSelectionChange:J}),it,fe.createElement($4,{proOptions:Pe,position:Le}),fe.createElement(fL,{rfId:gs,disableKeyboardA11y:Wr})))});cA.displayName="ReactFlow";const xP=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function uA(){return yt(xP,Xt)}const dA=({id:e,x:t,y:n,width:r,height:a,style:l,color:c,strokeColor:u,strokeWidth:f,className:p,borderRadius:h,shapeRendering:m,onClick:y,selected:w})=>{const{background:N,backgroundColor:k}=l||{},S=c||N||k;return fe.createElement("rect",{className:fn(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:r,height:a,fill:S,stroke:u,strokeWidth:f,shapeRendering:m,onClick:y?b=>y(b,e):void 0})};dA.displayName="MiniMapNode";var bP=x.memo(dA);const kP=e=>e.nodeOrigin,_P=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),xp=e=>e instanceof Function?e:()=>e;function NP({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a=2,nodeComponent:l=bP,onClick:c}){const u=yt(_P,Xt),f=yt(kP),p=xp(t),h=xp(e),m=xp(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return fe.createElement(fe.Fragment,null,u.map(w=>{const{x:N,y:k}=wo(w,f).positionAbsolute;return fe.createElement(l,{key:w.id,x:N,y:k,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:r,strokeColor:h(w),strokeWidth:a,shapeRendering:y,onClick:c,id:w.id})}))}var SP=x.memo(NP);const jP=200,EP=150,CP=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?P4(mh(t,e.nodeOrigin),n):n,rfId:e.rfId}},TP="react-flow__minimap-desc";function hA({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c=2,nodeComponent:u,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:k=!1,ariaLabel:S="React Flow mini map",inversePan:b=!1,zoomStep:j=10,offsetScale:E=5}){const C=Ut(),T=x.useRef(null),{boundingRect:R,viewBB:$,rfId:D}=yt(CP,Xt),U=(e==null?void 0:e.width)??jP,P=(e==null?void 0:e.height)??EP,V=R.width/U,J=R.height/P,ee=Math.max(V,J),M=ee*U,Z=ee*P,G=E*ee,I=R.x-(M-R.width)/2-G,q=R.y-(Z-R.height)/2-G,H=M+G*2,W=Z+G*2,L=`${TP}-${D}`,K=x.useRef(0);K.current=ee,x.useEffect(()=>{if(T.current){const Y=hr(T.current),B=pe=>{const{transform:ye,d3Selection:Ie,d3Zoom:Te}=C.getState();if(pe.sourceEvent.type!=="wheel"||!Ie||!Te)return;const Re=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*j,Me=ye[2]*Math.pow(2,Re);Te.scaleTo(Ie,Me)},te=pe=>{const{transform:ye,d3Selection:Ie,d3Zoom:Te,translateExtent:Re,width:Me,height:xe}=C.getState();if(pe.sourceEvent.type!=="mousemove"||!Ie||!Te)return;const He=K.current*Math.max(1,ye[2])*(b?-1:1),Ne={x:ye[0]-pe.sourceEvent.movementX*He,y:ye[1]-pe.sourceEvent.movementY*He},_e=[[0,0],[Me,xe]],Ze=$s.translate(Ne.x,Ne.y).scale(ye[2]),ct=Te.constrain()(Ze,_e,Re);Te.transform(Ie,ct)},le=b2().on("zoom",N?te:null).on("zoom.wheel",k?B:null);return Y.call(le),()=>{Y.on("zoom",null)}}},[N,k,b,j]);const de=y?Y=>{const B=Lr(Y);y(Y,{x:B[0],y:B[1]})}:void 0,O=w?(Y,B)=>{const te=C.getState().nodeInternals.get(B);w(Y,te)}:void 0;return fe.createElement(Wx,{position:m,style:e,className:fn(["react-flow__minimap",t]),"data-testid":"rf__minimap"},fe.createElement("svg",{width:U,height:P,viewBox:`${I} ${q} ${H} ${W}`,role:"img","aria-labelledby":L,ref:T,onClick:de},S&&fe.createElement("title",{id:L},S),fe.createElement(SP,{onClick:O,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),fe.createElement("path",{className:"react-flow__minimap-mask",d:`M${I-G},${q-G}h${H+G*2}v${W+G*2}h${-H-G*2}z
57
- M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}hA.displayName="MiniMap";var AP=x.memo(hA);function RP(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},fe.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function MP(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},fe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function IP(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},fe.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function $P(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function OP(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const dr=({children:e,className:t,...n})=>fe.createElement("button",{type:"button",className:fn(["react-flow__controls-button",t]),...n},e);dr.displayName="ControlButton";const LP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),fA=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:p,children:h,position:m="bottom-left"})=>{const y=Ut(),[w,N]=x.useState(!1),{isInteractive:k,minZoomReached:S,maxZoomReached:b}=yt(LP,Xt),{zoomIn:j,zoomOut:E,fitView:C}=kc();if(x.useEffect(()=>{N(!0)},[]),!w)return null;const T=()=>{j(),l==null||l()},R=()=>{E(),c==null||c()},$=()=>{C(a),u==null||u()},D=()=>{y.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),f==null||f(!k)};return fe.createElement(Wx,{className:fn(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&fe.createElement(fe.Fragment,null,fe.createElement(dr,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},fe.createElement(RP,null)),fe.createElement(dr,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},fe.createElement(MP,null))),n&&fe.createElement(dr,{className:"react-flow__controls-fitview",onClick:$,title:"fit view","aria-label":"fit view"},fe.createElement(IP,null)),r&&fe.createElement(dr,{className:"react-flow__controls-interactive",onClick:D,title:"toggle interactivity","aria-label":"toggle interactivity"},k?fe.createElement(OP,null):fe.createElement($P,null)),h)};fA.displayName="Controls";var PP=x.memo(fA),Fr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Fr||(Fr={}));function DP({color:e,dimensions:t,lineWidth:n}){return fe.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function qP({color:e,radius:t}){return fe.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const FP={[Fr.Dots]:"#91919a",[Fr.Lines]:"#eee",[Fr.Cross]:"#e2e2e2"},BP={[Fr.Dots]:1,[Fr.Lines]:1,[Fr.Cross]:6},zP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function pA({id:e,variant:t=Fr.Dots,gap:n=20,size:r,lineWidth:a=1,offset:l=2,color:c,style:u,className:f}){const p=x.useRef(null),{transform:h,patternId:m}=yt(zP,Xt),y=c||FP[t],w=r||BP[t],N=t===Fr.Dots,k=t===Fr.Cross,S=Array.isArray(n)?n:[n,n],b=[S[0]*h[2]||1,S[1]*h[2]||1],j=w*h[2],E=k?[j,j]:b,C=N?[j/l,j/l]:[E[0]/l,E[1]/l];return fe.createElement("svg",{className:fn(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},fe.createElement("pattern",{id:m+e,x:h[0]%b[0],y:h[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?fe.createElement(qP,{color:y,radius:j/l}):fe.createElement(DP,{dimensions:E,color:y,lineWidth:a})),fe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}pA.displayName="Background";var HP=x.memo(pA);const UP=["us-gov","global","apac","us","eu","jp","au"],WP=new RegExp(`^(?:(?:${UP.join("|")})\\.)?anthropic\\.`,"i");function _c(e){return e.replace(WP,"")}const VP=["command","cmd","file_path","path","url","pattern","notebook_path"],_1=120,bp=e=>e.length>_1?`${e.slice(0,_1-1)}…`:e;function GP(e){if(typeof e=="string")return e.trim()?bp(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of VP){const r=t[n];if(typeof r=="string"&&r.trim())return bp(r.trim());if(Array.isArray(r)&&r.length>0&&r.every(a=>typeof a=="string")){const a=r.join(" ").trim();if(a)return bp(a)}}return null}const KP=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function N1(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const S1={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function r0(e){const t=KP.exec(e);if(!t)return null;const n=N1(t[1],"status");return{label:(n&&Object.hasOwn(S1,n)?S1[n]:void 0)??"background task update",detail:N1(t[1],"summary")}}function mA(e){return e.filter(t=>!r0(t.text))}const YP=/[0-9a-f]{16,}/i,XP=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function gA(e){return YP.test(e)||XP.test(e)}function ZP(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!gA(t[n]))return t[n];return t[t.length-1]}function yA(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function s0(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,r=n.ephemeral_1h_input_tokens,a=n.ephemeral_5m_input_tokens;return typeof r!="number"&&typeof a!="number"?{}:{cacheCreate1hTokens:Number(r??0),cacheCreate5mTokens:Number(a??0)}}function QP(e){const t=s0(e),n={inputTokens:Number(e.input_tokens??0),outputTokens:Number(e.output_tokens??0),cacheReadTokens:Number(e.cache_read_input_tokens??e.cached_input_tokens??0),cacheCreateTokens:Number(e.cache_creation_input_tokens??e.cache_write_input_tokens??0),cacheCreate1hTokens:t.cacheCreate1hTokens,cacheCreate5mTokens:t.cacheCreate5mTokens};return typeof e.reasoning_output_tokens=="number"&&(n.reasoningOutputTokens=Number(e.reasoning_output_tokens)),n}function JP(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,r]of Object.entries(e))!n||!r||typeof r!="object"||(t[n]=QP(r));return Object.keys(t).length?t:void 0}function wA(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.input_tokens=="number"||typeof n.output_tokens=="number"||typeof n.cache_read_input_tokens=="number"||typeof n.cache_creation_input_tokens=="number")return{inputTokens:Number(n.input_tokens??0),outputTokens:Number(n.output_tokens??0),cacheReadTokens:Number(n.cache_read_input_tokens??0),cacheCreateTokens:Number(n.cache_creation_input_tokens??0),...s0(n)};for(const r of Object.values(n)){const a=wA(r,t+1);if(a)return a}return null}const e5=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,t5=new Set(["tool_input","tool_response"]);function vA(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&e5.test(_c(n.model)))return n.model;for(const[r,a]of Object.entries(n)){if(t5.has(r))continue;const l=vA(a,t+1);if(l)return l}return null}function xx(){return{agents:new Map,toolIndex:new Map,activeSubagentStack:new Map,subagentTombstones:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function ka(e){return ZP(e)}function j1(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function qi(e,t){return`${e}::${t}`}function _a(e,t){return`${e}\0${t}`}function Vd(e){const t=e.agent_type??e.subagent_type;return t&&!gA(t)?t:"subagent"}function tc(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Ci(e,t,n,r){const a=t;let l=e.agents.get(a);return l||(l={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:r,usage:yA()},e.agents.set(a,l),l)}function xA(e,t,n,r){const a=qi(t,n),l=e.agents.get(a);if(!l)return null;!l.cwd&&r.cwd&&(l.cwd=r.cwd,l.cwdBasename=ka(r.cwd));const c=Vd(r);return c&&(l.label==="subagent"||!l.label)&&(l.label=c),l}function n5(e,t,n){const r=t.session_id??"unknown",a=tc(t);if(a){const f=xA(e,r,a,t);if(f)return f}const l=e.activeSubagentStack.get(r),c=l&&l.length>0?l[l.length-1]:null;if(c){const f=e.agents.get(qi(r,c));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=ka(t.cwd)),f}const u=Ci(e,r,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=ka(t.cwd)),u.label==="session"&&t.cwd&&(u.label=ka(t.cwd)??"session"),u}function r5(e,t,n,r,a){const l=qi(t,n),c=Ci(e,t,a,!0);let u=e.agents.get(l);if(u){!u.cwd&&r.cwd&&(u.cwd=r.cwd,u.cwdBasename=ka(r.cwd));const f=Vd(r);return f&&(u.label==="subagent"||!u.label)&&(u.label=f),u}return u={id:l,sessionId:t,label:Vd(r),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:r.cwd,cwdBasename:ka(r.cwd),toolCount:0,childCount:0,usage:yA()},e.agents.set(l,u),c.childCount+=1,u}function s5(e,t,n){const r=e.activeSubagentStack.get(t)??[];r.includes(n)||(r.push(n),e.activeSubagentStack.set(t,r))}function E1(e,t,n){const r=e.activeSubagentStack.get(t);if(r){for(let a=r.length-1;a>=0;a--)if(r[a]===n){r.splice(a,1);break}r.length===0&&e.activeSubagentStack.delete(t)}}function ud(e,t=80){if(e==null)return"";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"…":e;try{const n=JSON.stringify(e);return n.length>t?n.slice(0,t-1)+"…":n}catch{return String(e)}}const C1=200;function a5(e,t){for(const n of e.values()){const r=n.tools.find(a=>a.id===t);if(r)return r}return null}const o5=25;function i5(e,t){const n=t.tools;if(n.length>C1){const r=n.splice(0,n.length-C1);for(const a of r){const l=_a(t.sessionId,a.id);e.toolIndex.get(l)===a&&e.toolIndex.delete(l)}}for(let r=n.length-o5-1;r>=0;r--){const a=n[r];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function l5(e,t,n){const r=e.toolIndex.get(_a(t.sessionId,n));if(r)return r;for(let a=t.tools.length-1;a>=0;a--)if(t.tools[a].id===n)return t.tools[a];return null}const T1=2e3;function c5(e,t,n){for(let r=e.prompts.length-1;r>=0;r--){const a=e.prompts[r];if(a.at<t-T1)return!1;if(a.text===n&&a.at<=t+T1)return!0}return!1}const dd=2e3;function u5(e){let t=e.startedAt;for(const n of e.prompts)n.at>t&&(t=n.at);return t}function bA(e,t){for(const n of t.tools){const r=_a(t.sessionId,n.id);e.toolIndex.get(r)===n&&e.toolIndex.delete(r)}}function Nc(e,t){return t&&(e.revision+=1),t}function d5(e,t,n,r,a){if(e.agents.size<=n)return!1;const l=m=>m.state==="done"&&m.endedAt!=null&&t-m.endedAt>r,c=[],u=new Map;for(const[m,y]of e.agents){if(y.parentId!=null){const w=u.get(y.parentId);w?w.push(m):u.set(y.parentId,[m])}l(y)&&c.push({id:m,endedAt:y.endedAt})}if(c.length===0)return!1;c.sort((m,y)=>m.endedAt-y.endedAt);let f=0;const p=new Set,h=m=>{const y=e.agents.get(m);y&&(bA(e,y),e.agents.delete(m),p.add(y.sessionId),f++)};for(const m of c){if(e.agents.size<=n)break;if(!e.agents.has(m.id))continue;const y=(u.get(m.id)??[]).map(w=>e.agents.get(w)).filter(w=>w!=null);if(!y.some(w=>!l(w))){for(const w of y)h(w.id);h(m.id)}}if(a&&p.size>0){const m=new Set;for(const y of e.agents.values())m.add(y.sessionId);for(const y of p)m.has(y)||a(y)}return Nc(e,f>0)}function h5(e,t,n,r,a){const l=new Map;for(const[h,m]of e.agents){let y=l.get(m.sessionId);y||(y={ids:[],endedAt:0,live:!1,closed:!1},l.set(m.sessionId,y)),y.ids.push(h),m.kind==="root"&&m.closedAt!=null&&(y.closed=!0),m.state==="done"&&m.endedAt!=null?y.endedAt=Math.max(y.endedAt,m.endedAt):y.live=!0}const c=[...l].filter(([,h])=>!h.live&&h.endedAt>0&&t-h.endedAt>r).sort(([,h],[,m])=>h.closed===m.closed?h.endedAt-m.endedAt:h.closed?-1:1);let f=[...l.values()].filter(h=>!h.live).length-n;if(f<=0)return!1;let p=!1;for(const[h,m]of c){if(f<=0)break;for(const y of m.ids){const w=e.agents.get(y);w&&bA(e,w),e.agents.delete(y)}a==null||a(h),f--,p=!0}return Nc(e,p)}function f5(e,t){const n=t==null?void 0:t.payload,r=n==null?void 0:n.hook_event_name;if(r!=="PostToolUse"&&r!=="PostToolUseFailure")return!1;const a=n==null?void 0:n.tool_use_id;return typeof a!="string"||a.length===0?!1:e.toolIndex.has(_a((n==null?void 0:n.session_id)??"unknown",a))}function p5(e){let t=!1;for(const n of e.agents.values())for(const r of n.tools)r.endedAt!=null||r.outcomeGap||(r.outcomeGap=!0,t=!0);return Nc(e,t)}function m5(e,t,n){let r=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const l=e.agents.get(a.sessionId),c=(l==null?void 0:l.lastEventAt)??(l==null?void 0:l.startedAt);for(const u of a.tools){const f=Math.max(u.startedAt,c??u.startedAt);u.endedAt==null&&t-f>n&&(u.endedAt=f,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(_a(a.sessionId,u.id)),r=!0)}}return Nc(e,r)}const A1=90*6e4;function g5(e,t,n){let r=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const l=a.lastEventAt??a.startedAt;if(!(t-l<=n)){a.waiting&&(a.waiting=null,r=!0),a.closedAt==null&&(a.closedAt=l),a.state==="active"&&(a.state="done",a.endedAt=l,a.reaped=!0,r=!0);for(const c of e.agents.values())c.sessionId!==a.sessionId||c.kind==="root"||c.state!=="active"||(c.state="done",c.endedAt=l,r=!0);e.activeSubagentStack.delete(a.sessionId)}}return Nc(e,r)}function y5(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const w5=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped"]);function v5(e,t){let n=null;for(const r of e.toolIndex.values()){const a=r.agentId?e.agents.get(r.agentId):void 0;!a||a.sessionId!==t||(!n||r.startedAt>n.startedAt)&&(n=r)}return n}const x5=3e4;function b5(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>x5)&&!(e.startedAt>t))return{name:e.name,preview:GP(e.input)??""}}function k5(e,t,n,r,a){if(n!=="permission")return{kind:n,message:r,since:a};const l=v5(e,t),c={kind:n,message:r,since:a};l!=null&&l.explicitSubagentId&&(c.subagentId=l.explicitSubagentId);const u=b5(l,a);return u&&(c.tool=u),c}function _5(e,t,n){if(e.kind==="idle")return!0;const r=tc(t);return r==null?!0:e.subagentId!=null&&qi(n,r)===e.subagentId}function R1(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const r=t.payload??{},a=t.receivedAt,l=r.hook_event_name??"Unknown";if(l==="__clear")return{...xx(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const c=r.session_id??"unknown";if(!w5.has(l)){const h=e.agents.get(c);h!=null&&h.waiting&&_5(h.waiting,r,c)&&(h.waiting=null)}const u=e.agents.get(c);if(u&&a>(u.lastEventAt??0)&&(u.lastEventAt=a,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof r.model_context_window=="number"&&r.model_context_window>0){const h=e.agents.get(c);h&&(h.contextWindow=r.model_context_window)}if(typeof r.approval_policy=="string"&&r.approval_policy){const h=e.agents.get(c);h&&(h.approvalPolicy=r.approval_policy)}if(typeof r.context_tokens=="number"&&r.context_tokens>=0){const h=e.agents.get(c);h&&(h.context={...h.context??j1(),currentContextTokens:r.context_tokens})}if(l==="ModelObserved"){const h=typeof r.model=="string"?r.model:null;if(h){const y=e.agents.get(c);y&&(y.model=h)}const m=r.subagentModels;if(m&&typeof m=="object")for(const[y,w]of Object.entries(m)){if(typeof w!="string")continue;const N=`${c}::${y}`,k=e.agents.get(N);k&&(k.model=w)}return e}if(l==="ContextObserved"){const h=r.context??null;if(h){const m=e.agents.get(c);if(m){const y=m.context??j1(),w=(k,S)=>typeof h[k]=="number"?h[k]:S,N=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;m.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(l==="SessionNamed"){const h=e.agents.get(c);if(h){const m=typeof r.sessionName=="string"?r.sessionName.trim():"",y=typeof r.sessionTitle=="string"?r.sessionTitle.trim():"";m&&(h.sessionName=m),y&&(h.sessionTitle=y);const w=h.sessionName??"";h.sessionTitle&&w&&h.sessionTitle.toLowerCase()===w.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(l==="SessionRecapped"){const h=e.agents.get(c);if(h){const m=r.recap;m===null?h.recap=void 0:m&&typeof m.text=="string"&&m.text.trim()&&Number.isFinite(m.at)&&(h.recap={text:m.text.trim(),at:m.at})}return e}if(l==="OutputObserved"){const h=r.kind==="thinking"||r.kind==="text"||r.kind==="tool_use"?r.kind:null,m=typeof r.at=="number"&&Number.isFinite(r.at)?r.at:a;if(!h)return e;const y=e.agents.get(c);if(!y||y.lastOutputAt!=null&&m<=y.lastOutputAt)return e;if(y.lastOutputAt=m,h!=="tool_use"){const w=(y.outputs??[]).filter(N=>m-N<N5);w.push(m),y.outputs=w.length>M1?w.slice(-M1):w}return e.revision+=1,e}if(l==="UsageObserved"){const h=r.usage??null;if(h){const m=e.agents.get(c);if(m){m.usage.inputTokens=Number(h.input_tokens??0),m.usage.outputTokens=Number(h.output_tokens??0),m.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const y=s0(h);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),m.usageByModel=JP(r.usageByModel)}}return e}const f=n5(e,r,a);f.provider||(f.provider=r.provider==="codex"?"codex":"claude");const p=vA(r);switch(p&&(f.model=p),l){case"SessionStart":{const h=Ci(e,c,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.endedAt=void 0,h.startedAt=Math.min(h.startedAt??a,a),!h.cwd&&r.cwd&&(h.cwd=r.cwd,h.cwdBasename=ka(r.cwd)),h.label==="session"&&r.cwd&&(h.label=ka(r.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===c&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<a&&(y.exitAt=a);const h=Ci(e,c,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const m=(typeof r.prompt=="string"?r.prompt:typeof r.message=="string"?r.message:"")??"";m&&!c5(h,a,m)&&(h.prompts.push({at:a,text:m}),!h.firstPrompt&&!r0(m)&&(h.firstPrompt=ud(m,120)));break}case"PreToolUse":{const h=r.tool_use_id?l5(e,f,r.tool_use_id):null;if(h){r.tool_name&&h.name==="?"&&(h.name=r.tool_name),h.endedAt==null&&!h.trimmed&&r.tool_input!==void 0&&(h.input=r.tool_input,h.inputPreview=ud(r.tool_input));break}const m=r.tool_use_id??`${f.id}:${f.toolCount}`,y=tc(r),w={id:m,name:r.tool_name??"?",input:r.tool_input,inputPreview:ud(r.tool_input),agentId:f.id,explicitSubagentId:y?qi(c,y):void 0,startedAt:a};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(_a(f.sessionId,m),w),i5(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=r.tool_use_id;if(!h)break;const m=_a(c,h);let y=e.toolIndex.get(m),w=!1;if(!y)for(const k of e.agents.values()){if(k.sessionId!==c)continue;const S=k.tools.find(b=>b.id===h);if(S){y=S,w=!0;break}}if(!y||y.outcomeApplied)break;y.outcomeApplied=!0,y.outcomeGap=void 0,y.endedAt=a,y.ok=l==="PostToolUse",y.trimmed||(y.response=r.tool_response),l==="PostToolUseFailure"?y.errorPreview=ud(r.tool_response):w&&(y.errorPreview=void 0);const N=wA(r.tool_response);N&&(y.usage=N),e.toolIndex.delete(m);break}case"SubagentStart":{const h=tc(r);if(!h)break;const m=r5(e,c,h,r,a),y=Vd(r);y&&(m.label=y);const w=e.subagentTombstones.get(m.id);w!=null&&e.subagentTombstones.delete(m.id);const N=m.endedAt!=null&&a-m.endedAt<=dd,k=w!=null&&a-w<=dd;if(N||k){const S=k?w:m.endedAt;m.state="done",m.endedAt=S,m.startedAt=Math.min(m.startedAt,S),E1(e,c,h);break}m.state="active",m.startedAt=m.startedAt||a,m.exitAt=void 0,m.endedAt=void 0,s5(e,c,h);break}case"SubagentStop":{const h=tc(r);if(!h)break;const m=xA(e,c,h,r);if(!m){for(const[y,w]of e.subagentTombstones)a-w>dd&&e.subagentTombstones.delete(y);e.subagentTombstones.set(qi(c,h),a);break}m.state="done",m.endedAt=Math.min(m.endedAt??a,a),E1(e,c,h);break}case"Stop":case"SessionEnd":{const h=Ci(e,c,a,!1),m=u5(h);if(a<m)break;const y=h.lastTurnEndAt;if(y!=null&&m>y&&a<=y+dd)break;h.state="done",h.endedAt=a,h.lastTurnEndAt=a;for(const w of h.provider==="codex"?[]:e.agents.values())if(w.sessionId===c)for(const N of w.tools)N.endedAt==null&&N.explicitSubagentId==null&&(N.endedAt=a,N.ok=!1,N.errorPreview=N.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(_a(w.sessionId,N.id)));l==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const h=y5(r.notification_type);if(!h)break;const m=Ci(e,c,a,!1),y=typeof r.message=="string"?r.message:"",w=m.waiting;m.waiting=w&&w.kind===h&&w.message===y?{...w,since:Math.min(w.since,a)}:k5(e,c,h,y,a);break}}return e}const N5=6e4,M1=64;function Gd(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}const S5={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},j5=[{match:/^claude[-_](fable|mythos)[-_]5[-_.]1\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_](fable|mythos)[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:S5},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}},{match:/^gpt[-_]6[-_]astra\b(?![-_][A-Za-z])/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5}},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:15.625}},{match:/^gpt[-_]5[-_.]6[-_]luna/i,rates:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25}},{match:/^gpt[-_]5[-_.]6[-_]terra/i,rates:{input:2,output:12,cacheRead:.2,cacheWrite:2.5}},{match:/^gpt[-_]5[-_.]6(?:[-_]sol)?\b(?![-_][A-Za-z])/i,rates:{input:4,output:20,cacheRead:.4,cacheWrite:5}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b(?![-_][A-Za-z])/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]pro/i,rates:{input:30,output:180,cacheRead:3,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]mini/i,rates:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]nano/i,rates:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4\b/i,rates:{input:2.5,output:15,cacheRead:.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]3[-_]codex/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2[-_]pro/i,rates:{input:21,output:168,cacheRead:21,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2\b/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1[-_]codex[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1(?!\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^gpt[-_]5[-_]pro\b/i,rates:{input:15,output:120,cacheRead:15,cacheWrite:0}},{match:/^gpt[-_]5[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_]nano/i,rates:{input:.05,output:.4,cacheRead:.005,cacheWrite:0}},{match:/^gpt[-_]5(?![-_.]\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^codex[-_]mini/i,rates:{input:1.5,output:6,cacheRead:.375,cacheWrite:0}},{match:/^o1[-_]pro/i,rates:{input:150,output:600,cacheRead:150,cacheWrite:0}},{match:/^o1[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o1\b/i,rates:{input:15,output:60,cacheRead:7.5,cacheWrite:0}},{match:/^o3[-_]deep[-_]research/i,rates:{input:10,output:40,cacheRead:2.5,cacheWrite:0}},{match:/^o3[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o3[-_]pro/i,rates:{input:20,output:80,cacheRead:20,cacheWrite:0}},{match:/^o4[-_]mini[-_]deep[-_]research/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}},{match:/^o4[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0}},{match:/^o3\b/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}}];function E5(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Wi(e,t=Date.now()){if(!e)return null;const n=_c(e);for(const r of j5)if(r.match.test(n))return typeof r.rates=="function"?r.rates(t):r.rates;return null}function kA(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),r=Math.max(0,e.cacheCreate5mTokens??0),a=Math.max(0,e.cacheCreateTokens-n-r),l=r+a,c=t.cacheWrite1h??t.cacheWrite;return{tokens5m:l,tokens1h:n,usd5m:l*t.cacheWrite/1e6,usd1h:n*c/1e6}}function _A(e,t,n=Date.now()){if(!E5(t))return e.inputTokens;const r=Wi(t,n),a=((r==null?void 0:r.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-a)}function a0(e,t,n=Date.now()){const r=Wi(t,n);if(!r)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=_A(e,t,n)*r.input/1e6,l=e.outputTokens*r.output/1e6,c=e.cacheReadTokens*r.cacheRead/1e6,u=kA(e,r),f=u.usd5m+u.usd1h;return{input:a,output:l,cacheRead:c,cacheWrite:f,total:a+l+c+f}}const I1=2e5,C5=1e6,T5=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],A5=[{match:/^gpt[-_]6[-_]astra/i,window:105e4},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,window:4e5},{match:/^gpt[-_]5[-_.]6/i,window:105e4},{match:/^gpt[-_]5[-_.]5/i,window:105e4},{match:/^gpt[-_]5[-_.]4[-_](?:mini|nano)/i,window:4e5},{match:/^gpt[-_]5[-_.]4/i,window:105e4},{match:/^gpt[-_]5[-_.]3[-_]codex[-_]spark/i,window:128e3},{match:/^gpt[-_]5[-_.]3[-_]codex/i,window:4e5},{match:/^gpt[-_]5[-_.]2/i,window:4e5},{match:/^gpt[-_]5/i,window:4e5},{match:/^codex[-_]mini/i,window:2e5},{match:/^o\d/i,window:2e5}];function R5(e){if(!e)return I1;const t=_c(e);for(const n of T5)if(n.test(t))return C5;for(const n of A5)if(n.match.test(t))return n.window;return I1}function NA(e,t){return typeof e=="number"&&e>0?e:R5(t)}const ji="not priced";function Nt(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const t=(e*100).toFixed(e<.1?1:0);if(Number(t)<100)return`${t}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function o0(e,t){if(e<=0||t<10)return null;const n=e/t,r=n*60;return r>=.01?`${Nt(r)}/min`:`${Nt(n*3600)}/hr`}function M5(e,t){const n={inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheCreateTokens:e.cacheCreateTokens+t.cacheCreateTokens};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0||t.cacheCreate1hTokens!==void 0||t.cacheCreate5mTokens!==void 0)&&(n.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(t.cacheCreate1hTokens??0),n.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(t.cacheCreate5mTokens??0)),(e.reasoningOutputTokens!==void 0||t.reasoningOutputTokens!==void 0)&&(n.reasoningOutputTokens=(e.reasoningOutputTokens??0)+(t.reasoningOutputTokens??0)),n}function I5(e,t){let n=0,r=0,a=0,l=0,c=0,u=0;for(const m of t)n+=m.inputTokens,r+=m.outputTokens,a+=m.cacheReadTokens,l+=m.cacheCreateTokens,c+=m.cacheCreate1hTokens??0,u+=m.cacheCreate5mTokens??0;const f=(m,y)=>Math.max(0,m-y),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,r),cacheReadTokens:f(e.cacheReadTokens,a),cacheCreateTokens:f(e.cacheCreateTokens,l)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,c),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Sc(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const r=n.map(l=>({model:l,usage:t[l]})),a=I5(e.usage,r.map(l=>l.usage));if(a){const l=r.findIndex(c=>c.model===e.model);l>=0?r[l]={model:r[l].model,usage:M5(r[l].usage,a)}:r.push({model:e.model,usage:a})}return r}function tr(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const r of Sc(e)){const a=a0(r.usage,r.model,t);n.input+=a.input,n.output+=a.output,n.cacheRead+=a.cacheRead,n.cacheWrite+=a.cacheWrite,n.total+=a.total}return n}function Kd(e,t=Date.now()){let n=0;for(const r of Sc(e))Wi(r.model,t)==null&&(n+=r.usage.inputTokens+r.usage.outputTokens);return n}function SA(e){const t=[];for(const n of Sc(e)){if(!n.model||t.includes(n.model))continue;const r=n.usage;r.inputTokens+r.outputTokens+r.cacheReadTokens+r.cacheCreateTokens<=0||t.push(n.model)}return t}function jA(e){return SA(e).filter(t=>t!==e.model)}const $5=new Set(["untrusted","on-request","on-failure"]);function O5(e){return typeof e!="string"||!e?null:$5.has(e)?!0:e==="never"?!1:null}function L5(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=O5(e.approvalPolicy);return t===!1?null:{label:"approvals not visible",detail:`${t===!0?`This session's approval policy is "${e.approvalPolicy}", so Codex can stop and ask you to approve a command.`:"This session's approval policy has not been read yet, so it may be able to stop and ask you to approve a command."}
58
-
59
- Codex writes no approval request to its rollout files, which are the only thing this deck can read — so when it does ask, this card, the sidebar, the topbar count, the tab title and the favicon will all stay silent. Check the terminal.`}}function $1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function _o(e){const t=_c(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=$1(n[1]),l=n[2].replace(/[-_]/g,".");return`${a} ${l}`}const r=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(r){const a=r[1].replace(/[-_]/g,"."),l=r[2].split(/[-_]/).filter(Boolean).map($1);return[`GPT-${a}`,...l].join(" ")}return e}function gh(e){const t=_c(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Eo(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function kp(e){const t=[];for(const n of e)n.kind==="root"&&Eo(n.waiting)&&t.push({id:n.id,label:n.label,waiting:n.waiting});return t.sort((n,r)=>n.waiting.since-r.waiting.since)}function P5(e,t){if(e.length===0)return null;const n=e.findIndex(r=>r.id===t);return e[(n+1)%e.length]}function D5(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function yh(e,t){return`${e}@${t.since}`}function EA(e,t){if(!e.tool)return null;const{name:n,preview:r}=e.tool,a=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return r?a?r:`${n} · ${r}`:a?null:n}function q5(e){const t=e.message||"Needs your permission",n=EA(e,t);return n?`${t}
60
- Likely on: ${n}`:t}function F5(e,t,n,r=!0){if(!r)return[];if(n)return[];const a=[];for(const l of e){if(!Eo(l.waiting))continue;const c=yh(l.id,l.waiting);t.has(c)||a.push({key:c,title:l.label,body:q5(l.waiting),sessionId:l.id})}return a}function B5(e,t,n){const r=new Set;for(const l of e)r.add(yh(l.id,l.waiting));const a=new Set;for(const l of n)r.has(l)&&a.add(l);for(const l of t)a.add(l.key);return a}function _p(e){return new Set(e.map(t=>yh(t.id,t.waiting)))}function z5(e,t){return e!==t}function H5(e,t){return!e&&t!=null}function U5(e,t){return e!==null&&t!=null}function bn(e){const t=Math.round(e);return t<1e3?`${t}`:t<1e6?`${(t/1e3).toFixed(1)}k`:t<1e9?`${(t/1e6).toFixed(2)}M`:`${(t/1e9).toFixed(2)}B`}function Yd(e,t,n){const r=(t??n)-e;if(r<1e3)return`${Math.max(0,r)}ms`;const a=Math.floor(r/1e3);if(a<60)return`${a}s`;const l=Math.floor(a/60),c=a%60;return`${l}m ${String(c).padStart(2,"0")}s`}function CA(e,t){if(e.endedAt==null)return t;const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function TA(e,t){const n=typeof e=="string"?e.trim():"",r=typeof t=="string"?t.trim():"";return{face:n||r||void 0,tooltip:r||n||void 0}}const W5=1;function V5(){const e=[];let t=0;function n(){let r;for(const a of e)(!r||a.layer>r.layer||a.layer===r.layer&&a.seq>r.seq)&&(r=a);return r}return{push(r,a=0){const l={dismiss:r,layer:a,seq:t++};return e.push(l),()=>{const c=e.indexOf(l);c!==-1&&e.splice(c,1)}},dismissTop(){const r=n();return r?(r.dismiss(),!0):!1},isTop(r){const a=n();return a!=null&&a.dismiss===r},depth(){return e.length}}}const Xd=V5();function G5(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function O1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function K5(e,t){return!e||!e.isConnected||O1(e)?!1:t==null||O1(t)}const L1="a[href], button, input, select, textarea, [tabindex]";function Y5(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function X5(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function Z5({count:e,index:t,shiftKey:n}){return e<=0?{kind:"hold"}:t<0||t>=e?{kind:"focus",index:n?e-1:0}:!n&&t===e-1?{kind:"focus",index:0}:n&&t===0?{kind:"focus",index:e-1}:{kind:"allow"}}function wh(e){return e.ctrlKey||e.metaKey||e.altKey}const Q5=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),J5=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),e6=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function i0(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function t6(e){return i0(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function l0(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=i0(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!Q5.has(String(e.type??"text").toLowerCase())}function n6(e,t){if(!e)return!1;if(l0(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&t6(e))return!1;if(J5.has(i0(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>e6.has(r))}function r6({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function AA(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(L1))return Y5({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&X5({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(L1)!=null})}):[]}function s6(e,t){const n=AA(e);if(!t||!e.contains(t)||n.includes(t))return n;const r=n.findIndex(a=>(t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return r===-1?[...n,t]:[...n.slice(0,r),t,...n.slice(r)]}function rn(e,t={}){const{focusRef:n,layer:r}=t,a=x.useRef(null),l=x.useRef(e);l.current=e;const c=x.useRef(null);c.current===null&&(c.current=()=>l.current());const u=c.current;return x.useEffect(()=>Xd.push(u,r),[u,r]),x.useEffect(()=>{var p;const f=document.activeElement;return(p=(n==null?void 0:n.current)??AA(a.current)[0])==null||p.focus(),()=>{K5(f,document.activeElement)&&f.focus()}},[]),x.useEffect(()=>{const f=p=>{var k;if(p.key!=="Tab"||wh(p))return;const h=a.current;if(!h)return;const m=document.activeElement;if(!(m!=null&&h.contains(m))&&!Xd.isTop(u))return;const w=s6(h,m),N=Z5({count:w.length,index:m?w.indexOf(m):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((k=w[N.index])==null||k.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[u]),a}function a6(e){return e==="codex"?{subtitle:"reported by the Codex CLI — as of its most recent request",windowScope:"last request",compositionCounted:!1,compositionUncounted:"Not counted for Codex — the deck reconstructs the session from its rollout file and skips whatever was written before it attached, so a message and tool-call breakdown here would be short by an unknown amount. The window figure above is the CLI's own and is unaffected.",memoryHeading:"AGENTS.md files in scope",memoryEmpty:"No AGENTS.md files found on the path from cwd to the filesystem root, or in $CODEX_HOME."}:{subtitle:"approximation — CC's /context isn't hook-exposed",windowScope:"current turn",compositionCounted:!0,compositionUncounted:"",memoryHeading:"CLAUDE.md files in scope",memoryEmpty:"No CLAUDE.md files found on the path from cwd to ~/.claude."}}function ur(e){return e.toLocaleString()}function o6(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const i6=60;function l6(e,t=i6){if(e.length<=t)return e;const n=e.slice(e.length-(t-1)),r=n.search(/[/\\]/);return"…"+(r===-1?n:n.slice(r))}function c6({agent:e,onClose:t}){var y;const n=x.useRef(null),r=rn(t,{focusRef:n}),a=e.context,l=e.usage,c=(a==null?void 0:a.currentContextTokens)??0,u=NA(e.contextWindow,e.model),f=Math.min(100,c/u*100),p=tr(e),h=e.provider==="codex"?l.inputTokens+l.outputTokens:l.inputTokens+l.outputTokens+l.cacheReadTokens+l.cacheCreateTokens,m=a6(e.provider);return i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:r,className:"modal ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[i.jsxs("header",{className:"ctx-modal-head",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),i.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),i.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),i.jsxs("section",{className:"ctx-window-row",children:[i.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:i.jsx("div",{className:"ctx-window-fill",style:{transform:`scaleX(${Math.min(100,Math.max(0,f))/100})`}})}),i.jsxs("div",{className:"ctx-window-meta",children:[i.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),i.jsxs("span",{children:[ur(c)," / ",ur(u)," tok (",m.windowScope,")"]})]})]}),i.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),i.jsxs("div",{className:"ctx-grid",children:[i.jsx(Or,{label:"input tokens",val:ur(l.inputTokens)}),i.jsx(Or,{label:"output tokens",val:ur(l.outputTokens)}),i.jsx(Or,{label:"cache reads",val:ur(l.cacheReadTokens)}),i.jsx(Or,{label:"cache writes",val:ur(l.cacheCreateTokens)}),i.jsx(Or,{label:"cumulative total",val:ur(h)}),i.jsx(Or,{label:"estimated cost",val:Nt(p.total),accent:!0})]}),i.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?i.jsxs("div",{className:"ctx-grid",children:[i.jsx(Or,{label:"user messages",val:ur((a==null?void 0:a.msgsUser)??0)}),i.jsx(Or,{label:"assistant messages",val:ur((a==null?void 0:a.msgsAssistant)??0)}),i.jsx(Or,{label:"tool uses",val:ur((a==null?void 0:a.toolUses)??0)}),i.jsx(Or,{label:"tool results",val:ur((a==null?void 0:a.toolResults)??0)}),i.jsx(Or,{label:"system-reminders",val:ur((a==null?void 0:a.systemReminders)??0)})]}):i.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),i.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?i.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):i.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(w=>i.jsxs("li",{children:[i.jsx("span",{className:"ctx-md-path",title:w.path,children:l6(w.path)}),i.jsx("span",{className:"ctx-md-size",children:o6(w.bytes)})]},w.path))})]})})}function Or({label:e,val:t,accent:n}){return i.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[i.jsx("span",{className:"ctx-row-label",children:e}),i.jsx("span",{className:"ctx-row-val",children:t})]})}function u6({currentContextTokens:e,modelId:t,contextWindow:n,size:r=26,onClick:a}){const l=NA(n,t),c=Math.min(1,e/l),u=r/2-3,f=r/2,p=2*Math.PI*u,h=p*c,m=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return i.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${l.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":`Context ${Math.round(c*100)}% of ${l.toLocaleString()} tokens — show breakdown`,children:i.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,children:[i.jsx("circle",{cx:f,cy:f,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),i.jsx("circle",{cx:f,cy:f,r:u,stroke:m,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),i.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}const P1=new Map;function RA(e){let t=P1.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},P1.set(e,t)),t}function d6(e,t){const n=RA(e);return n.listeners.add(t),n.timer===null&&(n.now=Date.now(),n.timer=setInterval(()=>{n.now=Date.now();for(const r of n.listeners)r()},e)),()=>{n.listeners.delete(t),n.listeners.size===0&&n.timer!==null&&(clearInterval(n.timer),n.timer=null)}}function h6(e){return RA(e).now}const D1=new Map,q1=new Map;function vh(e=1e3){let t=D1.get(e);t||(t=r=>d6(e,r),D1.set(e,t));let n=q1.get(e);return n||(n=()=>h6(e),q1.set(e,n)),x.useSyncExternalStore(t,n,n)}function xh(e){const t=e.recap;if(e.kind!=="root"||!t||e.state==="active"||e.closedAt!=null)return null;for(const n of e.prompts)if(n.at>t.at)return null;return t}const f6="1",F1="agent-dag.schema",p6=["agent-dag.layout","agent-dag.viewport"];function Sa(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function m6(e,t=f6){let n=null;try{n=e.getItem(F1)}catch{return[]}if(n===t)return[];const r=[];if(n!==null)for(const a of p6)try{e.getItem(a)!==null&&(e.removeItem(a),r.push(a))}catch{}try{e.setItem(F1,t)}catch{}return r}const MA="agent-dag.recapsDismissed",B1=200;function g6(){const e=Sa(MA);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let Fi=new Set(g6());const bx=new Set;let IA=0;function $A(e){return bx.add(e),()=>{bx.delete(e)}}function OA(e){if(Fi=e,IA++,typeof window<"u")try{const t=Array.from(e);window.localStorage.setItem(MA,JSON.stringify(t.length>B1?t.slice(-B1):t))}catch{}for(const t of bx)t()}function LA(e,t){return`${e}@${t}`}function y6(e){return Fi.has(e)}function w6(e){if(Fi.has(e))return;const t=new Set(Fi);t.add(e),OA(t)}function v6(e){const t=new Set(Fi);t.delete(e)||t.add(e),OA(t)}function x6(e){return x.useSyncExternalStore($A,()=>e!=null&&Fi.has(e),()=>!1)}function c0(e){return`recap:${e}`}function b6(e){return e.startsWith("recap:")}function k6(){return x.useSyncExternalStore($A,()=>IA,()=>0)}function z1(e,t){const n=Wi(t);if(!n)return`model: ${t}
61
- no published rate in this build — the tokens are counted, the dollars are not`;const r=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,l=a0(e,t),c=kA(e,n),u=c.tokens1h>0?[`cache w5m${r(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${Nt(c.usd5m)}`,`cache w1h${r(c.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${Nt(c.usd1h)}`]:[`cache w ${r(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${Nt(c.usd5m)}`],f=_A(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${r(f).padStart(14)} × ${a(n.input).padEnd(11)} = ${Nt(l.input)}`,`output ${r(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${Nt(l.output)}`,`cache r ${r(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${Nt(l.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${Nt(l.total)}`].join(`
62
- `)}function H1(e){const t=Sc(e);return t.length<=1?z1(e.usage,e.model):[...t.map(n=>z1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${Nt(tr(e).total)}`].join(`
63
- `)}function _6({data:e,selected:t}){var S,b;const n=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),r=e.tools.filter(j=>!j.endedAt).length,a=e.tools.filter(j=>j.ok===!1).length,l=Gd(e.sessionId),c=((S=e.context)==null?void 0:S.currentContextTokens)??0,u=e.kind==="root"&&c>0,f=e.sessionTitle?e.cwd?`${e.cwd}
64
- ${e.sessionTitle}`:e.sessionTitle:e.cwd,p=jA(e),h=p.length>0?`${e.model}
65
- spend on this card also covers:
66
- ${p.join(`
67
- `)}`:e.model,m=TA(e.sessionName,e.sessionTitle),y=xh(e),w=y?LA(e.sessionId,y.at):null,N=x6(w),k=y!=null&&!N;return i.jsxs("div",{className:n,style:{"--session-hue":l},children:[i.jsx("span",{className:"accent-stripe"}),i.jsx(ko,{type:"target",position:We.Left,style:{background:"transparent",border:"none"}}),i.jsxs("div",{className:"head",children:[i.jsxs("div",{className:"title",children:[i.jsx(j6,{state:e.state}),i.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&i.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"}),y&&w&&i.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":"Claude Code's recap","aria-expanded":k,title:k?"Hide the recap":"Show Claude Code's recap",onClick:j=>{j.stopPropagation(),v6(w)},children:i.jsx(u0,{})})]}),i.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&i.jsx(u6,{currentContextTokens:c,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),i.jsxs("div",{className:"time",title:e.synthetic?`The deck joined this session after it began, so it has run at least this long — first seen ${new Date(e.startedAt).toLocaleTimeString()}`:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:[e.synthetic?"≥ ":"",i.jsx(S6,{start:e.startedAt,end:e.endedAt})]})]})]}),i.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&i.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?i.jsxs("span",{className:"model-chip","data-family":gh(e.model),title:h,children:[_o(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?i.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&m.face&&i.jsx("div",{className:"session-name",title:m.tooltip,children:m.face}),e.waiting&&i.jsx(A6,{waiting:e.waiting}),(()=>{const j=L5(e);return j?i.jsxs("div",{className:"approval-blind-row",title:j.detail,children:[i.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),i.jsx("span",{className:"approval-blind-said",children:j.label})]}):null})(),(e.tools.length>0||(((b=e.outputs)==null?void 0:b.length)??0)>0)&&i.jsx(R6,{tools:e.tools,outputs:e.outputs}),i.jsxs("div",{className:"meta",children:[i.jsxs("span",{children:[i.jsx("b",{children:e.toolCount})," tools"]}),a>0&&i.jsxs("span",{className:"failed-meta",title:`${a} tool ${a===1?"call":"calls"} returned an error`,children:[i.jsx("b",{children:a})," err"]}),r>0&&i.jsxs("span",{className:"inflight-meta",children:[i.jsx("b",{children:r})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&i.jsxs("span",{className:"tokens-meta",title:`in:${e.usage.inputTokens} out:${e.usage.outputTokens} cache-r:${e.usage.cacheReadTokens} cache-c:${e.usage.cacheCreateTokens}${(e.usage.reasoningOutputTokens??0)>0?` reasoning:${e.usage.reasoningOutputTokens}`:""}`,children:[i.jsx("b",{children:bn(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const j=Wi(e.model),E=tr(e),C=Kd(e);if(!j&&E.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:i.jsx("span",{className:"cost-unpriced",title:H1(e),children:ji});if(E.total<=0)return null;const T=Math.max(0,((e.endedAt??Date.now())-e.startedAt)/1e3),R=e.state==="active"&&!e.synthetic?o0(E.total,T):null,$=H1(e)+(R?`
68
- burn: ${R}`:"");return i.jsx("span",{className:"cost-meta",title:$,children:i.jsxs("b",{children:[Nt(E.total),C>0?"+":""]})})})()]}),i.jsx(ko,{type:"source",position:We.Right,style:{background:"transparent",border:"none"}})]})}const N6=x.memo(_6);function S6({start:e,end:t}){const n=vh(1e3);return i.jsx(i.Fragment,{children:Yd(e,t,n)})}function hc(e){return e==="active"?"live":e==="done"?"done":"err"}function j6({state:e}){return i.jsx("span",{className:`state-pill state-${e}`,children:hc(e)})}function Bi(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function E6(e,t=Date.now()){const n=e.tools.filter(a=>a.ok===!1).length,r=tr(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",hc(e.state),Eo(e.waiting)?Bi(e.waiting):null,e.model?_o(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,n>0?`${n} failed`:null,r>0?`${Nt(r)}${Kd(e,t)>0?"+":""}`:null].filter(Boolean).join(", ")}function C6(e,t){const n=EA(e,t);return n?`Likely on: ${n}`:null}function T6(e){return e.kind==="idle"?"Your turn":Bi(e)}function A6({waiting:e}){const t=vh(1e3),n=Eo(e),r=Bi(e);return i.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${r}
69
- Blocked for ${Yd(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?i.jsx("span",{className:"ap-pulse","aria-hidden":!0}):i.jsx("span",{className:"waiting-dot","aria-hidden":!0}),i.jsx("span",{className:"waiting-said",children:T6(e)}),i.jsx("b",{children:Yd(e.since,void 0,t)})]})}function u0(){return i.jsxs("svg",{className:"recap-glyph",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[i.jsx("path",{d:"M3.3 3.3l5.4 5.4M8.7 3.3l-5.4 5.4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",fill:"none"}),i.jsx("circle",{cx:"6",cy:"1.2",r:"1.05",fill:"currentColor"}),i.jsx("circle",{cx:"6",cy:"10.8",r:"1.05",fill:"currentColor"}),i.jsx("circle",{cx:"1.2",cy:"6",r:"1.05",fill:"currentColor"}),i.jsx("circle",{cx:"10.8",cy:"6",r:"1.05",fill:"currentColor"})]})}function R6({tools:e,outputs:t}){const n=vh(1e3),r=6e4,a=24,l=r/a,c=new Array(a).fill(0);let u=0;const f=E=>{const C=n-E;if(C<0||C>=r)return;const T=a-1-Math.floor(C/l);T>=0&&T<a&&(c[T]+=1,u+=1)};for(const E of e)f(E.startedAt);for(const E of t??[])f(E);const p=2,h=Math.max(0,...c),m=132,y=14,w=m/a,N=h/(l/1e3),k=e.filter(E=>n-E.startedAt>=0&&n-E.startedAt<r).length,S=u-k,b=[k>0?`${k} tool ${k===1?"call":"calls"}`:"",S>0?`${S} ${S===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),j=u===0?"nothing in the last 60s":`${b.join(" · ")} in last 60s · peak ${N.toFixed(1)}/s`;return i.jsxs("div",{className:"tool-spark-row",title:j,children:[i.jsx("svg",{className:"tool-spark",width:m,height:y,viewBox:`0 0 ${m} ${y}`,"aria-hidden":!0,children:c.map((E,C)=>{const T=E===0?1.5:Math.max(1.5,Math.min(1,E/p)*y),R=C===a-1&&E>0,D=`tool-spark-bar${E>0?" active":""}${R?" latest":""}`;return i.jsx("rect",{x:C*w+.4,y:y-T,width:Math.max(.5,w-1),height:T,rx:.8,className:D},R?`landed:${E}`:C)})}),i.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function M6(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function Np(e){return e!=="gone"}function Sp(e,t){const[n,r]=x.useState(()=>e?"here":"gone"),a=x.useRef(null);return x.useEffect(()=>{r(l=>M6(e,l))},[e]),x.useEffect(()=>{if(n==="leaving")return a.current=window.setTimeout(()=>r("gone"),t),()=>{a.current!=null&&window.clearTimeout(a.current)}},[n,t]),x.useEffect(()=>{n==="entering"&&r("here")},[n]),n}async function bh(e,t=500){var r;if(!e)return!1;let n=!1;try{n=await Promise.race([((r=navigator.clipboard)==null?void 0:r.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(a=>window.setTimeout(()=>a(!1),t))])}catch{n=!1}if(n)return!0;try{const a=document.createElement("textarea");a.value=e,a.setAttribute("readonly",""),a.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(a),a.select(),n=document.execCommand("copy"),a.remove()}catch{n=!1}return n}const I6=60,$6=6e3,cs=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),Zn=e=>typeof e=="string"?e:null;function No(e,t=""){if(e==null)return"(none)";if(typeof e=="string")return e;if(typeof e!="object")return String(e);const n=Array.isArray(e),r=n?e.map((l,c)=>[String(c),l]):Object.entries(e);if(r.length===0)return n?"[]":"{}";const a=[];for(const[l,c]of r){const u=n?`${t}-`:`${t}${l}:`;if(typeof c=="string"&&c.includes(`
70
- `)){a.push(u);for(const f of c.split(`
71
- `))a.push(`${t} ${f}`)}else if(c!==null&&typeof c=="object"){const f=No(c,`${t} `);f==="[]"||f==="{}"?a.push(`${u} ${f}`):a.push(u,f)}else a.push(`${u} ${c===void 0?"(none)":String(c)}`)}return a.join(`
72
- `)}function O6(e){return e.lines??e.text.split(`
73
- `).map(t=>({text:t}))}function L6(e,t){if(t)return{shown:e,cut:!1};const n=[];let r=0;for(const a of e){if(n.length===I6)return{shown:n,cut:!0};const l=$6-r;if(a.text.length>l)return n.push({...a,text:`${a.text.slice(0,Math.max(l,0))}…`}),{shown:n,cut:!0};n.push(a),r+=a.text.length+1}return{shown:n,cut:!1}}const Cn=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),Qn=(e,t)=>({label:e,text:t,inline:!0}),PA=(e,t)=>({label:e,text:t.map(n=>n.text).join(`
74
- `),lines:t});function P6(e,t){return[...e.split(`
75
- `).map(n=>({text:`- ${n}`,tone:"del"})),...t.split(`
76
- `).map(n=>({text:`+ ${n}`,tone:"add"}))]}function D6(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!cs(n)||!Array.isArray(n.lines))return null;t.push({text:`@@ -${n.oldStart},${n.oldLines} +${n.newStart},${n.newLines} @@`,tone:"ctx"});for(const r of n.lines){const a=String(r);t.push(a.startsWith("+")?{text:a,tone:"add"}:a.startsWith("-")?{text:a,tone:"del"}:{text:a})}}return t}function U1(e){if(typeof e=="string")return[Cn(void 0,e)];if(!cs(e))return[Cn(void 0,No(e))];const t=[],n=Zn(e.type);n==="create"&&t.push(Qn("result","created the file"));const r=D6(e.structuredPatch);return r&&t.push(PA("applied",r)),e.userModified===!0&&t.push(Qn("note","the user changed it before it was applied")),t.length?t:[Qn("result",n==="update"?"updated the file":"done")]}function q6(e){const t=typeof e.offset=="number"?e.offset:null,n=typeof e.limit=="number"?e.limit:null;if(t==null&&n==null)return null;const r=t??1;return n!=null?`${r}–${r+n-1}`:`from ${r}`}function F6(e){if(typeof e=="string")return[Cn(void 0,e)];const t=cs(e)&&cs(e.file)?e.file:null,n=Zn(t==null?void 0:t.content);if(t&&n!=null){const a=[],l=Number(t.numLines),c=Number(t.totalLines),u=Number(t.startLine);return Number.isFinite(l)&&Number.isFinite(c)&&c>0&&a.push(Qn("lines",l>=c?`all ${c}`:Number.isFinite(u)?`${u}–${u+l-1} of ${c}`:`${l} of ${c}`)),a.push(Cn("content",n)),a}const r=cs(e)?Zn(e.type):null;return r&&r!=="text"?[Qn("result",`${/^[aeiou]/i.test(r)?"an":"a"} ${r} file`)]:[Cn(void 0,No(e))]}function B6(e){if(typeof e=="string")return[Cn("output",e)];if(!cs(e))return[Cn(void 0,No(e))];const t=Zn(e.stdout),n=Zn(e.stderr);if(t==null&&n==null)return[Cn(void 0,No(e))];const r=[];return t&&r.push(Cn("output",t.replace(/\n$/,""))),n&&r.push(Cn("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&r.push(Qn("note","interrupted before it finished")),r.length?r:[Qn("output","none")]}function z6(e,t,n){const r=cs(t)?t:null;if(r&&(e==="Edit"||e==="MultiEdit")){const a=Zn(r.file_path),l=(e==="MultiEdit"?Array.isArray(r.edits)?r.edits:[]:[r]).filter(cs).filter(c=>Zn(c.old_string)!=null&&Zn(c.new_string)!=null);if(a&&l.length){const c=[Qn("file",a)];return l.forEach((u,f)=>{const p=u.replace_all===!0?", every occurrence":"";c.push(PA(l.length>1?`change ${f+1}${p}`:`change${p}`,P6(u.old_string,u.new_string)))}),{input:c,response:U1(n)}}}if(r&&e==="Write"){const a=Zn(r.file_path),l=Zn(r.content);if(a&&l!=null)return{input:[Qn("file",a),Cn("content",l)],response:U1(n)}}if(r&&e==="Read"){const a=Zn(r.file_path);if(a){const l=q6(r);return{input:l?[Qn("file",a),Qn("lines",l)]:[Qn("file",a)],response:F6(n)}}}if(r&&e==="Bash"){const a=Zn(r.command);if(a!=null){const l=Zn(r.description);return{input:l?[Cn("command",a),Qn("why",l)]:[Cn("command",a)],response:B6(n)}}}return{input:[Cn(void 0,No(t))],response:[Cn(void 0,No(n))]}}function W1(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(cs(n)){if(e==="Bash"&&t==="input"&&typeof n.command=="string")return n.command;if(e==="Bash"&&t==="response"&&(typeof n.stdout=="string"||typeof n.stderr=="string"))return[n.stdout,n.stderr].filter(r=>typeof r=="string"&&r!=="").join(`
77
- `);if(e==="Read"&&t==="response"&&cs(n.file)&&typeof n.file.content=="string")return n.file.content}try{return JSON.stringify(n,null,2)??String(n)}catch{return String(n)}}function H6({tool:e,onClose:t}){const n=rn(t),r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",a=e.input??e.inputPreview,l=e.response??e.errorPreview,c=z6(e.name,a,l);return i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),i.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),i.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),i.jsxs("div",{className:"modal-actions",children:[i.jsx("span",{className:"modal-dur",children:CA(e,"in-flight…")}),i.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),i.jsxs("section",{className:"modal-body",children:[e.trimmed&&i.jsx("div",{className:"modal-section",children:i.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),i.jsxs("div",{className:"modal-section",children:[i.jsxs("div",{className:"tm-head",children:[i.jsx("h4",{children:"Input"}),i.jsx(G1,{text:W1(e.name,"input",a),what:"input"})]}),c.input.map((u,f)=>i.jsx(V1,{block:u},f))]}),i.jsxs("div",{className:"modal-section",children:[i.jsxs("div",{className:"tm-head",children:[i.jsxs("h4",{children:["Response ",r==="err"&&i.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&i.jsx(G1,{text:W1(e.name,"response",l),what:"response"})]}),e.endedAt==null?i.jsx("pre",{children:"(waiting…)"}):c.response.map((u,f)=>i.jsx(V1,{block:u},f))]})]})]})})}const U6={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function V1({block:e}){const[t,n]=x.useState(!1);if(e.inline)return i.jsxs("p",{className:"tm-inline",children:[e.label&&i.jsx("span",{className:"tm-label",children:e.label}),i.jsx("code",{children:e.text})]});const{shown:r,cut:a}=L6(O6(e),t);return i.jsxs("div",{className:"tm-block",children:[e.label&&i.jsx("span",{className:"tm-label",children:e.label}),i.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?r.map((l,c)=>i.jsxs("span",{className:l.tone?U6[l.tone]:void 0,children:[l.text,c<r.length-1?`
78
- `:""]},c)):r.map(l=>l.text).join(`
79
- `)}),a&&i.jsx("button",{type:"button",className:"btn tm-more",onClick:()=>n(!0),children:"show all"})]})}function G1({text:e,what:t}){const[n,r]=x.useState(!1),a=x.useRef(!0);return x.useEffect(()=>()=>{a.current=!1},[]),i.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void bh(e).then(l=>{!l||!a.current||(r(!0),window.setTimeout(()=>{a.current&&r(!1)},1600))}),children:n?"copied":"copy"})}const hd=18,K1=26,W6=12,V6=240;function G6(e,t){return(e+V6)*(t||1)}function K6(e){return Y6(e.nodeInternals.values())}function Y6(e){const t=new Map;for(const a of e){if(a.type!=="agent"&&a.type!=="recapNote")continue;const l=a.data;if(!(l!=null&&l.sessionId)||l.exitAt!=null||a.width==null||a.height==null)continue;const c=a.position.x,u=a.position.y,f=c+a.width,p=u+a.height,h=t.get(l.sessionId);h?(h.minX=Math.min(h.minX,c),h.minY=Math.min(h.minY,u),h.maxX=Math.max(h.maxX,f),h.maxY=Math.max(h.maxY,p),l.kind==="root"&&(h.label=Z1(l)??h.label),l.kind==="root"&&(h.name=Q1(l))):t.set(l.sessionId,{minX:c,minY:u,maxX:f,maxY:p,label:Z1(l)??l.sessionId,name:Q1(l)})}const n=new Map;for(const a of t.values())n.set(a.label,(n.get(a.label)??0)+1);const r=[];for(const[a,l]of t){const c=(n.get(l.label)??0)>1;r.push({sessionId:a,...Q6(l.label,l.name,a,c),x:l.minX-hd,y:l.minY-hd-K1,w:l.maxX-l.minX+hd*2,h:l.maxY-l.minY+hd*2+K1})}return r}const kx=" · ",X6=32,Z6=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function Y1(e){return Z6.test(e)?2:1}function X1(e,t=X6){const n=[...e];let r=0;for(const c of n)r+=Y1(c);if(r<=t)return e;const a=[];let l=0;for(const c of n){const u=Y1(c);if(l+u>t-1)break;a.push(c),l+=u}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function Q6(e,t,n,r){const a=(t==null?void 0:t.trim())??"",l=r?J6(n):void 0,c=[e,a||void 0,l].filter(Boolean);return{label:X1(e),name:a?X1(a):void 0,shortId:l,fullLabel:c.join(kx)}}function J6(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function Z1(e){if(e.kind==="root")return e.label}function Q1(e){if(e.kind==="root")return TA(e.sessionName,e.sessionTitle).face}function eD({onFit:e}){const{x:t,y:n,zoom:r}=uA(),a=kc(),l=yt(K6,tD);if(l.length<=1)return null;const c=f=>{try{const p=a.getNodes().filter(h=>{const m=h.data;return(m==null?void 0:m.sessionId)===f});if(p.length===0)return;a.fitView({padding:.3,duration:500,nodes:p}),e==null||e()}catch{}},u={transform:`translate(${t}px, ${n}px) scale(${r})`};return i.jsx("div",{className:"session-clusters",style:u,children:l.map(f=>{const p=Gd(f.sessionId),h={position:"absolute",left:0,top:0,transform:`translate(${f.x}px, ${f.y}px)`,width:f.w,height:f.h,"--session-hue":p},m={position:"absolute",left:f.x+16,top:f.y-W6/(r||1),transform:`scale(${1/(r||1)})`,transformOrigin:"left top",maxWidth:G6(f.w,r),"--session-hue":p};return i.jsxs(fe.Fragment,{children:[i.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),i.jsxs("button",{type:"button",className:"cluster-label",style:m,title:`Fit view to ${f.fullLabel}
80
- drag the wrapper to move the whole session`,onClick:()=>c(f.sessionId),children:[f.label,f.name?i.jsx("span",{className:"cluster-label-name",children:kx+f.name}):null,f.shortId?i.jsx("span",{className:"cluster-label-id",children:kx+f.shortId}):null]})]},f.sessionId)})})}function tD(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e[n],a=t[n];if(r.sessionId!==a.sessionId||r.label!==a.label||r.name!==a.name||r.shortId!==a.shortId||r.fullLabel!==a.fullLabel||r.x!==a.x||r.y!==a.y||r.w!==a.w||r.h!==a.h)return!1}return!0}function nD({data:e}){return i.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}function DA(e){const t=Math.max(0,e);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Ad(e){return DA(Math.floor(e/1e3))}function qA(e,t){const n=e-t;if(n<=0)return null;const r=Math.floor(n/86400),a=Math.floor(n%86400/3600),l=Math.floor(n%3600/60);return r>0?`${r}d ${a}h`:a>0?`${a}h ${l}m`:`${l}m`}function rD(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function _x(e,t,n){const r=new Date(e),a=Ad(t-e);return{label:rD(r,new Date(t))?a:`${a} · ${r.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:r.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function sD({data:e}){const t=vh(3e4),n=_x(e.recap.at,t);return i.jsxs("div",{className:"recap-note",role:"note","aria-label":"Claude Code's recap",style:{"--session-hue":e.hue},children:[i.jsxs("div",{className:"recap-note-head",children:[i.jsxs("span",{className:"recap-note-mark",children:[i.jsx(u0,{}),"recap"]}),i.jsx("span",{className:"recap-note-age",title:n.title,children:n.label}),i.jsx("button",{type:"button",className:"glyph-btn recap-note-close","aria-label":"Hide the recap",title:"Hide — the ※ on the card brings it back",onClick:r=>{r.stopPropagation(),w6(e.noteKey)},children:"×"})]}),i.jsx("p",{className:"recap-note-text",children:e.recap.text}),i.jsx(ko,{type:"source",position:We.Right,style:{background:"transparent",border:"none"}})]})}function aD({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a,targetPosition:l,style:c}){const[u]=Zx({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:l,curvature:.35});return i.jsxs("g",{className:"recap-tie",style:c,children:[i.jsx("path",{className:"recap-tie-thread",d:u}),i.jsx("path",{className:"recap-tie-beads",d:u}),i.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),i.jsx("circle",{className:"recap-tie-end",cx:n,cy:r,r:3.5})]})}const jc={exec:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},exec_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},write_stdin:{category:"shell",emoji:"💻",label:"stdin",shell:!0},wait:{category:"shell",emoji:"⏳",label:"wait",shell:!0},apply_patch:{category:"file",emoji:"🩹",label:"Edit"},update_plan:{category:"task",emoji:"📋",label:"Plan"},run:{category:"web",emoji:"🌐",label:"Web"}},oD=Object.fromEntries(Object.entries(jc).map(([e,t])=>[e,t.category])),iD=Object.fromEntries(Object.entries(jc).map(([e,t])=>[e,t.emoji])),lD=Object.fromEntries(Object.entries(jc).map(([e,t])=>[e,t.label])),cD=new Set(Object.keys(jc)),uD=new Set(Object.entries(jc).filter(([,e])=>e.shell).map(([e])=>e)),J1={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",WebFetch:"web",WebSearch:"web",Task:"agent",Agent:"agent",TodoWrite:"task",TaskCreate:"task",TaskUpdate:"task",TaskList:"task",TaskGet:"task",TaskOutput:"task",TaskStop:"task",EnterPlanMode:"plan",ExitPlanMode:"plan",AskUserQuestion:"plan",Skill:"plan",Workflow:"plan",...oD};function FA(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(J1,e)?J1[e]:"other"}const dD=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,hD=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function fD(e){if(typeof e!="string"||!e)return null;const t=dD.exec(e);if(t){const r=pD(t[2]);if(r.trim())return r}const n=hD.exec(e);return n?n[1]:null}function pD(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
81
- `:n==="r"?"\r":n==="t"?" ":n)}const BA=600,mD=4,gD=36,Nx=16,yD=60,wD=6,e_=220,t_=96,vD=28,n_={Read:"📖",Write:"💾",Edit:"✏️",MultiEdit:"🔧",Glob:"🗺️",Grep:"🔎",Bash:"⚡",PowerShell:"💻",LS:"📂",Task:"🤖",Agent:"🤖",TodoWrite:"📋",TaskCreate:"📋",TaskUpdate:"📝",TaskList:"🗂️",TaskGet:"🗂️",TaskOutput:"📤",TaskStop:"🛑",WebFetch:"🌐",WebSearch:"🔭",ToolSearch:"🧰",NotebookEdit:"📓",EnterPlanMode:"🧭",ExitPlanMode:"🏁",AskUserQuestion:"❓",ScheduleWakeup:"⏰",CronCreate:"⏰",CronList:"📅",CronDelete:"🗑️",Skill:"🎯",Workflow:"🎬",Monitor:"📡",PushNotification:"🔔",RemoteTrigger:"📡",...iD};function r_(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(n_,e)?n_[e]:"✨"}const s_={git:"🐙",gh:"🐙",glab:"🐙",npm:"📦",pnpm:"📦",yarn:"📦",bun:"📦",brew:"🍺",node:"🟢",deno:"🟢",python:"🐍",python3:"🐍",py:"🐍",pip:"🐍",pip3:"🐍",uv:"🐍",ruby:"💎",bundle:"💎",gem:"💎",cargo:"🦀",rustc:"🦀",rustup:"🦀",go:"🐹",docker:"🐳","docker-compose":"🐳",podman:"🐳",kubectl:"☸️",helm:"☸️",k9s:"☸️",grep:"🔎",rg:"🔎",ag:"🔎",ack:"🔎",find:"🔍",fd:"🔍",locate:"🔍",which:"🔍",ls:"📂",dir:"📂",tree:"📂",cat:"📄",head:"📄",tail:"📄",less:"📄",more:"📄",bat:"📄",cp:"📋",mv:"✂️",rm:"🗑️",rmdir:"🗑️",mkdir:"📁",touch:"📁",sed:"✏️",awk:"✏️",tr:"✏️",curl:"🌐",wget:"🌐",http:"🌐",httpie:"🌐",ssh:"🔐",scp:"🔐",rsync:"🔐",ping:"📡",make:"🔨",cmake:"🔨",ninja:"🔨",bazel:"🔨",just:"🔨",terraform:"🏗️",ansible:"📕",pulumi:"🏗️",ps:"📊",top:"📊",htop:"📊",btm:"📊",kill:"💀",pkill:"💀",systemctl:"⚙️",service:"⚙️",tar:"🗜️",zip:"🗜️",unzip:"🗜️",gzip:"🗜️","7z":"🗜️",vim:"📝",nvim:"📝",nano:"📝",emacs:"📝",code:"📝",jq:"🪺",yq:"🪺",echo:"💬",printf:"💬",ffmpeg:"🎞️",ffprobe:"🎞️",imagemagick:"🖼️",convert:"🖼️","Get-ChildItem":"📂","Get-Content":"📄","Set-Content":"💾","Out-File":"💾","Add-Content":"💾","Set-Location":"📍","Get-Location":"📍","Get-Process":"📊","Start-Process":"▶️","Stop-Process":"💀","Invoke-WebRequest":"🌐","Invoke-RestMethod":"🌐","New-Item":"📁","Remove-Item":"🗑️","Copy-Item":"📋","Move-Item":"✂️","Test-Path":"🔍","Where-Object":"🔎","ForEach-Object":"🔁","Select-Object":"🎯","Measure-Object":"📊","Get-Service":"⚙️","Restart-Service":"⚙️","ConvertTo-Json":"🪺","ConvertFrom-Json":"🪺"};function zA(e){if(!e)return null;let t=e.trim();if(!t)return null;const n=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(n)return zA(n[1]);for(;;){const l=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;t=t.slice(l[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const r=t.match(/^([^\s|;&<>(]+)/);if(!r)return null;let a=r[1];return/^[A-Za-z0-9_][\w.+-]*$/.test(a.replace(/^.*[/\\]/,""))?(a=a.replace(/^.*[/\\]/,""),a=a.replace(/\.(exe|cmd|bat|ps1)$/i,""),a||null):null}function xD(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=fD(t.script);if(n)return n}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(n=>typeof n=="string")){const n=t.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(n[0]??"")){const r=n.findIndex(a=>/^(-Command|-c)$/i.test(a));if(r>=0&&r+1<n.length)return n[r+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const bD=new Set(["Bash","PowerShell",...uD]),kD=cD;function _D(e,t){return kD.has(e)||e.startsWith("mcp__")?Math.max(t_,34+t.length*7.5):t_}function ND(e,t){if(!bD.has(e))return null;const n=xD(t);if(!n)return null;const r=zA(n);return r?{emoji:Object.hasOwn(s_,r)?s_[r]:"⚙️",label:r,category:"shell",detail:n}:null}const SD=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),a_={ts:"🟦",tsx:"🟦",d:"🟦",js:"🟨",jsx:"🟨",mjs:"🟨",cjs:"🟨",py:"🐍",pyi:"🐍",ipynb:"📓",rs:"🦀",go:"🐹",rb:"💎",erb:"💎",java:"☕",kt:"☕",scala:"☕",gradle:"☕",cs:"🔷",fs:"🔷",php:"🐘",swift:"🦅",c:"🇨",cpp:"🇨",cc:"🇨",h:"🇨",hpp:"🇨",md:"📝",mdx:"📝",rst:"📝",json:"🪺",json5:"🪺",jsonl:"🪺",yaml:"⚙️",yml:"⚙️",toml:"⚙️",ini:"⚙️",conf:"⚙️",cfg:"⚙️",xml:"📰",html:"🌐",htm:"🌐",vue:"🌐",svelte:"🌐",css:"🎨",scss:"🎨",sass:"🎨",less:"🎨",sh:"⚡",bash:"⚡",zsh:"⚡",fish:"⚡",ps1:"⚡",txt:"📄",log:"📄",out:"📄",csv:"📊",tsv:"📊",xlsx:"📊",xls:"📊",pdf:"📕",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",webp:"🖼️",svg:"🖼️",ico:"🖼️",mp4:"🎬",mov:"🎬",avi:"🎬",mkv:"🎬",webm:"🎬",mp3:"🎵",wav:"🎵",ogg:"🎵",flac:"🎵",zip:"🗜️",tar:"🗜️",gz:"🗜️",bz2:"🗜️","7z":"🗜️",xz:"🗜️",rar:"🗜️",env:"🔐",lock:"🔐",pem:"🔐",key:"🔐",crt:"🔐",sql:"🗄️",db:"🗄️",sqlite:"🗄️",parquet:"🗄️"},o_={dockerfile:"🐳",makefile:"🔨",rakefile:"💎","package.json":"📦","pnpm-lock.yaml":"📦","yarn.lock":"📦","cargo.toml":"🦀","cargo.lock":"🦀","go.mod":"🐹","go.sum":"🐹","pyproject.toml":"🐍","requirements.txt":"🐍","readme.md":"📖",readme:"📖",license:"📜",".gitignore":"🐙",".gitattributes":"🐙",".env":"🔐",".dockerignore":"🐳"};function jD(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),r=n.lastIndexOf("/");return r>=0?n.slice(r+1):n}function ED(e){const t=e.toLowerCase();if(Object.hasOwn(o_,t))return o_[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const r=t.slice(n+1);if(Object.hasOwn(a_,r))return a_[r]}return"📄"}function CD(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const r=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return r?r[1].trim():null}return typeof n.file_path=="string"?n.file_path:typeof n.notebook_path=="string"?n.notebook_path:typeof n.path=="string"?n.path:e==="Glob"&&typeof n.pattern=="string"?n.pattern:null}function TD(e,t){if(!SD.has(e))return null;const n=CD(e,t);if(!n)return null;const r=jD(n);return r?{emoji:e==="LS"?"📂":ED(r),label:r,category:"file",detail:n}:null}const i_={github:{emoji:"🐙",name:"GitHub"},git:{emoji:"🐙",name:"Git"},gitlab:{emoji:"🦊",name:"GitLab"},slack:{emoji:"💬",name:"Slack"},discord:{emoji:"💬",name:"Discord"},linear:{emoji:"📐",name:"Linear"},jira:{emoji:"🅹",name:"Jira"},atlassian:{emoji:"🅰️",name:"Atlassian"},notion:{emoji:"📓",name:"Notion"},asana:{emoji:"📋",name:"Asana"},intercom:{emoji:"💬",name:"Intercom"},figma:{emoji:"🎨",name:"Figma"},gmail:{emoji:"📧",name:"Gmail"},calendar:{emoji:"📅",name:"Calendar"},drive:{emoji:"☁️",name:"Drive"},zoom:{emoji:"📹",name:"Zoom"},spotify:{emoji:"🎵",name:"Spotify"},youtube:{emoji:"📺",name:"YouTube"},ccd_session:{emoji:"📡",name:"Session"},ccd_directory:{emoji:"📂",name:"Directory"},ccd_session_mgmt:{emoji:"📡",name:"Sessions"},mcp_registry:{emoji:"🧰",name:"Registry"},"computer-use":{emoji:"🖱️",name:"Computer"},"claude-in-chrome":{emoji:"🌐",name:"Chrome"},"claude-preview":{emoji:"👀",name:"Preview"},"scheduled-tasks":{emoji:"⏰",name:"Scheduler"},visualize:{emoji:"🎨",name:"Visualize"},"plugin-design-asana":{emoji:"📋",name:"Asana"},"plugin-design-atlassian":{emoji:"🅰️",name:"Atlassian"},"plugin-design-figma":{emoji:"🎨",name:"Figma"},"plugin-design-intercom":{emoji:"💬",name:"Intercom"},"plugin-design-linear":{emoji:"📐",name:"Linear"},"plugin-design-notion":{emoji:"📓",name:"Notion"},"plugin-design-slack":{emoji:"💬",name:"Slack"}};function d0(e){if(!e.startsWith("mcp__"))return null;const t=e.slice(5),n=t.indexOf("__");return n<=0?{server:t,method:""}:{server:t.slice(0,n),method:t.slice(n+2)}}function AD(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}function HA(e){const t=e.toLowerCase();return Object.hasOwn(i_,t)?i_[t]:void 0}function RD(e,t){const n=d0(e);if(!n)return null;const{server:r,method:a}=n;if(!a)return null;const l=HA(r);return{emoji:(l==null?void 0:l.emoji)??"🔌",label:a,category:"mcp",detail:l?`${l.name} · ${a}`:`${r} · ${a}`}}function MD(e,t){return ND(e,t)??TD(e,t)??RD(e)}const l_=lD,c_=18;function ID(e){const t=[...e];return t.length<=c_?e:t.slice(0,c_-1).join("")+"…"}function UA(e){const t=d0(e);if(t){const r=HA(t.server);return r?{emoji:r.emoji,label:r.name}:{emoji:"🔌",label:ID(t.server),hue:AD(t.server)}}const n=Object.hasOwn(l_,e)?l_[e]:"";return n?{emoji:r_(e),label:n}:{emoji:r_(e),label:e}}function $D(e){let t=null,n="";for(const r of e){const a=d0(r);if(a){if(!a.server)return null;if(t===null)t=a.server,n=r;else if(a.server!==t)return null}}return t===null?null:UA(n)}function OD(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function LD(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/BA)}function PD(e,t){const n=[],r=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const l=e[a];r.has(l.id)||(r.add(l.id),n.push(l))}return n.reverse()}function DD(e,t,n,r,a,l){const c=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&l-u.exitAt>BA)continue;const f=r.get(u.id)??n.get(u.id);if(!f)continue;const p=PD(u.tools,mD);if(p.length===0)continue;const h=u.exitAt??null,m=a.get(u.id),y=Math.max((m==null?void 0:m.width)??e_,e_),w=(m==null?void 0:m.height)??130,N=f.x,k=f.y,S=N+y,b=k+w/2;p.forEach((j,E)=>{const C=E*gD,T=N+y+yD,R=k+wD+C,$=LD(l,h),D=j.inputPreview??"",U=OD(j),P=$<.999,V=UA(j.name);c.push({id:`${u.id}::${j.id}`,toolId:j.id,agentId:u.id,toolName:j.name,name:V.label,emoji:V.emoji,status:U,category:FA(j.name),mcpHue:V.hue,inputPreview:D,fade:$,fading:P,worldX:T,worldY:R,anchorX:S,anchorY:b,spawnDx:S-T,spawnDy:b-(R+Nx)});const J=MD(j.name,j.input);if(J){const ee=_D(j.name,V.label),M=T+ee+vD,Z=R,G=T+ee,I=R+Nx;c.push({id:`sub:${u.id}::${j.id}`,toolId:j.id,agentId:u.id,toolName:j.name,name:J.label,emoji:J.emoji,isSub:!0,status:U,category:J.category,inputPreview:J.detail??D,fade:$,fading:P,worldX:M,worldY:Z,anchorX:G,anchorY:I,spawnDx:G-M,spawnDy:0})}})}return c}function qD({agents:e,visibleAgentIds:t,positions:n,pinned:r,measured:a,spotlight:l,hiddenCategories:c,now:u,onOpenTool:f}){const p=DD(e,t,n,r,a,u),h=c&&c.size>0?p.filter(m=>!c.has(m.category)):p;return i.jsx(FD,{bursts:h,spotlight:l,onOpenTool:f})}function FD({bursts:e,spotlight:t,onOpenTool:n}){const{x:r,y:a,zoom:l}=uA();return i.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[i.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const u=c.anchorX*l+r,f=c.anchorY*l+a,p=(c.worldX+6)*l+r,h=(c.worldY+Nx)*l+a,m=Math.max(1,p-u),y=Math.min(1,Math.abs(h-f)/m),w=u+m*(.55-.22*y),N=t!=null&&!t.has(c.agentId),k=c.fade*(N?.14:1);return i.jsx("path",{d:`M ${u} ${f} Q ${w} ${f}, ${p} ${h}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:k},`l:${c.id}`)})}),e.map(c=>i.jsx(zD,{b:c,x:r,y:a,zoom:l,dim:t!=null&&!t.has(c.agentId),onOpenTool:n},c.id))]})}function BD(e,t){const n=e.b,r=t.b;return e.x===t.x&&e.y===t.y&&e.zoom===t.zoom&&e.dim===t.dim&&e.onOpenTool===t.onOpenTool&&n.id===r.id&&n.toolId===r.toolId&&n.worldX===r.worldX&&n.worldY===r.worldY&&n.spawnDx===r.spawnDx&&n.spawnDy===r.spawnDy&&n.status===r.status&&n.fading===r.fading&&n.category===r.category&&n.mcpHue===r.mcpHue&&n.isSub===r.isSub&&n.emoji===r.emoji&&n.name===r.name&&n.toolName===r.toolName&&n.inputPreview===r.inputPreview}const zD=x.memo(function({b:t,x:n,y:r,zoom:a,dim:l,onOpenTool:c}){const u=t.worldX*a+n,f=t.worldY*a+r,p={left:`${u}px`,top:`${f}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${t.spawnDx}px`,"--spawn-dy":`${t.spawnDy}px`},h=t.isSub?`${t.toolName} · ${t.name}`:t.toolName,m=t.inputPreview?`${h} · ${t.inputPreview}`:h,y=c!=null,w=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},N=l?" dim":"";return i.jsx("div",{className:"tool-burst-wrap",style:p,children:i.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${y?" clickable":""}${t.isSub?" sub":""}${N}`,style:w,title:m,onClick:y?()=>c(t.toolId):void 0,children:[i.jsx("span",{className:"tb-emoji",children:t.emoji}),i.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&i.jsx("span",{className:"tb-spin"}),t.status==="done"&&i.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&i.jsx("span",{className:"tb-mark err",children:"×"})]})})},BD);function HD(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,r=0,a=0,l=0;for(const c of e){const u=tr(c);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=c.usage.inputTokens,r+=c.usage.outputTokens,a+=c.usage.cacheReadTokens,l+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:r,cacheReadTokens:a,cacheCreateTokens:l,sum:n+r}}const UD="spend on this board",WD="on this board",u_=`Everything on the board right now, and only that.
82
- Finished sessions are evicted from the canvas a couple of minutes after they end, and their tokens and dollars leave with them — so this figure falls on its own.
83
- Press H for the totals ccusage reads off the logs on disk, which do not forget.`,WA="session spend";function h0({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const r=(l,c,u)=>{if(l<=0)return null;const f=l/n*100;return i.jsx("span",{className:`cb-seg ${c}`,style:{width:`${f}%`},title:`${u}: ${Nt(l)} (${f.toFixed(0)}%)`},c)},a=t==="lg";return i.jsxs("div",{className:a?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function VD({state:e,sessionId:t,onClose:n}){const r=x.useMemo(()=>GD(e,t),[e,t]),a=x.useRef(null),l=rn(n,{focusRef:a});return r?i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:l,className:"modal session-summary",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[i.jsxs("div",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),i.jsx("span",{id:"ss-title",className:"modal-tool-name",title:r.cwd??r.sessionId,children:r.label}),i.jsxs("span",{className:"modal-tool-id",children:["· ",r.sessionId.slice(0,8)]})]}),i.jsxs("div",{className:"modal-actions",children:[i.jsx("span",{className:"modal-dur",title:"Total wall time",children:r.durationLabel}),i.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),i.jsxs("div",{className:"modal-body",children:[i.jsxs("section",{className:"ss-hero",children:[i.jsxs("div",{className:"ss-hero-left",children:[i.jsx("div",{className:"ss-cost-label",children:WA}),i.jsx("div",{className:"ss-cost",children:Nt(r.cost.total)}),r.modelChips.length>0&&i.jsx("div",{className:"ss-models",children:r.modelChips.map(c=>i.jsx("span",{className:"model-chip","data-family":gh(c),title:c,children:_o(c)},c))})]}),i.jsx("div",{className:"ss-hero-right",children:r.cost.total>0&&i.jsxs(i.Fragment,{children:[i.jsx(h0,{cost:r.cost,size:"lg"}),i.jsxs("div",{className:"ss-cost-legend",children:[i.jsxs("span",{className:"ssl ssl-in",children:["input ",i.jsx("b",{children:Nt(r.cost.input)})]}),i.jsxs("span",{className:"ssl ssl-out",children:["output ",i.jsx("b",{children:Nt(r.cost.output)})]}),i.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",i.jsx("b",{children:Nt(r.cost.cacheRead)})]}),i.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",i.jsx("b",{children:Nt(r.cost.cacheWrite)})]})]})]})})]}),i.jsxs("section",{className:"ss-stats",children:[i.jsx(bi,{label:"agents",value:r.agentCount}),i.jsx(bi,{label:"subagents",value:r.subagentCount}),i.jsx(bi,{label:"tool calls",value:r.toolCount}),i.jsx(bi,{label:"prompts",value:r.promptCount}),i.jsx(bi,{label:"tokens",value:r.tokensSum.toLocaleString()}),r.errCount>0&&i.jsx(bi,{label:"errors",value:r.errCount,tone:"err"})]}),r.topTools.length>0&&i.jsxs("section",{className:"modal-section",children:[i.jsx("h4",{children:"Most-used tools"}),i.jsx("div",{className:"ss-top-tools",children:r.topTools.map(([c,u])=>i.jsxs("div",{className:"ss-tt",children:[i.jsx("span",{className:"ss-tt-name",children:c}),i.jsx("span",{className:"ss-tt-bar",children:i.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/r.topTools[0][1]*100}%`}})}),i.jsx("span",{className:"ss-tt-count",children:u})]},c))})]}),r.firstPrompt&&i.jsxs("section",{className:"modal-section",children:[i.jsx("h4",{children:"Opening prompt"}),i.jsx("div",{className:"ss-prompt",children:r.firstPrompt})]})]})]})}):null}function bi({label:e,value:t,tone:n}){return i.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[i.jsx("div",{className:"ss-stat-value",children:t}),i.jsx("div",{className:"ss-stat-label",children:e})]})}function GD(e,t){const n=e.agents.get(t);if(!n)return null;const r=[];for(const E of e.agents.values())E.sessionId===t&&r.push(E);if(r.length===0)return null;const a={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},l=new Set,c=new Map;let u=0,f=0,p=0,h=0,m=0,y,w=1/0,N=0;for(const E of r){const C=tr(E);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const R of SA(E))l.add(R);E.model&&l.add(E.model),E.kind==="subagent"&&m++;const T=mA(E.prompts);f+=T.length,!y&&T.length>0&&(y=T[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,u+=E.toolCount,w=Math.min(w,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const R of E.tools)c.set(R.name,(c.get(R.name)??0)+1),R.ok===!1&&h++}const k=Math.max(0,N-w),S=Math.floor(k/1e3),b=S<60?`${S}s`:S<3600?`${Math.floor(S/60)}m ${String(S%60).padStart(2,"0")}s`:`${Math.floor(S/3600)}h ${Math.floor(S%3600/60)}m`,j=Array.from(c.entries()).sort((E,C)=>C[1]-E[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:b,cost:a,modelChips:Array.from(l),agentCount:r.length,subagentCount:m,toolCount:u,promptCount:f,tokensSum:p,errCount:h,topTools:j,firstPrompt:y}}function d_(e){return e.waiting?Eo(e.waiting)?0:1:e.state==="active"?2:3}function KD(e,t){const n=[];for(const r of e.agents.values()){if(r.kind!=="root")continue;let a=r.toolCount,l=tr(r).total,c=r.endedAt??r.startedAt;for(const u of e.agents.values()){if(u.sessionId!==r.sessionId||u.kind==="root")continue;a+=u.toolCount,l+=tr(u).total;const f=u.endedAt??u.startedAt;f>c&&(c=f)}n.push({sessionId:r.sessionId,label:r.label||r.cwdBasename||"session",cwdBasename:r.cwdBasename,state:r.state,waiting:r.waiting,recap:xh(r),modelId:r.model,toolCount:a,cost:l,startedAt:r.startedAt,lastActivity:c})}return n.sort((r,a)=>{const l=d_(r),c=d_(a);return l!==c?l-c:r.waiting&&a.waiting?r.waiting.since-a.waiting.since:a.lastActivity-r.lastActivity}),n}function h_(e,t,n){const r=(t??n)-e;if(r<1e3)return"<1s";const a=Math.floor(r/1e3);if(a<60)return`${a}s`;const l=Math.floor(a/60);return l<60?`${l}m`:`${Math.floor(l/60)}h ${l%60}m`}function YD({state:e,now:t,selectedIds:n,onSelect:r,onClose:a}){const l=x.useMemo(()=>KD(e),[e,e.revision,t]),c=l.filter(f=>f.state==="active").length,u=l.filter(f=>Eo(f.waiting)).length;return i.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[i.jsxs("div",{className:"sl-header",children:[i.jsxs("h2",{children:["Sessions ",i.jsx("span",{className:"sl-count",children:l.length})]}),u>0&&i.jsxs("span",{className:"sl-waiting-count",children:[u," waiting"]}),c>0&&i.jsxs("span",{className:"sl-live-count",children:[c," live"]}),i.jsx("button",{className:"glyph-btn sl-close",onClick:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),i.jsxs("div",{className:"sl-rows",children:[l.length===0&&i.jsx("div",{className:"sl-empty",children:"No sessions yet."}),l.map(f=>{const p=n.has(f.sessionId);return i.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>r(f.sessionId),title:`Focus ${f.label}`,children:[i.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:hc(f.state)}),i.jsxs("div",{className:"sl-row-body",children:[i.jsxs("div",{className:"sl-row-head",children:[i.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&i.jsx("span",{className:"model-chip","data-family":gh(f.modelId),title:f.modelId,children:_o(f.modelId)})]}),i.jsxs("div",{className:"sl-row-meta",children:[i.jsxs("span",{title:"tool calls",children:[i.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&i.jsx("span",{className:"sl-cost",title:WA,children:i.jsx("b",{children:Nt(f.cost)})}),f.waiting?i.jsxs("span",{className:"sl-waiting",title:[Bi(f.waiting),C6(f.waiting,Bi(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
84
- `),children:["waiting ",h_(f.waiting.since,void 0,t),f.waiting.tool&&i.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):i.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:h_(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]}),f.recap&&i.jsxs("span",{className:"sl-recap",title:f.recap.text,children:[i.jsx(u0,{}),f.recap.text]})]})]},f.sessionId)})]})]})}const XD=e=>1-Math.pow(1-e,5),VA=420;function ZD(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e===t)return!1;const n=Math.abs(t-e);if(n<1)return!1;const r=Math.max(Math.abs(e),Math.abs(t));return r===0||n/r>=.005}function QD(e,t,n,r=VA){return n>=r?t:n<=0?e:e+(t-e)*XD(n/r)}function JD(e,t,n,r={}){const a=r.now??(()=>performance.now()),l=r.raf??(w=>requestAnimationFrame(w)),c=r.cancel??(w=>cancelAnimationFrame(w)),u=r.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=r.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||f()||!ZD(e,t))return n(t),()=>{};const p=a();let h=0,m=!0;const y=()=>{if(!m)return;const w=a()-p;n(QD(e,t,w)),w<VA&&(h=l(y))};return h=l(y),()=>{m=!1,h&&c(h)}}const Sx={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function jp(e,t){const n=new Map;for(const r of e){if(r.kind!=="root"||!r.sessionId)continue;const a=tr(r,t);n.set(r.sessionId,{cost:a.total,inputTokens:r.usage.inputTokens,outputTokens:r.usage.outputTokens,cacheReadTokens:r.usage.cacheReadTokens,cacheCreateTokens:r.usage.cacheCreateTokens})}return n}function eq(e,t){if(!e)return Sx;const n={...Sx};for(const[r,a]of t){const l=e.get(r);if(!l)continue;const c={cost:a.cost-l.cost,inputTokens:a.inputTokens-l.inputTokens,outputTokens:a.outputTokens-l.outputTokens,cacheReadTokens:a.cacheReadTokens-l.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-l.cacheCreateTokens};c.cost<0||c.inputTokens<0||c.outputTokens<0||c.cost===0&&c.inputTokens===0&&c.outputTokens===0&&c.cacheReadTokens===0&&c.cacheCreateTokens===0||(n.cost+=c.cost,n.inputTokens+=Math.max(0,c.inputTokens),n.outputTokens+=Math.max(0,c.outputTokens),n.cacheReadTokens+=Math.max(0,c.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,c.cacheCreateTokens),n.sessions+=1)}return n}function GA(e,t,n){const r=nq*Math.max(1,n/YA);let a=0;for(const[l,c]of t){const u=e.get(l);if(u===void 0)continue;const f=c.cost-u.cost;f>0&&f<=r&&(a+=f)}return a}const f_={samples:[],last:new Map,watched:0},KA=10*6e4,tq=6e4,YA=5e3,nq=20;function rq(e,t,n){const r=e.samples[e.samples.length-1];if(r&&t-r.t<YA)return e;const a=e.watched+GA(e.last,n,r?t-r.t:0),l=e.samples.filter(c=>t-c.t<=KA);return l.push({t,watched:a}),{samples:l,last:n,watched:a}}function sq(e,t,n){const r=e.samples[0];if(!r)return null;const a=t-r.t;if(a<tq)return null;const l=e.samples[e.samples.length-1].t,c=e.watched+GA(e.last,n,t-l)-r.watched;return c>0?{spent:c,spanSec:a/1e3,spanMin:Math.min(KA/6e4,Math.ceil(a/6e4))}:null}function p_(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const kh=[{key:"today",label:"today",noun:"today",hint:"Since midnight, on this machine's clock."},{key:"month",label:"month",noun:"this month",hint:"Since the 1st of this calendar month — not the last 30 days."},{key:"all",label:"all",noun:"all time",hint:"Every transcript on disk, back to 2020."}];function aq(e,t,n=kh.length){return n<=0?null:e==="ArrowRight"||e==="ArrowDown"?(t+1)%n:e==="ArrowLeft"||e==="ArrowUp"?(t-1+n)%n:e==="Home"?0:e==="End"?n-1:null}function oq(e,t=new Date){return e==="today"?p_(1,t):e==="month"?p_(t.getDate(),t):"20200101"}const Jn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Rd=e=>typeof e=="string"?e:"";function XA(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const r of t){const a=Array.isArray(r==null?void 0:r.modelBreakdowns)?r.modelBreakdowns:[];for(const l of a){const c=Rd(l==null?void 0:l.modelName);if(!c)continue;let u=n.get(c);u||(u={model:c,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(c,u)),u.cost+=Jn(l==null?void 0:l.cost),u.inputTokens+=Jn(l==null?void 0:l.inputTokens),u.outputTokens+=Jn(l==null?void 0:l.outputTokens),u.cacheReadTokens+=Jn(l==null?void 0:l.cacheReadTokens),u.cacheCreateTokens+=Jn(l==null?void 0:l.cacheCreationTokens)}}return[...n.values()].sort((r,a)=>a.cost-r.cost||a.tokens-r.tokens)}const iq=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function lq(e){var t;return((t=iq.exec(e))==null?void 0:t[0])??e}function cq(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],r=[];for(const a of n){const l=Rd(a==null?void 0:a.period);if(!l)continue;const c=lq(l),u=a==null?void 0:a.metadata,f=typeof(u==null?void 0:u.lastActivity)=="string"?Date.parse(u.lastActivity):NaN;r.push({sessionId:c,label:t.get(c)??null,agent:Rd(a==null?void 0:a.agent)||"claude",cost:Jn(a==null?void 0:a.totalCost),tokens:Jn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Rd).filter(Boolean):[],lastActivityMs:Number.isFinite(f)?f:null})}return r.sort((a,l)=>l.cost-a.cost||l.tokens-a.tokens)}function ZA(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Jn(t.cacheReadTokens),p=Jn(t.cacheCreationTokens),h=Jn(t.inputTokens),m=Jn(t.outputTokens);return{cost:Jn(t.totalCost),inputTokens:h,outputTokens:m,cacheReadTokens:f,cacheCreateTokens:p,tokens:Jn(t.totalTokens)||h+m+f+p}}const n=XA(e),r=f=>n.reduce((p,h)=>p+f(h),0),a=r(f=>f.inputTokens),l=r(f=>f.outputTokens),c=r(f=>f.cacheReadTokens),u=r(f=>f.cacheCreateTokens);return{cost:r(f=>f.cost),inputTokens:a,outputTokens:l,cacheReadTokens:c,cacheCreateTokens:u,tokens:a+l+c+u}}function uq(e,t){return{data:(e==null?void 0:e.data)??null,shown:(e==null?void 0:e.period)??null,stale:e!=null&&e.period!==t,baseline:(e==null?void 0:e.baseline)??null}}function m_(e,t){var n;return((n=kh.find(r=>r.key===(e??t)))==null?void 0:n.noun)??"today"}function dq(e,t,n){const r=e!=null,a=ZA(e);return{fromRange:r,cost:r?a.cost+n.cost:t.cost.total,inputTokens:r?a.inputTokens+n.inputTokens:t.inputTokens,outputTokens:r?a.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:r?a.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:r?a.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:r?a.cost>0:t.cost.total>0,tokenSum:r?a.tokens:t.sum,showCostBar:!r}}const Yt="ccdeck";function Na(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function _h(e){return e==null}const jx="self";function wa(e,t=!1){const n=Na(e?jx:null,jx);return{disabled:t||n.disabled,"aria-busy":n.busy}}function Is(e){return _h(e?jx:null)}function hq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function g_(e){return e==null||e==="BODY"||e==="HTML"}const QA="agent-dag.usagePeriod";function fq(){const e=Sa(QA);return kh.some(t=>t.key===e)?e:"today"}function pq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(QA,e)}catch{}}const JA="agent-dag.usageSessionsOpen";function mq(){return Sa(JA)==="1"}function gq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(JA,e?"1":"0")}catch{}}function y_(e,t){if(!e)return null;const n=t-Math.floor(e/1e3);return n<10?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:`${Math.floor(n/3600)}h ago`}function yq(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget":e==="api"?"Fetched from Anthropic's usage endpoint, at most once every 5 minutes":e==="cli"?"Parsed from `claude /usage`, at most once every 5 minutes":"Last update"}const Ep="__unknown__";function wq(e,t,n,r){const a=Math.max(0,t-r),l=Math.max(0,n-a);if(l<120)return null;const c=Math.min(100,l/n*100),u=e-c;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:c,isDeficit:!1};if(u>0){const f=100-e,p=l>0?e/l:0,h=p>0?f/p:1/0,m={label:`${Math.round(u)}% over pace`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(h<a&&h<86400){const y=Math.floor(h/3600),w=Math.floor(h%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-u)}% under pace`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function fa({pct:e,label:t,reset:n,resetAt:r,windowSec:a,limitReached:l,nowSec:c}){const u=Math.min(100,Math.max(0,e)),p=l||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",h=u===0?"< 1%":`${u}%`,m=u===0?2:u,y=r?qA(r,c):null,w=r&&a?wq(u,r,a,c):null,[N,k]=x.useState(!1),S=x.useId();return i.jsxs("div",{className:"qb-row",children:[i.jsxs("div",{className:"qb-meta",children:[i.jsxs("span",{className:"qb-label",children:[t,l&&i.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),i.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),i.jsxs("div",{className:"qb-track",children:[i.jsx("div",{className:"qb-fill",style:{transform:`scaleX(${m/100})`,background:p,opacity:u===0?.4:1}}),w&&i.jsx("div",{className:"qb-pace-rail",style:{transform:`translateX(${w.expectedPct}%)`},children:i.jsx("div",{"aria-hidden":!0,className:"qb-pace-marker",style:{background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})})]}),i.jsxs("div",{className:"qb-reset-row",children:[y?i.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?i.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&i.jsxs("button",{type:"button",className:"qb-pace",style:{color:w.color},"aria-expanded":N,"aria-controls":N?S:void 0,onClick:()=>k(b=>!b),children:[i.jsx("i",{className:"qb-pace-key","aria-hidden":!0,style:{background:w.isDeficit?"var(--err)":"var(--ok)"}}),w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label]})]}),N&&w&&i.jsxs("div",{id:S,className:"qb-why",children:["To last until reset, stay near ",Math.round(w.expectedPct),"% by now."]})]})}const vq=6e4,xq=2e4;function bq(e){const[t,n]=x.useState(null),[r,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!Is(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(xq)});m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),vq),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:t,loading:r,refresh:()=>{e&&u(!0)}}}function kq(e){switch(e){case"no_subscription":return"This install signs in with an API key (or Bedrock/Vertex), which is billed per token and has no session window.";case"rate_limited":return"Anthropic asked the deck to wait — it will retry on its own.";case"waiting":return"Waiting for the next allowed read — or click ↻.";default:return"Run /usage in a claude session, then click ↻"}}function _q(e){switch(e){case"no_token":return"Run codex login to authenticate.";case"api_key_mode":return"API-key login — ChatGPT quota is only available for codex login.";case"refresh_rejected":return"Codex session expired — run codex login.";case"refresh_failed":return"Couldn't refresh the Codex token — click ↻ to retry.";case"untrusted_base_url":return"chatgpt_base_url in ~/.codex/config.toml is not an https OpenAI host, so the token was not sent.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const eR=6e4,w_=6e4;function Nq(e){const[t,n]=x.useState(null),[r,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!Is(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),eR),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:t,loading:r,refresh:()=>{e&&u(!0)}}}function Sq(e){const[t,n]=x.useState(null),r=x.useRef(null),a=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&n(await l.json())}catch{}};return x.useEffect(()=>{if(e)return a(),r.current=window.setInterval(a,eR),()=>{r.current!=null&&window.clearInterval(r.current)}},[e]),{data:t}}function jq(e,t,n){const[r,a]=x.useState(null),[l,c]=x.useState(!1),[u,f]=x.useState(0),p=x.useRef(0);x.useEffect(()=>{const m=()=>document.visibilityState==="visible",y=()=>{m()&&f(k=>k+1)},w=window.setInterval(y,w_),N=()=>{m()&&Date.now()-p.current>=w_&&f(k=>k+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",N)}},[]);const h=x.useRef(t);return x.useEffect(()=>{let m=!0;const y=t!==h.current;h.current=t;const w=e,N=oq(w);return c(!0),fetch(`/api/ccusage?since=${N}${y?"&refresh=1":""}`).then(k=>k.ok?k.json():null).then(k=>{!m||!(k!=null&&k.ok)||(p.current=Date.now(),a({period:w,data:k,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e,t,u]),{...uq(r,e),loading:l}}function Ul(e){const[t,n]=x.useState(e),r=x.useRef(e),a=x.useRef(!0);return x.useEffect(()=>{r.current=t},[t]),x.useEffect(()=>{if(a.current){a.current=!1,r.current=e,n(e);return}return JD(r.current,e,c=>{r.current=c,n(c)})},[e]),t}function Eq({state:e,now:t,providers:n,leaving:r,onClose:a,liveSince:l=null}){var qe,pt;const{quota:c,loading:u,refresh:f}=bq(n.claude),{data:p,loading:h,refresh:m}=Nq(n.codex),{data:y}=Sq(n.codex),[w,N]=x.useState(()=>Math.floor(Date.now()/1e3));x.useEffect(()=>{const ge=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ge)},[]);const k=x.useRef(f_),S=x.useRef(null),{byModel:b,totalCost:j,totalTokens:E,burnRate:C}=x.useMemo(()=>{const ge=new Map;for(const rt of e.agents.values())for(const ot of Sc(rt)){const jt=ot.model??Ep,xt=a0(ot.usage,ot.model),wt=ge.get(jt);wt?(wt.inputTokens+=ot.usage.inputTokens,wt.outputTokens+=ot.usage.outputTokens,wt.cacheReadTokens+=ot.usage.cacheReadTokens,wt.cacheCreateTokens+=ot.usage.cacheCreateTokens,wt.cost.total+=xt.total,wt.cost.input+=xt.input,wt.cost.output+=xt.output,wt.cost.cacheRead+=xt.cacheRead,wt.cost.cacheWrite+=xt.cacheWrite,wt.agentCount++):ge.set(jt,{model:jt,inputTokens:ot.usage.inputTokens,outputTokens:ot.usage.outputTokens,cacheReadTokens:ot.usage.cacheReadTokens,cacheCreateTokens:ot.usage.cacheCreateTokens,cost:{...xt},agentCount:1,priced:Wi(ot.model)!=null})}const be=Array.from(ge.values()).sort((rt,ot)=>ot.cost.total-rt.cost.total||ot.inputTokens+ot.outputTokens-(rt.inputTokens+rt.outputTokens)),Ve=HD(e.agents.values());S.current!==l&&(S.current=l,k.current=f_);const nt=jp(e.agents.values(),t);l!=null&&(k.current=rq(k.current,t,nt));const at=l==null?null:sq(k.current,t,nt),he=at?{label:o0(at.spent,at.spanSec),spanMin:at.spanMin}:null;return{byModel:be,totalCost:Ve.cost,totalTokens:Ve,burnRate:he}},[e,e.revision,t,l]),T=x.useMemo(()=>{const ge=[];for(const be of e.agents.values()){if(be.kind!=="root")continue;let Ve=tr(be).total,nt=be.usage.inputTokens,at=be.usage.outputTokens,he=Kd(be);for(const rt of e.agents.values())rt.sessionId!==be.sessionId||rt.kind==="root"||(Ve+=tr(rt).total,nt+=rt.usage.inputTokens,at+=rt.usage.outputTokens,he+=Kd(rt));ge.push({sessionId:be.sessionId,label:be.label||be.cwdBasename||"session",state:be.state,cost:Ve,inputTokens:nt,outputTokens:at,unpricedTokens:he})}return ge.sort((be,Ve)=>Ve.cost-be.cost||Ve.inputTokens+Ve.outputTokens-(be.inputTokens+be.outputTokens)).slice(0,12)},[e,e.revision]),[R,$]=x.useState(fq);x.useEffect(()=>{pq(R)},[R]);const[D,U]=x.useState(mq);x.useEffect(()=>{gq(D)},[D]);const P=x.useRef([]),[V,J]=x.useState(0),ee=x.useRef(()=>new Map);ee.current=()=>jp(e.agents.values(),t);const M=x.useCallback(()=>ee.current(),[]),{data:Z,shown:G,stale:I,loading:q,baseline:H}=jq(R,V,M),W=Z!=null,L=q&&I,K=x.useMemo(()=>{const ge=new Map;for(const be of e.agents.values()){if(be.kind!=="root"||!be.sessionId)continue;const Ve=be.label||be.cwdBasename;Ve&&ge.set(be.sessionId,Ve)}return ge},[e,e.revision]),de=x.useMemo(()=>{const ge=new Map;for(const be of e.agents.values())be.kind!=="root"||!be.sessionId||ge.set(be.sessionId,be.state);return ge},[e,e.revision]),O=x.useMemo(()=>W?XA(Z):[],[Z,W]),Y=x.useMemo(()=>{if(!W)return[];const ge=cq(Z,K).slice(0,12),be=new Map;for(const Ve of ge)Ve.label&&be.set(Ve.label,(be.get(Ve.label)??0)+1);return ge.map(Ve=>Ve.label&&(be.get(Ve.label)??0)>1?{...Ve,label:`${Ve.label} ${Ve.sessionId.slice(0,4)}`}:Ve)},[Z,W,K]),B=x.useMemo(()=>ZA(Z),[Z]),te=m_(G,R),le=I?" up-stale":"",pe=x.useMemo(()=>W?eq(H,jp(e.agents.values(),t)):Sx,[e,e.revision,H,W,t]),ye=dq(Z,{...E,cost:j},pe),Ie=ye.hasCost,Te=ye.tokenSum,Re=Ul(ye.cost),Me=Ul(ye.inputTokens),xe=Ul(ye.outputTokens),He=Ul(ye.cacheReadTokens),Ne=Ul(ye.cacheCreateTokens),_e=b.filter(ge=>ge.cost.total>0||ge.inputTokens+ge.outputTokens>0),Ze=T.filter(ge=>ge.cost>0||ge.inputTokens+ge.outputTokens>0),ct=W?O.some(ge=>ge.cost<=0&&ge.tokens>0):_e.some(ge=>!ge.priced),Ke=u||h,ce=y_(c==null?void 0:c.fetchedAt,w),je=y_(p==null?void 0:p.fetchedAt,w),$e=()=>{f(),m(),J(ge=>ge+1)},Je=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return i.jsxs("aside",{className:`usage-panel${r?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[i.jsxs("div",{className:"up-header",children:[i.jsx("h2",{children:"Usage"}),C&&i.jsxs("span",{className:"up-rate",title:`Spend on this board over the last ${C.spanMin} min`,children:[C.label,i.jsxs("span",{className:"up-rate-span",children:[" · ",C.spanMin," min"]})]}),i.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&i.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:$e,...wa(Ke),"aria-label":Je,title:Je,children:Ke?"…":"↻"}),i.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:a,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&i.jsxs("section",{className:"up-section up-quota-section",children:[i.jsxs("h3",{className:"up-section-title",children:["Claude quota",ce&&!u&&i.jsx("span",{className:"up-section-age",title:yq(c==null?void 0:c.source),children:ce})]}),c!=null&&c.ok?i.jsxs("div",{className:"up-quota-bars",children:[c.session5hPct!=null&&i.jsx(fa,{label:"5-hour window",pct:c.session5hPct,reset:c.session5hReset,resetAt:c.session5hResetAt,windowSec:c.session5hWindowSec,nowSec:w}),c.week7dPct!=null&&i.jsx(fa,{label:"7-day window",pct:c.week7dPct,reset:c.week7dReset,resetAt:c.week7dResetAt,windowSec:c.week7dWindowSec,nowSec:w}),c.weekSonnetPct!=null&&i.jsx(fa,{label:"Sonnet (7d)",pct:c.weekSonnetPct,nowSec:w}),c.weekOpusPct!=null&&i.jsx(fa,{label:"Opus (7d)",pct:c.weekOpusPct,nowSec:w}),c.extraEnabled&&c.extraUsedCredits!=null&&c.extraMonthlyLimit?i.jsx(fa,{label:`Extra credits (month${c.extraCurrency?`, ${c.extraCurrency}`:""})`,pct:Math.min(100,Math.round(c.extraUsedCredits/c.extraMonthlyLimit*100)),nowSec:w}):c.extraEnabled&&i.jsx("div",{className:"up-quota-sub up-credits",children:"extra usage credits: on"})]}):(c==null?void 0:c.ok)===!1?i.jsxs("div",{className:"up-quota-na",children:[i.jsx("span",{children:c.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),i.jsx("span",{className:"up-quota-hint",children:kq(c.reason)})]}):i.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&i.jsxs("section",{className:"up-section up-quota-section",children:[i.jsxs("h3",{className:"up-section-title",children:["Codex quota",(p==null?void 0:p.ok)&&p.planLabel&&i.jsx("span",{className:"up-plan-badge",children:p.planLabel}),je&&!h&&i.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:je})]}),p!=null&&p.ok?i.jsxs("div",{className:"up-quota-bars",children:[(qe=p.windows)==null?void 0:qe.map(ge=>i.jsx(fa,{label:ge.label,pct:ge.pct,reset:ge.reset??void 0,resetAt:ge.resetAt??void 0,windowSec:ge.windowSec??void 0,limitReached:p.limitReached&&ge.pct>=100,nowSec:w},ge.id)),(pt=p.extraWindows)==null?void 0:pt.map(ge=>i.jsx(fa,{label:ge.label,pct:ge.pct,reset:ge.reset??void 0,resetAt:ge.resetAt??void 0,windowSec:ge.windowSec??void 0,nowSec:w},ge.id)),p.creditLimit&&i.jsx(fa,{label:`spend cap · $${Math.round(p.creditLimit.used)} of $${Math.round(p.creditLimit.limit)}`,pct:p.creditLimit.usedPct,reset:p.creditLimit.reset??void 0,resetAt:p.creditLimit.resetAt??void 0,limitReached:p.spendControlReached,nowSec:w}),p.creditsBalance&&!p.creditsUnlimited&&i.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",p.creditsBalance,p.overageReached&&" · overage limit reached"]}),p.creditsUnlimited&&i.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),p.resetCredits&&p.resetCredits.availableCount>0&&i.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Yt} only reports them`,children:[p.resetCredits.availableCount," rate-limit reset",p.resetCredits.availableCount!==1?"s":""," available",p.resetCredits.nextExpiryAt&&` · expires ${new Date(p.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),p.promo&&i.jsx("div",{className:"up-quota-sub",children:p.promo}),p.partial&&i.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(p==null?void 0:p.ok)===!1?i.jsxs("div",{className:"up-quota-na",children:[i.jsx("span",{children:"Quota unavailable."}),i.jsx("span",{className:"up-quota-hint",children:_q(p.reason)})]}):i.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(y==null?void 0:y.ok)&&y.window7d&&y.window7d.sessionCount>0&&i.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${y.window5h?`
85
- last 5h: ${bn(y.window5h.totalTokens)} tokens · ${y.window5h.sessionCount} session${y.window5h.sessionCount!==1?"s":""}`:""}`,children:[bn(y.window7d.totalTokens)," tokens · ",y.window7d.sessionCount," session",y.window7d.sessionCount!==1?"s":""," (7d)"]})]}),W&&i.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":L||void 0,onKeyDown:ge=>{var nt;const be=P.current.indexOf(ge.target);if(be<0)return;const Ve=aq(ge.key,be);Ve!==null&&(ge.preventDefault(),(nt=P.current[Ve])==null||nt.focus())},children:kh.map((ge,be)=>i.jsx("button",{type:"button",ref:Ve=>{P.current[be]=Ve},tabIndex:R===ge.key?0:-1,"aria-pressed":R===ge.key,"data-pending":R===ge.key&&L?"":void 0,title:R===ge.key&&L?`Reading ${ge.noun} from the transcripts on this machine…`:ge.hint,className:"uh-range-btn",onClick:()=>$(ge.key),children:ge.label},ge.key))}),W&&i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:L?`Reading ${m_(R,R)}…`:""}),Te>0?i.jsxs(i.Fragment,{children:[Ie&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`up-total${le}`,title:W?void 0:u_,children:[i.jsx("span",{className:"up-total-value",children:Nt(Re)}),i.jsx("span",{className:"up-total-label",children:W?te:UD})]}),ye.showCostBar&&i.jsx(h0,{cost:j})]}),i.jsxs("div",{className:`up-tokens-row${le}`,title:W?void 0:u_,children:[i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"in"}),bn(Me)]}),i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"out"}),bn(xe)]}),ye.cacheReadTokens>0&&i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"cache r"}),bn(He)]}),ye.cacheCreateTokens>0&&i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"cache c"}),bn(Ne)]}),!Ie&&i.jsx("span",{className:"up-tok up-scope",children:WD})]}),(W?O.length:_e.length)>0&&i.jsxs("section",{className:`up-section${le}`,children:[i.jsx("h3",{className:"up-section-title",children:"By model"}),i.jsxs("table",{className:"up-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Model"}),i.jsx("th",{children:"Tokens"}),i.jsx("th",{children:"Cost"})]})}),i.jsx("tbody",{children:W?O.map(ge=>i.jsxs("tr",{children:[i.jsx("td",{className:"up-model-name",title:ge.model,children:_o(ge.model)}),i.jsx("td",{className:"up-num",children:bn(ge.tokens)}),ge.cost>0?i.jsx("td",{className:"up-num up-cost-val",children:Nt(ge.cost)}):i.jsx("td",{className:"up-num up-unpriced",children:ji})]},ge.model)):_e.map(ge=>i.jsxs("tr",{children:[i.jsx("td",{className:"up-model-name",title:ge.model===Ep?"no model reported yet":ge.model,children:ge.model===Ep?"unknown":_o(ge.model)}),i.jsx("td",{className:"up-num",children:bn(ge.inputTokens+ge.outputTokens)}),ge.priced?i.jsx("td",{className:"up-num up-cost-val",children:Nt(ge.cost.total)}):i.jsx("td",{className:"up-num up-unpriced",children:ji})]},ge.model))})]})]}),W&&Y.length===0&&B.tokens>0&&i.jsxs("section",{className:"up-section",children:[i.jsx("h3",{className:"up-section-title",children:"By session"}),i.jsxs("div",{className:"up-hint",children:["No session is dated ",te," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(W?Y.length:Ze.length)>0&&(()=>{const ge=W?Y.length:Ze.length;return i.jsxs("section",{className:`up-section${le}`,children:[i.jsx("h3",{className:"up-section-title",children:i.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":D,"aria-controls":"up-sessions",title:D?"Hide the per-session breakdown":`Show the per-session breakdown — ${ge} session${ge===1?"":"s"}`,onClick:()=>U(be=>!be),children:["By session",W&&i.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${te}, each showing what that session has cost since it started.
86
- A session that began earlier brings its whole total with it, so these rows can add up to more than the figure above.`,children:["active ",te]}),i.jsx("svg",{className:"up-chev",width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),i.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!D,children:[W&&Y.map(be=>{const Ve=de.get(be.sessionId);return i.jsxs("div",{className:"up-session-row",children:[Ve?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:`sl-dot state-${Ve}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:hc(Ve)})]}):i.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),i.jsx("span",{className:`up-session-label${be.label?"":" up-session-id"}`,title:be.label?`${be.label}
87
- ${be.sessionId}`:be.sessionId,children:be.label??be.sessionId.slice(0,8)}),i.jsx("span",{className:"up-session-tokens",children:bn(be.tokens)}),be.cost>0?i.jsx("span",{className:"up-session-cost",title:be.models.join(", ")||void 0,children:Nt(be.cost)}):i.jsx("span",{className:"up-session-cost up-unpriced",children:ji})]},be.sessionId)}),!W&&Ze.map(be=>i.jsxs("div",{className:"up-session-row",children:[i.jsx("span",{className:`sl-dot state-${be.state}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:hc(be.state)}),i.jsx("span",{className:"up-session-label",children:be.label}),i.jsx("span",{className:"up-session-tokens",children:bn(be.inputTokens+be.outputTokens)}),be.cost>0?i.jsxs("span",{className:"up-session-cost",title:be.unpricedTokens>0?`${bn(be.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Nt(be.cost),be.unpricedTokens>0?"+":""]}):i.jsx("span",{className:"up-session-cost up-unpriced",children:ji})]},be.sessionId))]})]})})(),ct&&i.jsxs("div",{className:"up-hint",children:["“",ji,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):i.jsx("div",{className:"up-empty",children:W?i.jsxs(i.Fragment,{children:["No usage ",te,".",i.jsx("br",{}),"Try a longer period."]}):i.jsxs(i.Fragment,{children:["No usage data yet.",i.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const hn={l:30,r:6,t:6,b:2},pa={l:0,r:0,t:2,b:1},Nh=104,Cq=64;function qr(e,t=100,n=Nh,r=hn){const a=n-r.t-r.b;return r.t+a*(1-Math.max(0,Math.min(t,e))/t)}function tR(e,t,n,r=100,a=Nh,l=hn){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,u=h=>{const m=t-l.l-l.r;return l.l+(c>0?m*(h-e[0].t)/c:m/2)};let f="",p=null;for(const h of e){const m=p&&h.t-p.t<=n*2?"L":"M";f+=`${m}${u(h.t).toFixed(1)} ${qr(h.v,r,a,l).toFixed(1)}`,p=h}return f}function nR(e,t,n,r=100,a=Nh,l=hn){if(e.length<2)return"";const c=a-l.b,u=e[e.length-1].t-e[0].t,f=t-l.l-l.r,p=w=>l.l+(u>0?f*(w-e[0].t)/u:f/2);let h="",m=[];const y=()=>{if(m.length>=2){let w=`M${p(m[0].t).toFixed(1)} ${c}`;for(const N of m)w+=`L${p(N.t).toFixed(1)} ${qr(N.v,r,a,l).toFixed(1)}`;h+=`${w}L${p(m[m.length-1].t).toFixed(1)} ${c}Z`}m=[]};for(const w of e)m.length&&w.t-m[m.length-1].t>n*2&&y(),m.push(w);return y(),h}function Tq(e){return e.length?{now:e[e.length-1].v,peak:e.reduce((t,n)=>Math.max(t,n.v),e[0].v)}:{now:null,peak:null}}function rR(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function Aq(e,t,n=r=>nc(r)){const r=e.filter(c=>c.v>0);if(!e.length)return null;if(!r.length)return"never held back";const a=r.length*(t/6e4),l=r[r.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(l.t)}`}function nc(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function f0(e,t){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<1)return"less than a minute";if(n<60)return`${n} minute${n===1?"":"s"}`;const r=Math.floor(n/60),a=n%60;return a?`${r}h ${a}m`:`${r}h`}function Rq({group:e,title:t,onClose:n}){const r=rn(n),[a,l]=x.useState(null);x.useEffect(()=>{let p=!0;const h=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&l(w)}catch{}};h();const m=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(m)}},[e]);const c=(a==null?void 0:a.series)??[],[u,f]=x.useMemo(()=>{let p=1/0,h=0;for(const m of c)m.points.length&&(p=Math.min(p,m.points[0].t),h=Math.max(h,m.points[m.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(a==null?void 0:a.sinceMs)??0):(a==null?void 0:a.sinceMs)??0,h]},[c,a==null?void 0:a.sinceMs]);return mr.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:r,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[i.jsxs("div",{className:"modal-head",children:[i.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&u>0&&i.jsxs("span",{className:"hist-since",children:["since ",nc(u)," · ",f0(u,f||Date.now())]}),i.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),i.jsx("div",{className:"hist-body",children:a==null?i.jsx("p",{className:"hist-empty",children:"Reading…"}):c.length===0?i.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):c.map(p=>i.jsx(Mq,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function Mq({series:e,stepMs:t}){const n=x.useRef(null),[r,a]=x.useState(560),[l,c]=x.useState(null);x.useEffect(()=>{const $=n.current;if(!$||typeof ResizeObserver>"u")return;const D=new ResizeObserver(([U])=>a(Math.max(160,U.contentRect.width)));return D.observe($),()=>D.disconnect()},[]);const{points:u,unit:f,warnAt:p,critAt:h,label:m,top:y,restsAtZero:w}=e,N=w?Cq:Nh,{now:k,peak:S}=Tq(u),b=f==="C"?"°C":f,j=m==="Throttling"?Aq(u,t):null,E=l!=null?u[l]:null,C=u.length>1?u[u.length-1].t-u[0].t:0,T=$=>{const D=r-hn.l-hn.r;return hn.l+(C>0?D*($-u[0].t)/C:D/2)},R=$=>{if(u.length<2)return;const D=$.currentTarget.getBoundingClientRect(),U=($.clientX-D.left-hn.l)/Math.max(1,D.width-hn.l-hn.r),P=u[0].t+C*Math.max(0,Math.min(1,U));let V=0;for(let J=1;J<u.length;J++)Math.abs(u[J].t-P)<Math.abs(u[V].t-P)&&(V=J);c(V)};return i.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[i.jsxs("div",{className:"hist-head",children:[i.jsx("span",{className:"hist-label",children:m}),i.jsxs("span",{className:"hist-stats",children:[k!=null&&i.jsxs(i.Fragment,{children:[i.jsx("b",{children:k}),i.jsxs("span",{children:[b," now"]})]}),S!=null&&i.jsxs(i.Fragment,{children:[i.jsx("b",{className:rR(S,p,h),children:S}),i.jsxs("span",{children:[b," peak"]})]})]})]}),i.jsx("div",{className:"hist-plot",ref:n,children:i.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${r} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":k==null?`${m}: nothing measured yet`:`${m}: ${k}${b} now, peak ${S}${b}, over ${f0(u[0].t,u[u.length-1].t)}`,onPointerMove:R,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",h]].map(([$,D])=>D==null||D>y?null:i.jsxs("g",{children:[i.jsx("line",{className:`hist-rule ${$}`,x1:hn.l,x2:r-hn.r,y1:qr(D,y,N),y2:qr(D,y,N)}),i.jsx("text",{className:`hist-rule-tag ${$}`,x:2,y:qr(D,y,N)+3,children:D})]},$)),i.jsx("line",{className:"hist-floor",x1:hn.l,x2:r-hn.r,y1:N-hn.b,y2:N-hn.b}),i.jsx("path",{className:"hist-area",d:nR(u,r,t,y,N)}),i.jsx("path",{className:"hist-line",d:tR(u,r,t,y,N)}),u.length===1&&i.jsx("circle",{className:"hist-dot",cx:T(u[0].t),cy:qr(u[0].v,y,N),r:3}),E&&i.jsxs("g",{children:[i.jsx("line",{className:"hist-cross",x1:T(E.t),x2:T(E.t),y1:hn.t,y2:N-hn.b}),i.jsx("circle",{className:"hist-dot",cx:T(E.t),cy:qr(E.v,y,N),r:3})]})]})}),i.jsx("div",{className:"hist-axis",children:E?i.jsxs("span",{className:"hist-at",children:[nc(E.t)," — ",i.jsx("b",{children:E.v}),b]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:u.length?nc(u[0].t):""}),i.jsx("span",{children:u.length?nc(u[u.length-1].t):""})]})}),j&&i.jsx("div",{className:"hist-note",children:j})]})}const Iq="thermal:Throttling";function $q(e){var n,r,a,l;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(r=e.loadavg)!=null&&r.length&&(t["load:1m"]=e.loadavg[0]);for(const c of((a=e.thermal)==null?void 0:a.celsius)??[])t[`thermal:${c.label}`]=c.celsius;return(l=e.thermal)!=null&&l.throttle&&(t[Iq]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Md(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function fd(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:Md(e,t)}const v_=["cores","memory","load","thermal"],fo=116,is=24,Oq=60,Lq=6e4;function Pq(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function Dq(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function qq(e,t=Oq){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function Fq({sys:e}){const[t,n]=x.useState({});x.useEffect(()=>{let c=!0;const u=async()=>{const p=await Promise.all(v_.map(async h=>{try{const m=await fetch(`/api/system/history?group=${h}`);return m.ok?[h,await m.json()]:[h,null]}catch{return[h,null]}}));c&&n(h=>{const m={...h};for(const[y,w]of p)w!=null&&w.ok&&(m[y]=w);return m})};u();const f=setInterval(()=>void u(),Lq);return()=>{c=!1,clearInterval(f)}},[]);const r=x.useMemo(()=>$q(e),[e]),a=x.useMemo(()=>v_.flatMap(c=>{const u=t[c];return u?u.series.filter(Pq).map(f=>({series:qq(f),stepMs:u.stepMs})):[]}),[t]),l=x.useMemo(()=>{let c=1/0,u=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(c=Math.min(c,p[0].t),u=Math.max(u,p[p.length-1].t))}return Number.isFinite(c)?f0(c,u):"less than a minute"},[a]);return Object.keys(r).length?i.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${l}`,children:a.map(({series:c,stepMs:u})=>i.jsx(Bq,{series:c,stepMs:u,now:r[c.key],span:l},c.key))}):null}function Bq({series:e,stepMs:t,now:n,span:r}){var w;const{points:a,top:l,unit:c,warnAt:u,critAt:f}=e,p=Dq(e),h=n??((w=a[a.length-1])==null?void 0:w.v),m=h==null?"":rR(h,u,f),y=Math.max(...a.map(N=>N.v));return i.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${Md(y,c)} over the last ${r}`,u!=null?`over ${fd(u,c)} is uncomfortable`:"",f!=null?`over ${fd(f,c)} the machine acts`:""].filter(Boolean).join(" · "),children:[i.jsxs("div",{className:"pl-cell-head",children:[i.jsx("span",{className:"pl-cell-label",children:p}),i.jsx("span",{className:"pl-cell-now",children:h==null?"—":Md(h,c)})]}),i.jsxs("svg",{className:"pl-spark",width:fo,height:is,viewBox:`0 0 ${fo} ${is}`,preserveAspectRatio:"none","aria-hidden":!0,children:[i.jsx("line",{className:"pl-spark-floor",x1:0,x2:fo,y1:is-pa.b,y2:is-pa.b}),i.jsx("path",{className:"pl-spark-area",d:nR(a,fo,t,l,is,pa)}),u!=null&&i.jsx("line",{className:"pl-rule warn",x1:0,x2:fo,y1:qr(u,l,is,pa),y2:qr(u,l,is,pa)}),f!=null&&i.jsx("line",{className:"pl-rule hot",x1:0,x2:fo,y1:qr(f,l,is,pa),y2:qr(f,l,is,pa)}),i.jsx("path",{className:"pl-spark-line",d:tR(a,fo,t,l,is,pa)})]}),i.jsxs("span",{className:"vis-hidden",children:["peak ",Md(y,c)," over the last ",r,u!=null&&`, uncomfortable over ${fd(u,c)}`,f!=null&&`, the machine acts over ${fd(f,c)}`]})]})}const zq={key:"cpu",dir:"desc"};function Hq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function Uq(e,t){const n=t.dir==="asc"?1:-1,r=l=>t.key==="cpu"?l.cpu:t.key==="mem"?l.mem:t.key==="rss"?l.rssBytes:t.key==="threads"?l.threads:l.uptimeSec,a=(l,c)=>{if(t.key==="name")return n*l.name.localeCompare(c.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=l.user??"",h=c.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const u=r(l),f=r(c);return u==null||f==null?u==null?f==null?0:1:-1:n*(u-f)};return[...e].sort((l,c)=>a(l,c)||(c.cpu??-1)-(l.cpu??-1)||c.mem-l.mem||l.pid-c.pid)}function Wq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const Vq=4e3;function Gq(){const[e,t]=x.useState(null);return x.useEffect(()=>{let n=!0;const r=async()=>{if(document.visibilityState!=="hidden")try{const l=await fetch("/api/system/processes?detail=1");if(!l.ok)return;const c=await l.json();n&&(c!=null&&c.ok)&&t({procs:c.procs??[],total:c.total??0})}catch{}};r();const a=window.setInterval(r,Vq);return()=>{n=!1,window.clearInterval(a)}},[]),e}function Kq(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e<1024)return`${Math.round(e)} B`;const t=["KB","MB","GB","TB"];let n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n>=100?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function Yq(e){return e==null||!Number.isFinite(e)||e<0?"—":e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function Xq({sys:e,onClose:t}){const n=rn(t),[r,a]=x.useState(zq),l=Gq(),c=l?Uq(l.procs,r):null;return mr.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[i.jsxs("div",{className:"modal-head",children:[i.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),l&&i.jsxs("span",{className:"pl-count",children:[c.length," of ",l.total," running"]}),i.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),i.jsxs("div",{className:"pl-split",children:[i.jsx("div",{className:"pl-body",children:c==null?i.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):c.length===0?i.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):i.jsxs("table",{className:"sd-procs pl-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx(ki,{col:"cpu",label:"cpu",sort:r,onSort:a}),i.jsx(ki,{col:"rss",label:"memory",note:"Resident set size, which is what ps and Task Manager report; macOS Activity Monitor shows a different figure.",sort:r,onSort:a}),i.jsx(ki,{col:"threads",label:"threads",sort:r,onSort:a}),i.jsx(ki,{col:"uptime",label:"up",sort:r,onSort:a}),i.jsx(ki,{col:"user",label:"user",sort:r,onSort:a}),i.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),i.jsx(ki,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:r,onSort:a})]})}),i.jsx("tbody",{children:c.map(u=>i.jsxs("tr",{children:[i.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),i.jsx("td",{className:"sd-num sd-dim",title:`${u.mem.toFixed(1)}% of installed memory`,children:Kq(u.rssBytes)}),i.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),i.jsx("td",{className:"sd-num sd-dim",children:Yq(u.uptimeSec)}),i.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),i.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),i.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&i.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),i.jsx(Fq,{sys:e})]})]})}),document.body)}function ki({col:e,label:t,note:n,sort:r,onSort:a}){const l=Wq(r,e);return i.jsx("th",{scope:"col","aria-sort":l,children:i.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
88
-
89
- ${n}`:`Sort by ${t}`,onClick:()=>a(Hq(r,e)),children:[t,i.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:l==="none"?"":l==="ascending"?"↑":"↓"})]})})}const Zq=3e3;function Qq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function Jq(e,t,n=Date.now()){const r=Math.max(0,Math.min(100,100-e));return{pct:r,value:`${r}%`,tone:r===0?"calm":r>=30?"hot":"warn",note:r>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${eF(t.lastMs,n)}`:"running at full speed, and never held back"}}function eF(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const r=Math.floor(n/60);return r===1?"an hour ago":`${r} hours ago`}function Wl(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} KB`}function tF(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${r}m`:`${r}m`}function nF(){const[e,t]=x.useState(null),n=x.useRef(null);return x.useEffect(()=>{let r=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();r&&(p!=null&&p.ok)&&t(p)}catch{}},l=()=>{n.current==null&&(a(),n.current=window.setInterval(a,Zq))},c=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){c();return}l(),a()};return l(),document.addEventListener("visibilitychange",u),()=>{r=!1,c(),document.removeEventListener("visibilitychange",u)}},[]),e}function x_({usageOpen:e,leaving:t,sub:n,onClose:r,children:a}){return i.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[i.jsxs("div",{className:"sd-head",children:[i.jsx("h2",{className:"sd-title",id:"sd-title",children:"This machine"}),n&&i.jsx("span",{className:"sd-sub",children:n}),i.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:r,"aria-label":"Close",title:"Close",children:"×"})]}),a]})}function rF({usageOpen:e,leaving:t,onClose:n}){const r=nF();if(!r||r.cpu==null||!r.memory)return i.jsx(x_,{usageOpen:e,leaving:t,onClose:n,children:i.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:a,swap:l,perCore:c,loadavg:u,cores:f,uptimeSec:p,platform:h,thermal:m}=r,y=a?a.total-a.available:0,w=h==="win32"?"Commit":"Swap",N=l&&l.total>0?l.used/l.total*100:0;return i.jsxs(x_,{usageOpen:e,leaving:t,sub:`up ${tF(p)} · ${f} cores`,onClose:n,children:[c&&c.length>0&&i.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:i.jsx(Id,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:i.jsx("div",{className:"sd-cores",children:c.map((k,S)=>i.jsx("span",{className:"sd-core",title:`core ${S+1}: ${k}%`,children:i.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,k)/100})`}})},S))})})}),i.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:i.jsxs(Id,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&i.jsx(Zd,{label:"Physical",value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:Wl(y)})," of ",Wl(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${Wl(a.available)} available`}),l&&l.total>0&&i.jsx(Zd,{label:w,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:Wl(l.used)})," of ",Wl(l.total)]}),pct:N,tone:N>=90?"warn":"calm",note:N>=50?"paging to disk":void 0})]})}),u&&i.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:i.jsxs(Id,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[i.jsx("div",{className:"sd-load",children:u.map((k,S)=>i.jsxs("span",{className:`sd-load-item${k>f?" over":""}`,children:[i.jsx("b",{children:k.toFixed(2)}),i.jsx("span",{children:["1m","5m","15m"][S]})]},S))}),i.jsx("div",{className:"sd-note",children:u[0]>f?`${(u[0]/f).toFixed(1)}× more work queued than cores to run it`:`within ${f} cores`})]})}),i.jsx(sF,{thermal:m}),i.jsx(aF,{sys:r})]})}function Id({group:e,title:t,action:n,label:r,children:a}){const[l,c]=x.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"sd-open",onClick:()=>c(!0),title:n,"aria-label":n,children:[i.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[r," ",i.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),l&&i.jsx(Rq,{group:e,title:t,onClose:()=>c(!1)})]})}function sF({thermal:e}){if(!e)return null;const t=e.throttle?Jq(e.throttle.speedLimit,e.heldBack):null;return i.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:i.jsxs(Id,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>i.jsx(Zd,{label:n.label,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:Qq(n.celsius,n.warnAt,n.critAt)},n.label)),t&&i.jsx(Zd,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function aF({sys:e}){const[t,n]=x.useState(!1);return i.jsxs("div",{className:"sd-section sd-door-section",children:[i.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:i.jsxs("span",{className:"sd-door-plate",children:[i.jsxs("span",{className:"sd-door-name",children:["Busiest processes",i.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),i.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&i.jsx(Xq,{sys:e,onClose:()=>n(!1)})]})}function Zd({label:e,value:t,pct:n,tone:r="calm",note:a}){return i.jsxs("div",{className:"sd-row",children:[i.jsxs("div",{className:"sd-row-head",children:[i.jsx("span",{className:"sd-row-label",children:e}),i.jsx("span",{className:"sd-row-val",children:t})]}),i.jsx("span",{className:"sd-track",children:i.jsx("span",{className:`sd-fill${r==="calm"?"":` ${r}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&i.jsx("div",{className:"sd-note",children:a})]})}const b_=18,oF=1100,_i=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},iF=Array.from({length:b_},(e,t)=>{const n=-72+144*t/(b_-1)+(_i(t,1)-.5)*9,r=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+_i(t,2)*.52);return{dx:Math.cos(r)*a,dy:Math.sin(r)*a,rot:(t%2?1:-1)*(100+_i(t,3)*260),delay:Math.round(_i(t,4)*90),dur:760+Math.round(_i(t,5)*260),scale:.8+_i(t,6)*.45,hue:t%4,round:t%3===0}});function k_({anchor:e}){var a;const[t,n]=x.useState(null),r=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return x.useEffect(()=>{if(r)return;const l=e.current;if(!l)return;const c=l.getBoundingClientRect();n({x:c.left+c.width/2,y:c.top+c.height/2});const u=window.setTimeout(()=>n(null),oF);return()=>window.clearTimeout(u)},[e,r]),r||!t?null:mr.createPortal(i.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:iF.map((l,c)=>i.jsx("span",{className:`confetti-bit${l.round?" round":""}`,"data-hue":l.hue,style:{"--dx":`${l.dx.toFixed(1)}px`,"--dy":`${l.dy.toFixed(1)}px`,"--rot":`${l.rot}deg`,"--s":l.scale.toFixed(2),animationDelay:`${l.delay}ms`,animationDuration:`${l.dur}ms, ${l.dur}ms`}},c))}),document.body)}const sR=new Set(["awaiting_url","awaiting_code","registering"]);function lF(e){return e!=null&&sR.has(e)}function aR(e){return e!=null&&e!=="done"&&!sR.has(e)}const cF="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",uF="the sign-in did not complete";function dF({state:e,serverError:t,localError:n}){const r=e==="idle";return{title:r?"Sign-in ended":"Sign-in failed",message:n||t||(r?cF:uF)}}function hF({restored:e,activeAccount:t}){if(e!==!1)return null;const n=(t==null?void 0:t.email)||((t==null?void 0:t.num)!=null?`account ${t.num}`:null);return n?`This machine is now signed in as ${n} — the account you were using could not be put back. Switch back from the accounts panel.`:"The account you were using could not be put back — check which account this machine is signed in as from the accounts panel."}const fF="done";function pF(){let e=!1;return{shouldAnnounce(t){return t!==fF?(e=!1,!1):e?!1:(e=!0,!0)}}}function p0(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const mF={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck2:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${Yt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",unreadable_export:"claude-swap wrote something this deck could not read — try again, and upgrade it if this repeats",mixed_versions:"claude-swap changed format part-way through — try again",nothing_to_share:"none of those accounts could be exported",too_many:"that is more accounts than one share can carry",not_in_bundle:"that account is not in this share",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters, and cannot start with a dash",bad_email:"that does not look like an email address — it cannot contain spaces or start with a dash"},gF={no_cswap:"claude-swap could not be run — it is not on this deck's PATH. Set AGENTS_DECK_CSWAP to its full path",timeout:"claude-swap took too long and was stopped — try again",switch_failed:"claude-swap refused the switch",bad_account:"that is not an account claude-swap has",unknown_setting:"claude-swap has no such setting",out_of_range:"that value is outside what the setting allows",bad_value:"claude-swap does not accept that value",set_failed:"claude-swap refused the change",command_failed:"claude-swap refused the command"},yF=`claude-swap could not read the login keychain — start ${Yt} from a Terminal window rather than a background service`,oR={401:"this deck did not accept the page as its own, so nothing was changed",403:"this deck refused a change from this address — open it on the address the deck prints, not through a proxy"};function Ex(e,t,n){const r=n==null?null:oR[n];if(r)return r;if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(fc(e)))return yF;const a=p0(gF,e==null?void 0:e.reason);return a||(e==null?void 0:e.reason)||t}function fc(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const wF={no_install:"ccusage is not installed, and AGENTS_DECK_NO_INSTALL=1 forbids fetching it — unset that variable and restart the deck, or install ccusage yourself so it is on this deck's PATH",bad_override:"AGENTS_DECK_CCUSAGE names a file that is not there — correct it to the full path of your ccusage, or unset it to let the deck find its own",timeout:"ccusage took more than 90 seconds and was stopped — a narrower range usually finishes",bad_output:"ccusage ran but printed no usage data — try again, and run ccusage daily --json in a terminal if it keeps happening",run_failed:"ccusage could not report usage — try again",bad_range:"that date range is not a YYYYMMDD date — reopen the modal and pick one of the presets",unreachable:"the deck did not answer — check it is still running, then try again"},vF="ccusage could not be started — npx is not on this deck's PATH. Install Node's npm/npx, or put ccusage on PATH yourself";function xF(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const bF="ccusage could not be started — the deck launched npx and Node could not load the npm script it points at. An older deck asked cmd.exe for a bare npx.cmd, which made the shim look for that script under the deck's working directory instead of beside itself; update the deck and reopen this modal",kF="ccusage could not be started — the copy npx fetched will not load: Node could not resolve a file inside it. That copy is in npx's own cache, which the deck never rewrites, so clear it with `npm cache clean --force` and reopen this modal",_F=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),NF=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,SF=/[\\/]_npx[\\/]/i,jF=`the copy of ccusage ${Yt} installed for itself`;function EF(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function JV(e,t){const n=CF(e,t),r=EF(e);switch(e==null?void 0:e.stage){case"npx":return r?`ccusage failed on both of its paths. The managed install failed first — ${r} — and the deck then fell back to npx, where ${Vl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Vl(n)}`;case"managed":return`${jF} failed to run: ${Vl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Vl(n)}`:`the ccusage this deck found on your PATH failed to run: ${Vl(n)}`;default:return n}}const Vl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function CF(e,t){const n=fc(e);if(_F(n)){if(SF.test(n))return kF;if(NF.test(n))return bF}if(xF(n))return vF;const r=p0(wF,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function Ti(e,t,n){const r=n==null?null:oR[n];if(r)return r;if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&aR(e.state))return e.error;const a=p0(mF,e==null?void 0:e.reason);return a||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function TF(e,t,n){if(n<=0||wh(e))return{kind:"pass"};const r=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:r===-1?0:(r+1)%n};case"ArrowLeft":return{kind:"select",index:r===-1?n-1:(r-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function iR(e,t){const n=Math.round(e/1e3)-t;return n<=0?{text:"expired",tone:"gone"}:n<60?{text:`expires in ${n}s`,tone:"soon"}:{text:`expires in ${Math.round(n/60)}m`,tone:"ok"}}function AF(e){const t=new Map;for(const n of e){const r=(n.email??"").trim().toLowerCase();r&&t.set(r,(t.get(r)??0)+1)}return e.map(n=>{const r=(n.email??"").trim(),a=n.alias||r||`account ${n.num}`,l=[];return n.alias&&r&&l.push(r),r&&(t.get(r.toLowerCase())??0)>1&&l.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:l.length?l.join(" · "):null}})}function RF(e){return e<=0?"Nothing picked yet.":e===1?"1 account — its sign-in token will be on your clipboard.":`${e} accounts — ${e} sign-in tokens will be on your clipboard.`}function MF(e){switch(e){case"imported":return"imported";case"healed":return"dead token replaced";case"updated":return"updated";case"present":return"already here";default:return"not imported"}}function IF(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,r=[],a=n("imported");a&&r.push(`${a} of ${t} imported`);const l=n("healed");l&&r.push(`${l} had a dead token replaced`);const c=n("updated");c&&r.push(`${c} updated`);const u=n("present");u&&r.push(`${u} already here`);const f=n("failed");return f&&r.push(`${f} did not arrive`),`${r.join(", ")}.`}const $F=1500,pd=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],__="aa-panel",N_=e=>`aa-tab-${e}`;async function Gl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Cx=fe.forwardRef((e,t)=>i.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[i.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),i.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Cx.displayName="SuccessMark";function OF({onClose:e,onChanged:t}){const[n,r]=x.useState("login"),[a,l]=x.useState(null),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(!1),[y,w]=x.useState(null),[N,k]=x.useState(null),[S,b]=x.useState(null),[j,E]=x.useState(null),C=x.useRef(""),T=x.useRef(!1),R=x.useRef(!1),$=x.useRef(null),D=x.useRef(null),U=x.useRef(null),P=x.useRef(null),V=x.useRef([]),J=x.useRef(!1),ee=x.useCallback(()=>{T.current&&Gl({action:"login-cancel"}).catch(()=>{}),e()},[e]),M=rn(ee,{focusRef:U}),Z=x.useCallback(async()=>{if(!Is(R.current))return;R.current=!0,m(!0),w(null),T.current=!0;const B=await Gl({action:"login"}).catch(()=>null);if(R.current=!1,m(!1),!(B!=null&&B.ok)){w(Ti(B,"could not start the sign-in"));return}l(B)},[]);x.useEffect(()=>{if(!lF(a==null?void 0:a.state))return;const B=window.setInterval(async()=>{try{const te=await fetch("/api/claude-accounts/login");te.ok&&l(await te.json())}catch{}},$F);return()=>window.clearInterval(B)},[a]);const G=x.useRef(t);G.current=t;const I=x.useState(pF)[0];x.useEffect(()=>{var B;(a==null?void 0:a.state)==="awaiting_code"&&((B=$.current)==null||B.focus()),I.shouldAnnounce(a==null?void 0:a.state)&&G.current()},[a==null?void 0:a.state,I]),x.useEffect(()=>{var B;n==="paste"&&!J.current&&((B=D.current)==null||B.focus()),J.current=!1},[n]);const q=x.useCallback(B=>{var le;const te=TF(B,pd.findIndex(pe=>pe.id===n),pd.length);te.kind!=="pass"&&(B.preventDefault(),J.current=!0,r(pd[te.index].id),(le=V.current[te.index])==null||le.focus())},[n]),H=x.useCallback(async()=>{var te;if(!Is(R.current))return;R.current=!0,m(!0),w(null);const B=await Gl({action:"login-code",code:c}).catch(()=>null);if(R.current=!1,m(!1),!(B!=null&&B.ok)){w(Ti(B,"the code was not accepted")),B!=null&&B.state&&l(B),(te=$.current)==null||te.select();return}u(""),l(B)},[c,a]),W=x.useCallback(async()=>{if(!Is(R.current))return;R.current=!0,m(!0),w(null);const B=await Gl({action:"import",blob:f}).catch(()=>null);if(R.current=!1,m(!1),!(B!=null&&B.ok)){w(Ti(B,"the import failed"));return}C.current=f,p(""),E(null),k(B.results??[]),t()},[f,t]),L=x.useCallback(async B=>{const te=`${B.email}|${B.org??""}`;if(!Is(R.current)||!C.current)return;R.current=!0,m(!0),b(te),E(null);const le=await Gl({action:"import",blob:C.current,force:!0,only:{email:B.email,org:B.org??""}}).catch(()=>null);if(R.current=!1,m(!1),b(null),!(le!=null&&le.ok)){E({key:te,text:Ti(le,"that account could not be updated")});return}const pe=(le.results??[])[0];pe&&k(ye=>ye&&ye.map(Ie=>`${Ie.email}|${Ie.org??""}`===te?pe:Ie)),t()},[t]),K=(a==null?void 0:a.state)==="done"?a.account:null,de=hF({restored:a==null?void 0:a.restored,activeAccount:a==null?void 0:a.activeAccount}),O=aR(a==null?void 0:a.state)||!!(y&&T.current&&!h),Y=dF({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return mr.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:ee,role:"presentation",children:i.jsxs("div",{ref:M,className:"modal aa-modal",onClick:B=>B.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:q,children:pd.map((B,te)=>i.jsx("button",{type:"button",role:"tab",id:N_(B.id),ref:le=>{V.current[te]=le},"aria-selected":n===B.id,"aria-controls":__,tabIndex:n===B.id?0:-1,className:`aa-tab${n===B.id?" on":""}`,onClick:()=>{J.current=!1,r(B.id)},children:B.label},B.id))})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:ee,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsx("section",{className:"modal-body aa-body",id:__,role:"tabpanel","aria-labelledby":N_(n),children:n==="login"?K?i.jsxs("div",{className:"aa-done",children:[i.jsx(Cx,{ref:P}),i.jsx(k_,{anchor:P}),i.jsx("h4",{children:K.added?`Account ${K.num} added`:"Credentials refreshed"}),i.jsxs("p",{className:"aa-note",children:[i.jsx("strong",{children:K.email}),K.added?de?" is in the rotation.":" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),de?i.jsx("p",{className:"aa-note aa-warn",role:"status",children:de}):null,i.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(a==null?void 0:a.state)==="awaiting_code"||(a==null?void 0:a.state)==="registering"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"1 · Approve in the browser"}),i.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),i.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),i.jsx("p",{className:"aa-note",children:"It usually finishes on its own — if the page says you are all set, there is nothing to do here."}),i.jsxs("div",{className:"aa-field",children:[i.jsx("input",{ref:$,type:"text",value:c,onChange:B=>u(B.target.value),onKeyDown:B=>{B.key==="Enter"&&c.trim()&&!h&&H()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),i.jsx("button",{type:"button",className:"btn primary",...wa(h,!c.trim()||a.state==="registering"),onClick:H,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&i.jsx("p",{className:"aa-err",children:y??a.error}),i.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):O?i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:Y.title}),i.jsx("p",{className:"aa-err",children:Y.message}),i.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,l(null),w(null),Z()},children:"Try again"})]}):h||T.current?i.jsx("div",{className:"aa-step",children:i.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):i.jsxs("div",{className:"aa-step aa-primer",children:[i.jsx("h4",{children:"Sign in to Anthropic"}),i.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in. It normally completes by itself; only if the page hands you a code does it need pasting back here. claude-swap records the account when it completes, and the account you are using now stays active."}),i.jsx("div",{className:"aa-actions",children:i.jsx("button",{type:"button",ref:U,className:"btn primary",onClick:Z,children:"Open the sign-in page"})})]}):N?(()=>{const B=N.filter(te=>te.state==="imported").length;return i.jsxs("div",{className:"aa-done",children:[i.jsx(Cx,{ref:P}),B>0&&i.jsx(k_,{anchor:P}),i.jsx("h4",{children:IF(N)}),N.length>0&&i.jsx("ul",{className:"aa-results",children:N.map(te=>{const le=`${te.email}|${te.org??""}`;return i.jsxs("li",{className:`aa-result ${te.state}`,children:[i.jsx("span",{className:"aa-result-who",children:te.email||(te.num?`slot ${te.num}`:"an account")}),i.jsx("span",{className:"aa-result-what",children:MF(te.state)}),te.state==="present"&&i.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":S===le,title:`Overwrite the stored login for ${te.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>L(te),children:S===le?"updating…":"update anyway"}),(j==null?void 0:j.key)===le&&i.jsx("span",{className:"aa-result-err",children:j.text})]},le)})}),i.jsxs("p",{className:"aa-note",children:["Nothing changed on the deck you copied this from. An account already here is left as it is, unless its stored login was dead or you pressed",i.jsx("strong",{children:" update anyway"}),"."]}),i.jsxs("div",{className:"aa-actions",children:[i.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),i.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),k(null)},children:"Import another"})]})]})})():i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"Paste an account shared from another deck"}),i.jsxs("div",{className:"aa-field",children:[i.jsx("input",{ref:D,type:"text",value:f,onChange:B=>p(B.target.value),onKeyDown:B=>{B.key==="Enter"&&f.trim()&&!h&&W()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),i.jsx("button",{type:"button",className:"btn primary",...wa(h,!f.trim()),onClick:W,children:h?"importing…":"Import"})]}),y&&i.jsx("p",{className:"aa-err",children:y}),i.jsxs("p",{className:"aa-note",children:["Use ",i.jsx("strong",{children:"share"})," on one account in the other deck, or ",i.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})}),document.body)}function LF(e,t,n){if(n<=0||wh(e))return{kind:"pass"};const r=t>=0&&t<n?t:-1;switch(e.key){case"ArrowDown":return{kind:"focus",index:r===-1?0:(r+1)%n};case"ArrowUp":return{kind:"focus",index:r===-1?n-1:(r-1+n)%n};case"Home":return{kind:"focus",index:0};case"End":return{kind:"focus",index:n-1};default:return{kind:"pass"}}}const va=4,Pr=8;function lR(e,t,n){const r=n.width-Pr-(e.right+va),a=e.left-va-Pr,l=t.width<=r||r>=a?"right":"left",c=l==="right"?e.right+va:e.left-va-t.width,u=n.height-Pr*2,f=t.height<=u,p=f?t.height:Math.max(0,u);return{top:Math.max(Pr,Math.min(e.top,n.height-Pr-p)),left:Math.max(Pr,c),side:l,maxHeight:f?null:p}}function PF(e,t,n){const r=n.height-Pr-(e.bottom+va),a=e.top-va-Pr,l=t.height<=r||r>=a?"below":"above",c=l==="below"?r:a,u=t.height<=c,f=u?t.height:Math.max(0,c),p=l==="below"?e.bottom+va:e.top-va-f,h=Math.max(Pr,Math.min(e.right-t.width,n.width-Pr-t.width));return{top:Math.max(Pr,p),left:h,side:l,maxHeight:u?null:f}}const cR='[role="menuitem"]';function S_(e){return e?Array.from(e.querySelectorAll(cR)).filter(t=>!t.disabled):[]}function j_({anchorId:e,boundaryId:t,id:n,className:r,role:a,labelledBy:l,start:c="first",onClose:u,children:f}){const p=x.useRef(u);p.current=u;const h=rn(()=>{var k;(k=document.getElementById(e))==null||k.focus(),p.current()}),m=x.useCallback(()=>{var C;const k=h.current;if(!k)return;const S=document.getElementById(e);if(!S){p.current();return}const b=S.getBoundingClientRect(),j=t?(C=document.getElementById(t))==null?void 0:C.getBoundingClientRect():null;if(j&&(b.bottom<=j.top||b.top>=j.bottom)){k.contains(document.activeElement)&&S.focus({preventScroll:!0}),p.current();return}k.style.maxHeight="";const E=PF(b,{width:k.offsetWidth,height:k.offsetHeight},{width:window.innerWidth,height:window.innerHeight});k.style.top=`${E.top}px`,k.style.left=`${E.left}px`,k.style.maxHeight=E.maxHeight==null?"":`${E.maxHeight}px`,k.dataset.side=E.side},[e,t,h]);x.useLayoutEffect(()=>{m()}),x.useEffect(()=>{const k=S=>{var b;(b=h.current)!=null&&b.contains(S.target)||m()};return window.addEventListener("scroll",k,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",m)}},[m,h]),x.useEffect(()=>{const k=S=>{var j,E;const b=S.target;!b||(j=h.current)!=null&&j.contains(b)||(E=document.getElementById(e))!=null&&E.contains(b)||p.current()};return window.addEventListener("pointerdown",k,!0),()=>window.removeEventListener("pointerdown",k,!0)},[e,h]),x.useEffect(()=>{var S;if(a!=="menu")return;const k=S_(h.current);(S=c==="last"?k[k.length-1]:k[0])==null||S.focus()},[]);const y=k=>{var S;if(a==="menu"&&k.key==="Tab"){k.stopPropagation(),(S=document.getElementById(e))==null||S.focus(),k.shiftKey&&k.preventDefault(),p.current();return}if(a==="menu"){const b=S_(h.current),j=LF(k,b.indexOf(document.activeElement),b.length);j.kind==="focus"&&(k.preventDefault(),b[j.index].focus())}k.key.length===1&&k.stopPropagation()},w=k=>{k.target.closest("button, input, select, textarea, code")||k.preventDefault()},N=k=>{if(a!=="menu"||k.pointerType==="touch")return;const S=k.target.closest(cR);S&&!S.disabled&&document.activeElement!==S&&S.focus({preventScroll:!0})};return mr.createPortal(i.jsx("div",{ref:h,id:n,className:`anchored-popover${r?` ${r}`:""}`,role:a,"aria-labelledby":l,onKeyDown:y,onMouseDown:w,onPointerMove:N,children:f}),document.body)}const DF=6;function qF(e,t){const n=e.filter(u=>u.ready);if(t.armed&&e.length>0&&n.length===0)return{text:"Auto-switch has nowhere to go",tone:"bad",free:null};const r=n.length===e.length?`${e.length} ready`:n.length===0?e.length===1?"not ready":`none of ${e.length} ready`:`${n.length} of ${e.length} ready`,a=n.length?"ok":"idle",l=t.strained&&!t.armed?FF(n):null,c=[r];return l!=null&&c.push(`${l}% free`),c.push(t.armed?`auto ${t.threshold??"on"}${t.threshold?"%":""}`:"auto off"),{text:c.join(" · "),tone:a,free:l}}function FF(e){const t=e.map(n=>n.headroom).filter(n=>typeof n=="number");return t.length?Math.max(...t):null}function BF(e){const t=[...e].sort((a,l)=>{if(a.ready!==l.ready)return a.ready?-1:1;if(!a.ready)return a.name.localeCompare(l.name);const c=a.headroom,u=l.headroom;return c==null&&u==null?a.name.localeCompare(l.name):c==null?1:u==null?-1:u-c}),n=t.slice(0,DF),r=t.length-n.length;return{title:e.some(a=>a.ready)?"Where you could switch":"Nothing to switch to",shown:n,rest:r>0?`and ${r} more`:null}}function uR({title:e,steps:t,finish:n,aside:r,onClose:a}){const l=x.useRef(null),c=rn(a,{focusRef:l}),[u,f]=x.useState(0),p=u===t.length-1,h=t[u],m=N=>f(Math.max(0,Math.min(t.length-1,N))),y=N=>{N.key!=="ArrowRight"&&N.key!=="ArrowLeft"||(N.preventDefault(),N.stopPropagation(),m(N.key==="ArrowRight"?u+1:u-1))},w=()=>{if(!p){m(u+1);return}n?n.act():a()};return mr.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:c,className:"modal guide",onClick:N=>N.stopPropagation(),onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),i.jsxs("span",{className:"modal-tool-id",children:[u+1," / ",t.length]})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("div",{className:"guide-stage",children:h.art},u),i.jsx("p",{className:"guide-line","aria-live":"polite",children:h.line}),i.jsx("p",{className:"guide-tip",children:h.tip??""}),i.jsxs("div",{className:"guide-foot",children:[i.jsx("div",{className:"guide-dots",children:t.map((N,k)=>i.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${k+1} of ${t.length}`,"aria-current":k===u?"step":void 0,onClick:()=>m(k)},k))}),p&&r&&i.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:r.act,children:r.label}),u>0&&i.jsx("button",{type:"button",className:"btn",onClick:()=>m(u-1),children:"Back"}),i.jsx("button",{ref:l,type:"button",className:"btn primary",onClick:w,children:p?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const Tx={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function gr({children:e}){return i.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function pr({x:e,y:t=34,w:n=176,h:r=132,label:a}){return i.jsxs(i.Fragment,{children:[a&&i.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:a}),i.jsx("rect",{x:e,y:t,width:n,height:r,rx:10,className:"ga-screen"})]})}function Br({x:e,y:t,email:n,state:r,tone:a,bars:l}){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:e+3,cy:t-4,r:3,className:Tx[a]}),i.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),i.jsx("text",{x:e+12,y:t+16,className:`ga-s ${Tx[a]}`,children:r}),l==null?void 0:l.map((c,u)=>i.jsxs("g",{children:[i.jsx("text",{x:e,y:t+40+u*18,className:"ga-s",children:u?"7d":"5h"}),i.jsx("rect",{x:e+22,y:t+35+u*18,width:96,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:e+22,y:t+35+u*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),i.jsxs("text",{x:e+148,y:t+40+u*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},u))]})}function dR({x:e,y:t,on:n}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),i.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function md({x:e,y:t,name:n,here:r=!0}){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:e+3,cy:t-4,r:3,className:r?"ga-ok":"ga-dim"}),i.jsx("text",{x:e+12,y:t,className:r?"ga-t":"ga-s",children:n})]})}function E_({x:e,y:t,on:n}){return n?i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),i.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):i.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function C_({x:e,y:t,d:n}){return i.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function m0({x:e,y:t}){return i.jsx("path",{d:`M${e} ${t}l0 13 3.4-3 2.4 5.2 2-.9-2.4-5.1 4.6-.2z`,className:"ga-pointer"})}function g0(){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{r:9,className:"ga-key-bed"}),i.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[i.jsx("circle",{cx:4.6,cy:7,r:2.6}),i.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function Ai({x:e,y:t,w:n,title:r,sub:a,tone:l}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),i.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:Tx[l]}),i.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:r}),i.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:a})]})}function $i({x:e,y:t,label:n,live:r}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:r?"ga-chip-live":"ga-chip"}),i.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function Qd({x:e,y:t}){return i.jsxs(i.Fragment,{children:[i.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),i.jsx(dR,{x:e+118,y:t-13,on:!0})]})}function zF(){return i.jsxs(gr,{children:[i.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),i.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),i.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),i.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),i.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),i.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),i.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),i.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),i.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),i.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),i.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),i.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),i.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),i.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),i.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),i.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),i.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),i.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),i.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),i.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),i.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),i.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function HF(){return i.jsxs(gr,{children:[i.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),i.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),i.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),i.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),i.jsx(Ai,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),i.jsx(Ai,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),i.jsx(Ai,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),i.jsx(Ai,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),i.jsx($i,{x:326,y:28,label:"Read"}),i.jsx($i,{x:380,y:28,label:"Grep",live:!0}),i.jsx($i,{x:326,y:90,label:"Bash",live:!0})]})}function T_({x:e,y:t,label:n,pct:r,note:a}){return i.jsxs(i.Fragment,{children:[i.jsx("text",{x:e,y:t,className:"ga-s",children:n}),i.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[r,"%"]}),i.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),i.jsx("rect",{x:e,y:t+7,width:194*r/100,height:5,rx:2.5,className:"ga-accent"}),i.jsx("text",{x:e,y:t+26,className:"ga-s",children:a})]})}function UF(){return i.jsxs(gr,{children:[i.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),i.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),i.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),i.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),i.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),i.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),i.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),i.jsx(T_,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),i.jsx(T_,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function WF(){return i.jsxs(gr,{children:[i.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),i.jsx(Ai,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),i.jsx(m0,{x:156,y:106}),i.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),i.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),i.jsx(pr,{x:200,y:22,w:226,h:160}),i.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),i.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),i.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),i.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),i.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),i.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),i.jsx($i,{x:214,y:122,label:"Read"}),i.jsx($i,{x:266,y:122,label:"Edit"}),i.jsx($i,{x:318,y:122,label:"Bash",live:!0}),i.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),i.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function VF(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return i.jsxs(gr,{children:[i.jsx(pr,{x:14,y:20,w:412,h:160}),i.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),i.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),i.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),i.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>i.jsxs("g",{children:[i.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),i.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),i.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),i.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),i.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),i.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),i.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),i.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),i.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),i.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),i.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),i.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),i.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),i.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function GF(){return i.jsxs(gr,{children:[i.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),i.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),i.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),i.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[i.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),i.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),i.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),i.jsx("path",{d:"M210 100H238",className:"ga-arc"}),i.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),i.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),i.jsx("g",{className:"ga-pop",children:i.jsx(Ai,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function KF(){return i.jsxs(gr,{children:[i.jsx(pr,{x:14,y:16,w:232,h:170}),i.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),i.jsx(C_,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),i.jsx(C_,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),i.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),i.jsx(Br,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),i.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),i.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),i.jsx(Br,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),i.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),i.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),i.jsx(m0,{x:221,y:161}),i.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),i.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),i.jsx(pr,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),i.jsx("g",{className:"ga-pop",children:i.jsx(Br,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function YF(){return i.jsxs(gr,{children:[i.jsx(pr,{x:14,label:"THIS MACHINE"}),i.jsx(Qd,{x:28,y:60}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(Br,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(Br,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(pr,{x:250,label:"ANOTHER MACHINE"}),i.jsx(Qd,{x:264,y:60}),i.jsx(Br,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),i.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:i.jsx(g0,{})})]})}const XF=[{art:i.jsx(zF,{}),line:"Sessions waiting on you top the session list, longest wait first.",tip:"A tone and a system notification when one stops to ask. The speaker in the topbar."},{art:i.jsx(HF,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:i.jsx(WF,{}),line:"Click any node: its prompt, every tool call, tokens and timing."},{art:i.jsx(UF,{}),line:"What each session costs, and how much quota is left."},{art:i.jsx(VF,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:i.jsx(KF,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:i.jsx(YF,{}),line:"Your machines repair each other's expired logins over the local network.",tip:"Open it from the row at the foot of the Claude accounts panel."},{art:i.jsx(GF,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function ZF(){return i.jsxs(gr,{children:[i.jsx(pr,{x:14,label:"THIS MACHINE"}),i.jsx(Br,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),i.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),i.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),i.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),i.jsx(pr,{x:250,label:"ANOTHER MACHINE"}),i.jsx(Br,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function QF(){return i.jsxs(gr,{children:[i.jsx(pr,{x:14,label:"THIS MACHINE"}),i.jsx(Qd,{x:28,y:60}),i.jsx(md,{x:28,y:92,name:"Ana's MacBook"}),i.jsx(md,{x:28,y:114,name:"Dorin's PC"}),i.jsx(pr,{x:250,label:"ANOTHER MACHINE"}),i.jsx(Qd,{x:264,y:60}),i.jsx(md,{x:264,y:92,name:"Your MacBook"}),i.jsx(md,{x:264,y:114,name:"Dorin's PC"}),i.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),i.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),i.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),i.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function JF(){return i.jsxs(gr,{children:[i.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),i.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),i.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),i.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),i.jsx(E_,{x:106,y:88,on:!0}),i.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),i.jsx(E_,{x:106,y:112}),i.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),i.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),i.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),i.jsx(dR,{x:304,y:157,on:!0}),i.jsx(m0,{x:115,y:97})]})}function e8(){return i.jsxs(gr,{children:[i.jsx(pr,{x:14,label:"THIS MACHINE"}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(Br,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(Br,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(pr,{x:250,label:"ANOTHER MACHINE"}),i.jsx(Br,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),i.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:i.jsx(g0,{})})]})}const t8=[{art:i.jsx(ZF,{}),line:"A login can expire on one machine while it still works on another."},{art:i.jsx(QF,{}),line:"Both decks are on. They find each other and ask to pair.",tip:"Not showing up? The + in the section reaches a machine by address or invite."},{art:i.jsx(JF,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:i.jsx(e8,{}),line:"An expired login is copied from a paired machine within a minute."}];function n8(){return i.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[i.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),i.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),i.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),i.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),i.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),i.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),i.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),i.jsx("g",{transform:"translate(116 13)",children:i.jsx(g0,{})})]})}const r8={panel:"Nothing here is stuck: whoever pastes an invite is the one dialling out. Ask them for one and paste it behind the + above, where an address can be typed too.",dialog:"Nothing here is stuck: whoever pastes an invite is the one dialling out. Ask them for one and paste it below, or type their address."},s8=1600;function hR({reach:e,where:t}){const[n,r]=x.useState(!1),a=x.useRef(!0);x.useEffect(()=>()=>{a.current=!1},[]);const l=(e==null?void 0:e.steps)??[],c=x.useCallback(async()=>{await bh(l.join(`
90
- `))&&a.current&&(r(!0),window.setTimeout(()=>{a.current&&r(!1)},s8))},[l]);if(!(e!=null&&e.blocked))return null;const u=e.shell==="sh";return i.jsxs("div",{className:"ap-lan-reach",children:[i.jsx("p",{className:"lan-warn",children:e.text}),i.jsx("p",{className:"lan-note",children:r8[t]}),l.length>0&&i.jsxs("details",{className:"ap-lan-reach-fix",children:[i.jsx("summary",{children:"or let them find this deck on their own"}),i.jsxs("p",{className:"lan-note",children:[u?i.jsx(i.Fragment,{children:"Run this in a terminal on this machine, then restart the deck."}):i.jsxs(i.Fragment,{children:["Run this in PowerShell ",i.jsx("strong",{children:"as Administrator"}),", then restart the deck."]}),e.category==="Public"&&i.jsx(i.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."}),e.unsure&&i.jsxs(i.Fragment,{children:[" ",e.unsure]})]}),i.jsx("pre",{className:"ap-lan-cmd",children:i.jsx("code",{children:l.join(`
91
- `)})}),i.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>void c(),title:u?"Copy these lines, then paste them into a terminal":"Copy these lines, then paste them into an elevated PowerShell",children:n?"copied":"copy command"})]})]})}async function Cp(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const a8={not_an_invite:"That is not an invite — paste the whole line they sent you.",expired:"That invite has run out. Ask them for a fresh one.",not_running:"This deck is not on the network yet. Turn Local network on, then try again."},o8={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function A_(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Kt(n,t)}function i8({status:e,manual:t,onClose:n,onChanged:r}){const a=x.useRef(null),l=rn(n,{focusRef:a}),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(null),[y,w]=x.useState(null),[N,k]=x.useState(null),[S,b]=x.useState(null),[j,E]=x.useState(()=>Date.now());x.useEffect(()=>{const I=window.setInterval(()=>E(Date.now()),1e3);return()=>window.clearInterval(I)},[]);const C=x.useRef(!0);x.useEffect(()=>()=>{C.current=!1},[]);const T=x.useRef(null),R=x.useCallback(I=>_h(T.current)?(T.current=I,k(I),!0):!1,[]),$=x.useCallback(()=>{T.current=null,C.current&&k(null)},[]),D=I=>{const q=Na(N,I);return{disabled:q.disabled,"aria-busy":q.busy}},U=I=>(h==null?void 0:h.field)===I?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},P=I=>m(q=>q&&q.field===I?null:q),V=x.useCallback(async()=>{const I=k8(c);if(!I){m({text:l8(c),field:"addr"});return}const q=`${I.addr}:${I.port}`,H=e.peers.find(W=>W.addr===I.addr&&W.port===I.port&&W.paired);if(H){m({text:`Already paired with ${H.name} at that address.`,field:"addr"});return}if(t.includes(q)){m({text:"This deck already calls that address.",field:"addr"});return}if(R("add"))try{const W=await Cp("/api/prefs",{lan:{manual:[...t,q]}});if(!C.current)return;W!=null&&W.ok?(m(null),u(""),r(),n()):m({text:Kt("add that address",W),field:"addr"})}catch{C.current&&m({text:Kt("add that address",null),field:"addr"})}finally{$()}},[c,t,e.peers,r,n,R,$]),J=x.useCallback(async I=>{if(!R(`invite:${I}`))return;const q=I==="make"?"make an invite":"cancel that invite";try{const H=await Cp("/api/lan/invite",{action:I});if(!C.current)return;H!=null&&H.ok?(m(null),w(null),r()):m({text:A_(o8,H,q)})}catch{C.current&&m({text:Kt(q,null)})}finally{$()}},[r,R,$]),ee=x.useCallback(async()=>{const I=f.trim();if(!(!I||!R("join"))){b(null);try{const q=await Cp("/api/lan/invite",{action:"join",token:I});if(!C.current)return;q!=null&&q.ok?(p(""),m(null),r(),n()):(q==null?void 0:q.reason)==="unreachable"&&Array.isArray(q.tried)&&q.tried.length?(b(q.tried),m(null)):(b(null),m({text:A_(a8,q,"use that invite"),field:"join"}))}catch{C.current&&m({text:Kt("use that invite",null),field:"join"})}finally{$()}}},[f,r,n,R,$]),M=x.useCallback(async(I,q)=>{try{await navigator.clipboard.writeText(I),w(q),window.setTimeout(()=>{C.current&&w(H=>H===q?null:H)},1600)}catch{m({text:"Could not copy it — select the text and copy it by hand."})}},[]),Z=e.invite&&e.invite.expiresAt>j?e.invite:null,G=e.port!=null?(e.addrs??[]).map(I=>`${I}:${e.port}`):[];return mr.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:l,className:"modal lan-add",onClick:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[h&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:h.text}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsx(hR,{reach:e.reach,where:"dialog"}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"By address"}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("input",{ref:a,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:c,placeholder:"192.168.1.5:54340",spellCheck:!1,...U("addr"),onChange:I=>{u(I.target.value),P("addr")},onKeyDown:I=>{I.key==="Enter"&&V()}}),c.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...D("add"),onClick:()=>void V(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),i.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."}),e.port!=null&&G.length>0&&i.jsxs("p",{className:"lan-note",children:["They type this deck’s own address into the same field on theirs:"," ",G.map((I,q)=>i.jsxs("span",{children:[q>0&&" or ",i.jsx("code",{className:"ap-lan-code",children:I})]},I)),i.jsx("button",{type:"button",className:"ap-lan-word lan-copy",...D("copy:mine"),onClick:()=>void M(G.join(" "),"mine"),title:"Copy this deck's address, to send to whoever is adding it",children:y==="mine"?"copied":"copy"})]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsxs("h3",{className:"lan-h",children:["With an invite",!Z&&i.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...D("invite:make"),onClick:()=>void J("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:N==="invite:make"?"making…":"make one to send"})]}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:f,placeholder:"paste one you were sent",spellCheck:!1,...U("join"),onChange:I=>{p(I.target.value),b(null),P("join")},onKeyDown:I=>{I.key==="Enter"&&ee()}}),f.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...D("join"),onClick:()=>void ee(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:N==="join"?"joining…":"join"})]}),i.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),S&&i.jsxs("div",{className:"ap-lan-tried",children:[i.jsx("span",{className:"lan-note",children:"Nothing answered at any address in that invite. Check that deck is running with its Local network switch on."}),S.map(I=>i.jsxs("span",{className:"ap-lan-tried-row",children:[i.jsx("code",{className:"ap-lan-code",children:I.addr}),i.jsx("span",{className:"ap-lan-bad",children:I.why})]},I.addr))]}),Z&&i.jsxs("div",{className:"ap-lan-invite",children:[i.jsxs("div",{className:"ap-lan-invite-head",children:[i.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),i.jsxs("span",{className:"ap-lan-invite-left",children:[N8(Z.expiresAt,j)," left"]})]}),i.jsx("code",{className:"ap-lan-token",children:Z.token}),i.jsxs("div",{className:"ap-lan-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...D("copy:invite"),onClick:()=>void M(Z.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),i.jsx("button",{type:"button",className:"ap-manage-btn",...D("invite:withdraw"),onClick:()=>void J("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),i.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function l8(e){const t=(e??"").trim();if(t==="")return"Type an address and a port, like 192.168.1.5:54340.";if(!t.startsWith("[")&&(t.match(/:/g)??[]).length>1)return"Too many colons to split. Use that deck's IPv4 address or its name, like 192.168.1.5:54340.";if(!t.includes(":"))return`Add the port too, like ${t}:54340.`;const n=t.slice(t.lastIndexOf(":")+1).trim();return n===""?"That is missing its port — try 192.168.1.5:54340.":/^\d+$/.test(n)?`A port runs from 1 to 65535, and this one is ${n}.`:`A port is a number, and this one is "${n}".`}const c8=1e3;function u8(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=us(e,t);return`${n} · ${r==="now"?"just now":r}`}function R_(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function d8(){return i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),i.jsx("path",{d:"M8.4 3.6l2 2"})]})}function M_(){return i.jsxs("svg",{className:"lan-machine",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),i.jsx("path",{d:"M1 13h14"})]})}function gd({dir:e,gate:t=!1}){const n=t?12:8;return i.jsx("svg",{className:"lan-chev","data-dir":e,"data-gate":t||void 0,width:n,height:"8",viewBox:`0 0 ${n} 8`,fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:e==="out"?"M2.8 1L6 4 2.8 7":t?"M1 1v6M9.6 1L6.4 4l3.2 3":"M5.2 1L2 4l3.2 3"})})}const h8={works:"works here",expired:"expired here",missing:"not on this deck"},f8={works:"works there",broken:"broken there",unknown:"not offered by that deck"};function p8(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${h8[e.here]}, ${f8[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function m8({row:e,source:t,status:n,accounts:r,now:a,busy:l,onClose:c,onRename:u,onCheck:f,onVerb:p,onSettings:h,twins:m=[],onUnpair:y}){var jt,xt,wt,kn,Zt;const w=x.useRef(null),N=rn(c,{focusRef:w}),[k,S]=x.useState(null),[b,j]=x.useState(null),[E,C]=x.useState(!1),T=x.useRef(0),[R,$]=x.useState(null),[D,U]=x.useState(!1),[P,V]=x.useState(0),J=x.useRef(null),ee=x.useRef(!0);x.useEffect(()=>()=>{ee.current=!1},[]);const M=k!=null;x.useEffect(()=>{var me;M&&((me=J.current)==null||me.select())},[M]),x.useEffect(()=>{if(!E)return;const me=window.setTimeout(()=>C(!1),4e3);return()=>window.clearTimeout(me)},[E]),x.useEffect(()=>{if(!R)return;const me=window.setTimeout(()=>$(null),4e3);return()=>window.clearTimeout(me)},[R]);const Z=me=>{const it=Na(l,me);return{disabled:it.disabled,"aria-busy":it.busy}},G=async me=>{const it=await me();return ee.current&&j(it),it==null},{peer:I,stranger:q}=t,H=e.kind==="paired",W=e.self??e.name,L=e.kind!=="dialling",K=e.kind==="dialling"?null:e.fp,de=I?I.addr?`${I.addr}:${I.port}`:"":q?q.port?`${q.addr}:${q.port}`:q.addr:e.addr,O=(I==null?void 0:I.about)??null,Y=((jt=n.about)==null?void 0:jt.version)??null,B=async me=>{const it=me.trim()===W?"":me;await G(()=>u(it))&&S(null)},te=async()=>{if(K)try{if(await navigator.clipboard.writeText(K),!ee.current)return;U(!0),window.setTimeout(()=>{ee.current&&U(!1)},1600)}catch{ee.current&&j("Could not copy it — select the fingerprint and copy it by hand.")}},le=H?I!=null&&I.waiting?I.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":I!=null&&I.offers?"not said — it runs an older version":"not reached yet":"shown once paired",pe=R_(n.about),ye=R_(O),Ie=O!=null&&O.version&&Y?M8(O.version,Y):null,Te=I?fR(I.last,a):null,Re=I&&((xt=I.last)!=null&&xt.error)?b8({error:I.last.error,host:I.addr,port:I.port},[...n.strangers??[],...n.pending??[],...(n.peers??[]).filter(me=>!me.manual&&me.addr).map(me=>({fp:me.fp,name:me.name,addr:me.addr,port:me.port,at:me.lastSeen??0}))],a):null,Me=(wt=I==null?void 0:I.last)!=null&&wt.error&&Te&&Te.text!==I.last.error?I.last.error:null,xe=((kn=I==null?void 0:I.last)==null?void 0:kn.done)??[],He=!!Te&&!!Me&&!e.quiet&&e.state.startsWith(Te.text),Ne=H||e.kind==="dialling",_e=I?I.waiting?null:I.manual?"added by address":"on this network":e.kind==="nearby"?"heard on this network":"asked this deck to pair",Ze=e.tone==="bad"?"bad":H?e.here?"up":"down":"loose",ct=l===`check:${e.fp}`,Ke=(I==null?void 0:I.offers)??null,ce=Ze==="up"?(Ke==null?void 0:Ke.current)??null:null,je=ce&&"key"in ce?ce.key:null,$e=!!ce&&"hidden"in ce,Je=!!ce&&"other"in ce,qe=H?$8((Ke==null?void 0:Ke.accounts)??null,r,n.shared??[],je):[],pt=qe.filter(me=>me.in==null&&me.out==="cut"),ge=qe.some(me=>me.in!=null),be=qe.some(me=>me.out!=null),Ve=new Map(xe.map(me=>[me.email,me])),nt=xe.filter(me=>!qe.some(it=>it.email===me.email)),at=H?Ke?Ke.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:I!=null&&I.waiting?"What that deck offers is not known yet. A deck that calls in says so each time it calls — one on an older version never does.":(Zt=I==null?void 0:I.last)!=null&&Zt.error?"What that deck offers is not known — the last attempt to ask it did not get through.":"Nobody has asked that deck what it offers yet. The next round asks it.":null,he=Ke&&(I!=null&&I.last)&&I.last.at-Ke.at>c8?us(Ke.at,a):null,rt=[];H&&(I!=null&&I.pairedAt)?rt.push({label:"Paired",value:u8(I.pairedAt,a),tone:"meta"}):e.kind==="declined"&&q&&rt.push({label:"Paired",value:`no · you said no ${w0(q.at,a)}`,tone:"meta"}),rt.push({label:"Fingerprint",value:K?i.jsxs("span",{className:"lan-fp",children:[i.jsx("code",{className:"ap-lan-code",children:K}),i.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void te(),"aria-label":D?"Fingerprint copied":"Copy the fingerprint",children:D?"copied":"copy"})]}):"not known — nothing has answered there",tone:K?void 0:"quiet"});const ot=m.length?[{row:e,peer:I??null},...m]:[];return mr.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:i.jsxs("div",{ref:N,className:"modal lan-peer","data-tone":e.tone,onClick:me=>me.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[i.jsxs("header",{className:"modal-head lan-peer-head",children:[i.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),i.jsxs("div",{className:"lan-peer-id",children:[M?i.jsxs("form",{className:"lan-peer-edit",onSubmit:me=>{me.preventDefault(),B(k??"")},children:[i.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),i.jsx("input",{ref:J,className:"ap-manage-input lan-peer-input",value:k??"",maxLength:48,placeholder:W,"aria-label":"Name for this deck, shown on this deck only",onChange:me=>S(me.target.value)}),i.jsx("button",{type:"submit",className:"ap-manage-btn",...Z(`alias:${e.fp}`),children:"save"}),i.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>S(null),children:"cancel"})]}):i.jsxs("span",{className:"lan-peer-title",children:[i.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),L&&i.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{j(null),S(e.name)},"aria-label":`Rename ${e.name} on this deck`,title:"Give it a name of your own. Only this deck sees it.",children:i.jsx(d8,{})})]}),i.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&i.jsxs(i.Fragment,{children:["calls itself ",i.jsx("span",{className:"lan-peer-self",children:e.self}),M&&i.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...Z(`alias:${e.fp}`),onClick:()=>void B(""),children:"use this name"}),i.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&i.jsx("span",{"aria-hidden":!0,children:" · "})]}),i.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{ref:w,type:"button",className:"glyph-btn",onClick:c,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body lan-peer-body",children:[b&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:b}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>j(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsxs("div",{className:"lan-map","data-link":Ze,"data-asking":ct||void 0,"data-bus":qe.length>0||void 0,children:[i.jsxs("div",{className:"lan-ends",children:[i.jsxs("p",{className:"lan-end",children:[i.jsx("span",{className:"lan-end-name",children:"This deck"}),pe&&i.jsx("span",{className:"lan-end-runs",children:pe}),H&&n.shareActive===!1&&i.jsx("span",{className:"lan-end-note",children:"current account hidden"})]}),i.jsxs("p",{className:"lan-end","data-side":"there",children:[i.jsx("span",{className:"lan-end-name",children:e.name}),e.kind!=="dialling"&&i.jsxs("span",{className:"lan-end-runs",children:[ye??(O?"not said":le),Ie?` · ${Ie<0?"older":"newer"}`:null]}),$e&&i.jsx("span",{className:"lan-end-note",children:"current account hidden"}),Je&&i.jsx("span",{className:"lan-end-note",children:"on another account"})]})]}),i.jsxs("div",{className:"lan-link",children:[i.jsx(M_,{}),i.jsxs("span",{className:"lan-span",children:[i.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[i.jsx("i",{className:"lan-glint","data-dir":"out"}),i.jsx("i",{className:"lan-glint","data-dir":"in"})]}),i.jsx("span",{className:"lan-link-label",children:de?i.jsx("code",{className:"ap-lan-code",children:de}):"none here — it calls this deck"})]}),i.jsx(M_,{}),(de&&_e||Ne)&&i.jsxs("p",{className:"lan-link-sub",children:[de&&_e,de&&_e&&Ne&&" · ",Ne&&(Te?He?i.jsx("code",{className:"ap-lan-code",children:Me}):i.jsx("span",{className:"lan-round","data-tone":Te.tone,children:Te.text.replace(/ · now$/," · just now")}):"not asked yet"),Ne&&Me&&!He&&i.jsx("code",{className:"lan-fact-raw",children:Me})]}),nt.length>0&&i.jsx("ul",{className:"lan-done",children:nt.map(me=>i.jsxs("li",{"data-ok":me.ok,children:[me.email," ",i.jsx("span",{className:"lan-done-what",children:me.ok?"arrived":"did not arrive"})]},`${me.email}:${me.action}`))}),Re&&i.jsx("p",{className:"lan-note lan-link-note",children:Re}),(I==null?void 0:I.waiting)&&i.jsx("p",{className:"lan-note lan-link-note",children:e.hint})]}),qe.length>0&&i.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:qe.map((me,it)=>{const ht=Ve.get(me.email),Qe=me.out==="live"||me.in!=null&&me.in!=="cut";return i.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":me.tone,"data-draw":me.in&&me.out?"both":me.in?"in":"out","data-used-there":me.usedThere||void 0,style:{"--i":it},children:[i.jsx("i",{className:"lan-pip","data-end":"here","data-state":me.here,"aria-hidden":!0}),i.jsxs("span",{className:"lan-track",children:[i.jsxs("span",{className:"lan-wire","data-flow":Qe?"live":"cut","aria-hidden":!0,children:[(me.in==="live"||me.in==="wait")&&i.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":me.in}),me.out==="live"&&i.jsx("i",{className:"lan-glint","data-dir":"out"})]}),me.in&&me.in!=="cut"&&i.jsx(gd,{dir:"in",gate:me.in==="blocked"}),me.out==="live"&&i.jsx(gd,{dir:"out"}),i.jsx("span",{className:"lan-lane-email",children:me.email})]}),i.jsx("i",{className:"lan-pip","data-end":"there","data-state":me.there,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:p8(me)}),(me.caption||ht)&&i.jsxs("span",{className:"lan-lane-note",children:[me.caption,me.caption&&ht&&" · ",ht&&i.jsx("span",{className:"lan-lane-done","data-ok":ht.ok,children:ht.ok?"arrived last round":"did not arrive last round"})]})]},me.key)})},P),H&&i.jsxs(i.Fragment,{children:[pt.length>0&&i.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",pt.length===1?pt[0].email:"the expired ones"," until you sign in again here."]}),at&&i.jsx("p",{className:"lan-empty",children:at}),he&&i.jsxs("p",{className:"lan-stale",children:["As of ",he==="now"?"just now":he,", when it last answered."]}),i.jsxs("div",{className:"lan-legend",children:[ge&&i.jsxs("span",{className:"lan-key",children:[i.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:i.jsx(gd,{dir:"in"})}),"from ",e.name]}),be?i.jsxs("span",{className:"lan-key",children:[i.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:i.jsx(gd,{dir:"out"})}),"from this deck, to every paired deck"]}):i.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),i.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:h,"aria-label":"Change what this deck offers",children:"change"})]})]})]}),i.jsx("dl",{className:"lan-facts",children:rt.map(me=>i.jsxs("div",{className:"lan-fact","data-tone":me.tone,children:[i.jsx("dt",{children:me.label}),i.jsx("dd",{children:me.value})]},me.label))}),ot.length>1&&i.jsxs("div",{className:"modal-section",children:[i.jsxs("h3",{className:"lan-h",children:[ot.length," decks on this machine"]}),i.jsx("ul",{className:"lan-twins",role:"list",children:ot.map((me,it)=>{var pn,Qt,mn,nr;const ht=(pn=me.peer)!=null&&pn.addr?`${me.peer.addr}:${me.peer.port}`:me.row.addr,Qe=ht||me.row.fp,sn=(Qt=me.peer)!=null&&Qt.pairedAt?us(me.peer.pairedAt,a):null,an=[(nr=(mn=me.peer)==null?void 0:mn.about)!=null&&nr.version?`runs ${me.peer.about.version}`:null,sn?`paired ${sn==="now"?"just now":sn}`:null,me.row.state].filter(Boolean).join(" · "),Dt=me.row.fp;return i.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":me.row.tone,children:[i.jsx("i",{className:me.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),ht?i.jsx("code",{className:"ap-lan-code lan-twin-at",children:ht}):i.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),i.jsx("code",{className:"ap-lan-code lan-twin-fp",children:Dt}),it>0&&y&&i.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${R===Dt?" armed":""}`,...Z(`unpair:${Dt}`),onKeyDown:Tn=>{Tn.repeat&&Tn.preventDefault()},onClick:()=>{if(R!==Dt){$(Dt),T.current=Date.now();return}Date.now()-T.current<Jd||($(null),G(()=>y(Dt)))},"aria-label":R===Dt?`Confirm unpairing ${Qe}`:`Unpair ${Qe}`,title:R===Dt?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this one of the machine's decks",children:l===`unpair:${Dt}`?"unpairing…":R===Dt?"confirm":"unpair"}),i.jsx("span",{className:"lan-twin-meta",children:it===0?`${an} · shown above`:an})]},Dt)})})]})]}),i.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&i.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),H&&!(I!=null&&I.waiting)&&i.jsx("button",{type:"button",className:"btn",...Z(`check:${e.fp}`),onClick:()=>void G(f).then(me=>{me&&ee.current&&V(it=>it+1)}),title:"Ask this deck now instead of waiting for the next round",children:l===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&i.jsx("button",{type:"button",className:`btn danger lan-peer-verb${E?" armed":""}`,...Z(`unpair:${e.fp}`),onKeyDown:me=>{me.repeat&&me.preventDefault()},onClick:()=>{if(!E){C(!0),T.current=Date.now();return}Date.now()-T.current<Jd||(C(!1),G(p))},"aria-label":E?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:E?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:l===`unpair:${e.fp}`?"Unpairing…":E?"Confirm unpair":"Unpair"}),e.kind==="nearby"&&i.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...Z(`accept:${e.fp}`),onClick:()=>void G(p),title:"Send it a request. Somebody at that machine has to accept it before anything is shared.",children:l===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&i.jsx("button",{type:"button",className:"btn lan-peer-verb",...Z(`drop:${e.fp}`),onClick:()=>void G(p),title:"Stop trying this address. Nothing was ever paired here.",children:l===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&i.jsx("button",{type:"button",className:"btn lan-peer-verb",...Z(`allow:${e.fp}`),onClick:()=>void G(p),title:"Take the no back. That deck is still trying, so its request comes round again on its own.",children:l===`allow:${e.fp}`?"Allowing…":"Let it ask again"})]})]})}),document.body)}function g8({status:e,accounts:t,onClose:n,onChanged:r}){const a=rn(n),[l,c]=x.useState(null),[u,f]=x.useState(null),[p,h]=x.useState(!1),[m,y]=x.useState(null),w=x.useRef(null),N=D=>{const U=Na(m,D);return{disabled:U.disabled,"aria-busy":U.busy}},k=x.useRef(null),S=x.useRef(!0);x.useEffect(()=>()=>{S.current=!1},[]),x.useEffect(()=>{k.current&&_8(k.current,e.shared??[])&&(k.current=null)},[e.shared]);const b=x.useCallback(async(D,U,P="write")=>{w.current=P,y(P);try{const J=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:D})})).json().catch(()=>null);return S.current?(J!=null&&J.ok?f(null):f(Kt(U,J)),r(),(J==null?void 0:J.ok)===!0):!1}catch{return S.current&&f(Kt(U,null)),!1}finally{w.current=null,S.current&&y(null)}},[r]),j=x.useCallback(async()=>{if(l!=null&&l!==(e.name??"")){if(!await b({name:l},"save the name","name"))return;S.current&&c(null)}n()},[l,e.name,b,n]),E=async()=>{if(!e.fp)return;const D=await bh(e.fp);if(S.current){if(!D){f("Could not copy it — select the fingerprint and copy it by hand.");return}h(!0),window.setTimeout(()=>{S.current&&h(!1)},1600)}},C=new Set(k.current??e.shared??[]),T=e.autoAsk!==!1,R=e.autoAccept!==!1,$=e.shareActive!==!1;return mr.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal lan-modal",onClick:D=>D.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[u&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:u}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Name"}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("span",{className:"ap-lan-label",children:"appear as"}),i.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:l??e.name??"",placeholder:"this machine",onChange:D=>c(D.target.value),onKeyDown:D=>{D.key!=="Enter"||l==null||(b({name:l},"save the name","name"),c(null))}}),l!=null&&l!==(e.name??"")&&i.jsx("button",{type:"button",className:"ap-manage-btn",...N("name"),onClick:()=>{b({name:l},"save the name","name"),c(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?i.jsxs("span",{className:"lan-fp",children:[i.jsx("code",{className:"ap-lan-code",children:e.fp}),i.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void E(),"aria-label":p?"Fingerprint copied":"Copy this deck's fingerprint",children:p?"copied":"copy"})]}):i.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Share these accounts"}),i.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&i.jsx("span",{className:"ap-lan-empty",children:"No Claude accounts on this deck yet — add one with + at the top of this panel."}),t.map(D=>i.jsxs("label",{className:"ap-lan-pick",title:D.alive?"Offer this account to the decks you have paired with, so one whose copy has died can heal from yours. Unticking stops it being offered from now on; it does not take back a copy somebody already has.":"This deck cannot use this login, so it has nothing to offer — a deck that can will heal it",children:[i.jsx("input",{type:"checkbox",checked:C.has(D.key),onChange:U=>{const P=new Set(k.current??e.shared??[]);U.target.checked?P.add(D.key):P.delete(D.key),k.current=[...P],b({shared:[...P]},U.target.checked?"share that account":"stop sharing that account")}}),i.jsx("span",{className:"ap-lan-pick-name",children:D.email}),!D.alive&&i.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},D.key))]}),t.length>0&&i.jsxs("div",{className:"lan-switch",children:[i.jsx("span",{className:"lan-switch-what",children:"Show paired decks which of these this deck is using"}),i.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":$,"aria-label":"Show paired decks which of these this deck is using",...N("current"),onClick:()=>void b({shareActive:!$},$?"stop showing which account this deck is using":"show which account this deck is using","current"),title:$?"Stop telling paired decks which account this one is on. They read “current account hidden” instead.":"Tell paired decks which of the ticked accounts this one is on. An unticked account is never named.",children:i.jsx("span",{className:"switch-knob"})})]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Pairing"}),i.jsxs("div",{className:"lan-switches",children:[i.jsxs("div",{className:"lan-switch",children:[i.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),i.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":T,"aria-label":"Ask every deck this one finds",...N("ask"),onClick:()=>void b({autoAsk:!T},T?"stop asking automatically":"ask every deck this one finds","ask"),title:T?"Stop sending requests on their own. You press ask on the row instead.":"Send a pairing request to every deck heard on this network. Somebody over there still has to say yes.",children:i.jsx("span",{className:"switch-knob"})})]}),i.jsxs("div",{className:"lan-switch",children:[i.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),i.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":R,"aria-label":"Say yes to every deck that asks","data-tone":"warn",...N("accept"),onKeyDown:D=>{D.repeat&&D.preventDefault()},onClick:()=>void b({autoAccept:!R},R?"stop accepting automatically":"accept every deck that asks","accept"),title:R?"Stop saying yes for you. A deck that asks waits in the panel again.":"Say yes for you. Every deck on this network that asks is paired without anybody being asked here.",children:i.jsx("span",{className:"switch-knob"})})]})]})]})]}),i.jsxs("footer",{className:"lan-setup-foot",children:[i.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),i.jsx("button",{type:"button",className:"btn primary",...N("name"),onClick:()=>void j(),children:"Done"})]})]})}),document.body)}function us(e,t){if(e==null)return"not seen";const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const a=Math.round(r/60);return a<48?`${a}h ago`:`${Math.round(a/24)}d ago`}const y0={"waiting for the other deck to accept this one":{text:"waiting for them to say yes",tone:"idle"},"that deck said no":{text:"it said no",tone:"bad"}},y8={ECONNREFUSED:"not listening",EHOSTUNREACH:"no route to it",ENETUNREACH:"no network here",ETIMEDOUT:"no answer",ECONNRESET:"it hung up",EHOSTDOWN:"it is down",ENOTFOUND:"name not found",EACCES:"blocked here",EPIPE:"it hung up"};function w8(e){var r;const t=v8[e];if(t)return t;const n=(r=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:r[1];return n&&y8[n]||e}const v8={"handshake timed out":"no answer","peer closed the connection":"it hung up","peer went quiet":"it stopped mid-sentence","bad reply":"it answered with nonsense","no manifest":"it would not say what it has","bad challenge":"it answered as somebody else","a different deck is answering at that address":"a different deck is at that address","that deck could not prove its own key":"it could not prove who it is","the other deck refused this one's proof":"it would not take this deck's word","the other deck refused this handshake":"it turned this deck away","that deck has this one pinned under a different key":"it knows this deck by another key"};function fR(e,t){if(!e)return null;if(e.error)return y0[e.error]??{text:w8(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${us(e.at,t)}`,tone:"idle"};const r=n.filter(l=>l.ok),a=r.length===1?"login":"logins";return r.length===n.length?{text:`${r.length} ${a} arrived · ${us(e.at,t)}`,tone:"ok"}:{text:`${r.length} of ${n.length} logins arrived · ${us(e.at,t)}`,tone:"bad"}}const x8=9e4;function b8({error:e,host:t,port:n},r,a,l=45317){if(e!=="handshake timed out")return null;const c=(t??"").trim();if(!c)return null;const u=r.filter(p=>p.addr===c&&p.port&&p.at>0&&a-p.at<x8);if(!u.length)return null;const f=[...new Set(u.map(p=>p.port))];if(n!=null&&!f.includes(n)){const p=f.length===1?`port ${f[0]}`:`ports ${f.join(" and ")}`;return`A deck at ${c} is announcing itself on ${p}, not on ${n}. This deck already hears it and dials it there, so this typed row has nothing to reach.`}return`That machine is running the deck — its beacon arrives here every half minute — and what this deck sends back never gets there. That is a firewall on ${c}, not a network fault. Whoever uses it can allow two ports: UDP ${l} and TCP ${n??f[0]}.`}const Ax=5e3,pR=6e4,Jd=400;function k8(e){const t=(e??"").trim(),n=t.lastIndexOf(":");if(n<=0||n===t.length-1)return null;const r=t.slice(0,n).trim(),a=Number(t.slice(n+1).trim());return!r||!Number.isInteger(a)||a<1||a>65535||r.includes(":")&&!(r.startsWith("[")&&r.endsWith("]"))?null:{addr:r,port:a}}function Kt(e,t){return t==null?`Could not ${e} — the deck did not answer.`:t.reason?`Could not ${e} — the deck refused it (${t.reason}).`:`Could not ${e}.`}function _8(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function N8(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function mR(e,t){var n,r;return(n=e.last)!=null&&n.error&&!y0[e.last.error]?!1:!!((r=e.last)!=null&&r.at&&t-e.last.at<eh||e.lastSeen!=null&&t-e.lastSeen<eh)}const eh=95e3,gR=160,S8=6,yR=140;function j8(e,t){const n=[],r=[];for(const a of e??[])(mR(a,t)?n:r).push(a);return{online:n,offline:r}}function E8(e,t){if(!e)return{text:"checking…",tone:"idle"};if(!e.enabled)return{text:"",tone:"idle"};if(e.stalled)return{text:`could not start — ${e.stalled}`,tone:"bad"};if(!e.running)return{text:"starting…",tone:"wait"};const n=(e.pending??[]).length;if(n)return{text:n===1?"1 deck is waiting for your answer":`${n} decks are waiting for your answer`,tone:"wait"};const r=(e.peers??[]).filter(w=>w.paired!==!1||w.met);if(!r.length)return{text:"no deck paired yet",tone:"idle"};const a=r.filter(w=>w.waiting),l=r.filter(w=>!w.waiting),c=a.filter(w=>{var N;return!((N=w.last)!=null&&N.error)&&w.lastSeen!=null&&t-w.lastSeen<eh}),{online:u,offline:f}=j8(l,t),p=[...f,...a.filter(w=>!c.includes(w))],h=u.length+c.length,m=u.filter(w=>{var N;return((N=w.last)==null?void 0:N.error)==="waiting for the other deck to accept this one"});if(h&&m.length===h)return{text:h===1?"1 deck found · waiting for them to accept":`${h} decks found · waiting for them to accept`,tone:"wait"};if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const y=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function C8(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const r=us(e,t);return r==="now"?"checked just now":`checked ${r}`}function w0(e,t){const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"just now";const r=Math.round(n/60);return r<60?`${r}m ago`:`${Math.round(r/60)}h ago`}function T8(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<eh;return{text:n?"online · one-way, it calls in":`one-way · last online ${us(e,t)}`,here:n}}function I_(e,t,n){return t?"online":e.lastSeen!=null?`last online ${us(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function A8(e,t){var y,w,N,k,S;if(!e)return[];const n=[],r=new Set,a=(b,j)=>b.name.localeCompare(j.name,void 0,{numeric:!0}),l=e.aliases??{},c=(b,j)=>{const E=b?l[b]:void 0;return E&&E!==j?{name:E,self:j}:{name:j}};for(const b of e.pending??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const j=c(b.fp,b.name||b.fp);n.push({fp:b.fp,name:j.name,...j.self?{self:j.self}:{},addr:b.addr??"",kind:"asks",state:`wants to pair · ${w0(b.at,t)}`,tone:"wait",here:!0,hint:`${j.name} at ${b.addr} is waiting for an answer.`})}const u=[],f=[];for(const b of e.peers??[]){const j=b.peerFp??b.fp;if(!j||r.has(j))continue;r.add(j);const E=fR(b.last,t),C=mR(b,t),T=b.addr?`${b.addr}:${b.port}`:"";if(!b.paired&&b.manual&&!b.met){f.push({fp:T,name:T||b.name||j,addr:b.addr??"",kind:"dialling",state:E?E.text.replace(/ · .*$/,""):"trying…",tone:E?E.tone:"idle",here:!1,hint:(y=b.last)!=null&&y.error?`Nothing has answered at ${T} yet — ${b.last.error}.`:`Dialling ${T} until something answers.`});continue}const R=b.waiting?T8(b.lastSeen,t):null,$=R?R.here:C,D=!R&&E?$?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${I_(b,$,t)}`:R?R.text:I_(b,$,t),U=(w=b.last)!=null&&w.error?y0[b.last.error]:null,P=!R&&$&&!((N=b.last)!=null&&N.error)&&!(((k=b.last)==null?void 0:k.done)??[]).length,V=b.manual&&!b.met?{name:T}:c(j,b.name||j);u.push({fp:j,name:V.name,...V.self?{self:V.self}:{},addr:b.addr??"",kind:"paired",state:D,quiet:P,tone:U?U.tone==="bad"?"bad":"wait":E?E.tone:$?"ok":"idle",here:R?R.here:C,hint:R?`${V.name} calls this deck, and this deck has no address to call back on — so it can repair its logins from here, and this deck cannot repair from it. ${b.lastSeen==null?"It has not called since this deck started.":`It last called ${us(b.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${V.name}${T?` at ${T}`:""}${(S=b.last)!=null&&S.error?` — ${b.last.error}`:""}`})}n.push(...R8(u).sort(a),...f.sort(a));const p=[];for(const b of e.strangers??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const j=c(b.fp,b.name||b.fp);p.push({fp:b.fp,name:j.name,...j.self?{self:j.self}:{},addr:b.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${j.name} at ${b.addr} is on this network and nothing is shared with it.`})}n.push(...p.sort(a));const h=[];for(const b of e.declined??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const j=c(b.fp,b.name||b.fp);h.push({fp:b.fp,name:j.name,...j.self?{self:j.self}:{},addr:b.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${j.name} asked and was turned away. It is not asking any more.`})}n.push(...h.sort(a));const m=new Map;for(const b of n)m.set(b.name,(m.get(b.name)??0)+1);for(const b of n)(m.get(b.name)??0)<2||!b.addr||(b.state=b.quiet||!b.state?b.addr:`${b.addr} · ${b.state}`,b.quiet=!1);return n}function R8(e){const t=new Map;for(const r of e){const a=t.get(r.name);a?a.push(r):t.set(r.name,[r])}const n=[];for(const r of t.values()){const a=[...new Set(r.filter(l=>l.addr).map(l=>l.addr))];if(a.length>1){for(const l of a)n.push($_(r.filter(c=>c.addr===l)));n.push(...r.filter(l=>!l.addr))}else n.push($_(r))}return n}function $_(e){const[t,...n]=[...e].sort((r,a)=>Number(a.here)-Number(r.here)||+!!a.addr-+!!r.addr);return n.length?{...t,twins:n}:t}function O_(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function L_(e,t){if(!e)return{};switch(t.kind){case"paired":return{peer:(e.peers??[]).find(n=>(n.peerFp??n.fp)===t.fp)??null};case"dialling":return{peer:(e.peers??[]).find(n=>n.manual&&!n.met&&`${n.addr}:${n.port}`===t.fp)??null};case"nearby":return{stranger:(e.strangers??[]).find(n=>n.fp===t.fp)??null};case"declined":return{stranger:(e.declined??[]).find(n=>n.fp===t.fp)??null};case"asks":return{stranger:(e.pending??[]).find(n=>n.fp===t.fp)??null}}}function M8(e,t){const n=/^(\d+)\.(\d+)\.(\d+)/.exec(e??""),r=/^(\d+)\.(\d+)\.(\d+)/.exec(t??"");if(!n||!r)return null;for(let a=1;a<=3;a++){const l=Number(n[a])-Number(r[a]);if(l)return Math.sign(l)}return 0}function I8(e,t,n){const r=t?t.alive?"works here":"expired here":"not on this deck";if(!e.alive){const a=t&&!t.alive?"neither copy works — sign in again here":null;return{there:"broken there",here:r,note:a,tone:a?"bad":"idle"}}return t?t.alive?{there:"works there",here:r,note:null,tone:"ok"}:n?{there:"works there",here:r,note:"repairs next round",tone:"wait"}:{there:"works there",here:r,note:"share it to repair",tone:"bad"}:{there:"works there",here:r,note:"arrives next round",tone:"wait"}}function $8(e,t,n,r=null){const a=new Map(t.map(f=>[f.key,f])),l=new Set(n),c=[],u=new Set;for(const f of e??[]){if(u.has(f.key))continue;u.add(f.key);const p=a.get(f.key)??null,h=l.has(f.key),m=I8(f,p,h),y=p?p.alive?"works":"expired":"missing",w=!f.alive&&p&&!p.alive?m.note:[y==="works"?null:m.here,f.alive?null:m.there,m.note].filter(Boolean).join(" · ")||null;c.push({key:f.key,email:f.email,here:y,there:f.alive?"works":"broken",in:f.alive?m.tone==="wait"?"wait":m.tone==="bad"?"blocked":"live":"cut",out:h&&p?p.alive?"live":"cut":null,caption:w,tone:m.tone,usedThere:r===f.key})}for(const f of n){const p=a.get(f);!p||u.has(f)||(u.add(f),c.push({key:f,email:p.email,here:p.alive?"works":"expired",there:"unknown",in:null,out:p.alive?"live":"cut",caption:p.alive?null:"expired here",tone:p.alive?"ok":"bad",usedThere:!1}))}return c}async function Ni(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function O8({anchorId:e,id:t,rows:n,onHold:r,onLet:a}){const l=x.useRef(null),c=n.filter(y=>y.kind==="paired"),u=c.filter(y=>y.here),f=u.slice(0,S8),p=c.length-u.length,h=u.length>f.length?`and ${u.length-f.length} more`:p>0?`${p} not on right now`:null,m=x.useCallback(()=>{const y=l.current,w=document.getElementById(e);if(!y||!w)return;const N=lR(w.getBoundingClientRect(),{width:y.offsetWidth,height:y.offsetHeight},{width:window.innerWidth,height:window.innerHeight});y.style.top=`${N.top}px`,y.style.left=`${N.left}px`,y.style.maxHeight=N.maxHeight==null?"":`${N.maxHeight}px`,y.dataset.side=N.side},[e]);return x.useLayoutEffect(()=>{m()}),x.useEffect(()=>(window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}),[m]),mr.createPortal(i.jsxs("div",{ref:l,id:t,className:"ap-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:a,children:[i.jsx("p",{className:"ap-peek-title",children:u.length?"On the network now":"Nobody on the network"}),f.length>0&&i.jsx("div",{className:"ap-peek-list",children:f.map(y=>i.jsxs("span",{className:"ap-peek-who",children:[i.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),i.jsx("span",{children:y.name})]},`${y.kind}:${y.fp}`))}),h&&i.jsx("p",{className:"ap-peek-rest",children:h})]}),document.body)}function L8(e,t){var l;if(!e)return{text:"checking…",tone:"idle",live:!1};if(!e.enabled)return{text:"Off",tone:"idle",live:!1};if(e.stalled)return{text:"could not start",tone:"bad",live:!1};if(!e.running)return{text:"starting…",tone:"wait",live:!1};const n=t.filter(c=>c.kind==="asks").length;if(n)return{text:n===1?"1 deck wants to pair":`${n} decks want to pair`,tone:"wait",live:!1};if((l=e.reach)!=null&&l.blocked)return{text:"nothing can get in",tone:"bad",live:!1};const r=t.filter(c=>c.kind==="paired");if(!r.length)return{text:"On · none paired yet",tone:"idle",live:!1};const a=r.filter(c=>c.here).length;return a?a===r.length?{text:`${a} online`,tone:"ok",live:!0}:{text:`${a} of ${r.length} online`,tone:"ok",live:!0}:{text:`none of ${r.length} online`,tone:"idle",live:!1}}function P8({accounts:e,onChanged:t,view:n,onOpen:r,onBack:a,closeButton:l}){const[c,u]=x.useState(null),[f,p]=x.useState([]),[h,m]=x.useState(null),[y,w]=x.useState(!1),[N,k]=x.useState(null),S=x.useRef(0),[b,j]=x.useState(!1),[E,C]=x.useState(!1),[T,R]=x.useState(!1),$=x.useRef(0);x.useEffect(()=>()=>window.clearTimeout($.current),[]);const[D,U]=x.useState(!1),[P,V]=x.useState(null),J=x.useRef(null),ee=x.useCallback(ce=>_h(J.current)?(J.current=ce,m(ce),!0):!1,[]),M=x.useCallback(()=>{J.current=null,q.current&&m(null)},[]),Z=ce=>{const je=Na(h,ce);return{disabled:je.disabled,"aria-busy":je.busy}},[G,I]=x.useState(()=>Date.now()),q=x.useRef(!0),H=x.useRef(Ax),W=x.useCallback(async()=>{var ce,je;try{const[$e,Je]=await Promise.all([fetch("/api/lan").then(qe=>qe.json()),fetch("/api/prefs").then(qe=>qe.json())]);if(!q.current)return;$e!=null&&$e.ok&&u($e),Je!=null&&Je.ok&&p(Array.isArray((je=(ce=Je.prefs)==null?void 0:ce.lan)==null?void 0:je.manual)?Je.prefs.lan.manual:[]),H.current=($e==null?void 0:$e.enabled)===!0?Ax:pR}catch{}},[]);x.useEffect(()=>{q.current=!0;let ce=0;const je=async()=>{I(Date.now()),await W(),q.current&&(ce=window.setTimeout(je,H.current))};return je(),()=>{q.current=!1,window.clearTimeout(ce)}},[W]);const L=x.useCallback(async()=>{const ce=(c==null?void 0:c.enabled)===!0;if(ee("switch"))try{const je=await Ni("/api/prefs",{lan:{enabled:!ce}});if(!q.current)return;je!=null&&je.ok?(V(null),ce||w(!0)):V(Kt(ce?"turn this off":"turn this on",je)),await W()}catch{q.current&&V(Kt(ce?"turn this off":"turn this on",null))}finally{M()}},[c==null?void 0:c.enabled,W,ee,M]),K=x.useCallback(async(ce,je,$e)=>{if(!ee(`${ce}:${je}`))return null;let Je=null;try{const qe=await Ni("/api/lan/peer",{action:ce,fp:je});if(!q.current)return null;qe!=null&&qe.ok?(u(qe),V(null)):(Je=Kt($e,qe),V(Je)),await W()}catch{Je=Kt($e,null),q.current&&V(Je)}finally{M()}return Je},[W,ee,M]),de=x.useCallback(async ce=>{if(!ee(`drop:${ce}`))return null;let je=null;try{const $e=await Ni("/api/prefs",{lan:{manual:f.filter(Je=>Je!==ce)}});if(!q.current)return null;$e!=null&&$e.ok?(V(null),t()):(je=Kt("stop dialling that address",$e),V(je)),await W()}catch{je=Kt("stop dialling that address",null),q.current&&V(je)}finally{M()}return je},[f,W,t,ee,M]),[O,Y]=x.useState(null),B=x.useCallback(async(ce,je)=>{if(!ee(`alias:${ce}`))return"Something else is still being saved. Try again in a moment.";try{const $e=await Ni("/api/lan/peer",{action:"alias",fp:ce,name:je});return q.current?$e!=null&&$e.ok?(u($e),null):Kt("rename that deck",$e):null}catch{return Kt("rename that deck",null)}finally{M()}},[ee,M]),te=x.useCallback(async ce=>{if(!ee(`check:${ce}`))return null;try{const je=await Ni("/api/lan/sync",{fp:ce});return q.current?je!=null&&je.ok?(u(je),t(),null):(je==null?void 0:je.reason)==="no_address"?"There is no address here to call it on. It calls this deck, and it is up to date each time it does.":Kt("check that deck",je):null}catch{return Kt("check that deck",null)}finally{M()}},[ee,M,t]),le=x.useCallback(async()=>{if(ee("check"))try{const ce=await Ni("/api/lan/sync",{});if(!q.current)return;ce!=null&&ce.ok?(u(ce),V(null)):V(Kt("check the other decks",ce)),t()}catch{q.current&&V(Kt("check the other decks",null))}finally{M()}},[ee,M,t]),pe=(c==null?void 0:c.enabled)===!0,ye=A8(c,G),Ie=O?ye.find(ce=>{var je;return ce.fp===O||((je=ce.twins)==null?void 0:je.some($e=>$e.fp===O))})??null:null;x.useEffect(()=>{O&&c&&!Ie&&Y(null)},[O,c,Ie]);const Te=ye.filter(ce=>ce.kind==="asks"),Re=ye.filter(ce=>ce.kind!=="asks"),Me=Re.filter(ce=>ce.here),xe=Re.filter(ce=>!ce.here),He=xe.filter(ce=>ce.tone==="bad").length,Ne=D||Me.length===0,_e=E8(c,G),Ze=Re.filter(ce=>ce.kind==="paired").length,ct=L8(c,ye),Ke=i.jsxs(i.Fragment,{children:[b&&c&&i.jsx(i8,{status:c,manual:f,onClose:()=>j(!1),onChanged:()=>{W(),t()}}),E&&i.jsx(uR,{title:"How Local network works",steps:t8,finish:pe?void 0:{label:"Turn it on",act:()=>{C(!1),L()}},onClose:()=>C(!1)}),y&&c&&i.jsx(g8,{status:{...c,manualRows:f},accounts:e,manual:f,onClose:()=>w(!1),onChanged:()=>{W(),t()}}),Ie&&c&&i.jsx(m8,{row:Ie,source:L_(c,Ie),status:c,accounts:e,now:G,busy:h,onClose:()=>Y(null),onRename:ce=>B(Ie.fp,ce),onCheck:()=>te(Ie.fp),onVerb:()=>{switch(Ie.kind){case"paired":return K("unpair",Ie.fp,"unpair that deck");case"nearby":return K("accept",Ie.fp,"reach that deck");case"declined":return K("allow",Ie.fp,"let that deck ask again");case"dialling":return de(Ie.fp);default:return Promise.resolve(null)}},onSettings:()=>{Y(null),w(!0)},twins:(Ie.twins??[]).map(ce=>({row:ce,peer:L_(c,ce).peer??null})),onUnpair:ce=>K("unpair",ce,"unpair that deck")})]});if(!n){const ce=qe=>{window.clearTimeout($.current),$.current=window.setTimeout(()=>R(!0),qe)},je=()=>{window.clearTimeout($.current),$.current=window.setTimeout(()=>R(!1),yR)},$e=()=>window.clearTimeout($.current),Je=()=>{window.clearTimeout($.current),R(!1)};return i.jsxs("div",{className:"ap-foot",children:[i.jsxs("button",{type:"button",id:"ap-lan-entry",className:"ap-nav",onClick:()=>{Je(),r()},"aria-describedby":T?"ap-lan-peek":void 0,onPointerEnter:qe=>{qe.pointerType==="mouse"&&ce(gR)},onPointerLeave:je,onFocus:qe=>{qe.target.matches(":focus-visible")&&ce(0)},onBlur:je,children:[i.jsxs("svg",{className:"ap-nav-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("rect",{x:"1.8",y:"2.3",width:"10.4",height:"7.2",rx:"1.2"}),i.jsx("path",{d:"M5 11.9h4M7 9.5v2.4"})]}),i.jsxs("span",{className:"ap-nav-text",children:[i.jsx("span",{className:"ap-nav-name",children:"Local network"}),i.jsxs("span",{className:"ap-nav-state","data-tone":ct.tone,children:[ct.live&&i.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),ct.text]})]}),i.jsx("svg",{className:"ap-nav-chev",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),T&&i.jsx(O8,{anchorId:"ap-lan-entry",id:"ap-lan-peek",rows:ye,onHold:$e,onLet:je}),i.jsx("p",{className:"vis-hidden",role:"status",children:_e.tone==="ok"?"":_e.text}),Ke]})}return i.jsxs("div",{className:"ap-lan-view",children:[i.jsxs("div",{className:"ap-header",children:[i.jsx("button",{type:"button",id:"ap-lan-back",className:"glyph-btn ap-back",onClick:a,"aria-label":"Back to Claude accounts",title:"Back to Claude accounts",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:"M8.4 3.4 4.8 7l3.6 3.6"})})}),i.jsx("h2",{id:"ap-lan-title",children:"Local network"}),i.jsxs("div",{className:"ap-header-right",children:[pe&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>j(!0),"aria-label":"Add a deck",title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M6.1 7.9a2.6 2.6 0 0 0 3.7 0l1.9-1.9a2.6 2.6 0 0 0-3.7-3.7l-.9.9"}),i.jsx("path",{d:"M7.9 6.1a2.6 2.6 0 0 0-3.7 0L2.3 8a2.6 2.6 0 0 0 3.7 3.7l.9-.9"})]})}),pe&&Ze>0&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...Z("check"),onClick:()=>void le(),"aria-label":h==="check"?"Checking every paired deck":"Check every paired deck now",title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next round",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),i.jsx("path",{d:"M4.6 4.6a3.4 3.4 0 0 0 0 4.8M9.4 4.6a3.4 3.4 0 0 1 0 4.8"}),i.jsx("path",{d:"M2.6 2.6a6.2 6.2 0 0 0 0 8.8M11.4 2.6a6.2 6.2 0 0 1 0 8.8"})]})}),pe&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...Z("setup"),onClick:()=>w(!0),"aria-label":"This deck's name and shared logins",title:"This deck's name on the network, and which of its logins it offers",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),i.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),i.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),l]})]}),i.jsx("div",{className:"ap-scroll",id:"ap-lan-scroll",children:i.jsxs("div",{className:"ap-lan",children:[i.jsxs("div",{className:"ap-policy",children:[i.jsx("h3",{className:"ap-auto-title",children:"Sync with paired decks"}),i.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":pe,"aria-label":"Sync with paired decks",...Z("switch"),onClick:()=>void L(),title:pe?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins",children:i.jsx("span",{className:"switch-knob"})})]}),pe&&i.jsx(hR,{reach:c==null?void 0:c.reach,where:"panel"}),!pe&&i.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>C(!0),title:"Four pictures: what this does, and what to do on each machine",children:[i.jsx(n8,{}),i.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),i.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),i.jsx("p",{className:`ap-lan-status ${_e.tone}`,role:"status",children:_e.tone==="ok"?"":_e.text}),P&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:P}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>V(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),pe&&i.jsxs(i.Fragment,{children:[Te.length>0&&i.jsx("div",{className:"ap-lan-asks",role:"alert",children:Te.map(ce=>i.jsxs("div",{className:"ap-lan-ask",children:[i.jsxs("span",{className:"ap-lan-ask-what",children:[i.jsx("strong",{className:"ap-lan-peer-name",children:ce.name})," at ",i.jsx("code",{className:"ap-lan-code",children:ce.addr})," wants to pair"]}),i.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",i.jsx("code",{className:"ap-lan-code",children:ce.fp})]}),i.jsxs("span",{className:"ap-lan-ask-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...Z(`accept:${ce.fp}`),onClick:()=>void K("accept",ce.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${ce.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),i.jsx("button",{type:"button",className:"ap-manage-btn",...Z(`dismiss:${ce.fp}`),onClick:()=>void K("dismiss",ce.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},ce.fp))}),(Ne?[...Me,...xe]:Me).length>0&&i.jsx("ul",{className:"ap-lan-here",children:(Ne?[...Me,...xe]:Me).map((ce,je)=>i.jsxs("li",{className:"ap-lan-who","data-tone":ce.tone,children:[i.jsx("i",{className:ce.here?"ap-pulse":"ap-dot","aria-hidden":!0}),i.jsx("span",{className:"ap-lan-who-name","aria-hidden":!0,children:ce.name}),i.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${je}`,onClick:()=>Y(ce.fp),children:i.jsxs("span",{className:"vis-hidden",children:[ce.name,", details"]})}),i.jsx("span",{id:`lan-who-state-${je}`,className:ce.quiet?"vis-hidden":"ap-lan-who-when",children:ce.state}),ce.kind==="nearby"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`accept:${ce.fp}`),onClick:()=>void K("accept",ce.fp,"reach that deck"),"aria-label":`Ask ${ce.name} to pair`,title:`Send ${ce.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${ce.fp}.`,children:"ask"}),ce.kind==="paired"&&i.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${N===ce.fp?" armed":""}`,...Z(`unpair:${ce.fp}`),onClick:()=>{if(N!==ce.fp){k(ce.fp),S.current=Date.now(),window.setTimeout(()=>k($e=>$e===ce.fp?null:$e),4e3);return}Date.now()-S.current<Jd||(k(null),K("unpair",ce.fp,"unpair that deck"))},"aria-label":N===ce.fp?`Confirm unpairing ${ce.name}`:`Unpair ${ce.name}`,title:N===ce.fp?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:N===ce.fp?"confirm":"unpair"}),ce.kind==="dialling"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`drop:${ce.fp}`),onClick:()=>void de(ce.fp),"aria-label":`Stop dialling ${ce.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),ce.kind==="declined"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`allow:${ce.fp}`),onClick:()=>void K("allow",ce.fp,"let that deck ask again"),"aria-label":`Let ${ce.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${ce.kind}:${ce.fp}`))}),(Me.length>0&&xe.length>0||pe&&Ze>0)&&i.jsxs("div",{className:"ap-lan-tail",children:[Me.length>0&&xe.length>0&&i.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":D,onClick:()=>U(ce=>!ce),title:D?"Show only the decks that are on":`Show the ${xe.length} deck${xe.length===1?"":"s"} that are not responding right now`,children:[i.jsx("span",{className:`ap-lan-chev${D?" open":""}`,"aria-hidden":!0,children:"›"}),D?"fewer":`${xe.length} more`,!D&&He>0&&i.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",He," not responding"]})]}),pe&&Ze>0&&i.jsx("span",{className:"ap-lan-checked",children:C8(c==null?void 0:c.checkedAt,G,h==="check")})]}),Re.length===0&&Te.length===0&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"ap-lan-fine",children:"No other deck yet. Decks on one network usually find each other on their own; when that has not happened, the link at the top of this view reaches one by address or by invite."}),i.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>C(!0),children:"How it works"})]})]})]})}),Ke]})}function D8({anchorId:e,id:t,peers:n,onHold:r,onLet:a}){const l=x.useRef(null),{title:c,shown:u,rest:f}=BF(n),p=x.useCallback(()=>{const h=l.current,m=document.getElementById(e);if(!h||!m)return;const y=lR(m.getBoundingClientRect(),{width:h.offsetWidth,height:h.offsetHeight},{width:window.innerWidth,height:window.innerHeight});h.style.top=`${y.top}px`,h.style.left=`${y.left}px`,h.style.maxHeight=y.maxHeight==null?"":`${y.maxHeight}px`,h.dataset.side=y.side},[e]);return x.useLayoutEffect(()=>{p()}),x.useEffect(()=>(window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}),[p]),mr.createPortal(i.jsxs("div",{ref:l,id:t,className:"ap-peek ap-fold-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:a,children:[i.jsx("p",{className:"ap-peek-title",children:c}),i.jsx("div",{className:"ap-peek-list",children:u.map(h=>i.jsxs("span",{className:"ap-peek-who ap-fold-who",children:[i.jsx("span",{className:"ap-fold-name",children:h.name}),i.jsx("span",{className:"ap-fold-state","data-tone":h.ready?"ok":h.warn?"warn":"idle",children:h.ready?h.headroom==null?"not read yet":`${h.headroom}% free`:h.why})]},h.key))}),f&&i.jsx("p",{className:"ap-peek-rest",children:f})]}),document.body)}function q8({peers:e,strained:t,armed:n,threshold:r,open:a,onToggle:l}){const[c,u]=x.useState(!1),f=x.useRef(0);x.useEffect(()=>()=>window.clearTimeout(f.current),[]),x.useEffect(()=>{a&&(window.clearTimeout(f.current),u(!1))},[a]);const p=N=>{a||(window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!0),N))},h=()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!1),yR)},m=()=>window.clearTimeout(f.current),y=()=>{window.clearTimeout(f.current),u(!1)},w=qF(e,{strained:t&&!a,armed:n,threshold:r});return i.jsxs("div",{className:"ap-rest",children:[i.jsxs("button",{type:"button",id:"ap-rest-entry",className:"ap-nav","aria-expanded":a,"aria-controls":a?"ap-rest-panel":void 0,"aria-describedby":c?"ap-rest-peek":void 0,onClick:()=>{y(),l()},onPointerEnter:N=>{N.pointerType==="mouse"&&p(gR)},onPointerLeave:h,onFocus:N=>{N.target.matches(":focus-visible")&&p(0)},onBlur:h,children:[i.jsxs("span",{className:"ap-nav-text",children:[i.jsx("span",{className:"ap-nav-name",children:"Other accounts"}),i.jsx("span",{className:"ap-nav-state","data-tone":w.tone,children:w.text})]}),i.jsx("svg",{className:"ap-nav-chev",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),c&&i.jsx(D8,{anchorId:"ap-rest-entry",id:"ap-rest-peek",peers:e,onHold:m,onLet:h})]})}async function F8(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const B8=1800;function z8({accounts:e,onClose:t,copyText:n}){const[r,a]=x.useState([]),[l,c]=x.useState(null),[u,f]=x.useState(!1),[p,h]=x.useState(null),[m,y]=x.useState(!1),[w,N]=x.useState(()=>Math.floor(Date.now()/1e3)),k=x.useRef(null),S=x.useRef(!1),b=rn(t,{focusRef:k});x.useEffect(()=>{if(!l)return;N(Math.floor(Date.now()/1e3));const P=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(P)},[l]);const j=AF(e),E=e.filter(P=>!r.includes(P.num)).map(P=>P.num),C=E.length===e.length,T=P=>a(V=>V.includes(P)?V.filter(J=>J!==P):[...V,P]),R=x.useCallback(async()=>{if(!Is(S.current)||!E.length)return;S.current=!0,f(!0),h(null),y(!1);const P=await F8({action:"share",accounts:E}).catch(()=>null);if(S.current=!1,f(!1),!(P!=null&&P.ok)){h(Ti(P,"the share could not be made"));return}c({blob:P.blob,expiresAt:P.expiresAt,shared:P.shared??[],failed:P.failed??[]})},[e,E]),$=l?iR(l.expiresAt,w):null,D=($==null?void 0:$.tone)==="gone",U=(l==null?void 0:l.shared.length)??0;return mr.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:b,className:"modal sa-modal",onClick:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("h3",{children:"Share accounts"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsx("section",{className:"modal-body sa-body",children:l?i.jsxs("div",{className:"sa-step",children:[i.jsx("h4",{children:D?"This share has expired":U===1?"1 account, ready to paste":`${U} accounts, ready to paste`}),i.jsx("code",{className:`ap-share-blob${D?" sa-dead":""}`,children:l.blob}),i.jsxs("div",{className:"ap-share-foot",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",ref:k,onClick:async()=>{if(D){c(null),R();return}await n(l.blob)&&(y(!0),window.setTimeout(()=>y(!1),B8))},children:D?"make a new share":m?"copied":`copy ${U===1?"the share":"all "+U}`}),i.jsxs("span",{className:"ap-manage-hint",title:"This text is the sign-in for every account in it. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the logins themselves are in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign those accounts out and back in.",children:[i.jsx("span",{className:"ap-share-warn",children:U===1?"this is the password":`this is ${U} passwords`})," · ",i.jsx("span",{className:`ap-share-expiry ${$==null?void 0:$.tone}`,children:$==null?void 0:$.text})]})]}),l.failed.length>0&&i.jsxs("div",{className:"sa-failed",role:"alert",children:[i.jsx("p",{className:"sa-failed-head",children:l.failed.length===1?"One account is not in this bundle:":`${l.failed.length} accounts are not in this bundle:`}),i.jsx("ul",{className:"sa-list",children:l.failed.map(P=>{var J;const V=!!(P.email&&((J=P.detail)!=null&&J.includes(P.email)));return i.jsxs("li",{children:[!V&&i.jsx("span",{className:"sa-who",children:P.email||`account ${P.num}`}),i.jsx("span",{className:"sa-why",children:P.detail||"could not be exported"})]},`${P.num}-${P.email}`)})})]}),i.jsx("p",{className:"sa-note",children:D?i.jsx(i.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):i.jsxs(i.Fragment,{children:["Paste it into the other deck with ",i.jsx("strong",{children:"+"})," → ",i.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),i.jsxs("div",{className:"sa-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>{c(null),y(!1)},children:"Pick again"}),i.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?i.jsxs("div",{className:"sa-step",children:[i.jsx("h4",{children:"Nothing to share"}),i.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",i.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),i.jsx("div",{className:"sa-actions",children:i.jsx("button",{type:"button",className:"btn primary",ref:k,onClick:t,children:"Close"})})]}):i.jsxs("div",{className:"sa-step",children:[i.jsxs("h4",{children:["Which accounts go to the other ",Yt,"?"]}),i.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:RF(E.length)}),i.jsx("ul",{className:"sa-list sa-pick",children:j.map(P=>i.jsx("li",{children:i.jsxs("label",{className:"sa-row",children:[i.jsx("input",{type:"checkbox",checked:E.includes(P.num),onChange:()=>T(P.num)}),i.jsx("span",{className:"sa-who",children:P.label}),P.sub&&i.jsx("span",{className:"sa-sub",children:P.sub})]})},P.num))}),p&&i.jsx("p",{className:"aa-err",children:p}),i.jsxs("div",{className:"sa-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map(P=>P.num):[]),children:C?"Clear all":"Select all"}),i.jsx("button",{type:"button",className:"btn primary",ref:k,...wa(u,!E.length),onClick:R,children:u?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})}),document.body)}function H8(e,t){const n=new Set(e),r=e.length?Math.max(...e):0;return[...new Set([...e,r+1])].sort((a,l)=>a-l).map(a=>{const l=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:l,label:l==="here"?`slot ${a}`:`slot ${a} · ${l}`}})}function U8(e,t,n){if(!(n!=null&&n.ok))return null;const r=Number.isInteger(n.to)?n.to:null;if(r==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const a=n.swapped===!0&&r!==t;return{menuFor:e.menuFor===t?r:a&&e.menuFor===r?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:a?{at:r,displaced:t}:null}}function W8(e,t,n){return t!=null&&e.some(r=>r.slot===t)?t:n}function V8(e,t,n){var a;const r=((a=e.find(l=>l.slot===t))==null?void 0:a.kind)??"here";return r==="swap"?{label:"swap",done:"swapped",sends:!0,swaps:!0,title:`Send this account to slot ${t}. That slot is taken, so the two accounts trade places and the one standing there moves to slot ${n}.`}:r==="free"?{label:"move",done:"moved",sends:!0,swaps:!1,title:`Send this account to slot ${t}. That slot is empty, so no other account moves.`}:{label:"move",done:"here",sends:!1,swaps:!1,title:`This account already holds slot ${n}.`}}function G8(e,t){return{label:"save",done:"saved",sends:e!==t,swaps:!1,title:`Switch the active account out once it passes ${e}% of its limit.`}}function P_(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function K8(e){const t=e.filter(u=>!P_(u)),n=e.filter(u=>P_(u)),r=t.length?t:n,a=t.length?n:[],l=r.reduce((u,f)=>u&&u.pct>=f.pct?u:f,null);let c=null;for(const u of a)l&&u.pct<=l.pct||(!c||u.pct>c.pct)&&(c=u);return{shown:r,rest:a,fuller:c,peak:c??l}}const Y8="\0";function th(e){const t=typeof e.email=="string"?e.email.trim():"";if(!t)return`slot:${e.num}`;const n=typeof e.org=="string"?e.org.trim():"";return`acct:${t}${Y8}${n}`}function X8(e,t){const n=th(t);return e.includes(n)?e.filter(r=>r!==n):[...e,n]}function Z8(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(th)),r=e.filter(a=>n.has(a));return r.length===e.length?e:r}const Q8=64;function J8(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const eB=Object.freeze({text:"couldn't reach the deck server",reload:!0}),tB=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function D_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function nB(e){const t=e.find(r=>!r.ok);if(!t)return null;const n=fc(t.body);return{text:Ex(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function q_(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}const F_=15e3,rB=8e3,sB=1800,aB=3e4,Tp=[70,80,85,90,95];function Ap(e,t){return DA(t-Math.floor(e/1e3))}function oB(e,t){if(!e)return"";const n=Math.floor(e/1e3)-t;return n<=0?" · due":n<60?` · next in ${n}s`:` · next in ${Math.round(n/60)}m`}function Zl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function iB(e,t){const n="The deck can still see this account — its live usage is being read — but claude-swap's own stored copy of the login was rejected, so these numbers stopped updating.";if((e==null?void 0:e.state)==="running")return{text:"resuming…",hint:`${n} The deck is re-capturing it from the login you already have. No sign-in, no switch.`};if((e==null?void 0:e.state)==="failed"){const r=Math.max(1,Math.ceil((e.retryAt/1e3-t)/60)),a=e.reason?`Re-capturing it from the login you already have did not work (${e.reason}).`:"The deck re-captured it from the login you already have, and claude-swap still cannot read it.";return{text:"numbers paused",hint:`${n} ${a} It tries again in ${r}m. No sign-in, no switch.`}}return{text:"numbers paused",hint:n}}function lB(e){switch(e){case"invalid_grant":case"no_refresh_token":return{text:"login expired",hint:"claude-swap's stored login for this account was rejected and cannot be refreshed. Signing in again replaces it — the account keeps its slot, its alias and its history.",fixable:!0};case"http-401":return{text:"re-login needed",hint:"Anthropic refused this account's token.",fixable:!0};case"http-429":return{text:"rate limited",hint:"Anthropic is throttling requests for this account. It clears on its own.",fixable:!1};case"transient":return{text:"temporary error",hint:"A network or server hiccup while reading usage. The next collection retries.",fixable:!1};case"timeout":return{text:"timed out",hint:"Reading this account's usage took too long. The next collection retries.",fixable:!1};case"network":return{text:"unreachable",hint:"Could not reach Anthropic to read this account's usage.",fixable:!1};default:return{text:e,hint:`claude-swap reported "${e}" for this account.`,fixable:!1}}}function cB(e){switch(e){case"no_credentials":return{text:"no stored login",hint:"claude-swap holds no credentials for this account, so there is nothing to read its usage with and nothing to switch to. A paired deck that has them sends them on its own; signing in as this account puts them there by hand.",fix:"sign in"};case"relogin_required":return{text:"login expired",hint:"claude-swap's stored login for this account was rejected and cannot be refreshed. Signing in again replaces it — the account keeps its slot, its alias and its history.",fix:"sign in again"};case"keychain_unavailable":return{text:"keychain unreadable",hint:"This is about the deck, not the account: claude-swap could not open your keychain, so it cannot read any account's stored login. A deck started from a background session cannot reach the keychain at all — start it from a terminal, or let it start at login, and this clears."};case"token_expired":return{text:"token expired",hint:"The access token ran out and the refresh was deferred. The next collection retries."};case"foreign_credential":return{text:"wrong credential",hint:"The live credential belongs to a different account. Switching to this one repairs it."};case null:case void 0:return null;default:return{text:e,hint:`claude-swap reported "${e}" for this account.`}}}function yd(e,t){if(e.staleCopy){const n=iB(e.repair??null,t);return{text:Zl(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=cB(e.collector??null);if(!n)return{text:"Not collecting",hint:"claude-swap has collected nothing for this account in over half a day and has not said why. A paired deck holding a working copy of this account will replace it on its own. To do it by hand, sign in as this account from + Add.",fix:null,tone:"quiet",blocksSwitch:!1};const r=e.collector==="no_credentials"||e.collector==="relogin_required";return{text:Zl(n.text),hint:n.hint,fix:n.fix?Zl(n.fix):null,tone:r||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:r}}if(e.error){const n=lB(e.error);return{text:Zl(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function Rp(){return i.jsxs("svg",{className:"ap-warn-glyph",width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),i.jsx("path",{d:"M7 5.6v2.9"}),i.jsx("path",{d:"M7 10.3v.05"})]})}function uB(e){return e>=90?"hi":e>=70?"mid":void 0}function dB(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!Tp.includes(t)?[...Tp,t]:Tp].sort((r,a)=>r-a)}function hB({lane:e,nowSec:t,frozen:n}){const r=Math.min(100,Math.max(0,e.pct)),a=n?"var(--muted)":r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",l=e.resetAt&&!n?qA(e.resetAt,t):null;return i.jsxs("div",{className:"ap-lane",children:[i.jsx("span",{className:"ap-lane-label",title:e.label,children:e.label}),i.jsx("div",{className:"ap-lane-track",children:i.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:a,opacity:r===0||n?.4:1}})}),i.jsxs("span",{className:"ap-lane-pct",style:{color:a},children:[r,"%"]}),i.jsx("span",{className:"ap-lane-reset",title:l?`${e.label} resets in ${l}`:void 0,children:l&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"vis-hidden",children:"resets in "}),l]})})]})}async function B_(e){var n;let t=!1;try{t=await Promise.race([((n=navigator.clipboard)==null?void 0:n.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(r=>window.setTimeout(()=>r(!1),500))])}catch{t=!1}if(t)return!0;try{const r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(r),r.select(),t=document.execCommand("copy"),r.remove()}catch{t=!1}return t}function fB({onClose:e,leaving:t}){var qs,Fs,fs;const[n,r]=x.useState(null),[a,l]=x.useState(null),[c,u]=x.useState(null),[f,p]=x.useState(!1),[h,m]=x.useState(null),[y,w]=x.useState(null),[N,k]=x.useState("accounts"),[S,b]=x.useState(!1),[j,E]=x.useState(null),C=x.useRef(j);C.current=j;const[T,R]=x.useState(()=>Math.floor(Date.now()/1e3)),$=x.useRef(null),[D,U]=x.useState(null),P=(D==null?void 0:D.num)??null,V=x.useRef(D);V.current=D;const[J,ee]=x.useState(null),[M,Z]=x.useState(!1),[G,I]=x.useState(""),[q,H]=x.useState(null),W=x.useRef(0),[L,K]=x.useState(null),[de,O]=x.useState(!1),[Y,B]=x.useState(!1),[te,le]=x.useState(null),[pe,ye]=x.useState(null),[Ie,Te]=x.useState(null),[Re,Me]=x.useState(!1),xe=x.useRef(null),He=x.useRef(null),[Ne,_e]=x.useState([]),[Ze,ct]=x.useState(!1),Ke=x.useRef(null),ce=x.useCallback(Q=>_h(Ke.current)?(Ke.current=Q,u(Q),!0):!1,[]),je=x.useCallback(()=>{Ke.current=null,u(null)},[]),$e=(Q,Ce=!1)=>{const Ue=Na(c,Q);return{disabled:Ue.disabled,"aria-busy":Ue.busy||Ce}},Je=x.useCallback(Q=>{window.requestAnimationFrame(()=>{var Ce;if(g_(((Ce=document.activeElement)==null?void 0:Ce.tagName)??null))for(const Ue of hq(Q)){const Le=document.querySelector(Ue);if(Le){Le.focus();return}}})},[]),qe=x.useCallback(async(Q=!1)=>{Q&&p(!0);const Ce=new AbortController,Ue=window.setTimeout(()=>Ce.abort(),aB);try{const[Le,Pe]=await Promise.all([fetch(`/api/claude-accounts${Q?"?refresh=1":""}`,{signal:Ce.signal}),fetch("/api/cswap-auto",{signal:Ce.signal})]);if(Le.ok){const Ct=await Le.json();r(Ct),_e($t=>Z8($t,Ct.accounts))}Pe.ok&&l(await Pe.json());const ft=nB([await D_(Le),await D_(Pe)]);m(Ct=>q_(Ct,ft))}catch{m(Le=>q_(Le,Ce.signal.aborted?tB:eB))}finally{window.clearTimeout(Ue),Q&&p(!1)}},[]),pt=x.useCallback(async(Q,Ce,Ue="panel")=>{if(!ce(Ce))return null;const Le=Ue==="menu"?ee:m;Le(null);try{const Pe=await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Q)}),ft=await Pe.json().catch(()=>null);return ft!=null&&ft.ok||Le({text:Ex(ft,"command failed",Pe.status),raw:fc(ft)}),ft}catch{return Le({text:"server unreachable"}),null}finally{je()}},[ce,je]),ge=x.useCallback(async(Q,Ce)=>{if(!ce(Ce))return null;m(null),ee(null);try{const Ue=await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Q)}),Le=await Ue.json().catch(()=>null);return Le!=null&&Le.ok||ee({text:Ti(Le,"command failed",Ue.status)}),Le}catch{return ee({text:"server unreachable"}),null}finally{je()}},[ce,je]);x.useEffect(()=>(qe(!0),$.current=window.setInterval(()=>qe(!1),F_),()=>{$.current!=null&&window.clearInterval($.current)}),[qe]),x.useEffect(()=>{const Q=window.setInterval(()=>R(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(Q)},[]);const be=((qs=a==null?void 0:a.settings["autoswitch.threshold"])==null?void 0:qs.value)??"90",Ve=Ie??be,nt=G8(Ve,be),at=(Fs=n==null?void 0:n.accounts)==null?void 0:Fs.find(Q=>Q.active),he=at?yd(at,T):null,rt=(n==null?void 0:n.accounts)??[],ot=at?rt.filter(Q=>!Q.active):[],jt=ot.length?rt.filter(Q=>Q.active):rt,xt=ot.map(Q=>{const Ce=yd(Q,T);return{key:th(Q),name:Q.alias??Q.email??`account ${Q.num}`,ready:!Q.disabled&&!(Ce!=null&&Ce.blocksSwitch),why:Q.disabled?"held out":Ce!=null&&Ce.blocksSwitch?Ce.text:null,warn:(Ce==null?void 0:Ce.tone)==="warn",headroom:Q.headroom}}),wt=Number(be),kn=(at==null?void 0:at.headroom)!=null&&Number.isFinite(wt)&&100-at.headroom>=wt,Zt=(a==null?void 0:a.ok)===!0&&(a.enabled||a.external),me=Q=>Ze&&ot.some(Ce=>Ce.num===Q)?"ap-rest-list":"ap-scroll",it=async(Q,Ce)=>{if(ce(`switch-${Q}`)){m(null),w(null);try{const Le=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:Q})})).json().catch(()=>null);Le!=null&&Le.ok?w({num:Q,name:Ce}):m({text:Ex(Le,"the switch failed"),raw:fc(Le),row:Q}),await qe(!0)}catch{m({text:"server unreachable",row:Q})}finally{je(),Je(Q)}}},ht=x.useCallback(()=>{U(null),ee(null),H(null),K(null),B(!1)},[]),Qe=(Q,Ce="first")=>{ht(),E(null),ye(null),U({num:Q,view:"menu",start:Ce})},sn=(Q,Ce)=>{ht(),E(Ue=>(Ue==null?void 0:Ue.anchor)===Ce?null:{num:Q,anchor:Ce})},an=x.useCallback((Q=!1)=>{var Ue;const Ce=C.current;Q&&Ce&&((Ue=document.getElementById(Ce.anchor))==null||Ue.focus()),E(null)},[]),Dt=()=>{ht(),E(null),k("lan")},pn=x.useRef(N);x.useEffect(()=>{pn.current!==N&&(pn.current=N,window.requestAnimationFrame(()=>{var Q;(Q=document.getElementById(N==="lan"?"ap-lan-back":"ap-lan-entry"))==null||Q.focus()}))},[N]),x.useEffect(()=>{n!=null&&n.ok&&b(!0)},[n==null?void 0:n.ok]);const Qt=x.useCallback(Q=>{var Le,Pe;const Ce=V.current;if(!Ce||Q!=null&&Ce.num!==Q)return;const Ue=document.getElementById(`ap-menu-${Ce.num}`);(Ue!=null&&Ue.contains(document.activeElement)||g_(((Le=document.activeElement)==null?void 0:Le.tagName)??null))&&((Pe=document.getElementById(`ap-more-${Ce.num}`))==null||Pe.focus()),ht()},[ht]);x.useEffect(()=>{t&&(ht(),E(null))},[t,ht]),x.useEffect(()=>{D&&(n!=null&&n.accounts)&&!n.accounts.some(Q=>Q.num===D.num)&&ht(),j&&(n!=null&&n.accounts)&&!n.accounts.some(Q=>Q.num===j.num)&&E(null)},[n,D,j,ht]);const mn=async Q=>{var Ue;B(!1);const Ce=await ge({action:"share",account:Q},`share-${Q}`);!(Ce!=null&&Ce.ok)||((Ue=V.current)==null?void 0:Ue.num)!==Q||(K({num:Q,blob:Ce.blob,expiresAt:Ce.expiresAt}),U({num:Q,view:"share"}))},nr=async(Q,Ce)=>{const{commit:Ue,alias:Le}=J8(G,Ce);if(Ue){const Pe=await ge({action:"alias",account:Q,alias:Le},`alias-${Q}`);if(await qe(!0),!(Pe!=null&&Pe.ok))return}Qt(Q)},Tn=async(Q,Ce)=>{var Pe,ft;const Ue=await ge({action:"move",account:Q,slot:Ce},`move-${Q}`),Le=U8({menuFor:((Pe=V.current)==null?void 0:Pe.num)??null,shareFor:(L==null?void 0:L.num)??null},Q,Ue);if(await qe(!0),Le){((ft=V.current)==null?void 0:ft.num)===Q&&ht(),H(Le.confirmRemove),Le.shareFor==null&&(K(null),B(!1)),le(Le.swapNote);const Ct=Le.swapNote;Ct&&window.setTimeout(()=>le($t=>$t===Ct?null:$t),rB),ye(null),Je(Le.menuFor)}return Ue},_n=async(Q,Ce,Ue)=>{if(!Ue.sends){Qt(Q);return}await Tn(Q,Ce)},vr=async(Q,Ce)=>{if(Ce.sends){const Ue=await pt({action:"setting",key:"autoswitch.threshold",value:Q},"threshold");if(await qe(!0),!(Ue!=null&&Ue.ok))return;Te(null)}Me(!0),window.setTimeout(()=>{var Ue;document.activeElement===He.current&&((Ue=xe.current)==null||Ue.focus()),Me(!1)},sB)},An=i.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})}),Rn=Q=>{const{shown:Ce,fuller:Ue}=K8(Q.lanes),Le=yd(Q,T),Pe=Q.active||Ne.includes(th(Q)),ft=Q.alias??Q.email??`account ${Q.num}`,Ct=Q.stale||(Le==null?void 0:Le.blocksSwitch)===!0,$t=Ue?[...Ce,Ue]:Ce,Wr=Q.fetchedAt?Ap(Q.fetchedAt,T):null;return i.jsxs("li",{className:`ap-account${Q.active?" active":""}`,"aria-current":Q.active?"true":void 0,"data-open":Pe?"":void 0,"data-frozen":Ct?"":void 0,children:[!Q.active&&i.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${Q.num}`,"aria-expanded":Pe,"aria-controls":Pe?`ap-detail-${Q.num}`:void 0,"aria-describedby":!Pe&&!(Le!=null&&Le.blocksSwitch)?`ap-quota-${Q.num}`:void 0,onClick:()=>_e(bt=>X8(bt,Q)),children:i.jsxs("span",{className:"vis-hidden",children:[ft,", ",Pe?"hide details":"details"]})}),i.jsxs("div",{className:"ap-account-head",children:[Q.active?i.jsx("span",{className:"ap-live",title:`Active account · slot ${Q.num}`,children:i.jsxs("span",{className:"vis-hidden",children:["Active account, slot ",Q.num,":"]})}):i.jsx("span",{className:"ap-num",children:Q.num}),Q.alias&&i.jsx("span",{className:"ap-alias",title:Q.alias,children:Q.alias}),i.jsx("span",{className:"ap-email",title:Q.email??void 0,children:Q.email}),Q.disabled&&i.jsx("span",{className:"ap-held",children:"held out"}),!Q.active&&!Q.disabled&&!(Le!=null&&Le.blocksSwitch)&&i.jsx("button",{type:"button",className:"ap-switch",...$e(`switch-${Q.num}`),onClick:()=>it(Q.num,ft),"aria-label":`Switch to ${ft}`,title:`Switch to ${Q.alias??Q.email}`,children:c===`switch-${Q.num}`?"…":"Switch"}),i.jsx("button",{type:"button",id:`ap-more-${Q.num}`,className:"ap-more","aria-label":`More actions for ${Q.email??Q.alias??`account ${Q.num}`}`,"aria-haspopup":"menu","aria-expanded":P===Q.num,"aria-controls":P===Q.num?`ap-menu-${Q.num}`:void 0,title:"More actions",onClick:()=>P===Q.num?Qt():Qe(Q.num),onKeyDown:bt=>{bt.key!=="ArrowDown"&&bt.key!=="ArrowUp"||(bt.preventDefault(),Qe(Q.num,bt.key==="ArrowUp"?"last":"first"))},children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:[i.jsx("circle",{cx:"2.8",cy:"7",r:"1.15"}),i.jsx("circle",{cx:"7",cy:"7",r:"1.15"}),i.jsx("circle",{cx:"11.2",cy:"7",r:"1.15"})]})})]}),(h==null?void 0:h.row)===Q.num&&i.jsxs("div",{className:"ap-failure ap-row-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),Q.active&&(y==null?void 0:y.num)===Q.num&&i.jsx("p",{className:"ap-switched",children:"Now active. New sessions start on it; ones already running pick it up on their next message, up to about 30 seconds later on macOS."}),(te==null?void 0:te.at)===Q.num&&(()=>{const bt=rt.find(Bs=>Bs.num===te.displaced),kt=(bt==null?void 0:bt.alias)??(bt==null?void 0:bt.email)??"the account that was there";return i.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${te.at} was taken, so the two accounts traded places: ${kt} now holds slot ${te.displaced}.`,children:["swapped with slot ",te.displaced]})})(),Le&&i.jsxs("div",{className:"ap-issue-line",children:[i.jsxs("button",{type:"button",id:`ap-issue-${Q.num}`,className:"ap-issue","data-tone":Le.tone,"aria-haspopup":"dialog","aria-expanded":(j==null?void 0:j.anchor)===`ap-issue-${Q.num}`,"aria-controls":(j==null?void 0:j.anchor)===`ap-issue-${Q.num}`?"ap-issue-pop":void 0,onClick:()=>sn(Q.num,`ap-issue-${Q.num}`),children:[Le.tone==="warn"&&i.jsx(Rp,{}),i.jsx("span",{className:"ap-issue-text",children:Le.text})]}),!Pe&&i.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:Wr??"never collected"})]}),!Pe&&!(Le!=null&&Le.blocksSwitch)&&i.jsxs("p",{className:"ap-quota",id:`ap-quota-${Q.num}`,children:[$t.length?$t.map(bt=>i.jsxs("span",{className:"ap-q",children:[i.jsx("span",{className:"ap-q-label",children:bt.label})," ",i.jsxs("span",{className:"ap-q-pct","data-level":Ct?void 0:uB(bt.pct),children:[Math.round(bt.pct),"%"]})]},bt.id)):i.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),Q.stale&&!Le&&i.jsx("span",{className:"ap-q-age","data-never":Wr?void 0:"",title:"When claude-swap last read this account's usage",children:Wr??"never collected"})]}),Pe&&i.jsxs("div",{className:"ap-detail",id:`ap-detail-${Q.num}`,children:[i.jsx("div",{className:"ap-lanes",children:Q.lanes.length?Q.lanes.map(bt=>i.jsx(hB,{lane:bt,nowSec:T,frozen:Ct},bt.id)):i.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),i.jsx("div",{className:"ap-meta",children:Q.fetchedAt?i.jsxs("span",{className:`ap-age${Q.stale&&!Le?" ap-stale":""}`,title:"When claude-swap last read this account's usage, and when it plans to read it again. It sets that interval itself — 3 minutes at the fastest, wider while an account is recovering from a rate limit — and every surface, including `cswap watch`, follows the same plan.",children:["collected ",Ap(Q.fetchedAt,T),Le!=null&&Le.blocksSwitch?"":oB(Q.nextAt,T)]}):i.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]},Q.num)},Mn=n!=null&&n.ok&&(a!=null&&a.ok)?i.jsxs("div",{className:"ap-policy-block",children:[i.jsxs("div",{className:"ap-policy",children:[i.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),i.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:i.jsx("select",{ref:xe,"aria-label":"Switch threshold",value:Ve,...$e("threshold"),onChange:Q=>Te(Q.target.value),children:dB(be).map(Q=>i.jsxs("option",{value:Q,children:[Q,"%"]},Q))})}),(nt.sends||Re)&&i.jsx("button",{ref:He,type:"button",className:"ap-manage-btn",...$e("threshold"),title:nt.title,onClick:()=>vr(Ve,nt),children:Re&&!nt.sends?nt.done:nt.label}),i.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":a.enabled,"aria-label":"Auto-switch",...$e("enable"),onClick:()=>pt({action:"enable",enabled:!a.enabled},"enable").then(()=>qe(!0)),title:a.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:i.jsx("span",{className:"switch-knob"})})]}),a.external&&i.jsxs("p",{className:"ap-auto-note",children:[i.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",i.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",a.enabled?" — this toggle takes over when you stop it.":"."]})]}):null;return i.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",children:[N==="accounts"&&i.jsxs("div",{className:"ap-header",children:[i.jsx("h2",{children:"Claude accounts"}),i.jsxs("div",{className:"ap-header-right",children:[i.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>Z(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((fs=n==null?void 0:n.accounts)==null?void 0:fs.length)??0)>0&&i.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>O(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Yt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),i.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),i.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>qe(!0),...$e("reload",f),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),i.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),An]})]}),N==="accounts"&&i.jsx("div",{className:"ap-scroll",id:"ap-scroll",children:n==null?h?i.jsxs("div",{className:"ap-empty",role:"alert",children:[i.jsx("span",{title:h.raw||void 0,children:h.text}),i.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",F_/1e3," seconds."]}),i.jsx("button",{type:"button",className:"ap-fix",disabled:f,onClick:()=>qe(!0),children:f?"trying…":"try again"})]}):i.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?i.jsxs(i.Fragment,{children:[at&&(he==null?void 0:he.tone)==="warn"&&i.jsxs("div",{className:"ap-notice",children:[i.jsxs("button",{type:"button",id:"ap-notice",className:"ap-issue","data-tone":"warn","aria-haspopup":"dialog","aria-expanded":(j==null?void 0:j.anchor)==="ap-notice","aria-controls":(j==null?void 0:j.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>sn(at.num,"ap-notice"),children:[i.jsx(Rp,{}),i.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),he.fix&&i.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>Z(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"Sign in"})]}),i.jsx("ul",{className:"ap-list",children:jt.map(Rn)}),ot.length>0&&i.jsx(q8,{peers:xt,strained:kn,armed:Zt,threshold:a!=null&&a.ok?be:null,open:Ze,onToggle:()=>ct(Q=>!Q)}),ot.length>0&&Ze&&i.jsxs("div",{className:"ap-rest-panel",id:"ap-rest-panel",children:[i.jsx("ul",{className:"ap-list ap-others",id:"ap-rest-list",children:ot.map(Rn)}),Mn]}),ot.length===0&&Mn,h&&h.row==null&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),D&&(()=>{var Le;const Q=(Le=n.accounts)==null?void 0:Le.find(Pe=>Pe.num===D.num);if(!Q)return null;const Ce=`ap-pop-title-${Q.num}`,Ue=J&&i.jsx("p",{className:"ap-pop-error",role:"alert",title:J.raw||void 0,children:J.text});return i.jsxs(j_,{anchorId:`ap-more-${Q.num}`,boundaryId:me(Q.num),id:`ap-menu-${Q.num}`,className:"ap-pop",role:D.view==="menu"?"menu":"dialog",labelledBy:D.view==="menu"?`ap-more-${Q.num}`:Ce,start:D.start,onClose:ht,children:[D.view==="menu"&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{I(Q.alias??""),ee(null),U({num:Q.num,view:"rename"})},children:"Rename"}),i.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{ye(null),ee(null),U({num:Q.num,view:"move"})},children:"Move to slot…"}),i.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...$e(`share-${Q.num}`),title:`Copy this account to another ${Yt}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:()=>mn(Q.num),children:c===`share-${Q.num}`?"Sharing…":"Share"}),(((a==null?void 0:a.enabled)||(a==null?void 0:a.external))&&!Q.active||Q.disabled)&&i.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...$e(`rot-${Q.num}`),title:Q.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",onClick:()=>pt({action:"account",account:Q.num,enabled:Q.disabled},`rot-${Q.num}`,"menu").then(Pe=>{qe(!0),Pe!=null&&Pe.ok&&Qt(Q.num)}),children:Q.disabled?"Put back in rotation":"Hold out of rotation"}),i.jsx("div",{role:"separator",className:"ap-menu-sep"}),i.jsx("button",{type:"button",role:"menuitem",className:`ap-menu-item danger${q===Q.num?" armed":""}`,...$e(`rm-${Q.num}`),"aria-label":q===Q.num?"Confirm remove":void 0,title:q===Q.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(q!==Q.num){H(Q.num),W.current=Date.now(),window.setTimeout(()=>H(Pe=>Pe===Q.num?null:Pe),4e3);return}Date.now()-W.current<Jd||(H(null),ge({action:"remove",account:Q.num},`rm-${Q.num}`).then(Pe=>{var ft;qe(!0),Pe!=null&&Pe.ok&&(((ft=V.current)==null?void 0:ft.num)===Q.num&&ht(),Je(null))}))},children:c===`rm-${Q.num}`?"Removing…":q===Q.num?"Confirm":"Remove"}),Ue]}),D.view==="rename"&&i.jsxs("form",{className:"ap-pop-form",onSubmit:Pe=>{Pe.preventDefault(),nr(Q.num,Q.alias)},children:[i.jsx("label",{className:"ap-pop-title",id:Ce,htmlFor:`ap-alias-${Q.num}`,children:"Rename account"}),i.jsx("input",{id:`ap-alias-${Q.num}`,className:"ap-manage-input",type:"text",value:G,onChange:Pe=>I(Pe.target.value),maxLength:Q8,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:Pe=>Pe.currentTarget.select()}),Ue,i.jsxs("div",{className:"ap-pop-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>Qt(),children:"Cancel"}),i.jsx("button",{type:"submit",className:"btn primary",...$e(`alias-${Q.num}`),title:"A short name to show instead of the email",children:c===`alias-${Q.num}`?"…":"Save"})]})]}),D.view==="move"&&(()=>{const Pe=H8((n.accounts??[]).map($t=>$t.num),Q.num),ft=W8(Pe,pe,Q.num),Ct=V8(Pe,ft,Q.num);return i.jsxs("div",{className:"ap-pop-form",children:[i.jsx("label",{className:"ap-pop-title",id:Ce,htmlFor:`ap-slot-${Q.num}`,children:"Move to slot"}),i.jsx("span",{className:"ap-field",children:i.jsx("select",{id:`ap-slot-${Q.num}`,value:String(ft),...$e(`move-${Q.num}`),onChange:$t=>ye(Number($t.target.value)),autoFocus:!0,children:Pe.map($t=>i.jsx("option",{value:$t.slot,children:$t.label},$t.slot))})}),Ue,i.jsxs("div",{className:"ap-pop-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>Qt(),children:"Cancel"}),i.jsx("button",{type:"button",className:"btn primary",...$e(`move-${Q.num}`),title:Ct.title,onClick:()=>_n(Q.num,ft,Ct),children:c===`move-${Q.num}`?"…":Zl(Ct.label)})]})]})})(),D.view==="share"&&(L==null?void 0:L.num)===Q.num&&(()=>{const Pe=iR(L.expiresAt,T),ft=Pe.tone==="gone";return i.jsxs("div",{className:`ap-pop-form ap-share${ft?" expired":""}`,children:[i.jsx("p",{className:"ap-pop-title",id:Ce,children:"Share account"}),i.jsx("code",{className:"ap-share-blob",children:L.blob}),i.jsxs("p",{className:"ap-pop-note",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[i.jsx("span",{className:"ap-share-warn",children:"This is the password"})," · ",i.jsx("span",{className:`ap-share-expiry ${Pe.tone}`,children:Pe.text})]}),Ue,i.jsxs("div",{className:"ap-pop-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>Qt(),children:"Done"}),i.jsx("button",{type:"button",className:"btn primary",...$e(`share-${Q.num}`),autoFocus:!0,onClick:async()=>{if(ft){await mn(Q.num);return}await B_(L.blob)&&(B(!0),window.setTimeout(()=>B(!1),1800))},children:ft?"Make a new share":Y?"Copied":"Copy"})]})]})})()]})})(),j&&(()=>{var Ue;const Q=(Ue=n.accounts)==null?void 0:Ue.find(Le=>Le.num===j.num),Ce=Q?yd(Q,T):null;return!Q||!Ce?null:i.jsx(j_,{anchorId:j.anchor,boundaryId:j.anchor==="ap-notice"?"ap-scroll":me(Q.num),id:"ap-issue-pop",className:"ap-pop ap-issue-pop",role:"dialog",labelledBy:"ap-issue-title",onClose:()=>an(),children:i.jsxs("div",{className:"ap-pop-form",children:[i.jsxs("p",{className:"ap-pop-title ap-issue-title",id:"ap-issue-title","data-tone":Ce.tone,children:[Ce.tone==="warn"&&i.jsx(Rp,{}),Ce.text]}),i.jsx("p",{className:"ap-pop-note ap-issue-hint",children:Ce.hint}),i.jsxs("p",{className:"ap-pop-note ap-issue-when",children:[i.jsx("span",{className:"ap-issue-who",children:Q.alias??Q.email??`account ${Q.num}`})," · ",Q.fetchedAt?`last collected ${Ap(Q.fetchedAt,T)}`:"never collected"]}),i.jsxs("div",{className:"ap-pop-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>an(!0),children:"Done"}),Ce.fix&&i.jsx("button",{type:"button",className:"btn primary",onClick:()=>{an(!0),Z(!0)},title:"Open the sign-in dialog. Signing in as this account puts its login back in this slot — it keeps its slot, its alias and its history.",children:Ce.fix})]})]})})})()]}):i.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"claude-swap isn't installed."}),i.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&i.jsx("code",{className:"ap-cmd",children:n.hint}),i.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",i.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"No accounts added yet."}),i.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",i.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"Couldn't read the account store."}),i.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})})}),i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:y?`Now active: ${y.name}`:""}),S&&i.jsx(P8,{accounts:((n==null?void 0:n.accounts)??[]).map(Q=>({key:`${String(Q.email??"").trim().toLowerCase()}@@${Q.orgUuid??""}`,email:Q.email??"",alive:Q.alive===!0})),onChanged:()=>qe(!0),view:N==="lan",onOpen:Dt,onBack:()=>k("accounts"),closeButton:An}),M&&i.jsx(OF,{onClose:()=>Z(!1),onChanged:()=>qe(!0)}),de&&i.jsx(z8,{accounts:((n==null?void 0:n.accounts)??[]).map(Q=>({num:Q.num,email:Q.email,alias:Q.alias,org:Q.org})),onClose:()=>O(!1),copyText:B_})]})}const pB=3e4;function mB({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function gB({bundle:e,running:t,pending:n,lastTried:r}){return t?mB({bundle:e,running:t,lastTried:r})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function yB(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function wB({asked:e,reported:t}){return t?t!==e:!1}function wR(e){const t=e.thresholdMs??pB;return!e.enabled||e.kind!=="restart"||!e.canRestart||!e.noticeOpen||!e.visible||e.busy?null:e.idleSince==null||e.now<e.idleSince?t:Math.max(0,t-(e.now-e.idleSince))}function vB(e){const t=Math.max(0,Math.ceil(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function xB(e,t){return e?t==null?"auto when idle":`auto in ${vB(t)}`:"auto-restart off"}function z_(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function bB(e){return e<=0?{label:"Restart now",clause:"nothing is running"}:{label:"Restart anyway",clause:`${e===1?"1 agent is running":`${e} agents are running`} — their events during the restart are lost`}}function kB(e){const t=wR(e);return t==null?{idleSince:null,restart:!1,remainingMs:null}:e.idleSince==null||e.now<e.idleSince?{idleSince:e.now,restart:!1,remainingMs:t}:{idleSince:e.idleSince,restart:t===0,remainingMs:t}}function _B(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function NB(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.decks!="number"||typeof t.mine!="boolean")return null;const n=t.owner&&typeof t.owner=="object"?t.owner.port:null;return{path:typeof t.path=="string"&&t.path!==""?t.path:null,decks:t.decks,mine:t.mine,ownerPort:typeof n=="number"?n:null}}function SB(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function jB(e,t){const n=SB(e),r=(...c)=>[n?`${n} on the canvas`:null,...c,"layout, pins and selection"].filter(u=>u!==null),a="This cannot be undone.";if(!t)return{goes:r("the event log on disk — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise"),stays:[],final:a,confirm:"Clear everything"};if(!t.path)return{goes:r(),stays:[],final:`This deck keeps no event log, so nothing on disk changes — and nothing can bring the canvas back. ${a}`,confirm:"Clear everything"};if(!t.mine){const c=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,u=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{goes:r(),stays:[`the event log — ${c}${u}`,"restart this deck and the log replays back onto it"],final:null,confirm:"Clear this canvas"}}if(t.decks<=1)return{goes:r("this deck's event log — the file a restarted deck replays to rebuild what you see"),stays:[],final:a,confirm:"Clear everything"};const l=t.decks-1;return{goes:r(`the event log ${l===1?"1 other running deck shares":`${l} other running decks share`} with this one — every session recorded in it, not just the ones drawn here`),stays:[l===1?"what that deck shows, until it restarts — then it is gone there too":"what those decks show, until they restart — then it is gone there too"],final:a,confirm:"Clear everything"}}function EB({agentCount:e,onConfirm:t,onCancel:n}){const r=x.useRef(null),a=rn(n,{focusRef:r,layer:W5}),[l,c]=x.useState(null);x.useEffect(()=>{let m=!1;return fetch("/api/clear").then(y=>y.ok?y.json():null).then(y=>{m||c(NB(y))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:f,final:p,confirm:h}=jB(e,l);return i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:"status-dot err","aria-hidden":!0}),i.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsxs("dl",{className:"cc-plan",children:[i.jsx("dt",{children:"Goes"}),i.jsx("dd",{children:u.map(m=>i.jsx("span",{children:m},m))}),i.jsx("dt",{children:"Stays"}),i.jsx("dd",{children:f.length>0?f.map(m=>i.jsx("span",{children:m},m)):i.jsx("span",{children:"nothing"})})]}),p&&i.jsx("p",{className:"cc-final",children:p}),i.jsxs("div",{className:"cc-actions",children:[i.jsx("button",{type:"button",ref:r,className:"btn",onClick:n,children:"Cancel"}),i.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const CB="Press Esc first if a key does nothing.",TB=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"W",action:"the session waiting on you — oldest first, again for the next",binds:["w","W"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"D",action:"detail panel",binds:["d","D"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"S",action:"this machine — cores, memory, temperature",binds:["s","S"]},{cap:"B",action:"Browser Watch",binds:["b","B"]},{cap:"V",action:"the sound menu — volume, tones, notifications",binds:["v","V"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function AB({onClose:e,onTour:t}){const n=rn(e);return i.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal key-help",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[t&&i.jsxs("div",{className:"guide-door",children:[i.jsx("span",{children:"Eight pictures of what the deck shows."}),i.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),i.jsx("div",{className:"shortcuts",children:TB.map(r=>i.jsxs(x.Fragment,{children:[i.jsx("h3",{className:"kh-group",children:r.title}),r.rows.map(a=>i.jsxs("div",{className:"sc",children:[i.jsx("kbd",{children:a.cap}),i.jsx("span",{children:a.action})]},`${r.title}:${a.cap}:${a.action}`))]},r.title))}),i.jsx("p",{className:"kh-foot",children:CB})]})]})})}const RB=["done","needs-input"],MB=[{id:"two",label:"Two notes",notes:[{at:0,hz:740,ms:90},{at:.085,hz:440,ms:150}]},{id:"arc",label:"Descent",notes:[{at:0,hz:988,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:440,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:740,ms:55},{at:.055,hz:740,ms:55},{at:.165,hz:440,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:988,ms:110},{at:0,hz:740,ms:110},{at:.1,hz:440,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:740,ms:120},{at:.11,hz:440,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:740,ms:55},{at:.06,hz:440,ms:90}]}],IB=[{id:"two",label:"Two notes",notes:[{at:0,hz:440,ms:90},{at:.085,hz:740,ms:150}]},{id:"arc",label:"Ascent",notes:[{at:0,hz:440,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:988,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:440,ms:55},{at:.055,hz:440,ms:55},{at:.165,hz:740,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:440,ms:110},{at:.1,hz:740,ms:170},{at:.1,hz:988,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:440,ms:120},{at:.11,hz:740,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:440,ms:55},{at:.06,hz:740,ms:90}]}],v0={done:MB,"needs-input":IB},zi="two";function nh(e,t){const n=v0[e];return n.find(r=>r.id===t)??n.find(r=>r.id===zi)??n[0]}function vR(e,t){return v0[e].some(r=>r.id===t)?t:zi}nh("done",zi).notes,nh("needs-input",zi).notes;const H_=.04,$B=.24,$d=0,rh=100,Rx=5,pc=50;function mc(e){if(!Number.isFinite(e))return pc;const t=Math.round(e/Rx)*Rx;return Math.min(rh,Math.max($d,t))}function OB(e){if(e==null)return pc;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?mc(Number(t)):pc}function LB(e){const t=mc(e),n=H_+($B-H_)*(t/rh);return Math.round(n*1e4)/1e4}function PB(e,t){const n=t.trim,r=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(LB(e)*r*1e4)/1e4}const DB=160,qB="agent-dag.soundLevel.done",FB="agent-dag.soundLevel.needs-input",BB="agent-dag.soundFigure.done",zB="agent-dag.soundFigure.needs-input",xR={done:qB,"needs-input":FB},bR={done:BB,"needs-input":zB},Mx={done:{level:pc,figure:zi},"needs-input":{level:pc,figure:zi}};function HB(e){const t=n=>({level:OB(e(xR[n])),figure:vR(n,e(bR[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const U_={Stop:"done",Notification:"needs-input"};function UB(e,t){var r;if(t)return null;const n=(r=e==null?void 0:e.payload)==null?void 0:r.hook_event_name;return typeof n!="string"?null:Object.hasOwn(U_,n)?U_[n]:null}function WB(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,r=!1;const a=()=>e.enabled()?r&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",l=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,a())};function c(){var f;if(!(!t||r))try{n=n??new t,(f=n.resume)==null||f.call(n).then(l,()=>{}),r=!0,l()}catch{}}function u(f,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((N=e.prefs)==null?void 0:N.call(e))??Mx)[f]??Mx[f],m=nh(f,h.figure),y=PB(h.level,m),w=n.currentTime;for(const k of m.notes){const S=n.createOscillator(),b=n.createGain();S.type=m.type??"sine",S.frequency.value=k.hz;const j=w+k.at,E=j+k.ms/1e3;b.gain.setValueAtTime(1e-4,j),b.gain.exponentialRampToValueAtTime(y,j+.012),b.gain.exponentialRampToValueAtTime(1e-4,E),S.connect(b).connect(n.destination),S.start(j),S.stop(E+.02)}return!0}return{unlock:c,play:u,state:a,get context(){return n}}}const VB="Notify me when a session needs my attention.",GB="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",W_="Get notified when you're away from this tab.";function KB(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:W_};case"default":return{status:null,ask:!0,ok:!1,note:W_};case"denied":return{status:"Blocked",ask:!1,ok:!1,note:"Your browser is blocking them; only its own site settings can undo that. You'll still be told once this tab is closed."};default:return{status:"Unavailable",ask:!1,ok:!1,note:"This browser cannot show them. You'll still be told once this tab is closed."}}}const V_={done:"Turn finished","needs-input":"Claude is asking"},YB={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function XB({onClose:e,soundOn:t,onToggleSound:n,prefs:r,onLevel:a,onFigure:l,onPreview:c,openerRef:u,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:m,onAskNotify:y}){const w=KB(m),N=f&&!h,k=rn(e),S=x.useRef(e);return S.current=e,x.useEffect(()=>{const b=j=>{var C,T;const E=j.target;E&&((C=k.current)!=null&&C.contains(E)||(T=u.current)!=null&&T.contains(E)||S.current())};return window.addEventListener("pointerdown",b,!0),()=>window.removeEventListener("pointerdown",b,!0)},[k,u]),i.jsxs("div",{ref:k,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[i.jsxs("div",{className:"sm-switches",children:[i.jsxs("label",{className:"sm-switch",children:[i.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),i.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"switch",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:i.jsx("span",{className:"switch-knob"})})]}),i.jsxs("div",{className:"sm-setting",children:[i.jsxs("label",{className:"sm-switch",children:[i.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),i.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"switch",onClick:p,title:"A system notification when a session blocks on you",children:i.jsx("span",{className:"switch-knob"})})]}),i.jsx("p",{className:"sm-note",children:h?GB:VB})]})]}),N&&i.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[i.jsxs("div",{className:"sm-channel-head",children:[i.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?i.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):i.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&i.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),i.jsx("p",{className:"sm-note",children:w.note})]}),!t&&i.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:"Plays even when Sounds is off, so you can set a tone before turning sounds back on."}),i.jsx("div",{className:"sm-tones",children:RB.map(b=>{const j=r[b],E=`sm-level-${b}`,C=`sm-figure-${b}`;return i.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${b}`,children:[i.jsxs("div",{className:"sm-tone-head",children:[i.jsx("h3",{className:"sm-tone-name",id:`sm-name-${b}`,children:V_[b]}),i.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(b),"aria-label":`Hear the ${V_[b].toLowerCase()} tone`,title:t?"Play this tone now, at what it is set to":"Plays even when Sounds is off","aria-describedby":t?void 0:"sm-preview-note",children:[i.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:i.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),i.jsxs("div",{className:"sm-row",children:[i.jsx("label",{htmlFor:E,children:"Volume"}),i.jsx("input",{id:E,type:"range",min:$d,max:rh,step:Rx,value:j.level,onChange:T=>a(b,Number(T.target.value)),style:{"--sm-level":`${(j.level-$d)/(rh-$d)*100}%`}}),i.jsxs("span",{className:"sm-read",children:[j.level,"%"]})]}),i.jsxs("div",{className:"sm-row",children:[i.jsx("label",{htmlFor:C,children:"Tone"}),i.jsx("select",{id:C,className:"sm-select",value:j.figure,onChange:T=>l(b,T.target.value),children:v0[b].map(T=>i.jsx("option",{value:T.id,children:T.label},T.id))})]}),i.jsx("p",{className:"sm-note",children:YB[b]})]},b)})}),i.jsxs("p",{className:"sm-foot",children:[i.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const Kl=["light","dark"];function ZB({theme:e,onTheme:t,characterEnabled:n,onToggleCharacter:r,onClose:a,openerRef:l}){const c=rn(a),u=x.useRef(a);u.current=a,x.useEffect(()=>{const p=h=>{var y,w;const m=h.target;!m||(y=c.current)!=null&&y.contains(m)||(w=l.current)!=null&&w.contains(m)||u.current()};return window.addEventListener("pointerdown",p,!0),()=>window.removeEventListener("pointerdown",p,!0)},[c,l]);const f=p=>{var y;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(p.key))return;p.preventDefault();const m=(Kl.indexOf(e)+(p.key==="ArrowLeft"||p.key==="ArrowUp"?-1:1)+Kl.length)%Kl.length;t(Kl[m]),(y=p.currentTarget.querySelectorAll('[role="radio"]')[m])==null||y.focus()};return i.jsxs("div",{ref:c,id:"appearance-menu",className:"appearance-menu",role:"dialog","aria-label":"Appearance settings",children:[i.jsxs("section",{"aria-labelledby":"appearance-theme-label",children:[i.jsx("h2",{id:"appearance-theme-label",className:"appearance-label",children:"Theme"}),i.jsx("div",{className:"appearance-choices",role:"radiogroup","aria-labelledby":"appearance-theme-label",onKeyDown:f,children:Kl.map(p=>i.jsx("button",{type:"button",className:"appearance-choice",role:"radio","aria-checked":e===p,onClick:()=>t(p),children:p==="light"?"Light":"Dark"},p))})]}),i.jsx("div",{className:"appearance-divider"}),i.jsxs("label",{className:"appearance-switch",children:[i.jsxs("span",{children:[i.jsx("strong",{children:"Show character"}),i.jsx("small",{children:"Play scenes on the canvas"})]}),i.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":n,"aria-label":"Show character",onClick:r,children:i.jsx("span",{className:"switch-knob"})})]})]})}const Ix="https://www.youtube-nocookie.com";function QB(e,t){const n=new URLSearchParams({channel:e,enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${Ix}/embed/live_stream?${n.toString()}`}function wd(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function JB(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const ez=[1,3],tz=[0,2],nz=[2,5,100,101,150];function rz(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{event:n,info:r}=t;if(n==="onReady")return{kind:"ready"};if(n==="onError"){const a=typeof r=="number"?r:Number(r==null?void 0:r.errorCode);return Number.isFinite(a)?{kind:"error",code:a}:null}if(n==="onStateChange"||n==="infoDelivery"){const a=typeof r=="number"?r:r==null?void 0:r.playerState;return typeof a!="number"||!Number.isFinite(a)?null:ez.includes(a)?{kind:"playing",playing:!0}:tz.includes(a)?{kind:"playing",playing:!1}:null}return null}const sz=100,az=18,oz=260;function iz(e){const t=e.reduce((n,r)=>Math.max(n,r.at*1e3+r.ms),0);return Math.round(t)+oz}const kR=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],G_=18,lz=kR.length,_R=new Set(["a","c","p"]);function Sh(e=kR){const t=[];return e.forEach((n,r)=>{let a=0;for(;a<n.length;){const l=n[a];if(l==="."){a+=1;continue}let c=1;for(;a+c<n.length&&n[a+c]===l;)c+=1;t.push({x:a,y:r,w:c,cell:l}),a+=c}}),t}const vo=148,K_=6e3,cz=16e3,NR=46,xa=34;function uz(e,t,n=vo){let r=-Math.round(t()*n);if(Math.abs(r-e)<xa){const a=e-xa>=-n?-xa:xa;r=Math.max(-n,Math.min(0,Math.round(e+a)))}return{to:r,ms:Math.round(Math.abs(r-e)*NR)}}function dz(e){return Math.round(K_+e()*(cz-K_))}const Y_=[{kind:"stroll",weight:44},{kind:"tidy",weight:17},{kind:"kick",weight:17},{kind:"sit",weight:12},{kind:"watch",weight:16},{kind:"leave",weight:7},{kind:"fish",weight:12},{kind:"skip",weight:10}];function hz(e){const t=Y_.reduce((r,a)=>r+a.weight,0);let n=e()*t;for(const r of Y_)if(n-=r.weight,n<0)return r.kind;return"stroll"}const fz=720,pz=260,mz=620,gz=220,X_=520,SR=1600,Z_=7e3,yz=15e3,Q_=6e3,wz=14e3;function Si(e,t,n=vo){let r=-Math.round(t()*n);if(Math.abs(r-e)<xa){const a=e-xa>=-n?-xa:xa;r=Math.max(-n,Math.min(0,Math.round(e+a)))}return r}const nn=(e,t)=>Math.round(Math.abs(t-e)*NR),vd=0;function vz(e,t){const n=r=>({kind:"litter",at:t,...r});return[{x:t,prop:n({}),act:"walk",ms:nn(e,t)},{x:t,prop:n({}),act:"stoop",ms:fz},{x:vd,prop:n({held:!0}),act:"carry",ms:nn(t,vd)},{x:vd,prop:n({held:!0}),act:"windup",ms:pz},{x:vd,prop:n({held:!0,leaving:!0}),act:"toss",ms:mz}]}function xz(e,t){const n=t>e?1:-1,r=t-n*Math.min(15,Math.abs(t-e)),a=(l={})=>({kind:"ball",at:t,...l});return[{x:r,prop:a(),act:"walk",ms:nn(e,r)},{x:r,prop:a(),act:"windup",ms:gz,facing:n>0?"right":"left"},{x:r,prop:a({leaving:!0}),act:"kick",ms:X_,facing:n>0?"right":"left"},{x:r,prop:a({leaving:!0}),act:"stand",ms:SR-X_}]}const jR=640;function bz(e,t,n){const r=Math.max(-70,Math.min(-20,t)),a={x:r,prop:null,facing:"left"};return[{x:r,prop:null,act:"walk",ms:nn(e,r)},{...a,act:"sit",ms:600},{...a,act:"cast",ms:900},{...a,act:"fish",ms:6e3+Math.round(n()*4e3)},{...a,act:"reel",ms:1200},{...a,act:"stow",ms:500},{...a,act:"stand",ms:400},{x:0,prop:null,act:"walk",ms:nn(r,0)}]}function kz(e,t,n){const r=Math.max(-110,Math.min(-30,t)),a={x:r,prop:null};return[{...a,act:"walk",ms:nn(e,r)},{...a,act:"skip-ready",ms:500},{...a,act:"skip",ms:jR*(6+Math.floor(n()*5))},{...a,act:"skip-rest",ms:600},{...a,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:nn(r,0)}]}function _z(e,t,n){return[{x:t,prop:null,act:"walk",ms:nn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(Q_+n()*(wz-Q_))},{x:t,prop:null,act:"stand",ms:400}]}function Nz(e,t,n){t=Math.max(-110,Math.min(0,t));const r=()=>({kind:"scope",at:t,held:!0});return[{x:t,prop:null,act:"walk",ms:nn(e,t)},{x:t,prop:r(),act:"watch",ms:Math.round(Z_+n()*(yz-Z_))},{x:t,prop:r(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function J_(e,t,n){return e.facing?e.facing:e.act==="watch"||e.act==="scope-pack"?"left":e.x===t?n:e.x>t?"right":"left"}const Sz=1500,jz=e=>Math.round(1e3*Math.sqrt(2*e/Sz)),Ez=115,Cz=e=>Math.round(e/Ez*1e3),Tz=620,Az=200,Rz=760,Mz=600,Iz=240;function $z(e,t,n){const a=-(t.ledgeSpan??vo),l=jz(t.ledgeH),c=Cz(t.ledgeH),u=-Math.round(n()*t.floorSpan),f=-Math.round(n()*t.floorSpan);return[{x:a,act:"walk",prop:null,ms:nn(e,a)},{x:a,act:"peer",prop:null,ms:Tz},{x:a,act:"fall",prop:null,ms:l,place:"floor"},{x:a,act:"land",prop:null,ms:Az,place:"floor"},{x:u,act:"walk",prop:null,ms:nn(a,u),place:"floor"},{x:f,act:"walk",prop:null,ms:nn(u,f),place:"floor"},{x:a,act:"walk",prop:null,ms:nn(f,a),place:"floor"},{x:a,act:"lasso",prop:null,ms:Rz,place:"floor"},{x:a,act:"rope-throw",prop:null,ms:Mz,place:"floor"},{x:a,act:"rope-catch",prop:null,ms:Iz,place:"floor"},{x:a,act:"climb",prop:null,ms:c},{x:a,act:"pull-up",prop:null,ms:480}]}function Oz(e,t,n){const r=(n==null?void 0:n.ledgeSpan)??vo;switch(hz(t)){case"tidy":return vz(e,Si(e,t,r));case"kick":return xz(e,Si(e,t,r));case"sit":return _z(e,Si(e,t,r),t);case"watch":return Nz(e,Si(e,t,r),t);case"fish":return bz(e,Si(e,t,r),t);case"skip":return kz(e,Si(e,t,r),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return $z(e,n,t)}}const l=uz(e,t,r);return[{x:l.to,prop:null,act:"walk",ms:l.ms}]}const Lz=[".xx.","xxxx",".xx."],Pz=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],Dz=["...xx...............","..xaax..............",".xaallx.............","xaallllx............",".xllllllx...........","..xllllllx..........","...xllllllx.........","....xllllllxx.......",".....xllllxsxx..xx..","......xllxsssx.xllxx",".......xxssssxxxllxx","........xssssssxx...",".........xssssx.....","..........xxxx......","..........xax.......",".........xxxxx......","........xx.x.xx.....","........xl.x.lx.....",".......xl..x..lx....",".......xl..x..lx....","......xl...x...lx...","......xl...x...lx...",".....xl....x....lx..","....xxx...xxx...xxx."],Mp={litter:Lz,ball:Pz,scope:Dz},ER=["bob","sway","groove"],eN=9e3,qz=16e3,CR=1e3,Fz=.08;function Bz(e,t){const n=ER.filter(l=>l!==e),r=n[Math.min(n.length-1,Math.floor(t()*n.length))],a=(t()*2-1)*Fz;return{dance:r,beatMs:Math.round(CR*(1+a))}}function zz(e){return Math.round(eN+e()*(qz-eN))}const Hz=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],Uz=3,Wz=-1,$x=11,tN=9,Vz=420;function Gz(e,t,n){const r=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(Vz,Math.max(0,r))}const Kz=260,Yz=200;function Xz(e,t,n){const r=(h,m=nn(e,h))=>({x:h,prop:null,act:"walk",ms:m,place:"floor"});if(!n||n.height<=0)return[r(t)];const a=Math.min(e,t);if(Math.max(e,t)<=n.left||a>=n.right)return[r(t)];const c=t>e,u=c?n.left:n.right,f=c?n.right:n.left,p={place:"floor",riser:n.height,prop:null};return[r(u,nn(e,u)),{...p,x:u,act:"mount",ms:Kz},{...p,x:f,act:"walk",ms:nn(u,f)},{x:f,prop:null,act:"dismount",ms:Yz,place:"floor"},{x:t,prop:null,act:"walk",ms:nn(f,t),place:"floor"}]}function nN(e){let t=null,n=null,r=0,a=0,l=!1;const c=()=>{t!==null&&clearTimeout(t),t=null},u=()=>{l||e.hidden||!n||t!==null||(a=performance.now(),t=setTimeout(()=>{t=null;const p=n;n=null,p==null||p()},r))},f=()=>{e.hidden&&t!==null?(r=Math.max(0,r-(performance.now()-a)),c()):e.hidden||u()};return e.addEventListener("visibilitychange",f),{schedule(p,h){l||(c(),n=p,r=Math.max(0,h),u())},dispose(){l=!0,c(),n=null,e.removeEventListener("visibilitychange",f)}}}function Ip(e,t){var r;const n=((r=e[0])==null?void 0:r.length)??0;return i.jsx("svg",{viewBox:`0 0 ${n} ${e.length}`,shapeRendering:"crispEdges","aria-hidden":!0,children:Sh(e).map(a=>i.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,fill:a.cell==="s"?"var(--fm-prop-shadow, var(--bg))":a.cell==="l"?"var(--fm-prop-light, var(--text))":a.cell==="a"?"var(--accent)":void 0},`${t}${a.y}-${a.x}`))})}const $p={e:"fm-eye",s:"fm-shade",p:"fm-pad"},sh=Sh().filter(e=>!_R.has(e.cell)),Zz=Sh().filter(e=>_R.has(e.cell)),rN=sh.filter(e=>e.cell==="e"),Qz=Sh(Hz),Jz=sh.filter(e=>e.y<$x&&e.cell!=="e").map(e=>{if(e.y!==8&&e.y!==9)return e;const t=Math.max(6,e.x);return{...e,x:t,w:Math.max(0,Math.min(12,e.x+e.w)-t)}}).filter(e=>e.w>0),eH={left:sh.filter(e=>e.y>=$x&&e.x<tN),right:sh.filter(e=>e.y>=$x&&e.x>=tN)},sN={litter:Ip(Mp.litter,"litter"),ball:Ip(Mp.ball,"ball"),scope:Ip(Mp.scope,"scope")},tH=x.memo(x.forwardRef(function({fetchImpl:t},n){const[r,a]=x.useState(null),[l,c]=x.useState(!1),[u,f]=x.useState(!1),[p,h]=x.useState(!1),[m,y]=x.useState(0),[w,N]=x.useState(0),[k,S]=x.useState(null),[b,j]=x.useState(null),[E,C]=x.useState({x:0,drop:0}),[T,R]=x.useState("ledge"),[$,D]=x.useState("left"),[U,P]=x.useState(0),V=x.useRef(null),[J,ee]=x.useState(()=>document.hidden);x.useEffect(()=>{const O=new Set,Y=()=>{var B;if(document.hidden){for(const te of((B=V.current)==null?void 0:B.getAnimations({subtree:!0}))??[])if(te.playState==="running"||te.pending){const le=te.currentTime;te.pause(),le!==null&&(te.currentTime=le),O.add(te)}}else{for(const te of O)te.playState==="paused"&&te.play();O.clear()}ee(document.hidden)};return Y(),document.addEventListener("visibilitychange",Y),()=>document.removeEventListener("visibilitychange",Y)},[r,l]);const[M,Z]=x.useState(null),[G,I]=x.useState(CR),[q,H]=x.useState(()=>{var O;return((O=window.matchMedia)==null?void 0:O.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});x.useEffect(()=>{var B;const O=(B=window.matchMedia)==null?void 0:B.call(window,"(prefers-reduced-motion: reduce)");if(!O)return;const Y=()=>H(O.matches);return Y(),O.addEventListener("change",Y),()=>O.removeEventListener("change",Y)},[]);const W=x.useRef(null),L=x.useRef(null),K=x.useCallback(O=>{var Y,B;(B=(Y=W.current)==null?void 0:Y.contentWindow)==null||B.postMessage(O,Ix)},[]);if(x.useEffect(()=>{let O=!0;return(t??fetch)("/api/claude-fm").then(B=>B.ok?B.json():null).then(B=>{O&&(B!=null&&B.live)&&(B!=null&&B.channel)&&a({live:!0,channel:B.channel})}).catch(()=>{}),()=>{O=!1}},[t]),x.useEffect(()=>{if(!u)return;const O=Y=>{var te;if(Y.origin!==Ix||Y.source!==((te=W.current)==null?void 0:te.contentWindow))return;const B=rz(Y.data);if(B){if(B.kind==="ready"){K(wd("playVideo"));return}if(B.kind==="playing"){h(B.playing);return}nz.includes(B.code)&&(f(!1),h(!1),c(!0))}};return window.addEventListener("message",O),()=>window.removeEventListener("message",O)},[u,K]),x.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]),x.useEffect(()=>{if(!r||l||q)return;const O=nN(document);let Y=0;y(Te=>Y=Te);const B=Te=>{var Ze,ct;const[Re,...Me]=Te;if(!Re){S(null),j(null),Ie();return}S(Re.act),j(Re.prop),R(Re.place??"ledge"),P(Re.riser??0);const xe=ye(Re),He=Y;if(Re.act==="kick"){const Ke=(ct=(Ze=V.current)==null?void 0:Ze.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:ct.getBoundingClientRect();Ke&&C({x:Gz(Ke.x,J_(Re,He,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-Ke.y+24)})}const _e=Re.act==="walk"||Re.act==="carry"?nn(He,xe):Re.ms;N(_e),D(Ke=>J_({...Re,x:xe},He,Ke)),y(xe),Y=xe,O.schedule(()=>B(Me),_e)},te=()=>{const Te=V.current,Re=Te==null?void 0:Te.querySelector(".fm-sprite"),Me=Te==null?void 0:Te.parentElement;if(!Te||!Re||!Me)return null;const xe=Te.getBoundingClientRect(),He=Me.getBoundingClientRect(),Ne=He.right-xe.right,_e=He.width-Ne*2-Re.offsetWidth;return _e>0?_e:null},le=()=>{const Te=V.current,Re=Te==null?void 0:Te.querySelector(".fm-walker"),Me=te();if(!Te||!Re||Me==null)return;const xe=Te.getBoundingClientRect().bottom-Re.getBoundingClientRect().bottom;if(xe>0)return{ledgeH:xe,floorSpan:Me}},pe=()=>{const Te=V.current,Re=document.querySelector(".autofit-chip");if(!Te||!Re)return null;const Me=Te.getBoundingClientRect(),xe=Re.getBoundingClientRect();return xe.width<=0||xe.height<=0?null:{left:xe.left-Me.right,right:xe.right-Me.right,height:xe.height}},ye=Te=>{const Re=(Te.place??"ledge")==="floor"?te()??vo:vo;return Math.max(-Re,Math.min(0,Te.x))},Ie=()=>{O.schedule(()=>{const Te=Oz(Y,Math.random,le()),Re=Te.some(He=>He.place==="floor")?pe():null;let Me=Y;const xe=Te.flatMap(He=>{const Ne=Me;return Me=He.x,He.place==="floor"&&He.act==="walk"?Xz(Ne,He.x,Re):[He]});B(xe)},dz(Math.random))};return Ie(),()=>{O.dispose(),R("ledge"),y(Te=>Math.max(-vo,Math.min(0,Te))),N(0),S(null),j(null),P(0)}},[r,l,q]),x.useEffect(()=>{if(!p||q){Z(null);return}const O=nN(document),Y=B=>{const te=Bz(B,Math.random);Z(te.dance),I(te.beatMs),O.schedule(()=>Y(te.dance),zz(Math.random))};return Y(null),()=>O.dispose()},[p,q]),x.useImperativeHandle(n,()=>({duck(O){p&&(L.current&&clearTimeout(L.current),K(wd("setVolume",[az])),L.current=setTimeout(()=>{K(wd("setVolume",[sz])),L.current=null},O))}}),[p,K]),!r||l)return null;const de=()=>{if(!u){f(!0),h(!0);return}const O=!p;h(O),K(wd(O?"playVideo":"pauseVideo")),O||(f(!1),L.current&&clearTimeout(L.current),L.current=null)};return i.jsxs("div",{ref:V,className:"fm","data-suspended":J?"":void 0,"data-place":T,style:{"--fm-beat":`${G}ms`},children:[b&&!b.held&&i.jsx("div",{className:"fm-prop","data-prop":b.kind,"data-leaving":b.leaving?"":void 0,style:{"--fm-prop-x":`${b.at}px`,"--fm-roll-to":`${E.x}px`,"--fm-ball-drop":`${E.drop}px`,"--fm-ball-flight-ms":`${SR}ms`,"--fm-ball-turn":$==="right"?"1080deg":"-1080deg"},children:sN[b.kind]}),(k==="lasso"||k==="rope-throw"||k==="rope-catch"||k==="climb"||k==="pull-up")&&i.jsxs("div",{className:"fm-rope","data-act":k,style:{"--fm-rope-x":`${m}px`,"--fm-rope-ms":`${w}ms`},children:[i.jsx("div",{className:"fm-rope-line"}),i.jsxs("svg",{className:"fm-rope-hook",viewBox:"0 0 9 9",shapeRendering:"crispEdges","aria-hidden":!0,children:[i.jsx("path",{d:"M4 8V3H3V1H1V3H0V5H2V4H3V6H5V4H6V5H8V3H7V1H5V3H4"}),i.jsx("rect",{className:"fm-rope-knot",x:"3",y:"6",width:"3",height:"2"})]})]}),i.jsxs("div",{className:"fm-walker","data-act":k??void 0,"data-place":T,"data-facing":$,style:{"--fm-x":`${m}px`,"--fm-walk-ms":`${w}ms`,"--fm-riser":`${U}px`,"--fm-skip-beat":`${jR}ms`},children:[(b==null?void 0:b.held)&&i.jsx("div",{className:"fm-held","data-prop":b.kind,"data-toss":b.leaving?"":void 0,children:sN[b.kind]}),["cast","fish","reel","stow"].includes(k)&&i.jsxs("svg",{className:"fm-fishing",viewBox:"0 0 24 32",shapeRendering:"crispEdges","aria-hidden":!0,children:[i.jsxs("g",{children:[i.jsx("path",{d:"M24 11H22V9H20V7H18V5H16V3H13V2H8"}),i.jsx("rect",{className:"fm-fishing-grip",x:"21",y:"9",width:"3",height:"3"})]}),i.jsxs("g",{className:"fm-fishing-line",children:[i.jsx("path",{d:"M8 2V26"}),i.jsxs("g",{className:"fm-float",children:[i.jsx("rect",{x:"7",y:"25",width:"3",height:"2"}),i.jsx("rect",{x:"8",y:"24",width:"1",height:"1"})]})]}),i.jsx("path",{className:"fm-ripple",d:"M3 28H6M10 28H14M5 30H12"})]}),["skip-ready","skip","skip-rest"].includes(k)&&i.jsxs("svg",{className:"fm-skipping-rope",viewBox:"0 0 26 26",shapeRendering:"crispEdges","aria-hidden":!0,children:[i.jsx("path",{className:"fm-skip-back",d:"M5 18H3V8H5V5H8V2H18V5H21V8H23V18H21"}),i.jsx("path",{className:"fm-skip-forward",d:"M5 18H3V14H5V11H8V9H18V11H21V14H23V18H21"}),i.jsx("path",{className:"fm-skip-front",d:"M5 18H3V21H5V23H8V25H18V23H21V21H23V18H21"}),i.jsx("path",{className:"fm-skip-return",d:"M5 18H3V19H8V20H18V19H23V18H21"}),i.jsx("path",{className:"fm-skip-handles",d:"M5 17V19M21 17V19"})]}),i.jsx("button",{type:"button",className:"fm-sprite","data-playing":p?"":void 0,"data-dance":p?M??ER[0]:void 0,"aria-pressed":p,onClick:de,title:p?"Stop Claude FM":"Play Claude FM — streams from YouTube","aria-label":p?"Stop Claude FM":"Play Claude FM",children:i.jsxs("svg",{viewBox:`0 0 ${G_} ${lz}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[i.jsx("g",{className:"fm-gear",children:i.jsx("g",{className:"fm-gear-motion",children:Zz.map(O=>i.jsx("rect",{x:O.x,y:O.y,width:O.w,height:1,className:$p[O.cell]},`g${O.y}-${O.x}`))})}),i.jsxs("g",{className:"fm-body",children:[rN.map(O=>i.jsx("rect",{x:O.x,y:O.y,width:O.w,height:1,fill:"var(--accent)"},`eye-bed-${O.x}`)),Jz.map(O=>i.jsx("rect",{x:O.x,y:O.y,width:O.w,height:1,className:$p[O.cell]},`b${O.y}-${O.x}`)),i.jsxs("g",{className:"fm-arms",children:[i.jsx("rect",{x:4,y:8,width:2,height:2}),i.jsx("rect",{x:12,y:8,width:1,height:2}),i.jsx("rect",{x:13,y:8,width:1,height:2,className:"fm-shade"})]}),rN.map(O=>i.jsx("rect",{x:O.x-(O.x>=G_/2?1:0)+($==="right"?1:0),y:O.y,width:O.w,height:1,className:"fm-eye"},`eye-${O.x}`))]}),i.jsx("g",{className:"fm-hat",children:Qz.map(O=>i.jsx("rect",{x:Uz+O.x,y:Wz+O.y,width:O.w,height:1,className:O.cell==="k"?"fm-hatband":void 0},`h${O.y}-${O.x}`))}),(k==="climb"||k==="rope-throw"||k==="rope-catch"||k==="pull-up")&&i.jsxs("g",{className:"fm-grip",children:[i.jsx("path",{className:"fm-grip-left",d:"M5 9H4V4H7V3H9V5H6V9Z"}),i.jsx("path",{className:"fm-grip-right",d:"M12 9H14V6H11V5H9V7H12Z"})]}),(k==="land"||k==="dismount")&&i.jsxs("g",{className:"fm-crouch-legs",children:[i.jsx("path",{d:"M6 11H8V13H6Z"}),i.jsx("path",{d:"M10 11H12V13H10Z"})]}),["sit","cast","fish","reel","stow"].includes(k)&&i.jsxs("g",{className:"fm-seated-legs",children:[i.jsx("path",{className:"fm-seated-far",d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),i.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(O=>i.jsx("g",{className:"fm-leg","data-side":O,children:eH[O].map(Y=>i.jsx("rect",{x:Y.x,y:Y.y,width:Y.w,height:1,className:$p[Y.cell]},`${O}${Y.y}-${Y.x}`))},O))]})})]}),u&&r.channel&&i.jsx("iframe",{ref:W,className:"fm-frame",title:"Claude FM",src:QB(r.channel,window.location.origin),onLoad:()=>K(JB()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})]})})),TR="agent-dag.character-enabled";function nH(e){return e!=="0"}function rH(){return nH(Sa(TR))}const sH=15e3;function aH(e){return e.visibilityState==="visible"&&e.hasFocus()}function oH(e,t){return t||e===!0}function iH(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}const lH={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all.","","A release that genuinely has nothing to say is spelled TWICE: no key here,",'and its version written into "//nothing-to-say" below. One spelling on its',"own is ambiguous — a missing key reads the same whether it was a decision","or a forgotten step, and five releases in a row were once forgotten. The list","is what tells the two apart, and release-notes-current-version.test.ts fails","the release whose version is in neither place. Any key opening with // is a","note to the author and never a release."],"//nothing-to-say":["3.23.1","3.23.2","3.23.3","3.23.4"],"3.24.1":[{title:"🎛️ Appearance is one small menu now",body:"The topbar's appearance control opens a compact menu where you can choose Light or Dark and show or hide the character. The character stays on by default, and your choice is remembered."}],"3.24.0":[{title:"🎧 Claude FM plays from the minimap",body:"A small character stands on the minimap's top edge. Press it and the Claude channel's live stream plays; press it again and it stops. It only turns up when the channel is actually broadcasting, so a deck with no network never shows it at all."},{title:"🤠 And it gets on with its day",body:"It walks that edge, tidies up what it finds, kicks a ball along it, sits with its legs over the side, and watches the board through a scope. Now and then it drops onto the canvas and ropes its way back up. Headphones on while the music plays, a hat when it does not."}],"3.23.5":[{title:"🧭 The accounts panel opens on the account you are on",body:"Its windows, its resets and how old the numbers are — whole, at the top of the column. Every other account stands behind one row that says how many of them a switch could actually reach; press it to see them, or rest on it to be shown their names and how much room each has left."},{title:"⚙️ Auto-switch moved in there with them",body:"It is behind that same row now, after the accounts it switches between, rather than at the foot of the panel. The row says `auto 90%` or `auto off` so you can tell what the policy is doing without opening it — and says so in amber when it is armed with nowhere left to go."}],"3.23.0":[{title:"🧭 The accounts column leads with accounts",body:`The live account is the open row: its windows as bars, when each one resets, and how old the numbers are. Every other account rests on the two figures a switch is decided by, and opens with a click when you want the rest.
92
-
93
- A problem stays on the row — an expired login, one that was never stored, a keychain the deck cannot open — with the reason and the sign-in one press away. Auto-switch is one row now: its threshold and its switch. Local network moved out of the column into a view of its own, reached from a row at the foot that says how many of the paired machines are on right now, and shows which ones when you hover it.`},{title:"💬 A resting session shows Claude Code's recap beside its card",body:"When a session stops, Claude Code's own recap of what it did is drawn beside the card — so a board you come back to says what happened without opening anything."},{title:"🪟 The chrome went quiet",body:`The topbar is borderless, one set of corners runs through the app, the canvas ground is flat, and the minimap, the zoom controls, the type filter and the Machine and Usage panels read as tooling rather than as cards.
94
-
95
- The canvas also says when auto-fit is off, with one press to bring new sessions back into view.`},{title:"🔍 A tool call's detail reads as the call",body:"A tool call's arguments are shown as the call rather than as escaped JSON, and can be copied."},{title:"🔐 Saying yes to every deck that asks takes two presses",body:"The switch that accepts every pairing request arms first and says what it hands over, so one stray click cannot put this machine's logins on another deck."},{title:"🖐️ Targets, themes and contrast",body:"The panel's smallest controls reach the 24px target floor, and grow further under a finger. A first run follows the system's light or dark setting instead of picking one. Status dots, meters and switch knobs survive a Windows Contrast theme."}],"3.22.15":[{title:"🖱️ Clicking a card opens its details",body:"Selecting an agent is inspecting it: a click, `j`/`k`, a session picked from the list and Enter on a focused card all open the detail panel — prompt, every tool call, tokens, timing. It used to open only with `D`, so anybody who closed it with its × and never found the key did not get it back. The × still closes it until the next selection, and `D` still toggles it.\n\n`D` with nothing selected now picks a card first — the session that has waited longest, or the one `j` would land on — instead of flipping a switch with nothing on screen to show for it."},{title:"⌨️ The keyboard and screen readers reach the whole deck",body:`Shortcuts keep working after a mouse click on a button. A click left focus on the button it pressed, and the key handler leaves a focused control its own keys, so every single-key shortcut was dead until you pressed Esc — with nothing on screen to say so.
96
-
97
- Tab follows the page now — topbar, the accounts column, the canvas, usage, machine — instead of zig-zagging left and right across it, and a canvas card reached by Tab draws the focus ring. A screen reader hears each card by name, with its kind, state, model and cost, rather than every word on it run together; the machine panel has a heading its region is named by; and the theme button is named for the theme it switches to.
98
-
99
- With **Reduce motion** set, the camera no longer flies across the canvas to a card.`},{title:"💵 The money figures say what they measure",body:"The usage header's **$/min** is spend over a trailing window, and says which span it measured: `$3.54/min · 2 min`. It used to divide the live agents' cost by how long the longest of them had been running, so one deck read $2.39/min in a tab left open and $19.49/min in a tab opened minutes later.\n\nA quota bar's pace says **over pace** or **under pace**. It said `ahead`, which is how plain English says winning, on the very line meant to warn you that you are burning the window faster than it lasts.\n\nA card's clock reads `≥ 53m 52s` for a session this page joined after it had started, instead of presenting the part it saw as the whole of it — and that card's per-minute burn is left out rather than divided by the short clock."},{title:"↔️ Narrow windows keep every topbar control on screen",body:`At 400px six of the topbar's buttons sat past the right edge and the page scrolled sideways. The readouts give way first now and the controls stay; below 640px the side panels span the window instead of leaving the canvas a sliver; and the category filter wraps inside the canvas rather than being clipped by it.
100
-
101
- Zoomed out, a card's name and a cluster's label stay readable instead of shrinking to about four pixels — which is the view a board of any size actually sits at.`},{title:"🔑 A paired deck's dialog says which account that machine is on",body:`The lane of the account the other machine is working on takes the accent and a slow ring on that machine's end. An account is named only if that deck shares it: on one it does not share, the dialog reads "on another account" and never which. A new switch under **SHARE THESE ACCOUNTS**, on by default, turns the telling off, and paired decks then read "current account hidden".
102
-
103
- **This deck on the network** prints this deck's own fingerprint again. A pairing request asks you to match it against the one on the other machine's screen, and no screen here was showing it — so the one check a person can make against a rogue deck could not be made, on the step that hands over logins.`},{title:"💬 The deck's messages send you somewhere worth going",body:'An empty canvas no longer ends with "Make sure ccdeck is running" while the page is plainly connected to it. The capture hints under that line, one per CLI, are the real reasons a canvas stays empty, and they stay. With the stream down the screen says whether this page lost a deck that was there or never found one, in those words, rather than naming the `/events` route nobody who typed `npx ccdeck` has seen.\n\nAnd a slow `claude-swap` now reads as a slow answer — "still waiting on the deck server" — instead of "couldn\'t reach the deck server", which sent people off to restart a server that was fine.'}],"3.22.10":[{title:"🖱️ Icon buttons are easier to hit",body:"Icon buttons react when the pointer is near them — no need to hit the icon exactly."},{title:"🧩 Sessions spread across the canvas",body:"Sessions now spread across the canvas in columns instead of one tall column, and new sessions and subagents land in the free space beside them. Nothing is placed under the Machine or Usage panels. Press R once to rearrange a board you already have."}],"3.21.0":[{title:"🖼️ The deck explains itself in pictures",body:"🎬 First run opens an eight-picture tour instead of the changelog — who is waiting on you, the tree, a node's inside, cost and quota, this machine, accounts, local network, how to start. `Take the tour` on an empty canvas brings it back.\n\n📡 **Local network** has a guide: a card while it is off, `How it works` under an empty list, four pictures ending on `Turn it on`. A machine's row opens its own dialog — address, version and system, the logins it offers, and a name of your own for it. Setup ends on Done.\n\n🔄 The deck updates itself when nobody is looking: no tab focused, no agent mid-turn, thirty seconds quiet. The banner's `auto when idle` switch governs it.\n\n🔑 An account whose numbers were paused resumes on its own, and the panel is titled **Claude accounts** — a Codex login is not in it."}],"3.20.0":[{title:"🟢 The deck keeps running after you close the terminal",body:"`ccdeck` prints the same boot report and gives you the prompt back. The deck stays up, and starts again when you log in.\n\n🛑 **`ccdeck --stop` is the off switch now** — Ctrl+C only cancels a start that is still printing. `--status` says what is running, `--logs` shows what the deck wrote while you were away, and `--foreground` holds the terminal the way every version before this one did.\n\n🔁 Typing `ccdeck` beside a deck that is already up opens **that deck's tab** instead of building a second one. `ccdeck --stop --all` clears any older deck still running from before this version. An `npx` run cannot start at login — `npx ccdeck --install` puts it on your PATH and sets that up.\n\n🔑 An account that will not collect now says which of three things is wrong: **no stored login**, a **login that expired**, or a **keychain the deck cannot open** — with the fix beside it. One with no stored login is filled over the local network by a paired deck that has it.\n\n📡 And decks find each other again on a machine with a VPN up: the beacon was going to an address that never left the machine, so this deck could hear colleagues and none of them could hear it."}],"3.19.0":[{title:"🟢 Local network: fixes and improvements",body:`The list of decks is quiet now. A deck that is **on**, with nothing to repair, is a name and a green mark — no sentence under it. Every healthy row used to carry the same words, so the one row worth reading looked like all the others. A failure, a login that arrived, a machine that is away, still say so, and they are now the only rows with anything written on them.
104
-
105
- \`unpair\` arrives when you point at a row rather than sitting on every one of them, two machines that share a name show their addresses, and the ↻ turns while a round is out.
106
-
107
- **Add a deck** is two ways in — by address, or with an invite — with \`make one to send\` beside the invite heading instead of under the paste field, where it read as that field's button. A refused address now says which mistake it was, and an invite that will not work says whether it ran out, was not an invite, or reached nothing.
108
-
109
- Switching **Local network** on opens your name and shared logins, every time, so nothing goes on the network without you having just seen what goes with it.`}],"3.18.3":[{title:"🟢 The list shows what is on, and folds the rest",body:'A machine that is off, or nearby and unpaired, or one you said no to, is context rather than an answer to "who can I use right now" — so the decks that are **on** lead the list and everything else is one line: `2 more`. Nothing worrying is hidden by it: a deck that cannot be reached is counted in that line, in the warning colour, so the fold says whether it is worth opening.\n\nThe round moved to a **↻ beside the switch**, where the accounts header has kept the same act since it was written, and the line under the state now says when it last ran — `checked 2m ago`, or `not checked yet`. A list that refreshes itself and a list that has stopped used to look identical, and pressing the button to find out was the only way to tell.'}],"3.18.1":[{title:"🔁 A deck stops asking to pair over and over",body:"Several decks on one computer share a config directory, so they start with one key. Each read the others' beacons as somebody wearing its name, took a fresh key, and wrote it to the file the others read — a loop that never settles. Every new key is a **new deck** to everyone else on the network, so one machine sent a fresh pairing request every few seconds and accepting one accomplished nothing: the deck that asked no longer existed by the time the answer arrived.\n\nDecks on one computer now recognise each other as the same machine and leave the key alone. The clash still worth healing — a `~/.claude` copied to a second machine — is unchanged.\n\nThis also collapses the rows: a computer that has run the deck a few times appeared several times on everybody else's panel and is one row now. **Both machines need this version** for that to take effect on the other one's screen.\n\nA deck that answered is no longer counted as unreachable, the list refreshes itself in seconds while somebody is deciding rather than at the next minute, and a failed round says what happened — `not listening`, `no route to it` — with the address and the raw error on the hover."}],"3.18.0":[{title:"🟢 A deck that is switched off no longer reads as on",body:"A paired deck this one has no address for was drawn **live** on the strength of being paired — a machine closed an hour ago still sat under `1 deck ready`. Every row now leads with whether that machine is actually there, and when it last was: `online · 1 login arrived`, `no answer · last online 20m ago`, `never reached`. The mark beside the name is a traffic light — green for a deck that answered, amber for one that cannot be reached, grey for one nothing has heard from.\n\n**+ add a deck** opens a dialog now instead of unfolding inside the panel. An address, an invite and the firewall note never fitted a 288px column, and unfolded they turned a list of machines into a form."}],"3.17.0":[{title:"🔔 Pairing is two presses",body:`When another deck asks to pair, the question now arrives **over the deck** rather than in a row three sections down a panel: its name, its address, the fingerprint to compare, **Accept** or **Decline**. Escape means later — the request stays in the panel until you answer it.
110
-
111
- The rest is one list. Every deck you are paired with, every deck on the network, and every one you turned away, each a row with its state under the name and one verb at the end — and a deck that cannot be reached now reads differently from one that is fine. Saying no also reaches the other machine now, instead of leaving it waiting forever; you can take it back.
112
-
113
- The dialog behind **setup** is down to the two things it is really about: what this deck is called, and which logins it offers.`}],"3.15.0":[{title:"🔗 Decks on one network heal each other's dead logins",body:`A login dies on the machine that has not used it while the same account keeps working on the machine that has. The fix was a blob copied out of one deck and pasted into another. Now: **Accounts ▸ Local network**, the same passphrase on each deck — it offers you six words — and they find each other and repair themselves.
114
-
115
- A deck only **adds** an account it does not have, or **replaces one it has proven dead** — proven by Anthropic refusing the token, not guessed. A credential that works is never touched. The passphrase is the only gate; a stranger on the same wifi sees that a deck exists and nothing else.`},{title:"⚠️ What sharing a login actually means",body:`**A login you share is a live one, and it cannot be taken back.** Turning the switch off stops what has not happened yet; a credential that has left your machine is gone, and the only real revocation is signing in again at Anthropic — which ends the session everywhere at once.
116
-
117
- Sharing a Claude account may also be against Anthropic's terms. Your call; the deck says it once and does not nag.`}],"3.14.0":[{title:"📊 The machine comes back beside the list that covers it",body:`**Busiest processes** opens over the machine panel and hides the very readings that sent you looking. They are back beside the list — cores, memory, swap, queued work, temperature — with up to an hour behind each: a column down the side on a wide screen, a band under the table on a narrow one.
118
-
119
- Each is drawn against the line it is measured to — memory and swap at 90%, load at your core count, the GPU at 75° and again at 90° — so swap sitting *on* its line is something you see rather than work out. The processor readings get no line on purpose: a CPU at 90% is your machine doing what you asked for. Throttling appears only once your machine has actually been held back, and the band says how much history it really has rather than claiming an hour it has not had.`},{title:"📋 The process dialog's footnote moved onto the columns it was about",body:"A band ran along the bottom of **Busiest processes** saying three things. Two were worth keeping and are now on the header of the column they describe — hover `memory` to read what that number measures, `process` to read that the command-line redaction is a filter rather than a promise.\n\nThe third said the list is the busiest by processor and memory, refreshed every four seconds. The heading, the count beside it and the moving numbers were already saying that."},{title:"📝 These notes render what they were written in",body:`Every note in this dialog is written in Markdown — **bold** for the sentence that carries the change, backticks for a flag or a path — and the dialog printed the string raw. So the first window you see after an upgrade has been showing you \`**this**\`, backticks and all, since the feature shipped: 25 of 52 notes, 52 bold spans, 54 code spans.
120
-
121
- What you are reading is the first version that does not.
122
-
123
- No Markdown library came along for it. Counted in the file: bold 52, code 54, links 0, headings 0, lists 0 — and the smallest library that reads all of Markdown is 40KB on a bundle the deck fetches while you wait for it to start.`},{title:"⎋ Esc leaves the machine panel where it is",body:"The × on **This machine** read `Close (Esc)`, so Escape put the panel away. Escape belongs to the canvas — it deselects and hands the keyboard back — and pressing it while you are reading your instruments should not close them.\n\nThe panel now closes the two ways it opens: its ×, and the meter in the topbar. The × says `Close`, and names no key it does not answer."},{title:"🖥 The machine moved out of the topbar and into a button",body:"The small CPU sparkline and memory bar in the topbar are gone. A chip glyph in the icon row beside `$` and the accounts silhouette opens the same **This machine** panel — cores, memory, swap, load, temperature, busiest processes — and the bar stops moving in the corner of your eye.\n\nIt also stops asking. The deck read your machine every three seconds for the life of every tab to feed that meter; it now reads only while the panel is open, and the history behind the readings is kept by the deck itself, so a panel opened an hour from now still has the hour behind it."},{title:"🔎 The panel's eight process rows became one way in",body:"The machine panel drew eight processes in a 280px box: three columns, names cut off mid-word, and a `ps` run every four seconds to keep them moving. **Busiest processes** is a single row you press now, and the dialog behind it is what it always was — every candidate the deck sees, its memory in bytes, threads, user, pid, and the command line that tells you which `node` this one is.\n\nWith that dialog closed, the deck reads no process list at all."},{title:"⏱ The restart banner says whether the press is safe, and shows the fuse",body:"The button read `Restart now` whether the machine was idle or five agents were mid-turn — and the events fired while the server is down are lost for good. It reads **`Restart anyway`** now when something is running, with the count beside it, and `Restart now` with *nothing is running* when the machine is quiet.\n\nThe automatic restart said only `auto when idle`, while a 30-second clock ran where nobody could see it. It counts — **`auto in 18s`** — which is also how you stop it, since the switch is the label. The amber dot pulses only while that clock runs.\n\nThe switch also says `auto-restart off` in words rather than in a colour, both its label and the button are readable in the light theme now, and a tab you are not looking at no longer restarts the deck under the tab you are."}],"3.13.0":[{title:"📊 Usage history stops jumping out from under you",body:`Pressing **H** put \`running ccusage…\` in a box 186px tall. Two to four seconds later the chart, the totals and the legend arrived and the box became 429px — and because the dialog is centred, that growth moved the whole thing **121px upward**, under the cursor that had just pressed something.
124
-
125
- The chart's place is now reserved from the first frame: the 168px the chart is tall plus the 16px it keeps for its day labels, both taken from the chart's own rule so the placeholder and the thing it holds room for cannot drift apart. The jump goes from 243px to 156px. It deliberately stops there — the totals and the legend are content, the legend's height depends on how many models ran, and reserving those would have meant drawing four plausible empty cards for a reading that had not arrived.
126
-
127
- What is drawn in the reserved space is **the chart's baseline and nothing else**: one line, in the same colour, at the height the columns will land on. Not a skeleton of grey bars — a skeleton stands in for content, an axis is furniture, and furniture is honest before the data exists. The light on it travels rather than fills, because the deck knows a subprocess is running and does not know how far through your transcripts it has got.
128
-
129
- Then the days rise out of that line, **oldest first**. The stagger is divided rather than fixed — 200ms of spread whether the range is 7 days or 90 — so the longest range is not also the slowest to appear.
130
-
131
- With reduced motion both loops and both entrances are off. The reserved space is layout, not animation, and stays outside that rule: asking for less movement gets you the same dialog that does not jump.`},{title:"⏳ The period mark says it is being read",body:"The first read of **today**, **month** or **all** takes two to three seconds — it walks the transcripts on this machine, and the cost is the walk, not the size of the range you asked for. Until now the panel said nothing for the whole of it, so pressing `month` looked like pressing nothing, and the honest response was to press it again.\n\nThe mark under the period now pulses while that read is in flight, and it **pulses rather than fills**: nothing measures how far through the transcripts ccusage has got, so a bar that filled would be inventing a number. Hovering the pending period says which one is being read, and screen readers are told the same thing through a live region rather than being left with a silent button."}],"3.12.0":[{title:"🔍 Busiest processes tells you which one",body:"The list could say what was eating the machine and not **which** of nine identical `Google Chrome Helper` rows was the headless Chrome you left running. It now shows the arguments after the name — `--type=renderer` beside one, `serve admin-portal --port 44440` beside a node — and four columns it did not have: **memory in MB and GB** instead of a percentage, **threads**, **how long it has been up**, and **user**. Every column sorts; press its heading.\n\n**Command lines have anything secret-shaped removed before they leave your machine** — the value of any flag whose name says token, password, key or secret, the password in a URL, and the shapes that identify themselves. It is a filter and not a guarantee: a secret that looks like an ordinary word looks like an ordinary word. The reading happens only while this modal is open, so a deck whose process list you never open never reads a command line at all.\n\n**Memory is resident set size** — what `ps` and Windows Task Manager report. On macOS this is *not* the number Activity Monitor shows in its Memory column; that one is the physical footprint, and on the machine this was built on the two disagree by up to fourteen times on the same process. No unprivileged command reports the footprint quickly, so the deck shows the figure that means the same thing on all three platforms and says which one it is.\n\n**There is no Ports column**, and the reason is the same kind of honesty: Mach ports do not exist on Linux, are not what Windows calls a handle, and on macOS the only way to count them takes four seconds — against a list that refreshes every four."},{title:"🔢 A token count that stays a whole number",body:"Switching the Usage panel from **month** to **today** counted down smoothly and then, for a fraction of a second, showed something like `in 594.3268260610639` where a token count belongs.\n\nThe count was never wrong; the printing was. The figures animate between two readings, so the formatter is handed a fraction on most of its frames — every size above a thousand was already rounded and the one below it was not."}],"3.11.0":[{title:"🗂 The session list waits to be asked for",body:`**BY SESSION in the Usage panel now starts collapsed.** It is the one block in that panel with no ceiling — every other section is two or three rows, or a model table bounded by the models that exist — and it was the reason the panel scrolled at all. Shut, the whole panel is one screen: quota, period, money, models. Press the heading to open it, and it stays open; ccdeck remembers your answer from then on.
132
-
133
- The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
134
-
135
- **Scrollbars are also gone until you point at the thing that scrolls.** Nothing moves when they appear — the track keeps its width in both states, so no text shifts under the pointer as it arrives.`},{title:"📊 today · month · all, as tabs that remember",body:"**The Usage panel's period switcher is a full-width row of tabs** rather than a pill floating over the column, with a thin cyan mark under the word it belongs to. It governs the figures beneath it, so it now looks like it does.\n\n**Your chosen period survives a reload.** It was the one preference in that panel that did not.\n\n**It costs one Tab stop instead of three.** Tab into the strip, then move with ←/→ or Home/End, and press Enter to choose. Arrowing past a period no longer starts reading it — moving and choosing are separate now, which matters on `all`.\n\nAnd **`month` says which month.** Hover it: this is the calendar month, from the 1st — not the last 30 days. `today` and `all` say what they cover too."},{title:"🔔 Sounds and Notifications are two switches, and Browser notifications is a channel",body:`**The sound menu has been rebuilt.** Sounds and Notifications are real switches now instead of words that read like status. Under them, **Browser notifications** is named as what it is — one of the two ways ccdeck can reach you — rather than sitting there as a third setting that seemed to contradict the one above it.
136
-
137
- There are two notifiers and they never both fire: the page raises one when the deck is open but hidden, and the server raises one when no page is open at all. Only the first needs a browser permission, which is why the permission belongs to a channel and not to the feature. **Turning Notifications on now asks the browser on that same press** — no second control to hunt for.
138
-
139
- \`M\` mutes and unmutes sounds from anywhere. **Hear it** plays the tone even when Sounds is off, so you can pick one before turning them back on.`},{title:"🧹 No agent, no empty panel",body:`**The detail panel no longer appears when nothing is selected.** It used to sit there empty, and a tab on the edge of the canvas existed to bring it back after you closed it — both are gone. Select an agent and the panel is there; press **D** to toggle it yourself.
140
-
141
- The canvas is that much wider whenever you are not reading one agent.`}],"3.10.0":[{title:"🔌 Who else can drive your browser, and where to see it",body:"**Browser Watch has a Remote control section.** The Claude in Chrome extension holds a connection open to Anthropic's relay, and that connection is registered against your **account**, not against this machine — so any Claude Code session signed in to the same account, running anywhere, can enumerate and drive this browser, and nothing prompts you on the machine being driven.\n\nThe panel now says whether that is the case here, and what the extension is actually allowed to do in each profile — enabled or switched off, every site or only the ones it was granted, and which of the powerful APIs it holds. That last part is not what `chrome://extensions` shows you: the per-site list there is enforced by the extension, on itself, while the grant underneath stays exactly as wide as it was.\n\nIf you want it closed, the section hands you the one command that closes it — as text, to paste in your own terminal. **ccdeck never runs it and never asks for your password**, and it never will: no part of this deck elevates, and a dashboard that could raise a password box on request would be a gift to anything else running on the machine. If the block is already in place, the section offers the command that takes it back out. And if something else in your hosts file already points that name somewhere, it says so and leaves the line alone — ccdeck only removes the line ccdeck wrote.\n\nAll of this is two file reads and no network call. It was written some releases ago and, until now, was not connected to any screen.\n\n**Also:** the README said `share` produces a `ccdeck1:` blob. It produces `ccdeck2:` — `ccdeck1:` has been read-only legacy for a while."}],"3.9.0":[{title:"🎛️ Five switches that were not where the thing they control is",body:'**The session list has a button again.** It lost one a while back and only the `L` key was left — and `L` is written down in one place, a shortcuts sheet behind a small `?` in the corner of the canvas. If you use a mouse there was no way to open the list at all. The `☰` is back at the left of the top bar.\n\n**The Notifications switch now tells you whether the browser will actually show one.** It said `on` while this browser had never been asked for permission, which is not the same thing. It now says so on that row and offers the ask right there. Before, the only place to grant it was a button that appears solely while a session is stuck waiting — so on a machine where that rarely happens you could not switch notifications on at all.\n\n**Started with `--workspace` or `--scope` and seeing nothing?** The empty screen used to tell everyone to "run `claude` or `codex` in any folder", which is the one thing that cannot work for you. It now names the folder the deck is actually watching.\n\n**Browser Watch says when a setting did not save.** Flipping the switch and having it fail showed a red line reading "Could not read" — about reading history, not about your press — and ten seconds later the panel wiped it and looked perfectly healthy with the setting unchanged. A failed save now says so, in its own words, and stays until you dismiss it. The "nobody browsing for" menu also follows the stored value again: change it in a second tab and this one never caught up.\n\n**The deck no longer restarts itself when nothing on screen offers to stop it.** Thirty seconds after the last agent went quiet, with a new version on disk, the server would exit, come back and reload the page. The `auto when idle` switch that controls that lives inside the update banner — so if you had closed the banner with its `×`, it happened with no visible setting anywhere. Closing the banner now also stands down the restart; clicking the version chip brings back both together.'}],"3.8.9":[{title:"🖥️ Four things that only went wrong on somebody else's operating system",body:"**Ubuntu:** the deck knew where Chromium and Brave keep their profiles when installed as a snap or a flatpak — which on a default Ubuntu is the only place Chromium is — but not what those programs are called. So it reported them as not running while they were, and refused to quit them. Both now work.\n\n**Windows:** the deck asked the system whether it could write to the folder an update installs into, and Windows always answers yes for a folder whatever the permissions say. It offered you an update that then died inside npm with a permission error. It now finds out by trying, and declines up front with the command to run yourself — which is what every other platform already got.\n\n**Linux:** if `XDG_DATA_HOME` was set to something starting with `~`, as it is from a systemd unit or a Dockerfile, the deck and claude-swap looked in two different places for your accounts. The panel said you had none while `cswap list` showed them all.\n\n**Plain terminals:** six messages used a typographic dash the old Windows console and the Linux text console cannot draw, so a box appeared mid-sentence — including in the line that explains why no events are arriving. They use the plain form on those terminals now, like everything else already did."}],"3.8.8":[{title:"📉 A false 99% on the memory chart, and three other quiet failures",body:`**The machine meter no longer invents a reading.** When the deck could not measure memory — a subprocess that would not start under load, or one that took too long — it substituted a number that means something else, and on a Mac that reads as about 99% used. The meter went red for half a minute, and because the chart keeps the highest value in each minute, that false peak stayed on it for a full day. A poll that cannot measure now keeps the last reading and records nothing: a gap in the chart is honest.
142
-
143
- **A failed ccusage repair no longer disables the repair.** If the deck found a half-installed copy it removes it and starts again. On Windows that removal can fail for a few seconds because the program it just ran still has the folder open — and the deck then treated the attempt as spent and never tried again for the rest of the session, leaving the panel permanently unable to read your usage. It now only counts a repair that happened.
144
-
145
- **Changing the auto-switch interval takes effect even during startup.** Set it in the first seconds after launch and the timer kept the old value for the life of the process, while the panel showed the new one.
146
-
147
- **Codex sessions with very large histories no longer cost hundreds of megabytes to read.** The deck read the whole file to find four values that live at its two ends — measured at 185 MB of memory and 95ms of frozen interface for one 44 MB session. It now reads only the ends.`}],"3.8.7":[{title:"🧠 Four things in the panel that behaved wrongly",body:`**Today's figure no longer overshoots.** Once a minute, when a fresh reading landed, the headline briefly counted past the true number and back down — it was measuring the last minute of spend from a starting point one moment out of date. The reading and its starting point are now recorded together, so there is no moment where they can disagree.
148
-
149
- **Browser Watch marks findings read when you close it, not when you open it.** It was clearing the badge immediately, and stamping every new finding as read the moment it arrived — so anything that turned up while you were reading was never badged at all. It was also writing to storage four times a second the whole time the panel was open.
150
-
151
- **A hidden tool category can always be brought back.** Hide one, leave the deck running, and once the canvas had turned over the row of chips disappeared while the filter stayed on — no bubbles, and nothing to press. Only reloading fixed it. The chips now stay for as long as anything is hidden.
152
-
153
- **Clicking a session's name no longer switches auto-fit off.** The deck was reading its own camera move as you grabbing the canvas, and remembered it across restarts, with nothing said.`}],"3.8.6":[{title:"🗂️ Two decks can no longer both claim the same log",body:"When several decks share one events log they elect a single writer for it, so nothing is recorded twice. That election compared the path as typed — so two decks reaching the SAME file by different spellings each thought they were alone, both wrote every event, and each believed the log was theirs to clear.\n\nDifferent spellings are ordinary, not exotic: a shortened Windows home directory, a mapped or substituted drive, a junction, or on macOS `/tmp` against `/private/tmp`. The visible symptoms were duplicated tool calls after a restart, and Clear wiping history belonging to another deck.\n\nThe path is now canonicalised the same way the watched folder already was. It works on a first run too, before the log file exists."}],"3.8.5":[{title:"⛔ Cancelling a sign-in no longer adds the account anyway",body:`Press Escape while adding a Claude account and the deck killed the sign-in — and then, sometimes, registered the account regardless, switched to it, and told you it had worked.
154
-
155
- The deck asks the tools it runs whether they finished cleanly. A program that is well behaved about being cancelled tidies up and exits with a success code, and the deck was reading that as "it finished" rather than "I stopped it". \`claude auth login\` is exactly that kind of program.
156
-
157
- A cancelled run now reports as cancelled. Everything that was not cancelled is unaffected.`}],"3.8.4":[{title:"🧷 Your own hooks can no longer be eaten by two decks starting together",body:'If you keep hooks of your own in `settings.json`, the deck parks them while it installs and puts them back afterwards. Two decks starting at the same moment could interleave inside that, and the loser wrote a version of the file computed before the restore — so your hook was gone from `settings.json` and gone from the park, which was its only other copy.\n\nThere was already a check for this, and it had a hole: if the last-moment re-read of the file failed, it read that as "nothing changed" and wrote anyway. A failed read is the one moment that check was most needed, because the usual reason a file cannot be read for a few milliseconds is that something else has just written it.\n\n`ccdeck --uninstall` had no such check at all and could overwrite a deck that was starting, then exit 0 saying it had succeeded. It has one now, and when it declines it says so and tells you to run it again rather than reporting that there was nothing to remove.'}],"3.8.3":[{title:"🪟 Windows: two settings files that could refuse to save",body:`On Windows a file cannot be moved into place while anything else has it open, and Defender and the search indexer open a file the instant it is written. The deck has had a retry for that for a long time, and two files written in the last few days were not using it: the notifications preference, and Browser Watch's episode archive.
158
-
159
- When it bit, the notifications switch silently did not stick, and Browser Watch answered an error and showed an empty panel. Both now retry the way everything else in the deck already did.
160
-
161
- Nothing changes on macOS or Linux, where the operating system never refused the move in the first place — which is why this got past a green test suite on both.`}],"3.8.2":[{title:"⌨️ A closed-behind-your-back dialog no longer kills every keyboard shortcut",body:`Open the context ring on a session's card and leave it open. The session finishes, and a couple of minutes later the canvas evicts it — or you press Clear. The dialog vanished, and from that moment every shortcut in the deck stopped working: Space, C, R, F, L, H, U, A, J, K, T, M, and the trash button too. Only reloading the page brought them back.
162
-
163
- The deck was still counting the dialog as open, because it remembered which session you had opened it for rather than whether anything was on screen. It now closes the dialog when its session leaves the board, which is what should have happened in the first place. The end-of-session recap had the same problem and is fixed with it.`}],"3.8.1":[{title:"🔒 Security: update if the deck runs on a Mac",body:"A local process able to reach the deck's port — no token, no browser, no tab — could get a string of its choosing compiled as AppleScript when the deck raised a desktop notification with no page open. On macOS that is code running as you.\n\nThe strings were already passed as arguments rather than pasted into the script, which is normally the whole defence. It is not enough for `osascript`: its option parser reads any argument starting with a dash as an option, so a name beginning with `-e` was taken as more script instead of as text. Every place the deck hands `osascript` or `notify-send` something from outside now carries an explicit end-of-options marker, so nothing from outside can be read as an instruction again.\n\nNothing to change on your side beyond updating. If you would rather keep the deck off the desktop entirely, the Notifications switch in the sound menu does that, and `AGENTS_DECK_NO_NOTIFY=1` does it at launch — but the fix is the thing to have."}],"3.8.0":[{title:"🔕 Notifications now have an off switch",body:`3.7.0 gave you a "notify me" button and no way back. Turning them off meant digging into your browser's site settings — which no page can do for you — and that still left the other notifier, the one the deck raises when no page is open at all. Silencing that one meant quitting the deck and starting it again with \`AGENTS_DECK_NO_NOTIFY=1\` in front. The person who wanted quiet was the one doing the work.
164
-
165
- There is a **Notifications** switch in the sound menu now, beside the one for sound — that menu is already "how loudly does this deck interrupt me". One switch governs both notifiers, it takes effect immediately without a restart, and it is remembered across restarts.
166
-
167
- It is kept by the deck rather than by your browser, because the second notifier runs when no page exists and a setting living in a page could never reach it. \`AGENTS_DECK_NO_NOTIFY=1\` still wins over the switch — a machine told at launch to stay off the desktop stays off it — and when that is the case the menu says so instead of showing an "on" that will not happen.`}],"3.7.1":[{title:"🔔 The notifications now fire on the thing that actually stops your agent",body:`3.7.0 could tell you a session was waiting — but only when Claude Code asked permission to run a tool. If you work with permissions bypassed, that never happens, and the whole feature was silent for you. Measured on one real log: 1683 events, every one of them in bypassPermissions, and a single permission prompt in the entire history.
168
-
169
- What fires constantly on that setup is the other kind: the agent asking you a question and stopping for the answer. The deck was throwing those away — no amber chip, no row in the sidebar, no notification, and no "notify me" button, because the button only appears while something is actually blocked.
170
-
171
- Now they count. The card carries the question itself rather than a generic "Your turn" — "paycore needs your input: merge both branches to main, or just one?" — and so does the notification, on the desktop, whether the tab is behind something or not open at all.
172
-
173
- An idle prompt still stays quiet: a turn that ended is not a session that is stuck, and a channel that cries wolf is one you switch off.`}],"3.7.0":[{title:"🔔 The deck can reach you when you are not looking at it",body:`The deck's whole point is telling you which agent is waiting on you, and until now it could only say so on screen — the amber chip, the tab title, the favicon. Every one of those is drawn inside a page, so the one moment it matters, when you have walked away and four agents have gone quiet, the deck was silent.
174
-
175
- Now it reaches the desktop, two ways that never overlap. With the deck open behind something, the page raises the notification itself: a "notify me" button appears in the top bar the first time a session blocks, and the browser asks you — nothing is requested before there is something to notify you about. With no page open at all, the server raises it, because it can see that nobody is connected and therefore that no other surface is saying anything.
176
-
177
- One notification per session, replaced rather than stacked if a second deck raises it too. Clicking it brings the tab forward. \`AGENTS_DECK_NO_NOTIFY=1\` turns the desktop side off entirely, and if you refuse the browser prompt the deck says so plainly instead of leaving you thinking you switched something on — after a refusal only your browser's site settings can undo it, which no page is allowed to touch.`},{title:"🧩 A blocked session now says what it is asking for",body:'"Waiting on you" told you to go and look. The session row and the card now carry the tool the prompt is most likely about, and the tooltip carries the one line of its input that a person actually reads — `rm -rf node_modules` rather than `{"command":"rm -rf node_modules"}`.\n\nIt is a guess and it is worded as one: the deck sees the tool calls, not the permission dialog, so it says "likely on". The deck still cannot allow, deny or answer anything for your agent, and it never will.'},{title:"🧮 Today's figure was counting some sessions twice",body:`The panel reads your usage from ccusage once a minute and fills the gap in between from what the deck is watching. The filling-in was wrong: any session that reached the canvas after the reading had landed was added in full, and since the canvas is still loading when the first reading arrives, that was most of them.
178
-
179
- Measured on a deck four seconds old: ccusage said $450 for today and the panel said $1,006. The table underneath it said $450 the whole time, which is the disagreement to trust.
180
-
181
- The deck now adds only work it has actually watched happen. A session that starts while you are looking shows up at the next reading instead of instantly — up to a minute — which is how the panel behaved before the live figure existed at all. Everything already on screen keeps moving as it did.`}],"3.6.0":[{title:"✂️ The two figures at the end of the top bar are gone",body:`The bar used to end with a token count and a dollar figure. Both were sums over what is on the canvas at that moment, and the canvas drops finished sessions a couple of minutes after they end — so both numbers fell on their own, with nothing on screen to explain the fall. They carried the word "board" and a three-line tooltip for exactly that reason.
182
-
183
- The usage panel answers the same question without the apology: it reads the logs on disk, it covers sessions this deck never watched, and it does not forget. Press U for the panel, or H for the full history.
184
-
185
- What is left in the bar is what is true right now — whether the stream is alive, and what your machine is doing.`}],"3.5.0":[{title:"⚡ The figures move when the work happens",body:`Reading your usage off the logs is not free — measured here, one reading is 7.8 seconds of CPU, because ccusage walks every transcript on the machine whatever period you asked for. Once a minute is affordable; once every ten seconds would be three quarters of a core, permanently, for numbers that move slowly.
186
-
187
- So the reading stays on a minute and the deck fills the gap with what it already knows. Every hook event carries its session's running total, so the panel adds whatever has been spent since the last reading and counts up to it. The headline now moves when a turn finishes rather than on the clock, and it costs nothing extra.
188
-
189
- It only ever adds. A session leaving the canvas cannot pull the figure down, and the next reading corrects whatever the estimate got wrong — the tokens are exact, and the dollars in between are priced by the deck's own table.
190
-
191
- Two smaller things with it: pressing today, month or all now counts between the two figures instead of swapping them, and coming back to the tab only re-reads if what is on screen is actually stale.`}],"3.4.0":[{title:"🔢 The figures count to their new value, once a minute",body:`The Usage panel re-reads its numbers every minute now rather than every five, and it is a real minute — the server used to hold a reading for two, so a shorter poll would have handed the same figure back.
192
-
193
- And they no longer teleport. Replaced in a single frame, $170 → $269 says only "this is different now": no direction, no sense of how much, and nothing at all if your eye was a few pixels away. Counted over a fifth of a second, the same change says up, and roughly how far.
194
-
195
- What deliberately does not count: the first paint, a change of period — "today" and "all time" are different quantities rather than one that moved — the tables, a change too small to read, and anything at all if you have reduced motion on or the tab is in the background.`},{title:"🧹 The board's own figure is out of the Usage panel",body:`3.3.0 put the canvas's live spend on its own labelled line, under whichever period you had chosen. In front of a panel that answers today, this month and all time from the logs on disk, that second money figure answers a question nobody asked at that moment — and it invited a comparison it could never win, $7,385 on the board beneath $170 for today.
196
-
197
- It is gone. The board's tokens and cost are still on the topbar, with the sentence that explains why they fall on their own, and the panel still shows them when ccusage cannot answer at all.`}],"3.3.0":[{title:"📊 The Usage panel answers for a period, not just for the board",body:`It used to add up the sessions drawn on the canvas — which is an honest number with a scope nobody reads it as having: finished sessions are evicted a couple of minutes after they end, so the figure fell on its own while nothing had happened and nothing was refunded.
198
-
199
- It now reads ccusage, the same source the H modal uses, and offers today, this month and all time. BY MODEL and BY SESSION come from there too, and each session is named by the project the board knows it as rather than by a uuid.
200
-
201
- The live figure is still there, on its own line and labelled — what the sessions currently on the board have spent — because that is a different question from what the month cost.
202
-
203
- One thing worth knowing about the source: ccusage reports a session's LIFETIME total, so the rows under "active today" can add up to more than the day above them. The heading says so.`},{title:"🪟 Windows: a deck started from an elevated terminal was being treated as dead",body:"The hook decides whether a deck is still running by trying to signal it. On POSIX a process you may not signal answers EPERM; on Windows it answers EACCES, and only EPERM was accepted — so a deck started from an elevated terminal, or under another account, read as gone. Its registration was deleted on every event and rewritten five seconds later, while its banner went on saying it was connected and almost nothing arrived.\n\nThree more Windows-only faults went with it: a read-only settings.json made every hook install fail for good (the atomic write could not replace the file); the machine panel answered 500 every four seconds whenever the process read failed; and a bare command name was looked for in the working directory before PATH, which is where `npx ccdeck` was run."},{title:"👁 Browser Watch reads nothing while it is switched off",body:`The switch used to control only what was KEPT. The read happened anyway — every five minutes, on every deck, the panel's badge poll discovered each Chromium profile and copied its whole History database to a temp file to query it. A switch that says off while that continues is not a switch.
204
-
205
- With the watch off, nothing touches a browser now. Opening the panel still reads live, because that is you looking, and a watch that is ON still records in the background — that is the feature. The trade is that the topbar badge no longer counts findings while the watch is off; open the panel to see them.
206
-
207
- The README has a Browser Watch section now: what is read, when, where the copy goes, and that only visits after the deck started are ever considered.`},{title:"🔒 The deck's own data is no longer readable by anything on the machine",body:"Changing an account needed the deck's credential; reading the event ring did not. Anything running on your machine could `curl` the events — prompt text, the commands an agent ran, the paths and contents it touched — plus the account list and the browsing episodes.\n\nThose reads now answer to the same rule the mutations do: the deck's own page, or its token. Nothing changes for you in the browser. A script of yours that reads those routes needs the token from `~/.claude/agent-dag/<pid>.json`, sent as `x-ccdeck-token`."},{title:"💳 An API-key, Bedrock or Vertex install is told there is no quota window",body:`Those installs are billed per token and have no five-hour window. The CLI ran, printed no quota lines, and the deck read that as a genuine "under 1%" — drawing two empty bars for a measurement nobody had taken, or telling you to run /usage, which cannot help there.
208
-
209
- It now says what it is, in one line, the way the Codex half already did.`},{title:"🎨 The model chip is coloured by its model again",body:`A session that switched model — Sonnet, then Opus — drew a chip reading "Opus 5 +1" in Sonnet blue, because the colour was picked from the tooltip and the tooltip lists every model the card's spend covers. Add a Fable turn and it went yellow.
210
-
211
- Also fixed on the way past: an account import the CLI rejected could take the whole deck down with it, and a corrupt compressed Codex rollout leaked a file handle on every poll.`}],"3.2.1":[{title:"💵 Sonnet 5 was being costed fifty per cent high",body:`Sonnet 5 launched at $2/$10 per million tokens as introductory pricing, with a rise to $3/$15 announced for September 1. The deck implemented that schedule, and on September 1 it started charging the higher rate.
212
-
213
- The increase was cancelled. Anthropic's pricing page now says the $2/$10 rate is simply the price and the rise "will not occur" — so every Sonnet 5 session since the 1st has been shown to you at half again what it cost.
214
-
215
- It is corrected, and there is no date logic left in that rate to go stale a second time. Numbers already on your board are recomputed from the log the next time the deck starts; nothing was billed by us, only displayed.
216
-
217
- Fable 5.1 and Mythos 5.1 are also priced now, including the cache read that is a quarter of Fable 5's — which is most of what a long session pays for.`}],"3.2.0":[{title:"🌡️ Windows shows a temperature where it can find one",body:`On most Windows laptops there is nothing to show, and that is Windows rather than this deck: modern machines declare no ACPI thermal zone, and the sensors that do exist sit behind an interface only an administrator may read. Measured on real hardware, elevated and not.
218
-
219
- One thing does work, and it costs you nothing to have. If LibreHardwareMonitor happens to be running with its web server on, the deck now reads its numbers over localhost — which needs no privileges at all.
220
-
221
- It is only ever a read. Nothing is installed, nothing is asked of you, and a machine without it shows no section, exactly as before.`}],"3.1.0":[{title:"🚀 The first run stops looking like it hung",body:`\`npx ccdeck\` on a machine that has never run it used to sit on a spinner at "checking claude-swap" and say nothing else. Measured on a Windows box: seventeen and a half seconds before it told you where to point a browser. It is now one and a half.
222
-
223
- The deck was waiting for an install nobody asked for during that boot — a Python toolchain being fetched so the accounts panel would work. The port had been open the whole time; there was just nothing on screen to say so.
224
-
225
- It no longer waits. Anything still working past the boot says so on its own line and keeps going in the background, and the deck comes up without it.`},{title:"⚡ Every start is quicker, and stays quicker",body:`The event log was read from the beginning on every boot to fill a buffer that only keeps the last two thousand events — so four fifths of that reading existed to be thrown away, and it got slower the longer you had been using the deck. It reads from the end now and stops when the buffer is full: 258ms down to 20ms here, on a 34 MB log, and it no longer grows.
226
-
227
- The accounts tool is also asked for its version once instead of twice, which on this machine was the single largest thing in an ordinary boot.`},{title:"📉 Ten fewer packages to install",body:"Opening your browser used to cost a dependency that brought nine more with it — ten downloads on a cold `npx ccdeck` before the deck's own files were unpacked. It is now done with the commands the operating system already has.\n\nThe package has no runtime dependencies at all."},{title:"🌡️ Temperature, on the machines that could not show it",body:`On Windows the deck was asking somewhere it is not allowed to look: that reading lives behind a namespace that needs administrator, so it failed for everybody and the section never appeared. It reads a performance counter now, which needs nothing.
228
-
229
- On Apple Silicon there is no command that ships with macOS which prints a temperature at all — the sensors are behind an interface only native code can reach. The deck fetches a small signed tool for it, verified against the checksum its release publishes, in the background and only on the Macs that need it. You do not have to install anything. \`AGENTS_DECK_NO_DOWNLOAD=1\` turns that off.
230
-
231
- A machine with no sensor still shows no section, which includes every virtual machine. Nothing is drawn that was not measured.`},{title:"😌 The terminal goes quiet when there is nothing happening",body:`The dot at the bottom blinked every 800ms for as long as the deck ran, which is what a terminal does while it is working — so a deck that had finished in a second looked like one that never finished.
232
-
233
- It now moves only while something actually is: a job still running, or hooks that cannot find the deck. Otherwise it is drawn once and left alone, and it says what the job is rather than just blinking. A step that takes more than three seconds shows how long it has been going, which is the whole of "is this stuck".
234
-
235
- And a machine with no Claude Code installed stops being told about it every few seconds — that one is said once now, on its own line instead of across the status line.`}],"3.0.0":[{title:"📈 The machine panel now shows what it DID, not just what it is",body:`Click any section of the machine panel — Cores, Memory, Load average, Thermal — and it opens a chart of what that reading has done since the deck started.
236
-
237
- The panel could always tell you the machine is busy now. It could not tell you whether it got hot while that three-hour build was running, or how deep the queue went while you were away, and those are the questions you actually have afterwards.
238
-
239
- Thermal is new as well. Where the machine will give degrees, it gives degrees; on a Mac it also reports whether the CPU is being held back to cool down, which is the consequence a temperature has to be interpreted into anyway. Nothing is drawn that was not measured — a machine with no sensor gets no section at all, rather than a zero.`},{title:"🔍 The whole process list, not just the busiest eight",body:`"more" beside Busiest processes opens the full list the deck is watching — around fifty processes rather than eight — with the pid and the untruncated name.
240
-
241
- This closes a gap. The panel's eight rows are the busiest, so sorting them by name only reorders those eight: "is my test runner still going" could not be answered if the test runner was not already on screen. Now it can.
242
-
243
- It is deliberately not a task manager. Nothing here ends a process; Activity Monitor and Task Manager are better at that and it is not a thing this deck should own.`},{title:"🔤 Process names in Cyrillic, Greek or with accents read correctly",body:`An application named Яндекс Музыка was showing up as M-PM-/M-PM-=M-PM-4M-PM-5… in the process list, and so was every other name the deck could not spell in plain ASCII.
244
-
245
- The deck was forcing a fixed locale on the commands it runs, to guarantee that a decimal point stays a point on a machine set to German or Russian — and that also forced the character set. It forces only the number format now. Your own character set is left alone, which is what makes the name arrive intact.`},{title:"📦 The text you copy to share accounts is a third of its size",body:`Sharing three accounts used to produce 6168 characters. It is now 1896.
246
-
247
- Most of that text was never the credentials — two OAuth tokens are about two hundred characters between them, and the rest was the envelope, whose field names repeated in full for every account added. So the saving grows with the number of accounts rather than shrinking.
248
-
249
- A blob you copied before this still imports until it expires. One made now cannot be read by a deck older than this version — that is the one thing in this release that older decks cannot follow.`}],"1.48.0":[{title:"👁 Browser Watch — see what a program opened while you were away",body:`There is a new eye in the top bar. It watches the browsers on this machine and tells you when a program — an extension, an agent, a command — opened pages while nobody was touching the browser.
250
-
251
- Usually that is your own agent doing what you asked, and the panel says so rather than crying intrusion. What it gives you is the evidence: which pages, in which browser, at what time, with every address written out in full.
252
-
253
- It is off until you switch it on, and nothing leaves this machine. It reads a copy of the browser's own history and only pages newer than the moment the deck started — never anything from before, never cookies, never saved passwords. Open ⚙ inside the panel and "What Browser Watch can access" says exactly what it reads, keeps and sends.
254
-
255
- When it finds something the eye turns amber with a count. You can dismiss a finding once you have looked at it and it stays gone, while the log file on disk keeps the record. On a Mac it can also close the tab it found, or quit the browser.`},{title:"🔑 Move all your accounts to another machine in one paste",body:`Sharing accounts between two decks used to be one account at a time, and step four of six is where people stop — leaving the second deck half set up with nothing saying so.
256
-
257
- Pick the accounts you want, copy one blob, paste it into the other deck. The import adds what is missing, leaves what already works alone, heals an account whose token has died, and tells you which of those happened to each one.
258
-
259
- The blob carries real credentials, so it expires ten minutes after you make it and the deck refuses an expired one before it unwraps anything.`}],"1.47.0":[{title:"🔌 The top bar goes quiet when everything is fine",body:`The green "live" pill used to sit up there permanently to tell you nothing was broken. It is gone while things are working.
260
-
261
- You will still see a pill when it matters: amber when you pause the canvas, with how many events are waiting, and red when the deck loses its connection to the server. No pill means all is well.`},{title:"🔴 The browser tab tells you when the connection drops",body:`The little icon in the tab has always shown what your sessions are doing — grey when it is quiet, blue when something is working, amber when a session is waiting on you.
262
-
263
- It could not say the one thing that matters most: that the deck has stopped hearing from the server. Until now it just kept showing whatever it had last seen. It turns into a broken red ring instead, so you can spot it from another tab without switching over.`}],"1.46.0":[{title:"🔊 Pick a volume and a sound for each of the two tones",body:`Click the speaker in the top bar and a small menu opens. There are two tones — one when a turn finishes, one when Claude is waiting for you — and each has its own volume and its own sound, six to choose from. Press "Hear it" to try one straight away, without waiting for a real turn.
264
-
265
- The two lists are separate on purpose, so you can never end up with both tones sounding the same. A finish tone always falls; an asking tone always rises. That is how you tell them apart without looking at the screen.
266
-
267
- M still turns the sound on and off from anywhere.`},{title:"✨ This box is new",body:`After an update, the deck tells you what changed — once, and only when there is something worth telling. Most updates have nothing to say and you will see nothing at all.
268
-
269
- Click the version at the top of the deck to read it again whenever you like.`}],"1.45.0":[{title:"🔕 The deck no longer puts anything in your settings.json",body:"It used to add a hook there so Claude Code would play a sound when a turn ended. That entry is removed the first time you start this version, and any sound hook you wrote yourself is put back exactly where you had it. Nothing else in that file is touched. The deck makes the sound itself now — which is also why you finally hear one when a Codex turn ends, not just a Claude one."}],"3.16.0":[{title:"🤝 Pair two decks with one piece of text",body:`**Accounts ▸ Local network ▸ setup… ▸ make an invite.** Send the text however you already talk to them; they paste it and the two decks are paired. Nobody presses accept, and neither of you has to know which of your addresses the other can reach — the invite carries them all and their deck tries each one.
270
-
271
- Decks on the same router still find each other on their own and appear under **on this network right now**. An invite is for the case that does not work: another subnet, a VPN, a firewall.
272
-
273
- The invite lasts 10 minutes and is used once. Anyone who gets hold of the text can pair with your deck until it runs out, so send it the way you would send anything else you would not want forwarded.`},{title:"⚠️ Both machines have to be on this version",body:`The two decks no longer speak the old protocol, and there is no fallback: a 3.15 deck and a 3.16 deck cannot see each other at all. Update both.
274
-
275
- The group passphrase is gone. If you had one set, that pairing is not carried over — make an invite and pair again. It was replaced because a passphrase that differs by one character produced a closed socket and no other symptom on either machine, and a secret is the one thing a panel must never print, so neither person could check theirs against the other's.`}],"3.22.1":[{title:"🖥️ A first run now opens This machine too",body:`Accounts and usage already opened themselves the first time you ran the deck; the machine panel did not, and now does. It is the panel that answers "is this box coping" — cores, memory, load, temperature — and somebody meeting the deck for the first time cannot ask for a panel they do not know is there.
276
-
277
- It only does this when you have never said otherwise. Close it once and it stays closed, on that browser, for good — the same rule the other two panels have always followed. Nothing reopens it behind you.
278
-
279
- While it is open it polls this machine once every few seconds, and it stops the moment you close it or switch tabs.`}],"3.22.4":[{title:"📈 A card stops looking idle while it is thinking",body:`The activity chart on each card counted tool calls and nothing else, so the time an agent spends reading, reasoning and writing drew as a flat line — measured on this machine, 16.5% of all working time, more than the time spent inside the tools themselves. A session that was busy looked exactly like one that had died, and the only way to tell them apart was to wait and see whether anything ever appeared.
280
-
281
- It marks that work now. A chart with bars in it means the agent is doing something, whether or not it has called a tool in the last minute; a flat chart means it genuinely is not. Hover it for the split — how many tool calls and how many blocks of thinking and writing landed in the last 60 seconds.
282
-
283
- Nothing was added to the card and nothing new is polled. The deck already reads each session's transcript for its token counts; this reads the same file for what the model has finished writing, and a session that is quiet costs one file check per second and a half.`}]},x0="agent-dag.releaseNotesSeen";function aN(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Hi(e,t){const n=aN(e),r=aN(t);for(let a=0;a<Math.max(n.length,r.length);a++){const l=(n[a]??0)-(r[a]??0);if(l!==0)return l<0?-1:1}return 0}function Ui(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function cH(e){if(!e||typeof e!="object")return!1;const{title:t,body:n}=e;return typeof t=="string"&&t.trim()!==""&&typeof n=="string"&&n.trim()!==""}function uH(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,r]of Object.entries(e)){if(!Ui(n)||!Array.isArray(r))continue;const a=r.filter(cH);a.length&&t.push({version:n,notes:a})}return t.sort((n,r)=>Hi(r.version,n.version))}const oN=uH(lH);function AR(e,t,n){return e.filter(r=>Hi(r.version,n)<=0&&(t===null||Hi(r.version,t)>0))}function dH(e,t){return e.filter(n=>Hi(n.version,t)===0)}function hH(e){if(!e.length)return"";const t=e[0].version,n=e[e.length-1].version;return t===n?`v${t}`:`v${n} – v${t}`}function fH({since:e,running:t,entries:n,firstRun:r}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const c=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${c} changed something you would notice. Clicking the version in the topbar brings this back.`}if(r&&Ui(t))return`The deck has not run in this browser before, so this is what v${t} — the release you have — changed. Earlier releases are not repeated here; clicking the version in the topbar brings all of them back.`;const a=n[0].version;if(!Ui(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const l=Hi(a,t);return l<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:l>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const pH=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function mH(e){const t=pH.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function iN(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function gH(e){if(!e)return null;let t=null;try{t=e.getItem(x0)}catch{return null}return Ui(t)?t:null}function yH(e){if(!e)return!1;try{return e.getItem(x0),!0}catch{return!1}}function wH(e,t){if(!e)return!1;try{return e.setItem(x0,t),!0}catch{return!1}}const RR="agent-dag.tourSeen";function vH(e){if(!e)return!1;try{return e.getItem(RR)==="1"}catch{return!1}}function xH(e){if(!e)return!1;try{return e.setItem(RR,"1"),!0}catch{return!1}}function bH({tourSeen:e,decision:t}){if(t.reason==="no-version"||t.reason==="cannot-remember")return{tour:!1,notes:"none"};if(t.reason==="welcome"||t.reason==="first-run")return{tour:!e,notes:"none"};const n=t.show.length>0;return e?{tour:!1,notes:n?"now":"none"}:{tour:!0,notes:n?"after":"none"}}function kH({stored:e,running:t,notes:n,remembers:r=!0}){if(!Ui(t))return{show:[],record:null,reason:"no-version"};if(!Ui(e)){if(!r)return{show:[],record:t,reason:"cannot-remember"};const c=dH(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=Hi(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const l=AR(n,e,t);return l.length?{show:l,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function _H(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const r=e.indexOf("`",n+1);if(r<0)break;n=r+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function MR(e,t=!0){const n=[];let r="";const a=()=>{r&&(n.push({kind:"text",text:r}),r="")};let l=0;for(;l<e.length;){if(e[l]==="`"){const c=e.indexOf("`",l+1);if(c>l+1){a(),n.push({kind:"code",text:e.slice(l+1,c)}),l=c+1;continue}}else if(t&&e.startsWith("**",l)){const c=_H(e,l);if(c>0){a(),n.push({kind:"bold",kids:MR(e.slice(l+2,c),!1)}),l=c+2;continue}}r+=e[l],l+=1}return a(),n}function NH({entries:e,since:t,running:n,firstRun:r,onClose:a,onTour:l}){const c=rn(a),u=hH(e);return i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:c,className:"modal release-notes",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),u&&i.jsx("span",{className:"modal-tool-id",children:u})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("p",{className:"modal-note",children:fH({since:t,running:n,firstRun:r,entries:e})}),l&&i.jsxs("div",{className:"guide-door",children:[i.jsx("span",{children:"Eight pictures of what the deck shows."}),i.jsx("button",{type:"button",className:"btn",onClick:l,children:"Take the tour"})]}),e.map(f=>i.jsxs("section",{className:"modal-section",children:[i.jsxs("h3",{className:"rn-version",children:["v",f.version]}),i.jsx("ul",{className:"rn-notes",children:f.notes.map((p,h)=>{const{icon:m,rest:y}=mH(p.title);return i.jsxs("li",{className:"rn-note",children:[i.jsxs("p",{className:"rn-note-title",children:[m&&i.jsx("span",{className:"rn-note-icon",children:m}),y]}),i.jsx("p",{className:"rn-note-body",children:IR(MR(p.body))})]},h)})})]},f.version))]})]})})}function IR(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?i.jsx("code",{className:"rn-code",children:t.text},n):i.jsx("strong",{className:"rn-strong",children:IR(t.kids)},n))}function SH(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function jH(e,t,n){var c;if(e.length===0)return null;const r=SH(e),a=t?r.findIndex(u=>u.id===t):-1,l=a===-1?n===1?0:r.length-1:(a+n+r.length)%r.length;return((c=r[l])==null?void 0:c.id)??null}const EH=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function CH(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:EH.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const TH=new Set(["","BODY","HTML","#DOCUMENT"]);function AH(e){return!e||l0(e)?!1:!TH.has(String(e.tagName??"").toUpperCase())}function xd(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function RH(e,t){let n=!1;for(const a of e)if(!t.has(a)){n=!0;break}if(!n)return e;const r=new Set;for(const a of e)t.has(a)&&r.add(a);return r}function MH(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(c0(n.id));return t}function IH(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(c0(n.id));return t}function $H(e,t){if(!t||!e.agents.get(t))return null;const r=new Set([t]);let a=t;for(;a;){const c=e.agents.get(a);if(!(c!=null&&c.parentId)||r.has(c.parentId))break;r.add(c.parentId),a=c.parentId}let l=!0;for(;l;){l=!1;for(const c of e.agents.values())c.parentId&&r.has(c.parentId)&&!r.has(c.id)&&(r.add(c.id),l=!0)}return r}function OH(e,t){const n=new Set;for(const r of t){const a=$H(e,r);if(a)for(const l of a)n.add(l)}return n.size>0?n:null}function Od(e,t,n){return!t.has(e)||n.has(e)}function LH(e,t,n,r){return!t.has(e)&&Od(e,n,r)}function PH(e,t,n){const r={x:0,y:0};return t.set(e,r),n.add(e),r}function lN(e,t,n,r){n.set(e,t),r.delete(e)}const DH=40,qH=120;function FH(e,t){let n=null,r=0,a=Number.NEGATIVE_INFINITY;const l=()=>{n=null,a=t.now(),e()},c=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(f,p,h)=>{if(n!=null){if(r<=f)return;c()}const m=Math.min(h,Math.max(0,f-p));r=f,n=t.setTimeout(l,m)};return{live(f=DH){const p=t.now(),h=Math.max(a+f,p);if(h<=p){c(),l();return}u(h,p,f)},replay(f=qH){c(),r=t.now()+f,n=t.setTimeout(l,f)},flush(){c(),l()},cancel(){c()}}}const BH=1e3;function zH(e={}){const t=Math.max(1,Math.floor(e.limit??BH)),n=e.protect;let r=!1,a=[],l=new Set,c=0,u=0,f=null;return{get paused(){return r},get size(){return a.length},get dropped(){return c},get overflowed(){return c>0},get through(){return u},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,m=(p==null?void 0:p.epoch)??null,y=m!==null&&m!==f;y&&(f=m,u=0);const w=h!==null&&!y&&h<=u;if(h!==null&&h>u&&(u=h),!r)return!0;if(w)return!1;if(a.push(p),n!=null&&n(p)&&l.add(p),a.length>t){let N=0;if(l.size<a.length)for(;l.has(a[N]);)N++;const[k]=a.splice(N,1);l.delete(k),c++}return!1},setPaused(p){if(r=p,p)return[];const h=a;return a=[],l=new Set,c=0,h}}}const $R="agent-dag.theme";function HH(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function UH(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function WH(){return HH(Sa($R),UH())}const VH=6,GH="ccdeck-tabs";function KH(e){return e>=VH}function YH(e,t,n){const r=a=>{const l=a.data;(l==null?void 0:l.kind)==="who"&&l.from!==t&&e.postMessage({kind:"here",from:t,to:l.from,streaming:n()})};return e.addEventListener("message",r),{ask(a,l=(c,u)=>setTimeout(c,u)){return new Promise(c=>{const u=new Set,f=p=>{const h=p.data;(h==null?void 0:h.kind)==="here"&&h.to===t&&h.streaming&&u.add(h.from)};e.addEventListener("message",f),e.postMessage({kind:"who",from:t}),l(()=>{e.removeEventListener("message",f),c(u.size)},a)})},leave(){var a;e.removeEventListener("message",r),(a=e.close)==null||a.call(e)}}}function XH({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Yt}`:Yt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const bd={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function kd(e,t){const a=c=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${c}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?a(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):a("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const ZH=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(kd(bd.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(kd(bd.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(kd(bd.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(kd(bd.idle,"idle"))}`}),QH="No sessions are waiting for you.";function JH(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const r=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${r} are waiting for your permission.`}function eU(e,t){return t!==""?t:e===""?"":QH}const cN="agent-dag.browserWatch.seenMs";function tU(e,t){return e.filter(n=>n.startMs>t)}function nU(e,t){const n=(e??[]).filter(a=>a&&typeof a.fp=="string"&&!t.has(a.fp));if(!n.length)return{request:null,waiting:0};const r=[...n].sort((a,l)=>(a.at??0)-(l.at??0));return{request:r[0],waiting:r.length-1}}function rU({request:e,waiting:t,busy:n,now:r,onAccept:a,onDecline:l,onLater:c}){const u=x.useRef(null),f=rn(c,{focusRef:u}),p=Na(n,"accept"),h=Na(n,"dismiss");return i.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:i.jsxs("div",{ref:f,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("i",{className:"ap-pulse","aria-hidden":!0}),i.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:c,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsxs("p",{className:"lan-ask-who",children:[i.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",i.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",w0(e.at,r)]}),i.jsx("p",{className:"modal-note",children:"Paired decks repair each other's expired logins. Accept only if you know this machine — what it shares is an account, not a screen."}),i.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",i.jsx("code",{className:"ap-lan-code",children:e.fp})," — that machine shows its own under This deck on the network; the two should match."]}),t>0&&i.jsx("p",{className:"lan-ask-more",children:t===1?"One more deck is waiting behind this one.":`${t} more decks are waiting behind this one.`}),i.jsxs("div",{className:"lan-ask-acts",children:[i.jsx("button",{type:"button",ref:u,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:l,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),i.jsx("button",{type:"button",className:"btn primary",disabled:p.disabled,"aria-busy":p.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function b0(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Op,uN;function sU(){if(uN)return Op;uN=1;function e(){this.__data__=[],this.size=0}return Op=e,Op}var Lp,dN;function Vi(){if(dN)return Lp;dN=1;function e(t,n){return t===n||t!==t&&n!==n}return Lp=e,Lp}var Pp,hN;function jh(){if(hN)return Pp;hN=1;var e=Vi();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return Pp=t,Pp}var Dp,fN;function aU(){if(fN)return Dp;fN=1;var e=jh(),t=Array.prototype,n=t.splice;function r(a){var l=this.__data__,c=e(l,a);if(c<0)return!1;var u=l.length-1;return c==u?l.pop():n.call(l,c,1),--this.size,!0}return Dp=r,Dp}var qp,pN;function oU(){if(pN)return qp;pN=1;var e=jh();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return qp=t,qp}var Fp,mN;function iU(){if(mN)return Fp;mN=1;var e=jh();function t(n){return e(this.__data__,n)>-1}return Fp=t,Fp}var Bp,gN;function lU(){if(gN)return Bp;gN=1;var e=jh();function t(n,r){var a=this.__data__,l=e(a,n);return l<0?(++this.size,a.push([n,r])):a[l][1]=r,this}return Bp=t,Bp}var zp,yN;function Eh(){if(yN)return zp;yN=1;var e=sU(),t=aU(),n=oU(),r=iU(),a=lU();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=r,l.prototype.set=a,zp=l,zp}var Hp,wN;function cU(){if(wN)return Hp;wN=1;var e=Eh();function t(){this.__data__=new e,this.size=0}return Hp=t,Hp}var Up,vN;function uU(){if(vN)return Up;vN=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return Up=e,Up}var Wp,xN;function dU(){if(xN)return Wp;xN=1;function e(t){return this.__data__.get(t)}return Wp=e,Wp}var Vp,bN;function hU(){if(bN)return Vp;bN=1;function e(t){return this.__data__.has(t)}return Vp=e,Vp}var Gp,kN;function OR(){if(kN)return Gp;kN=1;var e=typeof Ju=="object"&&Ju&&Ju.Object===Object&&Ju;return Gp=e,Gp}var Kp,_N;function Ur(){if(_N)return Kp;_N=1;var e=OR(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Kp=n,Kp}var Yp,NN;function Gi(){if(NN)return Yp;NN=1;var e=Ur(),t=e.Symbol;return Yp=t,Yp}var Xp,SN;function fU(){if(SN)return Xp;SN=1;var e=Gi(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function l(c){var u=n.call(c,a),f=c[a];try{c[a]=void 0;var p=!0}catch{}var h=r.call(c);return p&&(u?c[a]=f:delete c[a]),h}return Xp=l,Xp}var Zp,jN;function pU(){if(jN)return Zp;jN=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Zp=n,Zp}var Qp,EN;function Co(){if(EN)return Qp;EN=1;var e=Gi(),t=fU(),n=pU(),r="[object Null]",a="[object Undefined]",l=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?a:r:l&&l in Object(u)?t(u):n(u)}return Qp=c,Qp}var Jp,CN;function yr(){if(CN)return Jp;CN=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Jp=e,Jp}var em,TN;function Ec(){if(TN)return em;TN=1;var e=Co(),t=yr(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",l="[object Proxy]";function c(u){if(!t(u))return!1;var f=e(u);return f==r||f==a||f==n||f==l}return em=c,em}var tm,AN;function mU(){if(AN)return tm;AN=1;var e=Ur(),t=e["__core-js_shared__"];return tm=t,tm}var nm,RN;function gU(){if(RN)return nm;RN=1;var e=mU(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return nm=n,nm}var rm,MN;function LR(){if(MN)return rm;MN=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return rm=n,rm}var sm,IN;function yU(){if(IN)return sm;IN=1;var e=Ec(),t=gU(),n=yr(),r=LR(),a=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,f=c.toString,p=u.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var w=e(y)?h:l;return w.test(r(y))}return sm=m,sm}var am,$N;function wU(){if($N)return am;$N=1;function e(t,n){return t==null?void 0:t[n]}return am=e,am}var om,ON;function To(){if(ON)return om;ON=1;var e=yU(),t=wU();function n(r,a){var l=t(r,a);return e(l)?l:void 0}return om=n,om}var im,LN;function k0(){if(LN)return im;LN=1;var e=To(),t=Ur(),n=e(t,"Map");return im=n,im}var lm,PN;function Ch(){if(PN)return lm;PN=1;var e=To(),t=e(Object,"create");return lm=t,lm}var cm,DN;function vU(){if(DN)return cm;DN=1;var e=Ch();function t(){this.__data__=e?e(null):{},this.size=0}return cm=t,cm}var um,qN;function xU(){if(qN)return um;qN=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return um=e,um}var dm,FN;function bU(){if(FN)return dm;FN=1;var e=Ch(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(l){var c=this.__data__;if(e){var u=c[l];return u===t?void 0:u}return r.call(c,l)?c[l]:void 0}return dm=a,dm}var hm,BN;function kU(){if(BN)return hm;BN=1;var e=Ch(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var l=this.__data__;return e?l[a]!==void 0:n.call(l,a)}return hm=r,hm}var fm,zN;function _U(){if(zN)return fm;zN=1;var e=Ch(),t="__lodash_hash_undefined__";function n(r,a){var l=this.__data__;return this.size+=this.has(r)?0:1,l[r]=e&&a===void 0?t:a,this}return fm=n,fm}var pm,HN;function NU(){if(HN)return pm;HN=1;var e=vU(),t=xU(),n=bU(),r=kU(),a=_U();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=r,l.prototype.set=a,pm=l,pm}var mm,UN;function SU(){if(UN)return mm;UN=1;var e=NU(),t=Eh(),n=k0();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return mm=r,mm}var gm,WN;function jU(){if(WN)return gm;WN=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return gm=e,gm}var ym,VN;function Th(){if(VN)return ym;VN=1;var e=jU();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return ym=t,ym}var wm,GN;function EU(){if(GN)return wm;GN=1;var e=Th();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return wm=t,wm}var vm,KN;function CU(){if(KN)return vm;KN=1;var e=Th();function t(n){return e(this,n).get(n)}return vm=t,vm}var xm,YN;function TU(){if(YN)return xm;YN=1;var e=Th();function t(n){return e(this,n).has(n)}return xm=t,xm}var bm,XN;function AU(){if(XN)return bm;XN=1;var e=Th();function t(n,r){var a=e(this,n),l=a.size;return a.set(n,r),this.size+=a.size==l?0:1,this}return bm=t,bm}var km,ZN;function _0(){if(ZN)return km;ZN=1;var e=SU(),t=EU(),n=CU(),r=TU(),a=AU();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=r,l.prototype.set=a,km=l,km}var _m,QN;function RU(){if(QN)return _m;QN=1;var e=Eh(),t=k0(),n=_0(),r=200;function a(l,c){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<r-1)return f.push([l,c]),this.size=++u.size,this;u=this.__data__=new n(f)}return u.set(l,c),this.size=u.size,this}return _m=a,_m}var Nm,JN;function Ah(){if(JN)return Nm;JN=1;var e=Eh(),t=cU(),n=uU(),r=dU(),a=hU(),l=RU();function c(u){var f=this.__data__=new e(u);this.size=f.size}return c.prototype.clear=t,c.prototype.delete=n,c.prototype.get=r,c.prototype.has=a,c.prototype.set=l,Nm=c,Nm}var Sm,eS;function N0(){if(eS)return Sm;eS=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a&&n(t[r],r,t)!==!1;);return t}return Sm=e,Sm}var jm,tS;function PR(){if(tS)return jm;tS=1;var e=To(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return jm=t,jm}var Em,nS;function Rh(){if(nS)return Em;nS=1;var e=PR();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return Em=t,Em}var Cm,rS;function Mh(){if(rS)return Cm;rS=1;var e=Rh(),t=Vi(),n=Object.prototype,r=n.hasOwnProperty;function a(l,c,u){var f=l[c];(!(r.call(l,c)&&t(f,u))||u===void 0&&!(c in l))&&e(l,c,u)}return Cm=a,Cm}var Tm,sS;function Cc(){if(sS)return Tm;sS=1;var e=Mh(),t=Rh();function n(r,a,l,c){var u=!l;l||(l={});for(var f=-1,p=a.length;++f<p;){var h=a[f],m=c?c(l[h],r[h],h,l,r):void 0;m===void 0&&(m=r[h]),u?t(l,h,m):e(l,h,m)}return l}return Tm=n,Tm}var Am,aS;function MU(){if(aS)return Am;aS=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return Am=e,Am}var Rm,oS;function hs(){if(oS)return Rm;oS=1;function e(t){return t!=null&&typeof t=="object"}return Rm=e,Rm}var Mm,iS;function IU(){if(iS)return Mm;iS=1;var e=Co(),t=hs(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return Mm=r,Mm}var Im,lS;function Tc(){if(lS)return Im;lS=1;var e=IU(),t=hs(),n=Object.prototype,r=n.hasOwnProperty,a=n.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(c){return t(c)&&r.call(c,"callee")&&!a.call(c,"callee")};return Im=l,Im}var $m,cS;function Wt(){if(cS)return $m;cS=1;var e=Array.isArray;return $m=e,$m}var Ql={exports:{}},Om,uS;function $U(){if(uS)return Om;uS=1;function e(){return!1}return Om=e,Om}Ql.exports;var dS;function Ki(){return dS||(dS=1,(function(e,t){var n=Ur(),r=$U(),a=t&&!t.nodeType&&t,l=a&&!0&&e&&!e.nodeType&&e,c=l&&l.exports===a,u=c?n.Buffer:void 0,f=u?u.isBuffer:void 0,p=f||r;e.exports=p})(Ql,Ql.exports)),Ql.exports}var Lm,hS;function Ih(){if(hS)return Lm;hS=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var l=typeof r;return a=a??e,!!a&&(l=="number"||l!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return Lm=n,Lm}var Pm,fS;function S0(){if(fS)return Pm;fS=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Pm=t,Pm}var Dm,pS;function OU(){if(pS)return Dm;pS=1;var e=Co(),t=S0(),n=hs(),r="[object Arguments]",a="[object Array]",l="[object Boolean]",c="[object Date]",u="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",k="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",j="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",$="[object Uint8Array]",D="[object Uint8ClampedArray]",U="[object Uint16Array]",P="[object Uint32Array]",V={};V[j]=V[E]=V[C]=V[T]=V[R]=V[$]=V[D]=V[U]=V[P]=!0,V[r]=V[a]=V[S]=V[l]=V[b]=V[c]=V[u]=V[f]=V[p]=V[h]=V[m]=V[y]=V[w]=V[N]=V[k]=!1;function J(ee){return n(ee)&&t(ee.length)&&!!V[e(ee)]}return Dm=J,Dm}var qm,mS;function $h(){if(mS)return qm;mS=1;function e(t){return function(n){return t(n)}}return qm=e,qm}var Jl={exports:{}};Jl.exports;var gS;function j0(){return gS||(gS=1,(function(e,t){var n=OR(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===r,c=l&&n.process,u=(function(){try{var f=a&&a.require&&a.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}})();e.exports=u})(Jl,Jl.exports)),Jl.exports}var Fm,yS;function Ac(){if(yS)return Fm;yS=1;var e=OU(),t=$h(),n=j0(),r=n&&n.isTypedArray,a=r?t(r):e;return Fm=a,Fm}var Bm,wS;function DR(){if(wS)return Bm;wS=1;var e=MU(),t=Tc(),n=Wt(),r=Ki(),a=Ih(),l=Ac(),c=Object.prototype,u=c.hasOwnProperty;function f(p,h){var m=n(p),y=!m&&t(p),w=!m&&!y&&r(p),N=!m&&!y&&!w&&l(p),k=m||y||w||N,S=k?e(p.length,String):[],b=S.length;for(var j in p)(h||u.call(p,j))&&!(k&&(j=="length"||w&&(j=="offset"||j=="parent")||N&&(j=="buffer"||j=="byteLength"||j=="byteOffset")||a(j,b)))&&S.push(j);return S}return Bm=f,Bm}var zm,vS;function Oh(){if(vS)return zm;vS=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return zm=t,zm}var Hm,xS;function qR(){if(xS)return Hm;xS=1;function e(t,n){return function(r){return t(n(r))}}return Hm=e,Hm}var Um,bS;function LU(){if(bS)return Um;bS=1;var e=qR(),t=e(Object.keys,Object);return Um=t,Um}var Wm,kS;function E0(){if(kS)return Wm;kS=1;var e=Oh(),t=LU(),n=Object.prototype,r=n.hasOwnProperty;function a(l){if(!e(l))return t(l);var c=[];for(var u in Object(l))r.call(l,u)&&u!="constructor"&&c.push(u);return c}return Wm=a,Wm}var Vm,_S;function Ps(){if(_S)return Vm;_S=1;var e=Ec(),t=S0();function n(r){return r!=null&&t(r.length)&&!e(r)}return Vm=n,Vm}var Gm,NS;function ja(){if(NS)return Gm;NS=1;var e=DR(),t=E0(),n=Ps();function r(a){return n(a)?e(a):t(a)}return Gm=r,Gm}var Km,SS;function PU(){if(SS)return Km;SS=1;var e=Cc(),t=ja();function n(r,a){return r&&e(a,t(a),r)}return Km=n,Km}var Ym,jS;function DU(){if(jS)return Ym;jS=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return Ym=e,Ym}var Xm,ES;function qU(){if(ES)return Xm;ES=1;var e=yr(),t=Oh(),n=DU(),r=Object.prototype,a=r.hasOwnProperty;function l(c){if(!e(c))return n(c);var u=t(c),f=[];for(var p in c)p=="constructor"&&(u||!a.call(c,p))||f.push(p);return f}return Xm=l,Xm}var Zm,CS;function Ao(){if(CS)return Zm;CS=1;var e=DR(),t=qU(),n=Ps();function r(a){return n(a)?e(a,!0):t(a)}return Zm=r,Zm}var Qm,TS;function FU(){if(TS)return Qm;TS=1;var e=Cc(),t=Ao();function n(r,a){return r&&e(a,t(a),r)}return Qm=n,Qm}var ec={exports:{}};ec.exports;var AS;function FR(){return AS||(AS=1,(function(e,t){var n=Ur(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===r,c=l?n.Buffer:void 0,u=c?c.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var m=p.length,y=u?u(m):new p.constructor(m);return p.copy(y),y}e.exports=f})(ec,ec.exports)),ec.exports}var Jm,RS;function BR(){if(RS)return Jm;RS=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return Jm=e,Jm}var eg,MS;function zR(){if(MS)return eg;MS=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,l=0,c=[];++r<a;){var u=t[r];n(u,r,t)&&(c[l++]=u)}return c}return eg=e,eg}var tg,IS;function HR(){if(IS)return tg;IS=1;function e(){return[]}return tg=e,tg}var ng,$S;function C0(){if($S)return ng;$S=1;var e=zR(),t=HR(),n=Object.prototype,r=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,l=a?function(c){return c==null?[]:(c=Object(c),e(a(c),function(u){return r.call(c,u)}))}:t;return ng=l,ng}var rg,OS;function BU(){if(OS)return rg;OS=1;var e=Cc(),t=C0();function n(r,a){return e(r,t(r),a)}return rg=n,rg}var sg,LS;function T0(){if(LS)return sg;LS=1;function e(t,n){for(var r=-1,a=n.length,l=t.length;++r<a;)t[l+r]=n[r];return t}return sg=e,sg}var ag,PS;function Lh(){if(PS)return ag;PS=1;var e=qR(),t=e(Object.getPrototypeOf,Object);return ag=t,ag}var og,DS;function UR(){if(DS)return og;DS=1;var e=T0(),t=Lh(),n=C0(),r=HR(),a=Object.getOwnPropertySymbols,l=a?function(c){for(var u=[];c;)e(u,n(c)),c=t(c);return u}:r;return og=l,og}var ig,qS;function zU(){if(qS)return ig;qS=1;var e=Cc(),t=UR();function n(r,a){return e(r,t(r),a)}return ig=n,ig}var lg,FS;function WR(){if(FS)return lg;FS=1;var e=T0(),t=Wt();function n(r,a,l){var c=a(r);return t(r)?c:e(c,l(r))}return lg=n,lg}var cg,BS;function VR(){if(BS)return cg;BS=1;var e=WR(),t=C0(),n=ja();function r(a){return e(a,n,t)}return cg=r,cg}var ug,zS;function HU(){if(zS)return ug;zS=1;var e=WR(),t=UR(),n=Ao();function r(a){return e(a,n,t)}return ug=r,ug}var dg,HS;function UU(){if(HS)return dg;HS=1;var e=To(),t=Ur(),n=e(t,"DataView");return dg=n,dg}var hg,US;function WU(){if(US)return hg;US=1;var e=To(),t=Ur(),n=e(t,"Promise");return hg=n,hg}var fg,WS;function GR(){if(WS)return fg;WS=1;var e=To(),t=Ur(),n=e(t,"Set");return fg=n,fg}var pg,VS;function VU(){if(VS)return pg;VS=1;var e=To(),t=Ur(),n=e(t,"WeakMap");return pg=n,pg}var mg,GS;function Yi(){if(GS)return mg;GS=1;var e=UU(),t=k0(),n=WU(),r=GR(),a=VU(),l=Co(),c=LR(),u="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",m="[object WeakMap]",y="[object DataView]",w=c(e),N=c(t),k=c(n),S=c(r),b=c(a),j=l;return(e&&j(new e(new ArrayBuffer(1)))!=y||t&&j(new t)!=u||n&&j(n.resolve())!=p||r&&j(new r)!=h||a&&j(new a)!=m)&&(j=function(E){var C=l(E),T=C==f?E.constructor:void 0,R=T?c(T):"";if(R)switch(R){case w:return y;case N:return u;case k:return p;case S:return h;case b:return m}return C}),mg=j,mg}var gg,KS;function GU(){if(KS)return gg;KS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var a=r.length,l=new r.constructor(a);return a&&typeof r[0]=="string"&&t.call(r,"index")&&(l.index=r.index,l.input=r.input),l}return gg=n,gg}var yg,YS;function KR(){if(YS)return yg;YS=1;var e=Ur(),t=e.Uint8Array;return yg=t,yg}var wg,XS;function A0(){if(XS)return wg;XS=1;var e=KR();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return wg=t,wg}var vg,ZS;function KU(){if(ZS)return vg;ZS=1;var e=A0();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return vg=t,vg}var xg,QS;function YU(){if(QS)return xg;QS=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return xg=t,xg}var bg,JS;function XU(){if(JS)return bg;JS=1;var e=Gi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return bg=r,bg}var kg,ej;function YR(){if(ej)return kg;ej=1;var e=A0();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return kg=t,kg}var _g,tj;function ZU(){if(tj)return _g;tj=1;var e=A0(),t=KU(),n=YU(),r=XU(),a=YR(),l="[object Boolean]",c="[object Date]",u="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",k="[object Float32Array]",S="[object Float64Array]",b="[object Int8Array]",j="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",$="[object Uint32Array]";function D(U,P,V){var J=U.constructor;switch(P){case w:return e(U);case l:case c:return new J(+U);case N:return t(U,V);case k:case S:case b:case j:case E:case C:case T:case R:case $:return a(U,V);case u:return new J;case f:case m:return new J(U);case p:return n(U);case h:return new J;case y:return r(U)}}return _g=D,_g}var Ng,nj;function XR(){if(nj)return Ng;nj=1;var e=yr(),t=Object.create,n=(function(){function r(){}return function(a){if(!e(a))return{};if(t)return t(a);r.prototype=a;var l=new r;return r.prototype=void 0,l}})();return Ng=n,Ng}var Sg,rj;function ZR(){if(rj)return Sg;rj=1;var e=XR(),t=Lh(),n=Oh();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return Sg=r,Sg}var jg,sj;function QU(){if(sj)return jg;sj=1;var e=Yi(),t=hs(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return jg=r,jg}var Eg,aj;function JU(){if(aj)return Eg;aj=1;var e=QU(),t=$h(),n=j0(),r=n&&n.isMap,a=r?t(r):e;return Eg=a,Eg}var Cg,oj;function eW(){if(oj)return Cg;oj=1;var e=Yi(),t=hs(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return Cg=r,Cg}var Tg,ij;function tW(){if(ij)return Tg;ij=1;var e=eW(),t=$h(),n=j0(),r=n&&n.isSet,a=r?t(r):e;return Tg=a,Tg}var Ag,lj;function QR(){if(lj)return Ag;lj=1;var e=Ah(),t=N0(),n=Mh(),r=PU(),a=FU(),l=FR(),c=BR(),u=BU(),f=zU(),p=VR(),h=HU(),m=Yi(),y=GU(),w=ZU(),N=ZR(),k=Wt(),S=Ki(),b=JU(),j=yr(),E=tW(),C=ja(),T=Ao(),R=1,$=2,D=4,U="[object Arguments]",P="[object Array]",V="[object Boolean]",J="[object Date]",ee="[object Error]",M="[object Function]",Z="[object GeneratorFunction]",G="[object Map]",I="[object Number]",q="[object Object]",H="[object RegExp]",W="[object Set]",L="[object String]",K="[object Symbol]",de="[object WeakMap]",O="[object ArrayBuffer]",Y="[object DataView]",B="[object Float32Array]",te="[object Float64Array]",le="[object Int8Array]",pe="[object Int16Array]",ye="[object Int32Array]",Ie="[object Uint8Array]",Te="[object Uint8ClampedArray]",Re="[object Uint16Array]",Me="[object Uint32Array]",xe={};xe[U]=xe[P]=xe[O]=xe[Y]=xe[V]=xe[J]=xe[B]=xe[te]=xe[le]=xe[pe]=xe[ye]=xe[G]=xe[I]=xe[q]=xe[H]=xe[W]=xe[L]=xe[K]=xe[Ie]=xe[Te]=xe[Re]=xe[Me]=!0,xe[ee]=xe[M]=xe[de]=!1;function He(Ne,_e,Ze,ct,Ke,ce){var je,$e=_e&R,Je=_e&$,qe=_e&D;if(Ze&&(je=Ke?Ze(Ne,ct,Ke,ce):Ze(Ne)),je!==void 0)return je;if(!j(Ne))return Ne;var pt=k(Ne);if(pt){if(je=y(Ne),!$e)return c(Ne,je)}else{var ge=m(Ne),be=ge==M||ge==Z;if(S(Ne))return l(Ne,$e);if(ge==q||ge==U||be&&!Ke){if(je=Je||be?{}:N(Ne),!$e)return Je?f(Ne,a(je,Ne)):u(Ne,r(je,Ne))}else{if(!xe[ge])return Ke?Ne:{};je=w(Ne,ge,$e)}}ce||(ce=new e);var Ve=ce.get(Ne);if(Ve)return Ve;ce.set(Ne,je),E(Ne)?Ne.forEach(function(he){je.add(He(he,_e,Ze,he,Ne,ce))}):b(Ne)&&Ne.forEach(function(he,rt){je.set(rt,He(he,_e,Ze,rt,Ne,ce))});var nt=qe?Je?h:p:Je?T:C,at=pt?void 0:nt(Ne);return t(at||Ne,function(he,rt){at&&(rt=he,he=Ne[rt]),n(je,rt,He(he,_e,Ze,rt,Ne,ce))}),je}return Ag=He,Ag}var Rg,cj;function nW(){if(cj)return Rg;cj=1;var e=QR(),t=4;function n(r){return e(r,t)}return Rg=n,Rg}var Mg,uj;function R0(){if(uj)return Mg;uj=1;function e(t){return function(){return t}}return Mg=e,Mg}var Ig,dj;function rW(){if(dj)return Ig;dj=1;function e(t){return function(n,r,a){for(var l=-1,c=Object(n),u=a(n),f=u.length;f--;){var p=u[t?f:++l];if(r(c[p],p,c)===!1)break}return n}}return Ig=e,Ig}var $g,hj;function M0(){if(hj)return $g;hj=1;var e=rW(),t=e();return $g=t,$g}var Og,fj;function I0(){if(fj)return Og;fj=1;var e=M0(),t=ja();function n(r,a){return r&&e(r,a,t)}return Og=n,Og}var Lg,pj;function sW(){if(pj)return Lg;pj=1;var e=Ps();function t(n,r){return function(a,l){if(a==null)return a;if(!e(a))return n(a,l);for(var c=a.length,u=r?c:-1,f=Object(a);(r?u--:++u<c)&&l(f[u],u,f)!==!1;);return a}}return Lg=t,Lg}var Pg,mj;function Ph(){if(mj)return Pg;mj=1;var e=I0(),t=sW(),n=t(e);return Pg=n,Pg}var Dg,gj;function Ro(){if(gj)return Dg;gj=1;function e(t){return t}return Dg=e,Dg}var qg,yj;function JR(){if(yj)return qg;yj=1;var e=Ro();function t(n){return typeof n=="function"?n:e}return qg=t,qg}var Fg,wj;function eM(){if(wj)return Fg;wj=1;var e=N0(),t=Ph(),n=JR(),r=Wt();function a(l,c){var u=r(l)?e:t;return u(l,n(c))}return Fg=a,Fg}var Bg,vj;function tM(){return vj||(vj=1,Bg=eM()),Bg}var zg,xj;function aW(){if(xj)return zg;xj=1;var e=Ph();function t(n,r){var a=[];return e(n,function(l,c,u){r(l,c,u)&&a.push(l)}),a}return zg=t,zg}var Hg,bj;function oW(){if(bj)return Hg;bj=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Hg=t,Hg}var Ug,kj;function iW(){if(kj)return Ug;kj=1;function e(t){return this.__data__.has(t)}return Ug=e,Ug}var Wg,_j;function nM(){if(_j)return Wg;_j=1;var e=_0(),t=oW(),n=iW();function r(a){var l=-1,c=a==null?0:a.length;for(this.__data__=new e;++l<c;)this.add(a[l])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,Wg=r,Wg}var Vg,Nj;function lW(){if(Nj)return Vg;Nj=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a;)if(n(t[r],r,t))return!0;return!1}return Vg=e,Vg}var Gg,Sj;function rM(){if(Sj)return Gg;Sj=1;function e(t,n){return t.has(n)}return Gg=e,Gg}var Kg,jj;function sM(){if(jj)return Kg;jj=1;var e=nM(),t=lW(),n=rM(),r=1,a=2;function l(c,u,f,p,h,m){var y=f&r,w=c.length,N=u.length;if(w!=N&&!(y&&N>w))return!1;var k=m.get(c),S=m.get(u);if(k&&S)return k==u&&S==c;var b=-1,j=!0,E=f&a?new e:void 0;for(m.set(c,u),m.set(u,c);++b<w;){var C=c[b],T=u[b];if(p)var R=y?p(T,C,b,u,c,m):p(C,T,b,c,u,m);if(R!==void 0){if(R)continue;j=!1;break}if(E){if(!t(u,function($,D){if(!n(E,D)&&(C===$||h(C,$,f,p,m)))return E.push(D)})){j=!1;break}}else if(!(C===T||h(C,T,f,p,m))){j=!1;break}}return m.delete(c),m.delete(u),j}return Kg=l,Kg}var Yg,Ej;function cW(){if(Ej)return Yg;Ej=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,l){r[++n]=[l,a]}),r}return Yg=e,Yg}var Xg,Cj;function $0(){if(Cj)return Xg;Cj=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return Xg=e,Xg}var Zg,Tj;function uW(){if(Tj)return Zg;Tj=1;var e=Gi(),t=KR(),n=Vi(),r=sM(),a=cW(),l=$0(),c=1,u=2,f="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",k="[object String]",S="[object Symbol]",b="[object ArrayBuffer]",j="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function T(R,$,D,U,P,V,J){switch(D){case j:if(R.byteLength!=$.byteLength||R.byteOffset!=$.byteOffset)return!1;R=R.buffer,$=$.buffer;case b:return!(R.byteLength!=$.byteLength||!V(new t(R),new t($)));case f:case p:case y:return n(+R,+$);case h:return R.name==$.name&&R.message==$.message;case w:case k:return R==$+"";case m:var ee=a;case N:var M=U&c;if(ee||(ee=l),R.size!=$.size&&!M)return!1;var Z=J.get(R);if(Z)return Z==$;U|=u,J.set(R,$);var G=r(ee(R),ee($),U,P,V,J);return J.delete(R),G;case S:if(C)return C.call(R)==C.call($)}return!1}return Zg=T,Zg}var Qg,Aj;function dW(){if(Aj)return Qg;Aj=1;var e=VR(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(l,c,u,f,p,h){var m=u&t,y=e(l),w=y.length,N=e(c),k=N.length;if(w!=k&&!m)return!1;for(var S=w;S--;){var b=y[S];if(!(m?b in c:r.call(c,b)))return!1}var j=h.get(l),E=h.get(c);if(j&&E)return j==c&&E==l;var C=!0;h.set(l,c),h.set(c,l);for(var T=m;++S<w;){b=y[S];var R=l[b],$=c[b];if(f)var D=m?f($,R,b,c,l,h):f(R,$,b,l,c,h);if(!(D===void 0?R===$||p(R,$,u,f,h):D)){C=!1;break}T||(T=b=="constructor")}if(C&&!T){var U=l.constructor,P=c.constructor;U!=P&&"constructor"in l&&"constructor"in c&&!(typeof U=="function"&&U instanceof U&&typeof P=="function"&&P instanceof P)&&(C=!1)}return h.delete(l),h.delete(c),C}return Qg=a,Qg}var Jg,Rj;function hW(){if(Rj)return Jg;Rj=1;var e=Ah(),t=sM(),n=uW(),r=dW(),a=Yi(),l=Wt(),c=Ki(),u=Ac(),f=1,p="[object Arguments]",h="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(k,S,b,j,E,C){var T=l(k),R=l(S),$=T?h:a(k),D=R?h:a(S);$=$==p?m:$,D=D==p?m:D;var U=$==m,P=D==m,V=$==D;if(V&&c(k)){if(!c(S))return!1;T=!0,U=!1}if(V&&!U)return C||(C=new e),T||u(k)?t(k,S,b,j,E,C):n(k,S,$,b,j,E,C);if(!(b&f)){var J=U&&w.call(k,"__wrapped__"),ee=P&&w.call(S,"__wrapped__");if(J||ee){var M=J?k.value():k,Z=ee?S.value():S;return C||(C=new e),E(M,Z,b,j,C)}}return V?(C||(C=new e),r(k,S,b,j,E,C)):!1}return Jg=N,Jg}var ey,Mj;function aM(){if(Mj)return ey;Mj=1;var e=hW(),t=hs();function n(r,a,l,c,u){return r===a?!0:r==null||a==null||!t(r)&&!t(a)?r!==r&&a!==a:e(r,a,l,c,n,u)}return ey=n,ey}var ty,Ij;function fW(){if(Ij)return ty;Ij=1;var e=Ah(),t=aM(),n=1,r=2;function a(l,c,u,f){var p=u.length,h=p,m=!f;if(l==null)return!h;for(l=Object(l);p--;){var y=u[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<h;){y=u[p];var w=y[0],N=l[w],k=y[1];if(m&&y[2]){if(N===void 0&&!(w in l))return!1}else{var S=new e;if(f)var b=f(N,k,w,l,c,S);if(!(b===void 0?t(k,N,n|r,f,S):b))return!1}}return!0}return ty=a,ty}var ny,$j;function oM(){if($j)return ny;$j=1;var e=yr();function t(n){return n===n&&!e(n)}return ny=t,ny}var ry,Oj;function pW(){if(Oj)return ry;Oj=1;var e=oM(),t=ja();function n(r){for(var a=t(r),l=a.length;l--;){var c=a[l],u=r[c];a[l]=[c,u,e(u)]}return a}return ry=n,ry}var sy,Lj;function iM(){if(Lj)return sy;Lj=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return sy=e,sy}var ay,Pj;function mW(){if(Pj)return ay;Pj=1;var e=fW(),t=pW(),n=iM();function r(a){var l=t(a);return l.length==1&&l[0][2]?n(l[0][0],l[0][1]):function(c){return c===a||e(c,a,l)}}return ay=r,ay}var oy,Dj;function Xi(){if(Dj)return oy;Dj=1;var e=Co(),t=hs(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return oy=r,oy}var iy,qj;function O0(){if(qj)return iy;qj=1;var e=Wt(),t=Xi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(l,c){if(e(l))return!1;var u=typeof l;return u=="number"||u=="symbol"||u=="boolean"||l==null||t(l)?!0:r.test(l)||!n.test(l)||c!=null&&l in Object(c)}return iy=a,iy}var ly,Fj;function gW(){if(Fj)return ly;Fj=1;var e=_0(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var l=function(){var c=arguments,u=a?a.apply(this,c):c[0],f=l.cache;if(f.has(u))return f.get(u);var p=r.apply(this,c);return l.cache=f.set(u,p)||f,p};return l.cache=new(n.Cache||e),l}return n.Cache=e,ly=n,ly}var cy,Bj;function yW(){if(Bj)return cy;Bj=1;var e=gW(),t=500;function n(r){var a=e(r,function(c){return l.size===t&&l.clear(),c}),l=a.cache;return a}return cy=n,cy}var uy,zj;function wW(){if(zj)return uy;zj=1;var e=yW(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var l=[];return a.charCodeAt(0)===46&&l.push(""),a.replace(t,function(c,u,f,p){l.push(f?p.replace(n,"$1"):u||c)}),l});return uy=r,uy}var dy,Hj;function Dh(){if(Hj)return dy;Hj=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,l=Array(a);++r<a;)l[r]=n(t[r],r,t);return l}return dy=e,dy}var hy,Uj;function vW(){if(Uj)return hy;Uj=1;var e=Gi(),t=Dh(),n=Wt(),r=Xi(),a=e?e.prototype:void 0,l=a?a.toString:void 0;function c(u){if(typeof u=="string")return u;if(n(u))return t(u,c)+"";if(r(u))return l?l.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return hy=c,hy}var fy,Wj;function lM(){if(Wj)return fy;Wj=1;var e=vW();function t(n){return n==null?"":e(n)}return fy=t,fy}var py,Vj;function qh(){if(Vj)return py;Vj=1;var e=Wt(),t=O0(),n=wW(),r=lM();function a(l,c){return e(l)?l:t(l,c)?[l]:n(r(l))}return py=a,py}var my,Gj;function Rc(){if(Gj)return my;Gj=1;var e=Xi();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return my=t,my}var gy,Kj;function Fh(){if(Kj)return gy;Kj=1;var e=qh(),t=Rc();function n(r,a){a=e(a,r);for(var l=0,c=a.length;r!=null&&l<c;)r=r[t(a[l++])];return l&&l==c?r:void 0}return gy=n,gy}var yy,Yj;function xW(){if(Yj)return yy;Yj=1;var e=Fh();function t(n,r,a){var l=n==null?void 0:e(n,r);return l===void 0?a:l}return yy=t,yy}var wy,Xj;function bW(){if(Xj)return wy;Xj=1;function e(t,n){return t!=null&&n in Object(t)}return wy=e,wy}var vy,Zj;function cM(){if(Zj)return vy;Zj=1;var e=qh(),t=Tc(),n=Wt(),r=Ih(),a=S0(),l=Rc();function c(u,f,p){f=e(f,u);for(var h=-1,m=f.length,y=!1;++h<m;){var w=l(f[h]);if(!(y=u!=null&&p(u,w)))break;u=u[w]}return y||++h!=m?y:(m=u==null?0:u.length,!!m&&a(m)&&r(w,m)&&(n(u)||t(u)))}return vy=c,vy}var xy,Qj;function uM(){if(Qj)return xy;Qj=1;var e=bW(),t=cM();function n(r,a){return r!=null&&t(r,a,e)}return xy=n,xy}var by,Jj;function kW(){if(Jj)return by;Jj=1;var e=aM(),t=xW(),n=uM(),r=O0(),a=oM(),l=iM(),c=Rc(),u=1,f=2;function p(h,m){return r(h)&&a(m)?l(c(h),m):function(y){var w=t(y,h);return w===void 0&&w===m?n(y,h):e(m,w,u|f)}}return by=p,by}var ky,eE;function dM(){if(eE)return ky;eE=1;function e(t){return function(n){return n==null?void 0:n[t]}}return ky=e,ky}var _y,tE;function _W(){if(tE)return _y;tE=1;var e=Fh();function t(n){return function(r){return e(r,n)}}return _y=t,_y}var Ny,nE;function NW(){if(nE)return Ny;nE=1;var e=dM(),t=_W(),n=O0(),r=Rc();function a(l){return n(l)?e(r(l)):t(l)}return Ny=a,Ny}var Sy,rE;function Ds(){if(rE)return Sy;rE=1;var e=mW(),t=kW(),n=Ro(),r=Wt(),a=NW();function l(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?r(c)?t(c[0],c[1]):e(c):a(c)}return Sy=l,Sy}var jy,sE;function hM(){if(sE)return jy;sE=1;var e=zR(),t=aW(),n=Ds(),r=Wt();function a(l,c){var u=r(l)?e:t;return u(l,n(c,3))}return jy=a,jy}var Ey,aE;function SW(){if(aE)return Ey;aE=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,a){return r!=null&&t.call(r,a)}return Ey=n,Ey}var Cy,oE;function fM(){if(oE)return Cy;oE=1;var e=SW(),t=cM();function n(r,a){return r!=null&&t(r,a,e)}return Cy=n,Cy}var Ty,iE;function jW(){if(iE)return Ty;iE=1;var e=E0(),t=Yi(),n=Tc(),r=Wt(),a=Ps(),l=Ki(),c=Oh(),u=Ac(),f="[object Map]",p="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function y(w){if(w==null)return!0;if(a(w)&&(r(w)||typeof w=="string"||typeof w.splice=="function"||l(w)||u(w)||n(w)))return!w.length;var N=t(w);if(N==f||N==p)return!w.size;if(c(w))return!e(w).length;for(var k in w)if(m.call(w,k))return!1;return!0}return Ty=y,Ty}var Ay,lE;function pM(){if(lE)return Ay;lE=1;function e(t){return t===void 0}return Ay=e,Ay}var Ry,cE;function mM(){if(cE)return Ry;cE=1;var e=Ph(),t=Ps();function n(r,a){var l=-1,c=t(r)?Array(r.length):[];return e(r,function(u,f,p){c[++l]=a(u,f,p)}),c}return Ry=n,Ry}var My,uE;function gM(){if(uE)return My;uE=1;var e=Dh(),t=Ds(),n=mM(),r=Wt();function a(l,c){var u=r(l)?e:n;return u(l,t(c,3))}return My=a,My}var Iy,dE;function EW(){if(dE)return Iy;dE=1;function e(t,n,r,a){var l=-1,c=t==null?0:t.length;for(a&&c&&(r=t[++l]);++l<c;)r=n(r,t[l],l,t);return r}return Iy=e,Iy}var $y,hE;function CW(){if(hE)return $y;hE=1;function e(t,n,r,a,l){return l(t,function(c,u,f){r=a?(a=!1,c):n(r,c,u,f)}),r}return $y=e,$y}var Oy,fE;function yM(){if(fE)return Oy;fE=1;var e=EW(),t=Ph(),n=Ds(),r=CW(),a=Wt();function l(c,u,f){var p=a(c)?e:r,h=arguments.length<3;return p(c,n(u,4),f,h,t)}return Oy=l,Oy}var Ly,pE;function TW(){if(pE)return Ly;pE=1;var e=Co(),t=Wt(),n=hs(),r="[object String]";function a(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==r}return Ly=a,Ly}var Py,mE;function AW(){if(mE)return Py;mE=1;var e=dM(),t=e("length");return Py=t,Py}var Dy,gE;function RW(){if(gE)return Dy;gE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,l="\\ufe0e\\ufe0f",c="\\u200d",u=RegExp("["+c+e+a+l+"]");function f(p){return u.test(p)}return Dy=f,Dy}var qy,yE;function MW(){if(yE)return qy;yE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,l="\\ufe0e\\ufe0f",c="["+e+"]",u="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+f+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",k="["+l+"]?",S="(?:"+w+"(?:"+[h,m,y].join("|")+")"+k+N+")*",b=k+N+S,j="(?:"+[h+u+"?",u,m,y,c].join("|")+")",E=RegExp(f+"(?="+f+")|"+j+b,"g");function C(T){for(var R=E.lastIndex=0;E.test(T);)++R;return R}return qy=C,qy}var Fy,wE;function IW(){if(wE)return Fy;wE=1;var e=AW(),t=RW(),n=MW();function r(a){return t(a)?n(a):e(a)}return Fy=r,Fy}var By,vE;function $W(){if(vE)return By;vE=1;var e=E0(),t=Yi(),n=Ps(),r=TW(),a=IW(),l="[object Map]",c="[object Set]";function u(f){if(f==null)return 0;if(n(f))return r(f)?a(f):f.length;var p=t(f);return p==l||p==c?f.size:e(f).length}return By=u,By}var zy,xE;function OW(){if(xE)return zy;xE=1;var e=N0(),t=XR(),n=I0(),r=Ds(),a=Lh(),l=Wt(),c=Ki(),u=Ec(),f=yr(),p=Ac();function h(m,y,w){var N=l(m),k=N||c(m)||p(m);if(y=r(y,4),w==null){var S=m&&m.constructor;k?w=N?new S:[]:f(m)?w=u(S)?t(a(m)):{}:w={}}return(k?e:n)(m,function(b,j,E){return y(w,b,j,E)}),w}return zy=h,zy}var Hy,bE;function LW(){if(bE)return Hy;bE=1;var e=Gi(),t=Tc(),n=Wt(),r=e?e.isConcatSpreadable:void 0;function a(l){return n(l)||t(l)||!!(r&&l&&l[r])}return Hy=a,Hy}var Uy,kE;function L0(){if(kE)return Uy;kE=1;var e=T0(),t=LW();function n(r,a,l,c,u){var f=-1,p=r.length;for(l||(l=t),u||(u=[]);++f<p;){var h=r[f];a>0&&l(h)?a>1?n(h,a-1,l,c,u):e(u,h):c||(u[u.length]=h)}return u}return Uy=n,Uy}var Wy,_E;function PW(){if(_E)return Wy;_E=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return Wy=e,Wy}var Vy,NE;function wM(){if(NE)return Vy;NE=1;var e=PW(),t=Math.max;function n(r,a,l){return a=t(a===void 0?r.length-1:a,0),function(){for(var c=arguments,u=-1,f=t(c.length-a,0),p=Array(f);++u<f;)p[u]=c[a+u];u=-1;for(var h=Array(a+1);++u<a;)h[u]=c[u];return h[a]=l(p),e(r,this,h)}}return Vy=n,Vy}var Gy,SE;function DW(){if(SE)return Gy;SE=1;var e=R0(),t=PR(),n=Ro(),r=t?function(a,l){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:n;return Gy=r,Gy}var Ky,jE;function qW(){if(jE)return Ky;jE=1;var e=800,t=16,n=Date.now;function r(a){var l=0,c=0;return function(){var u=n(),f=t-(u-c);if(c=u,f>0){if(++l>=e)return arguments[0]}else l=0;return a.apply(void 0,arguments)}}return Ky=r,Ky}var Yy,EE;function vM(){if(EE)return Yy;EE=1;var e=DW(),t=qW(),n=t(e);return Yy=n,Yy}var Xy,CE;function Bh(){if(CE)return Xy;CE=1;var e=Ro(),t=wM(),n=vM();function r(a,l){return n(t(a,l,e),a+"")}return Xy=r,Xy}var Zy,TE;function xM(){if(TE)return Zy;TE=1;function e(t,n,r,a){for(var l=t.length,c=r+(a?1:-1);a?c--:++c<l;)if(n(t[c],c,t))return c;return-1}return Zy=e,Zy}var Qy,AE;function FW(){if(AE)return Qy;AE=1;function e(t){return t!==t}return Qy=e,Qy}var Jy,RE;function BW(){if(RE)return Jy;RE=1;function e(t,n,r){for(var a=r-1,l=t.length;++a<l;)if(t[a]===n)return a;return-1}return Jy=e,Jy}var ew,ME;function zW(){if(ME)return ew;ME=1;var e=xM(),t=FW(),n=BW();function r(a,l,c){return l===l?n(a,l,c):e(a,t,c)}return ew=r,ew}var tw,IE;function HW(){if(IE)return tw;IE=1;var e=zW();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return tw=t,tw}var nw,$E;function UW(){if($E)return nw;$E=1;function e(t,n,r){for(var a=-1,l=t==null?0:t.length;++a<l;)if(r(n,t[a]))return!0;return!1}return nw=e,nw}var rw,OE;function WW(){if(OE)return rw;OE=1;function e(){}return rw=e,rw}var sw,LE;function VW(){if(LE)return sw;LE=1;var e=GR(),t=WW(),n=$0(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(l){return new e(l)}:t;return sw=a,sw}var aw,PE;function GW(){if(PE)return aw;PE=1;var e=nM(),t=HW(),n=UW(),r=rM(),a=VW(),l=$0(),c=200;function u(f,p,h){var m=-1,y=t,w=f.length,N=!0,k=[],S=k;if(h)N=!1,y=n;else if(w>=c){var b=p?null:a(f);if(b)return l(b);N=!1,y=r,S=new e}else S=p?[]:k;e:for(;++m<w;){var j=f[m],E=p?p(j):j;if(j=h||j!==0?j:0,N&&E===E){for(var C=S.length;C--;)if(S[C]===E)continue e;p&&S.push(E),k.push(j)}else y(S,E,h)||(S!==k&&S.push(E),k.push(j))}return k}return aw=u,aw}var ow,DE;function bM(){if(DE)return ow;DE=1;var e=Ps(),t=hs();function n(r){return t(r)&&e(r)}return ow=n,ow}var iw,qE;function KW(){if(qE)return iw;qE=1;var e=L0(),t=Bh(),n=GW(),r=bM(),a=t(function(l){return n(e(l,1,r,!0))});return iw=a,iw}var lw,FE;function YW(){if(FE)return lw;FE=1;var e=Dh();function t(n,r){return e(r,function(a){return n[a]})}return lw=t,lw}var cw,BE;function kM(){if(BE)return cw;BE=1;var e=YW(),t=ja();function n(r){return r==null?[]:e(r,t(r))}return cw=n,cw}var uw,zE;function wr(){if(zE)return uw;zE=1;var e;if(typeof b0=="function")try{e={clone:nW(),constant:R0(),each:tM(),filter:hM(),has:fM(),isArray:Wt(),isEmpty:jW(),isFunction:Ec(),isUndefined:pM(),keys:ja(),map:gM(),reduce:yM(),size:$W(),transform:OW(),union:KW(),values:kM()}}catch{}return e||(e=window._),uw=e,uw}var dw,HE;function P0(){if(HE)return dw;HE=1;var e=wr();dw=a;var t="\0",n="\0",r="";function a(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(h){return this._label=h,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._in[m])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._out[m])})},a.prototype.setNodes=function(h,m){var y=arguments,w=this;return e.each(h,function(N){y.length>1?w.setNode(N,m):w.setNode(N)}),this},a.prototype.setNode=function(h,m){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},a.prototype.node=function(h){return this._nodes[h]},a.prototype.hasNode=function(h){return e.has(this._nodes,h)},a.prototype.removeNode=function(h){var m=this;if(e.has(this._nodes,h)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(w){m.setParent(w)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},a.prototype.setParent=function(h,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=n;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var m=this._children[h];if(m)return e.keys(m)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var m=this._preds[h];if(m)return e.keys(m)},a.prototype.successors=function(h){var m=this._sucs[h];if(m)return e.keys(m)},a.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return e.union(m,this.successors(h))},a.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},a.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(k,S){h(S)&&m.setNode(S,k)}),e.each(this._edgeObjs,function(k){m.hasNode(k.v)&&m.hasNode(k.w)&&m.setEdge(k,y.edge(k))});var w={};function N(k){var S=y.parent(k);return S===void 0||m.hasNode(S)?(w[k]=S,S):S in w?w[S]:N(S)}return this._isCompound&&e.each(m.nodes(),function(k){m.setParent(k,N(k))}),m},a.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(h,m){var y=this,w=arguments;return e.reduce(h,function(N,k){return w.length>1?y.setEdge(N,k,m):y.setEdge(N,k),k}),this},a.prototype.setEdge=function(){var h,m,y,w,N=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(h=k.v,m=k.w,y=k.name,arguments.length===2&&(w=arguments[1],N=!0)):(h=k,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),h=""+h,m=""+m,e.isUndefined(y)||(y=""+y);var S=u(this._isDirected,h,m,y);if(e.has(this._edgeLabels,S))return N&&(this._edgeLabels[S]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[S]=N?w:this._defaultEdgeLabelFn(h,m,y);var b=f(this._isDirected,h,m,y);return h=b.v,m=b.w,Object.freeze(b),this._edgeObjs[S]=b,l(this._preds[m],h),l(this._sucs[h],m),this._in[m][S]=b,this._out[h][S]=b,this._edgeCount++,this},a.prototype.edge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return this._edgeLabels[w]},a.prototype.hasEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y),N=this._edgeObjs[w];return N&&(h=N.v,m=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],c(this._preds[m],h),c(this._sucs[h],m),delete this._in[m][w],delete this._out[h][w],this._edgeCount--),this},a.prototype.inEdges=function(h,m){var y=this._in[h];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.v===m}):w}},a.prototype.outEdges=function(h,m){var y=this._out[h];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.w===m}):w}},a.prototype.nodeEdges=function(h,m){var y=this.inEdges(h,m);if(y)return y.concat(this.outEdges(h,m))};function l(h,m){h[m]?h[m]++:h[m]=1}function c(h,m){--h[m]||delete h[m]}function u(h,m,y,w){var N=""+m,k=""+y;if(!h&&N>k){var S=N;N=k,k=S}return N+r+k+r+(e.isUndefined(w)?t:w)}function f(h,m,y,w){var N=""+m,k=""+y;if(!h&&N>k){var S=N;N=k,k=S}var b={v:N,w:k};return w&&(b.name=w),b}function p(h,m){return u(h,m.v,m.w,m.name)}return dw}var hw,UE;function XW(){return UE||(UE=1,hw="2.1.8"),hw}var fw,WE;function ZW(){return WE||(WE=1,fw={Graph:P0(),version:XW()}),fw}var pw,VE;function QW(){if(VE)return pw;VE=1;var e=wr(),t=P0();pw={write:n,read:l};function n(c){var u={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:r(c),edges:a(c)};return e.isUndefined(c.graph())||(u.value=e.clone(c.graph())),u}function r(c){return e.map(c.nodes(),function(u){var f=c.node(u),p=c.parent(u),h={v:u};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(c){return e.map(c.edges(),function(u){var f=c.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(f)||(p.value=f),p})}function l(c){var u=new t(c.options).setGraph(c.value);return e.each(c.nodes,function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),e.each(c.edges,function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return pw}var mw,GE;function JW(){if(GE)return mw;GE=1;var e=wr();mw=t;function t(n){var r={},a=[],l;function c(u){e.has(r,u)||(r[u]=!0,l.push(u),e.each(n.successors(u),c),e.each(n.predecessors(u),c))}return e.each(n.nodes(),function(u){l=[],c(u),l.length&&a.push(l)}),a}return mw}var gw,KE;function _M(){if(KE)return gw;KE=1;var e=wr();gw=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,r){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var l=this._arr,c=l.length;return a[n]=c,l.push({key:n,priority:r}),this._decrease(c),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,r){var a=this._keyIndices[n];if(r>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+r);this._arr[a].priority=r,this._decrease(a)},t.prototype._heapify=function(n){var r=this._arr,a=2*n,l=a+1,c=n;a<r.length&&(c=r[a].priority<r[c].priority?a:c,l<r.length&&(c=r[l].priority<r[c].priority?l:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var r=this._arr,a=r[n].priority,l;n!==0&&(l=n>>1,!(r[l].priority<a));)this._swap(n,l),n=l},t.prototype._swap=function(n,r){var a=this._arr,l=this._keyIndices,c=a[n],u=a[r];a[n]=u,a[r]=c,l[u.key]=n,l[c.key]=r},gw}var yw,YE;function NM(){if(YE)return yw;YE=1;var e=wr(),t=_M();yw=r;var n=e.constant(1);function r(l,c,u,f){return a(l,String(c),u||n,f||function(p){return l.outEdges(p)})}function a(l,c,u,f){var p={},h=new t,m,y,w=function(N){var k=N.v!==m?N.v:N.w,S=p[k],b=u(N),j=y.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+b);j<S.distance&&(S.distance=j,S.predecessor=m,h.decrease(k,j))};for(l.nodes().forEach(function(N){var k=N===c?0:Number.POSITIVE_INFINITY;p[N]={distance:k},h.add(N,k)});h.size()>0&&(m=h.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(w);return p}return yw}var ww,XE;function e7(){if(XE)return ww;XE=1;var e=NM(),t=wr();ww=n;function n(r,a,l){return t.transform(r.nodes(),function(c,u){c[u]=e(r,u,a,l)},{})}return ww}var vw,ZE;function SM(){if(ZE)return vw;ZE=1;var e=wr();vw=t;function t(n){var r=0,a=[],l={},c=[];function u(f){var p=l[f]={onStack:!0,lowlink:r,index:r++};if(a.push(f),n.successors(f).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var h=[],m;do m=a.pop(),l[m].onStack=!1,h.push(m);while(f!==m);c.push(h)}}return n.nodes().forEach(function(f){e.has(l,f)||u(f)}),c}return vw}var xw,QE;function t7(){if(QE)return xw;QE=1;var e=wr(),t=SM();xw=n;function n(r){return e.filter(t(r),function(a){return a.length>1||a.length===1&&r.hasEdge(a[0],a[0])})}return xw}var bw,JE;function n7(){if(JE)return bw;JE=1;var e=wr();bw=n;var t=e.constant(1);function n(a,l,c){return r(a,l||t,c||function(u){return a.outEdges(u)})}function r(a,l,c){var u={},f=a.nodes();return f.forEach(function(p){u[p]={},u[p][p]={distance:0},f.forEach(function(h){p!==h&&(u[p][h]={distance:Number.POSITIVE_INFINITY})}),c(p).forEach(function(h){var m=h.v===p?h.w:h.v,y=l(h);u[p][m]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=u[p];f.forEach(function(m){var y=u[m];f.forEach(function(w){var N=y[p],k=h[w],S=y[w],b=N.distance+k.distance;b<S.distance&&(S.distance=b,S.predecessor=k.predecessor)})})}),u}return bw}var kw,eC;function jM(){if(eC)return kw;eC=1;var e=wr();kw=t,t.CycleException=n;function t(r){var a={},l={},c=[];function u(f){if(e.has(l,f))throw new n;e.has(a,f)||(l[f]=!0,a[f]=!0,e.each(r.predecessors(f),u),delete l[f],c.push(f))}if(e.each(r.sinks(),u),e.size(a)!==r.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,kw}var _w,tC;function r7(){if(tC)return _w;tC=1;var e=jM();_w=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return _w}var Nw,nC;function EM(){if(nC)return Nw;nC=1;var e=wr();Nw=t;function t(r,a,l){e.isArray(a)||(a=[a]);var c=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],f={};return e.each(a,function(p){if(!r.hasNode(p))throw new Error("Graph does not have node: "+p);n(r,p,l==="post",f,c,u)}),u}function n(r,a,l,c,u,f){e.has(c,a)||(c[a]=!0,l||f.push(a),e.each(u(a),function(p){n(r,p,l,c,u,f)}),l&&f.push(a))}return Nw}var Sw,rC;function s7(){if(rC)return Sw;rC=1;var e=EM();Sw=t;function t(n,r){return e(n,r,"post")}return Sw}var jw,sC;function a7(){if(sC)return jw;sC=1;var e=EM();jw=t;function t(n,r){return e(n,r,"pre")}return jw}var Ew,aC;function o7(){if(aC)return Ew;aC=1;var e=wr(),t=P0(),n=_M();Ew=r;function r(a,l){var c=new t,u={},f=new n,p;function h(y){var w=y.v===p?y.w:y.v,N=f.priority(w);if(N!==void 0){var k=l(y);k<N&&(u[w]=p,f.decrease(w,k))}}if(a.nodeCount()===0)return c;e.each(a.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),f.decrease(a.nodes()[0],0);for(var m=!1;f.size()>0;){if(p=f.removeMin(),e.has(u,p))c.setEdge(p,u[p]);else{if(m)throw new Error("Input graph is not connected: "+a);m=!0}a.nodeEdges(p).forEach(h)}return c}return Ew}var Cw,oC;function i7(){return oC||(oC=1,Cw={components:JW(),dijkstra:NM(),dijkstraAll:e7(),findCycles:t7(),floydWarshall:n7(),isAcyclic:r7(),postorder:s7(),preorder:a7(),prim:o7(),tarjan:SM(),topsort:jM()}),Cw}var Tw,iC;function l7(){if(iC)return Tw;iC=1;var e=ZW();return Tw={Graph:e.Graph,json:QW(),alg:i7(),version:e.version},Tw}var Aw,lC;function zr(){if(lC)return Aw;lC=1;var e;if(typeof b0=="function")try{e=l7()}catch{}return e||(e=window.graphlib),Aw=e,Aw}var Rw,cC;function c7(){if(cC)return Rw;cC=1;var e=QR(),t=1,n=4;function r(a){return e(a,t|n)}return Rw=r,Rw}var Mw,uC;function zh(){if(uC)return Mw;uC=1;var e=Vi(),t=Ps(),n=Ih(),r=yr();function a(l,c,u){if(!r(u))return!1;var f=typeof c;return(f=="number"?t(u)&&n(c,u.length):f=="string"&&c in u)?e(u[c],l):!1}return Mw=a,Mw}var Iw,dC;function u7(){if(dC)return Iw;dC=1;var e=Bh(),t=Vi(),n=zh(),r=Ao(),a=Object.prototype,l=a.hasOwnProperty,c=e(function(u,f){u=Object(u);var p=-1,h=f.length,m=h>2?f[2]:void 0;for(m&&n(f[0],f[1],m)&&(h=1);++p<h;)for(var y=f[p],w=r(y),N=-1,k=w.length;++N<k;){var S=w[N],b=u[S];(b===void 0||t(b,a[S])&&!l.call(u,S))&&(u[S]=y[S])}return u});return Iw=c,Iw}var $w,hC;function d7(){if(hC)return $w;hC=1;var e=Ds(),t=Ps(),n=ja();function r(a){return function(l,c,u){var f=Object(l);if(!t(l)){var p=e(c,3);l=n(l),c=function(m){return p(f[m],m,f)}}var h=a(l,c,u);return h>-1?f[p?l[h]:h]:void 0}}return $w=r,$w}var Ow,fC;function h7(){if(fC)return Ow;fC=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Ow=t,Ow}var Lw,pC;function f7(){if(pC)return Lw;pC=1;var e=h7(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Lw=n,Lw}var Pw,mC;function p7(){if(mC)return Pw;mC=1;var e=f7(),t=yr(),n=Xi(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return r;if(t(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=t(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||c.test(p)?u(p.slice(2),m?2:8):a.test(p)?r:+p}return Pw=f,Pw}var Dw,gC;function CM(){if(gC)return Dw;gC=1;var e=p7(),t=1/0,n=17976931348623157e292;function r(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var l=a<0?-1:1;return l*n}return a===a?a:0}return Dw=r,Dw}var qw,yC;function m7(){if(yC)return qw;yC=1;var e=CM();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return qw=t,qw}var Fw,wC;function g7(){if(wC)return Fw;wC=1;var e=xM(),t=Ds(),n=m7(),r=Math.max;function a(l,c,u){var f=l==null?0:l.length;if(!f)return-1;var p=u==null?0:n(u);return p<0&&(p=r(f+p,0)),e(l,t(c,3),p)}return Fw=a,Fw}var Bw,vC;function y7(){if(vC)return Bw;vC=1;var e=d7(),t=g7(),n=e(t);return Bw=n,Bw}var zw,xC;function TM(){if(xC)return zw;xC=1;var e=L0();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return zw=t,zw}var Hw,bC;function w7(){if(bC)return Hw;bC=1;var e=M0(),t=JR(),n=Ao();function r(a,l){return a==null?a:e(a,t(l),n)}return Hw=r,Hw}var Uw,kC;function v7(){if(kC)return Uw;kC=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Uw=e,Uw}var Ww,_C;function x7(){if(_C)return Ww;_C=1;var e=Rh(),t=I0(),n=Ds();function r(a,l){var c={};return l=n(l,3),t(a,function(u,f,p){e(c,f,l(u,f,p))}),c}return Ww=r,Ww}var Vw,NC;function D0(){if(NC)return Vw;NC=1;var e=Xi();function t(n,r,a){for(var l=-1,c=n.length;++l<c;){var u=n[l],f=r(u);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=u}return h}return Vw=t,Vw}var Gw,SC;function b7(){if(SC)return Gw;SC=1;function e(t,n){return t>n}return Gw=e,Gw}var Kw,jC;function k7(){if(jC)return Kw;jC=1;var e=D0(),t=b7(),n=Ro();function r(a){return a&&a.length?e(a,n,t):void 0}return Kw=r,Kw}var Yw,EC;function AM(){if(EC)return Yw;EC=1;var e=Rh(),t=Vi();function n(r,a,l){(l!==void 0&&!t(r[a],l)||l===void 0&&!(a in r))&&e(r,a,l)}return Yw=n,Yw}var Xw,CC;function _7(){if(CC)return Xw;CC=1;var e=Co(),t=Lh(),n=hs(),r="[object Object]",a=Function.prototype,l=Object.prototype,c=a.toString,u=l.hasOwnProperty,f=c.call(Object);function p(h){if(!n(h)||e(h)!=r)return!1;var m=t(h);if(m===null)return!0;var y=u.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&c.call(y)==f}return Xw=p,Xw}var Zw,TC;function RM(){if(TC)return Zw;TC=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Zw=e,Zw}var Qw,AC;function N7(){if(AC)return Qw;AC=1;var e=Cc(),t=Ao();function n(r){return e(r,t(r))}return Qw=n,Qw}var Jw,RC;function S7(){if(RC)return Jw;RC=1;var e=AM(),t=FR(),n=YR(),r=BR(),a=ZR(),l=Tc(),c=Wt(),u=bM(),f=Ki(),p=Ec(),h=yr(),m=_7(),y=Ac(),w=RM(),N=N7();function k(S,b,j,E,C,T,R){var $=w(S,j),D=w(b,j),U=R.get(D);if(U){e(S,j,U);return}var P=T?T($,D,j+"",S,b,R):void 0,V=P===void 0;if(V){var J=c(D),ee=!J&&f(D),M=!J&&!ee&&y(D);P=D,J||ee||M?c($)?P=$:u($)?P=r($):ee?(V=!1,P=t(D,!0)):M?(V=!1,P=n(D,!0)):P=[]:m(D)||l(D)?(P=$,l($)?P=N($):(!h($)||p($))&&(P=a(D))):V=!1}V&&(R.set(D,P),C(P,D,E,T,R),R.delete(D)),e(S,j,P)}return Jw=k,Jw}var ev,MC;function j7(){if(MC)return ev;MC=1;var e=Ah(),t=AM(),n=M0(),r=S7(),a=yr(),l=Ao(),c=RM();function u(f,p,h,m,y){f!==p&&n(p,function(w,N){if(y||(y=new e),a(w))r(f,p,N,h,u,m,y);else{var k=m?m(c(f,N),w,N+"",f,p,y):void 0;k===void 0&&(k=w),t(f,N,k)}},l)}return ev=u,ev}var tv,IC;function E7(){if(IC)return tv;IC=1;var e=Bh(),t=zh();function n(r){return e(function(a,l){var c=-1,u=l.length,f=u>1?l[u-1]:void 0,p=u>2?l[2]:void 0;for(f=r.length>3&&typeof f=="function"?(u--,f):void 0,p&&t(l[0],l[1],p)&&(f=u<3?void 0:f,u=1),a=Object(a);++c<u;){var h=l[c];h&&r(a,h,c,f)}return a})}return tv=n,tv}var nv,$C;function C7(){if($C)return nv;$C=1;var e=j7(),t=E7(),n=t(function(r,a,l){e(r,a,l)});return nv=n,nv}var rv,OC;function MM(){if(OC)return rv;OC=1;function e(t,n){return t<n}return rv=e,rv}var sv,LC;function T7(){if(LC)return sv;LC=1;var e=D0(),t=MM(),n=Ro();function r(a){return a&&a.length?e(a,n,t):void 0}return sv=r,sv}var av,PC;function A7(){if(PC)return av;PC=1;var e=D0(),t=Ds(),n=MM();function r(a,l){return a&&a.length?e(a,t(l,2),n):void 0}return av=r,av}var ov,DC;function R7(){if(DC)return ov;DC=1;var e=Ur(),t=function(){return e.Date.now()};return ov=t,ov}var iv,qC;function M7(){if(qC)return iv;qC=1;var e=Mh(),t=qh(),n=Ih(),r=yr(),a=Rc();function l(c,u,f,p){if(!r(c))return c;u=t(u,c);for(var h=-1,m=u.length,y=m-1,w=c;w!=null&&++h<m;){var N=a(u[h]),k=f;if(N==="__proto__"||N==="constructor"||N==="prototype")return c;if(h!=y){var S=w[N];k=p?p(S,N,w):void 0,k===void 0&&(k=r(S)?S:n(u[h+1])?[]:{})}e(w,N,k),w=w[N]}return c}return iv=l,iv}var lv,FC;function I7(){if(FC)return lv;FC=1;var e=Fh(),t=M7(),n=qh();function r(a,l,c){for(var u=-1,f=l.length,p={};++u<f;){var h=l[u],m=e(a,h);c(m,h)&&t(p,n(h,a),m)}return p}return lv=r,lv}var cv,BC;function $7(){if(BC)return cv;BC=1;var e=I7(),t=uM();function n(r,a){return e(r,a,function(l,c){return t(r,c)})}return cv=n,cv}var uv,zC;function O7(){if(zC)return uv;zC=1;var e=TM(),t=wM(),n=vM();function r(a){return n(t(a,void 0,e),a+"")}return uv=r,uv}var dv,HC;function L7(){if(HC)return dv;HC=1;var e=$7(),t=O7(),n=t(function(r,a){return r==null?{}:e(r,a)});return dv=n,dv}var hv,UC;function P7(){if(UC)return hv;UC=1;var e=Math.ceil,t=Math.max;function n(r,a,l,c){for(var u=-1,f=t(e((a-r)/(l||1)),0),p=Array(f);f--;)p[c?f:++u]=r,r+=l;return p}return hv=n,hv}var fv,WC;function D7(){if(WC)return fv;WC=1;var e=P7(),t=zh(),n=CM();function r(a){return function(l,c,u){return u&&typeof u!="number"&&t(l,c,u)&&(c=u=void 0),l=n(l),c===void 0?(c=l,l=0):c=n(c),u=u===void 0?l<c?1:-1:n(u),e(l,c,u,a)}}return fv=r,fv}var pv,VC;function q7(){if(VC)return pv;VC=1;var e=D7(),t=e();return pv=t,pv}var mv,GC;function F7(){if(GC)return mv;GC=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return mv=e,mv}var gv,KC;function B7(){if(KC)return gv;KC=1;var e=Xi();function t(n,r){if(n!==r){var a=n!==void 0,l=n===null,c=n===n,u=e(n),f=r!==void 0,p=r===null,h=r===r,m=e(r);if(!p&&!m&&!u&&n>r||u&&f&&h&&!p&&!m||l&&f&&h||!a&&h||!c)return 1;if(!l&&!u&&!m&&n<r||m&&a&&c&&!l&&!u||p&&a&&c||!f&&c||!h)return-1}return 0}return gv=t,gv}var yv,YC;function z7(){if(YC)return yv;YC=1;var e=B7();function t(n,r,a){for(var l=-1,c=n.criteria,u=r.criteria,f=c.length,p=a.length;++l<f;){var h=e(c[l],u[l]);if(h){if(l>=p)return h;var m=a[l];return h*(m=="desc"?-1:1)}}return n.index-r.index}return yv=t,yv}var wv,XC;function H7(){if(XC)return wv;XC=1;var e=Dh(),t=Fh(),n=Ds(),r=mM(),a=F7(),l=$h(),c=z7(),u=Ro(),f=Wt();function p(h,m,y){m.length?m=e(m,function(k){return f(k)?function(S){return t(S,k.length===1?k[0]:k)}:k}):m=[u];var w=-1;m=e(m,l(n));var N=r(h,function(k,S,b){var j=e(m,function(E){return E(k)});return{criteria:j,index:++w,value:k}});return a(N,function(k,S){return c(k,S,y)})}return wv=p,wv}var vv,ZC;function U7(){if(ZC)return vv;ZC=1;var e=L0(),t=H7(),n=Bh(),r=zh(),a=n(function(l,c){if(l==null)return[];var u=c.length;return u>1&&r(l,c[0],c[1])?c=[]:u>2&&r(c[0],c[1],c[2])&&(c=[c[0]]),t(l,e(c,1),[])});return vv=a,vv}var xv,QC;function W7(){if(QC)return xv;QC=1;var e=lM(),t=0;function n(r){var a=++t;return e(r)+a}return xv=n,xv}var bv,JC;function V7(){if(JC)return bv;JC=1;function e(t,n,r){for(var a=-1,l=t.length,c=n.length,u={};++a<l;){var f=a<c?n[a]:void 0;r(u,t[a],f)}return u}return bv=e,bv}var kv,eT;function G7(){if(eT)return kv;eT=1;var e=Mh(),t=V7();function n(r,a){return t(r||[],a||[],e)}return kv=n,kv}var _v,tT;function At(){if(tT)return _v;tT=1;var e;if(typeof b0=="function")try{e={cloneDeep:c7(),constant:R0(),defaults:u7(),each:tM(),filter:hM(),find:y7(),flatten:TM(),forEach:eM(),forIn:w7(),has:fM(),isUndefined:pM(),last:v7(),map:gM(),mapValues:x7(),max:k7(),merge:C7(),min:T7(),minBy:A7(),now:R7(),pick:L7(),range:q7(),reduce:yM(),sortBy:U7(),uniqueId:W7(),values:kM(),zipObject:G7()}}catch{}return e||(e=window._),_v=e,_v}var Nv,nT;function K7(){if(nT)return Nv;nT=1,Nv=e;function e(){var r={};r._next=r._prev=r,this._sentinel=r}e.prototype.dequeue=function(){var r=this._sentinel,a=r._prev;if(a!==r)return t(a),a},e.prototype.enqueue=function(r){var a=this._sentinel;r._prev&&r._next&&t(r),r._next=a._next,a._next._prev=r,a._next=r,r._prev=a},e.prototype.toString=function(){for(var r=[],a=this._sentinel,l=a._prev;l!==a;)r.push(JSON.stringify(l,n)),l=l._prev;return"["+r.join(", ")+"]"};function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,a){if(r!=="_next"&&r!=="_prev")return a}return Nv}var Sv,rT;function Y7(){if(rT)return Sv;rT=1;var e=At(),t=zr().Graph,n=K7();Sv=a;var r=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var m=u(p,h||r),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function l(p,h,m){for(var y=[],w=h[h.length-1],N=h[0],k;p.nodeCount();){for(;k=N.dequeue();)c(p,h,m,k);for(;k=w.dequeue();)c(p,h,m,k);if(p.nodeCount()){for(var S=h.length-2;S>0;--S)if(k=h[S].dequeue(),k){y=y.concat(c(p,h,m,k,!0));break}}}return y}function c(p,h,m,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(k){var S=p.edge(k),b=p.node(k.v);w&&N.push({v:k.v,w:k.w}),b.out-=S,f(h,m,b)}),e.forEach(p.outEdges(y.v),function(k){var S=p.edge(k),b=k.w,j=p.node(b);j.in-=S,f(h,m,j)}),p.removeNode(y.v),N}function u(p,h){var m=new t,y=0,w=0;e.forEach(p.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var b=m.edge(S.v,S.w)||0,j=h(S),E=b+j;m.setEdge(S.v,S.w,E),w=Math.max(w,m.node(S.v).out+=j),y=Math.max(y,m.node(S.w).in+=j)});var N=e.range(w+y+3).map(function(){return new n}),k=y+1;return e.forEach(m.nodes(),function(S){f(N,k,m.node(S))}),{graph:m,buckets:N,zeroIdx:k}}function f(p,h,m){m.out?m.in?p[m.out-m.in+h].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return Sv}var jv,sT;function X7(){if(sT)return jv;sT=1;var e=At(),t=Y7();jv={run:n,undo:a};function n(l){var c=l.graph().acyclicer==="greedy"?t(l,u(l)):r(l);e.forEach(c,function(f){var p=l.edge(f);l.removeEdge(f),p.forwardName=f.name,p.reversed=!0,l.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function u(f){return function(p){return f.edge(p).weight}}}function r(l){var c=[],u={},f={};function p(h){e.has(f,h)||(f[h]=!0,u[h]=!0,e.forEach(l.outEdges(h),function(m){e.has(u,m.w)?c.push(m):p(m.w)}),delete u[h])}return e.forEach(l.nodes(),p),c}function a(l){e.forEach(l.edges(),function(c){var u=l.edge(c);if(u.reversed){l.removeEdge(c);var f=u.forwardName;delete u.reversed,delete u.forwardName,l.setEdge(c.w,c.v,u,f)}})}return jv}var Ev,aT;function Hn(){if(aT)return Ev;aT=1;var e=At(),t=zr().Graph;Ev={addDummyNode:n,simplify:r,asNonCompoundGraph:a,successorWeights:l,predecessorWeights:c,intersectRect:u,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:m,maxRank:y,partition:w,time:N,notime:k};function n(S,b,j,E){var C;do C=e.uniqueId(E);while(S.hasNode(C));return j.dummy=b,S.setNode(C,j),C}function r(S){var b=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(j){b.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){var E=b.edge(j.v,j.w)||{weight:0,minlen:1},C=S.edge(j);b.setEdge(j.v,j.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),b}function a(S){var b=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(j){S.children(j).length||b.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){b.setEdge(j,S.edge(j))}),b}function l(S){var b=e.map(S.nodes(),function(j){var E={};return e.forEach(S.outEdges(j),function(C){E[C.w]=(E[C.w]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function c(S){var b=e.map(S.nodes(),function(j){var E={};return e.forEach(S.inEdges(j),function(C){E[C.v]=(E[C.v]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function u(S,b){var j=S.x,E=S.y,C=b.x-j,T=b.y-E,R=S.width/2,$=S.height/2;if(!C&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var D,U;return Math.abs(T)*R>Math.abs(C)*$?(T<0&&($=-$),D=$*C/T,U=$):(C<0&&(R=-R),D=R,U=R*T/C),{x:j+D,y:E+U}}function f(S){var b=e.map(e.range(y(S)+1),function(){return[]});return e.forEach(S.nodes(),function(j){var E=S.node(j),C=E.rank;e.isUndefined(C)||(b[C][E.order]=j)}),b}function p(S){var b=e.min(e.map(S.nodes(),function(j){return S.node(j).rank}));e.forEach(S.nodes(),function(j){var E=S.node(j);e.has(E,"rank")&&(E.rank-=b)})}function h(S){var b=e.min(e.map(S.nodes(),function(T){return S.node(T).rank})),j=[];e.forEach(S.nodes(),function(T){var R=S.node(T).rank-b;j[R]||(j[R]=[]),j[R].push(T)});var E=0,C=S.graph().nodeRankFactor;e.forEach(j,function(T,R){e.isUndefined(T)&&R%C!==0?--E:E&&e.forEach(T,function($){S.node($).rank+=E})})}function m(S,b,j,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=j,C.order=E),n(S,"border",C,b)}function y(S){return e.max(e.map(S.nodes(),function(b){var j=S.node(b).rank;if(!e.isUndefined(j))return j}))}function w(S,b){var j={lhs:[],rhs:[]};return e.forEach(S,function(E){b(E)?j.lhs.push(E):j.rhs.push(E)}),j}function N(S,b){var j=e.now();try{return b()}finally{console.log(S+" time: "+(e.now()-j)+"ms")}}function k(S,b){return b()}return Ev}var Cv,oT;function Z7(){if(oT)return Cv;oT=1;var e=At(),t=Hn();Cv={run:n,undo:a};function n(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(c){r(l,c)})}function r(l,c){var u=c.v,f=l.node(u).rank,p=c.w,h=l.node(p).rank,m=c.name,y=l.edge(c),w=y.labelRank;if(h!==f+1){l.removeEdge(c);var N,k,S;for(S=0,++f;f<h;++S,++f)y.points=[],k={width:0,height:0,edgeLabel:y,edgeObj:c,rank:f},N=t.addDummyNode(l,"edge",k,"_d"),f===w&&(k.width=y.width,k.height=y.height,k.dummy="edge-label",k.labelpos=y.labelpos),l.setEdge(u,N,{weight:y.weight},m),S===0&&l.graph().dummyChains.push(N),u=N;l.setEdge(u,p,{weight:y.weight},m)}}function a(l){e.forEach(l.graph().dummyChains,function(c){var u=l.node(c),f=u.edgeLabel,p;for(l.setEdge(u.edgeObj,f);u.dummy;)p=l.successors(c)[0],l.removeNode(c),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),c=p,u=l.node(c)})}return Cv}var Tv,iT;function ah(){if(iT)return Tv;iT=1;var e=At();Tv={longestPath:t,slack:n};function t(r){var a={};function l(c){var u=r.node(c);if(e.has(a,c))return u.rank;a[c]=!0;var f=e.min(e.map(r.outEdges(c),function(p){return l(p.w)-r.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(r.sources(),l)}function n(r,a){return r.node(a.w).rank-r.node(a.v).rank-r.edge(a).minlen}return Tv}var Av,lT;function IM(){if(lT)return Av;lT=1;var e=At(),t=zr().Graph,n=ah().slack;Av=r;function r(u){var f=new t({directed:!1}),p=u.nodes()[0],h=u.nodeCount();f.setNode(p,{});for(var m,y;a(f,u)<h;)m=l(f,u),y=f.hasNode(m.v)?n(u,m):-n(u,m),c(f,u,y);return f}function a(u,f){function p(h){e.forEach(f.nodeEdges(h),function(m){var y=m.v,w=h===y?m.w:y;!u.hasNode(w)&&!n(f,m)&&(u.setNode(w,{}),u.setEdge(h,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function l(u,f){return e.minBy(f.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(f,p)})}function c(u,f,p){e.forEach(u.nodes(),function(h){f.node(h).rank+=p})}return Av}var Rv,cT;function Q7(){if(cT)return Rv;cT=1;var e=At(),t=IM(),n=ah().slack,r=ah().longestPath,a=zr().alg.preorder,l=zr().alg.postorder,c=Hn().simplify;Rv=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=w,u.enterEdge=N,u.exchangeEdges=k;function u(E){E=c(E),r(E);var C=t(E);m(C),f(C,E);for(var T,R;T=w(C);)R=N(C,E,T),k(C,E,T,R)}function f(E,C){var T=l(E,E.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){p(E,C,R)})}function p(E,C,T){var R=E.node(T),$=R.parent;E.edge(T,$).cutvalue=h(E,C,T)}function h(E,C,T){var R=E.node(T),$=R.parent,D=!0,U=C.edge(T,$),P=0;return U||(D=!1,U=C.edge($,T)),P=U.weight,e.forEach(C.nodeEdges(T),function(V){var J=V.v===T,ee=J?V.w:V.v;if(ee!==$){var M=J===D,Z=C.edge(V).weight;if(P+=M?Z:-Z,b(E,T,ee)){var G=E.edge(T,ee).cutvalue;P+=M?-G:G}}}),P}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,T,R,$){var D=T,U=E.node(R);return C[R]=!0,e.forEach(E.neighbors(R),function(P){e.has(C,P)||(T=y(E,C,T,P,R))}),U.low=D,U.lim=T++,$?U.parent=$:delete U.parent,T}function w(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,T){var R=T.v,$=T.w;C.hasEdge(R,$)||(R=T.w,$=T.v);var D=E.node(R),U=E.node($),P=D,V=!1;D.lim>U.lim&&(P=U,V=!0);var J=e.filter(C.edges(),function(ee){return V===j(E,E.node(ee.v),P)&&V!==j(E,E.node(ee.w),P)});return e.minBy(J,function(ee){return n(C,ee)})}function k(E,C,T,R){var $=T.v,D=T.w;E.removeEdge($,D),E.setEdge(R.v,R.w,{}),m(E),f(E,C),S(E,C)}function S(E,C){var T=e.find(E.nodes(),function($){return!C.node($).parent}),R=a(E,T);R=R.slice(1),e.forEach(R,function($){var D=E.node($).parent,U=C.edge($,D),P=!1;U||(U=C.edge(D,$),P=!0),C.node($).rank=C.node(D).rank+(P?U.minlen:-U.minlen)})}function b(E,C,T){return E.hasEdge(C,T)}function j(E,C,T){return T.low<=C.lim&&C.lim<=T.lim}return Rv}var Mv,uT;function J7(){if(uT)return Mv;uT=1;var e=ah(),t=e.longestPath,n=IM(),r=Q7();Mv=a;function a(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":c(f);break;case"longest-path":l(f);break;default:u(f)}}var l=t;function c(f){t(f),n(f)}function u(f){r(f)}return Mv}var Iv,dT;function e9(){if(dT)return Iv;dT=1;var e=At();Iv=t;function t(a){var l=r(a);e.forEach(a.graph().dummyChains,function(c){for(var u=a.node(c),f=u.edgeObj,p=n(a,l,f.v,f.w),h=p.path,m=p.lca,y=0,w=h[y],N=!0;c!==f.w;){if(u=a.node(c),N){for(;(w=h[y])!==m&&a.node(w).maxRank<u.rank;)y++;w===m&&(N=!1)}if(!N){for(;y<h.length-1&&a.node(w=h[y+1]).minRank<=u.rank;)y++;w=h[y]}a.setParent(c,w),c=a.successors(c)[0]}})}function n(a,l,c,u){var f=[],p=[],h=Math.min(l[c].low,l[u].low),m=Math.max(l[c].lim,l[u].lim),y,w;y=c;do y=a.parent(y),f.push(y);while(y&&(l[y].low>h||m>l[y].lim));for(w=y,y=u;(y=a.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function r(a){var l={},c=0;function u(f){var p=c;e.forEach(a.children(f),u),l[f]={low:p,lim:c++}}return e.forEach(a.children(),u),l}return Iv}var $v,hT;function t9(){if(hT)return $v;hT=1;var e=At(),t=Hn();$v={run:n,cleanup:c};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),p=a(u),h=e.max(e.values(p))-1,m=2*h+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(w){u.edge(w).minlen*=m});var y=l(u)+1;e.forEach(u.children(),function(w){r(u,f,m,y,h,p,w)}),u.graph().nodeRankFactor=m}function r(u,f,p,h,m,y,w){var N=u.children(w);if(!N.length){w!==f&&u.setEdge(f,w,{weight:0,minlen:p});return}var k=t.addBorderNode(u,"_bt"),S=t.addBorderNode(u,"_bb"),b=u.node(w);u.setParent(k,w),b.borderTop=k,u.setParent(S,w),b.borderBottom=S,e.forEach(N,function(j){r(u,f,p,h,m,y,j);var E=u.node(j),C=E.borderTop?E.borderTop:j,T=E.borderBottom?E.borderBottom:j,R=E.borderTop?h:2*h,$=C!==T?1:m-y[w]+1;u.setEdge(k,C,{weight:R,minlen:$,nestingEdge:!0}),u.setEdge(T,S,{weight:R,minlen:$,nestingEdge:!0})}),u.parent(w)||u.setEdge(f,k,{weight:0,minlen:m+y[w]})}function a(u){var f={};function p(h,m){var y=u.children(h);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),f[h]=m}return e.forEach(u.children(),function(h){p(h,1)}),f}function l(u){return e.reduce(u.edges(),function(f,p){return f+u.edge(p).weight},0)}function c(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(u.edges(),function(p){var h=u.edge(p);h.nestingEdge&&u.removeEdge(p)})}return $v}var Ov,fT;function n9(){if(fT)return Ov;fT=1;var e=At(),t=Hn();Ov=n;function n(a){function l(c){var u=a.children(c),f=a.node(c);if(u.length&&e.forEach(u,l),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)r(a,"borderLeft","_bl",c,f,p),r(a,"borderRight","_br",c,f,p)}}e.forEach(a.children(),l)}function r(a,l,c,u,f,p){var h={width:0,height:0,rank:p,borderType:l},m=f[l][p-1],y=t.addDummyNode(a,"border",h,c);f[l][p]=y,a.setParent(y,u),m&&a.setEdge(m,y,{weight:1})}return Ov}var Lv,pT;function r9(){if(pT)return Lv;pT=1;var e=At();Lv={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&r(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&l(p),(h==="lr"||h==="rl")&&(u(p),r(p))}function r(p){e.forEach(p.nodes(),function(h){a(p.node(h))}),e.forEach(p.edges(),function(h){a(p.edge(h))})}function a(p){var h=p.width;p.width=p.height,p.height=h}function l(p){e.forEach(p.nodes(),function(h){c(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,c),e.has(m,"y")&&c(m)})}function c(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return Lv}var Pv,mT;function s9(){if(mT)return Pv;mT=1;var e=At();Pv=t;function t(n){var r={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),l=e.max(e.map(a,function(p){return n.node(p).rank})),c=e.map(e.range(l+1),function(){return[]});function u(p){if(!e.has(r,p)){r[p]=!0;var h=n.node(p);c[h.rank].push(p),e.forEach(n.successors(p),u)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,u),c}return Pv}var Dv,gT;function a9(){if(gT)return Dv;gT=1;var e=At();Dv=t;function t(r,a){for(var l=0,c=1;c<a.length;++c)l+=n(r,a[c-1],a[c]);return l}function n(r,a,l){for(var c=e.zipObject(l,e.map(l,function(y,w){return w})),u=e.flatten(e.map(a,function(y){return e.sortBy(e.map(r.outEdges(y),function(w){return{pos:c[w.w],weight:r.edge(w).weight}}),"pos")}),!0),f=1;f<l.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(u.forEach(function(y){var w=y.pos+f;h[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=h[w+1]),w=w-1>>1,h[w]+=y.weight;m+=y.weight*N})),m}return Dv}var qv,yT;function o9(){if(yT)return qv;yT=1;var e=At();qv=t;function t(n,r){return e.map(r,function(a){var l=n.inEdges(a);if(l.length){var c=e.reduce(l,function(u,f){var p=n.edge(f),h=n.node(f.v);return{sum:u.sum+p.weight*h.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}return qv}var Fv,wT;function i9(){if(wT)return Fv;wT=1;var e=At();Fv=t;function t(a,l){var c={};e.forEach(a,function(f,p){var h=c[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(l.edges(),function(f){var p=c[f.v],h=c[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(c[f.w]))});var u=e.filter(c,function(f){return!f.indegree});return n(u)}function n(a){var l=[];function c(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&r(p,h)}}function u(p){return function(h){h.in.push(p),--h.indegree===0&&a.push(h)}}for(;a.length;){var f=a.pop();l.push(f),e.forEach(f.in.reverse(),c(f)),e.forEach(f.out,u(f))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function r(a,l){var c=0,u=0;a.weight&&(c+=a.barycenter*a.weight,u+=a.weight),l.weight&&(c+=l.barycenter*l.weight,u+=l.weight),a.vs=l.vs.concat(a.vs),a.barycenter=c/u,a.weight=u,a.i=Math.min(l.i,a.i),l.merged=!0}return Fv}var Bv,vT;function l9(){if(vT)return Bv;vT=1;var e=At(),t=Hn();Bv=n;function n(l,c){var u=t.partition(l,function(k){return e.has(k,"barycenter")}),f=u.lhs,p=e.sortBy(u.rhs,function(k){return-k.i}),h=[],m=0,y=0,w=0;f.sort(a(!!c)),w=r(h,p,w),e.forEach(f,function(k){w+=k.vs.length,h.push(k.vs),m+=k.barycenter*k.weight,y+=k.weight,w=r(h,p,w)});var N={vs:e.flatten(h,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function r(l,c,u){for(var f;c.length&&(f=e.last(c)).i<=u;)c.pop(),l.push(f.vs),u++;return u}function a(l){return function(c,u){return c.barycenter<u.barycenter?-1:c.barycenter>u.barycenter?1:l?u.i-c.i:c.i-u.i}}return Bv}var zv,xT;function c9(){if(xT)return zv;xT=1;var e=At(),t=o9(),n=i9(),r=l9();zv=a;function a(u,f,p,h){var m=u.children(f),y=u.node(f),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,k={};w&&(m=e.filter(m,function(T){return T!==w&&T!==N}));var S=t(u,m);e.forEach(S,function(T){if(u.children(T.v).length){var R=a(u,T.v,p,h);k[T.v]=R,e.has(R,"barycenter")&&c(T,R)}});var b=n(S,p);l(b,k);var j=r(b,h);if(w&&(j.vs=e.flatten([w,j.vs,N],!0),u.predecessors(w).length)){var E=u.node(u.predecessors(w)[0]),C=u.node(u.predecessors(N)[0]);e.has(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+E.order+C.order)/(j.weight+2),j.weight+=2}return j}function l(u,f){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function c(u,f){e.isUndefined(u.barycenter)?(u.barycenter=f.barycenter,u.weight=f.weight):(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight)}return zv}var Hv,bT;function u9(){if(bT)return Hv;bT=1;var e=At(),t=zr().Graph;Hv=n;function n(a,l,c){var u=r(a),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),m=a.parent(p);(h.rank===l||h.minRank<=l&&l<=h.maxRank)&&(f.setNode(p),f.setParent(p,m||u),e.forEach(a[c](p),function(y){var w=y.v===p?y.w:y.v,N=f.edge(w,p),k=e.isUndefined(N)?0:N.weight;f.setEdge(w,p,{weight:a.edge(y).weight+k})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[l],borderRight:h.borderRight[l]}))}),f}function r(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}return Hv}var Uv,kT;function d9(){if(kT)return Uv;kT=1;var e=At();Uv=t;function t(n,r,a){var l={},c;e.forEach(a,function(u){for(var f=n.parent(u),p,h;f;){if(p=n.parent(f),p?(h=l[p],l[p]=f):(h=c,c=f),h&&h!==f){r.setEdge(h,f);return}f=p}})}return Uv}var Wv,_T;function h9(){if(_T)return Wv;_T=1;var e=At(),t=s9(),n=a9(),r=c9(),a=u9(),l=d9(),c=zr().Graph,u=Hn();Wv=f;function f(y){var w=u.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),k=p(y,e.range(w-1,-1,-1),"outEdges"),S=t(y);m(y,S);for(var b=Number.POSITIVE_INFINITY,j,E=0,C=0;C<4;++E,++C){h(E%2?N:k,E%4>=2),S=u.buildLayerMatrix(y);var T=n(y,S);T<b&&(C=0,j=e.cloneDeep(S),b=T)}m(y,j)}function p(y,w,N){return e.map(w,function(k){return a(y,k,N)})}function h(y,w){var N=new c;e.forEach(y,function(k){var S=k.graph().root,b=r(k,S,N,w);e.forEach(b.vs,function(j,E){k.node(j).order=E}),l(k,N,b.vs)})}function m(y,w){e.forEach(w,function(N){e.forEach(N,function(k,S){y.node(k).order=S})})}return Wv}var Vv,NT;function f9(){if(NT)return Vv;NT=1;var e=At(),t=zr().Graph,n=Hn();Vv={positionX:N,findType1Conflicts:r,findType2Conflicts:a,addConflict:c,hasConflict:u,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function r(b,j){var E={};function C(T,R){var $=0,D=0,U=T.length,P=e.last(R);return e.forEach(R,function(V,J){var ee=l(b,V),M=ee?b.node(ee).order:U;(ee||V===P)&&(e.forEach(R.slice(D,J+1),function(Z){e.forEach(b.predecessors(Z),function(G){var I=b.node(G),q=I.order;(q<$||M<q)&&!(I.dummy&&b.node(Z).dummy)&&c(E,G,Z)})}),D=J+1,$=M)}),R}return e.reduce(j,C),E}function a(b,j){var E={};function C(R,$,D,U,P){var V;e.forEach(e.range($,D),function(J){V=R[J],b.node(V).dummy&&e.forEach(b.predecessors(V),function(ee){var M=b.node(ee);M.dummy&&(M.order<U||M.order>P)&&c(E,ee,V)})})}function T(R,$){var D=-1,U,P=0;return e.forEach($,function(V,J){if(b.node(V).dummy==="border"){var ee=b.predecessors(V);ee.length&&(U=b.node(ee[0]).order,C($,P,J,D,U),P=J,D=U)}C($,P,$.length,U,R.length)}),$}return e.reduce(j,T),E}function l(b,j){if(b.node(j).dummy)return e.find(b.predecessors(j),function(E){return b.node(E).dummy})}function c(b,j,E){if(j>E){var C=j;j=E,E=C}var T=b[j];T||(b[j]=T={}),T[E]=!0}function u(b,j,E){if(j>E){var C=j;j=E,E=C}return e.has(b[j],E)}function f(b,j,E,C){var T={},R={},$={};return e.forEach(j,function(D){e.forEach(D,function(U,P){T[U]=U,R[U]=U,$[U]=P})}),e.forEach(j,function(D){var U=-1;e.forEach(D,function(P){var V=C(P);if(V.length){V=e.sortBy(V,function(G){return $[G]});for(var J=(V.length-1)/2,ee=Math.floor(J),M=Math.ceil(J);ee<=M;++ee){var Z=V[ee];R[P]===P&&U<$[Z]&&!u(E,P,Z)&&(R[Z]=P,R[P]=T[P]=T[Z],U=$[Z])}}})}),{root:T,align:R}}function p(b,j,E,C,T){var R={},$=h(b,j,E,T),D=T?"borderLeft":"borderRight";function U(J,ee){for(var M=$.nodes(),Z=M.pop(),G={};Z;)G[Z]?J(Z):(G[Z]=!0,M.push(Z),M=M.concat(ee(Z))),Z=M.pop()}function P(J){R[J]=$.inEdges(J).reduce(function(ee,M){return Math.max(ee,R[M.v]+$.edge(M))},0)}function V(J){var ee=$.outEdges(J).reduce(function(Z,G){return Math.min(Z,R[G.w]-$.edge(G))},Number.POSITIVE_INFINITY),M=b.node(J);ee!==Number.POSITIVE_INFINITY&&M.borderType!==D&&(R[J]=Math.max(R[J],ee))}return U(P,$.predecessors.bind($)),U(V,$.successors.bind($)),e.forEach(C,function(J){R[J]=R[E[J]]}),R}function h(b,j,E,C){var T=new t,R=b.graph(),$=k(R.nodesep,R.edgesep,C);return e.forEach(j,function(D){var U;e.forEach(D,function(P){var V=E[P];if(T.setNode(V),U){var J=E[U],ee=T.edge(J,V);T.setEdge(J,V,Math.max($(b,P,U),ee||0))}U=P})}),T}function m(b,j){return e.minBy(e.values(j),function(E){var C=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(R,$){var D=S(b,$)/2;C=Math.max(R+D,C),T=Math.min(R-D,T)}),C-T})}function y(b,j){var E=e.values(j),C=e.min(E),T=e.max(E);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function($){var D=R+$,U=b[D],P;if(U!==j){var V=e.values(U);P=$==="l"?C-e.min(V):T-e.max(V),P&&(b[D]=e.mapValues(U,function(J){return J+P}))}})})}function w(b,j){return e.mapValues(b.ul,function(E,C){if(j)return b[j.toLowerCase()][C];var T=e.sortBy(e.map(b,C));return(T[1]+T[2])/2})}function N(b){var j=n.buildLayerMatrix(b),E=e.merge(r(b,j),a(b,j)),C={},T;e.forEach(["u","d"],function($){T=$==="u"?j:e.values(j).reverse(),e.forEach(["l","r"],function(D){D==="r"&&(T=e.map(T,function(J){return e.values(J).reverse()}));var U=($==="u"?b.predecessors:b.successors).bind(b),P=f(b,T,E,U),V=p(b,T,P.root,P.align,D==="r");D==="r"&&(V=e.mapValues(V,function(J){return-J})),C[$+D]=V})});var R=m(b,C);return y(C,R),w(C,b.graph().align)}function k(b,j,E){return function(C,T,R){var $=C.node(T),D=C.node(R),U=0,P;if(U+=$.width/2,e.has($,"labelpos"))switch($.labelpos.toLowerCase()){case"l":P=-$.width/2;break;case"r":P=$.width/2;break}if(P&&(U+=E?P:-P),P=0,U+=($.dummy?j:b)/2,U+=(D.dummy?j:b)/2,U+=D.width/2,e.has(D,"labelpos"))switch(D.labelpos.toLowerCase()){case"l":P=D.width/2;break;case"r":P=-D.width/2;break}return P&&(U+=E?P:-P),P=0,U}}function S(b,j){return b.node(j).width}return Vv}var Gv,ST;function p9(){if(ST)return Gv;ST=1;var e=At(),t=Hn(),n=f9().positionX;Gv=r;function r(l){l=t.asNonCompoundGraph(l),a(l),e.forEach(n(l),function(c,u){l.node(u).x=c})}function a(l){var c=t.buildLayerMatrix(l),u=l.graph().ranksep,f=0;e.forEach(c,function(p){var h=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=f+h/2}),f+=h+u})}return Gv}var Kv,jT;function m9(){if(jT)return Kv;jT=1;var e=At(),t=X7(),n=Z7(),r=J7(),a=Hn().normalizeRanks,l=e9(),c=Hn().removeEmptyRanks,u=t9(),f=n9(),p=r9(),h=h9(),m=p9(),y=Hn(),w=zr().Graph;Kv=N;function N(O,Y){var B=Y&&Y.debugTiming?y.time:y.notime;B("layout",function(){var te=B(" buildLayoutGraph",function(){return U(O)});B(" runLayout",function(){k(te,B)}),B(" updateInputGraph",function(){S(O,te)})})}function k(O,Y){Y(" makeSpaceForEdgeLabels",function(){P(O)}),Y(" removeSelfEdges",function(){H(O)}),Y(" acyclic",function(){t.run(O)}),Y(" nestingGraph.run",function(){u.run(O)}),Y(" rank",function(){r(y.asNonCompoundGraph(O))}),Y(" injectEdgeLabelProxies",function(){V(O)}),Y(" removeEmptyRanks",function(){c(O)}),Y(" nestingGraph.cleanup",function(){u.cleanup(O)}),Y(" normalizeRanks",function(){a(O)}),Y(" assignRankMinMax",function(){J(O)}),Y(" removeEdgeLabelProxies",function(){ee(O)}),Y(" normalize.run",function(){n.run(O)}),Y(" parentDummyChains",function(){l(O)}),Y(" addBorderSegments",function(){f(O)}),Y(" order",function(){h(O)}),Y(" insertSelfEdges",function(){W(O)}),Y(" adjustCoordinateSystem",function(){p.adjust(O)}),Y(" position",function(){m(O)}),Y(" positionSelfEdges",function(){L(O)}),Y(" removeBorderNodes",function(){q(O)}),Y(" normalize.undo",function(){n.undo(O)}),Y(" fixupEdgeLabelCoords",function(){G(O)}),Y(" undoCoordinateSystem",function(){p.undo(O)}),Y(" translateGraph",function(){M(O)}),Y(" assignNodeIntersects",function(){Z(O)}),Y(" reversePoints",function(){I(O)}),Y(" acyclic.undo",function(){t.undo(O)})}function S(O,Y){e.forEach(O.nodes(),function(B){var te=O.node(B),le=Y.node(B);te&&(te.x=le.x,te.y=le.y,Y.children(B).length&&(te.width=le.width,te.height=le.height))}),e.forEach(O.edges(),function(B){var te=O.edge(B),le=Y.edge(B);te.points=le.points,e.has(le,"x")&&(te.x=le.x,te.y=le.y)}),O.graph().width=Y.graph().width,O.graph().height=Y.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],j={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],T={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],$={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},D=["labelpos"];function U(O){var Y=new w({multigraph:!0,compound:!0}),B=de(O.graph());return Y.setGraph(e.merge({},j,K(B,b),e.pick(B,E))),e.forEach(O.nodes(),function(te){var le=de(O.node(te));Y.setNode(te,e.defaults(K(le,C),T)),Y.setParent(te,O.parent(te))}),e.forEach(O.edges(),function(te){var le=de(O.edge(te));Y.setEdge(te,e.merge({},$,K(le,R),e.pick(le,D)))}),Y}function P(O){var Y=O.graph();Y.ranksep/=2,e.forEach(O.edges(),function(B){var te=O.edge(B);te.minlen*=2,te.labelpos.toLowerCase()!=="c"&&(Y.rankdir==="TB"||Y.rankdir==="BT"?te.width+=te.labeloffset:te.height+=te.labeloffset)})}function V(O){e.forEach(O.edges(),function(Y){var B=O.edge(Y);if(B.width&&B.height){var te=O.node(Y.v),le=O.node(Y.w),pe={rank:(le.rank-te.rank)/2+te.rank,e:Y};y.addDummyNode(O,"edge-proxy",pe,"_ep")}})}function J(O){var Y=0;e.forEach(O.nodes(),function(B){var te=O.node(B);te.borderTop&&(te.minRank=O.node(te.borderTop).rank,te.maxRank=O.node(te.borderBottom).rank,Y=e.max(Y,te.maxRank))}),O.graph().maxRank=Y}function ee(O){e.forEach(O.nodes(),function(Y){var B=O.node(Y);B.dummy==="edge-proxy"&&(O.edge(B.e).labelRank=B.rank,O.removeNode(Y))})}function M(O){var Y=Number.POSITIVE_INFINITY,B=0,te=Number.POSITIVE_INFINITY,le=0,pe=O.graph(),ye=pe.marginx||0,Ie=pe.marginy||0;function Te(Re){var Me=Re.x,xe=Re.y,He=Re.width,Ne=Re.height;Y=Math.min(Y,Me-He/2),B=Math.max(B,Me+He/2),te=Math.min(te,xe-Ne/2),le=Math.max(le,xe+Ne/2)}e.forEach(O.nodes(),function(Re){Te(O.node(Re))}),e.forEach(O.edges(),function(Re){var Me=O.edge(Re);e.has(Me,"x")&&Te(Me)}),Y-=ye,te-=Ie,e.forEach(O.nodes(),function(Re){var Me=O.node(Re);Me.x-=Y,Me.y-=te}),e.forEach(O.edges(),function(Re){var Me=O.edge(Re);e.forEach(Me.points,function(xe){xe.x-=Y,xe.y-=te}),e.has(Me,"x")&&(Me.x-=Y),e.has(Me,"y")&&(Me.y-=te)}),pe.width=B-Y+ye,pe.height=le-te+Ie}function Z(O){e.forEach(O.edges(),function(Y){var B=O.edge(Y),te=O.node(Y.v),le=O.node(Y.w),pe,ye;B.points?(pe=B.points[0],ye=B.points[B.points.length-1]):(B.points=[],pe=le,ye=te),B.points.unshift(y.intersectRect(te,pe)),B.points.push(y.intersectRect(le,ye))})}function G(O){e.forEach(O.edges(),function(Y){var B=O.edge(Y);if(e.has(B,"x"))switch((B.labelpos==="l"||B.labelpos==="r")&&(B.width-=B.labeloffset),B.labelpos){case"l":B.x-=B.width/2+B.labeloffset;break;case"r":B.x+=B.width/2+B.labeloffset;break}})}function I(O){e.forEach(O.edges(),function(Y){var B=O.edge(Y);B.reversed&&B.points.reverse()})}function q(O){e.forEach(O.nodes(),function(Y){if(O.children(Y).length){var B=O.node(Y),te=O.node(B.borderTop),le=O.node(B.borderBottom),pe=O.node(e.last(B.borderLeft)),ye=O.node(e.last(B.borderRight));B.width=Math.abs(ye.x-pe.x),B.height=Math.abs(le.y-te.y),B.x=pe.x+B.width/2,B.y=te.y+B.height/2}}),e.forEach(O.nodes(),function(Y){O.node(Y).dummy==="border"&&O.removeNode(Y)})}function H(O){e.forEach(O.edges(),function(Y){if(Y.v===Y.w){var B=O.node(Y.v);B.selfEdges||(B.selfEdges=[]),B.selfEdges.push({e:Y,label:O.edge(Y)}),O.removeEdge(Y)}})}function W(O){var Y=y.buildLayerMatrix(O);e.forEach(Y,function(B){var te=0;e.forEach(B,function(le,pe){var ye=O.node(le);ye.order=pe+te,e.forEach(ye.selfEdges,function(Ie){y.addDummyNode(O,"selfedge",{width:Ie.label.width,height:Ie.label.height,rank:ye.rank,order:pe+ ++te,e:Ie.e,label:Ie.label},"_se")}),delete ye.selfEdges})})}function L(O){e.forEach(O.nodes(),function(Y){var B=O.node(Y);if(B.dummy==="selfedge"){var te=O.node(B.e.v),le=te.x+te.width/2,pe=te.y,ye=B.x-le,Ie=te.height/2;O.setEdge(B.e,B.label),O.removeNode(Y),B.label.points=[{x:le+2*ye/3,y:pe-Ie},{x:le+5*ye/6,y:pe-Ie},{x:le+ye,y:pe},{x:le+5*ye/6,y:pe+Ie},{x:le+2*ye/3,y:pe+Ie}],B.label.x=B.x,B.label.y=B.y}})}function K(O,Y){return e.mapValues(e.pick(O,Y),Number)}function de(O){var Y={};return e.forEach(O,function(B,te){Y[te.toLowerCase()]=B}),Y}return Kv}var Yv,ET;function g9(){if(ET)return Yv;ET=1;var e=At(),t=Hn(),n=zr().Graph;Yv={debugOrdering:r};function r(a){var l=t.buildLayerMatrix(a),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(u){c.setNode(u,{label:u}),c.setParent(u,"layer"+a.node(u).rank)}),e.forEach(a.edges(),function(u){c.setEdge(u.v,u.w,{},u.name)}),e.forEach(l,function(u,f){var p="layer"+f;c.setNode(p,{rank:"same"}),e.reduce(u,function(h,m){return c.setEdge(h,m,{style:"invis"}),m})}),c}return Yv}var Xv,CT;function y9(){return CT||(CT=1,Xv="0.8.5"),Xv}var Zv,TT;function w9(){return TT||(TT=1,Zv={graphlib:zr(),layout:m9(),debug:g9(),util:{time:Hn().time,notime:Hn().notime},version:y9()}),Zv}var v9=w9();const AT=Dx(v9),So=240,gc=130,Oi=74,Hh=72,rc=Oi+Hh;function $M(e,t){var r;let n=So;for(const a of e)n=Math.max(n,((r=t.get(a.id))==null?void 0:r.width)??So);return n}const oh=420,OM=1;function x9(e,t,n,r){return Math.min(OM,n/Math.max(1,e),r/Math.max(1,t))}function jo(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function b9(e,t){return((t==null?void 0:t.get(e))??0)>0?oh:0}function k9(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function yc(e,t,n){const r=t.get(e);return{w:((r==null?void 0:r.width)??So)+b9(e,n),h:Math.max((r==null?void 0:r.height)??gc,k9(e,n))}}function _9(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function N9(e,t,n,r,a,l){const c=new AT.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(b=>!a.has(b)),f=new Set(u);for(const b of u){const{w:j,h:E}=yc(b,r,l);c.setNode(b,{width:j,height:E})}for(const b of t)f.has(b.source)&&f.has(b.target)&&c.setEdge(b.source,b.target);AT.layout(c);const p=new Map;let h=1/0,m=1/0,y=-1/0,w=-1/0;for(const b of u){const j=c.node(b);if(!j)continue;const E=r.get(b),C=(E==null?void 0:E.width)??So,T=(E==null?void 0:E.height)??gc,R=yc(b,r,l),$=j.x-R.w/2,D=j.y-R.h/2;p.set(b,{x:$,y:D}),$<h&&(h=$),D<m&&(m=D),$+C>y&&(y=$+C),D+T>w&&(w=D+T)}if(Number.isFinite(h)&&Number.isFinite(m))for(const[b,j]of p)p.set(b,{x:j.x-h,y:j.y-m});const N=Number.isFinite(y)?y-h:0,k=Number.isFinite(w)?w-m:0;let S=null;for(const b of e){const j=a.get(b);if(!j)continue;const E=r.get(b),C=(E==null?void 0:E.width)??So,T=(E==null?void 0:E.height)??gc;S=S===null?{minX:j.x,minY:j.y,maxX:j.x+C,maxY:j.y+T}:{minX:Math.min(S.minX,j.x),minY:Math.min(S.minY,j.y),maxX:Math.max(S.maxX,j.x+C),maxY:Math.max(S.maxY,j.y+T)}}return{positions:p,width:N,height:k,pinnedBox:S}}function LM(e,t,n){const r=n.direction??"LR",a=n.pinned??new Map,l=n.measured??new Map,c=n.lanes,u=new Map;for(const h of e){const m=jo(h),y=u.get(m);y?y.push(h.id):u.set(m,[h.id])}return{laid:Array.from(u.keys()).sort().map(h=>({sid:h,...N9(u.get(h),t,r,l,a,c)})),gap:$M(e,l)}}const PM=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+oh,S9=e=>e.reduce((t,n)=>t+n.height,0)+rc*Math.max(0,e.length-1);function Ox(e,t,n,r){const a=f=>{const p=[[]];let h=0;for(const m of e)h>0&&h+m.height>f&&(p.push([]),h=0),p[p.length-1].push(m),h+=m.height+rc;return p},l=[];for(let f=0;f<e.length;f++){let p=-rc;for(let h=f;h<e.length;h++)l.push(p+=e[h].height+rc)}l.sort((f,p)=>f-p);const c=f=>{let p=0,h=l.length-1;for(;p<h;){const m=p+h>>1;a(l[m]).length<=f?h=m:p=m+1}return a(l[p])};let u=[e];if(n>0&&r>0){const f=h=>x9(h.reduce((m,y)=>m+PM(y),0)+t*(h.length-1),Math.max(...h.map(S9)),n,r);let p=f(u);for(let h=2;h<=e.length;h++){const m=c(h),y=f(m);y>p+1e-9&&(p=y,u=m)}}return u}function j9(e,t,n,r,a){if(!(r.width>0&&r.height>0&&a.width>0&&a.height>0))return!1;const{laid:l,gap:c}=LM(e,t,n);return l.length<2?!1:Ox(l,c,r.width,r.height).length!==Ox(l,c,a.width,a.height).length}function E9(e,t,n={}){const r=n.pinned??new Map,{laid:a,gap:l}=LM(e,t,n),c=Ox(a,l,n.availableWidth??0,n.availableHeight??0),u=new Map;let f=0;for(const p of c){const h=PM(p);let m=0;for(const{positions:y,height:w,pinnedBox:N}of p){for(const[S,b]of y)u.set(S,{x:b.x+f,y:b.y+m});let k=m+w;N&&N.maxY>k&&N.minX<f+h&&f<N.maxX&&(k=N.maxY),m=k+rc}f+=h+l}return e.map(p=>{const h=r.get(p.id);if(h)return{...p,position:h};const m=u.get(p.id);return m?{...p,position:m}:p})}function C9(e,t,n,r,a){const c=Oi+Hh,u=60,f=w=>yc(w,r,a),p=new Map(e.map(w=>[w.id,jo(w)])),h=[],m=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of m){const{w:k,h:S}=f(w),b=p.get(w)??"_default";if(n.has(w)){h.push({x:N.x,y:N.y,w:k,h:S,sid:b});continue}let j=N.y;for(let E=0;E<h.length+1;E++){const C=h.find(T=>{const R=T.sid===b?24:u,$=T.sid===b?24:c;return N.x<T.x+T.w+R&&T.x<N.x+k+R&&j<T.y+T.h+$&&T.y<j+S+$});if(!C)break;j=C.y+C.h+(C.sid===b?24:c)}j!==N.y&&(t.set(w,{x:N.x,y:j}),y.push(w)),h.push({x:N.x,y:j,w:k,h:S,sid:b})}return y}function T9(e,t,n,r,a,l,c){const u=E=>yc(E,r,l),f=E=>n.get(E)??t.get(E),p=E=>{const C=r.get(E);return{cw:(C==null?void 0:C.width)??So,ch:(C==null?void 0:C.height)??gc}},h=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!f(E.id))continue;const C=jo(E),T=m.get(C);T?T.push(E):m.set(C,[E])}const y=new Set;for(const[E,C]of m)C.every(T=>a.has(T.id)&&!n.has(T.id))&&y.add(E);const w=new Map,N=[];for(const E of e){const C=f(E.id);if(!C)continue;const{w:T,h:R}=u(E.id),$=jo(E);y.has($)?(w.get($)??w.set($,[]).get($)).push(E):N.push({x:C.x,y:C.y,w:T,h:R,...p(E.id)})}if(w.size===0||h&&N.length===0)return[];const k=Oi+Hh,S=(E,C,T,R)=>N.some($=>E<$.x+$.w+Oi&&$.x<E+T+Oi&&C<$.y+$.h+k&&$.y<C+R+k),b=$M(e,r),j=[];for(const E of[...w.keys()].sort()){const C=w.get(E);let T=1/0,R=1/0,$=-1/0,D=-1/0,U=-1/0,P=-1/0;for(const I of C){const q=f(I.id),{w:H,h:W}=u(I.id),{cw:L,ch:K}=p(I.id);T=Math.min(T,q.x),R=Math.min(R,q.y),$=Math.max($,q.x+H),D=Math.max(D,q.y+W),U=Math.max(U,q.x+L),P=Math.max(P,q.y+K)}const V=$-T,J=D-R,ee=[...new Set(N.map(I=>Math.round(I.x)))].sort((I,q)=>I-q),M=ee.length?ee:[T],Z=[0,...N.map(I=>I.y+I.h+k)].sort((I,q)=>I-q);let G=null;if(h){let I=1/0,q=1/0,H=-1/0,W=-1/0;for(const B of N)I=Math.min(I,B.x),q=Math.min(q,B.y),H=Math.max(H,B.x+B.cw),W=Math.max(W,B.y+B.ch);const L=(B,te)=>{const le=c.width/(Math.max(H,B+U-T)-Math.min(I,B)+oh),pe=c.height/(Math.max(W,te+P-R)-Math.min(q,te));return[Math.min(OM,le,pe),Math.min(le,pe),Math.max(le,pe)]},K=(B,te)=>{for(let le=0;le<B.length;le++){if(B[le]>te[le]+1e-9)return!0;if(B[le]<te[le]-1e-9)return!1}return!1},de=Math.round(H+oh+b),O=[...new Set([...Z,q])].sort((B,te)=>B-te);let Y=null;for(const B of[...M,de])for(const te of O){if(S(B,te,V,J))continue;const le=L(B,te);(Y===null||K(le,Y))&&(Y=le,G={x:B,y:te})}G&&G.x===T&&G.y===R&&(G=null)}else e:for(const I of M)for(const q of Z){if(q>=R)break;if(!S(I,q,V,J)){G={x:I,y:q};break e}}if(G){const I=G.x-T,q=G.y-R;for(const H of C){const W=f(H.id);t.set(H.id,{x:W.x+I,y:W.y+q})}j.push(E)}for(const I of C){const q=f(I.id),{w:H,h:W}=u(I.id);N.push({x:q.x,y:q.y,w:H,h:W,...p(I.id)})}}return j}function A9(e,t,n){const r=new Map;for(const a of e){if(t.has(a.id)||!n(a.id))continue;const l=jo(a);(r.get(l)??r.set(l,[]).get(l)).push(a)}if(r.size===0)return e;for(const a of r.values())a.sort((l,c)=>l.id.localeCompare(c.id));return e.map(a=>{var p;if(t.has(a.id)||n(a.id))return a;const l=r.get(jo(a));if(!l)return a;const c=(p=a.data)==null?void 0:p.parentId,u=l.find(h=>h.id===c)??l[0],f=n(u.id);return{...a,position:{x:a.position.x+f.x-u.position.x,y:a.position.y+f.y-u.position.y}}})}function R9(e,t,n,r,a,l=!1,c){const p=Oi+Hh+1,h=8,m=1.75,y=200,w=.7,N=.01,k=P=>yc(P,r,c),S=P=>n.get(P)??t.get(P),b=new Map;for(const P of e){if(!S(P.id))continue;const V=jo(P),J=b.get(V);J?J.push(P):b.set(V,[P])}const j=[],E=new Set,C=new Set,T=a.size===0;for(const P of[...b.keys()].sort()){const V=b.get(P);let J=1/0,ee=1/0,M=-1/0,Z=-1/0,G=!1;for(const W of V){const L=S(W.id),{w:K,h:de}=k(W.id);J=Math.min(J,L.x),ee=Math.min(ee,L.y),M=Math.max(M,L.x+K),Z=Math.max(Z,L.y+de),n.has(W.id)&&(G=!0)}const I=M-J,q=Z-ee;C.add(P);const H=a.get(P);H&&(I>H.w+h||q>H.h+h)&&E.add(P),a.set(P,{w:I,h:q}),j.push({sid:P,members:V.map(W=>W.id),x:J,y:ee,w:I,h:q,anchored:G,mass:1})}for(const P of[...a.keys()])C.has(P)||a.delete(P);if(l||T)return[];let R=!1;for(let P=0;P<j.length&&!R;P++)for(let V=P+1;V<j.length;V++){const J=j[P],ee=j[V];if(!(J.anchored&&ee.anchored)&&Math.abs(J.x+J.w/2-(ee.x+ee.w/2))<(J.w+ee.w)/2+61&&Math.abs(J.y+J.h/2-(ee.y+ee.h/2))<(J.h+ee.h)/2+p){R=!0;break}}if(E.size===0&&!R)return[];if(E.size>0)for(const P of j)E.has(P.sid)&&(P.mass=8);else for(const P of j)P.mass=Math.max(1,P.w*P.h/(So*gc));const $=new Map(j.map(P=>[P.sid,P.x])),D=new Map(j.map(P=>[P.sid,P.y]));for(let P=0;P<y;P++){const V=new Map,J=new Map;let ee=0;for(let M=0;M<j.length;M++)for(let Z=M+1;Z<j.length;Z++){const G=j[M],I=j[Z];if(G.anchored&&I.anchored)continue;const q=G.x+G.w/2,H=G.y+G.h/2,W=I.x+I.w/2,L=I.y+I.h/2,K=(G.w+I.w)/2+61-Math.abs(q-W),de=(G.h+I.h)/2+p-Math.abs(H-L);if(K<=0||de<=0)continue;const O=(je,$e)=>!je.anchored&&!($e<0&&je.x<=0),Y=(je,$e)=>!je.anchored&&!($e<0&&je.y<=0),B=(je,$e,Je)=>{const qe=je===$e,pt=qe?G.sid<I.sid?-1:1:Math.sign(je-$e);return Je(G,pt)||Je(I,-pt)?pt:qe&&(Je(G,-pt)||Je(I,pt))?-pt:0},te=B(q,W,O),le=B(H,L,Y),pe=te!==0,ye=le!==0;if(!pe&&!ye)continue;const Ie=pe&&(!ye||K*m<de),[Te,Re,Me,xe]=Ie?[te,K,V,O]:[le,de,J,Y],He=xe(G,Te),Ne=xe(I,-Te),_e=G.mass,Ze=I.mass,ct=He?Ne?Ze/(_e+Ze):1:0,Ke=Ne?He?_e/(_e+Ze):1:0,ce=Re*w;Me.set(G.sid,(Me.get(G.sid)??0)+Te*ce*ct),Me.set(I.sid,(Me.get(I.sid)??0)-Te*ce*Ke),ee+=ce}for(const M of j)M.anchored||(M.x=Math.max(0,M.x+(V.get(M.sid)??0)),M.y=Math.max(0,M.y+(J.get(M.sid)??0)));if(ee<N)break}const U=[];for(const P of j){const V=P.x-$.get(P.sid),J=P.y-D.get(P.sid);if(!(Math.abs(V)<1&&Math.abs(J)<1)){for(const ee of P.members){if(n.has(ee))continue;const M=t.get(ee);M&&t.set(ee,{x:M.x+V,y:M.y+J})}U.push(P.sid)}}return U}const M9=600;function Lx(e,t){return!(e.exitAt!=null&&t-e.exitAt>M9||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function I9(e,t){const n=new Set;for(const r of e.agents.values())Lx(r,t)&&n.add(r.id);return n}function $9(e,t,n=0){return e.right+n>t.left&&e.left-n<t.right&&e.bottom+n>t.top&&e.top-n<t.bottom}function O9(e,t,n=0){if(!e)return!1;for(const r of t)if($9(e,r,n))return!0;return!1}const DM="sessionGroup";function L9(e,t){var r,a;if(e.type===DM)return"transparent";if(Eo((r=e.data)==null?void 0:r.waiting))return t("--warn");if(e.type==="recapNote")return t("--muted");const n=(a=e.data)==null?void 0:a.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const qM=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function RT(e){const t={};for(const n of qM)t[n]=e(n);return t}function P9(e){return t=>e[t]??""}function D9(e,t){return qM.every(n=>e[n]===t[n])}function q9(e){const t=new Set(e.pins),n=new Map,r=new Map;for(const[a,l]of e.positions)n.set(a,l),t.has(a)&&r.set(a,l);return{positions:n,pinned:r}}const FM=.2,BM=1.6;function F9(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{x:n,y:r,zoom:a}=t;return typeof n!="number"||typeof r!="number"||typeof a!="number"||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(a)||a<FM||a>BM?null:{x:n,y:r,zoom:a}}const B9=1200,z9=1e3;function MT(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<B9?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<z9}function Ld({durationMs:e,documentHidden:t,reducedMotion:n=H9()}){return t||n?!1:Number.isFinite(e)&&e>0}function H9(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Qv(e){const t=typeof document<"u"&&document.hidden;return Ld({durationMs:e,documentHidden:t})?e:0}function U9(e,t,n){const r=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,l=(e.x+e.width)*t.zoom+t.x,c=(e.y+e.height)*t.zoom+t.y;return l>0&&r<n.width&&c>0&&a<n.height}function W9({pane:e,viewport:t,boxes:n}){if(!e||!(e.width>0)||!(e.height>0)||!Number.isFinite(t.zoom)||t.zoom<=0||!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let r=!1;for(const a of n)if(r=!0,U9(a,t,e))return!1;return r}const V9="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Jv="click for what's new";function G9(e){if(e.checkDisabled)return`${V9} · ${Jv}`;if(e.checking)return`Asking npm for the newest release… · ${Jv}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",n=e.checkFailedAgo?` · could not reach npm ${e.checkFailedAgo}`:e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${Jv}, and to check npm now`}function K9(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:e.checkFailedAgo?`${t} — npm could not be reached ${e.checkFailedAgo}, check again`:`${t} and check npm for a newer release`}function Y9(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`,n=e.open?"show what's new":"show what's new and the notice";return`Version v${e.from}, ${t} — ${n}`}function X9(e){if(e==null)return{kind:"unknown",lead:"No data yet. Start a Claude Code or Codex session — it appears here as soon as the deck sees its first event.",workspace:null,tail:""};const t=e.trim();return t===""?{kind:"machine",lead:"No data yet. Start a Claude Code or Codex session anywhere on this machine — this deck is unscoped and captures every workspace.",workspace:null,tail:""}:{kind:"scoped",lead:"No data yet. This deck only captures sessions running under",workspace:t,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const Px={kind:"assumed",claude:!0,codex:!0};function Z9(e){if(!e||typeof e!="object")return Px;const t=e.providers;if(!t||typeof t!="object")return Px;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Q9(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const IT={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function J9(e){const t=e.toLowerCase();return Object.hasOwn(IT,t)?IT[t]:t?t[0].toUpperCase()+t.slice(1):""}function eV(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function eG(e,t=[]){const n=t.length?eV(t.map(J9)):Q9(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function tV(e){const t=e.claude?{provider:"claude",watching:!0,spans:[{text:"Claude Code sends its events through a hook in "},{text:"~/.claude/settings.json",code:!0},{text:" — or in "},{text:"$CLAUDE_CONFIG_DIR/settings.json",code:!0},{text:" when you have that set — which the deck installs on first run."}]}:{provider:"claude",watching:!1,spans:[{text:"Claude Code capture is off: no Claude Code was found on this machine, or the deck was started with "},{text:"--no-claude",code:!0},{text:"."}]},n=e.codex?{provider:"codex",watching:!0,spans:[{text:"Codex installs nothing and needs no trust prompt — the deck reads "},{text:"~/.codex/sessions/",code:!0},{text:" itself, so an empty canvas means no rollout has been written there yet, or that "},{text:"$CODEX_HOME",code:!0},{text:" points at a different tree."}]}:{provider:"codex",watching:!1,spans:[{text:"Codex capture is off: no "},{text:"~/.codex/",code:!0},{text:" was found — set "},{text:"$CODEX_HOME",code:!0},{text:" if yours lives elsewhere — or the deck was started with "},{text:"--no-codex",code:!0},{text:"."}]};return[t,n]}function nV(e,t){const n=t.prefs??Mx,r=mc(n.done.level),a=mc(n["needs-input"].level),l=r===a?`${r}%`:`${r}% and ${a}%`,c=t.on?`Sound: on at ${l} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
284
-
285
- Both CLIs get the finish tone. The second tone — Claude is waiting for you — has no Codex equivalent to fire on, so it only ever plays for Claude Code.`:"",f=t.on&&t.locked?`
286
-
287
- Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return c+u+f+`
288
-
289
- Click to set the volume and the sound of each tone, and to hear either one.`}function ih(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const $T=99;function rV(e){const t=Math.max(0,Math.floor(e));return t>$T?`${$T}+`:String(t)}const sV="Pause the canvas";function aV(e){if(!e.paused)return"Pause live updates — events keep arriving and are applied when you resume (Space)";const t=Math.max(0,Math.floor(e.dropped??0));return t>0?`The pause is full — ${ih(e.held)} held and ${t} older ${t===1?"one":"ones"} already dropped. Resume to follow the canvas again (Space)`:e.held<=0?"Nothing has arrived since you paused. Resume to follow the canvas again (Space)":`${ih(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function oV(e){return e.connected||!e.paused?null:"The canvas is paused as well — Space resumes it, but nothing new arrives until the stream is back."}const zM="paused · full",iV=(e,t)=>t>0?zM:e>0?`paused · ${rV(e)}`:"paused";function lV(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:iV(e.held,t),widest:zM,title:t>0?`Connected — the pause is full at ${ih(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${ih(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}const cV=x.lazy(()=>VT(()=>import("./UsageHistoryModal-BpWy0lAC.js"),[])),uV=x.lazy(()=>VT(()=>import("./BrowserWatchModal-tavADxex.js"),[]));function OT(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const dV={agent:N6,sessionGroup:nD,recapNote:sD},hV={recapTie:aD},fV=300,LT=130,pV=160,HM="react-flow__node";function PT(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,HM))===!0}const ex=80,tx=.86;function DT(e){if(!e)return 0;const t=e.getBoundingClientRect();let n=t.right;for(const r of document.querySelectorAll(".sysdetail:not(.leaving), .usage-panel:not(.leaving)")){const a=r.getBoundingClientRect();a.width>0&&a.left>t.left&&(n=Math.min(n,a.left))}return Math.max(0,t.right-n)}function mV(e){try{const t=document.querySelector(`.${HM}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const gV=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),yV=420;function wV(e){return e<.35?"far":e<.55?"mid":"full"}const _d=18,vV=200,xV=5*6e4,bV=6,kV=2*6e4,qT=400,q0="agent-dag.layout",F0="agent-dag.layoutFrame",B0="agent-dag.viewport",UM="agent-dag.sessionListOpen",WM="agent-dag.detailOpen",VM="agent-dag.usagePanelOpen",GM="agent-dag.systemPanelOpen",FT="agent-dag.accountsPanelOpen",nx="agent-dag.versionNoticeDismissed",BT="agent-dag.oldNameNoticeDismissed",_V=15*6e4,rx={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",not_writable:"the install directory is not writable by this user — run:",opted_out:"installs are off (AGENTS_DECK_NO_INSTALL=1) — run:",retired_name:"this install came from a name that is no longer published — run:"},Nd="agent-dag.autoRestart",zT="agent-dag.bundleReloadedFor";function NV(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(UM)==="1"}catch{return!1}}function SV(e){if(!(typeof window>"u"))try{window.localStorage.setItem(UM,e?"1":"0")}catch{}}function jV(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(WM)==="1"}catch{return!1}}function EV(e){if(!(typeof window>"u"))try{window.localStorage.setItem(WM,e?"1":"0")}catch{}}function CV(){const e=Sa(VM);return e===null?!0:e==="1"}function TV(e){if(!(typeof window>"u"))try{window.localStorage.setItem(VM,e?"1":"0")}catch{}}function AV(){const e=Sa(GM);return e===null?!0:e==="1"}function RV(e){if(!(typeof window>"u"))try{window.localStorage.setItem(GM,e?"1":"0")}catch{}}function MV(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(q0);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,l])=>l&&typeof l.x=="number"&&typeof l.y=="number");return{positions:a,pins:a.map(([l])=>l)}}return{positions:Object.entries(n.positions??{}).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function Sd(e,t){if(!(typeof window>"u"))try{const n={};for(const[r,a]of e)n[r]=a;for(const[r,a]of t)n[r]=a;window.localStorage.setItem(q0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function IV(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(F0);if(!e)return null;const t=JSON.parse(e);return!(typeof(t==null?void 0:t.width)=="number"&&typeof(t==null?void 0:t.height)=="number")||!(t.width>0&&t.height>0)?null:{width:t.width,height:t.height}}catch{return null}}function $V(e){if(!(typeof window>"u"))try{window.localStorage.setItem(F0,JSON.stringify(e))}catch{}}function OV(){if(typeof window>"u")return null;try{return F9(window.localStorage.getItem(B0))}catch{return null}}function LV(e){if(!(typeof window>"u"))try{window.localStorage.setItem(B0,JSON.stringify(e))}catch{}}function HT(){if(!(typeof window>"u")){try{window.localStorage.removeItem(q0)}catch{}try{window.localStorage.removeItem(B0)}catch{}try{window.localStorage.removeItem(F0)}catch{}}}function PV(e,t){const n=e.agents.get(t);if(!n)return;const r=[];for(const h of e.agents.values())h.sessionId===t&&r.push(h);const a={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:r.map(h=>({id:h.id,kind:h.kind,label:h.label,parentId:h.parentId,state:h.state,startedAt:h.startedAt,endedAt:h.endedAt,model:h.model,cwd:h.cwd,usage:h.usage,prompts:h.prompts,tools:h.tools.map(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},l=JSON.stringify(a,null,2),c=new Blob([l],{type:"application/json"}),u=URL.createObjectURL(c),f=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=u,f.download=`${Yt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const KM={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},DV={file:"M3.4 1.8h4.5l2.7 2.7v7.7H3.4z M7.9 1.8v2.7h2.7",shell:"M2.4 3.8 5.6 7l-3.2 3.2 M7.4 10.6h4.2",web:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M1.8 7h10.4 M7 1.8c-1.5 1.4-2.3 3.1-2.3 5.2s.8 3.8 2.3 5.2c1.5-1.4 2.3-3.1 2.3-5.2S8.5 3.2 7 1.8z",agent:"M3.3 4.8h7.4a1.2 1.2 0 0 1 1.2 1.2v4.8a1.2 1.2 0 0 1-1.2 1.2H3.3a1.2 1.2 0 0 1-1.2-1.2V6a1.2 1.2 0 0 1 1.2-1.2z M7 4.8V2.4 M5.3 8.2h.01 M8.7 8.2h.01",task:"M2.2 4l1.2 1.2 2-2.2 M7.4 4.2h4.4 M2.2 9.4l1.2 1.2 2-2.2 M7.4 9.6h4.4",plan:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M9 5 8 8 5 9l1-3z",mcp:"M5 1.8v2.6 M9 1.8v2.6 M3.6 4.4h6.8v2.2a3.4 3.4 0 0 1-6.8 0z M7 10v2.2",other:"M3.5 7h.01 M7 7h.01 M10.5 7h.01"};function qV({cat:e}){return i.jsx("svg",{className:"cat-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:DV[e]})})}const lh={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},YM=FA,UT=new WeakMap;function FV(e,t){let n=UT.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map},UT.set(e,n));const{byId:r}=n;return a=>{let l=r.get(a.id);return l||(l={...a,onOpenContext:t},r.set(a.id,l)),l}}function XM(e){const t=new Map;for(const n of e.agents.values())n.tools.length>0&&t.set(n.id,Math.min(4,n.tools.length));return t}function BV(e,t,n,r,a,l,c,u,f,p,h,m,y,w,N,k,S,b){var ee,M,Z,G;const j=[],E=[],C=FV(e,b);for(const I of e.agents.values()){if(!S.has(I.id))continue;const q=I.exitAt!=null,H=k!=null&&!k.has(I.id),W=[q?"rf-exiting":"",H?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,L=l.get(I.id);if(j.push({id:I.id,type:"agent",position:{x:0,y:0},data:C(I),className:W,ariaLabel:E6(I,t),...L?{width:L.width,height:L.height}:null}),I.parentId&&S.has(I.parentId)){const O=Gd(I.sessionId),Y=q,B=N.size>0&&(N.has(I.id)||N.has(I.parentId)),te=k!=null&&!k.has(I.id)&&!k.has(I.parentId),le=I.state==="active"?2:1.5,pe=B?le+1.5:le,ye=Y?.2:te?.12:1,Ie=["sess-edge",I.state==="active"?"sess-live":"sess-idle",Y?"rf-edge-exiting":"",B?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${I.parentId}->${I.id}`,source:I.parentId,target:I.id,animated:(I.state==="active"||B)&&!Y,type:"smoothstep",style:{"--session-hue":O,strokeWidth:pe,opacity:ye,transition:"var(--edge-transition)"},className:Ie})}const K=I.kind==="root"?xh(I):null,de=K?LA(I.sessionId,K.at):null;if(K&&de&&!y6(de)){const O=c0(I.id),Y=Gd(I.sessionId),B=l.get(O);j.push({id:O,type:"recapNote",position:{x:0,y:0},data:{sessionId:I.sessionId,parentId:I.id,recap:K,noteKey:de,hue:Y},className:H?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${I.label}`,...B?{width:B.width,height:B.height}:null}),E.push({id:`e:recap:${I.id}`,source:O,target:I.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":Y}})}}const T=XM(e),R=`${y}#lanes:${_9(T)}`,$=new Set(j.filter(I=>I.type==="recapNote").map(I=>I.id));for(const I of Array.from(h.keys()))b6(I)&&!$.has(I)&&!a.has(I)&&(h.delete(I),m.delete(I));const D=j.filter(I=>LH(I.id,a,h,m));if(D.length>0||R!==w.current){if(D.length>0){const I=A9(E9(j,E,{direction:"LR",pinned:a,measured:l,availableWidth:n,availableHeight:r,lanes:T}),a,q=>Od(q,h,m)?void 0:h.get(q));for(const q of I)Od(q.id,h,m)&&lN(q.id,q.position,h,m);T9(j,h,a,l,new Set(D.filter(q=>q.type!=="recapNote").map(q=>q.id)),T,{width:n,height:r});for(const q of D){if(q.type!=="recapNote")continue;const H=(ee=q.data)==null?void 0:ee.parentId;if(!H)continue;const W=a.get(H)??(Od(H,h,m)?void 0:h.get(H));if(!W)continue;const L=((M=l.get(q.id))==null?void 0:M.width)??fV,K=((Z=l.get(q.id))==null?void 0:Z.height)??LT,de=((G=l.get(H))==null?void 0:G.height)??LT;lN(q.id,{x:W.x-pV-L,y:W.y+(de-K)/2},h,m)}}C9(j,h,a,l,T),w.current=R}const U=R9(j,h,a,l,c,!f||p,T);U.length>0&&u(U);const P=IH(e.agents.values());xd(h,P),xd(m,P),xd(a,P),xd(l,MH(e.agents.values()));const V=[];let J=!1;for(const I of j){let q=a.get(I.id)??h.get(I.id);q||(q=PH(I.id,h,m),J=!0),V.push({...I,position:q})}return J&&(w.current=""),{nodes:V,edges:E}}function zV(){return i.jsx(n0,{children:i.jsx(WV,{})})}const HV=e=>e.transform[2]>=e.maxZoom,UV=e=>e.transform[2]<=e.minZoom;function WV(){var Js,Ja,ks,bl;const e=kc(),t=yt(HV),n=yt(UV),r=Ut(),a=x.useState(xx)[0],l=x.useRef(a),[,c]=x.useState(0),u=x.useCallback(()=>c(F=>F+1),[]),[f,p]=x.useState(jV);x.useEffect(()=>{EV(f)},[f]);const[h,m]=x.useState(()=>new Set),[y,w]=x.useState(null),[N,k]=x.useState(null),S=x.useCallback((F,z)=>{m(se=>{if(!z)return new Set([F]);const ae=new Set(se);return ae.has(F)?ae.delete(F):ae.add(F),ae}),w(se=>z&&se===F?se:F),z||p(!0)},[]),b=x.useCallback(()=>{m(new Set),w(null)},[]),[j,E]=x.useState(null),[C,T]=x.useState(null),R=x.useCallback(F=>T(F),[]),[$,D]=x.useState(!1),[U,P]=x.useState(!1),[V,J]=x.useState(!1),ee=x.useRef(null),[M,Z]=x.useState(NV);x.useEffect(()=>{SV(M)},[M]);const[G,I]=x.useState(CV);x.useEffect(()=>{TV(G)},[G]);const[q,H]=x.useState(AV);x.useEffect(()=>{RV(q)},[q]);const W=x.useRef(!1),[L,K]=x.useState(()=>{const F=(()=>{try{const z=window.localStorage.getItem(FT);return z===null?!0:z==="1"}catch{return!0}})();return F&&M?(W.current=!0,!1):F});x.useEffect(()=>{if(!(!L&&W.current))try{window.localStorage.setItem(FT,L?"1":"0")}catch{}},[L]),x.useEffect(()=>{!M&&W.current&&(W.current=!1,K(!0))},[M]);const de=Sp(L,200),O=Sp(G,130),Y=Sp(q,130),[B,te]=x.useState(null);x.useEffect(()=>{let F=null;try{F=localStorage.getItem("agent-dag.sound")}catch{}te(F===null?!0:F==="on")},[]);const le=x.useCallback(()=>{te(F=>{var se;const z=F!==!0;try{localStorage.setItem("agent-dag.sound",z?"on":"off")}catch{}return z&&((se=qe.current)==null||se.unlock()),z})},[]),pe=x.useCallback(F=>{le()},[le]),ye=x.useRef(pe);ye.current=pe;const Ie=x.useRef(B);Ie.current=B;const[Te,Re]=x.useState(()=>HB(Sa)),Me=x.useRef(Te);Me.current=Te;const xe=x.useRef(null),He=x.useCallback(F=>{var se,ae;const z=nh(F,(se=Me.current[F])==null?void 0:se.figure);(ae=xe.current)==null||ae.duck(iz(z.notes))},[]),Ne=x.useRef(null),_e=x.useCallback((F,z=!1)=>{var se,ae;if((se=qe.current)==null||se.unlock(),Ne.current!==null&&clearTimeout(Ne.current),Ne.current=null,!z){(ae=qe.current)!=null&&ae.play(F,!0)&&He(F);return}Ne.current=setTimeout(()=>{var Ae;Ne.current=null,(Ae=qe.current)!=null&&Ae.play(F,!0)&&He(F)},DB)},[He]),Ze=x.useCallback((F,z)=>{Re(se=>{const ae={level:mc(z.level??se[F].level),figure:vR(F,z.figure??se[F].figure)};try{localStorage.setItem(xR[F],String(ae.level)),localStorage.setItem(bR[F],ae.figure)}catch{}return{...se,[F]:ae}}),_e(F,!0)},[_e]);x.useEffect(()=>()=>{Ne.current!==null&&clearTimeout(Ne.current)},[]);const[ct,Ke]=x.useState(!1),ce=x.useRef(null),[je,$e]=x.useState(!1),Je=x.useRef(null);x.useEffect(()=>{ct&&$e(!1)},[ct]);const qe=x.useRef(null),[pt,ge]=x.useState("locked");x.useEffect(()=>{const F=WB({enabled:()=>Ie.current===!0,prefs:()=>Me.current,onState:ge});qe.current=F,ge(F.state());const z=()=>F.unlock();return window.addEventListener("pointerdown",z,{once:!0,capture:!0}),window.addEventListener("keydown",z,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",z,{capture:!0}),window.removeEventListener("keydown",z,{capture:!0})}},[]);const[be,Ve]=x.useState(!1),[nt,at]=x.useState(!1),[he,rt]=x.useState(null),[ot,jt]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(nx)??""}catch{return""}}),[xt,wt]=x.useState(!1),kn=x.useRef(0),[Zt,me]=x.useState(!1),it=x.useCallback((F=!1)=>(F&&(kn.current=Date.now(),me(!0)),fetch(F?"/api/version?refresh=1":"/api/version").then(z=>z.ok?z.json():null).then(z=>{z&&rt(z)}).catch(()=>{}).finally(()=>{F&&me(!1)})),[]),ht=x.useCallback(()=>{it(Date.now()-kn.current>=_V)},[it]);x.useEffect(()=>{it();const F=window.setInterval(ht,5*6e4),z=()=>{document.visibilityState==="visible"&&ht()};return document.addEventListener("visibilitychange",z),()=>{window.clearInterval(F),document.removeEventListener("visibilitychange",z)}},[it,ht]),x.useEffect(()=>{be&&it()},[be,it]),x.useEffect(()=>{const F=iH();let z=null;const se=Ge=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:F,looking:Ge}),keepalive:!0}).catch(()=>{})},ae=()=>{const Ge=aH(document);oH(z,Ge)&&se(Ge),z=Ge},Ae=()=>{z&&se(!1),z=!1};ae();const Se=window.setInterval(ae,sH);return window.addEventListener("focus",ae),window.addEventListener("blur",ae),document.addEventListener("visibilitychange",ae),window.addEventListener("pagehide",Ae),()=>{window.clearInterval(Se),window.removeEventListener("focus",ae),window.removeEventListener("blur",ae),document.removeEventListener("visibilitychange",ae),window.removeEventListener("pagehide",Ae),Ae()}},[]);const Qe=(he==null?void 0:he.notice)??null,[sn,an]=x.useState(null),Dt=x.useRef(!1);x.useEffect(()=>{if(Dt.current)return;const F=iN(),z=gH(F),se=kH({stored:z,running:(he==null?void 0:he.running)??null,notes:oN,remembers:yH(F)});if(se.reason==="no-version")return;Dt.current=!0,se.record&&wH(F,se.record);const ae=bH({tourSeen:vH(F),decision:se}),Ae=se.show.length?{entries:se.show,since:z,firstRun:!1}:null;ae.tour&&J(!0),ae.notes==="now"?an(Ae):ae.notes==="after"&&(ee.current=Ae)},[he==null?void 0:he.running]);const pn=(he==null?void 0:he.running)??"3.24.1",Qt=x.useMemo(()=>AR(oN,null,pn),[pn]),mn=x.useCallback(()=>{an({entries:Qt,since:null,firstRun:!1})},[Qt]),[nr,Tn]=x.useState(null),[_n,vr]=x.useState(Px);x.useEffect(()=>{let F=!1;return fetch("/api/health").then(z=>z.ok?z.json():null).then(z=>{F||(vr(Z9(z)),!(!z||typeof z.workspace!="string")&&Tn(z.workspace))}).catch(()=>{}),()=>{F=!0}},[be]);const An=x.useRef(_n);An.current=_n;const Rn=Qe?`${Qe.kind}:${Qe.to}`:"",Mn=Qe!=null&&ot!==Rn,qs=x.useCallback(()=>{jt("");try{window.localStorage.setItem(nx,"")}catch{}},[]),Fs=x.useCallback(()=>{if(Qe){jt(Rn);try{window.localStorage.setItem(nx,Rn)}catch{}}},[Qe,Rn]),[fs,Q]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(BT)??""}catch{return""}}),Ce=he!=null&&he.invokedAs&&he.invokedAs!==Yt?he.invokedAs:null,Ue=Ce!=null&&fs!==Ce,Le=x.useCallback(()=>{if(Ce){Q(Ce);try{window.localStorage.setItem(BT,Ce)}catch{}}},[Ce]),Pe=((Js=he==null?void 0:he.upgrade)==null?void 0:Js.state)??"idle",ft=yB(he==null?void 0:he.upgrade),Ct=x.useRef(!1),$t=x.useCallback(async()=>{if(Is(Ct.current||Pe==="running")){Ct.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await it(),Ct.current=!1}},[Pe,it]);x.useEffect(()=>{if(Pe!=="running")return;const F=window.setInterval(it,3e3);return()=>window.clearInterval(F)},[Pe,it]);const Wr=x.useCallback(async()=>{const F=he==null?void 0:he.command;!F||!await bh(F)||(wt(!0),window.setTimeout(()=>wt(!1),1600))},[he==null?void 0:he.command]),bt=x.useCallback(()=>{Z(F=>(F||K(z=>(z&&(W.current=!0),!1)),!F))},[]),kt=x.useCallback(()=>{W.current=!1,K(F=>(F||Z(!1),!F))},[]),[Bs,ps]=x.useState(!1),[Ea,Vr]=x.useState(!1),[Ca,Mo]=x.useState(()=>{try{return Number(localStorage.getItem(cN))||0}catch{return 0}}),[ms,In]=x.useState([]),[gs,$n]=x.useState(!1);x.useEffect(()=>{let F=!0;const z=()=>{fetch("/api/browser-watch?live=0").then(ae=>ae.ok?ae.json():null).then(ae=>{var Ae;!F||!(ae!=null&&ae.ok)||(In(ae.episodes??[]),$n(((Ae=ae.settings)==null?void 0:Ae.enabled)===!0))}).catch(()=>{})};z();const se=setInterval(z,5*6e4);return()=>{F=!1,clearInterval(se)}},[]);const[Uh,Io]=x.useState([]),Mc=x.useRef(new Set),[ys,Ta]=x.useState(null);x.useEffect(()=>{let F=!0,z=0;const se=()=>{fetch("/api/lan").then(ae=>ae.ok?ae.json():null).then(ae=>F?(ae!=null&&ae.ok&&Io(O_(Array.isArray(ae.pending)?ae.pending:[],ae.aliases)),ae):null).catch(()=>null).then(ae=>{F&&(z=window.setTimeout(se,(ae==null?void 0:ae.enabled)===!0?Ax:pR))})};return se(),()=>{F=!1,window.clearTimeout(z)}},[]);const zs=x.useCallback(async(F,z)=>{if(!ys){Ta(F);try{const ae=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:F,fp:z})})).json().catch(()=>null);ae&&Array.isArray(ae.pending)?Io(O_(ae.pending,ae.aliases)):Io(Ae=>Ae.filter(Se=>Se.fp!==z))}catch{}finally{Ta(null)}}},[ys]),Gr=x.useMemo(()=>tU(ms,Ca).length,[ms,Ca]),[Wh,Ic]=x.useState(0),$o=x.useRef(null),[$c,Oo]=x.useState(!1),xr=x.useRef(null),[Vh,Lo]=x.useState(0),st=x.useState(()=>zH({protect:F=>f5(l.current,F)}))[0],[Aa,Oc]=x.useState(!1),Ra=x.useCallback(()=>{const F=st.paused&&st.dropped>0,z=st.setPaused(!st.paused);F&&p5(l.current);for(const se of z)l.current=R1(l.current,se);Oc(st.paused)},[st]),[zt,Lc]=x.useState(Date.now()),[br,Hs]=x.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(Nd)!=="0"}catch{return!0}}),Ma=x.useRef(!1),Kr=x.useCallback(()=>{const F=!br;Ma.current=!0;try{window.localStorage.removeItem(Nd)}catch{}Hs(F),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:F})}).then(z=>z.ok?z.json():null).then(z=>{var se;z!=null&&z.ok&&Hs(((se=z.prefs)==null?void 0:se.autoUpdate)!==!1)}).catch(()=>{})},[br]),[on,Un]=x.useState(!1),[Ia,$a]=x.useState("restart"),[kr,Pc]=x.useState(null),ws=x.useRef(!1),Us=x.useRef(null),Dc=x.useRef(0),Oa=x.useCallback(async F=>{if(!Is(ws.current))return;const z=(F==null?void 0:F.upgrade)===!0;ws.current=!0,Us.current=ft;const se=++Dc.current;$a(z?"npx":"restart"),Un(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(Qe==null?void 0:Qe.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:z})})}catch{}window.setTimeout(()=>{if(Dc.current===se&&ws.current){ws.current=!1,Un(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},z?18e4:3e4)},[Qe==null?void 0:Qe.to,ft]),Ws=x.useRef(null);x.useEffect(()=>{const F=z_(l.current.agents.values())>0,z=kB({enabled:br,kind:Qe==null?void 0:Qe.kind,canRestart:(he==null?void 0:he.canRestart)===!0,noticeOpen:Mn,visible:document.visibilityState==="visible",busy:F,idleSince:Ws.current,now:zt});Ws.current=z.idleSince,z.restart&&Oa()},[br,Qe==null?void 0:Qe.kind,he==null?void 0:he.canRestart,Mn,zt,Oa]);const Zi=z_(l.current.agents.values()),qc=bB(Zi),Vs=wR({enabled:br,kind:Qe==null?void 0:Qe.kind,canRestart:(he==null?void 0:he.canRestart)===!0,noticeOpen:Mn,visible:document.visibilityState==="visible",busy:Zi>0,idleSince:Ws.current,now:zt});x.useEffect(()=>{const F=he==null?void 0:he.running;let z=null,se=null;try{z=window.sessionStorage.getItem("agent-dag.restartPending"),se=window.sessionStorage.getItem(zT)}catch{return}const ae=gB({bundle:"3.24.1",running:F,pending:z,lastTried:se});if(ae==="reload"){try{window.sessionStorage.setItem(zT,F??"")}catch{return}window.location.reload();return}if(ae!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ws.current=!1,Un(!1),Pc(F??null);const Ae=window.setTimeout(()=>Pc(null),6e3);return()=>window.clearTimeout(Ae)},[he==null?void 0:he.running]),x.useEffect(()=>{if(on&&wB({asked:Us.current,reported:ft})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ws.current=!1,Un(!1)}},[on,ft]);const Gs=x.useState(()=>q9(MV()))[0],Rt=x.useRef(Gs.pinned),vs=x.useRef(null),Po=x.useState(()=>OV())[0],[Qi,Ji]=x.useState(()=>new Set),[_r,Do]=x.useState(WH),[Ks,Yr]=x.useState(rH),[Xr,qo]=x.useState(()=>RT(OT)),el=x.useMemo(()=>P9(Xr),[Xr]),Fo=x.useCallback(F=>L9(F,el),[el]),[La,Fc]=x.useState(!1);x.useEffect(()=>{document.documentElement.dataset.theme=_r;try{window.localStorage.setItem($R,_r)}catch{}qo(F=>{const z=RT(OT);return D9(F,z)?F:z})},[_r]),x.useEffect(()=>{try{window.localStorage.setItem(TR,Ks?"1":"0")}catch{}},[Ks]);const qt=x.useCallback((F,z)=>{if(Ld({durationMs:z,documentHidden:document.hidden})){e.setViewport(F,{duration:z});return}const{d3Zoom:se,d3Selection:ae}=r.getState(),Ae=ae==null?void 0:ae.property("__zoom");if(se&&ae&&Ae&&Ae.k>0&&F.zoom>0){se.transform(ae,Ae.scale(F.zoom/Ae.k).translate((F.x-Ae.x)/F.zoom,(F.y-Ae.y)/F.zoom));return}e.setViewport(F,{duration:0})},[e,r]),rr=x.useRef(null);x.useEffect(()=>{if(!Po)return;const F=window.setTimeout(()=>{try{qt(Po,0)}catch{}Wn.current=Date.now()},60);return()=>window.clearTimeout(F)},[qt,Po]);const Bo=x.useRef(!0),[Nr,Bc]=x.useState(null);x.useEffect(()=>{const F=new EventSource("/events"),z=FH(u,{now:()=>Date.now(),setTimeout:(Se,Ge)=>window.setTimeout(Se,Ge),clearTimeout:Se=>window.clearTimeout(Se)});let se=!1;const ae=typeof BroadcastChannel=="function"?YH(new BroadcastChannel(GH),Math.random().toString(36).slice(2),()=>se):null,Ae=window.setInterval(()=>{se||!ae||ae.ask(600).then(Se=>{se||at(KH(Se))})},3e3);return F.addEventListener("open",()=>{Ve(!0),Fc(!0)}),F.addEventListener("error",()=>{Ve(!1),Bc(null)}),F.addEventListener("open",()=>{se=!0,at(!1)}),F.addEventListener("error",()=>{se=!1}),F.addEventListener("replay-end",()=>{Bo.current=!1,z.flush(),Bc(Date.now())}),F.addEventListener("hook",Se=>{var Ge;try{const lt=JSON.parse(Se.data);if(!st.accept(lt))return;l.current=R1(l.current,lt);const vt=lt.replay===!0||Bo.current||Date.now()-lt.receivedAt>3e4;vt?z.replay():z.live();const tt=UB(lt,vt);tt&&((Ge=qe.current)!=null&&Ge.play(tt))&&He(tt)}catch{}}),()=>{F.close(),z.cancel(),window.clearInterval(Ae),ae==null||ae.leave()}},[u]),x.useEffect(()=>{const F=setInterval(()=>{const z=Date.now();Lc(z);let se=m5(l.current,z,A1);g5(l.current,z,A1)&&(se=!0);const ae=[],Ae=Se=>{ae.push(Se)};d5(l.current,z,vV,xV,Ae)&&(se=!0),h5(l.current,z,bV,kV,Ae)&&(se=!0),ae.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:ae})}).catch(()=>{}),m(Se=>RH(Se,l.current.agents)),w(Se=>Se!=null&&!l.current.agents.has(Se)?null:Se),T(Se=>Se!=null&&!l.current.agents.has(Se)?null:Se),E(Se=>Se!=null&&!l.current.agents.has(Se)?null:Se),se&&u()},250);return()=>clearInterval(F)},[u]);const Pa=x.useRef(null),Wn=x.useRef(0),Da=420,ln=x.useCallback((F=500)=>{const z=ex,se=1,ae=.2,Ae=tx;try{const Se=document.querySelector(".canvas-wrap"),Ge=Array.from(document.querySelectorAll(".react-flow__node")).filter(Ot=>Ot.offsetWidth>0);if(!Se||Ge.length===0)return;const lt=Se.getBoundingClientRect(),vt=e.getViewport();if(!Number.isFinite(vt.zoom)||vt.zoom<=0)return;const tt=Ot=>(Ot-lt.left-vt.x)/vt.zoom,Nn=Ot=>(Ot-lt.top-vt.y)/vt.zoom,ti=Ge.map(Ot=>Ot.getBoundingClientRect()),du=Math.min(...ti.map(Ot=>tt(Ot.left))),kl=Math.max(...ti.map(Ot=>tt(Ot.right))),Cr=Math.min(...ti.map(Ot=>Nn(Ot.top))),hu=Math.max(...ti.map(Ot=>Nn(Ot.bottom))),_s=kl-du,On=hu-Cr;if(!(_s>0&&On>0))return;const Tr=Math.max(ae,Math.min(se,(lt.width-DT(Se)-z*2)/(_s+Da)*Ae,(lt.height-z*2)/On*Ae)),Sn={x:z-du*Tr,y:Math.max(z,(lt.height-On*Tr)/2)-Cr*Tr,zoom:Tr};qt(Sn,F),Wn.current=Date.now(),rr.current=Ld({durationMs:F,documentHidden:document.hidden})?{target:Sn,until:Date.now()+F+60}:null,window.setTimeout(()=>{var Ot;try{((Ot=rr.current)==null?void 0:Ot.target)===Sn&&(rr.current=null);const fu=e.getViewport();(Math.abs(fu.zoom-Tr)>.01||Math.abs(fu.x-Sn.x)>2)&&qt(Sn,0)}catch{}},F+60)}catch{}},[e,qt]);x.useEffect(()=>{const F=()=>{if(!document.hidden)return;const z=rr.current;if(rr.current=null,!(!z||Date.now()>z.until)){try{qt(z.target,0)}catch{}Wn.current=Date.now()}};return document.addEventListener("visibilitychange",F),()=>document.removeEventListener("visibilitychange",F)},[qt]);const zo=x.useRef(""),tl=x.useRef(null),zc=x.useRef(0),Ho=x.useCallback(()=>{zc.current=Date.now()},[]),qa=x.useRef(null),Hc=x.useRef(0),nl=x.useCallback(()=>{Hc.current=Date.now()},[]),Uc=x.useCallback(F=>({hasSourceEvent:!!F,at:Date.now(),lastDeckFitAt:Wn.current,lastCanvasInputAt:Hc.current}),[]),Gh="agent-dag.autoFitDisabled",xs=x.useRef(!1),[Uo,Wc]=x.useState(!1);x.useEffect(()=>{try{window.localStorage.removeItem(Gh)}catch{}},[]);const rl=x.useCallback(()=>{xs.current||(xs.current=!0,Wc(!0))},[]),Vc=x.useCallback(()=>{xs.current=!1,Wc(!1),ln(400)},[e,ln]);x.useEffect(()=>{const F=setInterval(()=>{if(xs.current||Date.now()-zc.current<800)return;const z=l.current,se=Date.now(),ae=[];for(const Se of z.agents.values())Lx(Se,se)&&ae.push({id:Se.id});if(ae.length===0)return;const Ae=[];for(const{id:Se}of ae){const Ge=Sr.current.get(Se),lt=Rt.current.get(Se)??cn.current.get(Se);!Ge||!lt||Ae.push({x:lt.x,y:lt.y,width:Ge.width,height:Ge.height})}W9({pane:qa.current,viewport:e.getViewport(),boxes:Ae})&&ln(600)},1500);return()=>clearInterval(F)},[e]);const sl=x.useRef(!1),Sr=x.useRef(new Map),Gc=x.useRef(0),Kh=x.useCallback(F=>{const z=Sr.current;let se=!1;for(const ae of F.nodeInternals.values()){const Ae=ae.width,Se=ae.height;if(Ae==null||Se==null)continue;const Ge=z.get(ae.id);Ge?(Math.abs(Ge.height-Se)>4||Math.abs(Ge.width-Ae)>4)&&(z.set(ae.id,{width:Ae,height:Se}),se=!0):(z.set(ae.id,{width:Ae,height:Se}),se=!0)}return se&&(Gc.current+=1),Gc.current},[]),Kc=yt(Kh),[al,Yh]=x.useState(0);x.useEffect(()=>{let F=0;const z=()=>{const ae=Sr.current;let Ae=!1;for(const Se of document.querySelectorAll(".react-flow__node[data-id]")){const Ge=Se.getAttribute("data-id");if(!Ge)continue;const lt=Se.offsetWidth,vt=Se.offsetHeight;if(!lt||!vt)continue;const tt=ae.get(Ge);(!tt||Math.abs(tt.width-lt)>4||Math.abs(tt.height-vt)>4)&&(ae.set(Ge,{width:lt,height:vt}),Ae=!0)}Ae&&Yh(Se=>Se+1)};if(sl.current)return;let se=0;return document.visibilityState==="hidden"?se=window.setTimeout(z,32):F=requestAnimationFrame(z),()=>{cancelAnimationFrame(F),window.clearTimeout(se)}});const cn=x.useRef(Gs.positions),Yc=x.useRef(new Set),Wo=x.useRef(""),Ys=x.useMemo(()=>{const F=[];for(const z of l.current.agents.values())Lx(z,zt)&&F.push(z.id+(z.parentId?`>${z.parentId}`:""));return F.sort(),`${F.join("|")}#sv${Kc}.${al}`},[l.current,l.current.revision,zt,Kc,al]),Fa=x.useRef(null);x.useEffect(()=>(Fa.current!=null&&window.clearTimeout(Fa.current),Fa.current=window.setTimeout(()=>{Sd(cn.current,Rt.current)},1500),()=>{Fa.current!=null&&window.clearTimeout(Fa.current)}),[Ys]),x.useEffect(()=>{if(zo.current===Ys)return;const F=zo.current;if(zo.current=Ys,!F||xs.current)return;Date.now()-Wn.current>1200&&ln(400),Pa.current&&window.clearTimeout(Pa.current),Pa.current=window.setTimeout(()=>{xs.current||ln(500)},280)},[Ys,e,ln]);const ol=x.useMemo(()=>OH(l.current,h),[l.current,l.current.revision,h]),Ba=x.useMemo(()=>I9(l.current,zt),[l.current,l.current.revision,zt]),Zr=x.useRef(null),[za,il]=x.useState({w:0,h:0});x.useEffect(()=>{const F=Zr.current;if(!F||typeof ResizeObserver>"u")return;const z=new ResizeObserver(se=>{var Ae;const ae=(Ae=se[0])==null?void 0:Ae.contentRect;ae&&(qa.current={width:ae.width,height:ae.height},il(Se=>Math.abs(Se.w-ae.width)>40||Math.abs(Se.h-ae.height)>40?{w:ae.width,h:ae.height}:Se))});return z.observe(F),qa.current={width:F.clientWidth,height:F.clientHeight},il({w:F.clientWidth,h:F.clientHeight}),()=>z.disconnect()},[]);const Xc=x.useCallback(F=>{var se,ae;const z=F.target;!(z!=null&&z.closest)||z.closest(gV)!==F.currentTarget||(F.preventDefault(),(ae=(se=document.activeElement)==null?void 0:se.blur)==null||ae.call(se))},[]),Zc=x.useRef(new Map),[Ha,Qc]=x.useState(!1);x.useEffect(()=>{const F=window.setTimeout(()=>Qc(!0),2500);return()=>window.clearTimeout(F)},[]);const[Xs,ll]=x.useState(!1),Qr=x.useRef(null),[Ua,cl]=x.useState(!1),[Jc,Wa]=x.useState("full"),Zs=x.useRef("full"),Xh=x.useCallback(()=>{Qr.current&&(window.clearTimeout(Qr.current),Qr.current=null),ll(!1)},[]),Vo=x.useCallback(F=>{F.length!==0&&queueMicrotask(()=>{ll(!0),Qr.current&&window.clearTimeout(Qr.current),Qr.current=window.setTimeout(()=>ll(!1),yV+80)})},[]);x.useEffect(()=>()=>{Qr.current&&window.clearTimeout(Qr.current)},[]);const gn=y?l.current.agents.get(y):null,eu=f&&gn!=null,[ul,dl]=x.useState(0);x.useEffect(()=>{const F=DT(Zr.current);dl(z=>Math.abs(z-F)>40?F:z)},[Y,O,G,eu,za.w]);const Va=za.w>0?Math.max(0,(za.w-ul-ex*2)*tx):0,Ga=za.h>0?Math.max(0,(za.h-ex*2)*tx):0,tu=k6(),{nodes:jr,edges:nu}=x.useMemo(()=>BV(l.current,zt,Va,Ga,Rt.current,Sr.current,Zc.current,Vo,Ha,Ua,cn.current,Yc.current,Ys,Wo,h,ol,Ba,R),[l.current,l.current.revision,zt,Va,Ga,Ha,Ua,Ys,h,ol,Ba,R,Wh,tu]),Zh=x.useState(IV)[0],ru=x.useRef(Zh);x.useEffect(()=>{if(!Ha||Ua)return;const F={width:Va,height:Ga};if(!(F.width>0&&F.height>0))return;const z=ru.current;if(ru.current=F,$V(F),!z||z.width===F.width&&z.height===F.height)return;const se={direction:"LR",pinned:Rt.current,measured:Sr.current,lanes:XM(l.current)};if(j9(jr,nu,se,z,F)){for(const ae of Array.from(cn.current.keys()))Rt.current.has(ae)||cn.current.delete(ae);Yc.current.clear(),Wo.current="",u(),window.setTimeout(()=>{Sd(cn.current,Rt.current),!xs.current&&ln(500)},80)}},[Va,Ga,Ha,Ua,u,ln]);const su=x.useMemo(()=>{const F=new Map;for(const se of jr){const ae=se.data;if(!(ae!=null&&ae.sessionId)||ae.exitAt!=null)continue;const Ae=se.width,Se=se.height;if(Ae==null||Se==null)continue;const Ge=se.position.x,lt=se.position.y,vt=Ge+Ae,tt=lt+Se,Nn=F.get(ae.sessionId);Nn?(Nn.minX=Math.min(Nn.minX,Ge),Nn.minY=Math.min(Nn.minY,lt),Nn.maxX=Math.max(Nn.maxX,vt),Nn.maxY=Math.max(Nn.maxY,tt)):F.set(ae.sessionId,{minX:Ge,minY:lt,maxX:vt,maxY:tt})}const z=[];for(const[se,ae]of F){const Ae=ae.maxX-ae.minX+_d*2,Se=ae.maxY-ae.minY+_d*2;z.push({id:`group:${se}`,type:DM,position:{x:ae.minX-_d,y:ae.minY-_d},data:{sessionId:se,w:Ae,h:Se},width:Ae,height:Se,style:{width:Ae,height:Se},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return z},[jr]),Vn=x.useMemo(()=>{const F=[...su,...jr],z=xr.current;return!z||z.size===0?F:F.map(se=>{const ae=z.get(se.id);return ae?{...se,position:ae}:se})},[su,jr,Vh]),Jr=x.useMemo(()=>{const F=new Set;for(const z of l.current.agents.values())for(const se of z.tools)F.add(YM(se.name));return Object.keys(KM).filter(z=>F.has(z))},[l.current,l.current.revision]);x.useEffect(()=>{if(Jr.length<=1){Oo(!1);return}let F=0;const z=()=>{const se=$o.current;if(se&&!document.hidden){const ae=se.getBoundingClientRect(),Ae=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ge=>Ge.getBoundingClientRect()),Se=O9(ae,Ae,8);Oo(Ge=>Ge===Se?Ge:Se)}F=window.setTimeout(z,300)};return z(),()=>window.clearTimeout(F)},[Jr.length]);const au=x.useCallback(F=>{Ji(z=>{const se=new Set(z);return se.has(F)?se.delete(F):se.add(F),se})},[]),Go=N?a5(l.current.agents,N):null,hl=x.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}l.current=xx(),Rt.current.clear(),Sr.current.clear(),cn.current.clear(),Wo.current="",HT(),b(),u()},[u,b]),fl=x.useRef($);fl.current=$;const Ko=x.useRef(U);Ko.current=U;const pl=x.useRef(!1);pl.current=Go!=null||Bs||C!=null||V||j!=null||Ea||U||sn!=null;const Yo=x.useCallback(F=>{const z=_B(F,{confirmOpen:fl.current,modalOpen:pl.current});z==="confirm"?D(!0):z==="clear"&&(D(!1),hl())},[hl]),es=x.useCallback(()=>{Rt.current.clear(),cn.current.clear(),Wo.current="",HT(),u(),window.setTimeout(()=>ln(500),80)},[u,e,ln]),Xo=x.useCallback(()=>ln(500),[ln]),ts=x.useRef(jr);ts.current=jr;const Ka=x.useRef(y);Ka.current=y;const Ya=x.useCallback(F=>{const z=ts.current.filter(Se=>Se.type==="agent"),se=jH(z.map(Se=>({id:Se.id,x:Se.position.x,y:Se.position.y})),Ka.current,F),ae=se?z.find(Se=>Se.id===se):void 0;if(!ae)return;const Ae=PT(document.activeElement);S(ae.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:Qv(350),nodes:[ae]})}catch{}Wn.current=Date.now(),Ae&&mV(ae.id)},30)},[S,e]),Qs=x.useRef(null),Gn=x.useCallback(F=>{S(F,!1),window.setTimeout(()=>{try{const z=ts.current.find(se=>se.id===F);z&&e.fitView({padding:.3,duration:Qv(500),nodes:[z]}),Wn.current=Date.now()}catch{}},60)},[S,e]),Zo=x.useRef(null);x.useEffect(()=>{let F=-1/0;const z=()=>{F=performance.now()},se=ae=>{Zo.current=performance.now()-F<250?ae.target:null};return window.addEventListener("pointerdown",z,!0),window.addEventListener("focusin",se,!0),()=>{window.removeEventListener("pointerdown",z,!0),window.removeEventListener("focusin",se,!0)}},[]),x.useEffect(()=>{const F=z=>{var lt,vt;const se=z.target,ae={tagName:se==null?void 0:se.tagName,isContentEditable:se==null?void 0:se.isContentEditable,role:(lt=se==null?void 0:se.getAttribute)==null?void 0:lt.call(se,"role"),type:se==null?void 0:se.type,pointerFocused:se!=null&&se===Zo.current};if(z.key==="Escape"){const tt=G5({overlayOpen:Xd.depth()>0,typing:l0(ae)});tt==="dismiss"?Xd.dismissTop():tt==="blur"?se==null||se.blur():(AH(ae)&&(se==null||se.blur()),b());return}if(wh(z))return;const Ae=PT(se)?(vt=se==null?void 0:se.getAttribute)==null?void 0:vt.call(se,"data-id"):null,Se=Ae&&ts.current.some(tt=>tt.id===Ae)?Ae:null,Ge=CH(z,Se);if(Ge.kind==="activate"){z.preventDefault(),S(Ge.nodeId,Ge.additive);return}if(Ge.kind!=="node"&&!(Ge.nodeId==null&&n6(ae,z.key))&&!r6({key:z.key,modalOpen:pl.current,sheetOpen:Ko.current})){if(z.key===" "&&(z.preventDefault(),Ra()),(z.key==="c"||z.key==="C")&&Yo("shortcut"),(z.key==="r"||z.key==="R")&&es(),(z.key==="f"||z.key==="F")&&Xo(),(z.key==="l"||z.key==="L")&&bt(),z.key==="d"||z.key==="D")if(Ka.current)p(tt=>!tt);else{const tt=kp(l.current.agents.values());tt.length>0?Gn(tt[0].id):Ya(1)}if((z.key==="h"||z.key==="H")&&ps(tt=>!tt),(z.key==="u"||z.key==="U")&&I(tt=>!tt),(z.key==="a"||z.key==="A")&&An.current.claude&&kt(),(z.key==="j"||z.key==="J")&&Ya(1),(z.key==="k"||z.key==="K")&&Ya(-1),z.key==="w"||z.key==="W"){const tt=P5(kp(l.current.agents.values()),Qs.current);tt&&(Qs.current=tt.id,Gn(tt.id))}(z.key==="t"||z.key==="T")&&Do(tt=>tt==="dark"?"light":"dark"),(z.key==="m"||z.key==="M")&&An.current.claude&&Ie.current!==null&&ye.current(z.shiftKey),(z.key==="s"||z.key==="S")&&H(tt=>!tt),(z.key==="b"||z.key==="B")&&Vr(tt=>!tt),(z.key==="v"||z.key==="V")&&An.current.claude&&Ie.current!==null&&Ke(tt=>!tt),z.key==="?"&&P(tt=>!tt)}};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[Yo,es,Xo,b,S,Ya,Gn,Ra]);const ml=l.current.agents.size,Ft=x.useMemo(()=>kp(l.current.agents.values()),[l.current,l.current.revision]),gl=x.useMemo(()=>D5(l.current.agents.values()),[l.current,l.current.revision]),yl=x.useRef(null);x.useEffect(()=>{const F=XH({waiting:Ft.length,running:gl,connected:be}),z=yl.current;if(yl.current=F,(z==null?void 0:z.title)!==F.title&&(document.title=F.title),(z==null?void 0:z.icon)!==F.icon){const se=document.querySelector('link[rel="icon"]');se&&(se.href=ZH[F.icon])}},[Ft.length,gl,be]);const[ou,iu]=x.useState(""),wl=JH(Ft);x.useEffect(()=>{iu(F=>eU(F,wl))},[wl]);const[Xa,ns]=x.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Er,Za]=x.useState(null),[Qo,vl]=x.useState(!1),[Qa,lu]=x.useState(!1);x.useEffect(()=>{let F=!0;return fetch("/api/prefs").then(z=>z.ok?z.json():null).then(z=>{var se,ae,Ae;if(!(!F||!(z!=null&&z.ok))){if(!Ma.current){let Se=!1;try{Se=window.localStorage.getItem(Nd)==="0",window.localStorage.removeItem(Nd)}catch{}Se&&((se=z.prefs)==null?void 0:se.autoUpdate)!==!1?(Hs(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):Hs(((ae=z.prefs)==null?void 0:ae.autoUpdate)!==!1)}vl(((Ae=z.prefs)==null?void 0:Ae.notifications)===!0),lu(z.notificationsVetoed===!0)}}).catch(()=>{}),()=>{F=!1}},[]);const xl=x.useRef(()=>{}),cu=x.useCallback(()=>{const F=!Qo;vl(F),F&&typeof Notification<"u"&&Notification.permission==="default"&&xl.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:F})}).then(z=>z.ok?z.json():null).then(z=>{var se;z!=null&&z.ok&&(vl(((se=z.prefs)==null?void 0:se.notifications)===!0),lu(z.notificationsVetoed===!0))}).catch(()=>{})},[Qo]),_t=typeof Notification<"u";x.useEffect(()=>{if(!Er)return;const z=setTimeout(()=>Za(null),Er==="blocked"?8e3:4e3);return()=>clearTimeout(z)},[Er]);const Jo=x.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(F=>{const z=F;ns(z),z==="granted"?Za("on"):z==="denied"&&Za("blocked")})},[]);xl.current=Jo;const rs=x.useRef(new Set),bs=x.useRef(null),uu=Ft.map(F=>yh(F.id,F.waiting)).join("|");x.useEffect(()=>{z5(bs.current,Xa)&&(bs.current=Xa,rs.current=_p(Ft))},[Xa]);const ei=x.useRef(!1);return x.useEffect(()=>{H5(ei.current,Nr)&&(ei.current=!0,rs.current=_p(Ft))},[Nr]),x.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!U5(bs.current,Nr))return;const F=typeof document>"u"||!document.hidden,z=F5(Ft,rs.current,F,Qo);for(const se of z)try{const ae=new Notification(se.title,{body:se.body,tag:se.key});ae.onclick=()=>{window.focus(),Gn(se.sessionId),ae.close()}}catch{}rs.current=F?_p(Ft):B5(Ft,z,rs.current)},[uu,Nr]),i.jsxs("div",{className:"app",children:[i.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),i.jsxs("header",{className:"topbar",children:[i.jsxs("div",{className:"readout",children:[i.jsxs("div",{className:"brand",children:[i.jsx("span",{className:"logo"}),i.jsx("h1",{children:Yt}),Qe?i.jsxs("button",{type:"button",className:"v stale",onClick:()=>{mn(),qs()},"aria-haspopup":"dialog","aria-label":Y9({...Qe,open:Mn}),title:Qe.kind==="restart"?`Running v${Qe.from}; v${Qe.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${Qe.from}; v${Qe.to} is on npm · click for what's new`,children:["v",Qe.from,i.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const F={running:pn,latest:he==null?void 0:he.latest,latestPending:he==null?void 0:he.latestPending,checkedAgo:he!=null&&he.checkedAt?Ad(zt-he.checkedAt):null,checkFailedAgo:he!=null&&he.checkFailedAt&&he.checkFailedAt>(he.checkedAt??0)?Ad(zt-he.checkFailedAt):null,checkDisabled:he==null?void 0:he.checkDisabled,checking:Zt};return i.jsxs("button",{type:"button",className:Zt?"v checking":"v",onClick:()=>{mn(),it(!0)},"aria-busy":Zt||void 0,"aria-haspopup":"dialog","aria-label":K9(F),title:G9(F),children:["v",F.running]})})()]}),i.jsx("span",{className:"status",children:(()=>{const F=lV({connected:be,paused:Aa,held:st.size,dropped:st.dropped});return F.resting?null:i.jsx("span",{className:`pill ${F.tone}`,title:F.title,children:i.jsxs("span",{className:"pill-box",children:[i.jsx("span",{className:"pill-widest","aria-hidden":!0,children:F.widest}),i.jsx("span",{className:"pill-label",children:F.label})]})})})()}),i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:ou}),Ft.length>0&&i.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{Qs.current=Ft[0].id,Gn(Ft[0].id)},title:`Blocked waiting for you — click, or press W, to go to the one that has been stuck longest:
290
- ${Ft.map(F=>` ${F.label}: ${Bi(F.waiting)} (${Ad(zt-F.waiting.since)})`).join(`
291
- `)}`,"aria-label":`${Ft.length} session${Ft.length===1?"":"s"} waiting for you`,children:[i.jsx("span",{className:"ap-pulse","aria-hidden":!0}),i.jsx("b",{children:Ft.length})," ",i.jsx("span",{className:"ws-word",children:"waiting"})]}),Er&&i.jsx("span",{className:Er==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:Er==="on"?"The deck will raise a system notification when a session blocks on you and this tab is in the background":"Notifications are blocked for this page. Only your browser can undo that — its site settings for this address",children:Er==="on"?"notifications on":"notifications blocked"})]}),gn&&(()=>{const F=tr(gn),z=Math.max(0,((gn.endedAt??zt)-gn.startedAt)/1e3),se=gn.state==="active"?o0(F.total,z):null,ae=h.size-1;return i.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${gn.label}`,onClick:()=>{try{const Ae=jr.find(Se=>Se.id===gn.id);Ae&&e.fitView({padding:.35,duration:Qv(500),nodes:[Ae]}),Wn.current=Date.now()}catch{}},children:[i.jsx("span",{className:`state-pill state-${gn.state}`,children:gn.state==="active"?"live":gn.state}),i.jsx("span",{className:"selected-label",children:gn.label}),F.total>0&&i.jsxs("span",{className:"selected-cost",children:[Nt(F.total),se?i.jsxs("span",{className:"selected-rate",children:[" · ",se]}):null]}),ae>0&&i.jsxs("span",{className:"selected-extra",children:["+",ae]}),i.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Ae=>{Ae.stopPropagation(),b()},children:"×"})]})})(),i.jsxs("div",{className:"actions",children:[i.jsxs("div",{className:"action-run",children:[i.jsxs("button",{className:"btn icon-btn",onClick:bt,title:`${M?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":M,"aria-controls":M?"session-list":void 0,children:[i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M5.4 3.6h6.6M5.4 7h6.6M5.4 10.4h6.6"}),i.jsx("path",{d:"M2.2 3.6h.2M2.2 7h.2M2.2 10.4h.2"})]}),i.jsx("span",{className:"tb-word",children:"Session list"})]}),i.jsxs("button",{className:"btn icon-btn",onClick:()=>I(F=>!F),title:`${G?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":G,"aria-controls":G?"usage-panel":void 0,children:[i.jsxs("svg",{className:"tb-glyph-narrow",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M9.4 4.5C9 3.6 8.1 3.1 7 3.1c-1.4 0-2.4.8-2.4 1.9 0 1.2 1.2 1.6 2.4 2s2.4.8 2.4 2c0 1.1-1 1.9-2.4 1.9-1.1 0-2-.5-2.4-1.4"}),i.jsx("path",{d:"M7 1.6v1.5M7 10.9v1.5"})]}),i.jsx("span",{className:"tb-word",children:"Usage"})]}),i.jsxs("button",{className:"btn icon-btn",onClick:()=>ps(F=>!F),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:[i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),i.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),i.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]}),i.jsx("span",{className:"tb-word",children:"History"})]})]}),i.jsxs("div",{className:"action-run",children:[_n.claude&&i.jsxs("button",{className:"btn icon-btn",onClick:kt,title:`${L?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":L,"aria-controls":L?"accounts-panel":void 0,children:[i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),i.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]}),i.jsx("span",{className:"tb-word",children:"Accounts"})]}),i.jsxs("button",{className:"btn icon-btn",onClick:()=>H(F=>!F),title:`${q?"Hide":"Show"} this machine — cores, memory, temperature (S)`,"aria-label":"Toggle machine detail","aria-expanded":q,"aria-controls":q?"system-panel":void 0,children:[i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),i.jsx("path",{d:"M5.8 1.4v2.2M8.2 1.4v2.2M5.8 10.4v2.2M8.2 10.4v2.2M1.4 5.8h2.2M1.4 8.2h2.2M10.4 5.8h2.2M10.4 8.2h2.2"})]}),i.jsx("span",{className:"tb-word",children:"Machine"})]}),i.jsxs("button",{className:"btn icon-btn bw-btn",onClick:()=>Vr(F=>!F),title:gs?"Browser watch — watching; the deck is keeping its own copy (B)":"Browser watch — not watching; reading the browser's history live (B)","aria-label":`Browser watch, ${gs?"watching":"not watching"}`+(Gr>0?`, ${Gr} unread`:""),"aria-haspopup":"dialog",children:[i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M0.9 7s2.2-4 6.1-4 6.1 4 6.1 4-2.2 4-6.1 4S0.9 7 0.9 7Z"}),gs||Gr>0?i.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):i.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),i.jsx("span",{className:"tb-word",children:"Browser watch"}),Gr>0&&i.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Gr})]})]}),i.jsxs("div",{className:"action-run action-run-utility",children:[_n.claude&&B!==null&&i.jsxs("div",{className:"sound-slot",children:[i.jsxs("button",{ref:ce,className:"btn icon-btn",onClick:()=>Ke(F=>!F),...wa(!1),title:nV(_n,{on:B===!0,locked:pt==="locked",prefs:Te}),"aria-label":`Sound settings, ${B?"on":"off"}`,"aria-haspopup":"dialog","aria-expanded":ct,"aria-controls":ct?"sound-menu":void 0,children:[i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),B?i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),i.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M10 5.6l2.6 2.8"}),i.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]}),i.jsx("span",{className:"tb-word",children:"Sound"})]}),ct&&i.jsx(XB,{onClose:()=>Ke(!1),soundOn:B===!0,onToggleSound:le,prefs:Te,onLevel:(F,z)=>Ze(F,{level:z}),onFigure:(F,z)=>Ze(F,{figure:z}),onPreview:F=>_e(F),notifyOn:Qo,onToggleNotify:cu,notifyVetoed:Qa,notifyPermission:_t?Xa:"unsupported",onAskNotify:Jo,openerRef:ce})]}),i.jsxs("div",{className:"appearance-slot",children:[i.jsx("button",{ref:Je,className:"btn icon-btn",onClick:()=>{Ke(!1),$e(F=>!F)},title:"Appearance settings","aria-label":`Appearance settings, ${_r} theme, character ${Ks?"shown":"hidden"}`,"aria-haspopup":"dialog","aria-expanded":je,"aria-controls":je?"appearance-menu":void 0,children:_r==="dark"?i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("circle",{cx:"7",cy:"7",r:"2.5"}),i.jsx("path",{d:"M7 1.5v1.2M7 11.3v1.2M1.5 7h1.2M11.3 7h1.2M3.1 3.1l.85.85M10.05 10.05l.85.85M3.1 10.9l.85-.85M10.05 3.95l.85-.85"})]}):i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:"M11.8 8.4A5 5 0 1 1 5.6 2.2a4 4 0 0 0 6.2 6.2Z"})})}),je&&i.jsx(ZB,{theme:_r,onTheme:Do,characterEnabled:Ks,onToggleCharacter:()=>Yr(F=>!F),onClose:()=>$e(!1),openerRef:Je})]})]})]})]}),kr?i.jsxs("div",{className:"ver-banner done",role:"status",children:[i.jsx("span",{className:"ver-dot"}),i.jsxs("strong",{children:["Restarted — now running v",kr,"."]}),i.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):La&&!be?i.jsxs("div",{className:"conn-banner",role:"alert",children:[i.jsx("span",{className:"conn-dot"}),on?Ia==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Yt}…`:(()=>{const F=oV({connected:be,paused:Aa});return i.jsxs(i.Fragment,{children:[`Lost connection to the ${Yt} server. Reconnecting…`,F&&i.jsx("span",{className:"conn-sub",children:F})]})})()]}):Mn&&Qe?i.jsxs("div",{className:`ver-banner ${Qe.kind}`,role:"status",children:[i.jsx("span",{className:`ver-dot${Vs==null?"":" armed"}`}),Qe.kind==="restart"?i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:["v",Qe.to," is installed — this deck still runs v",Qe.from,"."]}),he!=null&&he.canRestart?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"ver-act",onClick:()=>Oa(),...wa(on),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
292
-
293
- Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.`,children:on?"restarting…":qc.label}),!on&&i.jsx("span",{className:"ver-sub",children:qc.clause}),i.jsxs("label",{className:"ver-auto",children:[i.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":br,onClick:Kr,"aria-label":"Auto-restart when idle",title:br?"Updates on its own. While you are here it restarts once nothing has been running for 30 seconds; while you are away it also installs the new version first. Click to require a click instead.":"Only updates when you click. Click to let it update itself when idle or while you are away.",children:i.jsx("span",{className:"switch-knob"})}),i.jsx("span",{"aria-hidden":!0,children:xB(br,Vs)})]})]}):i.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:[Yt," v",Qe.to," is out — you are on v",Qe.from,"."]}),(he==null?void 0:he.upgradeMode)==="install"&&Pe!=="failed"&&i.jsx("button",{type:"button",className:"ver-act",onClick:$t,...wa(Pe==="running",Pe==="done"),title:`Runs ${((Ja=he==null?void 0:he.upgrade)==null?void 0:Ja.command)??(he==null?void 0:he.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Pe==="running"?"installing…":Pe==="done"?"installed":"Update now"}),(he==null?void 0:he.upgradeMode)==="npx"&&(he==null?void 0:he.canRestart)&&i.jsx("button",{type:"button",className:"ver-act",onClick:()=>Oa({upgrade:!0}),...wa(on),title:`Runs ${he==null?void 0:he.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:on?"fetching…":Pe==="failed"?"Retry update":"Update & restart"}),Pe==="failed"?i.jsxs("span",{className:"ver-sub fail",title:((ks=he==null?void 0:he.upgrade)==null?void 0:ks.error)??"",children:[(he==null?void 0:he.upgradeMode)==="npx"?"update failed":"install failed",": ",((bl=he==null?void 0:he.upgrade)==null?void 0:bl.error)??"unknown error"," — run it yourself:"]}):(he==null?void 0:he.upgradeMode)==="npx"?i.jsx("span",{className:"ver-sub",children:he!=null&&he.canRestart?"npx cannot upgrade in place, so the deck re-runs:":rx.npx}):he!=null&&he.upgradeBlocked?i.jsx("span",{className:"ver-sub",children:Object.hasOwn(rx,he.upgradeBlocked)?rx[he.upgradeBlocked]:"cannot install from here"}):null,i.jsxs("button",{type:"button",className:"ver-cmd",onClick:Wr,title:"Copy to clipboard",children:[i.jsx("code",{children:he==null?void 0:he.command}),i.jsx("span",{className:"ver-cmd-hint",children:xt?"copied":"copy"})]})]}),i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Fs,children:"×"})]}):Ue&&Ce?i.jsxs("div",{className:"ver-banner",role:"status",children:[i.jsx("span",{className:"ver-dot"}),i.jsxs("strong",{children:[Ce," still works — the deck is called ",Yt," now."]}),he!=null&&he.renameFix?i.jsx("span",{className:"ver-sub",children:he.renameFix}):null,i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Le,children:"×"})]}):null,Np(de)&&_n.claude&&i.jsx(fB,{leaving:de==="leaving",onClose:()=>K(!1)}),M&&i.jsx(YD,{state:l.current,now:zt,selectedIds:h,onSelect:Gn,onClose:()=>Z(!1)}),i.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${Xs?" bubbling":""}${Ua?" dragging-any":""}`,"data-detail":Jc,ref:Zr,onMouseDownCapture:Xc,onPointerDownCapture:nl,onPointerUpCapture:nl,onWheelCapture:nl,children:[ml===0&&(!be&&nt?i.jsx(VV,{}):i.jsx(GV,{live:be,everConnected:La,providers:_n,workspace:nr,onTour:()=>J(!0)})),(Jr.length>1||Qi.size>0)&&i.jsx("div",{ref:$o,className:`cat-filter-bar${$c?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Jr.map(F=>{const z=Qi.has(F);return i.jsxs("button",{type:"button",className:`cat-filter${z?" off":""}`,onClick:()=>au(F),"aria-pressed":!z,title:`${z?"Show":"Hide"} ${lh[F]} tools`,children:[i.jsx(qV,{cat:F}),i.jsx("span",{className:"cat-name",children:lh[F]})]},F)})}),i.jsxs(cA,{nodes:Vn,edges:nu,nodeTypes:dV,edgesFocusable:!1,edgeTypes:hV,fitView:!Po,fitViewOptions:{padding:.25,duration:Ld({durationMs:qT,documentHidden:document.hidden})?qT:0},minZoom:FM,maxZoom:BM,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:(F,z)=>{if(z.type==="sessionGroup"){b();return}if(z.type==="recapNote"){S(z.data.parentId,F.shiftKey);return}S(z.id,F.shiftKey)},onPaneClick:()=>b(),onMoveStart:F=>{MT(Uc(F))&&rl()},onMove:(F,z)=>{var ae;Ho(),MT(Uc(F))&&rl();const se=wV(z.zoom);se!==Zs.current&&(Zs.current=se,Wa(se)),(ae=Zr.current)==null||ae.style.setProperty("--zoom",String(z.zoom)),tl.current&&window.clearTimeout(tl.current),tl.current=window.setTimeout(()=>LV(z),250)},onNodeDragStart:(F,z)=>{var se;if(Xh(),sl.current=!0,xr.current=new Map,cl(!0),Ho(),rl(),z.type==="sessionGroup"){const ae=(se=z.data)==null?void 0:se.sessionId,Ae=new Map;if(ae)for(const Se of jr){const Ge=Se.data;(Ge==null?void 0:Ge.sessionId)===ae&&Ae.set(Se.id,{x:Se.position.x,y:Se.position.y})}vs.current={start:{x:z.position.x,y:z.position.y},members:Ae};return}Rt.current.set(z.id,{x:z.position.x,y:z.position.y})},onNodeDrag:(F,z)=>{var se;if(Ho(),z.type==="sessionGroup"){const ae=vs.current;if(!ae)return;const Ae=z.position.x-ae.start.x,Se=z.position.y-ae.start.y;for(const[lt,vt]of ae.members){const tt={x:vt.x+Ae,y:vt.y+Se};Rt.current.set(lt,tt),cn.current.set(lt,tt)}const Ge=xr.current;if(Ge){for(const[lt,vt]of ae.members)Ge.set(lt,{x:vt.x+Ae,y:vt.y+Se});Ge.set(z.id,{x:z.position.x,y:z.position.y})}Lo(lt=>lt+1);return}Rt.current.set(z.id,{x:z.position.x,y:z.position.y}),cn.current.set(z.id,{x:z.position.x,y:z.position.y}),(se=xr.current)==null||se.set(z.id,{x:z.position.x,y:z.position.y}),Lo(ae=>ae+1)},onNodeDragStop:(F,z)=>{if(Ho(),sl.current=!1,xr.current=null,cl(!1),Ic(se=>se+1),z.type==="sessionGroup"){const se=vs.current;if(se){const ae=z.position.x-se.start.x,Ae=z.position.y-se.start.y;for(const[Se,Ge]of se.members){const lt={x:Ge.x+ae,y:Ge.y+Ae};Rt.current.set(Se,lt),cn.current.set(Se,lt)}}vs.current=null,Sd(cn.current,Rt.current),Ic(ae=>ae+1);return}Rt.current.set(z.id,{x:z.position.x,y:z.position.y}),cn.current.set(z.id,{x:z.position.x,y:z.position.y}),Sd(cn.current,Rt.current)},children:[i.jsx(HP,{gap:28,size:1,color:Xr["--grid-line"]}),i.jsx(eD,{onFit:()=>{Wn.current=Date.now()}}),i.jsx(qD,{agents:l.current.agents,visibleAgentIds:Ba,positions:cn.current,pinned:Rt.current,measured:Sr.current,spotlight:ol,hiddenCategories:Qi,now:zt,onOpenTool:k}),Uo&&i.jsxs("div",{className:"autofit-chip",children:[i.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),i.jsx("button",{type:"button",className:"autofit-resume",onClick:Vc,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]}),i.jsxs(PP,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[i.jsx(dr,{onClick:()=>e.zoomIn(),title:"Zoom in","aria-label":"Zoom in",disabled:t,children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:i.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),i.jsx(dr,{onClick:()=>e.zoomOut(),title:"Zoom out","aria-label":"Zoom out",disabled:n,children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:i.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),i.jsx(dr,{onClick:Vc,title:Uo?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":Uo?"":void 0,children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),i.jsx(dr,{"data-group-start":"",onClick:Ra,title:aV({paused:Aa,held:st.size,dropped:st.dropped}),"aria-label":sV,"aria-pressed":Aa,children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:i.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),i.jsx(dr,{onClick:es,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),i.jsx(dr,{"data-group-start":"","data-danger":"",onClick:()=>Yo("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),i.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),i.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),i.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),i.jsx(dr,{"data-group-start":"",onClick:()=>P(F=>!F),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),i.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),i.jsx(AP,{zoomable:!0,pannable:!0,nodeColor:Fo,nodeStrokeWidth:2,maskColor:Xr["--minimap-mask"],maskStrokeColor:Xr["--line"]}),Ks&&i.jsx(tH,{ref:xe})]})]}),Np(O)&&i.jsx(Eq,{state:l.current,now:zt,providers:_n,liveSince:Nr,leaving:O==="leaving",onClose:()=>I(!1)}),Np(Y)&&i.jsx(rF,{usageOpen:G,leaving:Y==="leaving",onClose:()=>H(!1)}),f&&gn?i.jsxs("aside",{className:"detail","aria-label":"Detail",children:[i.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>p(!1),children:"×"}),i.jsx(YV,{agent:gn,now:zt,onOpenTool:k,onShowSummary:E,onExportSession:F=>PV(l.current,F)})]}):null,Go&&i.jsx(H6,{tool:Go,onClose:()=>k(null)}),Bs&&i.jsx(x.Suspense,{fallback:null,children:i.jsx(cV,{providers:_n,onClose:()=>ps(!1)})}),Ea&&i.jsx(x.Suspense,{fallback:null,children:i.jsx(uV,{onClose:()=>Vr(!1),onSeen:F=>{Mo(F);try{localStorage.setItem(cN,String(F))}catch{}},onWatching:$n,palette:Xr})}),C&&(()=>{const F=l.current.agents.get(C);return F?i.jsx(c6,{agent:F,onClose:()=>T(null)}):null})(),j&&i.jsx(VD,{state:l.current,sessionId:j,onClose:()=>E(null)}),sn&&i.jsx(NH,{entries:sn.entries,since:sn.since,firstRun:sn.firstRun,running:pn,onClose:()=>an(null),onTour:()=>{an(null),J(!0)}}),(()=>{const{request:F,waiting:z}=nU(Uh,Mc.current);return F?i.jsx(rU,{request:F,waiting:z,busy:ys,now:Date.now(),onAccept:()=>void zs("accept",F.fp),onDecline:()=>void zs("dismiss",F.fp),onLater:()=>{ys||(Mc.current.add(F.fp),Io(se=>[...se]))}}):null})(),U&&i.jsx(AB,{onClose:()=>P(!1),onTour:()=>{P(!1),J(!0)}}),V&&i.jsx(uR,{title:"What the deck shows you",steps:XF,onClose:()=>{J(!1),xH(iN());const F=ee.current;ee.current=null,F&&an(F)}}),$&&i.jsx(EB,{agentCount:ml,onConfirm:()=>Yo("confirmation"),onCancel:()=>D(!1)})]})}function VV(){return i.jsxs("div",{className:"empty-hero",children:[i.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[i.jsx("div",{className:"core"}),i.jsxs("div",{className:"orbit r1",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]}),i.jsxs("div",{className:"orbit r2",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]}),i.jsxs("div",{className:"orbit r3",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]})]}),i.jsxs("h2",{children:["Too many ",Yt," tabs are open"]}),i.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",i.jsx("code",{children:Yt})," tabs are holding them. Close one and this tab connects on its own."]})]})}function GV({live:e,everConnected:t,providers:n,workspace:r,onTour:a}){const l=!e;return i.jsxs("div",{className:"empty-hero",children:[i.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[i.jsx("div",{className:"core"}),i.jsxs("div",{className:"orbit r1",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]}),i.jsxs("div",{className:"orbit r2",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]}),i.jsxs("div",{className:"orbit r3",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]})]}),l?i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),i.jsxs("p",{children:[t?"This page lost its connection to ":"This page cannot reach ",i.jsx("code",{children:Yt}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):KV(n,r),!l&&i.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function KV(e,t){const n=X9(t);return i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?i.jsxs("p",{children:[n.lead," ",i.jsx("code",{children:n.workspace}),n.tail]}):i.jsxs("p",{children:["Run ",i.jsx("code",{children:"claude"})," or ",i.jsx("code",{children:"codex"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),tV(e).map(r=>i.jsx("p",{className:"hint-row",children:r.spans.map((a,l)=>a.code?i.jsx("code",{children:a.text},l):i.jsx("span",{children:a.text},l))},r.provider))]})}function YV({agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:a}){const l=`${e.synthetic?"≥ ":""}${Yd(e.startedAt,e.endedAt,t)}`,c=tr(e),u=c.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const k=YM(N.name);p.set(k,(p.get(k)??0)+1)}const h=e.tools.filter(N=>N.ok===!1).length,m=e.tools.filter(N=>!N.endedAt).length,y=Array.from(p.entries()).sort((N,k)=>k[1]-N[1]),w=p.has("mcp")?$D(e.tools.map(N=>N.name)):null;return i.jsxs(i.Fragment,{children:[i.jsxs("header",{className:"detail-hero",children:[i.jsxs("div",{className:"hero-line",children:[i.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),i.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),i.jsxs("div",{className:"hero-meta",children:[i.jsx("span",{className:"hero-meta-item",children:e.kind==="root"?"session":"subagent"}),i.jsx("span",{className:"hero-sep",children:"·"}),i.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:l}),e.model&&(()=>{const N=jA(e);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"hero-sep",children:"·"}),i.jsxs("span",{className:"model-chip","data-family":gh(e.model),title:N.length>0?`${e.model}
294
- spend on this panel also covers:
295
- ${N.join(`
296
- `)}`:e.model,children:[_o(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),u&&i.jsxs("div",{className:"hero-cost",children:[i.jsxs("div",{className:"hero-cost-headline",children:[i.jsx("span",{className:"hero-cost-value",children:Nt(c.total)}),i.jsx("span",{className:"hero-cost-label",children:"spend"})]}),i.jsx(h0,{cost:c})]}),i.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&r&&i.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>r(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),a&&i.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),(()=>{const N=xh(e);if(!N)return null;const k=_x(N.at,t);return i.jsxs("section",{className:"detail-section",children:[i.jsxs("h3",{children:["Recap ",i.jsx("span",{className:"section-count",title:k.title,children:k.label})]}),i.jsx("p",{className:"detail-recap",children:N.text})]})})(),e.tools.length>0&&i.jsxs("section",{className:"detail-section",children:[i.jsx("h3",{children:"Activity"}),i.jsxs("div",{className:"activity-row",children:[i.jsxs("div",{className:"activity-counters",children:[i.jsxs("span",{className:"ac-item",children:[i.jsx("b",{children:e.toolCount})," calls"]}),m>0&&i.jsxs("span",{className:"ac-item ac-live",children:[i.jsx("b",{children:m})," live"]}),h>0&&i.jsxs("span",{className:"ac-item ac-err",children:[i.jsx("b",{children:h})," err"]})]}),i.jsx("div",{className:"cat-strip",children:y.map(([N,k])=>{const S=N==="mcp"?w:null,b=S==null?void 0:S.hue,j=`${k} ${lh[N]} call${k===1?"":"s"}`;return i.jsxs("span",{className:`cat-chip cat-${N}${b!=null?" mcp-hue":""}`,style:b!=null?{"--mcp-hue":b}:void 0,title:S?`${j}, all to ${S.label}`:j,children:[i.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:KM[N]}),i.jsx("span",{className:"cat-name",children:lh[N]}),i.jsx("span",{className:"cat-count",children:k}),S&&i.jsx("span",{className:"cat-server",children:S.label})]},N)})})]})]}),f>0&&i.jsxs("section",{className:"detail-section",children:[i.jsx("h3",{children:"Tokens"}),i.jsxs("div",{className:"tokens-grid",children:[i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"in"}),i.jsx("b",{title:e.usage.inputTokens.toLocaleString(),children:bn(e.usage.inputTokens)})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"out"}),i.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:bn(e.usage.outputTokens)})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"cache r"}),i.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:bn(e.usage.cacheReadTokens)})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"cache c"}),i.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:bn(e.usage.cacheCreateTokens)})]})]})]}),i.jsxs("section",{className:"detail-section",children:[i.jsx("h3",{children:"Identity"}),i.jsxs("div",{children:[e.cwd&&i.jsxs("div",{className:"row",children:[i.jsx("span",{className:"k",children:"cwd"}),i.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),i.jsxs("div",{className:"row",children:[i.jsx("span",{className:"k",children:"session"}),i.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&i.jsxs("div",{className:"row",children:[i.jsx("span",{className:"k",children:"parent"}),i.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&i.jsxs("section",{className:"detail-section",children:[i.jsxs("h3",{children:["Prompts ",i.jsx("span",{className:"section-count",children:mA(e.prompts).length})]}),i.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,k)=>{const S=_x(N.at,t),b=r0(N.text);return b?i.jsxs("details",{className:"prompt-entry prompt-injected",children:[i.jsxs("summary",{children:[i.jsx("span",{className:"prompt-time",title:S.title,children:S.label}),i.jsx("span",{className:"prompt-injected-label",children:b.label})]}),b.detail&&i.jsx("div",{className:"prompt-injected-detail",children:b.detail})]},k):i.jsxs("div",{className:"prompt-entry",children:[i.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),i.jsx("div",{className:"prompt-text",children:N.text})]},k)})})]}),i.jsxs("section",{className:"detail-section",children:[i.jsxs("h3",{children:["Tool calls ",i.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&i.jsx("div",{className:"empty",children:"No tool calls yet."}),i.jsx("div",{children:e.tools.slice().reverse().map(N=>i.jsx(ZV,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const XV={inflight:"in-flight",done:"done",err:"error"};function ZV({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",r=CA(e,"…");return i.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[i.jsxs("span",{className:"name",children:[i.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:XV[n]}),e.name]}),i.jsx("span",{style:{color:"var(--muted)"},children:r})]})}try{m6(window.localStorage)}catch{}const QV=FI.createRoot(document.getElementById("root"));QV.render(i.jsx(zV,{}));export{cN as S,J9 as a,eG as b,fc as c,bn as d,JV as e,Nt as f,_o as g,Is as h,bh as i,i as j,tU as k,p_ as p,x as r,wa as s,rn as u};