ccdeck 3.26.4 → 3.26.5
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.
- package/dist/web/assets/{BrowserWatchModal-BUWNIaK8.js → BrowserWatchModal-B6MuDGvq.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-DlRe0P3F.js → UsageHistoryModal-BJA3mUzs.js} +1 -1
- package/dist/web/assets/index-D4fPrztm.js +297 -0
- package/dist/web/index.html +1 -1
- package/hook/hook.js +61 -20
- package/package.json +1 -1
- package/release-notes.json +2 -1
- package/src/server/installer.mjs +23 -1
- package/src/server/retire-sound-hook.mjs +10 -1
- package/dist/web/assets/index-CPHonXg4.js +0 -297
|
@@ -0,0 +1,297 @@
|
|
|
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 dd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function r0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var up={exports:{}},ic={},dp={exports:{}},st={};/**
|
|
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 Uk;function h$(){if(Uk)return st;Uk=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(F){return F===null||typeof F!="object"?null:(F=m&&F[m]||F["@@iterator"],typeof F=="function"?F:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,k={};function j(F,D,ae){this.props=F,this.context=D,this.refs=k,this.updater=ae||w}j.prototype.isReactComponent={},j.prototype.setState=function(F,D){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,D,"setState")},j.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function b(){}b.prototype=j.prototype;function S(F,D,ae){this.props=F,this.context=D,this.refs=k,this.updater=ae||w}var E=S.prototype=new b;E.constructor=S,_(E,j.prototype),E.isPureReactComponent=!0;var C=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function H(F,D,ae){var z,Z={},U=null,re=null;if(D!=null)for(z in D.ref!==void 0&&(re=D.ref),D.key!==void 0&&(U=""+D.key),D)T.call(D,z)&&!$.hasOwnProperty(z)&&(Z[z]=D[z]);var de=arguments.length-2;if(de===1)Z.children=ae;else if(1<de){for(var ge=Array(de),pe=0;pe<de;pe++)ge[pe]=arguments[pe+2];Z.children=ge}if(F&&F.defaultProps)for(z in de=F.defaultProps,de)Z[z]===void 0&&(Z[z]=de[z]);return{$$typeof:e,type:F,key:U,ref:re,props:Z,_owner:R.current}}function B(F,D){return{$$typeof:e,type:F.type,key:D,ref:F.ref,props:F.props,_owner:F._owner}}function P(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function G(F){var D={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(ae){return D[ae]})}var Q=/\/+/g;function J(F,D){return typeof F=="object"&&F!==null&&F.key!=null?G(""+F.key):D.toString(36)}function M(F,D,ae,z,Z){var U=typeof F;(U==="undefined"||U==="boolean")&&(F=null);var re=!1;if(F===null)re=!0;else switch(U){case"string":case"number":re=!0;break;case"object":switch(F.$$typeof){case e:case t:re=!0}}if(re)return re=F,Z=Z(re),F=z===""?"."+J(re,0):z,C(Z)?(ae="",F!=null&&(ae=F.replace(Q,"$&/")+"/"),M(Z,D,ae,"",function(pe){return pe})):Z!=null&&(P(Z)&&(Z=B(Z,ae+(!Z.key||re&&re.key===Z.key?"":(""+Z.key).replace(Q,"$&/")+"/")+F)),D.push(Z)),1;if(re=0,z=z===""?".":z+":",C(F))for(var de=0;de<F.length;de++){U=F[de];var ge=z+J(U,de);re+=M(U,D,ae,ge,Z)}else if(ge=y(F),typeof ge=="function")for(F=ge.call(F),de=0;!(U=F.next()).done;)U=U.value,ge=z+J(U,de++),re+=M(U,D,ae,ge,Z);else if(U==="object")throw D=String(F),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.");return re}function X(F,D,ae){if(F==null)return F;var z=[],Z=0;return M(F,z,"","",function(U){return D.call(ae,U,Z++)}),z}function V(F){if(F._status===-1){var D=F._result;D=D(),D.then(function(ae){(F._status===0||F._status===-1)&&(F._status=1,F._result=ae)},function(ae){(F._status===0||F._status===-1)&&(F._status=2,F._result=ae)}),F._status===-1&&(F._status=0,F._result=D)}if(F._status===1)return F._result.default;throw F._result}var I={current:null},q={transition:null},W={ReactCurrentDispatcher:I,ReactCurrentBatchConfig:q,ReactCurrentOwner:R};function K(){throw Error("act(...) is not supported in production builds of React.")}return st.Children={map:X,forEach:function(F,D,ae){X(F,function(){D.apply(this,arguments)},ae)},count:function(F){var D=0;return X(F,function(){D++}),D},toArray:function(F){return X(F,function(D){return D})||[]},only:function(F){if(!P(F))throw Error("React.Children.only expected to receive a single React element child.");return F}},st.Component=j,st.Fragment=n,st.Profiler=a,st.PureComponent=S,st.StrictMode=r,st.Suspense=f,st.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,st.act=K,st.cloneElement=function(F,D,ae){if(F==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+F+".");var z=_({},F.props),Z=F.key,U=F.ref,re=F._owner;if(D!=null){if(D.ref!==void 0&&(U=D.ref,re=R.current),D.key!==void 0&&(Z=""+D.key),F.type&&F.type.defaultProps)var de=F.type.defaultProps;for(ge in D)T.call(D,ge)&&!$.hasOwnProperty(ge)&&(z[ge]=D[ge]===void 0&&de!==void 0?de[ge]:D[ge])}var ge=arguments.length-2;if(ge===1)z.children=ae;else if(1<ge){de=Array(ge);for(var pe=0;pe<ge;pe++)de[pe]=arguments[pe+2];z.children=de}return{$$typeof:e,type:F.type,key:Z,ref:U,props:z,_owner:re}},st.createContext=function(F){return F={$$typeof:c,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},F.Provider={$$typeof:l,_context:F},F.Consumer=F},st.createElement=H,st.createFactory=function(F){var D=H.bind(null,F);return D.type=F,D},st.createRef=function(){return{current:null}},st.forwardRef=function(F){return{$$typeof:u,render:F}},st.isValidElement=P,st.lazy=function(F){return{$$typeof:h,_payload:{_status:-1,_result:F},_init:V}},st.memo=function(F,D){return{$$typeof:p,type:F,compare:D===void 0?null:D}},st.startTransition=function(F){var D=q.transition;q.transition={};try{F()}finally{q.transition=D}},st.unstable_act=K,st.useCallback=function(F,D){return I.current.useCallback(F,D)},st.useContext=function(F){return I.current.useContext(F)},st.useDebugValue=function(){},st.useDeferredValue=function(F){return I.current.useDeferredValue(F)},st.useEffect=function(F,D){return I.current.useEffect(F,D)},st.useId=function(){return I.current.useId()},st.useImperativeHandle=function(F,D,ae){return I.current.useImperativeHandle(F,D,ae)},st.useInsertionEffect=function(F,D){return I.current.useInsertionEffect(F,D)},st.useLayoutEffect=function(F,D){return I.current.useLayoutEffect(F,D)},st.useMemo=function(F,D){return I.current.useMemo(F,D)},st.useReducer=function(F,D,ae){return I.current.useReducer(F,D,ae)},st.useRef=function(F){return I.current.useRef(F)},st.useState=function(F){return I.current.useState(F)},st.useSyncExternalStore=function(F,D,ae){return I.current.useSyncExternalStore(F,D,ae)},st.useTransition=function(){return I.current.useTransition()},st.version="18.3.1",st}var Vk;function Wc(){return Vk||(Vk=1,dp.exports=h$()),dp.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 Gk;function f$(){if(Gk)return ic;Gk=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 ic.Fragment=n,ic.jsx=c,ic.jsxs=c,ic}var Kk;function p$(){return Kk||(Kk=1,up.exports=f$()),up.exports}var i=p$(),hd={},hp={exports:{}},Un={},fp={exports:{}},pp={};/**
|
|
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 Yk;function m$(){return Yk||(Yk=1,(function(e){function t(q,W){var K=q.length;q.push(W);e:for(;0<K;){var F=K-1>>>1,D=q[F];if(0<a(D,W))q[F]=W,q[K]=D,K=F;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var W=q[0],K=q.pop();if(K!==W){q[0]=K;e:for(var F=0,D=q.length,ae=D>>>1;F<ae;){var z=2*(F+1)-1,Z=q[z],U=z+1,re=q[U];if(0>a(Z,K))U<D&&0>a(re,Z)?(q[F]=re,q[U]=K,F=U):(q[F]=Z,q[z]=K,F=z);else if(U<D&&0>a(re,K))q[F]=re,q[U]=K,F=U;else break e}}return W}function a(q,W){var K=q.sortIndex-W.sortIndex;return K!==0?K:q.id-W.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,_=!1,k=!1,j=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,S=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 W=n(p);W!==null;){if(W.callback===null)r(p);else if(W.startTime<=q)r(p),W.sortIndex=W.expirationTime,t(f,W);else break;W=n(p)}}function C(q){if(k=!1,E(q),!_)if(n(f)!==null)_=!0,V(T);else{var W=n(p);W!==null&&I(C,W.startTime-q)}}function T(q,W){_=!1,k&&(k=!1,b(H),H=-1),w=!0;var K=y;try{for(E(W),m=n(f);m!==null&&(!(m.expirationTime>W)||q&&!G());){var F=m.callback;if(typeof F=="function"){m.callback=null,y=m.priorityLevel;var D=F(m.expirationTime<=W);W=e.unstable_now(),typeof D=="function"?m.callback=D:m===n(f)&&r(f),E(W)}else r(f);m=n(f)}if(m!==null)var ae=!0;else{var z=n(p);z!==null&&I(C,z.startTime-W),ae=!1}return ae}finally{m=null,y=K,w=!1}}var R=!1,$=null,H=-1,B=5,P=-1;function G(){return!(e.unstable_now()-P<B)}function Q(){if($!==null){var q=e.unstable_now();P=q;var W=!0;try{W=$(!0,q)}finally{W?J():(R=!1,$=null)}}else R=!1}var J;if(typeof S=="function")J=function(){S(Q)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,X=M.port2;M.port1.onmessage=Q,J=function(){X.postMessage(null)}}else J=function(){j(Q,0)};function V(q){$=q,R||(R=!0,J())}function I(q,W){H=j(function(){q(e.unstable_now())},W)}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(){_||w||(_=!0,V(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"):B=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 W=3;break;default:W=y}var K=y;y=W;try{return q()}finally{y=K}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(q,W){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var K=y;y=q;try{return W()}finally{y=K}},e.unstable_scheduleCallback=function(q,W,K){var F=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?F+K:F):K=F,q){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=K+D,q={id:h++,callback:W,priorityLevel:q,startTime:K,expirationTime:D,sortIndex:-1},K>F?(q.sortIndex=K,t(p,q),n(f)===null&&q===n(p)&&(k?(b(H),H=-1):k=!0,I(C,K-F))):(q.sortIndex=D,t(f,q),_||w||(_=!0,V(T))),q},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(q){var W=y;return function(){var K=y;y=W;try{return q.apply(this,arguments)}finally{y=K}}}})(pp)),pp}var Xk;function g$(){return Xk||(Xk=1,fp.exports=m$()),fp.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 Zk;function y$(){if(Zk)return Un;Zk=1;var e=Wc(),t=g$();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 _(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,N,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=N,this.removeEmptyString=A}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){j[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];j[o]=new k(o,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){j[s]=new k(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){j[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){j[s]=new k(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){j[s]=new k(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){j[s]=new k(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){j[s]=new k(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){j[s]=new k(s,5,!1,s.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function S(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,S);j[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,S);j[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,S);j[o]=new k(o,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){j[s]=new k(s,1,!1,s.toLowerCase(),null,!1,!1)}),j.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){j[s]=new k(s,1,!1,s.toLowerCase(),null,!0,!0)});function E(s,o,d,g){var v=j.hasOwnProperty(o)?j[o]:null;(v!==null?v.type!==0:g||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="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"),H=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),G=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),q=Symbol.iterator;function W(s){return s===null||typeof s!="object"?null:(s=q&&s[q]||s["@@iterator"],typeof s=="function"?s:null)}var K=Object.assign,F;function D(s){if(F===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);F=o&&o[1]||""}return`
|
|
34
|
+
`+F+s}var ae=!1;function z(s,o){if(!s||ae)return"";ae=!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(fe){var g=fe}Reflect.construct(s,[],o)}else{try{o.call()}catch(fe){g=fe}s.call(o.prototype)}else{try{throw Error()}catch(fe){g=fe}s()}}catch(fe){if(fe&&g&&typeof fe.stack=="string"){for(var v=fe.stack.split(`
|
|
35
|
+
`),N=g.stack.split(`
|
|
36
|
+
`),A=v.length-1,Y=N.length-1;1<=A&&0<=Y&&v[A]!==N[Y];)Y--;for(;1<=A&&0<=Y;A--,Y--)if(v[A]!==N[Y]){if(A!==1||Y!==1)do if(A--,Y--,0>Y||v[A]!==N[Y]){var te=`
|
|
37
|
+
`+v[A].replace(" at new "," at ");return s.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",s.displayName)),te}while(1<=A&&0<=Y);break}}}finally{ae=!1,Error.prepareStackTrace=d}return(s=s?s.displayName||s.name:"")?D(s):""}function Z(s){switch(s.tag){case 5:return D(s.type);case 16:return D("Lazy");case 13:return D("Suspense");case 19:return D("SuspenseList");case 0:case 2:case 15:return s=z(s.type,!1),s;case 11:return s=z(s.type.render,!1),s;case 1:return s=z(s.type,!0),s;default:return""}}function U(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 B:return"Profiler";case H:return"StrictMode";case J:return"Suspense";case M:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case G:return(s.displayName||"Context")+".Consumer";case P:return(s._context.displayName||"Context")+".Provider";case Q:var o=s.render;return s=s.displayName,s||(s=o.displayName||o.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case X:return o=s.displayName||null,o!==null?o:U(s.type)||"Memo";case V:o=s._payload,s=s._init;try{return U(s(o))}catch{}}return null}function re(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 U(o);case 8:return o===H?"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 de(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function ge(s){var o=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function pe(s){var o=ge(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,N=d.set;return Object.defineProperty(s,o,{configurable:!0,get:function(){return v.call(this)},set:function(A){g=""+A,N.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 _e(s){s._valueTracker||(s._valueTracker=pe(s))}function Pe(s){if(!s)return!1;var o=s._valueTracker;if(!o)return!0;var d=o.getValue(),g="";return s&&(g=ge(s)?s.checked?"true":"false":s.value),s=g,s!==d?(o.setValue(s),!0):!1}function $e(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 Te(s,o){var d=o.checked;return K({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??s._wrapperState.initialChecked})}function je(s,o){var d=o.defaultValue==null?"":o.defaultValue,g=o.checked!=null?o.checked:o.defaultChecked;d=de(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 et(s,o){o=o.checked,o!=null&&E(s,"checked",o,!1)}function Ce(s,o){et(s,o);var d=de(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")?He(s,o.type,d):o.hasOwnProperty("defaultValue")&&He(s,o.type,de(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(s.defaultChecked=!!o.defaultChecked)}function Ne(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 He(s,o,d){(o!=="number"||$e(s.ownerDocument)!==s)&&(d==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+d&&(s.defaultValue=""+d))}var it=Array.isArray;function ot(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=""+de(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 le(s,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return K({},o,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function be(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(it(d)){if(1<d.length)throw Error(n(93));d=d[0]}o=d}o==null&&(o=""),d=o}s._wrapperState={initialValue:de(d)}}function Re(s,o){var d=de(o.value),g=de(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 Ze(s){var o=s.textContent;o===s._wrapperState.initialValue&&o!==""&&o!==null&&(s.value=o)}function We(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 tt(s,o){return s==null||s==="http://www.w3.org/1999/xhtml"?We(o):s==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var we,Me=(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(we=we||document.createElement("div"),we.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=we.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;o.firstChild;)s.appendChild(o.firstChild)}});function Qe(s,o){if(o){var d=s.firstChild;if(d&&d===s.lastChild&&d.nodeType===3){d.nodeValue=o;return}}s.textContent=o}var ce={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},lt=["Webkit","ms","Moz","O"];Object.keys(ce).forEach(function(s){lt.forEach(function(o){o=o+s.charAt(0).toUpperCase()+s.substring(1),ce[o]=ce[s]})});function gt(s,o,d){return o==null||typeof o=="boolean"||o===""?"":d||typeof o!="number"||o===0||ce.hasOwnProperty(s)&&ce[s]?(""+o).trim():o+"px"}function mt(s,o){s=s.style;for(var d in o)if(o.hasOwnProperty(d)){var g=d.indexOf("--")===0,v=gt(d,o[d],g);d==="float"&&(d="cssFloat"),g?s.setProperty(d,v):s[d]=v}}var Et=K({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 Ot(s,o){if(o){if(Et[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 Pt(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 Kt=null;function jn(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var _t=null,Bt=null,he=null;function Je(s){if(s=po(s)){if(typeof _t!="function")throw Error(n(280));var o=s.stateNode;o&&(o=ha(o),_t(s.stateNode,s.type,o))}}function Ct(s){Bt?he?he.push(s):he=[s]:Bt=s}function En(){if(Bt){var s=Bt,o=he;if(he=Bt=null,Je(s),o)for(s=0;s<o.length;s++)Je(o[s])}}function dn(s,o){return s(o)}function ir(){}var Mt=!1;function hn(s,o,d){if(Mt)return s(o,d);Mt=!0;try{return dn(s,o,d)}finally{Mt=!1,(Bt!==null||he!==null)&&(ir(),En())}}function Cn(s,o){var d=s.stateNode;if(d===null)return null;var g=ha(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 zt=!1;if(u)try{var Pn={};Object.defineProperty(Pn,"passive",{get:function(){zt=!0}}),window.addEventListener("test",Pn,Pn),window.removeEventListener("test",Pn,Pn)}catch{zt=!1}function yn(s,o,d,g,v,N,A,Y,te){var fe=Array.prototype.slice.call(arguments,3);try{o.apply(d,fe)}catch(xe){this.onError(xe)}}var wn=!1,Tn=null,_r=!1,Kr=null,Hs={onError:function(s){wn=!0,Tn=s}};function Ws(s,o,d,g,v,N,A,Y,te){wn=!1,Tn=null,yn.apply(Hs,arguments)}function vn(s,o,d,g,v,N,A,Y,te){if(Ws.apply(this,arguments),wn){if(wn){var fe=Tn;wn=!1,Tn=null}else throw Error(n(198));_r||(_r=!0,Kr=fe)}}function ee(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 Ae(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 Le(s){if(ee(s)!==s)throw Error(n(188))}function Ie(s){var o=s.alternate;if(!o){if(o=ee(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 N=v.alternate;if(N===null){if(g=v.return,g!==null){d=g;continue}break}if(v.child===N.child){for(N=v.child;N;){if(N===d)return Le(v),s;if(N===g)return Le(v),o;N=N.sibling}throw Error(n(188))}if(d.return!==g.return)d=v,g=N;else{for(var A=!1,Y=v.child;Y;){if(Y===d){A=!0,d=v,g=N;break}if(Y===g){A=!0,g=v,d=N;break}Y=Y.sibling}if(!A){for(Y=N.child;Y;){if(Y===d){A=!0,d=N,g=v;break}if(Y===g){A=!0,g=N,d=v;break}Y=Y.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 Ue(s){return s=Ie(s),s!==null?ct(s):null}function ct(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var o=ct(s);if(o!==null)return o;s=s.sibling}return null}var yt=t.unstable_scheduleCallback,St=t.unstable_cancelCallback,Sr=t.unstable_shouldYield,xt=t.unstable_requestPaint,wt=t.unstable_now,Us=t.unstable_getCurrentPriorityLevel,ms=t.unstable_ImmediatePriority,qa=t.unstable_UserBlockingPriority,Vs=t.unstable_NormalPriority,Ba=t.unstable_LowPriority,Uo=t.unstable_IdlePriority,Yr=null,An=null;function za(s){if(An&&typeof An.onCommitFiberRoot=="function")try{An.onCommitFiberRoot(Yr,s,void 0,(s.current.flags&128)===128)}catch{}}var xn=Math.clz32?Math.clz32:su,ru=Math.log,Vo=Math.LN2;function su(s){return s>>>=0,s===0?32:31-(ru(s)/Vo|0)|0}var Ha=64,Xr=4194304;function Wa(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 Ua(s,o){var d=s.pendingLanes;if(d===0)return 0;var g=0,v=s.suspendedLanes,N=s.pingedLanes,A=d&268435455;if(A!==0){var Y=A&~v;Y!==0?g=Wa(Y):(N&=A,N!==0&&(g=Wa(N)))}else A=d&~v,A!==0?g=Wa(A):N!==0&&(g=Wa(N));if(g===0)return 0;if(o!==0&&o!==g&&(o&v)===0&&(v=g&-g,N=o&-o,v>=N||v===16&&(N&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-xn(o),v=1<<d,g|=s[d],o&=~v;return g}function au(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 Qh(s,o){for(var d=s.suspendedLanes,g=s.pingedLanes,v=s.expirationTimes,N=s.pendingLanes;0<N;){var A=31-xn(N),Y=1<<A,te=v[A];te===-1?((Y&d)===0||(Y&g)!==0)&&(v[A]=au(Y,o)):te<=o&&(s.expiredLanes|=Y),N&=~Y}}function Go(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function Gs(){var s=Ha;return Ha<<=1,(Ha&4194240)===0&&(Ha=64),s}function gl(s){for(var o=[],d=0;31>d;d++)o.push(s);return o}function Ks(s,o,d){s.pendingLanes|=o,o!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,o=31-xn(o),s[o]=d}function Xn(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-xn(d),N=1<<v;o[v]=0,g[v]=-1,s[v]=-1,d&=~N}}function Ys(s,o){var d=s.entangledLanes|=o;for(s=s.entanglements;d;){var g=31-xn(d),v=1<<g;v&o|s[g]&o&&(s[g]|=o),d&=~v}}var ht=0;function Ko(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Ht,yl,jr,Va,wl,vl=!1,Zn=[],Qn=null,Zr=null,Qr=null,Xs=new Map,Zs=new Map,Rn=[],ou="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 xl(s,o){switch(s){case"focusin":case"focusout":Qn=null;break;case"dragenter":case"dragleave":Zr=null;break;case"mouseover":case"mouseout":Qr=null;break;case"pointerover":case"pointerout":Xs.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zs.delete(o.pointerId)}}function Er(s,o,d,g,v,N){return s===null||s.nativeEvent!==N?(s={blockedOn:o,domEventName:d,eventSystemFlags:g,nativeEvent:N,targetContainers:[v]},o!==null&&(o=po(o),o!==null&&yl(o)),s):(s.eventSystemFlags|=g,o=s.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),s)}function bl(s,o,d,g,v){switch(o){case"focusin":return Qn=Er(Qn,s,o,d,g,v),!0;case"dragenter":return Zr=Er(Zr,s,o,d,g,v),!0;case"mouseover":return Qr=Er(Qr,s,o,d,g,v),!0;case"pointerover":var N=v.pointerId;return Xs.set(N,Er(Xs.get(N)||null,s,o,d,g,v)),!0;case"gotpointercapture":return N=v.pointerId,Zs.set(N,Er(Zs.get(N)||null,s,o,d,g,v)),!0}return!1}function kl(s){var o=lr(s.target);if(o!==null){var d=ee(o);if(d!==null){if(o=d.tag,o===13){if(o=Ae(d),o!==null){s.blockedOn=o,wl(s.priority,function(){jr(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 Ga(s){if(s.blockedOn!==null)return!1;for(var o=s.targetContainers;0<o.length;){var d=_l(s.domEventName,s.eventSystemFlags,o[0],s.nativeEvent);if(d===null){d=s.nativeEvent;var g=new d.constructor(d.type,d);Kt=g,d.target.dispatchEvent(g),Kt=null}else return o=po(d),o!==null&&yl(o),s.blockedOn=d,!1;o.shift()}return!0}function Nl(s,o,d){Ga(s)&&d.delete(o)}function iu(){vl=!1,Qn!==null&&Ga(Qn)&&(Qn=null),Zr!==null&&Ga(Zr)&&(Zr=null),Qr!==null&&Ga(Qr)&&(Qr=null),Xs.forEach(Nl),Zs.forEach(Nl)}function Tt(s,o){s.blockedOn===o&&(s.blockedOn=null,vl||(vl=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,iu)))}function Jr(s){function o(v){return Tt(v,s)}if(0<Zn.length){Tt(Zn[0],s);for(var d=1;d<Zn.length;d++){var g=Zn[d];g.blockedOn===s&&(g.blockedOn=null)}}for(Qn!==null&&Tt(Qn,s),Zr!==null&&Tt(Zr,s),Qr!==null&&Tt(Qr,s),Xs.forEach(o),Zs.forEach(o),d=0;d<Rn.length;d++)g=Rn[d],g.blockedOn===s&&(g.blockedOn=null);for(;0<Rn.length&&(d=Rn[0],d.blockedOn===null);)kl(d),d.blockedOn===null&&Rn.shift()}var Cr=C.ReactCurrentBatchConfig,Qs=!0;function Jh(s,o,d,g){var v=ht,N=Cr.transition;Cr.transition=null;try{ht=1,Yo(s,o,d,g)}finally{ht=v,Cr.transition=N}}function Js(s,o,d,g){var v=ht,N=Cr.transition;Cr.transition=null;try{ht=4,Yo(s,o,d,g)}finally{ht=v,Cr.transition=N}}function Yo(s,o,d,g){if(Qs){var v=_l(s,o,d,g);if(v===null)Ul(s,o,g,es,d),xl(s,g);else if(bl(v,s,o,d,g))g.stopPropagation();else if(xl(s,g),o&4&&-1<ou.indexOf(s)){for(;v!==null;){var N=po(v);if(N!==null&&Ht(N),N=_l(s,o,d,g),N===null&&Ul(s,o,g,es,d),N===v)break;v=N}v!==null&&g.stopPropagation()}else Ul(s,o,g,null,d)}}var es=null;function _l(s,o,d,g){if(es=null,s=jn(g),s=lr(s),s!==null)if(o=ee(s),o===null)s=null;else if(d=o.tag,d===13){if(s=Ae(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 es=s,null}function gs(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(Us()){case ms:return 1;case qa:return 4;case Vs:case Ba:return 16;case Uo:return 536870912;default:return 16}default:return 16}}var ts=null,Xo=null,Zo=null;function Sl(){if(Zo)return Zo;var s,o=Xo,d=o.length,g,v="value"in ts?ts.value:ts.textContent,N=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[N-g];g++);return Zo=v.slice(s,1<g?1-g:void 0)}function Qo(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 bn(){return!0}function ys(){return!1}function Yt(s){function o(d,g,v,N,A){this._reactName=d,this._targetInst=v,this.type=g,this.nativeEvent=N,this.target=A,this.currentTarget=null;for(var Y in s)s.hasOwnProperty(Y)&&(d=s[Y],this[Y]=d?d(N):N[Y]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?bn:ys,this.isPropagationStopped=ys,this}return K(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=bn)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=bn)},persist:function(){},isPersistent:bn}),o}var Tr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jo=Yt(Tr),ea=K({},Tr,{view:0,detail:0}),Ka=Yt(ea),ei,Ya,Jn,Xa=K({},ea,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:na,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!==Jn&&(Jn&&s.type==="mousemove"?(ei=s.screenX-Jn.screenX,Ya=s.screenY-Jn.screenY):Ya=ei=0,Jn=s),ei)},movementY:function(s){return"movementY"in s?s.movementY:Ya}}),Mn=Yt(Xa),jl=K({},Xa,{dataTransfer:0}),El=Yt(jl),lu=K({},ea,{relatedTarget:0}),ta=Yt(lu),Cl=K({},Tr,{animationName:0,elapsedTime:0,pseudoElement:0}),cu=Yt(Cl),Tl=K({},Tr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Al=Yt(Tl),ef=K({},Tr,{data:0}),ns=Yt(ef),Rl={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uu={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"},Za={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function du(s){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(s):(s=Za[s])?!!o[s]:!1}function na(){return du}var Ar=K({},ea,{key:function(s){if(s.key){var o=Rl[s.key]||s.key;if(o!=="Unidentified")return o}return s.type==="keypress"?(s=Qo(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?uu[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:na,charCode:function(s){return s.type==="keypress"?Qo(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Qo(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Ml=Yt(Ar),tf=K({},Xa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Il=Yt(tf),hu=K({},ea,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:na}),nf=Yt(hu),Xt=K({},Tr,{propertyName:0,elapsedTime:0,pseudoElement:0}),fu=Yt(Xt),ti=K({},Xa,{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}),ra=Yt(ti),Qa=[9,13,27,32],Ja=u&&"CompositionEvent"in window,ws=null;u&&"documentMode"in document&&(ws=document.documentMode);var vs=u&&"TextEvent"in window&&!ws,sa=u&&(!Ja||ws&&8<ws&&11>=ws),$l=" ",pu=!1;function mu(s,o){switch(s){case"keyup":return Qa.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function eo(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var aa=!1;function rf(s,o){switch(s){case"compositionend":return eo(o);case"keypress":return o.which!==32?null:(pu=!0,$l);case"textInput":return s=o.data,s===$l&&pu?null:s;default:return null}}function Ol(s,o){if(aa)return s==="compositionend"||!Ja&&mu(s,o)?(s=Sl(),Zo=Xo=ts=null,aa=!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 sa&&o.locale!=="ko"?null:o.data;default:return null}}var rs={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 oa(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o==="input"?!!rs[s.type]:o==="textarea"}function Pl(s,o,d,g){Ct(g),o=co(o,"onChange"),0<o.length&&(d=new Jo("onChange","change",null,d,g),s.push({event:d,listeners:o}))}var to=null,no=null;function xs(s){lo(s,0)}function ia(s){var o=js(s);if(Pe(o))return s}function sf(s,o){if(s==="change")return o}var gu=!1;if(u){var Ll;if(u){var sn="oninput"in document;if(!sn){var Dl=document.createElement("div");Dl.setAttribute("oninput","return;"),sn=typeof Dl.oninput=="function"}Ll=sn}else Ll=!1;gu=Ll&&(!document.documentMode||9<document.documentMode)}function ni(){to&&(to.detachEvent("onpropertychange",yu),no=to=null)}function yu(s){if(s.propertyName==="value"&&ia(no)){var o=[];Pl(o,no,s,jn(s)),hn(xs,o)}}function Fl(s,o,d){s==="focusin"?(ni(),to=o,no=d,to.attachEvent("onpropertychange",yu)):s==="focusout"&&ni()}function ri(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return ia(no)}function si(s,o){if(s==="click")return ia(o)}function af(s,o){if(s==="input"||s==="change")return ia(o)}function ss(s,o){return s===o&&(s!==0||1/s===1/o)||s!==s&&o!==o}var Ln=typeof Object.is=="function"?Object.is:ss;function ro(s,o){if(Ln(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)||!Ln(s[v],o[v]))return!1}return!0}function ql(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Bl(s,o){var d=ql(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=ql(d)}}function wu(s,o){return s&&o?s===o?!0:s&&s.nodeType===3?!1:o&&o.nodeType===3?wu(s,o.parentNode):"contains"in s?s.contains(o):s.compareDocumentPosition?!!(s.compareDocumentPosition(o)&16):!1:!1}function so(){for(var s=window,o=$e();o instanceof s.HTMLIFrameElement;){try{var d=typeof o.contentWindow.location.href=="string"}catch{d=!1}if(d)s=o.contentWindow;else break;o=$e(s.document)}return o}function zl(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 Hl(s){var o=so(),d=s.focusedElem,g=s.selectionRange;if(o!==d&&d&&d.ownerDocument&&wu(d.ownerDocument.documentElement,d)){if(g!==null&&zl(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,N=Math.min(g.start,v);g=g.end===void 0?N:Math.min(g.end,v),!s.extend&&N>g&&(v=g,g=N,N=v),v=Bl(d,N);var A=Bl(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(),N>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 vu=u&&"documentMode"in document&&11>=document.documentMode,bs=null,ai=null,ks=null,la=!1;function oi(s,o,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;la||bs==null||bs!==$e(g)||(g=bs,"selectionStart"in g&&zl(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}),ks&&ro(ks,g)||(ks=g,g=co(ai,"onSelect"),0<g.length&&(o=new Jo("onSelect","select",null,o,d),s.push({event:o,listeners:g}),o.target=bs)))}function ao(s,o){var d={};return d[s.toLowerCase()]=o.toLowerCase(),d["Webkit"+s]="webkit"+o,d["Moz"+s]="moz"+o,d}var Dn={animationend:ao("Animation","AnimationEnd"),animationiteration:ao("Animation","AnimationIteration"),animationstart:ao("Animation","AnimationStart"),transitionend:ao("Transition","TransitionEnd")},kn={},xu={};u&&(xu=document.createElement("div").style,"AnimationEvent"in window||(delete Dn.animationend.animation,delete Dn.animationiteration.animation,delete Dn.animationstart.animation),"TransitionEvent"in window||delete Dn.transitionend.transition);function ii(s){if(kn[s])return kn[s];if(!Dn[s])return s;var o=Dn[s],d;for(d in o)if(o.hasOwnProperty(d)&&d in xu)return kn[s]=o[d];return s}var bu=ii("animationend"),ku=ii("animationiteration"),Ns=ii("animationstart"),oo=ii("transitionend"),li=new Map,_s="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 Rr(s,o){li.set(s,o),l(o,[s])}for(var ci=0;ci<_s.length;ci++){var Wt=_s[ci],Nu=Wt.toLowerCase(),_u=Wt[0].toUpperCase()+Wt.slice(1);Rr(Nu,"on"+_u)}Rr(bu,"onAnimationEnd"),Rr(ku,"onAnimationIteration"),Rr(Ns,"onAnimationStart"),Rr("dblclick","onDoubleClick"),Rr("focusin","onFocus"),Rr("focusout","onBlur"),Rr(oo,"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 io="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(" "),of=new Set("cancel close invalid load scroll toggle".split(" ").concat(io));function Wl(s,o,d){var g=s.type||"unknown-event";s.currentTarget=d,vn(g,o,void 0,s),s.currentTarget=null}function lo(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 N=void 0;if(o)for(var A=g.length-1;0<=A;A--){var Y=g[A],te=Y.instance,fe=Y.currentTarget;if(Y=Y.listener,te!==N&&v.isPropagationStopped())break e;Wl(v,Y,fe),N=te}else for(A=0;A<g.length;A++){if(Y=g[A],te=Y.instance,fe=Y.currentTarget,Y=Y.listener,te!==N&&v.isPropagationStopped())break e;Wl(v,Y,fe),N=te}}}if(_r)throw s=Kr,_r=!1,Kr=null,s}function Nt(s,o){var d=o[Ft];d===void 0&&(d=o[Ft]=new Set);var g=s+"__bubble";d.has(g)||(ui(o,s,2,!1),d.add(g))}function Mr(s,o,d){var g=0;o&&(g|=4),ui(d,s,g,o)}var ca="_reactListening"+Math.random().toString(36).slice(2);function as(s){if(!s[ca]){s[ca]=!0,r.forEach(function(d){d!=="selectionchange"&&(of.has(d)||Mr(d,!1,s),Mr(d,!0,s))});var o=s.nodeType===9?s:s.ownerDocument;o===null||o[ca]||(o[ca]=!0,Mr("selectionchange",!1,o))}}function ui(s,o,d,g){switch(gs(o)){case 1:var v=Jh;break;case 4:v=Js;break;default:v=Yo}d=v.bind(null,o,d,s),v=void 0,!zt||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 Ul(s,o,d,g,v){var N=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 Y=g.stateNode.containerInfo;if(Y===v||Y.nodeType===8&&Y.parentNode===v)break;if(A===4)for(A=g.return;A!==null;){var te=A.tag;if((te===3||te===4)&&(te=A.stateNode.containerInfo,te===v||te.nodeType===8&&te.parentNode===v))return;A=A.return}for(;Y!==null;){if(A=lr(Y),A===null)return;if(te=A.tag,te===5||te===6){g=N=A;continue e}Y=Y.parentNode}}g=g.return}hn(function(){var fe=N,xe=jn(d),ke=[];e:{var ve=li.get(s);if(ve!==void 0){var Oe=Jo,qe=s;switch(s){case"keypress":if(Qo(d)===0)break e;case"keydown":case"keyup":Oe=Ml;break;case"focusin":qe="focus",Oe=ta;break;case"focusout":qe="blur",Oe=ta;break;case"beforeblur":case"afterblur":Oe=ta;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=Mn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Oe=El;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Oe=nf;break;case bu:case ku:case Ns:Oe=cu;break;case oo:Oe=fu;break;case"scroll":Oe=Ka;break;case"wheel":Oe=ra;break;case"copy":case"cut":case"paste":Oe=Al;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Oe=Il}var Be=(o&4)!==0,qt=!Be&&s==="scroll",ie=Be?ve!==null?ve+"Capture":null:ve;Be=[];for(var se=fe,ue;se!==null;){ue=se;var Ee=ue.stateNode;if(ue.tag===5&&Ee!==null&&(ue=Ee,ie!==null&&(Ee=Cn(se,ie),Ee!=null&&Be.push(ua(se,Ee,ue)))),qt)break;se=se.return}0<Be.length&&(ve=new Oe(ve,qe,null,d,xe),ke.push({event:ve,listeners:Be}))}}if((o&7)===0){e:{if(ve=s==="mouseover"||s==="pointerover",Oe=s==="mouseout"||s==="pointerout",ve&&d!==Kt&&(qe=d.relatedTarget||d.fromElement)&&(lr(qe)||qe[jt]))break e;if((Oe||ve)&&(ve=xe.window===xe?xe:(ve=xe.ownerDocument)?ve.defaultView||ve.parentWindow:window,Oe?(qe=d.relatedTarget||d.toElement,Oe=fe,qe=qe?lr(qe):null,qe!==null&&(qt=ee(qe),qe!==qt||qe.tag!==5&&qe.tag!==6)&&(qe=null)):(Oe=null,qe=fe),Oe!==qe)){if(Be=Mn,Ee="onMouseLeave",ie="onMouseEnter",se="mouse",(s==="pointerout"||s==="pointerover")&&(Be=Il,Ee="onPointerLeave",ie="onPointerEnter",se="pointer"),qt=Oe==null?ve:js(Oe),ue=qe==null?ve:js(qe),ve=new Be(Ee,se+"leave",Oe,d,xe),ve.target=qt,ve.relatedTarget=ue,Ee=null,lr(xe)===fe&&(Be=new Be(ie,se+"enter",qe,d,xe),Be.target=ue,Be.relatedTarget=qt,Ee=Be),qt=Ee,Oe&&qe)t:{for(Be=Oe,ie=qe,se=0,ue=Be;ue;ue=da(ue))se++;for(ue=0,Ee=ie;Ee;Ee=da(Ee))ue++;for(;0<se-ue;)Be=da(Be),se--;for(;0<ue-se;)ie=da(ie),ue--;for(;se--;){if(Be===ie||ie!==null&&Be===ie.alternate)break t;Be=da(Be),ie=da(ie)}Be=null}else Be=null;Oe!==null&&Su(ke,ve,Oe,Be,!1),qe!==null&&qt!==null&&Su(ke,qt,qe,Be,!0)}}e:{if(ve=fe?js(fe):window,Oe=ve.nodeName&&ve.nodeName.toLowerCase(),Oe==="select"||Oe==="input"&&ve.type==="file")var ze=sf;else if(oa(ve))if(gu)ze=af;else{ze=ri;var Ye=Fl}else(Oe=ve.nodeName)&&Oe.toLowerCase()==="input"&&(ve.type==="checkbox"||ve.type==="radio")&&(ze=si);if(ze&&(ze=ze(s,fe))){Pl(ke,ze,d,xe);break e}Ye&&Ye(s,ve,fe),s==="focusout"&&(Ye=ve._wrapperState)&&Ye.controlled&&ve.type==="number"&&He(ve,"number",ve.value)}switch(Ye=fe?js(fe):window,s){case"focusin":(oa(Ye)||Ye.contentEditable==="true")&&(bs=Ye,ai=fe,ks=null);break;case"focusout":ks=ai=bs=null;break;case"mousedown":la=!0;break;case"contextmenu":case"mouseup":case"dragend":la=!1,oi(ke,d,xe);break;case"selectionchange":if(vu)break;case"keydown":case"keyup":oi(ke,d,xe)}var Xe;if(Ja)e:{switch(s){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else aa?mu(s,d)&&(nt="onCompositionEnd"):s==="keydown"&&d.keyCode===229&&(nt="onCompositionStart");nt&&(sa&&d.locale!=="ko"&&(aa||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&aa&&(Xe=Sl()):(ts=xe,Xo="value"in ts?ts.value:ts.textContent,aa=!0)),Ye=co(fe,nt),0<Ye.length&&(nt=new ns(nt,s,null,d,xe),ke.push({event:nt,listeners:Ye}),Xe?nt.data=Xe:(Xe=eo(d),Xe!==null&&(nt.data=Xe)))),(Xe=vs?rf(s,d):Ol(s,d))&&(fe=co(fe,"onBeforeInput"),0<fe.length&&(xe=new ns("onBeforeInput","beforeinput",null,d,xe),ke.push({event:xe,listeners:fe}),xe.data=Xe))}lo(ke,o)})}function ua(s,o,d){return{instance:s,listener:o,currentTarget:d}}function co(s,o){for(var d=o+"Capture",g=[];s!==null;){var v=s,N=v.stateNode;v.tag===5&&N!==null&&(v=N,N=Cn(s,d),N!=null&&g.unshift(ua(s,N,v)),N=Cn(s,o),N!=null&&g.push(ua(s,N,v))),s=s.return}return g}function da(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Su(s,o,d,g,v){for(var N=o._reactName,A=[];d!==null&&d!==g;){var Y=d,te=Y.alternate,fe=Y.stateNode;if(te!==null&&te===g)break;Y.tag===5&&fe!==null&&(Y=fe,v?(te=Cn(d,N),te!=null&&A.unshift(ua(d,te,Y))):v||(te=Cn(d,N),te!=null&&A.push(ua(d,te,Y)))),d=d.return}A.length!==0&&s.push({event:o,listeners:A})}var ju=/\r\n?/g,uo=/\u0000|\uFFFD/g;function di(s){return(typeof s=="string"?s:""+s).replace(ju,`
|
|
38
|
+
`).replace(uo,"")}function hi(s,o,d){if(o=di(o),di(s)!==o&&d)throw Error(n(425))}function ho(){}var fi=null,pi=null;function mi(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 gi=typeof setTimeout=="function"?setTimeout:void 0,L=typeof clearTimeout=="function"?clearTimeout:void 0,O=typeof Promise=="function"?Promise:void 0,ne=typeof queueMicrotask=="function"?queueMicrotask:typeof O<"u"?function(s){return O.resolve(null).then(s).catch(oe)}:gi;function oe(s){setTimeout(function(){throw s})}function ye(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),Jr(o);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=v}while(d);Jr(o)}function Se(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 De(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 Ge=Math.random().toString(36).slice(2),rt="__reactFiber$"+Ge,Ke="__reactProps$"+Ge,jt="__reactContainer$"+Ge,Ft="__reactEvents$"+Ge,Ss="__reactListeners$"+Ge,fo="__reactHandles$"+Ge;function lr(s){var o=s[rt];if(o)return o;for(var d=s.parentNode;d;){if(o=d[jt]||d[rt]){if(d=o.alternate,o.child!==null||d!==null&&d.child!==null)for(s=De(s);s!==null;){if(d=s[rt])return d;s=De(s)}return o}s=d,d=s.parentNode}return null}function po(s){return s=s[rt]||s[jt],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function js(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function ha(s){return s[Ke]||null}var Vl=[],Es=-1;function Fn(s){return{current:s}}function ft(s){0>Es||(s.current=Vl[Es],Vl[Es]=null,Es--)}function bt(s,o){Es++,Vl[Es]=s.current,s.current=o}var vt={},Zt=Fn(vt),qn=Fn(!1),mo=vt;function yi(s,o){var d=s.type.contextTypes;if(!d)return vt;var g=s.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===o)return g.__reactInternalMemoizedMaskedChildContext;var v={},N;for(N in d)v[N]=o[N];return g&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=o,s.__reactInternalMemoizedMaskedChildContext=v),v}function Bn(s){return s=s.childContextTypes,s!=null}function Eu(){ft(qn),ft(Zt)}function fb(s,o,d){if(Zt.current!==vt)throw Error(n(168));bt(Zt,o),bt(qn,d)}function pb(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,re(s)||"Unknown",v));return K({},d,g)}function Cu(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||vt,mo=Zt.current,bt(Zt,s),bt(qn,qn.current),!0}function mb(s,o,d){var g=s.stateNode;if(!g)throw Error(n(169));d?(s=pb(s,o,mo),g.__reactInternalMemoizedMergedChildContext=s,ft(qn),ft(Zt),bt(Zt,s)):ft(qn),bt(qn,d)}var Cs=null,Tu=!1,lf=!1;function gb(s){Cs===null?Cs=[s]:Cs.push(s)}function RI(s){Tu=!0,gb(s)}function fa(){if(!lf&&Cs!==null){lf=!0;var s=0,o=ht;try{var d=Cs;for(ht=1;s<d.length;s++){var g=d[s];do g=g(!0);while(g!==null)}Cs=null,Tu=!1}catch(v){throw Cs!==null&&(Cs=Cs.slice(s+1)),yt(ms,fa),v}finally{ht=o,lf=!1}}return null}var wi=[],vi=0,Au=null,Ru=0,cr=[],ur=0,go=null,Ts=1,As="";function yo(s,o){wi[vi++]=Ru,wi[vi++]=Au,Au=s,Ru=o}function yb(s,o,d){cr[ur++]=Ts,cr[ur++]=As,cr[ur++]=go,go=s;var g=Ts;s=As;var v=32-xn(g)-1;g&=~(1<<v),d+=1;var N=32-xn(o)+v;if(30<N){var A=v-v%5;N=(g&(1<<A)-1).toString(32),g>>=A,v-=A,Ts=1<<32-xn(o)+v|d<<v|g,As=N+s}else Ts=1<<N|d<<v|g,As=s}function cf(s){s.return!==null&&(yo(s,1),yb(s,1,0))}function uf(s){for(;s===Au;)Au=wi[--vi],wi[vi]=null,Ru=wi[--vi],wi[vi]=null;for(;s===go;)go=cr[--ur],cr[ur]=null,As=cr[--ur],cr[ur]=null,Ts=cr[--ur],cr[ur]=null}var er=null,tr=null,At=!1,Ir=null;function wb(s,o){var d=pr(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 vb(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,er=s,tr=Se(o.firstChild),!0):!1;case 6:return o=s.pendingProps===""||o.nodeType!==3?null:o,o!==null?(s.stateNode=o,er=s,tr=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(d=go!==null?{id:Ts,overflow:As}:null,s.memoizedState={dehydrated:o,treeContext:d,retryLane:1073741824},d=pr(18,null,null,0),d.stateNode=o,d.return=s,s.child=d,er=s,tr=null,!0):!1;default:return!1}}function df(s){return(s.mode&1)!==0&&(s.flags&128)===0}function hf(s){if(At){var o=tr;if(o){var d=o;if(!vb(s,o)){if(df(s))throw Error(n(418));o=Se(d.nextSibling);var g=er;o&&vb(s,o)?wb(g,d):(s.flags=s.flags&-4097|2,At=!1,er=s)}}else{if(df(s))throw Error(n(418));s.flags=s.flags&-4097|2,At=!1,er=s}}}function xb(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;er=s}function Mu(s){if(s!==er)return!1;if(!At)return xb(s),At=!0,!1;var o;if((o=s.tag!==3)&&!(o=s.tag!==5)&&(o=s.type,o=o!=="head"&&o!=="body"&&!mi(s.type,s.memoizedProps)),o&&(o=tr)){if(df(s))throw bb(),Error(n(418));for(;o;)wb(s,o),o=Se(o.nextSibling)}if(xb(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){tr=Se(s.nextSibling);break e}o--}else d!=="$"&&d!=="$!"&&d!=="$?"||o++}s=s.nextSibling}tr=null}}else tr=er?Se(s.stateNode.nextSibling):null;return!0}function bb(){for(var s=tr;s;)s=Se(s.nextSibling)}function xi(){tr=er=null,At=!1}function ff(s){Ir===null?Ir=[s]:Ir.push(s)}var MI=C.ReactCurrentBatchConfig;function Gl(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,N=""+s;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===N?o.ref:(o=function(A){var Y=v.refs;A===null?delete Y[N]:Y[N]=A},o._stringRef=N,o)}if(typeof s!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,s))}return s}function Iu(s,o){throw s=Object.prototype.toString.call(o),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":s))}function kb(s){var o=s._init;return o(s._payload)}function Nb(s){function o(ie,se){if(s){var ue=ie.deletions;ue===null?(ie.deletions=[se],ie.flags|=16):ue.push(se)}}function d(ie,se){if(!s)return null;for(;se!==null;)o(ie,se),se=se.sibling;return null}function g(ie,se){for(ie=new Map;se!==null;)se.key!==null?ie.set(se.key,se):ie.set(se.index,se),se=se.sibling;return ie}function v(ie,se){return ie=ba(ie,se),ie.index=0,ie.sibling=null,ie}function N(ie,se,ue){return ie.index=ue,s?(ue=ie.alternate,ue!==null?(ue=ue.index,ue<se?(ie.flags|=2,se):ue):(ie.flags|=2,se)):(ie.flags|=1048576,se)}function A(ie){return s&&ie.alternate===null&&(ie.flags|=2),ie}function Y(ie,se,ue,Ee){return se===null||se.tag!==6?(se=sp(ue,ie.mode,Ee),se.return=ie,se):(se=v(se,ue),se.return=ie,se)}function te(ie,se,ue,Ee){var ze=ue.type;return ze===$?xe(ie,se,ue.props.children,Ee,ue.key):se!==null&&(se.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===V&&kb(ze)===se.type)?(Ee=v(se,ue.props),Ee.ref=Gl(ie,se,ue),Ee.return=ie,Ee):(Ee=rd(ue.type,ue.key,ue.props,null,ie.mode,Ee),Ee.ref=Gl(ie,se,ue),Ee.return=ie,Ee)}function fe(ie,se,ue,Ee){return se===null||se.tag!==4||se.stateNode.containerInfo!==ue.containerInfo||se.stateNode.implementation!==ue.implementation?(se=ap(ue,ie.mode,Ee),se.return=ie,se):(se=v(se,ue.children||[]),se.return=ie,se)}function xe(ie,se,ue,Ee,ze){return se===null||se.tag!==7?(se=So(ue,ie.mode,Ee,ze),se.return=ie,se):(se=v(se,ue),se.return=ie,se)}function ke(ie,se,ue){if(typeof se=="string"&&se!==""||typeof se=="number")return se=sp(""+se,ie.mode,ue),se.return=ie,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case T:return ue=rd(se.type,se.key,se.props,null,ie.mode,ue),ue.ref=Gl(ie,null,se),ue.return=ie,ue;case R:return se=ap(se,ie.mode,ue),se.return=ie,se;case V:var Ee=se._init;return ke(ie,Ee(se._payload),ue)}if(it(se)||W(se))return se=So(se,ie.mode,ue,null),se.return=ie,se;Iu(ie,se)}return null}function ve(ie,se,ue,Ee){var ze=se!==null?se.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number")return ze!==null?null:Y(ie,se,""+ue,Ee);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case T:return ue.key===ze?te(ie,se,ue,Ee):null;case R:return ue.key===ze?fe(ie,se,ue,Ee):null;case V:return ze=ue._init,ve(ie,se,ze(ue._payload),Ee)}if(it(ue)||W(ue))return ze!==null?null:xe(ie,se,ue,Ee,null);Iu(ie,ue)}return null}function Oe(ie,se,ue,Ee,ze){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number")return ie=ie.get(ue)||null,Y(se,ie,""+Ee,ze);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case T:return ie=ie.get(Ee.key===null?ue:Ee.key)||null,te(se,ie,Ee,ze);case R:return ie=ie.get(Ee.key===null?ue:Ee.key)||null,fe(se,ie,Ee,ze);case V:var Ye=Ee._init;return Oe(ie,se,ue,Ye(Ee._payload),ze)}if(it(Ee)||W(Ee))return ie=ie.get(ue)||null,xe(se,ie,Ee,ze,null);Iu(se,Ee)}return null}function qe(ie,se,ue,Ee){for(var ze=null,Ye=null,Xe=se,nt=se=0,ln=null;Xe!==null&&nt<ue.length;nt++){Xe.index>nt?(ln=Xe,Xe=null):ln=Xe.sibling;var dt=ve(ie,Xe,ue[nt],Ee);if(dt===null){Xe===null&&(Xe=ln);break}s&&Xe&&dt.alternate===null&&o(ie,Xe),se=N(dt,se,nt),Ye===null?ze=dt:Ye.sibling=dt,Ye=dt,Xe=ln}if(nt===ue.length)return d(ie,Xe),At&&yo(ie,nt),ze;if(Xe===null){for(;nt<ue.length;nt++)Xe=ke(ie,ue[nt],Ee),Xe!==null&&(se=N(Xe,se,nt),Ye===null?ze=Xe:Ye.sibling=Xe,Ye=Xe);return At&&yo(ie,nt),ze}for(Xe=g(ie,Xe);nt<ue.length;nt++)ln=Oe(Xe,ie,nt,ue[nt],Ee),ln!==null&&(s&&ln.alternate!==null&&Xe.delete(ln.key===null?nt:ln.key),se=N(ln,se,nt),Ye===null?ze=ln:Ye.sibling=ln,Ye=ln);return s&&Xe.forEach(function(ka){return o(ie,ka)}),At&&yo(ie,nt),ze}function Be(ie,se,ue,Ee){var ze=W(ue);if(typeof ze!="function")throw Error(n(150));if(ue=ze.call(ue),ue==null)throw Error(n(151));for(var Ye=ze=null,Xe=se,nt=se=0,ln=null,dt=ue.next();Xe!==null&&!dt.done;nt++,dt=ue.next()){Xe.index>nt?(ln=Xe,Xe=null):ln=Xe.sibling;var ka=ve(ie,Xe,dt.value,Ee);if(ka===null){Xe===null&&(Xe=ln);break}s&&Xe&&ka.alternate===null&&o(ie,Xe),se=N(ka,se,nt),Ye===null?ze=ka:Ye.sibling=ka,Ye=ka,Xe=ln}if(dt.done)return d(ie,Xe),At&&yo(ie,nt),ze;if(Xe===null){for(;!dt.done;nt++,dt=ue.next())dt=ke(ie,dt.value,Ee),dt!==null&&(se=N(dt,se,nt),Ye===null?ze=dt:Ye.sibling=dt,Ye=dt);return At&&yo(ie,nt),ze}for(Xe=g(ie,Xe);!dt.done;nt++,dt=ue.next())dt=Oe(Xe,ie,nt,dt.value,Ee),dt!==null&&(s&&dt.alternate!==null&&Xe.delete(dt.key===null?nt:dt.key),se=N(dt,se,nt),Ye===null?ze=dt:Ye.sibling=dt,Ye=dt);return s&&Xe.forEach(function(d$){return o(ie,d$)}),At&&yo(ie,nt),ze}function qt(ie,se,ue,Ee){if(typeof ue=="object"&&ue!==null&&ue.type===$&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case T:e:{for(var ze=ue.key,Ye=se;Ye!==null;){if(Ye.key===ze){if(ze=ue.type,ze===$){if(Ye.tag===7){d(ie,Ye.sibling),se=v(Ye,ue.props.children),se.return=ie,ie=se;break e}}else if(Ye.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===V&&kb(ze)===Ye.type){d(ie,Ye.sibling),se=v(Ye,ue.props),se.ref=Gl(ie,Ye,ue),se.return=ie,ie=se;break e}d(ie,Ye);break}else o(ie,Ye);Ye=Ye.sibling}ue.type===$?(se=So(ue.props.children,ie.mode,Ee,ue.key),se.return=ie,ie=se):(Ee=rd(ue.type,ue.key,ue.props,null,ie.mode,Ee),Ee.ref=Gl(ie,se,ue),Ee.return=ie,ie=Ee)}return A(ie);case R:e:{for(Ye=ue.key;se!==null;){if(se.key===Ye)if(se.tag===4&&se.stateNode.containerInfo===ue.containerInfo&&se.stateNode.implementation===ue.implementation){d(ie,se.sibling),se=v(se,ue.children||[]),se.return=ie,ie=se;break e}else{d(ie,se);break}else o(ie,se);se=se.sibling}se=ap(ue,ie.mode,Ee),se.return=ie,ie=se}return A(ie);case V:return Ye=ue._init,qt(ie,se,Ye(ue._payload),Ee)}if(it(ue))return qe(ie,se,ue,Ee);if(W(ue))return Be(ie,se,ue,Ee);Iu(ie,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"?(ue=""+ue,se!==null&&se.tag===6?(d(ie,se.sibling),se=v(se,ue),se.return=ie,ie=se):(d(ie,se),se=sp(ue,ie.mode,Ee),se.return=ie,ie=se),A(ie)):d(ie,se)}return qt}var bi=Nb(!0),_b=Nb(!1),$u=Fn(null),Ou=null,ki=null,pf=null;function mf(){pf=ki=Ou=null}function gf(s){var o=$u.current;ft($u),s._currentValue=o}function yf(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 Ni(s,o){Ou=s,pf=ki=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&o)!==0&&(zn=!0),s.firstContext=null)}function dr(s){var o=s._currentValue;if(pf!==s)if(s={context:s,memoizedValue:o,next:null},ki===null){if(Ou===null)throw Error(n(308));ki=s,Ou.dependencies={lanes:0,firstContext:s}}else ki=ki.next=s;return o}var wo=null;function wf(s){wo===null?wo=[s]:wo.push(s)}function Sb(s,o,d,g){var v=o.interleaved;return v===null?(d.next=d,wf(o)):(d.next=v.next,v.next=d),o.interleaved=d,Rs(s,g)}function Rs(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 pa=!1;function vf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jb(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 Ms(s,o){return{eventTime:s,lane:o,tag:0,payload:null,callback:null,next:null}}function ma(s,o,d){var g=s.updateQueue;if(g===null)return null;if(g=g.shared,(ut&2)!==0){var v=g.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),g.pending=o,Rs(s,d)}return v=g.interleaved,v===null?(o.next=o,wf(g)):(o.next=v.next,v.next=o),g.interleaved=o,Rs(s,d)}function Pu(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,Ys(s,d)}}function Eb(s,o){var d=s.updateQueue,g=s.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var v=null,N=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};N===null?v=N=A:N=N.next=A,d=d.next}while(d!==null);N===null?v=N=o:N=N.next=o}else v=N=o;d={baseState:g.baseState,firstBaseUpdate:v,lastBaseUpdate:N,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 Lu(s,o,d,g){var v=s.updateQueue;pa=!1;var N=v.firstBaseUpdate,A=v.lastBaseUpdate,Y=v.shared.pending;if(Y!==null){v.shared.pending=null;var te=Y,fe=te.next;te.next=null,A===null?N=fe:A.next=fe,A=te;var xe=s.alternate;xe!==null&&(xe=xe.updateQueue,Y=xe.lastBaseUpdate,Y!==A&&(Y===null?xe.firstBaseUpdate=fe:Y.next=fe,xe.lastBaseUpdate=te))}if(N!==null){var ke=v.baseState;A=0,xe=fe=te=null,Y=N;do{var ve=Y.lane,Oe=Y.eventTime;if((g&ve)===ve){xe!==null&&(xe=xe.next={eventTime:Oe,lane:0,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null});e:{var qe=s,Be=Y;switch(ve=o,Oe=d,Be.tag){case 1:if(qe=Be.payload,typeof qe=="function"){ke=qe.call(Oe,ke,ve);break e}ke=qe;break e;case 3:qe.flags=qe.flags&-65537|128;case 0:if(qe=Be.payload,ve=typeof qe=="function"?qe.call(Oe,ke,ve):qe,ve==null)break e;ke=K({},ke,ve);break e;case 2:pa=!0}}Y.callback!==null&&Y.lane!==0&&(s.flags|=64,ve=v.effects,ve===null?v.effects=[Y]:ve.push(Y))}else Oe={eventTime:Oe,lane:ve,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},xe===null?(fe=xe=Oe,te=ke):xe=xe.next=Oe,A|=ve;if(Y=Y.next,Y===null){if(Y=v.shared.pending,Y===null)break;ve=Y,Y=ve.next,ve.next=null,v.lastBaseUpdate=ve,v.shared.pending=null}}while(!0);if(xe===null&&(te=ke),v.baseState=te,v.firstBaseUpdate=fe,v.lastBaseUpdate=xe,o=v.shared.interleaved,o!==null){v=o;do A|=v.lane,v=v.next;while(v!==o)}else N===null&&(v.shared.lanes=0);bo|=A,s.lanes=A,s.memoizedState=ke}}function Cb(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 Kl={},os=Fn(Kl),Yl=Fn(Kl),Xl=Fn(Kl);function vo(s){if(s===Kl)throw Error(n(174));return s}function xf(s,o){switch(bt(Xl,o),bt(Yl,s),bt(os,Kl),s=o.nodeType,s){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:tt(null,"");break;default:s=s===8?o.parentNode:o,o=s.namespaceURI||null,s=s.tagName,o=tt(o,s)}ft(os),bt(os,o)}function _i(){ft(os),ft(Yl),ft(Xl)}function Tb(s){vo(Xl.current);var o=vo(os.current),d=tt(o,s.type);o!==d&&(bt(Yl,s),bt(os,d))}function bf(s){Yl.current===s&&(ft(os),ft(Yl))}var It=Fn(0);function Du(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 kf=[];function Nf(){for(var s=0;s<kf.length;s++)kf[s]._workInProgressVersionPrimary=null;kf.length=0}var Fu=C.ReactCurrentDispatcher,_f=C.ReactCurrentBatchConfig,xo=0,$t=null,Qt=null,an=null,qu=!1,Zl=!1,Ql=0,II=0;function Nn(){throw Error(n(321))}function Sf(s,o){if(o===null)return!1;for(var d=0;d<o.length&&d<s.length;d++)if(!Ln(s[d],o[d]))return!1;return!0}function jf(s,o,d,g,v,N){if(xo=N,$t=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Fu.current=s===null||s.memoizedState===null?LI:DI,s=d(g,v),Zl){N=0;do{if(Zl=!1,Ql=0,25<=N)throw Error(n(301));N+=1,an=Qt=null,o.updateQueue=null,Fu.current=FI,s=d(g,v)}while(Zl)}if(Fu.current=Hu,o=Qt!==null&&Qt.next!==null,xo=0,an=Qt=$t=null,qu=!1,o)throw Error(n(300));return s}function Ef(){var s=Ql!==0;return Ql=0,s}function is(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return an===null?$t.memoizedState=an=s:an=an.next=s,an}function hr(){if(Qt===null){var s=$t.alternate;s=s!==null?s.memoizedState:null}else s=Qt.next;var o=an===null?$t.memoizedState:an.next;if(o!==null)an=o,Qt=s;else{if(s===null)throw Error(n(310));Qt=s,s={memoizedState:Qt.memoizedState,baseState:Qt.baseState,baseQueue:Qt.baseQueue,queue:Qt.queue,next:null},an===null?$t.memoizedState=an=s:an=an.next=s}return an}function Jl(s,o){return typeof o=="function"?o(s):o}function Cf(s){var o=hr(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var g=Qt,v=g.baseQueue,N=d.pending;if(N!==null){if(v!==null){var A=v.next;v.next=N.next,N.next=A}g.baseQueue=v=N,d.pending=null}if(v!==null){N=v.next,g=g.baseState;var Y=A=null,te=null,fe=N;do{var xe=fe.lane;if((xo&xe)===xe)te!==null&&(te=te.next={lane:0,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),g=fe.hasEagerState?fe.eagerState:s(g,fe.action);else{var ke={lane:xe,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null};te===null?(Y=te=ke,A=g):te=te.next=ke,$t.lanes|=xe,bo|=xe}fe=fe.next}while(fe!==null&&fe!==N);te===null?A=g:te.next=Y,Ln(g,o.memoizedState)||(zn=!0),o.memoizedState=g,o.baseState=A,o.baseQueue=te,d.lastRenderedState=g}if(s=d.interleaved,s!==null){v=s;do N=v.lane,$t.lanes|=N,bo|=N,v=v.next;while(v!==s)}else v===null&&(d.lanes=0);return[o.memoizedState,d.dispatch]}function Tf(s){var o=hr(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var g=d.dispatch,v=d.pending,N=o.memoizedState;if(v!==null){d.pending=null;var A=v=v.next;do N=s(N,A.action),A=A.next;while(A!==v);Ln(N,o.memoizedState)||(zn=!0),o.memoizedState=N,o.baseQueue===null&&(o.baseState=N),d.lastRenderedState=N}return[N,g]}function Ab(){}function Rb(s,o){var d=$t,g=hr(),v=o(),N=!Ln(g.memoizedState,v);if(N&&(g.memoizedState=v,zn=!0),g=g.queue,Af($b.bind(null,d,g,s),[s]),g.getSnapshot!==o||N||an!==null&&an.memoizedState.tag&1){if(d.flags|=2048,ec(9,Ib.bind(null,d,g,v,o),void 0,null),on===null)throw Error(n(349));(xo&30)!==0||Mb(d,o,v)}return v}function Mb(s,o,d){s.flags|=16384,s={getSnapshot:o,value:d},o=$t.updateQueue,o===null?(o={lastEffect:null,stores:null},$t.updateQueue=o,o.stores=[s]):(d=o.stores,d===null?o.stores=[s]:d.push(s))}function Ib(s,o,d,g){o.value=d,o.getSnapshot=g,Ob(o)&&Pb(s)}function $b(s,o,d){return d(function(){Ob(o)&&Pb(s)})}function Ob(s){var o=s.getSnapshot;s=s.value;try{var d=o();return!Ln(s,d)}catch{return!0}}function Pb(s){var o=Rs(s,1);o!==null&&Lr(o,s,1,-1)}function Lb(s){var o=is();return typeof s=="function"&&(s=s()),o.memoizedState=o.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Jl,lastRenderedState:s},o.queue=s,s=s.dispatch=PI.bind(null,$t,s),[o.memoizedState,s]}function ec(s,o,d,g){return s={tag:s,create:o,destroy:d,deps:g,next:null},o=$t.updateQueue,o===null?(o={lastEffect:null,stores:null},$t.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 Db(){return hr().memoizedState}function Bu(s,o,d,g){var v=is();$t.flags|=s,v.memoizedState=ec(1|o,d,void 0,g===void 0?null:g)}function zu(s,o,d,g){var v=hr();g=g===void 0?null:g;var N=void 0;if(Qt!==null){var A=Qt.memoizedState;if(N=A.destroy,g!==null&&Sf(g,A.deps)){v.memoizedState=ec(o,d,N,g);return}}$t.flags|=s,v.memoizedState=ec(1|o,d,N,g)}function Fb(s,o){return Bu(8390656,8,s,o)}function Af(s,o){return zu(2048,8,s,o)}function qb(s,o){return zu(4,2,s,o)}function Bb(s,o){return zu(4,4,s,o)}function zb(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 Hb(s,o,d){return d=d!=null?d.concat([s]):null,zu(4,4,zb.bind(null,o,s),d)}function Rf(){}function Wb(s,o){var d=hr();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&Sf(o,g[1])?g[0]:(d.memoizedState=[s,o],s)}function Ub(s,o){var d=hr();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&Sf(o,g[1])?g[0]:(s=s(),d.memoizedState=[s,o],s)}function Vb(s,o,d){return(xo&21)===0?(s.baseState&&(s.baseState=!1,zn=!0),s.memoizedState=d):(Ln(d,o)||(d=Gs(),$t.lanes|=d,bo|=d,s.baseState=!0),o)}function $I(s,o){var d=ht;ht=d!==0&&4>d?d:4,s(!0);var g=_f.transition;_f.transition={};try{s(!1),o()}finally{ht=d,_f.transition=g}}function Gb(){return hr().memoizedState}function OI(s,o,d){var g=va(s);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},Kb(s))Yb(o,d);else if(d=Sb(s,o,d,g),d!==null){var v=$n();Lr(d,s,g,v),Xb(d,o,g)}}function PI(s,o,d){var g=va(s),v={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(Kb(s))Yb(o,v);else{var N=s.alternate;if(s.lanes===0&&(N===null||N.lanes===0)&&(N=o.lastRenderedReducer,N!==null))try{var A=o.lastRenderedState,Y=N(A,d);if(v.hasEagerState=!0,v.eagerState=Y,Ln(Y,A)){var te=o.interleaved;te===null?(v.next=v,wf(o)):(v.next=te.next,te.next=v),o.interleaved=v;return}}catch{}finally{}d=Sb(s,o,v,g),d!==null&&(v=$n(),Lr(d,s,g,v),Xb(d,o,g))}}function Kb(s){var o=s.alternate;return s===$t||o!==null&&o===$t}function Yb(s,o){Zl=qu=!0;var d=s.pending;d===null?o.next=o:(o.next=d.next,d.next=o),s.pending=o}function Xb(s,o,d){if((d&4194240)!==0){var g=o.lanes;g&=s.pendingLanes,d|=g,o.lanes=d,Ys(s,d)}}var Hu={readContext:dr,useCallback:Nn,useContext:Nn,useEffect:Nn,useImperativeHandle:Nn,useInsertionEffect:Nn,useLayoutEffect:Nn,useMemo:Nn,useReducer:Nn,useRef:Nn,useState:Nn,useDebugValue:Nn,useDeferredValue:Nn,useTransition:Nn,useMutableSource:Nn,useSyncExternalStore:Nn,useId:Nn,unstable_isNewReconciler:!1},LI={readContext:dr,useCallback:function(s,o){return is().memoizedState=[s,o===void 0?null:o],s},useContext:dr,useEffect:Fb,useImperativeHandle:function(s,o,d){return d=d!=null?d.concat([s]):null,Bu(4194308,4,zb.bind(null,o,s),d)},useLayoutEffect:function(s,o){return Bu(4194308,4,s,o)},useInsertionEffect:function(s,o){return Bu(4,2,s,o)},useMemo:function(s,o){var d=is();return o=o===void 0?null:o,s=s(),d.memoizedState=[s,o],s},useReducer:function(s,o,d){var g=is();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=OI.bind(null,$t,s),[g.memoizedState,s]},useRef:function(s){var o=is();return s={current:s},o.memoizedState=s},useState:Lb,useDebugValue:Rf,useDeferredValue:function(s){return is().memoizedState=s},useTransition:function(){var s=Lb(!1),o=s[0];return s=$I.bind(null,s[1]),is().memoizedState=s,[o,s]},useMutableSource:function(){},useSyncExternalStore:function(s,o,d){var g=$t,v=is();if(At){if(d===void 0)throw Error(n(407));d=d()}else{if(d=o(),on===null)throw Error(n(349));(xo&30)!==0||Mb(g,o,d)}v.memoizedState=d;var N={value:d,getSnapshot:o};return v.queue=N,Fb($b.bind(null,g,N,s),[s]),g.flags|=2048,ec(9,Ib.bind(null,g,N,d,o),void 0,null),d},useId:function(){var s=is(),o=on.identifierPrefix;if(At){var d=As,g=Ts;d=(g&~(1<<32-xn(g)-1)).toString(32)+d,o=":"+o+"R"+d,d=Ql++,0<d&&(o+="H"+d.toString(32)),o+=":"}else d=II++,o=":"+o+"r"+d.toString(32)+":";return s.memoizedState=o},unstable_isNewReconciler:!1},DI={readContext:dr,useCallback:Wb,useContext:dr,useEffect:Af,useImperativeHandle:Hb,useInsertionEffect:qb,useLayoutEffect:Bb,useMemo:Ub,useReducer:Cf,useRef:Db,useState:function(){return Cf(Jl)},useDebugValue:Rf,useDeferredValue:function(s){var o=hr();return Vb(o,Qt.memoizedState,s)},useTransition:function(){var s=Cf(Jl)[0],o=hr().memoizedState;return[s,o]},useMutableSource:Ab,useSyncExternalStore:Rb,useId:Gb,unstable_isNewReconciler:!1},FI={readContext:dr,useCallback:Wb,useContext:dr,useEffect:Af,useImperativeHandle:Hb,useInsertionEffect:qb,useLayoutEffect:Bb,useMemo:Ub,useReducer:Tf,useRef:Db,useState:function(){return Tf(Jl)},useDebugValue:Rf,useDeferredValue:function(s){var o=hr();return Qt===null?o.memoizedState=s:Vb(o,Qt.memoizedState,s)},useTransition:function(){var s=Tf(Jl)[0],o=hr().memoizedState;return[s,o]},useMutableSource:Ab,useSyncExternalStore:Rb,useId:Gb,unstable_isNewReconciler:!1};function $r(s,o){if(s&&s.defaultProps){o=K({},o),s=s.defaultProps;for(var d in s)o[d]===void 0&&(o[d]=s[d]);return o}return o}function Mf(s,o,d,g){o=s.memoizedState,d=d(g,o),d=d==null?o:K({},o,d),s.memoizedState=d,s.lanes===0&&(s.updateQueue.baseState=d)}var Wu={isMounted:function(s){return(s=s._reactInternals)?ee(s)===s:!1},enqueueSetState:function(s,o,d){s=s._reactInternals;var g=$n(),v=va(s),N=Ms(g,v);N.payload=o,d!=null&&(N.callback=d),o=ma(s,N,v),o!==null&&(Lr(o,s,v,g),Pu(o,s,v))},enqueueReplaceState:function(s,o,d){s=s._reactInternals;var g=$n(),v=va(s),N=Ms(g,v);N.tag=1,N.payload=o,d!=null&&(N.callback=d),o=ma(s,N,v),o!==null&&(Lr(o,s,v,g),Pu(o,s,v))},enqueueForceUpdate:function(s,o){s=s._reactInternals;var d=$n(),g=va(s),v=Ms(d,g);v.tag=2,o!=null&&(v.callback=o),o=ma(s,v,g),o!==null&&(Lr(o,s,g,d),Pu(o,s,g))}};function Zb(s,o,d,g,v,N,A){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(g,N,A):o.prototype&&o.prototype.isPureReactComponent?!ro(d,g)||!ro(v,N):!0}function Qb(s,o,d){var g=!1,v=vt,N=o.contextType;return typeof N=="object"&&N!==null?N=dr(N):(v=Bn(o)?mo:Zt.current,g=o.contextTypes,N=(g=g!=null)?yi(s,v):vt),o=new o(d,N),s.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Wu,s.stateNode=o,o._reactInternals=s,g&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=v,s.__reactInternalMemoizedMaskedChildContext=N),o}function Jb(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&&Wu.enqueueReplaceState(o,o.state,null)}function If(s,o,d,g){var v=s.stateNode;v.props=d,v.state=s.memoizedState,v.refs={},vf(s);var N=o.contextType;typeof N=="object"&&N!==null?v.context=dr(N):(N=Bn(o)?mo:Zt.current,v.context=yi(s,N)),v.state=s.memoizedState,N=o.getDerivedStateFromProps,typeof N=="function"&&(Mf(s,o,N,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&&Wu.enqueueReplaceState(v,v.state,null),Lu(s,d,v,g),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308)}function Si(s,o){try{var d="",g=o;do d+=Z(g),g=g.return;while(g);var v=d}catch(N){v=`
|
|
39
|
+
Error generating stack: `+N.message+`
|
|
40
|
+
`+N.stack}return{value:s,source:o,stack:v,digest:null}}function $f(s,o,d){return{value:s,source:null,stack:d??null,digest:o??null}}function Of(s,o){try{console.error(o.value)}catch(d){setTimeout(function(){throw d})}}var qI=typeof WeakMap=="function"?WeakMap:Map;function ek(s,o,d){d=Ms(-1,d),d.tag=3,d.payload={element:null};var g=o.value;return d.callback=function(){Zu||(Zu=!0,Xf=g),Of(s,o)},d}function tk(s,o,d){d=Ms(-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(){Of(s,o)}}var N=s.stateNode;return N!==null&&typeof N.componentDidCatch=="function"&&(d.callback=function(){Of(s,o),typeof g!="function"&&(ya===null?ya=new Set([this]):ya.add(this));var A=o.stack;this.componentDidCatch(o.value,{componentStack:A!==null?A:""})}),d}function nk(s,o,d){var g=s.pingCache;if(g===null){g=s.pingCache=new qI;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=e$.bind(null,s,o,d),o.then(s,s))}function rk(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 sk(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=Ms(-1,1),o.tag=2,ma(d,o,1))),d.lanes|=1),s):(s.flags|=65536,s.lanes=v,s)}var BI=C.ReactCurrentOwner,zn=!1;function In(s,o,d,g){o.child=s===null?_b(o,null,d,g):bi(o,s.child,d,g)}function ak(s,o,d,g,v){d=d.render;var N=o.ref;return Ni(o,v),g=jf(s,o,d,g,N,v),d=Ef(),s!==null&&!zn?(o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~v,Is(s,o,v)):(At&&d&&cf(o),o.flags|=1,In(s,o,g,v),o.child)}function ok(s,o,d,g,v){if(s===null){var N=d.type;return typeof N=="function"&&!rp(N)&&N.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(o.tag=15,o.type=N,ik(s,o,N,g,v)):(s=rd(d.type,null,g,o,o.mode,v),s.ref=o.ref,s.return=o,o.child=s)}if(N=s.child,(s.lanes&v)===0){var A=N.memoizedProps;if(d=d.compare,d=d!==null?d:ro,d(A,g)&&s.ref===o.ref)return Is(s,o,v)}return o.flags|=1,s=ba(N,g),s.ref=o.ref,s.return=o,o.child=s}function ik(s,o,d,g,v){if(s!==null){var N=s.memoizedProps;if(ro(N,g)&&s.ref===o.ref)if(zn=!1,o.pendingProps=g=N,(s.lanes&v)!==0)(s.flags&131072)!==0&&(zn=!0);else return o.lanes=s.lanes,Is(s,o,v)}return Pf(s,o,d,g,v)}function lk(s,o,d){var g=o.pendingProps,v=g.children,N=s!==null?s.memoizedState:null;if(g.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},bt(Ei,nr),nr|=d;else{if((d&1073741824)===0)return s=N!==null?N.baseLanes|d:d,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:s,cachePool:null,transitions:null},o.updateQueue=null,bt(Ei,nr),nr|=s,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=N!==null?N.baseLanes:d,bt(Ei,nr),nr|=g}else N!==null?(g=N.baseLanes|d,o.memoizedState=null):g=d,bt(Ei,nr),nr|=g;return In(s,o,v,d),o.child}function ck(s,o){var d=o.ref;(s===null&&d!==null||s!==null&&s.ref!==d)&&(o.flags|=512,o.flags|=2097152)}function Pf(s,o,d,g,v){var N=Bn(d)?mo:Zt.current;return N=yi(o,N),Ni(o,v),d=jf(s,o,d,g,N,v),g=Ef(),s!==null&&!zn?(o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~v,Is(s,o,v)):(At&&g&&cf(o),o.flags|=1,In(s,o,d,v),o.child)}function uk(s,o,d,g,v){if(Bn(d)){var N=!0;Cu(o)}else N=!1;if(Ni(o,v),o.stateNode===null)Vu(s,o),Qb(o,d,g),If(o,d,g,v),g=!0;else if(s===null){var A=o.stateNode,Y=o.memoizedProps;A.props=Y;var te=A.context,fe=d.contextType;typeof fe=="object"&&fe!==null?fe=dr(fe):(fe=Bn(d)?mo:Zt.current,fe=yi(o,fe));var xe=d.getDerivedStateFromProps,ke=typeof xe=="function"||typeof A.getSnapshotBeforeUpdate=="function";ke||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(Y!==g||te!==fe)&&Jb(o,A,g,fe),pa=!1;var ve=o.memoizedState;A.state=ve,Lu(o,g,A,v),te=o.memoizedState,Y!==g||ve!==te||qn.current||pa?(typeof xe=="function"&&(Mf(o,d,xe,g),te=o.memoizedState),(Y=pa||Zb(o,d,Y,g,ve,te,fe))?(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=te),A.props=g,A.state=te,A.context=fe,g=Y):(typeof A.componentDidMount=="function"&&(o.flags|=4194308),g=!1)}else{A=o.stateNode,jb(s,o),Y=o.memoizedProps,fe=o.type===o.elementType?Y:$r(o.type,Y),A.props=fe,ke=o.pendingProps,ve=A.context,te=d.contextType,typeof te=="object"&&te!==null?te=dr(te):(te=Bn(d)?mo:Zt.current,te=yi(o,te));var Oe=d.getDerivedStateFromProps;(xe=typeof Oe=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(Y!==ke||ve!==te)&&Jb(o,A,g,te),pa=!1,ve=o.memoizedState,A.state=ve,Lu(o,g,A,v);var qe=o.memoizedState;Y!==ke||ve!==qe||qn.current||pa?(typeof Oe=="function"&&(Mf(o,d,Oe,g),qe=o.memoizedState),(fe=pa||Zb(o,d,fe,g,ve,qe,te)||!1)?(xe||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(g,qe,te),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(g,qe,te)),typeof A.componentDidUpdate=="function"&&(o.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof A.componentDidUpdate!="function"||Y===s.memoizedProps&&ve===s.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||Y===s.memoizedProps&&ve===s.memoizedState||(o.flags|=1024),o.memoizedProps=g,o.memoizedState=qe),A.props=g,A.state=qe,A.context=te,g=fe):(typeof A.componentDidUpdate!="function"||Y===s.memoizedProps&&ve===s.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||Y===s.memoizedProps&&ve===s.memoizedState||(o.flags|=1024),g=!1)}return Lf(s,o,d,g,N,v)}function Lf(s,o,d,g,v,N){ck(s,o);var A=(o.flags&128)!==0;if(!g&&!A)return v&&mb(o,d,!1),Is(s,o,N);g=o.stateNode,BI.current=o;var Y=A&&typeof d.getDerivedStateFromError!="function"?null:g.render();return o.flags|=1,s!==null&&A?(o.child=bi(o,s.child,null,N),o.child=bi(o,null,Y,N)):In(s,o,Y,N),o.memoizedState=g.state,v&&mb(o,d,!0),o.child}function dk(s){var o=s.stateNode;o.pendingContext?fb(s,o.pendingContext,o.pendingContext!==o.context):o.context&&fb(s,o.context,!1),xf(s,o.containerInfo)}function hk(s,o,d,g,v){return xi(),ff(v),o.flags|=256,In(s,o,d,g),o.child}var Df={dehydrated:null,treeContext:null,retryLane:0};function Ff(s){return{baseLanes:s,cachePool:null,transitions:null}}function fk(s,o,d){var g=o.pendingProps,v=It.current,N=!1,A=(o.flags&128)!==0,Y;if((Y=A)||(Y=s!==null&&s.memoizedState===null?!1:(v&2)!==0),Y?(N=!0,o.flags&=-129):(s===null||s.memoizedState!==null)&&(v|=1),bt(It,v&1),s===null)return hf(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,N?(g=o.mode,N=o.child,A={mode:"hidden",children:A},(g&1)===0&&N!==null?(N.childLanes=0,N.pendingProps=A):N=sd(A,g,0,null),s=So(s,g,d,null),N.return=o,s.return=o,N.sibling=s,o.child=N,o.child.memoizedState=Ff(d),o.memoizedState=Df,s):qf(o,A));if(v=s.memoizedState,v!==null&&(Y=v.dehydrated,Y!==null))return zI(s,o,A,g,Y,v,d);if(N){N=g.fallback,A=o.mode,v=s.child,Y=v.sibling;var te={mode:"hidden",children:g.children};return(A&1)===0&&o.child!==v?(g=o.child,g.childLanes=0,g.pendingProps=te,o.deletions=null):(g=ba(v,te),g.subtreeFlags=v.subtreeFlags&14680064),Y!==null?N=ba(Y,N):(N=So(N,A,d,null),N.flags|=2),N.return=o,g.return=o,g.sibling=N,o.child=g,g=N,N=o.child,A=s.child.memoizedState,A=A===null?Ff(d):{baseLanes:A.baseLanes|d,cachePool:null,transitions:A.transitions},N.memoizedState=A,N.childLanes=s.childLanes&~d,o.memoizedState=Df,g}return N=s.child,s=N.sibling,g=ba(N,{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 qf(s,o){return o=sd({mode:"visible",children:o},s.mode,0,null),o.return=s,s.child=o}function Uu(s,o,d,g){return g!==null&&ff(g),bi(o,s.child,null,d),s=qf(o,o.pendingProps.children),s.flags|=2,o.memoizedState=null,s}function zI(s,o,d,g,v,N,A){if(d)return o.flags&256?(o.flags&=-257,g=$f(Error(n(422))),Uu(s,o,A,g)):o.memoizedState!==null?(o.child=s.child,o.flags|=128,null):(N=g.fallback,v=o.mode,g=sd({mode:"visible",children:g.children},v,0,null),N=So(N,v,A,null),N.flags|=2,g.return=o,N.return=o,g.sibling=N,o.child=g,(o.mode&1)!==0&&bi(o,s.child,null,A),o.child.memoizedState=Ff(A),o.memoizedState=Df,N);if((o.mode&1)===0)return Uu(s,o,A,null);if(v.data==="$!"){if(g=v.nextSibling&&v.nextSibling.dataset,g)var Y=g.dgst;return g=Y,N=Error(n(419)),g=$f(N,g,void 0),Uu(s,o,A,g)}if(Y=(A&s.childLanes)!==0,zn||Y){if(g=on,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!==N.retryLane&&(N.retryLane=v,Rs(s,v),Lr(g,s,v,-1))}return np(),g=$f(Error(n(421))),Uu(s,o,A,g)}return v.data==="$?"?(o.flags|=128,o.child=s.child,o=t$.bind(null,s),v._reactRetry=o,null):(s=N.treeContext,tr=Se(v.nextSibling),er=o,At=!0,Ir=null,s!==null&&(cr[ur++]=Ts,cr[ur++]=As,cr[ur++]=go,Ts=s.id,As=s.overflow,go=o),o=qf(o,g.children),o.flags|=4096,o)}function pk(s,o,d){s.lanes|=o;var g=s.alternate;g!==null&&(g.lanes|=o),yf(s.return,o,d)}function Bf(s,o,d,g,v){var N=s.memoizedState;N===null?s.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:v}:(N.isBackwards=o,N.rendering=null,N.renderingStartTime=0,N.last=g,N.tail=d,N.tailMode=v)}function mk(s,o,d){var g=o.pendingProps,v=g.revealOrder,N=g.tail;if(In(s,o,g.children,d),g=It.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&&pk(s,d,o);else if(s.tag===19)pk(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(bt(It,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&&Du(s)===null&&(v=d),d=d.sibling;d=v,d===null?(v=o.child,o.child=null):(v=d.sibling,d.sibling=null),Bf(o,!1,v,d,N);break;case"backwards":for(d=null,v=o.child,o.child=null;v!==null;){if(s=v.alternate,s!==null&&Du(s)===null){o.child=v;break}s=v.sibling,v.sibling=d,d=v,v=s}Bf(o,!0,d,null,N);break;case"together":Bf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Vu(s,o){(o.mode&1)===0&&s!==null&&(s.alternate=null,o.alternate=null,o.flags|=2)}function Is(s,o,d){if(s!==null&&(o.dependencies=s.dependencies),bo|=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=ba(s,s.pendingProps),o.child=d,d.return=o;s.sibling!==null;)s=s.sibling,d=d.sibling=ba(s,s.pendingProps),d.return=o;d.sibling=null}return o.child}function HI(s,o,d){switch(o.tag){case 3:dk(o),xi();break;case 5:Tb(o);break;case 1:Bn(o.type)&&Cu(o);break;case 4:xf(o,o.stateNode.containerInfo);break;case 10:var g=o.type._context,v=o.memoizedProps.value;bt($u,g._currentValue),g._currentValue=v;break;case 13:if(g=o.memoizedState,g!==null)return g.dehydrated!==null?(bt(It,It.current&1),o.flags|=128,null):(d&o.child.childLanes)!==0?fk(s,o,d):(bt(It,It.current&1),s=Is(s,o,d),s!==null?s.sibling:null);bt(It,It.current&1);break;case 19:if(g=(d&o.childLanes)!==0,(s.flags&128)!==0){if(g)return mk(s,o,d);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),bt(It,It.current),g)break;return null;case 22:case 23:return o.lanes=0,lk(s,o,d)}return Is(s,o,d)}var gk,zf,yk,wk;gk=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}},zf=function(){},yk=function(s,o,d,g){var v=s.memoizedProps;if(v!==g){s=o.stateNode,vo(os.current);var N=null;switch(d){case"input":v=Te(s,v),g=Te(s,g),N=[];break;case"select":v=K({},v,{value:void 0}),g=K({},g,{value:void 0}),N=[];break;case"textarea":v=le(s,v),g=le(s,g),N=[];break;default:typeof v.onClick!="function"&&typeof g.onClick=="function"&&(s.onclick=ho)}Ot(d,g);var A;d=null;for(fe in v)if(!g.hasOwnProperty(fe)&&v.hasOwnProperty(fe)&&v[fe]!=null)if(fe==="style"){var Y=v[fe];for(A in Y)Y.hasOwnProperty(A)&&(d||(d={}),d[A]="")}else fe!=="dangerouslySetInnerHTML"&&fe!=="children"&&fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&fe!=="autoFocus"&&(a.hasOwnProperty(fe)?N||(N=[]):(N=N||[]).push(fe,null));for(fe in g){var te=g[fe];if(Y=v!=null?v[fe]:void 0,g.hasOwnProperty(fe)&&te!==Y&&(te!=null||Y!=null))if(fe==="style")if(Y){for(A in Y)!Y.hasOwnProperty(A)||te&&te.hasOwnProperty(A)||(d||(d={}),d[A]="");for(A in te)te.hasOwnProperty(A)&&Y[A]!==te[A]&&(d||(d={}),d[A]=te[A])}else d||(N||(N=[]),N.push(fe,d)),d=te;else fe==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,Y=Y?Y.__html:void 0,te!=null&&Y!==te&&(N=N||[]).push(fe,te)):fe==="children"?typeof te!="string"&&typeof te!="number"||(N=N||[]).push(fe,""+te):fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&(a.hasOwnProperty(fe)?(te!=null&&fe==="onScroll"&&Nt("scroll",s),N||Y===te||(N=[])):(N=N||[]).push(fe,te))}d&&(N=N||[]).push("style",d);var fe=N;(o.updateQueue=fe)&&(o.flags|=4)}},wk=function(s,o,d,g){d!==g&&(o.flags|=4)};function tc(s,o){if(!At)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 _n(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 WI(s,o,d){var g=o.pendingProps;switch(uf(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _n(o),null;case 1:return Bn(o.type)&&Eu(),_n(o),null;case 3:return g=o.stateNode,_i(),ft(qn),ft(Zt),Nf(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(s===null||s.child===null)&&(Mu(o)?o.flags|=4:s===null||s.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Ir!==null&&(Jf(Ir),Ir=null))),zf(s,o),_n(o),null;case 5:bf(o);var v=vo(Xl.current);if(d=o.type,s!==null&&o.stateNode!=null)yk(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 _n(o),null}if(s=vo(os.current),Mu(o)){g=o.stateNode,d=o.type;var N=o.memoizedProps;switch(g[rt]=o,g[Ke]=N,s=(o.mode&1)!==0,d){case"dialog":Nt("cancel",g),Nt("close",g);break;case"iframe":case"object":case"embed":Nt("load",g);break;case"video":case"audio":for(v=0;v<io.length;v++)Nt(io[v],g);break;case"source":Nt("error",g);break;case"img":case"image":case"link":Nt("error",g),Nt("load",g);break;case"details":Nt("toggle",g);break;case"input":je(g,N),Nt("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!N.multiple},Nt("invalid",g);break;case"textarea":be(g,N),Nt("invalid",g)}Ot(d,N),v=null;for(var A in N)if(N.hasOwnProperty(A)){var Y=N[A];A==="children"?typeof Y=="string"?g.textContent!==Y&&(N.suppressHydrationWarning!==!0&&hi(g.textContent,Y,s),v=["children",Y]):typeof Y=="number"&&g.textContent!==""+Y&&(N.suppressHydrationWarning!==!0&&hi(g.textContent,Y,s),v=["children",""+Y]):a.hasOwnProperty(A)&&Y!=null&&A==="onScroll"&&Nt("scroll",g)}switch(d){case"input":_e(g),Ne(g,N,!0);break;case"textarea":_e(g),Ze(g);break;case"select":case"option":break;default:typeof N.onClick=="function"&&(g.onclick=ho)}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=We(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[rt]=o,s[Ke]=g,gk(s,o,!1,!1),o.stateNode=s;e:{switch(A=Pt(d,g),d){case"dialog":Nt("cancel",s),Nt("close",s),v=g;break;case"iframe":case"object":case"embed":Nt("load",s),v=g;break;case"video":case"audio":for(v=0;v<io.length;v++)Nt(io[v],s);v=g;break;case"source":Nt("error",s),v=g;break;case"img":case"image":case"link":Nt("error",s),Nt("load",s),v=g;break;case"details":Nt("toggle",s),v=g;break;case"input":je(s,g),v=Te(s,g),Nt("invalid",s);break;case"option":v=g;break;case"select":s._wrapperState={wasMultiple:!!g.multiple},v=K({},g,{value:void 0}),Nt("invalid",s);break;case"textarea":be(s,g),v=le(s,g),Nt("invalid",s);break;default:v=g}Ot(d,v),Y=v;for(N in Y)if(Y.hasOwnProperty(N)){var te=Y[N];N==="style"?mt(s,te):N==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&Me(s,te)):N==="children"?typeof te=="string"?(d!=="textarea"||te!=="")&&Qe(s,te):typeof te=="number"&&Qe(s,""+te):N!=="suppressContentEditableWarning"&&N!=="suppressHydrationWarning"&&N!=="autoFocus"&&(a.hasOwnProperty(N)?te!=null&&N==="onScroll"&&Nt("scroll",s):te!=null&&E(s,N,te,A))}switch(d){case"input":_e(s),Ne(s,g,!1);break;case"textarea":_e(s),Ze(s);break;case"option":g.value!=null&&s.setAttribute("value",""+de(g.value));break;case"select":s.multiple=!!g.multiple,N=g.value,N!=null?ot(s,!!g.multiple,N,!1):g.defaultValue!=null&&ot(s,!!g.multiple,g.defaultValue,!0);break;default:typeof v.onClick=="function"&&(s.onclick=ho)}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 _n(o),null;case 6:if(s&&o.stateNode!=null)wk(s,o,s.memoizedProps,g);else{if(typeof g!="string"&&o.stateNode===null)throw Error(n(166));if(d=vo(Xl.current),vo(os.current),Mu(o)){if(g=o.stateNode,d=o.memoizedProps,g[rt]=o,(N=g.nodeValue!==d)&&(s=er,s!==null))switch(s.tag){case 3:hi(g.nodeValue,d,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&hi(g.nodeValue,d,(s.mode&1)!==0)}N&&(o.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[rt]=o,o.stateNode=g}return _n(o),null;case 13:if(ft(It),g=o.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(At&&tr!==null&&(o.mode&1)!==0&&(o.flags&128)===0)bb(),xi(),o.flags|=98560,N=!1;else if(N=Mu(o),g!==null&&g.dehydrated!==null){if(s===null){if(!N)throw Error(n(318));if(N=o.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(n(317));N[rt]=o}else xi(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;_n(o),N=!1}else Ir!==null&&(Jf(Ir),Ir=null),N=!0;if(!N)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||(It.current&1)!==0?Jt===0&&(Jt=3):np())),o.updateQueue!==null&&(o.flags|=4),_n(o),null);case 4:return _i(),zf(s,o),s===null&&as(o.stateNode.containerInfo),_n(o),null;case 10:return gf(o.type._context),_n(o),null;case 17:return Bn(o.type)&&Eu(),_n(o),null;case 19:if(ft(It),N=o.memoizedState,N===null)return _n(o),null;if(g=(o.flags&128)!==0,A=N.rendering,A===null)if(g)tc(N,!1);else{if(Jt!==0||s!==null&&(s.flags&128)!==0)for(s=o.child;s!==null;){if(A=Du(s),A!==null){for(o.flags|=128,tc(N,!1),g=A.updateQueue,g!==null&&(o.updateQueue=g,o.flags|=4),o.subtreeFlags=0,g=d,d=o.child;d!==null;)N=d,s=g,N.flags&=14680066,A=N.alternate,A===null?(N.childLanes=0,N.lanes=s,N.child=null,N.subtreeFlags=0,N.memoizedProps=null,N.memoizedState=null,N.updateQueue=null,N.dependencies=null,N.stateNode=null):(N.childLanes=A.childLanes,N.lanes=A.lanes,N.child=A.child,N.subtreeFlags=0,N.deletions=null,N.memoizedProps=A.memoizedProps,N.memoizedState=A.memoizedState,N.updateQueue=A.updateQueue,N.type=A.type,s=A.dependencies,N.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),d=d.sibling;return bt(It,It.current&1|2),o.child}s=s.sibling}N.tail!==null&&wt()>Ci&&(o.flags|=128,g=!0,tc(N,!1),o.lanes=4194304)}else{if(!g)if(s=Du(A),s!==null){if(o.flags|=128,g=!0,d=s.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),tc(N,!0),N.tail===null&&N.tailMode==="hidden"&&!A.alternate&&!At)return _n(o),null}else 2*wt()-N.renderingStartTime>Ci&&d!==1073741824&&(o.flags|=128,g=!0,tc(N,!1),o.lanes=4194304);N.isBackwards?(A.sibling=o.child,o.child=A):(d=N.last,d!==null?d.sibling=A:o.child=A,N.last=A)}return N.tail!==null?(o=N.tail,N.rendering=o,N.tail=o.sibling,N.renderingStartTime=wt(),o.sibling=null,d=It.current,bt(It,g?d&1|2:d&1),o):(_n(o),null);case 22:case 23:return tp(),g=o.memoizedState!==null,s!==null&&s.memoizedState!==null!==g&&(o.flags|=8192),g&&(o.mode&1)!==0?(nr&1073741824)!==0&&(_n(o),o.subtreeFlags&6&&(o.flags|=8192)):_n(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function UI(s,o){switch(uf(o),o.tag){case 1:return Bn(o.type)&&Eu(),s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 3:return _i(),ft(qn),ft(Zt),Nf(),s=o.flags,(s&65536)!==0&&(s&128)===0?(o.flags=s&-65537|128,o):null;case 5:return bf(o),null;case 13:if(ft(It),s=o.memoizedState,s!==null&&s.dehydrated!==null){if(o.alternate===null)throw Error(n(340));xi()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 19:return ft(It),null;case 4:return _i(),null;case 10:return gf(o.type._context),null;case 22:case 23:return tp(),null;case 24:return null;default:return null}}var Gu=!1,Sn=!1,VI=typeof WeakSet=="function"?WeakSet:Set,Fe=null;function ji(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 Hf(s,o,d){try{d()}catch(g){Lt(s,o,g)}}var vk=!1;function GI(s,o){if(fi=Qs,s=so(),zl(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,N=g.focusNode;g=g.focusOffset;try{d.nodeType,N.nodeType}catch{d=null;break e}var A=0,Y=-1,te=-1,fe=0,xe=0,ke=s,ve=null;t:for(;;){for(var Oe;ke!==d||v!==0&&ke.nodeType!==3||(Y=A+v),ke!==N||g!==0&&ke.nodeType!==3||(te=A+g),ke.nodeType===3&&(A+=ke.nodeValue.length),(Oe=ke.firstChild)!==null;)ve=ke,ke=Oe;for(;;){if(ke===s)break t;if(ve===d&&++fe===v&&(Y=A),ve===N&&++xe===g&&(te=A),(Oe=ke.nextSibling)!==null)break;ke=ve,ve=ke.parentNode}ke=Oe}d=Y===-1||te===-1?null:{start:Y,end:te}}else d=null}d=d||{start:0,end:0}}else d=null;for(pi={focusedElem:s,selectionRange:d},Qs=!1,Fe=o;Fe!==null;)if(o=Fe,s=o.child,(o.subtreeFlags&1028)!==0&&s!==null)s.return=o,Fe=s;else for(;Fe!==null;){o=Fe;try{var qe=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(qe!==null){var Be=qe.memoizedProps,qt=qe.memoizedState,ie=o.stateNode,se=ie.getSnapshotBeforeUpdate(o.elementType===o.type?Be:$r(o.type,Be),qt);ie.__reactInternalSnapshotBeforeUpdate=se}break;case 3:var ue=o.stateNode.containerInfo;ue.nodeType===1?ue.textContent="":ue.nodeType===9&&ue.documentElement&&ue.removeChild(ue.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,Fe=s;break}Fe=o.return}return qe=vk,vk=!1,qe}function nc(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 N=v.destroy;v.destroy=void 0,N!==void 0&&Hf(o,d,N)}v=v.next}while(v!==g)}}function Ku(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 Wf(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 xk(s){var o=s.alternate;o!==null&&(s.alternate=null,xk(o)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(o=s.stateNode,o!==null&&(delete o[rt],delete o[Ke],delete o[Ft],delete o[Ss],delete o[fo])),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 bk(s){return s.tag===5||s.tag===3||s.tag===4}function kk(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||bk(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 Uf(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=ho));else if(g!==4&&(s=s.child,s!==null))for(Uf(s,o,d),s=s.sibling;s!==null;)Uf(s,o,d),s=s.sibling}function Vf(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(Vf(s,o,d),s=s.sibling;s!==null;)Vf(s,o,d),s=s.sibling}var fn=null,Or=!1;function ga(s,o,d){for(d=d.child;d!==null;)Nk(s,o,d),d=d.sibling}function Nk(s,o,d){if(An&&typeof An.onCommitFiberUnmount=="function")try{An.onCommitFiberUnmount(Yr,d)}catch{}switch(d.tag){case 5:Sn||ji(d,o);case 6:var g=fn,v=Or;fn=null,ga(s,o,d),fn=g,Or=v,fn!==null&&(Or?(s=fn,d=d.stateNode,s.nodeType===8?s.parentNode.removeChild(d):s.removeChild(d)):fn.removeChild(d.stateNode));break;case 18:fn!==null&&(Or?(s=fn,d=d.stateNode,s.nodeType===8?ye(s.parentNode,d):s.nodeType===1&&ye(s,d),Jr(s)):ye(fn,d.stateNode));break;case 4:g=fn,v=Or,fn=d.stateNode.containerInfo,Or=!0,ga(s,o,d),fn=g,Or=v;break;case 0:case 11:case 14:case 15:if(!Sn&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){v=g=g.next;do{var N=v,A=N.destroy;N=N.tag,A!==void 0&&((N&2)!==0||(N&4)!==0)&&Hf(d,o,A),v=v.next}while(v!==g)}ga(s,o,d);break;case 1:if(!Sn&&(ji(d,o),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(Y){Lt(d,o,Y)}ga(s,o,d);break;case 21:ga(s,o,d);break;case 22:d.mode&1?(Sn=(g=Sn)||d.memoizedState!==null,ga(s,o,d),Sn=g):ga(s,o,d);break;default:ga(s,o,d)}}function _k(s){var o=s.updateQueue;if(o!==null){s.updateQueue=null;var d=s.stateNode;d===null&&(d=s.stateNode=new VI),o.forEach(function(g){var v=n$.bind(null,s,g);d.has(g)||(d.add(g),g.then(v,v))})}}function Pr(s,o){var d=o.deletions;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];try{var N=s,A=o,Y=A;e:for(;Y!==null;){switch(Y.tag){case 5:fn=Y.stateNode,Or=!1;break e;case 3:fn=Y.stateNode.containerInfo,Or=!0;break e;case 4:fn=Y.stateNode.containerInfo,Or=!0;break e}Y=Y.return}if(fn===null)throw Error(n(160));Nk(N,A,v),fn=null,Or=!1;var te=v.alternate;te!==null&&(te.return=null),v.return=null}catch(fe){Lt(v,o,fe)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Sk(o,s),o=o.sibling}function Sk(s,o){var d=s.alternate,g=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(Pr(o,s),ls(s),g&4){try{nc(3,s,s.return),Ku(3,s)}catch(Be){Lt(s,s.return,Be)}try{nc(5,s,s.return)}catch(Be){Lt(s,s.return,Be)}}break;case 1:Pr(o,s),ls(s),g&512&&d!==null&&ji(d,d.return);break;case 5:if(Pr(o,s),ls(s),g&512&&d!==null&&ji(d,d.return),s.flags&32){var v=s.stateNode;try{Qe(v,"")}catch(Be){Lt(s,s.return,Be)}}if(g&4&&(v=s.stateNode,v!=null)){var N=s.memoizedProps,A=d!==null?d.memoizedProps:N,Y=s.type,te=s.updateQueue;if(s.updateQueue=null,te!==null)try{Y==="input"&&N.type==="radio"&&N.name!=null&&et(v,N),Pt(Y,A);var fe=Pt(Y,N);for(A=0;A<te.length;A+=2){var xe=te[A],ke=te[A+1];xe==="style"?mt(v,ke):xe==="dangerouslySetInnerHTML"?Me(v,ke):xe==="children"?Qe(v,ke):E(v,xe,ke,fe)}switch(Y){case"input":Ce(v,N);break;case"textarea":Re(v,N);break;case"select":var ve=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!N.multiple;var Oe=N.value;Oe!=null?ot(v,!!N.multiple,Oe,!1):ve!==!!N.multiple&&(N.defaultValue!=null?ot(v,!!N.multiple,N.defaultValue,!0):ot(v,!!N.multiple,N.multiple?[]:"",!1))}v[Ke]=N}catch(Be){Lt(s,s.return,Be)}}break;case 6:if(Pr(o,s),ls(s),g&4){if(s.stateNode===null)throw Error(n(162));v=s.stateNode,N=s.memoizedProps;try{v.nodeValue=N}catch(Be){Lt(s,s.return,Be)}}break;case 3:if(Pr(o,s),ls(s),g&4&&d!==null&&d.memoizedState.isDehydrated)try{Jr(o.containerInfo)}catch(Be){Lt(s,s.return,Be)}break;case 4:Pr(o,s),ls(s);break;case 13:Pr(o,s),ls(s),v=s.child,v.flags&8192&&(N=v.memoizedState!==null,v.stateNode.isHidden=N,!N||v.alternate!==null&&v.alternate.memoizedState!==null||(Yf=wt())),g&4&&_k(s);break;case 22:if(xe=d!==null&&d.memoizedState!==null,s.mode&1?(Sn=(fe=Sn)||xe,Pr(o,s),Sn=fe):Pr(o,s),ls(s),g&8192){if(fe=s.memoizedState!==null,(s.stateNode.isHidden=fe)&&!xe&&(s.mode&1)!==0)for(Fe=s,xe=s.child;xe!==null;){for(ke=Fe=xe;Fe!==null;){switch(ve=Fe,Oe=ve.child,ve.tag){case 0:case 11:case 14:case 15:nc(4,ve,ve.return);break;case 1:ji(ve,ve.return);var qe=ve.stateNode;if(typeof qe.componentWillUnmount=="function"){g=ve,d=ve.return;try{o=g,qe.props=o.memoizedProps,qe.state=o.memoizedState,qe.componentWillUnmount()}catch(Be){Lt(g,d,Be)}}break;case 5:ji(ve,ve.return);break;case 22:if(ve.memoizedState!==null){Ck(ke);continue}}Oe!==null?(Oe.return=ve,Fe=Oe):Ck(ke)}xe=xe.sibling}e:for(xe=null,ke=s;;){if(ke.tag===5){if(xe===null){xe=ke;try{v=ke.stateNode,fe?(N=v.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none"):(Y=ke.stateNode,te=ke.memoizedProps.style,A=te!=null&&te.hasOwnProperty("display")?te.display:null,Y.style.display=gt("display",A))}catch(Be){Lt(s,s.return,Be)}}}else if(ke.tag===6){if(xe===null)try{ke.stateNode.nodeValue=fe?"":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;xe===ke&&(xe=null),ke=ke.return}xe===ke&&(xe=null),ke.sibling.return=ke.return,ke=ke.sibling}}break;case 19:Pr(o,s),ls(s),g&4&&_k(s);break;case 21:break;default:Pr(o,s),ls(s)}}function ls(s){var o=s.flags;if(o&2){try{e:{for(var d=s.return;d!==null;){if(bk(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&&(Qe(v,""),g.flags&=-33);var N=kk(s);Vf(s,N,v);break;case 3:case 4:var A=g.stateNode.containerInfo,Y=kk(s);Uf(s,Y,A);break;default:throw Error(n(161))}}catch(te){Lt(s,s.return,te)}s.flags&=-3}o&4096&&(s.flags&=-4097)}function KI(s,o,d){Fe=s,jk(s)}function jk(s,o,d){for(var g=(s.mode&1)!==0;Fe!==null;){var v=Fe,N=v.child;if(v.tag===22&&g){var A=v.memoizedState!==null||Gu;if(!A){var Y=v.alternate,te=Y!==null&&Y.memoizedState!==null||Sn;Y=Gu;var fe=Sn;if(Gu=A,(Sn=te)&&!fe)for(Fe=v;Fe!==null;)A=Fe,te=A.child,A.tag===22&&A.memoizedState!==null?Tk(v):te!==null?(te.return=A,Fe=te):Tk(v);for(;N!==null;)Fe=N,jk(N),N=N.sibling;Fe=v,Gu=Y,Sn=fe}Ek(s)}else(v.subtreeFlags&8772)!==0&&N!==null?(N.return=v,Fe=N):Ek(s)}}function Ek(s){for(;Fe!==null;){var o=Fe;if((o.flags&8772)!==0){var d=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Sn||Ku(5,o);break;case 1:var g=o.stateNode;if(o.flags&4&&!Sn)if(d===null)g.componentDidMount();else{var v=o.elementType===o.type?d.memoizedProps:$r(o.type,d.memoizedProps);g.componentDidUpdate(v,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var N=o.updateQueue;N!==null&&Cb(o,N,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}Cb(o,A,d)}break;case 5:var Y=o.stateNode;if(d===null&&o.flags&4){d=Y;var te=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":te.autoFocus&&d.focus();break;case"img":te.src&&(d.src=te.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var fe=o.alternate;if(fe!==null){var xe=fe.memoizedState;if(xe!==null){var ke=xe.dehydrated;ke!==null&&Jr(ke)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Sn||o.flags&512&&Wf(o)}catch(ve){Lt(o,o.return,ve)}}if(o===s){Fe=null;break}if(d=o.sibling,d!==null){d.return=o.return,Fe=d;break}Fe=o.return}}function Ck(s){for(;Fe!==null;){var o=Fe;if(o===s){Fe=null;break}var d=o.sibling;if(d!==null){d.return=o.return,Fe=d;break}Fe=o.return}}function Tk(s){for(;Fe!==null;){var o=Fe;try{switch(o.tag){case 0:case 11:case 15:var d=o.return;try{Ku(4,o)}catch(te){Lt(o,d,te)}break;case 1:var g=o.stateNode;if(typeof g.componentDidMount=="function"){var v=o.return;try{g.componentDidMount()}catch(te){Lt(o,v,te)}}var N=o.return;try{Wf(o)}catch(te){Lt(o,N,te)}break;case 5:var A=o.return;try{Wf(o)}catch(te){Lt(o,A,te)}}}catch(te){Lt(o,o.return,te)}if(o===s){Fe=null;break}var Y=o.sibling;if(Y!==null){Y.return=o.return,Fe=Y;break}Fe=o.return}}var YI=Math.ceil,Yu=C.ReactCurrentDispatcher,Gf=C.ReactCurrentOwner,fr=C.ReactCurrentBatchConfig,ut=0,on=null,Ut=null,pn=0,nr=0,Ei=Fn(0),Jt=0,rc=null,bo=0,Xu=0,Kf=0,sc=null,Hn=null,Yf=0,Ci=1/0,$s=null,Zu=!1,Xf=null,ya=null,Qu=!1,wa=null,Ju=0,ac=0,Zf=null,ed=-1,td=0;function $n(){return(ut&6)!==0?wt():ed!==-1?ed:ed=wt()}function va(s){return(s.mode&1)===0?1:(ut&2)!==0&&pn!==0?pn&-pn:MI.transition!==null?(td===0&&(td=Gs()),td):(s=ht,s!==0||(s=window.event,s=s===void 0?16:gs(s.type)),s)}function Lr(s,o,d,g){if(50<ac)throw ac=0,Zf=null,Error(n(185));Ks(s,d,g),((ut&2)===0||s!==on)&&(s===on&&((ut&2)===0&&(Xu|=d),Jt===4&&xa(s,pn)),Wn(s,g),d===1&&ut===0&&(o.mode&1)===0&&(Ci=wt()+500,Tu&&fa()))}function Wn(s,o){var d=s.callbackNode;Qh(s,o);var g=Ua(s,s===on?pn:0);if(g===0)d!==null&&St(d),s.callbackNode=null,s.callbackPriority=0;else if(o=g&-g,s.callbackPriority!==o){if(d!=null&&St(d),o===1)s.tag===0?RI(Rk.bind(null,s)):gb(Rk.bind(null,s)),ne(function(){(ut&6)===0&&fa()}),d=null;else{switch(Ko(g)){case 1:d=ms;break;case 4:d=qa;break;case 16:d=Vs;break;case 536870912:d=Uo;break;default:d=Vs}d=Fk(d,Ak.bind(null,s))}s.callbackPriority=o,s.callbackNode=d}}function Ak(s,o){if(ed=-1,td=0,(ut&6)!==0)throw Error(n(327));var d=s.callbackNode;if(Ti()&&s.callbackNode!==d)return null;var g=Ua(s,s===on?pn:0);if(g===0)return null;if((g&30)!==0||(g&s.expiredLanes)!==0||o)o=nd(s,g);else{o=g;var v=ut;ut|=2;var N=Ik();(on!==s||pn!==o)&&($s=null,Ci=wt()+500,No(s,o));do try{QI();break}catch(Y){Mk(s,Y)}while(!0);mf(),Yu.current=N,ut=v,Ut!==null?o=0:(on=null,pn=0,o=Jt)}if(o!==0){if(o===2&&(v=Go(s),v!==0&&(g=v,o=Qf(s,v))),o===1)throw d=rc,No(s,0),xa(s,g),Wn(s,wt()),d;if(o===6)xa(s,g);else{if(v=s.current.alternate,(g&30)===0&&!XI(v)&&(o=nd(s,g),o===2&&(N=Go(s),N!==0&&(g=N,o=Qf(s,N))),o===1))throw d=rc,No(s,0),xa(s,g),Wn(s,wt()),d;switch(s.finishedWork=v,s.finishedLanes=g,o){case 0:case 1:throw Error(n(345));case 2:_o(s,Hn,$s);break;case 3:if(xa(s,g),(g&130023424)===g&&(o=Yf+500-wt(),10<o)){if(Ua(s,0)!==0)break;if(v=s.suspendedLanes,(v&g)!==g){$n(),s.pingedLanes|=s.suspendedLanes&v;break}s.timeoutHandle=gi(_o.bind(null,s,Hn,$s),o);break}_o(s,Hn,$s);break;case 4:if(xa(s,g),(g&4194240)===g)break;for(o=s.eventTimes,v=-1;0<g;){var A=31-xn(g);N=1<<A,A=o[A],A>v&&(v=A),g&=~N}if(g=v,g=wt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*YI(g/1960))-g,10<g){s.timeoutHandle=gi(_o.bind(null,s,Hn,$s),g);break}_o(s,Hn,$s);break;case 5:_o(s,Hn,$s);break;default:throw Error(n(329))}}}return Wn(s,wt()),s.callbackNode===d?Ak.bind(null,s):null}function Qf(s,o){var d=sc;return s.current.memoizedState.isDehydrated&&(No(s,o).flags|=256),s=nd(s,o),s!==2&&(o=Hn,Hn=d,o!==null&&Jf(o)),s}function Jf(s){Hn===null?Hn=s:Hn.push.apply(Hn,s)}function XI(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],N=v.getSnapshot;v=v.value;try{if(!Ln(N(),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 xa(s,o){for(o&=~Kf,o&=~Xu,s.suspendedLanes|=o,s.pingedLanes&=~o,s=s.expirationTimes;0<o;){var d=31-xn(o),g=1<<d;s[d]=-1,o&=~g}}function Rk(s){if((ut&6)!==0)throw Error(n(327));Ti();var o=Ua(s,0);if((o&1)===0)return Wn(s,wt()),null;var d=nd(s,o);if(s.tag!==0&&d===2){var g=Go(s);g!==0&&(o=g,d=Qf(s,g))}if(d===1)throw d=rc,No(s,0),xa(s,o),Wn(s,wt()),d;if(d===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=o,_o(s,Hn,$s),Wn(s,wt()),null}function ep(s,o){var d=ut;ut|=1;try{return s(o)}finally{ut=d,ut===0&&(Ci=wt()+500,Tu&&fa())}}function ko(s){wa!==null&&wa.tag===0&&(ut&6)===0&&Ti();var o=ut;ut|=1;var d=fr.transition,g=ht;try{if(fr.transition=null,ht=1,s)return s()}finally{ht=g,fr.transition=d,ut=o,(ut&6)===0&&fa()}}function tp(){nr=Ei.current,ft(Ei)}function No(s,o){s.finishedWork=null,s.finishedLanes=0;var d=s.timeoutHandle;if(d!==-1&&(s.timeoutHandle=-1,L(d)),Ut!==null)for(d=Ut.return;d!==null;){var g=d;switch(uf(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&Eu();break;case 3:_i(),ft(qn),ft(Zt),Nf();break;case 5:bf(g);break;case 4:_i();break;case 13:ft(It);break;case 19:ft(It);break;case 10:gf(g.type._context);break;case 22:case 23:tp()}d=d.return}if(on=s,Ut=s=ba(s.current,null),pn=nr=o,Jt=0,rc=null,Kf=Xu=bo=0,Hn=sc=null,wo!==null){for(o=0;o<wo.length;o++)if(d=wo[o],g=d.interleaved,g!==null){d.interleaved=null;var v=g.next,N=d.pending;if(N!==null){var A=N.next;N.next=v,g.next=A}d.pending=g}wo=null}return s}function Mk(s,o){do{var d=Ut;try{if(mf(),Fu.current=Hu,qu){for(var g=$t.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}qu=!1}if(xo=0,an=Qt=$t=null,Zl=!1,Ql=0,Gf.current=null,d===null||d.return===null){Jt=1,rc=o,Ut=null;break}e:{var N=s,A=d.return,Y=d,te=o;if(o=pn,Y.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var fe=te,xe=Y,ke=xe.tag;if((xe.mode&1)===0&&(ke===0||ke===11||ke===15)){var ve=xe.alternate;ve?(xe.updateQueue=ve.updateQueue,xe.memoizedState=ve.memoizedState,xe.lanes=ve.lanes):(xe.updateQueue=null,xe.memoizedState=null)}var Oe=rk(A);if(Oe!==null){Oe.flags&=-257,sk(Oe,A,Y,N,o),Oe.mode&1&&nk(N,fe,o),o=Oe,te=fe;var qe=o.updateQueue;if(qe===null){var Be=new Set;Be.add(te),o.updateQueue=Be}else qe.add(te);break e}else{if((o&1)===0){nk(N,fe,o),np();break e}te=Error(n(426))}}else if(At&&Y.mode&1){var qt=rk(A);if(qt!==null){(qt.flags&65536)===0&&(qt.flags|=256),sk(qt,A,Y,N,o),ff(Si(te,Y));break e}}N=te=Si(te,Y),Jt!==4&&(Jt=2),sc===null?sc=[N]:sc.push(N),N=A;do{switch(N.tag){case 3:N.flags|=65536,o&=-o,N.lanes|=o;var ie=ek(N,te,o);Eb(N,ie);break e;case 1:Y=te;var se=N.type,ue=N.stateNode;if((N.flags&128)===0&&(typeof se.getDerivedStateFromError=="function"||ue!==null&&typeof ue.componentDidCatch=="function"&&(ya===null||!ya.has(ue)))){N.flags|=65536,o&=-o,N.lanes|=o;var Ee=tk(N,Y,o);Eb(N,Ee);break e}}N=N.return}while(N!==null)}Ok(d)}catch(ze){o=ze,Ut===d&&d!==null&&(Ut=d=d.return);continue}break}while(!0)}function Ik(){var s=Yu.current;return Yu.current=Hu,s===null?Hu:s}function np(){(Jt===0||Jt===3||Jt===2)&&(Jt=4),on===null||(bo&268435455)===0&&(Xu&268435455)===0||xa(on,pn)}function nd(s,o){var d=ut;ut|=2;var g=Ik();(on!==s||pn!==o)&&($s=null,No(s,o));do try{ZI();break}catch(v){Mk(s,v)}while(!0);if(mf(),ut=d,Yu.current=g,Ut!==null)throw Error(n(261));return on=null,pn=0,Jt}function ZI(){for(;Ut!==null;)$k(Ut)}function QI(){for(;Ut!==null&&!Sr();)$k(Ut)}function $k(s){var o=Dk(s.alternate,s,nr);s.memoizedProps=s.pendingProps,o===null?Ok(s):Ut=o,Gf.current=null}function Ok(s){var o=s;do{var d=o.alternate;if(s=o.return,(o.flags&32768)===0){if(d=WI(d,o,nr),d!==null){Ut=d;return}}else{if(d=UI(d,o),d!==null){d.flags&=32767,Ut=d;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Jt=6,Ut=null;return}}if(o=o.sibling,o!==null){Ut=o;return}Ut=o=s}while(o!==null);Jt===0&&(Jt=5)}function _o(s,o,d){var g=ht,v=fr.transition;try{fr.transition=null,ht=1,JI(s,o,d,g)}finally{fr.transition=v,ht=g}return null}function JI(s,o,d,g){do Ti();while(wa!==null);if((ut&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 N=d.lanes|d.childLanes;if(Xn(s,N),s===on&&(Ut=on=null,pn=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Qu||(Qu=!0,Fk(Vs,function(){return Ti(),null})),N=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||N){N=fr.transition,fr.transition=null;var A=ht;ht=1;var Y=ut;ut|=4,Gf.current=null,GI(s,d),Sk(d,s),Hl(pi),Qs=!!fi,pi=fi=null,s.current=d,KI(d),xt(),ut=Y,ht=A,fr.transition=N}else s.current=d;if(Qu&&(Qu=!1,wa=s,Ju=v),N=s.pendingLanes,N===0&&(ya=null),za(d.stateNode),Wn(s,wt()),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(Zu)throw Zu=!1,s=Xf,Xf=null,s;return(Ju&1)!==0&&s.tag!==0&&Ti(),N=s.pendingLanes,(N&1)!==0?s===Zf?ac++:(ac=0,Zf=s):ac=0,fa(),null}function Ti(){if(wa!==null){var s=Ko(Ju),o=fr.transition,d=ht;try{if(fr.transition=null,ht=16>s?16:s,wa===null)var g=!1;else{if(s=wa,wa=null,Ju=0,(ut&6)!==0)throw Error(n(331));var v=ut;for(ut|=4,Fe=s.current;Fe!==null;){var N=Fe,A=N.child;if((Fe.flags&16)!==0){var Y=N.deletions;if(Y!==null){for(var te=0;te<Y.length;te++){var fe=Y[te];for(Fe=fe;Fe!==null;){var xe=Fe;switch(xe.tag){case 0:case 11:case 15:nc(8,xe,N)}var ke=xe.child;if(ke!==null)ke.return=xe,Fe=ke;else for(;Fe!==null;){xe=Fe;var ve=xe.sibling,Oe=xe.return;if(xk(xe),xe===fe){Fe=null;break}if(ve!==null){ve.return=Oe,Fe=ve;break}Fe=Oe}}}var qe=N.alternate;if(qe!==null){var Be=qe.child;if(Be!==null){qe.child=null;do{var qt=Be.sibling;Be.sibling=null,Be=qt}while(Be!==null)}}Fe=N}}if((N.subtreeFlags&2064)!==0&&A!==null)A.return=N,Fe=A;else e:for(;Fe!==null;){if(N=Fe,(N.flags&2048)!==0)switch(N.tag){case 0:case 11:case 15:nc(9,N,N.return)}var ie=N.sibling;if(ie!==null){ie.return=N.return,Fe=ie;break e}Fe=N.return}}var se=s.current;for(Fe=se;Fe!==null;){A=Fe;var ue=A.child;if((A.subtreeFlags&2064)!==0&&ue!==null)ue.return=A,Fe=ue;else e:for(A=se;Fe!==null;){if(Y=Fe,(Y.flags&2048)!==0)try{switch(Y.tag){case 0:case 11:case 15:Ku(9,Y)}}catch(ze){Lt(Y,Y.return,ze)}if(Y===A){Fe=null;break e}var Ee=Y.sibling;if(Ee!==null){Ee.return=Y.return,Fe=Ee;break e}Fe=Y.return}}if(ut=v,fa(),An&&typeof An.onPostCommitFiberRoot=="function")try{An.onPostCommitFiberRoot(Yr,s)}catch{}g=!0}return g}finally{ht=d,fr.transition=o}}return!1}function Pk(s,o,d){o=Si(d,o),o=ek(s,o,1),s=ma(s,o,1),o=$n(),s!==null&&(Ks(s,1,o),Wn(s,o))}function Lt(s,o,d){if(s.tag===3)Pk(s,s,d);else for(;o!==null;){if(o.tag===3){Pk(o,s,d);break}else if(o.tag===1){var g=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(ya===null||!ya.has(g))){s=Si(d,s),s=tk(o,s,1),o=ma(o,s,1),s=$n(),o!==null&&(Ks(o,1,s),Wn(o,s));break}}o=o.return}}function e$(s,o,d){var g=s.pingCache;g!==null&&g.delete(o),o=$n(),s.pingedLanes|=s.suspendedLanes&d,on===s&&(pn&d)===d&&(Jt===4||Jt===3&&(pn&130023424)===pn&&500>wt()-Yf?No(s,0):Kf|=d),Wn(s,o)}function Lk(s,o){o===0&&((s.mode&1)===0?o=1:(o=Xr,Xr<<=1,(Xr&130023424)===0&&(Xr=4194304)));var d=$n();s=Rs(s,o),s!==null&&(Ks(s,o,d),Wn(s,d))}function t$(s){var o=s.memoizedState,d=0;o!==null&&(d=o.retryLane),Lk(s,d)}function n$(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),Lk(s,d)}var Dk;Dk=function(s,o,d){if(s!==null)if(s.memoizedProps!==o.pendingProps||qn.current)zn=!0;else{if((s.lanes&d)===0&&(o.flags&128)===0)return zn=!1,HI(s,o,d);zn=(s.flags&131072)!==0}else zn=!1,At&&(o.flags&1048576)!==0&&yb(o,Ru,o.index);switch(o.lanes=0,o.tag){case 2:var g=o.type;Vu(s,o),s=o.pendingProps;var v=yi(o,Zt.current);Ni(o,d),v=jf(null,o,g,s,v,d);var N=Ef();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,Bn(g)?(N=!0,Cu(o)):N=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,vf(o),v.updater=Wu,o.stateNode=v,v._reactInternals=o,If(o,g,s,d),o=Lf(null,o,g,!0,N,d)):(o.tag=0,At&&N&&cf(o),In(null,o,v,d),o=o.child),o;case 16:g=o.elementType;e:{switch(Vu(s,o),s=o.pendingProps,v=g._init,g=v(g._payload),o.type=g,v=o.tag=s$(g),s=$r(g,s),v){case 0:o=Pf(null,o,g,s,d);break e;case 1:o=uk(null,o,g,s,d);break e;case 11:o=ak(null,o,g,s,d);break e;case 14:o=ok(null,o,g,$r(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:$r(g,v),Pf(s,o,g,v,d);case 1:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:$r(g,v),uk(s,o,g,v,d);case 3:e:{if(dk(o),s===null)throw Error(n(387));g=o.pendingProps,N=o.memoizedState,v=N.element,jb(s,o),Lu(o,g,null,d);var A=o.memoizedState;if(g=A.element,N.isDehydrated)if(N={element:g,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},o.updateQueue.baseState=N,o.memoizedState=N,o.flags&256){v=Si(Error(n(423)),o),o=hk(s,o,g,d,v);break e}else if(g!==v){v=Si(Error(n(424)),o),o=hk(s,o,g,d,v);break e}else for(tr=Se(o.stateNode.containerInfo.firstChild),er=o,At=!0,Ir=null,d=_b(o,null,g,d),o.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(xi(),g===v){o=Is(s,o,d);break e}In(s,o,g,d)}o=o.child}return o;case 5:return Tb(o),s===null&&hf(o),g=o.type,v=o.pendingProps,N=s!==null?s.memoizedProps:null,A=v.children,mi(g,v)?A=null:N!==null&&mi(g,N)&&(o.flags|=32),ck(s,o),In(s,o,A,d),o.child;case 6:return s===null&&hf(o),null;case 13:return fk(s,o,d);case 4:return xf(o,o.stateNode.containerInfo),g=o.pendingProps,s===null?o.child=bi(o,null,g,d):In(s,o,g,d),o.child;case 11:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:$r(g,v),ak(s,o,g,v,d);case 7:return In(s,o,o.pendingProps,d),o.child;case 8:return In(s,o,o.pendingProps.children,d),o.child;case 12:return In(s,o,o.pendingProps.children,d),o.child;case 10:e:{if(g=o.type._context,v=o.pendingProps,N=o.memoizedProps,A=v.value,bt($u,g._currentValue),g._currentValue=A,N!==null)if(Ln(N.value,A)){if(N.children===v.children&&!qn.current){o=Is(s,o,d);break e}}else for(N=o.child,N!==null&&(N.return=o);N!==null;){var Y=N.dependencies;if(Y!==null){A=N.child;for(var te=Y.firstContext;te!==null;){if(te.context===g){if(N.tag===1){te=Ms(-1,d&-d),te.tag=2;var fe=N.updateQueue;if(fe!==null){fe=fe.shared;var xe=fe.pending;xe===null?te.next=te:(te.next=xe.next,xe.next=te),fe.pending=te}}N.lanes|=d,te=N.alternate,te!==null&&(te.lanes|=d),yf(N.return,d,o),Y.lanes|=d;break}te=te.next}}else if(N.tag===10)A=N.type===o.type?null:N.child;else if(N.tag===18){if(A=N.return,A===null)throw Error(n(341));A.lanes|=d,Y=A.alternate,Y!==null&&(Y.lanes|=d),yf(A,d,o),A=N.sibling}else A=N.child;if(A!==null)A.return=N;else for(A=N;A!==null;){if(A===o){A=null;break}if(N=A.sibling,N!==null){N.return=A.return,A=N;break}A=A.return}N=A}In(s,o,v.children,d),o=o.child}return o;case 9:return v=o.type,g=o.pendingProps.children,Ni(o,d),v=dr(v),g=g(v),o.flags|=1,In(s,o,g,d),o.child;case 14:return g=o.type,v=$r(g,o.pendingProps),v=$r(g.type,v),ok(s,o,g,v,d);case 15:return ik(s,o,o.type,o.pendingProps,d);case 17:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:$r(g,v),Vu(s,o),o.tag=1,Bn(g)?(s=!0,Cu(o)):s=!1,Ni(o,d),Qb(o,g,v),If(o,g,v,d),Lf(null,o,g,!0,s,d);case 19:return mk(s,o,d);case 22:return lk(s,o,d)}throw Error(n(156,o.tag))};function Fk(s,o){return yt(s,o)}function r$(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 pr(s,o,d,g){return new r$(s,o,d,g)}function rp(s){return s=s.prototype,!(!s||!s.isReactComponent)}function s$(s){if(typeof s=="function")return rp(s)?1:0;if(s!=null){if(s=s.$$typeof,s===Q)return 11;if(s===X)return 14}return 2}function ba(s,o){var d=s.alternate;return d===null?(d=pr(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 rd(s,o,d,g,v,N){var A=2;if(g=s,typeof s=="function")rp(s)&&(A=1);else if(typeof s=="string")A=5;else e:switch(s){case $:return So(d.children,v,N,o);case H:A=8,v|=8;break;case B:return s=pr(12,d,o,v|2),s.elementType=B,s.lanes=N,s;case J:return s=pr(13,d,o,v),s.elementType=J,s.lanes=N,s;case M:return s=pr(19,d,o,v),s.elementType=M,s.lanes=N,s;case I:return sd(d,v,N,o);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case P:A=10;break e;case G:A=9;break e;case Q:A=11;break e;case X:A=14;break e;case V:A=16,g=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return o=pr(A,d,o,v),o.elementType=s,o.type=g,o.lanes=N,o}function So(s,o,d,g){return s=pr(7,s,g,o),s.lanes=d,s}function sd(s,o,d,g){return s=pr(22,s,g,o),s.elementType=I,s.lanes=d,s.stateNode={isHidden:!1},s}function sp(s,o,d){return s=pr(6,s,null,o),s.lanes=d,s}function ap(s,o,d){return o=pr(4,s.children!==null?s.children:[],s.key,o),o.lanes=d,o.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},o}function a$(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=gl(0),this.expirationTimes=gl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gl(0),this.identifierPrefix=g,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function op(s,o,d,g,v,N,A,Y,te){return s=new a$(s,o,d,Y,te),o===1?(o=1,N===!0&&(o|=8)):o=0,N=pr(3,null,null,o),s.current=N,N.stateNode=s,N.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},vf(N),s}function o$(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 qk(s){if(!s)return vt;s=s._reactInternals;e:{if(ee(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(Bn(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(Bn(d))return pb(s,d,o)}return o}function Bk(s,o,d,g,v,N,A,Y,te){return s=op(d,g,!0,s,v,N,A,Y,te),s.context=qk(null),d=s.current,g=$n(),v=va(d),N=Ms(g,v),N.callback=o??null,ma(d,N,v),s.current.lanes=v,Ks(s,v,g),Wn(s,g),s}function ad(s,o,d,g){var v=o.current,N=$n(),A=va(v);return d=qk(d),o.context===null?o.context=d:o.pendingContext=d,o=Ms(N,A),o.payload={element:s},g=g===void 0?null:g,g!==null&&(o.callback=g),s=ma(v,o,A),s!==null&&(Lr(s,v,A,N),Pu(s,v,A)),A}function od(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 zk(s,o){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var d=s.retryLane;s.retryLane=d!==0&&d<o?d:o}}function ip(s,o){zk(s,o),(s=s.alternate)&&zk(s,o)}function i$(){return null}var Hk=typeof reportError=="function"?reportError:function(s){console.error(s)};function lp(s){this._internalRoot=s}id.prototype.render=lp.prototype.render=function(s){var o=this._internalRoot;if(o===null)throw Error(n(409));ad(s,o,null,null)},id.prototype.unmount=lp.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var o=s.containerInfo;ko(function(){ad(null,s,null,null)}),o[jt]=null}};function id(s){this._internalRoot=s}id.prototype.unstable_scheduleHydration=function(s){if(s){var o=Va();s={blockedOn:null,target:s,priority:o};for(var d=0;d<Rn.length&&o!==0&&o<Rn[d].priority;d++);Rn.splice(d,0,s),d===0&&kl(s)}};function cp(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function ld(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function Wk(){}function l$(s,o,d,g,v){if(v){if(typeof g=="function"){var N=g;g=function(){var fe=od(A);N.call(fe)}}var A=Bk(o,g,s,0,null,!1,!1,"",Wk);return s._reactRootContainer=A,s[jt]=A.current,as(s.nodeType===8?s.parentNode:s),ko(),A}for(;v=s.lastChild;)s.removeChild(v);if(typeof g=="function"){var Y=g;g=function(){var fe=od(te);Y.call(fe)}}var te=op(s,0,!1,null,null,!1,!1,"",Wk);return s._reactRootContainer=te,s[jt]=te.current,as(s.nodeType===8?s.parentNode:s),ko(function(){ad(o,te,d,g)}),te}function cd(s,o,d,g,v){var N=d._reactRootContainer;if(N){var A=N;if(typeof v=="function"){var Y=v;v=function(){var te=od(A);Y.call(te)}}ad(o,A,s,v)}else A=l$(d,o,s,v,g);return od(A)}Ht=function(s){switch(s.tag){case 3:var o=s.stateNode;if(o.current.memoizedState.isDehydrated){var d=Wa(o.pendingLanes);d!==0&&(Ys(o,d|1),Wn(o,wt()),(ut&6)===0&&(Ci=wt()+500,fa()))}break;case 13:ko(function(){var g=Rs(s,1);if(g!==null){var v=$n();Lr(g,s,1,v)}}),ip(s,1)}},yl=function(s){if(s.tag===13){var o=Rs(s,134217728);if(o!==null){var d=$n();Lr(o,s,134217728,d)}ip(s,134217728)}},jr=function(s){if(s.tag===13){var o=va(s),d=Rs(s,o);if(d!==null){var g=$n();Lr(d,s,o,g)}ip(s,o)}},Va=function(){return ht},wl=function(s,o){var d=ht;try{return ht=s,o()}finally{ht=d}},_t=function(s,o,d){switch(o){case"input":if(Ce(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=ha(g);if(!v)throw Error(n(90));Pe(g),Ce(g,v)}}}break;case"textarea":Re(s,d);break;case"select":o=d.value,o!=null&&ot(s,!!d.multiple,o,!1)}},dn=ep,ir=ko;var c$={usingClientEntryPoint:!1,Events:[po,js,ha,Ct,En,ep]},oc={findFiberByHostInstance:lr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},u$={bundleType:oc.bundleType,version:oc.version,rendererPackageName:oc.rendererPackageName,rendererConfig:oc.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=Ue(s),s===null?null:s.stateNode},findFiberByHostInstance:oc.findFiberByHostInstance||i$,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 ud=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ud.isDisabled&&ud.supportsFiber)try{Yr=ud.inject(u$),An=ud}catch{}}return Un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=c$,Un.createPortal=function(s,o){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!cp(o))throw Error(n(200));return o$(s,o,null,d)},Un.createRoot=function(s,o){if(!cp(s))throw Error(n(299));var d=!1,g="",v=Hk;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(g=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=op(s,1,!1,null,null,d,!1,g,v),s[jt]=o.current,as(s.nodeType===8?s.parentNode:s),new lp(o)},Un.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=Ue(o),s=s===null?null:s.stateNode,s},Un.flushSync=function(s){return ko(s)},Un.hydrate=function(s,o,d){if(!ld(o))throw Error(n(200));return cd(null,s,o,!0,d)},Un.hydrateRoot=function(s,o,d){if(!cp(s))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,v=!1,N="",A=Hk;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(N=d.identifierPrefix),d.onRecoverableError!==void 0&&(A=d.onRecoverableError)),o=Bk(o,null,s,1,d??null,v,!1,N,A),s[jt]=o.current,as(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 id(o)},Un.render=function(s,o,d){if(!ld(o))throw Error(n(200));return cd(null,s,o,!1,d)},Un.unmountComponentAtNode=function(s){if(!ld(s))throw Error(n(40));return s._reactRootContainer?(ko(function(){cd(null,null,s,!1,function(){s._reactRootContainer=null,s[jt]=null})}),!0):!1},Un.unstable_batchedUpdates=ep,Un.unstable_renderSubtreeIntoContainer=function(s,o,d,g){if(!ld(d))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return cd(s,o,d,!1,g)},Un.version="18.3.1-next-f1338f8080-20240426",Un}var Qk;function v2(){if(Qk)return hp.exports;Qk=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(),hp.exports=y$(),hp.exports}var Jk;function w$(){if(Jk)return hd;Jk=1;var e=v2();return hd.createRoot=e.createRoot,hd.hydrateRoot=e.hydrateRoot,hd}var v$=w$();const x$="modulepreload",b$=function(e){return"/"+e},e1={},x2=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=b$(p),p in e1)return;e1[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":x$,h||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),h)return new Promise((w,_)=>{y.addEventListener("load",w),y.addEventListener("error",()=>_(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 me=r0(x);function gn(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=gn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var mp={exports:{}},gp={},yp={exports:{}},wp={};/**
|
|
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 t1;function k$(){if(t1)return wp;t1=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(),_=r({inst:{value:w,getSnapshot:y}}),k=_[0].inst,j=_[1];return l(function(){k.value=w,k.getSnapshot=y,f(k)&&j({inst:k})},[m,w,y]),a(function(){return f(k)&&j({inst:k}),m(function(){f(k)&&j({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 wp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,wp}var n1;function N$(){return n1||(n1=1,yp.exports=k$()),yp.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 r1;function _$(){if(r1)return gp;r1=1;var e=Wc(),t=N$();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 gp.useSyncExternalStoreWithSelector=function(p,h,m,y,w){var _=l(null);if(_.current===null){var k={hasValue:!1,value:null};_.current=k}else k=_.current;_=u(function(){function b(R){if(!S){if(S=!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 H=y(R);return w!==void 0&&w($,H)?(E=R,$):(E=R,C=H)}var S=!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 j=a(p,_[0],_[1]);return c(function(){k.hasValue=!0,k.value=j},[j]),f(j),j},gp}var s1;function S$(){return s1||(s1=1,mp.exports=_$()),mp.exports}var j$=S$();const E$=r0(j$),C$={},a1=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(_=>_(t,w))}},a=()=>t,f={setState:r,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(C$?"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},T$=e=>e?a1(e):a1,{useDebugValue:A$}=me,{useSyncExternalStoreWithSelector:R$}=E$,M$=e=>e;function b2(e,t=M$,n){const r=R$(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return A$(r),r}const o1=(e,t)=>{const n=T$(e),r=(a,l=t)=>b2(n,a,l);return Object.assign(r,n),r},I$=(e,t)=>e?o1(e,t):o1;function rn(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 $$={value:()=>{}};function yh(){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 Dd(n)}function Dd(e){this._=e}function O$(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}})}Dd.prototype=yh.prototype={constructor:Dd,on:function(e,t){var n=this._,r=O$(e+"",n),a,l=-1,c=r.length;if(arguments.length<2){for(;++l<c;)if((a=(e=r[l]).type)&&(a=P$(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]=i1(n[a],e.name,t);else if(t==null)for(a in n)n[a]=i1(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 Dd(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 P$(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function i1(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=$$,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var gx="http://www.w3.org/1999/xhtml";const l1={svg:"http://www.w3.org/2000/svg",xhtml:gx,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function wh(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),l1.hasOwnProperty(t)?{space:l1[t],local:e}:e}function L$(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===gx&&t.documentElement.namespaceURI===gx?t.createElement(e):t.createElementNS(n,e)}}function D$(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function k2(e){var t=wh(e);return(t.local?D$:L$)(t)}function F$(){}function s0(e){return e==null?F$:function(){return this.querySelector(e)}}function q$(e){typeof e!="function"&&(e=s0(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 or(r,this._parents)}function B$(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function z$(){return[]}function N2(e){return e==null?z$:function(){return this.querySelectorAll(e)}}function H$(e){return function(){return B$(e.apply(this,arguments))}}function W$(e){typeof e=="function"?e=H$(e):e=N2(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 or(r,a)}function _2(e){return function(){return this.matches(e)}}function S2(e){return function(t){return t.matches(e)}}var U$=Array.prototype.find;function V$(e){return function(){return U$.call(this.children,e)}}function G$(){return this.firstElementChild}function K$(e){return this.select(e==null?G$:V$(typeof e=="function"?e:S2(e)))}var Y$=Array.prototype.filter;function X$(){return Array.from(this.children)}function Z$(e){return function(){return Y$.call(this.children,e)}}function Q$(e){return this.selectAll(e==null?X$:Z$(typeof e=="function"?e:S2(e)))}function J$(e){typeof e!="function"&&(e=_2(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 or(r,this._parents)}function j2(e){return new Array(e.length)}function e3(){return new or(this._enter||this._groups.map(j2),this._parents)}function Gd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Gd.prototype={constructor:Gd,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 t3(e){return function(){return e}}function n3(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 Gd(e,l[c]);for(;c<f;++c)(u=t[c])&&(a[c]=u)}function r3(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 Gd(e,l[u]);for(u=0;u<h;++u)(f=t[u])&&p.get(y[u])===f&&(a[u]=f)}function s3(e){return e.__data__}function a3(e,t){if(!arguments.length)return Array.from(this,s3);var n=t?r3:n3,r=this._parents,a=this._groups;typeof e!="function"&&(e=t3(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=o3(e.call(h,h&&h.__data__,p,r)),_=w.length,k=u[p]=new Array(_),j=c[p]=new Array(_),b=f[p]=new Array(y);n(h,m,k,j,b,w,t);for(var S=0,E=0,C,T;S<_;++S)if(C=k[S]){for(S>=E&&(E=S+1);!(T=j[E])&&++E<_;);C._next=T||null}}return c=new or(c,r),c._enter=u,c._exit=f,c}function o3(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function i3(){return new or(this._exit||this._groups.map(j2),this._parents)}function l3(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 c3(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,_=0;_<m;++_)(w=p[_]||h[_])&&(y[_]=w);for(;f<a;++f)u[f]=n[f];return new or(u,this._parents)}function u3(){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 d3(e){e||(e=h3);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 or(a,this._parents).order()}function h3(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function f3(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function p3(){return Array.from(this)}function m3(){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 g3(){let e=0;for(const t of this)++e;return e}function y3(){return!this.node()}function w3(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 v3(e){return function(){this.removeAttribute(e)}}function x3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function b3(e,t){return function(){this.setAttribute(e,t)}}function k3(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function N3(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function _3(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 S3(e,t){var n=wh(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?x3:v3:typeof t=="function"?n.local?_3:N3:n.local?k3:b3)(n,t))}function E2(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function j3(e){return function(){this.style.removeProperty(e)}}function E3(e,t,n){return function(){this.style.setProperty(e,t,n)}}function C3(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function T3(e,t,n){return arguments.length>1?this.each((t==null?j3:typeof t=="function"?C3:E3)(e,t,n??"")):Zi(this.node(),e)}function Zi(e,t){return e.style.getPropertyValue(t)||E2(e).getComputedStyle(e,null).getPropertyValue(t)}function A3(e){return function(){delete this[e]}}function R3(e,t){return function(){this[e]=t}}function M3(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function I3(e,t){return arguments.length>1?this.each((t==null?A3:typeof t=="function"?M3:R3)(e,t)):this.node()[e]}function C2(e){return e.trim().split(/^|\s+/)}function a0(e){return e.classList||new T2(e)}function T2(e){this._node=e,this._names=C2(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 A2(e,t){for(var n=a0(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function R2(e,t){for(var n=a0(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function $3(e){return function(){A2(this,e)}}function O3(e){return function(){R2(this,e)}}function P3(e,t){return function(){(t.apply(this,arguments)?A2:R2)(this,e)}}function L3(e,t){var n=C2(e+"");if(arguments.length<2){for(var r=a0(this.node()),a=-1,l=n.length;++a<l;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?P3:t?$3:O3)(n,t))}function D3(){this.textContent=""}function F3(e){return function(){this.textContent=e}}function q3(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function B3(e){return arguments.length?this.each(e==null?D3:(typeof e=="function"?q3:F3)(e)):this.node().textContent}function z3(){this.innerHTML=""}function H3(e){return function(){this.innerHTML=e}}function W3(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function U3(e){return arguments.length?this.each(e==null?z3:(typeof e=="function"?W3:H3)(e)):this.node().innerHTML}function V3(){this.nextSibling&&this.parentNode.appendChild(this)}function G3(){return this.each(V3)}function K3(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Y3(){return this.each(K3)}function X3(e){var t=typeof e=="function"?e:k2(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Z3(){return null}function Q3(e,t){var n=typeof e=="function"?e:k2(e),r=t==null?Z3:typeof t=="function"?t:s0(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function J3(){var e=this.parentNode;e&&e.removeChild(this)}function eO(){return this.each(J3)}function tO(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nO(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rO(e){return this.select(e?nO:tO)}function sO(e){return arguments.length?this.property("__data__",e):this.node().__data__}function aO(e){return function(t){e.call(this,t,this.__data__)}}function oO(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 iO(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 lO(e,t,n){return function(){var r=this.__on,a,l=aO(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 cO(e,t,n){var r=oO(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?lO:iO,a=0;a<l;++a)this.each(u(r[a],t,n));return this}function M2(e,t,n){var r=E2(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 uO(e,t){return function(){return M2(this,e,t)}}function dO(e,t){return function(){return M2(this,e,t.apply(this,arguments))}}function hO(e,t){return this.each((typeof t=="function"?dO:uO)(e,t))}function*fO(){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 I2=[null];function or(e,t){this._groups=e,this._parents=t}function Uc(){return new or([[document.documentElement]],I2)}function pO(){return this}or.prototype=Uc.prototype={constructor:or,select:q$,selectAll:W$,selectChild:K$,selectChildren:Q$,filter:J$,data:a3,enter:e3,exit:i3,join:l3,merge:c3,selection:pO,order:u3,sort:d3,call:f3,nodes:p3,node:m3,size:g3,empty:y3,each:w3,attr:S3,style:T3,property:I3,classed:L3,text:B3,html:U3,raise:G3,lower:Y3,append:X3,insert:Q3,remove:eO,clone:rO,datum:sO,on:cO,dispatch:hO,[Symbol.iterator]:fO};function yr(e){return typeof e=="string"?new or([[document.querySelector(e)]],[document.documentElement]):new or([[e]],I2)}function mO(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Fr(e,t){if(e=mO(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 gO={passive:!1},Ec={capture:!0,passive:!1};function vp(e){e.stopImmediatePropagation()}function Vi(e){e.preventDefault(),e.stopImmediatePropagation()}function $2(e){var t=e.document.documentElement,n=yr(e).on("dragstart.drag",Vi,Ec);"onselectstart"in t?n.on("selectstart.drag",Vi,Ec):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function O2(e,t){var n=e.document.documentElement,r=yr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Vi,Ec),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 fd=e=>()=>e;function yx(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}})}yx.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yO(e){return!e.ctrlKey&&!e.button}function wO(){return this.parentNode}function vO(e,t){return t??{x:e.x,y:e.y}}function xO(){return navigator.maxTouchPoints||"ontouchstart"in this}function bO(){var e=yO,t=wO,n=vO,r=xO,a={},l=yh("start","drag","end"),c=0,u,f,p,h,m=0;function y(C){C.on("mousedown.drag",w).filter(r).on("touchstart.drag",j).on("touchmove.drag",b,gO).on("touchend.drag touchcancel.drag",S).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&&(yr(C.view).on("mousemove.drag",_,Ec).on("mouseup.drag",k,Ec),$2(C.view),vp(C),p=!1,u=C.clientX,f=C.clientY,R("start",C))}}function _(C){if(Vi(C),!p){var T=C.clientX-u,R=C.clientY-f;p=T*T+R*R>m}a.mouse("drag",C)}function k(C){yr(C.view).on("mousemove.drag mouseup.drag",null),O2(C.view,p),Vi(C),a.mouse("end",C)}function j(C,T){if(e.call(this,C,T)){var R=C.changedTouches,$=t.call(this,C,T),H=R.length,B,P;for(B=0;B<H;++B)(P=E(this,$,C,T,R[B].identifier,R[B]))&&(vp(C),P("start",C,R[B]))}}function b(C){var T=C.changedTouches,R=T.length,$,H;for($=0;$<R;++$)(H=a[T[$].identifier])&&(Vi(C),H("drag",C,T[$]))}function S(C){var T=C.changedTouches,R=T.length,$,H;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),$=0;$<R;++$)(H=a[T[$].identifier])&&(vp(C),H("end",C,T[$]))}function E(C,T,R,$,H,B){var P=l.copy(),G=Fr(B||R,T),Q,J,M;if((M=n.call(C,new yx("beforestart",{sourceEvent:R,target:y,identifier:H,active:c,x:G[0],y:G[1],dx:0,dy:0,dispatch:P}),$))!=null)return Q=M.x-G[0]||0,J=M.y-G[1]||0,function X(V,I,q){var W=G,K;switch(V){case"start":a[H]=X,K=c++;break;case"end":delete a[H],--c;case"drag":G=Fr(q||I,T),K=c;break}P.call(V,C,new yx(V,{sourceEvent:I,subject:M,target:y,identifier:H,active:K,x:G[0]+Q,y:G[1]+J,dx:G[0]-W[0],dy:G[1]-W[1],dispatch:P}),$)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:fd(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:fd(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:fd(C),y):n},y.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:fd(!!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 o0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function P2(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Vc(){}var Cc=.7,Kd=1/Cc,Gi="\\s*([+-]?\\d+)\\s*",Tc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",us="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kO=/^#([0-9a-f]{3,8})$/,NO=new RegExp(`^rgb\\(${Gi},${Gi},${Gi}\\)$`),_O=new RegExp(`^rgb\\(${us},${us},${us}\\)$`),SO=new RegExp(`^rgba\\(${Gi},${Gi},${Gi},${Tc}\\)$`),jO=new RegExp(`^rgba\\(${us},${us},${us},${Tc}\\)$`),EO=new RegExp(`^hsl\\(${Tc},${us},${us}\\)$`),CO=new RegExp(`^hsla\\(${Tc},${us},${us},${Tc}\\)$`),c1={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};o0(Vc,Ac,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:u1,formatHex:u1,formatHex8:TO,formatHsl:AO,formatRgb:d1,toString:d1});function u1(){return this.rgb().formatHex()}function TO(){return this.rgb().formatHex8()}function AO(){return L2(this).formatHsl()}function d1(){return this.rgb().formatRgb()}function Ac(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=kO.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?h1(t):n===3?new Vn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pd(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=NO.exec(e))?new Vn(t[1],t[2],t[3],1):(t=_O.exec(e))?new Vn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=SO.exec(e))?pd(t[1],t[2],t[3],t[4]):(t=jO.exec(e))?pd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=EO.exec(e))?m1(t[1],t[2]/100,t[3]/100,1):(t=CO.exec(e))?m1(t[1],t[2]/100,t[3]/100,t[4]):c1.hasOwnProperty(e)?h1(c1[e]):e==="transparent"?new Vn(NaN,NaN,NaN,0):null}function h1(e){return new Vn(e>>16&255,e>>8&255,e&255,1)}function pd(e,t,n,r){return r<=0&&(e=t=n=NaN),new Vn(e,t,n,r)}function RO(e){return e instanceof Vc||(e=Ac(e)),e?(e=e.rgb(),new Vn(e.r,e.g,e.b,e.opacity)):new Vn}function wx(e,t,n,r){return arguments.length===1?RO(e):new Vn(e,t,n,r??1)}function Vn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}o0(Vn,wx,P2(Vc,{brighter(e){return e=e==null?Kd:Math.pow(Kd,e),new Vn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Cc:Math.pow(Cc,e),new Vn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vn(Ro(this.r),Ro(this.g),Ro(this.b),Yd(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:f1,formatHex:f1,formatHex8:MO,formatRgb:p1,toString:p1}));function f1(){return`#${To(this.r)}${To(this.g)}${To(this.b)}`}function MO(){return`#${To(this.r)}${To(this.g)}${To(this.b)}${To((isNaN(this.opacity)?1:this.opacity)*255)}`}function p1(){const e=Yd(this.opacity);return`${e===1?"rgb(":"rgba("}${Ro(this.r)}, ${Ro(this.g)}, ${Ro(this.b)}${e===1?")":`, ${e})`}`}function Yd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ro(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function To(e){return e=Ro(e),(e<16?"0":"")+e.toString(16)}function m1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Br(e,t,n,r)}function L2(e){if(e instanceof Br)return new Br(e.h,e.s,e.l,e.opacity);if(e instanceof Vc||(e=Ac(e)),!e)return new Br;if(e instanceof Br)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 Br(c,u,f,e.opacity)}function IO(e,t,n,r){return arguments.length===1?L2(e):new Br(e,t,n,r??1)}function Br(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}o0(Br,IO,P2(Vc,{brighter(e){return e=e==null?Kd:Math.pow(Kd,e),new Br(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Cc:Math.pow(Cc,e),new Br(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 Vn(xp(e>=240?e-240:e+120,a,r),xp(e,a,r),xp(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Br(g1(this.h),md(this.s),md(this.l),Yd(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=Yd(this.opacity);return`${e===1?"hsl(":"hsla("}${g1(this.h)}, ${md(this.s)*100}%, ${md(this.l)*100}%${e===1?")":`, ${e})`}`}}));function g1(e){return e=(e||0)%360,e<0?e+360:e}function md(e){return Math.max(0,Math.min(1,e||0))}function xp(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 D2=e=>()=>e;function $O(e,t){return function(n){return e+n*t}}function OO(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 PO(e){return(e=+e)==1?F2:function(t,n){return n-t?OO(t,n,e):D2(isNaN(t)?n:t)}}function F2(e,t){var n=t-e;return n?$O(e,n):D2(isNaN(e)?t:e)}const y1=(function e(t){var n=PO(t);function r(a,l){var c=n((a=wx(a)).r,(l=wx(l)).r),u=n(a.g,l.g),f=n(a.b,l.b),p=F2(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 Ea(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var vx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,bp=new RegExp(vx.source,"g");function LO(e){return function(){return e}}function DO(e){return function(t){return e(t)+""}}function FO(e,t){var n=vx.lastIndex=bp.lastIndex=0,r,a,l,c=-1,u=[],f=[];for(e=e+"",t=t+"";(r=vx.exec(e))&&(a=bp.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:Ea(r,a)})),n=bp.lastIndex;return n<t.length&&(l=t.slice(n),u[c]?u[c]+=l:u[++c]=l),u.length<2?f[0]?DO(f[0].x):LO(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 w1=180/Math.PI,xx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function q2(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)*w1,skewX:Math.atan(f)*w1,scaleX:c,scaleY:u}}var gd;function qO(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?xx:q2(t.a,t.b,t.c,t.d,t.e,t.f)}function BO(e){return e==null||(gd||(gd=document.createElementNS("http://www.w3.org/2000/svg","g")),gd.setAttribute("transform",e),!(e=gd.transform.baseVal.consolidate()))?xx:(e=e.matrix,q2(e.a,e.b,e.c,e.d,e.e,e.f))}function B2(e,t,n,r){function a(p){return p.length?p.pop()+" ":""}function l(p,h,m,y,w,_){if(p!==m||h!==y){var k=w.push("translate(",null,t,null,n);_.push({i:k-4,x:Ea(p,m)},{i:k-2,x:Ea(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:Ea(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:Ea(p,h)}):h&&m.push(a(m)+"skewX("+h+r)}function f(p,h,m,y,w,_){if(p!==m||h!==y){var k=w.push(a(w)+"scale(",null,",",null,")");_.push({i:k-4,x:Ea(p,m)},{i:k-2,x:Ea(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 _=-1,k=y.length,j;++_<k;)m[(j=y[_]).i]=j.x(w);return m.join("")}}}var zO=B2(qO,"px, ","px)","deg)"),HO=B2(BO,", ",")",")"),WO=1e-12;function v1(e){return((e=Math.exp(e))+1/e)/2}function UO(e){return((e=Math.exp(e))-1/e)/2}function VO(e){return((e=Math.exp(2*e))-1)/(e+1)}const GO=(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,_=m-f,k=w*w+_*_,j,b;if(k<WO)b=Math.log(y/p)/t,j=function($){return[u+$*w,f+$*_,p*Math.exp(t*$*b)]};else{var S=Math.sqrt(k),E=(y*y-p*p+r*k)/(2*p*n*S),C=(y*y-p*p-r*k)/(2*y*n*S),T=Math.log(Math.sqrt(E*E+1)-E),R=Math.log(Math.sqrt(C*C+1)-C);b=(R-T)/t,j=function($){var H=$*b,B=v1(T),P=p/(n*S)*(B*VO(t*H+T)-UO(T));return[u+P*w,f+P*_,p*B/v1(t*H+T)]}}return j.duration=b*1e3*t/Math.SQRT2,j}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 Qi=0,yc=0,lc=0,z2=1e3,Xd,wc,Zd=0,Oo=0,vh=0,Rc=typeof performance=="object"&&performance.now?performance:Date,H2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function i0(){return Oo||(H2(KO),Oo=Rc.now()+vh)}function KO(){Oo=0}function Qd(){this._call=this._time=this._next=null}Qd.prototype=W2.prototype={constructor:Qd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?i0():+n)+(t==null?0:+t),!this._next&&wc!==this&&(wc?wc._next=this:Xd=this,wc=this),this._call=e,this._time=n,bx()},stop:function(){this._call&&(this._call=null,this._time=1/0,bx())}};function W2(e,t,n){var r=new Qd;return r.restart(e,t,n),r}function YO(){i0(),++Qi;for(var e=Xd,t;e;)(t=Oo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qi}function x1(){Oo=(Zd=Rc.now())+vh,Qi=yc=0;try{YO()}finally{Qi=0,ZO(),Oo=0}}function XO(){var e=Rc.now(),t=e-Zd;t>z2&&(vh-=t,Zd=e)}function ZO(){for(var e,t=Xd,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:Xd=n);wc=e,bx(r)}function bx(e){if(!Qi){yc&&(yc=clearTimeout(yc));var t=e-Oo;t>24?(e<1/0&&(yc=setTimeout(x1,e-Rc.now()-vh)),lc&&(lc=clearInterval(lc))):(lc||(Zd=Rc.now(),lc=setInterval(XO,z2)),Qi=1,H2(x1))}}function b1(e,t,n){var r=new Qd;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var QO=yh("start","end","cancel","interrupt"),JO=[],U2=0,k1=1,kx=2,Fd=3,N1=4,Nx=5,qd=6;function xh(e,t,n,r,a,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;e4(e,n,{name:t,index:r,group:a,on:QO,tween:JO,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:U2})}function l0(e,t){var n=Vr(e,t);if(n.state>U2)throw new Error("too late; already scheduled");return n}function fs(e,t){var n=Vr(e,t);if(n.state>Fd)throw new Error("too late; already running");return n}function Vr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function e4(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=W2(l,0,n.time);function l(p){n.state=k1,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!==k1)return f();for(h in r)if(w=r[h],w.name===n.name){if(w.state===Fd)return b1(c);w.state===N1?(w.state=qd,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete r[h]):+h<t&&(w.state=qd,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete r[h])}if(b1(function(){n.state===Fd&&(n.state=N1,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=kx,n.on.call("start",e,e.__data__,n.index,n.group),n.state===kx){for(n.state=Fd,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=Nx,1),m=-1,y=a.length;++m<y;)a[m].call(e,h);n.state===Nx&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=qd,n.timer.stop(),delete r[t];for(var p in r)return;delete e.__transition}}function Bd(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>kx&&r.state<Nx,r.state=qd,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[c]}l&&delete e.__transition}}function t4(e){return this.each(function(){Bd(this,e)})}function n4(e,t){var n,r;return function(){var a=fs(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 r4(e,t,n){var r,a;if(typeof n!="function")throw new Error;return function(){var l=fs(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 s4(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Vr(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?n4:r4)(n,e,t))}function c0(e,t,n){var r=e._id;return e.each(function(){var a=fs(this,r);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return Vr(a,r).value[t]}}function V2(e,t){var n;return(typeof t=="number"?Ea:t instanceof Ac?y1:(n=Ac(t))?(t=n,y1):FO)(e,t)}function a4(e){return function(){this.removeAttribute(e)}}function o4(e){return function(){this.removeAttributeNS(e.space,e.local)}}function i4(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 l4(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 c4(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 u4(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 d4(e,t){var n=wh(e),r=n==="transform"?HO:V2;return this.attrTween(e,typeof t=="function"?(n.local?u4:c4)(n,r,c0(this,"attr."+e,t)):t==null?(n.local?o4:a4)(n):(n.local?l4:i4)(n,r,t))}function h4(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function f4(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function p4(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&f4(e,l)),n}return a._value=t,a}function m4(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&h4(e,l)),n}return a._value=t,a}function g4(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=wh(e);return this.tween(n,(r.local?p4:m4)(r,t))}function y4(e,t){return function(){l0(this,e).delay=+t.apply(this,arguments)}}function w4(e,t){return t=+t,function(){l0(this,e).delay=t}}function v4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?y4:w4)(t,e)):Vr(this.node(),t).delay}function x4(e,t){return function(){fs(this,e).duration=+t.apply(this,arguments)}}function b4(e,t){return t=+t,function(){fs(this,e).duration=t}}function k4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?x4:b4)(t,e)):Vr(this.node(),t).duration}function N4(e,t){if(typeof t!="function")throw new Error;return function(){fs(this,e).ease=t}}function _4(e){var t=this._id;return arguments.length?this.each(N4(t,e)):Vr(this.node(),t).ease}function S4(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fs(this,e).ease=n}}function j4(e){if(typeof e!="function")throw new Error;return this.each(S4(this._id,e))}function E4(e){typeof e!="function"&&(e=_2(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 Fs(r,this._parents,this._name,this._id)}function C4(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 Fs(c,this._parents,this._name,this._id)}function T4(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 A4(e,t,n){var r,a,l=T4(t)?l0:fs;return function(){var c=l(this,e),u=c.on;u!==r&&(a=(r=u).copy()).on(t,n),c.on=a}}function R4(e,t){var n=this._id;return arguments.length<2?Vr(this.node(),n).on.on(e):this.each(A4(n,e,t))}function M4(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function I4(){return this.on("end.remove",M4(this._id))}function $4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=s0(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,xh(p[y],t,n,y,p,Vr(h,n)));return new Fs(l,this._parents,t,n)}function O4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=N2(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,_=Vr(h,n),k=0,j=y.length;k<j;++k)(w=y[k])&&xh(w,t,n,k,y,_);l.push(y),c.push(h)}return new Fs(l,c,t,n)}var P4=Uc.prototype.constructor;function L4(){return new P4(this._groups,this._parents)}function D4(e,t){var n,r,a;return function(){var l=Zi(this,e),c=(this.style.removeProperty(e),Zi(this,e));return l===c?null:l===n&&c===r?a:a=t(n=l,r=c)}}function G2(e){return function(){this.style.removeProperty(e)}}function F4(e,t,n){var r,a=n+"",l;return function(){var c=Zi(this,e);return c===a?null:c===r?l:l=t(r=c,n)}}function q4(e,t,n){var r,a,l;return function(){var c=Zi(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),Zi(this,e))),c===f?null:c===r&&f===a?l:(a=f,l=t(r=c,u))}}function B4(e,t){var n,r,a,l="style."+t,c="end."+l,u;return function(){var f=fs(this,e),p=f.on,h=f.value[l]==null?u||(u=G2(t)):void 0;(p!==n||a!==h)&&(r=(n=p).copy()).on(c,a=h),f.on=r}}function z4(e,t,n){var r=(e+="")=="transform"?zO:V2;return t==null?this.styleTween(e,D4(e,r)).on("end.style."+e,G2(e)):typeof t=="function"?this.styleTween(e,q4(e,r,c0(this,"style."+e,t))).each(B4(this._id,e)):this.styleTween(e,F4(e,r,t),n).on("end.style."+e,null)}function H4(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function W4(e,t,n){var r,a;function l(){var c=t.apply(this,arguments);return c!==a&&(r=(a=c)&&H4(e,c,n)),r}return l._value=t,l}function U4(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,W4(e,t,n??""))}function V4(e){return function(){this.textContent=e}}function G4(e){return function(){var t=e(this);this.textContent=t??""}}function K4(e){return this.tween("text",typeof e=="function"?G4(c0(this,"text",e)):V4(e==null?"":e+""))}function Y4(e){return function(t){this.textContent=e.call(this,t)}}function X4(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&Y4(a)),t}return r._value=e,r}function Z4(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,X4(e))}function Q4(){for(var e=this._name,t=this._id,n=K2(),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=Vr(f,t);xh(f,e,n,p,c,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Fs(r,this._parents,e,n)}function J4(){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=fs(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 eP=0;function Fs(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function K2(){return++eP}var Os=Uc.prototype;Fs.prototype={constructor:Fs,select:$4,selectAll:O4,selectChild:Os.selectChild,selectChildren:Os.selectChildren,filter:E4,merge:C4,selection:L4,transition:Q4,call:Os.call,nodes:Os.nodes,node:Os.node,size:Os.size,empty:Os.empty,each:Os.each,on:R4,attr:d4,attrTween:g4,style:z4,styleTween:U4,text:K4,textTween:Z4,remove:I4,tween:s4,delay:v4,duration:k4,ease:_4,easeVarying:j4,end:J4,[Symbol.iterator]:Os[Symbol.iterator]};function tP(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var nP={time:null,delay:0,duration:250,ease:tP};function rP(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 sP(e){var t,n;e instanceof Fs?(t=e._id,e=e._name):(t=K2(),(n=nP).time=i0(),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])&&xh(f,e,t,p,c,n||rP(f,t));return new Fs(r,this._parents,e,t)}Uc.prototype.interrupt=t4;Uc.prototype.transition=sP;const yd=e=>()=>e;function aP(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 Ps(e,t,n){this.k=e,this.x=t,this.y=n}Ps.prototype={constructor:Ps,scale:function(e){return e===1?this:new Ps(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ps(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 Ds=new Ps(1,0,0);Ps.prototype;function kp(e){e.stopImmediatePropagation()}function cc(e){e.preventDefault(),e.stopImmediatePropagation()}function oP(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function iP(){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 _1(){return this.__zoom||Ds}function lP(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function cP(){return navigator.maxTouchPoints||"ontouchstart"in this}function uP(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 Y2(){var e=oP,t=iP,n=uP,r=lP,a=cP,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=GO,p=yh("start","zoom","end"),h,m,y,w=500,_=150,k=0,j=10;function b(M){M.property("__zoom",_1).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",P).filter(a).on("touchstart.zoom",G).on("touchmove.zoom",Q).on("touchend.zoom touchcancel.zoom",J).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(M,X,V,I){var q=M.selection?M.selection():M;q.property("__zoom",_1),M!==q?T(M,X,V,I):q.interrupt().each(function(){R(this,arguments).event(I).start().zoom(null,typeof X=="function"?X.apply(this,arguments):X).end()})},b.scaleBy=function(M,X,V,I){b.scaleTo(M,function(){var q=this.__zoom.k,W=typeof X=="function"?X.apply(this,arguments):X;return q*W},V,I)},b.scaleTo=function(M,X,V,I){b.transform(M,function(){var q=t.apply(this,arguments),W=this.__zoom,K=V==null?C(q):typeof V=="function"?V.apply(this,arguments):V,F=W.invert(K),D=typeof X=="function"?X.apply(this,arguments):X;return n(E(S(W,D),K,F),q,c)},V,I)},b.translateBy=function(M,X,V,I){b.transform(M,function(){return n(this.__zoom.translate(typeof X=="function"?X.apply(this,arguments):X,typeof V=="function"?V.apply(this,arguments):V),t.apply(this,arguments),c)},null,I)},b.translateTo=function(M,X,V,I,q){b.transform(M,function(){var W=t.apply(this,arguments),K=this.__zoom,F=I==null?C(W):typeof I=="function"?I.apply(this,arguments):I;return n(Ds.translate(F[0],F[1]).scale(K.k).translate(typeof X=="function"?-X.apply(this,arguments):-X,typeof V=="function"?-V.apply(this,arguments):-V),W,c)},I,q)};function S(M,X){return X=Math.max(l[0],Math.min(l[1],X)),X===M.k?M:new Ps(X,M.x,M.y)}function E(M,X,V){var I=X[0]-V[0]*M.k,q=X[1]-V[1]*M.k;return I===M.x&&q===M.y?M:new Ps(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,X,V,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,W=arguments,K=R(q,W).event(I),F=t.apply(q,W),D=V==null?C(F):typeof V=="function"?V.apply(q,W):V,ae=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),z=q.__zoom,Z=typeof X=="function"?X.apply(q,W):X,U=f(z.invert(D).concat(ae/z.k),Z.invert(D).concat(ae/Z.k));return function(re){if(re===1)re=Z;else{var de=U(re),ge=ae/de[2];re=new Ps(ge,D[0]-de[0]*ge,D[1]-de[1]*ge)}K.zoom(null,re)}})}function R(M,X,V){return!V&&M.__zooming||new $(M,X)}function $(M,X){this.that=M,this.args=X,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,X),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,X){return this.mouse&&M!=="mouse"&&(this.mouse[1]=X.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=X.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=X.invert(this.touch1[0])),this.that.__zoom=X,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var X=yr(this.that).datum();p.call(M,this.that,new aP(M,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:p}),X)}};function H(M,...X){if(!e.apply(this,arguments))return;var V=R(this,X).event(M),I=this.__zoom,q=Math.max(l[0],Math.min(l[1],I.k*Math.pow(2,r.apply(this,arguments)))),W=Fr(M);if(V.wheel)(V.mouse[0][0]!==W[0]||V.mouse[0][1]!==W[1])&&(V.mouse[1]=I.invert(V.mouse[0]=W)),clearTimeout(V.wheel);else{if(I.k===q)return;V.mouse=[W,I.invert(W)],Bd(this),V.start()}cc(M),V.wheel=setTimeout(K,_),V.zoom("mouse",n(E(S(I,q),V.mouse[0],V.mouse[1]),V.extent,c));function K(){V.wheel=null,V.end()}}function B(M,...X){if(y||!e.apply(this,arguments))return;var V=M.currentTarget,I=R(this,X,!0).event(M),q=yr(M.view).on("mousemove.zoom",D,!0).on("mouseup.zoom",ae,!0),W=Fr(M,V),K=M.clientX,F=M.clientY;$2(M.view),kp(M),I.mouse=[W,this.__zoom.invert(W)],Bd(this),I.start();function D(z){if(cc(z),!I.moved){var Z=z.clientX-K,U=z.clientY-F;I.moved=Z*Z+U*U>k}I.event(z).zoom("mouse",n(E(I.that.__zoom,I.mouse[0]=Fr(z,V),I.mouse[1]),I.extent,c))}function ae(z){q.on("mousemove.zoom mouseup.zoom",null),O2(z.view,I.moved),cc(z),I.event(z).end()}}function P(M,...X){if(e.apply(this,arguments)){var V=this.__zoom,I=Fr(M.changedTouches?M.changedTouches[0]:M,this),q=V.invert(I),W=V.k*(M.shiftKey?.5:2),K=n(E(S(V,W),I,q),t.apply(this,X),c);cc(M),u>0?yr(this).transition().duration(u).call(T,K,I,M):yr(this).call(b.transform,K,I,M)}}function G(M,...X){if(e.apply(this,arguments)){var V=M.touches,I=V.length,q=R(this,X,M.changedTouches.length===I).event(M),W,K,F,D;for(kp(M),K=0;K<I;++K)F=V[K],D=Fr(F,this),D=[D,this.__zoom.invert(D),F.identifier],q.touch0?!q.touch1&&q.touch0[2]!==D[2]&&(q.touch1=D,q.taps=0):(q.touch0=D,W=!0,q.taps=1+!!h);h&&(h=clearTimeout(h)),W&&(q.taps<2&&(m=D[0],h=setTimeout(function(){h=null},w)),Bd(this),q.start())}}function Q(M,...X){if(this.__zooming){var V=R(this,X).event(M),I=M.changedTouches,q=I.length,W,K,F,D;for(cc(M),W=0;W<q;++W)K=I[W],F=Fr(K,this),V.touch0&&V.touch0[2]===K.identifier?V.touch0[0]=F:V.touch1&&V.touch1[2]===K.identifier&&(V.touch1[0]=F);if(K=V.that.__zoom,V.touch1){var ae=V.touch0[0],z=V.touch0[1],Z=V.touch1[0],U=V.touch1[1],re=(re=Z[0]-ae[0])*re+(re=Z[1]-ae[1])*re,de=(de=U[0]-z[0])*de+(de=U[1]-z[1])*de;K=S(K,Math.sqrt(re/de)),F=[(ae[0]+Z[0])/2,(ae[1]+Z[1])/2],D=[(z[0]+U[0])/2,(z[1]+U[1])/2]}else if(V.touch0)F=V.touch0[0],D=V.touch0[1];else return;V.zoom("touch",n(E(K,F,D),V.extent,c))}}function J(M,...X){if(this.__zooming){var V=R(this,X).event(M),I=M.changedTouches,q=I.length,W,K;for(kp(M),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),W=0;W<q;++W)K=I[W],V.touch0&&V.touch0[2]===K.identifier?delete V.touch0:V.touch1&&V.touch1[2]===K.identifier&&delete V.touch1;if(V.touch1&&!V.touch0&&(V.touch0=V.touch1,delete V.touch1),V.touch0)V.touch0[1]=this.__zoom.invert(V.touch0[0]);else if(V.end(),V.taps===2&&(K=Fr(K,this),Math.hypot(m[0]-K[0],m[1]-K[1])<j)){var F=yr(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return b.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:yd(+M),b):r},b.filter=function(M){return arguments.length?(e=typeof M=="function"?M:yd(!!M),b):e},b.touchable=function(M){return arguments.length?(a=typeof M=="function"?M:yd(!!M),b):a},b.extent=function(M){return arguments.length?(t=typeof M=="function"?M:yd([[+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?(j=+M,b):j},b}var Yn=v2();const bh=x.createContext(null),dP=bh.Provider,qs={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.`},X2=qs.error001();function pt(e,t){const n=x.useContext(bh);if(n===null)throw new Error(X2);return b2(n,e,t)}const Vt=()=>{const e=x.useContext(bh);if(e===null)throw new Error(X2);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},hP=e=>e.userSelectionActive?"none":"all";function u0({position:e,children:t,className:n,style:r,...a}){const l=pt(hP),c=`${e}`.split("-");return me.createElement("div",{className:gn(["react-flow__panel",n,...c]),style:{...r,pointerEvents:l},...a},t)}function fP({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:me.createElement(u0,{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"},me.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const pP=({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}),_=gn(["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:me.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:_,visibility:y.width?"visible":"hidden",...h},a&&me.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}),me.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:r},n),f)};var mP=x.memo(pP);const d0=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ji=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),h0=(e={x:0,y:0},t)=>({x:Ji(e.x,t[0][0],t[1][0]),y:Ji(e.y,t[0][1],t[1][1])}),S1=(e,t,n)=>e<t?Ji(Math.abs(e-t),1,50)/50:e>n?-Ji(Math.abs(e-n),1,50)/50:0,Z2=(e,t)=>{const n=S1(e.x,35,t.width-35)*20,r=S1(e.y,35,t.height-35)*20;return[n,r]},Q2=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},J2=(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)}),Mc=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),eA=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),j1=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),gP=(e,t)=>eA(J2(Mc(e),Mc(t))),_x=(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)},yP=e=>wr(e.width)&&wr(e.height)&&wr(e.x)&&wr(e.y),wr=e=>!isNaN(e)&&isFinite(e),Dt=Symbol.for("internals"),tA=["Enter"," ","Escape"],wP=(e,t)=>{},vP=e=>"nativeEvent"in e;function Sx(e){var a,l;const t=vP(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 nA=e=>"clientX"in e,Ia=(e,t)=>{var l,c;const n=nA(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)}},Jd=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Gc=({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})=>me.createElement(me.Fragment,null,me.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&me.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&wr(n)&&wr(r)?me.createElement(mP,{x:n,y:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);Gc.displayName="BaseEdge";function uc(e,t,n){return n===void 0?n:r=>{const a=t().edges.find(l=>l.id===e);a&&n(r,{...a})}}function rA({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 sA({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 Po;(function(e){e.Strict="strict",e.Loose="loose"})(Po||(Po={}));var Ao;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ao||(Ao={}));var Ic;(function(e){e.Partial="partial",e.Full="full"})(Ic||(Ic={}));var Ta;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ta||(Ta={}));var eh;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(eh||(eh={}));var Ve;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ve||(Ve={}));function E1({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===Ve.Left||e===Ve.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function aA({sourceX:e,sourceY:t,sourcePosition:n=Ve.Bottom,targetX:r,targetY:a,targetPosition:l=Ve.Top}){const[c,u]=E1({pos:n,x1:e,y1:t,x2:r,y2:a}),[f,p]=E1({pos:l,x1:r,y1:a,x2:e,y2:t}),[h,m,y,w]=sA({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 f0=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a=Ve.Bottom,targetPosition:l=Ve.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:_,interactionWidth:k})=>{const[j,b,S]=aA({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:l});return me.createElement(Gc,{path:j,labelX:b,labelY:S,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:_,interactionWidth:k})});f0.displayName="SimpleBezierEdge";const C1={[Ve.Left]:{x:-1,y:0},[Ve.Right]:{x:1,y:0},[Ve.Top]:{x:0,y:-1},[Ve.Bottom]:{x:0,y:1}},xP=({source:e,sourcePosition:t=Ve.Bottom,target:n})=>t===Ve.Left||t===Ve.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},T1=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function bP({source:e,sourcePosition:t=Ve.Bottom,target:n,targetPosition:r=Ve.Top,center:a,offset:l}){const c=C1[t],u=C1[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=xP({source:f,sourcePosition:t,target:p}),m=h.x!==0?"x":"y",y=h[m];let w=[],_,k;const j={x:0,y:0},b={x:0,y:0},[S,E,C,T]=rA({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*u[m]===-1){_=a.x??S,k=a.y??E;const $=[{x:_,y:f.y},{x:_,y:p.y}],H=[{x:f.x,y:k},{x:p.x,y:k}];c[m]===y?w=m==="x"?$:H:w=m==="x"?H:$}else{const $=[{x:f.x,y:p.y}],H=[{x:p.x,y:f.y}];if(m==="x"?w=c.x===y?H:$:w=c.y===y?$:H,t===r){const J=Math.abs(e[m]-n[m]);if(J<=l){const M=Math.min(l-1,l-J);c[m]===y?j[m]=(f[m]>e[m]?-1:1)*M:b[m]=(p[m]>n[m]?-1:1)*M}}if(t!==r){const J=m==="x"?"y":"x",M=c[m]===u[J],X=f[J]>p[J],V=f[J]<p[J];(c[m]===1&&(!M&&X||M&&V)||c[m]!==1&&(!M&&V||M&&X))&&(w=m==="x"?$:H)}const B={x:f.x+j.x,y:f.y+j.y},P={x:p.x+b.x,y:p.y+b.y},G=Math.max(Math.abs(B.x-w[0].x),Math.abs(P.x-w[0].x)),Q=Math.max(Math.abs(B.y-w[0].y),Math.abs(P.y-w[0].y));G>=Q?(_=(B.x+P.x)/2,k=w[0].y):(_=w[0].x,k=(B.y+P.y)/2)}return[[e,{x:f.x+j.x,y:f.y+j.y},...w,{x:p.x+b.x,y:p.y+b.y},n],_,k,C,T]}function kP(e,t,n,r){const a=Math.min(T1(e,t)/2,T1(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 jx({sourceX:e,sourceY:t,sourcePosition:n=Ve.Bottom,targetX:r,targetY:a,targetPosition:l=Ve.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[h,m,y,w,_]=bP({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:l,center:{x:u,y:f},offset:p});return[h.reduce((j,b,S)=>{let E="";return S>0&&S<h.length-1?E=kP(h[S-1],b,h[S+1],c):E=`${S===0?"M":"L"}${b.x} ${b.y}`,j+=E,j},""),m,y,w,_]}const kh=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=Ve.Bottom,targetPosition:y=Ve.Top,markerEnd:w,markerStart:_,pathOptions:k,interactionWidth:j})=>{const[b,S,E]=jx({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 me.createElement(Gc,{path:b,labelX:S,labelY:E,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:_,interactionWidth:j})});kh.displayName="SmoothStepEdge";const p0=x.memo(e=>{var t;return me.createElement(kh,{...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])})});p0.displayName="StepEdge";function NP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,c,u]=rA({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,c,u]}const m0=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[_,k,j]=NP({sourceX:e,sourceY:t,targetX:n,targetY:r});return me.createElement(Gc,{path:_,labelX:k,labelY:j,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})});m0.displayName="StraightEdge";function wd(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 Ve.Left:return[t-wd(t-r,l),n];case Ve.Right:return[t+wd(r-t,l),n];case Ve.Top:return[t,n-wd(n-a,l)];case Ve.Bottom:return[t,n+wd(a-n,l)]}}function g0({sourceX:e,sourceY:t,sourcePosition:n=Ve.Bottom,targetX:r,targetY:a,targetPosition:l=Ve.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,_]=sA({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,_]}const th=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a=Ve.Bottom,targetPosition:l=Ve.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:_,pathOptions:k,interactionWidth:j})=>{const[b,S,E]=g0({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:l,curvature:k==null?void 0:k.curvature});return me.createElement(Gc,{path:b,labelX:S,labelY:E,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:_,interactionWidth:j})});th.displayName="BezierEdge";const y0=x.createContext(null),_P=y0.Provider;y0.Consumer;const SP=()=>x.useContext(y0),jP=e=>"id"in e&&"source"in e&&"target"in e,EP=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,Ex=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,CP=(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)),TP=(e,t)=>{if(!e.source||!e.target)return t;let n;return jP(e)?n={...e}:n={...e,id:EP(e)},CP(n,t)?t:t.concat(n)},Cx=({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},oA=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r}),Mo=(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}},Nh=(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}=Mo(a,t).positionAbsolute;return J2(r,Mc({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 eA(n)},iA=(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:_=!1}=h;if(c&&!w||_)return!1;const{positionAbsolute:k}=Mo(h,u),j={x:k.x,y:k.y,width:m||0,height:y||0},b=_x(f,j),S=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&b>0,C=(m||0)*(y||0);(S||E||b>=C||h.dragging)&&p.push(h)}),p},lA=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},cA=(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=Ji(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}},Eo=(e,t=0)=>e.transition().duration(t);function R1(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 AP(e,t,n,r,a,l){const{x:c,y:u}=Ia(e),p=t.elementsFromPoint(c,u).find(_=>_.classList.contains("react-flow__handle"));if(p){const _=p.getAttribute("data-nodeid");if(_){const k=w0(void 0,p),j=p.getAttribute("data-handleid"),b=l({nodeId:_,id:j,type:k});if(b){const S=a.find(E=>E.nodeId===_&&E.type===k&&E.id===j);return{handle:{id:j,type:k,nodeId:_,x:(S==null?void 0:S.x)||n.x,y:(S==null?void 0:S.y)||n.y},validHandleResult:b}}}}let h=[],m=1/0;if(a.forEach(_=>{const k=Math.sqrt((_.x-n.x)**2+(_.y-n.y)**2);if(k<=r){const j=l(_);k<=m&&(k<m?h=[{handle:_,validHandleResult:j}]:k===m&&h.push({handle:_,validHandleResult:j}),m=k)}}),!h.length)return{handle:null,validHandleResult:uA()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:_})=>_.isValid),w=h.some(({handle:_})=>_.type==="target");return h.find(({handle:_,validHandleResult:k})=>w?_.type==="target":y?k.isValid:!0)||h[0]}const RP={source:null,target:null,sourceHandle:null,targetHandle:null},uA=()=>({handleDomNode:null,isValid:!1,connection:RP,endHandle:null});function dA(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={...uA(),handleDomNode:f};if(f){const h=w0(void 0,f),m=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),_=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&&_&&(t===Po.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 MP({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((a,l)=>{if(l[Dt]){const{handleBounds:c}=l[Dt];let u=[],f=[];c&&(u=R1(l,c,"source",`${t}-${n}-${r}`),f=R1(l,c,"target",`${t}-${n}-${r}`)),a.push(...u,...f)}return a},[])}function w0(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Np(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function IP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function hA({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:a,getState:l,setState:c,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const h=Q2(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:_,onConnectStart:k,panBy:j,getNodes:b,cancelConnection:S}=l();let E=0,C;const{x:T,y:R}=Ia(e),$=h==null?void 0:h.elementFromPoint(T,R),H=w0(f,$),B=y==null?void 0:y.getBoundingClientRect();if(!B||!H)return;let P,G=Ia(e,B),Q=!1,J=null,M=!1,X=null;const V=MP({nodes:b(),nodeId:n,handleId:t,handleType:H}),I=()=>{if(!w)return;const[K,F]=Z2(G,B);j({x:K,y:F}),E=requestAnimationFrame(I)};c({connectionPosition:G,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:H,connectionStartHandle:{nodeId:n,handleId:t,type:H},connectionEndHandle:null}),k==null||k(e,{nodeId:n,handleId:t,handleType:H});function q(K){const{transform:F}=l();G=Ia(K,B);const{handle:D,validHandleResult:ae}=AP(K,h,Cx(G,F,!1,[1,1]),_,V,z=>dA(z,m,n,t,a?"target":"source",u,h));if(C=D,Q||(I(),Q=!0),X=ae.handleDomNode,J=ae.connection,M=ae.isValid,c({connectionPosition:C&&M?oA({x:C.x,y:C.y},F):G,connectionStatus:IP(!!C,M),connectionEndHandle:ae.endHandle}),!C&&!M&&!X)return Np(P);J.source!==J.target&&X&&(Np(P),P=X,X.classList.add("connecting","react-flow__handle-connecting"),X.classList.toggle("valid",M),X.classList.toggle("react-flow__handle-valid",M))}function W(K){var F,D;(C||X)&&J&&M&&(r==null||r(J)),(D=(F=l()).onConnectEnd)==null||D.call(F,K),f&&(p==null||p(K)),Np(P),S(),cancelAnimationFrame(E),Q=!1,M=!1,J=null,X=null,h.removeEventListener("mousemove",q),h.removeEventListener("mouseup",W),h.removeEventListener("touchmove",q),h.removeEventListener("touchend",W)}h.addEventListener("mousemove",q),h.addEventListener("mouseup",W),h.addEventListener("touchmove",q),h.addEventListener("touchend",W)}const M1=()=>!0,$P=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),OP=(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}},fA=x.forwardRef(({type:e="source",position:t=Ve.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 B,P;const _=c||null,k=e==="target",j=Vt(),b=SP(),{connectOnClick:S,noPanClassName:E}=pt($P,rn),{connecting:C,clickConnecting:T}=pt(OP(b,_,e),rn);b||(P=(B=j.getState()).onError)==null||P.call(B,"010",qs.error010());const R=G=>{const{defaultEdgeOptions:Q,onConnect:J,hasDefaultEdges:M}=j.getState(),X={...Q,...G};if(M){const{edges:V,setEdges:I}=j.getState();I(TP(X,V))}J==null||J(X),u==null||u(X)},$=G=>{if(!b)return;const Q=nA(G);a&&(Q&&G.button===0||!Q)&&hA({event:G,handleId:_,nodeId:b,onConnect:R,isTarget:k,getState:j.getState,setState:j.setState,isValidConnection:n||j.getState().isValidConnection||M1}),Q?h==null||h(G):m==null||m(G)},H=G=>{const{onClickConnectStart:Q,onClickConnectEnd:J,connectionClickStartHandle:M,connectionMode:X,isValidConnection:V}=j.getState();if(!b||!M&&!a)return;if(!M){Q==null||Q(G,{nodeId:b,handleId:_,handleType:e}),j.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:_}});return}const I=Q2(G.target),q=n||V||M1,{connection:W,isValid:K}=dA({nodeId:b,id:_,type:e},X,M.nodeId,M.handleId||null,M.type,q,I);K&&R(W),J==null||J(G),j.setState({connectionClickStartHandle:null})};return me.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${_}-${e}`,className:gn(["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:S?H:void 0,ref:w,...y},f)});fA.displayName="Handle";var Lo=x.memo(fA);const pA=({data:e,isConnectable:t,targetPosition:n=Ve.Top,sourcePosition:r=Ve.Bottom})=>me.createElement(me.Fragment,null,me.createElement(Lo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,me.createElement(Lo,{type:"source",position:r,isConnectable:t}));pA.displayName="DefaultNode";var Tx=x.memo(pA);const mA=({data:e,isConnectable:t,sourcePosition:n=Ve.Bottom})=>me.createElement(me.Fragment,null,e==null?void 0:e.label,me.createElement(Lo,{type:"source",position:n,isConnectable:t}));mA.displayName="InputNode";var gA=x.memo(mA);const yA=({data:e,isConnectable:t,targetPosition:n=Ve.Top})=>me.createElement(me.Fragment,null,me.createElement(Lo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);yA.displayName="OutputNode";var wA=x.memo(yA);const v0=()=>null;v0.displayName="GroupNode";const PP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),vd=e=>e.id;function LP(e,t){return rn(e.selectedNodes.map(vd),t.selectedNodes.map(vd))&&rn(e.selectedEdges.map(vd),t.selectedEdges.map(vd))}const vA=x.memo(({onSelectionChange:e})=>{const t=Vt(),{selectedNodes:n,selectedEdges:r}=pt(PP,LP);return x.useEffect(()=>{const a={nodes:n,edges:r};e==null||e(a),t.getState().onSelectionChange.forEach(l=>l(a))},[n,r,e]),null});vA.displayName="SelectionListener";const DP=e=>!!e.onSelectionChange;function FP({onSelectionChange:e}){const t=pt(DP);return e||t?me.createElement(vA,{onSelectionChange:e}):null}const qP=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 Ai(e,t){x.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function at(e,t,n){x.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const BP=({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:_,minZoom:k,maxZoom:j,nodeExtent:b,onNodesChange:S,onEdgesChange:E,elementsSelectable:C,connectionMode:T,snapGrid:R,snapToGrid:$,translateExtent:H,connectOnClick:B,defaultEdgeOptions:P,fitView:G,fitViewOptions:Q,onNodesDelete:J,onEdgesDelete:M,onNodeDrag:X,onNodeDragStart:V,onNodeDragStop:I,onSelectionDrag:q,onSelectionDragStart:W,onSelectionDragStop:K,noPanClassName:F,nodeOrigin:D,rfId:ae,autoPanOnConnect:z,autoPanOnNodeDrag:Z,onError:U,connectionRadius:re,isValidConnection:de,nodeDragThreshold:ge})=>{const{setNodes:pe,setEdges:_e,setDefaultNodesAndEdges:Pe,setMinZoom:$e,setMaxZoom:Te,setTranslateExtent:je,setNodeExtent:et,reset:Ce}=pt(qP,rn),Ne=Vt();return x.useEffect(()=>{const He=r==null?void 0:r.map(it=>({...it,...P}));return Pe(n,He),()=>{Ce()}},[]),at("defaultEdgeOptions",P,Ne.setState),at("connectionMode",T,Ne.setState),at("onConnect",a,Ne.setState),at("onConnectStart",l,Ne.setState),at("onConnectEnd",c,Ne.setState),at("onClickConnectStart",u,Ne.setState),at("onClickConnectEnd",f,Ne.setState),at("nodesDraggable",p,Ne.setState),at("nodesConnectable",h,Ne.setState),at("nodesFocusable",m,Ne.setState),at("edgesFocusable",y,Ne.setState),at("edgesUpdatable",w,Ne.setState),at("elementsSelectable",C,Ne.setState),at("elevateNodesOnSelect",_,Ne.setState),at("snapToGrid",$,Ne.setState),at("snapGrid",R,Ne.setState),at("onNodesChange",S,Ne.setState),at("onEdgesChange",E,Ne.setState),at("connectOnClick",B,Ne.setState),at("fitViewOnInit",G,Ne.setState),at("fitViewOnInitOptions",Q,Ne.setState),at("onNodesDelete",J,Ne.setState),at("onEdgesDelete",M,Ne.setState),at("onNodeDrag",X,Ne.setState),at("onNodeDragStart",V,Ne.setState),at("onNodeDragStop",I,Ne.setState),at("onSelectionDrag",q,Ne.setState),at("onSelectionDragStart",W,Ne.setState),at("onSelectionDragStop",K,Ne.setState),at("noPanClassName",F,Ne.setState),at("nodeOrigin",D,Ne.setState),at("rfId",ae,Ne.setState),at("autoPanOnConnect",z,Ne.setState),at("autoPanOnNodeDrag",Z,Ne.setState),at("onError",U,Ne.setState),at("connectionRadius",re,Ne.setState),at("isValidConnection",de,Ne.setState),at("nodeDragThreshold",ge,Ne.setState),Ai(e,pe),Ai(t,_e),Ai(k,$e),Ai(j,Te),Ai(H,je),Ai(b,et),null},I1={display:"none"},zP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},xA="react-flow__node-desc",bA="react-flow__edge-desc",HP="react-flow__aria-live",WP=e=>e.ariaLiveMessage;function UP({rfId:e}){const t=pt(WP);return me.createElement("div",{id:`${HP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:zP},t)}function VP({rfId:e,disableKeyboardA11y:t}){return me.createElement(me.Fragment,null,me.createElement("div",{id:`${xA}-${e}`,style:I1},"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."," "),me.createElement("div",{id:`${bA}-${e}`,style:I1},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&me.createElement(UP,{rfId:e}))}var $c=(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)&&Sx(w))return!1;const k=O1(w.code,u);l.current.add(w[k]),$1(c,l.current,!1)&&(w.preventDefault(),r(!0))},m=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&Sx(w))return!1;const k=O1(w.code,u);$1(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 $1(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function O1(e,t){return t.includes(e)?"code":"key"}function kA(e,t,n,r){var u,f;const a=e.parentNode||e.parentId;if(!a)return n;const l=t.get(a),c=Mo(l,r);return kA(l,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((u=l[Dt])==null?void 0:u.z)??0)>(n.z??0)?((f=l[Dt])==null?void 0:f.z)??0:n.z??0},r)}function NA(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}=kA(r,e,{...r.position,z:((l=r[Dt])==null?void 0:l.z)??0},t);r.positionAbsolute={x:c,y:u},r[Dt].z=f,n!=null&&n[r.id]&&(r[Dt].isParent=!0)}})}function _p(e,t,n,r){const a=new Map,l={},c=r?1e3:0;return e.forEach(u=>{var w;const f=(wr(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,Dt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[Dt])==null?void 0:w.handleBounds,z:f}}),a.set(u.id,h)}),NA(a,n,l),a}function _A(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().filter(j=>{var S;const b=t.includeHiddenNodes?j.width&&j.height:!j.hidden;return(S=t.nodes)!=null&&S.length?b&&t.nodes.some(E=>E.id===j.id):b}),k=_.every(j=>j.width&&j.height);if(_.length>0&&k){const j=Nh(_,m),{x:b,y:S,zoom:E}=cA(j,r,a,t.minZoom??l,t.maxZoom??c,t.padding??.1),C=Ds.translate(b,S).scale(E);return typeof t.duration=="number"&&t.duration>0?u.transform(Eo(f,t.duration),C):u.transform(f,C),!0}}return!1}function GP(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Dt]:r[Dt],selected:n.selected})}),new Map(t)}function KP(e,t){return t.map(n=>{const r=e.find(a=>a.id===n.id);return r&&(n.selected=r.selected),n})}function xd({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:GP(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&r({edges:KP(t,l)}),u==null||u(t))}const Ri=()=>{},YP={zoomIn:Ri,zoomOut:Ri,zoomTo:Ri,getZoom:()=>1,setViewport:Ri,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ri,fitBounds:Ri,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},XP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),ZP=()=>{const e=Vt(),{d3Zoom:t,d3Selection:n}=pt(XP,rn);return x.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(Eo(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(Eo(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,l)=>t.scaleTo(Eo(n,l==null?void 0:l.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,l)=>{const[c,u,f]=e.getState().transform,p=Ds.translate(a.x??c,a.y??u).scale(a.zoom??f);t.transform(Eo(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=>_A(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=Ds.translate(m,y).scale(h);t.transform(Eo(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}=cA(a,c,u,f,p,(l==null?void 0:l.padding)??.1),w=Ds.translate(h,m).scale(y);t.transform(Eo(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"),Cx(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 Cx(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=oA(a,l);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:YP,[t,n])};function _h(){const e=ZP(),t=Vt(),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(j=>({...j}))},[]),l=x.useCallback(k=>{const{edges:j=[]}=t.getState();return j.find(b=>b.id===k)},[]),c=x.useCallback(k=>{const{getNodes:j,setNodes:b,hasDefaultNodes:S,onNodesChange:E}=t.getState(),C=j(),T=typeof k=="function"?k(C):k;if(S)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:j=[],setEdges:b,hasDefaultEdges:S,onEdgesChange:E}=t.getState(),C=typeof k=="function"?k(j):k;if(S)b(C);else if(E){const T=C.length===0?j.map(R=>({type:"remove",id:R.id})):C.map(R=>({item:R,type:"reset"}));E(T)}},[]),f=x.useCallback(k=>{const j=Array.isArray(k)?k:[k],{getNodes:b,setNodes:S,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const R=[...b(),...j];S(R)}else if(C){const T=j.map(R=>({item:R,type:"add"}));C(T)}},[]),p=x.useCallback(k=>{const j=Array.isArray(k)?k:[k],{edges:b=[],setEdges:S,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)S([...b,...j]);else if(C){const T=j.map(R=>({item:R,type:"add"}));C(T)}},[]),h=x.useCallback(()=>{const{getNodes:k,edges:j=[],transform:b}=t.getState(),[S,E,C]=b;return{nodes:k().map(T=>({...T})),edges:j.map(T=>({...T})),viewport:{x:S,y:E,zoom:C}}},[]),m=x.useCallback(({nodes:k,edges:j})=>{const{nodeInternals:b,getNodes:S,edges:E,hasDefaultNodes:C,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:$,onNodesChange:H,onEdgesChange:B}=t.getState(),P=(k||[]).map(X=>X.id),G=(j||[]).map(X=>X.id),Q=S().reduce((X,V)=>{const I=V.parentNode||V.parentId,q=!P.includes(V.id)&&I&&X.find(K=>K.id===I);return(typeof V.deletable=="boolean"?V.deletable:!0)&&(P.includes(V.id)||q)&&X.push(V),X},[]),J=E.filter(X=>typeof X.deletable=="boolean"?X.deletable:!0),M=J.filter(X=>G.includes(X.id));if(Q||M){const X=lA(Q,J),V=[...M,...X],I=V.reduce((q,W)=>(q.includes(W.id)||q.push(W.id),q),[]);if((T||C)&&(T&&t.setState({edges:E.filter(q=>!I.includes(q.id))}),C&&(Q.forEach(q=>{b.delete(q.id)}),t.setState({nodeInternals:new Map(b)}))),I.length>0&&($==null||$(V),B&&B(I.map(q=>({id:q,type:"remove"})))),Q.length>0&&(R==null||R(Q),H)){const q=Q.map(W=>({id:W.id,type:"remove"}));H(q)}}},[]),y=x.useCallback(k=>{const j=yP(k),b=j?null:t.getState().nodeInternals.get(k.id);return!j&&!b?[null,null,j]:[j?k:j1(b),b,j]},[]),w=x.useCallback((k,j=!0,b)=>{const[S,E,C]=y(k);return S?(b||t.getState().getNodes()).filter(T=>{if(!C&&(T.id===E.id||!T.positionAbsolute))return!1;const R=j1(T),$=_x(R,S);return j&&$>0||$>=S.width*S.height}):[]},[]),_=x.useCallback((k,j,b=!0)=>{const[S]=y(k);if(!S)return!1;const E=_x(S,j);return b&&E>0||E>=S.width*S.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:_}),[e,n,r,a,l,c,u,f,p,h,m,w,_])}const QP={actInsideInputWithModifier:!1};var JP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Vt(),{deleteElements:r}=_h(),a=$c(e,QP),l=$c(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 eL(e){const t=Vt();x.useEffect(()=>{let n;const r=()=>{var l,c;if(!e.current)return;const a=d0(e.current);(a.height===0||a.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",qs.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 x0={position:"absolute",width:"100%",height:"100%",top:0,left:0},tL=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,bd=e=>({x:e.x,y:e.y,zoom:e.k}),Mi=(e,t)=>e.target.closest(`.${t}`),P1=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),L1=e=>{const t=e.ctrlKey&&Jd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},nL=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),rL=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:a=!0,zoomOnPinch:l=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=Ao.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:_,maxZoom:k,zoomActivationKeyCode:j,preventScrolling:b=!0,children:S,noWheelClassName:E,noPanClassName:C})=>{const T=x.useRef(),R=Vt(),$=x.useRef(!1),H=x.useRef(!1),B=x.useRef(null),P=x.useRef({x:0,y:0,zoom:0}),{d3Zoom:G,d3Selection:Q,d3ZoomHandler:J,userSelectionActive:M}=pt(nL,rn),X=$c(j),V=x.useRef(0),I=x.useRef(!1),q=x.useRef();return eL(B),x.useEffect(()=>{if(B.current){const W=B.current.getBoundingClientRect(),K=Y2().scaleExtent([_,k]).translateExtent(w),F=yr(B.current).call(K),D=Ds.translate(y.x,y.y).scale(Ji(y.zoom,_,k)),ae=[[0,0],[W.width,W.height]],z=K.constrain()(D,ae,w);K.transform(F,z),K.wheelDelta(L1),R.setState({d3Zoom:K,d3Selection:F,d3ZoomHandler:F.on("wheel.zoom"),transform:[z.x,z.y,z.k],domNode:B.current.closest(".react-flow")})}},[]),x.useEffect(()=>{Q&&G&&(c&&!X&&!M?Q.on("wheel.zoom",W=>{if(Mi(W,E))return!1;W.preventDefault(),W.stopImmediatePropagation();const K=Q.property("__zoom").k||1;if(W.ctrlKey&&l){const de=Fr(W),ge=L1(W),pe=K*Math.pow(2,ge);G.scaleTo(Q,pe,de,W);return}const F=W.deltaMode===1?20:1;let D=f===Ao.Vertical?0:W.deltaX*F,ae=f===Ao.Horizontal?0:W.deltaY*F;!Jd()&&W.shiftKey&&f!==Ao.Vertical&&(D=W.deltaY*F,ae=0),G.translateBy(Q,-(D/K)*u,-(ae/K)*u,{internal:!0});const z=bd(Q.property("__zoom")),{onViewportChangeStart:Z,onViewportChange:U,onViewportChangeEnd:re}=R.getState();clearTimeout(q.current),I.current||(I.current=!0,t==null||t(W,z),Z==null||Z(z)),I.current&&(e==null||e(W,z),U==null||U(z),q.current=setTimeout(()=>{n==null||n(W,z),re==null||re(z),I.current=!1},150))},{passive:!1}):typeof J<"u"&&Q.on("wheel.zoom",function(W,K){if(!b&&W.type==="wheel"&&!W.ctrlKey||Mi(W,E))return null;W.preventDefault(),J.call(this,W,K)},{passive:!1}))},[M,c,f,Q,G,J,X,l,b,E,t,e,n]),x.useEffect(()=>{G&&G.on("start",W=>{var D,ae;if(!W.sourceEvent||W.sourceEvent.internal)return null;V.current=(D=W.sourceEvent)==null?void 0:D.button;const{onViewportChangeStart:K}=R.getState(),F=bd(W.transform);$.current=!0,P.current=F,((ae=W.sourceEvent)==null?void 0:ae.type)==="mousedown"&&R.setState({paneDragging:!0}),K==null||K(F),t==null||t(W.sourceEvent,F)})},[G,t]),x.useEffect(()=>{G&&(M&&!$.current?G.on("zoom",null):M||G.on("zoom",W=>{var F;const{onViewportChange:K}=R.getState();if(R.setState({transform:[W.transform.x,W.transform.y,W.transform.k]}),H.current=!!(r&&P1(m,V.current??0)),(e||K)&&!((F=W.sourceEvent)!=null&&F.internal)){const D=bd(W.transform);K==null||K(D),e==null||e(W.sourceEvent,D)}}))},[M,G,e,m,r]),x.useEffect(()=>{G&&G.on("end",W=>{if(!W.sourceEvent||W.sourceEvent.internal)return null;const{onViewportChangeEnd:K}=R.getState();if($.current=!1,R.setState({paneDragging:!1}),r&&P1(m,V.current??0)&&!H.current&&r(W.sourceEvent),H.current=!1,(n||K)&&tL(P.current,W.transform)){const F=bd(W.transform);P.current=F,clearTimeout(T.current),T.current=setTimeout(()=>{K==null||K(F),n==null||n(W.sourceEvent,F)},c?150:0)}})},[G,c,m,n,r]),x.useEffect(()=>{G&&G.filter(W=>{const K=X||a,F=l&&W.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&W.button===1&&W.type==="mousedown"&&(Mi(W,"react-flow__node")||Mi(W,"react-flow__edge")))return!0;if(!m&&!K&&!c&&!p&&!l||M||!p&&W.type==="dblclick"||Mi(W,E)&&W.type==="wheel"||Mi(W,C)&&(W.type!=="wheel"||c&&W.type==="wheel"&&!X)||!l&&W.ctrlKey&&W.type==="wheel"||!K&&!c&&!F&&W.type==="wheel"||!m&&(W.type==="mousedown"||W.type==="touchstart")||Array.isArray(m)&&!m.includes(W.button)&&W.type==="mousedown")return!1;const D=Array.isArray(m)&&m.includes(W.button)||!W.button||W.button<=1;return(!W.ctrlKey||W.type==="wheel")&&D})},[M,G,a,l,c,p,m,h,X]),me.createElement("div",{className:"react-flow__renderer",ref:B,style:x0},S)},sL=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function aL(){const{userSelectionActive:e,userSelectionRect:t}=pt(sL,rn);return e&&t?me.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 D1(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 oL(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&&D1(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&&D1(r,c);break}case"remove":return r}return r.push(c),r},n)}function iL(e,t){return oL(e,t)}const Ca=(e,t)=>({id:e,type:"select",selected:t});function Bi(e,t){return e.reduce((n,r)=>{const a=t.includes(r.id);return!r.selected&&a?(r.selected=!0,n.push(Ca(r.id,!0))):r.selected&&!a&&(r.selected=!1,n.push(Ca(r.id,!1))),n},[])}const Sp=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},lL=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),SA=x.memo(({isSelecting:e,selectionMode:t=Ic.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=Vt(),_=x.useRef(0),k=x.useRef(0),j=x.useRef(),{userSelectionActive:b,elementsSelectable:S,dragging:E}=pt(lL,rn),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,k.current=0},T=J=>{l==null||l(J),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=J=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){J.preventDefault();return}c==null||c(J)},$=u?J=>u(J):void 0,H=J=>{const{resetSelectedElements:M,domNode:X}=w.getState();if(j.current=X==null?void 0:X.getBoundingClientRect(),!S||!e||J.button!==0||J.target!==y.current||!j.current)return;const{x:V,y:I}=Ia(J,j.current);M(),w.setState({userSelectionRect:{width:0,height:0,startX:V,startY:I,x:V,y:I}}),r==null||r(J)},B=J=>{const{userSelectionRect:M,nodeInternals:X,edges:V,transform:I,onNodesChange:q,onEdgesChange:W,nodeOrigin:K,getNodes:F}=w.getState();if(!e||!j.current||!M)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const D=Ia(J,j.current),ae=M.startX??0,z=M.startY??0,Z={...M,x:D.x<ae?D.x:ae,y:D.y<z?D.y:z,width:Math.abs(D.x-ae),height:Math.abs(D.y-z)},U=F(),re=iA(X,Z,I,t===Ic.Partial,!0,K),de=lA(re,V).map(pe=>pe.id),ge=re.map(pe=>pe.id);if(_.current!==ge.length){_.current=ge.length;const pe=Bi(U,ge);pe.length&&(q==null||q(pe))}if(k.current!==de.length){k.current=de.length;const pe=Bi(V,de);pe.length&&(W==null||W(pe))}w.setState({userSelectionRect:Z})},P=J=>{if(J.button!==0)return;const{userSelectionRect:M}=w.getState();!b&&M&&J.target===y.current&&(T==null||T(J)),w.setState({nodesSelectionActive:_.current>0}),C(),a==null||a(J)},G=J=>{b&&(w.setState({nodesSelectionActive:_.current>0}),a==null||a(J)),C()},Q=S&&(e||b);return me.createElement("div",{className:gn(["react-flow__pane",{dragging:E,selection:e}]),onClick:Q?void 0:Sp(T,y),onContextMenu:Sp(R,y),onWheel:Sp($,y),onMouseEnter:Q?void 0:f,onMouseDown:Q?H:void 0,onMouseMove:Q?B:p,onMouseUp:Q?P:void 0,onMouseLeave:Q?G:h,ref:y,style:x0},m,me.createElement(aL,null))});SA.displayName="Pane";function jA(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:jA(r,t):!1}function F1(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 cL(e,t,n,r){return Array.from(e.values()).filter(a=>(a.selected||a.id===r)&&(!a.parentNode||a.parentId||!jA(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 uL(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function EA(e,t,n,r,a=[0,0],l){const c=uL(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}=Mo(m,a).positionAbsolute;u=m&&wr(y)&&wr(w)&&wr(m.width)&&wr(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",qs.error005()),u=c;else if(e.extent&&f&&e.extent!=="parent"){const m=n.get(f),{x:y,y:w}=Mo(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=Mo(m,a).positionAbsolute}const h=u&&u!=="parent"?h0(t,u):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function jp({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 q1=(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,...d0(f)}})};function dc(e,t,n){return n===void 0?n:r=>{const a=t().nodeInternals.get(e);a&&n(r,{...a})}}function Ax({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",qs.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 dL(){const e=Vt();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 Ep(e){return(t,n,r)=>e==null?void 0:e(t,r)}function CA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,selectNodesOnDrag:c}){const u=Vt(),[f,p]=x.useState(!1),h=x.useRef([]),m=x.useRef({x:null,y:null}),y=x.useRef(0),w=x.useRef(null),_=x.useRef({x:0,y:0}),k=x.useRef(null),j=x.useRef(!1),b=x.useRef(!1),S=x.useRef(!1),E=dL();return x.useEffect(()=>{if(e!=null&&e.current){const C=yr(e.current),T=({x:H,y:B})=>{const{nodeInternals:P,onNodeDrag:G,onSelectionDrag:Q,updateNodePositions:J,nodeExtent:M,snapGrid:X,snapToGrid:V,nodeOrigin:I,onError:q}=u.getState();m.current={x:H,y:B};let W=!1,K={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&M){const D=Nh(h.current,I);K=Mc(D)}if(h.current=h.current.map(D=>{const ae={x:H-D.distance.x,y:B-D.distance.y};V&&(ae.x=X[0]*Math.round(ae.x/X[0]),ae.y=X[1]*Math.round(ae.y/X[1]));const z=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];h.current.length>1&&M&&!D.extent&&(z[0][0]=D.positionAbsolute.x-K.x+M[0][0],z[1][0]=D.positionAbsolute.x+(D.width??0)-K.x2+M[1][0],z[0][1]=D.positionAbsolute.y-K.y+M[0][1],z[1][1]=D.positionAbsolute.y+(D.height??0)-K.y2+M[1][1]);const Z=EA(D,ae,P,z,I,q);return W=W||D.position.x!==Z.position.x||D.position.y!==Z.position.y,D.position=Z.position,D.positionAbsolute=Z.positionAbsolute,D}),!W)return;J(h.current,!0,!0),p(!0);const F=a?G:Ep(Q);if(F&&k.current){const[D,ae]=jp({nodeId:a,dragItems:h.current,nodeInternals:P});F(k.current,D,ae)}},R=()=>{if(!w.current)return;const[H,B]=Z2(_.current,w.current);if(H!==0||B!==0){const{transform:P,panBy:G}=u.getState();m.current.x=(m.current.x??0)-H/P[2],m.current.y=(m.current.y??0)-B/P[2],G({x:H,y:B})&&T(m.current)}y.current=requestAnimationFrame(R)},$=H=>{var I;const{nodeInternals:B,multiSelectionActive:P,nodesDraggable:G,unselectNodesAndEdges:Q,onNodeDragStart:J,onSelectionDragStart:M}=u.getState();b.current=!0;const X=a?J:Ep(M);(!c||!l)&&!P&&a&&((I=B.get(a))!=null&&I.selected||Q()),a&&l&&c&&Ax({id:a,store:u,nodeRef:e});const V=E(H);if(m.current=V,h.current=cL(B,G,V,a),X&&h.current){const[q,W]=jp({nodeId:a,dragItems:h.current,nodeInternals:B});X(H.sourceEvent,q,W)}};if(t)C.on(".drag",null);else{const H=bO().on("start",B=>{const{domNode:P,nodeDragThreshold:G}=u.getState();G===0&&$(B),S.current=!1;const Q=E(B);m.current=Q,w.current=(P==null?void 0:P.getBoundingClientRect())||null,_.current=Ia(B.sourceEvent,w.current)}).on("drag",B=>{var J,M;const P=E(B),{autoPanOnNodeDrag:G,nodeDragThreshold:Q}=u.getState();if(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1&&(S.current=!0),!S.current){if(!j.current&&b.current&&G&&(j.current=!0,R()),!b.current){const X=P.xSnapped-(((J=m==null?void 0:m.current)==null?void 0:J.x)??0),V=P.ySnapped-(((M=m==null?void 0:m.current)==null?void 0:M.y)??0);Math.sqrt(X*X+V*V)>Q&&$(B)}(m.current.x!==P.xSnapped||m.current.y!==P.ySnapped)&&h.current&&b.current&&(k.current=B.sourceEvent,_.current=Ia(B.sourceEvent,w.current),T(P))}}).on("end",B=>{if(!(!b.current||S.current)&&(p(!1),j.current=!1,b.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:P,nodeInternals:G,onNodeDragStop:Q,onSelectionDragStop:J}=u.getState(),M=a?Q:Ep(J);if(P(h.current,!1,!1),M){const[X,V]=jp({nodeId:a,dragItems:h.current,nodeInternals:G});M(B.sourceEvent,X,V)}}}).filter(B=>{const P=B.target;return!B.button&&(!n||!F1(P,`.${n}`,e))&&(!r||F1(P,r,e))});return C.call(H),()=>{C.on(".drag",null)}}}},[e,t,n,r,l,u,a,c,E]),f}function TA(){const e=Vt();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(S=>S.selected&&(S.draggable||h&&typeof S.draggable>"u")),y=u?f[0]:5,w=u?f[1]:5,_=n.isShiftPressed?4:1,k=n.x*y*_,j=n.y*w*_,b=m.map(S=>{if(S.positionAbsolute){const E={x:S.positionAbsolute.x+k,y:S.positionAbsolute.y+j};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}=EA(S,E,r,a,void 0,p);S.position=T,S.positionAbsolute=C}return S});l(b,!0,!1)},[])}const Ki={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var hc=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:_,onDoubleClick:k,style:j,className:b,isDraggable:S,isSelectable:E,isConnectable:C,isFocusable:T,selectNodesOnDrag:R,sourcePosition:$,targetPosition:H,hidden:B,resizeObserver:P,dragHandle:G,zIndex:Q,isParent:J,noDragClassName:M,noPanClassName:X,initialized:V,disableKeyboardA11y:I,ariaLabel:q,rfId:W,hasHandleBounds:K})=>{const F=Vt(),D=x.useRef(null),ae=x.useRef(null),z=x.useRef($),Z=x.useRef(H),U=x.useRef(r),re=E||S||h||m||y||w,de=TA(),ge=dc(n,F.getState,m),pe=dc(n,F.getState,y),_e=dc(n,F.getState,w),Pe=dc(n,F.getState,_),$e=dc(n,F.getState,k),Te=Ce=>{const{nodeDragThreshold:Ne}=F.getState();if(E&&(!R||!S||Ne>0)&&Ax({id:n,store:F,nodeRef:D}),h){const He=F.getState().nodeInternals.get(n);He&&h(Ce,{...He})}},je=Ce=>{if(!Sx(Ce)&&!I)if(tA.includes(Ce.key)&&E){const Ne=Ce.key==="Escape";Ax({id:n,store:F,unselect:Ne,nodeRef:D})}else S&&p&&Object.prototype.hasOwnProperty.call(Ki,Ce.key)&&(F.setState({ariaLiveMessage:`Moved selected node ${Ce.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~c}`}),de({x:Ki[Ce.key].x,y:Ki[Ce.key].y,isShiftPressed:Ce.shiftKey}))};x.useEffect(()=>()=>{ae.current&&(P==null||P.unobserve(ae.current),ae.current=null)},[]),x.useEffect(()=>{if(D.current&&!B){const Ce=D.current;(!V||!K||ae.current!==Ce)&&(ae.current&&(P==null||P.unobserve(ae.current)),P==null||P.observe(Ce),ae.current=Ce)}},[B,V,K]),x.useEffect(()=>{const Ce=U.current!==r,Ne=z.current!==$,He=Z.current!==H;D.current&&(Ce||Ne||He)&&(Ce&&(U.current=r),Ne&&(z.current=$),He&&(Z.current=H),F.getState().updateNodeDimensions([{id:n,nodeElement:D.current,forceUpdate:!0}]))},[n,r,$,H]);const et=CA({nodeRef:D,disabled:B||!S,noDragClassName:M,handleSelector:G,nodeId:n,isSelectable:E,selectNodesOnDrag:R});return B?null:me.createElement("div",{className:gn(["react-flow__node",`react-flow__node-${r}`,{[X]:S},b,{selected:p,selectable:E,parent:J,dragging:et}]),ref:D,style:{zIndex:Q,transform:`translate(${u}px,${f}px)`,pointerEvents:re?"all":"none",visibility:V?"visible":"hidden",...j},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:ge,onMouseMove:pe,onMouseLeave:_e,onContextMenu:Pe,onClick:Te,onDoubleClick:$e,onKeyDown:T?je:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":I?void 0:`${xA}-${W}`,"aria-label":q},me.createElement(_P,{value:n},me.createElement(e,{id:n,data:a,type:r,xPos:l,yPos:c,selected:p,isConnectable:C,sourcePosition:$,targetPosition:H,dragging:et,dragHandle:G,zIndex:Q})))};return t.displayName="NodeWrapper",x.memo(t)};const hL=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Nh(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function fL({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Vt(),{width:a,height:l,x:c,y:u,transformString:f,userSelectionActive:p}=pt(hL,rn),h=TA(),m=x.useRef(null);if(x.useEffect(()=>{var _;n||(_=m.current)==null||_.focus({preventScroll:!0})},[n]),CA({nodeRef:m}),p||!a||!l)return null;const y=e?_=>{const k=r.getState().getNodes().filter(j=>j.selected);e(_,k)}:void 0,w=_=>{Object.prototype.hasOwnProperty.call(Ki,_.key)&&h({x:Ki[_.key].x,y:Ki[_.key].y,isShiftPressed:_.shiftKey})};return me.createElement("div",{className:gn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},me.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 pL=x.memo(fL);const mL=e=>e.nodesSelectionActive,AA=({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:_,onSelectionEnd:k,multiSelectionKeyCode:j,panActivationKeyCode:b,zoomActivationKeyCode:S,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:$,panOnScrollMode:H,zoomOnDoubleClick:B,panOnDrag:P,defaultViewport:G,translateExtent:Q,minZoom:J,maxZoom:M,preventScrolling:X,onSelectionContextMenu:V,noWheelClassName:I,noPanClassName:q,disableKeyboardA11y:W})=>{const K=pt(mL),F=$c(m),D=$c(b),ae=D||P,z=D||R,Z=F||y&&ae!==!0;return JP({deleteKeyCode:u,multiSelectionKeyCode:j}),me.createElement(rL,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:z,panOnScrollSpeed:$,panOnScrollMode:H,zoomOnDoubleClick:B,panOnDrag:!F&&ae,defaultViewport:G,translateExtent:Q,minZoom:J,maxZoom:M,zoomActivationKeyCode:S,preventScrolling:X,noWheelClassName:I,noPanClassName:q},me.createElement(SA,{onSelectionStart:_,onSelectionEnd:k,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:ae,isSelecting:!!Z,selectionMode:w},e,K&&me.createElement(pL,{onSelectionContextMenu:V,noPanClassName:q,disableKeyboardA11y:W})))};AA.displayName="FlowRenderer";var gL=x.memo(AA);function yL(e){return pt(x.useCallback(n=>e?iA(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function wL(e){const t={input:hc(e.input||gA),default:hc(e.default||Tx),output:hc(e.output||wA),group:hc(e.group||v0)},n={},r=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,l)=>(a[l]=hc(e[l]||Tx),a),n);return{...t,...r}}const vL=({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]},xL=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}=pt(xL,rn),u=yL(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()},[]),me.createElement("div",{className:"react-flow__nodes",style:x0},u.map(h=>{var T,R,$;let m=h.type||"default";e.nodeTypes[m]||(c==null||c("003",qs.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),_=!!(h.selectable||a&&typeof h.selectable>"u"),k=!!(h.connectable||n&&typeof h.connectable>"u"),j=!!(h.focusable||r&&typeof h.focusable>"u"),b=e.nodeExtent?h0(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,S=(b==null?void 0:b.x)??0,E=(b==null?void 0:b.y)??0,C=vL({x:S,y:E,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return me.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||Ve.Bottom,targetPosition:h.targetPosition||Ve.Top,hidden:h.hidden,xPos:S,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:_,isConnectable:k,isFocusable:j,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((T=h[Dt])==null?void 0:T.z)??0,isParent:!!((R=h[Dt])!=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[Dt])!=null&&$.handleBounds)})}))};RA.displayName="NodeRenderer";var bL=x.memo(RA);const kL=(e,t,n)=>n===Ve.Left?e-t:n===Ve.Right?e+t:e,NL=(e,t,n)=>n===Ve.Top?e-t:n===Ve.Bottom?e+t:e,B1="react-flow__edgeupdater",z1=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:c,type:u})=>me.createElement("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:c,className:gn([B1,`${B1}-${u}`]),cx:kL(t,r,e),cy:NL(n,r,e),r,stroke:"transparent",fill:"transparent"}),_L=()=>!0;var Ii=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:_,labelBgBorderRadius:k,style:j,source:b,target:S,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:$,targetPosition:H,elementsSelectable:B,hidden:P,sourceHandleId:G,targetHandleId:Q,onContextMenu:J,onMouseEnter:M,onMouseMove:X,onMouseLeave:V,reconnectRadius:I,onReconnect:q,onReconnectStart:W,onReconnectEnd:K,markerEnd:F,markerStart:D,rfId:ae,ariaLabel:z,isFocusable:Z,isReconnectable:U,pathOptions:re,interactionWidth:de,disableKeyboardA11y:ge})=>{const pe=x.useRef(null),[_e,Pe]=x.useState(!1),[$e,Te]=x.useState(!1),je=Vt(),et=x.useMemo(()=>`url('#${Ex(D,ae)}')`,[D,ae]),Ce=x.useMemo(()=>`url('#${Ex(F,ae)}')`,[F,ae]);if(P)return null;const Ne=ce=>{var Pt;const{edges:lt,addSelectedEdges:gt,unselectNodesAndEdges:mt,multiSelectionActive:Et}=je.getState(),Ot=lt.find(Kt=>Kt.id===n);Ot&&(B&&(je.setState({nodesSelectionActive:!1}),Ot.selected&&Et?(mt({nodes:[],edges:[Ot]}),(Pt=pe.current)==null||Pt.blur()):gt([n])),c&&c(ce,Ot))},He=uc(n,je.getState,u),it=uc(n,je.getState,J),ot=uc(n,je.getState,M),le=uc(n,je.getState,X),be=uc(n,je.getState,V),Re=(ce,lt)=>{if(ce.button!==0)return;const{edges:gt,isValidConnection:mt}=je.getState(),Et=lt?S:b,Ot=(lt?Q:G)||null,Pt=lt?"target":"source",Kt=mt||_L,jn=lt,_t=gt.find(Je=>Je.id===n);Te(!0),W==null||W(ce,_t,Pt);const Bt=Je=>{Te(!1),K==null||K(Je,_t,Pt)};hA({event:ce,handleId:Ot,nodeId:Et,onConnect:Je=>q==null?void 0:q(_t,Je),isTarget:jn,getState:je.getState,setState:je.setState,isValidConnection:Kt,edgeUpdaterType:Pt,onReconnectEnd:Bt})},Ze=ce=>Re(ce,!0),We=ce=>Re(ce,!1),tt=()=>Pe(!0),we=()=>Pe(!1),Me=!B&&!c,Qe=ce=>{var lt;if(!ge&&tA.includes(ce.key)&&B){const{unselectNodesAndEdges:gt,addSelectedEdges:mt,edges:Et}=je.getState();ce.key==="Escape"?((lt=pe.current)==null||lt.blur(),gt({edges:[Et.find(Pt=>Pt.id===n)]})):mt([n])}};return me.createElement("g",{className:gn(["react-flow__edge",`react-flow__edge-${a}`,r,{selected:f,animated:p,inactive:Me,updating:_e}]),onClick:Ne,onDoubleClick:He,onContextMenu:it,onMouseEnter:ot,onMouseMove:le,onMouseLeave:be,onKeyDown:Z?Qe:void 0,tabIndex:Z?0:void 0,role:Z?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":z===null?void 0:z||`Edge from ${b} to ${S}`,"aria-describedby":Z?`${bA}-${ae}`:void 0,ref:pe},!$e&&me.createElement(e,{id:n,source:b,target:S,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:_,labelBgBorderRadius:k,data:l,style:j,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:$,targetPosition:H,sourceHandleId:G,targetHandleId:Q,markerStart:et,markerEnd:Ce,pathOptions:re,interactionWidth:de}),U&&me.createElement(me.Fragment,null,(U==="source"||U===!0)&&me.createElement(z1,{position:$,centerX:E,centerY:C,radius:I,onMouseDown:Ze,onMouseEnter:tt,onMouseOut:we,type:"source"}),(U==="target"||U===!0)&&me.createElement(z1,{position:H,centerX:T,centerY:R,radius:I,onMouseDown:We,onMouseEnter:tt,onMouseOut:we,type:"target"})))};return t.displayName="EdgeWrapper",x.memo(t)};function SL(e){const t={default:Ii(e.default||th),straight:Ii(e.bezier||m0),step:Ii(e.step||p0),smoothstep:Ii(e.step||kh),simplebezier:Ii(e.simplebezier||f0)},n={},r=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,l)=>(a[l]=Ii(e[l]||th),a),n);return{...t,...r}}function H1(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 Ve.Top:return{x:r+l/2,y:a};case Ve.Right:return{x:r+l,y:a+c/2};case Ve.Bottom:return{x:r+l/2,y:a+c};case Ve.Left:return{x:r,y:a+c/2}}}function W1(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const jL=(e,t,n,r,a,l)=>{const c=H1(n,e,t),u=H1(l,r,a);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function EL({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=Mc({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 U1(e){var r,a,l,c,u;const t=((r=e==null?void 0:e[Dt])==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 CL=[{level:0,isMaxLevel:!0,edges:[]}];function TL(e,t,n=!1){let r=-1;const a=e.reduce((c,u)=>{var h,m;const f=wr(u.zIndex);let p=f?u.zIndex:0;if(n){const y=t.get(u.target),w=t.get(u.source),_=u.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),k=Math.max(((h=w==null?void 0:w[Dt])==null?void 0:h.z)||0,((m=y==null?void 0:y[Dt])==null?void 0:m.z)||0,1e3);p=(f?u.zIndex:0)+(_?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?CL:l}function AL(e,t,n){const r=pt(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)&&EL({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 TL(r,t,n)}const RL=({color:e="none",strokeWidth:t=1})=>me.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),ML=({color:e="none",strokeWidth:t=1})=>me.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),V1={[eh.Arrow]:RL,[eh.ArrowClosed]:ML};function IL(e){const t=Vt();return x.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(V1,e)?V1[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",qs.error009(e)),null)},[e])}const $L=({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=IL(t);return f?me.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"},me.createElement(f,{color:n,strokeWidth:c})):null},OL=({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=Ex(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))},MA=({defaultColor:e,rfId:t})=>{const n=pt(x.useCallback(OL({defaultColor:e,rfId:t}),[e,t]),(r,a)=>!(r.length!==a.length||r.some((l,c)=>l.id!==a[c].id)));return me.createElement("defs",null,n.map(r=>me.createElement($L,{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})))};MA.displayName="MarkerDefinitions";var PL=x.memo(MA);const LL=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}),IA=({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:_,reconnectRadius:k,children:j,disableKeyboardA11y:b})=>{const{edgesFocusable:S,edgesUpdatable:E,elementsSelectable:C,width:T,height:R,connectionMode:$,nodeInternals:H,onError:B}=pt(LL,rn),P=AL(t,H,n);return T?me.createElement(me.Fragment,null,P.map(({level:G,edges:Q,isMaxLevel:J})=>me.createElement("svg",{key:G,style:{zIndex:G},width:T,height:R,className:"react-flow__edges react-flow__container"},J&&me.createElement(PL,{defaultColor:e,rfId:r}),me.createElement("g",null,Q.map(M=>{const[X,V,I]=U1(H.get(M.source)),[q,W,K]=U1(H.get(M.target));if(!I||!K)return null;let F=M.type||"default";a[F]||(B==null||B("011",qs.error011(F)),F="default");const D=a[F]||a.default,ae=$===Po.Strict?W.target:(W.target??[]).concat(W.source??[]),z=W1(V.source,M.sourceHandle),Z=W1(ae,M.targetHandle),U=(z==null?void 0:z.position)||Ve.Bottom,re=(Z==null?void 0:Z.position)||Ve.Top,de=!!(M.focusable||S&&typeof M.focusable>"u"),ge=M.reconnectable||M.updatable,pe=typeof y<"u"&&(ge||E&&typeof ge>"u");if(!z||!Z)return B==null||B("008",qs.error008(z,M)),null;const{sourceX:_e,sourceY:Pe,targetX:$e,targetY:Te}=jL(X,z,U,q,Z,re);return me.createElement(D,{key:M.id,id:M.id,className:gn([M.className,l]),type:F,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:_e,sourceY:Pe,targetX:$e,targetY:Te,sourcePosition:U,targetPosition:re,elementsSelectable:C,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:_,reconnectRadius:k,rfId:r,ariaLabel:M.ariaLabel,isFocusable:de,isReconnectable:pe,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:b})})))),j):null};IA.displayName="EdgeRenderer";var DL=x.memo(IA);const FL=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function qL({children:e}){const t=pt(FL);return me.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function BL(e){const t=_h(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const zL={[Ve.Left]:Ve.Right,[Ve.Right]:Ve.Left,[Ve.Top]:Ve.Bottom,[Ve.Bottom]:Ve.Top},$A=({nodeId:e,handleType:t,style:n,type:r=Ta.Bezier,CustomComponent:a,connectionStatus:l})=>{var R,$,H;const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:h}=pt(x.useCallback(B=>({fromNode:B.nodeInternals.get(e),handleId:B.connectionHandleId,toX:(B.connectionPosition.x-B.transform[0])/B.transform[2],toY:(B.connectionPosition.y-B.transform[1])/B.transform[2],connectionMode:B.connectionMode}),[e]),rn),m=(R=c==null?void 0:c[Dt])==null?void 0:R.handleBounds;let y=m==null?void 0:m[t];if(h===Po.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const w=u?y.find(B=>B.id===u):y[0],_=w?w.x+w.width/2:(c.width??0)/2,k=w?w.y+w.height/2:c.height??0,j=((($=c.positionAbsolute)==null?void 0:$.x)??0)+_,b=(((H=c.positionAbsolute)==null?void 0:H.y)??0)+k,S=w==null?void 0:w.position,E=S?zL[S]:null;if(!S||!E)return null;if(a)return me.createElement(a,{connectionLineType:r,connectionLineStyle:n,fromNode:c,fromHandle:w,fromX:j,fromY:b,toX:f,toY:p,fromPosition:S,toPosition:E,connectionStatus:l});let C="";const T={sourceX:j,sourceY:b,sourcePosition:S,targetX:f,targetY:p,targetPosition:E};return r===Ta.Bezier?[C]=g0(T):r===Ta.Step?[C]=jx({...T,borderRadius:0}):r===Ta.SmoothStep?[C]=jx(T):r===Ta.SimpleBezier?[C]=aA(T):C=`M${j},${b} ${f},${p}`,me.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};$A.displayName="ConnectionLine";const HL=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function WL({containerStyle:e,style:t,type:n,component:r}){const{nodeId:a,handleType:l,nodesConnectable:c,width:u,height:f,connectionStatus:p}=pt(HL,rn);return!(a&&l&&u&&c)?null:me.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},me.createElement("g",{className:gn(["react-flow__connection",p])},me.createElement($A,{nodeId:a,handleType:l,style:t,type:n,CustomComponent:r,connectionStatus:p})))}function G1(e,t){return x.useRef(null),Vt(),x.useMemo(()=>t(e),[e])}const OA=({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:_,onSelectionStart:k,onSelectionEnd:j,connectionLineType:b,connectionLineStyle:S,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:R,selectionMode:$,multiSelectionKeyCode:H,panActivationKeyCode:B,zoomActivationKeyCode:P,deleteKeyCode:G,onlyRenderVisibleElements:Q,elementsSelectable:J,selectNodesOnDrag:M,defaultViewport:X,translateExtent:V,minZoom:I,maxZoom:q,preventScrolling:W,defaultMarkerColor:K,zoomOnScroll:F,zoomOnPinch:D,panOnScroll:ae,panOnScrollSpeed:z,panOnScrollMode:Z,zoomOnDoubleClick:U,panOnDrag:re,onPaneClick:de,onPaneMouseEnter:ge,onPaneMouseMove:pe,onPaneMouseLeave:_e,onPaneScroll:Pe,onPaneContextMenu:$e,onEdgeContextMenu:Te,onEdgeMouseEnter:je,onEdgeMouseMove:et,onEdgeMouseLeave:Ce,onReconnect:Ne,onReconnectStart:He,onReconnectEnd:it,reconnectRadius:ot,noDragClassName:le,noWheelClassName:be,noPanClassName:Re,elevateEdgesOnSelect:Ze,disableKeyboardA11y:We,nodeOrigin:tt,nodeExtent:we,rfId:Me})=>{const Qe=G1(e,wL),ce=G1(t,SL);return BL(l),me.createElement(gL,{onPaneClick:de,onPaneMouseEnter:ge,onPaneMouseMove:pe,onPaneMouseLeave:_e,onPaneContextMenu:$e,onPaneScroll:Pe,deleteKeyCode:G,selectionKeyCode:T,selectionOnDrag:R,selectionMode:$,onSelectionStart:k,onSelectionEnd:j,multiSelectionKeyCode:H,panActivationKeyCode:B,zoomActivationKeyCode:P,elementsSelectable:J,onMove:n,onMoveStart:r,onMoveEnd:a,zoomOnScroll:F,zoomOnPinch:D,zoomOnDoubleClick:U,panOnScroll:ae,panOnScrollSpeed:z,panOnScrollMode:Z,panOnDrag:re,defaultViewport:X,translateExtent:V,minZoom:I,maxZoom:q,onSelectionContextMenu:_,preventScrolling:W,noDragClassName:le,noWheelClassName:be,noPanClassName:Re,disableKeyboardA11y:We},me.createElement(qL,null,me.createElement(DL,{edgeTypes:ce,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:Q,onEdgeContextMenu:Te,onEdgeMouseEnter:je,onEdgeMouseMove:et,onEdgeMouseLeave:Ce,onReconnect:Ne,onReconnectStart:He,onReconnectEnd:it,reconnectRadius:ot,defaultMarkerColor:K,noPanClassName:Re,elevateEdgesOnSelect:!!Ze,disableKeyboardA11y:We,rfId:Me},me.createElement(WL,{style:S,type:b,component:E,containerStyle:C})),me.createElement("div",{className:"react-flow__edgelabel-renderer"}),me.createElement(bL,{nodeTypes:Qe,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:M,onlyRenderVisibleElements:Q,noPanClassName:Re,noDragClassName:le,disableKeyboardA11y:We,nodeOrigin:tt,nodeExtent:we,rfId:Me})))};OA.displayName="GraphView";var UL=x.memo(OA);const Rx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Na={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:Rx,nodeExtent:Rx,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Po.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:wP,isValidConnection:void 0},VL=()=>I$((e,t)=>({...Na,setNodes:n=>{const{nodeInternals:r,nodeOrigin:a,elevateNodesOnSelect:l}=t();e({nodeInternals:_p(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?_p(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,j)=>{const b=a.get(j.id);if(b!=null&&b.hidden)a.set(b.id,{...b,[Dt]:{...b[Dt],handleBounds:void 0}});else if(b){const S=d0(j.nodeElement);!!(S.width&&S.height&&(b.width!==S.width||b.height!==S.height||j.forceUpdate))&&(a.set(b.id,{...b,[Dt]:{...b[Dt],handleBounds:{source:q1(".source",j.nodeElement,y,p),target:q1(".target",j.nodeElement,y,p)}},...S}),k.push({id:b.id,type:"dimensions",dimensions:S}))}return k},[]);NA(a,p);const _=c||l&&!c&&_A(t,{initial:!0,...u});e({nodeInternals:new Map(a),fitViewOnInitDone:_}),(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=iL(n,u()),h=_p(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=>Ca(f,!0)):(c=Bi(l(),n),u=Bi(a,[])),xd({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=>Ca(f,!0)):(c=Bi(a,n),u=Bi(l(),[])),xd({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,Ca(h.id,!1))),p=u.map(h=>Ca(h.id,!1));xd({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=>Ca(u.id,!1)),c=n.filter(u=>u.selected).map(u=>Ca(u.id,!1));xd({changedNodes:l,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(a=>{a.positionAbsolute=h0(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=Ds.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:Na.connectionNodeId,connectionHandleId:Na.connectionHandleId,connectionHandleType:Na.connectionHandleType,connectionStatus:Na.connectionStatus,connectionStartHandle:Na.connectionStartHandle,connectionEndHandle:Na.connectionEndHandle}),reset:()=>e({...Na})}),Object.is),b0=({children:e})=>{const t=x.useRef(null);return t.current||(t.current=VL()),me.createElement(dP,{value:t.current},e)};b0.displayName="ReactFlowProvider";const PA=({children:e})=>x.useContext(bh)?me.createElement(me.Fragment,null,e):me.createElement(b0,null,e);PA.displayName="ReactFlowWrapper";const GL={input:gA,default:Tx,output:wA,group:v0},KL={default:th,straight:m0,step:p0,smoothstep:kh,simplebezier:f0},YL=[0,0],XL=[15,15],ZL={x:0,y:0,zoom:1},QL={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},LA=x.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l=GL,edgeTypes:c=KL,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:_,onConnectEnd:k,onClickConnectStart:j,onClickConnectEnd:b,onNodeMouseEnter:S,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:$,onNodeDrag:H,onNodeDragStop:B,onNodesDelete:P,onEdgesDelete:G,onSelectionChange:Q,onSelectionDragStart:J,onSelectionDrag:M,onSelectionDragStop:X,onSelectionContextMenu:V,onSelectionStart:I,onSelectionEnd:q,connectionMode:W=Po.Strict,connectionLineType:K=Ta.Bezier,connectionLineStyle:F,connectionLineComponent:D,connectionLineContainerStyle:ae,deleteKeyCode:z="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:U=!1,selectionMode:re=Ic.Full,panActivationKeyCode:de="Space",multiSelectionKeyCode:ge=Jd()?"Meta":"Control",zoomActivationKeyCode:pe=Jd()?"Meta":"Control",snapToGrid:_e=!1,snapGrid:Pe=XL,onlyRenderVisibleElements:$e=!1,selectNodesOnDrag:Te=!0,nodesDraggable:je,nodesConnectable:et,nodesFocusable:Ce,nodeOrigin:Ne=YL,edgesFocusable:He,edgesUpdatable:it,elementsSelectable:ot,defaultViewport:le=ZL,minZoom:be=.5,maxZoom:Re=2,translateExtent:Ze=Rx,preventScrolling:We=!0,nodeExtent:tt,defaultMarkerColor:we="#b1b1b7",zoomOnScroll:Me=!0,zoomOnPinch:Qe=!0,panOnScroll:ce=!1,panOnScrollSpeed:lt=.5,panOnScrollMode:gt=Ao.Free,zoomOnDoubleClick:mt=!0,panOnDrag:Et=!0,onPaneClick:Ot,onPaneMouseEnter:Pt,onPaneMouseMove:Kt,onPaneMouseLeave:jn,onPaneScroll:_t,onPaneContextMenu:Bt,children:he,onEdgeContextMenu:Je,onEdgeDoubleClick:Ct,onEdgeMouseEnter:En,onEdgeMouseMove:dn,onEdgeMouseLeave:ir,onEdgeUpdate:Mt,onEdgeUpdateStart:hn,onEdgeUpdateEnd:Cn,onReconnect:zt,onReconnectStart:Pn,onReconnectEnd:yn,reconnectRadius:wn=10,edgeUpdaterRadius:Tn=10,onNodesChange:_r,onEdgesChange:Kr,noDragClassName:Hs="nodrag",noWheelClassName:Ws="nowheel",noPanClassName:vn="nopan",fitView:ee=!1,fitViewOptions:Ae,connectOnClick:Le=!0,attributionPosition:Ie,proOptions:Ue,defaultEdgeOptions:ct,elevateNodesOnSelect:yt=!0,elevateEdgesOnSelect:St=!1,disableKeyboardA11y:Sr=!1,autoPanOnConnect:xt=!0,autoPanOnNodeDrag:wt=!0,connectionRadius:Us=20,isValidConnection:ms,onError:qa,style:Vs,id:Ba,nodeDragThreshold:Uo,...Yr},An)=>{const za=Ba||"1";return me.createElement("div",{...Yr,style:{...Vs,...QL},ref:An,className:gn(["react-flow",a]),"data-testid":"rf__wrapper",id:Ba},me.createElement(PA,null,me.createElement(UL,{onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:S,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:l,edgeTypes:c,connectionLineType:K,connectionLineStyle:F,connectionLineComponent:D,connectionLineContainerStyle:ae,selectionKeyCode:Z,selectionOnDrag:U,selectionMode:re,deleteKeyCode:z,multiSelectionKeyCode:ge,panActivationKeyCode:de,zoomActivationKeyCode:pe,onlyRenderVisibleElements:$e,selectNodesOnDrag:Te,defaultViewport:le,translateExtent:Ze,minZoom:be,maxZoom:Re,preventScrolling:We,zoomOnScroll:Me,zoomOnPinch:Qe,zoomOnDoubleClick:mt,panOnScroll:ce,panOnScrollSpeed:lt,panOnScrollMode:gt,panOnDrag:Et,onPaneClick:Ot,onPaneMouseEnter:Pt,onPaneMouseMove:Kt,onPaneMouseLeave:jn,onPaneScroll:_t,onPaneContextMenu:Bt,onSelectionContextMenu:V,onSelectionStart:I,onSelectionEnd:q,onEdgeContextMenu:Je,onEdgeDoubleClick:Ct,onEdgeMouseEnter:En,onEdgeMouseMove:dn,onEdgeMouseLeave:ir,onReconnect:zt??Mt,onReconnectStart:Pn??hn,onReconnectEnd:yn??Cn,reconnectRadius:wn??Tn,defaultMarkerColor:we,noDragClassName:Hs,noWheelClassName:Ws,noPanClassName:vn,elevateEdgesOnSelect:St,rfId:za,disableKeyboardA11y:Sr,nodeOrigin:Ne,nodeExtent:tt}),me.createElement(BP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:w,onConnectStart:_,onConnectEnd:k,onClickConnectStart:j,onClickConnectEnd:b,nodesDraggable:je,nodesConnectable:et,nodesFocusable:Ce,edgesFocusable:He,edgesUpdatable:it,elementsSelectable:ot,elevateNodesOnSelect:yt,minZoom:be,maxZoom:Re,nodeExtent:tt,onNodesChange:_r,onEdgesChange:Kr,snapToGrid:_e,snapGrid:Pe,connectionMode:W,translateExtent:Ze,connectOnClick:Le,defaultEdgeOptions:ct,fitView:ee,fitViewOptions:Ae,onNodesDelete:P,onEdgesDelete:G,onNodeDragStart:$,onNodeDrag:H,onNodeDragStop:B,onSelectionDrag:M,onSelectionDragStart:J,onSelectionDragStop:X,noPanClassName:vn,nodeOrigin:Ne,rfId:za,autoPanOnConnect:xt,autoPanOnNodeDrag:wt,onError:qa,connectionRadius:Us,isValidConnection:ms,nodeDragThreshold:Uo}),me.createElement(FP,{onSelectionChange:Q}),he,me.createElement(fP,{proOptions:Ue,position:Ie}),me.createElement(VP,{rfId:za,disableKeyboardA11y:Sr})))});LA.displayName="ReactFlow";const JL=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function DA(){return pt(JL,rn)}const FA=({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:_,backgroundColor:k}=l||{},j=c||_||k;return me.createElement("rect",{className:gn(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:r,height:a,fill:j,stroke:u,strokeWidth:f,shapeRendering:m,onClick:y?b=>y(b,e):void 0})};FA.displayName="MiniMapNode";var e5=x.memo(FA);const t5=e=>e.nodeOrigin,n5=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Cp=e=>e instanceof Function?e:()=>e;function r5({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a=2,nodeComponent:l=e5,onClick:c}){const u=pt(n5,rn),f=pt(t5),p=Cp(t),h=Cp(e),m=Cp(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return me.createElement(me.Fragment,null,u.map(w=>{const{x:_,y:k}=Mo(w,f).positionAbsolute;return me.createElement(l,{key:w.id,x:_,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 s5=x.memo(r5);const a5=200,o5=150,i5=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?gP(Nh(t,e.nodeOrigin),n):n,rfId:e.rfId}},l5="react-flow__minimap-desc";function qA({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:_=!1,zoomable:k=!1,ariaLabel:j="React Flow mini map",inversePan:b=!1,zoomStep:S=10,offsetScale:E=5}){const C=Vt(),T=x.useRef(null),{boundingRect:R,viewBB:$,rfId:H}=pt(i5,rn),B=(e==null?void 0:e.width)??a5,P=(e==null?void 0:e.height)??o5,G=R.width/B,Q=R.height/P,J=Math.max(G,Q),M=J*B,X=J*P,V=E*J,I=R.x-(M-R.width)/2-V,q=R.y-(X-R.height)/2-V,W=M+V*2,K=X+V*2,F=`${l5}-${H}`,D=x.useRef(0);D.current=J,x.useEffect(()=>{if(T.current){const Z=yr(T.current),U=ge=>{const{transform:pe,d3Selection:_e,d3Zoom:Pe}=C.getState();if(ge.sourceEvent.type!=="wheel"||!_e||!Pe)return;const $e=-ge.sourceEvent.deltaY*(ge.sourceEvent.deltaMode===1?.05:ge.sourceEvent.deltaMode?1:.002)*S,Te=pe[2]*Math.pow(2,$e);Pe.scaleTo(_e,Te)},re=ge=>{const{transform:pe,d3Selection:_e,d3Zoom:Pe,translateExtent:$e,width:Te,height:je}=C.getState();if(ge.sourceEvent.type!=="mousemove"||!_e||!Pe)return;const et=D.current*Math.max(1,pe[2])*(b?-1:1),Ce={x:pe[0]-ge.sourceEvent.movementX*et,y:pe[1]-ge.sourceEvent.movementY*et},Ne=[[0,0],[Te,je]],He=Ds.translate(Ce.x,Ce.y).scale(pe[2]),it=Pe.constrain()(He,Ne,$e);Pe.transform(_e,it)},de=Y2().on("zoom",_?re:null).on("zoom.wheel",k?U:null);return Z.call(de),()=>{Z.on("zoom",null)}}},[_,k,b,S]);const ae=y?Z=>{const U=Fr(Z);y(Z,{x:U[0],y:U[1]})}:void 0,z=w?(Z,U)=>{const re=C.getState().nodeInternals.get(U);w(Z,re)}:void 0;return me.createElement(u0,{position:m,style:e,className:gn(["react-flow__minimap",t]),"data-testid":"rf__minimap"},me.createElement("svg",{width:B,height:P,viewBox:`${I} ${q} ${W} ${K}`,role:"img","aria-labelledby":F,ref:T,onClick:ae},j&&me.createElement("title",{id:F},j),me.createElement(s5,{onClick:z,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),me.createElement("path",{className:"react-flow__minimap-mask",d:`M${I-V},${q-V}h${W+V*2}v${K+V*2}h${-W-V*2}z
|
|
57
|
+
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}qA.displayName="MiniMap";var c5=x.memo(qA);function u5(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},me.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function d5(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},me.createElement("path",{d:"M0 0h32v4.2H0z"}))}function h5(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},me.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 f5(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},me.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 p5(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},me.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 gr=({children:e,className:t,...n})=>me.createElement("button",{type:"button",className:gn(["react-flow__controls-button",t]),...n},e);gr.displayName="ControlButton";const m5=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),BA=({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=Vt(),[w,_]=x.useState(!1),{isInteractive:k,minZoomReached:j,maxZoomReached:b}=pt(m5,rn),{zoomIn:S,zoomOut:E,fitView:C}=_h();if(x.useEffect(()=>{_(!0)},[]),!w)return null;const T=()=>{S(),l==null||l()},R=()=>{E(),c==null||c()},$=()=>{C(a),u==null||u()},H=()=>{y.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),f==null||f(!k)};return me.createElement(u0,{className:gn(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&me.createElement(me.Fragment,null,me.createElement(gr,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},me.createElement(u5,null)),me.createElement(gr,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:j},me.createElement(d5,null))),n&&me.createElement(gr,{className:"react-flow__controls-fitview",onClick:$,title:"fit view","aria-label":"fit view"},me.createElement(h5,null)),r&&me.createElement(gr,{className:"react-flow__controls-interactive",onClick:H,title:"toggle interactivity","aria-label":"toggle interactivity"},k?me.createElement(p5,null):me.createElement(f5,null)),h)};BA.displayName="Controls";var g5=x.memo(BA),Hr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Hr||(Hr={}));function y5({color:e,dimensions:t,lineWidth:n}){return me.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function w5({color:e,radius:t}){return me.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const v5={[Hr.Dots]:"#91919a",[Hr.Lines]:"#eee",[Hr.Cross]:"#e2e2e2"},x5={[Hr.Dots]:1,[Hr.Lines]:1,[Hr.Cross]:6},b5=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function zA({id:e,variant:t=Hr.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}=pt(b5,rn),y=c||v5[t],w=r||x5[t],_=t===Hr.Dots,k=t===Hr.Cross,j=Array.isArray(n)?n:[n,n],b=[j[0]*h[2]||1,j[1]*h[2]||1],S=w*h[2],E=k?[S,S]:b,C=_?[S/l,S/l]:[E[0]/l,E[1]/l];return me.createElement("svg",{className:gn(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},me.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]})`},_?me.createElement(w5,{color:y,radius:S/l}):me.createElement(y5,{dimensions:E,color:y,lineWidth:a})),me.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}zA.displayName="Background";var k5=x.memo(zA);const N5=["us-gov","global","apac","us","eu","jp","au"],_5=new RegExp(`^(?:(?:${N5.join("|")})\\.)?anthropic\\.`,"i");function Kc(e){return e.replace(_5,"")}const S5=["command","cmd","file_path","path","url","pattern","notebook_path"],K1=120,Tp=e=>e.length>K1?`${e.slice(0,K1-1)}…`:e;function j5(e){if(typeof e=="string")return e.trim()?Tp(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of S5){const r=t[n];if(typeof r=="string"&&r.trim())return Tp(r.trim());if(Array.isArray(r)&&r.length>0&&r.every(a=>typeof a=="string")){const a=r.join(" ").trim();if(a)return Tp(a)}}return null}const E5=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function Y1(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const X1={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function k0(e){const t=E5.exec(e);if(!t)return null;const n=Y1(t[1],"status");return{label:(n&&Object.hasOwn(X1,n)?X1[n]:void 0)??"background task update",detail:Y1(t[1],"summary")}}function HA(e){return e.filter(t=>!k0(t.text))}const C5=/[0-9a-f]{16,}/i,T5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function WA(e){return C5.test(e)||T5.test(e)}function A5(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!WA(t[n]))return t[n];return t[t.length-1]}function UA(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function N0(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 R5(e){const t=N0(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 M5(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]=R5(r));return Object.keys(t).length?t:void 0}function VA(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),...N0(n)};for(const r of Object.values(n)){const a=VA(r,t+1);if(a)return a}return null}const I5=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,$5=new Set(["tool_input","tool_response"]);function GA(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&I5.test(Kc(n.model)))return n.model;for(const[r,a]of Object.entries(n)){if($5.has(r))continue;const l=GA(a,t+1);if(l)return l}return null}function Mx(){return{agents:new Map,toolIndex:new Map,activeSubagentStack:new Map,subagentTombstones:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function $a(e){return A5(e)}function Z1(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function el(e,t){return`${e}::${t}`}function Oa(e,t){return`${e}\0${t}`}function nh(e){const t=e.agent_type??e.subagent_type;return t&&!WA(t)?t:"subagent"}function Nc(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function zi(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:UA()},e.agents.set(a,l),l)}function KA(e,t,n,r){const a=el(t,n),l=e.agents.get(a);if(!l)return null;!l.cwd&&r.cwd&&(l.cwd=r.cwd,l.cwdBasename=$a(r.cwd));const c=nh(r);return c&&(l.label==="subagent"||!l.label)&&(l.label=c),l}function O5(e,t,n){const r=t.session_id??"unknown",a=Nc(t);if(a){const f=KA(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(el(r,c));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=$a(t.cwd)),f}const u=zi(e,r,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=$a(t.cwd)),u.label==="session"&&t.cwd&&(u.label=$a(t.cwd)??"session"),u}function P5(e,t,n,r,a){const l=el(t,n),c=zi(e,t,a,!0);let u=e.agents.get(l);if(u){!u.cwd&&r.cwd&&(u.cwd=r.cwd,u.cwdBasename=$a(r.cwd));const f=nh(r);return f&&(u.label==="subagent"||!u.label)&&(u.label=f),u}return u={id:l,sessionId:t,label:nh(r),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:r.cwd,cwdBasename:$a(r.cwd),toolCount:0,childCount:0,usage:UA()},e.agents.set(l,u),c.childCount+=1,u}function L5(e,t,n){const r=e.activeSubagentStack.get(t)??[];r.includes(n)||(r.push(n),e.activeSubagentStack.set(t,r))}function Q1(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 kd(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 J1=200;function D5(e,t){for(const n of e.values()){const r=n.tools.find(a=>a.id===t);if(r)return r}return null}const F5=25;function q5(e,t){const n=t.tools;if(n.length>J1){const r=n.splice(0,n.length-J1);for(const a of r){const l=Oa(t.sessionId,a.id);e.toolIndex.get(l)===a&&e.toolIndex.delete(l)}}for(let r=n.length-F5-1;r>=0;r--){const a=n[r];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function B5(e,t,n){const r=e.toolIndex.get(Oa(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 eN=2e3;function z5(e,t,n){for(let r=e.prompts.length-1;r>=0;r--){const a=e.prompts[r];if(a.at<t-eN)return!1;if(a.text===n&&a.at<=t+eN)return!0}return!1}const Nd=2e3;function H5(e){let t=e.startedAt;for(const n of e.prompts)n.at>t&&(t=n.at);return t}function YA(e,t){for(const n of t.tools){const r=Oa(t.sessionId,n.id);e.toolIndex.get(r)===n&&e.toolIndex.delete(r)}}function Yc(e,t){return t&&(e.revision+=1),t}function W5(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&&(YA(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 Yc(e,f>0)}function U5(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&&YA(e,w),e.agents.delete(y)}a==null||a(h),f--,p=!0}return Yc(e,p)}function V5(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(Oa((n==null?void 0:n.session_id)??"unknown",a))}function G5(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 Yc(e,t)}function K5(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(Oa(a.sessionId,u.id)),r=!0)}}return Yc(e,r)}const tN=90*6e4;function Y5(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 Yc(e,r)}function X5(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const Z5=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped"]);function Q5(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 J5=3e4;function e6(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>J5)&&!(e.startedAt>t))return{name:e.name,preview:j5(e.input)??""}}function t6(e,t,n,r,a){if(n!=="permission")return{kind:n,message:r,since:a};const l=Q5(e,t),c={kind:n,message:r,since:a};l!=null&&l.explicitSubagentId&&(c.subagentId=l.explicitSubagentId);const u=e6(l,a);return u&&(c.tool=u),c}function n6(e,t,n){if(e.kind==="idle")return!0;const r=Nc(t);return r==null?!0:e.subagentId!=null&&el(n,r)===e.subagentId}function nN(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{...Mx(),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(!Z5.has(l)){const h=e.agents.get(c);h!=null&&h.waiting&&n6(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??Z1(),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 _=`${c}::${y}`,k=e.agents.get(_);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??Z1(),w=(k,j)=>typeof h[k]=="number"?h[k]:j,_=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:_??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(_=>m-_<r6);w.push(m),y.outputs=w.length>rN?w.slice(-rN):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=N0(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=M5(r.usageByModel)}}return e}const f=O5(e,r,a);f.provider||(f.provider=r.provider==="codex"?"codex":"claude");const p=GA(r);switch(p&&(f.model=p),l){case"SessionStart":{const h=zi(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=$a(r.cwd)),h.label==="session"&&r.cwd&&(h.label=$a(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=zi(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&&!z5(h,a,m)&&(h.prompts.push({at:a,text:m}),!h.firstPrompt&&!k0(m)&&(h.firstPrompt=kd(m,120)));break}case"PreToolUse":{const h=r.tool_use_id?B5(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=kd(r.tool_input));break}const m=r.tool_use_id??`${f.id}:${f.toolCount}`,y=Nc(r),w={id:m,name:r.tool_name??"?",input:r.tool_input,inputPreview:kd(r.tool_input),agentId:f.id,explicitSubagentId:y?el(c,y):void 0,startedAt:a};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(Oa(f.sessionId,m),w),q5(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=r.tool_use_id;if(!h)break;const m=Oa(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 j=k.tools.find(b=>b.id===h);if(j){y=j,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=kd(r.tool_response):w&&(y.errorPreview=void 0);const _=VA(r.tool_response);_&&(y.usage=_),e.toolIndex.delete(m);break}case"SubagentStart":{const h=Nc(r);if(!h)break;const m=P5(e,c,h,r,a),y=nh(r);y&&(m.label=y);const w=e.subagentTombstones.get(m.id);w!=null&&e.subagentTombstones.delete(m.id);const _=m.endedAt!=null&&a-m.endedAt<=Nd,k=w!=null&&a-w<=Nd;if(_||k){const j=k?w:m.endedAt;m.state="done",m.endedAt=j,m.startedAt=Math.min(m.startedAt,j),Q1(e,c,h);break}m.state="active",m.startedAt=m.startedAt||a,m.exitAt=void 0,m.endedAt=void 0,L5(e,c,h);break}case"SubagentStop":{const h=Nc(r);if(!h)break;const m=KA(e,c,h,r);if(!m){for(const[y,w]of e.subagentTombstones)a-w>Nd&&e.subagentTombstones.delete(y);e.subagentTombstones.set(el(c,h),a);break}m.state="done",m.endedAt=Math.min(m.endedAt??a,a),Q1(e,c,h);break}case"Stop":case"SessionEnd":{const h=zi(e,c,a,!1),m=H5(h);if(a<m)break;const y=h.lastTurnEndAt;if(y!=null&&m>y&&a<=y+Nd)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 _ of w.tools)_.endedAt==null&&_.explicitSubagentId==null&&(_.endedAt=a,_.ok=!1,_.errorPreview=_.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(Oa(w.sessionId,_.id)));l==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const h=X5(r.notification_type);if(!h)break;const m=zi(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)}:t6(e,c,h,y,a);break}}return e}const r6=6e4,rN=64;function rh(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 s6={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},a6=[{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:s6},{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 o6(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function cl(e,t=Date.now()){if(!e)return null;const n=Kc(e);for(const r of a6)if(r.match.test(n))return typeof r.rates=="function"?r.rates(t):r.rates;return null}function XA(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 ZA(e,t,n=Date.now()){if(!o6(t))return e.inputTokens;const r=cl(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 _0(e,t,n=Date.now()){const r=cl(t,n);if(!r)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=ZA(e,t,n)*r.input/1e6,l=e.outputTokens*r.output/1e6,c=e.cacheReadTokens*r.cacheRead/1e6,u=XA(e,r),f=u.usd5m+u.usd1h;return{input:a,output:l,cacheRead:c,cacheWrite:f,total:a+l+c+f}}const sN=2e5,i6=1e6,l6=[/\[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],c6=[{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 u6(e){if(!e)return sN;const t=Kc(e);for(const n of l6)if(n.test(t))return i6;for(const n of c6)if(n.match.test(t))return n.window;return sN}function QA(e,t){return typeof e=="number"&&e>0?e:u6(t)}const qi="not priced";function kt(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}¢`}if(e<100){const t=e.toFixed(2);if(Number(t)<100)return`$${t}`}if(e<1e4){const t=e.toFixed(0);if(Number(t)<1e4)return`$${t}`}return`$${(e/1e3).toFixed(1)}k`}function S0(e,t){if(e<=0||t<10)return null;const n=e/t,r=n*60;return r>=.01?`${kt(r)}/min`:`${kt(n*3600)}/hr`}function d6(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 h6(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 Xc(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=h6(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:d6(r[l].usage,a)}:r.push({model:e.model,usage:a})}return r}function Kn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const r of Xc(e)){const a=_0(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 Oc(e,t=Date.now()){let n=0;for(const r of Xc(e))cl(r.model,t)==null&&(n+=r.usage.inputTokens+r.usage.outputTokens);return n}function JA(e){const t=[];for(const n of Xc(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 eR(e){return JA(e).filter(t=>t!==e.model)}const f6=new Set(["untrusted","on-request","on-failure"]);function p6(e){return typeof e!="string"||!e?null:f6.has(e)?!0:e==="never"?!1:null}function m6(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=p6(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 aN(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Pa(e){const t=Kc(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=aN(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(aN);return[`GPT-${a}`,...l].join(" ")}return e}function Sh(e){const t=Kc(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function vr(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function Ap(e){const t=[];for(const n of e)n.kind==="root"&&vr(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 g6(e,t){if(e.length===0)return null;const n=e.findIndex(r=>r.id===t);return e[(n+1)%e.length]}function y6(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function jh(e,t){return`${e}@${t.since}`}function tR(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 w6(e){const t=e.message||"Needs your permission",n=tR(e,t);return n?`${t}
|
|
60
|
+
Likely on: ${n}`:t}function v6(e,t,n,r=!0){if(!r)return[];if(n)return[];const a=[];for(const l of e){if(!vr(l.waiting))continue;const c=jh(l.id,l.waiting);t.has(c)||a.push({key:c,title:l.label,body:w6(l.waiting),sessionId:l.id})}return a}function x6(e,t,n){const r=new Set;for(const l of e)r.add(jh(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 Rp(e){return new Set(e.map(t=>jh(t.id,t.waiting)))}function b6(e,t){return e!==t}function k6(e,t){return!e&&t!=null}function N6(e,t){return e!==null&&t!=null}function mn(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 tl(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 nR(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 j0(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 _6=1;function S6(){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,l="dialog"){const c={dismiss:r,layer:a,kind:l,seq:t++};return e.push(c),()=>{const u=e.indexOf(c);u!==-1&&e.splice(u,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},dialogDepth(){return e.filter(r=>r.kind==="dialog").length}}}const _c=S6();function j6(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function oN(e){return String(e.tagName??"").toUpperCase()==="BODY"}function E6(e,t){return!e||!e.isConnected||oN(e)?!1:t==null||oN(t)}const iN="a[href], button, input, select, textarea, [tabindex]";function C6(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function T6(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function A6({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 Eh(e){return e.ctrlKey||e.metaKey||e.altKey}const R6=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),M6=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),I6=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function E0(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function $6(e){return E0(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function C0(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=E0(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!R6.has(String(e.type??"text").toLowerCase())}function O6(e,t){if(!e)return!1;if(C0(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&$6(e))return!1;if(M6.has(E0(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>I6.has(r))}function P6({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function L6({appModal:e,dialogDepth:t}){return e||t>0}function rR(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(iN))return C6({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&T6({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(iN)!=null})}):[]}function D6(e,t){const n=rR(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 un(e,t={}){const{focusRef:n,layer:r,popover:a}=t,l=a?"popover":"dialog",c=x.useRef(null),u=x.useRef(e);u.current=e;const f=x.useRef(null);f.current===null&&(f.current=()=>u.current());const p=f.current;return x.useEffect(()=>_c.push(p,r,l),[p,r,l]),x.useEffect(()=>{var m;const h=document.activeElement;return(m=(n==null?void 0:n.current)??rR(c.current)[0])==null||m.focus(),()=>{E6(h,document.activeElement)&&h.focus()}},[]),x.useEffect(()=>{const h=m=>{var b;if(m.key!=="Tab"||Eh(m))return;const y=c.current;if(!y)return;const w=document.activeElement;if(!(w!=null&&y.contains(w))&&!_c.isTop(p))return;const k=D6(y,w),j=A6({count:k.length,index:w?k.indexOf(w):-1,shiftKey:m.shiftKey});j.kind!=="allow"&&(m.preventDefault(),j.kind==="focus"&&((b=k[j.index])==null||b.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[p]),c}function F6(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 mr(e){return e.toLocaleString()}function q6(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const B6=60;function z6(e,t=B6){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 H6({agent:e,onClose:t}){var y;const n=x.useRef(null),r=un(t,{focusRef:n}),a=e.context,l=e.usage,c=(a==null?void 0:a.currentContextTokens)??0,u=QA(e.contextWindow,e.model),f=Math.min(100,c/u*100),p=Kn(e),h=e.provider==="codex"?l.inputTokens+l.outputTokens:l.inputTokens+l.outputTokens+l.cacheReadTokens+l.cacheCreateTokens,m=F6(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:[mr(c)," / ",mr(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(Dr,{label:"input tokens",val:mr(l.inputTokens)}),i.jsx(Dr,{label:"output tokens",val:mr(l.outputTokens)}),i.jsx(Dr,{label:"cache reads",val:mr(l.cacheReadTokens)}),i.jsx(Dr,{label:"cache writes",val:mr(l.cacheCreateTokens)}),i.jsx(Dr,{label:"cumulative total",val:mr(h)}),i.jsx(Dr,{label:"estimated cost",val:kt(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(Dr,{label:"user messages",val:mr((a==null?void 0:a.msgsUser)??0)}),i.jsx(Dr,{label:"assistant messages",val:mr((a==null?void 0:a.msgsAssistant)??0)}),i.jsx(Dr,{label:"tool uses",val:mr((a==null?void 0:a.toolUses)??0)}),i.jsx(Dr,{label:"tool results",val:mr((a==null?void 0:a.toolResults)??0)}),i.jsx(Dr,{label:"system-reminders",val:mr((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:z6(w.path)}),i.jsx("span",{className:"ctx-md-size",children:q6(w.bytes)})]},w.path))})]})})}function Dr({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 W6({currentContextTokens:e,modelId:t,contextWindow:n,size:r=26,onClick:a}){const l=QA(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 lN=new Map;function sR(e){let t=lN.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},lN.set(e,t)),t}function U6(e,t){const n=sR(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 V6(e){return sR(e).now}const cN=new Map,uN=new Map;function ul(e=1e3){let t=cN.get(e);t||(t=r=>U6(e,r),cN.set(e,t));let n=uN.get(e);return n||(n=()=>V6(e),uN.set(e,n)),x.useSyncExternalStore(t,n,n)}function Ch(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 G6="1",dN="agent-dag.schema",K6=["agent-dag.layout","agent-dag.viewport"];function Da(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function Y6(e,t=G6){let n=null;try{n=e.getItem(dN)}catch{return[]}if(n===t)return[];const r=[];if(n!==null)for(const a of K6)try{e.getItem(a)!==null&&(e.removeItem(a),r.push(a))}catch{}try{e.setItem(dN,t)}catch{}return r}const aR="agent-dag.recapsDismissed",hN=200;function X6(){const e=Da(aR);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let nl=new Set(X6());const Ix=new Set;let oR=0;function iR(e){return Ix.add(e),()=>{Ix.delete(e)}}function lR(e){if(nl=e,oR++,typeof window<"u")try{const t=Array.from(e);window.localStorage.setItem(aR,JSON.stringify(t.length>hN?t.slice(-hN):t))}catch{}for(const t of Ix)t()}function cR(e,t){return`${e}@${t}`}function Z6(e){return nl.has(e)}function Q6(e){if(nl.has(e))return;const t=new Set(nl);t.add(e),lR(t)}function J6(e){const t=new Set(nl);t.delete(e)||t.add(e),lR(t)}function eD(e){return x.useSyncExternalStore(iR,()=>e!=null&&nl.has(e),()=>!1)}function T0(e){return`recap:${e}`}function tD(e){return e.startsWith("recap:")}function nD(){return x.useSyncExternalStore(iR,()=>oR,()=>0)}function rD(e){const t=new Map;for(const n of e){if(n.kind!=="subagent"||n.exitAt!=null)continue;let r=t.get(n.sessionId);r||(r={total:0,live:0,done:0,err:0,failed:0},t.set(n.sessionId,r)),r.total+=1,n.state==="active"?r.live+=1:n.state==="err"?r.err+=1:r.done+=1;for(const a of n.tools)a.ok===!1&&(r.failed+=1)}return t}function uR(e){return[`${e.total} ${e.total===1?"subagent":"subagents"}`,e.live>0?`${e.live} live`:null,e.done>0?`${e.done} done`:null,e.err>0?`${e.err} err`:null].filter(Boolean).join(" · ")}function dR(e){return e.live>0?`→ ${e.total} · ${e.live} live`:`→ ${e.total} · done`}function sD(e,t,n){const r=e.kind==="root"?e.waiting:null;if(r&&vr(r))return{tone:"warn",long:n.sayWaiting(r),short:r.kind==="permission"?"Needs you":"Asked you"};if(r&&r.kind==="idle"){const l=n.sayWaiting(r);return{tone:"idle",long:l,short:l}}const a=e.tools.filter(l=>l.ok===!1).length;if(a>0)return{tone:"err",long:`${a} tool ${a===1?"call":"calls"} failed`,short:`${a} failed`};if(t&&t.total>0)return{tone:"muted",long:uR(t),short:dR(t)};if(e.state==="active")for(let l=e.tools.length-1;l>=0;l--){const c=e.tools[l];if(c.endedAt!=null)continue;const{name:u,subject:f}=n.describeCall(c);return{tone:"muted",long:f?`${u} · ${f}`:u,short:u}}return null}function $x(e){return e==="active"?"live":e==="done"?"done":"err"}const Zc={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"}},aD=Object.fromEntries(Object.entries(Zc).map(([e,t])=>[e,t.category])),oD=Object.fromEntries(Object.entries(Zc).map(([e,t])=>[e,t.emoji])),iD=Object.fromEntries(Object.entries(Zc).map(([e,t])=>[e,t.label])),lD=new Set(Object.keys(Zc)),cD=new Set(Object.entries(Zc).filter(([,e])=>e.shell).map(([e])=>e)),fN={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",...aD};function hR(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(fN,e)?fN[e]:"other"}const uD=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,dD=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function hD(e){if(typeof e!="string"||!e)return null;const t=uD.exec(e);if(t){const r=fD(t[2]);if(r.trim())return r}const n=dD.exec(e);return n?n[1]:null}function fD(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
61
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const fR=600,pD=4,mD=36,Ox=16,gD=60,yD=6,pN=220,mN=96,wD=28,gN={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:"📡",...oD};function yN(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(gN,e)?gN[e]:"✨"}const wN={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 pR(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 pR(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 vD(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=hD(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 xD=new Set(["Bash","PowerShell",...cD]),bD=lD;function kD(e,t){return bD.has(e)||e.startsWith("mcp__")?Math.max(mN,34+t.length*7.5):mN}function ND(e,t){if(!xD.has(e))return null;const n=vD(t);if(!n)return null;const r=pR(n);return r?{emoji:Object.hasOwn(wN,r)?wN[r]:"⚙️",label:r,category:"shell",detail:n}:null}const _D=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),vN={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:"🗄️"},xN={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 SD(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),r=n.lastIndexOf("/");return r>=0?n.slice(r+1):n}function jD(e){const t=e.toLowerCase();if(Object.hasOwn(xN,t))return xN[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(vN,r))return vN[r]}return"📄"}function ED(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 CD(e,t){if(!_D.has(e))return null;const n=ED(e,t);if(!n)return null;const r=SD(n);return r?{emoji:e==="LS"?"📂":jD(r),label:r,category:"file",detail:n}:null}const bN={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 A0(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 TD(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 mR(e){const t=e.toLowerCase();return Object.hasOwn(bN,t)?bN[t]:void 0}function AD(e,t){const n=A0(e);if(!n)return null;const{server:r,method:a}=n;if(!a)return null;const l=mR(r);return{emoji:(l==null?void 0:l.emoji)??"🔌",label:a,category:"mcp",detail:l?`${l.name} · ${a}`:`${r} · ${a}`}}function gR(e,t){return ND(e,t)??CD(e,t)??AD(e)}function RD(e,t){var n;return((n=gR(e,t))==null?void 0:n.label)??null}const kN=iD,NN=18;function MD(e){const t=[...e];return t.length<=NN?e:t.slice(0,NN-1).join("")+"…"}function R0(e){const t=A0(e);if(t){const r=mR(t.server);return r?{emoji:r.emoji,label:r.name}:{emoji:"🔌",label:MD(t.server),hue:TD(t.server)}}const n=Object.hasOwn(kN,e)?kN[e]:"";return n?{emoji:yN(e),label:n}:{emoji:yN(e),label:e}}function ID(e){let t=null,n="";for(const r of e){const a=A0(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:R0(n)}function $D(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function OD(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/fR)}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 LD(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>fR)continue;const f=r.get(u.id)??n.get(u.id);if(!f)continue;const p=PD(u.tools,pD);if(p.length===0)continue;const h=u.exitAt??null,m=a.get(u.id),y=Math.max((m==null?void 0:m.width)??pN,pN),w=(m==null?void 0:m.height)??130,_=f.x,k=f.y,j=_+y,b=k+w/2;p.forEach((S,E)=>{const C=E*mD,T=_+y+gD,R=k+yD+C,$=OD(l,h),H=S.inputPreview??"",B=$D(S),P=$<.999,G=R0(S.name);c.push({id:`${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:G.label,emoji:G.emoji,status:B,category:hR(S.name),mcpHue:G.hue,inputPreview:H,fade:$,fading:P,worldX:T,worldY:R,anchorX:j,anchorY:b,spawnDx:j-T,spawnDy:b-(R+Ox)});const Q=gR(S.name,S.input);if(Q){const J=kD(S.name,G.label),M=T+J+wD,X=R,V=T+J,I=R+Ox;c.push({id:`sub:${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:Q.label,emoji:Q.emoji,isSub:!0,status:B,category:Q.category,inputPreview:Q.detail??H,fade:$,fading:P,worldX:M,worldY:X,anchorX:V,anchorY:I,spawnDx:V-M,spawnDy:0})}})}return c}function DD({agents:e,visibleAgentIds:t,positions:n,pinned:r,measured:a,spotlight:l,hiddenCategories:c,now:u,onOpenTool:f}){const p=LD(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}=DA();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+Ox)*l+a,m=Math.max(1,p-u),y=Math.min(1,Math.abs(h-f)/m),w=u+m*(.55-.22*y),_=t!=null&&!t.has(c.agentId),k=c.fade*(_?.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(BD,{b:c,x:r,y:a,zoom:l,dim:t!=null&&!t.has(c.agentId),onOpenTool:n},c.id))]})}function qD(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 BD=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}:{},_=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":""}${_}`,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:"×"})]})})},qD);function yR({kind:e}){return i.jsxs("svg",{className:"state-mark","data-kind":e,viewBox:"0 0 10 10",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[e==="live"&&i.jsx("circle",{cx:"5",cy:"5",r:"3.2",fill:"currentColor"}),e==="done"&&i.jsx("path",{d:"M2.2 5.3l1.9 1.9 3.8-4.4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),e==="err"&&i.jsx("path",{d:"M2.8 2.8l4.4 4.4M7.2 2.8l-4.4 4.4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",fill:"none"})]})}function M0(){return i.jsxs("svg",{className:"alert-mark",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",focusable:"false",children:[i.jsx("path",{d:"M6 1.4l4.7 8.3H1.3z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",fill:"none"}),i.jsx("path",{d:"M6 4.6v2.4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),i.jsx("circle",{cx:"6",cy:"8.35",r:"0.72",fill:"currentColor"})]})}function _N(e,t){const n=cl(t);if(!n)return`model: ${t}
|
|
62
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const r=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,l=_0(e,t),c=XA(e,n),u=c.tokens1h>0?[`cache w5m${r(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${kt(c.usd5m)}`,`cache w1h${r(c.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${kt(c.usd1h)}`]:[`cache w ${r(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${kt(c.usd5m)}`],f=ZA(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${r(f).padStart(14)} × ${a(n.input).padEnd(11)} = ${kt(l.input)}`,`output ${r(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${kt(l.output)}`,`cache r ${r(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${kt(l.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${kt(l.total)}`].join(`
|
|
63
|
+
`)}function SN(e){const t=Xc(e);return t.length<=1?_N(e.usage,e.model):[...t.map(n=>_N(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${kt(Kn(e).total)}`].join(`
|
|
64
|
+
`)}function zD({data:e,selected:t}){var j,b;const n=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),r=e.tools.filter(S=>!S.endedAt).length,a=e.tools.filter(S=>S.ok===!1).length,l=rh(e.sessionId),c=((j=e.context)==null?void 0:j.currentContextTokens)??0,u=e.kind==="root"&&c>0,f=e.sessionTitle?e.cwd?`${e.cwd}
|
|
65
|
+
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=eR(e),h=p.length>0?`${e.model}
|
|
66
|
+
spend on this card also covers:
|
|
67
|
+
${p.join(`
|
|
68
|
+
`)}`:e.model,m=j0(e.sessionName,e.sessionTitle),y=Ch(e),w=y?cR(e.sessionId,y.at):null,_=eD(w),k=y!=null&&!_;return i.jsxs("div",{className:n,style:{"--session-hue":l},children:[i.jsx("span",{className:"accent-stripe"}),i.jsx(Lo,{type:"target",position:Ve.Left,style:{background:"transparent",border:"none"}}),i.jsxs("div",{className:"head",children:[i.jsxs("div",{className:"title",children:[i.jsx(VD,{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:S=>{S.stopPropagation(),J6(w)},children:i.jsx(Pc,{})})]}),i.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&i.jsx(W6,{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(UD,{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":Sh(e.model),title:h,children:[Pa(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(YD,{waiting:e.waiting}),(()=>{const S=m6(e);return S?i.jsxs("div",{className:"approval-blind-row",title:S.detail,children:[i.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),i.jsx("span",{className:"approval-blind-said",children:S.label})]}):null})(),(e.tools.length>0||(((b=e.outputs)==null?void 0:b.length)??0)>0)&&i.jsx(XD,{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:mn(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const S=cl(e.model),E=Kn(e),C=Oc(e);if(!S&&E.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:i.jsx("span",{className:"cost-unpriced",title:SN(e),children:qi});if(E.total<=0)return null;const T=Math.max(0,((e.endedAt??Date.now())-e.startedAt)/1e3),R=e.state==="active"&&!e.synthetic?S0(E.total,T):null,$=SN(e)+(R?`
|
|
69
|
+
burn: ${R}`:"");return i.jsx("span",{className:"cost-meta",title:$,children:i.jsxs("b",{children:[kt(E.total),C>0?"+":""]})})})()]}),i.jsx(WD,{data:e,title:e.kind==="root"?m.face:void 0}),i.jsx(Lo,{type:"source",position:Ve.Right,style:{background:"transparent",border:"none"}})]})}const HD=x.memo(zD);function WD({data:e,title:t}){const n=e.kind==="root"&&vr(e.waiting),r=sD(e,e.branch,{sayWaiting:I0,describeCall:a=>({name:R0(a.name).label,subject:RD(a.name,a.input)})});return i.jsxs("div",{className:"lod-face","data-kind":e.kind,"data-alarm":n?"":void 0,"data-signal":r?"":void 0,"aria-hidden":!0,children:[i.jsxs("div",{className:"lod-id",children:[i.jsx(yR,{kind:$x(e.state)}),i.jsx("span",{className:"lod-name",children:e.label}),r&&i.jsx("span",{className:"lod-inline","data-tone":r.tone,children:r.short}),n&&i.jsx(M0,{})]}),t&&i.jsx("div",{className:"lod-title",children:t}),r&&i.jsxs("div",{className:"lod-signal","data-tone":r.tone,children:[i.jsx("span",{className:"lod-long",children:r.long}),i.jsx("span",{className:"lod-short",children:r.short})]})]})}function UD({start:e,end:t}){const n=ul(1e3);return i.jsx(i.Fragment,{children:tl(e,t,n)})}function rl(e){return e==="active"?"live":e==="done"?"done":"err"}function VD({state:e}){return i.jsx("span",{className:`state-pill state-${e}`,children:rl(e)})}function sl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function GD(e,t=Date.now()){const n=e.tools.filter(a=>a.ok===!1).length,r=Kn(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",rl(e.state),vr(e.waiting)?sl(e.waiting):null,e.model?Pa(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,n>0?`${n} failed`:null,r>0?`${kt(r)}${Oc(e,t)>0?"+":""}`:null].filter(Boolean).join(", ")}function KD(e,t){const n=tR(e,t);return n?`Likely on: ${n}`:null}function I0(e){return e.kind==="idle"?"Your turn":sl(e)}function YD({waiting:e}){const t=ul(1e3),n=vr(e),r=sl(e);return i.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${r}
|
|
70
|
+
Blocked for ${tl(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:I0(e)}),i.jsx("b",{children:tl(e.since,void 0,t)})]})}function Pc(){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 XD({tools:e,outputs:t}){const n=ul(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,_=h/(l/1e3),k=e.filter(E=>n-E.startedAt>=0&&n-E.startedAt<r).length,j=u-k,b=[k>0?`${k} tool ${k===1?"call":"calls"}`:"",j>0?`${j} ${j===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),S=u===0?"nothing in the last 60s":`${b.join(" · ")} in last 60s · peak ${_.toFixed(1)}/s`;return i.jsxs("div",{className:"tool-spark-row",title:S,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,H=`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:H},R?`landed:${E}`:C)})}),i.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function ZD(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function Mp(e){return e!=="gone"}function Ip(e,t){const[n,r]=x.useState(()=>e?"here":"gone"),a=x.useRef(null);return x.useEffect(()=>{r(l=>ZD(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 al(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 QD=60,JD=6e3,ds=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),rr=e=>typeof e=="string"?e:null;function Do(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(`
|
|
71
|
+
`)){a.push(u);for(const f of c.split(`
|
|
72
|
+
`))a.push(`${t} ${f}`)}else if(c!==null&&typeof c=="object"){const f=Do(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(`
|
|
73
|
+
`)}function eF(e){return e.lines??e.text.split(`
|
|
74
|
+
`).map(t=>({text:t}))}function tF(e,t){if(t)return{shown:e,cut:!1};const n=[];let r=0;for(const a of e){if(n.length===QD)return{shown:n,cut:!0};const l=JD-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 On=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),sr=(e,t)=>({label:e,text:t,inline:!0}),wR=(e,t)=>({label:e,text:t.map(n=>n.text).join(`
|
|
75
|
+
`),lines:t});function nF(e,t){return[...e.split(`
|
|
76
|
+
`).map(n=>({text:`- ${n}`,tone:"del"})),...t.split(`
|
|
77
|
+
`).map(n=>({text:`+ ${n}`,tone:"add"}))]}function rF(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!ds(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 jN(e){if(typeof e=="string")return[On(void 0,e)];if(!ds(e))return[On(void 0,Do(e))];const t=[],n=rr(e.type);n==="create"&&t.push(sr("result","created the file"));const r=rF(e.structuredPatch);return r&&t.push(wR("applied",r)),e.userModified===!0&&t.push(sr("note","the user changed it before it was applied")),t.length?t:[sr("result",n==="update"?"updated the file":"done")]}function sF(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 aF(e){if(typeof e=="string")return[On(void 0,e)];const t=ds(e)&&ds(e.file)?e.file:null,n=rr(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(sr("lines",l>=c?`all ${c}`:Number.isFinite(u)?`${u}–${u+l-1} of ${c}`:`${l} of ${c}`)),a.push(On("content",n)),a}const r=ds(e)?rr(e.type):null;return r&&r!=="text"?[sr("result",`${/^[aeiou]/i.test(r)?"an":"a"} ${r} file`)]:[On(void 0,Do(e))]}function oF(e){if(typeof e=="string")return[On("output",e)];if(!ds(e))return[On(void 0,Do(e))];const t=rr(e.stdout),n=rr(e.stderr);if(t==null&&n==null)return[On(void 0,Do(e))];const r=[];return t&&r.push(On("output",t.replace(/\n$/,""))),n&&r.push(On("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&r.push(sr("note","interrupted before it finished")),r.length?r:[sr("output","none")]}function iF(e,t,n){const r=ds(t)?t:null;if(r&&(e==="Edit"||e==="MultiEdit")){const a=rr(r.file_path),l=(e==="MultiEdit"?Array.isArray(r.edits)?r.edits:[]:[r]).filter(ds).filter(c=>rr(c.old_string)!=null&&rr(c.new_string)!=null);if(a&&l.length){const c=[sr("file",a)];return l.forEach((u,f)=>{const p=u.replace_all===!0?", every occurrence":"";c.push(wR(l.length>1?`change ${f+1}${p}`:`change${p}`,nF(u.old_string,u.new_string)))}),{input:c,response:jN(n)}}}if(r&&e==="Write"){const a=rr(r.file_path),l=rr(r.content);if(a&&l!=null)return{input:[sr("file",a),On("content",l)],response:jN(n)}}if(r&&e==="Read"){const a=rr(r.file_path);if(a){const l=sF(r);return{input:l?[sr("file",a),sr("lines",l)]:[sr("file",a)],response:aF(n)}}}if(r&&e==="Bash"){const a=rr(r.command);if(a!=null){const l=rr(r.description);return{input:l?[On("command",a),sr("why",l)]:[On("command",a)],response:oF(n)}}}return{input:[On(void 0,Do(t))],response:[On(void 0,Do(n))]}}function EN(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(ds(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(`
|
|
78
|
+
`);if(e==="Read"&&t==="response"&&ds(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 lF({tool:e,onClose:t}){const n=un(t),r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",a=e.input??e.inputPreview,l=e.response??e.errorPreview,c=iF(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:nR(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(TN,{text:EN(e.name,"input",a),what:"input"})]}),c.input.map((u,f)=>i.jsx(CN,{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(TN,{text:EN(e.name,"response",l),what:"response"})]}),e.endedAt==null?i.jsx("pre",{children:"(waiting…)"}):c.response.map((u,f)=>i.jsx(CN,{block:u},f))]})]})]})})}const cF={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function CN({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}=tF(eF(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?cF[l.tone]:void 0,children:[l.text,c<r.length-1?`
|
|
79
|
+
`:""]},c)):r.map(l=>l.text).join(`
|
|
80
|
+
`)}),a&&i.jsx("button",{type:"button",className:"btn tm-more",onClick:()=>n(!0),children:"show all"})]})}function TN({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 al(e).then(l=>{!l||!a.current||(r(!0),window.setTimeout(()=>{a.current&&r(!1)},1600))}),children:n?"copied":"copy"})}const _d=18,AN=26,uF=12,dF=240;function hF(e,t){return(e+dF)*(t||1)}function fF(e){return pF(e.nodeInternals.values())}function pF(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=$N(l)??h.label),l.kind==="root"&&(h.name=ON(l)),l.kind==="root"&&(h.alarm=vr(l.waiting)),l.kind==="root"&&(h.branch=IN(l))):t.set(l.sessionId,{minX:c,minY:u,maxX:f,maxY:p,label:$N(l)??l.sessionId,name:ON(l),alarm:l.kind==="root"&&vr(l.waiting),branch:IN(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,...yF(l.label,l.name,a,c),x:l.minX-_d,y:l.minY-_d-AN,w:l.maxX-l.minX+_d*2,h:l.maxY-l.minY+_d*2+AN,...l.alarm?{alarm:!0}:null,...l.branch?{branch:l.branch}:null})}return r}const zd=" · ",mF=32,gF=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function RN(e){return gF.test(e)?2:1}function MN(e,t=mF){const n=[...e];let r=0;for(const c of n)r+=RN(c);if(r<=t)return e;const a=[];let l=0;for(const c of n){const u=RN(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 yF(e,t,n,r){const a=(t==null?void 0:t.trim())??"",l=r?wF(n):void 0,c=[e,a||void 0,l].filter(Boolean);return{label:MN(e),name:a?MN(a):void 0,shortId:l,fullLabel:c.join(zd)}}function wF(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function IN(e){if(e.kind!=="root")return;const t=e.branch;return t&&t.total>0?dR(t):void 0}function $N(e){if(e.kind==="root")return e.label}function ON(e){if(e.kind==="root")return j0(e.sessionName,e.sessionTitle).face}function vF({onFocusSession:e}){const{x:t,y:n,zoom:r}=DA(),a=pt(fF,xF);if(a.length<=1)return null;const l=u=>{try{e==null||e(u)}catch{}},c={transform:`translate(${t}px, ${n}px) scale(${r})`};return i.jsx("div",{className:"session-clusters",style:c,children:a.map(u=>{const f=rh(u.sessionId),p={position:"absolute",left:0,top:0,transform:`translate(${u.x}px, ${u.y}px)`,width:u.w,height:u.h,"--session-hue":f},h={position:"absolute",left:u.x+16,top:u.y-uF/(r||1),transform:`scale(${1/(r||1)})`,transformOrigin:"left top",maxWidth:hF(u.w,r),"--session-hue":f};return i.jsxs(me.Fragment,{children:[i.jsx("div",{className:"cluster-card",style:p,"aria-hidden":!0}),i.jsxs("button",{type:"button",className:"cluster-label","data-alarm":u.alarm?"":void 0,style:h,title:`${u.alarm?`Waiting on you
|
|
81
|
+
`:""}Zoom to ${u.fullLabel}
|
|
82
|
+
drag the wrapper to move the whole session`,onClick:()=>l(u.sessionId),children:[u.alarm?i.jsxs(i.Fragment,{children:[i.jsx(M0,{}),i.jsx("span",{className:"cluster-label-said",children:"waiting on you: "})]}):null,u.label,u.branch?i.jsx("span",{className:"cluster-label-branch",children:zd+u.branch}):null,u.name?i.jsx("span",{className:"cluster-label-name",children:zd+u.name}):null,u.shortId?i.jsx("span",{className:"cluster-label-id",children:zd+u.shortId}):null]})]},u.sessionId)})})}function xF(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.alarm!==a.alarm||r.branch!==a.branch||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 bF({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 vR(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 Hd(e){return vR(Math.floor(e/1e3))}function xR(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 kF(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function sh(e,t,n){const r=new Date(e),a=Hd(t-e);return{label:kF(r,new Date(t))?a:`${a} · ${r.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:r.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function NF({data:e}){const t=ul(3e4),n=sh(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(Pc,{}),"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(),Q6(e.noteKey)},children:"×"})]}),i.jsx("p",{className:"recap-note-text",children:e.recap.text}),i.jsxs("div",{className:"lod-face recap-face","aria-hidden":!0,children:[i.jsxs("div",{className:"lod-id",children:[i.jsxs("span",{className:"recap-note-mark",children:[i.jsx(Pc,{}),"recap"]}),i.jsx("span",{className:"recap-face-age",children:n.label})]}),i.jsx("p",{className:"recap-face-text",children:e.recap.text})]}),i.jsx(Lo,{type:"source",position:Ve.Right,style:{background:"transparent",border:"none"}})]})}function _F({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a,targetPosition:l,style:c}){const[u]=g0({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})]})}function SF(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=Kn(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 jF="spend on this board",EF="on this board",PN=`Everything on the board right now, and only that.
|
|
83
|
+
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.
|
|
84
|
+
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,bR="session spend",Px="__unknown__",CF=12;function TF(e,t=Date.now()){const n=new Map;for(const r of e)for(const a of Xc(r)){const l=a.model??Px,c=_0(a.usage,a.model,t),u=n.get(l);u?(u.inputTokens+=a.usage.inputTokens,u.outputTokens+=a.usage.outputTokens,u.cacheReadTokens+=a.usage.cacheReadTokens,u.cacheCreateTokens+=a.usage.cacheCreateTokens,u.cost.total+=c.total,u.cost.input+=c.input,u.cost.output+=c.output,u.cost.cacheRead+=c.cacheRead,u.cost.cacheWrite+=c.cacheWrite,u.agentCount++):n.set(l,{model:l,inputTokens:a.usage.inputTokens,outputTokens:a.usage.outputTokens,cacheReadTokens:a.usage.cacheReadTokens,cacheCreateTokens:a.usage.cacheCreateTokens,cost:{...c},agentCount:1,priced:cl(a.model,t)!=null})}return Array.from(n.values()).sort((r,a)=>a.cost.total-r.cost.total||a.inputTokens+a.outputTokens-(r.inputTokens+r.outputTokens))}function AF(e,t=Date.now()){const n=[...e],r=[];for(const a of n){if(a.kind!=="root")continue;let l=Kn(a,t).total,c=a.usage.inputTokens,u=a.usage.outputTokens,f=Oc(a,t);for(const p of n)p.sessionId!==a.sessionId||p.kind==="root"||(l+=Kn(p,t).total,c+=p.usage.inputTokens,u+=p.usage.outputTokens,f+=Oc(p,t));r.push({sessionId:a.sessionId,label:a.label||a.cwdBasename||"session",state:a.state,cost:l,inputTokens:c,outputTokens:u,unpricedTokens:f})}return r.sort((a,l)=>l.cost-a.cost||l.inputTokens+l.outputTokens-(a.inputTokens+a.outputTokens)).slice(0,CF)}function $0({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}: ${kt(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 RF({state:e,sessionId:t,onClose:n}){const r=x.useMemo(()=>MF(e,t),[e,t]),a=x.useRef(null),l=un(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:bR}),i.jsx("div",{className:"ss-cost",children:kt(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":Sh(c),title:c,children:Pa(c)},c))})]}),i.jsx("div",{className:"ss-hero-right",children:r.cost.total>0&&i.jsxs(i.Fragment,{children:[i.jsx($0,{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:kt(r.cost.input)})]}),i.jsxs("span",{className:"ssl ssl-out",children:["output ",i.jsx("b",{children:kt(r.cost.output)})]}),i.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",i.jsx("b",{children:kt(r.cost.cacheRead)})]}),i.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",i.jsx("b",{children:kt(r.cost.cacheWrite)})]})]})]})})]}),i.jsxs("section",{className:"ss-stats",children:[i.jsx($i,{label:"agents",value:r.agentCount}),i.jsx($i,{label:"subagents",value:r.subagentCount}),i.jsx($i,{label:"tool calls",value:r.toolCount}),i.jsx($i,{label:"prompts",value:r.promptCount}),i.jsx($i,{label:"tokens",value:r.tokensSum.toLocaleString()}),r.errCount>0&&i.jsx($i,{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 $i({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 MF(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,_=0;for(const E of r){const C=Kn(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 JA(E))l.add(R);E.model&&l.add(E.model),E.kind==="subagent"&&m++;const T=HA(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),_=Math.max(_,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,_-w),j=Math.floor(k/1e3),b=j<60?`${j}s`:j<3600?`${Math.floor(j/60)}m ${String(j%60).padStart(2,"0")}s`:`${Math.floor(j/3600)}h ${Math.floor(j%3600/60)}m`,S=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:S,firstPrompt:y}}function LN(e){return e.waiting?vr(e.waiting)?0:1:e.state==="active"?2:3}function IF(e,t){const n=[];for(const r of e.agents.values()){if(r.kind!=="root")continue;let a=r.toolCount,l=Kn(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+=Kn(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:Ch(r),modelId:r.model,toolCount:a,cost:l,startedAt:r.startedAt,lastActivity:c})}return n.sort((r,a)=>{const l=LN(r),c=LN(a);return l!==c?l-c:r.waiting&&a.waiting?r.waiting.since-a.waiting.since:a.lastActivity-r.lastActivity}),n}function DN(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 $F({state:e,now:t,selectedIds:n,onSelect:r,onClose:a}){const l=x.useMemo(()=>IF(e),[e,e.revision,t]),c=l.filter(f=>f.state==="active").length,u=l.filter(f=>vr(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:rl(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":Sh(f.modelId),title:f.modelId,children:Pa(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:bR,children:i.jsx("b",{children:kt(f.cost)})}),f.waiting?i.jsxs("span",{className:"sl-waiting",title:[sl(f.waiting),KD(f.waiting,sl(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
85
|
+
`),children:["waiting ",DN(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:DN(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(Pc,{}),f.recap.text]})]})]},f.sessionId)})]})]})}const OF=e=>1-Math.pow(1-e,5),kR=420;function PF(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 LF(e,t,n,r=kR){return n>=r?t:n<=0?e:e+(t-e)*OF(n/r)}function DF(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()||!PF(e,t))return n(t),()=>{};const p=a();let h=0,m=!0;const y=()=>{if(!m)return;const w=a()-p;n(LF(e,t,w)),w<kR&&(h=l(y))};return h=l(y),()=>{m=!1,h&&c(h)}}const Lx={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function FF(e){if(!e.synthetic)return!1;const t=e.usage;return t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreateTokens<=0}function $p(e,t){const n=new Map;for(const r of e){if(r.kind!=="root"||!r.sessionId||FF(r))continue;const a=Kn(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 qF(e,t){if(!e)return Lx;const n={...Lx};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 NR(e,t,n){const r=zF*Math.max(1,n/SR);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 FN={samples:[],last:new Map,watched:0},_R=10*6e4,BF=6e4,SR=5e3,zF=20;function HF(e,t,n){const r=e.samples[e.samples.length-1];if(r&&t-r.t<SR)return e;const a=e.watched+NR(e.last,n,r?t-r.t:0),l=e.samples.filter(c=>t-c.t<=_R);return l.push({t,watched:a}),{samples:l,last:n,watched:a}}function WF(e,t,n){const r=e.samples[0];if(!r)return null;const a=t-r.t;if(a<BF)return null;const l=e.samples[e.samples.length-1].t,c=e.watched+NR(e.last,n,t-l)-r.watched;return c>0?{spent:c,spanSec:a/1e3,spanMin:Math.min(_R/6e4,Math.ceil(a/6e4))}:null}function qN(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const Th=[{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 UF(e,t,n=Th.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 VF(e,t=new Date){return e==="today"?qN(1,t):e==="month"?qN(t.getDate(),t):"20200101"}const ar=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Wd=e=>typeof e=="string"?e:"";function jR(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=Wd(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+=ar(l==null?void 0:l.cost),u.inputTokens+=ar(l==null?void 0:l.inputTokens),u.outputTokens+=ar(l==null?void 0:l.outputTokens),u.cacheReadTokens+=ar(l==null?void 0:l.cacheReadTokens),u.cacheCreateTokens+=ar(l==null?void 0:l.cacheCreationTokens)}}return[...n.values()].sort((r,a)=>a.cost-r.cost||a.tokens-r.tokens)}const GF=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function KF(e){var t;return((t=GF.exec(e))==null?void 0:t[0])??e}function YF(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],r=[];for(const a of n){const l=Wd(a==null?void 0:a.period);if(!l)continue;const c=KF(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:Wd(a==null?void 0:a.agent)||"claude",cost:ar(a==null?void 0:a.totalCost),tokens:ar(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Wd).filter(Boolean):[],lastActivityMs:Number.isFinite(f)?f:null})}return r.sort((a,l)=>l.cost-a.cost||l.tokens-a.tokens)}function ER(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=ar(t.cacheReadTokens),p=ar(t.cacheCreationTokens),h=ar(t.inputTokens),m=ar(t.outputTokens);return{cost:ar(t.totalCost),inputTokens:h,outputTokens:m,cacheReadTokens:f,cacheCreateTokens:p,tokens:ar(t.totalTokens)||h+m+f+p}}const n=jR(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 XF(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 BN(e,t){var n;return((n=Th.find(r=>r.key===(e??t)))==null?void 0:n.noun)??"today"}function ZF(e,t,n){const r=e!=null,a=ER(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 nn="ccdeck";function La(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function Ah(e){return e==null}const Dx="self";function Aa(e,t=!1){const n=La(e?Dx:null,Dx);return{disabled:t||n.disabled,"aria-busy":n.busy}}function Ls(e){return Ah(e?Dx:null)}function ah({armedFor:e,target:t,armedAt:n,now:r,gapMs:a}){return e!==t?"arm":r-n<a?"ignore":"fire"}function QF(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function zN(e){return e==null||e==="BODY"||e==="HTML"}const CR="agent-dag.usagePeriod";function JF(){const e=Da(CR);return Th.some(t=>t.key===e)?e:"today"}function eq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(CR,e)}catch{}}const TR="agent-dag.usageSessionsOpen";function tq(){return Da(TR)==="1"}function nq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(TR,e?"1":"0")}catch{}}function HN(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 rq(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"}function sq(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 _a({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?xR(r,c):null,w=r&&a?sq(u,r,a,c):null,[_,k]=x.useState(!1),j=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":_,"aria-controls":_?j: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]})]}),_&&w&&i.jsxs("div",{id:j,className:"qb-why",children:["To last until reset, stay near ",Math.round(w.expectedPct),"% by now."]})]})}const aq=6e4,oq=2e4;function iq(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&&!Ls(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(oq)});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),aq),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:t,loading:r,refresh:()=>{e&&u(!0)}}}function lq(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 cq(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 AR=6e4,WN=6e4;function uq(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&&!Ls(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),AR),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:t,loading:r,refresh:()=>{e&&u(!0)}}}function dq(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,AR),()=>{r.current!=null&&window.clearInterval(r.current)}},[e]),{data:t}}function hq(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,WN),_=()=>{m()&&Date.now()-p.current>=WN&&f(k=>k+1)};return document.addEventListener("visibilitychange",_),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",_)}},[]);const h=x.useRef(t);return x.useEffect(()=>{let m=!0;const y=t!==h.current;h.current=t;const w=e,_=VF(w);return c(!0),fetch(`/api/ccusage?since=${_}${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]),{...XF(r,e),loading:l}}function fc(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 DF(r.current,e,c=>{r.current=c,n(c)})},[e]),t}function fq({state:e,now:t,providers:n,leaving:r,onClose:a,liveSince:l=null}){var We,tt;const{quota:c,loading:u,refresh:f}=iq(n.claude),{data:p,loading:h,refresh:m}=uq(n.codex),{data:y}=dq(n.codex),[w,_]=x.useState(()=>Math.floor(Date.now()/1e3));x.useEffect(()=>{const we=window.setInterval(()=>_(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(we)},[]);const k=x.useRef(FN),j=x.useRef(null),{byModel:b,totalCost:S,totalTokens:E,burnRate:C}=x.useMemo(()=>{const we=TF(e.agents.values()),Me=SF(e.agents.values());j.current!==l&&(j.current=l,k.current=FN);const Qe=$p(e.agents.values(),t);l!=null&&(k.current=HF(k.current,t,Qe));const ce=l==null?null:WF(k.current,t,Qe),lt=ce?{label:S0(ce.spent,ce.spanSec),spanMin:ce.spanMin}:null;return{byModel:we,totalCost:Me.cost,totalTokens:Me,burnRate:lt}},[e,e.revision,t,l]),T=x.useMemo(()=>AF(e.agents.values()),[e,e.revision]),[R,$]=x.useState(JF);x.useEffect(()=>{eq(R)},[R]);const[H,B]=x.useState(tq);x.useEffect(()=>{nq(H)},[H]);const P=x.useRef([]),[G,Q]=x.useState(0),J=x.useRef(()=>new Map);J.current=()=>$p(e.agents.values(),t);const M=x.useCallback(()=>J.current(),[]),{data:X,shown:V,stale:I,loading:q,baseline:W}=hq(R,G,M),K=X!=null,F=q&&I,D=x.useMemo(()=>{const we=new Map;for(const Me of e.agents.values()){if(Me.kind!=="root"||!Me.sessionId)continue;const Qe=Me.label||Me.cwdBasename;Qe&&we.set(Me.sessionId,Qe)}return we},[e,e.revision]),ae=x.useMemo(()=>{const we=new Map;for(const Me of e.agents.values())Me.kind!=="root"||!Me.sessionId||we.set(Me.sessionId,Me.state);return we},[e,e.revision]),z=x.useMemo(()=>K?jR(X):[],[X,K]),Z=x.useMemo(()=>{if(!K)return[];const we=YF(X,D).slice(0,12),Me=new Map;for(const Qe of we)Qe.label&&Me.set(Qe.label,(Me.get(Qe.label)??0)+1);return we.map(Qe=>Qe.label&&(Me.get(Qe.label)??0)>1?{...Qe,label:`${Qe.label} ${Qe.sessionId.slice(0,4)}`}:Qe)},[X,K,D]),U=x.useMemo(()=>ER(X),[X]),re=BN(V,R),de=I?" up-stale":"",ge=x.useMemo(()=>K?qF(W,$p(e.agents.values(),t)):Lx,[e,e.revision,W,K,t]),pe=ZF(X,{...E,cost:S},ge),_e=pe.hasCost,Pe=pe.tokenSum,$e=fc(pe.cost),Te=fc(pe.inputTokens),je=fc(pe.outputTokens),et=fc(pe.cacheReadTokens),Ce=fc(pe.cacheCreateTokens),Ne=b.filter(we=>we.cost.total>0||we.inputTokens+we.outputTokens>0),He=T.filter(we=>we.cost>0||we.inputTokens+we.outputTokens>0),it=K?z.some(we=>we.cost<=0&&we.tokens>0):Ne.some(we=>!we.priced),ot=u||h,le=HN(c==null?void 0:c.fetchedAt,w),be=HN(p==null?void 0:p.fetchedAt,w),Re=()=>{f(),m(),Q(we=>we+1)},Ze=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:Re,...Aa(ot),"aria-label":Ze,title:Ze,children:ot?"…":"↻"}),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",le&&!u&&i.jsx("span",{className:"up-section-age",title:rq(c==null?void 0:c.source),children:le})]}),c!=null&&c.ok?i.jsxs("div",{className:"up-quota-bars",children:[c.session5hPct!=null&&i.jsx(_a,{label:"5-hour window",pct:c.session5hPct,reset:c.session5hReset,resetAt:c.session5hResetAt,windowSec:c.session5hWindowSec,nowSec:w}),c.week7dPct!=null&&i.jsx(_a,{label:"7-day window",pct:c.week7dPct,reset:c.week7dReset,resetAt:c.week7dResetAt,windowSec:c.week7dWindowSec,nowSec:w}),c.weekSonnetPct!=null&&i.jsx(_a,{label:"Sonnet (7d)",pct:c.weekSonnetPct,nowSec:w}),c.weekOpusPct!=null&&i.jsx(_a,{label:"Opus (7d)",pct:c.weekOpusPct,nowSec:w}),c.extraEnabled&&c.extraUsedCredits!=null&&c.extraMonthlyLimit?i.jsx(_a,{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:lq(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}),be&&!h&&i.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:be})]}),p!=null&&p.ok?i.jsxs("div",{className:"up-quota-bars",children:[(We=p.windows)==null?void 0:We.map(we=>i.jsx(_a,{label:we.label,pct:we.pct,reset:we.reset??void 0,resetAt:we.resetAt??void 0,windowSec:we.windowSec??void 0,limitReached:p.limitReached&&we.pct>=100,nowSec:w},we.id)),(tt=p.extraWindows)==null?void 0:tt.map(we=>i.jsx(_a,{label:we.label,pct:we.pct,reset:we.reset??void 0,resetAt:we.resetAt??void 0,windowSec:we.windowSec??void 0,nowSec:w},we.id)),p.creditLimit&&i.jsx(_a,{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 — ${nn} 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:cq(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?`
|
|
86
|
+
last 5h: ${mn(y.window5h.totalTokens)} tokens · ${y.window5h.sessionCount} session${y.window5h.sessionCount!==1?"s":""}`:""}`,children:[mn(y.window7d.totalTokens)," tokens · ",y.window7d.sessionCount," session",y.window7d.sessionCount!==1?"s":""," (7d)"]})]}),K&&i.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":F||void 0,onKeyDown:we=>{var ce;const Me=P.current.indexOf(we.target);if(Me<0)return;const Qe=UF(we.key,Me);Qe!==null&&(we.preventDefault(),(ce=P.current[Qe])==null||ce.focus())},children:Th.map((we,Me)=>i.jsx("button",{type:"button",ref:Qe=>{P.current[Me]=Qe},tabIndex:R===we.key?0:-1,"aria-pressed":R===we.key,"data-pending":R===we.key&&F?"":void 0,title:R===we.key&&F?`Reading ${we.noun} from the transcripts on this machine…`:we.hint,className:"uh-range-btn",onClick:()=>$(we.key),children:we.label},we.key))}),K&&i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:F?`Reading ${BN(R,R)}…`:""}),Pe>0?i.jsxs(i.Fragment,{children:[_e&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`up-total${de}`,title:K?void 0:PN,children:[i.jsx("span",{className:"up-total-value",children:kt($e)}),i.jsx("span",{className:"up-total-label",children:K?re:jF})]}),pe.showCostBar&&i.jsx($0,{cost:S})]}),i.jsxs("div",{className:`up-tokens-row${de}`,title:K?void 0:PN,children:[i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"in"}),mn(Te)]}),i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"out"}),mn(je)]}),pe.cacheReadTokens>0&&i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"cache r"}),mn(et)]}),pe.cacheCreateTokens>0&&i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"cache c"}),mn(Ce)]}),!_e&&i.jsx("span",{className:"up-tok up-scope",children:EF})]}),(K?z.length:Ne.length)>0&&i.jsxs("section",{className:`up-section${de}`,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:K?z.map(we=>i.jsxs("tr",{children:[i.jsx("td",{className:"up-model-name",title:we.model,children:Pa(we.model)}),i.jsx("td",{className:"up-num",children:mn(we.tokens)}),we.cost>0?i.jsx("td",{className:"up-num up-cost-val",children:kt(we.cost)}):i.jsx("td",{className:"up-num up-unpriced",children:qi})]},we.model)):Ne.map(we=>i.jsxs("tr",{children:[i.jsx("td",{className:"up-model-name",title:we.model===Px?"no model reported yet":we.model,children:we.model===Px?"unknown":Pa(we.model)}),i.jsx("td",{className:"up-num",children:mn(we.inputTokens+we.outputTokens)}),we.priced?i.jsx("td",{className:"up-num up-cost-val",children:kt(we.cost.total)}):i.jsx("td",{className:"up-num up-unpriced",children:qi})]},we.model))})]})]}),K&&Z.length===0&&U.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 ",re," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(K?Z.length:He.length)>0&&(()=>{const we=K?Z.length:He.length;return i.jsxs("section",{className:`up-section${de}`,children:[i.jsx("h3",{className:"up-section-title",children:i.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":H,"aria-controls":"up-sessions",title:H?"Hide the per-session breakdown":`Show the per-session breakdown — ${we} session${we===1?"":"s"}`,onClick:()=>B(Me=>!Me),children:["By session",K&&i.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${re}, each showing what that session has cost since it started.
|
|
87
|
+
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 ",re]}),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:!H,children:[K&&Z.map(Me=>{const Qe=ae.get(Me.sessionId);return i.jsxs("div",{className:"up-session-row",children:[Qe?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:`sl-dot state-${Qe}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:rl(Qe)})]}):i.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),i.jsx("span",{className:`up-session-label${Me.label?"":" up-session-id"}`,title:Me.label?`${Me.label}
|
|
88
|
+
${Me.sessionId}`:Me.sessionId,children:Me.label??Me.sessionId.slice(0,8)}),i.jsx("span",{className:"up-session-tokens",children:mn(Me.tokens)}),Me.cost>0?i.jsx("span",{className:"up-session-cost",title:Me.models.join(", ")||void 0,children:kt(Me.cost)}):i.jsx("span",{className:"up-session-cost up-unpriced",children:qi})]},Me.sessionId)}),!K&&He.map(Me=>i.jsxs("div",{className:"up-session-row",children:[i.jsx("span",{className:`sl-dot state-${Me.state}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:rl(Me.state)}),i.jsx("span",{className:"up-session-label",children:Me.label}),i.jsx("span",{className:"up-session-tokens",children:mn(Me.inputTokens+Me.outputTokens)}),Me.cost>0?i.jsxs("span",{className:"up-session-cost",title:Me.unpricedTokens>0?`${mn(Me.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[kt(Me.cost),Me.unpricedTokens>0?"+":""]}):i.jsx("span",{className:"up-session-cost up-unpriced",children:qi})]},Me.sessionId))]})]})})(),it&&i.jsxs("div",{className:"up-hint",children:["“",qi,"” 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:K?i.jsxs(i.Fragment,{children:["No usage ",re,".",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."]})})]})}function Op(e){return e<9.95?e.toFixed(1):String(Math.round(e))}function O0(e){const t=Number.isFinite(e)?Math.max(0,e):0;return t<50?{value:"0",unit:"KB/s"}:t<999500?{value:Op(t/1e3),unit:"KB/s"}:t<9995e5?{value:Op(t/1e6),unit:"MB/s"}:{value:Op(t/1e9),unit:"GB/s"}}function Rh(e){const t=Number.isFinite(e)?Math.max(0,e):0;return t<999.5?{value:String(Math.round(t)),unit:"ms"}:{value:(t/1e3).toFixed(1),unit:"s"}}function Lc(e){return e.unit?e.unit==="%"||e.unit==="°C"?`${e.value}${e.unit}`:`${e.value} ${e.unit}`:e.value}function Pp(e,t){return t==="B/s"?O0(e):t==="ms"?Rh(e):{value:String(e),unit:t==="C"?"°C":t}}const en={l:30,r:6,t:6,b:2},Sa={l:0,r:0,t:2,b:1},Mh=104,pq=64;function zr(e,t=100,n=Mh,r=en){const a=n-r.t-r.b;return r.t+a*(1-Math.max(0,Math.min(t,e))/t)}function RR(e,t,n,r=100,a=Mh,l=en){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)} ${zr(h.v,r,a,l).toFixed(1)}`,p=h}return f}function MR(e,t,n,r=100,a=Mh,l=en){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 _ of m)w+=`L${p(_.t).toFixed(1)} ${zr(_.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 mq(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 IR(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function gq(e,t,n=r=>Co(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 Co(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function P0(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 yq({group:e,title:t,onClose:n}){const r=un(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 Yn.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 ",Co(u)," · ",P0(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(wq,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function wq({series:e,stepMs:t}){const n=x.useRef(null),[r,a]=x.useState(560),[l,c]=x.useState(null);x.useEffect(()=>{const B=n.current;if(!B||typeof ResizeObserver>"u")return;const P=new ResizeObserver(([G])=>a(Math.max(160,G.contentRect.width)));return P.observe(B),()=>P.disconnect()},[]);const{points:u,unit:f,warnAt:p,critAt:h,label:m,top:y,restsAtZero:w,changes:_}=e,k=w?pq:Mh,{now:j,peak:b}=mq(u),S=j!=null?Pp(j,f):null,E=b!=null?Pp(b,f):null,C=m==="Throttling"?gq(u,t):null,T=l!=null?u[l]:null,R=u.length>1?u[u.length-1].t-u[0].t:0,$=B=>{const P=r-en.l-en.r;return en.l+(R>0?P*(B-u[0].t)/R:P/2)},H=B=>{if(u.length<2)return;const P=B.currentTarget.getBoundingClientRect(),G=(B.clientX-P.left-en.l)/Math.max(1,P.width-en.l-en.r),Q=u[0].t+R*Math.max(0,Math.min(1,G));let J=0;for(let M=1;M<u.length;M++)Math.abs(u[M].t-Q)<Math.abs(u[J].t-Q)&&(J=M);c(J)};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:[S&&i.jsxs(i.Fragment,{children:[i.jsx("b",{children:S.value}),i.jsxs("span",{children:[S.unit," now"]})]}),b!=null&&E&&i.jsxs(i.Fragment,{children:[i.jsx("b",{className:IR(b,p,h),children:E.value}),i.jsxs("span",{children:[E.unit," peak"]})]})]})]}),i.jsx("div",{className:"hist-plot",ref:n,children:i.jsxs("svg",{className:"hist-chart",width:"100%",height:k,viewBox:`0 0 ${r} ${k}`,preserveAspectRatio:"none",role:"img","aria-label":S==null||E==null?`${m}: nothing measured yet`:`${m}: ${Lc(S)} now, peak ${Lc(E)}, over ${P0(u[0].t,u[u.length-1].t)}`,onPointerMove:H,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",h]].map(([B,P])=>P==null||P>y?null:i.jsxs("g",{children:[i.jsx("line",{className:`hist-rule ${B}`,x1:en.l,x2:r-en.r,y1:zr(P,y,k),y2:zr(P,y,k)}),i.jsx("text",{className:`hist-rule-tag ${B}`,x:2,y:zr(P,y,k)+3,children:P})]},B)),i.jsx("line",{className:"hist-floor",x1:en.l,x2:r-en.r,y1:k-en.b,y2:k-en.b}),(_??[]).filter(B=>B.from!=null&&u.length>1&&B.t>=u[0].t&&B.t<=u[u.length-1].t).map(B=>i.jsx("line",{className:"hist-mark",x1:$(B.t),x2:$(B.t),y1:en.t,y2:k-en.b},B.t)),i.jsx("path",{className:"hist-area",d:MR(u,r,t,y,k)}),i.jsx("path",{className:"hist-line",d:RR(u,r,t,y,k)}),u.length===1&&i.jsx("circle",{className:"hist-dot",cx:$(u[0].t),cy:zr(u[0].v,y,k),r:3}),T&&i.jsxs("g",{children:[i.jsx("line",{className:"hist-cross",x1:$(T.t),x2:$(T.t),y1:en.t,y2:k-en.b}),i.jsx("circle",{className:"hist-dot",cx:$(T.t),cy:zr(T.v,y,k),r:3})]})]})}),i.jsx("div",{className:"hist-axis",children:T?i.jsxs("span",{className:"hist-at",children:[Co(T.t)," — ",(()=>{const B=Pp(T.v,f);return i.jsxs(i.Fragment,{children:[i.jsx("b",{children:B.value}),B.unit==="%"||B.unit==="°C"||!B.unit?B.unit:` ${B.unit}`]})})()]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:u.length?Co(u[0].t):""}),i.jsx("span",{children:u.length?Co(u[u.length-1].t):""})]})}),C&&i.jsx("div",{className:"hist-note",children:C}),_==null?void 0:_.slice(-3).map(B=>i.jsx("div",{className:"hist-note hist-route",children:B.from==null?`Since ${Co(B.t)} — ${B.label}`:`${Co(B.t)} — ${B.label.charAt(0).toUpperCase()+B.label.slice(1)}`},B.t))]})}function vq(e,t,n){if(n<=0||Eh(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 Ra=4,qr=8;function L0(e,t,n){const r=n.width-qr-(e.right+Ra),a=e.left-Ra-qr,l=t.width<=r||r>=a?"right":"left",c=l==="right"?e.right+Ra:e.left-Ra-t.width,u=n.height-qr*2,f=t.height<=u,p=f?t.height:Math.max(0,u);return{top:Math.max(qr,Math.min(e.top,n.height-qr-p)),left:Math.max(qr,c),side:l,maxHeight:f?null:p}}function xq(e,t,n){const r=n.height-qr-(e.bottom+Ra),a=e.top-Ra-qr,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+Ra:e.top-Ra-f,h=Math.max(qr,Math.min(e.right-t.width,n.width-qr-t.width));return{top:Math.max(qr,p),left:h,side:l,maxHeight:u?null:f}}const $R='[role="menuitem"]';function UN(e){return e?Array.from(e.querySelectorAll($R)).filter(t=>!t.disabled):[]}function Fx({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=un(()=>{var k;(k=document.getElementById(e))==null||k.focus(),p.current()},{popover:!0}),m=x.useCallback(()=>{var C;const k=h.current;if(!k)return;const j=document.getElementById(e);if(!j){p.current();return}const b=j.getBoundingClientRect(),S=t?(C=document.getElementById(t))==null?void 0:C.getBoundingClientRect():null;if(S&&(b.bottom<=S.top||b.top>=S.bottom)){k.contains(document.activeElement)&&j.focus({preventScroll:!0}),p.current();return}k.style.maxHeight="";const E=xq(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=j=>{var b;(b=h.current)!=null&&b.contains(j.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=j=>{var S,E;const b=j.target;!b||(S=h.current)!=null&&S.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 j;if(a!=="menu")return;const k=UN(h.current);(j=c==="last"?k[k.length-1]:k[0])==null||j.focus()},[]);const y=k=>{var j;if(a==="menu"&&k.key==="Tab"){k.stopPropagation(),(j=document.getElementById(e))==null||j.focus(),k.shiftKey&&k.preventDefault(),p.current();return}if(a==="menu"){const b=UN(h.current),S=vq(k,b.indexOf(document.activeElement),b.length);S.kind==="focus"&&(k.preventDefault(),b[S.index].focus())}k.key.length===1&&k.stopPropagation()},w=k=>{k.target.closest("button, input, select, textarea, code")||k.preventDefault()},_=k=>{if(a!=="menu"||k.pointerType==="touch")return;const j=k.target.closest($R);j&&!j.disabled&&document.activeElement!==j&&j.focus({preventScroll:!0})};return Yn.createPortal(i.jsx("div",{ref:h,id:n,className:`anchored-popover${r?` ${r}`:""}`,role:a,"aria-labelledby":l,onKeyDown:y,onMouseDown:w,onPointerMove:_,children:f}),document.body)}const bq="thermal:Throttling";function kq(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[bq]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Sc(e,t){return t==="B/s"?Lc(O0(e)):t==="ms"?Lc(Rh(e)):t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function Sd(e,t){return t==="B/s"||t==="ms"||!Number.isInteger(e)?Sc(e,t):t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`}const VN=["cores","memory","load","thermal"],jo=116,cs=24,Nq=60,_q=6e4;function Sq(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function jq(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function Eq(e,t=Nq){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function Cq({sys:e}){const[t,n]=x.useState({});x.useEffect(()=>{let c=!0;const u=async()=>{const p=await Promise.all(VN.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(),_q);return()=>{c=!1,clearInterval(f)}},[]);const r=x.useMemo(()=>kq(e),[e]),a=x.useMemo(()=>VN.flatMap(c=>{const u=t[c];return u?u.series.filter(Sq).map(f=>({series:Eq(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)?P0(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(Tq,{series:c,stepMs:u,now:r[c.key],span:l},c.key))}):null}function Tq({series:e,stepMs:t,now:n,span:r}){var w;const{points:a,top:l,unit:c,warnAt:u,critAt:f}=e,p=jq(e),h=n??((w=a[a.length-1])==null?void 0:w.v),m=h==null?"":IR(h,u,f),y=Math.max(...a.map(_=>_.v));return i.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${Sc(y,c)} over the last ${r}`,u!=null?`over ${Sd(u,c)} is uncomfortable`:"",f!=null?`over ${Sd(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?"—":Sc(h,c)})]}),i.jsxs("svg",{className:"pl-spark",width:jo,height:cs,viewBox:`0 0 ${jo} ${cs}`,preserveAspectRatio:"none","aria-hidden":!0,children:[i.jsx("line",{className:"pl-spark-floor",x1:0,x2:jo,y1:cs-Sa.b,y2:cs-Sa.b}),i.jsx("path",{className:"pl-spark-area",d:MR(a,jo,t,l,cs,Sa)}),u!=null&&i.jsx("line",{className:"pl-rule warn",x1:0,x2:jo,y1:zr(u,l,cs,Sa),y2:zr(u,l,cs,Sa)}),f!=null&&i.jsx("line",{className:"pl-rule hot",x1:0,x2:jo,y1:zr(f,l,cs,Sa),y2:zr(f,l,cs,Sa)}),i.jsx("path",{className:"pl-spark-line",d:RR(a,jo,t,l,cs,Sa)})]}),i.jsxs("span",{className:"vis-hidden",children:["peak ",Sc(y,c)," over the last ",r,u!=null&&`, uncomfortable over ${Sd(u,c)}`,f!=null&&`, the machine acts over ${Sd(f,c)}`]})]})}const Aq={key:"cpu",dir:"desc"};function Rq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function Mq(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 Iq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const $q=4e3;function Oq(){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,$q);return()=>{n=!1,window.clearInterval(a)}},[]),e}function Pq(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 Lq(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 Dq({sys:e,onClose:t}){const n=un(t),[r,a]=x.useState(Aq),l=Oq(),c=l?Mq(l.procs,r):null;return Yn.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(Oi,{col:"cpu",label:"cpu",sort:r,onSort:a}),i.jsx(Oi,{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(Oi,{col:"threads",label:"threads",sort:r,onSort:a}),i.jsx(Oi,{col:"uptime",label:"up",sort:r,onSort:a}),i.jsx(Oi,{col:"user",label:"user",sort:r,onSort:a}),i.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),i.jsx(Oi,{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:Pq(u.rssBytes)}),i.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),i.jsx("td",{className:"sd-num sd-dim",children:Lq(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(Cq,{sys:e})]})]})}),document.body)}function Oi({col:e,label:t,note:n,sort:r,onSort:a}){const l=Iq(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}
|
|
89
|
+
|
|
90
|
+
${n}`:`Sort by ${t}`,onClick:()=>a(Rq(r,e)),children:[t,i.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:l==="none"?"":l==="ascending"?"↑":"↓"})]})})}const Fq=3e3;function qq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function Bq(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}% ${zq(t.lastMs,n)}`:"running at full speed, and never held back"}}function zq(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 pc(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 Hq(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 Wq(e){var n,r,a;const t=(r=(n=e.thermal)==null?void 0:n.throttle)==null?void 0:r.speedLimit;return t!=null&&t<100?`throttled to ${t}% of full speed`:e.memory&&e.memory.usedPct>=90?`physical memory ${Math.round(e.memory.usedPct)}% full`:(a=e.network)!=null&&a.api&&e.network.api.ms==null?"the Claude API is not answering":null}function Uq(){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,Fq))},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 GN({usageOpen:e,leaving:t,sub:n,flag:r,onClose:a,children:l}){return i.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[i.jsxs("div",{className:"sd-top",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:a,"aria-label":"Close",title:"Close",children:"×"})]}),r&&i.jsx("p",{className:"sd-flag",children:r})]}),l]})}function Vq({usageOpen:e,leaving:t,onClose:n}){const r=Uq();if(!r||r.cpu==null||!r.memory)return i.jsx(GN,{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,network:y,cpu:w}=r;return i.jsxs(GN,{usageOpen:e,leaving:t,sub:`up ${Hq(p)} · ${f} cores`,flag:Wq(r),onClose:n,children:[i.jsx(Gq,{cpu:w,perCore:c,loadavg:u,cores:f}),i.jsx(Kq,{memory:a,swap:l,platform:h}),y&&i.jsx(Yq,{network:y}),i.jsx(Qq,{thermal:m}),i.jsx(Jq,{sys:r})]})}function Gq({cpu:e,perCore:t,loadavg:n,cores:r}){const a=!!t&&t.length>0;return!a&&!n?null:i.jsxs("div",{className:"sd-section sd-cpu",role:"group","aria-label":"CPU",children:[a&&i.jsx(Dc,{group:"cores",title:"Core history",action:"Show core history",label:"CPU",value:e==null?null:`${Math.round(e)}%`,children:i.jsx("div",{className:"sd-cores",role:"img","aria-label":`${t.length} logical cores, busiest at ${Math.round(Math.max(...t))}%`,children:t.map((l,c)=>i.jsx("span",{className:"sd-core",title:`logical core ${c+1} · ${l}% busy`,children:i.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,l)/100})`}})},c))})}),n&&i.jsxs(Dc,{group:"load",title:"Load history",action:"Show load history",label:"Load average",hint:"the queue for the cores, counted in tasks rather than as a share of them",children:[i.jsx("div",{className:"sd-figs",title:"The queue for this machine's cores, averaged over one, five and fifteen minutes. A count of tasks, not a share of the CPU.",children:n.map((l,c)=>i.jsx(qx,{value:l.toFixed(2),cap:["1m","5m","15m"][c]},c))}),n[0]>r&&i.jsx("div",{className:"sd-note",children:`${(n[0]/r).toFixed(1)}× more work queued than cores to run it`})]})]})}function Kq({memory:e,swap:t,platform:n}){const r=e.total-e.available,a=n==="win32"?"Commit":"Swap",l=t&&t.total>0?t.used/t.total*100:0;return i.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:i.jsxs(Dc,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[i.jsx(oh,{label:"Physical",value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:pc(r)})," of ",pc(e.total)]}),pct:e.usedPct,tone:e.usedPct>=90?"warn":"calm",note:`${pc(e.available)} available`}),t&&t.total>0&&i.jsx(oh,{label:a,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:pc(t.used)})," of ",pc(t.total)]}),pct:l,tone:l>=90?"warn":"calm"})]})})}function Yq({network:e}){const{down:t,up:n,api:r,route:a}=e,[l,c]=x.useState(!1),u=r&&r.ms!=null?Rh(r.ms):null,f=t!=null&&n!=null;return i.jsxs("div",{className:"sd-section",role:"group","aria-label":"Network",children:[i.jsxs(Dc,{group:"network",title:"Network history",action:"Show network history",label:"Network",children:[(f||u)&&i.jsxs("div",{className:"sd-figs sd-figs-named",children:[f&&[["Download",t],["Upload",n]].map(([p,h])=>{const m=O0(h);return i.jsx(qx,{value:m.value,unit:m.unit,cap:p},p)}),u&&i.jsx(qx,{value:u.value,unit:u.unit,cap:"Claude API"})]}),!f&&i.jsx("div",{className:"sd-note",children:"measuring…"}),r&&r.ms==null&&i.jsx("div",{className:"sd-note sd-note-warn",children:"Can’t reach Claude"})]}),a&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"sd-detail",id:"sd-conn","aria-expanded":l,"aria-haspopup":"dialog",onClick:()=>c(p=>!p),children:["Connection details",a.relay&&i.jsx("span",{className:"sd-route-relay",children:" · relayed"}),i.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),l&&i.jsx(Zq,{route:a,api:r,onClose:()=>c(!1)})]})]})}function qx({value:e,unit:t,cap:n}){return t?i.jsxs("span",{className:"sd-fig",children:[i.jsx("span",{className:"sd-fig-cap",children:n}),i.jsxs("span",{className:"sd-fig-read",children:[i.jsx("b",{children:e})," ",i.jsx("span",{className:"sd-fig-unit",children:t})]})]}):i.jsxs("span",{className:"sd-fig",children:[i.jsx("b",{children:e}),i.jsx("span",{className:"sd-fig-cap",children:n})]})}function Xq(e){return e.kind==="tailscale-exit"?e.node?`Tailscale exit node ${e.node}`:"a Tailscale exit node":e.kind==="tailscale"?"Tailscale":`${e.name?`${e.name} `:""}VPN${e.iface?` (${e.iface})`:""}`}function Zq({route:e,api:t,onClose:n}){return i.jsxs(Fx,{anchorId:"sd-conn",boundaryId:"system-panel",id:"sd-conn-pop",className:"sd-pop",role:"dialog",labelledBy:"sd-conn-title",onClose:n,children:[i.jsx("p",{className:"sd-pop-title",id:"sd-conn-title",children:"Connection"}),i.jsxs("dl",{className:"sd-pop-rows",children:[i.jsxs("div",{className:"sd-pop-row",children:[i.jsx("dt",{children:e.to==="claude"?"Traffic to Claude":"Internet traffic"}),i.jsxs("dd",{children:["through ",Xq(e)]})]}),e.relay&&i.jsxs("div",{className:"sd-pop-row",children:[i.jsx("dt",{children:"Relay"}),i.jsxs("dd",{children:[i.jsx("span",{className:"sd-route-relay",children:e.relay})," — not a direct path, so every packet carries one more round trip than it has to"]})]}),t&&i.jsxs("div",{className:"sd-pop-row",children:[i.jsx("dt",{children:"Round trip"}),i.jsx("dd",{children:t.ms==null?`${t.host} did not answer`:`${Lc(Rh(t.ms))} to open a connection to ${t.host}`})]}),i.jsxs("div",{className:"sd-pop-row",children:[i.jsx("dt",{children:"Throughput"}),i.jsx("dd",{children:"every interface on this machine, not this path alone"})]})]})]})}function Dc({group:e,title:t,action:n,label:r,value:a,hint:l,children:c}){const[u,f]=x.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"sd-open",onClick:()=>f(!0),title:n,"aria-label":a==null?n:`${n}, now ${a}`,"aria-describedby":l?`sd-hint-${e}`:void 0,children:[i.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[r," ",i.jsx("i",{className:"sd-row-more",children:"›"}),a!=null&&i.jsx("span",{className:"sd-h-val",children:a})]}),c]}),l&&i.jsx("span",{id:`sd-hint-${e}`,className:"vis-hidden",children:l}),u&&i.jsx(yq,{group:e,title:t,onClose:()=>f(!1)})]})}function Qq({thermal:e}){if(!e)return null;const t=e.throttle?Bq(e.throttle.speedLimit,e.heldBack):null;return i.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:i.jsxs(Dc,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>i.jsx(oh,{label:n.label,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius/n.critAt*100,mark:n.warnAt/n.critAt*100,tone:qq(n.celsius,n.warnAt,n.critAt),title:`bar runs 0–${n.critAt} °C · amber from ${n.warnAt} °C, red at ${n.critAt} °C`,trackLabel:`${n.celsius} °C on a bar that runs to ${n.critAt} °C, amber from ${n.warnAt} °C`},n.label)),t&&i.jsx(oh,{label:"Throttling",value:i.jsx("b",{children:t.value}),pct:t.pct,tone:t.tone,note:t.note})]})})}function Jq({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(Dq,{sys:e,onClose:()=>n(!1)})]})}function oh({label:e,value:t,pct:n,tone:r="calm",note:a,mark:l,title:c,trackLabel:u}){return i.jsxs("div",{className:"sd-row",title:c,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.jsxs("span",{className:"sd-track",role:u?"img":void 0,"aria-label":u,children:[i.jsx("span",{className:`sd-fill${r==="calm"?"":` ${r}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}}),l!=null&&l>0&&l<100&&i.jsx("span",{className:"sd-mark",style:{left:`${l}%`},"aria-hidden":!0})]}),a&&i.jsx("div",{className:"sd-note",children:a})]})}const KN=18,e8=1100,Pi=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},t8=Array.from({length:KN},(e,t)=>{const n=-72+144*t/(KN-1)+(Pi(t,1)-.5)*9,r=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+Pi(t,2)*.52);return{dx:Math.cos(r)*a,dy:Math.sin(r)*a,rot:(t%2?1:-1)*(100+Pi(t,3)*260),delay:Math.round(Pi(t,4)*90),dur:760+Math.round(Pi(t,5)*260),scale:.8+Pi(t,6)*.45,hue:t%4,round:t%3===0}});function YN({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),e8);return()=>window.clearTimeout(u)},[e,r]),r||!t?null:Yn.createPortal(i.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:t8.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 OR=new Set(["awaiting_url","awaiting_code","registering"]);function n8(e){return e!=null&&OR.has(e)}function PR(e){return e!=null&&e!=="done"&&!OR.has(e)}const r8="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",s8="the sign-in did not complete";function a8({state:e,serverError:t,localError:n}){const r=e==="idle";return{title:r?"Sign-in ended":"Sign-in failed",message:n||t||(r?r8:s8)}}function o8({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."}function i8({started:e,state:t}){return!e||t==="done"?null:{action:"login-cancel"}}const l8="done";function c8(){let e=!1;return{shouldAnnounce(t){return t!==l8?(e=!1,!1):e?!1:(e=!0,!0)}}}function D0(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const u8={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 ${nn}`,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"},d8={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"},h8=`claude-swap could not read the login keychain — start ${nn} from a Terminal window rather than a background service`,LR={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 Bx(e,t,n){const r=n==null?null:LR[n];if(r)return r;if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Fc(e)))return h8;const a=D0(d8,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 f8={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"},p8="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 m8(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const g8="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",y8="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",w8=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),v8=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,x8=/[\\/]_npx[\\/]/i,b8=`the copy of ccusage ${nn} installed for itself`;function k8(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function NK(e,t){const n=N8(e,t),r=k8(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 ${mc(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${mc(n)}`;case"managed":return`${b8} failed to run: ${mc(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${mc(n)}`:`the ccusage this deck found on your PATH failed to run: ${mc(n)}`;default:return n}}const mc=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function N8(e,t){const n=Fc(e);if(w8(n)){if(x8.test(n))return y8;if(v8.test(n))return g8}if(m8(n))return p8;const r=D0(f8,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function Hi(e,t,n){const r=n==null?null:LR[n];if(r)return r;if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&PR(e.state))return e.error;const a=D0(u8,e==null?void 0:e.reason);return a||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function _8(e,t,n){if(n<=0||Eh(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 DR(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 S8(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 j8(e,t){return e.filter(n=>!t.includes(n.num)).map(n=>n.num)}function E8(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function C8(e){return e.length?{action:"share",accounts:[...e]}:null}function T8(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 zx(e){return`${e.email}|${e.org??""}`}function A8(e,t,n){return e&&e.map(r=>zx(r)===t?n:r)}function R8(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 M8(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 I8=1500,jd=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],XN="aa-panel",ZN=e=>`aa-tab-${e}`;async function gc(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Hx=me.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"})]}));Hx.displayName="SuccessMark";function $8({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),[_,k]=x.useState(null),[j,b]=x.useState(null),[S,E]=x.useState(null),C=x.useRef(""),T=x.useRef(!1),R=x.useRef(!1),$=x.useRef(null),H=x.useRef(null),B=x.useRef(null),P=x.useRef(null),G=x.useRef([]),Q=x.useRef(!1),J=x.useCallback(()=>{const U=i8({started:T.current,state:a==null?void 0:a.state});U&&gc(U).catch(()=>{}),e()},[e,a==null?void 0:a.state]),M=un(J,{focusRef:B}),X=x.useCallback(async()=>{if(!Ls(R.current))return;R.current=!0,m(!0),w(null),T.current=!0;const U=await gc({action:"login"}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){w(Hi(U,"could not start the sign-in"));return}l(U)},[]);x.useEffect(()=>{if(!n8(a==null?void 0:a.state))return;const U=window.setInterval(async()=>{try{const re=await fetch("/api/claude-accounts/login");re.ok&&l(await re.json())}catch{}},I8);return()=>window.clearInterval(U)},[a]);const V=x.useRef(t);V.current=t;const I=x.useState(c8)[0];x.useEffect(()=>{var U;(a==null?void 0:a.state)==="awaiting_code"&&((U=$.current)==null||U.focus()),I.shouldAnnounce(a==null?void 0:a.state)&&V.current()},[a==null?void 0:a.state,I]),x.useEffect(()=>{var U;n==="paste"&&!Q.current&&((U=H.current)==null||U.focus()),Q.current=!1},[n]);const q=x.useCallback(U=>{var de;const re=_8(U,jd.findIndex(ge=>ge.id===n),jd.length);re.kind!=="pass"&&(U.preventDefault(),Q.current=!0,r(jd[re.index].id),(de=G.current[re.index])==null||de.focus())},[n]),W=x.useCallback(async()=>{var re;if(!Ls(R.current))return;R.current=!0,m(!0),w(null);const U=await gc({action:"login-code",code:c}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){w(Hi(U,"the code was not accepted")),U!=null&&U.state&&l(U),(re=$.current)==null||re.select();return}u(""),l(U)},[c,a]),K=x.useCallback(async()=>{if(!Ls(R.current))return;R.current=!0,m(!0),w(null);const U=await gc({action:"import",blob:f}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){w(Hi(U,"the import failed"));return}C.current=f,p(""),E(null),k(U.results??[]),t()},[f,t]),F=x.useCallback(async U=>{const re=zx(U);if(!Ls(R.current)||!C.current)return;R.current=!0,m(!0),b(re),E(null);const de=await gc({action:"import",blob:C.current,force:!0,only:{email:U.email,org:U.org??""}}).catch(()=>null);if(R.current=!1,m(!1),b(null),!(de!=null&&de.ok)){E({key:re,text:Hi(de,"that account could not be updated")});return}const ge=(de.results??[])[0];ge&&k(pe=>A8(pe,re,ge)),t()},[t]),D=(a==null?void 0:a.state)==="done"?a.account:null,ae=o8({restored:a==null?void 0:a.restored,activeAccount:a==null?void 0:a.activeAccount}),z=PR(a==null?void 0:a.state)||!!(y&&T.current&&!h),Z=a8({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return Yn.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:J,role:"presentation",children:i.jsxs("div",{ref:M,className:"modal aa-modal",onClick:U=>U.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:jd.map((U,re)=>i.jsx("button",{type:"button",role:"tab",id:ZN(U.id),ref:de=>{G.current[re]=de},"aria-selected":n===U.id,"aria-controls":XN,tabIndex:n===U.id?0:-1,className:`aa-tab${n===U.id?" on":""}`,onClick:()=>{Q.current=!1,r(U.id)},children:U.label},U.id))})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:J,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsx("section",{className:"modal-body aa-body",id:XN,role:"tabpanel","aria-labelledby":ZN(n),children:n==="login"?D?i.jsxs("div",{className:"aa-done",children:[i.jsx(Hx,{ref:P}),i.jsx(YN,{anchor:P}),i.jsx("h4",{children:D.added?`Account ${D.num} added`:"Credentials refreshed"}),i.jsxs("p",{className:"aa-note",children:[i.jsx("strong",{children:D.email}),D.added?ae?" 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."]}),ae?i.jsx("p",{className:"aa-note aa-warn",role:"status",children:ae}):null,i.jsx("button",{type:"button",className:"btn primary",onClick:J,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:U=>u(U.target.value),onKeyDown:U=>{U.key==="Enter"&&c.trim()&&!h&&W()},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",...Aa(h,!c.trim()||a.state==="registering"),onClick:W,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."})]})]}):z?i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:Z.title}),i.jsx("p",{className:"aa-err",children:Z.message}),i.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,l(null),w(null),X()},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:B,className:"btn primary",onClick:X,children:"Open the sign-in page"})})]}):_?(()=>{const U=_.filter(re=>re.state==="imported").length;return i.jsxs("div",{className:"aa-done",children:[i.jsx(Hx,{ref:P}),U>0&&i.jsx(YN,{anchor:P}),i.jsx("h4",{children:M8(_)}),_.length>0&&i.jsx("ul",{className:"aa-results",children:_.map(re=>{const de=zx(re);return i.jsxs("li",{className:`aa-result ${re.state}`,children:[i.jsx("span",{className:"aa-result-who",children:re.email||(re.num?`slot ${re.num}`:"an account")}),i.jsx("span",{className:"aa-result-what",children:R8(re.state)}),re.state==="present"&&i.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":j===de,title:`Overwrite the stored login for ${re.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>F(re),children:j===de?"updating…":"update anyway"}),(S==null?void 0:S.key)===de&&i.jsx("span",{className:"aa-result-err",children:S.text})]},de)})}),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:J,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:H,type:"text",value:f,onChange:U=>p(U.target.value),onKeyDown:U=>{U.key==="Enter"&&f.trim()&&!h&&K()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),i.jsx("button",{type:"button",className:"btn primary",...Aa(h,!f.trim()),onClick:K,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)}const O8=6;function P8(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?L8(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 L8(e){const t=e.map(n=>n.headroom).filter(n=>typeof n=="number");return t.length?Math.max(...t):null}function D8(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,O8),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 FR({title:e,steps:t,finish:n,aside:r,onClose:a}){const l=x.useRef(null),c=un(a,{focusRef:l}),[u,f]=x.useState(0),p=u===t.length-1,h=t[u],m=_=>f(Math.max(0,Math.min(t.length-1,_))),y=_=>{_.key!=="ArrowRight"&&_.key!=="ArrowLeft"||(_.preventDefault(),_.stopPropagation(),m(_.key==="ArrowRight"?u+1:u-1))},w=()=>{if(!p){m(u+1);return}n?n.act():a()};return Yn.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:c,className:"modal guide",onClick:_=>_.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((_,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 Wx={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function br({children:e}){return i.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function xr({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 Wr({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:Wx[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 ${Wx[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 qR({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 Ed({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 QN({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 JN({x:e,y:t,d:n}){return i.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function F0({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 q0(){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 Wi({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:Wx[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 Yi({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 ih({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(qR,{x:e+118,y:t-13,on:!0})]})}function F8(){return i.jsxs(br,{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 q8(){return i.jsxs(br,{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(Wi,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),i.jsx(Wi,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),i.jsx(Wi,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),i.jsx(Wi,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),i.jsx(Yi,{x:326,y:28,label:"Read"}),i.jsx(Yi,{x:380,y:28,label:"Grep",live:!0}),i.jsx(Yi,{x:326,y:90,label:"Bash",live:!0})]})}function e_({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 B8(){return i.jsxs(br,{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(e_,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),i.jsx(e_,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function z8(){return i.jsxs(br,{children:[i.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),i.jsx(Wi,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),i.jsx(F0,{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(xr,{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(Yi,{x:214,y:122,label:"Read"}),i.jsx(Yi,{x:266,y:122,label:"Edit"}),i.jsx(Yi,{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 H8(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return i.jsxs(br,{children:[i.jsx(xr,{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 W8(){return i.jsxs(br,{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(Wi,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function U8(){return i.jsxs(br,{children:[i.jsx(xr,{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(JN,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),i.jsx(JN,{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(Wr,{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(Wr,{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(F0,{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(xr,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),i.jsx("g",{className:"ga-pop",children:i.jsx(Wr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function V8(){return i.jsxs(br,{children:[i.jsx(xr,{x:14,label:"THIS MACHINE"}),i.jsx(ih,{x:28,y:60}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(Wr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(Wr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(xr,{x:250,label:"ANOTHER MACHINE"}),i.jsx(ih,{x:264,y:60}),i.jsx(Wr,{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(q0,{})})]})}const G8=[{art:i.jsx(F8,{}),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(q8,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:i.jsx(z8,{}),line:"Double-click any node: its prompt, every tool call, tokens and timing."},{art:i.jsx(B8,{}),line:"What each session costs, and how much quota is left."},{art:i.jsx(H8,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:i.jsx(U8,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:i.jsx(V8,{}),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(W8,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function K8(){return i.jsxs(br,{children:[i.jsx(xr,{x:14,label:"THIS MACHINE"}),i.jsx(Wr,{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(xr,{x:250,label:"ANOTHER MACHINE"}),i.jsx(Wr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function Y8(){return i.jsxs(br,{children:[i.jsx(xr,{x:14,label:"THIS MACHINE"}),i.jsx(ih,{x:28,y:60}),i.jsx(Ed,{x:28,y:92,name:"Ana's MacBook"}),i.jsx(Ed,{x:28,y:114,name:"Dorin's PC"}),i.jsx(xr,{x:250,label:"ANOTHER MACHINE"}),i.jsx(ih,{x:264,y:60}),i.jsx(Ed,{x:264,y:92,name:"Your MacBook"}),i.jsx(Ed,{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 X8(){return i.jsxs(br,{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(QN,{x:106,y:88,on:!0}),i.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),i.jsx(QN,{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(qR,{x:304,y:157,on:!0}),i.jsx(F0,{x:115,y:97})]})}function Z8(){return i.jsxs(br,{children:[i.jsx(xr,{x:14,label:"THIS MACHINE"}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(Wr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(Wr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(xr,{x:250,label:"ANOTHER MACHINE"}),i.jsx(Wr,{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(q0,{})})]})}const Q8=[{art:i.jsx(K8,{}),line:"A login can expire on one machine while it still works on another."},{art:i.jsx(Y8,{}),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(X8,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:i.jsx(Z8,{}),line:"An expired login is copied from a paired machine within a minute."}];function J8(){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(q0,{})})]})}const eB={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."},tB=1600;function BR({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 al(l.join(`
|
|
91
|
+
`))&&a.current&&(r(!0),window.setTimeout(()=>{a.current&&r(!1)},tB))},[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:eB[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(`
|
|
92
|
+
`)})}),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 Lp(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const nB={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."},rB={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function t_(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||tn(n,t)}function sB({status:e,manual:t,onClose:n,onChanged:r}){const a=x.useRef(null),l=un(n,{focusRef:a}),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(null),[y,w]=x.useState(null),[_,k]=x.useState(null),[j,b]=x.useState(null),[S,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=>Ah(T.current)?(T.current=I,k(I),!0):!1,[]),$=x.useCallback(()=>{T.current=null,C.current&&k(null)},[]),H=I=>{const q=La(_,I);return{disabled:q.disabled,"aria-busy":q.busy}},B=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),G=x.useCallback(async()=>{const I=xB(c);if(!I){m({text:aB(c),field:"addr"});return}const q=`${I.addr}:${I.port}`,W=e.peers.find(K=>K.addr===I.addr&&K.port===I.port&&K.paired);if(W){m({text:`Already paired with ${W.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 K=await Lp("/api/prefs",{lan:{manual:[...t,q]}});if(!C.current)return;K!=null&&K.ok?(m(null),u(""),r(),n()):m({text:tn("add that address",K),field:"addr"})}catch{C.current&&m({text:tn("add that address",null),field:"addr"})}finally{$()}},[c,t,e.peers,r,n,R,$]),Q=x.useCallback(async I=>{if(!R(`invite:${I}`))return;const q=I==="make"?"make an invite":"cancel that invite";try{const W=await Lp("/api/lan/invite",{action:I});if(!C.current)return;W!=null&&W.ok?(m(null),w(null),r()):m({text:t_(rB,W,q)})}catch{C.current&&m({text:tn(q,null)})}finally{$()}},[r,R,$]),J=x.useCallback(async()=>{const I=f.trim();if(!(!I||!R("join"))){b(null);try{const q=await Lp("/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:t_(nB,q,"use that invite"),field:"join"}))}catch{C.current&&m({text:tn("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(W=>W===q?null:W)},1600)}catch{m({text:"Could not copy it — select the text and copy it by hand."})}},[]),X=e.invite&&e.invite.expiresAt>S?e.invite:null,V=e.port!=null?(e.addrs??[]).map(I=>`${I}:${e.port}`):[];return Yn.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(BR,{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,...B("addr"),onChange:I=>{u(I.target.value),P("addr")},onKeyDown:I=>{I.key==="Enter"&&G()}}),c.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...H("add"),onClick:()=>void G(),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&&V.length>0&&i.jsxs("p",{className:"lan-note",children:["They type this deck’s own address into the same field on theirs:"," ",V.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",...H("copy:mine"),onClick:()=>void M(V.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",!X&&i.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...H("invite:make"),onClick:()=>void Q("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:_==="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,...B("join"),onChange:I=>{p(I.target.value),b(null),P("join")},onKeyDown:I=>{I.key==="Enter"&&J()}}),f.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...H("join"),onClick:()=>void J(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:_==="join"?"joining…":"join"})]}),i.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),j&&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."}),j.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))]}),X&&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:[NB(X.expiresAt,S)," left"]})]}),i.jsx("code",{className:"ap-lan-token",children:X.token}),i.jsxs("div",{className:"ap-lan-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...H("copy:invite"),onClick:()=>void M(X.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",...H("invite:withdraw"),onClick:()=>void Q("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 aB(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 oB=1e3;function iB(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=hs(e,t);return`${n} · ${r==="now"?"just now":r}`}function n_(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function lB(){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 r_(){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 Cd({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 cB={works:"works here",expired:"expired here",missing:"not on this deck"},uB={works:"works there",broken:"broken there",unknown:"not offered by that deck"};function dB(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${cB[e.here]}, ${uB[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function hB({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 Pt,Kt,jn,_t,Bt;const w=x.useRef(null),_=un(c,{focusRef:w}),[k,j]=x.useState(null),[b,S]=x.useState(null),[E,C]=x.useState(!1),T=x.useRef(0),[R,$]=x.useState(null),[H,B]=x.useState(!1),[P,G]=x.useState(0),Q=x.useRef(null),J=x.useRef(!0);x.useEffect(()=>()=>{J.current=!1},[]);const M=k!=null;x.useEffect(()=>{var he;M&&((he=Q.current)==null||he.select())},[M]),x.useEffect(()=>{if(!E)return;const he=window.setTimeout(()=>C(!1),4e3);return()=>window.clearTimeout(he)},[E]),x.useEffect(()=>{if(!R)return;const he=window.setTimeout(()=>$(null),4e3);return()=>window.clearTimeout(he)},[R]);const X=he=>{const Je=La(l,he);return{disabled:Je.disabled,"aria-busy":Je.busy}},V=async he=>{const Je=await he();return J.current&&S(Je),Je==null},{peer:I,stranger:q}=t,W=e.kind==="paired",K=e.self??e.name,F=e.kind!=="dialling",D=e.kind==="dialling"?null:e.fp,ae=I?I.addr?`${I.addr}:${I.port}`:"":q?q.port?`${q.addr}:${q.port}`:q.addr:e.addr,z=(I==null?void 0:I.about)??null,Z=((Pt=n.about)==null?void 0:Pt.version)??null,U=async he=>{const Je=he.trim()===K?"":he;await V(()=>u(Je))&&j(null)},re=async()=>{if(D)try{if(await navigator.clipboard.writeText(D),!J.current)return;B(!0),window.setTimeout(()=>{J.current&&B(!1)},1600)}catch{J.current&&S("Could not copy it — select the fingerprint and copy it by hand.")}},de=W?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",ge=n_(n.about),pe=n_(z),_e=z!=null&&z.version&&Z?MB(z.version,Z):null,Pe=I?zR(I.last,a):null,$e=I&&((Kt=I.last)!=null&&Kt.error)?vB({error:I.last.error,host:I.addr,port:I.port},[...n.strangers??[],...n.pending??[],...(n.peers??[]).filter(he=>!he.manual&&he.addr).map(he=>({fp:he.fp,name:he.name,addr:he.addr,port:he.port,at:he.lastSeen??0}))],a):null,Te=(jn=I==null?void 0:I.last)!=null&&jn.error&&Pe&&Pe.text!==I.last.error?I.last.error:null,je=((_t=I==null?void 0:I.last)==null?void 0:_t.done)??[],et=!!Pe&&!!Te&&!e.quiet&&e.state.startsWith(Pe.text),Ce=W||e.kind==="dialling",Ne=((I==null?void 0:I.via)??e.via)==="tailscale",He=I?I.waiting?null:I.manual?Ne?"added by its Tailscale address":"added by address":Ne?"over Tailscale":"on this network":e.kind==="nearby"?Ne?"heard over Tailscale":"heard on this network":Ne?"asked this deck to pair, over Tailscale":"asked this deck to pair",it=e.tone==="bad"?"bad":W?e.here?"up":"down":"loose",ot=l===`check:${e.fp}`,le=(I==null?void 0:I.offers)??null,be=it==="up"?(le==null?void 0:le.current)??null:null,Re=be&&"key"in be?be.key:null,Ze=!!be&&"hidden"in be,We=!!be&&"other"in be,tt=W?$B((le==null?void 0:le.accounts)??null,r,n.shared??[],Re):[],we=tt.filter(he=>he.in==null&&he.out==="cut"),Me=tt.some(he=>he.in!=null),Qe=tt.some(he=>he.out!=null),ce=new Map(je.map(he=>[he.email,he])),lt=je.filter(he=>!tt.some(Je=>Je.email===he.email)),gt=W?le?le.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.":(Bt=I==null?void 0:I.last)!=null&&Bt.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,mt=le&&(I!=null&&I.last)&&I.last.at-le.at>oB?hs(le.at,a):null,Et=[];W&&(I!=null&&I.pairedAt)?Et.push({label:"Paired",value:iB(I.pairedAt,a),tone:"meta"}):e.kind==="declined"&&q&&Et.push({label:"Paired",value:`no · you said no ${z0(q.at,a)}`,tone:"meta"}),Et.push({label:"Fingerprint",value:D?i.jsxs("span",{className:"lan-fp",children:[i.jsx("code",{className:"ap-lan-code",children:D}),i.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void re(),"aria-label":H?"Fingerprint copied":"Copy the fingerprint",children:H?"copied":"copy"})]}):"not known — nothing has answered there",tone:D?void 0:"quiet"});const Ot=m.length?[{row:e,peer:I??null},...m]:[];return Yn.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:i.jsxs("div",{ref:_,className:"modal lan-peer","data-tone":e.tone,onClick:he=>he.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:he=>{he.preventDefault(),U(k??"")},children:[i.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),i.jsx("input",{ref:Q,className:"ap-manage-input lan-peer-input",value:k??"",maxLength:48,placeholder:K,"aria-label":"Name for this deck, shown on this deck only",onChange:he=>j(he.target.value)}),i.jsx("button",{type:"submit",className:"ap-manage-btn",...X(`alias:${e.fp}`),children:"save"}),i.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>j(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}),F&&i.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{S(null),j(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(lB,{})})]}),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",...X(`alias:${e.fp}`),onClick:()=>void U(""),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:()=>S(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsxs("div",{className:"lan-map","data-link":it,"data-asking":ot||void 0,"data-bus":tt.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"}),ge&&i.jsx("span",{className:"lan-end-runs",children:ge}),W&&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:[pe??(z?"not said":de),_e?` · ${_e<0?"older":"newer"}`:null]}),Ze&&i.jsx("span",{className:"lan-end-note",children:"current account hidden"}),We&&i.jsx("span",{className:"lan-end-note",children:"on another account"})]})]}),i.jsxs("div",{className:"lan-link",children:[i.jsx(r_,{}),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:ae?i.jsx("code",{className:"ap-lan-code",children:ae}):"none here — it calls this deck"})]}),i.jsx(r_,{}),(ae&&He||Ce)&&i.jsxs("p",{className:"lan-link-sub",children:[ae&&He,ae&&He&&Ce&&" · ",Ce&&(Pe?et?i.jsx("code",{className:"ap-lan-code",children:Te}):i.jsx("span",{className:"lan-round","data-tone":Pe.tone,children:Pe.text.replace(/ · now$/," · just now")}):"not asked yet"),Ce&&Te&&!et&&i.jsx("code",{className:"lan-fact-raw",children:Te})]}),lt.length>0&&i.jsx("ul",{className:"lan-done",children:lt.map(he=>i.jsxs("li",{"data-ok":he.ok,children:[he.email," ",i.jsx("span",{className:"lan-done-what",children:he.ok?"arrived":"did not arrive"})]},`${he.email}:${he.action}`))}),$e&&i.jsx("p",{className:"lan-note lan-link-note",children:$e}),(I==null?void 0:I.waiting)&&i.jsx("p",{className:"lan-note lan-link-note",children:e.hint})]}),tt.length>0&&i.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:tt.map((he,Je)=>{const Ct=ce.get(he.email),En=he.out==="live"||he.in!=null&&he.in!=="cut";return i.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":he.tone,"data-draw":he.in&&he.out?"both":he.in?"in":"out","data-used-there":he.usedThere||void 0,style:{"--i":Je},children:[i.jsx("i",{className:"lan-pip","data-end":"here","data-state":he.here,"aria-hidden":!0}),i.jsxs("span",{className:"lan-track",children:[i.jsxs("span",{className:"lan-wire","data-flow":En?"live":"cut","aria-hidden":!0,children:[(he.in==="live"||he.in==="wait")&&i.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":he.in}),he.out==="live"&&i.jsx("i",{className:"lan-glint","data-dir":"out"})]}),he.in&&he.in!=="cut"&&i.jsx(Cd,{dir:"in",gate:he.in==="blocked"}),he.out==="live"&&i.jsx(Cd,{dir:"out"}),i.jsx("span",{className:"lan-lane-email",children:he.email})]}),i.jsx("i",{className:"lan-pip","data-end":"there","data-state":he.there,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:dB(he)}),(he.caption||Ct)&&i.jsxs("span",{className:"lan-lane-note",children:[he.caption,he.caption&&Ct&&" · ",Ct&&i.jsx("span",{className:"lan-lane-done","data-ok":Ct.ok,children:Ct.ok?"arrived last round":"did not arrive last round"})]})]},he.key)})},P),W&&i.jsxs(i.Fragment,{children:[we.length>0&&i.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",we.length===1?we[0].email:"the expired ones"," until you sign in again here."]}),gt&&i.jsx("p",{className:"lan-empty",children:gt}),mt&&i.jsxs("p",{className:"lan-stale",children:["As of ",mt==="now"?"just now":mt,", when it last answered."]}),i.jsxs("div",{className:"lan-legend",children:[Me&&i.jsxs("span",{className:"lan-key",children:[i.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:i.jsx(Cd,{dir:"in"})}),"from ",e.name]}),Qe?i.jsxs("span",{className:"lan-key",children:[i.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:i.jsx(Cd,{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:Et.map(he=>i.jsxs("div",{className:"lan-fact","data-tone":he.tone,children:[i.jsx("dt",{children:he.label}),i.jsx("dd",{children:he.value})]},he.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((he,Je)=>{var hn,Cn,zt,Pn;const Ct=(hn=he.peer)!=null&&hn.addr?`${he.peer.addr}:${he.peer.port}`:he.row.addr,En=Ct||he.row.fp,dn=(Cn=he.peer)!=null&&Cn.pairedAt?hs(he.peer.pairedAt,a):null,ir=[(Pn=(zt=he.peer)==null?void 0:zt.about)!=null&&Pn.version?`runs ${he.peer.about.version}`:null,dn?`paired ${dn==="now"?"just now":dn}`:null,he.row.state].filter(Boolean).join(" · "),Mt=he.row.fp;return i.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":he.row.tone,children:[i.jsx("i",{className:he.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),Ct?i.jsx("code",{className:"ap-lan-code lan-twin-at",children:Ct}):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:Mt}),Je>0&&y&&i.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${R===Mt?" armed":""}`,...X(`unpair:${Mt}`),onKeyDown:yn=>{yn.repeat&&yn.preventDefault()},onClick:()=>{const yn=Date.now(),wn=ah({armedFor:R,target:Mt,armedAt:T.current,now:yn,gapMs:lh});if(wn==="arm"){$(Mt),T.current=yn;return}wn!=="ignore"&&($(null),V(()=>y(Mt)))},"aria-label":R===Mt?`Confirm unpairing ${En}`:`Unpair ${En}`,title:R===Mt?"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:${Mt}`?"unpairing…":R===Mt?"confirm":"unpair"}),i.jsx("span",{className:"lan-twin-meta",children:Je===0?`${ir} · shown above`:ir})]},Mt)})})]})]}),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."}),W&&!(I!=null&&I.waiting)&&i.jsx("button",{type:"button",className:"btn",...X(`check:${e.fp}`),onClick:()=>void V(f).then(he=>{he&&J.current&&G(Je=>Je+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":""}`,...X(`unpair:${e.fp}`),onKeyDown:he=>{he.repeat&&he.preventDefault()},onClick:()=>{const he=Date.now(),Je=ah({armedFor:E?e.fp:null,target:e.fp,armedAt:T.current,now:he,gapMs:lh});if(Je==="arm"){C(!0),T.current=he;return}Je!=="ignore"&&(C(!1),V(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",...X(`accept:${e.fp}`),onClick:()=>void V(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",...X(`drop:${e.fp}`),onClick:()=>void V(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",...X(`allow:${e.fp}`),onClick:()=>void V(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 fB(e){if(!e.running)return`Tailscale is ${e.state==="Stopped"?"turned off":e.state==="NeedsLogin"||e.state==="NeedsMachineAuth"?"signed out":e.state==="Starting"?"still starting":"not answering"} on this machine`;const t=e.login??"your Tailscale account";return e.on?`${e.devices} online · ${t}`:t}function pB({status:e,accounts:t,onClose:n,onChanged:r}){const a=un(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),_=Q=>{const J=La(m,Q);return{disabled:J.disabled,"aria-busy":J.busy}},k=x.useRef(null),j=x.useRef(!0);x.useEffect(()=>()=>{j.current=!1},[]),x.useEffect(()=>{k.current=s_(k.current,e.shared??[],null)},[e.shared]);const b=x.useCallback(async(Q,J,M="write")=>{w.current=M,y(M);try{const V=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:Q})})).json().catch(()=>null);return j.current?(V!=null&&V.ok?f(null):f(tn(J,V)),r(),(V==null?void 0:V.ok)===!0):!1}catch{return j.current&&f(tn(J,null)),!1}finally{w.current=null,j.current&&y(null)}},[r]),S=x.useCallback(async()=>{if(l!=null&&l!==(e.name??"")){if(!await b({name:l},"save the name","name"))return;j.current&&c(null)}n()},[l,e.name,b,n]),E=async()=>{if(!e.fp)return;const Q=await al(e.fp);if(j.current){if(!Q){f("Could not copy it — select the fingerprint and copy it by hand.");return}h(!0),window.setTimeout(()=>{j.current&&h(!1)},1600)}},C=new Set(k.current??e.shared??[]),T=e.autoAsk!==!1,R=e.autoAccept!==!1,$=e.shareActive!==!1,H=e.tailscale??null,B=!!(H!=null&&H.on),P=(H==null?void 0:H.ask)!==!1,G=(H==null?void 0:H.accept)!==!1;return Yn.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal lan-modal",onClick:Q=>Q.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:Q=>c(Q.target.value),onKeyDown:Q=>{Q.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",..._("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(Q=>i.jsxs("label",{className:"ap-lan-pick",title:Q.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(Q.key),onChange:J=>{const M=kB(k.current,e.shared??[],Q.key,J.target.checked);k.current=M,b({shared:M},J.target.checked?"share that account":"stop sharing that account").then(X=>{k.current===M&&(k.current=s_(M,e.shared??[],{ok:X}))})}}),i.jsx("span",{className:"ap-lan-pick-name",children:Q.email}),!Q.alive&&i.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},Q.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",..._("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",..._("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",..._("accept"),onKeyDown:Q=>{Q.repeat&&Q.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"})})]})]})]}),(H==null?void 0:H.found)&&i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Tailscale"}),i.jsxs("div",{className:"lan-switches",children:[i.jsxs("div",{className:"lan-switch",children:[i.jsxs("span",{className:"lan-switch-what",children:["Look for my devices",i.jsx("span",{id:"lan-ts-detail",className:"lan-switch-detail",children:fB(H)})]}),i.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":B,"aria-label":"Look for my devices over Tailscale","aria-describedby":"lan-ts-detail",..._("tailscale"),onClick:()=>void b({tailscale:!B},B?"stop looking over Tailscale":"look for your devices over Tailscale","tailscale"),title:B?"Stop. Nothing is looked for or answered over the tailnet; decks already paired stay paired.":"Find the decks on your other machines on Tailscale, wherever they are. Only machines signed in to your Tailscale account are asked.",children:i.jsx("span",{className:"switch-knob"})})]}),B&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"lan-switch",children:[i.jsx("span",{className:"lan-switch-what",children:"Ask each device it finds"}),i.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":P,"aria-label":"Ask each of my devices it finds over Tailscale",..._("tailscale-ask"),onClick:()=>void b({tailscaleAsk:!P},P?"stop asking your devices automatically":"ask your devices automatically","tailscale-ask"),title:P?"Stop sending requests on their own. You press ask on the row instead.":"Send a pairing request to every deck found on your devices over Tailscale.",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 each device that asks"}),i.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":G,"aria-label":"Say yes to my devices when they ask over Tailscale","data-tone":"warn",..._("tailscale-accept"),onKeyDown:Q=>{Q.repeat&&Q.preventDefault()},onClick:()=>void b({tailscaleAccept:!G},G?"stop accepting your devices automatically":"accept your devices automatically","tailscale-accept"),title:G?"Stop saying yes for you. A device that asks waits in the panel again.":"Say yes for you when a deck on one of your own devices asks. Anybody else on the tailnet still waits for a press.",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",..._("name"),onClick:()=>void S(),children:"Done"})]})]})}),document.body)}function hs(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 B0={"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"}},mB={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 gB(e){var r;const t=yB[e];if(t)return t;const n=(r=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:r[1];return n&&mB[n]||e}const yB={"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 zR(e,t){if(!e)return null;if(e.error)return B0[e.error]??{text:gB(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${hs(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 · ${hs(e.at,t)}`,tone:"ok"}:{text:`${r.length} of ${n.length} logins arrived · ${hs(e.at,t)}`,tone:"bad"}}const wB=9e4;function vB({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<wB);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 Ux=5e3,HR=6e4,lh=400;function xB(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 tn(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 bB(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function kB(e,t,n,r){const a=new Set(e??t);return r?a.add(n):a.delete(n),[...a]}function s_(e,t,n){return e==null||n!=null&&!n.ok||bB(e,t)?null:e}function NB(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function WR(e,t){var n,r;return(n=e.last)!=null&&n.error&&!B0[e.last.error]?!1:!!((r=e.last)!=null&&r.at&&t-e.last.at<ch||e.lastSeen!=null&&t-e.lastSeen<ch)}const ch=95e3,UR=160,_B=6,VR=140;function SB(e,t){const n=[],r=[];for(const a of e??[])(WR(a,t)?n:r).push(a);return{online:n,offline:r}}function jB(e){var t;return(t=e.tailscale)!=null&&t.exitNode?"Tailscale sends this machine's local network through an exit node, so decks on this network cannot find this one. Turn on Allow local network access in Tailscale's exit node menu to bring them back.":"This machine sends its local network through a VPN, so decks on this network cannot find this one. Allowing local network access in the VPN brings them back."}function EB(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 _;return!((_=w.last)!=null&&_.error)&&w.lastSeen!=null&&t-w.lastSeen<ch}),{online:u,offline:f}=SB(l,t),p=[...f,...a.filter(w=>!c.includes(w))],h=u.length+c.length,m=u.filter(w=>{var _;return((_=w.last)==null?void 0:_.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 CB(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const r=hs(e,t);return r==="now"?"checked just now":`checked ${r}`}function z0(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 TB(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<ch;return{text:n?"online · one-way, it calls in":`one-way · last online ${hs(e,t)}`,here:n}}function a_(e,t,n){return t?"online":e.lastSeen!=null?`last online ${hs(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function AB(e,t){var y,w,_,k,j;if(!e)return[];const n=[],r=new Set,a=(b,S)=>b.name.localeCompare(S.name,void 0,{numeric:!0}),l=e.aliases??{},c=(b,S)=>{const E=b?l[b]:void 0;return E&&E!==S?{name:E,self:S}:{name:S}};for(const b of e.pending??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const S=c(b.fp,b.name||b.fp);n.push({fp:b.fp,name:S.name,...S.self?{self:S.self}:{},addr:b.addr??"",kind:"asks",state:`wants to pair · ${z0(b.at,t)}`,tone:"wait",here:!0,hint:`${S.name} at ${b.addr}${b.via==="tailscale"?", over Tailscale,":""} is waiting for an answer.`,...b.via==="tailscale"?{via:"tailscale"}:{}})}const u=[],f=[];for(const b of e.peers??[]){const S=b.peerFp??b.fp;if(!S||r.has(S))continue;r.add(S);const E=zR(b.last,t),C=WR(b,t),T=b.addr?`${b.addr}:${b.port}`:"";if(!b.paired&&b.manual&&!b.met){f.push({fp:T,name:T||b.name||S,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.`,...b.via==="tailscale"?{via:"tailscale"}:{}});continue}const R=b.waiting?TB(b.lastSeen,t):null,$=R?R.here:C,H=!R&&E?$?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${a_(b,$,t)}`:R?R.text:a_(b,$,t),B=(w=b.last)!=null&&w.error?B0[b.last.error]:null,P=!R&&$&&!((_=b.last)!=null&&_.error)&&!(((k=b.last)==null?void 0:k.done)??[]).length,G=b.manual&&!b.met?{name:T}:c(S,b.name||S);u.push({fp:S,name:G.name,...G.self?{self:G.self}:{},addr:b.addr??"",kind:"paired",state:H,quiet:P,tone:B?B.tone==="bad"?"bad":"wait":E?E.tone:$?"ok":"idle",here:R?R.here:C,...b.via==="tailscale"?{via:"tailscale"}:{},hint:R?`${G.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 ${hs(b.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${G.name}${T?` at ${T}`:""}${(j=b.last)!=null&&j.error?` — ${b.last.error}`:""}`})}n.push(...RB(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 S=c(b.fp,b.name||b.fp);p.push({fp:b.fp,name:S.name,...S.self?{self:S.self}:{},addr:b.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:b.via==="tailscale"?`${S.name} at ${b.addr} is on your tailnet and nothing is shared with it.`:`${S.name} at ${b.addr} is on this network and nothing is shared with it.`,...b.via==="tailscale"?{via:"tailscale"}:{}})}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 S=c(b.fp,b.name||b.fp);h.push({fp:b.fp,name:S.name,...S.self?{self:S.self}:{},addr:b.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${S.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 RB(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(o_(r.filter(c=>c.addr===l)));n.push(...r.filter(l=>!l.addr))}else n.push(o_(r))}return n}function o_(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 i_(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 MB(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 IB(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 $B(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=IB(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 Li(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function OB({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,_B),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 _=L0(w.getBoundingClientRect(),{width:y.offsetWidth,height:y.offsetHeight},{width:window.innerWidth,height:window.innerHeight});y.style.top=`${_.top}px`,y.style.left=`${_.left}px`,y.style.maxHeight=_.maxHeight==null?"":`${_.maxHeight}px`,y.dataset.side=_.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]),Yn.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.jsxs("span",{children:[y.name,y.via==="tailscale"&&i.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]})]},`${y.kind}:${y.fp}`))}),h&&i.jsx("p",{className:"ap-peek-rest",children:h})]}),document.body)}function PB(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 LB({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),[_,k]=x.useState(null),j=x.useRef(0),[b,S]=x.useState(!1),[E,C]=x.useState(!1),[T,R]=x.useState(!1),$=x.useRef(0);x.useEffect(()=>()=>window.clearTimeout($.current),[]);const[H,B]=x.useState(!1),[P,G]=x.useState(null),Q=x.useRef(null),J=x.useCallback(le=>Ah(Q.current)?(Q.current=le,m(le),!0):!1,[]),M=x.useCallback(()=>{Q.current=null,q.current&&m(null)},[]),X=le=>{const be=La(h,le);return{disabled:be.disabled,"aria-busy":be.busy}},[V,I]=x.useState(()=>Date.now()),q=x.useRef(!0),W=x.useRef(Ux),K=x.useCallback(async()=>{var le,be;try{const[Re,Ze]=await Promise.all([fetch("/api/lan").then(We=>We.json()),fetch("/api/prefs").then(We=>We.json())]);if(!q.current)return;Re!=null&&Re.ok&&u(Re),Ze!=null&&Ze.ok&&p(Array.isArray((be=(le=Ze.prefs)==null?void 0:le.lan)==null?void 0:be.manual)?Ze.prefs.lan.manual:[]),W.current=(Re==null?void 0:Re.enabled)===!0?Ux:HR}catch{}},[]);x.useEffect(()=>{q.current=!0;let le=0;const be=async()=>{I(Date.now()),await K(),q.current&&(le=window.setTimeout(be,W.current))};return be(),()=>{q.current=!1,window.clearTimeout(le)}},[K]);const F=x.useCallback(async()=>{const le=(c==null?void 0:c.enabled)===!0;if(J("switch"))try{const be=await Li("/api/prefs",{lan:{enabled:!le}});if(!q.current)return;be!=null&&be.ok?(G(null),le||w(!0)):G(tn(le?"turn this off":"turn this on",be)),await K()}catch{q.current&&G(tn(le?"turn this off":"turn this on",null))}finally{M()}},[c==null?void 0:c.enabled,K,J,M]),D=x.useCallback(async(le,be,Re)=>{if(!J(`${le}:${be}`))return null;let Ze=null;try{const We=await Li("/api/lan/peer",{action:le,fp:be});if(!q.current)return null;We!=null&&We.ok?(u(We),G(null)):(Ze=tn(Re,We),G(Ze)),await K()}catch{Ze=tn(Re,null),q.current&&G(Ze)}finally{M()}return Ze},[K,J,M]),ae=x.useCallback(async le=>{if(!J(`drop:${le}`))return null;let be=null;try{const Re=await Li("/api/prefs",{lan:{manual:f.filter(Ze=>Ze!==le)}});if(!q.current)return null;Re!=null&&Re.ok?(G(null),t()):(be=tn("stop dialling that address",Re),G(be)),await K()}catch{be=tn("stop dialling that address",null),q.current&&G(be)}finally{M()}return be},[f,K,t,J,M]),[z,Z]=x.useState(null),U=x.useCallback(async(le,be)=>{if(!J(`alias:${le}`))return"Something else is still being saved. Try again in a moment.";try{const Re=await Li("/api/lan/peer",{action:"alias",fp:le,name:be});return q.current?Re!=null&&Re.ok?(u(Re),null):tn("rename that deck",Re):null}catch{return tn("rename that deck",null)}finally{M()}},[J,M]),re=x.useCallback(async le=>{if(!J(`check:${le}`))return null;try{const be=await Li("/api/lan/sync",{fp:le});return q.current?be!=null&&be.ok?(u(be),t(),null):(be==null?void 0:be.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.":tn("check that deck",be):null}catch{return tn("check that deck",null)}finally{M()}},[J,M,t]),de=x.useCallback(async()=>{if(J("check"))try{const le=await Li("/api/lan/sync",{});if(!q.current)return;le!=null&&le.ok?(u(le),G(null)):G(tn("check the other decks",le)),t()}catch{q.current&&G(tn("check the other decks",null))}finally{M()}},[J,M,t]),ge=(c==null?void 0:c.enabled)===!0,pe=AB(c,V),_e=z?pe.find(le=>{var be;return le.fp===z||((be=le.twins)==null?void 0:be.some(Re=>Re.fp===z))})??null:null;x.useEffect(()=>{z&&c&&!_e&&Z(null)},[z,c,_e]);const Pe=pe.filter(le=>le.kind==="asks"),$e=pe.filter(le=>le.kind!=="asks"),Te=$e.filter(le=>le.here),je=$e.filter(le=>!le.here),et=je.filter(le=>le.tone==="bad").length,Ce=H||Te.length===0,Ne=EB(c,V),He=$e.filter(le=>le.kind==="paired").length,it=PB(c,pe),ot=i.jsxs(i.Fragment,{children:[b&&c&&i.jsx(sB,{status:c,manual:f,onClose:()=>S(!1),onChanged:()=>{K(),t()}}),E&&i.jsx(FR,{title:"How Local network works",steps:Q8,finish:ge?void 0:{label:"Turn it on",act:()=>{C(!1),F()}},onClose:()=>C(!1)}),y&&c&&i.jsx(pB,{status:{...c,manualRows:f},accounts:e,manual:f,onClose:()=>w(!1),onChanged:()=>{K(),t()}}),_e&&c&&i.jsx(hB,{row:_e,source:l_(c,_e),status:c,accounts:e,now:V,busy:h,onClose:()=>Z(null),onRename:le=>U(_e.fp,le),onCheck:()=>re(_e.fp),onVerb:()=>{switch(_e.kind){case"paired":return D("unpair",_e.fp,"unpair that deck");case"nearby":return D("accept",_e.fp,"reach that deck");case"declined":return D("allow",_e.fp,"let that deck ask again");case"dialling":return ae(_e.fp);default:return Promise.resolve(null)}},onSettings:()=>{Z(null),w(!0)},twins:(_e.twins??[]).map(le=>({row:le,peer:l_(c,le).peer??null})),onUnpair:le=>D("unpair",le,"unpair that deck")})]});if(!n){const le=We=>{window.clearTimeout($.current),$.current=window.setTimeout(()=>R(!0),We)},be=()=>{window.clearTimeout($.current),$.current=window.setTimeout(()=>R(!1),VR)},Re=()=>window.clearTimeout($.current),Ze=()=>{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:()=>{Ze(),r()},"aria-describedby":T?"ap-lan-peek":void 0,onPointerEnter:We=>{We.pointerType==="mouse"&&le(UR)},onPointerLeave:be,onFocus:We=>{We.target.matches(":focus-visible")&&le(0)},onBlur:be,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":it.tone,children:[it.live&&i.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),it.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(OB,{anchorId:"ap-lan-entry",id:"ap-lan-peek",rows:pe,onHold:Re,onLet:be}),i.jsx("p",{className:"vis-hidden",role:"status",children:Ne.tone==="ok"?"":Ne.text}),ot]})}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:[ge&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>S(!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"})]})}),ge&&He>0&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...X("check"),onClick:()=>void de(),"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"})]})}),ge&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...X("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":ge,"aria-label":"Sync with paired decks",...X("switch"),onClick:()=>void F(),title:ge?"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"})})]}),ge&&i.jsx(BR,{reach:c==null?void 0:c.reach,where:"panel"}),ge&&(c==null?void 0:c.deaf)&&i.jsx("p",{className:"ap-lan-fine",children:c.deaf}),ge&&(c==null?void 0:c.lanTunneled)&&i.jsx("p",{className:"ap-lan-fine",children:jB(c)}),!ge&&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(J8,{}),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 ${Ne.tone}`,role:"status",children:Ne.tone==="ok"?"":Ne.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:()=>G(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),ge&&i.jsxs(i.Fragment,{children:[Pe.length>0&&i.jsx("div",{className:"ap-lan-asks",role:"alert",children:Pe.map(le=>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:le.name})," at ",i.jsx("code",{className:"ap-lan-code",children:le.addr})," wants to pair"]}),i.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",i.jsx("code",{className:"ap-lan-code",children:le.fp})]}),i.jsxs("span",{className:"ap-lan-ask-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...X(`accept:${le.fp}`),onClick:()=>void D("accept",le.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${le.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),i.jsx("button",{type:"button",className:"ap-manage-btn",...X(`dismiss:${le.fp}`),onClick:()=>void D("dismiss",le.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},le.fp))}),(Ce?[...Te,...je]:Te).length>0&&i.jsx("ul",{className:"ap-lan-here",children:(Ce?[...Te,...je]:Te).map((le,be)=>i.jsxs("li",{className:"ap-lan-who","data-tone":le.tone,children:[i.jsx("i",{className:le.here?"ap-pulse":"ap-dot","aria-hidden":!0}),i.jsxs("span",{className:"ap-lan-who-name","aria-hidden":!0,children:[le.name,le.via==="tailscale"&&i.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]}),i.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${be}`,onClick:()=>Z(le.fp),children:i.jsxs("span",{className:"vis-hidden",children:[le.name,le.via==="tailscale"?", over Tailscale":"",", details"]})}),i.jsx("span",{id:`lan-who-state-${be}`,className:le.quiet?"vis-hidden":"ap-lan-who-when",children:le.state}),le.kind==="nearby"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`accept:${le.fp}`),onClick:()=>void D("accept",le.fp,"reach that deck"),"aria-label":`Ask ${le.name} to pair`,title:`Send ${le.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${le.fp}.`,children:"ask"}),le.kind==="paired"&&i.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${_===le.fp?" armed":""}`,...X(`unpair:${le.fp}`),onClick:()=>{const Re=Date.now(),Ze=ah({armedFor:_,target:le.fp,armedAt:j.current,now:Re,gapMs:lh});if(Ze==="arm"){k(le.fp),j.current=Re,window.setTimeout(()=>k(We=>We===le.fp?null:We),4e3);return}Ze!=="ignore"&&(k(null),D("unpair",le.fp,"unpair that deck"))},"aria-label":_===le.fp?`Confirm unpairing ${le.name}`:`Unpair ${le.name}`,title:_===le.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:_===le.fp?"confirm":"unpair"}),le.kind==="dialling"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`drop:${le.fp}`),onClick:()=>void ae(le.fp),"aria-label":`Stop dialling ${le.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),le.kind==="declined"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`allow:${le.fp}`),onClick:()=>void D("allow",le.fp,"let that deck ask again"),"aria-label":`Let ${le.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${le.kind}:${le.fp}`))}),(Te.length>0&&je.length>0||ge&&He>0)&&i.jsxs("div",{className:"ap-lan-tail",children:[Te.length>0&&je.length>0&&i.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":H,onClick:()=>B(le=>!le),title:H?"Show only the decks that are on":`Show the ${je.length} deck${je.length===1?"":"s"} that are not responding right now`,children:[i.jsx("span",{className:`ap-lan-chev${H?" open":""}`,"aria-hidden":!0,children:"›"}),H?"fewer":`${je.length} more`,!H&&et>0&&i.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",et," not responding"]})]}),ge&&He>0&&i.jsx("span",{className:"ap-lan-checked",children:CB(c==null?void 0:c.checkedAt,V,h==="check")})]}),$e.length===0&&Pe.length===0&&!(c!=null&&c.stalled)&&!(c!=null&&c.deaf)&&!(c!=null&&c.lanTunneled)&&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"})]})]})]})}),ot]})}function DB({anchorId:e,id:t,peers:n,onHold:r,onLet:a}){const l=x.useRef(null),{title:c,shown:u,rest:f}=D8(n),p=x.useCallback(()=>{const h=l.current,m=document.getElementById(e);if(!h||!m)return;const y=L0(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]),Yn.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 FB({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=_=>{a||(window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!0),_))},h=()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!1),VR)},m=()=>window.clearTimeout(f.current),y=()=>{window.clearTimeout(f.current),u(!1)},w=P8(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:_=>{_.pointerType==="mouse"&&p(UR)},onPointerLeave:h,onFocus:_=>{_.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(DB,{anchorId:"ap-rest-entry",id:"ap-rest-peek",peers:e,onHold:m,onLet:h})]})}async function qB(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const BB=1800;function zB({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,_]=x.useState(()=>Math.floor(Date.now()/1e3)),k=x.useRef(null),j=x.useRef(!1),b=un(t,{focusRef:k});x.useEffect(()=>{if(!l)return;_(Math.floor(Date.now()/1e3));const P=window.setInterval(()=>_(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(P)},[l]);const S=S8(e),E=j8(e,r),C=E.length===e.length,T=P=>a(G=>E8(G,P)),R=x.useCallback(async()=>{const P=C8(E);if(!Ls(j.current)||!P)return;j.current=!0,f(!0),h(null),y(!1);const G=await qB(P).catch(()=>null);if(j.current=!1,f(!1),!(G!=null&&G.ok)){h(Hi(G,"the share could not be made"));return}c({blob:G.blob,expiresAt:G.expiresAt,shared:G.shared??[],failed:G.failed??[]})},[e,E]),$=l?DR(l.expiresAt,w):null,H=($==null?void 0:$.tone)==="gone",B=(l==null?void 0:l.shared.length)??0;return Yn.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:H?"This share has expired":B===1?"1 account, ready to paste":`${B} accounts, ready to paste`}),i.jsx("code",{className:`ap-share-blob${H?" 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(H){c(null),R();return}await n(l.blob)&&(y(!0),window.setTimeout(()=>y(!1),BB))},children:H?"make a new share":m?"copied":`copy ${B===1?"the share":"all "+B}`}),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:B===1?"this is the password":`this is ${B} 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 Q;const G=!!(P.email&&((Q=P.detail)!=null&&Q.includes(P.email)));return i.jsxs("li",{children:[!G&&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:H?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 ",nn,"?"]}),i.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:T8(E.length)}),i.jsx("ul",{className:"sa-list sa-pick",children:S.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,...Aa(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 HB(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 WB(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 UB(e,t,n){return t!=null&&e.some(r=>r.slot===t)?t:n}function VB(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 GB(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 c_(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function KB(e){const t=e.filter(u=>!c_(u)),n=e.filter(u=>c_(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 YB="\0";function uh(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}${YB}${n}`}function XB(e,t){const n=uh(t);return e.includes(n)?e.filter(r=>r!==n):[...e,n]}function ZB(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(uh)),r=e.filter(a=>n.has(a));return r.length===e.length?e:r}const QB=64;function JB(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const ez=Object.freeze({text:"couldn't reach the deck server",reload:!0}),tz=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function u_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function nz(e){const t=e.find(r=>!r.ok);if(!t)return null;const n=Fc(t.body);return{text:Bx(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function d_(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 h_=15e3,rz=8e3,sz=1800,az=3e4,Dp=[70,80,85,90,95];function Fp(e,t){return vR(t-Math.floor(e/1e3))}function oz(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 vc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function iz(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 lz(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 cz(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 Td(e,t){if(e.staleCopy){const n=iz(e.repair??null,t);return{text:vc(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=cz(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:vc(n.text),hint:n.hint,fix:n.fix?vc(n.fix):null,tone:r||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:r}}if(e.error){const n=lz(e.error);return{text:vc(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function qp(){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 uz(e){return e>=90?"hi":e>=70?"mid":void 0}function dz(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!Dp.includes(t)?[...Dp,t]:Dp].sort((r,a)=>r-a)}function hz({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?xR(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]})})]})}function fz({onClose:e,leaving:t}){var Hs,Ws,vn;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),[_,k]=x.useState("accounts"),[j,b]=x.useState(!1),[S,E]=x.useState(null),C=x.useRef(S);C.current=S;const[T,R]=x.useState(()=>Math.floor(Date.now()/1e3)),$=x.useRef(null),[H,B]=x.useState(null),P=(H==null?void 0:H.num)??null,G=x.useRef(H);G.current=H;const[Q,J]=x.useState(null),[M,X]=x.useState(!1),[V,I]=x.useState(""),[q,W]=x.useState(null),K=x.useRef(0),[F,D]=x.useState(null),[ae,z]=x.useState(!1),[Z,U]=x.useState(!1),[re,de]=x.useState(null),[ge,pe]=x.useState(null),[_e,Pe]=x.useState(null),[$e,Te]=x.useState(!1),je=x.useRef(null),et=x.useRef(null),[Ce,Ne]=x.useState([]),[He,it]=x.useState(!1),ot=x.useRef(null),le=x.useCallback(ee=>Ah(ot.current)?(ot.current=ee,u(ee),!0):!1,[]),be=x.useCallback(()=>{ot.current=null,u(null)},[]),Re=(ee,Ae=!1)=>{const Le=La(c,ee);return{disabled:Le.disabled,"aria-busy":Le.busy||Ae}},Ze=x.useCallback(ee=>{window.requestAnimationFrame(()=>{var Ae;if(zN(((Ae=document.activeElement)==null?void 0:Ae.tagName)??null))for(const Le of QF(ee)){const Ie=document.querySelector(Le);if(Ie){Ie.focus();return}}})},[]),We=x.useCallback(async(ee=!1)=>{ee&&p(!0);const Ae=new AbortController,Le=window.setTimeout(()=>Ae.abort(),az);try{const[Ie,Ue]=await Promise.all([fetch(`/api/claude-accounts${ee?"?refresh=1":""}`,{signal:Ae.signal}),fetch("/api/cswap-auto",{signal:Ae.signal})]);if(Ie.ok){const yt=await Ie.json();r(yt),Ne(St=>ZB(St,yt.accounts))}Ue.ok&&l(await Ue.json());const ct=nz([await u_(Ie),await u_(Ue)]);m(yt=>d_(yt,ct))}catch{m(Ie=>d_(Ie,Ae.signal.aborted?tz:ez))}finally{window.clearTimeout(Le),ee&&p(!1)}},[]),tt=x.useCallback(async(ee,Ae,Le="panel")=>{if(!le(Ae))return null;const Ie=Le==="menu"?J:m;Ie(null);try{const Ue=await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ee)}),ct=await Ue.json().catch(()=>null);return ct!=null&&ct.ok||Ie({text:Bx(ct,"command failed",Ue.status),raw:Fc(ct)}),ct}catch{return Ie({text:"server unreachable"}),null}finally{be()}},[le,be]),we=x.useCallback(async(ee,Ae)=>{if(!le(Ae))return null;m(null),J(null);try{const Le=await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ee)}),Ie=await Le.json().catch(()=>null);return Ie!=null&&Ie.ok||J({text:Hi(Ie,"command failed",Le.status)}),Ie}catch{return J({text:"server unreachable"}),null}finally{be()}},[le,be]);x.useEffect(()=>(We(!0),$.current=window.setInterval(()=>We(!1),h_),()=>{$.current!=null&&window.clearInterval($.current)}),[We]),x.useEffect(()=>{const ee=window.setInterval(()=>R(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ee)},[]);const Me=((Hs=a==null?void 0:a.settings["autoswitch.threshold"])==null?void 0:Hs.value)??"90",Qe=_e??Me,ce=GB(Qe,Me),lt=(Ws=n==null?void 0:n.accounts)==null?void 0:Ws.find(ee=>ee.active),gt=lt?Td(lt,T):null,mt=(n==null?void 0:n.accounts)??[],Et=lt?mt.filter(ee=>!ee.active):[],Ot=Et.length?mt.filter(ee=>ee.active):mt,Pt=Et.map(ee=>{const Ae=Td(ee,T);return{key:uh(ee),name:ee.alias??ee.email??`account ${ee.num}`,ready:!ee.disabled&&!(Ae!=null&&Ae.blocksSwitch),why:ee.disabled?"held out":Ae!=null&&Ae.blocksSwitch?Ae.text:null,warn:(Ae==null?void 0:Ae.tone)==="warn",headroom:ee.headroom}}),Kt=Number(Me),jn=(lt==null?void 0:lt.headroom)!=null&&Number.isFinite(Kt)&&100-lt.headroom>=Kt,_t=(a==null?void 0:a.ok)===!0&&(a.enabled||a.external),Bt=ee=>He&&Et.some(Ae=>Ae.num===ee)?"ap-rest-list":"ap-scroll",he=async(ee,Ae)=>{if(le(`switch-${ee}`)){m(null),w(null);try{const Ie=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:ee})})).json().catch(()=>null);Ie!=null&&Ie.ok?w({num:ee,name:Ae}):m({text:Bx(Ie,"the switch failed"),raw:Fc(Ie),row:ee}),await We(!0)}catch{m({text:"server unreachable",row:ee})}finally{be(),Ze(ee)}}},Je=x.useCallback(()=>{B(null),J(null),W(null),D(null),U(!1)},[]),Ct=(ee,Ae="first")=>{Je(),E(null),pe(null),B({num:ee,view:"menu",start:Ae})},En=(ee,Ae)=>{Je(),E(Le=>(Le==null?void 0:Le.anchor)===Ae?null:{num:ee,anchor:Ae})},dn=x.useCallback((ee=!1)=>{var Le;const Ae=C.current;ee&&Ae&&((Le=document.getElementById(Ae.anchor))==null||Le.focus()),E(null)},[]),ir=()=>{Je(),E(null),k("lan")},Mt=x.useRef(_);x.useEffect(()=>{Mt.current!==_&&(Mt.current=_,window.requestAnimationFrame(()=>{var ee;(ee=document.getElementById(_==="lan"?"ap-lan-back":"ap-lan-entry"))==null||ee.focus()}))},[_]),x.useEffect(()=>{n!=null&&n.ok&&b(!0)},[n==null?void 0:n.ok]);const hn=x.useCallback(ee=>{var Ie,Ue;const Ae=G.current;if(!Ae||ee!=null&&Ae.num!==ee)return;const Le=document.getElementById(`ap-menu-${Ae.num}`);(Le!=null&&Le.contains(document.activeElement)||zN(((Ie=document.activeElement)==null?void 0:Ie.tagName)??null))&&((Ue=document.getElementById(`ap-more-${Ae.num}`))==null||Ue.focus()),Je()},[Je]);x.useEffect(()=>{t&&(Je(),E(null))},[t,Je]),x.useEffect(()=>{H&&(n!=null&&n.accounts)&&!n.accounts.some(ee=>ee.num===H.num)&&Je(),S&&(n!=null&&n.accounts)&&!n.accounts.some(ee=>ee.num===S.num)&&E(null)},[n,H,S,Je]);const Cn=async ee=>{var Le;U(!1);const Ae=await we({action:"share",account:ee},`share-${ee}`);!(Ae!=null&&Ae.ok)||((Le=G.current)==null?void 0:Le.num)!==ee||(D({num:ee,blob:Ae.blob,expiresAt:Ae.expiresAt}),B({num:ee,view:"share"}))},zt=async(ee,Ae)=>{const{commit:Le,alias:Ie}=JB(V,Ae);if(Le){const Ue=await we({action:"alias",account:ee,alias:Ie},`alias-${ee}`);if(await We(!0),!(Ue!=null&&Ue.ok))return}hn(ee)},Pn=async(ee,Ae)=>{var Ue,ct;const Le=await we({action:"move",account:ee,slot:Ae},`move-${ee}`),Ie=WB({menuFor:((Ue=G.current)==null?void 0:Ue.num)??null,shareFor:(F==null?void 0:F.num)??null},ee,Le);if(await We(!0),Ie){((ct=G.current)==null?void 0:ct.num)===ee&&Je(),W(Ie.confirmRemove),Ie.shareFor==null&&(D(null),U(!1)),de(Ie.swapNote);const yt=Ie.swapNote;yt&&window.setTimeout(()=>de(St=>St===yt?null:St),rz),pe(null),Ze(Ie.menuFor)}return Le},yn=async(ee,Ae,Le)=>{if(!Le.sends){hn(ee);return}await Pn(ee,Ae)},wn=async(ee,Ae)=>{if(Ae.sends){const Le=await tt({action:"setting",key:"autoswitch.threshold",value:ee},"threshold");if(await We(!0),!(Le!=null&&Le.ok))return;Pe(null)}Te(!0),window.setTimeout(()=>{var Le;document.activeElement===et.current&&((Le=je.current)==null||Le.focus()),Te(!1)},sz)},Tn=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"})})}),_r=ee=>{const{shown:Ae,fuller:Le}=KB(ee.lanes),Ie=Td(ee,T),Ue=ee.active||Ce.includes(uh(ee)),ct=ee.alias??ee.email??`account ${ee.num}`,yt=ee.stale||(Ie==null?void 0:Ie.blocksSwitch)===!0,St=Le?[...Ae,Le]:Ae,Sr=ee.fetchedAt?Fp(ee.fetchedAt,T):null;return i.jsxs("li",{className:`ap-account${ee.active?" active":""}`,"aria-current":ee.active?"true":void 0,"data-open":Ue?"":void 0,"data-frozen":yt?"":void 0,children:[!ee.active&&i.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${ee.num}`,"aria-expanded":Ue,"aria-controls":Ue?`ap-detail-${ee.num}`:void 0,"aria-describedby":!Ue&&!(Ie!=null&&Ie.blocksSwitch)?`ap-quota-${ee.num}`:void 0,onClick:()=>Ne(xt=>XB(xt,ee)),children:i.jsxs("span",{className:"vis-hidden",children:[ct,", ",Ue?"hide details":"details"]})}),i.jsxs("div",{className:"ap-account-head",children:[ee.active?i.jsx("span",{className:"ap-live",title:`Active account · slot ${ee.num}`,children:i.jsxs("span",{className:"vis-hidden",children:["Active account, slot ",ee.num,":"]})}):i.jsx("span",{className:"ap-num",children:ee.num}),ee.alias&&i.jsx("span",{className:"ap-alias",title:ee.alias,children:ee.alias}),i.jsx("span",{className:"ap-email",title:ee.email??void 0,children:ee.email}),ee.disabled&&i.jsx("span",{className:"ap-held",children:"held out"}),!ee.active&&!ee.disabled&&!(Ie!=null&&Ie.blocksSwitch)&&i.jsx("button",{type:"button",className:"ap-switch",...Re(`switch-${ee.num}`),onClick:()=>he(ee.num,ct),"aria-label":`Switch to ${ct}`,title:`Switch to ${ee.alias??ee.email}`,children:c===`switch-${ee.num}`?"…":"Switch"}),i.jsx("button",{type:"button",id:`ap-more-${ee.num}`,className:"ap-more","aria-label":`More actions for ${ee.email??ee.alias??`account ${ee.num}`}`,"aria-haspopup":"menu","aria-expanded":P===ee.num,"aria-controls":P===ee.num?`ap-menu-${ee.num}`:void 0,title:"More actions",onClick:()=>P===ee.num?hn():Ct(ee.num),onKeyDown:xt=>{xt.key!=="ArrowDown"&&xt.key!=="ArrowUp"||(xt.preventDefault(),Ct(ee.num,xt.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)===ee.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:"×"})]}),ee.active&&(y==null?void 0:y.num)===ee.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."}),(re==null?void 0:re.at)===ee.num&&(()=>{const xt=mt.find(Us=>Us.num===re.displaced),wt=(xt==null?void 0:xt.alias)??(xt==null?void 0:xt.email)??"the account that was there";return i.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${re.at} was taken, so the two accounts traded places: ${wt} now holds slot ${re.displaced}.`,children:["swapped with slot ",re.displaced]})})(),Ie&&i.jsxs("div",{className:"ap-issue-line",children:[i.jsxs("button",{type:"button",id:`ap-issue-${ee.num}`,className:"ap-issue","data-tone":Ie.tone,"aria-haspopup":"dialog","aria-expanded":(S==null?void 0:S.anchor)===`ap-issue-${ee.num}`,"aria-controls":(S==null?void 0:S.anchor)===`ap-issue-${ee.num}`?"ap-issue-pop":void 0,onClick:()=>En(ee.num,`ap-issue-${ee.num}`),children:[Ie.tone==="warn"&&i.jsx(qp,{}),i.jsx("span",{className:"ap-issue-text",children:Ie.text})]}),!Ue&&i.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:Sr??"never collected"})]}),!Ue&&!(Ie!=null&&Ie.blocksSwitch)&&i.jsxs("p",{className:"ap-quota",id:`ap-quota-${ee.num}`,children:[St.length?St.map(xt=>i.jsxs("span",{className:"ap-q",children:[i.jsx("span",{className:"ap-q-label",children:xt.label})," ",i.jsxs("span",{className:"ap-q-pct","data-level":yt?void 0:uz(xt.pct),children:[Math.round(xt.pct),"%"]})]},xt.id)):i.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),ee.stale&&!Ie&&i.jsx("span",{className:"ap-q-age","data-never":Sr?void 0:"",title:"When claude-swap last read this account's usage",children:Sr??"never collected"})]}),Ue&&i.jsxs("div",{className:"ap-detail",id:`ap-detail-${ee.num}`,children:[i.jsx("div",{className:"ap-lanes",children:ee.lanes.length?ee.lanes.map(xt=>i.jsx(hz,{lane:xt,nowSec:T,frozen:yt},xt.id)):i.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),i.jsx("div",{className:"ap-meta",children:ee.fetchedAt?i.jsxs("span",{className:`ap-age${ee.stale&&!Ie?" 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 ",Fp(ee.fetchedAt,T),Ie!=null&&Ie.blocksSwitch?"":oz(ee.nextAt,T)]}):i.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]},ee.num)},Kr=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:je,"aria-label":"Switch threshold",value:Qe,...Re("threshold"),onChange:ee=>Pe(ee.target.value),children:dz(Me).map(ee=>i.jsxs("option",{value:ee,children:[ee,"%"]},ee))})}),(ce.sends||$e)&&i.jsx("button",{ref:et,type:"button",className:"ap-manage-btn",...Re("threshold"),title:ce.title,onClick:()=>wn(Qe,ce),children:$e&&!ce.sends?ce.done:ce.label}),i.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":a.enabled,"aria-label":"Auto-switch",...Re("enable"),onClick:()=>tt({action:"enable",enabled:!a.enabled},"enable").then(()=>We(!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:[_==="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:()=>X(!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"})})}),(((vn=n==null?void 0:n.accounts)==null?void 0:vn.length)??0)>0&&i.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>z(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${nn} 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:()=>We(!0),...Re("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"})]})}),Tn]})]}),_==="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 ",h_/1e3," seconds."]}),i.jsx("button",{type:"button",className:"ap-fix",disabled:f,onClick:()=>We(!0),children:f?"trying…":"try again"})]}):i.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?i.jsxs(i.Fragment,{children:[lt&&(gt==null?void 0:gt.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":(S==null?void 0:S.anchor)==="ap-notice","aria-controls":(S==null?void 0:S.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>En(lt.num,"ap-notice"),children:[i.jsx(qp,{}),i.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),gt.fix&&i.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>X(!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:Ot.map(_r)}),Et.length>0&&i.jsx(FB,{peers:Pt,strained:jn,armed:_t,threshold:a!=null&&a.ok?Me:null,open:He,onToggle:()=>it(ee=>!ee)}),Et.length>0&&He&&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:Et.map(_r)}),Kr]}),Et.length===0&&Kr,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:"×"})]}),H&&(()=>{var Ie;const ee=(Ie=n.accounts)==null?void 0:Ie.find(Ue=>Ue.num===H.num);if(!ee)return null;const Ae=`ap-pop-title-${ee.num}`,Le=Q&&i.jsx("p",{className:"ap-pop-error",role:"alert",title:Q.raw||void 0,children:Q.text});return i.jsxs(Fx,{anchorId:`ap-more-${ee.num}`,boundaryId:Bt(ee.num),id:`ap-menu-${ee.num}`,className:"ap-pop",role:H.view==="menu"?"menu":"dialog",labelledBy:H.view==="menu"?`ap-more-${ee.num}`:Ae,start:H.start,onClose:Je,children:[H.view==="menu"&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{I(ee.alias??""),J(null),B({num:ee.num,view:"rename"})},children:"Rename"}),i.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{pe(null),J(null),B({num:ee.num,view:"move"})},children:"Move to slot…"}),i.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...Re(`share-${ee.num}`),title:`Copy this account to another ${nn}. 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:()=>Cn(ee.num),children:c===`share-${ee.num}`?"Sharing…":"Share"}),(((a==null?void 0:a.enabled)||(a==null?void 0:a.external))&&!ee.active||ee.disabled)&&i.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...Re(`rot-${ee.num}`),title:ee.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",onClick:()=>tt({action:"account",account:ee.num,enabled:ee.disabled},`rot-${ee.num}`,"menu").then(Ue=>{We(!0),Ue!=null&&Ue.ok&&hn(ee.num)}),children:ee.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===ee.num?" armed":""}`,...Re(`rm-${ee.num}`),"aria-label":q===ee.num?"Confirm remove":void 0,title:q===ee.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{const Ue=Date.now(),ct=ah({armedFor:q,target:ee.num,armedAt:K.current,now:Ue,gapMs:lh});if(ct==="arm"){W(ee.num),K.current=Ue,window.setTimeout(()=>W(yt=>yt===ee.num?null:yt),4e3);return}ct!=="ignore"&&(W(null),we({action:"remove",account:ee.num},`rm-${ee.num}`).then(yt=>{var St;We(!0),yt!=null&&yt.ok&&(((St=G.current)==null?void 0:St.num)===ee.num&&Je(),Ze(null))}))},children:c===`rm-${ee.num}`?"Removing…":q===ee.num?"Confirm":"Remove"}),Le]}),H.view==="rename"&&i.jsxs("form",{className:"ap-pop-form",onSubmit:Ue=>{Ue.preventDefault(),zt(ee.num,ee.alias)},children:[i.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-alias-${ee.num}`,children:"Rename account"}),i.jsx("input",{id:`ap-alias-${ee.num}`,className:"ap-manage-input",type:"text",value:V,onChange:Ue=>I(Ue.target.value),maxLength:QB,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:Ue=>Ue.currentTarget.select()}),Le,i.jsxs("div",{className:"ap-pop-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>hn(),children:"Cancel"}),i.jsx("button",{type:"submit",className:"btn primary",...Re(`alias-${ee.num}`),title:"A short name to show instead of the email",children:c===`alias-${ee.num}`?"…":"Save"})]})]}),H.view==="move"&&(()=>{const Ue=HB((n.accounts??[]).map(St=>St.num),ee.num),ct=UB(Ue,ge,ee.num),yt=VB(Ue,ct,ee.num);return i.jsxs("div",{className:"ap-pop-form",children:[i.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-slot-${ee.num}`,children:"Move to slot"}),i.jsx("span",{className:"ap-field",children:i.jsx("select",{id:`ap-slot-${ee.num}`,value:String(ct),...Re(`move-${ee.num}`),onChange:St=>pe(Number(St.target.value)),autoFocus:!0,children:Ue.map(St=>i.jsx("option",{value:St.slot,children:St.label},St.slot))})}),Le,i.jsxs("div",{className:"ap-pop-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>hn(),children:"Cancel"}),i.jsx("button",{type:"button",className:"btn primary",...Re(`move-${ee.num}`),title:yt.title,onClick:()=>yn(ee.num,ct,yt),children:c===`move-${ee.num}`?"…":vc(yt.label)})]})]})})(),H.view==="share"&&(F==null?void 0:F.num)===ee.num&&(()=>{const Ue=DR(F.expiresAt,T),ct=Ue.tone==="gone";return i.jsxs("div",{className:`ap-pop-form ap-share${ct?" expired":""}`,children:[i.jsx("p",{className:"ap-pop-title",id:Ae,children:"Share account"}),i.jsx("code",{className:"ap-share-blob",children:F.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 ${Ue.tone}`,children:Ue.text})]}),Le,i.jsxs("div",{className:"ap-pop-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>hn(),children:"Done"}),i.jsx("button",{type:"button",className:"btn primary",...Re(`share-${ee.num}`),autoFocus:!0,onClick:async()=>{if(ct){await Cn(ee.num);return}await al(F.blob)&&(U(!0),window.setTimeout(()=>U(!1),1800))},children:ct?"Make a new share":Z?"Copied":"Copy"})]})]})})()]})})(),S&&(()=>{var Le;const ee=(Le=n.accounts)==null?void 0:Le.find(Ie=>Ie.num===S.num),Ae=ee?Td(ee,T):null;return!ee||!Ae?null:i.jsx(Fx,{anchorId:S.anchor,boundaryId:S.anchor==="ap-notice"?"ap-scroll":Bt(ee.num),id:"ap-issue-pop",className:"ap-pop ap-issue-pop",role:"dialog",labelledBy:"ap-issue-title",onClose:()=>dn(),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":Ae.tone,children:[Ae.tone==="warn"&&i.jsx(qp,{}),Ae.text]}),i.jsx("p",{className:"ap-pop-note ap-issue-hint",children:Ae.hint}),i.jsxs("p",{className:"ap-pop-note ap-issue-when",children:[i.jsx("span",{className:"ap-issue-who",children:ee.alias??ee.email??`account ${ee.num}`})," · ",ee.fetchedAt?`last collected ${Fp(ee.fetchedAt,T)}`:"never collected"]}),i.jsxs("div",{className:"ap-pop-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>dn(!0),children:"Done"}),Ae.fix&&i.jsx("button",{type:"button",className:"btn primary",onClick:()=>{dn(!0),X(!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:Ae.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}`:""}),j&&i.jsx(LB,{accounts:((n==null?void 0:n.accounts)??[]).map(ee=>({key:`${String(ee.email??"").trim().toLowerCase()}@@${ee.orgUuid??""}`,email:ee.email??"",alive:ee.alive===!0})),onChanged:()=>We(!0),view:_==="lan",onOpen:ir,onBack:()=>k("accounts"),closeButton:Tn}),M&&i.jsx($8,{onClose:()=>X(!1),onChanged:()=>We(!0)}),ae&&i.jsx(zB,{accounts:((n==null?void 0:n.accounts)??[]).map(ee=>({num:ee.num,email:ee.email,alias:ee.alias,org:ee.org})),onClose:()=>z(!1),copyText:al})]})}const pz=3e4;function mz({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function gz({bundle:e,running:t,pending:n,lastTried:r}){return t?mz({bundle:e,running:t,lastTried:r})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function yz(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function wz({asked:e,reported:t}){return t?t!==e:!1}function GR(e){const t=e.thresholdMs??pz;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 vz(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 xz(e,t){return e?t==null?"auto when idle":`auto in ${vz(t)}`:"auto-restart off"}function f_(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function bz(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 kz(e){const t=GR(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 H0(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 Bp,p_;function Nz(){if(p_)return Bp;p_=1;function e(){this.__data__=[],this.size=0}return Bp=e,Bp}var zp,m_;function dl(){if(m_)return zp;m_=1;function e(t,n){return t===n||t!==t&&n!==n}return zp=e,zp}var Hp,g_;function Ih(){if(g_)return Hp;g_=1;var e=dl();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return Hp=t,Hp}var Wp,y_;function _z(){if(y_)return Wp;y_=1;var e=Ih(),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 Wp=r,Wp}var Up,w_;function Sz(){if(w_)return Up;w_=1;var e=Ih();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return Up=t,Up}var Vp,v_;function jz(){if(v_)return Vp;v_=1;var e=Ih();function t(n){return e(this.__data__,n)>-1}return Vp=t,Vp}var Gp,x_;function Ez(){if(x_)return Gp;x_=1;var e=Ih();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 Gp=t,Gp}var Kp,b_;function $h(){if(b_)return Kp;b_=1;var e=Nz(),t=_z(),n=Sz(),r=jz(),a=Ez();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,Kp=l,Kp}var Yp,k_;function Cz(){if(k_)return Yp;k_=1;var e=$h();function t(){this.__data__=new e,this.size=0}return Yp=t,Yp}var Xp,N_;function Tz(){if(N_)return Xp;N_=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return Xp=e,Xp}var Zp,__;function Az(){if(__)return Zp;__=1;function e(t){return this.__data__.get(t)}return Zp=e,Zp}var Qp,S_;function Rz(){if(S_)return Qp;S_=1;function e(t){return this.__data__.has(t)}return Qp=e,Qp}var Jp,j_;function KR(){if(j_)return Jp;j_=1;var e=typeof dd=="object"&&dd&&dd.Object===Object&ⅆreturn Jp=e,Jp}var em,E_;function Gr(){if(E_)return em;E_=1;var e=KR(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return em=n,em}var tm,C_;function hl(){if(C_)return tm;C_=1;var e=Gr(),t=e.Symbol;return tm=t,tm}var nm,T_;function Mz(){if(T_)return nm;T_=1;var e=hl(),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 nm=l,nm}var rm,A_;function Iz(){if(A_)return rm;A_=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return rm=n,rm}var sm,R_;function Bo(){if(R_)return sm;R_=1;var e=hl(),t=Mz(),n=Iz(),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 sm=c,sm}var am,M_;function kr(){if(M_)return am;M_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return am=e,am}var om,I_;function Qc(){if(I_)return om;I_=1;var e=Bo(),t=kr(),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 om=c,om}var im,$_;function $z(){if($_)return im;$_=1;var e=Gr(),t=e["__core-js_shared__"];return im=t,im}var lm,O_;function Oz(){if(O_)return lm;O_=1;var e=$z(),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 lm=n,lm}var cm,P_;function YR(){if(P_)return cm;P_=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 cm=n,cm}var um,L_;function Pz(){if(L_)return um;L_=1;var e=Qc(),t=Oz(),n=kr(),r=YR(),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 um=m,um}var dm,D_;function Lz(){if(D_)return dm;D_=1;function e(t,n){return t==null?void 0:t[n]}return dm=e,dm}var hm,F_;function zo(){if(F_)return hm;F_=1;var e=Pz(),t=Lz();function n(r,a){var l=t(r,a);return e(l)?l:void 0}return hm=n,hm}var fm,q_;function W0(){if(q_)return fm;q_=1;var e=zo(),t=Gr(),n=e(t,"Map");return fm=n,fm}var pm,B_;function Oh(){if(B_)return pm;B_=1;var e=zo(),t=e(Object,"create");return pm=t,pm}var mm,z_;function Dz(){if(z_)return mm;z_=1;var e=Oh();function t(){this.__data__=e?e(null):{},this.size=0}return mm=t,mm}var gm,H_;function Fz(){if(H_)return gm;H_=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return gm=e,gm}var ym,W_;function qz(){if(W_)return ym;W_=1;var e=Oh(),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 ym=a,ym}var wm,U_;function Bz(){if(U_)return wm;U_=1;var e=Oh(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var l=this.__data__;return e?l[a]!==void 0:n.call(l,a)}return wm=r,wm}var vm,V_;function zz(){if(V_)return vm;V_=1;var e=Oh(),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 vm=n,vm}var xm,G_;function Hz(){if(G_)return xm;G_=1;var e=Dz(),t=Fz(),n=qz(),r=Bz(),a=zz();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,xm=l,xm}var bm,K_;function Wz(){if(K_)return bm;K_=1;var e=Hz(),t=$h(),n=W0();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return bm=r,bm}var km,Y_;function Uz(){if(Y_)return km;Y_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return km=e,km}var Nm,X_;function Ph(){if(X_)return Nm;X_=1;var e=Uz();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return Nm=t,Nm}var _m,Z_;function Vz(){if(Z_)return _m;Z_=1;var e=Ph();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return _m=t,_m}var Sm,Q_;function Gz(){if(Q_)return Sm;Q_=1;var e=Ph();function t(n){return e(this,n).get(n)}return Sm=t,Sm}var jm,J_;function Kz(){if(J_)return jm;J_=1;var e=Ph();function t(n){return e(this,n).has(n)}return jm=t,jm}var Em,eS;function Yz(){if(eS)return Em;eS=1;var e=Ph();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 Em=t,Em}var Cm,tS;function U0(){if(tS)return Cm;tS=1;var e=Wz(),t=Vz(),n=Gz(),r=Kz(),a=Yz();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,Cm=l,Cm}var Tm,nS;function Xz(){if(nS)return Tm;nS=1;var e=$h(),t=W0(),n=U0(),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 Tm=a,Tm}var Am,rS;function Lh(){if(rS)return Am;rS=1;var e=$h(),t=Cz(),n=Tz(),r=Az(),a=Rz(),l=Xz();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,Am=c,Am}var Rm,sS;function V0(){if(sS)return Rm;sS=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 Rm=e,Rm}var Mm,aS;function XR(){if(aS)return Mm;aS=1;var e=zo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Mm=t,Mm}var Im,oS;function Dh(){if(oS)return Im;oS=1;var e=XR();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return Im=t,Im}var $m,iS;function Fh(){if(iS)return $m;iS=1;var e=Dh(),t=dl(),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 $m=a,$m}var Om,lS;function Jc(){if(lS)return Om;lS=1;var e=Fh(),t=Dh();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 Om=n,Om}var Pm,cS;function Zz(){if(cS)return Pm;cS=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return Pm=e,Pm}var Lm,uS;function ps(){if(uS)return Lm;uS=1;function e(t){return t!=null&&typeof t=="object"}return Lm=e,Lm}var Dm,dS;function Qz(){if(dS)return Dm;dS=1;var e=Bo(),t=ps(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return Dm=r,Dm}var Fm,hS;function eu(){if(hS)return Fm;hS=1;var e=Qz(),t=ps(),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 Fm=l,Fm}var qm,fS;function Gt(){if(fS)return qm;fS=1;var e=Array.isArray;return qm=e,qm}var xc={exports:{}},Bm,pS;function Jz(){if(pS)return Bm;pS=1;function e(){return!1}return Bm=e,Bm}xc.exports;var mS;function fl(){return mS||(mS=1,(function(e,t){var n=Gr(),r=Jz(),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})(xc,xc.exports)),xc.exports}var zm,gS;function qh(){if(gS)return zm;gS=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 zm=n,zm}var Hm,yS;function G0(){if(yS)return Hm;yS=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Hm=t,Hm}var Wm,wS;function eH(){if(wS)return Wm;wS=1;var e=Bo(),t=G0(),n=ps(),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]",_="[object String]",k="[object WeakMap]",j="[object ArrayBuffer]",b="[object DataView]",S="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",$="[object Uint8Array]",H="[object Uint8ClampedArray]",B="[object Uint16Array]",P="[object Uint32Array]",G={};G[S]=G[E]=G[C]=G[T]=G[R]=G[$]=G[H]=G[B]=G[P]=!0,G[r]=G[a]=G[j]=G[l]=G[b]=G[c]=G[u]=G[f]=G[p]=G[h]=G[m]=G[y]=G[w]=G[_]=G[k]=!1;function Q(J){return n(J)&&t(J.length)&&!!G[e(J)]}return Wm=Q,Wm}var Um,vS;function Bh(){if(vS)return Um;vS=1;function e(t){return function(n){return t(n)}}return Um=e,Um}var bc={exports:{}};bc.exports;var xS;function K0(){return xS||(xS=1,(function(e,t){var n=KR(),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})(bc,bc.exports)),bc.exports}var Vm,bS;function tu(){if(bS)return Vm;bS=1;var e=eH(),t=Bh(),n=K0(),r=n&&n.isTypedArray,a=r?t(r):e;return Vm=a,Vm}var Gm,kS;function ZR(){if(kS)return Gm;kS=1;var e=Zz(),t=eu(),n=Gt(),r=fl(),a=qh(),l=tu(),c=Object.prototype,u=c.hasOwnProperty;function f(p,h){var m=n(p),y=!m&&t(p),w=!m&&!y&&r(p),_=!m&&!y&&!w&&l(p),k=m||y||w||_,j=k?e(p.length,String):[],b=j.length;for(var S in p)(h||u.call(p,S))&&!(k&&(S=="length"||w&&(S=="offset"||S=="parent")||_&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||a(S,b)))&&j.push(S);return j}return Gm=f,Gm}var Km,NS;function zh(){if(NS)return Km;NS=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return Km=t,Km}var Ym,_S;function QR(){if(_S)return Ym;_S=1;function e(t,n){return function(r){return t(n(r))}}return Ym=e,Ym}var Xm,SS;function tH(){if(SS)return Xm;SS=1;var e=QR(),t=e(Object.keys,Object);return Xm=t,Xm}var Zm,jS;function Y0(){if(jS)return Zm;jS=1;var e=zh(),t=tH(),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 Zm=a,Zm}var Qm,ES;function Bs(){if(ES)return Qm;ES=1;var e=Qc(),t=G0();function n(r){return r!=null&&t(r.length)&&!e(r)}return Qm=n,Qm}var Jm,CS;function Fa(){if(CS)return Jm;CS=1;var e=ZR(),t=Y0(),n=Bs();function r(a){return n(a)?e(a):t(a)}return Jm=r,Jm}var eg,TS;function nH(){if(TS)return eg;TS=1;var e=Jc(),t=Fa();function n(r,a){return r&&e(a,t(a),r)}return eg=n,eg}var tg,AS;function rH(){if(AS)return tg;AS=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return tg=e,tg}var ng,RS;function sH(){if(RS)return ng;RS=1;var e=kr(),t=zh(),n=rH(),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 ng=l,ng}var rg,MS;function Ho(){if(MS)return rg;MS=1;var e=ZR(),t=sH(),n=Bs();function r(a){return n(a)?e(a,!0):t(a)}return rg=r,rg}var sg,IS;function aH(){if(IS)return sg;IS=1;var e=Jc(),t=Ho();function n(r,a){return r&&e(a,t(a),r)}return sg=n,sg}var kc={exports:{}};kc.exports;var $S;function JR(){return $S||($S=1,(function(e,t){var n=Gr(),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})(kc,kc.exports)),kc.exports}var ag,OS;function eM(){if(OS)return ag;OS=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 ag=e,ag}var og,PS;function tM(){if(PS)return og;PS=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 og=e,og}var ig,LS;function nM(){if(LS)return ig;LS=1;function e(){return[]}return ig=e,ig}var lg,DS;function X0(){if(DS)return lg;DS=1;var e=tM(),t=nM(),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 lg=l,lg}var cg,FS;function oH(){if(FS)return cg;FS=1;var e=Jc(),t=X0();function n(r,a){return e(r,t(r),a)}return cg=n,cg}var ug,qS;function Z0(){if(qS)return ug;qS=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 ug=e,ug}var dg,BS;function Hh(){if(BS)return dg;BS=1;var e=QR(),t=e(Object.getPrototypeOf,Object);return dg=t,dg}var hg,zS;function rM(){if(zS)return hg;zS=1;var e=Z0(),t=Hh(),n=X0(),r=nM(),a=Object.getOwnPropertySymbols,l=a?function(c){for(var u=[];c;)e(u,n(c)),c=t(c);return u}:r;return hg=l,hg}var fg,HS;function iH(){if(HS)return fg;HS=1;var e=Jc(),t=rM();function n(r,a){return e(r,t(r),a)}return fg=n,fg}var pg,WS;function sM(){if(WS)return pg;WS=1;var e=Z0(),t=Gt();function n(r,a,l){var c=a(r);return t(r)?c:e(c,l(r))}return pg=n,pg}var mg,US;function aM(){if(US)return mg;US=1;var e=sM(),t=X0(),n=Fa();function r(a){return e(a,n,t)}return mg=r,mg}var gg,VS;function lH(){if(VS)return gg;VS=1;var e=sM(),t=rM(),n=Ho();function r(a){return e(a,n,t)}return gg=r,gg}var yg,GS;function cH(){if(GS)return yg;GS=1;var e=zo(),t=Gr(),n=e(t,"DataView");return yg=n,yg}var wg,KS;function uH(){if(KS)return wg;KS=1;var e=zo(),t=Gr(),n=e(t,"Promise");return wg=n,wg}var vg,YS;function oM(){if(YS)return vg;YS=1;var e=zo(),t=Gr(),n=e(t,"Set");return vg=n,vg}var xg,XS;function dH(){if(XS)return xg;XS=1;var e=zo(),t=Gr(),n=e(t,"WeakMap");return xg=n,xg}var bg,ZS;function pl(){if(ZS)return bg;ZS=1;var e=cH(),t=W0(),n=uH(),r=oM(),a=dH(),l=Bo(),c=YR(),u="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",m="[object WeakMap]",y="[object DataView]",w=c(e),_=c(t),k=c(n),j=c(r),b=c(a),S=l;return(e&&S(new e(new ArrayBuffer(1)))!=y||t&&S(new t)!=u||n&&S(n.resolve())!=p||r&&S(new r)!=h||a&&S(new a)!=m)&&(S=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 _:return u;case k:return p;case j:return h;case b:return m}return C}),bg=S,bg}var kg,QS;function hH(){if(QS)return kg;QS=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 kg=n,kg}var Ng,JS;function iM(){if(JS)return Ng;JS=1;var e=Gr(),t=e.Uint8Array;return Ng=t,Ng}var _g,ej;function Q0(){if(ej)return _g;ej=1;var e=iM();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return _g=t,_g}var Sg,tj;function fH(){if(tj)return Sg;tj=1;var e=Q0();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return Sg=t,Sg}var jg,nj;function pH(){if(nj)return jg;nj=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return jg=t,jg}var Eg,rj;function mH(){if(rj)return Eg;rj=1;var e=hl(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return Eg=r,Eg}var Cg,sj;function lM(){if(sj)return Cg;sj=1;var e=Q0();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return Cg=t,Cg}var Tg,aj;function gH(){if(aj)return Tg;aj=1;var e=Q0(),t=fH(),n=pH(),r=mH(),a=lM(),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]",_="[object DataView]",k="[object Float32Array]",j="[object Float64Array]",b="[object Int8Array]",S="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",$="[object Uint32Array]";function H(B,P,G){var Q=B.constructor;switch(P){case w:return e(B);case l:case c:return new Q(+B);case _:return t(B,G);case k:case j:case b:case S:case E:case C:case T:case R:case $:return a(B,G);case u:return new Q;case f:case m:return new Q(B);case p:return n(B);case h:return new Q;case y:return r(B)}}return Tg=H,Tg}var Ag,oj;function cM(){if(oj)return Ag;oj=1;var e=kr(),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 Ag=n,Ag}var Rg,ij;function uM(){if(ij)return Rg;ij=1;var e=cM(),t=Hh(),n=zh();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return Rg=r,Rg}var Mg,lj;function yH(){if(lj)return Mg;lj=1;var e=pl(),t=ps(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return Mg=r,Mg}var Ig,cj;function wH(){if(cj)return Ig;cj=1;var e=yH(),t=Bh(),n=K0(),r=n&&n.isMap,a=r?t(r):e;return Ig=a,Ig}var $g,uj;function vH(){if(uj)return $g;uj=1;var e=pl(),t=ps(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return $g=r,$g}var Og,dj;function xH(){if(dj)return Og;dj=1;var e=vH(),t=Bh(),n=K0(),r=n&&n.isSet,a=r?t(r):e;return Og=a,Og}var Pg,hj;function dM(){if(hj)return Pg;hj=1;var e=Lh(),t=V0(),n=Fh(),r=nH(),a=aH(),l=JR(),c=eM(),u=oH(),f=iH(),p=aM(),h=lH(),m=pl(),y=hH(),w=gH(),_=uM(),k=Gt(),j=fl(),b=wH(),S=kr(),E=xH(),C=Fa(),T=Ho(),R=1,$=2,H=4,B="[object Arguments]",P="[object Array]",G="[object Boolean]",Q="[object Date]",J="[object Error]",M="[object Function]",X="[object GeneratorFunction]",V="[object Map]",I="[object Number]",q="[object Object]",W="[object RegExp]",K="[object Set]",F="[object String]",D="[object Symbol]",ae="[object WeakMap]",z="[object ArrayBuffer]",Z="[object DataView]",U="[object Float32Array]",re="[object Float64Array]",de="[object Int8Array]",ge="[object Int16Array]",pe="[object Int32Array]",_e="[object Uint8Array]",Pe="[object Uint8ClampedArray]",$e="[object Uint16Array]",Te="[object Uint32Array]",je={};je[B]=je[P]=je[z]=je[Z]=je[G]=je[Q]=je[U]=je[re]=je[de]=je[ge]=je[pe]=je[V]=je[I]=je[q]=je[W]=je[K]=je[F]=je[D]=je[_e]=je[Pe]=je[$e]=je[Te]=!0,je[J]=je[M]=je[ae]=!1;function et(Ce,Ne,He,it,ot,le){var be,Re=Ne&R,Ze=Ne&$,We=Ne&H;if(He&&(be=ot?He(Ce,it,ot,le):He(Ce)),be!==void 0)return be;if(!S(Ce))return Ce;var tt=k(Ce);if(tt){if(be=y(Ce),!Re)return c(Ce,be)}else{var we=m(Ce),Me=we==M||we==X;if(j(Ce))return l(Ce,Re);if(we==q||we==B||Me&&!ot){if(be=Ze||Me?{}:_(Ce),!Re)return Ze?f(Ce,a(be,Ce)):u(Ce,r(be,Ce))}else{if(!je[we])return ot?Ce:{};be=w(Ce,we,Re)}}le||(le=new e);var Qe=le.get(Ce);if(Qe)return Qe;le.set(Ce,be),E(Ce)?Ce.forEach(function(gt){be.add(et(gt,Ne,He,gt,Ce,le))}):b(Ce)&&Ce.forEach(function(gt,mt){be.set(mt,et(gt,Ne,He,mt,Ce,le))});var ce=We?Ze?h:p:Ze?T:C,lt=tt?void 0:ce(Ce);return t(lt||Ce,function(gt,mt){lt&&(mt=gt,gt=Ce[mt]),n(be,mt,et(gt,Ne,He,mt,Ce,le))}),be}return Pg=et,Pg}var Lg,fj;function bH(){if(fj)return Lg;fj=1;var e=dM(),t=4;function n(r){return e(r,t)}return Lg=n,Lg}var Dg,pj;function J0(){if(pj)return Dg;pj=1;function e(t){return function(){return t}}return Dg=e,Dg}var Fg,mj;function kH(){if(mj)return Fg;mj=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 Fg=e,Fg}var qg,gj;function eb(){if(gj)return qg;gj=1;var e=kH(),t=e();return qg=t,qg}var Bg,yj;function tb(){if(yj)return Bg;yj=1;var e=eb(),t=Fa();function n(r,a){return r&&e(r,a,t)}return Bg=n,Bg}var zg,wj;function NH(){if(wj)return zg;wj=1;var e=Bs();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 zg=t,zg}var Hg,vj;function Wh(){if(vj)return Hg;vj=1;var e=tb(),t=NH(),n=t(e);return Hg=n,Hg}var Wg,xj;function Wo(){if(xj)return Wg;xj=1;function e(t){return t}return Wg=e,Wg}var Ug,bj;function hM(){if(bj)return Ug;bj=1;var e=Wo();function t(n){return typeof n=="function"?n:e}return Ug=t,Ug}var Vg,kj;function fM(){if(kj)return Vg;kj=1;var e=V0(),t=Wh(),n=hM(),r=Gt();function a(l,c){var u=r(l)?e:t;return u(l,n(c))}return Vg=a,Vg}var Gg,Nj;function pM(){return Nj||(Nj=1,Gg=fM()),Gg}var Kg,_j;function _H(){if(_j)return Kg;_j=1;var e=Wh();function t(n,r){var a=[];return e(n,function(l,c,u){r(l,c,u)&&a.push(l)}),a}return Kg=t,Kg}var Yg,Sj;function SH(){if(Sj)return Yg;Sj=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Yg=t,Yg}var Xg,jj;function jH(){if(jj)return Xg;jj=1;function e(t){return this.__data__.has(t)}return Xg=e,Xg}var Zg,Ej;function mM(){if(Ej)return Zg;Ej=1;var e=U0(),t=SH(),n=jH();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,Zg=r,Zg}var Qg,Cj;function EH(){if(Cj)return Qg;Cj=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 Qg=e,Qg}var Jg,Tj;function gM(){if(Tj)return Jg;Tj=1;function e(t,n){return t.has(n)}return Jg=e,Jg}var ey,Aj;function yM(){if(Aj)return ey;Aj=1;var e=mM(),t=EH(),n=gM(),r=1,a=2;function l(c,u,f,p,h,m){var y=f&r,w=c.length,_=u.length;if(w!=_&&!(y&&_>w))return!1;var k=m.get(c),j=m.get(u);if(k&&j)return k==u&&j==c;var b=-1,S=!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;S=!1;break}if(E){if(!t(u,function($,H){if(!n(E,H)&&(C===$||h(C,$,f,p,m)))return E.push(H)})){S=!1;break}}else if(!(C===T||h(C,T,f,p,m))){S=!1;break}}return m.delete(c),m.delete(u),S}return ey=l,ey}var ty,Rj;function CH(){if(Rj)return ty;Rj=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,l){r[++n]=[l,a]}),r}return ty=e,ty}var ny,Mj;function nb(){if(Mj)return ny;Mj=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return ny=e,ny}var ry,Ij;function TH(){if(Ij)return ry;Ij=1;var e=hl(),t=iM(),n=dl(),r=yM(),a=CH(),l=nb(),c=1,u=2,f="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",_="[object Set]",k="[object String]",j="[object Symbol]",b="[object ArrayBuffer]",S="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function T(R,$,H,B,P,G,Q){switch(H){case S:if(R.byteLength!=$.byteLength||R.byteOffset!=$.byteOffset)return!1;R=R.buffer,$=$.buffer;case b:return!(R.byteLength!=$.byteLength||!G(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 J=a;case _:var M=B&c;if(J||(J=l),R.size!=$.size&&!M)return!1;var X=Q.get(R);if(X)return X==$;B|=u,Q.set(R,$);var V=r(J(R),J($),B,P,G,Q);return Q.delete(R),V;case j:if(C)return C.call(R)==C.call($)}return!1}return ry=T,ry}var sy,$j;function AH(){if($j)return sy;$j=1;var e=aM(),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,_=e(c),k=_.length;if(w!=k&&!m)return!1;for(var j=w;j--;){var b=y[j];if(!(m?b in c:r.call(c,b)))return!1}var S=h.get(l),E=h.get(c);if(S&&E)return S==c&&E==l;var C=!0;h.set(l,c),h.set(c,l);for(var T=m;++j<w;){b=y[j];var R=l[b],$=c[b];if(f)var H=m?f($,R,b,c,l,h):f(R,$,b,l,c,h);if(!(H===void 0?R===$||p(R,$,u,f,h):H)){C=!1;break}T||(T=b=="constructor")}if(C&&!T){var B=l.constructor,P=c.constructor;B!=P&&"constructor"in l&&"constructor"in c&&!(typeof B=="function"&&B instanceof B&&typeof P=="function"&&P instanceof P)&&(C=!1)}return h.delete(l),h.delete(c),C}return sy=a,sy}var ay,Oj;function RH(){if(Oj)return ay;Oj=1;var e=Lh(),t=yM(),n=TH(),r=AH(),a=pl(),l=Gt(),c=fl(),u=tu(),f=1,p="[object Arguments]",h="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function _(k,j,b,S,E,C){var T=l(k),R=l(j),$=T?h:a(k),H=R?h:a(j);$=$==p?m:$,H=H==p?m:H;var B=$==m,P=H==m,G=$==H;if(G&&c(k)){if(!c(j))return!1;T=!0,B=!1}if(G&&!B)return C||(C=new e),T||u(k)?t(k,j,b,S,E,C):n(k,j,$,b,S,E,C);if(!(b&f)){var Q=B&&w.call(k,"__wrapped__"),J=P&&w.call(j,"__wrapped__");if(Q||J){var M=Q?k.value():k,X=J?j.value():j;return C||(C=new e),E(M,X,b,S,C)}}return G?(C||(C=new e),r(k,j,b,S,E,C)):!1}return ay=_,ay}var oy,Pj;function wM(){if(Pj)return oy;Pj=1;var e=RH(),t=ps();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 oy=n,oy}var iy,Lj;function MH(){if(Lj)return iy;Lj=1;var e=Lh(),t=wM(),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],_=l[w],k=y[1];if(m&&y[2]){if(_===void 0&&!(w in l))return!1}else{var j=new e;if(f)var b=f(_,k,w,l,c,j);if(!(b===void 0?t(k,_,n|r,f,j):b))return!1}}return!0}return iy=a,iy}var ly,Dj;function vM(){if(Dj)return ly;Dj=1;var e=kr();function t(n){return n===n&&!e(n)}return ly=t,ly}var cy,Fj;function IH(){if(Fj)return cy;Fj=1;var e=vM(),t=Fa();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 cy=n,cy}var uy,qj;function xM(){if(qj)return uy;qj=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return uy=e,uy}var dy,Bj;function $H(){if(Bj)return dy;Bj=1;var e=MH(),t=IH(),n=xM();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 dy=r,dy}var hy,zj;function ml(){if(zj)return hy;zj=1;var e=Bo(),t=ps(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return hy=r,hy}var fy,Hj;function rb(){if(Hj)return fy;Hj=1;var e=Gt(),t=ml(),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 fy=a,fy}var py,Wj;function OH(){if(Wj)return py;Wj=1;var e=U0(),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,py=n,py}var my,Uj;function PH(){if(Uj)return my;Uj=1;var e=OH(),t=500;function n(r){var a=e(r,function(c){return l.size===t&&l.clear(),c}),l=a.cache;return a}return my=n,my}var gy,Vj;function LH(){if(Vj)return gy;Vj=1;var e=PH(),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 gy=r,gy}var yy,Gj;function Uh(){if(Gj)return yy;Gj=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 yy=e,yy}var wy,Kj;function DH(){if(Kj)return wy;Kj=1;var e=hl(),t=Uh(),n=Gt(),r=ml(),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 wy=c,wy}var vy,Yj;function bM(){if(Yj)return vy;Yj=1;var e=DH();function t(n){return n==null?"":e(n)}return vy=t,vy}var xy,Xj;function Vh(){if(Xj)return xy;Xj=1;var e=Gt(),t=rb(),n=LH(),r=bM();function a(l,c){return e(l)?l:t(l,c)?[l]:n(r(l))}return xy=a,xy}var by,Zj;function nu(){if(Zj)return by;Zj=1;var e=ml();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return by=t,by}var ky,Qj;function Gh(){if(Qj)return ky;Qj=1;var e=Vh(),t=nu();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 ky=n,ky}var Ny,Jj;function FH(){if(Jj)return Ny;Jj=1;var e=Gh();function t(n,r,a){var l=n==null?void 0:e(n,r);return l===void 0?a:l}return Ny=t,Ny}var _y,eE;function qH(){if(eE)return _y;eE=1;function e(t,n){return t!=null&&n in Object(t)}return _y=e,_y}var Sy,tE;function kM(){if(tE)return Sy;tE=1;var e=Vh(),t=eu(),n=Gt(),r=qh(),a=G0(),l=nu();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 Sy=c,Sy}var jy,nE;function NM(){if(nE)return jy;nE=1;var e=qH(),t=kM();function n(r,a){return r!=null&&t(r,a,e)}return jy=n,jy}var Ey,rE;function BH(){if(rE)return Ey;rE=1;var e=wM(),t=FH(),n=NM(),r=rb(),a=vM(),l=xM(),c=nu(),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 Ey=p,Ey}var Cy,sE;function _M(){if(sE)return Cy;sE=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Cy=e,Cy}var Ty,aE;function zH(){if(aE)return Ty;aE=1;var e=Gh();function t(n){return function(r){return e(r,n)}}return Ty=t,Ty}var Ay,oE;function HH(){if(oE)return Ay;oE=1;var e=_M(),t=zH(),n=rb(),r=nu();function a(l){return n(l)?e(r(l)):t(l)}return Ay=a,Ay}var Ry,iE;function zs(){if(iE)return Ry;iE=1;var e=$H(),t=BH(),n=Wo(),r=Gt(),a=HH();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 Ry=l,Ry}var My,lE;function SM(){if(lE)return My;lE=1;var e=tM(),t=_H(),n=zs(),r=Gt();function a(l,c){var u=r(l)?e:t;return u(l,n(c,3))}return My=a,My}var Iy,cE;function WH(){if(cE)return Iy;cE=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,a){return r!=null&&t.call(r,a)}return Iy=n,Iy}var $y,uE;function jM(){if(uE)return $y;uE=1;var e=WH(),t=kM();function n(r,a){return r!=null&&t(r,a,e)}return $y=n,$y}var Oy,dE;function UH(){if(dE)return Oy;dE=1;var e=Y0(),t=pl(),n=eu(),r=Gt(),a=Bs(),l=fl(),c=zh(),u=tu(),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 _=t(w);if(_==f||_==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 Oy=y,Oy}var Py,hE;function EM(){if(hE)return Py;hE=1;function e(t){return t===void 0}return Py=e,Py}var Ly,fE;function CM(){if(fE)return Ly;fE=1;var e=Wh(),t=Bs();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 Ly=n,Ly}var Dy,pE;function TM(){if(pE)return Dy;pE=1;var e=Uh(),t=zs(),n=CM(),r=Gt();function a(l,c){var u=r(l)?e:n;return u(l,t(c,3))}return Dy=a,Dy}var Fy,mE;function VH(){if(mE)return Fy;mE=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 Fy=e,Fy}var qy,gE;function GH(){if(gE)return qy;gE=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 qy=e,qy}var By,yE;function AM(){if(yE)return By;yE=1;var e=VH(),t=Wh(),n=zs(),r=GH(),a=Gt();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 By=l,By}var zy,wE;function KH(){if(wE)return zy;wE=1;var e=Bo(),t=Gt(),n=ps(),r="[object String]";function a(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==r}return zy=a,zy}var Hy,vE;function YH(){if(vE)return Hy;vE=1;var e=_M(),t=e("length");return Hy=t,Hy}var Wy,xE;function XH(){if(xE)return Wy;xE=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 Wy=f,Wy}var Uy,bE;function ZH(){if(bE)return Uy;bE=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",_=p+"?",k="["+l+"]?",j="(?:"+w+"(?:"+[h,m,y].join("|")+")"+k+_+")*",b=k+_+j,S="(?:"+[h+u+"?",u,m,y,c].join("|")+")",E=RegExp(f+"(?="+f+")|"+S+b,"g");function C(T){for(var R=E.lastIndex=0;E.test(T);)++R;return R}return Uy=C,Uy}var Vy,kE;function QH(){if(kE)return Vy;kE=1;var e=YH(),t=XH(),n=ZH();function r(a){return t(a)?n(a):e(a)}return Vy=r,Vy}var Gy,NE;function JH(){if(NE)return Gy;NE=1;var e=Y0(),t=pl(),n=Bs(),r=KH(),a=QH(),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 Gy=u,Gy}var Ky,_E;function eW(){if(_E)return Ky;_E=1;var e=V0(),t=cM(),n=tb(),r=zs(),a=Hh(),l=Gt(),c=fl(),u=Qc(),f=kr(),p=tu();function h(m,y,w){var _=l(m),k=_||c(m)||p(m);if(y=r(y,4),w==null){var j=m&&m.constructor;k?w=_?new j:[]:f(m)?w=u(j)?t(a(m)):{}:w={}}return(k?e:n)(m,function(b,S,E){return y(w,b,S,E)}),w}return Ky=h,Ky}var Yy,SE;function tW(){if(SE)return Yy;SE=1;var e=hl(),t=eu(),n=Gt(),r=e?e.isConcatSpreadable:void 0;function a(l){return n(l)||t(l)||!!(r&&l&&l[r])}return Yy=a,Yy}var Xy,jE;function sb(){if(jE)return Xy;jE=1;var e=Z0(),t=tW();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 Xy=n,Xy}var Zy,EE;function nW(){if(EE)return Zy;EE=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 Zy=e,Zy}var Qy,CE;function RM(){if(CE)return Qy;CE=1;var e=nW(),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 Qy=n,Qy}var Jy,TE;function rW(){if(TE)return Jy;TE=1;var e=J0(),t=XR(),n=Wo(),r=t?function(a,l){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:n;return Jy=r,Jy}var ew,AE;function sW(){if(AE)return ew;AE=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 ew=r,ew}var tw,RE;function MM(){if(RE)return tw;RE=1;var e=rW(),t=sW(),n=t(e);return tw=n,tw}var nw,ME;function Kh(){if(ME)return nw;ME=1;var e=Wo(),t=RM(),n=MM();function r(a,l){return n(t(a,l,e),a+"")}return nw=r,nw}var rw,IE;function IM(){if(IE)return rw;IE=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 rw=e,rw}var sw,$E;function aW(){if($E)return sw;$E=1;function e(t){return t!==t}return sw=e,sw}var aw,OE;function oW(){if(OE)return aw;OE=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 aw=e,aw}var ow,PE;function iW(){if(PE)return ow;PE=1;var e=IM(),t=aW(),n=oW();function r(a,l,c){return l===l?n(a,l,c):e(a,t,c)}return ow=r,ow}var iw,LE;function lW(){if(LE)return iw;LE=1;var e=iW();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return iw=t,iw}var lw,DE;function cW(){if(DE)return lw;DE=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 lw=e,lw}var cw,FE;function uW(){if(FE)return cw;FE=1;function e(){}return cw=e,cw}var uw,qE;function dW(){if(qE)return uw;qE=1;var e=oM(),t=uW(),n=nb(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(l){return new e(l)}:t;return uw=a,uw}var dw,BE;function hW(){if(BE)return dw;BE=1;var e=mM(),t=lW(),n=cW(),r=gM(),a=dW(),l=nb(),c=200;function u(f,p,h){var m=-1,y=t,w=f.length,_=!0,k=[],j=k;if(h)_=!1,y=n;else if(w>=c){var b=p?null:a(f);if(b)return l(b);_=!1,y=r,j=new e}else j=p?[]:k;e:for(;++m<w;){var S=f[m],E=p?p(S):S;if(S=h||S!==0?S:0,_&&E===E){for(var C=j.length;C--;)if(j[C]===E)continue e;p&&j.push(E),k.push(S)}else y(j,E,h)||(j!==k&&j.push(E),k.push(S))}return k}return dw=u,dw}var hw,zE;function $M(){if(zE)return hw;zE=1;var e=Bs(),t=ps();function n(r){return t(r)&&e(r)}return hw=n,hw}var fw,HE;function fW(){if(HE)return fw;HE=1;var e=sb(),t=Kh(),n=hW(),r=$M(),a=t(function(l){return n(e(l,1,r,!0))});return fw=a,fw}var pw,WE;function pW(){if(WE)return pw;WE=1;var e=Uh();function t(n,r){return e(r,function(a){return n[a]})}return pw=t,pw}var mw,UE;function OM(){if(UE)return mw;UE=1;var e=pW(),t=Fa();function n(r){return r==null?[]:e(r,t(r))}return mw=n,mw}var gw,VE;function Nr(){if(VE)return gw;VE=1;var e;if(typeof H0=="function")try{e={clone:bH(),constant:J0(),each:pM(),filter:SM(),has:jM(),isArray:Gt(),isEmpty:UH(),isFunction:Qc(),isUndefined:EM(),keys:Fa(),map:TM(),reduce:AM(),size:JH(),transform:eW(),union:fW(),values:OM()}}catch{}return e||(e=window._),gw=e,gw}var yw,GE;function ab(){if(GE)return yw;GE=1;var e=Nr();yw=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(_){y.length>1?w.setNode(_,m):w.setNode(_)}),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,j){h(j)&&m.setNode(j,k)}),e.each(this._edgeObjs,function(k){m.hasNode(k.v)&&m.hasNode(k.w)&&m.setEdge(k,y.edge(k))});var w={};function _(k){var j=y.parent(k);return j===void 0||m.hasNode(j)?(w[k]=j,j):j in w?w[j]:_(j)}return this._isCompound&&e.each(m.nodes(),function(k){m.setParent(k,_(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(_,k){return w.length>1?y.setEdge(_,k,m):y.setEdge(_,k),k}),this},a.prototype.setEdge=function(){var h,m,y,w,_=!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],_=!0)):(h=k,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],_=!0)),h=""+h,m=""+m,e.isUndefined(y)||(y=""+y);var j=u(this._isDirected,h,m,y);if(e.has(this._edgeLabels,j))return _&&(this._edgeLabels[j]=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[j]=_?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[j]=b,l(this._preds[m],h),l(this._sucs[h],m),this._in[m][j]=b,this._out[h][j]=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),_=this._edgeObjs[w];return _&&(h=_.v,m=_.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(_){return _.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(_){return _.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 _=""+m,k=""+y;if(!h&&_>k){var j=_;_=k,k=j}return _+r+k+r+(e.isUndefined(w)?t:w)}function f(h,m,y,w){var _=""+m,k=""+y;if(!h&&_>k){var j=_;_=k,k=j}var b={v:_,w:k};return w&&(b.name=w),b}function p(h,m){return u(h,m.v,m.w,m.name)}return yw}var ww,KE;function mW(){return KE||(KE=1,ww="2.1.8"),ww}var vw,YE;function gW(){return YE||(YE=1,vw={Graph:ab(),version:mW()}),vw}var xw,XE;function yW(){if(XE)return xw;XE=1;var e=Nr(),t=ab();xw={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 xw}var bw,ZE;function wW(){if(ZE)return bw;ZE=1;var e=Nr();bw=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 bw}var kw,QE;function PM(){if(QE)return kw;QE=1;var e=Nr();kw=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},kw}var Nw,JE;function LM(){if(JE)return Nw;JE=1;var e=Nr(),t=PM();Nw=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(_){var k=_.v!==m?_.v:_.w,j=p[k],b=u(_),S=y.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+_+" Weight: "+b);S<j.distance&&(j.distance=S,j.predecessor=m,h.decrease(k,S))};for(l.nodes().forEach(function(_){var k=_===c?0:Number.POSITIVE_INFINITY;p[_]={distance:k},h.add(_,k)});h.size()>0&&(m=h.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(w);return p}return Nw}var _w,eC;function vW(){if(eC)return _w;eC=1;var e=LM(),t=Nr();_w=n;function n(r,a,l){return t.transform(r.nodes(),function(c,u){c[u]=e(r,u,a,l)},{})}return _w}var Sw,tC;function DM(){if(tC)return Sw;tC=1;var e=Nr();Sw=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 Sw}var jw,nC;function xW(){if(nC)return jw;nC=1;var e=Nr(),t=DM();jw=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 jw}var Ew,rC;function bW(){if(rC)return Ew;rC=1;var e=Nr();Ew=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 _=y[p],k=h[w],j=y[w],b=_.distance+k.distance;b<j.distance&&(j.distance=b,j.predecessor=k.predecessor)})})}),u}return Ew}var Cw,sC;function FM(){if(sC)return Cw;sC=1;var e=Nr();Cw=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,Cw}var Tw,aC;function kW(){if(aC)return Tw;aC=1;var e=FM();Tw=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return Tw}var Aw,oC;function qM(){if(oC)return Aw;oC=1;var e=Nr();Aw=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 Aw}var Rw,iC;function NW(){if(iC)return Rw;iC=1;var e=qM();Rw=t;function t(n,r){return e(n,r,"post")}return Rw}var Mw,lC;function _W(){if(lC)return Mw;lC=1;var e=qM();Mw=t;function t(n,r){return e(n,r,"pre")}return Mw}var Iw,cC;function SW(){if(cC)return Iw;cC=1;var e=Nr(),t=ab(),n=PM();Iw=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,_=f.priority(w);if(_!==void 0){var k=l(y);k<_&&(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 Iw}var $w,uC;function jW(){return uC||(uC=1,$w={components:wW(),dijkstra:LM(),dijkstraAll:vW(),findCycles:xW(),floydWarshall:bW(),isAcyclic:kW(),postorder:NW(),preorder:_W(),prim:SW(),tarjan:DM(),topsort:FM()}),$w}var Ow,dC;function EW(){if(dC)return Ow;dC=1;var e=gW();return Ow={Graph:e.Graph,json:yW(),alg:jW(),version:e.version},Ow}var Pw,hC;function Ur(){if(hC)return Pw;hC=1;var e;if(typeof H0=="function")try{e=EW()}catch{}return e||(e=window.graphlib),Pw=e,Pw}var Lw,fC;function CW(){if(fC)return Lw;fC=1;var e=dM(),t=1,n=4;function r(a){return e(a,t|n)}return Lw=r,Lw}var Dw,pC;function Yh(){if(pC)return Dw;pC=1;var e=dl(),t=Bs(),n=qh(),r=kr();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 Dw=a,Dw}var Fw,mC;function TW(){if(mC)return Fw;mC=1;var e=Kh(),t=dl(),n=Yh(),r=Ho(),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),_=-1,k=w.length;++_<k;){var j=w[_],b=u[j];(b===void 0||t(b,a[j])&&!l.call(u,j))&&(u[j]=y[j])}return u});return Fw=c,Fw}var qw,gC;function AW(){if(gC)return qw;gC=1;var e=zs(),t=Bs(),n=Fa();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 qw=r,qw}var Bw,yC;function RW(){if(yC)return Bw;yC=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Bw=t,Bw}var zw,wC;function MW(){if(wC)return zw;wC=1;var e=RW(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return zw=n,zw}var Hw,vC;function IW(){if(vC)return Hw;vC=1;var e=MW(),t=kr(),n=ml(),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 Hw=f,Hw}var Ww,xC;function BM(){if(xC)return Ww;xC=1;var e=IW(),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 Ww=r,Ww}var Uw,bC;function $W(){if(bC)return Uw;bC=1;var e=BM();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return Uw=t,Uw}var Vw,kC;function OW(){if(kC)return Vw;kC=1;var e=IM(),t=zs(),n=$W(),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 Vw=a,Vw}var Gw,NC;function PW(){if(NC)return Gw;NC=1;var e=AW(),t=OW(),n=e(t);return Gw=n,Gw}var Kw,_C;function zM(){if(_C)return Kw;_C=1;var e=sb();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return Kw=t,Kw}var Yw,SC;function LW(){if(SC)return Yw;SC=1;var e=eb(),t=hM(),n=Ho();function r(a,l){return a==null?a:e(a,t(l),n)}return Yw=r,Yw}var Xw,jC;function DW(){if(jC)return Xw;jC=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Xw=e,Xw}var Zw,EC;function FW(){if(EC)return Zw;EC=1;var e=Dh(),t=tb(),n=zs();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 Zw=r,Zw}var Qw,CC;function ob(){if(CC)return Qw;CC=1;var e=ml();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 Qw=t,Qw}var Jw,TC;function qW(){if(TC)return Jw;TC=1;function e(t,n){return t>n}return Jw=e,Jw}var ev,AC;function BW(){if(AC)return ev;AC=1;var e=ob(),t=qW(),n=Wo();function r(a){return a&&a.length?e(a,n,t):void 0}return ev=r,ev}var tv,RC;function HM(){if(RC)return tv;RC=1;var e=Dh(),t=dl();function n(r,a,l){(l!==void 0&&!t(r[a],l)||l===void 0&&!(a in r))&&e(r,a,l)}return tv=n,tv}var nv,MC;function zW(){if(MC)return nv;MC=1;var e=Bo(),t=Hh(),n=ps(),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 nv=p,nv}var rv,IC;function WM(){if(IC)return rv;IC=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return rv=e,rv}var sv,$C;function HW(){if($C)return sv;$C=1;var e=Jc(),t=Ho();function n(r){return e(r,t(r))}return sv=n,sv}var av,OC;function WW(){if(OC)return av;OC=1;var e=HM(),t=JR(),n=lM(),r=eM(),a=uM(),l=eu(),c=Gt(),u=$M(),f=fl(),p=Qc(),h=kr(),m=zW(),y=tu(),w=WM(),_=HW();function k(j,b,S,E,C,T,R){var $=w(j,S),H=w(b,S),B=R.get(H);if(B){e(j,S,B);return}var P=T?T($,H,S+"",j,b,R):void 0,G=P===void 0;if(G){var Q=c(H),J=!Q&&f(H),M=!Q&&!J&&y(H);P=H,Q||J||M?c($)?P=$:u($)?P=r($):J?(G=!1,P=t(H,!0)):M?(G=!1,P=n(H,!0)):P=[]:m(H)||l(H)?(P=$,l($)?P=_($):(!h($)||p($))&&(P=a(H))):G=!1}G&&(R.set(H,P),C(P,H,E,T,R),R.delete(H)),e(j,S,P)}return av=k,av}var ov,PC;function UW(){if(PC)return ov;PC=1;var e=Lh(),t=HM(),n=eb(),r=WW(),a=kr(),l=Ho(),c=WM();function u(f,p,h,m,y){f!==p&&n(p,function(w,_){if(y||(y=new e),a(w))r(f,p,_,h,u,m,y);else{var k=m?m(c(f,_),w,_+"",f,p,y):void 0;k===void 0&&(k=w),t(f,_,k)}},l)}return ov=u,ov}var iv,LC;function VW(){if(LC)return iv;LC=1;var e=Kh(),t=Yh();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 iv=n,iv}var lv,DC;function GW(){if(DC)return lv;DC=1;var e=UW(),t=VW(),n=t(function(r,a,l){e(r,a,l)});return lv=n,lv}var cv,FC;function UM(){if(FC)return cv;FC=1;function e(t,n){return t<n}return cv=e,cv}var uv,qC;function KW(){if(qC)return uv;qC=1;var e=ob(),t=UM(),n=Wo();function r(a){return a&&a.length?e(a,n,t):void 0}return uv=r,uv}var dv,BC;function YW(){if(BC)return dv;BC=1;var e=ob(),t=zs(),n=UM();function r(a,l){return a&&a.length?e(a,t(l,2),n):void 0}return dv=r,dv}var hv,zC;function XW(){if(zC)return hv;zC=1;var e=Gr(),t=function(){return e.Date.now()};return hv=t,hv}var fv,HC;function ZW(){if(HC)return fv;HC=1;var e=Fh(),t=Vh(),n=qh(),r=kr(),a=nu();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 _=a(u[h]),k=f;if(_==="__proto__"||_==="constructor"||_==="prototype")return c;if(h!=y){var j=w[_];k=p?p(j,_,w):void 0,k===void 0&&(k=r(j)?j:n(u[h+1])?[]:{})}e(w,_,k),w=w[_]}return c}return fv=l,fv}var pv,WC;function QW(){if(WC)return pv;WC=1;var e=Gh(),t=ZW(),n=Vh();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 pv=r,pv}var mv,UC;function JW(){if(UC)return mv;UC=1;var e=QW(),t=NM();function n(r,a){return e(r,a,function(l,c){return t(r,c)})}return mv=n,mv}var gv,VC;function eU(){if(VC)return gv;VC=1;var e=zM(),t=RM(),n=MM();function r(a){return n(t(a,void 0,e),a+"")}return gv=r,gv}var yv,GC;function tU(){if(GC)return yv;GC=1;var e=JW(),t=eU(),n=t(function(r,a){return r==null?{}:e(r,a)});return yv=n,yv}var wv,KC;function nU(){if(KC)return wv;KC=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 wv=n,wv}var vv,YC;function rU(){if(YC)return vv;YC=1;var e=nU(),t=Yh(),n=BM();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 vv=r,vv}var xv,XC;function sU(){if(XC)return xv;XC=1;var e=rU(),t=e();return xv=t,xv}var bv,ZC;function aU(){if(ZC)return bv;ZC=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return bv=e,bv}var kv,QC;function oU(){if(QC)return kv;QC=1;var e=ml();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 kv=t,kv}var Nv,JC;function iU(){if(JC)return Nv;JC=1;var e=oU();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 Nv=t,Nv}var _v,eT;function lU(){if(eT)return _v;eT=1;var e=Uh(),t=Gh(),n=zs(),r=CM(),a=aU(),l=Bh(),c=iU(),u=Wo(),f=Gt();function p(h,m,y){m.length?m=e(m,function(k){return f(k)?function(j){return t(j,k.length===1?k[0]:k)}:k}):m=[u];var w=-1;m=e(m,l(n));var _=r(h,function(k,j,b){var S=e(m,function(E){return E(k)});return{criteria:S,index:++w,value:k}});return a(_,function(k,j){return c(k,j,y)})}return _v=p,_v}var Sv,tT;function cU(){if(tT)return Sv;tT=1;var e=sb(),t=lU(),n=Kh(),r=Yh(),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 Sv=a,Sv}var jv,nT;function uU(){if(nT)return jv;nT=1;var e=bM(),t=0;function n(r){var a=++t;return e(r)+a}return jv=n,jv}var Ev,rT;function dU(){if(rT)return Ev;rT=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 Ev=e,Ev}var Cv,sT;function hU(){if(sT)return Cv;sT=1;var e=Fh(),t=dU();function n(r,a){return t(r||[],a||[],e)}return Cv=n,Cv}var Tv,aT;function Rt(){if(aT)return Tv;aT=1;var e;if(typeof H0=="function")try{e={cloneDeep:CW(),constant:J0(),defaults:TW(),each:pM(),filter:SM(),find:PW(),flatten:zM(),forEach:fM(),forIn:LW(),has:jM(),isUndefined:EM(),last:DW(),map:TM(),mapValues:FW(),max:BW(),merge:GW(),min:KW(),minBy:YW(),now:XW(),pick:tU(),range:sU(),reduce:AM(),sortBy:cU(),uniqueId:uU(),values:OM(),zipObject:hU()}}catch{}return e||(e=window._),Tv=e,Tv}var Av,oT;function fU(){if(oT)return Av;oT=1,Av=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 Av}var Rv,iT;function pU(){if(iT)return Rv;iT=1;var e=Rt(),t=Ur().Graph,n=fU();Rv=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],_=h[0],k;p.nodeCount();){for(;k=_.dequeue();)c(p,h,m,k);for(;k=w.dequeue();)c(p,h,m,k);if(p.nodeCount()){for(var j=h.length-2;j>0;--j)if(k=h[j].dequeue(),k){y=y.concat(c(p,h,m,k,!0));break}}}return y}function c(p,h,m,y,w){var _=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(k){var j=p.edge(k),b=p.node(k.v);w&&_.push({v:k.v,w:k.w}),b.out-=j,f(h,m,b)}),e.forEach(p.outEdges(y.v),function(k){var j=p.edge(k),b=k.w,S=p.node(b);S.in-=j,f(h,m,S)}),p.removeNode(y.v),_}function u(p,h){var m=new t,y=0,w=0;e.forEach(p.nodes(),function(j){m.setNode(j,{v:j,in:0,out:0})}),e.forEach(p.edges(),function(j){var b=m.edge(j.v,j.w)||0,S=h(j),E=b+S;m.setEdge(j.v,j.w,E),w=Math.max(w,m.node(j.v).out+=S),y=Math.max(y,m.node(j.w).in+=S)});var _=e.range(w+y+3).map(function(){return new n}),k=y+1;return e.forEach(m.nodes(),function(j){f(_,k,m.node(j))}),{graph:m,buckets:_,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 Rv}var Mv,lT;function mU(){if(lT)return Mv;lT=1;var e=Rt(),t=pU();Mv={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 Mv}var Iv,cT;function Gn(){if(cT)return Iv;cT=1;var e=Rt(),t=Ur().Graph;Iv={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:_,notime:k};function n(j,b,S,E){var C;do C=e.uniqueId(E);while(j.hasNode(C));return S.dummy=b,j.setNode(C,S),C}function r(j){var b=new t().setGraph(j.graph());return e.forEach(j.nodes(),function(S){b.setNode(S,j.node(S))}),e.forEach(j.edges(),function(S){var E=b.edge(S.v,S.w)||{weight:0,minlen:1},C=j.edge(S);b.setEdge(S.v,S.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),b}function a(j){var b=new t({multigraph:j.isMultigraph()}).setGraph(j.graph());return e.forEach(j.nodes(),function(S){j.children(S).length||b.setNode(S,j.node(S))}),e.forEach(j.edges(),function(S){b.setEdge(S,j.edge(S))}),b}function l(j){var b=e.map(j.nodes(),function(S){var E={};return e.forEach(j.outEdges(S),function(C){E[C.w]=(E[C.w]||0)+j.edge(C).weight}),E});return e.zipObject(j.nodes(),b)}function c(j){var b=e.map(j.nodes(),function(S){var E={};return e.forEach(j.inEdges(S),function(C){E[C.v]=(E[C.v]||0)+j.edge(C).weight}),E});return e.zipObject(j.nodes(),b)}function u(j,b){var S=j.x,E=j.y,C=b.x-S,T=b.y-E,R=j.width/2,$=j.height/2;if(!C&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var H,B;return Math.abs(T)*R>Math.abs(C)*$?(T<0&&($=-$),H=$*C/T,B=$):(C<0&&(R=-R),H=R,B=R*T/C),{x:S+H,y:E+B}}function f(j){var b=e.map(e.range(y(j)+1),function(){return[]});return e.forEach(j.nodes(),function(S){var E=j.node(S),C=E.rank;e.isUndefined(C)||(b[C][E.order]=S)}),b}function p(j){var b=e.min(e.map(j.nodes(),function(S){return j.node(S).rank}));e.forEach(j.nodes(),function(S){var E=j.node(S);e.has(E,"rank")&&(E.rank-=b)})}function h(j){var b=e.min(e.map(j.nodes(),function(T){return j.node(T).rank})),S=[];e.forEach(j.nodes(),function(T){var R=j.node(T).rank-b;S[R]||(S[R]=[]),S[R].push(T)});var E=0,C=j.graph().nodeRankFactor;e.forEach(S,function(T,R){e.isUndefined(T)&&R%C!==0?--E:E&&e.forEach(T,function($){j.node($).rank+=E})})}function m(j,b,S,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=S,C.order=E),n(j,"border",C,b)}function y(j){return e.max(e.map(j.nodes(),function(b){var S=j.node(b).rank;if(!e.isUndefined(S))return S}))}function w(j,b){var S={lhs:[],rhs:[]};return e.forEach(j,function(E){b(E)?S.lhs.push(E):S.rhs.push(E)}),S}function _(j,b){var S=e.now();try{return b()}finally{console.log(j+" time: "+(e.now()-S)+"ms")}}function k(j,b){return b()}return Iv}var $v,uT;function gU(){if(uT)return $v;uT=1;var e=Rt(),t=Gn();$v={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 _,k,j;for(j=0,++f;f<h;++j,++f)y.points=[],k={width:0,height:0,edgeLabel:y,edgeObj:c,rank:f},_=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,_,{weight:y.weight},m),j===0&&l.graph().dummyChains.push(_),u=_;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 $v}var Ov,dT;function dh(){if(dT)return Ov;dT=1;var e=Rt();Ov={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 Ov}var Pv,hT;function VM(){if(hT)return Pv;hT=1;var e=Rt(),t=Ur().Graph,n=dh().slack;Pv=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 Pv}var Lv,fT;function yU(){if(fT)return Lv;fT=1;var e=Rt(),t=VM(),n=dh().slack,r=dh().longestPath,a=Ur().alg.preorder,l=Ur().alg.postorder,c=Gn().simplify;Lv=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=w,u.enterEdge=_,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=_(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,H=!0,B=C.edge(T,$),P=0;return B||(H=!1,B=C.edge($,T)),P=B.weight,e.forEach(C.nodeEdges(T),function(G){var Q=G.v===T,J=Q?G.w:G.v;if(J!==$){var M=Q===H,X=C.edge(G).weight;if(P+=M?X:-X,b(E,T,J)){var V=E.edge(T,J).cutvalue;P+=M?-V:V}}}),P}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,T,R,$){var H=T,B=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))}),B.low=H,B.lim=T++,$?B.parent=$:delete B.parent,T}function w(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function _(E,C,T){var R=T.v,$=T.w;C.hasEdge(R,$)||(R=T.w,$=T.v);var H=E.node(R),B=E.node($),P=H,G=!1;H.lim>B.lim&&(P=B,G=!0);var Q=e.filter(C.edges(),function(J){return G===S(E,E.node(J.v),P)&&G!==S(E,E.node(J.w),P)});return e.minBy(Q,function(J){return n(C,J)})}function k(E,C,T,R){var $=T.v,H=T.w;E.removeEdge($,H),E.setEdge(R.v,R.w,{}),m(E),f(E,C),j(E,C)}function j(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 H=E.node($).parent,B=C.edge($,H),P=!1;B||(B=C.edge(H,$),P=!0),C.node($).rank=C.node(H).rank+(P?B.minlen:-B.minlen)})}function b(E,C,T){return E.hasEdge(C,T)}function S(E,C,T){return T.low<=C.lim&&C.lim<=T.lim}return Lv}var Dv,pT;function wU(){if(pT)return Dv;pT=1;var e=dh(),t=e.longestPath,n=VM(),r=yU();Dv=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 Dv}var Fv,mT;function vU(){if(mT)return Fv;mT=1;var e=Rt();Fv=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],_=!0;c!==f.w;){if(u=a.node(c),_){for(;(w=h[y])!==m&&a.node(w).maxRank<u.rank;)y++;w===m&&(_=!1)}if(!_){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 Fv}var qv,gT;function xU(){if(gT)return qv;gT=1;var e=Rt(),t=Gn();qv={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 _=u.children(w);if(!_.length){w!==f&&u.setEdge(f,w,{weight:0,minlen:p});return}var k=t.addBorderNode(u,"_bt"),j=t.addBorderNode(u,"_bb"),b=u.node(w);u.setParent(k,w),b.borderTop=k,u.setParent(j,w),b.borderBottom=j,e.forEach(_,function(S){r(u,f,p,h,m,y,S);var E=u.node(S),C=E.borderTop?E.borderTop:S,T=E.borderBottom?E.borderBottom:S,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,j,{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 qv}var Bv,yT;function bU(){if(yT)return Bv;yT=1;var e=Rt(),t=Gn();Bv=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 Bv}var zv,wT;function kU(){if(wT)return zv;wT=1;var e=Rt();zv={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 zv}var Hv,vT;function NU(){if(vT)return Hv;vT=1;var e=Rt();Hv=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 Hv}var Wv,xT;function _U(){if(xT)return Wv;xT=1;var e=Rt();Wv=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 _=0;w>0;)w%2&&(_+=h[w+1]),w=w-1>>1,h[w]+=y.weight;m+=y.weight*_})),m}return Wv}var Uv,bT;function SU(){if(bT)return Uv;bT=1;var e=Rt();Uv=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 Uv}var Vv,kT;function jU(){if(kT)return Vv;kT=1;var e=Rt();Vv=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 Vv}var Gv,NT;function EU(){if(NT)return Gv;NT=1;var e=Rt(),t=Gn();Gv=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 _={vs:e.flatten(h,!0)};return y&&(_.barycenter=m/y,_.weight=y),_}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 Gv}var Kv,_T;function CU(){if(_T)return Kv;_T=1;var e=Rt(),t=SU(),n=jU(),r=EU();Kv=a;function a(u,f,p,h){var m=u.children(f),y=u.node(f),w=y?y.borderLeft:void 0,_=y?y.borderRight:void 0,k={};w&&(m=e.filter(m,function(T){return T!==w&&T!==_}));var j=t(u,m);e.forEach(j,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(j,p);l(b,k);var S=r(b,h);if(w&&(S.vs=e.flatten([w,S.vs,_],!0),u.predecessors(w).length)){var E=u.node(u.predecessors(w)[0]),C=u.node(u.predecessors(_)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+E.order+C.order)/(S.weight+2),S.weight+=2}return S}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 Kv}var Yv,ST;function TU(){if(ST)return Yv;ST=1;var e=Rt(),t=Ur().Graph;Yv=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,_=f.edge(w,p),k=e.isUndefined(_)?0:_.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 Yv}var Xv,jT;function AU(){if(jT)return Xv;jT=1;var e=Rt();Xv=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 Xv}var Zv,ET;function RU(){if(ET)return Zv;ET=1;var e=Rt(),t=NU(),n=_U(),r=CU(),a=TU(),l=AU(),c=Ur().Graph,u=Gn();Zv=f;function f(y){var w=u.maxRank(y),_=p(y,e.range(1,w+1),"inEdges"),k=p(y,e.range(w-1,-1,-1),"outEdges"),j=t(y);m(y,j);for(var b=Number.POSITIVE_INFINITY,S,E=0,C=0;C<4;++E,++C){h(E%2?_:k,E%4>=2),j=u.buildLayerMatrix(y);var T=n(y,j);T<b&&(C=0,S=e.cloneDeep(j),b=T)}m(y,S)}function p(y,w,_){return e.map(w,function(k){return a(y,k,_)})}function h(y,w){var _=new c;e.forEach(y,function(k){var j=k.graph().root,b=r(k,j,_,w);e.forEach(b.vs,function(S,E){k.node(S).order=E}),l(k,_,b.vs)})}function m(y,w){e.forEach(w,function(_){e.forEach(_,function(k,j){y.node(k).order=j})})}return Zv}var Qv,CT;function MU(){if(CT)return Qv;CT=1;var e=Rt(),t=Ur().Graph,n=Gn();Qv={positionX:_,findType1Conflicts:r,findType2Conflicts:a,addConflict:c,hasConflict:u,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function r(b,S){var E={};function C(T,R){var $=0,H=0,B=T.length,P=e.last(R);return e.forEach(R,function(G,Q){var J=l(b,G),M=J?b.node(J).order:B;(J||G===P)&&(e.forEach(R.slice(H,Q+1),function(X){e.forEach(b.predecessors(X),function(V){var I=b.node(V),q=I.order;(q<$||M<q)&&!(I.dummy&&b.node(X).dummy)&&c(E,V,X)})}),H=Q+1,$=M)}),R}return e.reduce(S,C),E}function a(b,S){var E={};function C(R,$,H,B,P){var G;e.forEach(e.range($,H),function(Q){G=R[Q],b.node(G).dummy&&e.forEach(b.predecessors(G),function(J){var M=b.node(J);M.dummy&&(M.order<B||M.order>P)&&c(E,J,G)})})}function T(R,$){var H=-1,B,P=0;return e.forEach($,function(G,Q){if(b.node(G).dummy==="border"){var J=b.predecessors(G);J.length&&(B=b.node(J[0]).order,C($,P,Q,H,B),P=Q,H=B)}C($,P,$.length,B,R.length)}),$}return e.reduce(S,T),E}function l(b,S){if(b.node(S).dummy)return e.find(b.predecessors(S),function(E){return b.node(E).dummy})}function c(b,S,E){if(S>E){var C=S;S=E,E=C}var T=b[S];T||(b[S]=T={}),T[E]=!0}function u(b,S,E){if(S>E){var C=S;S=E,E=C}return e.has(b[S],E)}function f(b,S,E,C){var T={},R={},$={};return e.forEach(S,function(H){e.forEach(H,function(B,P){T[B]=B,R[B]=B,$[B]=P})}),e.forEach(S,function(H){var B=-1;e.forEach(H,function(P){var G=C(P);if(G.length){G=e.sortBy(G,function(V){return $[V]});for(var Q=(G.length-1)/2,J=Math.floor(Q),M=Math.ceil(Q);J<=M;++J){var X=G[J];R[P]===P&&B<$[X]&&!u(E,P,X)&&(R[X]=P,R[P]=T[P]=T[X],B=$[X])}}})}),{root:T,align:R}}function p(b,S,E,C,T){var R={},$=h(b,S,E,T),H=T?"borderLeft":"borderRight";function B(Q,J){for(var M=$.nodes(),X=M.pop(),V={};X;)V[X]?Q(X):(V[X]=!0,M.push(X),M=M.concat(J(X))),X=M.pop()}function P(Q){R[Q]=$.inEdges(Q).reduce(function(J,M){return Math.max(J,R[M.v]+$.edge(M))},0)}function G(Q){var J=$.outEdges(Q).reduce(function(X,V){return Math.min(X,R[V.w]-$.edge(V))},Number.POSITIVE_INFINITY),M=b.node(Q);J!==Number.POSITIVE_INFINITY&&M.borderType!==H&&(R[Q]=Math.max(R[Q],J))}return B(P,$.predecessors.bind($)),B(G,$.successors.bind($)),e.forEach(C,function(Q){R[Q]=R[E[Q]]}),R}function h(b,S,E,C){var T=new t,R=b.graph(),$=k(R.nodesep,R.edgesep,C);return e.forEach(S,function(H){var B;e.forEach(H,function(P){var G=E[P];if(T.setNode(G),B){var Q=E[B],J=T.edge(Q,G);T.setEdge(Q,G,Math.max($(b,P,B),J||0))}B=P})}),T}function m(b,S){return e.minBy(e.values(S),function(E){var C=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(R,$){var H=j(b,$)/2;C=Math.max(R+H,C),T=Math.min(R-H,T)}),C-T})}function y(b,S){var E=e.values(S),C=e.min(E),T=e.max(E);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function($){var H=R+$,B=b[H],P;if(B!==S){var G=e.values(B);P=$==="l"?C-e.min(G):T-e.max(G),P&&(b[H]=e.mapValues(B,function(Q){return Q+P}))}})})}function w(b,S){return e.mapValues(b.ul,function(E,C){if(S)return b[S.toLowerCase()][C];var T=e.sortBy(e.map(b,C));return(T[1]+T[2])/2})}function _(b){var S=n.buildLayerMatrix(b),E=e.merge(r(b,S),a(b,S)),C={},T;e.forEach(["u","d"],function($){T=$==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(H){H==="r"&&(T=e.map(T,function(Q){return e.values(Q).reverse()}));var B=($==="u"?b.predecessors:b.successors).bind(b),P=f(b,T,E,B),G=p(b,T,P.root,P.align,H==="r");H==="r"&&(G=e.mapValues(G,function(Q){return-Q})),C[$+H]=G})});var R=m(b,C);return y(C,R),w(C,b.graph().align)}function k(b,S,E){return function(C,T,R){var $=C.node(T),H=C.node(R),B=0,P;if(B+=$.width/2,e.has($,"labelpos"))switch($.labelpos.toLowerCase()){case"l":P=-$.width/2;break;case"r":P=$.width/2;break}if(P&&(B+=E?P:-P),P=0,B+=($.dummy?S:b)/2,B+=(H.dummy?S:b)/2,B+=H.width/2,e.has(H,"labelpos"))switch(H.labelpos.toLowerCase()){case"l":P=H.width/2;break;case"r":P=-H.width/2;break}return P&&(B+=E?P:-P),P=0,B}}function j(b,S){return b.node(S).width}return Qv}var Jv,TT;function IU(){if(TT)return Jv;TT=1;var e=Rt(),t=Gn(),n=MU().positionX;Jv=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 Jv}var ex,AT;function $U(){if(AT)return ex;AT=1;var e=Rt(),t=mU(),n=gU(),r=wU(),a=Gn().normalizeRanks,l=vU(),c=Gn().removeEmptyRanks,u=xU(),f=bU(),p=kU(),h=RU(),m=IU(),y=Gn(),w=Ur().Graph;ex=_;function _(z,Z){var U=Z&&Z.debugTiming?y.time:y.notime;U("layout",function(){var re=U(" buildLayoutGraph",function(){return B(z)});U(" runLayout",function(){k(re,U)}),U(" updateInputGraph",function(){j(z,re)})})}function k(z,Z){Z(" makeSpaceForEdgeLabels",function(){P(z)}),Z(" removeSelfEdges",function(){W(z)}),Z(" acyclic",function(){t.run(z)}),Z(" nestingGraph.run",function(){u.run(z)}),Z(" rank",function(){r(y.asNonCompoundGraph(z))}),Z(" injectEdgeLabelProxies",function(){G(z)}),Z(" removeEmptyRanks",function(){c(z)}),Z(" nestingGraph.cleanup",function(){u.cleanup(z)}),Z(" normalizeRanks",function(){a(z)}),Z(" assignRankMinMax",function(){Q(z)}),Z(" removeEdgeLabelProxies",function(){J(z)}),Z(" normalize.run",function(){n.run(z)}),Z(" parentDummyChains",function(){l(z)}),Z(" addBorderSegments",function(){f(z)}),Z(" order",function(){h(z)}),Z(" insertSelfEdges",function(){K(z)}),Z(" adjustCoordinateSystem",function(){p.adjust(z)}),Z(" position",function(){m(z)}),Z(" positionSelfEdges",function(){F(z)}),Z(" removeBorderNodes",function(){q(z)}),Z(" normalize.undo",function(){n.undo(z)}),Z(" fixupEdgeLabelCoords",function(){V(z)}),Z(" undoCoordinateSystem",function(){p.undo(z)}),Z(" translateGraph",function(){M(z)}),Z(" assignNodeIntersects",function(){X(z)}),Z(" reversePoints",function(){I(z)}),Z(" acyclic.undo",function(){t.undo(z)})}function j(z,Z){e.forEach(z.nodes(),function(U){var re=z.node(U),de=Z.node(U);re&&(re.x=de.x,re.y=de.y,Z.children(U).length&&(re.width=de.width,re.height=de.height))}),e.forEach(z.edges(),function(U){var re=z.edge(U),de=Z.edge(U);re.points=de.points,e.has(de,"x")&&(re.x=de.x,re.y=de.y)}),z.graph().width=Z.graph().width,z.graph().height=Z.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],S={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"},H=["labelpos"];function B(z){var Z=new w({multigraph:!0,compound:!0}),U=ae(z.graph());return Z.setGraph(e.merge({},S,D(U,b),e.pick(U,E))),e.forEach(z.nodes(),function(re){var de=ae(z.node(re));Z.setNode(re,e.defaults(D(de,C),T)),Z.setParent(re,z.parent(re))}),e.forEach(z.edges(),function(re){var de=ae(z.edge(re));Z.setEdge(re,e.merge({},$,D(de,R),e.pick(de,H)))}),Z}function P(z){var Z=z.graph();Z.ranksep/=2,e.forEach(z.edges(),function(U){var re=z.edge(U);re.minlen*=2,re.labelpos.toLowerCase()!=="c"&&(Z.rankdir==="TB"||Z.rankdir==="BT"?re.width+=re.labeloffset:re.height+=re.labeloffset)})}function G(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z);if(U.width&&U.height){var re=z.node(Z.v),de=z.node(Z.w),ge={rank:(de.rank-re.rank)/2+re.rank,e:Z};y.addDummyNode(z,"edge-proxy",ge,"_ep")}})}function Q(z){var Z=0;e.forEach(z.nodes(),function(U){var re=z.node(U);re.borderTop&&(re.minRank=z.node(re.borderTop).rank,re.maxRank=z.node(re.borderBottom).rank,Z=e.max(Z,re.maxRank))}),z.graph().maxRank=Z}function J(z){e.forEach(z.nodes(),function(Z){var U=z.node(Z);U.dummy==="edge-proxy"&&(z.edge(U.e).labelRank=U.rank,z.removeNode(Z))})}function M(z){var Z=Number.POSITIVE_INFINITY,U=0,re=Number.POSITIVE_INFINITY,de=0,ge=z.graph(),pe=ge.marginx||0,_e=ge.marginy||0;function Pe($e){var Te=$e.x,je=$e.y,et=$e.width,Ce=$e.height;Z=Math.min(Z,Te-et/2),U=Math.max(U,Te+et/2),re=Math.min(re,je-Ce/2),de=Math.max(de,je+Ce/2)}e.forEach(z.nodes(),function($e){Pe(z.node($e))}),e.forEach(z.edges(),function($e){var Te=z.edge($e);e.has(Te,"x")&&Pe(Te)}),Z-=pe,re-=_e,e.forEach(z.nodes(),function($e){var Te=z.node($e);Te.x-=Z,Te.y-=re}),e.forEach(z.edges(),function($e){var Te=z.edge($e);e.forEach(Te.points,function(je){je.x-=Z,je.y-=re}),e.has(Te,"x")&&(Te.x-=Z),e.has(Te,"y")&&(Te.y-=re)}),ge.width=U-Z+pe,ge.height=de-re+_e}function X(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z),re=z.node(Z.v),de=z.node(Z.w),ge,pe;U.points?(ge=U.points[0],pe=U.points[U.points.length-1]):(U.points=[],ge=de,pe=re),U.points.unshift(y.intersectRect(re,ge)),U.points.push(y.intersectRect(de,pe))})}function V(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z);if(e.has(U,"x"))switch((U.labelpos==="l"||U.labelpos==="r")&&(U.width-=U.labeloffset),U.labelpos){case"l":U.x-=U.width/2+U.labeloffset;break;case"r":U.x+=U.width/2+U.labeloffset;break}})}function I(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z);U.reversed&&U.points.reverse()})}function q(z){e.forEach(z.nodes(),function(Z){if(z.children(Z).length){var U=z.node(Z),re=z.node(U.borderTop),de=z.node(U.borderBottom),ge=z.node(e.last(U.borderLeft)),pe=z.node(e.last(U.borderRight));U.width=Math.abs(pe.x-ge.x),U.height=Math.abs(de.y-re.y),U.x=ge.x+U.width/2,U.y=re.y+U.height/2}}),e.forEach(z.nodes(),function(Z){z.node(Z).dummy==="border"&&z.removeNode(Z)})}function W(z){e.forEach(z.edges(),function(Z){if(Z.v===Z.w){var U=z.node(Z.v);U.selfEdges||(U.selfEdges=[]),U.selfEdges.push({e:Z,label:z.edge(Z)}),z.removeEdge(Z)}})}function K(z){var Z=y.buildLayerMatrix(z);e.forEach(Z,function(U){var re=0;e.forEach(U,function(de,ge){var pe=z.node(de);pe.order=ge+re,e.forEach(pe.selfEdges,function(_e){y.addDummyNode(z,"selfedge",{width:_e.label.width,height:_e.label.height,rank:pe.rank,order:ge+ ++re,e:_e.e,label:_e.label},"_se")}),delete pe.selfEdges})})}function F(z){e.forEach(z.nodes(),function(Z){var U=z.node(Z);if(U.dummy==="selfedge"){var re=z.node(U.e.v),de=re.x+re.width/2,ge=re.y,pe=U.x-de,_e=re.height/2;z.setEdge(U.e,U.label),z.removeNode(Z),U.label.points=[{x:de+2*pe/3,y:ge-_e},{x:de+5*pe/6,y:ge-_e},{x:de+pe,y:ge},{x:de+5*pe/6,y:ge+_e},{x:de+2*pe/3,y:ge+_e}],U.label.x=U.x,U.label.y=U.y}})}function D(z,Z){return e.mapValues(e.pick(z,Z),Number)}function ae(z){var Z={};return e.forEach(z,function(U,re){Z[re.toLowerCase()]=U}),Z}return ex}var tx,RT;function OU(){if(RT)return tx;RT=1;var e=Rt(),t=Gn(),n=Ur().Graph;tx={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 tx}var nx,MT;function PU(){return MT||(MT=1,nx="0.8.5"),nx}var rx,IT;function LU(){return IT||(IT=1,rx={graphlib:Ur(),layout:$U(),debug:OU(),util:{time:Gn().time,notime:Gn().notime},version:PU()}),rx}var DU=LU();const $T=r0(DU),Fo=240,qc=130,Xi=74,Xh=72,jc=Xi+Xh;function GM(e,t){var r;let n=Fo;for(const a of e)n=Math.max(n,((r=t.get(a.id))==null?void 0:r.width)??Fo);return n}const hh=420,KM=1;function FU(e,t,n,r){return Math.min(KM,n/Math.max(1,e),r/Math.max(1,t))}function qo(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function qU(e,t){return((t==null?void 0:t.get(e))??0)>0?hh:0}function BU(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Bc(e,t,n){const r=t.get(e);return{w:((r==null?void 0:r.width)??Fo)+qU(e,n),h:Math.max((r==null?void 0:r.height)??qc,BU(e,n))}}function zU(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function HU(e,t,n,r,a,l){const c=new $T.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:S,h:E}=Bc(b,r,l);c.setNode(b,{width:S,height:E})}for(const b of t)f.has(b.source)&&f.has(b.target)&&c.setEdge(b.source,b.target);$T.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 S=c.node(b);if(!S)continue;const E=r.get(b),C=(E==null?void 0:E.width)??Fo,T=(E==null?void 0:E.height)??qc,R=Bc(b,r,l),$=S.x-R.w/2,H=S.y-R.h/2;p.set(b,{x:$,y:H}),$<h&&(h=$),H<m&&(m=H),$+C>y&&(y=$+C),H+T>w&&(w=H+T)}if(Number.isFinite(h)&&Number.isFinite(m))for(const[b,S]of p)p.set(b,{x:S.x-h,y:S.y-m});const _=Number.isFinite(y)?y-h:0,k=Number.isFinite(w)?w-m:0;let j=null;for(const b of e){const S=a.get(b);if(!S)continue;const E=r.get(b),C=(E==null?void 0:E.width)??Fo,T=(E==null?void 0:E.height)??qc;j=j===null?{minX:S.x,minY:S.y,maxX:S.x+C,maxY:S.y+T}:{minX:Math.min(j.minX,S.x),minY:Math.min(j.minY,S.y),maxX:Math.max(j.maxX,S.x+C),maxY:Math.max(j.maxY,S.y+T)}}return{positions:p,width:_,height:k,pinnedBox:j}}function YM(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=qo(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,...HU(u.get(h),t,r,l,a,c)})),gap:GM(e,l)}}const XM=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+hh,WU=e=>e.reduce((t,n)=>t+n.height,0)+jc*Math.max(0,e.length-1);function Vx(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+jc;return p},l=[];for(let f=0;f<e.length;f++){let p=-jc;for(let h=f;h<e.length;h++)l.push(p+=e[h].height+jc)}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=>FU(h.reduce((m,y)=>m+XM(y),0)+t*(h.length-1),Math.max(...h.map(WU)),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 UU(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}=YM(e,t,n);return l.length<2?!1:Vx(l,c,r.width,r.height).length!==Vx(l,c,a.width,a.height).length}function VU(e,t,n={}){const r=n.pinned??new Map,{laid:a,gap:l}=YM(e,t,n),c=Vx(a,l,n.availableWidth??0,n.availableHeight??0),u=new Map;let f=0;for(const p of c){const h=XM(p);let m=0;for(const{positions:y,height:w,pinnedBox:_}of p){for(const[j,b]of y)u.set(j,{x:b.x+f,y:b.y+m});let k=m+w;_&&_.maxY>k&&_.minX<f+h&&f<_.maxX&&(k=_.maxY),m=k+jc}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 GU(e,t,n,r,a){const c=Xi+Xh,u=60,f=w=>Bc(w,r,a),p=new Map(e.map(w=>[w.id,qo(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,_)=>w.pos.y-_.pos.y||w.pos.x-_.pos.x||w.id.localeCompare(_.id)),y=[];for(const{id:w,pos:_}of m){const{w:k,h:j}=f(w),b=p.get(w)??"_default";if(n.has(w)){h.push({x:_.x,y:_.y,w:k,h:j,sid:b});continue}let S=_.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 _.x<T.x+T.w+R&&T.x<_.x+k+R&&S<T.y+T.h+$&&T.y<S+j+$});if(!C)break;S=C.y+C.h+(C.sid===b?24:c)}S!==_.y&&(t.set(w,{x:_.x,y:S}),y.push(w)),h.push({x:_.x,y:S,w:k,h:j,sid:b})}return y}function KU(e,t,n,r,a,l,c){const u=E=>Bc(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)??Fo,ch:(C==null?void 0:C.height)??qc}},h=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!f(E.id))continue;const C=qo(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,_=[];for(const E of e){const C=f(E.id);if(!C)continue;const{w:T,h:R}=u(E.id),$=qo(E);y.has($)?(w.get($)??w.set($,[]).get($)).push(E):_.push({x:C.x,y:C.y,w:T,h:R,...p(E.id)})}if(w.size===0||h&&_.length===0)return[];const k=Xi+Xh,j=(E,C,T,R)=>_.some($=>E<$.x+$.w+Xi&&$.x<E+T+Xi&&C<$.y+$.h+k&&$.y<C+R+k),b=GM(e,r),S=[];for(const E of[...w.keys()].sort()){const C=w.get(E);let T=1/0,R=1/0,$=-1/0,H=-1/0,B=-1/0,P=-1/0;for(const I of C){const q=f(I.id),{w:W,h:K}=u(I.id),{cw:F,ch:D}=p(I.id);T=Math.min(T,q.x),R=Math.min(R,q.y),$=Math.max($,q.x+W),H=Math.max(H,q.y+K),B=Math.max(B,q.x+F),P=Math.max(P,q.y+D)}const G=$-T,Q=H-R,J=[...new Set(_.map(I=>Math.round(I.x)))].sort((I,q)=>I-q),M=J.length?J:[T],X=[0,..._.map(I=>I.y+I.h+k)].sort((I,q)=>I-q);let V=null;if(h){let I=1/0,q=1/0,W=-1/0,K=-1/0;for(const U of _)I=Math.min(I,U.x),q=Math.min(q,U.y),W=Math.max(W,U.x+U.cw),K=Math.max(K,U.y+U.ch);const F=(U,re)=>{const de=c.width/(Math.max(W,U+B-T)-Math.min(I,U)+hh),ge=c.height/(Math.max(K,re+P-R)-Math.min(q,re));return[Math.min(KM,de,ge),Math.min(de,ge),Math.max(de,ge)]},D=(U,re)=>{for(let de=0;de<U.length;de++){if(U[de]>re[de]+1e-9)return!0;if(U[de]<re[de]-1e-9)return!1}return!1},ae=Math.round(W+hh+b),z=[...new Set([...X,q])].sort((U,re)=>U-re);let Z=null;for(const U of[...M,ae])for(const re of z){if(j(U,re,G,Q))continue;const de=F(U,re);(Z===null||D(de,Z))&&(Z=de,V={x:U,y:re})}V&&V.x===T&&V.y===R&&(V=null)}else e:for(const I of M)for(const q of X){if(q>=R)break;if(!j(I,q,G,Q)){V={x:I,y:q};break e}}if(V){const I=V.x-T,q=V.y-R;for(const W of C){const K=f(W.id);t.set(W.id,{x:K.x+I,y:K.y+q})}S.push(E)}for(const I of C){const q=f(I.id),{w:W,h:K}=u(I.id);_.push({x:q.x,y:q.y,w:W,h:K,...p(I.id)})}}return S}function YU(e,t,n){const r=new Map;for(const a of e){if(t.has(a.id)||!n(a.id))continue;const l=qo(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(qo(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 XU(e,t,n,r,a,l=!1,c){const p=Xi+Xh+1,h=8,m=1.75,y=200,w=.7,_=.01,k=P=>Bc(P,r,c),j=P=>n.get(P)??t.get(P),b=new Map;for(const P of e){if(!j(P.id))continue;const G=qo(P),Q=b.get(G);Q?Q.push(P):b.set(G,[P])}const S=[],E=new Set,C=new Set,T=a.size===0;for(const P of[...b.keys()].sort()){const G=b.get(P);let Q=1/0,J=1/0,M=-1/0,X=-1/0,V=!1;for(const K of G){const F=j(K.id),{w:D,h:ae}=k(K.id);Q=Math.min(Q,F.x),J=Math.min(J,F.y),M=Math.max(M,F.x+D),X=Math.max(X,F.y+ae),n.has(K.id)&&(V=!0)}const I=M-Q,q=X-J;C.add(P);const W=a.get(P);W&&(I>W.w+h||q>W.h+h)&&E.add(P),a.set(P,{w:I,h:q}),S.push({sid:P,members:G.map(K=>K.id),x:Q,y:J,w:I,h:q,anchored:V,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<S.length&&!R;P++)for(let G=P+1;G<S.length;G++){const Q=S[P],J=S[G];if(!(Q.anchored&&J.anchored)&&Math.abs(Q.x+Q.w/2-(J.x+J.w/2))<(Q.w+J.w)/2+61&&Math.abs(Q.y+Q.h/2-(J.y+J.h/2))<(Q.h+J.h)/2+p){R=!0;break}}if(E.size===0&&!R)return[];if(E.size>0)for(const P of S)E.has(P.sid)&&(P.mass=8);else for(const P of S)P.mass=Math.max(1,P.w*P.h/(Fo*qc));const $=new Map(S.map(P=>[P.sid,P.x])),H=new Map(S.map(P=>[P.sid,P.y]));for(let P=0;P<y;P++){const G=new Map,Q=new Map;let J=0;for(let M=0;M<S.length;M++)for(let X=M+1;X<S.length;X++){const V=S[M],I=S[X];if(V.anchored&&I.anchored)continue;const q=V.x+V.w/2,W=V.y+V.h/2,K=I.x+I.w/2,F=I.y+I.h/2,D=(V.w+I.w)/2+61-Math.abs(q-K),ae=(V.h+I.h)/2+p-Math.abs(W-F);if(D<=0||ae<=0)continue;const z=(be,Re)=>!be.anchored&&!(Re<0&&be.x<=0),Z=(be,Re)=>!be.anchored&&!(Re<0&&be.y<=0),U=(be,Re,Ze)=>{const We=be===Re,tt=We?V.sid<I.sid?-1:1:Math.sign(be-Re);return Ze(V,tt)||Ze(I,-tt)?tt:We&&(Ze(V,-tt)||Ze(I,tt))?-tt:0},re=U(q,K,z),de=U(W,F,Z),ge=re!==0,pe=de!==0;if(!ge&&!pe)continue;const _e=ge&&(!pe||D*m<ae),[Pe,$e,Te,je]=_e?[re,D,G,z]:[de,ae,Q,Z],et=je(V,Pe),Ce=je(I,-Pe),Ne=V.mass,He=I.mass,it=et?Ce?He/(Ne+He):1:0,ot=Ce?et?Ne/(Ne+He):1:0,le=$e*w;Te.set(V.sid,(Te.get(V.sid)??0)+Pe*le*it),Te.set(I.sid,(Te.get(I.sid)??0)-Pe*le*ot),J+=le}for(const M of S)M.anchored||(M.x=Math.max(0,M.x+(G.get(M.sid)??0)),M.y=Math.max(0,M.y+(Q.get(M.sid)??0)));if(J<_)break}const B=[];for(const P of S){const G=P.x-$.get(P.sid),Q=P.y-H.get(P.sid);if(!(Math.abs(G)<1&&Math.abs(Q)<1)){for(const J of P.members){if(n.has(J))continue;const M=t.get(J);M&&t.set(J,{x:M.x+G,y:M.y+Q})}B.push(P.sid)}}return B}function Ud(e,t,n){return!t.has(e)||n.has(e)}function ZU(e,t,n,r){return!t.has(e)&&Ud(e,n,r)}function QU(e,t,n){const r={x:0,y:0};return t.set(e,r),n.add(e),r}function OT(e,t,n,r){n.set(e,t),r.delete(e)}const JU=200,e7=5*6e4,t7=6,n7=2*6e4;function Ad(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function r7(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 s7(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(T0(n.id));return t}function a7(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(T0(n.id));return t}function o7(e,t){let n=K5(e,t,tN);Y5(e,t,tN)&&(n=!0);const r=[],a=l=>{r.push(l)};return W5(e,t,JU,e7,a)&&(n=!0),U5(e,t,t7,n7,a)&&(n=!0),{changed:n,forgotten:r}}const i7=300,PT=130,l7=160,LT=new WeakMap;function c7(e,t){let n=LT.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map,branches:rD(e.agents.values())},LT.set(e,n));const{byId:r,branches:a}=n;return l=>{let c=r.get(l.id);if(!c){const u=l.kind==="root"?a.get(l.sessionId):void 0;c=u?{...l,onOpenContext:t,branch:u}:{...l,onOpenContext:t},r.set(l.id,c)}return c}}function Gx(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 u7(e,t,n,r,a,l,c,u,f,p,h,m,y,w,_,k,j,b){var J,M,X,V;const S=[],E=[],C=c7(e,b);for(const I of e.agents.values()){if(!j.has(I.id))continue;const q=I.exitAt!=null,W=k!=null&&!k.has(I.id),K=[q?"rf-exiting":"",W?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,F=l.get(I.id);if(S.push({id:I.id,type:"agent",position:{x:0,y:0},data:C(I),className:K,ariaLabel:GD(I,t),...F?{width:F.width,height:F.height}:null}),I.parentId&&j.has(I.parentId)){const z=rh(I.sessionId),Z=q,U=_.size>0&&(_.has(I.id)||_.has(I.parentId)),re=k!=null&&!k.has(I.id)&&!k.has(I.parentId),de=I.state==="active"?2:1.5,ge=U?de+1.5:de,pe=Z?.2:re?.12:1,_e=["sess-edge",I.state==="active"?"sess-live":"sess-idle",Z?"rf-edge-exiting":"",U?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${I.parentId}->${I.id}`,source:I.parentId,target:I.id,animated:(I.state==="active"||U)&&!Z,type:"smoothstep",style:{"--session-hue":z,strokeWidth:`calc(${ge}px * var(--edge-k, 1))`,opacity:pe,transition:"var(--edge-transition)"},className:_e})}const D=I.kind==="root"?Ch(I):null,ae=D?cR(I.sessionId,D.at):null;if(D&&ae&&!Z6(ae)){const z=T0(I.id),Z=rh(I.sessionId),U=l.get(z);S.push({id:z,type:"recapNote",position:{x:0,y:0},data:{sessionId:I.sessionId,parentId:I.id,recap:D,noteKey:ae,hue:Z},className:W?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${I.label}`,...U?{width:U.width,height:U.height}:null}),E.push({id:`e:recap:${I.id}`,source:z,target:I.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":Z}})}}const T=Gx(e),R=`${y}#lanes:${zU(T)}`,$=new Set(S.filter(I=>I.type==="recapNote").map(I=>I.id));for(const I of Array.from(h.keys()))tD(I)&&!$.has(I)&&!a.has(I)&&(h.delete(I),m.delete(I));const H=S.filter(I=>ZU(I.id,a,h,m));if(H.length>0||R!==w.current){if(H.length>0){const I=YU(VU(S,E,{direction:"LR",pinned:a,measured:l,availableWidth:n,availableHeight:r,lanes:T}),a,q=>Ud(q,h,m)?void 0:h.get(q));for(const q of I)Ud(q.id,h,m)&&OT(q.id,q.position,h,m);KU(S,h,a,l,new Set(H.filter(q=>q.type!=="recapNote").map(q=>q.id)),T,{width:n,height:r});for(const q of H){if(q.type!=="recapNote")continue;const W=(J=q.data)==null?void 0:J.parentId;if(!W)continue;const K=a.get(W)??(Ud(W,h,m)?void 0:h.get(W));if(!K)continue;const F=((M=l.get(q.id))==null?void 0:M.width)??i7,D=((X=l.get(q.id))==null?void 0:X.height)??PT,ae=((V=l.get(W))==null?void 0:V.height)??PT;OT(q.id,{x:K.x-l7-F,y:K.y+(ae-D)/2},h,m)}}GU(S,h,a,l,T),w.current=R}const B=XU(S,h,a,l,c,!f||p,T);B.length>0&&u(B);const P=a7(e.agents.values());Ad(h,P),Ad(m,P),Ad(a,P),Ad(l,s7(e.agents.values()));const G=[];let Q=!1;for(const I of S){let q=a.get(I.id)??h.get(I.id);q||(q=QU(I.id,h,m),Q=!0),G.push({...I,position:q})}return Q&&(w.current=""),{nodes:G,edges:E}}const d7=1;function h7(e){return{id:e.id,name:e.name,inputPreview:e.inputPreview,startedAt:e.startedAt,endedAt:e.endedAt,ok:e.ok,errorPreview:e.errorPreview,usage:e.usage}}function f7(e,t,n){const r=e.agents.get(t);if(!r)return null;const a=[];for(const l of e.agents.values())l.sessionId===t&&a.push(l);return{schemaVersion:d7,exportedAt:n,sessionId:t,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:a.map(l=>({id:l.id,kind:l.kind,label:l.label,parentId:l.parentId,state:l.state,startedAt:l.startedAt,endedAt:l.endedAt,model:l.model,cwd:l.cwd,usage:l.usage,prompts:l.prompts,tools:l.tools.map(h7)}))}}function p7(e,t){const n=(e||"session").replace(/[^a-z0-9._-]/gi,"_");return`${nn}-${n}-${t.slice(0,8)}.json`}function m7(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function g7(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 y7(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function w7(e,t){const n=y7(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 v7({agentCount:e,onConfirm:t,onCancel:n}){const r=x.useRef(null),a=un(n,{focusRef:r,layer:_6}),[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(g7(y))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:f,final:p,confirm:h}=w7(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 x7="Press Esc first if a key does nothing.",b7=[{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:"Z",action:"zoom to the selected agent and its session",binds:["z","Z"]},{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:"a card: go to it and its session",binds:[]},{cap:"double-click",action:"a card: its prompt, every tool call, tokens and timing",binds:[]},{cap:"hover",action:"zoomed out, a card's name, state and numbers",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function k7({onClose:e,onTour:t}){const n=un(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:b7.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:x7})]})]})})}const N7=["done","needs-input"],_7=[{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}]}],S7=[{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}]}],ib={done:_7,"needs-input":S7},ol="two";function Kx(e,t){const n=ib[e];return n.find(r=>r.id===t)??n.find(r=>r.id===ol)??n[0]}function ZM(e,t){return ib[e].some(r=>r.id===t)?t:ol}Kx("done",ol).notes,Kx("needs-input",ol).notes;const DT=.04,j7=.24,Vd=0,fh=100,Yx=5,zc=50;function Hc(e){if(!Number.isFinite(e))return zc;const t=Math.round(e/Yx)*Yx;return Math.min(fh,Math.max(Vd,t))}function E7(e){if(e==null)return zc;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?Hc(Number(t)):zc}function C7(e){const t=Hc(e),n=DT+(j7-DT)*(t/fh);return Math.round(n*1e4)/1e4}function T7(e,t){const n=t.trim,r=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(C7(e)*r*1e4)/1e4}const A7=160,R7="agent-dag.soundLevel.done",M7="agent-dag.soundLevel.needs-input",I7="agent-dag.soundFigure.done",$7="agent-dag.soundFigure.needs-input",QM={done:R7,"needs-input":M7},JM={done:I7,"needs-input":$7},Xx={done:{level:zc,figure:ol},"needs-input":{level:zc,figure:ol}};function O7(e){const t=n=>({level:E7(e(QM[n])),figure:ZM(n,e(JM[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const FT={Stop:"done",Notification:"needs-input"};function P7(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(FT,n)?FT[n]:null}function L7(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 _;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((_=e.prefs)==null?void 0:_.call(e))??Xx)[f]??Xx[f],m=Kx(f,h.figure),y=T7(h.level,m),w=n.currentTime;for(const k of m.notes){const j=n.createOscillator(),b=n.createGain();j.type=m.type??"sine",j.frequency.value=k.hz;const S=w+k.at,E=S+k.ms/1e3;b.gain.setValueAtTime(1e-4,S),b.gain.exponentialRampToValueAtTime(y,S+.012),b.gain.exponentialRampToValueAtTime(1e-4,E),j.connect(b).connect(n.destination),j.start(S),j.stop(E+.02)}return!0}return{unlock:c,play:u,state:a,get context(){return n}}}const D7="With no deck tab open, get a notification wherever a sound would have played.",F7="With the ccdeck window closed, get a notification wherever a sound would have played.";function q7(e){return e?F7:D7}const B7="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",qT="Get notified when you're away from this tab.";function z7(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:qT};case"default":return{status:null,ask:!0,ok:!1,note:qT};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."}}}function H7(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}const BT={done:"Turn finished","needs-input":"Claude is asking"},W7={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function U7({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=z7(m),_=H7(),k=f&&!h&&!_,j=un(e,{popover:!0}),b=x.useRef(e);return b.current=e,x.useEffect(()=>{const S=E=>{var T,R;const C=E.target;C&&((T=j.current)!=null&&T.contains(C)||(R=u.current)!=null&&R.contains(C)||b.current())};return window.addEventListener("pointerdown",S,!0),()=>window.removeEventListener("pointerdown",S,!0)},[j,u]),i.jsxs("div",{ref:j,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 while closed"}),i.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"switch",onClick:p,title:"With no deck tab open, a notification wherever a sound would play",children:i.jsx("span",{className:"switch-knob"})})]}),i.jsx("p",{className:"sm-note",children:h?B7:q7(_)})]})]}),k&&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:N7.map(S=>{const E=r[S],C=`sm-level-${S}`,T=`sm-figure-${S}`;return i.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${S}`,children:[i.jsxs("div",{className:"sm-tone-head",children:[i.jsx("h3",{className:"sm-tone-name",id:`sm-name-${S}`,children:BT[S]}),i.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(S),"aria-label":`Hear the ${BT[S].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:C,children:"Volume"}),i.jsx("input",{id:C,type:"range",min:Vd,max:fh,step:Yx,value:E.level,onChange:R=>a(S,Number(R.target.value)),style:{"--sm-level":`${(E.level-Vd)/(fh-Vd)*100}%`}}),i.jsxs("span",{className:"sm-read",children:[E.level,"%"]})]}),i.jsxs("div",{className:"sm-row",children:[i.jsx("label",{htmlFor:T,children:"Tone"}),i.jsx("select",{id:T,className:"sm-select",value:E.figure,onChange:R=>l(S,R.target.value),children:ib[S].map(R=>i.jsx("option",{value:R.id,children:R.label},R.id))})]}),i.jsx("p",{className:"sm-note",children:W7[S]})]},S)})}),i.jsxs("p",{className:"sm-foot",children:[i.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const Di=["light","dark"],V7={light:"Light",dark:"Dark"};function G7({theme:e}){return i.jsx("span",{className:"appearance-preview","data-swatch":e,children:i.jsxs("svg",{viewBox:"0 0 112 56","aria-hidden":!0,focusable:"false",children:[i.jsx("rect",{className:"tp-canvas",width:"112",height:"56"}),i.jsx("rect",{className:"tp-surface",width:"112",height:"7"}),i.jsx("rect",{className:"tp-rule",y:"7",width:"112",height:"1"}),i.jsx("rect",{className:"tp-surface",y:"8",width:"25",height:"48"}),i.jsx("rect",{className:"tp-rule",x:"25",y:"8",width:"1",height:"48"}),i.jsx("rect",{className:"tp-card",x:"36.5",y:"27.5",width:"28",height:"14",rx:"2.5"}),i.jsx("rect",{className:"tp-tag",x:"39.5",y:"25.5",width:"13",height:"4",rx:"2"}),i.jsx("rect",{className:"tp-card",x:"76.5",y:"14.5",width:"29",height:"20",rx:"2.5"}),i.jsx("rect",{className:"tp-rule",x:"81",y:"23",width:"20",height:"2",rx:"1"}),i.jsx("rect",{className:"tp-accent",x:"81",y:"23",width:"12",height:"2",rx:"1"})]})})}function K7({theme:e,onTheme:t,characterEnabled:n,onToggleCharacter:r,onClose:a,openerRef:l}){const c=un(a,{popover:!0}),u=x.useRef(a);u.current=a,x.useEffect(()=>{const h=m=>{var w,_;const y=m.target;!y||(w=c.current)!=null&&w.contains(y)||(_=l.current)!=null&&_.contains(y)||u.current()};return window.addEventListener("pointerdown",h,!0),()=>window.removeEventListener("pointerdown",h,!0)},[c,l]);const f=h=>{var w;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(h.key))return;h.preventDefault();const y=(Di.indexOf(e)+(h.key==="ArrowLeft"||h.key==="ArrowUp"?-1:1)+Di.length)%Di.length;t(Di[y]),(w=h.currentTarget.querySelectorAll('[role="radio"]')[y])==null||w.focus()},p=h=>{var y;if(h.key===" "){h.stopPropagation();return}if(h.key!=="t"&&h.key!=="T"||h.ctrlKey||h.metaKey||h.altKey)return;h.preventDefault(),h.stopPropagation();const m=e==="dark"?"light":"dark";t(m),h.target.getAttribute("role")==="radio"&&((y=h.currentTarget.querySelectorAll('[role="radio"]')[Di.indexOf(m)])==null||y.focus())};return i.jsxs("div",{ref:c,id:"appearance-menu",className:"appearance-menu",role:"dialog","aria-labelledby":"appearance-title",onKeyDown:p,children:[i.jsx("div",{className:"appearance-head",children:i.jsx("h2",{id:"appearance-title",className:"appearance-title",children:"Appearance"})}),i.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-theme-caption",children:[i.jsxs("div",{className:"appearance-caption",children:[i.jsx("h3",{id:"appearance-theme-caption",children:"Color theme"}),i.jsx("kbd",{className:"appearance-key","aria-hidden":!0,title:"Press T anywhere to switch themes",children:"T"})]}),i.jsx("div",{className:"appearance-themes",role:"radiogroup","aria-labelledby":"appearance-theme-caption","aria-keyshortcuts":"T",onKeyDown:f,children:Di.map(h=>i.jsxs("button",{type:"button",className:"appearance-theme",role:"radio","aria-checked":e===h,tabIndex:e===h?0:-1,onClick:()=>t(h),children:[i.jsx(G7,{theme:h}),i.jsxs("span",{className:"appearance-theme-name",children:[V7[h],i.jsx("svg",{className:"appearance-check",viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:i.jsx("path",{d:"M2.5 6.4 4.9 8.7 9.5 3.6"})})]})]},h))})]}),i.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-fm-caption",children:[i.jsx("div",{className:"appearance-caption",children:i.jsx("h3",{id:"appearance-fm-caption",children:"Claude FM"})}),i.jsxs("label",{className:"appearance-row",children:[i.jsx("span",{className:"appearance-row-label",id:"appearance-character-label",children:"Show character on minimap"}),i.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":n,"aria-labelledby":"appearance-character-label","aria-describedby":"appearance-character-note",onClick:r,children:i.jsx("span",{className:"switch-knob"})}),i.jsx("span",{className:"appearance-row-note",id:"appearance-character-note",children:"Press it to play the live stream"})]})]})]})}const Zx="https://www.youtube-nocookie.com";function Y7(e,t){const n=new URLSearchParams({channel:e,enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${Zx}/embed/live_stream?${n.toString()}`}function zT(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function X7(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const Z7=[1,3],Q7=[0,2],J7=[2,5,100,101,150];function e9(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:Z7.includes(a)?{kind:"playing",playing:!0}:Q7.includes(a)?{kind:"playing",playing:!1}:null}return null}const eI=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],HT=18,t9=eI.length,tI=new Set(["a","c","p"]);function Zh(e=eI){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 Io=148,WT=6e3,n9=16e3,nI=46,Ma=34;function r9(e,t,n=Io){let r=-Math.round(t()*n);if(Math.abs(r-e)<Ma){const a=e-Ma>=-n?-Ma:Ma;r=Math.max(-n,Math.min(0,Math.round(e+a)))}return{to:r,ms:Math.round(Math.abs(r-e)*nI)}}function s9(e){return Math.round(WT+e()*(n9-WT))}const UT=[{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 a9(e){const t=UT.reduce((r,a)=>r+a.weight,0);let n=e()*t;for(const r of UT)if(n-=r.weight,n<0)return r.kind;return"stroll"}const o9=720,i9=260,l9=620,c9=220,VT=520,rI=1600,GT=7e3,u9=15e3,KT=6e3,d9=14e3;function Fi(e,t,n=Io){let r=-Math.round(t()*n);if(Math.abs(r-e)<Ma){const a=e-Ma>=-n?-Ma:Ma;r=Math.max(-n,Math.min(0,Math.round(e+a)))}return r}const cn=(e,t)=>Math.round(Math.abs(t-e)*nI),Rd=0;function h9(e,t){const n=r=>({kind:"litter",at:t,...r});return[{x:t,prop:n({}),act:"walk",ms:cn(e,t)},{x:t,prop:n({}),act:"stoop",ms:o9},{x:Rd,prop:n({held:!0}),act:"carry",ms:cn(t,Rd)},{x:Rd,prop:n({held:!0}),act:"windup",ms:i9},{x:Rd,prop:n({held:!0,leaving:!0}),act:"toss",ms:l9}]}function f9(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:cn(e,r)},{x:r,prop:a(),act:"windup",ms:c9,facing:n>0?"right":"left"},{x:r,prop:a({leaving:!0}),act:"kick",ms:VT,facing:n>0?"right":"left"},{x:r,prop:a({leaving:!0}),act:"stand",ms:rI-VT}]}const sI=640;function p9(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:cn(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:cn(r,0)}]}function m9(e,t,n){const r=Math.max(-110,Math.min(-30,t)),a={x:r,prop:null};return[{...a,act:"walk",ms:cn(e,r)},{...a,act:"skip-ready",ms:500},{...a,act:"skip",ms:sI*(6+Math.floor(n()*5))},{...a,act:"skip-rest",ms:600},{...a,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:cn(r,0)}]}function g9(e,t,n){return[{x:t,prop:null,act:"walk",ms:cn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(KT+n()*(d9-KT))},{x:t,prop:null,act:"stand",ms:400}]}function y9(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:cn(e,t)},{x:t,prop:r(),act:"watch",ms:Math.round(GT+n()*(u9-GT))},{x:t,prop:r(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function YT(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 w9=1500,v9=e=>Math.round(1e3*Math.sqrt(2*e/w9)),x9=115,b9=e=>Math.round(e/x9*1e3),k9=620,N9=200,_9=760,S9=600,j9=240;function E9(e,t,n){const a=-(t.ledgeSpan??Io),l=v9(t.ledgeH),c=b9(t.ledgeH),u=-Math.round(n()*t.floorSpan),f=-Math.round(n()*t.floorSpan);return[{x:a,act:"walk",prop:null,ms:cn(e,a)},{x:a,act:"peer",prop:null,ms:k9},{x:a,act:"fall",prop:null,ms:l,place:"floor"},{x:a,act:"land",prop:null,ms:N9,place:"floor"},{x:u,act:"walk",prop:null,ms:cn(a,u),place:"floor"},{x:f,act:"walk",prop:null,ms:cn(u,f),place:"floor"},{x:a,act:"walk",prop:null,ms:cn(f,a),place:"floor"},{x:a,act:"lasso",prop:null,ms:_9,place:"floor"},{x:a,act:"rope-throw",prop:null,ms:S9,place:"floor"},{x:a,act:"rope-catch",prop:null,ms:j9,place:"floor"},{x:a,act:"climb",prop:null,ms:c},{x:a,act:"pull-up",prop:null,ms:480}]}function C9(e,t,n){const r=(n==null?void 0:n.ledgeSpan)??Io;switch(a9(t)){case"tidy":return h9(e,Fi(e,t,r));case"kick":return f9(e,Fi(e,t,r));case"sit":return g9(e,Fi(e,t,r),t);case"watch":return y9(e,Fi(e,t,r),t);case"fish":return p9(e,Fi(e,t,r),t);case"skip":return m9(e,Fi(e,t,r),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return E9(e,n,t)}}const l=r9(e,t,r);return[{x:l.to,prop:null,act:"walk",ms:l.ms}]}const T9=[".xx.","xxxx",".xx."],A9=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],R9=["...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."],sx={litter:T9,ball:A9,scope:R9},aI=["bob","sway","groove"],XT=9e3,M9=16e3,oI=1e3,I9=.08;function $9(e,t){const n=aI.filter(l=>l!==e),r=n[Math.min(n.length-1,Math.floor(t()*n.length))],a=(t()*2-1)*I9;return{dance:r,beatMs:Math.round(oI*(1+a))}}function O9(e){return Math.round(XT+e()*(M9-XT))}const P9=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],L9=3,D9=-1,Qx=11,ZT=9,F9=420;function q9(e,t,n){const r=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(F9,Math.max(0,r))}const B9=260,z9=200;function H9(e,t,n){const r=(h,m=cn(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,cn(e,u)),{...p,x:u,act:"mount",ms:B9},{...p,x:f,act:"walk",ms:cn(u,f)},{x:f,prop:null,act:"dismount",ms:z9,place:"floor"},{x:t,prop:null,act:"walk",ms:cn(f,t),place:"floor"}]}function QT(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 ax(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:Zh(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 ox={e:"fm-eye",s:"fm-shade",p:"fm-pad"},ph=Zh().filter(e=>!tI.has(e.cell)),W9=Zh().filter(e=>tI.has(e.cell)),JT=ph.filter(e=>e.cell==="e"),U9=Zh(P9),V9=ph.filter(e=>e.y<Qx&&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),G9={left:ph.filter(e=>e.y>=Qx&&e.x<ZT),right:ph.filter(e=>e.y>=Qx&&e.x>=ZT)},e2={litter:ax(sx.litter,"litter"),ball:ax(sx.ball,"ball"),scope:ax(sx.scope,"scope")},K9=x.memo(function({fetchImpl:t}){const[n,r]=x.useState(null),[a,l]=x.useState(!1),[c,u]=x.useState(!1),[f,p]=x.useState(!1),[h,m]=x.useState(0),[y,w]=x.useState(0),[_,k]=x.useState(null),[j,b]=x.useState(null),[S,E]=x.useState({x:0,drop:0}),[C,T]=x.useState("ledge"),[R,$]=x.useState("left"),[H,B]=x.useState(0),P=x.useRef(null),[G,Q]=x.useState(()=>document.hidden);x.useEffect(()=>{const D=new Set,ae=()=>{var z;if(document.hidden){for(const Z of((z=P.current)==null?void 0:z.getAnimations({subtree:!0}))??[])if(Z.playState==="running"||Z.pending){const U=Z.currentTime;Z.pause(),U!==null&&(Z.currentTime=U),D.add(Z)}}else{for(const Z of D)Z.playState==="paused"&&Z.play();D.clear()}Q(document.hidden)};return ae(),document.addEventListener("visibilitychange",ae),()=>document.removeEventListener("visibilitychange",ae)},[n,a]);const[J,M]=x.useState(null),[X,V]=x.useState(oI),[I,q]=x.useState(()=>{var D;return((D=window.matchMedia)==null?void 0:D.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});x.useEffect(()=>{var z;const D=(z=window.matchMedia)==null?void 0:z.call(window,"(prefers-reduced-motion: reduce)");if(!D)return;const ae=()=>q(D.matches);return ae(),D.addEventListener("change",ae),()=>D.removeEventListener("change",ae)},[]);const W=x.useRef(null),K=x.useCallback(D=>{var ae,z;(z=(ae=W.current)==null?void 0:ae.contentWindow)==null||z.postMessage(D,Zx)},[]);if(x.useEffect(()=>{let D=!0;return(t??fetch)("/api/claude-fm").then(z=>z.ok?z.json():null).then(z=>{D&&(z!=null&&z.live)&&(z!=null&&z.channel)&&r({live:!0,channel:z.channel})}).catch(()=>{}),()=>{D=!1}},[t]),x.useEffect(()=>{if(!c)return;const D=ae=>{var Z;if(ae.origin!==Zx||ae.source!==((Z=W.current)==null?void 0:Z.contentWindow))return;const z=e9(ae.data);if(z){if(z.kind==="ready"){K(zT("playVideo"));return}if(z.kind==="playing"){p(z.playing);return}J7.includes(z.code)&&(u(!1),p(!1),l(!0))}};return window.addEventListener("message",D),()=>window.removeEventListener("message",D)},[c,K]),x.useEffect(()=>{if(!n||a||I)return;const D=QT(document);let ae=0;m(pe=>ae=pe);const z=pe=>{var Ce,Ne;const[_e,...Pe]=pe;if(!_e){k(null),b(null),ge();return}k(_e.act),b(_e.prop),T(_e.place??"ledge"),B(_e.riser??0);const $e=de(_e),Te=ae;if(_e.act==="kick"){const He=(Ne=(Ce=P.current)==null?void 0:Ce.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:Ne.getBoundingClientRect();He&&E({x:q9(He.x,YT(_e,Te,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-He.y+24)})}const et=_e.act==="walk"||_e.act==="carry"?cn(Te,$e):_e.ms;w(et),$(He=>YT({..._e,x:$e},Te,He)),m($e),ae=$e,D.schedule(()=>z(Pe),et)},Z=()=>{const pe=P.current,_e=pe==null?void 0:pe.querySelector(".fm-sprite"),Pe=pe==null?void 0:pe.parentElement;if(!pe||!_e||!Pe)return null;const $e=pe.getBoundingClientRect(),Te=Pe.getBoundingClientRect(),je=Te.right-$e.right,et=Te.width-je*2-_e.offsetWidth;return et>0?et:null},U=()=>{const pe=P.current,_e=pe==null?void 0:pe.querySelector(".fm-walker"),Pe=Z();if(!pe||!_e||Pe==null)return;const $e=pe.getBoundingClientRect().bottom-_e.getBoundingClientRect().bottom;if($e>0)return{ledgeH:$e,floorSpan:Pe}},re=()=>{const pe=P.current,_e=document.querySelector(".autofit-chip");if(!pe||!_e)return null;const Pe=pe.getBoundingClientRect(),$e=_e.getBoundingClientRect();return $e.width<=0||$e.height<=0?null:{left:$e.left-Pe.right,right:$e.right-Pe.right,height:$e.height}},de=pe=>{const _e=(pe.place??"ledge")==="floor"?Z()??Io:Io;return Math.max(-_e,Math.min(0,pe.x))},ge=()=>{D.schedule(()=>{const pe=C9(ae,Math.random,U()),_e=pe.some(Te=>Te.place==="floor")?re():null;let Pe=ae;const $e=pe.flatMap(Te=>{const je=Pe;return Pe=Te.x,Te.place==="floor"&&Te.act==="walk"?H9(je,Te.x,_e):[Te]});z($e)},s9(Math.random))};return ge(),()=>{D.dispose(),T("ledge"),m(pe=>Math.max(-Io,Math.min(0,pe))),w(0),k(null),b(null),B(0)}},[n,a,I]),x.useEffect(()=>{if(!f||I){M(null);return}const D=QT(document),ae=z=>{const Z=$9(z,Math.random);M(Z.dance),V(Z.beatMs),D.schedule(()=>ae(Z.dance),O9(Math.random))};return ae(null),()=>D.dispose()},[f,I]),!n||a)return null;const F=()=>{if(!c){u(!0),p(!0);return}const D=!f;p(D),K(zT(D?"playVideo":"pauseVideo")),D||u(!1)};return i.jsxs("div",{ref:P,className:"fm","data-suspended":G?"":void 0,"data-place":C,style:{"--fm-beat":`${X}ms`},children:[j&&!j.held&&i.jsx("div",{className:"fm-prop","data-prop":j.kind,"data-leaving":j.leaving?"":void 0,style:{"--fm-prop-x":`${j.at}px`,"--fm-roll-to":`${S.x}px`,"--fm-ball-drop":`${S.drop}px`,"--fm-ball-flight-ms":`${rI}ms`,"--fm-ball-turn":R==="right"?"1080deg":"-1080deg"},children:e2[j.kind]}),(_==="lasso"||_==="rope-throw"||_==="rope-catch"||_==="climb"||_==="pull-up")&&i.jsxs("div",{className:"fm-rope","data-act":_,style:{"--fm-rope-x":`${h}px`,"--fm-rope-ms":`${y}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":_??void 0,"data-place":C,"data-facing":R,style:{"--fm-x":`${h}px`,"--fm-walk-ms":`${y}ms`,"--fm-riser":`${H}px`,"--fm-skip-beat":`${sI}ms`},children:[(j==null?void 0:j.held)&&i.jsx("div",{className:"fm-held","data-prop":j.kind,"data-toss":j.leaving?"":void 0,children:e2[j.kind]}),["cast","fish","reel","stow"].includes(_)&&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(_)&&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":f?"":void 0,"data-dance":f?J??aI[0]:void 0,"aria-pressed":f,onClick:F,title:f?"Stop Claude FM":"Play Claude FM — streams from YouTube","aria-label":f?"Stop Claude FM":"Play Claude FM",children:i.jsxs("svg",{viewBox:`0 0 ${HT} ${t9}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[i.jsx("g",{className:"fm-gear",children:i.jsx("g",{className:"fm-gear-motion",children:W9.map(D=>i.jsx("rect",{x:D.x,y:D.y,width:D.w,height:1,className:ox[D.cell]},`g${D.y}-${D.x}`))})}),i.jsxs("g",{className:"fm-body",children:[JT.map(D=>i.jsx("rect",{x:D.x,y:D.y,width:D.w,height:1,fill:"var(--accent)"},`eye-bed-${D.x}`)),V9.map(D=>i.jsx("rect",{x:D.x,y:D.y,width:D.w,height:1,className:ox[D.cell]},`b${D.y}-${D.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"})]}),JT.map(D=>i.jsx("rect",{x:D.x-(D.x>=HT/2?1:0)+(R==="right"?1:0),y:D.y,width:D.w,height:1,className:"fm-eye"},`eye-${D.x}`))]}),i.jsx("g",{className:"fm-hat",children:U9.map(D=>i.jsx("rect",{x:L9+D.x,y:D9+D.y,width:D.w,height:1,className:D.cell==="k"?"fm-hatband":void 0},`h${D.y}-${D.x}`))}),(_==="climb"||_==="rope-throw"||_==="rope-catch"||_==="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"})]}),(_==="land"||_==="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(_)&&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(D=>i.jsx("g",{className:"fm-leg","data-side":D,children:G9[D].map(ae=>i.jsx("rect",{x:ae.x,y:ae.y,width:ae.w,height:1,className:ox[ae.cell]},`${D}${ae.y}-${ae.x}`))},D))]})})]}),c&&n.channel&&i.jsx("iframe",{ref:W,className:"fm-frame",title:"Claude FM",src:Y7(n.channel,window.location.origin),onLoad:()=>K(X7()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})]})}),iI="agent-dag.character-enabled";function Y9(e){return e!=="0"}function X9(){return Y9(Da(iI))}const Z9=15e3;function Q9(e){return e.visibilityState==="visible"&&e.hasFocus()}function J9(e,t){return t||e===!0}function eV(){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 tV={"//":["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.26.0","3.26.1","3.26.3","3.26.4","3.26.5"],"3.25.0":[{title:"🖱️ A click goes to the session, a double-click opens the details",body:"Clicking a card frames it with the rest of its session and leaves the detail panel shut. Double-click a card to open its details; `j`/`k`, the session list, Enter and `D` still open them too."},{title:"🔭 Cards stay readable when you zoom out",body:"At every zoom a card shows its name, its state and anything waiting on you, instead of shrinking to a coloured pill. Hover or focus a card to see it whole. Recap notes read at a distance too, and show the full recap on hover."},{title:"🌐 The Machine panel shows your network",body:"A new Network section shows download, upload and the round trip to Claude's API, and names the route when traffic goes through a VPN or a Tailscale exit node. Those checks run only while the panel is open. The panel is regrouped into CPU, Memory, Network and Thermal, with a flag at the top when something needs attention."},{title:"🎨 See each theme before you pick it",body:"The Appearance menu shows a small preview of the deck in Light and in Dark. Claude FM also keeps its volume when a notification chime plays, instead of dipping under it."}],"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.
|
|
93
|
+
|
|
94
|
+
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.
|
|
95
|
+
|
|
96
|
+
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.
|
|
97
|
+
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
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.
|
|
101
|
+
|
|
102
|
+
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".
|
|
103
|
+
|
|
104
|
+
**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.
|
|
105
|
+
|
|
106
|
+
\`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.
|
|
107
|
+
|
|
108
|
+
**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.
|
|
109
|
+
|
|
110
|
+
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.
|
|
111
|
+
|
|
112
|
+
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.
|
|
113
|
+
|
|
114
|
+
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.
|
|
115
|
+
|
|
116
|
+
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.
|
|
117
|
+
|
|
118
|
+
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.
|
|
119
|
+
|
|
120
|
+
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.
|
|
121
|
+
|
|
122
|
+
What you are reading is the first version that does not.
|
|
123
|
+
|
|
124
|
+
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.
|
|
125
|
+
|
|
126
|
+
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.
|
|
127
|
+
|
|
128
|
+
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.
|
|
129
|
+
|
|
130
|
+
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.
|
|
131
|
+
|
|
132
|
+
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.
|
|
133
|
+
|
|
134
|
+
The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
|
|
135
|
+
|
|
136
|
+
**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.
|
|
137
|
+
|
|
138
|
+
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.
|
|
139
|
+
|
|
140
|
+
\`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.
|
|
141
|
+
|
|
142
|
+
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.
|
|
143
|
+
|
|
144
|
+
**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.
|
|
145
|
+
|
|
146
|
+
**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.
|
|
147
|
+
|
|
148
|
+
**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.
|
|
149
|
+
|
|
150
|
+
**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.
|
|
151
|
+
|
|
152
|
+
**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.
|
|
153
|
+
|
|
154
|
+
**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.
|
|
155
|
+
|
|
156
|
+
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.
|
|
157
|
+
|
|
158
|
+
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.
|
|
159
|
+
|
|
160
|
+
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.
|
|
161
|
+
|
|
162
|
+
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.
|
|
163
|
+
|
|
164
|
+
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.
|
|
165
|
+
|
|
166
|
+
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.
|
|
167
|
+
|
|
168
|
+
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.
|
|
169
|
+
|
|
170
|
+
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.
|
|
171
|
+
|
|
172
|
+
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.
|
|
173
|
+
|
|
174
|
+
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.
|
|
175
|
+
|
|
176
|
+
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.
|
|
177
|
+
|
|
178
|
+
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.
|
|
179
|
+
|
|
180
|
+
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.
|
|
181
|
+
|
|
182
|
+
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.
|
|
183
|
+
|
|
184
|
+
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.
|
|
185
|
+
|
|
186
|
+
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.
|
|
187
|
+
|
|
188
|
+
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.
|
|
189
|
+
|
|
190
|
+
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.
|
|
191
|
+
|
|
192
|
+
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.
|
|
193
|
+
|
|
194
|
+
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.
|
|
195
|
+
|
|
196
|
+
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.
|
|
197
|
+
|
|
198
|
+
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.
|
|
199
|
+
|
|
200
|
+
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.
|
|
201
|
+
|
|
202
|
+
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.
|
|
203
|
+
|
|
204
|
+
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.
|
|
205
|
+
|
|
206
|
+
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.
|
|
207
|
+
|
|
208
|
+
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.
|
|
209
|
+
|
|
210
|
+
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.
|
|
211
|
+
|
|
212
|
+
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.
|
|
213
|
+
|
|
214
|
+
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.
|
|
215
|
+
|
|
216
|
+
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.
|
|
217
|
+
|
|
218
|
+
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.
|
|
219
|
+
|
|
220
|
+
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.
|
|
221
|
+
|
|
222
|
+
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.
|
|
223
|
+
|
|
224
|
+
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.
|
|
225
|
+
|
|
226
|
+
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.
|
|
227
|
+
|
|
228
|
+
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.
|
|
229
|
+
|
|
230
|
+
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.
|
|
231
|
+
|
|
232
|
+
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.
|
|
233
|
+
|
|
234
|
+
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".
|
|
235
|
+
|
|
236
|
+
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.
|
|
237
|
+
|
|
238
|
+
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.
|
|
239
|
+
|
|
240
|
+
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.
|
|
241
|
+
|
|
242
|
+
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.
|
|
243
|
+
|
|
244
|
+
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.
|
|
245
|
+
|
|
246
|
+
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.
|
|
247
|
+
|
|
248
|
+
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.
|
|
249
|
+
|
|
250
|
+
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.
|
|
251
|
+
|
|
252
|
+
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.
|
|
253
|
+
|
|
254
|
+
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.
|
|
255
|
+
|
|
256
|
+
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.
|
|
257
|
+
|
|
258
|
+
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.
|
|
259
|
+
|
|
260
|
+
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.
|
|
261
|
+
|
|
262
|
+
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.
|
|
263
|
+
|
|
264
|
+
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.
|
|
265
|
+
|
|
266
|
+
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.
|
|
267
|
+
|
|
268
|
+
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.
|
|
269
|
+
|
|
270
|
+
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.
|
|
271
|
+
|
|
272
|
+
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.
|
|
273
|
+
|
|
274
|
+
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.
|
|
275
|
+
|
|
276
|
+
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.
|
|
277
|
+
|
|
278
|
+
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.
|
|
279
|
+
|
|
280
|
+
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.
|
|
281
|
+
|
|
282
|
+
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.
|
|
283
|
+
|
|
284
|
+
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.`}]},lb="agent-dag.releaseNotesSeen";function t2(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function il(e,t){const n=t2(e),r=t2(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 ll(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function nV(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 rV(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,r]of Object.entries(e)){if(!ll(n)||!Array.isArray(r))continue;const a=r.filter(nV);a.length&&t.push({version:n,notes:a})}return t.sort((n,r)=>il(r.version,n.version))}const n2=rV(tV);function lI(e,t,n){return e.filter(r=>il(r.version,n)<=0&&(t===null||il(r.version,t)>0))}function sV(e,t){return e.filter(n=>il(n.version,t)===0)}function aV(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 oV({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&&ll(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(!ll(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=il(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 iV=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function lV(e){const t=iV.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function r2(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function cV(e){if(!e)return null;let t=null;try{t=e.getItem(lb)}catch{return null}return ll(t)?t:null}function uV(e){if(!e)return!1;try{return e.getItem(lb),!0}catch{return!1}}function dV(e,t){if(!e)return!1;try{return e.setItem(lb,t),!0}catch{return!1}}const cI="agent-dag.tourSeen";function hV(e){if(!e)return!1;try{return e.getItem(cI)==="1"}catch{return!1}}function fV(e){if(!e)return!1;try{return e.setItem(cI,"1"),!0}catch{return!1}}function pV({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 mV({stored:e,running:t,notes:n,remembers:r=!0}){if(!ll(t))return{show:[],record:null,reason:"no-version"};if(!ll(e)){if(!r)return{show:[],record:t,reason:"cannot-remember"};const c=sV(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=il(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const l=lI(n,e,t);return l.length?{show:l,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function gV(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 uI(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=gV(e,l);if(c>0){a(),n.push({kind:"bold",kids:uI(e.slice(l+2,c),!1)}),l=c+2;continue}}r+=e[l],l+=1}return a(),n}function yV({entries:e,since:t,running:n,firstRun:r,onClose:a,onTour:l,onRestart:c}){const u=un(a),f=aV(e);return i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:u,className:"modal release-notes",onClick:p=>p.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"}),f&&i.jsx("span",{className:"modal-tool-id",children:f})]}),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:oV({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"})]}),c&&i.jsxs("div",{className:"guide-door",children:[i.jsx("span",{children:"Restart the deck. Sessions, settings and pairings come back as they were."}),i.jsx("button",{type:"button",className:"btn",onClick:c,children:"Restart"})]}),e.map(p=>i.jsxs("section",{className:"modal-section",children:[i.jsxs("h3",{className:"rn-version",children:["v",p.version]}),i.jsx("ul",{className:"rn-notes",children:p.notes.map((h,m)=>{const{icon:y,rest:w}=lV(h.title);return i.jsxs("li",{className:"rn-note",children:[i.jsxs("p",{className:"rn-note-title",children:[y&&i.jsx("span",{className:"rn-note-icon",children:y}),w]}),i.jsx("p",{className:"rn-note-body",children:dI(uI(h.body))})]},m)})})]},p.version))]})]})})}function dI(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:dI(t.kids)},n))}function wV(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function vV(e,t,n){var c;if(e.length===0)return null;const r=wV(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 xV=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function bV(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:xV.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const kV=new Set(["","BODY","HTML","#DOCUMENT"]);function NV(e){return!e||C0(e)?!1:!kV.has(String(e.tagName??"").toUpperCase())}function _V(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 SV(e,t){const n=new Set;for(const r of t){const a=_V(e,r);if(a)for(const l of a)n.add(l)}return n.size>0?n:null}const jV=40,EV=120;function CV(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=jV){const p=t.now(),h=Math.max(a+f,p);if(h<=p){c(),l();return}u(h,p,f)},replay(f=EV){c(),r=t.now()+f,n=t.setTimeout(l,f)},flush(){c(),l()},cancel(){c()}}}const TV=1e3;function AV(e={}){const t=Math.max(1,Math.floor(e.limit??TV)),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 _=0;if(l.size<a.length)for(;l.has(a[_]);)_++;const[k]=a.splice(_,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 hI="agent-dag.theme";function RV(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function MV(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function IV(){return RV(Da(hI),MV())}const $V=6,OV="ccdeck-tabs";function PV(e){return e>=$V}function LV(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 DV({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${nn}`:nn,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const Md={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Id(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 FV=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Id(Md.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Id(Md.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Id(Md.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Id(Md.idle,"idle"))}`}),qV="No sessions are waiting for you.";function BV(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 zV(e,t){return t!==""?t:e===""?"":qV}const s2="agent-dag.browserWatch.seenMs";function HV(e,t){return e.filter(n=>n.startMs>t)}function WV(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 UV({request:e,waiting:t,busy:n,now:r,onAccept:a,onDecline:l,onLater:c}){const u=x.useRef(null),f=un(c,{focusRef:u}),p=La(n,"accept"),h=La(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 ",z0(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"})]})]})]})})}const VV=600;function Jx(e,t){return!(e.exitAt!=null&&t-e.exitAt>VV||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function GV(e,t){const n=new Set;for(const r of e.agents.values())Jx(r,t)&&n.add(r.id);return n}function KV(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 YV(e,t,n=0){if(!e)return!1;for(const r of t)if(KV(e,r,n))return!0;return!1}const fI="sessionGroup";function XV(e,t){var r,a;if(e.type===fI)return"transparent";if(vr((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 pI=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function a2(e){const t={};for(const n of pI)t[n]=e(n);return t}function ZV(e){return t=>e[t]??""}function QV(e,t){return pI.every(n=>e[n]===t[n])}function JV(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}}function o2(e){return Object.entries(e??{}).filter(([,t])=>t&&typeof t.x=="number"&&typeof t.y=="number")}function eG(e){const t={positions:[],pins:[]};if(!e)return t;let n;try{n=JSON.parse(e)}catch{return t}if(!n||typeof n!="object")return t;if(!("v"in n)){const a=o2(n);return{positions:a,pins:a.map(([l])=>l)}}const r=n;return{positions:o2(r.positions),pins:Array.isArray(r.pins)?r.pins:[]}}function tG(e,t){const n={};for(const[r,a]of e)n[r]=a;for(const[r,a]of t)n[r]=a;return JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())})}function nG(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}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}}const mI=.2,gI=1.6;function rG(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<mI||a>gI?null:{x:n,y:r,zoom:a}}const sG=1200,aG=1e3;function ix(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<sG?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<aG}function $d({durationMs:e,documentHidden:t,reducedMotion:n=oG()}){return t||n?!1:Number.isFinite(e)&&e>0}function oG(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function iG(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 lG({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,iG(a,t,e))return!1;return r}const cb=11,yI=7.2,wI=6.6,cG={width:104,height:48},i2={width:96,height:44},vI={width:220,height:103};function uG(e){let t=1/0,n=1/0;for(const r of e)!(r.width>0)||!(r.height>0)||(t=Math.min(t,r.width),n=Math.min(n,r.height));return!Number.isFinite(t)||!Number.isFinite(n)?vI:{width:Math.max(160,t),height:Math.max(72,n)}}function lx(e,t,n){return e.width*t>=n.width&&e.height*t>=n.height}function dG(e,t,n=vI){if(!Number.isFinite(t)||t<=0)return e??"detail";const r=cb*t;return e==="detail"?r>=wI?"detail":lx(n,t,i2)?"compact":"overview":r>=yI?"detail":e==="compact"?lx(n,t,i2)?"compact":"overview":lx(n,t,cG)?"compact":"overview"}const hG=yI/cb,fG=wI/cb;function pG(e,t){return e>=hG?e:Math.max(e,Math.min(t,fG-.001))}const mG=.8,gG=1;function yG(e){const t=e.minZoom??mG,n=e.maxZoom??gG,r=e.fill??.9,a=e.insets.left,l=e.insets.top,c=Math.max(1,e.pane.width-e.insets.left-e.insets.right),u=Math.max(1,e.pane.height-e.insets.top-e.insets.bottom),f=e.context,p=e.anchor,h=Math.min(c/Math.max(1,f.width),u/Math.max(1,f.height))*r,m=Math.max(t,Math.min(n,h)),y=(w,_,k,j,b,S)=>{let E=w+(_-j*m)/2-k*m;const C=b*m+E,T=(b+S)*m+E;return S*m<=_?C<w?E+=w-C:T>w+_&&(E-=T-(w+_)):E+=w-C,E};return{x:y(a,c,f.x,f.width,p.x,p.width),y:y(l,u,f.y,f.height,p.y,p.height),zoom:m}}function wG(e){let t=1/0,n=1/0,r=-1/0,a=-1/0;for(const l of e)t=Math.min(t,l.x),n=Math.min(n,l.y),r=Math.max(r,l.x+l.width),a=Math.max(a,l.y+l.height);return Number.isFinite(t)?{x:t,y:n,width:r-t,height:a-n}:null}let $o=null,Ui=null;const e0=new Set,t0=()=>{for(const e of e0)e()},vG=e=>(e0.add(e),()=>{e0.delete(e)}),l2=()=>$o,xG=90;function xI(e){!Ui||e!=null&&Ui.at.id!==e||(clearTimeout(Ui.timer),Ui=null)}function c2(e,t,n="pointer"){xI();const r={id:e,anchor:t,by:n};if($o||n==="focus"){$o=r,t0();return}Ui={at:r,timer:setTimeout(()=>{Ui=null,$o=r,t0()},xG)}}function ja(e){xI(e),!(!$o||e!=null&&$o.id!==e)&&($o=null,t0())}function bG({agentFor:e,recapFor:t,labelFor:n,bounds:r}){const a=x.useSyncExternalStore(vG,l2,l2),l=a?e(a.id):void 0,c=a&&!l?t(a.id):void 0,u=a!=null&&(!l&&!c||!a.anchor.isConnected);return x.useEffect(()=>{u&&a&&ja(a.id)},[u,a]),!a||u?null:l?i.jsx(NG,{a:l,anchor:a.anchor,parentLabel:l.parentId?n(l.parentId):void 0,bounds:r},a.id):c?i.jsx(kG,{r:c,anchor:a.anchor,bounds:r},a.id):null}function bI(e,t){const n=x.useRef(null),r=x.useCallback(()=>{const a=n.current;if(!a||!e.isConnected)return;const l=L0(e.getBoundingClientRect(),{width:a.offsetWidth,height:a.offsetHeight},t());a.style.top=`${l.top}px`,a.style.left=`${l.left}px`,a.style.maxHeight=l.maxHeight==null?"":`${l.maxHeight}px`,a.dataset.side=l.side},[e,t]);return x.useLayoutEffect(()=>{r()}),n}function kG({r:e,anchor:t,bounds:n}){const r=bI(t,n),a=ul(3e4),l=sh(e.recap.at,a);return Yn.createPortal(i.jsxs("div",{ref:r,className:"ap-peek node-peek recap-peek",role:"tooltip",id:"node-peek",style:{"--session-hue":e.hue},children:[i.jsxs("div",{className:"node-peek-head",children:[i.jsxs("span",{className:"recap-peek-mark",children:[i.jsx(Pc,{}),"recap"]}),i.jsx("span",{className:"node-peek-time",title:l.title,children:l.label})]}),e.sessionLabel&&i.jsx("div",{className:"node-peek-kind",children:i.jsxs("span",{children:["Claude Code's recap of ",e.sessionLabel]})}),i.jsx("p",{className:"recap-peek-text",children:e.recap.text}),i.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for its details"})]}),document.body)}function NG({a:e,anchor:t,parentLabel:n,bounds:r}){const a=bI(t,r),l=ul(1e3),c=j0(e.sessionName,e.sessionTitle),u=e.tools.filter(_=>_.ok===!1).length,f=e.tools.filter(_=>!_.endedAt).length,p=Kn(e,l).total,h=e.usage.inputTokens+e.usage.outputTokens,m=e.kind==="root"&&vr(e.waiting),y=e.kind==="root"?"session":n?`subagent of ${n}`:"subagent",w=[`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,f>0?`${f} in-flight`:null,h>0?`${mn(h)} tok`:null,p>0?`${kt(p)}${Oc(e,l)>0?"+":""}`:null].filter(Boolean).join(" · ");return Yn.createPortal(i.jsxs("div",{ref:a,className:"ap-peek node-peek",role:"tooltip",id:"node-peek",children:[i.jsxs("div",{className:"node-peek-head",children:[i.jsx("span",{className:"node-peek-name",children:e.label}),i.jsxs("span",{className:"node-peek-time",children:[e.synthetic?"≥ ":"",tl(e.startedAt,e.endedAt,l)]})]}),i.jsxs("div",{className:"node-peek-kind",children:[i.jsxs("span",{className:"node-peek-state","data-kind":$x(e.state),children:[i.jsx(yR,{kind:$x(e.state)}),rl(e.state)]}),i.jsx("span",{children:y}),e.model?i.jsx("span",{children:Pa(e.model)}):null]}),e.kind==="root"&&c.face&&i.jsx("p",{className:"node-peek-title",children:c.face}),e.kind==="root"&&e.waiting&&i.jsxs("p",{className:`node-peek-wait${m?" warn":""}`,children:[m&&i.jsx(M0,{}),i.jsx("span",{children:I0(e.waiting)}),i.jsx("b",{children:tl(e.waiting.since,void 0,l)})]}),i.jsxs("p",{className:"node-peek-facts",children:[w,u>0&&i.jsxs("span",{className:"node-peek-failed",children:[" · ",u," failed"]})]}),e.branch&&e.branch.total>0&&i.jsx("p",{className:"node-peek-branch",children:uR(e.branch)}),i.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for details"})]}),document.body)}const _G="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",cx="click for what's new";function SG(e){if(e.checkDisabled)return`${_G} · ${cx}`;if(e.checking)return`Asking npm for the newest release… · ${cx}`;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 · ${cx}, and to check npm now`}function jG(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 EG(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 kI(e){return e?`${e.kind}:${e.to}`:""}function CG(e,t){return e!=null&&t!==kI(e)}function TG(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 n0={kind:"assumed",claude:!0,codex:!0};function AG(e){if(!e||typeof e!="object")return n0;const t=e.providers;if(!t||typeof t!="object")return n0;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function RG(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const u2={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function MG(e){const t=e.toLowerCase();return Object.hasOwn(u2,t)?u2[t]:t?t[0].toUpperCase()+t.slice(1):""}function IG(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function _K(e,t=[]){const n=t.length?IG(t.map(MG)):RG(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function $G(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 OG(e,t){const n=t.prefs??Xx,r=Hc(n.done.level),a=Hc(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?`
|
|
285
|
+
|
|
286
|
+
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?`
|
|
287
|
+
|
|
288
|
+
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+`
|
|
289
|
+
|
|
290
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function mh(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const d2=99;function PG(e){const t=Math.max(0,Math.floor(e));return t>d2?`${d2}+`:String(t)}const LG="Pause the canvas";function DG(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 — ${mh(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)":`${mh(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function FG(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 NI="paused · full",qG=(e,t)=>t>0?NI:e>0?`paused · ${PG(e)}`:"paused";function BG(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:qG(e.held,t),widest:NI,title:t>0?`Connected — the pause is full at ${mh(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${mh(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 zG=x.lazy(()=>x2(()=>import("./UsageHistoryModal-BJA3mUzs.js"),[])),HG=x.lazy(()=>x2(()=>import("./BrowserWatchModal-B6MuDGvq.js"),[]));function h2(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const WG={agent:HD,sessionGroup:bF,recapNote:NF},UG={recapTie:_F},_I="react-flow__node";function ux(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,_I))===!0}const dx=80,hx=.86;function f2(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 VG(e){try{const t=document.querySelector(`.${_I}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const GG=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),KG=420,Od=18,p2=400,fx=450,ub="agent-dag.layout",db="agent-dag.layoutFrame",hb="agent-dag.viewport",SI="agent-dag.sessionListOpen",jI="agent-dag.detailOpen",EI="agent-dag.usagePanelOpen",CI="agent-dag.systemPanelOpen",m2="agent-dag.accountsPanelOpen",px="agent-dag.versionNoticeDismissed",g2="agent-dag.oldNameNoticeDismissed",YG=15*6e4,mx={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:"},Pd="agent-dag.autoRestart",y2="agent-dag.bundleReloadedFor";function XG(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(SI)==="1"}catch{return!1}}function ZG(e){if(!(typeof window>"u"))try{window.localStorage.setItem(SI,e?"1":"0")}catch{}}function QG(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(jI)==="1"}catch{return!1}}function JG(e){if(!(typeof window>"u"))try{window.localStorage.setItem(jI,e?"1":"0")}catch{}}function eK(){const e=Da(EI);return e===null?!0:e==="1"}function tK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(EI,e?"1":"0")}catch{}}function nK(){const e=Da(CI);return e===null?!0:e==="1"}function rK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(CI,e?"1":"0")}catch{}}function sK(){if(typeof window>"u")return{positions:[],pins:[]};try{return eG(window.localStorage.getItem(ub))}catch{return{positions:[],pins:[]}}}function Ld(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(ub,tG(e,t))}catch{}}function aK(){if(typeof window>"u")return null;try{return nG(window.localStorage.getItem(db))}catch{return null}}function oK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(db,JSON.stringify(e))}catch{}}function iK(){if(typeof window>"u")return null;try{return rG(window.localStorage.getItem(hb))}catch{return null}}function lK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(hb,JSON.stringify(e))}catch{}}function w2(){if(!(typeof window>"u")){try{window.localStorage.removeItem(ub)}catch{}try{window.localStorage.removeItem(hb)}catch{}try{window.localStorage.removeItem(db)}catch{}}}function cK(e,t){const n=f7(e,t,new Date().toISOString());if(!n)return;const r=JSON.stringify(n,null,2),a=new Blob([r],{type:"application/json"}),l=URL.createObjectURL(a),c=document.createElement("a");c.href=l,c.download=p7(n.label,t),document.body.appendChild(c),c.click(),document.body.removeChild(c),setTimeout(()=>URL.revokeObjectURL(l),1e3)}const TI={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},uK={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 dK({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:uK[e]})})}const gh={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},AI=hR;function hK(){return i.jsx(b0,{children:i.jsx(mK,{})})}const fK=e=>e.transform[2]>=e.maxZoom,pK=e=>e.transform[2]<=e.minZoom;function mK(){var fi,pi,mi,gi;const e=_h(),t=pt(fK),n=pt(pK),r=Vt(),a=x.useState(Mx)[0],l=x.useRef(a),[,c]=x.useState(0),u=x.useCallback(()=>c(L=>L+1),[]),[f,p]=x.useState(QG);x.useEffect(()=>{JG(f)},[f]);const[h,m]=x.useState(()=>new Set),[y,w]=x.useState(null),[_,k]=x.useState(null),j=x.useCallback((L,O,ne=!O)=>{m(oe=>{if(!O)return new Set([L]);const ye=new Set(oe);return ye.has(L)?ye.delete(L):ye.add(L),ye}),w(oe=>O&&oe===L?oe:L),!O&&ne&&p(!0)},[]),b=x.useCallback(()=>{m(new Set),w(null)},[]),[S,E]=x.useState(null),[C,T]=x.useState(null),R=x.useCallback(L=>T(L),[]),[$,H]=x.useState(!1),[B,P]=x.useState(!1),[G,Q]=x.useState(!1),J=x.useRef(null),[M,X]=x.useState(XG);x.useEffect(()=>{ZG(M)},[M]);const[V,I]=x.useState(eK);x.useEffect(()=>{tK(V)},[V]);const[q,W]=x.useState(nK);x.useEffect(()=>{rK(q)},[q]);const K=x.useRef(!1),[F,D]=x.useState(()=>{const L=(()=>{try{const O=window.localStorage.getItem(m2);return O===null?!0:O==="1"}catch{return!0}})();return L&&M?(K.current=!0,!1):L});x.useEffect(()=>{if(!(!F&&K.current))try{window.localStorage.setItem(m2,F?"1":"0")}catch{}},[F]),x.useEffect(()=>{!M&&K.current&&(K.current=!1,D(!0))},[M]);const ae=Ip(F,200),z=Ip(V,130),Z=Ip(q,130),[U,re]=x.useState(null);x.useEffect(()=>{let L=null;try{L=localStorage.getItem("agent-dag.sound")}catch{}re(L===null?!0:L==="on")},[]);const de=x.useCallback(()=>{re(L=>{var ne;const O=L!==!0;try{localStorage.setItem("agent-dag.sound",O?"on":"off")}catch{}return O&&((ne=Re.current)==null||ne.unlock()),O})},[]),ge=x.useCallback(L=>{de()},[de]),pe=x.useRef(ge);pe.current=ge;const _e=x.useRef(U);_e.current=U;const[Pe,$e]=x.useState(()=>O7(Da)),Te=x.useRef(Pe);Te.current=Pe;const je=x.useRef(null),et=x.useCallback((L,O=!1)=>{var ne,oe;if((ne=Re.current)==null||ne.unlock(),je.current!==null&&clearTimeout(je.current),je.current=null,!O){(oe=Re.current)==null||oe.play(L,!0);return}je.current=setTimeout(()=>{var ye;je.current=null,(ye=Re.current)==null||ye.play(L,!0)},A7)},[]),Ce=x.useCallback((L,O)=>{$e(ne=>{const oe={level:Hc(O.level??ne[L].level),figure:ZM(L,O.figure??ne[L].figure)};try{localStorage.setItem(QM[L],String(oe.level)),localStorage.setItem(JM[L],oe.figure)}catch{}return{...ne,[L]:oe}}),et(L,!0)},[et]);x.useEffect(()=>()=>{je.current!==null&&clearTimeout(je.current)},[]);const[Ne,He]=x.useState(!1),it=x.useRef(null),[ot,le]=x.useState(!1),be=x.useRef(null);x.useEffect(()=>{Ne&&le(!1)},[Ne]);const Re=x.useRef(null),[Ze,We]=x.useState("locked");x.useEffect(()=>{const L=L7({enabled:()=>_e.current===!0,prefs:()=>Te.current,onState:We});Re.current=L,We(L.state());const O=()=>L.unlock();return window.addEventListener("pointerdown",O,{once:!0,capture:!0}),window.addEventListener("keydown",O,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",O,{capture:!0}),window.removeEventListener("keydown",O,{capture:!0})}},[]);const[tt,we]=x.useState(!1),[Me,Qe]=x.useState(!1),[ce,lt]=x.useState(null),[gt,mt]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(px)??""}catch{return""}}),[Et,Ot]=x.useState(!1),Pt=x.useRef(0),[Kt,jn]=x.useState(!1),_t=x.useCallback((L=!1)=>(L&&(Pt.current=Date.now(),jn(!0)),fetch(L?"/api/version?refresh=1":"/api/version").then(O=>O.ok?O.json():null).then(O=>{O&<(O)}).catch(()=>{}).finally(()=>{L&&jn(!1)})),[]),Bt=x.useCallback(()=>{_t(Date.now()-Pt.current>=YG)},[_t]);x.useEffect(()=>{_t();const L=window.setInterval(Bt,5*6e4),O=()=>{document.visibilityState==="visible"&&Bt()};return document.addEventListener("visibilitychange",O),()=>{window.clearInterval(L),document.removeEventListener("visibilitychange",O)}},[_t,Bt]),x.useEffect(()=>{tt&&_t()},[tt,_t]),x.useEffect(()=>{const L=eV();let O=null;const ne=De=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:L,looking:De}),keepalive:!0}).catch(()=>{})},oe=()=>{const De=Q9(document);J9(O,De)&&ne(De),O=De},ye=()=>{O&&ne(!1),O=!1};oe();const Se=window.setInterval(oe,Z9);return window.addEventListener("focus",oe),window.addEventListener("blur",oe),document.addEventListener("visibilitychange",oe),window.addEventListener("pagehide",ye),()=>{window.clearInterval(Se),window.removeEventListener("focus",oe),window.removeEventListener("blur",oe),document.removeEventListener("visibilitychange",oe),window.removeEventListener("pagehide",ye),ye()}},[]);const he=(ce==null?void 0:ce.notice)??null,[Je,Ct]=x.useState(null),En=x.useRef(!1);x.useEffect(()=>{if(En.current)return;const L=r2(),O=cV(L),ne=mV({stored:O,running:(ce==null?void 0:ce.running)??null,notes:n2,remembers:uV(L)});if(ne.reason==="no-version")return;En.current=!0,ne.record&&dV(L,ne.record);const oe=pV({tourSeen:hV(L),decision:ne}),ye=ne.show.length?{entries:ne.show,since:O,firstRun:!1}:null;oe.tour&&Q(!0),oe.notes==="now"?Ct(ye):oe.notes==="after"&&(J.current=ye)},[ce==null?void 0:ce.running]);const dn=(ce==null?void 0:ce.running)??"3.26.5",ir=x.useMemo(()=>lI(n2,null,dn),[dn]),Mt=x.useCallback(()=>{Ct({entries:ir,since:null,firstRun:!1})},[ir]),[hn,Cn]=x.useState(null),[zt,Pn]=x.useState(n0);x.useEffect(()=>{let L=!1;return fetch("/api/health").then(O=>O.ok?O.json():null).then(O=>{L||(Pn(AG(O)),!(!O||typeof O.workspace!="string")&&Cn(O.workspace))}).catch(()=>{}),()=>{L=!0}},[tt]);const yn=x.useRef(zt);yn.current=zt;const wn=kI(he),Tn=CG(he,gt),_r=x.useCallback(()=>{mt("");try{window.localStorage.setItem(px,"")}catch{}},[]),Kr=x.useCallback(()=>{if(he){mt(wn);try{window.localStorage.setItem(px,wn)}catch{}}},[he,wn]),[Hs,Ws]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(g2)??""}catch{return""}}),vn=ce!=null&&ce.invokedAs&&ce.invokedAs!==nn?ce.invokedAs:null,ee=vn!=null&&Hs!==vn,Ae=x.useCallback(()=>{if(vn){Ws(vn);try{window.localStorage.setItem(g2,vn)}catch{}}},[vn]),Le=((fi=ce==null?void 0:ce.upgrade)==null?void 0:fi.state)??"idle",Ie=yz(ce==null?void 0:ce.upgrade),Ue=x.useRef(!1),ct=x.useCallback(async()=>{if(Ls(Ue.current||Le==="running")){Ue.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await _t(),Ue.current=!1}},[Le,_t]);x.useEffect(()=>{if(Le!=="running")return;const L=window.setInterval(_t,3e3);return()=>window.clearInterval(L)},[Le,_t]);const yt=x.useCallback(async()=>{const L=ce==null?void 0:ce.command;!L||!await al(L)||(Ot(!0),window.setTimeout(()=>Ot(!1),1600))},[ce==null?void 0:ce.command]),St=x.useCallback(()=>{X(L=>(L||D(O=>(O&&(K.current=!0),!1)),!L))},[]),Sr=x.useCallback(()=>{K.current=!1,D(L=>(L||X(!1),!L))},[]),[xt,wt]=x.useState(!1),[Us,ms]=x.useState(!1),[qa,Vs]=x.useState(()=>{try{return Number(localStorage.getItem(s2))||0}catch{return 0}}),[Ba,Uo]=x.useState([]),[Yr,An]=x.useState(!1);x.useEffect(()=>{let L=!0;const O=()=>{fetch("/api/browser-watch?live=0").then(oe=>oe.ok?oe.json():null).then(oe=>{var ye;!L||!(oe!=null&&oe.ok)||(Uo(oe.episodes??[]),An(((ye=oe.settings)==null?void 0:ye.enabled)===!0))}).catch(()=>{})};O();const ne=setInterval(O,5*6e4);return()=>{L=!1,clearInterval(ne)}},[]);const[za,xn]=x.useState([]),ru=x.useRef(new Set),[Vo,su]=x.useState(null);x.useEffect(()=>{let L=!0,O=0;const ne=()=>{fetch("/api/lan").then(oe=>oe.ok?oe.json():null).then(oe=>L?(oe!=null&&oe.ok&&xn(i_(Array.isArray(oe.pending)?oe.pending:[],oe.aliases)),oe):null).catch(()=>null).then(oe=>{L&&(O=window.setTimeout(ne,(oe==null?void 0:oe.enabled)===!0?Ux:HR))})};return ne(),()=>{L=!1,window.clearTimeout(O)}},[]);const Ha=x.useCallback(async(L,O)=>{if(!Vo){su(L);try{const oe=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:L,fp:O})})).json().catch(()=>null);oe&&Array.isArray(oe.pending)?xn(i_(oe.pending,oe.aliases)):xn(ye=>ye.filter(Se=>Se.fp!==O))}catch{}finally{su(null)}}},[Vo]),Xr=x.useMemo(()=>HV(Ba,qa).length,[Ba,qa]),[Wa,Ua]=x.useState(0),au=x.useRef(null),[Qh,Go]=x.useState(!1),Gs=x.useRef(null),[gl,Ks]=x.useState(0),Xn=x.useState(()=>AV({protect:L=>V5(l.current,L)}))[0],[Ys,ht]=x.useState(!1),Ko=x.useCallback(()=>{const L=Xn.paused&&Xn.dropped>0,O=Xn.setPaused(!Xn.paused);L&&G5(l.current);for(const ne of O)l.current=nN(l.current,ne);ht(Xn.paused)},[Xn]),[Ht,yl]=x.useState(Date.now()),[jr,Va]=x.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(Pd)!=="0"}catch{return!0}}),wl=x.useRef(!1),vl=x.useCallback(()=>{const L=!jr;wl.current=!0;try{window.localStorage.removeItem(Pd)}catch{}Va(L),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:L})}).then(O=>O.ok?O.json():null).then(O=>{var ne;O!=null&&O.ok&&Va(((ne=O.prefs)==null?void 0:ne.autoUpdate)!==!1)}).catch(()=>{})},[jr]),[Zn,Qn]=x.useState(!1),[Zr,Qr]=x.useState("restart"),[Xs,Zs]=x.useState(null),Rn=x.useRef(!1),ou=x.useRef(null),xl=x.useRef(0),Er=x.useCallback(async L=>{if(!Ls(Rn.current))return;const O=(L==null?void 0:L.upgrade)===!0;Rn.current=!0,ou.current=Ie;const ne=++xl.current;Qr(O?"npx":"restart"),Qn(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(he==null?void 0:he.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:O})})}catch{}window.setTimeout(()=>{if(xl.current===ne&&Rn.current){Rn.current=!1,Qn(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},O?18e4:3e4)},[he==null?void 0:he.to,Ie]),bl=x.useRef(null);x.useEffect(()=>{const L=f_(l.current.agents.values())>0,O=kz({enabled:jr,kind:he==null?void 0:he.kind,canRestart:(ce==null?void 0:ce.canRestart)===!0,noticeOpen:Tn,visible:document.visibilityState==="visible",busy:L,idleSince:bl.current,now:Ht});bl.current=O.idleSince,O.restart&&Er()},[jr,he==null?void 0:he.kind,ce==null?void 0:ce.canRestart,Tn,Ht,Er]);const kl=f_(l.current.agents.values()),Ga=bz(kl),Nl=GR({enabled:jr,kind:he==null?void 0:he.kind,canRestart:(ce==null?void 0:ce.canRestart)===!0,noticeOpen:Tn,visible:document.visibilityState==="visible",busy:kl>0,idleSince:bl.current,now:Ht});x.useEffect(()=>{const L=ce==null?void 0:ce.running;let O=null,ne=null;try{O=window.sessionStorage.getItem("agent-dag.restartPending"),ne=window.sessionStorage.getItem(y2)}catch{return}const oe=gz({bundle:"3.26.5",running:L,pending:O,lastTried:ne});if(oe==="reload"){try{window.sessionStorage.setItem(y2,L??"")}catch{return}window.location.reload();return}if(oe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Rn.current=!1,Qn(!1),Zs(L??null);const ye=window.setTimeout(()=>Zs(null),6e3);return()=>window.clearTimeout(ye)},[ce==null?void 0:ce.running]),x.useEffect(()=>{if(Zn&&wz({asked:ou.current,reported:Ie})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Rn.current=!1,Qn(!1)}},[Zn,Ie]);const iu=x.useState(()=>JV(sK()))[0],Tt=x.useRef(iu.pinned),Jr=x.useRef(null),Cr=x.useState(()=>iK())[0],[Qs,Jh]=x.useState(()=>new Set),[Js,Yo]=x.useState(IV),[es,_l]=x.useState(X9),[gs,ts]=x.useState(()=>a2(h2)),Xo=x.useMemo(()=>ZV(gs),[gs]),Zo=x.useCallback(L=>XV(L,Xo),[Xo]),[Sl,Qo]=x.useState(!1);x.useEffect(()=>{document.documentElement.dataset.theme=Js;try{window.localStorage.setItem(hI,Js)}catch{}ts(L=>{const O=a2(h2);return QV(L,O)?L:O})},[Js]),x.useEffect(()=>{try{window.localStorage.setItem(iI,es?"1":"0")}catch{}},[es]);const bn=x.useCallback((L,O)=>{if($d({durationMs:O,documentHidden:document.hidden})){e.setViewport(L,{duration:O});return}const{d3Zoom:ne,d3Selection:oe}=r.getState(),ye=oe==null?void 0:oe.property("__zoom");if(ne&&oe&&ye&&ye.k>0&&L.zoom>0){ne.transform(oe,ye.scale(L.zoom/ye.k).translate((L.x-ye.x)/L.zoom,(L.y-ye.y)/L.zoom));return}e.setViewport(L,{duration:0})},[e,r]),ys=x.useRef(null),Yt=x.useRef(0),Tr=x.useRef(null),Jo=x.useRef(()=>{});x.useEffect(()=>{if(!Cr)return;const L=window.setTimeout(()=>{try{bn(Cr,0)}catch{}Jn.current=Date.now()},60);return()=>window.clearTimeout(L)},[bn,Cr]);const ea=x.useRef(!0),[Ka,ei]=x.useState(null);x.useEffect(()=>{const L=new EventSource("/events"),O=CV(u,{now:()=>Date.now(),setTimeout:(Se,De)=>window.setTimeout(Se,De),clearTimeout:Se=>window.clearTimeout(Se)});let ne=!1;const oe=typeof BroadcastChannel=="function"?LV(new BroadcastChannel(OV),Math.random().toString(36).slice(2),()=>ne):null,ye=window.setInterval(()=>{ne||!oe||oe.ask(600).then(Se=>{ne||Qe(PV(Se))})},3e3);return L.addEventListener("open",()=>{we(!0),Qo(!0)}),L.addEventListener("error",()=>{we(!1),ei(null)}),L.addEventListener("open",()=>{ne=!0,Qe(!1)}),L.addEventListener("error",()=>{ne=!1}),L.addEventListener("replay-end",()=>{ea.current=!1,O.flush(),ei(Date.now())}),L.addEventListener("hook",Se=>{var De;try{const Ge=JSON.parse(Se.data);if(!Xn.accept(Ge))return;l.current=nN(l.current,Ge);const rt=Ge.replay===!0||ea.current||Date.now()-Ge.receivedAt>3e4;rt?O.replay():O.live();const Ke=P7(Ge,rt);Ke&&((De=Re.current)==null||De.play(Ke))}catch{}}),()=>{L.close(),O.cancel(),window.clearInterval(ye),oe==null||oe.leave()}},[u]),x.useEffect(()=>{const L=setInterval(()=>{const O=Date.now();yl(O);const{changed:ne,forgotten:oe}=o7(l.current,O);oe.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:oe})}).catch(()=>{}),m(ye=>r7(ye,l.current.agents)),w(ye=>ye!=null&&!l.current.agents.has(ye)?null:ye),T(ye=>ye!=null&&!l.current.agents.has(ye)?null:ye),E(ye=>ye!=null&&!l.current.agents.has(ye)?null:ye),ne&&u()},250);return()=>clearInterval(L)},[u]);const Ya=x.useRef(null),Jn=x.useRef(0),Xa=420,Mn=x.useCallback((L=500)=>{const O=dx,ne=1,oe=.2,ye=hx;try{const Se=document.querySelector(".canvas-wrap"),De=Array.from(document.querySelectorAll(".react-flow__node")).filter(vt=>vt.offsetWidth>0);if(!Se||De.length===0)return;const Ge=Se.getBoundingClientRect(),rt=e.getViewport();if(!Number.isFinite(rt.zoom)||rt.zoom<=0)return;const Ke=vt=>(vt-Ge.left-rt.x)/rt.zoom,jt=vt=>(vt-Ge.top-rt.y)/rt.zoom,Ft=De.map(vt=>vt.getBoundingClientRect()),Ss=Math.min(...Ft.map(vt=>Ke(vt.left))),fo=Math.max(...Ft.map(vt=>Ke(vt.right))),lr=Math.min(...Ft.map(vt=>jt(vt.top))),po=Math.max(...Ft.map(vt=>jt(vt.bottom))),js=fo-Ss,ha=po-lr;if(!(js>0&&ha>0))return;const Vl=f2(Se),Es=vt=>Math.max(oe,Math.min(ne,(Ge.width-Vl-O*2)/(js+vt)*ye,(Ge.height-O*2)/ha*ye)),Fn=pG(Es(Xa),Es(0)),ft={x:O-Ss*Fn,y:Math.max(O,(Ge.height-ha*Fn)/2)-lr*Fn,zoom:Fn},bt=++Yt.current;bn(ft,L),Jn.current=Date.now(),ys.current=$d({durationMs:L,documentHidden:document.hidden})?{target:ft,until:Date.now()+L+60}:null,window.setTimeout(()=>{var vt;try{if(((vt=ys.current)==null?void 0:vt.target)===ft&&(ys.current=null),Yt.current!==bt)return;const Zt=e.getViewport();(Math.abs(Zt.zoom-Fn)>.01||Math.abs(Zt.x-ft.x)>2)&&bn(ft,0)}catch{}},L+60)}catch{}},[e,bn]);x.useEffect(()=>{const L=()=>{if(!document.hidden)return;const O=ys.current;if(ys.current=null,!(!O||Date.now()>O.until)){try{bn(O.target,0)}catch{}Jn.current=Date.now()}};return document.addEventListener("visibilitychange",L),()=>document.removeEventListener("visibilitychange",L)},[bn]);const jl=x.useRef(""),El=x.useRef(null),lu=x.useRef(0),ta=x.useCallback(()=>{lu.current=Date.now()},[]),Cl=x.useRef(null),cu=x.useRef(0),Tl=x.useCallback(()=>{cu.current=Date.now()},[]),Al=x.useCallback(L=>({hasSourceEvent:!!L,at:Date.now(),lastDeckFitAt:Jn.current,lastCanvasInputAt:cu.current}),[]),ef="agent-dag.autoFitDisabled",ns=x.useRef(!1),[Rl,uu]=x.useState(!1);x.useEffect(()=>{try{window.localStorage.removeItem(ef)}catch{}},[]);const Za=x.useCallback(()=>{ns.current||(ns.current=!0,uu(!0))},[]),du=x.useCallback(()=>{ns.current=!1,uu(!1),Mn(400)},[e,Mn]);x.useEffect(()=>{const L=setInterval(()=>{if(ns.current||Date.now()-lu.current<800)return;const O=l.current,ne=Date.now(),oe=[];for(const Se of O.agents.values())Jx(Se,ne)&&oe.push({id:Se.id});if(oe.length===0)return;const ye=[];for(const{id:Se}of oe){const De=Ar.current.get(Se),Ge=Tt.current.get(Se)??Xt.current.get(Se);!De||!Ge||ye.push({x:Ge.x,y:Ge.y,width:De.width,height:De.height})}lG({pane:Cl.current,viewport:e.getViewport(),boxes:ye})&&Mn(600)},1500);return()=>clearInterval(L)},[e]);const na=x.useRef(!1),Ar=x.useRef(new Map),Ml=x.useRef(0),tf=x.useCallback(L=>{const O=Ar.current;let ne=!1;for(const oe of L.nodeInternals.values()){const ye=oe.width,Se=oe.height;if(ye==null||Se==null)continue;const De=O.get(oe.id);De?(Math.abs(De.height-Se)>4||Math.abs(De.width-ye)>4)&&(O.set(oe.id,{width:ye,height:Se}),ne=!0):(O.set(oe.id,{width:ye,height:Se}),ne=!0)}return ne&&(Ml.current+=1),Ml.current},[]),Il=pt(tf),[hu,nf]=x.useState(0);x.useEffect(()=>{let L=0;const O=()=>{const oe=Ar.current;let ye=!1;for(const Se of document.querySelectorAll(".react-flow__node[data-id]")){const De=Se.getAttribute("data-id");if(!De)continue;const Ge=Se.offsetWidth,rt=Se.offsetHeight;if(!Ge||!rt)continue;const Ke=oe.get(De);(!Ke||Math.abs(Ke.width-Ge)>4||Math.abs(Ke.height-rt)>4)&&(oe.set(De,{width:Ge,height:rt}),ye=!0)}ye&&nf(Se=>Se+1)};if(na.current)return;let ne=0;return document.visibilityState==="hidden"?ne=window.setTimeout(O,32):L=requestAnimationFrame(O),()=>{cancelAnimationFrame(L),window.clearTimeout(ne)}});const Xt=x.useRef(iu.positions),fu=x.useRef(new Set),ti=x.useRef(""),ra=x.useMemo(()=>{const L=[];for(const O of l.current.agents.values())Jx(O,Ht)&&L.push(O.id+(O.parentId?`>${O.parentId}`:""));return L.sort(),`${L.join("|")}#sv${Il}.${hu}`},[l.current,l.current.revision,Ht,Il,hu]),Qa=x.useRef(null);x.useEffect(()=>(Qa.current!=null&&window.clearTimeout(Qa.current),Qa.current=window.setTimeout(()=>{Ld(Xt.current,Tt.current)},1500),()=>{Qa.current!=null&&window.clearTimeout(Qa.current)}),[ra]),x.useEffect(()=>{if(jl.current===ra)return;const L=jl.current;if(jl.current=ra,!L||ns.current)return;Date.now()-Jn.current>1200&&Mn(400),Ya.current&&window.clearTimeout(Ya.current),Ya.current=window.setTimeout(()=>{ns.current||Mn(500)},280)},[ra,e,Mn]);const Ja=x.useMemo(()=>SV(l.current,h),[l.current,l.current.revision,h]),ws=x.useMemo(()=>GV(l.current,Ht),[l.current,l.current.revision,Ht]),vs=x.useRef(null),[sa,$l]=x.useState({w:0,h:0});x.useEffect(()=>{const L=vs.current;if(!L||typeof ResizeObserver>"u")return;const O=new ResizeObserver(ne=>{var ye;const oe=(ye=ne[0])==null?void 0:ye.contentRect;oe&&(Cl.current={width:oe.width,height:oe.height},$l(Se=>Math.abs(Se.w-oe.width)>40||Math.abs(Se.h-oe.height)>40?{w:oe.width,h:oe.height}:Se))});return O.observe(L),Cl.current={width:L.clientWidth,height:L.clientHeight},$l({w:L.clientWidth,h:L.clientHeight}),()=>O.disconnect()},[]);const pu=x.useCallback(L=>{var ne,oe;const O=L.target;!(O!=null&&O.closest)||O.closest(GG)!==L.currentTarget||(L.preventDefault(),(oe=(ne=document.activeElement)==null?void 0:ne.blur)==null||oe.call(ne))},[]),mu=x.useRef(new Map),[eo,aa]=x.useState(!1);x.useEffect(()=>{const L=window.setTimeout(()=>aa(!0),2500);return()=>window.clearTimeout(L)},[]);const[rf,Ol]=x.useState(!1),rs=x.useRef(null),[oa,Pl]=x.useState(!1),[to,no]=x.useState("detail"),xs=x.useRef(null),ia=x.useRef(null),sf=x.useCallback(()=>{var oe;const L=Ml.current;if(((oe=ia.current)==null?void 0:oe.version)===L)return ia.current.card;const O=[];for(const ye of l.current.agents.keys()){const Se=Ar.current.get(ye);Se&&O.push(Se)}const ne=uG(O);return ia.current={version:L,card:ne},ne},[]),gu=x.useCallback(()=>{rs.current&&(window.clearTimeout(rs.current),rs.current=null),Ol(!1)},[]),Ll=x.useCallback(L=>{L.length!==0&&queueMicrotask(()=>{Ol(!0),rs.current&&window.clearTimeout(rs.current),rs.current=window.setTimeout(()=>Ol(!1),KG+80)})},[]);x.useEffect(()=>()=>{rs.current&&window.clearTimeout(rs.current)},[]);const sn=y?l.current.agents.get(y):null,Dl=f&&sn!=null,[ni,yu]=x.useState(0);x.useEffect(()=>{const L=f2(vs.current);yu(O=>Math.abs(O-L)>40?L:O)},[Z,z,V,Dl,sa.w]);const Fl=x.useRef(ni);Fl.current=ni;const ri=sa.w>0?Math.max(0,(sa.w-ni-dx*2)*hx):0,si=sa.h>0?Math.max(0,(sa.h-dx*2)*hx):0,af=nD(),{nodes:ss,edges:Ln}=x.useMemo(()=>u7(l.current,Ht,ri,si,Tt.current,Ar.current,mu.current,Ll,eo,oa,Xt.current,fu.current,ra,ti,h,Ja,ws,R),[l.current,l.current.revision,Ht,ri,si,eo,oa,ra,h,Ja,ws,R,Wa,af]),ro=x.useState(aK)[0],ql=x.useRef(ro);x.useEffect(()=>{if(!eo||oa)return;const L={width:ri,height:si};if(!(L.width>0&&L.height>0))return;const O=ql.current;if(ql.current=L,oK(L),!O||O.width===L.width&&O.height===L.height)return;const ne={direction:"LR",pinned:Tt.current,measured:Ar.current,lanes:Gx(l.current)};if(!UU(ss,Ln,ne,O,L))return;const oe=Tr.current&&Date.now()-Tr.current.at<1500?Tr.current.id:null,ye=oe??Ns.current,Se=ye?Tt.current.get(ye)??Xt.current.get(ye):void 0;for(const De of Array.from(Xt.current.keys()))Tt.current.has(De)||Xt.current.delete(De);fu.current.clear(),ti.current="",u(),window.setTimeout(()=>{if(Ld(Xt.current,Tt.current),ns.current){if(oe){Jo.current(oe);return}const De=ye?Tt.current.get(ye)??Xt.current.get(ye):void 0;if(Se&&De&&(De.x!==Se.x||De.y!==Se.y)){const Ge=e.getViewport();Yt.current+=1,bn({x:Ge.x-(De.x-Se.x)*Ge.zoom,y:Ge.y-(De.y-Se.y)*Ge.zoom,zoom:Ge.zoom},0),Jn.current=Date.now()}return}Mn(500)},80)},[ri,si,eo,oa,u,Mn,e,bn]);const Bl=x.useMemo(()=>{const L=new Map;for(const ne of ss){const oe=ne.data;if(!(oe!=null&&oe.sessionId)||oe.exitAt!=null)continue;const ye=ne.width,Se=ne.height;if(ye==null||Se==null)continue;const De=ne.position.x,Ge=ne.position.y,rt=De+ye,Ke=Ge+Se,jt=L.get(oe.sessionId);jt?(jt.minX=Math.min(jt.minX,De),jt.minY=Math.min(jt.minY,Ge),jt.maxX=Math.max(jt.maxX,rt),jt.maxY=Math.max(jt.maxY,Ke)):L.set(oe.sessionId,{minX:De,minY:Ge,maxX:rt,maxY:Ke})}const O=[];for(const[ne,oe]of L){const ye=oe.maxX-oe.minX+Od*2,Se=oe.maxY-oe.minY+Od*2;O.push({id:`group:${ne}`,type:fI,position:{x:oe.minX-Od,y:oe.minY-Od},data:{sessionId:ne,w:ye,h:Se},width:ye,height:Se,style:{width:ye,height:Se},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return O},[ss]),wu=x.useMemo(()=>{const L=[...Bl,...ss],O=Gs.current;return!O||O.size===0?L:L.map(ne=>{const oe=O.get(ne.id);return oe?{...ne,position:oe}:ne})},[Bl,ss,gl]),so=x.useMemo(()=>{const L=new Set;for(const O of l.current.agents.values())for(const ne of O.tools)L.add(AI(ne.name));return Object.keys(TI).filter(O=>L.has(O))},[l.current,l.current.revision]);x.useEffect(()=>{if(so.length<=1){Go(!1);return}let L=0;const O=()=>{const ne=au.current;if(ne&&!document.hidden){const oe=ne.getBoundingClientRect(),ye=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(De=>De.getBoundingClientRect()),Se=YV(oe,ye,8);Go(De=>De===Se?De:Se)}L=window.setTimeout(O,300)};return O(),()=>window.clearTimeout(L)},[so.length]);const zl=x.useCallback(L=>{Jh(O=>{const ne=new Set(O);return ne.has(L)?ne.delete(L):ne.add(L),ne})},[]),Hl=_?D5(l.current.agents,_):null,vu=x.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}l.current=Mx(),Tt.current.clear(),Ar.current.clear(),Xt.current.clear(),ti.current="",w2(),b(),u()},[u,b]),bs=x.useRef($);bs.current=$;const ai=x.useRef(B);ai.current=B;const ks=x.useRef(!1);ks.current=Hl!=null||xt||C!=null||G||S!=null||Us||B||Je!=null;const la=x.useCallback(L=>{const O=m7(L,{confirmOpen:bs.current,modalOpen:ks.current});O==="confirm"?H(!0):O==="clear"&&(H(!1),vu())},[vu]),oi=x.useCallback(()=>{Tt.current.clear(),Xt.current.clear(),ti.current="",w2(),u(),window.setTimeout(()=>Mn(500),80)},[u,e,Mn]),ao=x.useCallback(()=>Mn(500),[Mn]),Dn=x.useRef(ss);Dn.current=ss;const kn=x.useCallback(L=>{var jt;const O=vs.current,ne=l.current.agents.get(L);if(!O||!ne)return;const oe=Gx(l.current),ye=(Ft,Ss)=>{const fo=Ar.current.get(Ft.id);if(!fo)return null;const lr=Ss&&oe.has(Ft.id)?Xa:0;return{x:Ft.position.x,y:Ft.position.y,width:fo.width+lr,height:fo.height}},Se=Dn.current.find(Ft=>Ft.id===L),De=Se?ye(Se,!1):null;if(!De)return;const Ge=[];for(const Ft of Dn.current){if(Ft.type!=="agent"&&Ft.type!=="recapNote"||((jt=Ft.data)==null?void 0:jt.sessionId)!==ne.sessionId)continue;const Ss=ye(Ft,Ft.type==="agent");Ss&&Ge.push(Ss)}const rt=O.getBoundingClientRect(),Ke=yG({pane:{width:rt.width,height:rt.height},insets:{top:56,left:72,bottom:32,right:Fl.current+32},context:wG(Ge)??De,anchor:De});ja(),Za(),Tr.current={id:L,at:Date.now()},Yt.current+=1,bn(Ke,fx),Jn.current=Date.now(),ys.current=$d({durationMs:fx,documentHidden:document.hidden})?{target:Ke,until:Date.now()+fx+60}:null},[bn,Za]);Jo.current=kn;const xu=x.useCallback(L=>{const O=Dn.current.find(ne=>ne.id===L&&ne.type==="agent");return O?O.data:void 0},[]),ii=x.useCallback(L=>{var O;return(O=l.current.agents.get(L))==null?void 0:O.label},[]),bu=x.useCallback(L=>{var oe;const O=Dn.current.find(ye=>ye.id===L&&ye.type==="recapNote");if(!O)return;const ne=O.data;return{recap:ne.recap,hue:ne.hue,sessionLabel:(oe=l.current.agents.get(ne.parentId))==null?void 0:oe.label}},[]),ku=x.useCallback(()=>{var ne;const L=(ne=vs.current)==null?void 0:ne.getBoundingClientRect(),O=document.documentElement;return L?{width:L.right-Fl.current,height:L.bottom}:{width:O.clientWidth,height:O.clientHeight}},[]),Ns=x.useRef(y);Ns.current=y;const oo=x.useCallback(L=>{const O=Dn.current.filter(Se=>Se.type==="agent"),ne=vV(O.map(Se=>({id:Se.id,x:Se.position.x,y:Se.position.y})),Ns.current,L),oe=ne?O.find(Se=>Se.id===ne):void 0;if(!oe)return;const ye=ux(document.activeElement);j(oe.id,!1),window.setTimeout(()=>{try{kn(oe.id)}catch{}ye&&VG(oe.id)},30)},[j,kn]),li=x.useRef(null),_s=x.useCallback(L=>{j(L,!1),window.setTimeout(()=>{try{kn(L)}catch{}},60)},[j,kn]),Rr=x.useRef(null);x.useEffect(()=>{let L=-1/0;const O=()=>{L=performance.now()},ne=oe=>{Rr.current=performance.now()-L<250?oe.target:null};return window.addEventListener("pointerdown",O,!0),window.addEventListener("focusin",ne,!0),()=>{window.removeEventListener("pointerdown",O,!0),window.removeEventListener("focusin",ne,!0)}},[]),x.useEffect(()=>{const L=O=>{var Ge,rt;const ne=O.target,oe={tagName:ne==null?void 0:ne.tagName,isContentEditable:ne==null?void 0:ne.isContentEditable,role:(Ge=ne==null?void 0:ne.getAttribute)==null?void 0:Ge.call(ne,"role"),type:ne==null?void 0:ne.type,pointerFocused:ne!=null&&ne===Rr.current};if(O.key==="Escape"){const Ke=j6({overlayOpen:_c.depth()>0,typing:C0(oe)});Ke==="dismiss"?_c.dismissTop():Ke==="blur"?ne==null||ne.blur():(NV(oe)&&(ne==null||ne.blur()),b());return}if(Eh(O))return;const ye=ux(ne)?(rt=ne==null?void 0:ne.getAttribute)==null?void 0:rt.call(ne,"data-id"):null,Se=ye&&Dn.current.some(Ke=>Ke.id===ye)?ye:null,De=bV(O,Se);if(De.kind==="activate"){O.preventDefault(),j(De.nodeId,De.additive);return}if(De.kind!=="node"&&!(De.nodeId==null&&O6(oe,O.key))&&!P6({key:O.key,modalOpen:L6({appModal:ks.current,dialogDepth:_c.dialogDepth()}),sheetOpen:ai.current})){if(O.key===" "&&(O.preventDefault(),Ko()),(O.key==="c"||O.key==="C")&&la("shortcut"),(O.key==="r"||O.key==="R")&&oi(),(O.key==="f"||O.key==="F")&&ao(),(O.key==="z"||O.key==="Z")&&Ns.current&&kn(Ns.current),(O.key==="l"||O.key==="L")&&St(),O.key==="d"||O.key==="D")if(Ns.current)p(Ke=>!Ke);else{const Ke=Ap(l.current.agents.values());Ke.length>0?_s(Ke[0].id):oo(1)}if((O.key==="h"||O.key==="H")&&wt(Ke=>!Ke),(O.key==="u"||O.key==="U")&&I(Ke=>!Ke),(O.key==="a"||O.key==="A")&&yn.current.claude&&Sr(),(O.key==="j"||O.key==="J")&&oo(1),(O.key==="k"||O.key==="K")&&oo(-1),O.key==="w"||O.key==="W"){const Ke=g6(Ap(l.current.agents.values()),li.current);Ke&&(li.current=Ke.id,_s(Ke.id))}(O.key==="t"||O.key==="T")&&Yo(Ke=>Ke==="dark"?"light":"dark"),(O.key==="m"||O.key==="M")&&yn.current.claude&&_e.current!==null&&pe.current(O.shiftKey),(O.key==="s"||O.key==="S")&&W(Ke=>!Ke),(O.key==="b"||O.key==="B")&&ms(Ke=>!Ke),(O.key==="v"||O.key==="V")&&yn.current.claude&&_e.current!==null&&He(Ke=>!Ke),O.key==="?"&&P(Ke=>!Ke)}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[la,oi,ao,b,j,oo,_s,kn,Ko]);const ci=l.current.agents.size,Wt=x.useMemo(()=>Ap(l.current.agents.values()),[l.current,l.current.revision]),Nu=x.useMemo(()=>y6(l.current.agents.values()),[l.current,l.current.revision]),_u=x.useRef(null);x.useEffect(()=>{const L=DV({waiting:Wt.length,running:Nu,connected:tt}),O=_u.current;if(_u.current=L,(O==null?void 0:O.title)!==L.title&&(document.title=L.title),(O==null?void 0:O.icon)!==L.icon){const ne=document.querySelector('link[rel="icon"]');ne&&(ne.href=FV[L.icon])}},[Wt.length,Nu,tt]);const[io,of]=x.useState(""),Wl=BV(Wt);x.useEffect(()=>{of(L=>zV(L,Wl))},[Wl]);const[lo,Nt]=x.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Mr,ca]=x.useState(null),[as,ui]=x.useState(!1),[Ul,ua]=x.useState(!1);x.useEffect(()=>{let L=!0;return fetch("/api/prefs").then(O=>O.ok?O.json():null).then(O=>{var ne,oe,ye;if(!(!L||!(O!=null&&O.ok))){if(!wl.current){let Se=!1;try{Se=window.localStorage.getItem(Pd)==="0",window.localStorage.removeItem(Pd)}catch{}Se&&((ne=O.prefs)==null?void 0:ne.autoUpdate)!==!1?(Va(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):Va(((oe=O.prefs)==null?void 0:oe.autoUpdate)!==!1)}ui(((ye=O.prefs)==null?void 0:ye.notifications)===!0),ua(O.notificationsVetoed===!0)}}).catch(()=>{}),()=>{L=!1}},[]);const co=x.useRef(()=>{}),da=x.useCallback(()=>{const L=!as;ui(L),L&&typeof Notification<"u"&&Notification.permission==="default"&&co.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:L})}).then(O=>O.ok?O.json():null).then(O=>{var ne;O!=null&&O.ok&&(ui(((ne=O.prefs)==null?void 0:ne.notifications)===!0),ua(O.notificationsVetoed===!0))}).catch(()=>{})},[as]),Su=typeof Notification<"u";x.useEffect(()=>{if(!Mr)return;const O=setTimeout(()=>ca(null),Mr==="blocked"?8e3:4e3);return()=>clearTimeout(O)},[Mr]);const ju=x.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(L=>{const O=L;Nt(O),O==="granted"?ca("on"):O==="denied"&&ca("blocked")})},[]);co.current=ju;const uo=x.useRef(new Set),di=x.useRef(null),hi=Wt.map(L=>jh(L.id,L.waiting)).join("|");x.useEffect(()=>{b6(di.current,lo)&&(di.current=lo,uo.current=Rp(Wt))},[lo]);const ho=x.useRef(!1);return x.useEffect(()=>{k6(ho.current,Ka)&&(ho.current=!0,uo.current=Rp(Wt))},[Ka]),x.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!N6(di.current,Ka))return;const L=typeof document>"u"||!document.hidden,O=v6(Wt,uo.current,L,as);for(const ne of O)try{const oe=new Notification(ne.title,{body:ne.body,tag:ne.key});oe.onclick=()=>{window.focus(),_s(ne.sessionId),oe.close()}}catch{}uo.current=L?Rp(Wt):x6(Wt,O,uo.current)},[hi,Ka]),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:nn}),he?i.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Mt(),_r()},"aria-haspopup":"dialog","aria-label":EG({...he,open:Tn}),title:he.kind==="restart"?`Running v${he.from}; v${he.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${he.from}; v${he.to} is on npm · click for what's new`,children:["v",he.from,i.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const L={running:dn,latest:ce==null?void 0:ce.latest,latestPending:ce==null?void 0:ce.latestPending,checkedAgo:ce!=null&&ce.checkedAt?Hd(Ht-ce.checkedAt):null,checkFailedAgo:ce!=null&&ce.checkFailedAt&&ce.checkFailedAt>(ce.checkedAt??0)?Hd(Ht-ce.checkFailedAt):null,checkDisabled:ce==null?void 0:ce.checkDisabled,checking:Kt};return i.jsxs("button",{type:"button",className:Kt?"v checking":"v",onClick:()=>{Mt(),_t(!0)},"aria-busy":Kt||void 0,"aria-haspopup":"dialog","aria-label":jG(L),title:SG(L),children:["v",L.running]})})()]}),i.jsx("span",{className:"status",children:(()=>{const L=BG({connected:tt,paused:Ys,held:Xn.size,dropped:Xn.dropped});return L.resting?null:i.jsx("span",{className:`pill ${L.tone}`,title:L.title,children:i.jsxs("span",{className:"pill-box",children:[i.jsx("span",{className:"pill-widest","aria-hidden":!0,children:L.widest}),i.jsx("span",{className:"pill-label",children:L.label})]})})})()}),i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:io}),Wt.length>0&&i.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{li.current=Wt[0].id,_s(Wt[0].id)},title:`Blocked waiting for you — click, or press W, to go to the one that has been stuck longest:
|
|
291
|
+
${Wt.map(L=>` ${L.label}: ${sl(L.waiting)} (${Hd(Ht-L.waiting.since)})`).join(`
|
|
292
|
+
`)}`,"aria-label":`${Wt.length} session${Wt.length===1?"":"s"} waiting for you`,children:[i.jsx("span",{className:"ap-pulse","aria-hidden":!0}),i.jsx("b",{children:Wt.length})," ",i.jsx("span",{className:"ws-word",children:"waiting"})]}),Mr&&i.jsx("span",{className:Mr==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:Mr==="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:Mr==="on"?"notifications on":"notifications blocked"})]}),sn&&(()=>{const L=Kn(sn),O=Math.max(0,((sn.endedAt??Ht)-sn.startedAt)/1e3),ne=sn.state==="active"?S0(L.total,O):null,oe=h.size-1;return i.jsxs("button",{type:"button",className:"selected-ribbon",title:`Zoom to ${sn.label} and its session (Z)`,onClick:()=>{try{kn(sn.id)}catch{}},children:[i.jsx("span",{className:`state-pill state-${sn.state}`,children:sn.state==="active"?"live":sn.state}),i.jsx("span",{className:"selected-label",children:sn.label}),L.total>0&&i.jsxs("span",{className:"selected-cost",children:[kt(L.total),ne?i.jsxs("span",{className:"selected-rate",children:[" · ",ne]}):null]}),oe>0&&i.jsxs("span",{className:"selected-extra",children:["+",oe]}),i.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:ye=>{ye.stopPropagation(),b()},children:"×"})]})})(),i.jsxs("div",{className:"actions",children:[i.jsxs("div",{className:"action-run",children:[i.jsxs("button",{className:"btn icon-btn",onClick:St,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(L=>!L),title:`${V?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":V,"aria-controls":V?"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:()=>wt(L=>!L),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:[zt.claude&&i.jsxs("button",{className:"btn icon-btn",onClick:Sr,title:`${F?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":F,"aria-controls":F?"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:()=>W(L=>!L),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:()=>ms(L=>!L),title:Yr?"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, ${Yr?"watching":"not watching"}`+(Xr>0?`, ${Xr} 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"}),Yr||Xr>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"}),Xr>0&&i.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Xr})]})]}),i.jsxs("div",{className:"action-run action-run-utility",children:[zt.claude&&U!==null&&i.jsxs("div",{className:"sound-slot",children:[i.jsxs("button",{ref:it,className:"btn icon-btn",onClick:()=>He(L=>!L),...Aa(!1),title:OG(zt,{on:U===!0,locked:Ze==="locked",prefs:Pe}),"aria-label":`Sound settings, ${U?"on":"off"}`,"aria-haspopup":"dialog","aria-expanded":Ne,"aria-controls":Ne?"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"}),U?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"})]}),Ne&&i.jsx(U7,{onClose:()=>He(!1),soundOn:U===!0,onToggleSound:de,prefs:Pe,onLevel:(L,O)=>Ce(L,{level:O}),onFigure:(L,O)=>Ce(L,{figure:O}),onPreview:L=>et(L),notifyOn:as,onToggleNotify:da,notifyVetoed:Ul,notifyPermission:Su?lo:"unsupported",onAskNotify:ju,openerRef:it})]}),i.jsxs("div",{className:"appearance-slot",children:[i.jsx("button",{ref:be,className:"btn icon-btn",onClick:()=>{He(!1),le(L=>!L)},title:"Appearance settings","aria-label":`Appearance settings, ${Js} theme, character ${es?"shown":"hidden"}`,"aria-haspopup":"dialog","aria-expanded":ot,"aria-controls":ot?"appearance-menu":void 0,children:Js==="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"})})}),ot&&i.jsx(K7,{theme:Js,onTheme:Yo,characterEnabled:es,onToggleCharacter:()=>_l(L=>!L),onClose:()=>le(!1),openerRef:be})]})]})]})]}),Xs?i.jsxs("div",{className:"ver-banner done",role:"status",children:[i.jsx("span",{className:"ver-dot"}),i.jsxs("strong",{children:["Restarted — now running v",Xs,"."]}),i.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Sl&&!tt?i.jsxs("div",{className:"conn-banner",role:"alert",children:[i.jsx("span",{className:"conn-dot"}),Zn?Zr==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${nn}…`:(()=>{const L=FG({connected:tt,paused:Ys});return i.jsxs(i.Fragment,{children:[`Lost connection to the ${nn} server. Reconnecting…`,L&&i.jsx("span",{className:"conn-sub",children:L})]})})()]}):Tn&&he?i.jsxs("div",{className:`ver-banner ${he.kind}`,role:"status",children:[i.jsx("span",{className:`ver-dot${Nl==null?"":" armed"}`}),he.kind==="restart"?i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:["v",he.to," is installed — this deck still runs v",he.from,"."]}),ce!=null&&ce.canRestart?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"ver-act",onClick:()=>Er(),...Aa(Zn),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
293
|
+
|
|
294
|
+
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:Zn?"restarting…":Ga.label}),!Zn&&i.jsx("span",{className:"ver-sub",children:Ga.clause}),i.jsxs("label",{className:"ver-auto",children:[i.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":jr,onClick:vl,"aria-label":"Auto-restart when idle",title:jr?"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:xz(jr,Nl)})]})]}):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:[nn," v",he.to," is out — you are on v",he.from,"."]}),(ce==null?void 0:ce.upgradeMode)==="install"&&Le!=="failed"&&i.jsx("button",{type:"button",className:"ver-act",onClick:ct,...Aa(Le==="running",Le==="done"),title:`Runs ${((pi=ce==null?void 0:ce.upgrade)==null?void 0:pi.command)??(ce==null?void 0:ce.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Le==="running"?"installing…":Le==="done"?"installed":"Update now"}),(ce==null?void 0:ce.upgradeMode)==="npx"&&(ce==null?void 0:ce.canRestart)&&i.jsx("button",{type:"button",className:"ver-act",onClick:()=>Er({upgrade:!0}),...Aa(Zn),title:`Runs ${ce==null?void 0:ce.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Zn?"fetching…":Le==="failed"?"Retry update":"Update & restart"}),Le==="failed"?i.jsxs("span",{className:"ver-sub fail",title:((mi=ce==null?void 0:ce.upgrade)==null?void 0:mi.error)??"",children:[(ce==null?void 0:ce.upgradeMode)==="npx"?"update failed":"install failed",": ",((gi=ce==null?void 0:ce.upgrade)==null?void 0:gi.error)??"unknown error"," — run it yourself:"]}):(ce==null?void 0:ce.upgradeMode)==="npx"?i.jsx("span",{className:"ver-sub",children:ce!=null&&ce.canRestart?"npx cannot upgrade in place, so the deck re-runs:":mx.npx}):ce!=null&&ce.upgradeBlocked?i.jsx("span",{className:"ver-sub",children:Object.hasOwn(mx,ce.upgradeBlocked)?mx[ce.upgradeBlocked]:"cannot install from here"}):null,i.jsxs("button",{type:"button",className:"ver-cmd",onClick:yt,title:"Copy to clipboard",children:[i.jsx("code",{children:ce==null?void 0:ce.command}),i.jsx("span",{className:"ver-cmd-hint",children:Et?"copied":"copy"})]})]}),i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Kr,children:"×"})]}):ee&&vn?i.jsxs("div",{className:"ver-banner",role:"status",children:[i.jsx("span",{className:"ver-dot"}),i.jsxs("strong",{children:[vn," still works — the deck is called ",nn," now."]}),ce!=null&&ce.renameFix?i.jsx("span",{className:"ver-sub",children:ce.renameFix}):null,i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Ae,children:"×"})]}):null,Mp(ae)&&zt.claude&&i.jsx(fz,{leaving:ae==="leaving",onClose:()=>D(!1)}),M&&i.jsx($F,{state:l.current,now:Ht,selectedIds:h,onSelect:_s,onClose:()=>X(!1)}),i.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${rf?" bubbling":""}${oa?" dragging-any":""}`,"data-lod":to,ref:vs,onMouseDownCapture:pu,onPointerDownCapture:Tl,onPointerUpCapture:Tl,onWheelCapture:Tl,onFocusCapture:L=>{const O=L.target;if(!ux(O)||xs.current==null||xs.current==="detail")return;const ne=O.getAttribute("data-id");ne&&l.current.agents.has(ne)&&O.matches(":focus-visible")&&c2(ne,O,"focus")},onBlurCapture:L=>{var ne,oe;const O=(oe=(ne=L.target).getAttribute)==null?void 0:oe.call(ne,"data-id");O&&ja(O)},children:[ci===0&&(!tt&&Me?i.jsx(gK,{}):i.jsx(yK,{live:tt,everConnected:Sl,providers:zt,workspace:hn,onTour:()=>Q(!0)})),(so.length>1||Qs.size>0)&&i.jsx("div",{ref:au,className:`cat-filter-bar${Qh?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:so.map(L=>{const O=Qs.has(L);return i.jsxs("button",{type:"button",className:`cat-filter${O?" off":""}`,onClick:()=>zl(L),"aria-pressed":!O,title:`${O?"Show":"Hide"} ${gh[L]} tools`,children:[i.jsx(dK,{cat:L}),i.jsx("span",{className:"cat-name",children:gh[L]})]},L)})}),i.jsxs(LA,{nodes:wu,edges:Ln,nodeTypes:WG,edgesFocusable:!1,edgeTypes:UG,fitView:!Cr,fitViewOptions:{padding:.25,duration:$d({durationMs:p2,documentHidden:document.hidden})?p2:0},minZoom:mI,maxZoom:gI,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:(L,O)=>{if(O.type==="sessionGroup"){b();return}const ne=O.type==="recapNote"?O.data.parentId:O.id;j(ne,L.shiftKey,!1),!L.shiftKey&&(f&&p(!1),Dl?window.setTimeout(()=>{try{kn(ne)}catch{}},80):kn(ne))},onPaneClick:()=>{ja(),b()},onNodeDoubleClick:(L,O)=>{if(O.type!=="agent"&&O.type!=="recapNote")return;const ne=O.type==="recapNote"?O.data.parentId:O.id;j(ne,!1),window.setTimeout(()=>{try{kn(ne)}catch{}},80)},onNodeMouseEnter:(L,O)=>{O.type!=="agent"&&O.type!=="recapNote"||na.current||xs.current==null||xs.current==="detail"||c2(O.id,L.currentTarget)},onNodeMouseLeave:(L,O)=>ja(O.id),onMoveStart:L=>{ja(),ix(Al(L))&&(Yt.current+=1),ix(Al(L))&&Za()},onMove:(L,O)=>{var oe,ye;ta(),ix(Al(L))&&Za(),(oe=vs.current)==null||oe.style.setProperty("--zoom",String(O.zoom));const ne=dG(xs.current,O.zoom,sf());ne!==xs.current&&(xs.current=ne,(ye=vs.current)==null||ye.setAttribute("data-lod",ne),no(ne),ne==="detail"&&ja()),El.current&&window.clearTimeout(El.current),El.current=window.setTimeout(()=>lK(O),250)},onNodeDragStart:(L,O)=>{var ne;if(ja(),gu(),na.current=!0,Gs.current=new Map,Pl(!0),ta(),Za(),O.type==="sessionGroup"){const oe=(ne=O.data)==null?void 0:ne.sessionId,ye=new Map;if(oe)for(const Se of ss){const De=Se.data;(De==null?void 0:De.sessionId)===oe&&ye.set(Se.id,{x:Se.position.x,y:Se.position.y})}Jr.current={start:{x:O.position.x,y:O.position.y},members:ye};return}Tt.current.set(O.id,{x:O.position.x,y:O.position.y})},onNodeDrag:(L,O)=>{var ne;if(ta(),O.type==="sessionGroup"){const oe=Jr.current;if(!oe)return;const ye=O.position.x-oe.start.x,Se=O.position.y-oe.start.y;for(const[Ge,rt]of oe.members){const Ke={x:rt.x+ye,y:rt.y+Se};Tt.current.set(Ge,Ke),Xt.current.set(Ge,Ke)}const De=Gs.current;if(De){for(const[Ge,rt]of oe.members)De.set(Ge,{x:rt.x+ye,y:rt.y+Se});De.set(O.id,{x:O.position.x,y:O.position.y})}Ks(Ge=>Ge+1);return}Tt.current.set(O.id,{x:O.position.x,y:O.position.y}),Xt.current.set(O.id,{x:O.position.x,y:O.position.y}),(ne=Gs.current)==null||ne.set(O.id,{x:O.position.x,y:O.position.y}),Ks(oe=>oe+1)},onNodeDragStop:(L,O)=>{if(ta(),na.current=!1,Gs.current=null,Pl(!1),Ua(ne=>ne+1),O.type==="sessionGroup"){const ne=Jr.current;if(ne){const oe=O.position.x-ne.start.x,ye=O.position.y-ne.start.y;for(const[Se,De]of ne.members){const Ge={x:De.x+oe,y:De.y+ye};Tt.current.set(Se,Ge),Xt.current.set(Se,Ge)}}Jr.current=null,Ld(Xt.current,Tt.current),Ua(oe=>oe+1);return}Tt.current.set(O.id,{x:O.position.x,y:O.position.y}),Xt.current.set(O.id,{x:O.position.x,y:O.position.y}),Ld(Xt.current,Tt.current)},children:[i.jsx(k5,{gap:28,size:1,color:gs["--grid-line"]}),i.jsx(vF,{onFocusSession:kn}),i.jsx(DD,{agents:l.current.agents,visibleAgentIds:ws,positions:Xt.current,pinned:Tt.current,measured:Ar.current,spotlight:Ja,hiddenCategories:Qs,now:Ht,onOpenTool:k}),Rl&&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:du,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]}),i.jsxs(g5,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[i.jsx(gr,{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(gr,{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(gr,{onClick:du,title:Rl?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":Rl?"":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(gr,{"data-group-start":"",onClick:Ko,title:DG({paused:Ys,held:Xn.size,dropped:Xn.dropped}),"aria-label":LG,"aria-pressed":Ys,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(gr,{onClick:oi,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(gr,{"data-group-start":"","data-danger":"",onClick:()=>la("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(gr,{"data-group-start":"",onClick:()=>P(L=>!L),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(c5,{zoomable:!0,pannable:!0,nodeColor:Zo,nodeStrokeWidth:2,maskColor:gs["--minimap-mask"],maskStrokeColor:gs["--line"]}),es&&i.jsx(K9,{})]}),i.jsx(bG,{agentFor:xu,recapFor:bu,labelFor:ii,bounds:ku})]}),Mp(z)&&i.jsx(fq,{state:l.current,now:Ht,providers:zt,liveSince:Ka,leaving:z==="leaving",onClose:()=>I(!1)}),Mp(Z)&&i.jsx(Vq,{usageOpen:V,leaving:Z==="leaving",onClose:()=>W(!1)}),f&&sn?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(vK,{agent:sn,now:Ht,onOpenTool:k,onShowSummary:E,onExportSession:L=>cK(l.current,L)})]}):null,Hl&&i.jsx(lF,{tool:Hl,onClose:()=>k(null)}),xt&&i.jsx(x.Suspense,{fallback:null,children:i.jsx(zG,{providers:zt,onClose:()=>wt(!1)})}),Us&&i.jsx(x.Suspense,{fallback:null,children:i.jsx(HG,{onClose:()=>ms(!1),onSeen:L=>{Vs(L);try{localStorage.setItem(s2,String(L))}catch{}},onWatching:An,palette:gs})}),C&&(()=>{const L=l.current.agents.get(C);return L?i.jsx(H6,{agent:L,onClose:()=>T(null)}):null})(),S&&i.jsx(RF,{state:l.current,sessionId:S,onClose:()=>E(null)}),Je&&i.jsx(yV,{entries:Je.entries,since:Je.since,firstRun:Je.firstRun,running:dn,onClose:()=>Ct(null),onTour:()=>{Ct(null),Q(!0)},onRestart:ce!=null&&ce.canRestart?()=>{Ct(null),Er()}:void 0}),(()=>{const{request:L,waiting:O}=WV(za,ru.current);return L?i.jsx(UV,{request:L,waiting:O,busy:Vo,now:Date.now(),onAccept:()=>void Ha("accept",L.fp),onDecline:()=>void Ha("dismiss",L.fp),onLater:()=>{Vo||(ru.current.add(L.fp),xn(ne=>[...ne]))}}):null})(),B&&i.jsx(k7,{onClose:()=>P(!1),onTour:()=>{P(!1),Q(!0)}}),G&&i.jsx(FR,{title:"What the deck shows you",steps:G8,onClose:()=>{Q(!1),fV(r2());const L=J.current;J.current=null,L&&Ct(L)}}),$&&i.jsx(v7,{agentCount:ci,onConfirm:()=>la("confirmation"),onCancel:()=>H(!1)})]})}function gK(){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 ",nn," tabs are open"]}),i.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",i.jsx("code",{children:nn})," tabs are holding them. Close one and this tab connects on its own."]})]})}function yK({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:nn}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):wK(n,r),!l&&i.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function wK(e,t){const n=TG(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."]}),$G(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 vK({agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:a}){const l=`${e.synthetic?"≥ ":""}${tl(e.startedAt,e.endedAt,t)}`,c=Kn(e),u=c.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const _ of e.tools){const k=AI(_.name);p.set(k,(p.get(k)??0)+1)}const h=e.tools.filter(_=>_.ok===!1).length,m=e.tools.filter(_=>!_.endedAt).length,y=Array.from(p.entries()).sort((_,k)=>k[1]-_[1]),w=p.has("mcp")?ID(e.tools.map(_=>_.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 _=eR(e);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"hero-sep",children:"·"}),i.jsxs("span",{className:"model-chip","data-family":Sh(e.model),title:_.length>0?`${e.model}
|
|
295
|
+
spend on this panel also covers:
|
|
296
|
+
${_.join(`
|
|
297
|
+
`)}`:e.model,children:[Pa(e.model),_.length>0?` +${_.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:kt(c.total)}),i.jsx("span",{className:"hero-cost-label",children:"spend"})]}),i.jsx($0,{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 _=Ch(e);if(!_)return null;const k=sh(_.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:_.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(([_,k])=>{const j=_==="mcp"?w:null,b=j==null?void 0:j.hue,S=`${k} ${gh[_]} call${k===1?"":"s"}`;return i.jsxs("span",{className:`cat-chip cat-${_}${b!=null?" mcp-hue":""}`,style:b!=null?{"--mcp-hue":b}:void 0,title:j?`${S}, all to ${j.label}`:S,children:[i.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:TI[_]}),i.jsx("span",{className:"cat-name",children:gh[_]}),i.jsx("span",{className:"cat-count",children:k}),j&&i.jsx("span",{className:"cat-server",children:j.label})]},_)})})]})]}),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:mn(e.usage.inputTokens)})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"out"}),i.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:mn(e.usage.outputTokens)})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"cache r"}),i.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:mn(e.usage.cacheReadTokens)})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"cache c"}),i.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:mn(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:HA(e.prompts).length})]}),i.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((_,k)=>{const j=sh(_.at,t),b=k0(_.text);return b?i.jsxs("details",{className:"prompt-entry prompt-injected",children:[i.jsxs("summary",{children:[i.jsx("span",{className:"prompt-time",title:j.title,children:j.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:j.title,children:j.label}),i.jsx("div",{className:"prompt-text",children:_.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(_=>i.jsx(bK,{t:_,onClick:()=>n(_.id)},_.id))})]})]})}const xK={inflight:"in-flight",done:"done",err:"error"};function bK({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",r=nR(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:xK[n]}),e.name]}),i.jsx("span",{style:{color:"var(--muted)"},children:r})]})}try{Y6(window.localStorage)}catch{}const kK=v$.createRoot(document.getElementById("root"));kK.render(i.jsx(hK,{}));export{s2 as S,MG as a,_K as b,Fc as c,mn as d,NK as e,kt as f,Pa as g,Ls as h,al as i,i as j,HV as k,qN as p,x as r,Aa as s,un as u};
|