ccdeck 3.32.1 → 3.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -12
- package/bin/agent-dag.js +6 -0
- package/bin/cli/help.js +2 -0
- package/bin/cli/one-shot.js +32 -13
- package/bin/cli/second-start.js +1 -0
- package/bin/cli/startup.js +34 -0
- package/bin/cli/uninstall.js +47 -2
- package/bin/deck.js +12 -1
- package/dist/web/assets/BrowserWatchModal-B3UjvY82.js +1 -0
- package/dist/web/assets/UsageHistoryModal-DxNI8gR6.js +1 -0
- package/dist/web/assets/index-BIANlQ9A.css +1 -0
- package/dist/web/assets/index-OLDoLpOW.js +299 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +40 -0
- package/src/server/account-projects.mjs +11 -2
- package/src/server/args.mjs +12 -2
- package/src/server/auto-update.mjs +14 -1
- package/src/server/best-of-nostalgia.mjs +2 -1
- package/src/server/block-notify.mjs +114 -11
- package/src/server/browser-history.mjs +81 -4
- package/src/server/browser-presence.mjs +98 -2
- package/src/server/browser-react.mjs +39 -4
- package/src/server/browser-watch-seen.mjs +35 -1
- package/src/server/browser-watch.mjs +105 -18
- package/src/server/cafe-music-bgm.mjs +2 -1
- package/src/server/ccusage-install.mjs +8 -4
- package/src/server/ccusage.mjs +3 -1
- package/src/server/claude-accounts.mjs +38 -16
- package/src/server/codex-dir.mjs +8 -6
- package/src/server/codex-quota.mjs +4 -2
- package/src/server/codex-usage.mjs +93 -38
- package/src/server/codex-watch.mjs +150 -18
- package/src/server/cswap-auto-loop.mjs +15 -2
- package/src/server/cswap-auto-readers.mjs +10 -4
- package/src/server/cswap-auto.mjs +6 -6
- package/src/server/cswap-install.mjs +118 -3
- package/src/server/deck-prefs.mjs +4 -0
- package/src/server/event-pipeline.mjs +3 -0
- package/src/server/event-ring.mjs +2 -2
- package/src/server/good-life-radio.mjs +2 -1
- package/src/server/index.mjs +3 -2
- package/src/server/installer.mjs +62 -12
- package/src/server/lan-beacon.mjs +6 -4
- package/src/server/lan-call.mjs +4 -0
- package/src/server/lan-dials.mjs +10 -1
- package/src/server/lan-engine.mjs +221 -44
- package/src/server/lan-requests.mjs +88 -5
- package/src/server/lan-round-record.mjs +21 -4
- package/src/server/lan-socket.mjs +105 -15
- package/src/server/lan-sync.mjs +18 -4
- package/src/server/lifecycle.mjs +21 -2
- package/src/server/live-radio-mix.mjs +2 -1
- package/src/server/log-replay.mjs +55 -24
- package/src/server/login-service.mjs +38 -3
- package/src/server/metrics-run.mjs +5 -3
- package/src/server/network-sampler.mjs +25 -2
- package/src/server/npm-upgrade.mjs +8 -1
- package/src/server/npx.mjs +32 -5
- package/src/server/process-list.mjs +103 -13
- package/src/server/purge-key.mjs +52 -24
- package/src/server/request-gates.mjs +47 -14
- package/src/server/retire-sound-hook.mjs +56 -9
- package/src/server/ring-bounds.mjs +10 -0
- package/src/server/running-deck.mjs +72 -2
- package/src/server/session-enrichment.mjs +40 -8
- package/src/server/stop-deck.mjs +13 -4
- package/src/server/system-metrics.mjs +2 -2
- package/src/server/transcript-scan.mjs +27 -6
- package/dist/web/assets/BrowserWatchModal-ohP7oQCN.js +0 -1
- package/dist/web/assets/UsageHistoryModal-CNjMaM59.js +0 -1
- package/dist/web/assets/index-DKn7nc15.css +0 -1
- package/dist/web/assets/index-P2zWn3Hw.js +0 -299
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var tu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Af={exports:{}},Ki={},Mf={exports:{}},De={};/**
|
|
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 g1;function IL(){if(g1)return De;g1=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.iterator;function g(P){return P===null||typeof P!="object"?null:(P=m&&P[m]||P["@@iterator"],typeof P=="function"?P:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,x={};function k(P,Y,G){this.props=P,this.context=Y,this.refs=x,this.updater=G||w}k.prototype.isReactComponent={},k.prototype.setState=function(P,Y){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,Y,"setState")},k.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function j(){}j.prototype=k.prototype;function S(P,Y,G){this.props=P,this.context=Y,this.refs=x,this.updater=G||w}var _=S.prototype=new j;_.constructor=S,b(_,k.prototype),_.isPureReactComponent=!0;var E=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function B(P,Y,G){var z,X={},V=null,J=null;if(Y!=null)for(z in Y.ref!==void 0&&(J=Y.ref),Y.key!==void 0&&(V=""+Y.key),Y)T.call(Y,z)&&!A.hasOwnProperty(z)&&(X[z]=Y[z]);var ee=arguments.length-2;if(ee===1)X.children=G;else if(1<ee){for(var re=Array(ee),oe=0;oe<ee;oe++)re[oe]=arguments[oe+2];X.children=re}if(P&&P.defaultProps)for(z in ee=P.defaultProps,ee)X[z]===void 0&&(X[z]=ee[z]);return{$$typeof:e,type:P,key:V,ref:J,props:X,_owner:R.current}}function $(P,Y){return{$$typeof:e,type:P.type,key:Y,ref:P.ref,props:P.props,_owner:P._owner}}function I(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function D(P){var Y={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(G){return Y[G]})}var F=/\/+/g;function W(P,Y){return typeof P=="object"&&P!==null&&P.key!=null?D(""+P.key):Y.toString(36)}function M(P,Y,G,z,X){var V=typeof P;(V==="undefined"||V==="boolean")&&(P=null);var J=!1;if(P===null)J=!0;else switch(V){case"string":case"number":J=!0;break;case"object":switch(P.$$typeof){case e:case t:J=!0}}if(J)return J=P,X=X(J),P=z===""?"."+W(J,0):z,E(X)?(G="",P!=null&&(G=P.replace(F,"$&/")+"/"),M(X,Y,G,"",function(oe){return oe})):X!=null&&(I(X)&&(X=$(X,G+(!X.key||J&&J.key===X.key?"":(""+X.key).replace(F,"$&/")+"/")+P)),Y.push(X)),1;if(J=0,z=z===""?".":z+":",E(P))for(var ee=0;ee<P.length;ee++){V=P[ee];var re=z+W(V,ee);J+=M(V,Y,G,re,X)}else if(re=g(P),typeof re=="function")for(P=re.call(P),ee=0;!(V=P.next()).done;)V=V.value,re=z+W(V,ee++),J+=M(V,Y,G,re,X);else if(V==="object")throw Y=String(P),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return J}function O(P,Y,G){if(P==null)return P;var z=[],X=0;return M(P,z,"","",function(V){return Y.call(G,V,X++)}),z}function L(P){if(P._status===-1){var Y=P._result;Y=Y(),Y.then(function(G){(P._status===0||P._status===-1)&&(P._status=1,P._result=G)},function(G){(P._status===0||P._status===-1)&&(P._status=2,P._result=G)}),P._status===-1&&(P._status=0,P._result=Y)}if(P._status===1)return P._result.default;throw P._result}var K={current:null},Z={transition:null},q={ReactCurrentDispatcher:K,ReactCurrentBatchConfig:Z,ReactCurrentOwner:R};function H(){throw Error("act(...) is not supported in production builds of React.")}return De.Children={map:O,forEach:function(P,Y,G){O(P,function(){Y.apply(this,arguments)},G)},count:function(P){var Y=0;return O(P,function(){Y++}),Y},toArray:function(P){return O(P,function(Y){return Y})||[]},only:function(P){if(!I(P))throw Error("React.Children.only expected to receive a single React element child.");return P}},De.Component=k,De.Fragment=n,De.Profiler=s,De.PureComponent=S,De.StrictMode=r,De.Suspense=d,De.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=q,De.act=H,De.cloneElement=function(P,Y,G){if(P==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+P+".");var z=b({},P.props),X=P.key,V=P.ref,J=P._owner;if(Y!=null){if(Y.ref!==void 0&&(V=Y.ref,J=R.current),Y.key!==void 0&&(X=""+Y.key),P.type&&P.type.defaultProps)var ee=P.type.defaultProps;for(re in Y)T.call(Y,re)&&!A.hasOwnProperty(re)&&(z[re]=Y[re]===void 0&&ee!==void 0?ee[re]:Y[re])}var re=arguments.length-2;if(re===1)z.children=G;else if(1<re){ee=Array(re);for(var oe=0;oe<re;oe++)ee[oe]=arguments[oe+2];z.children=ee}return{$$typeof:e,type:P.type,key:X,ref:V,props:z,_owner:J}},De.createContext=function(P){return P={$$typeof:l,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},P.Provider={$$typeof:i,_context:P},P.Consumer=P},De.createElement=B,De.createFactory=function(P){var Y=B.bind(null,P);return Y.type=P,Y},De.createRef=function(){return{current:null}},De.forwardRef=function(P){return{$$typeof:u,render:P}},De.isValidElement=I,De.lazy=function(P){return{$$typeof:h,_payload:{_status:-1,_result:P},_init:L}},De.memo=function(P,Y){return{$$typeof:f,type:P,compare:Y===void 0?null:Y}},De.startTransition=function(P){var Y=Z.transition;Z.transition={};try{P()}finally{Z.transition=Y}},De.unstable_act=H,De.useCallback=function(P,Y){return K.current.useCallback(P,Y)},De.useContext=function(P){return K.current.useContext(P)},De.useDebugValue=function(){},De.useDeferredValue=function(P){return K.current.useDeferredValue(P)},De.useEffect=function(P,Y){return K.current.useEffect(P,Y)},De.useId=function(){return K.current.useId()},De.useImperativeHandle=function(P,Y,G){return K.current.useImperativeHandle(P,Y,G)},De.useInsertionEffect=function(P,Y){return K.current.useInsertionEffect(P,Y)},De.useLayoutEffect=function(P,Y){return K.current.useLayoutEffect(P,Y)},De.useMemo=function(P,Y){return K.current.useMemo(P,Y)},De.useReducer=function(P,Y,G){return K.current.useReducer(P,Y,G)},De.useRef=function(P){return K.current.useRef(P)},De.useState=function(P){return K.current.useState(P)},De.useSyncExternalStore=function(P,Y,G){return K.current.useSyncExternalStore(P,Y,G)},De.useTransition=function(){return K.current.useTransition()},De.version="18.3.1",De}var y1;function Ll(){return y1||(y1=1,Mf.exports=IL()),Mf.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 w1;function OL(){if(w1)return Ki;w1=1;var e=Ll(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(u,d,f){var h,m={},g=null,w=null;f!==void 0&&(g=""+f),d.key!==void 0&&(g=""+d.key),d.ref!==void 0&&(w=d.ref);for(h in d)r.call(d,h)&&!i.hasOwnProperty(h)&&(m[h]=d[h]);if(u&&u.defaultProps)for(h in d=u.defaultProps,d)m[h]===void 0&&(m[h]=d[h]);return{$$typeof:t,type:u,key:g,ref:w,props:m,_owner:s.current}}return Ki.Fragment=n,Ki.jsx=l,Ki.jsxs=l,Ki}var v1;function LL(){return v1||(v1=1,Af.exports=OL()),Af.exports}var a=LL(),nu={},$f={exports:{}},an={},If={exports:{}},Of={};/**
|
|
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 x1;function PL(){return x1||(x1=1,(function(e){function t(Z,q){var H=Z.length;Z.push(q);e:for(;0<H;){var P=H-1>>>1,Y=Z[P];if(0<s(Y,q))Z[P]=q,Z[H]=Y,H=P;else break e}}function n(Z){return Z.length===0?null:Z[0]}function r(Z){if(Z.length===0)return null;var q=Z[0],H=Z.pop();if(H!==q){Z[0]=H;e:for(var P=0,Y=Z.length,G=Y>>>1;P<G;){var z=2*(P+1)-1,X=Z[z],V=z+1,J=Z[V];if(0>s(X,H))V<Y&&0>s(J,X)?(Z[P]=J,Z[V]=H,P=V):(Z[P]=X,Z[z]=H,P=z);else if(V<Y&&0>s(J,H))Z[P]=J,Z[V]=H,P=V;else break e}}return q}function s(Z,q){var H=Z.sortIndex-q.sortIndex;return H!==0?H:Z.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var d=[],f=[],h=1,m=null,g=3,w=!1,b=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,j=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 _(Z){for(var q=n(f);q!==null;){if(q.callback===null)r(f);else if(q.startTime<=Z)r(f),q.sortIndex=q.expirationTime,t(d,q);else break;q=n(f)}}function E(Z){if(x=!1,_(Z),!b)if(n(d)!==null)b=!0,L(T);else{var q=n(f);q!==null&&K(E,q.startTime-Z)}}function T(Z,q){b=!1,x&&(x=!1,j(B),B=-1),w=!0;var H=g;try{for(_(q),m=n(d);m!==null&&(!(m.expirationTime>q)||Z&&!D());){var P=m.callback;if(typeof P=="function"){m.callback=null,g=m.priorityLevel;var Y=P(m.expirationTime<=q);q=e.unstable_now(),typeof Y=="function"?m.callback=Y:m===n(d)&&r(d),_(q)}else r(d);m=n(d)}if(m!==null)var G=!0;else{var z=n(f);z!==null&&K(E,z.startTime-q),G=!1}return G}finally{m=null,g=H,w=!1}}var R=!1,A=null,B=-1,$=5,I=-1;function D(){return!(e.unstable_now()-I<$)}function F(){if(A!==null){var Z=e.unstable_now();I=Z;var q=!0;try{q=A(!0,Z)}finally{q?W():(R=!1,A=null)}}else R=!1}var W;if(typeof S=="function")W=function(){S(F)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,O=M.port2;M.port1.onmessage=F,W=function(){O.postMessage(null)}}else W=function(){k(F,0)};function L(Z){A=Z,R||(R=!0,W())}function K(Z,q){B=k(function(){Z(e.unstable_now())},q)}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(Z){Z.callback=null},e.unstable_continueExecution=function(){b||w||(b=!0,L(T))},e.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(Z){switch(g){case 1:case 2:case 3:var q=3;break;default:q=g}var H=g;g=q;try{return Z()}finally{g=H}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Z,q){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var H=g;g=Z;try{return q()}finally{g=H}},e.unstable_scheduleCallback=function(Z,q,H){var P=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?P+H:P):H=P,Z){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=H+Y,Z={id:h++,callback:q,priorityLevel:Z,startTime:H,expirationTime:Y,sortIndex:-1},H>P?(Z.sortIndex=H,t(f,Z),n(d)===null&&Z===n(f)&&(x?(j(B),B=-1):x=!0,K(E,H-P))):(Z.sortIndex=Y,t(d,Z),b||w||(b=!0,L(T))),Z},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(Z){var q=g;return function(){var H=g;g=q;try{return Z.apply(this,arguments)}finally{g=H}}}})(Of)),Of}var b1;function DL(){return b1||(b1=1,If.exports=PL()),If.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 k1;function FL(){if(k1)return an;k1=1;var e=Ll(),t=DL();function n(o){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+o,p=1;p<arguments.length;p++)c+="&args[]="+encodeURIComponent(arguments[p]);return"Minified React error #"+o+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,s={};function i(o,c){l(o,c),l(o+"Capture",c)}function l(o,c){for(s[o]=c,o=0;o<c.length;o++)r.add(c[o])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,f=/^[: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 g(o){return d.call(m,o)?!0:d.call(h,o)?!1:f.test(o)?m[o]=!0:(h[o]=!0,!1)}function w(o,c,p,y){if(p!==null&&p.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return y?!1:p!==null?!p.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function b(o,c,p,y){if(c===null||typeof c>"u"||w(o,c,p,y))return!0;if(y)return!1;if(p!==null)switch(p.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function x(o,c,p,y,N,C,U){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=y,this.attributeNamespace=N,this.mustUseProperty=p,this.propertyName=o,this.type=c,this.sanitizeURL=C,this.removeEmptyString=U}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){k[o]=new x(o,0,!1,o,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var c=o[0];k[c]=new x(c,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){k[o]=new x(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){k[o]=new x(o,2,!1,o,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(o){k[o]=new x(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){k[o]=new x(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){k[o]=new x(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){k[o]=new x(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){k[o]=new x(o,5,!1,o.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function S(o){return o[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(o){var c=o.replace(j,S);k[c]=new x(c,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var c=o.replace(j,S);k[c]=new x(c,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var c=o.replace(j,S);k[c]=new x(c,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){k[o]=new x(o,1,!1,o.toLowerCase(),null,!1,!1)}),k.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){k[o]=new x(o,1,!1,o.toLowerCase(),null,!0,!0)});function _(o,c,p,y){var N=k.hasOwnProperty(c)?k[c]:null;(N!==null?N.type!==0:y||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(b(c,p,N,y)&&(p=null),y||N===null?g(c)&&(p===null?o.removeAttribute(c):o.setAttribute(c,""+p)):N.mustUseProperty?o[N.propertyName]=p===null?N.type===3?!1:"":p:(c=N.attributeName,y=N.attributeNamespace,p===null?o.removeAttribute(c):(N=N.type,p=N===3||N===4&&p===!0?"":""+p,y?o.setAttributeNS(y,c,p):o.setAttribute(c,p))))}var E=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),R=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),D=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),K=Symbol.for("react.offscreen"),Z=Symbol.iterator;function q(o){return o===null||typeof o!="object"?null:(o=Z&&o[Z]||o["@@iterator"],typeof o=="function"?o:null)}var H=Object.assign,P;function Y(o){if(P===void 0)try{throw Error()}catch(p){var c=p.stack.trim().match(/\n( *(at )?)/);P=c&&c[1]||""}return`
|
|
34
|
-
`+P+o}var G=!1;function z(o,c){if(!o||G)return"";G=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(le){var y=le}Reflect.construct(o,[],c)}else{try{c.call()}catch(le){y=le}o.call(c.prototype)}else{try{throw Error()}catch(le){y=le}o()}}catch(le){if(le&&y&&typeof le.stack=="string"){for(var N=le.stack.split(`
|
|
35
|
-
`),C=y.stack.split(`
|
|
36
|
-
`),U=N.length-1,Q=C.length-1;1<=U&&0<=Q&&N[U]!==C[Q];)Q--;for(;1<=U&&0<=Q;U--,Q--)if(N[U]!==C[Q]){if(U!==1||Q!==1)do if(U--,Q--,0>Q||N[U]!==C[Q]){var te=`
|
|
37
|
-
`+N[U].replace(" at new "," at ");return o.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",o.displayName)),te}while(1<=U&&0<=Q);break}}}finally{G=!1,Error.prepareStackTrace=p}return(o=o?o.displayName||o.name:"")?Y(o):""}function X(o){switch(o.tag){case 5:return Y(o.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return o=z(o.type,!1),o;case 11:return o=z(o.type.render,!1),o;case 1:return o=z(o.type,!0),o;default:return""}}function V(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case A:return"Fragment";case R:return"Portal";case $:return"Profiler";case B:return"StrictMode";case W:return"Suspense";case M:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case D:return(o.displayName||"Context")+".Consumer";case I:return(o._context.displayName||"Context")+".Provider";case F:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case O:return c=o.displayName||null,c!==null?c:V(o.type)||"Memo";case L:c=o._payload,o=o._init;try{return V(o(c))}catch{}}return null}function J(o){var c=o.type;switch(o.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=c.render,o=o.displayName||o.name||"",c.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return V(c);case 8:return c===B?"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 c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function ee(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function re(o){var c=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function oe(o){var c=re(o)?"checked":"value",p=Object.getOwnPropertyDescriptor(o.constructor.prototype,c),y=""+o[c];if(!o.hasOwnProperty(c)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var N=p.get,C=p.set;return Object.defineProperty(o,c,{configurable:!0,get:function(){return N.call(this)},set:function(U){y=""+U,C.call(this,U)}}),Object.defineProperty(o,c,{enumerable:p.enumerable}),{getValue:function(){return y},setValue:function(U){y=""+U},stopTracking:function(){o._valueTracker=null,delete o[c]}}}}function fe(o){o._valueTracker||(o._valueTracker=oe(o))}function Ne(o){if(!o)return!1;var c=o._valueTracker;if(!c)return!0;var p=c.getValue(),y="";return o&&(y=re(o)?o.checked?"true":"false":o.value),o=y,o!==p?(c.setValue(o),!0):!1}function we(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function ye(o,c){var p=c.checked;return H({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??o._wrapperState.initialChecked})}function ve(o,c){var p=c.defaultValue==null?"":c.defaultValue,y=c.checked!=null?c.checked:c.defaultChecked;p=ee(c.value!=null?c.value:p),o._wrapperState={initialChecked:y,initialValue:p,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function Ie(o,c){c=c.checked,c!=null&&_(o,"checked",c,!1)}function xe(o,c){Ie(o,c);var p=ee(c.value),y=c.type;if(p!=null)y==="number"?(p===0&&o.value===""||o.value!=p)&&(o.value=""+p):o.value!==""+p&&(o.value=""+p);else if(y==="submit"||y==="reset"){o.removeAttribute("value");return}c.hasOwnProperty("value")?se(o,c.type,p):c.hasOwnProperty("defaultValue")&&se(o,c.type,ee(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(o.defaultChecked=!!c.defaultChecked)}function ue(o,c,p){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var y=c.type;if(!(y!=="submit"&&y!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+o._wrapperState.initialValue,p||c===o.value||(o.value=c),o.defaultValue=c}p=o.name,p!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,p!==""&&(o.name=p)}function se(o,c,p){(c!=="number"||we(o.ownerDocument)!==o)&&(p==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+p&&(o.defaultValue=""+p))}var be=Array.isArray;function Te(o,c,p,y){if(o=o.options,c){c={};for(var N=0;N<p.length;N++)c["$"+p[N]]=!0;for(p=0;p<o.length;p++)N=c.hasOwnProperty("$"+o[p].value),o[p].selected!==N&&(o[p].selected=N),N&&y&&(o[p].defaultSelected=!0)}else{for(p=""+ee(p),c=null,N=0;N<o.length;N++){if(o[N].value===p){o[N].selected=!0,y&&(o[N].defaultSelected=!0);return}c!==null||o[N].disabled||(c=o[N])}c!==null&&(c.selected=!0)}}function Le(o,c){if(c.dangerouslySetInnerHTML!=null)throw Error(n(91));return H({},c,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function $e(o,c){var p=c.value;if(p==null){if(p=c.children,c=c.defaultValue,p!=null){if(c!=null)throw Error(n(92));if(be(p)){if(1<p.length)throw Error(n(93));p=p[0]}c=p}c==null&&(c=""),p=c}o._wrapperState={initialValue:ee(p)}}function Oe(o,c){var p=ee(c.value),y=ee(c.defaultValue);p!=null&&(p=""+p,p!==o.value&&(o.value=p),c.defaultValue==null&&o.defaultValue!==p&&(o.defaultValue=p)),y!=null&&(o.defaultValue=""+y)}function Xe(o){var c=o.textContent;c===o._wrapperState.initialValue&&c!==""&&c!==null&&(o.value=c)}function Ge(o){switch(o){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 Ze(o,c){return o==null||o==="http://www.w3.org/1999/xhtml"?Ge(c):o==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var Ve,Ot=(function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,p,y,N){MSApp.execUnsafeLocalFunction(function(){return o(c,p,y,N)})}:o})(function(o,c){if(o.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in o)o.innerHTML=c;else{for(Ve=Ve||document.createElement("div"),Ve.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=Ve.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;c.firstChild;)o.appendChild(c.firstChild)}});function mt(o,c){if(c){var p=o.firstChild;if(p&&p===o.lastChild&&p.nodeType===3){p.nodeValue=c;return}}o.textContent=c}var Pe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},at=["Webkit","ms","Moz","O"];Object.keys(Pe).forEach(function(o){at.forEach(function(c){c=c+o.charAt(0).toUpperCase()+o.substring(1),Pe[c]=Pe[o]})});function Qe(o,c,p){return c==null||typeof c=="boolean"||c===""?"":p||typeof c!="number"||c===0||Pe.hasOwnProperty(o)&&Pe[o]?(""+c).trim():c+"px"}function ot(o,c){o=o.style;for(var p in c)if(c.hasOwnProperty(p)){var y=p.indexOf("--")===0,N=Qe(p,c[p],y);p==="float"&&(p="cssFloat"),y?o.setProperty(p,N):o[p]=N}}var Ft=H({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 bt(o,c){if(c){if(Ft[o]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(n(137,o));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(n(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(n(61))}if(c.style!=null&&typeof c.style!="object")throw Error(n(62))}}function kt(o,c){if(o.indexOf("-")===-1)return typeof c.is=="string";switch(o){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 qt=null;function bn(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Gt=null,Bt=null,dn=null;function Kt(o){if(o=$i(o)){if(typeof Gt!="function")throw Error(n(280));var c=o.stateNode;c&&(c=gc(c),Gt(o.stateNode,o.type,c))}}function rs(o){Bt?dn?dn.push(o):dn=[o]:Bt=o}function $r(){if(Bt){var o=Bt,c=dn;if(dn=Bt=null,Kt(o),c)for(o=0;o<c.length;o++)Kt(c[o])}}function ss(o,c){return o(c)}function ur(){}var qn=!1;function as(o,c,p){if(qn)return o(c,p);qn=!0;try{return ss(o,c,p)}finally{qn=!1,(Bt!==null||dn!==null)&&(ur(),$r())}}function kn(o,c){var p=o.stateNode;if(p===null)return null;var y=gc(p);if(y===null)return null;p=y[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(y=!y.disabled)||(o=o.type,y=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!y;break e;default:o=!1}if(o)return null;if(p&&typeof p!="function")throw Error(n(231,c,typeof p));return p}var dr=!1;if(u)try{var hn={};Object.defineProperty(hn,"passive",{get:function(){dr=!0}}),window.addEventListener("test",hn,hn),window.removeEventListener("test",hn,hn)}catch{dr=!1}function os(o,c,p,y,N,C,U,Q,te){var le=Array.prototype.slice.call(arguments,3);try{c.apply(p,le)}catch(he){this.onError(he)}}var Nn=!1,gt=null,Bn=!1,pe=null,Be={onError:function(o){Nn=!0,gt=o}};function Je(o,c,p,y,N,C,U,Q,te){Nn=!1,gt=null,os.apply(Be,arguments)}function fn(o,c,p,y,N,C,U,Q,te){if(Je.apply(this,arguments),Nn){if(Nn){var le=gt;Nn=!1,gt=null}else throw Error(n(198));Bn||(Bn=!0,pe=le)}}function Ut(o){var c=o,p=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(p=c.return),o=c.return;while(o)}return c.tag===3?p:null}function hr(o){if(o.tag===13){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function Ys(o){if(Ut(o)!==o)throw Error(n(188))}function is(o){var c=o.alternate;if(!c){if(c=Ut(o),c===null)throw Error(n(188));return c!==o?null:o}for(var p=o,y=c;;){var N=p.return;if(N===null)break;var C=N.alternate;if(C===null){if(y=N.return,y!==null){p=y;continue}break}if(N.child===C.child){for(C=N.child;C;){if(C===p)return Ys(N),o;if(C===y)return Ys(N),c;C=C.sibling}throw Error(n(188))}if(p.return!==y.return)p=N,y=C;else{for(var U=!1,Q=N.child;Q;){if(Q===p){U=!0,p=N,y=C;break}if(Q===y){U=!0,y=N,p=C;break}Q=Q.sibling}if(!U){for(Q=C.child;Q;){if(Q===p){U=!0,p=C,y=N;break}if(Q===y){U=!0,y=C,p=N;break}Q=Q.sibling}if(!U)throw Error(n(189))}}if(p.alternate!==y)throw Error(n(190))}if(p.tag!==3)throw Error(n(188));return p.stateNode.current===p?o:c}function Un(o){return o=is(o),o!==null?Wa(o):null}function Wa(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var c=Wa(o);if(c!==null)return c;o=o.sibling}return null}var Va=t.unstable_scheduleCallback,fr=t.unstable_cancelCallback,Ga=t.unstable_shouldYield,Ka=t.unstable_requestPaint,Ke=t.unstable_now,ls=t.unstable_getCurrentPriorityLevel,pr=t.unstable_ImmediatePriority,Ya=t.unstable_UserBlockingPriority,cs=t.unstable_NormalPriority,Xs=t.unstable_LowPriority,Zs=t.unstable_IdlePriority,us=null,Yt=null;function ds(o){if(Yt&&typeof Yt.onCommitFiberRoot=="function")try{Yt.onCommitFiberRoot(us,o,void 0,(o.current.flags&128)===128)}catch{}}var Nt=Math.clz32?Math.clz32:Xl,rh=Math.log,sh=Math.LN2;function Xl(o){return o>>>=0,o===0?32:31-(rh(o)/sh|0)|0}var Js=64,hs=4194304;function Ir(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function jn(o,c){var p=o.pendingLanes;if(p===0)return 0;var y=0,N=o.suspendedLanes,C=o.pingedLanes,U=p&268435455;if(U!==0){var Q=U&~N;Q!==0?y=Ir(Q):(C&=U,C!==0&&(y=Ir(C)))}else U=p&~N,U!==0?y=Ir(U):C!==0&&(y=Ir(C));if(y===0)return 0;if(c!==0&&c!==y&&(c&N)===0&&(N=y&-y,C=c&-c,N>=C||N===16&&(C&4194240)!==0))return c;if((y&4)!==0&&(y|=p&16),c=o.entangledLanes,c!==0)for(o=o.entanglements,c&=y;0<c;)p=31-Nt(c),N=1<<p,y|=o[p],c&=~N;return y}function ah(o,c){switch(o){case 1:case 2:case 4:return c+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 c+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 oh(o,c){for(var p=o.suspendedLanes,y=o.pingedLanes,N=o.expirationTimes,C=o.pendingLanes;0<C;){var U=31-Nt(C),Q=1<<U,te=N[U];te===-1?((Q&p)===0||(Q&y)!==0)&&(N[U]=ah(Q,c)):te<=c&&(o.expiredLanes|=Q),C&=~Q}}function pi(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function mi(){var o=Js;return Js<<=1,(Js&4194240)===0&&(Js=64),o}function mr(o){for(var c=[],p=0;31>p;p++)c.push(o);return c}function Qs(o,c,p){o.pendingLanes|=c,c!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,c=31-Nt(c),o[c]=p}function Zl(o,c){var p=o.pendingLanes&~c;o.pendingLanes=c,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=c,o.mutableReadLanes&=c,o.entangledLanes&=c,c=o.entanglements;var y=o.eventTimes;for(o=o.expirationTimes;0<p;){var N=31-Nt(p),C=1<<N;c[N]=0,y[N]=-1,o[N]=-1,p&=~C}}function Xa(o,c){var p=o.entangledLanes|=c;for(o=o.entanglements;p;){var y=31-Nt(p),N=1<<y;N&c|o[y]&c&&(o[y]|=c),p&=~N}}var Ue=0;function Jl(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var Ql,ea,gi,ec,tc,yi=!1,fs=[],gr=null,zn=null,yr=null,ta=new Map,na=new Map,Hn=[],ih="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 nc(o,c){switch(o){case"focusin":case"focusout":gr=null;break;case"dragenter":case"dragleave":zn=null;break;case"mouseover":case"mouseout":yr=null;break;case"pointerover":case"pointerout":ta.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":na.delete(c.pointerId)}}function ps(o,c,p,y,N,C){return o===null||o.nativeEvent!==C?(o={blockedOn:c,domEventName:p,eventSystemFlags:y,nativeEvent:C,targetContainers:[N]},c!==null&&(c=$i(c),c!==null&&ea(c)),o):(o.eventSystemFlags|=y,c=o.targetContainers,N!==null&&c.indexOf(N)===-1&&c.push(N),o)}function ra(o,c,p,y,N){switch(c){case"focusin":return gr=ps(gr,o,c,p,y,N),!0;case"dragenter":return zn=ps(zn,o,c,p,y,N),!0;case"mouseover":return yr=ps(yr,o,c,p,y,N),!0;case"pointerover":var C=N.pointerId;return ta.set(C,ps(ta.get(C)||null,o,c,p,y,N)),!0;case"gotpointercapture":return C=N.pointerId,na.set(C,ps(na.get(C)||null,o,c,p,y,N)),!0}return!1}function wi(o){var c=la(o.target);if(c!==null){var p=Ut(c);if(p!==null){if(c=p.tag,c===13){if(c=hr(p),c!==null){o.blockedOn=c,tc(o.priority,function(){gi(p)});return}}else if(c===3&&p.stateNode.current.memoizedState.isDehydrated){o.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}o.blockedOn=null}function sa(o){if(o.blockedOn!==null)return!1;for(var c=o.targetContainers;0<c.length;){var p=aa(o.domEventName,o.eventSystemFlags,c[0],o.nativeEvent);if(p===null){p=o.nativeEvent;var y=new p.constructor(p.type,p);qt=y,p.target.dispatchEvent(y),qt=null}else return c=$i(p),c!==null&&ea(c),o.blockedOn=p,!1;c.shift()}return!0}function vi(o,c,p){sa(o)&&p.delete(c)}function rc(){yi=!1,gr!==null&&sa(gr)&&(gr=null),zn!==null&&sa(zn)&&(zn=null),yr!==null&&sa(yr)&&(yr=null),ta.forEach(vi),na.forEach(vi)}function ms(o,c){o.blockedOn===c&&(o.blockedOn=null,yi||(yi=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,rc)))}function Or(o){function c(N){return ms(N,o)}if(0<fs.length){ms(fs[0],o);for(var p=1;p<fs.length;p++){var y=fs[p];y.blockedOn===o&&(y.blockedOn=null)}}for(gr!==null&&ms(gr,o),zn!==null&&ms(zn,o),yr!==null&&ms(yr,o),ta.forEach(c),na.forEach(c),p=0;p<Hn.length;p++)y=Hn[p],y.blockedOn===o&&(y.blockedOn=null);for(;0<Hn.length&&(p=Hn[0],p.blockedOn===null);)wi(p),p.blockedOn===null&&Hn.shift()}var gs=E.ReactCurrentBatchConfig,ys=!0;function sc(o,c,p,y){var N=Ue,C=gs.transition;gs.transition=null;try{Ue=1,xi(o,c,p,y)}finally{Ue=N,gs.transition=C}}function ac(o,c,p,y){var N=Ue,C=gs.transition;gs.transition=null;try{Ue=4,xi(o,c,p,y)}finally{Ue=N,gs.transition=C}}function xi(o,c,p,y){if(ys){var N=aa(o,c,p,y);if(N===null)xh(o,c,y,Za,p),nc(o,y);else if(ra(N,o,c,p,y))y.stopPropagation();else if(nc(o,y),c&4&&-1<ih.indexOf(o)){for(;N!==null;){var C=$i(N);if(C!==null&&Ql(C),C=aa(o,c,p,y),C===null&&xh(o,c,y,Za,p),C===N)break;N=C}N!==null&&y.stopPropagation()}else xh(o,c,y,null,p)}}var Za=null;function aa(o,c,p,y){if(Za=null,o=bn(y),o=la(o),o!==null)if(c=Ut(o),c===null)o=null;else if(p=c.tag,p===13){if(o=hr(c),o!==null)return o;o=null}else if(p===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;o=null}else c!==o&&(o=null);return Za=o,null}function oa(o){switch(o){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(ls()){case pr:return 1;case Ya:return 4;case cs:case Xs:return 16;case Zs:return 536870912;default:return 16}default:return 16}}var wr=null,Lr=null,Ja=null;function oc(){if(Ja)return Ja;var o,c=Lr,p=c.length,y,N="value"in wr?wr.value:wr.textContent,C=N.length;for(o=0;o<p&&c[o]===N[o];o++);var U=p-o;for(y=1;y<=U&&c[p-y]===N[C-y];y++);return Ja=N.slice(o,1<y?1-y:void 0)}function Qa(o){var c=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&c===13&&(o=13)):o=c,o===10&&(o=13),32<=o||o===13?o:0}function ia(){return!0}function ic(){return!1}function Xt(o){function c(p,y,N,C,U){this._reactName=p,this._targetInst=N,this.type=y,this.nativeEvent=C,this.target=U,this.currentTarget=null;for(var Q in o)o.hasOwnProperty(Q)&&(p=o[Q],this[Q]=p?p(C):C[Q]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?ia:ic,this.isPropagationStopped=ic,this}return H(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=ia)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=ia)},persist:function(){},isPersistent:ia}),c}var Pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dr=Xt(Pr),ws=H({},Pr,{view:0,detail:0}),bi=Xt(ws),ki,Fr,Ni,lc=H({},ws,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ch,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Ni&&(Ni&&o.type==="mousemove"?(ki=o.screenX-Ni.screenX,Fr=o.screenY-Ni.screenY):Fr=ki=0,Ni=o),ki)},movementY:function(o){return"movementY"in o?o.movementY:Fr}}),ab=Xt(lc),lO=H({},lc,{dataTransfer:0}),cO=Xt(lO),uO=H({},ws,{relatedTarget:0}),lh=Xt(uO),dO=H({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),hO=Xt(dO),fO=H({},Pr,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),pO=Xt(fO),mO=H({},Pr,{data:0}),ob=Xt(mO),gO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yO={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"},wO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vO(o){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(o):(o=wO[o])?!!c[o]:!1}function ch(){return vO}var xO=H({},ws,{key:function(o){if(o.key){var c=gO[o.key]||o.key;if(c!=="Unidentified")return c}return o.type==="keypress"?(o=Qa(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?yO[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ch,charCode:function(o){return o.type==="keypress"?Qa(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Qa(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),bO=Xt(xO),kO=H({},lc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ib=Xt(kO),NO=H({},ws,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ch}),jO=Xt(NO),SO=H({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),_O=Xt(SO),EO=H({},lc,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),CO=Xt(EO),TO=[9,13,27,32],uh=u&&"CompositionEvent"in window,ji=null;u&&"documentMode"in document&&(ji=document.documentMode);var RO=u&&"TextEvent"in window&&!ji,lb=u&&(!uh||ji&&8<ji&&11>=ji),cb=" ",ub=!1;function db(o,c){switch(o){case"keyup":return TO.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hb(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var eo=!1;function AO(o,c){switch(o){case"compositionend":return hb(c);case"keypress":return c.which!==32?null:(ub=!0,cb);case"textInput":return o=c.data,o===cb&&ub?null:o;default:return null}}function MO(o,c){if(eo)return o==="compositionend"||!uh&&db(o,c)?(o=oc(),Ja=Lr=wr=null,eo=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return lb&&c.locale!=="ko"?null:c.data;default:return null}}var $O={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 fb(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c==="input"?!!$O[o.type]:c==="textarea"}function pb(o,c,p,y){rs(y),c=fc(c,"onChange"),0<c.length&&(p=new Dr("onChange","change",null,p,y),o.push({event:p,listeners:c}))}var Si=null,_i=null;function IO(o){Mb(o,0)}function cc(o){var c=ao(o);if(Ne(c))return o}function OO(o,c){if(o==="change")return c}var mb=!1;if(u){var dh;if(u){var hh="oninput"in document;if(!hh){var gb=document.createElement("div");gb.setAttribute("oninput","return;"),hh=typeof gb.oninput=="function"}dh=hh}else dh=!1;mb=dh&&(!document.documentMode||9<document.documentMode)}function yb(){Si&&(Si.detachEvent("onpropertychange",wb),_i=Si=null)}function wb(o){if(o.propertyName==="value"&&cc(_i)){var c=[];pb(c,_i,o,bn(o)),as(IO,c)}}function LO(o,c,p){o==="focusin"?(yb(),Si=c,_i=p,Si.attachEvent("onpropertychange",wb)):o==="focusout"&&yb()}function PO(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return cc(_i)}function DO(o,c){if(o==="click")return cc(c)}function FO(o,c){if(o==="input"||o==="change")return cc(c)}function qO(o,c){return o===c&&(o!==0||1/o===1/c)||o!==o&&c!==c}var Wn=typeof Object.is=="function"?Object.is:qO;function Ei(o,c){if(Wn(o,c))return!0;if(typeof o!="object"||o===null||typeof c!="object"||c===null)return!1;var p=Object.keys(o),y=Object.keys(c);if(p.length!==y.length)return!1;for(y=0;y<p.length;y++){var N=p[y];if(!d.call(c,N)||!Wn(o[N],c[N]))return!1}return!0}function vb(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function xb(o,c){var p=vb(o);o=0;for(var y;p;){if(p.nodeType===3){if(y=o+p.textContent.length,o<=c&&y>=c)return{node:p,offset:c-o};o=y}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=vb(p)}}function bb(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?bb(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function kb(){for(var o=window,c=we();c instanceof o.HTMLIFrameElement;){try{var p=typeof c.contentWindow.location.href=="string"}catch{p=!1}if(p)o=c.contentWindow;else break;c=we(o.document)}return c}function fh(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}function BO(o){var c=kb(),p=o.focusedElem,y=o.selectionRange;if(c!==p&&p&&p.ownerDocument&&bb(p.ownerDocument.documentElement,p)){if(y!==null&&fh(p)){if(c=y.start,o=y.end,o===void 0&&(o=c),"selectionStart"in p)p.selectionStart=c,p.selectionEnd=Math.min(o,p.value.length);else if(o=(c=p.ownerDocument||document)&&c.defaultView||window,o.getSelection){o=o.getSelection();var N=p.textContent.length,C=Math.min(y.start,N);y=y.end===void 0?C:Math.min(y.end,N),!o.extend&&C>y&&(N=y,y=C,C=N),N=xb(p,C);var U=xb(p,y);N&&U&&(o.rangeCount!==1||o.anchorNode!==N.node||o.anchorOffset!==N.offset||o.focusNode!==U.node||o.focusOffset!==U.offset)&&(c=c.createRange(),c.setStart(N.node,N.offset),o.removeAllRanges(),C>y?(o.addRange(c),o.extend(U.node,U.offset)):(c.setEnd(U.node,U.offset),o.addRange(c)))}}for(c=[],o=p;o=o.parentNode;)o.nodeType===1&&c.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<c.length;p++)o=c[p],o.element.scrollLeft=o.left,o.element.scrollTop=o.top}}var UO=u&&"documentMode"in document&&11>=document.documentMode,to=null,ph=null,Ci=null,mh=!1;function Nb(o,c,p){var y=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;mh||to==null||to!==we(y)||(y=to,"selectionStart"in y&&fh(y)?y={start:y.selectionStart,end:y.selectionEnd}:(y=(y.ownerDocument&&y.ownerDocument.defaultView||window).getSelection(),y={anchorNode:y.anchorNode,anchorOffset:y.anchorOffset,focusNode:y.focusNode,focusOffset:y.focusOffset}),Ci&&Ei(Ci,y)||(Ci=y,y=fc(ph,"onSelect"),0<y.length&&(c=new Dr("onSelect","select",null,c,p),o.push({event:c,listeners:y}),c.target=to)))}function uc(o,c){var p={};return p[o.toLowerCase()]=c.toLowerCase(),p["Webkit"+o]="webkit"+c,p["Moz"+o]="moz"+c,p}var no={animationend:uc("Animation","AnimationEnd"),animationiteration:uc("Animation","AnimationIteration"),animationstart:uc("Animation","AnimationStart"),transitionend:uc("Transition","TransitionEnd")},gh={},jb={};u&&(jb=document.createElement("div").style,"AnimationEvent"in window||(delete no.animationend.animation,delete no.animationiteration.animation,delete no.animationstart.animation),"TransitionEvent"in window||delete no.transitionend.transition);function dc(o){if(gh[o])return gh[o];if(!no[o])return o;var c=no[o],p;for(p in c)if(c.hasOwnProperty(p)&&p in jb)return gh[o]=c[p];return o}var Sb=dc("animationend"),_b=dc("animationiteration"),Eb=dc("animationstart"),Cb=dc("transitionend"),Tb=new Map,Rb="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 vs(o,c){Tb.set(o,c),i(c,[o])}for(var yh=0;yh<Rb.length;yh++){var wh=Rb[yh],zO=wh.toLowerCase(),HO=wh[0].toUpperCase()+wh.slice(1);vs(zO,"on"+HO)}vs(Sb,"onAnimationEnd"),vs(_b,"onAnimationIteration"),vs(Eb,"onAnimationStart"),vs("dblclick","onDoubleClick"),vs("focusin","onFocus"),vs("focusout","onBlur"),vs(Cb,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ti="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(" "),WO=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ti));function Ab(o,c,p){var y=o.type||"unknown-event";o.currentTarget=p,fn(y,c,void 0,o),o.currentTarget=null}function Mb(o,c){c=(c&4)!==0;for(var p=0;p<o.length;p++){var y=o[p],N=y.event;y=y.listeners;e:{var C=void 0;if(c)for(var U=y.length-1;0<=U;U--){var Q=y[U],te=Q.instance,le=Q.currentTarget;if(Q=Q.listener,te!==C&&N.isPropagationStopped())break e;Ab(N,Q,le),C=te}else for(U=0;U<y.length;U++){if(Q=y[U],te=Q.instance,le=Q.currentTarget,Q=Q.listener,te!==C&&N.isPropagationStopped())break e;Ab(N,Q,le),C=te}}}if(Bn)throw o=pe,Bn=!1,pe=null,o}function nt(o,c){var p=c[_h];p===void 0&&(p=c[_h]=new Set);var y=o+"__bubble";p.has(y)||($b(c,o,2,!1),p.add(y))}function vh(o,c,p){var y=0;c&&(y|=4),$b(p,o,y,c)}var hc="_reactListening"+Math.random().toString(36).slice(2);function Ri(o){if(!o[hc]){o[hc]=!0,r.forEach(function(p){p!=="selectionchange"&&(WO.has(p)||vh(p,!1,o),vh(p,!0,o))});var c=o.nodeType===9?o:o.ownerDocument;c===null||c[hc]||(c[hc]=!0,vh("selectionchange",!1,c))}}function $b(o,c,p,y){switch(oa(c)){case 1:var N=sc;break;case 4:N=ac;break;default:N=xi}p=N.bind(null,c,p,o),N=void 0,!dr||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(N=!0),y?N!==void 0?o.addEventListener(c,p,{capture:!0,passive:N}):o.addEventListener(c,p,!0):N!==void 0?o.addEventListener(c,p,{passive:N}):o.addEventListener(c,p,!1)}function xh(o,c,p,y,N){var C=y;if((c&1)===0&&(c&2)===0&&y!==null)e:for(;;){if(y===null)return;var U=y.tag;if(U===3||U===4){var Q=y.stateNode.containerInfo;if(Q===N||Q.nodeType===8&&Q.parentNode===N)break;if(U===4)for(U=y.return;U!==null;){var te=U.tag;if((te===3||te===4)&&(te=U.stateNode.containerInfo,te===N||te.nodeType===8&&te.parentNode===N))return;U=U.return}for(;Q!==null;){if(U=la(Q),U===null)return;if(te=U.tag,te===5||te===6){y=C=U;continue e}Q=Q.parentNode}}y=y.return}as(function(){var le=C,he=bn(p),me=[];e:{var de=Tb.get(o);if(de!==void 0){var ke=Dr,Se=o;switch(o){case"keypress":if(Qa(p)===0)break e;case"keydown":case"keyup":ke=bO;break;case"focusin":Se="focus",ke=lh;break;case"focusout":Se="blur",ke=lh;break;case"beforeblur":case"afterblur":ke=lh;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ke=ab;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ke=cO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ke=jO;break;case Sb:case _b:case Eb:ke=hO;break;case Cb:ke=_O;break;case"scroll":ke=bi;break;case"wheel":ke=CO;break;case"copy":case"cut":case"paste":ke=pO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ke=ib}var _e=(c&4)!==0,ft=!_e&&o==="scroll",ae=_e?de!==null?de+"Capture":null:de;_e=[];for(var ne=le,ie;ne!==null;){ie=ne;var ge=ie.stateNode;if(ie.tag===5&&ge!==null&&(ie=ge,ae!==null&&(ge=kn(ne,ae),ge!=null&&_e.push(Ai(ne,ge,ie)))),ft)break;ne=ne.return}0<_e.length&&(de=new ke(de,Se,null,p,he),me.push({event:de,listeners:_e}))}}if((c&7)===0){e:{if(de=o==="mouseover"||o==="pointerover",ke=o==="mouseout"||o==="pointerout",de&&p!==qt&&(Se=p.relatedTarget||p.fromElement)&&(la(Se)||Se[qr]))break e;if((ke||de)&&(de=he.window===he?he:(de=he.ownerDocument)?de.defaultView||de.parentWindow:window,ke?(Se=p.relatedTarget||p.toElement,ke=le,Se=Se?la(Se):null,Se!==null&&(ft=Ut(Se),Se!==ft||Se.tag!==5&&Se.tag!==6)&&(Se=null)):(ke=null,Se=le),ke!==Se)){if(_e=ab,ge="onMouseLeave",ae="onMouseEnter",ne="mouse",(o==="pointerout"||o==="pointerover")&&(_e=ib,ge="onPointerLeave",ae="onPointerEnter",ne="pointer"),ft=ke==null?de:ao(ke),ie=Se==null?de:ao(Se),de=new _e(ge,ne+"leave",ke,p,he),de.target=ft,de.relatedTarget=ie,ge=null,la(he)===le&&(_e=new _e(ae,ne+"enter",Se,p,he),_e.target=ie,_e.relatedTarget=ft,ge=_e),ft=ge,ke&&Se)t:{for(_e=ke,ae=Se,ne=0,ie=_e;ie;ie=ro(ie))ne++;for(ie=0,ge=ae;ge;ge=ro(ge))ie++;for(;0<ne-ie;)_e=ro(_e),ne--;for(;0<ie-ne;)ae=ro(ae),ie--;for(;ne--;){if(_e===ae||ae!==null&&_e===ae.alternate)break t;_e=ro(_e),ae=ro(ae)}_e=null}else _e=null;ke!==null&&Ib(me,de,ke,_e,!1),Se!==null&&ft!==null&&Ib(me,ft,Se,_e,!0)}}e:{if(de=le?ao(le):window,ke=de.nodeName&&de.nodeName.toLowerCase(),ke==="select"||ke==="input"&&de.type==="file")var Ee=OO;else if(fb(de))if(mb)Ee=FO;else{Ee=PO;var Re=LO}else(ke=de.nodeName)&&ke.toLowerCase()==="input"&&(de.type==="checkbox"||de.type==="radio")&&(Ee=DO);if(Ee&&(Ee=Ee(o,le))){pb(me,Ee,p,he);break e}Re&&Re(o,de,le),o==="focusout"&&(Re=de._wrapperState)&&Re.controlled&&de.type==="number"&&se(de,"number",de.value)}switch(Re=le?ao(le):window,o){case"focusin":(fb(Re)||Re.contentEditable==="true")&&(to=Re,ph=le,Ci=null);break;case"focusout":Ci=ph=to=null;break;case"mousedown":mh=!0;break;case"contextmenu":case"mouseup":case"dragend":mh=!1,Nb(me,p,he);break;case"selectionchange":if(UO)break;case"keydown":case"keyup":Nb(me,p,he)}var Ae;if(uh)e:{switch(o){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else eo?db(o,p)&&(Me="onCompositionEnd"):o==="keydown"&&p.keyCode===229&&(Me="onCompositionStart");Me&&(lb&&p.locale!=="ko"&&(eo||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&eo&&(Ae=oc()):(wr=he,Lr="value"in wr?wr.value:wr.textContent,eo=!0)),Re=fc(le,Me),0<Re.length&&(Me=new ob(Me,o,null,p,he),me.push({event:Me,listeners:Re}),Ae?Me.data=Ae:(Ae=hb(p),Ae!==null&&(Me.data=Ae)))),(Ae=RO?AO(o,p):MO(o,p))&&(le=fc(le,"onBeforeInput"),0<le.length&&(he=new ob("onBeforeInput","beforeinput",null,p,he),me.push({event:he,listeners:le}),he.data=Ae))}Mb(me,c)})}function Ai(o,c,p){return{instance:o,listener:c,currentTarget:p}}function fc(o,c){for(var p=c+"Capture",y=[];o!==null;){var N=o,C=N.stateNode;N.tag===5&&C!==null&&(N=C,C=kn(o,p),C!=null&&y.unshift(Ai(o,C,N)),C=kn(o,c),C!=null&&y.push(Ai(o,C,N))),o=o.return}return y}function ro(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function Ib(o,c,p,y,N){for(var C=c._reactName,U=[];p!==null&&p!==y;){var Q=p,te=Q.alternate,le=Q.stateNode;if(te!==null&&te===y)break;Q.tag===5&&le!==null&&(Q=le,N?(te=kn(p,C),te!=null&&U.unshift(Ai(p,te,Q))):N||(te=kn(p,C),te!=null&&U.push(Ai(p,te,Q)))),p=p.return}U.length!==0&&o.push({event:c,listeners:U})}var VO=/\r\n?/g,GO=/\u0000|\uFFFD/g;function Ob(o){return(typeof o=="string"?o:""+o).replace(VO,`
|
|
38
|
-
`).replace(GO,"")}function pc(o,c,p){if(c=Ob(c),Ob(o)!==c&&p)throw Error(n(425))}function mc(){}var bh=null,kh=null;function Nh(o,c){return o==="textarea"||o==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var jh=typeof setTimeout=="function"?setTimeout:void 0,KO=typeof clearTimeout=="function"?clearTimeout:void 0,Lb=typeof Promise=="function"?Promise:void 0,YO=typeof queueMicrotask=="function"?queueMicrotask:typeof Lb<"u"?function(o){return Lb.resolve(null).then(o).catch(XO)}:jh;function XO(o){setTimeout(function(){throw o})}function Sh(o,c){var p=c,y=0;do{var N=p.nextSibling;if(o.removeChild(p),N&&N.nodeType===8)if(p=N.data,p==="/$"){if(y===0){o.removeChild(N),Or(c);return}y--}else p!=="$"&&p!=="$?"&&p!=="$!"||y++;p=N}while(p);Or(c)}function xs(o){for(;o!=null;o=o.nextSibling){var c=o.nodeType;if(c===1||c===3)break;if(c===8){if(c=o.data,c==="$"||c==="$!"||c==="$?")break;if(c==="/$")return null}}return o}function Pb(o){o=o.previousSibling;for(var c=0;o;){if(o.nodeType===8){var p=o.data;if(p==="$"||p==="$!"||p==="$?"){if(c===0)return o;c--}else p==="/$"&&c++}o=o.previousSibling}return null}var so=Math.random().toString(36).slice(2),vr="__reactFiber$"+so,Mi="__reactProps$"+so,qr="__reactContainer$"+so,_h="__reactEvents$"+so,ZO="__reactListeners$"+so,JO="__reactHandles$"+so;function la(o){var c=o[vr];if(c)return c;for(var p=o.parentNode;p;){if(c=p[qr]||p[vr]){if(p=c.alternate,c.child!==null||p!==null&&p.child!==null)for(o=Pb(o);o!==null;){if(p=o[vr])return p;o=Pb(o)}return c}o=p,p=o.parentNode}return null}function $i(o){return o=o[vr]||o[qr],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function ao(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function gc(o){return o[Mi]||null}var Eh=[],oo=-1;function bs(o){return{current:o}}function rt(o){0>oo||(o.current=Eh[oo],Eh[oo]=null,oo--)}function tt(o,c){oo++,Eh[oo]=o.current,o.current=c}var ks={},zt=bs(ks),en=bs(!1),ca=ks;function io(o,c){var p=o.type.contextTypes;if(!p)return ks;var y=o.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===c)return y.__reactInternalMemoizedMaskedChildContext;var N={},C;for(C in p)N[C]=c[C];return y&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=c,o.__reactInternalMemoizedMaskedChildContext=N),N}function tn(o){return o=o.childContextTypes,o!=null}function yc(){rt(en),rt(zt)}function Db(o,c,p){if(zt.current!==ks)throw Error(n(168));tt(zt,c),tt(en,p)}function Fb(o,c,p){var y=o.stateNode;if(c=c.childContextTypes,typeof y.getChildContext!="function")return p;y=y.getChildContext();for(var N in y)if(!(N in c))throw Error(n(108,J(o)||"Unknown",N));return H({},p,y)}function wc(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||ks,ca=zt.current,tt(zt,o),tt(en,en.current),!0}function qb(o,c,p){var y=o.stateNode;if(!y)throw Error(n(169));p?(o=Fb(o,c,ca),y.__reactInternalMemoizedMergedChildContext=o,rt(en),rt(zt),tt(zt,o)):rt(en),tt(en,p)}var Br=null,vc=!1,Ch=!1;function Bb(o){Br===null?Br=[o]:Br.push(o)}function QO(o){vc=!0,Bb(o)}function Ns(){if(!Ch&&Br!==null){Ch=!0;var o=0,c=Ue;try{var p=Br;for(Ue=1;o<p.length;o++){var y=p[o];do y=y(!0);while(y!==null)}Br=null,vc=!1}catch(N){throw Br!==null&&(Br=Br.slice(o+1)),Va(pr,Ns),N}finally{Ue=c,Ch=!1}}return null}var lo=[],co=0,xc=null,bc=0,Sn=[],_n=0,ua=null,Ur=1,zr="";function da(o,c){lo[co++]=bc,lo[co++]=xc,xc=o,bc=c}function Ub(o,c,p){Sn[_n++]=Ur,Sn[_n++]=zr,Sn[_n++]=ua,ua=o;var y=Ur;o=zr;var N=32-Nt(y)-1;y&=~(1<<N),p+=1;var C=32-Nt(c)+N;if(30<C){var U=N-N%5;C=(y&(1<<U)-1).toString(32),y>>=U,N-=U,Ur=1<<32-Nt(c)+N|p<<N|y,zr=C+o}else Ur=1<<C|p<<N|y,zr=o}function Th(o){o.return!==null&&(da(o,1),Ub(o,1,0))}function Rh(o){for(;o===xc;)xc=lo[--co],lo[co]=null,bc=lo[--co],lo[co]=null;for(;o===ua;)ua=Sn[--_n],Sn[_n]=null,zr=Sn[--_n],Sn[_n]=null,Ur=Sn[--_n],Sn[_n]=null}var pn=null,mn=null,it=!1,Vn=null;function zb(o,c){var p=Rn(5,null,null,0);p.elementType="DELETED",p.stateNode=c,p.return=o,c=o.deletions,c===null?(o.deletions=[p],o.flags|=16):c.push(p)}function Hb(o,c){switch(o.tag){case 5:var p=o.type;return c=c.nodeType!==1||p.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(o.stateNode=c,pn=o,mn=xs(c.firstChild),!0):!1;case 6:return c=o.pendingProps===""||c.nodeType!==3?null:c,c!==null?(o.stateNode=c,pn=o,mn=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(p=ua!==null?{id:Ur,overflow:zr}:null,o.memoizedState={dehydrated:c,treeContext:p,retryLane:1073741824},p=Rn(18,null,null,0),p.stateNode=c,p.return=o,o.child=p,pn=o,mn=null,!0):!1;default:return!1}}function Ah(o){return(o.mode&1)!==0&&(o.flags&128)===0}function Mh(o){if(it){var c=mn;if(c){var p=c;if(!Hb(o,c)){if(Ah(o))throw Error(n(418));c=xs(p.nextSibling);var y=pn;c&&Hb(o,c)?zb(y,p):(o.flags=o.flags&-4097|2,it=!1,pn=o)}}else{if(Ah(o))throw Error(n(418));o.flags=o.flags&-4097|2,it=!1,pn=o}}}function Wb(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;pn=o}function kc(o){if(o!==pn)return!1;if(!it)return Wb(o),it=!0,!1;var c;if((c=o.tag!==3)&&!(c=o.tag!==5)&&(c=o.type,c=c!=="head"&&c!=="body"&&!Nh(o.type,o.memoizedProps)),c&&(c=mn)){if(Ah(o))throw Vb(),Error(n(418));for(;c;)zb(o,c),c=xs(c.nextSibling)}if(Wb(o),o.tag===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));e:{for(o=o.nextSibling,c=0;o;){if(o.nodeType===8){var p=o.data;if(p==="/$"){if(c===0){mn=xs(o.nextSibling);break e}c--}else p!=="$"&&p!=="$!"&&p!=="$?"||c++}o=o.nextSibling}mn=null}}else mn=pn?xs(o.stateNode.nextSibling):null;return!0}function Vb(){for(var o=mn;o;)o=xs(o.nextSibling)}function uo(){mn=pn=null,it=!1}function $h(o){Vn===null?Vn=[o]:Vn.push(o)}var eL=E.ReactCurrentBatchConfig;function Ii(o,c,p){if(o=p.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(n(309));var y=p.stateNode}if(!y)throw Error(n(147,o));var N=y,C=""+o;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===C?c.ref:(c=function(U){var Q=N.refs;U===null?delete Q[C]:Q[C]=U},c._stringRef=C,c)}if(typeof o!="string")throw Error(n(284));if(!p._owner)throw Error(n(290,o))}return o}function Nc(o,c){throw o=Object.prototype.toString.call(c),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":o))}function Gb(o){var c=o._init;return c(o._payload)}function Kb(o){function c(ae,ne){if(o){var ie=ae.deletions;ie===null?(ae.deletions=[ne],ae.flags|=16):ie.push(ne)}}function p(ae,ne){if(!o)return null;for(;ne!==null;)c(ae,ne),ne=ne.sibling;return null}function y(ae,ne){for(ae=new Map;ne!==null;)ne.key!==null?ae.set(ne.key,ne):ae.set(ne.index,ne),ne=ne.sibling;return ae}function N(ae,ne){return ae=As(ae,ne),ae.index=0,ae.sibling=null,ae}function C(ae,ne,ie){return ae.index=ie,o?(ie=ae.alternate,ie!==null?(ie=ie.index,ie<ne?(ae.flags|=2,ne):ie):(ae.flags|=2,ne)):(ae.flags|=1048576,ne)}function U(ae){return o&&ae.alternate===null&&(ae.flags|=2),ae}function Q(ae,ne,ie,ge){return ne===null||ne.tag!==6?(ne=Sf(ie,ae.mode,ge),ne.return=ae,ne):(ne=N(ne,ie),ne.return=ae,ne)}function te(ae,ne,ie,ge){var Ee=ie.type;return Ee===A?he(ae,ne,ie.props.children,ge,ie.key):ne!==null&&(ne.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===L&&Gb(Ee)===ne.type)?(ge=N(ne,ie.props),ge.ref=Ii(ae,ne,ie),ge.return=ae,ge):(ge=Gc(ie.type,ie.key,ie.props,null,ae.mode,ge),ge.ref=Ii(ae,ne,ie),ge.return=ae,ge)}function le(ae,ne,ie,ge){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ie.containerInfo||ne.stateNode.implementation!==ie.implementation?(ne=_f(ie,ae.mode,ge),ne.return=ae,ne):(ne=N(ne,ie.children||[]),ne.return=ae,ne)}function he(ae,ne,ie,ge,Ee){return ne===null||ne.tag!==7?(ne=va(ie,ae.mode,ge,Ee),ne.return=ae,ne):(ne=N(ne,ie),ne.return=ae,ne)}function me(ae,ne,ie){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=Sf(""+ne,ae.mode,ie),ne.return=ae,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case T:return ie=Gc(ne.type,ne.key,ne.props,null,ae.mode,ie),ie.ref=Ii(ae,null,ne),ie.return=ae,ie;case R:return ne=_f(ne,ae.mode,ie),ne.return=ae,ne;case L:var ge=ne._init;return me(ae,ge(ne._payload),ie)}if(be(ne)||q(ne))return ne=va(ne,ae.mode,ie,null),ne.return=ae,ne;Nc(ae,ne)}return null}function de(ae,ne,ie,ge){var Ee=ne!==null?ne.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Ee!==null?null:Q(ae,ne,""+ie,ge);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case T:return ie.key===Ee?te(ae,ne,ie,ge):null;case R:return ie.key===Ee?le(ae,ne,ie,ge):null;case L:return Ee=ie._init,de(ae,ne,Ee(ie._payload),ge)}if(be(ie)||q(ie))return Ee!==null?null:he(ae,ne,ie,ge,null);Nc(ae,ie)}return null}function ke(ae,ne,ie,ge,Ee){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return ae=ae.get(ie)||null,Q(ne,ae,""+ge,Ee);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case T:return ae=ae.get(ge.key===null?ie:ge.key)||null,te(ne,ae,ge,Ee);case R:return ae=ae.get(ge.key===null?ie:ge.key)||null,le(ne,ae,ge,Ee);case L:var Re=ge._init;return ke(ae,ne,ie,Re(ge._payload),Ee)}if(be(ge)||q(ge))return ae=ae.get(ie)||null,he(ne,ae,ge,Ee,null);Nc(ne,ge)}return null}function Se(ae,ne,ie,ge){for(var Ee=null,Re=null,Ae=ne,Me=ne=0,Mt=null;Ae!==null&&Me<ie.length;Me++){Ae.index>Me?(Mt=Ae,Ae=null):Mt=Ae.sibling;var He=de(ae,Ae,ie[Me],ge);if(He===null){Ae===null&&(Ae=Mt);break}o&&Ae&&He.alternate===null&&c(ae,Ae),ne=C(He,ne,Me),Re===null?Ee=He:Re.sibling=He,Re=He,Ae=Mt}if(Me===ie.length)return p(ae,Ae),it&&da(ae,Me),Ee;if(Ae===null){for(;Me<ie.length;Me++)Ae=me(ae,ie[Me],ge),Ae!==null&&(ne=C(Ae,ne,Me),Re===null?Ee=Ae:Re.sibling=Ae,Re=Ae);return it&&da(ae,Me),Ee}for(Ae=y(ae,Ae);Me<ie.length;Me++)Mt=ke(Ae,ae,Me,ie[Me],ge),Mt!==null&&(o&&Mt.alternate!==null&&Ae.delete(Mt.key===null?Me:Mt.key),ne=C(Mt,ne,Me),Re===null?Ee=Mt:Re.sibling=Mt,Re=Mt);return o&&Ae.forEach(function(Ms){return c(ae,Ms)}),it&&da(ae,Me),Ee}function _e(ae,ne,ie,ge){var Ee=q(ie);if(typeof Ee!="function")throw Error(n(150));if(ie=Ee.call(ie),ie==null)throw Error(n(151));for(var Re=Ee=null,Ae=ne,Me=ne=0,Mt=null,He=ie.next();Ae!==null&&!He.done;Me++,He=ie.next()){Ae.index>Me?(Mt=Ae,Ae=null):Mt=Ae.sibling;var Ms=de(ae,Ae,He.value,ge);if(Ms===null){Ae===null&&(Ae=Mt);break}o&&Ae&&Ms.alternate===null&&c(ae,Ae),ne=C(Ms,ne,Me),Re===null?Ee=Ms:Re.sibling=Ms,Re=Ms,Ae=Mt}if(He.done)return p(ae,Ae),it&&da(ae,Me),Ee;if(Ae===null){for(;!He.done;Me++,He=ie.next())He=me(ae,He.value,ge),He!==null&&(ne=C(He,ne,Me),Re===null?Ee=He:Re.sibling=He,Re=He);return it&&da(ae,Me),Ee}for(Ae=y(ae,Ae);!He.done;Me++,He=ie.next())He=ke(Ae,ae,Me,He.value,ge),He!==null&&(o&&He.alternate!==null&&Ae.delete(He.key===null?Me:He.key),ne=C(He,ne,Me),Re===null?Ee=He:Re.sibling=He,Re=He);return o&&Ae.forEach(function($L){return c(ae,$L)}),it&&da(ae,Me),Ee}function ft(ae,ne,ie,ge){if(typeof ie=="object"&&ie!==null&&ie.type===A&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case T:e:{for(var Ee=ie.key,Re=ne;Re!==null;){if(Re.key===Ee){if(Ee=ie.type,Ee===A){if(Re.tag===7){p(ae,Re.sibling),ne=N(Re,ie.props.children),ne.return=ae,ae=ne;break e}}else if(Re.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===L&&Gb(Ee)===Re.type){p(ae,Re.sibling),ne=N(Re,ie.props),ne.ref=Ii(ae,Re,ie),ne.return=ae,ae=ne;break e}p(ae,Re);break}else c(ae,Re);Re=Re.sibling}ie.type===A?(ne=va(ie.props.children,ae.mode,ge,ie.key),ne.return=ae,ae=ne):(ge=Gc(ie.type,ie.key,ie.props,null,ae.mode,ge),ge.ref=Ii(ae,ne,ie),ge.return=ae,ae=ge)}return U(ae);case R:e:{for(Re=ie.key;ne!==null;){if(ne.key===Re)if(ne.tag===4&&ne.stateNode.containerInfo===ie.containerInfo&&ne.stateNode.implementation===ie.implementation){p(ae,ne.sibling),ne=N(ne,ie.children||[]),ne.return=ae,ae=ne;break e}else{p(ae,ne);break}else c(ae,ne);ne=ne.sibling}ne=_f(ie,ae.mode,ge),ne.return=ae,ae=ne}return U(ae);case L:return Re=ie._init,ft(ae,ne,Re(ie._payload),ge)}if(be(ie))return Se(ae,ne,ie,ge);if(q(ie))return _e(ae,ne,ie,ge);Nc(ae,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,ne!==null&&ne.tag===6?(p(ae,ne.sibling),ne=N(ne,ie),ne.return=ae,ae=ne):(p(ae,ne),ne=Sf(ie,ae.mode,ge),ne.return=ae,ae=ne),U(ae)):p(ae,ne)}return ft}var ho=Kb(!0),Yb=Kb(!1),jc=bs(null),Sc=null,fo=null,Ih=null;function Oh(){Ih=fo=Sc=null}function Lh(o){var c=jc.current;rt(jc),o._currentValue=c}function Ph(o,c,p){for(;o!==null;){var y=o.alternate;if((o.childLanes&c)!==c?(o.childLanes|=c,y!==null&&(y.childLanes|=c)):y!==null&&(y.childLanes&c)!==c&&(y.childLanes|=c),o===p)break;o=o.return}}function po(o,c){Sc=o,Ih=fo=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&c)!==0&&(nn=!0),o.firstContext=null)}function En(o){var c=o._currentValue;if(Ih!==o)if(o={context:o,memoizedValue:c,next:null},fo===null){if(Sc===null)throw Error(n(308));fo=o,Sc.dependencies={lanes:0,firstContext:o}}else fo=fo.next=o;return c}var ha=null;function Dh(o){ha===null?ha=[o]:ha.push(o)}function Xb(o,c,p,y){var N=c.interleaved;return N===null?(p.next=p,Dh(c)):(p.next=N.next,N.next=p),c.interleaved=p,Hr(o,y)}function Hr(o,c){o.lanes|=c;var p=o.alternate;for(p!==null&&(p.lanes|=c),p=o,o=o.return;o!==null;)o.childLanes|=c,p=o.alternate,p!==null&&(p.childLanes|=c),p=o,o=o.return;return p.tag===3?p.stateNode:null}var js=!1;function Fh(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Zb(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function Wr(o,c){return{eventTime:o,lane:c,tag:0,payload:null,callback:null,next:null}}function Ss(o,c,p){var y=o.updateQueue;if(y===null)return null;if(y=y.shared,(ze&2)!==0){var N=y.pending;return N===null?c.next=c:(c.next=N.next,N.next=c),y.pending=c,Hr(o,p)}return N=y.interleaved,N===null?(c.next=c,Dh(y)):(c.next=N.next,N.next=c),y.interleaved=c,Hr(o,p)}function _c(o,c,p){if(c=c.updateQueue,c!==null&&(c=c.shared,(p&4194240)!==0)){var y=c.lanes;y&=o.pendingLanes,p|=y,c.lanes=p,Xa(o,p)}}function Jb(o,c){var p=o.updateQueue,y=o.alternate;if(y!==null&&(y=y.updateQueue,p===y)){var N=null,C=null;if(p=p.firstBaseUpdate,p!==null){do{var U={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};C===null?N=C=U:C=C.next=U,p=p.next}while(p!==null);C===null?N=C=c:C=C.next=c}else N=C=c;p={baseState:y.baseState,firstBaseUpdate:N,lastBaseUpdate:C,shared:y.shared,effects:y.effects},o.updateQueue=p;return}o=p.lastBaseUpdate,o===null?p.firstBaseUpdate=c:o.next=c,p.lastBaseUpdate=c}function Ec(o,c,p,y){var N=o.updateQueue;js=!1;var C=N.firstBaseUpdate,U=N.lastBaseUpdate,Q=N.shared.pending;if(Q!==null){N.shared.pending=null;var te=Q,le=te.next;te.next=null,U===null?C=le:U.next=le,U=te;var he=o.alternate;he!==null&&(he=he.updateQueue,Q=he.lastBaseUpdate,Q!==U&&(Q===null?he.firstBaseUpdate=le:Q.next=le,he.lastBaseUpdate=te))}if(C!==null){var me=N.baseState;U=0,he=le=te=null,Q=C;do{var de=Q.lane,ke=Q.eventTime;if((y&de)===de){he!==null&&(he=he.next={eventTime:ke,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var Se=o,_e=Q;switch(de=c,ke=p,_e.tag){case 1:if(Se=_e.payload,typeof Se=="function"){me=Se.call(ke,me,de);break e}me=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=_e.payload,de=typeof Se=="function"?Se.call(ke,me,de):Se,de==null)break e;me=H({},me,de);break e;case 2:js=!0}}Q.callback!==null&&Q.lane!==0&&(o.flags|=64,de=N.effects,de===null?N.effects=[Q]:de.push(Q))}else ke={eventTime:ke,lane:de,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},he===null?(le=he=ke,te=me):he=he.next=ke,U|=de;if(Q=Q.next,Q===null){if(Q=N.shared.pending,Q===null)break;de=Q,Q=de.next,de.next=null,N.lastBaseUpdate=de,N.shared.pending=null}}while(!0);if(he===null&&(te=me),N.baseState=te,N.firstBaseUpdate=le,N.lastBaseUpdate=he,c=N.shared.interleaved,c!==null){N=c;do U|=N.lane,N=N.next;while(N!==c)}else C===null&&(N.shared.lanes=0);ma|=U,o.lanes=U,o.memoizedState=me}}function Qb(o,c,p){if(o=c.effects,c.effects=null,o!==null)for(c=0;c<o.length;c++){var y=o[c],N=y.callback;if(N!==null){if(y.callback=null,y=p,typeof N!="function")throw Error(n(191,N));N.call(y)}}}var Oi={},xr=bs(Oi),Li=bs(Oi),Pi=bs(Oi);function fa(o){if(o===Oi)throw Error(n(174));return o}function qh(o,c){switch(tt(Pi,c),tt(Li,o),tt(xr,Oi),o=c.nodeType,o){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:Ze(null,"");break;default:o=o===8?c.parentNode:c,c=o.namespaceURI||null,o=o.tagName,c=Ze(c,o)}rt(xr),tt(xr,c)}function mo(){rt(xr),rt(Li),rt(Pi)}function ek(o){fa(Pi.current);var c=fa(xr.current),p=Ze(c,o.type);c!==p&&(tt(Li,o),tt(xr,p))}function Bh(o){Li.current===o&&(rt(xr),rt(Li))}var ct=bs(0);function Cc(o){for(var c=o;c!==null;){if(c.tag===13){var p=c.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||p.data==="$?"||p.data==="$!"))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Uh=[];function zh(){for(var o=0;o<Uh.length;o++)Uh[o]._workInProgressVersionPrimary=null;Uh.length=0}var Tc=E.ReactCurrentDispatcher,Hh=E.ReactCurrentBatchConfig,pa=0,ut=null,jt=null,Rt=null,Rc=!1,Di=!1,Fi=0,tL=0;function Ht(){throw Error(n(321))}function Wh(o,c){if(c===null)return!1;for(var p=0;p<c.length&&p<o.length;p++)if(!Wn(o[p],c[p]))return!1;return!0}function Vh(o,c,p,y,N,C){if(pa=C,ut=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Tc.current=o===null||o.memoizedState===null?aL:oL,o=p(y,N),Di){C=0;do{if(Di=!1,Fi=0,25<=C)throw Error(n(301));C+=1,Rt=jt=null,c.updateQueue=null,Tc.current=iL,o=p(y,N)}while(Di)}if(Tc.current=$c,c=jt!==null&&jt.next!==null,pa=0,Rt=jt=ut=null,Rc=!1,c)throw Error(n(300));return o}function Gh(){var o=Fi!==0;return Fi=0,o}function br(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?ut.memoizedState=Rt=o:Rt=Rt.next=o,Rt}function Cn(){if(jt===null){var o=ut.alternate;o=o!==null?o.memoizedState:null}else o=jt.next;var c=Rt===null?ut.memoizedState:Rt.next;if(c!==null)Rt=c,jt=o;else{if(o===null)throw Error(n(310));jt=o,o={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},Rt===null?ut.memoizedState=Rt=o:Rt=Rt.next=o}return Rt}function qi(o,c){return typeof c=="function"?c(o):c}function Kh(o){var c=Cn(),p=c.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=o;var y=jt,N=y.baseQueue,C=p.pending;if(C!==null){if(N!==null){var U=N.next;N.next=C.next,C.next=U}y.baseQueue=N=C,p.pending=null}if(N!==null){C=N.next,y=y.baseState;var Q=U=null,te=null,le=C;do{var he=le.lane;if((pa&he)===he)te!==null&&(te=te.next={lane:0,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),y=le.hasEagerState?le.eagerState:o(y,le.action);else{var me={lane:he,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null};te===null?(Q=te=me,U=y):te=te.next=me,ut.lanes|=he,ma|=he}le=le.next}while(le!==null&&le!==C);te===null?U=y:te.next=Q,Wn(y,c.memoizedState)||(nn=!0),c.memoizedState=y,c.baseState=U,c.baseQueue=te,p.lastRenderedState=y}if(o=p.interleaved,o!==null){N=o;do C=N.lane,ut.lanes|=C,ma|=C,N=N.next;while(N!==o)}else N===null&&(p.lanes=0);return[c.memoizedState,p.dispatch]}function Yh(o){var c=Cn(),p=c.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=o;var y=p.dispatch,N=p.pending,C=c.memoizedState;if(N!==null){p.pending=null;var U=N=N.next;do C=o(C,U.action),U=U.next;while(U!==N);Wn(C,c.memoizedState)||(nn=!0),c.memoizedState=C,c.baseQueue===null&&(c.baseState=C),p.lastRenderedState=C}return[C,y]}function tk(){}function nk(o,c){var p=ut,y=Cn(),N=c(),C=!Wn(y.memoizedState,N);if(C&&(y.memoizedState=N,nn=!0),y=y.queue,Xh(ak.bind(null,p,y,o),[o]),y.getSnapshot!==c||C||Rt!==null&&Rt.memoizedState.tag&1){if(p.flags|=2048,Bi(9,sk.bind(null,p,y,N,c),void 0,null),At===null)throw Error(n(349));(pa&30)!==0||rk(p,c,N)}return N}function rk(o,c,p){o.flags|=16384,o={getSnapshot:c,value:p},c=ut.updateQueue,c===null?(c={lastEffect:null,stores:null},ut.updateQueue=c,c.stores=[o]):(p=c.stores,p===null?c.stores=[o]:p.push(o))}function sk(o,c,p,y){c.value=p,c.getSnapshot=y,ok(c)&&ik(o)}function ak(o,c,p){return p(function(){ok(c)&&ik(o)})}function ok(o){var c=o.getSnapshot;o=o.value;try{var p=c();return!Wn(o,p)}catch{return!0}}function ik(o){var c=Hr(o,1);c!==null&&Xn(c,o,1,-1)}function lk(o){var c=br();return typeof o=="function"&&(o=o()),c.memoizedState=c.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:o},c.queue=o,o=o.dispatch=sL.bind(null,ut,o),[c.memoizedState,o]}function Bi(o,c,p,y){return o={tag:o,create:c,destroy:p,deps:y,next:null},c=ut.updateQueue,c===null?(c={lastEffect:null,stores:null},ut.updateQueue=c,c.lastEffect=o.next=o):(p=c.lastEffect,p===null?c.lastEffect=o.next=o:(y=p.next,p.next=o,o.next=y,c.lastEffect=o)),o}function ck(){return Cn().memoizedState}function Ac(o,c,p,y){var N=br();ut.flags|=o,N.memoizedState=Bi(1|c,p,void 0,y===void 0?null:y)}function Mc(o,c,p,y){var N=Cn();y=y===void 0?null:y;var C=void 0;if(jt!==null){var U=jt.memoizedState;if(C=U.destroy,y!==null&&Wh(y,U.deps)){N.memoizedState=Bi(c,p,C,y);return}}ut.flags|=o,N.memoizedState=Bi(1|c,p,C,y)}function uk(o,c){return Ac(8390656,8,o,c)}function Xh(o,c){return Mc(2048,8,o,c)}function dk(o,c){return Mc(4,2,o,c)}function hk(o,c){return Mc(4,4,o,c)}function fk(o,c){if(typeof c=="function")return o=o(),c(o),function(){c(null)};if(c!=null)return o=o(),c.current=o,function(){c.current=null}}function pk(o,c,p){return p=p!=null?p.concat([o]):null,Mc(4,4,fk.bind(null,c,o),p)}function Zh(){}function mk(o,c){var p=Cn();c=c===void 0?null:c;var y=p.memoizedState;return y!==null&&c!==null&&Wh(c,y[1])?y[0]:(p.memoizedState=[o,c],o)}function gk(o,c){var p=Cn();c=c===void 0?null:c;var y=p.memoizedState;return y!==null&&c!==null&&Wh(c,y[1])?y[0]:(o=o(),p.memoizedState=[o,c],o)}function yk(o,c,p){return(pa&21)===0?(o.baseState&&(o.baseState=!1,nn=!0),o.memoizedState=p):(Wn(p,c)||(p=mi(),ut.lanes|=p,ma|=p,o.baseState=!0),c)}function nL(o,c){var p=Ue;Ue=p!==0&&4>p?p:4,o(!0);var y=Hh.transition;Hh.transition={};try{o(!1),c()}finally{Ue=p,Hh.transition=y}}function wk(){return Cn().memoizedState}function rL(o,c,p){var y=Ts(o);if(p={lane:y,action:p,hasEagerState:!1,eagerState:null,next:null},vk(o))xk(c,p);else if(p=Xb(o,c,p,y),p!==null){var N=Jt();Xn(p,o,y,N),bk(p,c,y)}}function sL(o,c,p){var y=Ts(o),N={lane:y,action:p,hasEagerState:!1,eagerState:null,next:null};if(vk(o))xk(c,N);else{var C=o.alternate;if(o.lanes===0&&(C===null||C.lanes===0)&&(C=c.lastRenderedReducer,C!==null))try{var U=c.lastRenderedState,Q=C(U,p);if(N.hasEagerState=!0,N.eagerState=Q,Wn(Q,U)){var te=c.interleaved;te===null?(N.next=N,Dh(c)):(N.next=te.next,te.next=N),c.interleaved=N;return}}catch{}finally{}p=Xb(o,c,N,y),p!==null&&(N=Jt(),Xn(p,o,y,N),bk(p,c,y))}}function vk(o){var c=o.alternate;return o===ut||c!==null&&c===ut}function xk(o,c){Di=Rc=!0;var p=o.pending;p===null?c.next=c:(c.next=p.next,p.next=c),o.pending=c}function bk(o,c,p){if((p&4194240)!==0){var y=c.lanes;y&=o.pendingLanes,p|=y,c.lanes=p,Xa(o,p)}}var $c={readContext:En,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},aL={readContext:En,useCallback:function(o,c){return br().memoizedState=[o,c===void 0?null:c],o},useContext:En,useEffect:uk,useImperativeHandle:function(o,c,p){return p=p!=null?p.concat([o]):null,Ac(4194308,4,fk.bind(null,c,o),p)},useLayoutEffect:function(o,c){return Ac(4194308,4,o,c)},useInsertionEffect:function(o,c){return Ac(4,2,o,c)},useMemo:function(o,c){var p=br();return c=c===void 0?null:c,o=o(),p.memoizedState=[o,c],o},useReducer:function(o,c,p){var y=br();return c=p!==void 0?p(c):c,y.memoizedState=y.baseState=c,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:c},y.queue=o,o=o.dispatch=rL.bind(null,ut,o),[y.memoizedState,o]},useRef:function(o){var c=br();return o={current:o},c.memoizedState=o},useState:lk,useDebugValue:Zh,useDeferredValue:function(o){return br().memoizedState=o},useTransition:function(){var o=lk(!1),c=o[0];return o=nL.bind(null,o[1]),br().memoizedState=o,[c,o]},useMutableSource:function(){},useSyncExternalStore:function(o,c,p){var y=ut,N=br();if(it){if(p===void 0)throw Error(n(407));p=p()}else{if(p=c(),At===null)throw Error(n(349));(pa&30)!==0||rk(y,c,p)}N.memoizedState=p;var C={value:p,getSnapshot:c};return N.queue=C,uk(ak.bind(null,y,C,o),[o]),y.flags|=2048,Bi(9,sk.bind(null,y,C,p,c),void 0,null),p},useId:function(){var o=br(),c=At.identifierPrefix;if(it){var p=zr,y=Ur;p=(y&~(1<<32-Nt(y)-1)).toString(32)+p,c=":"+c+"R"+p,p=Fi++,0<p&&(c+="H"+p.toString(32)),c+=":"}else p=tL++,c=":"+c+"r"+p.toString(32)+":";return o.memoizedState=c},unstable_isNewReconciler:!1},oL={readContext:En,useCallback:mk,useContext:En,useEffect:Xh,useImperativeHandle:pk,useInsertionEffect:dk,useLayoutEffect:hk,useMemo:gk,useReducer:Kh,useRef:ck,useState:function(){return Kh(qi)},useDebugValue:Zh,useDeferredValue:function(o){var c=Cn();return yk(c,jt.memoizedState,o)},useTransition:function(){var o=Kh(qi)[0],c=Cn().memoizedState;return[o,c]},useMutableSource:tk,useSyncExternalStore:nk,useId:wk,unstable_isNewReconciler:!1},iL={readContext:En,useCallback:mk,useContext:En,useEffect:Xh,useImperativeHandle:pk,useInsertionEffect:dk,useLayoutEffect:hk,useMemo:gk,useReducer:Yh,useRef:ck,useState:function(){return Yh(qi)},useDebugValue:Zh,useDeferredValue:function(o){var c=Cn();return jt===null?c.memoizedState=o:yk(c,jt.memoizedState,o)},useTransition:function(){var o=Yh(qi)[0],c=Cn().memoizedState;return[o,c]},useMutableSource:tk,useSyncExternalStore:nk,useId:wk,unstable_isNewReconciler:!1};function Gn(o,c){if(o&&o.defaultProps){c=H({},c),o=o.defaultProps;for(var p in o)c[p]===void 0&&(c[p]=o[p]);return c}return c}function Jh(o,c,p,y){c=o.memoizedState,p=p(y,c),p=p==null?c:H({},c,p),o.memoizedState=p,o.lanes===0&&(o.updateQueue.baseState=p)}var Ic={isMounted:function(o){return(o=o._reactInternals)?Ut(o)===o:!1},enqueueSetState:function(o,c,p){o=o._reactInternals;var y=Jt(),N=Ts(o),C=Wr(y,N);C.payload=c,p!=null&&(C.callback=p),c=Ss(o,C,N),c!==null&&(Xn(c,o,N,y),_c(c,o,N))},enqueueReplaceState:function(o,c,p){o=o._reactInternals;var y=Jt(),N=Ts(o),C=Wr(y,N);C.tag=1,C.payload=c,p!=null&&(C.callback=p),c=Ss(o,C,N),c!==null&&(Xn(c,o,N,y),_c(c,o,N))},enqueueForceUpdate:function(o,c){o=o._reactInternals;var p=Jt(),y=Ts(o),N=Wr(p,y);N.tag=2,c!=null&&(N.callback=c),c=Ss(o,N,y),c!==null&&(Xn(c,o,y,p),_c(c,o,y))}};function kk(o,c,p,y,N,C,U){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(y,C,U):c.prototype&&c.prototype.isPureReactComponent?!Ei(p,y)||!Ei(N,C):!0}function Nk(o,c,p){var y=!1,N=ks,C=c.contextType;return typeof C=="object"&&C!==null?C=En(C):(N=tn(c)?ca:zt.current,y=c.contextTypes,C=(y=y!=null)?io(o,N):ks),c=new c(p,C),o.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Ic,o.stateNode=c,c._reactInternals=o,y&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=N,o.__reactInternalMemoizedMaskedChildContext=C),c}function jk(o,c,p,y){o=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(p,y),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(p,y),c.state!==o&&Ic.enqueueReplaceState(c,c.state,null)}function Qh(o,c,p,y){var N=o.stateNode;N.props=p,N.state=o.memoizedState,N.refs={},Fh(o);var C=c.contextType;typeof C=="object"&&C!==null?N.context=En(C):(C=tn(c)?ca:zt.current,N.context=io(o,C)),N.state=o.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(Jh(o,c,C,p),N.state=o.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(c=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),c!==N.state&&Ic.enqueueReplaceState(N,N.state,null),Ec(o,p,N,y),N.state=o.memoizedState),typeof N.componentDidMount=="function"&&(o.flags|=4194308)}function go(o,c){try{var p="",y=c;do p+=X(y),y=y.return;while(y);var N=p}catch(C){N=`
|
|
39
|
-
Error generating stack: `+C.message+`
|
|
40
|
-
`+C.stack}return{value:o,source:c,stack:N,digest:null}}function ef(o,c,p){return{value:o,source:null,stack:p??null,digest:c??null}}function tf(o,c){try{console.error(c.value)}catch(p){setTimeout(function(){throw p})}}var lL=typeof WeakMap=="function"?WeakMap:Map;function Sk(o,c,p){p=Wr(-1,p),p.tag=3,p.payload={element:null};var y=c.value;return p.callback=function(){Bc||(Bc=!0,yf=y),tf(o,c)},p}function _k(o,c,p){p=Wr(-1,p),p.tag=3;var y=o.type.getDerivedStateFromError;if(typeof y=="function"){var N=c.value;p.payload=function(){return y(N)},p.callback=function(){tf(o,c)}}var C=o.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(p.callback=function(){tf(o,c),typeof y!="function"&&(Es===null?Es=new Set([this]):Es.add(this));var U=c.stack;this.componentDidCatch(c.value,{componentStack:U!==null?U:""})}),p}function Ek(o,c,p){var y=o.pingCache;if(y===null){y=o.pingCache=new lL;var N=new Set;y.set(c,N)}else N=y.get(c),N===void 0&&(N=new Set,y.set(c,N));N.has(p)||(N.add(p),o=kL.bind(null,o,c,p),c.then(o,o))}function Ck(o){do{var c;if((c=o.tag===13)&&(c=o.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return o;o=o.return}while(o!==null);return null}function Tk(o,c,p,y,N){return(o.mode&1)===0?(o===c?o.flags|=65536:(o.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(c=Wr(-1,1),c.tag=2,Ss(p,c,1))),p.lanes|=1),o):(o.flags|=65536,o.lanes=N,o)}var cL=E.ReactCurrentOwner,nn=!1;function Zt(o,c,p,y){c.child=o===null?Yb(c,null,p,y):ho(c,o.child,p,y)}function Rk(o,c,p,y,N){p=p.render;var C=c.ref;return po(c,N),y=Vh(o,c,p,y,C,N),p=Gh(),o!==null&&!nn?(c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~N,Vr(o,c,N)):(it&&p&&Th(c),c.flags|=1,Zt(o,c,y,N),c.child)}function Ak(o,c,p,y,N){if(o===null){var C=p.type;return typeof C=="function"&&!jf(C)&&C.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(c.tag=15,c.type=C,Mk(o,c,C,y,N)):(o=Gc(p.type,null,y,c,c.mode,N),o.ref=c.ref,o.return=c,c.child=o)}if(C=o.child,(o.lanes&N)===0){var U=C.memoizedProps;if(p=p.compare,p=p!==null?p:Ei,p(U,y)&&o.ref===c.ref)return Vr(o,c,N)}return c.flags|=1,o=As(C,y),o.ref=c.ref,o.return=c,c.child=o}function Mk(o,c,p,y,N){if(o!==null){var C=o.memoizedProps;if(Ei(C,y)&&o.ref===c.ref)if(nn=!1,c.pendingProps=y=C,(o.lanes&N)!==0)(o.flags&131072)!==0&&(nn=!0);else return c.lanes=o.lanes,Vr(o,c,N)}return nf(o,c,p,y,N)}function $k(o,c,p){var y=c.pendingProps,N=y.children,C=o!==null?o.memoizedState:null;if(y.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt(wo,gn),gn|=p;else{if((p&1073741824)===0)return o=C!==null?C.baseLanes|p:p,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:o,cachePool:null,transitions:null},c.updateQueue=null,tt(wo,gn),gn|=o,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},y=C!==null?C.baseLanes:p,tt(wo,gn),gn|=y}else C!==null?(y=C.baseLanes|p,c.memoizedState=null):y=p,tt(wo,gn),gn|=y;return Zt(o,c,N,p),c.child}function Ik(o,c){var p=c.ref;(o===null&&p!==null||o!==null&&o.ref!==p)&&(c.flags|=512,c.flags|=2097152)}function nf(o,c,p,y,N){var C=tn(p)?ca:zt.current;return C=io(c,C),po(c,N),p=Vh(o,c,p,y,C,N),y=Gh(),o!==null&&!nn?(c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~N,Vr(o,c,N)):(it&&y&&Th(c),c.flags|=1,Zt(o,c,p,N),c.child)}function Ok(o,c,p,y,N){if(tn(p)){var C=!0;wc(c)}else C=!1;if(po(c,N),c.stateNode===null)Lc(o,c),Nk(c,p,y),Qh(c,p,y,N),y=!0;else if(o===null){var U=c.stateNode,Q=c.memoizedProps;U.props=Q;var te=U.context,le=p.contextType;typeof le=="object"&&le!==null?le=En(le):(le=tn(p)?ca:zt.current,le=io(c,le));var he=p.getDerivedStateFromProps,me=typeof he=="function"||typeof U.getSnapshotBeforeUpdate=="function";me||typeof U.UNSAFE_componentWillReceiveProps!="function"&&typeof U.componentWillReceiveProps!="function"||(Q!==y||te!==le)&&jk(c,U,y,le),js=!1;var de=c.memoizedState;U.state=de,Ec(c,y,U,N),te=c.memoizedState,Q!==y||de!==te||en.current||js?(typeof he=="function"&&(Jh(c,p,he,y),te=c.memoizedState),(Q=js||kk(c,p,Q,y,de,te,le))?(me||typeof U.UNSAFE_componentWillMount!="function"&&typeof U.componentWillMount!="function"||(typeof U.componentWillMount=="function"&&U.componentWillMount(),typeof U.UNSAFE_componentWillMount=="function"&&U.UNSAFE_componentWillMount()),typeof U.componentDidMount=="function"&&(c.flags|=4194308)):(typeof U.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=y,c.memoizedState=te),U.props=y,U.state=te,U.context=le,y=Q):(typeof U.componentDidMount=="function"&&(c.flags|=4194308),y=!1)}else{U=c.stateNode,Zb(o,c),Q=c.memoizedProps,le=c.type===c.elementType?Q:Gn(c.type,Q),U.props=le,me=c.pendingProps,de=U.context,te=p.contextType,typeof te=="object"&&te!==null?te=En(te):(te=tn(p)?ca:zt.current,te=io(c,te));var ke=p.getDerivedStateFromProps;(he=typeof ke=="function"||typeof U.getSnapshotBeforeUpdate=="function")||typeof U.UNSAFE_componentWillReceiveProps!="function"&&typeof U.componentWillReceiveProps!="function"||(Q!==me||de!==te)&&jk(c,U,y,te),js=!1,de=c.memoizedState,U.state=de,Ec(c,y,U,N);var Se=c.memoizedState;Q!==me||de!==Se||en.current||js?(typeof ke=="function"&&(Jh(c,p,ke,y),Se=c.memoizedState),(le=js||kk(c,p,le,y,de,Se,te)||!1)?(he||typeof U.UNSAFE_componentWillUpdate!="function"&&typeof U.componentWillUpdate!="function"||(typeof U.componentWillUpdate=="function"&&U.componentWillUpdate(y,Se,te),typeof U.UNSAFE_componentWillUpdate=="function"&&U.UNSAFE_componentWillUpdate(y,Se,te)),typeof U.componentDidUpdate=="function"&&(c.flags|=4),typeof U.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof U.componentDidUpdate!="function"||Q===o.memoizedProps&&de===o.memoizedState||(c.flags|=4),typeof U.getSnapshotBeforeUpdate!="function"||Q===o.memoizedProps&&de===o.memoizedState||(c.flags|=1024),c.memoizedProps=y,c.memoizedState=Se),U.props=y,U.state=Se,U.context=te,y=le):(typeof U.componentDidUpdate!="function"||Q===o.memoizedProps&&de===o.memoizedState||(c.flags|=4),typeof U.getSnapshotBeforeUpdate!="function"||Q===o.memoizedProps&&de===o.memoizedState||(c.flags|=1024),y=!1)}return rf(o,c,p,y,C,N)}function rf(o,c,p,y,N,C){Ik(o,c);var U=(c.flags&128)!==0;if(!y&&!U)return N&&qb(c,p,!1),Vr(o,c,C);y=c.stateNode,cL.current=c;var Q=U&&typeof p.getDerivedStateFromError!="function"?null:y.render();return c.flags|=1,o!==null&&U?(c.child=ho(c,o.child,null,C),c.child=ho(c,null,Q,C)):Zt(o,c,Q,C),c.memoizedState=y.state,N&&qb(c,p,!0),c.child}function Lk(o){var c=o.stateNode;c.pendingContext?Db(o,c.pendingContext,c.pendingContext!==c.context):c.context&&Db(o,c.context,!1),qh(o,c.containerInfo)}function Pk(o,c,p,y,N){return uo(),$h(N),c.flags|=256,Zt(o,c,p,y),c.child}var sf={dehydrated:null,treeContext:null,retryLane:0};function af(o){return{baseLanes:o,cachePool:null,transitions:null}}function Dk(o,c,p){var y=c.pendingProps,N=ct.current,C=!1,U=(c.flags&128)!==0,Q;if((Q=U)||(Q=o!==null&&o.memoizedState===null?!1:(N&2)!==0),Q?(C=!0,c.flags&=-129):(o===null||o.memoizedState!==null)&&(N|=1),tt(ct,N&1),o===null)return Mh(c),o=c.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((c.mode&1)===0?c.lanes=1:o.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(U=y.children,o=y.fallback,C?(y=c.mode,C=c.child,U={mode:"hidden",children:U},(y&1)===0&&C!==null?(C.childLanes=0,C.pendingProps=U):C=Kc(U,y,0,null),o=va(o,y,p,null),C.return=c,o.return=c,C.sibling=o,c.child=C,c.child.memoizedState=af(p),c.memoizedState=sf,o):of(c,U));if(N=o.memoizedState,N!==null&&(Q=N.dehydrated,Q!==null))return uL(o,c,U,y,Q,N,p);if(C){C=y.fallback,U=c.mode,N=o.child,Q=N.sibling;var te={mode:"hidden",children:y.children};return(U&1)===0&&c.child!==N?(y=c.child,y.childLanes=0,y.pendingProps=te,c.deletions=null):(y=As(N,te),y.subtreeFlags=N.subtreeFlags&14680064),Q!==null?C=As(Q,C):(C=va(C,U,p,null),C.flags|=2),C.return=c,y.return=c,y.sibling=C,c.child=y,y=C,C=c.child,U=o.child.memoizedState,U=U===null?af(p):{baseLanes:U.baseLanes|p,cachePool:null,transitions:U.transitions},C.memoizedState=U,C.childLanes=o.childLanes&~p,c.memoizedState=sf,y}return C=o.child,o=C.sibling,y=As(C,{mode:"visible",children:y.children}),(c.mode&1)===0&&(y.lanes=p),y.return=c,y.sibling=null,o!==null&&(p=c.deletions,p===null?(c.deletions=[o],c.flags|=16):p.push(o)),c.child=y,c.memoizedState=null,y}function of(o,c){return c=Kc({mode:"visible",children:c},o.mode,0,null),c.return=o,o.child=c}function Oc(o,c,p,y){return y!==null&&$h(y),ho(c,o.child,null,p),o=of(c,c.pendingProps.children),o.flags|=2,c.memoizedState=null,o}function uL(o,c,p,y,N,C,U){if(p)return c.flags&256?(c.flags&=-257,y=ef(Error(n(422))),Oc(o,c,U,y)):c.memoizedState!==null?(c.child=o.child,c.flags|=128,null):(C=y.fallback,N=c.mode,y=Kc({mode:"visible",children:y.children},N,0,null),C=va(C,N,U,null),C.flags|=2,y.return=c,C.return=c,y.sibling=C,c.child=y,(c.mode&1)!==0&&ho(c,o.child,null,U),c.child.memoizedState=af(U),c.memoizedState=sf,C);if((c.mode&1)===0)return Oc(o,c,U,null);if(N.data==="$!"){if(y=N.nextSibling&&N.nextSibling.dataset,y)var Q=y.dgst;return y=Q,C=Error(n(419)),y=ef(C,y,void 0),Oc(o,c,U,y)}if(Q=(U&o.childLanes)!==0,nn||Q){if(y=At,y!==null){switch(U&-U){case 4:N=2;break;case 16:N=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:N=32;break;case 536870912:N=268435456;break;default:N=0}N=(N&(y.suspendedLanes|U))!==0?0:N,N!==0&&N!==C.retryLane&&(C.retryLane=N,Hr(o,N),Xn(y,o,N,-1))}return Nf(),y=ef(Error(n(421))),Oc(o,c,U,y)}return N.data==="$?"?(c.flags|=128,c.child=o.child,c=NL.bind(null,o),N._reactRetry=c,null):(o=C.treeContext,mn=xs(N.nextSibling),pn=c,it=!0,Vn=null,o!==null&&(Sn[_n++]=Ur,Sn[_n++]=zr,Sn[_n++]=ua,Ur=o.id,zr=o.overflow,ua=c),c=of(c,y.children),c.flags|=4096,c)}function Fk(o,c,p){o.lanes|=c;var y=o.alternate;y!==null&&(y.lanes|=c),Ph(o.return,c,p)}function lf(o,c,p,y,N){var C=o.memoizedState;C===null?o.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:y,tail:p,tailMode:N}:(C.isBackwards=c,C.rendering=null,C.renderingStartTime=0,C.last=y,C.tail=p,C.tailMode=N)}function qk(o,c,p){var y=c.pendingProps,N=y.revealOrder,C=y.tail;if(Zt(o,c,y.children,p),y=ct.current,(y&2)!==0)y=y&1|2,c.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=c.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Fk(o,p,c);else if(o.tag===19)Fk(o,p,c);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===c)break e;for(;o.sibling===null;){if(o.return===null||o.return===c)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}y&=1}if(tt(ct,y),(c.mode&1)===0)c.memoizedState=null;else switch(N){case"forwards":for(p=c.child,N=null;p!==null;)o=p.alternate,o!==null&&Cc(o)===null&&(N=p),p=p.sibling;p=N,p===null?(N=c.child,c.child=null):(N=p.sibling,p.sibling=null),lf(c,!1,N,p,C);break;case"backwards":for(p=null,N=c.child,c.child=null;N!==null;){if(o=N.alternate,o!==null&&Cc(o)===null){c.child=N;break}o=N.sibling,N.sibling=p,p=N,N=o}lf(c,!0,p,null,C);break;case"together":lf(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Lc(o,c){(c.mode&1)===0&&o!==null&&(o.alternate=null,c.alternate=null,c.flags|=2)}function Vr(o,c,p){if(o!==null&&(c.dependencies=o.dependencies),ma|=c.lanes,(p&c.childLanes)===0)return null;if(o!==null&&c.child!==o.child)throw Error(n(153));if(c.child!==null){for(o=c.child,p=As(o,o.pendingProps),c.child=p,p.return=c;o.sibling!==null;)o=o.sibling,p=p.sibling=As(o,o.pendingProps),p.return=c;p.sibling=null}return c.child}function dL(o,c,p){switch(c.tag){case 3:Lk(c),uo();break;case 5:ek(c);break;case 1:tn(c.type)&&wc(c);break;case 4:qh(c,c.stateNode.containerInfo);break;case 10:var y=c.type._context,N=c.memoizedProps.value;tt(jc,y._currentValue),y._currentValue=N;break;case 13:if(y=c.memoizedState,y!==null)return y.dehydrated!==null?(tt(ct,ct.current&1),c.flags|=128,null):(p&c.child.childLanes)!==0?Dk(o,c,p):(tt(ct,ct.current&1),o=Vr(o,c,p),o!==null?o.sibling:null);tt(ct,ct.current&1);break;case 19:if(y=(p&c.childLanes)!==0,(o.flags&128)!==0){if(y)return qk(o,c,p);c.flags|=128}if(N=c.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),tt(ct,ct.current),y)break;return null;case 22:case 23:return c.lanes=0,$k(o,c,p)}return Vr(o,c,p)}var Bk,cf,Uk,zk;Bk=function(o,c){for(var p=c.child;p!==null;){if(p.tag===5||p.tag===6)o.appendChild(p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===c)break;for(;p.sibling===null;){if(p.return===null||p.return===c)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},cf=function(){},Uk=function(o,c,p,y){var N=o.memoizedProps;if(N!==y){o=c.stateNode,fa(xr.current);var C=null;switch(p){case"input":N=ye(o,N),y=ye(o,y),C=[];break;case"select":N=H({},N,{value:void 0}),y=H({},y,{value:void 0}),C=[];break;case"textarea":N=Le(o,N),y=Le(o,y),C=[];break;default:typeof N.onClick!="function"&&typeof y.onClick=="function"&&(o.onclick=mc)}bt(p,y);var U;p=null;for(le in N)if(!y.hasOwnProperty(le)&&N.hasOwnProperty(le)&&N[le]!=null)if(le==="style"){var Q=N[le];for(U in Q)Q.hasOwnProperty(U)&&(p||(p={}),p[U]="")}else le!=="dangerouslySetInnerHTML"&&le!=="children"&&le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&le!=="autoFocus"&&(s.hasOwnProperty(le)?C||(C=[]):(C=C||[]).push(le,null));for(le in y){var te=y[le];if(Q=N!=null?N[le]:void 0,y.hasOwnProperty(le)&&te!==Q&&(te!=null||Q!=null))if(le==="style")if(Q){for(U in Q)!Q.hasOwnProperty(U)||te&&te.hasOwnProperty(U)||(p||(p={}),p[U]="");for(U in te)te.hasOwnProperty(U)&&Q[U]!==te[U]&&(p||(p={}),p[U]=te[U])}else p||(C||(C=[]),C.push(le,p)),p=te;else le==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,Q=Q?Q.__html:void 0,te!=null&&Q!==te&&(C=C||[]).push(le,te)):le==="children"?typeof te!="string"&&typeof te!="number"||(C=C||[]).push(le,""+te):le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&(s.hasOwnProperty(le)?(te!=null&&le==="onScroll"&&nt("scroll",o),C||Q===te||(C=[])):(C=C||[]).push(le,te))}p&&(C=C||[]).push("style",p);var le=C;(c.updateQueue=le)&&(c.flags|=4)}},zk=function(o,c,p,y){p!==y&&(c.flags|=4)};function Ui(o,c){if(!it)switch(o.tailMode){case"hidden":c=o.tail;for(var p=null;c!==null;)c.alternate!==null&&(p=c),c=c.sibling;p===null?o.tail=null:p.sibling=null;break;case"collapsed":p=o.tail;for(var y=null;p!==null;)p.alternate!==null&&(y=p),p=p.sibling;y===null?c||o.tail===null?o.tail=null:o.tail.sibling=null:y.sibling=null}}function Wt(o){var c=o.alternate!==null&&o.alternate.child===o.child,p=0,y=0;if(c)for(var N=o.child;N!==null;)p|=N.lanes|N.childLanes,y|=N.subtreeFlags&14680064,y|=N.flags&14680064,N.return=o,N=N.sibling;else for(N=o.child;N!==null;)p|=N.lanes|N.childLanes,y|=N.subtreeFlags,y|=N.flags,N.return=o,N=N.sibling;return o.subtreeFlags|=y,o.childLanes=p,c}function hL(o,c,p){var y=c.pendingProps;switch(Rh(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(c),null;case 1:return tn(c.type)&&yc(),Wt(c),null;case 3:return y=c.stateNode,mo(),rt(en),rt(zt),zh(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(o===null||o.child===null)&&(kc(c)?c.flags|=4:o===null||o.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Vn!==null&&(xf(Vn),Vn=null))),cf(o,c),Wt(c),null;case 5:Bh(c);var N=fa(Pi.current);if(p=c.type,o!==null&&c.stateNode!=null)Uk(o,c,p,y,N),o.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!y){if(c.stateNode===null)throw Error(n(166));return Wt(c),null}if(o=fa(xr.current),kc(c)){y=c.stateNode,p=c.type;var C=c.memoizedProps;switch(y[vr]=c,y[Mi]=C,o=(c.mode&1)!==0,p){case"dialog":nt("cancel",y),nt("close",y);break;case"iframe":case"object":case"embed":nt("load",y);break;case"video":case"audio":for(N=0;N<Ti.length;N++)nt(Ti[N],y);break;case"source":nt("error",y);break;case"img":case"image":case"link":nt("error",y),nt("load",y);break;case"details":nt("toggle",y);break;case"input":ve(y,C),nt("invalid",y);break;case"select":y._wrapperState={wasMultiple:!!C.multiple},nt("invalid",y);break;case"textarea":$e(y,C),nt("invalid",y)}bt(p,C),N=null;for(var U in C)if(C.hasOwnProperty(U)){var Q=C[U];U==="children"?typeof Q=="string"?y.textContent!==Q&&(C.suppressHydrationWarning!==!0&&pc(y.textContent,Q,o),N=["children",Q]):typeof Q=="number"&&y.textContent!==""+Q&&(C.suppressHydrationWarning!==!0&&pc(y.textContent,Q,o),N=["children",""+Q]):s.hasOwnProperty(U)&&Q!=null&&U==="onScroll"&&nt("scroll",y)}switch(p){case"input":fe(y),ue(y,C,!0);break;case"textarea":fe(y),Xe(y);break;case"select":case"option":break;default:typeof C.onClick=="function"&&(y.onclick=mc)}y=N,c.updateQueue=y,y!==null&&(c.flags|=4)}else{U=N.nodeType===9?N:N.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=Ge(p)),o==="http://www.w3.org/1999/xhtml"?p==="script"?(o=U.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof y.is=="string"?o=U.createElement(p,{is:y.is}):(o=U.createElement(p),p==="select"&&(U=o,y.multiple?U.multiple=!0:y.size&&(U.size=y.size))):o=U.createElementNS(o,p),o[vr]=c,o[Mi]=y,Bk(o,c,!1,!1),c.stateNode=o;e:{switch(U=kt(p,y),p){case"dialog":nt("cancel",o),nt("close",o),N=y;break;case"iframe":case"object":case"embed":nt("load",o),N=y;break;case"video":case"audio":for(N=0;N<Ti.length;N++)nt(Ti[N],o);N=y;break;case"source":nt("error",o),N=y;break;case"img":case"image":case"link":nt("error",o),nt("load",o),N=y;break;case"details":nt("toggle",o),N=y;break;case"input":ve(o,y),N=ye(o,y),nt("invalid",o);break;case"option":N=y;break;case"select":o._wrapperState={wasMultiple:!!y.multiple},N=H({},y,{value:void 0}),nt("invalid",o);break;case"textarea":$e(o,y),N=Le(o,y),nt("invalid",o);break;default:N=y}bt(p,N),Q=N;for(C in Q)if(Q.hasOwnProperty(C)){var te=Q[C];C==="style"?ot(o,te):C==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&Ot(o,te)):C==="children"?typeof te=="string"?(p!=="textarea"||te!=="")&&mt(o,te):typeof te=="number"&&mt(o,""+te):C!=="suppressContentEditableWarning"&&C!=="suppressHydrationWarning"&&C!=="autoFocus"&&(s.hasOwnProperty(C)?te!=null&&C==="onScroll"&&nt("scroll",o):te!=null&&_(o,C,te,U))}switch(p){case"input":fe(o),ue(o,y,!1);break;case"textarea":fe(o),Xe(o);break;case"option":y.value!=null&&o.setAttribute("value",""+ee(y.value));break;case"select":o.multiple=!!y.multiple,C=y.value,C!=null?Te(o,!!y.multiple,C,!1):y.defaultValue!=null&&Te(o,!!y.multiple,y.defaultValue,!0);break;default:typeof N.onClick=="function"&&(o.onclick=mc)}switch(p){case"button":case"input":case"select":case"textarea":y=!!y.autoFocus;break e;case"img":y=!0;break e;default:y=!1}}y&&(c.flags|=4)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return Wt(c),null;case 6:if(o&&c.stateNode!=null)zk(o,c,o.memoizedProps,y);else{if(typeof y!="string"&&c.stateNode===null)throw Error(n(166));if(p=fa(Pi.current),fa(xr.current),kc(c)){if(y=c.stateNode,p=c.memoizedProps,y[vr]=c,(C=y.nodeValue!==p)&&(o=pn,o!==null))switch(o.tag){case 3:pc(y.nodeValue,p,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&pc(y.nodeValue,p,(o.mode&1)!==0)}C&&(c.flags|=4)}else y=(p.nodeType===9?p:p.ownerDocument).createTextNode(y),y[vr]=c,c.stateNode=y}return Wt(c),null;case 13:if(rt(ct),y=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(it&&mn!==null&&(c.mode&1)!==0&&(c.flags&128)===0)Vb(),uo(),c.flags|=98560,C=!1;else if(C=kc(c),y!==null&&y.dehydrated!==null){if(o===null){if(!C)throw Error(n(318));if(C=c.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(n(317));C[vr]=c}else uo(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Wt(c),C=!1}else Vn!==null&&(xf(Vn),Vn=null),C=!0;if(!C)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=p,c):(y=y!==null,y!==(o!==null&&o.memoizedState!==null)&&y&&(c.child.flags|=8192,(c.mode&1)!==0&&(o===null||(ct.current&1)!==0?St===0&&(St=3):Nf())),c.updateQueue!==null&&(c.flags|=4),Wt(c),null);case 4:return mo(),cf(o,c),o===null&&Ri(c.stateNode.containerInfo),Wt(c),null;case 10:return Lh(c.type._context),Wt(c),null;case 17:return tn(c.type)&&yc(),Wt(c),null;case 19:if(rt(ct),C=c.memoizedState,C===null)return Wt(c),null;if(y=(c.flags&128)!==0,U=C.rendering,U===null)if(y)Ui(C,!1);else{if(St!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(U=Cc(o),U!==null){for(c.flags|=128,Ui(C,!1),y=U.updateQueue,y!==null&&(c.updateQueue=y,c.flags|=4),c.subtreeFlags=0,y=p,p=c.child;p!==null;)C=p,o=y,C.flags&=14680066,U=C.alternate,U===null?(C.childLanes=0,C.lanes=o,C.child=null,C.subtreeFlags=0,C.memoizedProps=null,C.memoizedState=null,C.updateQueue=null,C.dependencies=null,C.stateNode=null):(C.childLanes=U.childLanes,C.lanes=U.lanes,C.child=U.child,C.subtreeFlags=0,C.deletions=null,C.memoizedProps=U.memoizedProps,C.memoizedState=U.memoizedState,C.updateQueue=U.updateQueue,C.type=U.type,o=U.dependencies,C.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),p=p.sibling;return tt(ct,ct.current&1|2),c.child}o=o.sibling}C.tail!==null&&Ke()>vo&&(c.flags|=128,y=!0,Ui(C,!1),c.lanes=4194304)}else{if(!y)if(o=Cc(U),o!==null){if(c.flags|=128,y=!0,p=o.updateQueue,p!==null&&(c.updateQueue=p,c.flags|=4),Ui(C,!0),C.tail===null&&C.tailMode==="hidden"&&!U.alternate&&!it)return Wt(c),null}else 2*Ke()-C.renderingStartTime>vo&&p!==1073741824&&(c.flags|=128,y=!0,Ui(C,!1),c.lanes=4194304);C.isBackwards?(U.sibling=c.child,c.child=U):(p=C.last,p!==null?p.sibling=U:c.child=U,C.last=U)}return C.tail!==null?(c=C.tail,C.rendering=c,C.tail=c.sibling,C.renderingStartTime=Ke(),c.sibling=null,p=ct.current,tt(ct,y?p&1|2:p&1),c):(Wt(c),null);case 22:case 23:return kf(),y=c.memoizedState!==null,o!==null&&o.memoizedState!==null!==y&&(c.flags|=8192),y&&(c.mode&1)!==0?(gn&1073741824)!==0&&(Wt(c),c.subtreeFlags&6&&(c.flags|=8192)):Wt(c),null;case 24:return null;case 25:return null}throw Error(n(156,c.tag))}function fL(o,c){switch(Rh(c),c.tag){case 1:return tn(c.type)&&yc(),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return mo(),rt(en),rt(zt),zh(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 5:return Bh(c),null;case 13:if(rt(ct),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(n(340));uo()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return rt(ct),null;case 4:return mo(),null;case 10:return Lh(c.type._context),null;case 22:case 23:return kf(),null;case 24:return null;default:return null}}var Pc=!1,Vt=!1,pL=typeof WeakSet=="function"?WeakSet:Set,je=null;function yo(o,c){var p=o.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(y){dt(o,c,y)}else p.current=null}function uf(o,c,p){try{p()}catch(y){dt(o,c,y)}}var Hk=!1;function mL(o,c){if(bh=ys,o=kb(),fh(o)){if("selectionStart"in o)var p={start:o.selectionStart,end:o.selectionEnd};else e:{p=(p=o.ownerDocument)&&p.defaultView||window;var y=p.getSelection&&p.getSelection();if(y&&y.rangeCount!==0){p=y.anchorNode;var N=y.anchorOffset,C=y.focusNode;y=y.focusOffset;try{p.nodeType,C.nodeType}catch{p=null;break e}var U=0,Q=-1,te=-1,le=0,he=0,me=o,de=null;t:for(;;){for(var ke;me!==p||N!==0&&me.nodeType!==3||(Q=U+N),me!==C||y!==0&&me.nodeType!==3||(te=U+y),me.nodeType===3&&(U+=me.nodeValue.length),(ke=me.firstChild)!==null;)de=me,me=ke;for(;;){if(me===o)break t;if(de===p&&++le===N&&(Q=U),de===C&&++he===y&&(te=U),(ke=me.nextSibling)!==null)break;me=de,de=me.parentNode}me=ke}p=Q===-1||te===-1?null:{start:Q,end:te}}else p=null}p=p||{start:0,end:0}}else p=null;for(kh={focusedElem:o,selectionRange:p},ys=!1,je=c;je!==null;)if(c=je,o=c.child,(c.subtreeFlags&1028)!==0&&o!==null)o.return=c,je=o;else for(;je!==null;){c=je;try{var Se=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(Se!==null){var _e=Se.memoizedProps,ft=Se.memoizedState,ae=c.stateNode,ne=ae.getSnapshotBeforeUpdate(c.elementType===c.type?_e:Gn(c.type,_e),ft);ae.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var ie=c.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ge){dt(c,c.return,ge)}if(o=c.sibling,o!==null){o.return=c.return,je=o;break}je=c.return}return Se=Hk,Hk=!1,Se}function zi(o,c,p){var y=c.updateQueue;if(y=y!==null?y.lastEffect:null,y!==null){var N=y=y.next;do{if((N.tag&o)===o){var C=N.destroy;N.destroy=void 0,C!==void 0&&uf(c,p,C)}N=N.next}while(N!==y)}}function Dc(o,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var p=c=c.next;do{if((p.tag&o)===o){var y=p.create;p.destroy=y()}p=p.next}while(p!==c)}}function df(o){var c=o.ref;if(c!==null){var p=o.stateNode;switch(o.tag){case 5:o=p;break;default:o=p}typeof c=="function"?c(o):c.current=o}}function Wk(o){var c=o.alternate;c!==null&&(o.alternate=null,Wk(c)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(c=o.stateNode,c!==null&&(delete c[vr],delete c[Mi],delete c[_h],delete c[ZO],delete c[JO])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Vk(o){return o.tag===5||o.tag===3||o.tag===4}function Gk(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Vk(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function hf(o,c,p){var y=o.tag;if(y===5||y===6)o=o.stateNode,c?p.nodeType===8?p.parentNode.insertBefore(o,c):p.insertBefore(o,c):(p.nodeType===8?(c=p.parentNode,c.insertBefore(o,p)):(c=p,c.appendChild(o)),p=p._reactRootContainer,p!=null||c.onclick!==null||(c.onclick=mc));else if(y!==4&&(o=o.child,o!==null))for(hf(o,c,p),o=o.sibling;o!==null;)hf(o,c,p),o=o.sibling}function ff(o,c,p){var y=o.tag;if(y===5||y===6)o=o.stateNode,c?p.insertBefore(o,c):p.appendChild(o);else if(y!==4&&(o=o.child,o!==null))for(ff(o,c,p),o=o.sibling;o!==null;)ff(o,c,p),o=o.sibling}var Lt=null,Kn=!1;function _s(o,c,p){for(p=p.child;p!==null;)Kk(o,c,p),p=p.sibling}function Kk(o,c,p){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(us,p)}catch{}switch(p.tag){case 5:Vt||yo(p,c);case 6:var y=Lt,N=Kn;Lt=null,_s(o,c,p),Lt=y,Kn=N,Lt!==null&&(Kn?(o=Lt,p=p.stateNode,o.nodeType===8?o.parentNode.removeChild(p):o.removeChild(p)):Lt.removeChild(p.stateNode));break;case 18:Lt!==null&&(Kn?(o=Lt,p=p.stateNode,o.nodeType===8?Sh(o.parentNode,p):o.nodeType===1&&Sh(o,p),Or(o)):Sh(Lt,p.stateNode));break;case 4:y=Lt,N=Kn,Lt=p.stateNode.containerInfo,Kn=!0,_s(o,c,p),Lt=y,Kn=N;break;case 0:case 11:case 14:case 15:if(!Vt&&(y=p.updateQueue,y!==null&&(y=y.lastEffect,y!==null))){N=y=y.next;do{var C=N,U=C.destroy;C=C.tag,U!==void 0&&((C&2)!==0||(C&4)!==0)&&uf(p,c,U),N=N.next}while(N!==y)}_s(o,c,p);break;case 1:if(!Vt&&(yo(p,c),y=p.stateNode,typeof y.componentWillUnmount=="function"))try{y.props=p.memoizedProps,y.state=p.memoizedState,y.componentWillUnmount()}catch(Q){dt(p,c,Q)}_s(o,c,p);break;case 21:_s(o,c,p);break;case 22:p.mode&1?(Vt=(y=Vt)||p.memoizedState!==null,_s(o,c,p),Vt=y):_s(o,c,p);break;default:_s(o,c,p)}}function Yk(o){var c=o.updateQueue;if(c!==null){o.updateQueue=null;var p=o.stateNode;p===null&&(p=o.stateNode=new pL),c.forEach(function(y){var N=jL.bind(null,o,y);p.has(y)||(p.add(y),y.then(N,N))})}}function Yn(o,c){var p=c.deletions;if(p!==null)for(var y=0;y<p.length;y++){var N=p[y];try{var C=o,U=c,Q=U;e:for(;Q!==null;){switch(Q.tag){case 5:Lt=Q.stateNode,Kn=!1;break e;case 3:Lt=Q.stateNode.containerInfo,Kn=!0;break e;case 4:Lt=Q.stateNode.containerInfo,Kn=!0;break e}Q=Q.return}if(Lt===null)throw Error(n(160));Kk(C,U,N),Lt=null,Kn=!1;var te=N.alternate;te!==null&&(te.return=null),N.return=null}catch(le){dt(N,c,le)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)Xk(c,o),c=c.sibling}function Xk(o,c){var p=o.alternate,y=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Yn(c,o),kr(o),y&4){try{zi(3,o,o.return),Dc(3,o)}catch(_e){dt(o,o.return,_e)}try{zi(5,o,o.return)}catch(_e){dt(o,o.return,_e)}}break;case 1:Yn(c,o),kr(o),y&512&&p!==null&&yo(p,p.return);break;case 5:if(Yn(c,o),kr(o),y&512&&p!==null&&yo(p,p.return),o.flags&32){var N=o.stateNode;try{mt(N,"")}catch(_e){dt(o,o.return,_e)}}if(y&4&&(N=o.stateNode,N!=null)){var C=o.memoizedProps,U=p!==null?p.memoizedProps:C,Q=o.type,te=o.updateQueue;if(o.updateQueue=null,te!==null)try{Q==="input"&&C.type==="radio"&&C.name!=null&&Ie(N,C),kt(Q,U);var le=kt(Q,C);for(U=0;U<te.length;U+=2){var he=te[U],me=te[U+1];he==="style"?ot(N,me):he==="dangerouslySetInnerHTML"?Ot(N,me):he==="children"?mt(N,me):_(N,he,me,le)}switch(Q){case"input":xe(N,C);break;case"textarea":Oe(N,C);break;case"select":var de=N._wrapperState.wasMultiple;N._wrapperState.wasMultiple=!!C.multiple;var ke=C.value;ke!=null?Te(N,!!C.multiple,ke,!1):de!==!!C.multiple&&(C.defaultValue!=null?Te(N,!!C.multiple,C.defaultValue,!0):Te(N,!!C.multiple,C.multiple?[]:"",!1))}N[Mi]=C}catch(_e){dt(o,o.return,_e)}}break;case 6:if(Yn(c,o),kr(o),y&4){if(o.stateNode===null)throw Error(n(162));N=o.stateNode,C=o.memoizedProps;try{N.nodeValue=C}catch(_e){dt(o,o.return,_e)}}break;case 3:if(Yn(c,o),kr(o),y&4&&p!==null&&p.memoizedState.isDehydrated)try{Or(c.containerInfo)}catch(_e){dt(o,o.return,_e)}break;case 4:Yn(c,o),kr(o);break;case 13:Yn(c,o),kr(o),N=o.child,N.flags&8192&&(C=N.memoizedState!==null,N.stateNode.isHidden=C,!C||N.alternate!==null&&N.alternate.memoizedState!==null||(gf=Ke())),y&4&&Yk(o);break;case 22:if(he=p!==null&&p.memoizedState!==null,o.mode&1?(Vt=(le=Vt)||he,Yn(c,o),Vt=le):Yn(c,o),kr(o),y&8192){if(le=o.memoizedState!==null,(o.stateNode.isHidden=le)&&!he&&(o.mode&1)!==0)for(je=o,he=o.child;he!==null;){for(me=je=he;je!==null;){switch(de=je,ke=de.child,de.tag){case 0:case 11:case 14:case 15:zi(4,de,de.return);break;case 1:yo(de,de.return);var Se=de.stateNode;if(typeof Se.componentWillUnmount=="function"){y=de,p=de.return;try{c=y,Se.props=c.memoizedProps,Se.state=c.memoizedState,Se.componentWillUnmount()}catch(_e){dt(y,p,_e)}}break;case 5:yo(de,de.return);break;case 22:if(de.memoizedState!==null){Qk(me);continue}}ke!==null?(ke.return=de,je=ke):Qk(me)}he=he.sibling}e:for(he=null,me=o;;){if(me.tag===5){if(he===null){he=me;try{N=me.stateNode,le?(C=N.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none"):(Q=me.stateNode,te=me.memoizedProps.style,U=te!=null&&te.hasOwnProperty("display")?te.display:null,Q.style.display=Qe("display",U))}catch(_e){dt(o,o.return,_e)}}}else if(me.tag===6){if(he===null)try{me.stateNode.nodeValue=le?"":me.memoizedProps}catch(_e){dt(o,o.return,_e)}}else if((me.tag!==22&&me.tag!==23||me.memoizedState===null||me===o)&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===o)break e;for(;me.sibling===null;){if(me.return===null||me.return===o)break e;he===me&&(he=null),me=me.return}he===me&&(he=null),me.sibling.return=me.return,me=me.sibling}}break;case 19:Yn(c,o),kr(o),y&4&&Yk(o);break;case 21:break;default:Yn(c,o),kr(o)}}function kr(o){var c=o.flags;if(c&2){try{e:{for(var p=o.return;p!==null;){if(Vk(p)){var y=p;break e}p=p.return}throw Error(n(160))}switch(y.tag){case 5:var N=y.stateNode;y.flags&32&&(mt(N,""),y.flags&=-33);var C=Gk(o);ff(o,C,N);break;case 3:case 4:var U=y.stateNode.containerInfo,Q=Gk(o);hf(o,Q,U);break;default:throw Error(n(161))}}catch(te){dt(o,o.return,te)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function gL(o,c,p){je=o,Zk(o)}function Zk(o,c,p){for(var y=(o.mode&1)!==0;je!==null;){var N=je,C=N.child;if(N.tag===22&&y){var U=N.memoizedState!==null||Pc;if(!U){var Q=N.alternate,te=Q!==null&&Q.memoizedState!==null||Vt;Q=Pc;var le=Vt;if(Pc=U,(Vt=te)&&!le)for(je=N;je!==null;)U=je,te=U.child,U.tag===22&&U.memoizedState!==null?e1(N):te!==null?(te.return=U,je=te):e1(N);for(;C!==null;)je=C,Zk(C),C=C.sibling;je=N,Pc=Q,Vt=le}Jk(o)}else(N.subtreeFlags&8772)!==0&&C!==null?(C.return=N,je=C):Jk(o)}}function Jk(o){for(;je!==null;){var c=je;if((c.flags&8772)!==0){var p=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:Vt||Dc(5,c);break;case 1:var y=c.stateNode;if(c.flags&4&&!Vt)if(p===null)y.componentDidMount();else{var N=c.elementType===c.type?p.memoizedProps:Gn(c.type,p.memoizedProps);y.componentDidUpdate(N,p.memoizedState,y.__reactInternalSnapshotBeforeUpdate)}var C=c.updateQueue;C!==null&&Qb(c,C,y);break;case 3:var U=c.updateQueue;if(U!==null){if(p=null,c.child!==null)switch(c.child.tag){case 5:p=c.child.stateNode;break;case 1:p=c.child.stateNode}Qb(c,U,p)}break;case 5:var Q=c.stateNode;if(p===null&&c.flags&4){p=Q;var te=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":te.autoFocus&&p.focus();break;case"img":te.src&&(p.src=te.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var le=c.alternate;if(le!==null){var he=le.memoizedState;if(he!==null){var me=he.dehydrated;me!==null&&Or(me)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Vt||c.flags&512&&df(c)}catch(de){dt(c,c.return,de)}}if(c===o){je=null;break}if(p=c.sibling,p!==null){p.return=c.return,je=p;break}je=c.return}}function Qk(o){for(;je!==null;){var c=je;if(c===o){je=null;break}var p=c.sibling;if(p!==null){p.return=c.return,je=p;break}je=c.return}}function e1(o){for(;je!==null;){var c=je;try{switch(c.tag){case 0:case 11:case 15:var p=c.return;try{Dc(4,c)}catch(te){dt(c,p,te)}break;case 1:var y=c.stateNode;if(typeof y.componentDidMount=="function"){var N=c.return;try{y.componentDidMount()}catch(te){dt(c,N,te)}}var C=c.return;try{df(c)}catch(te){dt(c,C,te)}break;case 5:var U=c.return;try{df(c)}catch(te){dt(c,U,te)}}}catch(te){dt(c,c.return,te)}if(c===o){je=null;break}var Q=c.sibling;if(Q!==null){Q.return=c.return,je=Q;break}je=c.return}}var yL=Math.ceil,Fc=E.ReactCurrentDispatcher,pf=E.ReactCurrentOwner,Tn=E.ReactCurrentBatchConfig,ze=0,At=null,yt=null,Pt=0,gn=0,wo=bs(0),St=0,Hi=null,ma=0,qc=0,mf=0,Wi=null,rn=null,gf=0,vo=1/0,Gr=null,Bc=!1,yf=null,Es=null,Uc=!1,Cs=null,zc=0,Vi=0,wf=null,Hc=-1,Wc=0;function Jt(){return(ze&6)!==0?Ke():Hc!==-1?Hc:Hc=Ke()}function Ts(o){return(o.mode&1)===0?1:(ze&2)!==0&&Pt!==0?Pt&-Pt:eL.transition!==null?(Wc===0&&(Wc=mi()),Wc):(o=Ue,o!==0||(o=window.event,o=o===void 0?16:oa(o.type)),o)}function Xn(o,c,p,y){if(50<Vi)throw Vi=0,wf=null,Error(n(185));Qs(o,p,y),((ze&2)===0||o!==At)&&(o===At&&((ze&2)===0&&(qc|=p),St===4&&Rs(o,Pt)),sn(o,y),p===1&&ze===0&&(c.mode&1)===0&&(vo=Ke()+500,vc&&Ns()))}function sn(o,c){var p=o.callbackNode;oh(o,c);var y=jn(o,o===At?Pt:0);if(y===0)p!==null&&fr(p),o.callbackNode=null,o.callbackPriority=0;else if(c=y&-y,o.callbackPriority!==c){if(p!=null&&fr(p),c===1)o.tag===0?QO(n1.bind(null,o)):Bb(n1.bind(null,o)),YO(function(){(ze&6)===0&&Ns()}),p=null;else{switch(Jl(y)){case 1:p=pr;break;case 4:p=Ya;break;case 16:p=cs;break;case 536870912:p=Zs;break;default:p=cs}p=u1(p,t1.bind(null,o))}o.callbackPriority=c,o.callbackNode=p}}function t1(o,c){if(Hc=-1,Wc=0,(ze&6)!==0)throw Error(n(327));var p=o.callbackNode;if(xo()&&o.callbackNode!==p)return null;var y=jn(o,o===At?Pt:0);if(y===0)return null;if((y&30)!==0||(y&o.expiredLanes)!==0||c)c=Vc(o,y);else{c=y;var N=ze;ze|=2;var C=s1();(At!==o||Pt!==c)&&(Gr=null,vo=Ke()+500,ya(o,c));do try{xL();break}catch(Q){r1(o,Q)}while(!0);Oh(),Fc.current=C,ze=N,yt!==null?c=0:(At=null,Pt=0,c=St)}if(c!==0){if(c===2&&(N=pi(o),N!==0&&(y=N,c=vf(o,N))),c===1)throw p=Hi,ya(o,0),Rs(o,y),sn(o,Ke()),p;if(c===6)Rs(o,y);else{if(N=o.current.alternate,(y&30)===0&&!wL(N)&&(c=Vc(o,y),c===2&&(C=pi(o),C!==0&&(y=C,c=vf(o,C))),c===1))throw p=Hi,ya(o,0),Rs(o,y),sn(o,Ke()),p;switch(o.finishedWork=N,o.finishedLanes=y,c){case 0:case 1:throw Error(n(345));case 2:wa(o,rn,Gr);break;case 3:if(Rs(o,y),(y&130023424)===y&&(c=gf+500-Ke(),10<c)){if(jn(o,0)!==0)break;if(N=o.suspendedLanes,(N&y)!==y){Jt(),o.pingedLanes|=o.suspendedLanes&N;break}o.timeoutHandle=jh(wa.bind(null,o,rn,Gr),c);break}wa(o,rn,Gr);break;case 4:if(Rs(o,y),(y&4194240)===y)break;for(c=o.eventTimes,N=-1;0<y;){var U=31-Nt(y);C=1<<U,U=c[U],U>N&&(N=U),y&=~C}if(y=N,y=Ke()-y,y=(120>y?120:480>y?480:1080>y?1080:1920>y?1920:3e3>y?3e3:4320>y?4320:1960*yL(y/1960))-y,10<y){o.timeoutHandle=jh(wa.bind(null,o,rn,Gr),y);break}wa(o,rn,Gr);break;case 5:wa(o,rn,Gr);break;default:throw Error(n(329))}}}return sn(o,Ke()),o.callbackNode===p?t1.bind(null,o):null}function vf(o,c){var p=Wi;return o.current.memoizedState.isDehydrated&&(ya(o,c).flags|=256),o=Vc(o,c),o!==2&&(c=rn,rn=p,c!==null&&xf(c)),o}function xf(o){rn===null?rn=o:rn.push.apply(rn,o)}function wL(o){for(var c=o;;){if(c.flags&16384){var p=c.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var y=0;y<p.length;y++){var N=p[y],C=N.getSnapshot;N=N.value;try{if(!Wn(C(),N))return!1}catch{return!1}}}if(p=c.child,c.subtreeFlags&16384&&p!==null)p.return=c,c=p;else{if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Rs(o,c){for(c&=~mf,c&=~qc,o.suspendedLanes|=c,o.pingedLanes&=~c,o=o.expirationTimes;0<c;){var p=31-Nt(c),y=1<<p;o[p]=-1,c&=~y}}function n1(o){if((ze&6)!==0)throw Error(n(327));xo();var c=jn(o,0);if((c&1)===0)return sn(o,Ke()),null;var p=Vc(o,c);if(o.tag!==0&&p===2){var y=pi(o);y!==0&&(c=y,p=vf(o,y))}if(p===1)throw p=Hi,ya(o,0),Rs(o,c),sn(o,Ke()),p;if(p===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=c,wa(o,rn,Gr),sn(o,Ke()),null}function bf(o,c){var p=ze;ze|=1;try{return o(c)}finally{ze=p,ze===0&&(vo=Ke()+500,vc&&Ns())}}function ga(o){Cs!==null&&Cs.tag===0&&(ze&6)===0&&xo();var c=ze;ze|=1;var p=Tn.transition,y=Ue;try{if(Tn.transition=null,Ue=1,o)return o()}finally{Ue=y,Tn.transition=p,ze=c,(ze&6)===0&&Ns()}}function kf(){gn=wo.current,rt(wo)}function ya(o,c){o.finishedWork=null,o.finishedLanes=0;var p=o.timeoutHandle;if(p!==-1&&(o.timeoutHandle=-1,KO(p)),yt!==null)for(p=yt.return;p!==null;){var y=p;switch(Rh(y),y.tag){case 1:y=y.type.childContextTypes,y!=null&&yc();break;case 3:mo(),rt(en),rt(zt),zh();break;case 5:Bh(y);break;case 4:mo();break;case 13:rt(ct);break;case 19:rt(ct);break;case 10:Lh(y.type._context);break;case 22:case 23:kf()}p=p.return}if(At=o,yt=o=As(o.current,null),Pt=gn=c,St=0,Hi=null,mf=qc=ma=0,rn=Wi=null,ha!==null){for(c=0;c<ha.length;c++)if(p=ha[c],y=p.interleaved,y!==null){p.interleaved=null;var N=y.next,C=p.pending;if(C!==null){var U=C.next;C.next=N,y.next=U}p.pending=y}ha=null}return o}function r1(o,c){do{var p=yt;try{if(Oh(),Tc.current=$c,Rc){for(var y=ut.memoizedState;y!==null;){var N=y.queue;N!==null&&(N.pending=null),y=y.next}Rc=!1}if(pa=0,Rt=jt=ut=null,Di=!1,Fi=0,pf.current=null,p===null||p.return===null){St=1,Hi=c,yt=null;break}e:{var C=o,U=p.return,Q=p,te=c;if(c=Pt,Q.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var le=te,he=Q,me=he.tag;if((he.mode&1)===0&&(me===0||me===11||me===15)){var de=he.alternate;de?(he.updateQueue=de.updateQueue,he.memoizedState=de.memoizedState,he.lanes=de.lanes):(he.updateQueue=null,he.memoizedState=null)}var ke=Ck(U);if(ke!==null){ke.flags&=-257,Tk(ke,U,Q,C,c),ke.mode&1&&Ek(C,le,c),c=ke,te=le;var Se=c.updateQueue;if(Se===null){var _e=new Set;_e.add(te),c.updateQueue=_e}else Se.add(te);break e}else{if((c&1)===0){Ek(C,le,c),Nf();break e}te=Error(n(426))}}else if(it&&Q.mode&1){var ft=Ck(U);if(ft!==null){(ft.flags&65536)===0&&(ft.flags|=256),Tk(ft,U,Q,C,c),$h(go(te,Q));break e}}C=te=go(te,Q),St!==4&&(St=2),Wi===null?Wi=[C]:Wi.push(C),C=U;do{switch(C.tag){case 3:C.flags|=65536,c&=-c,C.lanes|=c;var ae=Sk(C,te,c);Jb(C,ae);break e;case 1:Q=te;var ne=C.type,ie=C.stateNode;if((C.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(Es===null||!Es.has(ie)))){C.flags|=65536,c&=-c,C.lanes|=c;var ge=_k(C,Q,c);Jb(C,ge);break e}}C=C.return}while(C!==null)}o1(p)}catch(Ee){c=Ee,yt===p&&p!==null&&(yt=p=p.return);continue}break}while(!0)}function s1(){var o=Fc.current;return Fc.current=$c,o===null?$c:o}function Nf(){(St===0||St===3||St===2)&&(St=4),At===null||(ma&268435455)===0&&(qc&268435455)===0||Rs(At,Pt)}function Vc(o,c){var p=ze;ze|=2;var y=s1();(At!==o||Pt!==c)&&(Gr=null,ya(o,c));do try{vL();break}catch(N){r1(o,N)}while(!0);if(Oh(),ze=p,Fc.current=y,yt!==null)throw Error(n(261));return At=null,Pt=0,St}function vL(){for(;yt!==null;)a1(yt)}function xL(){for(;yt!==null&&!Ga();)a1(yt)}function a1(o){var c=c1(o.alternate,o,gn);o.memoizedProps=o.pendingProps,c===null?o1(o):yt=c,pf.current=null}function o1(o){var c=o;do{var p=c.alternate;if(o=c.return,(c.flags&32768)===0){if(p=hL(p,c,gn),p!==null){yt=p;return}}else{if(p=fL(p,c),p!==null){p.flags&=32767,yt=p;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{St=6,yt=null;return}}if(c=c.sibling,c!==null){yt=c;return}yt=c=o}while(c!==null);St===0&&(St=5)}function wa(o,c,p){var y=Ue,N=Tn.transition;try{Tn.transition=null,Ue=1,bL(o,c,p,y)}finally{Tn.transition=N,Ue=y}return null}function bL(o,c,p,y){do xo();while(Cs!==null);if((ze&6)!==0)throw Error(n(327));p=o.finishedWork;var N=o.finishedLanes;if(p===null)return null;if(o.finishedWork=null,o.finishedLanes=0,p===o.current)throw Error(n(177));o.callbackNode=null,o.callbackPriority=0;var C=p.lanes|p.childLanes;if(Zl(o,C),o===At&&(yt=At=null,Pt=0),(p.subtreeFlags&2064)===0&&(p.flags&2064)===0||Uc||(Uc=!0,u1(cs,function(){return xo(),null})),C=(p.flags&15990)!==0,(p.subtreeFlags&15990)!==0||C){C=Tn.transition,Tn.transition=null;var U=Ue;Ue=1;var Q=ze;ze|=4,pf.current=null,mL(o,p),Xk(p,o),BO(kh),ys=!!bh,kh=bh=null,o.current=p,gL(p),Ka(),ze=Q,Ue=U,Tn.transition=C}else o.current=p;if(Uc&&(Uc=!1,Cs=o,zc=N),C=o.pendingLanes,C===0&&(Es=null),ds(p.stateNode),sn(o,Ke()),c!==null)for(y=o.onRecoverableError,p=0;p<c.length;p++)N=c[p],y(N.value,{componentStack:N.stack,digest:N.digest});if(Bc)throw Bc=!1,o=yf,yf=null,o;return(zc&1)!==0&&o.tag!==0&&xo(),C=o.pendingLanes,(C&1)!==0?o===wf?Vi++:(Vi=0,wf=o):Vi=0,Ns(),null}function xo(){if(Cs!==null){var o=Jl(zc),c=Tn.transition,p=Ue;try{if(Tn.transition=null,Ue=16>o?16:o,Cs===null)var y=!1;else{if(o=Cs,Cs=null,zc=0,(ze&6)!==0)throw Error(n(331));var N=ze;for(ze|=4,je=o.current;je!==null;){var C=je,U=C.child;if((je.flags&16)!==0){var Q=C.deletions;if(Q!==null){for(var te=0;te<Q.length;te++){var le=Q[te];for(je=le;je!==null;){var he=je;switch(he.tag){case 0:case 11:case 15:zi(8,he,C)}var me=he.child;if(me!==null)me.return=he,je=me;else for(;je!==null;){he=je;var de=he.sibling,ke=he.return;if(Wk(he),he===le){je=null;break}if(de!==null){de.return=ke,je=de;break}je=ke}}}var Se=C.alternate;if(Se!==null){var _e=Se.child;if(_e!==null){Se.child=null;do{var ft=_e.sibling;_e.sibling=null,_e=ft}while(_e!==null)}}je=C}}if((C.subtreeFlags&2064)!==0&&U!==null)U.return=C,je=U;else e:for(;je!==null;){if(C=je,(C.flags&2048)!==0)switch(C.tag){case 0:case 11:case 15:zi(9,C,C.return)}var ae=C.sibling;if(ae!==null){ae.return=C.return,je=ae;break e}je=C.return}}var ne=o.current;for(je=ne;je!==null;){U=je;var ie=U.child;if((U.subtreeFlags&2064)!==0&&ie!==null)ie.return=U,je=ie;else e:for(U=ne;je!==null;){if(Q=je,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:Dc(9,Q)}}catch(Ee){dt(Q,Q.return,Ee)}if(Q===U){je=null;break e}var ge=Q.sibling;if(ge!==null){ge.return=Q.return,je=ge;break e}je=Q.return}}if(ze=N,Ns(),Yt&&typeof Yt.onPostCommitFiberRoot=="function")try{Yt.onPostCommitFiberRoot(us,o)}catch{}y=!0}return y}finally{Ue=p,Tn.transition=c}}return!1}function i1(o,c,p){c=go(p,c),c=Sk(o,c,1),o=Ss(o,c,1),c=Jt(),o!==null&&(Qs(o,1,c),sn(o,c))}function dt(o,c,p){if(o.tag===3)i1(o,o,p);else for(;c!==null;){if(c.tag===3){i1(c,o,p);break}else if(c.tag===1){var y=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(Es===null||!Es.has(y))){o=go(p,o),o=_k(c,o,1),c=Ss(c,o,1),o=Jt(),c!==null&&(Qs(c,1,o),sn(c,o));break}}c=c.return}}function kL(o,c,p){var y=o.pingCache;y!==null&&y.delete(c),c=Jt(),o.pingedLanes|=o.suspendedLanes&p,At===o&&(Pt&p)===p&&(St===4||St===3&&(Pt&130023424)===Pt&&500>Ke()-gf?ya(o,0):mf|=p),sn(o,c)}function l1(o,c){c===0&&((o.mode&1)===0?c=1:(c=hs,hs<<=1,(hs&130023424)===0&&(hs=4194304)));var p=Jt();o=Hr(o,c),o!==null&&(Qs(o,c,p),sn(o,p))}function NL(o){var c=o.memoizedState,p=0;c!==null&&(p=c.retryLane),l1(o,p)}function jL(o,c){var p=0;switch(o.tag){case 13:var y=o.stateNode,N=o.memoizedState;N!==null&&(p=N.retryLane);break;case 19:y=o.stateNode;break;default:throw Error(n(314))}y!==null&&y.delete(c),l1(o,p)}var c1;c1=function(o,c,p){if(o!==null)if(o.memoizedProps!==c.pendingProps||en.current)nn=!0;else{if((o.lanes&p)===0&&(c.flags&128)===0)return nn=!1,dL(o,c,p);nn=(o.flags&131072)!==0}else nn=!1,it&&(c.flags&1048576)!==0&&Ub(c,bc,c.index);switch(c.lanes=0,c.tag){case 2:var y=c.type;Lc(o,c),o=c.pendingProps;var N=io(c,zt.current);po(c,p),N=Vh(null,c,y,o,N,p);var C=Gh();return c.flags|=1,typeof N=="object"&&N!==null&&typeof N.render=="function"&&N.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,tn(y)?(C=!0,wc(c)):C=!1,c.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,Fh(c),N.updater=Ic,c.stateNode=N,N._reactInternals=c,Qh(c,y,o,p),c=rf(null,c,y,!0,C,p)):(c.tag=0,it&&C&&Th(c),Zt(null,c,N,p),c=c.child),c;case 16:y=c.elementType;e:{switch(Lc(o,c),o=c.pendingProps,N=y._init,y=N(y._payload),c.type=y,N=c.tag=_L(y),o=Gn(y,o),N){case 0:c=nf(null,c,y,o,p);break e;case 1:c=Ok(null,c,y,o,p);break e;case 11:c=Rk(null,c,y,o,p);break e;case 14:c=Ak(null,c,y,Gn(y.type,o),p);break e}throw Error(n(306,y,""))}return c;case 0:return y=c.type,N=c.pendingProps,N=c.elementType===y?N:Gn(y,N),nf(o,c,y,N,p);case 1:return y=c.type,N=c.pendingProps,N=c.elementType===y?N:Gn(y,N),Ok(o,c,y,N,p);case 3:e:{if(Lk(c),o===null)throw Error(n(387));y=c.pendingProps,C=c.memoizedState,N=C.element,Zb(o,c),Ec(c,y,null,p);var U=c.memoizedState;if(y=U.element,C.isDehydrated)if(C={element:y,isDehydrated:!1,cache:U.cache,pendingSuspenseBoundaries:U.pendingSuspenseBoundaries,transitions:U.transitions},c.updateQueue.baseState=C,c.memoizedState=C,c.flags&256){N=go(Error(n(423)),c),c=Pk(o,c,y,p,N);break e}else if(y!==N){N=go(Error(n(424)),c),c=Pk(o,c,y,p,N);break e}else for(mn=xs(c.stateNode.containerInfo.firstChild),pn=c,it=!0,Vn=null,p=Yb(c,null,y,p),c.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(uo(),y===N){c=Vr(o,c,p);break e}Zt(o,c,y,p)}c=c.child}return c;case 5:return ek(c),o===null&&Mh(c),y=c.type,N=c.pendingProps,C=o!==null?o.memoizedProps:null,U=N.children,Nh(y,N)?U=null:C!==null&&Nh(y,C)&&(c.flags|=32),Ik(o,c),Zt(o,c,U,p),c.child;case 6:return o===null&&Mh(c),null;case 13:return Dk(o,c,p);case 4:return qh(c,c.stateNode.containerInfo),y=c.pendingProps,o===null?c.child=ho(c,null,y,p):Zt(o,c,y,p),c.child;case 11:return y=c.type,N=c.pendingProps,N=c.elementType===y?N:Gn(y,N),Rk(o,c,y,N,p);case 7:return Zt(o,c,c.pendingProps,p),c.child;case 8:return Zt(o,c,c.pendingProps.children,p),c.child;case 12:return Zt(o,c,c.pendingProps.children,p),c.child;case 10:e:{if(y=c.type._context,N=c.pendingProps,C=c.memoizedProps,U=N.value,tt(jc,y._currentValue),y._currentValue=U,C!==null)if(Wn(C.value,U)){if(C.children===N.children&&!en.current){c=Vr(o,c,p);break e}}else for(C=c.child,C!==null&&(C.return=c);C!==null;){var Q=C.dependencies;if(Q!==null){U=C.child;for(var te=Q.firstContext;te!==null;){if(te.context===y){if(C.tag===1){te=Wr(-1,p&-p),te.tag=2;var le=C.updateQueue;if(le!==null){le=le.shared;var he=le.pending;he===null?te.next=te:(te.next=he.next,he.next=te),le.pending=te}}C.lanes|=p,te=C.alternate,te!==null&&(te.lanes|=p),Ph(C.return,p,c),Q.lanes|=p;break}te=te.next}}else if(C.tag===10)U=C.type===c.type?null:C.child;else if(C.tag===18){if(U=C.return,U===null)throw Error(n(341));U.lanes|=p,Q=U.alternate,Q!==null&&(Q.lanes|=p),Ph(U,p,c),U=C.sibling}else U=C.child;if(U!==null)U.return=C;else for(U=C;U!==null;){if(U===c){U=null;break}if(C=U.sibling,C!==null){C.return=U.return,U=C;break}U=U.return}C=U}Zt(o,c,N.children,p),c=c.child}return c;case 9:return N=c.type,y=c.pendingProps.children,po(c,p),N=En(N),y=y(N),c.flags|=1,Zt(o,c,y,p),c.child;case 14:return y=c.type,N=Gn(y,c.pendingProps),N=Gn(y.type,N),Ak(o,c,y,N,p);case 15:return Mk(o,c,c.type,c.pendingProps,p);case 17:return y=c.type,N=c.pendingProps,N=c.elementType===y?N:Gn(y,N),Lc(o,c),c.tag=1,tn(y)?(o=!0,wc(c)):o=!1,po(c,p),Nk(c,y,N),Qh(c,y,N,p),rf(null,c,y,!0,o,p);case 19:return qk(o,c,p);case 22:return $k(o,c,p)}throw Error(n(156,c.tag))};function u1(o,c){return Va(o,c)}function SL(o,c,p,y){this.tag=o,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rn(o,c,p,y){return new SL(o,c,p,y)}function jf(o){return o=o.prototype,!(!o||!o.isReactComponent)}function _L(o){if(typeof o=="function")return jf(o)?1:0;if(o!=null){if(o=o.$$typeof,o===F)return 11;if(o===O)return 14}return 2}function As(o,c){var p=o.alternate;return p===null?(p=Rn(o.tag,c,o.key,o.mode),p.elementType=o.elementType,p.type=o.type,p.stateNode=o.stateNode,p.alternate=o,o.alternate=p):(p.pendingProps=c,p.type=o.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=o.flags&14680064,p.childLanes=o.childLanes,p.lanes=o.lanes,p.child=o.child,p.memoizedProps=o.memoizedProps,p.memoizedState=o.memoizedState,p.updateQueue=o.updateQueue,c=o.dependencies,p.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},p.sibling=o.sibling,p.index=o.index,p.ref=o.ref,p}function Gc(o,c,p,y,N,C){var U=2;if(y=o,typeof o=="function")jf(o)&&(U=1);else if(typeof o=="string")U=5;else e:switch(o){case A:return va(p.children,N,C,c);case B:U=8,N|=8;break;case $:return o=Rn(12,p,c,N|2),o.elementType=$,o.lanes=C,o;case W:return o=Rn(13,p,c,N),o.elementType=W,o.lanes=C,o;case M:return o=Rn(19,p,c,N),o.elementType=M,o.lanes=C,o;case K:return Kc(p,N,C,c);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case I:U=10;break e;case D:U=9;break e;case F:U=11;break e;case O:U=14;break e;case L:U=16,y=null;break e}throw Error(n(130,o==null?o:typeof o,""))}return c=Rn(U,p,c,N),c.elementType=o,c.type=y,c.lanes=C,c}function va(o,c,p,y){return o=Rn(7,o,y,c),o.lanes=p,o}function Kc(o,c,p,y){return o=Rn(22,o,y,c),o.elementType=K,o.lanes=p,o.stateNode={isHidden:!1},o}function Sf(o,c,p){return o=Rn(6,o,null,c),o.lanes=p,o}function _f(o,c,p){return c=Rn(4,o.children!==null?o.children:[],o.key,c),c.lanes=p,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}function EL(o,c,p,y,N){this.tag=c,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mr(0),this.expirationTimes=mr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mr(0),this.identifierPrefix=y,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function Ef(o,c,p,y,N,C,U,Q,te){return o=new EL(o,c,p,Q,te),c===1?(c=1,C===!0&&(c|=8)):c=0,C=Rn(3,null,null,c),o.current=C,C.stateNode=o,C.memoizedState={element:y,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fh(C),o}function CL(o,c,p){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:y==null?null:""+y,children:o,containerInfo:c,implementation:p}}function d1(o){if(!o)return ks;o=o._reactInternals;e:{if(Ut(o)!==o||o.tag!==1)throw Error(n(170));var c=o;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(tn(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(n(171))}if(o.tag===1){var p=o.type;if(tn(p))return Fb(o,p,c)}return c}function h1(o,c,p,y,N,C,U,Q,te){return o=Ef(p,y,!0,o,N,C,U,Q,te),o.context=d1(null),p=o.current,y=Jt(),N=Ts(p),C=Wr(y,N),C.callback=c??null,Ss(p,C,N),o.current.lanes=N,Qs(o,N,y),sn(o,y),o}function Yc(o,c,p,y){var N=c.current,C=Jt(),U=Ts(N);return p=d1(p),c.context===null?c.context=p:c.pendingContext=p,c=Wr(C,U),c.payload={element:o},y=y===void 0?null:y,y!==null&&(c.callback=y),o=Ss(N,c,U),o!==null&&(Xn(o,N,U,C),_c(o,N,U)),U}function Xc(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return o.child.stateNode;default:return o.child.stateNode}}function f1(o,c){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var p=o.retryLane;o.retryLane=p!==0&&p<c?p:c}}function Cf(o,c){f1(o,c),(o=o.alternate)&&f1(o,c)}function TL(){return null}var p1=typeof reportError=="function"?reportError:function(o){console.error(o)};function Tf(o){this._internalRoot=o}Zc.prototype.render=Tf.prototype.render=function(o){var c=this._internalRoot;if(c===null)throw Error(n(409));Yc(o,c,null,null)},Zc.prototype.unmount=Tf.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var c=o.containerInfo;ga(function(){Yc(null,o,null,null)}),c[qr]=null}};function Zc(o){this._internalRoot=o}Zc.prototype.unstable_scheduleHydration=function(o){if(o){var c=ec();o={blockedOn:null,target:o,priority:c};for(var p=0;p<Hn.length&&c!==0&&c<Hn[p].priority;p++);Hn.splice(p,0,o),p===0&&wi(o)}};function Rf(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function Jc(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function m1(){}function RL(o,c,p,y,N){if(N){if(typeof y=="function"){var C=y;y=function(){var le=Xc(U);C.call(le)}}var U=h1(c,y,o,0,null,!1,!1,"",m1);return o._reactRootContainer=U,o[qr]=U.current,Ri(o.nodeType===8?o.parentNode:o),ga(),U}for(;N=o.lastChild;)o.removeChild(N);if(typeof y=="function"){var Q=y;y=function(){var le=Xc(te);Q.call(le)}}var te=Ef(o,0,!1,null,null,!1,!1,"",m1);return o._reactRootContainer=te,o[qr]=te.current,Ri(o.nodeType===8?o.parentNode:o),ga(function(){Yc(c,te,p,y)}),te}function Qc(o,c,p,y,N){var C=p._reactRootContainer;if(C){var U=C;if(typeof N=="function"){var Q=N;N=function(){var te=Xc(U);Q.call(te)}}Yc(c,U,o,N)}else U=RL(p,c,o,N,y);return Xc(U)}Ql=function(o){switch(o.tag){case 3:var c=o.stateNode;if(c.current.memoizedState.isDehydrated){var p=Ir(c.pendingLanes);p!==0&&(Xa(c,p|1),sn(c,Ke()),(ze&6)===0&&(vo=Ke()+500,Ns()))}break;case 13:ga(function(){var y=Hr(o,1);if(y!==null){var N=Jt();Xn(y,o,1,N)}}),Cf(o,1)}},ea=function(o){if(o.tag===13){var c=Hr(o,134217728);if(c!==null){var p=Jt();Xn(c,o,134217728,p)}Cf(o,134217728)}},gi=function(o){if(o.tag===13){var c=Ts(o),p=Hr(o,c);if(p!==null){var y=Jt();Xn(p,o,c,y)}Cf(o,c)}},ec=function(){return Ue},tc=function(o,c){var p=Ue;try{return Ue=o,c()}finally{Ue=p}},Gt=function(o,c,p){switch(c){case"input":if(xe(o,p),c=p.name,p.type==="radio"&&c!=null){for(p=o;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<p.length;c++){var y=p[c];if(y!==o&&y.form===o.form){var N=gc(y);if(!N)throw Error(n(90));Ne(y),xe(y,N)}}}break;case"textarea":Oe(o,p);break;case"select":c=p.value,c!=null&&Te(o,!!p.multiple,c,!1)}},ss=bf,ur=ga;var AL={usingClientEntryPoint:!1,Events:[$i,ao,gc,rs,$r,bf]},Gi={findFiberByHostInstance:la,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ML={bundleType:Gi.bundleType,version:Gi.version,rendererPackageName:Gi.rendererPackageName,rendererConfig:Gi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=Un(o),o===null?null:o.stateNode},findFiberByHostInstance:Gi.findFiberByHostInstance||TL,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 eu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!eu.isDisabled&&eu.supportsFiber)try{us=eu.inject(ML),Yt=eu}catch{}}return an.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=AL,an.createPortal=function(o,c){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Rf(c))throw Error(n(200));return CL(o,c,null,p)},an.createRoot=function(o,c){if(!Rf(o))throw Error(n(299));var p=!1,y="",N=p1;return c!=null&&(c.unstable_strictMode===!0&&(p=!0),c.identifierPrefix!==void 0&&(y=c.identifierPrefix),c.onRecoverableError!==void 0&&(N=c.onRecoverableError)),c=Ef(o,1,!1,null,null,p,!1,y,N),o[qr]=c.current,Ri(o.nodeType===8?o.parentNode:o),new Tf(c)},an.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var c=o._reactInternals;if(c===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=Un(c),o=o===null?null:o.stateNode,o},an.flushSync=function(o){return ga(o)},an.hydrate=function(o,c,p){if(!Jc(c))throw Error(n(200));return Qc(null,o,c,!0,p)},an.hydrateRoot=function(o,c,p){if(!Rf(o))throw Error(n(405));var y=p!=null&&p.hydratedSources||null,N=!1,C="",U=p1;if(p!=null&&(p.unstable_strictMode===!0&&(N=!0),p.identifierPrefix!==void 0&&(C=p.identifierPrefix),p.onRecoverableError!==void 0&&(U=p.onRecoverableError)),c=h1(c,null,o,1,p??null,N,!1,C,U),o[qr]=c.current,Ri(o),y)for(o=0;o<y.length;o++)p=y[o],N=p._getVersion,N=N(p._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[p,N]:c.mutableSourceEagerHydrationData.push(p,N);return new Zc(c)},an.render=function(o,c,p){if(!Jc(c))throw Error(n(200));return Qc(null,o,c,!1,p)},an.unmountComponentAtNode=function(o){if(!Jc(o))throw Error(n(40));return o._reactRootContainer?(ga(function(){Qc(null,null,o,!1,function(){o._reactRootContainer=null,o[qr]=null})}),!0):!1},an.unstable_batchedUpdates=bf,an.unstable_renderSubtreeIntoContainer=function(o,c,p,y){if(!Jc(p))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return Qc(o,c,p,!1,y)},an.version="18.3.1-next-f1338f8080-20240426",an}var N1;function VR(){if(N1)return $f.exports;N1=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(),$f.exports=FL(),$f.exports}var j1;function qL(){if(j1)return nu;j1=1;var e=VR();return nu.createRoot=e.createRoot,nu.hydrateRoot=e.hydrateRoot,nu}var BL=qL(),v=Ll();const ce=Lx(v);function Dt(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=Dt(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Lf={exports:{}},Pf={},Df={exports:{}},Ff={};/**
|
|
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 S1;function UL(){if(S1)return Ff;S1=1;var e=Ll();function t(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function u(m,g){var w=g(),b=r({inst:{value:w,getSnapshot:g}}),x=b[0].inst,k=b[1];return i(function(){x.value=w,x.getSnapshot=g,d(x)&&k({inst:x})},[m,w,g]),s(function(){return d(x)&&k({inst:x}),m(function(){d(x)&&k({inst:x})})},[m]),l(w),w}function d(m){var g=m.getSnapshot;m=m.value;try{var w=g();return!n(m,w)}catch{return!0}}function f(m,g){return g()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:u;return Ff.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Ff}var _1;function zL(){return _1||(_1=1,Df.exports=UL()),Df.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 E1;function HL(){if(E1)return Pf;E1=1;var e=Ll(),t=zL();function n(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,l=e.useEffect,u=e.useMemo,d=e.useDebugValue;return Pf.useSyncExternalStoreWithSelector=function(f,h,m,g,w){var b=i(null);if(b.current===null){var x={hasValue:!1,value:null};b.current=x}else x=b.current;b=u(function(){function j(R){if(!S){if(S=!0,_=R,R=g(R),w!==void 0&&x.hasValue){var A=x.value;if(w(A,R))return E=A}return E=R}if(A=E,r(_,R))return A;var B=g(R);return w!==void 0&&w(A,B)?(_=R,A):(_=R,E=B)}var S=!1,_,E,T=m===void 0?null:m;return[function(){return j(h())},T===null?void 0:function(){return j(T())}]},[h,m,g,w]);var k=s(f,b[0],b[1]);return l(function(){x.hasValue=!0,x.value=k},[k]),d(k),k},Pf}var C1;function WL(){return C1||(C1=1,Lf.exports=HL()),Lf.exports}var VL=WL();const GL=Lx(VL),KL={},T1=e=>{let t;const n=new Set,r=(h,m)=>{const g=typeof h=="function"?h(t):h;if(!Object.is(g,t)){const w=t;t=m??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(b=>b(t,w))}},s=()=>t,d={setState:r,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(KL?"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()}},f=t=e(r,s,d);return d},YL=e=>e?T1(e):T1,{useDebugValue:XL}=ce,{useSyncExternalStoreWithSelector:ZL}=GL,JL=e=>e;function GR(e,t=JL,n){const r=ZL(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return XL(r),r}const R1=(e,t)=>{const n=YL(e),r=(s,i=t)=>GR(n,s,i);return Object.assign(r,n),r},QL=(e,t)=>e?R1(e,t):R1;function Tt(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,s]of e)if(!Object.is(s,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 eP={value:()=>{}};function pd(){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 Su(n)}function Su(e){this._=e}function tP(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Su.prototype=pd.prototype={constructor:Su,on:function(e,t){var n=this._,r=tP(e+"",n),s,i=-1,l=r.length;if(arguments.length<2){for(;++i<l;)if((s=(e=r[i]).type)&&(s=nP(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<l;)if(s=(e=r[i]).type)n[s]=A1(n[s],e.name,t);else if(t==null)for(s in n)n[s]=A1(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Su(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[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],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function nP(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function A1(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=eP,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Iv="http://www.w3.org/1999/xhtml";const M1={svg:"http://www.w3.org/2000/svg",xhtml:Iv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function md(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),M1.hasOwnProperty(t)?{space:M1[t],local:e}:e}function rP(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Iv&&t.documentElement.namespaceURI===Iv?t.createElement(e):t.createElementNS(n,e)}}function sP(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function KR(e){var t=md(e);return(t.local?sP:rP)(t)}function aP(){}function Px(e){return e==null?aP:function(){return this.querySelector(e)}}function oP(e){typeof e!="function"&&(e=Px(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],l=i.length,u=r[s]=new Array(l),d,f,h=0;h<l;++h)(d=i[h])&&(f=e.call(d,d.__data__,h,i))&&("__data__"in d&&(f.__data__=d.__data__),u[h]=f);return new xn(r,this._parents)}function iP(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function lP(){return[]}function YR(e){return e==null?lP:function(){return this.querySelectorAll(e)}}function cP(e){return function(){return iP(e.apply(this,arguments))}}function uP(e){typeof e=="function"?e=cP(e):e=YR(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var l=t[i],u=l.length,d,f=0;f<u;++f)(d=l[f])&&(r.push(e.call(d,d.__data__,f,l)),s.push(d));return new xn(r,s)}function XR(e){return function(){return this.matches(e)}}function ZR(e){return function(t){return t.matches(e)}}var dP=Array.prototype.find;function hP(e){return function(){return dP.call(this.children,e)}}function fP(){return this.firstElementChild}function pP(e){return this.select(e==null?fP:hP(typeof e=="function"?e:ZR(e)))}var mP=Array.prototype.filter;function gP(){return Array.from(this.children)}function yP(e){return function(){return mP.call(this.children,e)}}function wP(e){return this.selectAll(e==null?gP:yP(typeof e=="function"?e:ZR(e)))}function vP(e){typeof e!="function"&&(e=XR(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],l=i.length,u=r[s]=[],d,f=0;f<l;++f)(d=i[f])&&e.call(d,d.__data__,f,i)&&u.push(d);return new xn(r,this._parents)}function JR(e){return new Array(e.length)}function xP(){return new xn(this._enter||this._groups.map(JR),this._parents)}function Du(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Du.prototype={constructor:Du,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 bP(e){return function(){return e}}function kP(e,t,n,r,s,i){for(var l=0,u,d=t.length,f=i.length;l<f;++l)(u=t[l])?(u.__data__=i[l],r[l]=u):n[l]=new Du(e,i[l]);for(;l<d;++l)(u=t[l])&&(s[l]=u)}function NP(e,t,n,r,s,i,l){var u,d,f=new Map,h=t.length,m=i.length,g=new Array(h),w;for(u=0;u<h;++u)(d=t[u])&&(g[u]=w=l.call(d,d.__data__,u,t)+"",f.has(w)?s[u]=d:f.set(w,d));for(u=0;u<m;++u)w=l.call(e,i[u],u,i)+"",(d=f.get(w))?(r[u]=d,d.__data__=i[u],f.delete(w)):n[u]=new Du(e,i[u]);for(u=0;u<h;++u)(d=t[u])&&f.get(g[u])===d&&(s[u]=d)}function jP(e){return e.__data__}function SP(e,t){if(!arguments.length)return Array.from(this,jP);var n=t?NP:kP,r=this._parents,s=this._groups;typeof e!="function"&&(e=bP(e));for(var i=s.length,l=new Array(i),u=new Array(i),d=new Array(i),f=0;f<i;++f){var h=r[f],m=s[f],g=m.length,w=_P(e.call(h,h&&h.__data__,f,r)),b=w.length,x=u[f]=new Array(b),k=l[f]=new Array(b),j=d[f]=new Array(g);n(h,m,x,k,j,w,t);for(var S=0,_=0,E,T;S<b;++S)if(E=x[S]){for(S>=_&&(_=S+1);!(T=k[_])&&++_<b;);E._next=T||null}}return l=new xn(l,r),l._enter=u,l._exit=d,l}function _P(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function EP(){return new xn(this._exit||this._groups.map(JR),this._parents)}function CP(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function TP(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,l=Math.min(s,i),u=new Array(s),d=0;d<l;++d)for(var f=n[d],h=r[d],m=f.length,g=u[d]=new Array(m),w,b=0;b<m;++b)(w=f[b]||h[b])&&(g[b]=w);for(;d<s;++d)u[d]=n[d];return new xn(u,this._parents)}function RP(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],l;--s>=0;)(l=r[s])&&(i&&l.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(l,i),i=l);return this}function AP(e){e||(e=MP);function t(m,g){return m&&g?e(m.__data__,g.__data__):!m-!g}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var l=n[i],u=l.length,d=s[i]=new Array(u),f,h=0;h<u;++h)(f=l[h])&&(d[h]=f);d.sort(t)}return new xn(s,this._parents).order()}function MP(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function $P(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function IP(){return Array.from(this)}function OP(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var l=r[s];if(l)return l}return null}function LP(){let e=0;for(const t of this)++e;return e}function PP(){return!this.node()}function DP(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,l=s.length,u;i<l;++i)(u=s[i])&&e.call(u,u.__data__,i,s);return this}function FP(e){return function(){this.removeAttribute(e)}}function qP(e){return function(){this.removeAttributeNS(e.space,e.local)}}function BP(e,t){return function(){this.setAttribute(e,t)}}function UP(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function zP(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function HP(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 WP(e,t){var n=md(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?qP:FP:typeof t=="function"?n.local?HP:zP:n.local?UP:BP)(n,t))}function QR(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function VP(e){return function(){this.style.removeProperty(e)}}function GP(e,t,n){return function(){this.style.setProperty(e,t,n)}}function KP(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function YP(e,t,n){return arguments.length>1?this.each((t==null?VP:typeof t=="function"?KP:GP)(e,t,n??"")):Wo(this.node(),e)}function Wo(e,t){return e.style.getPropertyValue(t)||QR(e).getComputedStyle(e,null).getPropertyValue(t)}function XP(e){return function(){delete this[e]}}function ZP(e,t){return function(){this[e]=t}}function JP(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function QP(e,t){return arguments.length>1?this.each((t==null?XP:typeof t=="function"?JP:ZP)(e,t)):this.node()[e]}function e2(e){return e.trim().split(/^|\s+/)}function Dx(e){return e.classList||new t2(e)}function t2(e){this._node=e,this._names=e2(e.getAttribute("class")||"")}t2.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function n2(e,t){for(var n=Dx(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function r2(e,t){for(var n=Dx(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function e3(e){return function(){n2(this,e)}}function t3(e){return function(){r2(this,e)}}function n3(e,t){return function(){(t.apply(this,arguments)?n2:r2)(this,e)}}function r3(e,t){var n=e2(e+"");if(arguments.length<2){for(var r=Dx(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?n3:t?e3:t3)(n,t))}function s3(){this.textContent=""}function a3(e){return function(){this.textContent=e}}function o3(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function i3(e){return arguments.length?this.each(e==null?s3:(typeof e=="function"?o3:a3)(e)):this.node().textContent}function l3(){this.innerHTML=""}function c3(e){return function(){this.innerHTML=e}}function u3(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function d3(e){return arguments.length?this.each(e==null?l3:(typeof e=="function"?u3:c3)(e)):this.node().innerHTML}function h3(){this.nextSibling&&this.parentNode.appendChild(this)}function f3(){return this.each(h3)}function p3(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function m3(){return this.each(p3)}function g3(e){var t=typeof e=="function"?e:KR(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function y3(){return null}function w3(e,t){var n=typeof e=="function"?e:KR(e),r=t==null?y3:typeof t=="function"?t:Px(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function v3(){var e=this.parentNode;e&&e.removeChild(this)}function x3(){return this.each(v3)}function b3(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function k3(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function N3(e){return this.select(e?k3:b3)}function j3(e){return arguments.length?this.property("__data__",e):this.node().__data__}function S3(e){return function(t){e.call(this,t,this.__data__)}}function _3(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 E3(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function C3(e,t,n){return function(){var r=this.__on,s,i=S3(t);if(r){for(var l=0,u=r.length;l<u;++l)if((s=r[l]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function T3(e,t,n){var r=_3(e+""),s,i=r.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var d=0,f=u.length,h;d<f;++d)for(s=0,h=u[d];s<i;++s)if((l=r[s]).type===h.type&&l.name===h.name)return h.value}return}for(u=t?C3:E3,s=0;s<i;++s)this.each(u(r[s],t,n));return this}function s2(e,t,n){var r=QR(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function R3(e,t){return function(){return s2(this,e,t)}}function A3(e,t){return function(){return s2(this,e,t.apply(this,arguments))}}function M3(e,t){return this.each((typeof t=="function"?A3:R3)(e,t))}function*$3(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,l;s<i;++s)(l=r[s])&&(yield l)}var a2=[null];function xn(e,t){this._groups=e,this._parents=t}function Pl(){return new xn([[document.documentElement]],a2)}function I3(){return this}xn.prototype=Pl.prototype={constructor:xn,select:oP,selectAll:uP,selectChild:pP,selectChildren:wP,filter:vP,data:SP,enter:xP,exit:EP,join:CP,merge:TP,selection:I3,order:RP,sort:AP,call:$P,nodes:IP,node:OP,size:LP,empty:PP,each:DP,attr:WP,style:YP,property:QP,classed:r3,text:i3,html:d3,raise:f3,lower:m3,append:g3,insert:w3,remove:x3,clone:N3,datum:j3,on:T3,dispatch:M3,[Symbol.iterator]:$3};function $n(e){return typeof e=="string"?new xn([[document.querySelector(e)]],[document.documentElement]):new xn([[e]],a2)}function O3(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Qn(e,t){if(e=O3(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 s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const L3={passive:!1},fl={capture:!0,passive:!1};function qf(e){e.stopImmediatePropagation()}function Fo(e){e.preventDefault(),e.stopImmediatePropagation()}function o2(e){var t=e.document.documentElement,n=$n(e).on("dragstart.drag",Fo,fl);"onselectstart"in t?n.on("selectstart.drag",Fo,fl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function i2(e,t){var n=e.document.documentElement,r=$n(e).on("dragstart.drag",null);t&&(r.on("click.drag",Fo,fl),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 ru=e=>()=>e;function Ov(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:l,y:u,dx:d,dy:f,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:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:h}})}Ov.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function P3(e){return!e.ctrlKey&&!e.button}function D3(){return this.parentNode}function F3(e,t){return t??{x:e.x,y:e.y}}function q3(){return navigator.maxTouchPoints||"ontouchstart"in this}function B3(){var e=P3,t=D3,n=F3,r=q3,s={},i=pd("start","drag","end"),l=0,u,d,f,h,m=0;function g(E){E.on("mousedown.drag",w).filter(r).on("touchstart.drag",k).on("touchmove.drag",j,L3).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(E,T){if(!(h||!e.call(this,E,T))){var R=_(this,t.call(this,E,T),E,T,"mouse");R&&($n(E.view).on("mousemove.drag",b,fl).on("mouseup.drag",x,fl),o2(E.view),qf(E),f=!1,u=E.clientX,d=E.clientY,R("start",E))}}function b(E){if(Fo(E),!f){var T=E.clientX-u,R=E.clientY-d;f=T*T+R*R>m}s.mouse("drag",E)}function x(E){$n(E.view).on("mousemove.drag mouseup.drag",null),i2(E.view,f),Fo(E),s.mouse("end",E)}function k(E,T){if(e.call(this,E,T)){var R=E.changedTouches,A=t.call(this,E,T),B=R.length,$,I;for($=0;$<B;++$)(I=_(this,A,E,T,R[$].identifier,R[$]))&&(qf(E),I("start",E,R[$]))}}function j(E){var T=E.changedTouches,R=T.length,A,B;for(A=0;A<R;++A)(B=s[T[A].identifier])&&(Fo(E),B("drag",E,T[A]))}function S(E){var T=E.changedTouches,R=T.length,A,B;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),A=0;A<R;++A)(B=s[T[A].identifier])&&(qf(E),B("end",E,T[A]))}function _(E,T,R,A,B,$){var I=i.copy(),D=Qn($||R,T),F,W,M;if((M=n.call(E,new Ov("beforestart",{sourceEvent:R,target:g,identifier:B,active:l,x:D[0],y:D[1],dx:0,dy:0,dispatch:I}),A))!=null)return F=M.x-D[0]||0,W=M.y-D[1]||0,function O(L,K,Z){var q=D,H;switch(L){case"start":s[B]=O,H=l++;break;case"end":delete s[B],--l;case"drag":D=Qn(Z||K,T),H=l;break}I.call(L,E,new Ov(L,{sourceEvent:K,subject:M,target:g,identifier:B,active:H,x:D[0]+F,y:D[1]+W,dx:D[0]-q[0],dy:D[1]-q[1],dispatch:I}),A)}}return g.filter=function(E){return arguments.length?(e=typeof E=="function"?E:ru(!!E),g):e},g.container=function(E){return arguments.length?(t=typeof E=="function"?E:ru(E),g):t},g.subject=function(E){return arguments.length?(n=typeof E=="function"?E:ru(E),g):n},g.touchable=function(E){return arguments.length?(r=typeof E=="function"?E:ru(!!E),g):r},g.on=function(){var E=i.on.apply(i,arguments);return E===i?g:E},g.clickDistance=function(E){return arguments.length?(m=(E=+E)*E,g):Math.sqrt(m)},g}function Fx(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function l2(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Dl(){}var pl=.7,Fu=1/pl,qo="\\s*([+-]?\\d+)\\s*",ml="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Er="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",U3=/^#([0-9a-f]{3,8})$/,z3=new RegExp(`^rgb\\(${qo},${qo},${qo}\\)$`),H3=new RegExp(`^rgb\\(${Er},${Er},${Er}\\)$`),W3=new RegExp(`^rgba\\(${qo},${qo},${qo},${ml}\\)$`),V3=new RegExp(`^rgba\\(${Er},${Er},${Er},${ml}\\)$`),G3=new RegExp(`^hsl\\(${ml},${Er},${Er}\\)$`),K3=new RegExp(`^hsla\\(${ml},${Er},${Er},${ml}\\)$`),$1={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};Fx(Dl,gl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:I1,formatHex:I1,formatHex8:Y3,formatHsl:X3,formatRgb:O1,toString:O1});function I1(){return this.rgb().formatHex()}function Y3(){return this.rgb().formatHex8()}function X3(){return c2(this).formatHsl()}function O1(){return this.rgb().formatRgb()}function gl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=U3.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?L1(t):n===3?new ln(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?su(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?su(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=z3.exec(e))?new ln(t[1],t[2],t[3],1):(t=H3.exec(e))?new ln(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=W3.exec(e))?su(t[1],t[2],t[3],t[4]):(t=V3.exec(e))?su(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=G3.exec(e))?F1(t[1],t[2]/100,t[3]/100,1):(t=K3.exec(e))?F1(t[1],t[2]/100,t[3]/100,t[4]):$1.hasOwnProperty(e)?L1($1[e]):e==="transparent"?new ln(NaN,NaN,NaN,0):null}function L1(e){return new ln(e>>16&255,e>>8&255,e&255,1)}function su(e,t,n,r){return r<=0&&(e=t=n=NaN),new ln(e,t,n,r)}function Z3(e){return e instanceof Dl||(e=gl(e)),e?(e=e.rgb(),new ln(e.r,e.g,e.b,e.opacity)):new ln}function Lv(e,t,n,r){return arguments.length===1?Z3(e):new ln(e,t,n,r??1)}function ln(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Fx(ln,Lv,l2(Dl,{brighter(e){return e=e==null?Fu:Math.pow(Fu,e),new ln(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pl:Math.pow(pl,e),new ln(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ln(Ca(this.r),Ca(this.g),Ca(this.b),qu(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:P1,formatHex:P1,formatHex8:J3,formatRgb:D1,toString:D1}));function P1(){return`#${Sa(this.r)}${Sa(this.g)}${Sa(this.b)}`}function J3(){return`#${Sa(this.r)}${Sa(this.g)}${Sa(this.b)}${Sa((isNaN(this.opacity)?1:this.opacity)*255)}`}function D1(){const e=qu(this.opacity);return`${e===1?"rgb(":"rgba("}${Ca(this.r)}, ${Ca(this.g)}, ${Ca(this.b)}${e===1?")":`, ${e})`}`}function qu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ca(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Sa(e){return e=Ca(e),(e<16?"0":"")+e.toString(16)}function F1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new tr(e,t,n,r)}function c2(e){if(e instanceof tr)return new tr(e.h,e.s,e.l,e.opacity);if(e instanceof Dl||(e=gl(e)),!e)return new tr;if(e instanceof tr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),l=NaN,u=i-s,d=(i+s)/2;return u?(t===i?l=(n-r)/u+(n<r)*6:n===i?l=(r-t)/u+2:l=(t-n)/u+4,u/=d<.5?i+s:2-i-s,l*=60):u=d>0&&d<1?0:l,new tr(l,u,d,e.opacity)}function Q3(e,t,n,r){return arguments.length===1?c2(e):new tr(e,t,n,r??1)}function tr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Fx(tr,Q3,l2(Dl,{brighter(e){return e=e==null?Fu:Math.pow(Fu,e),new tr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pl:Math.pow(pl,e),new tr(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,s=2*n-r;return new ln(Bf(e>=240?e-240:e+120,s,r),Bf(e,s,r),Bf(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new tr(q1(this.h),au(this.s),au(this.l),qu(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=qu(this.opacity);return`${e===1?"hsl(":"hsla("}${q1(this.h)}, ${au(this.s)*100}%, ${au(this.l)*100}%${e===1?")":`, ${e})`}`}}));function q1(e){return e=(e||0)%360,e<0?e+360:e}function au(e){return Math.max(0,Math.min(1,e||0))}function Bf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const u2=e=>()=>e;function e4(e,t){return function(n){return e+n*t}}function t4(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 n4(e){return(e=+e)==1?d2:function(t,n){return n-t?t4(t,n,e):u2(isNaN(t)?n:t)}}function d2(e,t){var n=t-e;return n?e4(e,n):u2(isNaN(e)?t:e)}const B1=(function e(t){var n=n4(t);function r(s,i){var l=n((s=Lv(s)).r,(i=Lv(i)).r),u=n(s.g,i.g),d=n(s.b,i.b),f=d2(s.opacity,i.opacity);return function(h){return s.r=l(h),s.g=u(h),s.b=d(h),s.opacity=f(h),s+""}}return r.gamma=e,r})(1);function Ls(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Pv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Uf=new RegExp(Pv.source,"g");function r4(e){return function(){return e}}function s4(e){return function(t){return e(t)+""}}function a4(e,t){var n=Pv.lastIndex=Uf.lastIndex=0,r,s,i,l=-1,u=[],d=[];for(e=e+"",t=t+"";(r=Pv.exec(e))&&(s=Uf.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),u[l]?u[l]+=i:u[++l]=i),(r=r[0])===(s=s[0])?u[l]?u[l]+=s:u[++l]=s:(u[++l]=null,d.push({i:l,x:Ls(r,s)})),n=Uf.lastIndex;return n<t.length&&(i=t.slice(n),u[l]?u[l]+=i:u[++l]=i),u.length<2?d[0]?s4(d[0].x):r4(t):(t=d.length,function(f){for(var h=0,m;h<t;++h)u[(m=d[h]).i]=m.x(f);return u.join("")})}var U1=180/Math.PI,Dv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function h2(e,t,n,r,s,i){var l,u,d;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(d=e*n+t*r)&&(n-=e*d,r-=t*d),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,d/=u),e*r<t*n&&(e=-e,t=-t,d=-d,l=-l),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*U1,skewX:Math.atan(d)*U1,scaleX:l,scaleY:u}}var ou;function o4(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Dv:h2(t.a,t.b,t.c,t.d,t.e,t.f)}function i4(e){return e==null||(ou||(ou=document.createElementNS("http://www.w3.org/2000/svg","g")),ou.setAttribute("transform",e),!(e=ou.transform.baseVal.consolidate()))?Dv:(e=e.matrix,h2(e.a,e.b,e.c,e.d,e.e,e.f))}function f2(e,t,n,r){function s(f){return f.length?f.pop()+" ":""}function i(f,h,m,g,w,b){if(f!==m||h!==g){var x=w.push("translate(",null,t,null,n);b.push({i:x-4,x:Ls(f,m)},{i:x-2,x:Ls(h,g)})}else(m||g)&&w.push("translate("+m+t+g+n)}function l(f,h,m,g){f!==h?(f-h>180?h+=360:h-f>180&&(f+=360),g.push({i:m.push(s(m)+"rotate(",null,r)-2,x:Ls(f,h)})):h&&m.push(s(m)+"rotate("+h+r)}function u(f,h,m,g){f!==h?g.push({i:m.push(s(m)+"skewX(",null,r)-2,x:Ls(f,h)}):h&&m.push(s(m)+"skewX("+h+r)}function d(f,h,m,g,w,b){if(f!==m||h!==g){var x=w.push(s(w)+"scale(",null,",",null,")");b.push({i:x-4,x:Ls(f,m)},{i:x-2,x:Ls(h,g)})}else(m!==1||g!==1)&&w.push(s(w)+"scale("+m+","+g+")")}return function(f,h){var m=[],g=[];return f=e(f),h=e(h),i(f.translateX,f.translateY,h.translateX,h.translateY,m,g),l(f.rotate,h.rotate,m,g),u(f.skewX,h.skewX,m,g),d(f.scaleX,f.scaleY,h.scaleX,h.scaleY,m,g),f=h=null,function(w){for(var b=-1,x=g.length,k;++b<x;)m[(k=g[b]).i]=k.x(w);return m.join("")}}}var l4=f2(o4,"px, ","px)","deg)"),c4=f2(i4,", ",")",")"),u4=1e-12;function z1(e){return((e=Math.exp(e))+1/e)/2}function d4(e){return((e=Math.exp(e))-1/e)/2}function h4(e){return((e=Math.exp(2*e))-1)/(e+1)}const f4=(function e(t,n,r){function s(i,l){var u=i[0],d=i[1],f=i[2],h=l[0],m=l[1],g=l[2],w=h-u,b=m-d,x=w*w+b*b,k,j;if(x<u4)j=Math.log(g/f)/t,k=function(A){return[u+A*w,d+A*b,f*Math.exp(t*A*j)]};else{var S=Math.sqrt(x),_=(g*g-f*f+r*x)/(2*f*n*S),E=(g*g-f*f-r*x)/(2*g*n*S),T=Math.log(Math.sqrt(_*_+1)-_),R=Math.log(Math.sqrt(E*E+1)-E);j=(R-T)/t,k=function(A){var B=A*j,$=z1(T),I=f/(n*S)*($*h4(t*B+T)-d4(T));return[u+I*w,d+I*b,f*$/z1(t*B+T)]}}return k.duration=j*1e3*t/Math.SQRT2,k}return s.rho=function(i){var l=Math.max(.001,+i),u=l*l,d=u*u;return e(l,u,d)},s})(Math.SQRT2,2,4);var Vo=0,nl=0,Yi=0,p2=1e3,Bu,rl,Uu=0,$a=0,gd=0,yl=typeof performance=="object"&&performance.now?performance:Date,m2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function qx(){return $a||(m2(p4),$a=yl.now()+gd)}function p4(){$a=0}function zu(){this._call=this._time=this._next=null}zu.prototype=g2.prototype={constructor:zu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?qx():+n)+(t==null?0:+t),!this._next&&rl!==this&&(rl?rl._next=this:Bu=this,rl=this),this._call=e,this._time=n,Fv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fv())}};function g2(e,t,n){var r=new zu;return r.restart(e,t,n),r}function m4(){qx(),++Vo;for(var e=Bu,t;e;)(t=$a-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Vo}function H1(){$a=(Uu=yl.now())+gd,Vo=nl=0;try{m4()}finally{Vo=0,y4(),$a=0}}function g4(){var e=yl.now(),t=e-Uu;t>p2&&(gd-=t,Uu=e)}function y4(){for(var e,t=Bu,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:Bu=n);rl=e,Fv(r)}function Fv(e){if(!Vo){nl&&(nl=clearTimeout(nl));var t=e-$a;t>24?(e<1/0&&(nl=setTimeout(H1,e-yl.now()-gd)),Yi&&(Yi=clearInterval(Yi))):(Yi||(Uu=yl.now(),Yi=setInterval(g4,p2)),Vo=1,m2(H1))}}function W1(e,t,n){var r=new zu;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var w4=pd("start","end","cancel","interrupt"),v4=[],y2=0,V1=1,qv=2,_u=3,G1=4,Bv=5,Eu=6;function yd(e,t,n,r,s,i){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;x4(e,n,{name:t,index:r,group:s,on:w4,tween:v4,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:y2})}function Bx(e,t){var n=ir(e,t);if(n.state>y2)throw new Error("too late; already scheduled");return n}function Ar(e,t){var n=ir(e,t);if(n.state>_u)throw new Error("too late; already running");return n}function ir(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function x4(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=g2(i,0,n.time);function i(f){n.state=V1,n.timer.restart(l,n.delay,n.time),n.delay<=f&&l(f-n.delay)}function l(f){var h,m,g,w;if(n.state!==V1)return d();for(h in r)if(w=r[h],w.name===n.name){if(w.state===_u)return W1(l);w.state===G1?(w.state=Eu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete r[h]):+h<t&&(w.state=Eu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete r[h])}if(W1(function(){n.state===_u&&(n.state=G1,n.timer.restart(u,n.delay,n.time),u(f))}),n.state=qv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===qv){for(n.state=_u,s=new Array(g=n.tween.length),h=0,m=-1;h<g;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(s[++m]=w);s.length=m+1}}function u(f){for(var h=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(d),n.state=Bv,1),m=-1,g=s.length;++m<g;)s[m].call(e,h);n.state===Bv&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=Eu,n.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function Cu(e,t){var n=e.__transition,r,s,i=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((r=n[l]).name!==t){i=!1;continue}s=r.state>qv&&r.state<Bv,r.state=Eu,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[l]}i&&delete e.__transition}}function b4(e){return this.each(function(){Cu(this,e)})}function k4(e,t){var n,r;return function(){var s=Ar(this,e),i=s.tween;if(i!==n){r=n=i;for(var l=0,u=r.length;l<u;++l)if(r[l].name===t){r=r.slice(),r.splice(l,1);break}}s.tween=r}}function N4(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Ar(this,e),l=i.tween;if(l!==r){s=(r=l).slice();for(var u={name:t,value:n},d=0,f=s.length;d<f;++d)if(s[d].name===t){s[d]=u;break}d===f&&s.push(u)}i.tween=s}}function j4(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ir(this.node(),n).tween,s=0,i=r.length,l;s<i;++s)if((l=r[s]).name===e)return l.value;return null}return this.each((t==null?k4:N4)(n,e,t))}function Ux(e,t,n){var r=e._id;return e.each(function(){var s=Ar(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return ir(s,r).value[t]}}function w2(e,t){var n;return(typeof t=="number"?Ls:t instanceof gl?B1:(n=gl(t))?(t=n,B1):a4)(e,t)}function S4(e){return function(){this.removeAttribute(e)}}function _4(e){return function(){this.removeAttributeNS(e.space,e.local)}}function E4(e,t,n){var r,s=n+"",i;return function(){var l=this.getAttribute(e);return l===s?null:l===r?i:i=t(r=l,n)}}function C4(e,t,n){var r,s=n+"",i;return function(){var l=this.getAttributeNS(e.space,e.local);return l===s?null:l===r?i:i=t(r=l,n)}}function T4(e,t,n){var r,s,i;return function(){var l,u=n(this),d;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),d=u+"",l===d?null:l===r&&d===s?i:(s=d,i=t(r=l,u)))}}function R4(e,t,n){var r,s,i;return function(){var l,u=n(this),d;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),d=u+"",l===d?null:l===r&&d===s?i:(s=d,i=t(r=l,u)))}}function A4(e,t){var n=md(e),r=n==="transform"?c4:w2;return this.attrTween(e,typeof t=="function"?(n.local?R4:T4)(n,r,Ux(this,"attr."+e,t)):t==null?(n.local?_4:S4)(n):(n.local?C4:E4)(n,r,t))}function M4(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function $4(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function I4(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&$4(e,i)),n}return s._value=t,s}function O4(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&M4(e,i)),n}return s._value=t,s}function L4(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=md(e);return this.tween(n,(r.local?I4:O4)(r,t))}function P4(e,t){return function(){Bx(this,e).delay=+t.apply(this,arguments)}}function D4(e,t){return t=+t,function(){Bx(this,e).delay=t}}function F4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?P4:D4)(t,e)):ir(this.node(),t).delay}function q4(e,t){return function(){Ar(this,e).duration=+t.apply(this,arguments)}}function B4(e,t){return t=+t,function(){Ar(this,e).duration=t}}function U4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?q4:B4)(t,e)):ir(this.node(),t).duration}function z4(e,t){if(typeof t!="function")throw new Error;return function(){Ar(this,e).ease=t}}function H4(e){var t=this._id;return arguments.length?this.each(z4(t,e)):ir(this.node(),t).ease}function W4(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ar(this,e).ease=n}}function V4(e){if(typeof e!="function")throw new Error;return this.each(W4(this._id,e))}function G4(e){typeof e!="function"&&(e=XR(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],l=i.length,u=r[s]=[],d,f=0;f<l;++f)(d=i[f])&&e.call(d,d.__data__,f,i)&&u.push(d);return new Jr(r,this._parents,this._name,this._id)}function K4(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),l=new Array(r),u=0;u<i;++u)for(var d=t[u],f=n[u],h=d.length,m=l[u]=new Array(h),g,w=0;w<h;++w)(g=d[w]||f[w])&&(m[w]=g);for(;u<r;++u)l[u]=t[u];return new Jr(l,this._parents,this._name,this._id)}function Y4(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 X4(e,t,n){var r,s,i=Y4(t)?Bx:Ar;return function(){var l=i(this,e),u=l.on;u!==r&&(s=(r=u).copy()).on(t,n),l.on=s}}function Z4(e,t){var n=this._id;return arguments.length<2?ir(this.node(),n).on.on(e):this.each(X4(n,e,t))}function J4(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Q4(){return this.on("end.remove",J4(this._id))}function eD(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Px(e));for(var r=this._groups,s=r.length,i=new Array(s),l=0;l<s;++l)for(var u=r[l],d=u.length,f=i[l]=new Array(d),h,m,g=0;g<d;++g)(h=u[g])&&(m=e.call(h,h.__data__,g,u))&&("__data__"in h&&(m.__data__=h.__data__),f[g]=m,yd(f[g],t,n,g,f,ir(h,n)));return new Jr(i,this._parents,t,n)}function tD(e){var t=this._name,n=this._id;typeof e!="function"&&(e=YR(e));for(var r=this._groups,s=r.length,i=[],l=[],u=0;u<s;++u)for(var d=r[u],f=d.length,h,m=0;m<f;++m)if(h=d[m]){for(var g=e.call(h,h.__data__,m,d),w,b=ir(h,n),x=0,k=g.length;x<k;++x)(w=g[x])&&yd(w,t,n,x,g,b);i.push(g),l.push(h)}return new Jr(i,l,t,n)}var nD=Pl.prototype.constructor;function rD(){return new nD(this._groups,this._parents)}function sD(e,t){var n,r,s;return function(){var i=Wo(this,e),l=(this.style.removeProperty(e),Wo(this,e));return i===l?null:i===n&&l===r?s:s=t(n=i,r=l)}}function v2(e){return function(){this.style.removeProperty(e)}}function aD(e,t,n){var r,s=n+"",i;return function(){var l=Wo(this,e);return l===s?null:l===r?i:i=t(r=l,n)}}function oD(e,t,n){var r,s,i;return function(){var l=Wo(this,e),u=n(this),d=u+"";return u==null&&(d=u=(this.style.removeProperty(e),Wo(this,e))),l===d?null:l===r&&d===s?i:(s=d,i=t(r=l,u))}}function iD(e,t){var n,r,s,i="style."+t,l="end."+i,u;return function(){var d=Ar(this,e),f=d.on,h=d.value[i]==null?u||(u=v2(t)):void 0;(f!==n||s!==h)&&(r=(n=f).copy()).on(l,s=h),d.on=r}}function lD(e,t,n){var r=(e+="")=="transform"?l4:w2;return t==null?this.styleTween(e,sD(e,r)).on("end.style."+e,v2(e)):typeof t=="function"?this.styleTween(e,oD(e,r,Ux(this,"style."+e,t))).each(iD(this._id,e)):this.styleTween(e,aD(e,r,t),n).on("end.style."+e,null)}function cD(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function uD(e,t,n){var r,s;function i(){var l=t.apply(this,arguments);return l!==s&&(r=(s=l)&&cD(e,l,n)),r}return i._value=t,i}function dD(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,uD(e,t,n??""))}function hD(e){return function(){this.textContent=e}}function fD(e){return function(){var t=e(this);this.textContent=t??""}}function pD(e){return this.tween("text",typeof e=="function"?fD(Ux(this,"text",e)):hD(e==null?"":e+""))}function mD(e){return function(t){this.textContent=e.call(this,t)}}function gD(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&mD(s)),t}return r._value=e,r}function yD(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,gD(e))}function wD(){for(var e=this._name,t=this._id,n=x2(),r=this._groups,s=r.length,i=0;i<s;++i)for(var l=r[i],u=l.length,d,f=0;f<u;++f)if(d=l[f]){var h=ir(d,t);yd(d,e,n,f,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Jr(r,this._parents,e,n)}function vD(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,l){var u={value:l},d={value:function(){--s===0&&i()}};n.each(function(){var f=Ar(this,r),h=f.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(d)),f.on=t}),s===0&&i()})}var xD=0;function Jr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function x2(){return++xD}var Kr=Pl.prototype;Jr.prototype={constructor:Jr,select:eD,selectAll:tD,selectChild:Kr.selectChild,selectChildren:Kr.selectChildren,filter:G4,merge:K4,selection:rD,transition:wD,call:Kr.call,nodes:Kr.nodes,node:Kr.node,size:Kr.size,empty:Kr.empty,each:Kr.each,on:Z4,attr:A4,attrTween:L4,style:lD,styleTween:dD,text:pD,textTween:yD,remove:Q4,tween:j4,delay:F4,duration:U4,ease:H4,easeVarying:V4,end:vD,[Symbol.iterator]:Kr[Symbol.iterator]};function bD(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var kD={time:null,delay:0,duration:250,ease:bD};function ND(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 jD(e){var t,n;e instanceof Jr?(t=e._id,e=e._name):(t=x2(),(n=kD).time=qx(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var l=r[i],u=l.length,d,f=0;f<u;++f)(d=l[f])&&yd(d,e,t,f,l,n||ND(d,t));return new Jr(r,this._parents,e,t)}Pl.prototype.interrupt=b4;Pl.prototype.transition=jD;const iu=e=>()=>e;function SD(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){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:s}})}function Yr(e,t,n){this.k=e,this.x=t,this.y=n}Yr.prototype={constructor:Yr,scale:function(e){return e===1?this:new Yr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Yr(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 Xr=new Yr(1,0,0);Yr.prototype;function zf(e){e.stopImmediatePropagation()}function Xi(e){e.preventDefault(),e.stopImmediatePropagation()}function _D(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ED(){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 K1(){return this.__zoom||Xr}function CD(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function TD(){return navigator.maxTouchPoints||"ontouchstart"in this}function RD(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l))}function b2(){var e=_D,t=ED,n=RD,r=CD,s=TD,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,d=f4,f=pd("start","zoom","end"),h,m,g,w=500,b=150,x=0,k=10;function j(M){M.property("__zoom",K1).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",D).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}j.transform=function(M,O,L,K){var Z=M.selection?M.selection():M;Z.property("__zoom",K1),M!==Z?T(M,O,L,K):Z.interrupt().each(function(){R(this,arguments).event(K).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},j.scaleBy=function(M,O,L,K){j.scaleTo(M,function(){var Z=this.__zoom.k,q=typeof O=="function"?O.apply(this,arguments):O;return Z*q},L,K)},j.scaleTo=function(M,O,L,K){j.transform(M,function(){var Z=t.apply(this,arguments),q=this.__zoom,H=L==null?E(Z):typeof L=="function"?L.apply(this,arguments):L,P=q.invert(H),Y=typeof O=="function"?O.apply(this,arguments):O;return n(_(S(q,Y),H,P),Z,l)},L,K)},j.translateBy=function(M,O,L,K){j.transform(M,function(){return n(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),l)},null,K)},j.translateTo=function(M,O,L,K,Z){j.transform(M,function(){var q=t.apply(this,arguments),H=this.__zoom,P=K==null?E(q):typeof K=="function"?K.apply(this,arguments):K;return n(Xr.translate(P[0],P[1]).scale(H.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof L=="function"?-L.apply(this,arguments):-L),q,l)},K,Z)};function S(M,O){return O=Math.max(i[0],Math.min(i[1],O)),O===M.k?M:new Yr(O,M.x,M.y)}function _(M,O,L){var K=O[0]-L[0]*M.k,Z=O[1]-L[1]*M.k;return K===M.x&&Z===M.y?M:new Yr(M.k,K,Z)}function E(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function T(M,O,L,K){M.on("start.zoom",function(){R(this,arguments).event(K).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(K).end()}).tween("zoom",function(){var Z=this,q=arguments,H=R(Z,q).event(K),P=t.apply(Z,q),Y=L==null?E(P):typeof L=="function"?L.apply(Z,q):L,G=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),z=Z.__zoom,X=typeof O=="function"?O.apply(Z,q):O,V=d(z.invert(Y).concat(G/z.k),X.invert(Y).concat(G/X.k));return function(J){if(J===1)J=X;else{var ee=V(J),re=G/ee[2];J=new Yr(re,Y[0]-ee[0]*re,Y[1]-ee[1]*re)}H.zoom(null,J)}})}function R(M,O,L){return!L&&M.__zooming||new A(M,O)}function A(M,O){this.that=M,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,O),this.taps=0}A.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,O){return this.mouse&&M!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var O=$n(this.that).datum();f.call(M,this.that,new SD(M,{sourceEvent:this.sourceEvent,target:j,transform:this.that.__zoom,dispatch:f}),O)}};function B(M,...O){if(!e.apply(this,arguments))return;var L=R(this,O).event(M),K=this.__zoom,Z=Math.max(i[0],Math.min(i[1],K.k*Math.pow(2,r.apply(this,arguments)))),q=Qn(M);if(L.wheel)(L.mouse[0][0]!==q[0]||L.mouse[0][1]!==q[1])&&(L.mouse[1]=K.invert(L.mouse[0]=q)),clearTimeout(L.wheel);else{if(K.k===Z)return;L.mouse=[q,K.invert(q)],Cu(this),L.start()}Xi(M),L.wheel=setTimeout(H,b),L.zoom("mouse",n(_(S(K,Z),L.mouse[0],L.mouse[1]),L.extent,l));function H(){L.wheel=null,L.end()}}function $(M,...O){if(g||!e.apply(this,arguments))return;var L=M.currentTarget,K=R(this,O,!0).event(M),Z=$n(M.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",G,!0),q=Qn(M,L),H=M.clientX,P=M.clientY;o2(M.view),zf(M),K.mouse=[q,this.__zoom.invert(q)],Cu(this),K.start();function Y(z){if(Xi(z),!K.moved){var X=z.clientX-H,V=z.clientY-P;K.moved=X*X+V*V>x}K.event(z).zoom("mouse",n(_(K.that.__zoom,K.mouse[0]=Qn(z,L),K.mouse[1]),K.extent,l))}function G(z){Z.on("mousemove.zoom mouseup.zoom",null),i2(z.view,K.moved),Xi(z),K.event(z).end()}}function I(M,...O){if(e.apply(this,arguments)){var L=this.__zoom,K=Qn(M.changedTouches?M.changedTouches[0]:M,this),Z=L.invert(K),q=L.k*(M.shiftKey?.5:2),H=n(_(S(L,q),K,Z),t.apply(this,O),l);Xi(M),u>0?$n(this).transition().duration(u).call(T,H,K,M):$n(this).call(j.transform,H,K,M)}}function D(M,...O){if(e.apply(this,arguments)){var L=M.touches,K=L.length,Z=R(this,O,M.changedTouches.length===K).event(M),q,H,P,Y;for(zf(M),H=0;H<K;++H)P=L[H],Y=Qn(P,this),Y=[Y,this.__zoom.invert(Y),P.identifier],Z.touch0?!Z.touch1&&Z.touch0[2]!==Y[2]&&(Z.touch1=Y,Z.taps=0):(Z.touch0=Y,q=!0,Z.taps=1+!!h);h&&(h=clearTimeout(h)),q&&(Z.taps<2&&(m=Y[0],h=setTimeout(function(){h=null},w)),Cu(this),Z.start())}}function F(M,...O){if(this.__zooming){var L=R(this,O).event(M),K=M.changedTouches,Z=K.length,q,H,P,Y;for(Xi(M),q=0;q<Z;++q)H=K[q],P=Qn(H,this),L.touch0&&L.touch0[2]===H.identifier?L.touch0[0]=P:L.touch1&&L.touch1[2]===H.identifier&&(L.touch1[0]=P);if(H=L.that.__zoom,L.touch1){var G=L.touch0[0],z=L.touch0[1],X=L.touch1[0],V=L.touch1[1],J=(J=X[0]-G[0])*J+(J=X[1]-G[1])*J,ee=(ee=V[0]-z[0])*ee+(ee=V[1]-z[1])*ee;H=S(H,Math.sqrt(J/ee)),P=[(G[0]+X[0])/2,(G[1]+X[1])/2],Y=[(z[0]+V[0])/2,(z[1]+V[1])/2]}else if(L.touch0)P=L.touch0[0],Y=L.touch0[1];else return;L.zoom("touch",n(_(H,P,Y),L.extent,l))}}function W(M,...O){if(this.__zooming){var L=R(this,O).event(M),K=M.changedTouches,Z=K.length,q,H;for(zf(M),g&&clearTimeout(g),g=setTimeout(function(){g=null},w),q=0;q<Z;++q)H=K[q],L.touch0&&L.touch0[2]===H.identifier?delete L.touch0:L.touch1&&L.touch1[2]===H.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(H=Qn(H,this),Math.hypot(m[0]-H[0],m[1]-H[1])<k)){var P=$n(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return j.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:iu(+M),j):r},j.filter=function(M){return arguments.length?(e=typeof M=="function"?M:iu(!!M),j):e},j.touchable=function(M){return arguments.length?(s=typeof M=="function"?M:iu(!!M),j):s},j.extent=function(M){return arguments.length?(t=typeof M=="function"?M:iu([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),j):t},j.scaleExtent=function(M){return arguments.length?(i[0]=+M[0],i[1]=+M[1],j):[i[0],i[1]]},j.translateExtent=function(M){return arguments.length?(l[0][0]=+M[0][0],l[1][0]=+M[1][0],l[0][1]=+M[0][1],l[1][1]=+M[1][1],j):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},j.constrain=function(M){return arguments.length?(n=M,j):n},j.duration=function(M){return arguments.length?(u=+M,j):u},j.interpolate=function(M){return arguments.length?(d=M,j):d},j.on=function(){var M=f.on.apply(f,arguments);return M===f?j:M},j.clickDistance=function(M){return arguments.length?(x=(M=+M)*M,j):Math.sqrt(x)},j.tapDistance=function(M){return arguments.length?(k=+M,j):k},j}var It=VR();const wd=v.createContext(null),AD=wd.Provider,Qr={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},k2=Qr.error001();function We(e,t){const n=v.useContext(wd);if(n===null)throw new Error(k2);return GR(n,e,t)}const vt=()=>{const e=v.useContext(wd);if(e===null)throw new Error(k2);return v.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},MD=e=>e.userSelectionActive?"none":"all";function zx({position:e,children:t,className:n,style:r,...s}){const i=We(MD),l=`${e}`.split("-");return ce.createElement("div",{className:Dt(["react-flow__panel",n,...l]),style:{...r,pointerEvents:i},...s},t)}function $D({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ce.createElement(zx,{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"},ce.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const ID=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:d,className:f,...h})=>{const m=v.useRef(null),[g,w]=v.useState({x:0,y:0,width:0,height:0}),b=Dt(["react-flow__edge-textwrapper",f]);return v.useEffect(()=>{if(m.current){const x=m.current.getBBox();w({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),typeof n>"u"||!n?null:ce.createElement("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:b,visibility:g.width?"visible":"hidden",...h},s&&ce.createElement("rect",{width:g.width+2*l[0],x:-l[0],y:-l[1],height:g.height+2*l[1],className:"react-flow__edge-textbg",style:i,rx:u,ry:u}),ce.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:m,style:r},n),d)};var OD=v.memo(ID);const Hx=e=>({width:e.offsetWidth,height:e.offsetHeight}),Go=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Wx=(e={x:0,y:0},t)=>({x:Go(e.x,t[0][0],t[1][0]),y:Go(e.y,t[0][1],t[1][1])}),Y1=(e,t,n)=>e<t?Go(Math.abs(e-t),1,50)/50:e>n?-Go(Math.abs(e-n),1,50)/50:0,N2=(e,t)=>{const n=Y1(e.x,35,t.width-35)*20,r=Y1(e.y,35,t.height-35)*20;return[n,r]},j2=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},S2=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),wl=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),_2=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),X1=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),LD=(e,t)=>_2(S2(wl(e),wl(t))),Uv=(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)},PD=e=>In(e.width)&&In(e.height)&&In(e.x)&&In(e.y),In=e=>!isNaN(e)&&isFinite(e),ht=Symbol.for("internals"),E2=["Enter"," ","Escape"],DD=(e,t)=>{},FD=e=>"nativeEvent"in e;function zv(e){var s,i;const t=FD(e)?e.nativeEvent:e,n=((i=(s=t.composedPath)==null?void 0:s.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const C2=e=>"clientX"in e,Us=(e,t)=>{var i,l;const n=C2(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Hu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Fl=({id:e,path:t,labelX:n,labelY:r,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:w=20})=>ce.createElement(ce.Fragment,null,ce.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:g}),w&&ce.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),s&&In(n)&&In(r)?ce.createElement(OD,{x:n,y:r,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f}):null);Fl.displayName="BaseEdge";function Zi(e,t,n){return n===void 0?n:r=>{const s=t().edges.find(i=>i.id===e);s&&n(r,{...s})}}function T2({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,l=Math.abs(r-t)/2,u=r<t?r+l:r-l;return[i,u,s,l]}function R2({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:l,targetControlY:u}){const d=e*.125+s*.375+l*.375+n*.125,f=t*.125+i*.375+u*.375+r*.125,h=Math.abs(d-e),m=Math.abs(f-t);return[d,f,h,m]}var Ia;(function(e){e.Strict="strict",e.Loose="loose"})(Ia||(Ia={}));var _a;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(_a||(_a={}));var vl;(function(e){e.Partial="partial",e.Full="full"})(vl||(vl={}));var Ds;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ds||(Ds={}));var Wu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Wu||(Wu={}));var Ce;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ce||(Ce={}));function Z1({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ce.Left||e===Ce.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function A2({sourceX:e,sourceY:t,sourcePosition:n=Ce.Bottom,targetX:r,targetY:s,targetPosition:i=Ce.Top}){const[l,u]=Z1({pos:n,x1:e,y1:t,x2:r,y2:s}),[d,f]=Z1({pos:i,x1:r,y1:s,x2:e,y2:t}),[h,m,g,w]=R2({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:u,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${u} ${d},${f} ${r},${s}`,h,m,g,w]}const Vx=v.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s=Ce.Bottom,targetPosition:i=Ce.Top,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:w,markerStart:b,interactionWidth:x})=>{const[k,j,S]=A2({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:i});return ce.createElement(Fl,{path:k,labelX:j,labelY:S,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:w,markerStart:b,interactionWidth:x})});Vx.displayName="SimpleBezierEdge";const J1={[Ce.Left]:{x:-1,y:0},[Ce.Right]:{x:1,y:0},[Ce.Top]:{x:0,y:-1},[Ce.Bottom]:{x:0,y:1}},qD=({source:e,sourcePosition:t=Ce.Bottom,target:n})=>t===Ce.Left||t===Ce.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},Q1=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function BD({source:e,sourcePosition:t=Ce.Bottom,target:n,targetPosition:r=Ce.Top,center:s,offset:i}){const l=J1[t],u=J1[r],d={x:e.x+l.x*i,y:e.y+l.y*i},f={x:n.x+u.x*i,y:n.y+u.y*i},h=qD({source:d,sourcePosition:t,target:f}),m=h.x!==0?"x":"y",g=h[m];let w=[],b,x;const k={x:0,y:0},j={x:0,y:0},[S,_,E,T]=T2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[m]*u[m]===-1){b=s.x??S,x=s.y??_;const A=[{x:b,y:d.y},{x:b,y:f.y}],B=[{x:d.x,y:x},{x:f.x,y:x}];l[m]===g?w=m==="x"?A:B:w=m==="x"?B:A}else{const A=[{x:d.x,y:f.y}],B=[{x:f.x,y:d.y}];if(m==="x"?w=l.x===g?B:A:w=l.y===g?A:B,t===r){const W=Math.abs(e[m]-n[m]);if(W<=i){const M=Math.min(i-1,i-W);l[m]===g?k[m]=(d[m]>e[m]?-1:1)*M:j[m]=(f[m]>n[m]?-1:1)*M}}if(t!==r){const W=m==="x"?"y":"x",M=l[m]===u[W],O=d[W]>f[W],L=d[W]<f[W];(l[m]===1&&(!M&&O||M&&L)||l[m]!==1&&(!M&&L||M&&O))&&(w=m==="x"?A:B)}const $={x:d.x+k.x,y:d.y+k.y},I={x:f.x+j.x,y:f.y+j.y},D=Math.max(Math.abs($.x-w[0].x),Math.abs(I.x-w[0].x)),F=Math.max(Math.abs($.y-w[0].y),Math.abs(I.y-w[0].y));D>=F?(b=($.x+I.x)/2,x=w[0].y):(b=w[0].x,x=($.y+I.y)/2)}return[[e,{x:d.x+k.x,y:d.y+k.y},...w,{x:f.x+j.x,y:f.y+j.y},n],b,x,E,T]}function UD(e,t,n,r){const s=Math.min(Q1(e,t)/2,Q1(t,n)/2,r),{x:i,y:l}=t;if(e.x===i&&i===n.x||e.y===l&&l===n.y)return`L${i} ${l}`;if(e.y===l){const f=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+s*f},${l}Q ${i},${l} ${i},${l+s*h}`}const u=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${i},${l+s*d}Q ${i},${l} ${i+s*u},${l}`}function Hv({sourceX:e,sourceY:t,sourcePosition:n=Ce.Bottom,targetX:r,targetY:s,targetPosition:i=Ce.Top,borderRadius:l=5,centerX:u,centerY:d,offset:f=20}){const[h,m,g,w,b]=BD({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:u,y:d},offset:f});return[h.reduce((k,j,S)=>{let _="";return S>0&&S<h.length-1?_=UD(h[S-1],j,h[S+1],l):_=`${S===0?"M":"L"}${j.x} ${j.y}`,k+=_,k},""),m,g,w,b]}const vd=v.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:m=Ce.Bottom,targetPosition:g=Ce.Top,markerEnd:w,markerStart:b,pathOptions:x,interactionWidth:k})=>{const[j,S,_]=Hv({sourceX:e,sourceY:t,sourcePosition:m,targetX:n,targetY:r,targetPosition:g,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset});return ce.createElement(Fl,{path:j,labelX:S,labelY:_,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:w,markerStart:b,interactionWidth:k})});vd.displayName="SmoothStepEdge";const Gx=v.memo(e=>{var t;return ce.createElement(vd,{...e,pathOptions:v.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Gx.displayName="StepEdge";function zD({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,l,u]=T2({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,l,u]}const Kx=v.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:w})=>{const[b,x,k]=zD({sourceX:e,sourceY:t,targetX:n,targetY:r});return ce.createElement(Fl,{path:b,labelX:x,labelY:k,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:w})});Kx.displayName="StraightEdge";function lu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function eN({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Ce.Left:return[t-lu(t-r,i),n];case Ce.Right:return[t+lu(r-t,i),n];case Ce.Top:return[t,n-lu(n-s,i)];case Ce.Bottom:return[t,n+lu(s-n,i)]}}function Yx({sourceX:e,sourceY:t,sourcePosition:n=Ce.Bottom,targetX:r,targetY:s,targetPosition:i=Ce.Top,curvature:l=.25}){const[u,d]=eN({pos:n,x1:e,y1:t,x2:r,y2:s,c:l}),[f,h]=eN({pos:i,x1:r,y1:s,x2:e,y2:t,c:l}),[m,g,w,b]=R2({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:u,sourceControlY:d,targetControlX:f,targetControlY:h});return[`M${e},${t} C${u},${d} ${f},${h} ${r},${s}`,m,g,w,b]}const Vu=v.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s=Ce.Bottom,targetPosition:i=Ce.Top,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:w,markerStart:b,pathOptions:x,interactionWidth:k})=>{const[j,S,_]=Yx({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:x==null?void 0:x.curvature});return ce.createElement(Fl,{path:j,labelX:S,labelY:_,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:w,markerStart:b,interactionWidth:k})});Vu.displayName="BezierEdge";const Xx=v.createContext(null),HD=Xx.Provider;Xx.Consumer;const WD=()=>v.useContext(Xx),VD=e=>"id"in e&&"source"in e&&"target"in e,GD=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,Wv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,KD=(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)),YD=(e,t)=>{if(!e.source||!e.target)return t;let n;return VD(e)?n={...e}:n={...e,id:GD(e)},KD(n,t)?t:t.concat(n)},Vv=({x:e,y:t},[n,r,s],i,[l,u])=>{const d={x:(e-n)/s,y:(t-r)/s};return i?{x:l*Math.round(d.x/l),y:u*Math.round(d.y/u)}:d},M2=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r}),Ta=(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],s={x:e.position.x-n,y:e.position.y-r};return{...s,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:s}},xd=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const{x:i,y:l}=Ta(s,t).positionAbsolute;return S2(r,wl({x:i,y:l,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return _2(n)},$2=(e,t,[n,r,s]=[0,0,1],i=!1,l=!1,u=[0,0])=>{const d={x:(t.x-n)/s,y:(t.y-r)/s,width:t.width/s,height:t.height/s},f=[];return e.forEach(h=>{const{width:m,height:g,selectable:w=!0,hidden:b=!1}=h;if(l&&!w||b)return!1;const{positionAbsolute:x}=Ta(h,u),k={x:x.x,y:x.y,width:m||0,height:g||0},j=Uv(d,k),S=typeof m>"u"||typeof g>"u"||m===null||g===null,_=i&&j>0,E=(m||0)*(g||0);(S||_||j>=E||h.dragging)&&f.push(h)}),f},I2=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},O2=(e,t,n,r,s,i=.1)=>{const l=t/(e.width*(1+i)),u=n/(e.height*(1+i)),d=Math.min(l,u),f=Go(d,r,s),h=e.x+e.width/2,m=e.y+e.height/2,g=t/2-h*f,w=n/2-m*f;return{x:g,y:w,zoom:f}},ba=(e,t=0)=>e.transition().duration(t);function tN(e,t,n,r){return(t[n]||[]).reduce((s,i)=>{var l,u;return`${e.id}-${i.id}-${n}`!==r&&s.push({id:i.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+i.x+i.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+i.y+i.height/2}),s},[])}function XD(e,t,n,r,s,i){const{x:l,y:u}=Us(e),f=t.elementsFromPoint(l,u).find(b=>b.classList.contains("react-flow__handle"));if(f){const b=f.getAttribute("data-nodeid");if(b){const x=Zx(void 0,f),k=f.getAttribute("data-handleid"),j=i({nodeId:b,id:k,type:x});if(j){const S=s.find(_=>_.nodeId===b&&_.type===x&&_.id===k);return{handle:{id:k,type:x,nodeId:b,x:(S==null?void 0:S.x)||n.x,y:(S==null?void 0:S.y)||n.y},validHandleResult:j}}}}let h=[],m=1/0;if(s.forEach(b=>{const x=Math.sqrt((b.x-n.x)**2+(b.y-n.y)**2);if(x<=r){const k=i(b);x<=m&&(x<m?h=[{handle:b,validHandleResult:k}]:x===m&&h.push({handle:b,validHandleResult:k}),m=x)}}),!h.length)return{handle:null,validHandleResult:L2()};if(h.length===1)return h[0];const g=h.some(({validHandleResult:b})=>b.isValid),w=h.some(({handle:b})=>b.type==="target");return h.find(({handle:b,validHandleResult:x})=>w?b.type==="target":g?x.isValid:!0)||h[0]}const ZD={source:null,target:null,sourceHandle:null,targetHandle:null},L2=()=>({handleDomNode:null,isValid:!1,connection:ZD,endHandle:null});function P2(e,t,n,r,s,i,l){const u=s==="target",d=l.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),f={...L2(),handleDomNode:d};if(d){const h=Zx(void 0,d),m=d.getAttribute("data-nodeid"),g=d.getAttribute("data-handleid"),w=d.classList.contains("connectable"),b=d.classList.contains("connectableend"),x={source:u?m:n,sourceHandle:u?g:r,target:u?n:m,targetHandle:u?r:g};f.connection=x,w&&b&&(t===Ia.Strict?u&&h==="source"||!u&&h==="target":m!==n||g!==r)&&(f.endHandle={nodeId:m,handleId:g,type:h},f.isValid=i(x))}return f}function JD({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((s,i)=>{if(i[ht]){const{handleBounds:l}=i[ht];let u=[],d=[];l&&(u=tN(i,l,"source",`${t}-${n}-${r}`),d=tN(i,l,"target",`${t}-${n}-${r}`)),s.push(...u,...d)}return s},[])}function Zx(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Hf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function QD(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function D2({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:s,getState:i,setState:l,isValidConnection:u,edgeUpdaterType:d,onReconnectEnd:f}){const h=j2(e.target),{connectionMode:m,domNode:g,autoPanOnConnect:w,connectionRadius:b,onConnectStart:x,panBy:k,getNodes:j,cancelConnection:S}=i();let _=0,E;const{x:T,y:R}=Us(e),A=h==null?void 0:h.elementFromPoint(T,R),B=Zx(d,A),$=g==null?void 0:g.getBoundingClientRect();if(!$||!B)return;let I,D=Us(e,$),F=!1,W=null,M=!1,O=null;const L=JD({nodes:j(),nodeId:n,handleId:t,handleType:B}),K=()=>{if(!w)return;const[H,P]=N2(D,$);k({x:H,y:P}),_=requestAnimationFrame(K)};l({connectionPosition:D,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:B,connectionStartHandle:{nodeId:n,handleId:t,type:B},connectionEndHandle:null}),x==null||x(e,{nodeId:n,handleId:t,handleType:B});function Z(H){const{transform:P}=i();D=Us(H,$);const{handle:Y,validHandleResult:G}=XD(H,h,Vv(D,P,!1,[1,1]),b,L,z=>P2(z,m,n,t,s?"target":"source",u,h));if(E=Y,F||(K(),F=!0),O=G.handleDomNode,W=G.connection,M=G.isValid,l({connectionPosition:E&&M?M2({x:E.x,y:E.y},P):D,connectionStatus:QD(!!E,M),connectionEndHandle:G.endHandle}),!E&&!M&&!O)return Hf(I);W.source!==W.target&&O&&(Hf(I),I=O,O.classList.add("connecting","react-flow__handle-connecting"),O.classList.toggle("valid",M),O.classList.toggle("react-flow__handle-valid",M))}function q(H){var P,Y;(E||O)&&W&&M&&(r==null||r(W)),(Y=(P=i()).onConnectEnd)==null||Y.call(P,H),d&&(f==null||f(H)),Hf(I),S(),cancelAnimationFrame(_),F=!1,M=!1,W=null,O=null,h.removeEventListener("mousemove",Z),h.removeEventListener("mouseup",q),h.removeEventListener("touchmove",Z),h.removeEventListener("touchend",q)}h.addEventListener("mousemove",Z),h.addEventListener("mouseup",q),h.addEventListener("touchmove",Z),h.addEventListener("touchend",q)}const nN=()=>!0,e5=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),t5=(e,t,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:i,connectionClickStartHandle:l}=r;return{connecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},F2=v.forwardRef(({type:e="source",position:t=Ce.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:l,onConnect:u,children:d,className:f,onMouseDown:h,onTouchStart:m,...g},w)=>{var $,I;const b=l||null,x=e==="target",k=vt(),j=WD(),{connectOnClick:S,noPanClassName:_}=We(e5,Tt),{connecting:E,clickConnecting:T}=We(t5(j,b,e),Tt);j||(I=($=k.getState()).onError)==null||I.call($,"010",Qr.error010());const R=D=>{const{defaultEdgeOptions:F,onConnect:W,hasDefaultEdges:M}=k.getState(),O={...F,...D};if(M){const{edges:L,setEdges:K}=k.getState();K(YD(O,L))}W==null||W(O),u==null||u(O)},A=D=>{if(!j)return;const F=C2(D);s&&(F&&D.button===0||!F)&&D2({event:D,handleId:b,nodeId:j,onConnect:R,isTarget:x,getState:k.getState,setState:k.setState,isValidConnection:n||k.getState().isValidConnection||nN}),F?h==null||h(D):m==null||m(D)},B=D=>{const{onClickConnectStart:F,onClickConnectEnd:W,connectionClickStartHandle:M,connectionMode:O,isValidConnection:L}=k.getState();if(!j||!M&&!s)return;if(!M){F==null||F(D,{nodeId:j,handleId:b,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:j,type:e,handleId:b}});return}const K=j2(D.target),Z=n||L||nN,{connection:q,isValid:H}=P2({nodeId:j,id:b,type:e},O,M.nodeId,M.handleId||null,M.type,Z,K);H&&R(q),W==null||W(D),k.setState({connectionClickStartHandle:null})};return ce.createElement("div",{"data-handleid":b,"data-nodeid":j,"data-handlepos":t,"data-id":`${j}-${b}-${e}`,className:Dt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,f,{source:!x,target:x,connectable:r,connectablestart:s,connectableend:i,connecting:T,connectionindicator:r&&(s&&!E||i&&E)}]),onMouseDown:A,onTouchStart:A,onClick:S?B:void 0,ref:w,...g},d)});F2.displayName="Handle";var Oa=v.memo(F2);const q2=({data:e,isConnectable:t,targetPosition:n=Ce.Top,sourcePosition:r=Ce.Bottom})=>ce.createElement(ce.Fragment,null,ce.createElement(Oa,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,ce.createElement(Oa,{type:"source",position:r,isConnectable:t}));q2.displayName="DefaultNode";var Gv=v.memo(q2);const B2=({data:e,isConnectable:t,sourcePosition:n=Ce.Bottom})=>ce.createElement(ce.Fragment,null,e==null?void 0:e.label,ce.createElement(Oa,{type:"source",position:n,isConnectable:t}));B2.displayName="InputNode";var U2=v.memo(B2);const z2=({data:e,isConnectable:t,targetPosition:n=Ce.Top})=>ce.createElement(ce.Fragment,null,ce.createElement(Oa,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);z2.displayName="OutputNode";var H2=v.memo(z2);const Jx=()=>null;Jx.displayName="GroupNode";const n5=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),cu=e=>e.id;function r5(e,t){return Tt(e.selectedNodes.map(cu),t.selectedNodes.map(cu))&&Tt(e.selectedEdges.map(cu),t.selectedEdges.map(cu))}const W2=v.memo(({onSelectionChange:e})=>{const t=vt(),{selectedNodes:n,selectedEdges:r}=We(n5,r5);return v.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChange.forEach(i=>i(s))},[n,r,e]),null});W2.displayName="SelectionListener";const s5=e=>!!e.onSelectionChange;function a5({onSelectionChange:e}){const t=We(s5);return e||t?ce.createElement(W2,{onSelectionChange:e}):null}const o5=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 bo(e,t){v.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Fe(e,t,n){v.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const i5=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:i,onConnectEnd:l,onClickConnectStart:u,onClickConnectEnd:d,nodesDraggable:f,nodesConnectable:h,nodesFocusable:m,edgesFocusable:g,edgesUpdatable:w,elevateNodesOnSelect:b,minZoom:x,maxZoom:k,nodeExtent:j,onNodesChange:S,onEdgesChange:_,elementsSelectable:E,connectionMode:T,snapGrid:R,snapToGrid:A,translateExtent:B,connectOnClick:$,defaultEdgeOptions:I,fitView:D,fitViewOptions:F,onNodesDelete:W,onEdgesDelete:M,onNodeDrag:O,onNodeDragStart:L,onNodeDragStop:K,onSelectionDrag:Z,onSelectionDragStart:q,onSelectionDragStop:H,noPanClassName:P,nodeOrigin:Y,rfId:G,autoPanOnConnect:z,autoPanOnNodeDrag:X,onError:V,connectionRadius:J,isValidConnection:ee,nodeDragThreshold:re})=>{const{setNodes:oe,setEdges:fe,setDefaultNodesAndEdges:Ne,setMinZoom:we,setMaxZoom:ye,setTranslateExtent:ve,setNodeExtent:Ie,reset:xe}=We(o5,Tt),ue=vt();return v.useEffect(()=>{const se=r==null?void 0:r.map(be=>({...be,...I}));return Ne(n,se),()=>{xe()}},[]),Fe("defaultEdgeOptions",I,ue.setState),Fe("connectionMode",T,ue.setState),Fe("onConnect",s,ue.setState),Fe("onConnectStart",i,ue.setState),Fe("onConnectEnd",l,ue.setState),Fe("onClickConnectStart",u,ue.setState),Fe("onClickConnectEnd",d,ue.setState),Fe("nodesDraggable",f,ue.setState),Fe("nodesConnectable",h,ue.setState),Fe("nodesFocusable",m,ue.setState),Fe("edgesFocusable",g,ue.setState),Fe("edgesUpdatable",w,ue.setState),Fe("elementsSelectable",E,ue.setState),Fe("elevateNodesOnSelect",b,ue.setState),Fe("snapToGrid",A,ue.setState),Fe("snapGrid",R,ue.setState),Fe("onNodesChange",S,ue.setState),Fe("onEdgesChange",_,ue.setState),Fe("connectOnClick",$,ue.setState),Fe("fitViewOnInit",D,ue.setState),Fe("fitViewOnInitOptions",F,ue.setState),Fe("onNodesDelete",W,ue.setState),Fe("onEdgesDelete",M,ue.setState),Fe("onNodeDrag",O,ue.setState),Fe("onNodeDragStart",L,ue.setState),Fe("onNodeDragStop",K,ue.setState),Fe("onSelectionDrag",Z,ue.setState),Fe("onSelectionDragStart",q,ue.setState),Fe("onSelectionDragStop",H,ue.setState),Fe("noPanClassName",P,ue.setState),Fe("nodeOrigin",Y,ue.setState),Fe("rfId",G,ue.setState),Fe("autoPanOnConnect",z,ue.setState),Fe("autoPanOnNodeDrag",X,ue.setState),Fe("onError",V,ue.setState),Fe("connectionRadius",J,ue.setState),Fe("isValidConnection",ee,ue.setState),Fe("nodeDragThreshold",re,ue.setState),bo(e,oe),bo(t,fe),bo(x,we),bo(k,ye),bo(B,ve),bo(j,Ie),null},rN={display:"none"},l5={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},V2="react-flow__node-desc",G2="react-flow__edge-desc",c5="react-flow__aria-live",u5=e=>e.ariaLiveMessage;function d5({rfId:e}){const t=We(u5);return ce.createElement("div",{id:`${c5}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:l5},t)}function h5({rfId:e,disableKeyboardA11y:t}){return ce.createElement(ce.Fragment,null,ce.createElement("div",{id:`${V2}-${e}`,style:rN},"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."," "),ce.createElement("div",{id:`${G2}-${e}`,style:rN},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&ce.createElement(d5,{rfId:e}))}var xl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=v.useState(!1),s=v.useRef(!1),i=v.useRef(new Set([])),[l,u]=v.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=f.reduce((m,g)=>m.concat(...g),[]);return[f,h]}return[[],[]]},[e]);return v.useEffect(()=>{const d=typeof document<"u"?document:null,f=(t==null?void 0:t.target)||d;if(e!==null){const h=w=>{if(s.current=w.ctrlKey||w.metaKey||w.shiftKey,(!s.current||s.current&&!t.actInsideInputWithModifier)&&zv(w))return!1;const x=aN(w.code,u);i.current.add(w[x]),sN(l,i.current,!1)&&(w.preventDefault(),r(!0))},m=w=>{if((!s.current||s.current&&!t.actInsideInputWithModifier)&&zv(w))return!1;const x=aN(w.code,u);sN(l,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(w[x]),w.key==="Meta"&&i.current.clear(),s.current=!1},g=()=>{i.current.clear(),r(!1)};return f==null||f.addEventListener("keydown",h),f==null||f.addEventListener("keyup",m),window.addEventListener("blur",g),()=>{f==null||f.removeEventListener("keydown",h),f==null||f.removeEventListener("keyup",m),window.removeEventListener("blur",g)}}},[e,r]),n};function sN(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function aN(e,t){return t.includes(e)?"code":"key"}function K2(e,t,n,r){var u,d;const s=e.parentNode||e.parentId;if(!s)return n;const i=t.get(s),l=Ta(i,r);return K2(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((u=i[ht])==null?void 0:u.z)??0)>(n.z??0)?((d=i[ht])==null?void 0:d.z)??0:n.z??0},r)}function Y2(e,t,n){e.forEach(r=>{var i;const s=r.parentNode||r.parentId;if(s&&!e.has(s))throw new Error(`Parent node ${s} not found`);if(s||n!=null&&n[r.id]){const{x:l,y:u,z:d}=K2(r,e,{...r.position,z:((i=r[ht])==null?void 0:i.z)??0},t);r.positionAbsolute={x:l,y:u},r[ht].z=d,n!=null&&n[r.id]&&(r[ht].isParent=!0)}})}function Wf(e,t,n,r){const s=new Map,i={},l=r?1e3:0;return e.forEach(u=>{var w;const d=(In(u.zIndex)?u.zIndex:0)+(u.selected?l:0),f=t.get(u.id),h={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},m=u.parentNode||u.parentId;m&&(i[m]=!0);const g=(f==null?void 0:f.type)&&(f==null?void 0:f.type)!==u.type;Object.defineProperty(h,ht,{enumerable:!1,value:{handleBounds:g||(w=f==null?void 0:f[ht])==null?void 0:w.handleBounds,z:d}}),s.set(u.id,h)}),Y2(s,n,i),s}function X2(e,t={}){const{getNodes:n,width:r,height:s,minZoom:i,maxZoom:l,d3Zoom:u,d3Selection:d,fitViewOnInitDone:f,fitViewOnInit:h,nodeOrigin:m}=e(),g=t.initial&&!f&&h;if(u&&d&&(g||!t.initial)){const b=n().filter(k=>{var S;const j=t.includeHiddenNodes?k.width&&k.height:!k.hidden;return(S=t.nodes)!=null&&S.length?j&&t.nodes.some(_=>_.id===k.id):j}),x=b.every(k=>k.width&&k.height);if(b.length>0&&x){const k=xd(b,m),{x:j,y:S,zoom:_}=O2(k,r,s,t.minZoom??i,t.maxZoom??l,t.padding??.1),E=Xr.translate(j,S).scale(_);return typeof t.duration=="number"&&t.duration>0?u.transform(ba(d,t.duration),E):u.transform(d,E),!0}}return!1}function f5(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[ht]:r[ht],selected:n.selected})}),new Map(t)}function p5(e,t){return t.map(n=>{const r=e.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function uu({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:s,edges:i,onNodesChange:l,onEdgesChange:u,hasDefaultNodes:d,hasDefaultEdges:f}=n();e!=null&&e.length&&(d&&r({nodeInternals:f5(e,s)}),l==null||l(e)),t!=null&&t.length&&(f&&r({edges:p5(t,i)}),u==null||u(t))}const ko=()=>{},m5={zoomIn:ko,zoomOut:ko,zoomTo:ko,getZoom:()=>1,setViewport:ko,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ko,fitBounds:ko,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},g5=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),y5=()=>{const e=vt(),{d3Zoom:t,d3Selection:n}=We(g5,Tt);return v.useMemo(()=>n&&t?{zoomIn:s=>t.scaleBy(ba(n,s==null?void 0:s.duration),1.2),zoomOut:s=>t.scaleBy(ba(n,s==null?void 0:s.duration),1/1.2),zoomTo:(s,i)=>t.scaleTo(ba(n,i==null?void 0:i.duration),s),getZoom:()=>e.getState().transform[2],setViewport:(s,i)=>{const[l,u,d]=e.getState().transform,f=Xr.translate(s.x??l,s.y??u).scale(s.zoom??d);t.transform(ba(n,i==null?void 0:i.duration),f)},getViewport:()=>{const[s,i,l]=e.getState().transform;return{x:s,y:i,zoom:l}},fitView:s=>X2(e.getState,s),setCenter:(s,i,l)=>{const{width:u,height:d,maxZoom:f}=e.getState(),h=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:f,m=u/2-s*h,g=d/2-i*h,w=Xr.translate(m,g).scale(h);t.transform(ba(n,l==null?void 0:l.duration),w)},fitBounds:(s,i)=>{const{width:l,height:u,minZoom:d,maxZoom:f}=e.getState(),{x:h,y:m,zoom:g}=O2(s,l,u,d,f,(i==null?void 0:i.padding)??.1),w=Xr.translate(h,m).scale(g);t.transform(ba(n,i==null?void 0:i.duration),w)},project:s=>{const{transform:i,snapToGrid:l,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"),Vv(s,i,l,u)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:l,snapGrid:u,domNode:d}=e.getState();if(!d)return s;const{x:f,y:h}=d.getBoundingClientRect(),m={x:s.x-f,y:s.y-h};return Vv(m,i,l,u)},flowToScreenPosition:s=>{const{transform:i,domNode:l}=e.getState();if(!l)return s;const{x:u,y:d}=l.getBoundingClientRect(),f=M2(s,i);return{x:f.x+u,y:f.y+d}},viewportInitialized:!0}:m5,[t,n])};function si(){const e=y5(),t=vt(),n=v.useCallback(()=>t.getState().getNodes().map(x=>({...x})),[]),r=v.useCallback(x=>t.getState().nodeInternals.get(x),[]),s=v.useCallback(()=>{const{edges:x=[]}=t.getState();return x.map(k=>({...k}))},[]),i=v.useCallback(x=>{const{edges:k=[]}=t.getState();return k.find(j=>j.id===x)},[]),l=v.useCallback(x=>{const{getNodes:k,setNodes:j,hasDefaultNodes:S,onNodesChange:_}=t.getState(),E=k(),T=typeof x=="function"?x(E):x;if(S)j(T);else if(_){const R=T.length===0?E.map(A=>({type:"remove",id:A.id})):T.map(A=>({item:A,type:"reset"}));_(R)}},[]),u=v.useCallback(x=>{const{edges:k=[],setEdges:j,hasDefaultEdges:S,onEdgesChange:_}=t.getState(),E=typeof x=="function"?x(k):x;if(S)j(E);else if(_){const T=E.length===0?k.map(R=>({type:"remove",id:R.id})):E.map(R=>({item:R,type:"reset"}));_(T)}},[]),d=v.useCallback(x=>{const k=Array.isArray(x)?x:[x],{getNodes:j,setNodes:S,hasDefaultNodes:_,onNodesChange:E}=t.getState();if(_){const R=[...j(),...k];S(R)}else if(E){const T=k.map(R=>({item:R,type:"add"}));E(T)}},[]),f=v.useCallback(x=>{const k=Array.isArray(x)?x:[x],{edges:j=[],setEdges:S,hasDefaultEdges:_,onEdgesChange:E}=t.getState();if(_)S([...j,...k]);else if(E){const T=k.map(R=>({item:R,type:"add"}));E(T)}},[]),h=v.useCallback(()=>{const{getNodes:x,edges:k=[],transform:j}=t.getState(),[S,_,E]=j;return{nodes:x().map(T=>({...T})),edges:k.map(T=>({...T})),viewport:{x:S,y:_,zoom:E}}},[]),m=v.useCallback(({nodes:x,edges:k})=>{const{nodeInternals:j,getNodes:S,edges:_,hasDefaultNodes:E,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:A,onNodesChange:B,onEdgesChange:$}=t.getState(),I=(x||[]).map(O=>O.id),D=(k||[]).map(O=>O.id),F=S().reduce((O,L)=>{const K=L.parentNode||L.parentId,Z=!I.includes(L.id)&&K&&O.find(H=>H.id===K);return(typeof L.deletable=="boolean"?L.deletable:!0)&&(I.includes(L.id)||Z)&&O.push(L),O},[]),W=_.filter(O=>typeof O.deletable=="boolean"?O.deletable:!0),M=W.filter(O=>D.includes(O.id));if(F||M){const O=I2(F,W),L=[...M,...O],K=L.reduce((Z,q)=>(Z.includes(q.id)||Z.push(q.id),Z),[]);if((T||E)&&(T&&t.setState({edges:_.filter(Z=>!K.includes(Z.id))}),E&&(F.forEach(Z=>{j.delete(Z.id)}),t.setState({nodeInternals:new Map(j)}))),K.length>0&&(A==null||A(L),$&&$(K.map(Z=>({id:Z,type:"remove"})))),F.length>0&&(R==null||R(F),B)){const Z=F.map(q=>({id:q.id,type:"remove"}));B(Z)}}},[]),g=v.useCallback(x=>{const k=PD(x),j=k?null:t.getState().nodeInternals.get(x.id);return!k&&!j?[null,null,k]:[k?x:X1(j),j,k]},[]),w=v.useCallback((x,k=!0,j)=>{const[S,_,E]=g(x);return S?(j||t.getState().getNodes()).filter(T=>{if(!E&&(T.id===_.id||!T.positionAbsolute))return!1;const R=X1(T),A=Uv(R,S);return k&&A>0||A>=S.width*S.height}):[]},[]),b=v.useCallback((x,k,j=!0)=>{const[S]=g(x);if(!S)return!1;const _=Uv(S,k);return j&&_>0||_>=S.width*S.height},[]);return v.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:s,getEdge:i,setNodes:l,setEdges:u,addNodes:d,addEdges:f,toObject:h,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:b}),[e,n,r,s,i,l,u,d,f,h,m,w,b])}const w5={actInsideInputWithModifier:!1};var v5=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=vt(),{deleteElements:r}=si(),s=xl(e,w5),i=xl(t);v.useEffect(()=>{if(s){const{edges:l,getNodes:u}=n.getState(),d=u().filter(h=>h.selected),f=l.filter(h=>h.selected);r({nodes:d,edges:f}),n.setState({nodesSelectionActive:!1})}},[s]),v.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function x5(e){const t=vt();v.useEffect(()=>{let n;const r=()=>{var i,l;if(!e.current)return;const s=Hx(e.current);(s.height===0||s.width===0)&&((l=(i=t.getState()).onError)==null||l.call(i,"004",Qr.error004())),t.setState({width:s.width||500,height:s.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 Qx={position:"absolute",width:"100%",height:"100%",top:0,left:0},b5=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,du=e=>({x:e.x,y:e.y,zoom:e.k}),No=(e,t)=>e.target.closest(`.${t}`),oN=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),iN=e=>{const t=e.ctrlKey&&Hu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},k5=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),N5=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:d=_a.Free,zoomOnDoubleClick:f=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:g,translateExtent:w,minZoom:b,maxZoom:x,zoomActivationKeyCode:k,preventScrolling:j=!0,children:S,noWheelClassName:_,noPanClassName:E})=>{const T=v.useRef(),R=vt(),A=v.useRef(!1),B=v.useRef(!1),$=v.useRef(null),I=v.useRef({x:0,y:0,zoom:0}),{d3Zoom:D,d3Selection:F,d3ZoomHandler:W,userSelectionActive:M}=We(k5,Tt),O=xl(k),L=v.useRef(0),K=v.useRef(!1),Z=v.useRef();return x5($),v.useEffect(()=>{if($.current){const q=$.current.getBoundingClientRect(),H=b2().scaleExtent([b,x]).translateExtent(w),P=$n($.current).call(H),Y=Xr.translate(g.x,g.y).scale(Go(g.zoom,b,x)),G=[[0,0],[q.width,q.height]],z=H.constrain()(Y,G,w);H.transform(P,z),H.wheelDelta(iN),R.setState({d3Zoom:H,d3Selection:P,d3ZoomHandler:P.on("wheel.zoom"),transform:[z.x,z.y,z.k],domNode:$.current.closest(".react-flow")})}},[]),v.useEffect(()=>{F&&D&&(l&&!O&&!M?F.on("wheel.zoom",q=>{if(No(q,_))return!1;q.preventDefault(),q.stopImmediatePropagation();const H=F.property("__zoom").k||1;if(q.ctrlKey&&i){const ee=Qn(q),re=iN(q),oe=H*Math.pow(2,re);D.scaleTo(F,oe,ee,q);return}const P=q.deltaMode===1?20:1;let Y=d===_a.Vertical?0:q.deltaX*P,G=d===_a.Horizontal?0:q.deltaY*P;!Hu()&&q.shiftKey&&d!==_a.Vertical&&(Y=q.deltaY*P,G=0),D.translateBy(F,-(Y/H)*u,-(G/H)*u,{internal:!0});const z=du(F.property("__zoom")),{onViewportChangeStart:X,onViewportChange:V,onViewportChangeEnd:J}=R.getState();clearTimeout(Z.current),K.current||(K.current=!0,t==null||t(q,z),X==null||X(z)),K.current&&(e==null||e(q,z),V==null||V(z),Z.current=setTimeout(()=>{n==null||n(q,z),J==null||J(z),K.current=!1},150))},{passive:!1}):typeof W<"u"&&F.on("wheel.zoom",function(q,H){if(!j&&q.type==="wheel"&&!q.ctrlKey||No(q,_))return null;q.preventDefault(),W.call(this,q,H)},{passive:!1}))},[M,l,d,F,D,W,O,i,j,_,t,e,n]),v.useEffect(()=>{D&&D.on("start",q=>{var Y,G;if(!q.sourceEvent||q.sourceEvent.internal)return null;L.current=(Y=q.sourceEvent)==null?void 0:Y.button;const{onViewportChangeStart:H}=R.getState(),P=du(q.transform);A.current=!0,I.current=P,((G=q.sourceEvent)==null?void 0:G.type)==="mousedown"&&R.setState({paneDragging:!0}),H==null||H(P),t==null||t(q.sourceEvent,P)})},[D,t]),v.useEffect(()=>{D&&(M&&!A.current?D.on("zoom",null):M||D.on("zoom",q=>{var P;const{onViewportChange:H}=R.getState();if(R.setState({transform:[q.transform.x,q.transform.y,q.transform.k]}),B.current=!!(r&&oN(m,L.current??0)),(e||H)&&!((P=q.sourceEvent)!=null&&P.internal)){const Y=du(q.transform);H==null||H(Y),e==null||e(q.sourceEvent,Y)}}))},[M,D,e,m,r]),v.useEffect(()=>{D&&D.on("end",q=>{if(!q.sourceEvent||q.sourceEvent.internal)return null;const{onViewportChangeEnd:H}=R.getState();if(A.current=!1,R.setState({paneDragging:!1}),r&&oN(m,L.current??0)&&!B.current&&r(q.sourceEvent),B.current=!1,(n||H)&&b5(I.current,q.transform)){const P=du(q.transform);I.current=P,clearTimeout(T.current),T.current=setTimeout(()=>{H==null||H(P),n==null||n(q.sourceEvent,P)},l?150:0)}})},[D,l,m,n,r]),v.useEffect(()=>{D&&D.filter(q=>{const H=O||s,P=i&&q.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&q.button===1&&q.type==="mousedown"&&(No(q,"react-flow__node")||No(q,"react-flow__edge")))return!0;if(!m&&!H&&!l&&!f&&!i||M||!f&&q.type==="dblclick"||No(q,_)&&q.type==="wheel"||No(q,E)&&(q.type!=="wheel"||l&&q.type==="wheel"&&!O)||!i&&q.ctrlKey&&q.type==="wheel"||!H&&!l&&!P&&q.type==="wheel"||!m&&(q.type==="mousedown"||q.type==="touchstart")||Array.isArray(m)&&!m.includes(q.button)&&q.type==="mousedown")return!1;const Y=Array.isArray(m)&&m.includes(q.button)||!q.button||q.button<=1;return(!q.ctrlKey||q.type==="wheel")&&Y})},[M,D,s,i,l,f,m,h,O]),ce.createElement("div",{className:"react-flow__renderer",ref:$,style:Qx},S)},j5=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function S5(){const{userSelectionActive:e,userSelectionRect:t}=We(j5,Tt);return e&&t?ce.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 lN(e,t){const n=t.parentNode||t.parentId,r=e.find(s=>s.id===n);if(r){const s=t.position.x+t.width-r.width,i=t.position.y+t.height-r.height;if(s>0||i>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,s>0&&(r.style.width+=s),i>0&&(r.style.height+=i),t.position.x<0){const l=Math.abs(t.position.x);r.position.x=r.position.x-l,r.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);r.position.y=r.position.y-l,r.style.height+=l,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function _5(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,s)=>{const i=e.filter(u=>u.id===s.id);if(i.length===0)return r.push(s),r;const l={...s};for(const u of i)if(u)switch(u.type){case"select":{l.selected=u.selected;break}case"position":{typeof u.position<"u"&&(l.position=u.position),typeof u.positionAbsolute<"u"&&(l.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(l.dragging=u.dragging),l.expandParent&&lN(r,l);break}case"dimensions":{typeof u.dimensions<"u"&&(l.width=u.dimensions.width,l.height=u.dimensions.height),typeof u.updateStyle<"u"&&(l.style={...l.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(l.resizing=u.resizing),l.expandParent&&lN(r,l);break}case"remove":return r}return r.push(l),r},n)}function E5(e,t){return _5(e,t)}const Ps=(e,t)=>({id:e,type:"select",selected:t});function Oo(e,t){return e.reduce((n,r)=>{const s=t.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(Ps(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(Ps(r.id,!1))),n},[])}const Vf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},C5=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Z2=v.memo(({isSelecting:e,selectionMode:t=vl.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:h,children:m})=>{const g=v.useRef(null),w=vt(),b=v.useRef(0),x=v.useRef(0),k=v.useRef(),{userSelectionActive:j,elementsSelectable:S,dragging:_}=We(C5,Tt),E=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),b.current=0,x.current=0},T=W=>{i==null||i(W),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=W=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){W.preventDefault();return}l==null||l(W)},A=u?W=>u(W):void 0,B=W=>{const{resetSelectedElements:M,domNode:O}=w.getState();if(k.current=O==null?void 0:O.getBoundingClientRect(),!S||!e||W.button!==0||W.target!==g.current||!k.current)return;const{x:L,y:K}=Us(W,k.current);M(),w.setState({userSelectionRect:{width:0,height:0,startX:L,startY:K,x:L,y:K}}),r==null||r(W)},$=W=>{const{userSelectionRect:M,nodeInternals:O,edges:L,transform:K,onNodesChange:Z,onEdgesChange:q,nodeOrigin:H,getNodes:P}=w.getState();if(!e||!k.current||!M)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Y=Us(W,k.current),G=M.startX??0,z=M.startY??0,X={...M,x:Y.x<G?Y.x:G,y:Y.y<z?Y.y:z,width:Math.abs(Y.x-G),height:Math.abs(Y.y-z)},V=P(),J=$2(O,X,K,t===vl.Partial,!0,H),ee=I2(J,L).map(oe=>oe.id),re=J.map(oe=>oe.id);if(b.current!==re.length){b.current=re.length;const oe=Oo(V,re);oe.length&&(Z==null||Z(oe))}if(x.current!==ee.length){x.current=ee.length;const oe=Oo(L,ee);oe.length&&(q==null||q(oe))}w.setState({userSelectionRect:X})},I=W=>{if(W.button!==0)return;const{userSelectionRect:M}=w.getState();!j&&M&&W.target===g.current&&(T==null||T(W)),w.setState({nodesSelectionActive:b.current>0}),E(),s==null||s(W)},D=W=>{j&&(w.setState({nodesSelectionActive:b.current>0}),s==null||s(W)),E()},F=S&&(e||j);return ce.createElement("div",{className:Dt(["react-flow__pane",{dragging:_,selection:e}]),onClick:F?void 0:Vf(T,g),onContextMenu:Vf(R,g),onWheel:Vf(A,g),onMouseEnter:F?void 0:d,onMouseDown:F?B:void 0,onMouseMove:F?$:f,onMouseUp:F?I:void 0,onMouseLeave:F?D:h,ref:g,style:Qx},m,ce.createElement(S5,null))});Z2.displayName="Pane";function J2(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:J2(r,t):!1}function cN(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 T5(e,t,n,r){return Array.from(e.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!J2(s,e))&&(s.draggable||t&&typeof s.draggable>"u")).map(s=>{var i,l;return{id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=s.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((l=s.positionAbsolute)==null?void 0:l.y)??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}})}function R5(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Q2(e,t,n,r,s=[0,0],i){const l=R5(e,e.extent||r);let u=l;const d=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(d&&e.width&&e.height){const m=n.get(d),{x:g,y:w}=Ta(m,s).positionAbsolute;u=m&&In(g)&&In(w)&&In(m.width)&&In(m.height)?[[g+e.width*s[0],w+e.height*s[1]],[g+m.width-e.width+e.width*s[0],w+m.height-e.height+e.height*s[1]]]:u}else i==null||i("005",Qr.error005()),u=l;else if(e.extent&&d&&e.extent!=="parent"){const m=n.get(d),{x:g,y:w}=Ta(m,s).positionAbsolute;u=[[e.extent[0][0]+g,e.extent[0][1]+w],[e.extent[1][0]+g,e.extent[1][1]+w]]}let f={x:0,y:0};if(d){const m=n.get(d);f=Ta(m,s).positionAbsolute}const h=u&&u!=="parent"?Wx(t,u):t;return{position:{x:h.x-f.x,y:h.y-f.y},positionAbsolute:h}}function Gf({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[e?r.find(s=>s.id===e):r[0],r]}const uN=(e,t,n,r)=>{const s=t.querySelectorAll(e);if(!s||!s.length)return null;const i=Array.from(s),l=t.getBoundingClientRect(),u={x:l.width*r[0],y:l.height*r[1]};return i.map(d=>{const f=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(f.left-l.left-u.x)/n,y:(f.top-l.top-u.y)/n,...Hx(d)}})};function Ji(e,t,n){return n===void 0?n:r=>{const s=t().nodeInternals.get(e);s&&n(r,{...s})}}function Kv({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:l,nodeInternals:u,onError:d}=t.getState(),f=u.get(e);if(!f){d==null||d("012",Qr.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&l)&&(i({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var h;return(h=r==null?void 0:r.current)==null?void 0:h.blur()})):s([e])}function A5(){const e=vt();return v.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:i}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,d={x:(l-r[0])/r[2],y:(u-r[1])/r[2]};return{xSnapped:i?s[0]*Math.round(d.x/s[0]):d.x,ySnapped:i?s[1]*Math.round(d.y/s[1]):d.y,...d}},[])}function Kf(e){return(t,n,r)=>e==null?void 0:e(t,r)}function eA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,selectNodesOnDrag:l}){const u=vt(),[d,f]=v.useState(!1),h=v.useRef([]),m=v.useRef({x:null,y:null}),g=v.useRef(0),w=v.useRef(null),b=v.useRef({x:0,y:0}),x=v.useRef(null),k=v.useRef(!1),j=v.useRef(!1),S=v.useRef(!1),_=A5();return v.useEffect(()=>{if(e!=null&&e.current){const E=$n(e.current),T=({x:B,y:$})=>{const{nodeInternals:I,onNodeDrag:D,onSelectionDrag:F,updateNodePositions:W,nodeExtent:M,snapGrid:O,snapToGrid:L,nodeOrigin:K,onError:Z}=u.getState();m.current={x:B,y:$};let q=!1,H={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&M){const Y=xd(h.current,K);H=wl(Y)}if(h.current=h.current.map(Y=>{const G={x:B-Y.distance.x,y:$-Y.distance.y};L&&(G.x=O[0]*Math.round(G.x/O[0]),G.y=O[1]*Math.round(G.y/O[1]));const z=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];h.current.length>1&&M&&!Y.extent&&(z[0][0]=Y.positionAbsolute.x-H.x+M[0][0],z[1][0]=Y.positionAbsolute.x+(Y.width??0)-H.x2+M[1][0],z[0][1]=Y.positionAbsolute.y-H.y+M[0][1],z[1][1]=Y.positionAbsolute.y+(Y.height??0)-H.y2+M[1][1]);const X=Q2(Y,G,I,z,K,Z);return q=q||Y.position.x!==X.position.x||Y.position.y!==X.position.y,Y.position=X.position,Y.positionAbsolute=X.positionAbsolute,Y}),!q)return;W(h.current,!0,!0),f(!0);const P=s?D:Kf(F);if(P&&x.current){const[Y,G]=Gf({nodeId:s,dragItems:h.current,nodeInternals:I});P(x.current,Y,G)}},R=()=>{if(!w.current)return;const[B,$]=N2(b.current,w.current);if(B!==0||$!==0){const{transform:I,panBy:D}=u.getState();m.current.x=(m.current.x??0)-B/I[2],m.current.y=(m.current.y??0)-$/I[2],D({x:B,y:$})&&T(m.current)}g.current=requestAnimationFrame(R)},A=B=>{var K;const{nodeInternals:$,multiSelectionActive:I,nodesDraggable:D,unselectNodesAndEdges:F,onNodeDragStart:W,onSelectionDragStart:M}=u.getState();j.current=!0;const O=s?W:Kf(M);(!l||!i)&&!I&&s&&((K=$.get(s))!=null&&K.selected||F()),s&&i&&l&&Kv({id:s,store:u,nodeRef:e});const L=_(B);if(m.current=L,h.current=T5($,D,L,s),O&&h.current){const[Z,q]=Gf({nodeId:s,dragItems:h.current,nodeInternals:$});O(B.sourceEvent,Z,q)}};if(t)E.on(".drag",null);else{const B=B3().on("start",$=>{const{domNode:I,nodeDragThreshold:D}=u.getState();D===0&&A($),S.current=!1;const F=_($);m.current=F,w.current=(I==null?void 0:I.getBoundingClientRect())||null,b.current=Us($.sourceEvent,w.current)}).on("drag",$=>{var W,M;const I=_($),{autoPanOnNodeDrag:D,nodeDragThreshold:F}=u.getState();if($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1&&(S.current=!0),!S.current){if(!k.current&&j.current&&D&&(k.current=!0,R()),!j.current){const O=I.xSnapped-(((W=m==null?void 0:m.current)==null?void 0:W.x)??0),L=I.ySnapped-(((M=m==null?void 0:m.current)==null?void 0:M.y)??0);Math.sqrt(O*O+L*L)>F&&A($)}(m.current.x!==I.xSnapped||m.current.y!==I.ySnapped)&&h.current&&j.current&&(x.current=$.sourceEvent,b.current=Us($.sourceEvent,w.current),T(I))}}).on("end",$=>{if(!(!j.current||S.current)&&(f(!1),k.current=!1,j.current=!1,cancelAnimationFrame(g.current),h.current)){const{updateNodePositions:I,nodeInternals:D,onNodeDragStop:F,onSelectionDragStop:W}=u.getState(),M=s?F:Kf(W);if(I(h.current,!1,!1),M){const[O,L]=Gf({nodeId:s,dragItems:h.current,nodeInternals:D});M($.sourceEvent,O,L)}}}).filter($=>{const I=$.target;return!$.button&&(!n||!cN(I,`.${n}`,e))&&(!r||cN(I,r,e))});return E.call(B),()=>{E.on(".drag",null)}}}},[e,t,n,r,i,u,s,l,_]),d}function tA(){const e=vt();return v.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:i,getNodes:l,snapToGrid:u,snapGrid:d,onError:f,nodesDraggable:h}=e.getState(),m=l().filter(S=>S.selected&&(S.draggable||h&&typeof S.draggable>"u")),g=u?d[0]:5,w=u?d[1]:5,b=n.isShiftPressed?4:1,x=n.x*g*b,k=n.y*w*b,j=m.map(S=>{if(S.positionAbsolute){const _={x:S.positionAbsolute.x+x,y:S.positionAbsolute.y+k};u&&(_.x=d[0]*Math.round(_.x/d[0]),_.y=d[1]*Math.round(_.y/d[1]));const{positionAbsolute:E,position:T}=Q2(S,_,r,s,void 0,f);S.position=T,S.positionAbsolute=E}return S});i(j,!0,!1)},[])}const Bo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Qi=e=>{const t=({id:n,type:r,data:s,xPos:i,yPos:l,xPosOrigin:u,yPosOrigin:d,selected:f,onClick:h,onMouseEnter:m,onMouseMove:g,onMouseLeave:w,onContextMenu:b,onDoubleClick:x,style:k,className:j,isDraggable:S,isSelectable:_,isConnectable:E,isFocusable:T,selectNodesOnDrag:R,sourcePosition:A,targetPosition:B,hidden:$,resizeObserver:I,dragHandle:D,zIndex:F,isParent:W,noDragClassName:M,noPanClassName:O,initialized:L,disableKeyboardA11y:K,ariaLabel:Z,rfId:q,hasHandleBounds:H})=>{const P=vt(),Y=v.useRef(null),G=v.useRef(null),z=v.useRef(A),X=v.useRef(B),V=v.useRef(r),J=_||S||h||m||g||w,ee=tA(),re=Ji(n,P.getState,m),oe=Ji(n,P.getState,g),fe=Ji(n,P.getState,w),Ne=Ji(n,P.getState,b),we=Ji(n,P.getState,x),ye=xe=>{const{nodeDragThreshold:ue}=P.getState();if(_&&(!R||!S||ue>0)&&Kv({id:n,store:P,nodeRef:Y}),h){const se=P.getState().nodeInternals.get(n);se&&h(xe,{...se})}},ve=xe=>{if(!zv(xe)&&!K)if(E2.includes(xe.key)&&_){const ue=xe.key==="Escape";Kv({id:n,store:P,unselect:ue,nodeRef:Y})}else S&&f&&Object.prototype.hasOwnProperty.call(Bo,xe.key)&&(P.setState({ariaLiveMessage:`Moved selected node ${xe.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~l}`}),ee({x:Bo[xe.key].x,y:Bo[xe.key].y,isShiftPressed:xe.shiftKey}))};v.useEffect(()=>()=>{G.current&&(I==null||I.unobserve(G.current),G.current=null)},[]),v.useEffect(()=>{if(Y.current&&!$){const xe=Y.current;(!L||!H||G.current!==xe)&&(G.current&&(I==null||I.unobserve(G.current)),I==null||I.observe(xe),G.current=xe)}},[$,L,H]),v.useEffect(()=>{const xe=V.current!==r,ue=z.current!==A,se=X.current!==B;Y.current&&(xe||ue||se)&&(xe&&(V.current=r),ue&&(z.current=A),se&&(X.current=B),P.getState().updateNodeDimensions([{id:n,nodeElement:Y.current,forceUpdate:!0}]))},[n,r,A,B]);const Ie=eA({nodeRef:Y,disabled:$||!S,noDragClassName:M,handleSelector:D,nodeId:n,isSelectable:_,selectNodesOnDrag:R});return $?null:ce.createElement("div",{className:Dt(["react-flow__node",`react-flow__node-${r}`,{[O]:S},j,{selected:f,selectable:_,parent:W,dragging:Ie}]),ref:Y,style:{zIndex:F,transform:`translate(${u}px,${d}px)`,pointerEvents:J?"all":"none",visibility:L?"visible":"hidden",...k},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:re,onMouseMove:oe,onMouseLeave:fe,onContextMenu:Ne,onClick:ye,onDoubleClick:we,onKeyDown:T?ve:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":K?void 0:`${V2}-${q}`,"aria-label":Z},ce.createElement(HD,{value:n},ce.createElement(e,{id:n,data:s,type:r,xPos:i,yPos:l,selected:f,isConnectable:E,sourcePosition:A,targetPosition:B,dragging:Ie,dragHandle:D,zIndex:F})))};return t.displayName="NodeWrapper",v.memo(t)};const M5=e=>{const t=e.getNodes().filter(n=>n.selected);return{...xd(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function $5({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=vt(),{width:s,height:i,x:l,y:u,transformString:d,userSelectionActive:f}=We(M5,Tt),h=tA(),m=v.useRef(null);if(v.useEffect(()=>{var b;n||(b=m.current)==null||b.focus({preventScroll:!0})},[n]),eA({nodeRef:m}),f||!s||!i)return null;const g=e?b=>{const x=r.getState().getNodes().filter(k=>k.selected);e(b,x)}:void 0,w=b=>{Object.prototype.hasOwnProperty.call(Bo,b.key)&&h({x:Bo[b.key].x,y:Bo[b.key].y,isShiftPressed:b.shiftKey})};return ce.createElement("div",{className:Dt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:d}},ce.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:s,height:i,top:u,left:l}}))}var I5=v.memo($5);const O5=e=>e.nodesSelectionActive,nA=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:l,deleteKeyCode:u,onMove:d,onMoveStart:f,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:g,selectionMode:w,onSelectionStart:b,onSelectionEnd:x,multiSelectionKeyCode:k,panActivationKeyCode:j,zoomActivationKeyCode:S,elementsSelectable:_,zoomOnScroll:E,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:A,panOnScrollMode:B,zoomOnDoubleClick:$,panOnDrag:I,defaultViewport:D,translateExtent:F,minZoom:W,maxZoom:M,preventScrolling:O,onSelectionContextMenu:L,noWheelClassName:K,noPanClassName:Z,disableKeyboardA11y:q})=>{const H=We(O5),P=xl(m),Y=xl(j),G=Y||I,z=Y||R,X=P||g&&G!==!0;return v5({deleteKeyCode:u,multiSelectionKeyCode:k}),ce.createElement(N5,{onMove:d,onMoveStart:f,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:_,zoomOnScroll:E,zoomOnPinch:T,panOnScroll:z,panOnScrollSpeed:A,panOnScrollMode:B,zoomOnDoubleClick:$,panOnDrag:!P&&G,defaultViewport:D,translateExtent:F,minZoom:W,maxZoom:M,zoomActivationKeyCode:S,preventScrolling:O,noWheelClassName:K,noPanClassName:Z},ce.createElement(Z2,{onSelectionStart:b,onSelectionEnd:x,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:G,isSelecting:!!X,selectionMode:w},e,H&&ce.createElement(I5,{onSelectionContextMenu:L,noPanClassName:Z,disableKeyboardA11y:q})))};nA.displayName="FlowRenderer";var L5=v.memo(nA);function P5(e){return We(v.useCallback(n=>e?$2(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function D5(e){const t={input:Qi(e.input||U2),default:Qi(e.default||Gv),output:Qi(e.output||H2),group:Qi(e.group||Jx)},n={},r=Object.keys(e).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=Qi(e[i]||Gv),s),n);return{...t,...r}}const F5=({x:e,y:t,width:n,height:r,origin:s})=>!n||!r?{x:e,y:t}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:e,y:t}:{x:e-n*s[0],y:t-r*s[1]},q5=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:s,updateNodeDimensions:i,onError:l}=We(q5,Tt),u=P5(e.onlyRenderVisibleElements),d=v.useRef(),f=v.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const g=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));i(g)});return d.current=h,h},[]);return v.useEffect(()=>()=>{var h;(h=d==null?void 0:d.current)==null||h.disconnect()},[]),ce.createElement("div",{className:"react-flow__nodes",style:Qx},u.map(h=>{var T,R,A;let m=h.type||"default";e.nodeTypes[m]||(l==null||l("003",Qr.error003(m)),m="default");const g=e.nodeTypes[m]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),b=!!(h.selectable||s&&typeof h.selectable>"u"),x=!!(h.connectable||n&&typeof h.connectable>"u"),k=!!(h.focusable||r&&typeof h.focusable>"u"),j=e.nodeExtent?Wx(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,S=(j==null?void 0:j.x)??0,_=(j==null?void 0:j.y)??0,E=F5({x:S,y:_,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return ce.createElement(g,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||Ce.Bottom,targetPosition:h.targetPosition||Ce.Top,hidden:h.hidden,xPos:S,yPos:_,xPosOrigin:E.x,yPosOrigin:E.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:b,isConnectable:x,isFocusable:k,resizeObserver:f,dragHandle:h.dragHandle,zIndex:((T=h[ht])==null?void 0:T.z)??0,isParent:!!((R=h[ht])!=null&&R.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((A=h[ht])!=null&&A.handleBounds)})}))};rA.displayName="NodeRenderer";var B5=v.memo(rA);const U5=(e,t,n)=>n===Ce.Left?e-t:n===Ce.Right?e+t:e,z5=(e,t,n)=>n===Ce.Top?e-t:n===Ce.Bottom?e+t:e,dN="react-flow__edgeupdater",hN=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:l,type:u})=>ce.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:l,className:Dt([dN,`${dN}-${u}`]),cx:U5(t,r,e),cy:z5(n,r,e),r,stroke:"transparent",fill:"transparent"}),H5=()=>!0;var jo=e=>{const t=({id:n,className:r,type:s,data:i,onClick:l,onEdgeDoubleClick:u,selected:d,animated:f,label:h,labelStyle:m,labelShowBg:g,labelBgStyle:w,labelBgPadding:b,labelBgBorderRadius:x,style:k,source:j,target:S,sourceX:_,sourceY:E,targetX:T,targetY:R,sourcePosition:A,targetPosition:B,elementsSelectable:$,hidden:I,sourceHandleId:D,targetHandleId:F,onContextMenu:W,onMouseEnter:M,onMouseMove:O,onMouseLeave:L,reconnectRadius:K,onReconnect:Z,onReconnectStart:q,onReconnectEnd:H,markerEnd:P,markerStart:Y,rfId:G,ariaLabel:z,isFocusable:X,isReconnectable:V,pathOptions:J,interactionWidth:ee,disableKeyboardA11y:re})=>{const oe=v.useRef(null),[fe,Ne]=v.useState(!1),[we,ye]=v.useState(!1),ve=vt(),Ie=v.useMemo(()=>`url('#${Wv(Y,G)}')`,[Y,G]),xe=v.useMemo(()=>`url('#${Wv(P,G)}')`,[P,G]);if(I)return null;const ue=Pe=>{var kt;const{edges:at,addSelectedEdges:Qe,unselectNodesAndEdges:ot,multiSelectionActive:Ft}=ve.getState(),bt=at.find(qt=>qt.id===n);bt&&($&&(ve.setState({nodesSelectionActive:!1}),bt.selected&&Ft?(ot({nodes:[],edges:[bt]}),(kt=oe.current)==null||kt.blur()):Qe([n])),l&&l(Pe,bt))},se=Zi(n,ve.getState,u),be=Zi(n,ve.getState,W),Te=Zi(n,ve.getState,M),Le=Zi(n,ve.getState,O),$e=Zi(n,ve.getState,L),Oe=(Pe,at)=>{if(Pe.button!==0)return;const{edges:Qe,isValidConnection:ot}=ve.getState(),Ft=at?S:j,bt=(at?F:D)||null,kt=at?"target":"source",qt=ot||H5,bn=at,Gt=Qe.find(Kt=>Kt.id===n);ye(!0),q==null||q(Pe,Gt,kt);const Bt=Kt=>{ye(!1),H==null||H(Kt,Gt,kt)};D2({event:Pe,handleId:bt,nodeId:Ft,onConnect:Kt=>Z==null?void 0:Z(Gt,Kt),isTarget:bn,getState:ve.getState,setState:ve.setState,isValidConnection:qt,edgeUpdaterType:kt,onReconnectEnd:Bt})},Xe=Pe=>Oe(Pe,!0),Ge=Pe=>Oe(Pe,!1),Ze=()=>Ne(!0),Ve=()=>Ne(!1),Ot=!$&&!l,mt=Pe=>{var at;if(!re&&E2.includes(Pe.key)&&$){const{unselectNodesAndEdges:Qe,addSelectedEdges:ot,edges:Ft}=ve.getState();Pe.key==="Escape"?((at=oe.current)==null||at.blur(),Qe({edges:[Ft.find(kt=>kt.id===n)]})):ot([n])}};return ce.createElement("g",{className:Dt(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:d,animated:f,inactive:Ot,updating:fe}]),onClick:ue,onDoubleClick:se,onContextMenu:be,onMouseEnter:Te,onMouseMove:Le,onMouseLeave:$e,onKeyDown:X?mt:void 0,tabIndex:X?0:void 0,role:X?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":z===null?void 0:z||`Edge from ${j} to ${S}`,"aria-describedby":X?`${G2}-${G}`:void 0,ref:oe},!we&&ce.createElement(e,{id:n,source:j,target:S,selected:d,animated:f,label:h,labelStyle:m,labelShowBg:g,labelBgStyle:w,labelBgPadding:b,labelBgBorderRadius:x,data:i,style:k,sourceX:_,sourceY:E,targetX:T,targetY:R,sourcePosition:A,targetPosition:B,sourceHandleId:D,targetHandleId:F,markerStart:Ie,markerEnd:xe,pathOptions:J,interactionWidth:ee}),V&&ce.createElement(ce.Fragment,null,(V==="source"||V===!0)&&ce.createElement(hN,{position:A,centerX:_,centerY:E,radius:K,onMouseDown:Xe,onMouseEnter:Ze,onMouseOut:Ve,type:"source"}),(V==="target"||V===!0)&&ce.createElement(hN,{position:B,centerX:T,centerY:R,radius:K,onMouseDown:Ge,onMouseEnter:Ze,onMouseOut:Ve,type:"target"})))};return t.displayName="EdgeWrapper",v.memo(t)};function W5(e){const t={default:jo(e.default||Vu),straight:jo(e.bezier||Kx),step:jo(e.step||Gx),smoothstep:jo(e.step||vd),simplebezier:jo(e.simplebezier||Vx)},n={},r=Object.keys(e).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=jo(e[i]||Vu),s),n);return{...t,...r}}function fN(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,s=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case Ce.Top:return{x:r+i/2,y:s};case Ce.Right:return{x:r+i,y:s+l/2};case Ce.Bottom:return{x:r+i/2,y:s+l};case Ce.Left:return{x:r,y:s+l/2}}}function pN(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const V5=(e,t,n,r,s,i)=>{const l=fN(n,e,t),u=fN(i,r,s);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function G5({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:i,width:l,height:u,transform:d}){const f={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+s),y2:Math.max(e.y+r,t.y+i)};f.x===f.x2&&(f.x2+=1),f.y===f.y2&&(f.y2+=1);const h=wl({x:(0-d[0])/d[2],y:(0-d[1])/d[2],width:l/d[2],height:u/d[2]}),m=Math.max(0,Math.min(h.x2,f.x2)-Math.max(h.x,f.x)),g=Math.max(0,Math.min(h.y2,f.y2)-Math.max(h.y,f.y));return Math.ceil(m*g)>0}function mN(e){var r,s,i,l,u;const t=((r=e==null?void 0:e[ht])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.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 K5=[{level:0,isMaxLevel:!0,edges:[]}];function Y5(e,t,n=!1){let r=-1;const s=e.reduce((l,u)=>{var h,m;const d=In(u.zIndex);let f=d?u.zIndex:0;if(n){const g=t.get(u.target),w=t.get(u.source),b=u.selected||(g==null?void 0:g.selected)||(w==null?void 0:w.selected),x=Math.max(((h=w==null?void 0:w[ht])==null?void 0:h.z)||0,((m=g==null?void 0:g[ht])==null?void 0:m.z)||0,1e3);f=(d?u.zIndex:0)+(b?x:0)}return l[f]?l[f].push(u):l[f]=[u],r=f>r?f:r,l},{}),i=Object.entries(s).map(([l,u])=>{const d=+l;return{edges:u,level:d,isMaxLevel:d===r}});return i.length===0?K5:i}function X5(e,t,n){const r=We(v.useCallback(s=>e?s.edges.filter(i=>{const l=t.get(i.source),u=t.get(i.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&G5({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:u.width,targetHeight:u.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[e,t]));return Y5(r,t,n)}const Z5=({color:e="none",strokeWidth:t=1})=>ce.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),J5=({color:e="none",strokeWidth:t=1})=>ce.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),gN={[Wu.Arrow]:Z5,[Wu.ArrowClosed]:J5};function Q5(e){const t=vt();return v.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(gN,e)?gN[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",Qr.error009(e)),null)},[e])}const eF=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const d=Q5(t);return d?ce.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:u,refX:"0",refY:"0"},ce.createElement(d,{color:n,strokeWidth:l})):null},tF=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((s,i)=>([i.markerStart,i.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const u=Wv(l,t);r.includes(u)||(s.push({id:u,color:l.color||e,...l}),r.push(u))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},sA=({defaultColor:e,rfId:t})=>{const n=We(v.useCallback(tF({defaultColor:e,rfId:t}),[e,t]),(r,s)=>!(r.length!==s.length||r.some((i,l)=>i.id!==s[l].id)));return ce.createElement("defs",null,n.map(r=>ce.createElement(eF,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};sA.displayName="MarkerDefinitions";var nF=v.memo(sA);const rF=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),aA=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:w,onReconnectEnd:b,reconnectRadius:x,children:k,disableKeyboardA11y:j})=>{const{edgesFocusable:S,edgesUpdatable:_,elementsSelectable:E,width:T,height:R,connectionMode:A,nodeInternals:B,onError:$}=We(rF,Tt),I=X5(t,B,n);return T?ce.createElement(ce.Fragment,null,I.map(({level:D,edges:F,isMaxLevel:W})=>ce.createElement("svg",{key:D,style:{zIndex:D},width:T,height:R,className:"react-flow__edges react-flow__container"},W&&ce.createElement(nF,{defaultColor:e,rfId:r}),ce.createElement("g",null,F.map(M=>{const[O,L,K]=mN(B.get(M.source)),[Z,q,H]=mN(B.get(M.target));if(!K||!H)return null;let P=M.type||"default";s[P]||($==null||$("011",Qr.error011(P)),P="default");const Y=s[P]||s.default,G=A===Ia.Strict?q.target:(q.target??[]).concat(q.source??[]),z=pN(L.source,M.sourceHandle),X=pN(G,M.targetHandle),V=(z==null?void 0:z.position)||Ce.Bottom,J=(X==null?void 0:X.position)||Ce.Top,ee=!!(M.focusable||S&&typeof M.focusable>"u"),re=M.reconnectable||M.updatable,oe=typeof g<"u"&&(re||_&&typeof re>"u");if(!z||!X)return $==null||$("008",Qr.error008(z,M)),null;const{sourceX:fe,sourceY:Ne,targetX:we,targetY:ye}=V5(O,z,V,Z,X,J);return ce.createElement(Y,{key:M.id,id:M.id,className:Dt([M.className,i]),type:P,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:fe,sourceY:Ne,targetX:we,targetY:ye,sourcePosition:V,targetPosition:J,elementsSelectable:E,onContextMenu:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,onClick:h,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:w,onReconnectEnd:b,reconnectRadius:x,rfId:r,ariaLabel:M.ariaLabel,isFocusable:ee,isReconnectable:oe,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:j})})))),k):null};aA.displayName="EdgeRenderer";var sF=v.memo(aA);const aF=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function oF({children:e}){const t=We(aF);return ce.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function iF(e){const t=si(),n=v.useRef(!1);v.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const lF={[Ce.Left]:Ce.Right,[Ce.Right]:Ce.Left,[Ce.Top]:Ce.Bottom,[Ce.Bottom]:Ce.Top},oA=({nodeId:e,handleType:t,style:n,type:r=Ds.Bezier,CustomComponent:s,connectionStatus:i})=>{var R,A,B;const{fromNode:l,handleId:u,toX:d,toY:f,connectionMode:h}=We(v.useCallback($=>({fromNode:$.nodeInternals.get(e),handleId:$.connectionHandleId,toX:($.connectionPosition.x-$.transform[0])/$.transform[2],toY:($.connectionPosition.y-$.transform[1])/$.transform[2],connectionMode:$.connectionMode}),[e]),Tt),m=(R=l==null?void 0:l[ht])==null?void 0:R.handleBounds;let g=m==null?void 0:m[t];if(h===Ia.Loose&&(g=g||(m==null?void 0:m[t==="source"?"target":"source"])),!l||!g)return null;const w=u?g.find($=>$.id===u):g[0],b=w?w.x+w.width/2:(l.width??0)/2,x=w?w.y+w.height/2:l.height??0,k=(((A=l.positionAbsolute)==null?void 0:A.x)??0)+b,j=(((B=l.positionAbsolute)==null?void 0:B.y)??0)+x,S=w==null?void 0:w.position,_=S?lF[S]:null;if(!S||!_)return null;if(s)return ce.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:k,fromY:j,toX:d,toY:f,fromPosition:S,toPosition:_,connectionStatus:i});let E="";const T={sourceX:k,sourceY:j,sourcePosition:S,targetX:d,targetY:f,targetPosition:_};return r===Ds.Bezier?[E]=Yx(T):r===Ds.Step?[E]=Hv({...T,borderRadius:0}):r===Ds.SmoothStep?[E]=Hv(T):r===Ds.SimpleBezier?[E]=A2(T):E=`M${k},${j} ${d},${f}`,ce.createElement("path",{d:E,fill:"none",className:"react-flow__connection-path",style:n})};oA.displayName="ConnectionLine";const cF=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function uF({containerStyle:e,style:t,type:n,component:r}){const{nodeId:s,handleType:i,nodesConnectable:l,width:u,height:d,connectionStatus:f}=We(cF,Tt);return!(s&&i&&u&&l)?null:ce.createElement("svg",{style:e,width:u,height:d,className:"react-flow__edges react-flow__connectionline react-flow__container"},ce.createElement("g",{className:Dt(["react-flow__connection",f])},ce.createElement(oA,{nodeId:s,handleType:i,style:t,type:n,CustomComponent:r,connectionStatus:f})))}function yN(e,t){return v.useRef(null),vt(),v.useMemo(()=>t(e),[e])}const iA=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:i,onNodeClick:l,onEdgeClick:u,onNodeDoubleClick:d,onEdgeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:w,onSelectionContextMenu:b,onSelectionStart:x,onSelectionEnd:k,connectionLineType:j,connectionLineStyle:S,connectionLineComponent:_,connectionLineContainerStyle:E,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,multiSelectionKeyCode:B,panActivationKeyCode:$,zoomActivationKeyCode:I,deleteKeyCode:D,onlyRenderVisibleElements:F,elementsSelectable:W,selectNodesOnDrag:M,defaultViewport:O,translateExtent:L,minZoom:K,maxZoom:Z,preventScrolling:q,defaultMarkerColor:H,zoomOnScroll:P,zoomOnPinch:Y,panOnScroll:G,panOnScrollSpeed:z,panOnScrollMode:X,zoomOnDoubleClick:V,panOnDrag:J,onPaneClick:ee,onPaneMouseEnter:re,onPaneMouseMove:oe,onPaneMouseLeave:fe,onPaneScroll:Ne,onPaneContextMenu:we,onEdgeContextMenu:ye,onEdgeMouseEnter:ve,onEdgeMouseMove:Ie,onEdgeMouseLeave:xe,onReconnect:ue,onReconnectStart:se,onReconnectEnd:be,reconnectRadius:Te,noDragClassName:Le,noWheelClassName:$e,noPanClassName:Oe,elevateEdgesOnSelect:Xe,disableKeyboardA11y:Ge,nodeOrigin:Ze,nodeExtent:Ve,rfId:Ot})=>{const mt=yN(e,D5),Pe=yN(t,W5);return iF(i),ce.createElement(L5,{onPaneClick:ee,onPaneMouseEnter:re,onPaneMouseMove:oe,onPaneMouseLeave:fe,onPaneContextMenu:we,onPaneScroll:Ne,deleteKeyCode:D,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,onSelectionStart:x,onSelectionEnd:k,multiSelectionKeyCode:B,panActivationKeyCode:$,zoomActivationKeyCode:I,elementsSelectable:W,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:P,zoomOnPinch:Y,zoomOnDoubleClick:V,panOnScroll:G,panOnScrollSpeed:z,panOnScrollMode:X,panOnDrag:J,defaultViewport:O,translateExtent:L,minZoom:K,maxZoom:Z,onSelectionContextMenu:b,preventScrolling:q,noDragClassName:Le,noWheelClassName:$e,noPanClassName:Oe,disableKeyboardA11y:Ge},ce.createElement(oF,null,ce.createElement(sF,{edgeTypes:Pe,onEdgeClick:u,onEdgeDoubleClick:f,onlyRenderVisibleElements:F,onEdgeContextMenu:ye,onEdgeMouseEnter:ve,onEdgeMouseMove:Ie,onEdgeMouseLeave:xe,onReconnect:ue,onReconnectStart:se,onReconnectEnd:be,reconnectRadius:Te,defaultMarkerColor:H,noPanClassName:Oe,elevateEdgesOnSelect:!!Xe,disableKeyboardA11y:Ge,rfId:Ot},ce.createElement(uF,{style:S,type:j,component:_,containerStyle:E})),ce.createElement("div",{className:"react-flow__edgelabel-renderer"}),ce.createElement(B5,{nodeTypes:mt,onNodeClick:l,onNodeDoubleClick:d,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:w,selectNodesOnDrag:M,onlyRenderVisibleElements:F,noPanClassName:Oe,noDragClassName:Le,disableKeyboardA11y:Ge,nodeOrigin:Ze,nodeExtent:Ve,rfId:Ot})))};iA.displayName="GraphView";var dF=v.memo(iA);const Yv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],$s={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:Yv,nodeExtent:Yv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ia.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:DD,isValidConnection:void 0},hF=()=>QL((e,t)=>({...$s,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:i}=t();e({nodeInternals:Wf(n,r,s,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",i=typeof r<"u",l=s?Wf(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:i?r:[],hasDefaultNodes:s,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:i,fitViewOnInitDone:l,fitViewOnInitOptions:u,domNode:d,nodeOrigin:f}=t(),h=d==null?void 0:d.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{m22:g}=new window.DOMMatrixReadOnly(m.transform),w=n.reduce((x,k)=>{const j=s.get(k.id);if(j!=null&&j.hidden)s.set(j.id,{...j,[ht]:{...j[ht],handleBounds:void 0}});else if(j){const S=Hx(k.nodeElement);!!(S.width&&S.height&&(j.width!==S.width||j.height!==S.height||k.forceUpdate))&&(s.set(j.id,{...j,[ht]:{...j[ht],handleBounds:{source:uN(".source",k.nodeElement,g,f),target:uN(".target",k.nodeElement,g,f)}},...S}),x.push({id:j.id,type:"dimensions",dimensions:S}))}return x},[]);Y2(s,f);const b=l||i&&!l&&X2(t,{initial:!0,...u});e({nodeInternals:new Map(s),fitViewOnInitDone:b}),(w==null?void 0:w.length)>0&&(r==null||r(w))},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:i}=t(),l=n.map(u=>{const d={id:u.id,type:"position",dragging:s};return r&&(d.positionAbsolute=u.positionAbsolute,d.position=u.position),d});i(l)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:l,getNodes:u,elevateNodesOnSelect:d}=t();if(n!=null&&n.length){if(i){const f=E5(n,u()),h=Wf(f,s,l,d);e({nodeInternals:h})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=t();let l,u=null;r?l=n.map(d=>Ps(d,!0)):(l=Oo(i(),n),u=Oo(s,[])),uu({changedNodes:l,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=t();let l,u=null;r?l=n.map(d=>Ps(d,!0)):(l=Oo(s,n),u=Oo(i(),[])),uu({changedNodes:u,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:i}=t(),l=n||i(),u=r||s,d=l.map(h=>(h.selected=!1,Ps(h.id,!1))),f=u.map(h=>Ps(h.id,!1));uu({changedNodes:d,changedEdges:f,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=t();r==null||r.scaleExtent([n,s]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=t();r==null||r.scaleExtent([s,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(),i=r().filter(u=>u.selected).map(u=>Ps(u.id,!1)),l=n.filter(u=>u.selected).map(u=>Ps(u.id,!1));uu({changedNodes:i,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(s=>{s.positionAbsolute=Wx(s.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:i,d3Zoom:l,d3Selection:u,translateExtent:d}=t();if(!l||!u||!n.x&&!n.y)return!1;const f=Xr.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),h=[[0,0],[s,i]],m=l==null?void 0:l.constrain()(f,h,d);return l.transform(u,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>e({connectionNodeId:$s.connectionNodeId,connectionHandleId:$s.connectionHandleId,connectionHandleType:$s.connectionHandleType,connectionStatus:$s.connectionStatus,connectionStartHandle:$s.connectionStartHandle,connectionEndHandle:$s.connectionEndHandle}),reset:()=>e({...$s})}),Object.is),e0=({children:e})=>{const t=v.useRef(null);return t.current||(t.current=hF()),ce.createElement(AD,{value:t.current},e)};e0.displayName="ReactFlowProvider";const lA=({children:e})=>v.useContext(wd)?ce.createElement(ce.Fragment,null,e):ce.createElement(e0,null,e);lA.displayName="ReactFlowWrapper";const fF={input:U2,default:Gv,output:H2,group:Jx},pF={default:Vu,straight:Kx,step:Gx,smoothstep:vd,simplebezier:Vx},mF=[0,0],gF=[15,15],yF={x:0,y:0,zoom:1},wF={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},cA=v.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i=fF,edgeTypes:l=pF,onNodeClick:u,onEdgeClick:d,onInit:f,onMove:h,onMoveStart:m,onMoveEnd:g,onConnect:w,onConnectStart:b,onConnectEnd:x,onClickConnectStart:k,onClickConnectEnd:j,onNodeMouseEnter:S,onNodeMouseMove:_,onNodeMouseLeave:E,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:A,onNodeDrag:B,onNodeDragStop:$,onNodesDelete:I,onEdgesDelete:D,onSelectionChange:F,onSelectionDragStart:W,onSelectionDrag:M,onSelectionDragStop:O,onSelectionContextMenu:L,onSelectionStart:K,onSelectionEnd:Z,connectionMode:q=Ia.Strict,connectionLineType:H=Ds.Bezier,connectionLineStyle:P,connectionLineComponent:Y,connectionLineContainerStyle:G,deleteKeyCode:z="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:V=!1,selectionMode:J=vl.Full,panActivationKeyCode:ee="Space",multiSelectionKeyCode:re=Hu()?"Meta":"Control",zoomActivationKeyCode:oe=Hu()?"Meta":"Control",snapToGrid:fe=!1,snapGrid:Ne=gF,onlyRenderVisibleElements:we=!1,selectNodesOnDrag:ye=!0,nodesDraggable:ve,nodesConnectable:Ie,nodesFocusable:xe,nodeOrigin:ue=mF,edgesFocusable:se,edgesUpdatable:be,elementsSelectable:Te,defaultViewport:Le=yF,minZoom:$e=.5,maxZoom:Oe=2,translateExtent:Xe=Yv,preventScrolling:Ge=!0,nodeExtent:Ze,defaultMarkerColor:Ve="#b1b1b7",zoomOnScroll:Ot=!0,zoomOnPinch:mt=!0,panOnScroll:Pe=!1,panOnScrollSpeed:at=.5,panOnScrollMode:Qe=_a.Free,zoomOnDoubleClick:ot=!0,panOnDrag:Ft=!0,onPaneClick:bt,onPaneMouseEnter:kt,onPaneMouseMove:qt,onPaneMouseLeave:bn,onPaneScroll:Gt,onPaneContextMenu:Bt,children:dn,onEdgeContextMenu:Kt,onEdgeDoubleClick:rs,onEdgeMouseEnter:$r,onEdgeMouseMove:ss,onEdgeMouseLeave:ur,onEdgeUpdate:qn,onEdgeUpdateStart:as,onEdgeUpdateEnd:kn,onReconnect:dr,onReconnectStart:hn,onReconnectEnd:os,reconnectRadius:Nn=10,edgeUpdaterRadius:gt=10,onNodesChange:Bn,onEdgesChange:pe,noDragClassName:Be="nodrag",noWheelClassName:Je="nowheel",noPanClassName:fn="nopan",fitView:Ut=!1,fitViewOptions:hr,connectOnClick:Ys=!0,attributionPosition:is,proOptions:Un,defaultEdgeOptions:Wa,elevateNodesOnSelect:Va=!0,elevateEdgesOnSelect:fr=!1,disableKeyboardA11y:Ga=!1,autoPanOnConnect:Ka=!0,autoPanOnNodeDrag:Ke=!0,connectionRadius:ls=20,isValidConnection:pr,onError:Ya,style:cs,id:Xs,nodeDragThreshold:Zs,...us},Yt)=>{const ds=Xs||"1";return ce.createElement("div",{...us,style:{...cs,...wF},ref:Yt,className:Dt(["react-flow",s]),"data-testid":"rf__wrapper",id:Xs},ce.createElement(lA,null,ce.createElement(dF,{onInit:f,onMove:h,onMoveStart:m,onMoveEnd:g,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:S,onNodeMouseMove:_,onNodeMouseLeave:E,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:i,edgeTypes:l,connectionLineType:H,connectionLineStyle:P,connectionLineComponent:Y,connectionLineContainerStyle:G,selectionKeyCode:X,selectionOnDrag:V,selectionMode:J,deleteKeyCode:z,multiSelectionKeyCode:re,panActivationKeyCode:ee,zoomActivationKeyCode:oe,onlyRenderVisibleElements:we,selectNodesOnDrag:ye,defaultViewport:Le,translateExtent:Xe,minZoom:$e,maxZoom:Oe,preventScrolling:Ge,zoomOnScroll:Ot,zoomOnPinch:mt,zoomOnDoubleClick:ot,panOnScroll:Pe,panOnScrollSpeed:at,panOnScrollMode:Qe,panOnDrag:Ft,onPaneClick:bt,onPaneMouseEnter:kt,onPaneMouseMove:qt,onPaneMouseLeave:bn,onPaneScroll:Gt,onPaneContextMenu:Bt,onSelectionContextMenu:L,onSelectionStart:K,onSelectionEnd:Z,onEdgeContextMenu:Kt,onEdgeDoubleClick:rs,onEdgeMouseEnter:$r,onEdgeMouseMove:ss,onEdgeMouseLeave:ur,onReconnect:dr??qn,onReconnectStart:hn??as,onReconnectEnd:os??kn,reconnectRadius:Nn??gt,defaultMarkerColor:Ve,noDragClassName:Be,noWheelClassName:Je,noPanClassName:fn,elevateEdgesOnSelect:fr,rfId:ds,disableKeyboardA11y:Ga,nodeOrigin:ue,nodeExtent:Ze}),ce.createElement(i5,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:w,onConnectStart:b,onConnectEnd:x,onClickConnectStart:k,onClickConnectEnd:j,nodesDraggable:ve,nodesConnectable:Ie,nodesFocusable:xe,edgesFocusable:se,edgesUpdatable:be,elementsSelectable:Te,elevateNodesOnSelect:Va,minZoom:$e,maxZoom:Oe,nodeExtent:Ze,onNodesChange:Bn,onEdgesChange:pe,snapToGrid:fe,snapGrid:Ne,connectionMode:q,translateExtent:Xe,connectOnClick:Ys,defaultEdgeOptions:Wa,fitView:Ut,fitViewOptions:hr,onNodesDelete:I,onEdgesDelete:D,onNodeDragStart:A,onNodeDrag:B,onNodeDragStop:$,onSelectionDrag:M,onSelectionDragStart:W,onSelectionDragStop:O,noPanClassName:fn,nodeOrigin:ue,rfId:ds,autoPanOnConnect:Ka,autoPanOnNodeDrag:Ke,onError:Ya,connectionRadius:ls,isValidConnection:pr,nodeDragThreshold:Zs}),ce.createElement(a5,{onSelectionChange:F}),dn,ce.createElement($D,{proOptions:Un,position:is}),ce.createElement(h5,{rfId:ds,disableKeyboardA11y:Ga})))});cA.displayName="ReactFlow";const vF=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function uA(){return We(vF,Tt)}const dA=({id:e,x:t,y:n,width:r,height:s,style:i,color:l,strokeColor:u,strokeWidth:d,className:f,borderRadius:h,shapeRendering:m,onClick:g,selected:w})=>{const{background:b,backgroundColor:x}=i||{},k=l||b||x;return ce.createElement("rect",{className:Dt(["react-flow__minimap-node",{selected:w},f]),x:t,y:n,rx:h,ry:h,width:r,height:s,fill:k,stroke:u,strokeWidth:d,shapeRendering:m,onClick:g?j=>g(j,e):void 0})};dA.displayName="MiniMapNode";var xF=v.memo(dA);const bF=e=>e.nodeOrigin,kF=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Yf=e=>e instanceof Function?e:()=>e;function NF({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:i=xF,onClick:l}){const u=We(kF,Tt),d=We(bF),f=Yf(t),h=Yf(e),m=Yf(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ce.createElement(ce.Fragment,null,u.map(w=>{const{x:b,y:x}=Ta(w,d).positionAbsolute;return ce.createElement(i,{key:w.id,x:b,y:x,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:f(w),borderRadius:r,strokeColor:h(w),strokeWidth:s,shapeRendering:g,onClick:l,id:w.id})}))}var jF=v.memo(NF);const SF=200,_F=150,EF=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?LD(xd(t,e.nodeOrigin),n):n,rfId:e.rfId}},CF="react-flow__minimap-desc";function hA({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:l=2,nodeComponent:u,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:f="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:g,onNodeClick:w,pannable:b=!1,zoomable:x=!1,ariaLabel:k="React Flow mini map",inversePan:j=!1,zoomStep:S=10,offsetScale:_=5}){const E=vt(),T=v.useRef(null),{boundingRect:R,viewBB:A,rfId:B}=We(EF,Tt),$=(e==null?void 0:e.width)??SF,I=(e==null?void 0:e.height)??_F,D=R.width/$,F=R.height/I,W=Math.max(D,F),M=W*$,O=W*I,L=_*W,K=R.x-(M-R.width)/2-L,Z=R.y-(O-R.height)/2-L,q=M+L*2,H=O+L*2,P=`${CF}-${B}`,Y=v.useRef(0);Y.current=W,v.useEffect(()=>{if(T.current){const X=$n(T.current),V=re=>{const{transform:oe,d3Selection:fe,d3Zoom:Ne}=E.getState();if(re.sourceEvent.type!=="wheel"||!fe||!Ne)return;const we=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*S,ye=oe[2]*Math.pow(2,we);Ne.scaleTo(fe,ye)},J=re=>{const{transform:oe,d3Selection:fe,d3Zoom:Ne,translateExtent:we,width:ye,height:ve}=E.getState();if(re.sourceEvent.type!=="mousemove"||!fe||!Ne)return;const Ie=Y.current*Math.max(1,oe[2])*(j?-1:1),xe={x:oe[0]-re.sourceEvent.movementX*Ie,y:oe[1]-re.sourceEvent.movementY*Ie},ue=[[0,0],[ye,ve]],se=Xr.translate(xe.x,xe.y).scale(oe[2]),be=Ne.constrain()(se,ue,we);Ne.transform(fe,be)},ee=b2().on("zoom",b?J:null).on("zoom.wheel",x?V:null);return X.call(ee),()=>{X.on("zoom",null)}}},[b,x,j,S]);const G=g?X=>{const V=Qn(X);g(X,{x:V[0],y:V[1]})}:void 0,z=w?(X,V)=>{const J=E.getState().nodeInternals.get(V);w(X,J)}:void 0;return ce.createElement(zx,{position:m,style:e,className:Dt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},ce.createElement("svg",{width:$,height:I,viewBox:`${K} ${Z} ${q} ${H}`,role:"img","aria-labelledby":P,ref:T,onClick:G},k&&ce.createElement("title",{id:P},k),ce.createElement(jF,{onClick:z,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:l,nodeComponent:u}),ce.createElement("path",{className:"react-flow__minimap-mask",d:`M${K-L},${Z-L}h${q+L*2}v${H+L*2}h${-q-L*2}z
|
|
57
|
-
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:d,fillRule:"evenodd",stroke:f,strokeWidth:h,pointerEvents:"none"})))}hA.displayName="MiniMap";var TF=v.memo(hA);function RF(){return ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ce.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function AF(){return ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ce.createElement("path",{d:"M0 0h32v4.2H0z"}))}function MF(){return ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ce.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 $F(){return ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ce.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 IF(){return ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ce.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 Mn=({children:e,className:t,...n})=>ce.createElement("button",{type:"button",className:Dt(["react-flow__controls-button",t]),...n},e);Mn.displayName="ControlButton";const OF=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),fA=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:l,onFitView:u,onInteractiveChange:d,className:f,children:h,position:m="bottom-left"})=>{const g=vt(),[w,b]=v.useState(!1),{isInteractive:x,minZoomReached:k,maxZoomReached:j}=We(OF,Tt),{zoomIn:S,zoomOut:_,fitView:E}=si();if(v.useEffect(()=>{b(!0)},[]),!w)return null;const T=()=>{S(),i==null||i()},R=()=>{_(),l==null||l()},A=()=>{E(s),u==null||u()},B=()=>{g.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),d==null||d(!x)};return ce.createElement(zx,{className:Dt(["react-flow__controls",f]),position:m,style:e,"data-testid":"rf__controls"},t&&ce.createElement(ce.Fragment,null,ce.createElement(Mn,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:j},ce.createElement(RF,null)),ce.createElement(Mn,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:k},ce.createElement(AF,null))),n&&ce.createElement(Mn,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},ce.createElement(MF,null)),r&&ce.createElement(Mn,{className:"react-flow__controls-interactive",onClick:B,title:"toggle interactivity","aria-label":"toggle interactivity"},x?ce.createElement(IF,null):ce.createElement($F,null)),h)};fA.displayName="Controls";var LF=v.memo(fA),rr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(rr||(rr={}));function PF({color:e,dimensions:t,lineWidth:n}){return ce.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function DF({color:e,radius:t}){return ce.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const FF={[rr.Dots]:"#91919a",[rr.Lines]:"#eee",[rr.Cross]:"#e2e2e2"},qF={[rr.Dots]:1,[rr.Lines]:1,[rr.Cross]:6},BF=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function pA({id:e,variant:t=rr.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=2,color:l,style:u,className:d}){const f=v.useRef(null),{transform:h,patternId:m}=We(BF,Tt),g=l||FF[t],w=r||qF[t],b=t===rr.Dots,x=t===rr.Cross,k=Array.isArray(n)?n:[n,n],j=[k[0]*h[2]||1,k[1]*h[2]||1],S=w*h[2],_=x?[S,S]:j,E=b?[S/i,S/i]:[_[0]/i,_[1]/i];return ce.createElement("svg",{className:Dt(["react-flow__background",d]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:f,"data-testid":"rf__background"},ce.createElement("pattern",{id:m+e,x:h[0]%j[0],y:h[1]%j[1],width:j[0],height:j[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`},b?ce.createElement(DF,{color:g,radius:S/i}):ce.createElement(PF,{dimensions:_,color:g,lineWidth:s})),ce.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}pA.displayName="Background";var UF=v.memo(pA);function zF(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function Tu(e){return e!=="gone"}function Ru(e,t){const[n,r]=v.useState(()=>e?"here":"gone"),s=v.useRef(null);return v.useEffect(()=>{r(i=>zF(e,i))},[e]),v.useEffect(()=>{if(n==="leaving")return s.current=window.setTimeout(()=>r("gone"),t),()=>{s.current!=null&&window.clearTimeout(s.current)}},[n,t]),v.useEffect(()=>{n==="entering"&&r("here")},[n]),n}const wN="agent-dag.fm-custom-stations",vN="agent-dag.fm-muted",Xv="custom:",HF=/^UC[A-Za-z0-9_-]{22}$/,WF=/^[A-Za-z0-9_-]{11}$/,t0=/^[A-Za-z0-9_-]{1,80}$/,VF=/\.(mp3|aac|ogg)$/i,GF=/\.m3u8$/i,mA=2048,bl=80;function La(e){return`${Xv}${e}`}function Ko(e){if(!e.startsWith(Xv))return null;const t=e.slice(Xv.length);return t0.test(t)?t:null}function xN(e){return Ko(e)??e}function KF(e){return e?"This station could not be played. Check its link, pick another, or pick it again to retry.":"This station is not live right now. Pick another, or pick it again later to retry."}function n0(e){var l,u;const t=e.trim();if(t.length>mA)return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol!=="https:"||n.username||n.password)return null;const r=n.toString(),s=n.hostname.toLowerCase();if(s==="youtube.com"||s==="www.youtube.com"||s==="m.youtube.com"){if(n.port)return null;const d=(l=/^\/channel\/([^/]+)(?:\/live)?\/?$/.exec(n.pathname))==null?void 0:l[1];if(d&&HF.test(d))return{kind:"youtube-channel",url:r,channel:d};const f=(u=/^\/@([^/]+)\/live\/?$/.exec(n.pathname))==null?void 0:u[1];if(f&&/^[A-Za-z0-9._-]{1,64}$/.test(f))return{kind:"youtube-handle",url:r,handle:f};if(n.pathname==="/watch"){const h=n.searchParams.get("v")??"";if(WF.test(h))return{kind:"youtube-video",url:r,video:h}}return null}return GF.test(n.pathname)?{kind:"direct-audio",url:r,format:"hls"}:VF.test(n.pathname)?{kind:"direct-audio",url:r,format:"audio"}:null}function YF(e){return e==="1"}function XF(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];const n=new Set,r=[];for(const s of t){if(!s||typeof s!="object")continue;const i=typeof s.id=="string"?s.id:"",l=typeof s.name=="string"?s.name.trim():"",u=typeof s.url=="string"?s.url.trim():"",d=n0(u);!t0.test(i)||n.has(i)||!l||l.length>bl||!d||(n.add(i),r.push({id:i,name:l,url:d.url}))}return r}function ZF(e,t,n){const r=Ko(e??"");return r&&t.some(s=>s.id===r)?La(r):n(e)}function JF(e,t){return e===La(t)?"claude-fm":e}function QF(){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)}`}function e6(e,t,n=QF()){const r=e.trim(),s=n0(t);return!r||r.length>bl||!t0.test(n)||!s?null:{id:n,name:r,url:s.url}}const gA=.2,yA=1.6;function t6(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:s}=t;return typeof n!="number"||typeof r!="number"||typeof s!="number"||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(s)||s<gA||s>yA?null:{x:n,y:r,zoom:s}}function Zv({durationMs:e,documentHidden:t,reducedMotion:n=n6()}){return t||n?!1:Number.isFinite(e)&&e>0}function n6(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}const r6=["us-gov","global","apac","us","eu","jp","au"],s6=new RegExp(`^(?:(?:${r6.join("|")})\\.)?anthropic\\.`,"i");function ai(e){return e.replace(s6,"")}const a6=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,o6=new Set(["tool_input","tool_response"]);function wA(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&a6.test(ai(n.model)))return n.model;for(const[r,s]of Object.entries(n)){if(o6.has(r))continue;const i=wA(s,t+1);if(i)return i}return null}function r0(){return{agents:new Map,toolIndex:new Map,activeSubagentStack:new Map,subagentTombstones:new Map,pendingSubagentModels:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Gs(e,t){return`${e}::${t}`}function oi(e,t){return`${e}\0${t}`}const i6=/[0-9a-f]{16,}/i,l6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function vA(e){return i6.test(e)||l6.test(e)}function c6(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!vA(t[n]))return t[n];return t[t.length-1]}function xA(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function bA(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,r=n.ephemeral_1h_input_tokens,s=n.ephemeral_5m_input_tokens;return typeof r!="number"&&typeof s!="number"?{}:{cacheCreate1hTokens:Number(r??0),cacheCreate5mTokens:Number(s??0)}}function kA(e){const t=bA(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 u6(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]=kA(r));return Object.keys(t).length?t:void 0}function NA(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),...bA(n)};for(const r of Object.values(n)){const s=NA(r,t+1);if(s)return s}return null}function s0(e){return c6(e)}function a0(e){const t=e.agent_type??e.subagent_type;return t&&!vA(t)?t:"subagent"}function ql(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function kl(e,t){!e.cwd&&t.cwd&&(e.cwd=t.cwd,e.cwdBasename=s0(t.cwd))}function jA(e,t){e.label==="session"&&t.cwd&&(e.label=s0(t.cwd)??"session")}function SA(e,t){const n=a0(t);n&&(e.label==="subagent"||!e.label)&&(e.label=n)}function ii(e,t,n,r){const s=t;let i=e.agents.get(s);return i||(i={id:s,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:r,usage:xA()},e.agents.set(s,i),i)}function _A(e,t,n,r){const s=Gs(t,n),i=e.agents.get(s);return i?(kl(i,r),SA(i,r),i):null}function d6(e,t,n){const r=t.session_id??"unknown",s=ql(t);if(s){const d=_A(e,r,s,t);if(d)return d}const i=e.activeSubagentStack.get(r),l=i&&i.length>0?i[i.length-1]:null;if(l){const d=e.agents.get(Gs(r,l));if(d)return kl(d,t),d}const u=ii(e,r,n,t.hook_event_name!=="SessionStart");return kl(u,t),jA(u,t),u}function h6(e,t,n,r,s){const i=Gs(t,n),l=ii(e,t,s,!0);let u=e.agents.get(i);if(u)return kl(u,r),SA(u,r),u;u={id:i,sessionId:t,label:a0(r),kind:"subagent",parentId:l.id,state:"active",startedAt:s,tools:[],prompts:[],cwd:r.cwd,cwdBasename:s0(r.cwd),toolCount:0,childCount:0,usage:xA()},e.agents.set(i,u);const d=e.pendingSubagentModels.get(i);return d&&(u.model=d,e.pendingSubagentModels.delete(i)),l.childCount+=1,u}function f6(e,t,n){const r=e.activeSubagentStack.get(t)??[];r.includes(n)||(r.push(n),e.activeSubagentStack.set(t,r))}function EA(e,t,n){const r=e.activeSubagentStack.get(t);if(r){for(let s=r.length-1;s>=0;s--)if(r[s]===n){r.splice(s,1);break}r.length===0&&e.activeSubagentStack.delete(t)}}function $t(e,t){return Object.hasOwn(e,t)?e[t]:void 0}const p6=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function bN(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const m6={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function o0(e){const t=p6.exec(e);if(!t)return null;const n=bN(t[1],"status");return{label:(n?$t(m6,n):void 0)??"background task update",detail:bN(t[1],"summary")}}function CA(e){return e.filter(t=>!o0(t.text))}const kN=2e3;function g6(e,t,n){for(let r=e.prompts.length-1;r>=0;r--){const s=e.prompts[r];if(s.at<t-kN)return!1;if(s.text===n&&s.at<=t+kN)return!0}return!1}const Gu=2e3;function y6(e){let t=e.startedAt;for(const n of e.prompts)n.at>t&&(t=n.at);return t}function Ku(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 NN=200;function w6(e,t,n){var r;return((r=e.get(t))==null?void 0:r.tools.find(s=>s.id===n))??null}const v6=25;function x6(e,t){const n=t.tools;if(n.length>NN){const r=n.splice(0,n.length-NN);for(const s of r)RA(e,t,s)}for(let r=n.length-v6-1;r>=0;r--){const s=n[r];if(s.trimmed)break;s.input=void 0,s.response=void 0,s.trimmed=!0}}function b6(e,t,n){const r=e.toolIndex.get(oi(t.sessionId,n));if(r)return r;for(let s=t.tools.length-1;s>=0;s--)if(t.tools[s].id===n)return t.tools[s];return null}function TA(e,t){for(const n of t.tools)RA(e,t,n)}function RA(e,t,n){const r=oi(t.sessionId,n.id);e.toolIndex.get(r)===n&&e.toolIndex.delete(r)}const k6="no result reached the deck — events were dropped while the deck was paused";function AA(e,t,n,r,s){n.endedAt=r,n.ok=!1,n.errorPreview=n.outcomeGap?k6:s,e.toolIndex.delete(oi(t.sessionId,n.id))}function N6(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 s=n==null?void 0:n.tool_use_id;return typeof s!="string"||s.length===0?!1:e.toolIndex.has(oi((n==null?void 0:n.session_id)??"unknown",s))}function j6(e,t,n,r,s){const i=t.tool_use_id?b6(e,r,t.tool_use_id):null;if(i){t.tool_name&&i.name==="?"&&(i.name=t.tool_name),i.endedAt==null&&!i.trimmed&&t.tool_input!==void 0&&(i.input=t.tool_input,i.inputPreview=Ku(t.tool_input));return}const l=t.tool_use_id??`${r.id}:${r.toolCount}`,u=ql(t),d={id:l,name:t.tool_name??"?",input:t.tool_input,inputPreview:Ku(t.tool_input),agentId:r.id,explicitSubagentId:u?Gs(n,u):void 0,startedAt:s};r.tools.push(d),r.toolCount+=1,r.state="active",e.toolIndex.set(oi(r.sessionId,l),d),x6(e,r)}function S6(e,t,n,r,s){const i=t.tool_use_id;if(!i)return;const l=oi(r,i);let u=e.toolIndex.get(l),d=!1;if(!u)for(const h of e.agents.values()){if(h.sessionId!==r)continue;const m=h.tools.find(g=>g.id===i);if(m){u=m,d=!0;break}}if(!u||u.outcomeApplied)return;u.outcomeApplied=!0,u.outcomeGap=void 0,u.endedAt=s,u.ok=n==="PostToolUse",u.trimmed||(u.response=t.tool_response),n==="PostToolUseFailure"?u.errorPreview=Ku(t.tool_response):d&&(u.errorPreview=void 0);const f=NA(t.tool_response);f&&(u.usage=f),e.toolIndex.delete(l)}function _6(e,t,n){const r=e.agents.get(t);r&&n>(r.lastEventAt??0)&&(r.lastEventAt=n,r.reaped&&(r.reaped=!1,r.state="active",r.endedAt=void 0,r.closedAt=void 0))}function E6(e,t,n,r){const s=ii(e,n,r,!1);s.synthetic=!1,s.state="active",s.closedAt=void 0,s.endedAt=void 0,s.startedAt=Math.min(s.startedAt??r,r),kl(s,t),jA(s,t)}function C6(e,t,n,r){for(const l of e.agents.values())l.sessionId===n&&l.kind==="subagent"&&l.state==="done"&&l.exitAt==null&&l.endedAt!=null&&l.endedAt<r&&(l.exitAt=r);const s=ii(e,n,r,!1);s.state="active",s.endedAt=void 0,s.closedAt=void 0,s.exitAt=void 0;const i=(typeof t.prompt=="string"?t.prompt:typeof t.message=="string"?t.message:"")??"";i&&!g6(s,r,i)&&(s.prompts.push({at:r,text:i}),!s.firstPrompt&&!o0(i)&&(s.firstPrompt=Ku(i,120)))}function T6(e,t,n,r){const s=ii(e,n,r,!1),i=y6(s);if(r<i)return;const l=s.lastTurnEndAt;if(!(l!=null&&i>l&&r<=l+Gu)){s.state="done",s.endedAt=r,s.lastTurnEndAt=r;for(const u of s.provider==="codex"?[]:e.agents.values())if(u.sessionId===n)for(const d of u.tools)d.endedAt==null&&d.explicitSubagentId==null&&AA(e,u,d,r,"the turn ended before this call returned");t==="SessionEnd"&&(s.closedAt=r),e.activeSubagentStack.delete(n)}}function R6(e,t,n,r){const s=ql(t);if(!s)return;const i=h6(e,n,s,t,r),l=a0(t);l&&(i.label=l);const u=e.subagentTombstones.get(i.id);u!=null&&e.subagentTombstones.delete(i.id);const d=i.endedAt!=null&&r-i.endedAt<=Gu,f=u!=null&&r-u<=Gu;if(d||f){const h=f?u:i.endedAt;i.state="done",i.endedAt=h,i.startedAt=Math.min(i.startedAt,h),EA(e,n,s);return}i.state="active",i.startedAt=i.startedAt||r,i.exitAt=void 0,i.endedAt=void 0,f6(e,n,s)}function A6(e,t,n,r){const s=ql(t);if(!s)return;const i=_A(e,n,s,t);if(!i){for(const[l,u]of e.subagentTombstones)r-u>Gu&&e.subagentTombstones.delete(l);e.subagentTombstones.set(Gs(n,s),r);return}i.state="done",i.endedAt=Math.min(i.endedAt??r,r),EA(e,n,s)}function MA(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function M6(e,t,n){if(typeof t.model_context_window=="number"&&t.model_context_window>0){const r=e.agents.get(n);r&&(r.contextWindow=t.model_context_window)}if(typeof t.approval_policy=="string"&&t.approval_policy){const r=e.agents.get(n);r&&(r.approvalPolicy=t.approval_policy)}if(typeof t.context_tokens=="number"&&t.context_tokens>=0){const r=e.agents.get(n);r&&(r.context={...r.context??MA(),currentContextTokens:t.context_tokens})}}const $6=6e4,jN=64;function I6(e,t,n){const r=typeof t.model=="string"?t.model:null;if(r){const i=e.agents.get(n);i&&(i.model=r)}const s=t.subagentModels;if(s&&typeof s=="object")for(const[i,l]of Object.entries(s)){if(typeof l!="string")continue;const u=Gs(n,i),d=e.agents.get(u);if(d)d.model=l,e.pendingSubagentModels.delete(u);else if(e.pendingSubagentModels.delete(u),e.pendingSubagentModels.set(u,l),e.pendingSubagentModels.size>256){const f=e.pendingSubagentModels.keys().next().value;f!==void 0&&e.pendingSubagentModels.delete(f)}}}function O6(e,t,n){const r=t.context??null;if(r){const s=e.agents.get(n);if(s){const i=s.context??MA(),l=(d,f)=>typeof r[d]=="number"?r[d]:f,u=Array.isArray(r.memoryFiles)?r.memoryFiles:Array.isArray(r.claudeMdFiles)?r.claudeMdFiles:null;s.context={msgsUser:l("msgsUser",i.msgsUser),msgsAssistant:l("msgsAssistant",i.msgsAssistant),toolUses:l("toolUses",i.toolUses),toolResults:l("toolResults",i.toolResults),systemReminders:l("systemReminders",i.systemReminders),currentContextTokens:l("currentContextTokens",i.currentContextTokens),memoryFiles:u??i.memoryFiles}}}}function L6(e,t,n){const r=e.agents.get(n);if(r){const s=typeof t.sessionName=="string"?t.sessionName.trim():"",i=typeof t.sessionTitle=="string"?t.sessionTitle.trim():"";s&&(r.sessionName=s),i&&(r.sessionTitle=i);const l=r.sessionName??"";r.sessionTitle&&l&&r.sessionTitle.toLowerCase()===l.toLowerCase()&&(r.sessionTitle=void 0)}}function P6(e,t,n){const r=e.agents.get(n);if(r){const s=t.recap;s===null?r.recap=void 0:s&&typeof s.text=="string"&&s.text.trim()&&Number.isFinite(s.at)&&(r.recap={text:s.text.trim(),at:s.at})}}function D6(e,t,n,r){const s=t.kind==="thinking"||t.kind==="text"||t.kind==="tool_use"?t.kind:null,i=typeof t.at=="number"&&Number.isFinite(t.at)?t.at:r;if(!s)return;const l=e.agents.get(n);if(l&&!(l.lastOutputAt!=null&&i<=l.lastOutputAt)){if(l.lastOutputAt=i,s!=="tool_use"){const u=(l.outputs??[]).filter(d=>i-d<$6);u.push(i),l.outputs=u.length>jN?u.slice(-jN):u}e.revision+=1}}function F6(e,t,n){const r=t.usage??null;if(r){const s=e.agents.get(n);s&&(Object.assign(s.usage,kA(r)),s.usageByModel=u6(t.usageByModel))}}const q6=["command","cmd","file_path","path","url","pattern","notebook_path"],SN=120,Xf=e=>e.length>SN?`${e.slice(0,SN-1)}…`:e;function B6(e){if(typeof e=="string")return e.trim()?Xf(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of q6){const r=t[n];if(typeof r=="string"&&r.trim())return Xf(r.trim());if(Array.isArray(r)&&r.length>0&&r.every(s=>typeof s=="string")){const s=r.join(" ").trim();if(s)return Xf(s)}}return null}function U6(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const z6=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped","OutputObserved"]);function H6(e,t){let n=null;for(const r of e.toolIndex.values()){const s=r.agentId?e.agents.get(r.agentId):void 0;!s||s.sessionId!==t||(!n||r.startedAt>n.startedAt)&&(n=r)}return n}const W6=3e4;function V6(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>W6)&&!(e.startedAt>t))return{name:e.name,preview:B6(e.input)??""}}function G6(e,t,n,r,s){if(n!=="permission")return{kind:n,message:r,since:s};const i=H6(e,t),l={kind:n,message:r,since:s};i!=null&&i.explicitSubagentId&&(l.subagentId=i.explicitSubagentId);const u=V6(i,s);return u&&(l.tool=u),l}function K6(e,t,n){if(e.kind==="idle")return!0;const r=ql(t);return r==null?!0:e.subagentId!=null&&Gs(n,r)===e.subagentId}function Y6(e,t,n,r){if(!z6.has(t)){const s=e.agents.get(r);s!=null&&s.waiting&&K6(s.waiting,n,r)&&(s.waiting=null)}}function X6(e,t,n,r){const s=U6(t.notification_type);if(!s)return;const i=ii(e,n,r,!1),l=typeof t.message=="string"?t.message:"",u=i.waiting;i.waiting=u&&u.kind===s&&u.message===l?{...u,since:Math.min(u.since,r)}:G6(e,n,s,l,r)}function Bl(e,t){return t&&(e.revision+=1),t}function Z6(e,t,n,r,s){if(e.agents.size<=n)return!1;const i=m=>m.state==="done"&&m.endedAt!=null&&t-m.endedAt>r,l=[],u=new Map;for(const[m,g]of e.agents){if(g.parentId!=null){const w=u.get(g.parentId);w?w.push(m):u.set(g.parentId,[m])}i(g)&&l.push({id:m,endedAt:g.endedAt})}if(l.length===0)return!1;l.sort((m,g)=>m.endedAt-g.endedAt);let d=0;const f=new Set,h=m=>{const g=e.agents.get(m);g&&(TA(e,g),e.agents.delete(m),f.add(g.sessionId),d++)};for(const m of l){if(e.agents.size<=n)break;if(!e.agents.has(m.id))continue;const g=(u.get(m.id)??[]).map(w=>e.agents.get(w)).filter(w=>w!=null);if(!g.some(w=>!i(w))){for(const w of g)h(w.id);h(m.id)}}if(s&&f.size>0){const m=new Set;for(const g of e.agents.values())m.add(g.sessionId);for(const g of f)m.has(g)||s(g)}return Bl(e,d>0)}function J6(e,t,n,r,s){const i=new Map;for(const[h,m]of e.agents){let g=i.get(m.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},i.set(m.sessionId,g)),g.ids.push(h),m.kind==="root"&&m.closedAt!=null&&(g.closed=!0),m.state==="done"&&m.endedAt!=null?g.endedAt=Math.max(g.endedAt,m.endedAt):g.live=!0}const l=[...i].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 d=[...i.values()].filter(h=>!h.live).length-n;if(d<=0)return!1;let f=!1;for(const[h,m]of l){if(d<=0)break;for(const w of m.ids){const b=e.agents.get(w);b&&TA(e,b),e.agents.delete(w)}const g=Gs(h,"");for(const w of e.pendingSubagentModels.keys())w.startsWith(g)&&e.pendingSubagentModels.delete(w);s==null||s(h),d--,f=!0}return Bl(e,f)}function Q6(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 Bl(e,t)}function eq(e,t,n){let r=!1;for(const s of e.agents.values()){if(s.provider==="codex")continue;const i=e.agents.get(s.sessionId),l=(i==null?void 0:i.lastEventAt)??(i==null?void 0:i.startedAt);for(const u of s.tools){const d=Math.max(u.startedAt,l??u.startedAt);u.endedAt==null&&t-d>n&&(AA(e,s,u,d,"session ended before this call returned"),r=!0)}}return Bl(e,r)}const _N=90*6e4;function tq(e,t,n){let r=!1;for(const s of e.agents.values()){if(s.kind!=="root")continue;const i=s.lastEventAt??s.startedAt;if(!(t-i<=n)){s.waiting&&(s.waiting=null,r=!0),s.closedAt==null&&(s.closedAt=i),s.state==="active"&&(s.state="done",s.endedAt=i,s.reaped=!0,r=!0);for(const l of e.agents.values())l.sessionId!==s.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=i,r=!0);e.activeSubagentStack.delete(s.sessionId)}}return Bl(e,r)}function Yu(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 $A(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??{},s=t.receivedAt,i=r.hook_event_name??"Unknown";if(i==="__clear")return{...r0(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const l=r.session_id??"unknown";switch(Y6(e,i,r,l),_6(e,l,s),M6(e,r,l),i){case"ModelObserved":return I6(e,r,l),e;case"ContextObserved":return O6(e,r,l),e;case"SessionNamed":return L6(e,r,l),e;case"SessionRecapped":return P6(e,r,l),e;case"OutputObserved":return D6(e,r,l,s),e;case"UsageObserved":return F6(e,r,l),e}const u=d6(e,r,s);u.provider||(u.provider=r.provider==="codex"?"codex":"claude");const d=wA(r);switch(d&&(u.model=d),i){case"SessionStart":E6(e,r,l,s);break;case"UserPromptSubmit":C6(e,r,l,s);break;case"PreToolUse":j6(e,r,l,u,s);break;case"PostToolUse":case"PostToolUseFailure":S6(e,r,i,l,s);break;case"SubagentStart":R6(e,r,l,s);break;case"SubagentStop":A6(e,r,l,s);break;case"Stop":case"SessionEnd":T6(e,i,l,s);break;case"Notification":X6(e,r,l,s);break}return e}const nq={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},rq=[{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[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:4,output:20,cacheRead:.2,cacheWrite:5,cacheWrite1h:8}},{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[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}},{match:/^claude[-_]sonnet[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:nq},{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 sq(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Fa(e,t=Date.now()){if(!e)return null;const n=ai(e);for(const r of rq)if(r.match.test(n))return typeof r.rates=="function"?r.rates(t):r.rates;return null}function ll(e,t){return e*t/1e6}function IA(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),r=Math.max(0,e.cacheCreate5mTokens??0),s=Math.max(0,e.cacheCreateTokens-n-r),i=r+s,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:i,tokens1h:n,usd5m:ll(i,t.cacheWrite),usd1h:ll(n,l)}}function OA(e,t,n=Date.now()){if(!sq(t))return e.inputTokens;const r=Fa(t,n),s=((r==null?void 0:r.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-s)}function Nl(e,t,n=Date.now()){const r=Fa(t,n);if(!r)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const s=ll(OA(e,t,n),r.input),i=ll(e.outputTokens,r.output),l=ll(e.cacheReadTokens,r.cacheRead),u=IA(e,r),d=u.usd5m+u.usd1h;return{input:s,output:i,cacheRead:l,cacheWrite:d,total:s+i+l+d}}const es="not priced";function Zf(e,t,n){const r=e.toFixed(t);return Number(r)<n?r:null}function qe(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const t=Zf(e*100,e<.1?1:0,100);if(t!==null)return`${t}¢`}if(e<100){const t=Zf(e,2,100);if(t!==null)return`$${t}`}if(e<1e4){const t=Zf(e,0,1e4);if(t!==null)return`$${t}`}return`$${(e/1e3).toFixed(1)}k`}function i0(e,t){if(e<=0||t<10)return null;const n=e/t,r=n*60;return r>=.01?`${qe(r)}/min`:`${qe(n*3600)}/hr`}function aq(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 oq(e,t){let n=0,r=0,s=0,i=0,l=0,u=0;for(const m of t)n+=m.inputTokens,r+=m.outputTokens,s+=m.cacheReadTokens,i+=m.cacheCreateTokens,l+=m.cacheCreate1hTokens??0,u+=m.cacheCreate5mTokens??0;const d=(m,g)=>Math.max(0,m-g),f={inputTokens:d(e.inputTokens,n),outputTokens:d(e.outputTokens,r),cacheReadTokens:d(e.cacheReadTokens,s),cacheCreateTokens:d(e.cacheCreateTokens,i)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(f.cacheCreate1hTokens=d(e.cacheCreate1hTokens??0,l),f.cacheCreate5mTokens=d(e.cacheCreate5mTokens??0,u)),f.inputTokens+f.outputTokens+f.cacheReadTokens+f.cacheCreateTokens>0?f:null}function Ul(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(i=>({model:i,usage:t[i]})),s=oq(e.usage,r.map(i=>i.usage));if(s){const i=r.findIndex(l=>l.model===e.model);i>=0?r[i]={model:r[i].model,usage:aq(r[i].usage,s)}:r.push({model:e.model,usage:s})}return r}function un(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const r of Ul(e)){const s=Nl(r.usage,r.model,t);n.input+=s.input,n.output+=s.output,n.cacheRead+=s.cacheRead,n.cacheWrite+=s.cacheWrite,n.total+=s.total}return n}function jl(e,t=Date.now()){let n=0;for(const r of Ul(e))Fa(r.model,t)==null&&(n+=r.usage.inputTokens+r.usage.outputTokens);return n}function LA(e){const t=[];for(const n of Ul(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 PA(e){return LA(e).filter(t=>t!==e.model)}function EN(e,t){const n=Fa(t);if(!n)return`model: ${t}
|
|
58
|
-
no published rate in this build — the tokens are counted, the dollars are not`;const r=h=>h.toLocaleString(),s=h=>`$${h}/MTok`,i=Nl(e,t),l=IA(e,n),u=l.tokens1h>0?[`cache w5m${r(l.tokens5m).padStart(14)} × ${s(n.cacheWrite).padEnd(11)} = ${qe(l.usd5m)}`,`cache w1h${r(l.tokens1h).padStart(14)} × ${s(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${qe(l.usd1h)}`]:[`cache w ${r(l.tokens5m).padStart(14)} × ${s(n.cacheWrite).padEnd(11)} = ${qe(l.usd5m)}`],d=OA(e,t),f=d===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${f.padEnd(9)}${r(d).padStart(14)} × ${s(n.input).padEnd(11)} = ${qe(i.input)}`,`output ${r(e.outputTokens).padStart(14)} × ${s(n.output).padEnd(11)} = ${qe(i.output)}`,`cache r ${r(e.cacheReadTokens).padStart(14)} × ${s(n.cacheRead).padEnd(11)} = ${qe(i.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${qe(i.total)}`].join(`
|
|
59
|
-
`)}function CN(e){const t=Ul(e);return t.length<=1?EN(e.usage,e.model):[...t.map(n=>EN(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${qe(un(e).total)}`].join(`
|
|
60
|
-
`)}function iq(e){if(!e.model)return null;const t=Fa(e.model),n=un(e),r=jl(e);if(!t&&n.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:{kind:"unpriced",tt:CN(e)};if(n.total<=0)return null;const s=Math.max(0,((e.endedAt??Date.now())-e.startedAt)/1e3),i=e.state==="active"&&!e.synthetic?i0(n.total,s):null,l=CN(e)+(i?`
|
|
61
|
-
burn: ${i}`:"");return{kind:"spent",total:n.total,floor:r>0,tt:l}}const lq=new Set(["untrusted","on-request","on-failure"]);function cq(e){return typeof e!="string"||!e?null:lq.has(e)?!0:e==="never"?!1:null}function uq(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=cq(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."}
|
|
62
|
-
|
|
63
|
-
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 TN(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Hs(e){const t=ai(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const s=TN(n[1]),i=n[2].replace(/[-_]/g,".");return`${s} ${i}`}const r=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(r){const s=r[1].replace(/[-_]/g,"."),i=r[2].split(/[-_]/).filter(Boolean).map(TN);return[`GPT-${s}`,...i].join(" ")}return e}function bd(e){const t=ai(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function lr(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function Jv(e){const t=[];for(const n of e)n.kind==="root"&&lr(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 dq(e,t){if(e.length===0)return null;const n=e.findIndex(r=>r.id===t);return e[(n+1)%e.length]}function hq(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function kd(e,t){return`${e}@${t.since}`}function DA(e,t){if(!e.tool)return null;const{name:n,preview:r}=e.tool,s=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return r?s?r:`${n} · ${r}`:s?null:n}function fq(e){const t=e.message||"Needs your permission",n=DA(e,t);return n?`${t}
|
|
64
|
-
Likely on: ${n}`:t}function pq(e,t,n,r=!0){if(!r)return[];if(n)return[];const s=[];for(const i of e){if(!lr(i.waiting))continue;const l=kd(i.id,i.waiting);t.has(l)||s.push({key:l,title:i.label,body:fq(i.waiting),sessionId:i.id})}return s}function mq(e,t,n){const r=new Set;for(const i of e)r.add(kd(i.id,i.waiting));const s=new Set;for(const i of n)r.has(i)&&s.add(i);for(const i of t)s.add(i.key);return s}function Jf(e){return new Set(e.map(t=>kd(t.id,t.waiting)))}function gq(e,t){return e!==t}function yq(e,t){return!e&&t!=null}function wq(e,t){return e!==null&&t!=null}function Yo(e){return e==="active"?"live":e==="done"?"done":"err"}function Xo(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function vq(e,t=Date.now(),n=!1){const r=e.tools.filter(i=>i.ok===!1).length,s=un(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",Yo(e.state),lr(e.waiting)?Xo(e.waiting):null,e.model?Hs(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,r>0?`${r} failed`:null,s>0?`${qe(s)}${jl(e,t)>0?"+":""}`:null,n?"selected":null].filter(Boolean).join(", ")}function xq(e,t){const n=DA(e,t);return n?`Likely on: ${n}`:null}function l0(e){return e.kind==="idle"?"Your turn":Xo(e)}function st(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 Zo(e,t,n){const r=(t??n)-e;if(r<1e3)return`${Math.max(0,r)}ms`;const s=Math.floor(r/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60),l=s%60;return`${i}m ${String(l).padStart(2,"0")}s`}function FA(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 c0(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 RN=["B","KB","MB","GB","TB"];function ka(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e===0)return"0 B";let t=e,n=0;for(;n<RN.length-1&&Number(t.toFixed(1))>=1024;)t/=1024,n++;return`${t.toFixed(1)} ${RN[n]}`}const AN=2e5,bq=1e6,kq=[/\[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],Nq=[{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 jq(e){if(!e)return AN;const t=ai(e);for(const n of kq)if(n.test(t))return bq;for(const n of Nq)if(n.match.test(t))return n.window;return AN}function qA(e,t){return typeof e=="number"&&e>0?e:jq(t)}const Sq=1;function _q(){const e=[];let t=0;function n(){let r;for(const s of e)(!r||s.layer>r.layer||s.layer===r.layer&&s.seq>r.seq)&&(r=s);return r}return{push(r,s=0,i="dialog"){const l={dismiss:r,layer:s,kind:i,seq:t++};return e.push(l),()=>{const u=e.indexOf(l);u!==-1&&e.splice(u,1)}},dismissTop(){const r=n();return r?(r.dismiss(),!0):!1},isTop(r){const s=n();return s!=null&&s.dismiss===r},depth(){return e.length},dialogDepth(){return e.filter(r=>r.kind==="dialog").length}}}const cl=_q(),Eq=e=>e==="Escape";function Cq(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function MN(e){return String(e.tagName??"").toUpperCase()==="BODY"}function Tq(e,t){return!e||!e.isConnected||MN(e)?!1:t==null||MN(t)}const $N="a[href], button, input, select, textarea, [tabindex]";function Rq(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function Aq(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function Mq({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 Nd(e){return e.ctrlKey||e.metaKey||e.altKey}const $q=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),Iq=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),Oq=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function u0(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function Lq(e){return u0(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function jd(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=u0(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!$q.has(String(e.type??"text").toLowerCase())}function Pq(e,t){if(!e)return!1;if(jd(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&Lq(e))return!1;if(Iq.has(u0(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>Oq.has(r))}function Dq({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function Fq({appModal:e,dialogDepth:t}){return e||t>0}function BA(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches($N))return Rq({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&Aq({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector($N)!=null})}):[]}function qq(e,t){const n=BA(e);if(!t||!e.contains(t)||n.includes(t))return n;const r=n.findIndex(s=>(t.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return r===-1?[...n,t]:[...n.slice(0,r),t,...n.slice(r)]}function pt(e,t={}){const{focusRef:n,layer:r,popover:s}=t,i=s?"popover":"dialog",l=v.useRef(null),u=v.useRef(e);u.current=e;const d=v.useRef(null);d.current===null&&(d.current=()=>u.current());const f=d.current;return v.useEffect(()=>cl.push(f,r,i),[f,r,i]),v.useEffect(()=>{var m;const h=document.activeElement;return(m=(n==null?void 0:n.current)??BA(l.current)[0])==null||m.focus(),()=>{Tq(h,document.activeElement)&&h.focus()}},[]),v.useEffect(()=>{const h=m=>{var j;if(m.key!=="Tab"||Nd(m))return;const g=l.current;if(!g)return;const w=document.activeElement;if(!(w!=null&&g.contains(w))&&!cl.isTop(f))return;const x=qq(g,w),k=Mq({count:x.length,index:w?x.indexOf(w):-1,shiftKey:m.shiftKey});k.kind!=="allow"&&(m.preventDefault(),k.kind==="focus"&&((j=x[k.index])==null||j.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[f]),l}function Bq(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 An(e){return e.toLocaleString()}const Uq=60;function zq(e,t=Uq){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 Hq({agent:e,onClose:t}){var g;const n=v.useRef(null),r=pt(t,{focusRef:n}),s=e.context,i=e.usage,l=(s==null?void 0:s.currentContextTokens)??0,u=qA(e.contextWindow,e.model),d=Math.min(100,l/u*100),f=un(e),h=e.provider==="codex"?i.inputTokens+i.outputTokens:i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheCreateTokens,m=Bq(e.provider);return a.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:a.jsxs("div",{ref:r,className:"modal ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[a.jsxs("header",{className:"ctx-modal-head",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),a.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),a.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),a.jsxs("section",{className:"ctx-window-row",children:[a.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-label":"Context window used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(d),children:a.jsx("div",{className:"ctx-window-fill",style:{transform:`scaleX(${Math.min(100,Math.max(0,d))/100})`}})}),a.jsxs("div",{className:"ctx-window-meta",children:[a.jsxs("span",{className:"ctx-window-pct",children:[d.toFixed(1),"%"]}),a.jsxs("span",{children:[An(l)," / ",An(u)," tok (",m.windowScope,")"]})]})]}),a.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),a.jsxs("div",{className:"ctx-grid",children:[a.jsx(Zn,{label:"input tokens",val:An(i.inputTokens)}),a.jsx(Zn,{label:"output tokens",val:An(i.outputTokens)}),a.jsx(Zn,{label:"cache reads",val:An(i.cacheReadTokens)}),a.jsx(Zn,{label:"cache writes",val:An(i.cacheCreateTokens)}),a.jsx(Zn,{label:"cumulative total",val:An(h)}),a.jsx(Zn,{label:"estimated cost",val:qe(f.total),accent:!0})]}),a.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?a.jsxs("div",{className:"ctx-grid",children:[a.jsx(Zn,{label:"user messages",val:An((s==null?void 0:s.msgsUser)??0)}),a.jsx(Zn,{label:"assistant messages",val:An((s==null?void 0:s.msgsAssistant)??0)}),a.jsx(Zn,{label:"tool uses",val:An((s==null?void 0:s.toolUses)??0)}),a.jsx(Zn,{label:"tool results",val:An((s==null?void 0:s.toolResults)??0)}),a.jsx(Zn,{label:"system-reminders",val:An((s==null?void 0:s.systemReminders)??0)})]}):a.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),a.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((g=s==null?void 0:s.memoryFiles)==null?void 0:g.length)??0)===0?a.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):a.jsx("ul",{className:"ctx-md-list",children:s.memoryFiles.map(w=>a.jsxs("li",{children:[a.jsx("span",{className:"ctx-md-path",title:w.path,children:zq(w.path)}),a.jsx("span",{className:"ctx-md-size",children:ka(w.bytes)})]},w.path))})]})})}function Zn({label:e,val:t,accent:n}){return a.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[a.jsx("span",{className:"ctx-row-label",children:e}),a.jsx("span",{className:"ctx-row-val",children:t})]})}function Wq({currentContextTokens:e,modelId:t,contextWindow:n,size:r=26,onClick:s}){const i=qA(n,t),l=Math.min(1,e/i),u=r/2-3,d=r/2,f=2*Math.PI*u,h=f*l,m=l>.9?"var(--err)":l>.7?"var(--warn)":"var(--accent)";return a.jsx("button",{type:"button",className:"ctx-donut",onClick:s,title:`context: ${e.toLocaleString()} / ${i.toLocaleString()} (${(l*100).toFixed(1)}%)`,"aria-label":`Context ${Math.round(l*100)}% of ${i.toLocaleString()} tokens — show breakdown`,children:a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,"aria-hidden":"true",children:[a.jsx("circle",{cx:d,cy:d,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),a.jsx("circle",{cx:d,cy:d,r:u,stroke:m,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${f-h}`,strokeDashoffset:f/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),a.jsx("text",{x:d,y:d+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}const IN=new Map;function UA(e){let t=IN.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},IN.set(e,t)),t}function Vq(e,t){const n=UA(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 Gq(e){return UA(e).now}const ON=new Map,LN=new Map;function li(e=1e3){let t=ON.get(e);t||(t=r=>Vq(e,r),ON.set(e,t));let n=LN.get(e);return n||(n=()=>Gq(e),LN.set(e,n)),v.useSyncExternalStore(t,n,n)}function Sd(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 Kq="1",PN="agent-dag.schema",Yq=["agent-dag.layout","agent-dag.viewport"];function et(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function Ye(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}function Zr(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}}function ul(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function Xq(e,t=Kq){let n=null;try{n=e.getItem(PN)}catch{return[]}if(n===t)return[];const r=[];if(n!==null)for(const s of Yq)try{e.getItem(s)!==null&&(e.removeItem(s),r.push(s))}catch{}try{e.setItem(PN,t)}catch{}return r}const zA="agent-dag.recapsDismissed",DN=200;function Zq(){const e=et(zA);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let Jo=new Set(Zq());const Qv=new Set;let HA=0;function WA(e){return Qv.add(e),()=>{Qv.delete(e)}}function VA(e){Jo=e,HA++;const t=Array.from(e);Ye(zA,JSON.stringify(t.length>DN?t.slice(-DN):t));for(const n of Qv)n()}function GA(e,t){return`${e}@${t}`}function Jq(e){return Jo.has(e)}function Qq(e){if(Jo.has(e))return;const t=new Set(Jo);t.add(e),VA(t)}function e8(e){const t=new Set(Jo);t.delete(e)||t.add(e),VA(t)}function t8(e){return v.useSyncExternalStore(WA,()=>e!=null&&Jo.has(e),()=>!1)}function d0(e){return`recap:${e}`}function n8(e){return e.startsWith("recap:")}function r8(){return v.useSyncExternalStore(WA,()=>HA,()=>0)}function s8(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 s of n.tools)s.ok===!1&&(r.failed+=1)}return t}function KA(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 YA(e){return e.live>0?`→ ${e.total} · ${e.live} live`:`→ ${e.total} · done`}function a8(e,t,n){const r=e.kind==="root"?e.waiting:null;if(r&&lr(r))return{tone:"warn",long:n.sayWaiting(r),short:r.kind==="permission"?"Needs you":"Asked you"};if(r&&r.kind==="idle"){const i=n.sayWaiting(r);return{tone:"idle",long:i,short:i}}const s=e.tools.filter(i=>i.ok===!1).length;if(s>0)return{tone:"err",long:`${s} tool ${s===1?"call":"calls"} failed`,short:`${s} failed`};if(t&&t.total>0)return{tone:"muted",long:KA(t),short:YA(t)};if(e.state==="active")for(let i=e.tools.length-1;i>=0;i--){const l=e.tools[i];if(l.endedAt!=null)continue;const{name:u,subject:d}=n.describeCall(l);return{tone:"muted",long:d?`${u} · ${d}`:u,short:u}}return null}function ex(e){return e==="active"?"live":e==="done"?"done":"err"}const _d={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"}},o8=Object.fromEntries(Object.entries(_d).map(([e,t])=>[e,t.category])),i8=Object.fromEntries(Object.entries(_d).map(([e,t])=>[e,t.emoji])),l8=Object.fromEntries(Object.entries(_d).map(([e,t])=>[e,t.label])),c8=new Set(Object.entries(_d).filter(([,e])=>e.shell).map(([e])=>e)),u8={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",...o8};function XA(e){return e.startsWith("mcp__")?"mcp":$t(u8,e)??"other"}const d8=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,h8=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function f8(e){if(typeof e!="string"||!e)return null;const t=d8.exec(e);if(t){const r=p8(t[2]);if(r.trim())return r}const n=h8.exec(e);return n?n[1]:null}function p8(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
65
|
-
`:n==="r"?"\r":n==="t"?" ":n)}const m8={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:"📡",...i8};function FN(e){return e.startsWith("mcp__")?"🔌":$t(m8,e)??"✨"}const g8={git:"🐙",gh:"🐙",glab:"🐙",npm:"📦",pnpm:"📦",yarn:"📦",bun:"📦",brew:"🍺",node:"🟢",deno:"🟢",python:"🐍",python3:"🐍",py:"🐍",pip:"🐍",pip3:"🐍",uv:"🐍",ruby:"💎",bundle:"💎",gem:"💎",cargo:"🦀",rustc:"🦀",rustup:"🦀",go:"🐹",docker:"🐳","docker-compose":"🐳",podman:"🐳",kubectl:"☸️",helm:"☸️",k9s:"☸️",grep:"🔎",rg:"🔎",ag:"🔎",ack:"🔎",find:"🔍",fd:"🔍",locate:"🔍",which:"🔍",ls:"📂",dir:"📂",tree:"📂",cat:"📄",head:"📄",tail:"📄",less:"📄",more:"📄",bat:"📄",cp:"📋",mv:"✂️",rm:"🗑️",rmdir:"🗑️",mkdir:"📁",touch:"📁",sed:"✏️",awk:"✏️",tr:"✏️",curl:"🌐",wget:"🌐",http:"🌐",httpie:"🌐",ssh:"🔐",scp:"🔐",rsync:"🔐",ping:"📡",make:"🔨",cmake:"🔨",ninja:"🔨",bazel:"🔨",just:"🔨",terraform:"🏗️",ansible:"📕",pulumi:"🏗️",ps:"📊",top:"📊",htop:"📊",btm:"📊",kill:"💀",pkill:"💀",systemctl:"⚙️",service:"⚙️",tar:"🗜️",zip:"🗜️",unzip:"🗜️",gzip:"🗜️","7z":"🗜️",vim:"📝",nvim:"📝",nano:"📝",emacs:"📝",code:"📝",jq:"🪺",yq:"🪺",echo:"💬",printf:"💬",ffmpeg:"🎞️",ffprobe:"🎞️",imagemagick:"🖼️",convert:"🖼️","Get-ChildItem":"📂","Get-Content":"📄","Set-Content":"💾","Out-File":"💾","Add-Content":"💾","Set-Location":"📍","Get-Location":"📍","Get-Process":"📊","Start-Process":"▶️","Stop-Process":"💀","Invoke-WebRequest":"🌐","Invoke-RestMethod":"🌐","New-Item":"📁","Remove-Item":"🗑️","Copy-Item":"📋","Move-Item":"✂️","Test-Path":"🔍","Where-Object":"🔎","ForEach-Object":"🔁","Select-Object":"🎯","Measure-Object":"📊","Get-Service":"⚙️","Restart-Service":"⚙️","ConvertTo-Json":"🪺","ConvertFrom-Json":"🪺"};function ZA(e){if(!e)return null;let t=e.trim();if(!t)return null;const n=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(n)return ZA(n[1]);for(;;){const i=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!i)break;t=t.slice(i[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 s=r[1];return/^[A-Za-z0-9_][\w.+-]*$/.test(s.replace(/^.*[/\\]/,""))?(s=s.replace(/^.*[/\\]/,""),s=s.replace(/\.(exe|cmd|bat|ps1)$/i,""),s||null):null}function y8(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=f8(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(s=>/^(-Command|-c)$/i.test(s));if(r>=0&&r+1<n.length)return n[r+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const w8=new Set(["Bash","PowerShell",...c8]);function v8(e,t){if(!w8.has(e))return null;const n=y8(t);if(!n)return null;const r=ZA(n);return r?{emoji:$t(g8,r)??"⚙️",label:r,category:"shell",detail:n}:null}const x8=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),b8={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:"🗄️"},k8={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 N8(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),r=n.lastIndexOf("/");return r>=0?n.slice(r+1):n}function j8(e){const t=e.toLowerCase(),n=$t(k8,t);if(n!==void 0)return n;if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const r=t.lastIndexOf(".");if(r>0&&r<t.length-1){const s=$t(b8,t.slice(r+1));if(s!==void 0)return s}return"📄"}function S8(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 _8(e,t){if(!x8.has(e))return null;const n=S8(e,t);if(!n)return null;const r=N8(n);return r?{emoji:e==="LS"?"📂":j8(r),label:r,category:"file",detail:n}:null}const E8={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 h0(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 C8(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 JA(e){return $t(E8,e.toLowerCase())}function T8(e,t){const n=h0(e);if(!n)return null;const{server:r,method:s}=n;if(!s)return null;const i=JA(r);return{emoji:(i==null?void 0:i.emoji)??"🔌",label:s,category:"mcp",detail:i?`${i.name} · ${s}`:`${r} · ${s}`}}function QA(e,t){return v8(e,t)??_8(e,t)??T8(e)}function R8(e,t){var n;return((n=QA(e,t))==null?void 0:n.label)??null}const A8=l8,qN=18;function hu(e){const t=[...e];return t.length<=qN?e:t.slice(0,qN-1).join("")+"…"}const Qf=13,M8=6;function $8(e,t){const n=[...e];if(n.length<=Qf)return e;const r=n.lastIndexOf("."),s=r>0?n.slice(r):[];return t==="file"&&s.length>1&&s.length<=M8?n.slice(0,Qf-1-s.length).join("")+"…"+s.join(""):n.slice(0,Qf-1).join("")+"…"}function f0(e){const t=h0(e);if(t){const r=JA(t.server);return r?{emoji:r.emoji,label:hu(r.name)}:{emoji:"🔌",label:hu(t.server),hue:C8(t.server)}}const n=$t(A8,e)??"";return n?{emoji:FN(e),label:hu(n)}:{emoji:FN(e),label:hu(e)}}function I8(e){let t=null,n="";for(const r of e){const s=h0(r);if(s){if(!s.server)return null;if(t===null)t=s.server,n=r;else if(s.server!==t)return null}}return t===null?null:f0(n)}const tx=6e4,Uo=24,BN=tx/Uo,ep=132,Au=14;function O8(e,t,n){const r=new Array(Uo).fill(0);let s=0;const i=g=>{const w=n-g;if(w<0||w>=tx)return;const b=Uo-1-Math.floor(w/BN);b>=0&&b<Uo&&(r[b]+=1,s+=1)};for(const g of e)i(g.startedAt);for(const g of t??[])i(g);const u=Math.max(0,...r)/(BN/1e3),d=e.filter(g=>n-g.startedAt>=0&&n-g.startedAt<tx).length,f=s-d,h=[d>0?`${d} tool ${d===1?"call":"calls"}`:"",f>0?`${f} ${f===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),m=s===0?"nothing in the last 60s":`${h.join(" · ")} in last 60s · peak ${u.toFixed(1)}/s`;return{counts:r,title:m}}const L8=2;function P8(e){return e===0?1.5:Math.max(1.5,Math.min(1,e/L8)*Au)}function eM({kind:e}){return a.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"&&a.jsx("circle",{cx:"5",cy:"5",r:"3.2",fill:"currentColor"}),e==="done"&&a.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"&&a.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 p0(){return a.jsxs("svg",{className:"alert-mark",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",focusable:"false",children:[a.jsx("path",{d:"M6 1.4l4.7 8.3H1.3z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",fill:"none"}),a.jsx("path",{d:"M6 4.6v2.4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),a.jsx("circle",{cx:"6",cy:"8.35",r:"0.72",fill:"currentColor"})]})}function Sl(){return a.jsxs("svg",{className:"recap-glyph",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[a.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"}),a.jsx("circle",{cx:"6",cy:"1.2",r:"1.05",fill:"currentColor"}),a.jsx("circle",{cx:"6",cy:"10.8",r:"1.05",fill:"currentColor"}),a.jsx("circle",{cx:"1.2",cy:"6",r:"1.05",fill:"currentColor"}),a.jsx("circle",{cx:"10.8",cy:"6",r:"1.05",fill:"currentColor"})]})}function D8({data:e,selected:t}){var j,S;const n=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),r=e.tools.filter(_=>!_.endedAt).length,s=e.tools.filter(_=>_.ok===!1).length,i=Yu(e.sessionId),l=((j=e.context)==null?void 0:j.currentContextTokens)??0,u=e.kind==="root"&&l>0,d=e.sessionTitle?e.cwd?`${e.cwd}
|
|
66
|
-
${e.sessionTitle}`:e.sessionTitle:e.cwd,f=PA(e),h=f.length>0?`${e.model}
|
|
67
|
-
spend on this card also covers:
|
|
68
|
-
${f.join(`
|
|
69
|
-
`)}`:e.model,m=c0(e.sessionName,e.sessionTitle),g=Sd(e),w=g?GA(e.sessionId,g.at):null,b=t8(w),x=g!=null&&!b,k=iq(e);return a.jsxs("div",{className:n,style:{"--session-hue":i},children:[a.jsx("span",{className:"accent-stripe"}),a.jsx(Oa,{type:"target",position:Ce.Left,style:{background:"transparent",border:"none"}}),a.jsxs("div",{className:"head",children:[a.jsxs("div",{className:"title",children:[a.jsx(U8,{state:e.state}),a.jsx("span",{className:"label",title:d,children:e.label}),e.synthetic&&a.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"}),g&&w&&a.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":"Claude Code's recap","aria-expanded":x,title:x?"Hide the recap":"Show Claude Code's recap",onClick:_=>{_.stopPropagation(),e8(w)},children:a.jsx(Sl,{})})]}),a.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&a.jsx(Wq,{currentContextTokens:l,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),a.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?"≥ ":"",a.jsx(B8,{start:e.startedAt,end:e.endedAt})]})]})]}),a.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&a.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?a.jsxs("span",{className:"model-chip","data-family":bd(e.model),title:h,children:[Hs(e.model),f.length>0?` +${f.length}`:""]}):e.provider==="codex"?a.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&m.face&&a.jsx("div",{className:"session-name",title:m.tooltip,children:m.face}),e.waiting&&a.jsx(z8,{waiting:e.waiting}),(()=>{const _=uq(e);return _?a.jsxs("div",{className:"approval-blind-row",title:_.detail,children:[a.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),a.jsx("span",{className:"approval-blind-said",children:_.label})]}):null})(),(e.tools.length>0||(((S=e.outputs)==null?void 0:S.length)??0)>0)&&a.jsx(H8,{tools:e.tools,outputs:e.outputs}),a.jsxs("div",{className:"meta",children:[a.jsxs("span",{children:[a.jsx("b",{children:e.toolCount})," tools"]}),s>0&&a.jsxs("span",{className:"failed-meta",title:`${s} tool ${s===1?"call":"calls"} returned an error`,children:[a.jsx("b",{children:s})," err"]}),r>0&&a.jsxs("span",{className:"inflight-meta",children:[a.jsx("b",{children:r})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&a.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:[a.jsx("b",{children:st(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),(k==null?void 0:k.kind)==="unpriced"&&a.jsx("span",{className:"cost-unpriced",title:k.tt,children:es}),(k==null?void 0:k.kind)==="spent"&&a.jsx("span",{className:"cost-meta",title:k.tt,children:a.jsxs("b",{children:[qe(k.total),k.floor?"+":""]})})]}),a.jsx(q8,{data:e,title:e.kind==="root"?m.face:void 0}),a.jsx(Oa,{type:"source",position:Ce.Right,style:{background:"transparent",border:"none"}})]})}const F8=v.memo(D8);function q8({data:e,title:t}){const n=e.kind==="root"&&lr(e.waiting),r=a8(e,e.branch,{sayWaiting:l0,describeCall:s=>({name:f0(s.name).label,subject:R8(s.name,s.input)})});return a.jsxs("div",{className:"lod-face","data-kind":e.kind,"data-alarm":n?"":void 0,"data-signal":r?"":void 0,"aria-hidden":!0,children:[a.jsxs("div",{className:"lod-id",children:[a.jsx(eM,{kind:ex(e.state)}),a.jsx("span",{className:"lod-name",children:e.label}),r&&a.jsx("span",{className:"lod-inline","data-tone":r.tone,children:r.short}),n&&a.jsx(p0,{})]}),t&&a.jsx("div",{className:"lod-title",children:t}),r&&a.jsxs("div",{className:"lod-signal","data-tone":r.tone,children:[a.jsx("span",{className:"lod-long",children:r.long}),a.jsx("span",{className:"lod-short",children:r.short})]})]})}function B8({start:e,end:t}){const n=li(1e3);return a.jsx(a.Fragment,{children:Zo(e,t,n)})}function U8({state:e}){return a.jsx("span",{className:`state-pill state-${e}`,children:Yo(e)})}function z8({waiting:e}){const t=li(1e3),n=lr(e),r=Xo(e);return a.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${r}
|
|
70
|
-
Blocked for ${Zo(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?a.jsx("span",{className:"ap-pulse","aria-hidden":!0}):a.jsx("span",{className:"waiting-dot","aria-hidden":!0}),a.jsx("span",{className:"waiting-said",children:l0(e)}),a.jsx("b",{children:Zo(e.since,void 0,t)})]})}function H8({tools:e,outputs:t}){const n=li(1e3),{counts:r,title:s}=O8(e,t,n),i=ep/Uo;return a.jsxs("div",{className:"tool-spark-row",title:s,children:[a.jsx("svg",{className:"tool-spark",width:ep,height:Au,viewBox:`0 0 ${ep} ${Au}`,"aria-hidden":!0,children:r.map((l,u)=>{const d=P8(l),f=u===Uo-1&&l>0,m=`tool-spark-bar${l>0?" active":""}${f?" latest":""}`;return a.jsx("rect",{x:u*i+.4,y:Au-d,width:Math.max(.5,i-1),height:d,rx:.8,className:m},f?`landed:${l}`:u)})}),a.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function W8({enableAutoFitAndRefit:e}){return a.jsxs("div",{className:"autofit-chip",children:[a.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),a.jsx("button",{type:"button",className:"autofit-resume",onClick:e,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]})}function Xu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const UN=99;function V8(e){const t=Math.max(0,Math.floor(e));return t>UN?`${UN}+`:String(t)}const G8="Pause the canvas";function K8(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 — ${Xu(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)":`${Xu(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function Y8(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 tM="paused · full",X8=(e,t)=>t>0?tM:e>0?`paused · ${V8(e)}`:"paused";function Z8(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:X8(e.held,t),widest:tM,title:t>0?`Connected — the pause is full at ${Xu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Xu(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 J8=e=>e.transform[2]>=e.maxZoom,Q8=e=>e.transform[2]<=e.minZoom;function eB({autoFitDisabled:e,enableAutoFitAndRefit:t,paused:n,pauseGate:r,togglePause:s,handleRelayout:i,requestClear:l,setKeyHelpOpen:u}){const d=si(),f=We(J8),h=We(Q8);return a.jsxs(LF,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[a.jsx(Mn,{onClick:()=>d.zoomIn(),title:"Zoom in","aria-label":"Zoom in",disabled:f,children:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:a.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),a.jsx(Mn,{onClick:()=>d.zoomOut(),title:"Zoom out","aria-label":"Zoom out",disabled:h,children:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:a.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),a.jsx(Mn,{onClick:t,title:e?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":e?"":void 0,children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[a.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),a.jsx(Mn,{"data-group-start":"",onClick:s,title:K8({paused:n,held:r.size,dropped:r.dropped}),"aria-label":G8,"aria-pressed":n,children:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:a.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),a.jsx(Mn,{onClick:i,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[a.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),a.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),a.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),a.jsx(Mn,{"data-group-start":"","data-danger":"",onClick:()=>l("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[a.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),a.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"}),a.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"}),a.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),a.jsx(Mn,{"data-group-start":"",onClick:()=>u(m=>!m),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[a.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"}),a.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]})}const Ra=148,zN=6e3,tB=16e3,nM=46,qs=34;function nB(e,t,n=Ra){let r=-Math.round(t()*n);if(Math.abs(r-e)<qs){const s=e-qs>=-n?-qs:qs;r=Math.max(-n,Math.min(0,Math.round(e+s)))}return{to:r,ms:Math.round(Math.abs(r-e)*nM)}}function rB(e){return Math.round(zN+e()*(tB-zN))}const HN=[{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 sB(e){const t=HN.reduce((r,s)=>r+s.weight,0);let n=e()*t;for(const r of HN)if(n-=r.weight,n<0)return r.kind;return"stroll"}const aB=720,oB=260,iB=620,lB=220,WN=520,rM=1600,VN=7e3,cB=15e3,GN=6e3,uB=14e3;function So(e,t,n=Ra){let r=-Math.round(t()*n);if(Math.abs(r-e)<qs){const s=e-qs>=-n?-qs:qs;r=Math.max(-n,Math.min(0,Math.round(e+s)))}return r}const Ct=(e,t)=>Math.round(Math.abs(t-e)*nM),dB=120,fu=0;function hB(e,t){const n=r=>({kind:"litter",at:t,...r});return[{x:t,prop:n({}),act:"walk",ms:Ct(e,t)},{x:t,prop:n({}),act:"stoop",ms:aB},{x:fu,prop:n({held:!0}),act:"carry",ms:Ct(t,fu)},{x:fu,prop:n({held:!0}),act:"windup",ms:oB},{x:fu,prop:n({held:!0,leaving:!0}),act:"toss",ms:iB}]}function fB(e,t){const n=t>e?1:-1,r=t-n*Math.min(15,Math.abs(t-e)),s=(i={})=>({kind:"ball",at:t,...i});return[{x:r,prop:s(),act:"walk",ms:Ct(e,r)},{x:r,prop:s(),act:"windup",ms:lB,facing:n>0?"right":"left"},{x:r,prop:s({leaving:!0}),act:"kick",ms:WN,facing:n>0?"right":"left"},{x:r,prop:s({leaving:!0}),act:"stand",ms:rM-WN}]}const sM=640;function pB(e,t,n){const r=Math.max(-70,Math.min(-20,t)),s={x:r,prop:null,facing:"left"};return[{x:r,prop:null,act:"walk",ms:Ct(e,r)},{...s,act:"sit",ms:600},{...s,act:"cast",ms:900},{...s,act:"fish",ms:6e3+Math.round(n()*4e3)},{...s,act:"reel",ms:1200},{...s,act:"stow",ms:500},{...s,act:"stand",ms:400},{x:0,prop:null,act:"walk",ms:Ct(r,0)}]}function mB(e,t,n){const r=Math.max(-110,Math.min(-30,t)),s={x:r,prop:null};return[{...s,act:"walk",ms:Ct(e,r)},{...s,act:"skip-ready",ms:500},{...s,act:"skip",ms:sM*(6+Math.floor(n()*5))},{...s,act:"skip-rest",ms:600},{...s,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:Ct(r,0)}]}function gB(e,t,n){return[{x:t,prop:null,act:"walk",ms:Ct(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(GN+n()*(uB-GN))},{x:t,prop:null,act:"stand",ms:400}]}function yB(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:Ct(e,t)},{x:t,prop:r(),act:"watch",ms:Math.round(VN+n()*(cB-VN))},{x:t,prop:r(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function tp(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 wB=1500,vB=e=>Math.round(1e3*Math.sqrt(2*e/wB)),xB=115,bB=e=>Math.round(e/xB*1e3),kB=620,NB=200,jB=760,SB=600,_B=240;function EB(e,t,n){const s=-(t.ledgeSpan??Ra),i=vB(t.ledgeH),l=bB(t.ledgeH),u=n(),d=n(),f=-Math.round(u*t.floorSpan),h=-Math.round(d*t.floorSpan);return[{x:s,act:"walk",prop:null,ms:Ct(e,s)},{x:s,act:"peer",prop:null,ms:kB},{x:s,act:"fall",prop:null,ms:i,place:"floor"},{x:s,act:"land",prop:null,ms:NB,place:"floor"},{x:f,act:"walk",prop:null,ms:Ct(s,f),place:"floor",floorFrac:u},{x:h,act:"walk",prop:null,ms:Ct(f,h),place:"floor",floorFrac:d},{x:s,act:"walk",prop:null,ms:Ct(h,s),place:"floor"},{x:s,act:"lasso",prop:null,ms:jB,place:"floor"},{x:s,act:"rope-throw",prop:null,ms:SB,place:"floor"},{x:s,act:"rope-catch",prop:null,ms:_B,place:"floor"},{x:s,act:"climb",prop:null,ms:l},{x:s,act:"pull-up",prop:null,ms:480}]}function CB(e,t,n){const r=(n==null?void 0:n.ledgeSpan)??Ra;switch(sB(t)){case"tidy":return hB(e,So(e,t,r));case"kick":return fB(e,So(e,t,r));case"sit":return gB(e,So(e,t,r),t);case"watch":return yB(e,So(e,t,r),t);case"fish":return pB(e,So(e,t,r),t);case"skip":return mB(e,So(e,t,r),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return EB(e,n,t)}}const i=nB(e,t,r);return[{x:i.to,prop:null,act:"walk",ms:i.ms}]}const TB=420;function RB(e,t,n){const r=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(TB,Math.max(0,r))}const AB=260,MB=200;function $B(e,t,n){const r=(h,m=Ct(e,h))=>({x:h,prop:null,act:"walk",ms:m,place:"floor"});if(!n||n.height<=0)return[r(t)];const s=Math.min(e,t);if(Math.max(e,t)<=n.left||s>=n.right)return[r(t)];const l=t>e,u=l?n.left:n.right,d=l?n.right:n.left,f={place:"floor",riser:n.height,prop:null};return[r(u,Ct(e,u)),{...f,x:u,act:"mount",ms:AB},{...f,x:d,act:"walk",ms:Ct(u,d)},{x:d,prop:null,act:"dismount",ms:MB,place:"floor"},{x:t,prop:null,act:"walk",ms:Ct(d,t),place:"floor"}]}const aM=["bob","sway","groove"],KN=9e3,IB=16e3,oM=1e3,OB=.08;function LB(e,t){const n=aM.filter(i=>i!==e),r=n[Math.min(n.length-1,Math.floor(t()*n.length))],s=(t()*2-1)*OB;return{dance:r,beatMs:Math.round(oM*(1+s))}}function PB(e){return Math.round(KN+e()*(IB-KN))}const iM=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],YN=18,DB=iM.length,lM=new Set(["a","c","p"]);function Ed(e=iM){const t=[];return e.forEach((n,r)=>{let s=0;for(;s<n.length;){const i=n[s];if(i==="."){s+=1;continue}let l=1;for(;s+l<n.length&&n[s+l]===i;)l+=1;t.push({x:s,y:r,w:l,cell:i}),s+=l}}),t}const FB=[".xx.","xxxx",".xx."],qB=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],BB=["...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."],np={litter:FB,ball:qB,scope:BB},UB=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],zB=3,HB=-1,nx=11,XN=9,rx="https://www.youtube-nocookie.com";function WB(e,t,n){const r=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${rx}/embed/${n?encodeURIComponent(n):"live_stream"}?${r.toString()}`}function _o(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function VB(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const GB=[1,3],KB=[0,2],YB=[2,5,100,101,150];function XB(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 s=typeof r=="number"?r:Number(r==null?void 0:r.errorCode);return Number.isFinite(s)?{kind:"error",code:s}:null}if(n==="onStateChange"||n==="infoDelivery"){const s=typeof r=="number"?r:r==null?void 0:r.playerState;return typeof s!="number"||!Number.isFinite(s)?null:GB.includes(s)?{kind:"playing",playing:!0}:KB.includes(s)?{kind:"playing",playing:!1}:null}return null}const ZB="modulepreload",JB=function(e){return"/"+e},ZN={},m0=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.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]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=l(n.map(f=>{if(f=JB(f),f in ZN)return;ZN[f]=!0;const h=f.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const g=document.createElement("link");if(g.rel=h?"stylesheet":ZB,h||(g.as="script"),g.crossOrigin="",g.href=f,d&&g.setAttribute("nonce",d),document.head.appendChild(g),h)return new Promise((w,b)=>{g.addEventListener("load",w),g.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return s.then(l=>{for(const u of l||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})},QB={"claude-fm":null,"lofi-relax":null,"lofi-game":null,"lofi-vibe":null,"lofi-sleep":null,"radio-mix":"/api/live-radio-mix","best-of-nostalgia":"/api/best-of-nostalgia","good-life-radio":"/api/good-life-radio","cafe-music-bgm":"/api/cafe-music-bgm"};function eU({fetchImpl:e,volume:t,muted:n,source:r,playRequest:s,customStation:i,onAvailabilityChange:l}){const[u,d]=v.useState(null),[f,h]=v.useState(!1),[m,g]=v.useState(!1),[w,b]=v.useState(!1),x=v.useRef(s),k=v.useRef(null),j=v.useRef(null),S=v.useRef(null),_=v.useCallback(()=>{var I;(I=j.current)==null||I.destroy(),j.current=null;const $=k.current;$&&($.pause(),$.removeAttribute("src"),$.load(),k.current=null)},[]),E=v.useCallback($=>{var I,D;(D=(I=S.current)==null?void 0:I.contentWindow)==null||D.postMessage($,rx)},[]),T=v.useRef(t);T.current=t;const R=v.useRef(n);R.current=n;const A=v.useCallback(($,I,D)=>{_();const F=new Audio;F.preload="none",F.volume=T.current/100,F.muted=R.current,k.current=F,g(!0),b(!0);const W=()=>k.current===F,M=()=>{_(),g(!1),b(!1)},O=()=>{W()&&(M(),h(!0),l==null||l(D,!0))},L=K=>{if(W()){if(K instanceof DOMException&&K.name==="NotAllowedError"){M();return}O()}};F.addEventListener("playing",()=>{W()&&(b(!0),l==null||l(D,!1))}),F.addEventListener("ended",()=>{W()&&M()}),F.addEventListener("error",O,{once:!0}),I&&!F.canPlayType("application/vnd.apple.mpegurl")?m0(async()=>{const{default:K}=await import("./hls-BFpXDghs.js");return{default:K}},[]).then(({default:K})=>{if(!W())return;if(!K.isSupported()){O();return}const Z=new K;j.current=Z,Z.on(K.Events.ERROR,(q,H)=>{H.fatal&&O()}),Z.on(K.Events.MEDIA_ATTACHED,()=>Z.loadSource($)),Z.on(K.Events.MANIFEST_PARSED,()=>{F.play().catch(L)}),Z.attachMedia(F)},O):(F.src=$,F.play().catch(L))},[l,_]);return v.useEffect(()=>{m&&(E(_o("setVolume",[t])),E(_o(n?"mute":"unMute")),k.current&&(k.current.volume=t/100,k.current.muted=n))},[t,n,m,E]),v.useEffect(()=>{let $=!0;const I=e??fetch,D=x.current!==s;x.current=s,d(null),h(!1),g(D),b(D),_();const F=i&&La(i.id)===r?n0(i.url):null;if(F)return F.kind==="direct-audio"?(d({live:!0,channel:"",audio:F.url,hls:F.format==="hls"}),l==null||l(r,!1),D&&A(F.url,F.format==="hls",r),()=>{$=!1}):(I(`/api/fm-station?url=${encodeURIComponent(F.url)}`).then(O=>O.ok?O.json():null).then(O=>{$&&(O!=null&&O.channel||O!=null&&O.video?(d({live:!0,channel:O.channel??"",video:O.video??void 0}),l==null||l(r,!1)):(h(!0),l==null||l(r,!0)))}).catch(()=>{$&&(h(!0),l==null||l(r,!0))}),()=>{$=!1});if(Ko(r))return h(!0),l==null||l(r,!0),()=>{$=!1};const W=r,M=QB[W];if(M)I(M).then(O=>O.ok?O.json():null).then(O=>{$&&(O!=null&&O.video&&d({live:!0,channel:"",video:O.video}),l==null||l(r,!(O!=null&&O.video)))}).catch(()=>{$&&(l==null||l(r,!0))});else if(W!=="claude-fm"){const O=W.replace("lofi-","");I(`/api/lofi-girl?station=${encodeURIComponent(O)}`).then(L=>L.ok?L.json():null).then(L=>{$&&(L!=null&&L.video&&d({live:!0,channel:"",video:L.video}),l==null||l(r,!(L!=null&&L.video)))}).catch(()=>{$&&(l==null||l(r,!0))})}else I("/api/claude-fm").then(O=>O.ok?O.json():null).then(O=>{if(!$)return;const L=!!(O!=null&&O.live&&(O!=null&&O.channel));L&&d({live:!0,channel:O.channel}),l==null||l(r,!L)}).catch(()=>{$&&(l==null||l(r,!0))});return()=>{$=!1}},[i==null?void 0:i.id,i==null?void 0:i.url,e,l,s,r,A,_]),v.useEffect(()=>()=>_(),[_]),v.useEffect(()=>{if(!m)return;const $=I=>{var F;if(I.origin!==rx||I.source!==((F=S.current)==null?void 0:F.contentWindow))return;const D=XB(I.data);if(D){if(D.kind==="ready"){E(_o("setVolume",[T.current])),E(_o(n?"mute":"unMute")),E(_o("playVideo"));return}if(D.kind==="playing"){b(D.playing);return}YB.includes(D.code)&&(g(!1),b(!1),h(!0),l==null||l(r,!0))}};return window.addEventListener("message",$),()=>window.removeEventListener("message",$)},[m,n,l,E,r]),{probe:u,dead:f,armed:m,playing:w,frame:S,say:E,press:()=>{if(!u)return;if(u.audio){if(m){_(),g(!1),b(!1);return}A(u.audio,u.hls===!0,r);return}if(!m){g(!0),b(!0);return}const $=!w;b($),E(_o($?"playVideo":"pauseVideo")),$||g(!1)}}}function JN(e){let t=null,n=null,r=0,s=0,i=!1;const l=()=>{t!==null&&clearTimeout(t),t=null},u=()=>{i||e.hidden||!n||t!==null||(s=performance.now(),t=setTimeout(()=>{t=null;const f=n;n=null,f==null||f()},r))},d=()=>{e.hidden&&t!==null?(r=Math.max(0,r-(performance.now()-s)),l()):e.hidden||u()};return e.addEventListener("visibilitychange",d),{schedule(f,h){i||(l(),n=f,r=Math.max(0,h),u())},dispose(){i=!0,l(),n=null,e.removeEventListener("visibilitychange",d)}}}function tU(e,t,n){const[r,s]=v.useState(0),[i,l]=v.useState(0),[u,d]=v.useState(null),[f,h]=v.useState(null),[m,g]=v.useState({x:0,drop:0}),[w,b]=v.useState("ledge"),[x,k]=v.useState("left"),[j,S]=v.useState(0),_=v.useRef(null),[E,T]=v.useState(()=>document.hidden);v.useEffect(()=>{const F=new Set,W=()=>{var M;if(document.hidden){for(const O of((M=_.current)==null?void 0:M.getAnimations({subtree:!0}))??[])if(O.playState==="running"||O.pending){const L=O.currentTime;O.pause(),L!==null&&(O.currentTime=L),F.add(O)}}else{for(const O of F)O.playState==="paused"&&O.play();F.clear()}T(document.hidden)};return W(),document.addEventListener("visibilitychange",W),()=>document.removeEventListener("visibilitychange",W)},[e,t]);const[R,A]=v.useState(null),[B,$]=v.useState(oM),[I,D]=v.useState(()=>{var F;return((F=window.matchMedia)==null?void 0:F.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});return v.useEffect(()=>{var M;const F=(M=window.matchMedia)==null?void 0:M.call(window,"(prefers-reduced-motion: reduce)");if(!F)return;const W=()=>D(F.matches);return W(),F.addEventListener("change",W),()=>F.removeEventListener("change",W)},[]),v.useEffect(()=>{var V;if(!e||t||I)return;const F=JN(document);let W=0;s(J=>W=J);let M=null,O=0,L=0;const K=J=>{var Ne,we;const[ee,...re]=J;if(!ee){M=null,d(null),h(null),G();return}d(ee.act),h(ee.prop),b(ee.place??"ledge"),S(ee.riser??0);const oe=W,fe=P(ee);if(ee.act==="kick"){const ye=(we=(Ne=_.current)==null?void 0:Ne.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:we.getBoundingClientRect();ye&&g({x:RB(ye.x,tp(ee,oe,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-ye.y+24)})}L=ee.act==="walk"?Math.max(Ct(oe,fe),dB):ee.ms,ee.act==="carry"&&(L=Ct(oe,fe)),l(L),k(ye=>tp({...ee,x:fe},oe,ye)),s(fe),W=fe,M=ee,O=Date.now(),F.schedule(()=>K(re),L)},Z=()=>{const J=_.current,ee=J==null?void 0:J.querySelector(".fm-sprite"),re=J==null?void 0:J.parentElement;if(!J||!ee||!re)return null;const oe=J.getBoundingClientRect(),fe=re.getBoundingClientRect(),Ne=fe.right-oe.right,we=fe.width-Ne*2-ee.offsetWidth;return we>0?we:null},q=()=>{const J=_.current,ee=J==null?void 0:J.querySelector(".fm-walker"),re=Z();if(!J||!ee||re==null)return;const oe=J.getBoundingClientRect().bottom-ee.getBoundingClientRect().bottom;if(oe>0)return{ledgeH:oe,floorSpan:re}},H=()=>{const J=_.current,ee=document.querySelector(".autofit-chip");if(!J||!ee)return null;const re=J.getBoundingClientRect(),oe=ee.getBoundingClientRect();return oe.width<=0||oe.height<=0?null:{left:oe.left-re.right,right:oe.right-re.right,height:oe.height}},P=J=>{const ee=(J.place??"ledge")==="floor",re=ee?Z()??Ra:Ra,oe=ee&&J.floorFrac!=null?-Math.round(J.floorFrac*re):J.x;return Math.max(-re,Math.min(0,oe))},Y=()=>{if(!M)return;const J=P(M);J!==W&&(l(Math.max(0,O+L-Date.now())),k(ee=>tp({...M,x:J},W,ee)),s(J),W=J)},G=()=>{F.schedule(()=>{const J=CB(W,Math.random,q()),ee=J.some(fe=>fe.place==="floor")?H():null;let re=W;const oe=J.flatMap(fe=>{const Ne=re;if(re=fe.x,!(fe.place==="floor"&&fe.act==="walk"))return[fe];const we=$B(Ne,fe.x,ee),ye=we.length-1;return fe.floorFrac==null?we:we.map((ve,Ie)=>Ie===ye?{...ve,floorFrac:fe.floorFrac}:ve)});K(oe)},rB(Math.random))},z=(V=_.current)==null?void 0:V.parentElement,X=typeof ResizeObserver>"u"?null:new ResizeObserver(Y);return z&&X&&X.observe(z),G(),()=>{F.dispose(),X==null||X.disconnect(),b("ledge"),s(J=>Math.max(-Ra,Math.min(0,J))),l(0),d(null),h(null),S(0)}},[e,t,I]),v.useEffect(()=>{if(!n||I){A(null);return}const F=JN(document),W=M=>{const O=LB(M,Math.random);A(O.dance),$(O.beatMs),F.schedule(()=>W(O.dance),PB(Math.random))};return W(null),()=>F.dispose()},[n,I]),{scene:_,suspended:E,x:r,walkMs:i,act:u,prop:f,ballFlight:m,place:w,facing:x,riser:j,dance:R,beatMs:B}}const rp={e:"fm-eye",s:"fm-shade",p:"fm-pad"},Zu=Ed().filter(e=>!lM.has(e.cell)),nU=Ed().filter(e=>lM.has(e.cell)),QN=Zu.filter(e=>e.cell==="e"),rU=Ed(UB),sU=Zu.filter(e=>e.y<nx&&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),aU={left:Zu.filter(e=>e.y>=nx&&e.x<XN),right:Zu.filter(e=>e.y>=nx&&e.x>=XN)},oU=v.memo(function({act:t,facing:n}){return a.jsxs("svg",{viewBox:`0 0 ${YN} ${DB}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[a.jsx("g",{className:"fm-gear",children:a.jsx("g",{className:"fm-gear-motion",children:nU.map(r=>a.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,className:rp[r.cell]},`g${r.y}-${r.x}`))})}),a.jsxs("g",{className:"fm-body",children:[QN.map(r=>a.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:"var(--accent)"},`eye-bed-${r.x}`)),sU.map(r=>a.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,className:rp[r.cell]},`b${r.y}-${r.x}`)),a.jsxs("g",{className:"fm-arms",children:[a.jsx("rect",{x:4,y:8,width:2,height:2}),a.jsx("rect",{x:12,y:8,width:1,height:2}),a.jsx("rect",{x:13,y:8,width:1,height:2,className:"fm-shade"})]}),QN.map(r=>a.jsx("rect",{x:r.x-(r.x>=YN/2?1:0)+(n==="right"?1:0),y:r.y,width:r.w,height:1,className:"fm-eye"},`eye-${r.x}`))]}),a.jsx("g",{className:"fm-hat",children:rU.map(r=>a.jsx("rect",{x:zB+r.x,y:HB+r.y,width:r.w,height:1,className:r.cell==="k"?"fm-hatband":void 0},`h${r.y}-${r.x}`))}),(t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up")&&a.jsxs("g",{className:"fm-grip",children:[a.jsx("path",{className:"fm-grip-left",d:"M5 9H4V4H7V3H9V5H6V9Z"}),a.jsx("path",{className:"fm-grip-right",d:"M12 9H14V6H11V5H9V7H12Z"})]}),(t==="land"||t==="dismount")&&a.jsxs("g",{className:"fm-crouch-legs",children:[a.jsx("path",{d:"M6 11H8V13H6Z"}),a.jsx("path",{d:"M10 11H12V13H10Z"})]}),["sit","cast","fish","reel","stow"].includes(t)&&a.jsxs("g",{className:"fm-seated-legs",children:[a.jsx("path",{className:"fm-seated-far",d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),a.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(r=>a.jsx("g",{className:"fm-leg","data-side":r,children:aU[r].map(s=>a.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,className:rp[s.cell]},`${r}${s.y}-${s.x}`))},r))]})}),iU={"claude-fm":"Claude FM","lofi-relax":"Lofi Girl relax/study","lofi-game":"Lofi Girl chill/game","lofi-vibe":"Lofi Girl vibe/chill","lofi-sleep":"Lofi Girl sleep/chill","radio-mix":"Radio Mix Live","best-of-nostalgia":"Best of Nostalgia Live","good-life-radio":"The Good Life Radio Live","cafe-music-bgm":"Cafe Music BGM Live"};function lU(e,t){return t&&La(t.id)===e?t.name:Ko(e)?"Custom FM":iU[e]}function sp(e,t){var r;const n=((r=e[0])==null?void 0:r.length)??0;return a.jsx("svg",{viewBox:`0 0 ${n} ${e.length}`,shapeRendering:"crispEdges","aria-hidden":!0,children:Ed(e).map(s=>a.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,fill:s.cell==="s"?"var(--fm-prop-shadow, var(--bg))":s.cell==="l"?"var(--fm-prop-light, var(--text))":s.cell==="a"?"var(--accent)":void 0},`${t}${s.y}-${s.x}`))})}const ej={litter:sp(np.litter,"litter"),ball:sp(np.ball,"ball"),scope:sp(np.scope,"scope")};function cU(e){try{return new URL(e).host}catch{return"the station's server"}}const uU=v.memo(function({fetchImpl:t,volume:n,muted:r=!1,source:s="claude-fm",playRequest:i=0,customStation:l,onAvailabilityChange:u}){const{probe:d,dead:f,armed:h,playing:m,frame:g,say:w,press:b}=eU({fetchImpl:t,volume:n,muted:r,source:s,playRequest:i,customStation:l,onAvailabilityChange:u}),{scene:x,suspended:k,x:j,walkMs:S,act:_,prop:E,ballFlight:T,place:R,facing:A,riser:B,dance:$,beatMs:I}=tU(d,f,m);if(!d||f)return null;const D=lU(s,l),F=d.audio?cU(d.audio):"YouTube";return a.jsxs("div",{ref:x,className:"fm","data-suspended":k?"":void 0,"data-place":R,style:{"--fm-beat":`${I}ms`},children:[E&&!E.held&&a.jsx("div",{className:"fm-prop","data-prop":E.kind,"data-leaving":E.leaving?"":void 0,style:{"--fm-prop-x":`${E.at}px`,"--fm-roll-to":`${T.x}px`,"--fm-ball-drop":`${T.drop}px`,"--fm-ball-flight-ms":`${rM}ms`,"--fm-ball-turn":A==="right"?"1080deg":"-1080deg"},children:ej[E.kind]}),(_==="lasso"||_==="rope-throw"||_==="rope-catch"||_==="climb"||_==="pull-up")&&a.jsxs("div",{className:"fm-rope","data-act":_,style:{"--fm-rope-x":`${j}px`,"--fm-rope-ms":`${S}ms`},children:[a.jsx("div",{className:"fm-rope-line"}),a.jsxs("svg",{className:"fm-rope-hook",viewBox:"0 0 9 9",shapeRendering:"crispEdges","aria-hidden":!0,children:[a.jsx("path",{d:"M4 8V3H3V1H1V3H0V5H2V4H3V6H5V4H6V5H8V3H7V1H5V3H4"}),a.jsx("rect",{className:"fm-rope-knot",x:"3",y:"6",width:"3",height:"2"})]})]}),a.jsxs("div",{className:"fm-walker","data-act":_??void 0,"data-place":R,"data-facing":A,style:{"--fm-x":`${j}px`,"--fm-walk-ms":`${S}ms`,"--fm-riser":`${B}px`,"--fm-skip-beat":`${sM}ms`},children:[(E==null?void 0:E.held)&&a.jsx("div",{className:"fm-held","data-prop":E.kind,"data-toss":E.leaving?"":void 0,children:ej[E.kind]}),["cast","fish","reel","stow"].includes(_)&&a.jsxs("svg",{className:"fm-fishing",viewBox:"0 0 24 32",shapeRendering:"crispEdges","aria-hidden":!0,children:[a.jsxs("g",{children:[a.jsx("path",{d:"M24 11H22V9H20V7H18V5H16V3H13V2H8"}),a.jsx("rect",{className:"fm-fishing-grip",x:"21",y:"9",width:"3",height:"3"})]}),a.jsxs("g",{className:"fm-fishing-line",children:[a.jsx("path",{d:"M8 2V26"}),a.jsxs("g",{className:"fm-float",children:[a.jsx("rect",{x:"7",y:"25",width:"3",height:"2"}),a.jsx("rect",{x:"8",y:"24",width:"1",height:"1"})]})]}),a.jsx("path",{className:"fm-ripple",d:"M3 28H6M10 28H14M5 30H12"})]}),["skip-ready","skip","skip-rest"].includes(_)&&a.jsxs("svg",{className:"fm-skipping-rope",viewBox:"0 0 26 26",shapeRendering:"crispEdges","aria-hidden":!0,children:[a.jsx("path",{className:"fm-skip-back",d:"M5 18H3V8H5V5H8V2H18V5H21V8H23V18H21"}),a.jsx("path",{className:"fm-skip-forward",d:"M5 18H3V14H5V11H8V9H18V11H21V14H23V18H21"}),a.jsx("path",{className:"fm-skip-front",d:"M5 18H3V21H5V23H8V25H18V23H21V21H23V18H21"}),a.jsx("path",{className:"fm-skip-return",d:"M5 18H3V19H8V20H18V19H23V18H21"}),a.jsx("path",{className:"fm-skip-handles",d:"M5 17V19M21 17V19"})]}),a.jsx("button",{type:"button",className:"fm-sprite","data-playing":m?"":void 0,"data-dance":m?$??aM[0]:void 0,onClick:b,title:m?`Stop ${D}`:`Play ${D} — streams from ${F}`,"aria-label":m?`Stop ${D}`:`Play ${D}`,children:a.jsx(oU,{act:_,facing:A})})]}),h&&!d.audio&&(d.channel||d.video)&&a.jsx("iframe",{ref:g,className:"fm-frame",title:D,src:WB(d.channel,window.location.origin,d.video),onLoad:()=>w(VB()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})]})});function cM(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 Ju(e){return cM(Math.floor(e/1e3))}function Cd(e,t){const n=e-t;if(n<=0)return null;const r=Math.floor(n/86400),s=Math.floor(n%86400/3600),i=Math.floor(n%3600/60);return r>0?`${r}d ${s}h`:s>0?`${s}h ${i}m`:`${i}m`}function dU(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Qu(e,t,n){const r=new Date(e),s=Ju(t-e);return{label:dU(r,new Date(t))?s:`${s} · ${r.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:r.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function hU({data:e}){const t=li(3e4),n=Qu(e.recap.at,t);return a.jsxs("div",{className:"recap-note",role:"note","aria-label":"Claude Code's recap",style:{"--session-hue":e.hue},children:[a.jsxs("div",{className:"recap-note-head",children:[a.jsxs("span",{className:"recap-note-mark",children:[a.jsx(Sl,{}),"recap"]}),a.jsx("span",{className:"recap-note-age",title:n.title,children:n.label}),a.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(),Qq(e.noteKey)},children:"×"})]}),a.jsx("p",{className:"recap-note-text",children:e.recap.text}),a.jsxs("div",{className:"lod-face recap-face","aria-hidden":!0,children:[a.jsxs("div",{className:"lod-id",children:[a.jsxs("span",{className:"recap-note-mark",children:[a.jsx(Sl,{}),"recap"]}),a.jsx("span",{className:"recap-face-age",children:n.label})]}),a.jsx("p",{className:"recap-face-text",children:e.recap.text})]}),a.jsx(Oa,{type:"source",position:Ce.Right,style:{background:"transparent",border:"none"}})]})}function fU({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s,targetPosition:i,style:l}){const[u]=Yx({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:.35});return a.jsxs("g",{className:"recap-tie",style:l,children:[a.jsx("path",{className:"recap-tie-thread",d:u}),a.jsx("path",{className:"recap-tie-beads",d:u}),a.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),a.jsx("circle",{className:"recap-tie-end",cx:n,cy:r,r:3.5})]})}const Mu=" · ",pU=32,mU=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function tj(e){return mU.test(e)?2:1}function nj(e,t=pU){const n=[...e];let r=0;for(const l of n)r+=tj(l);if(r<=t)return e;const s=[];let i=0;for(const l of n){const u=tj(l);if(i+u>t-1)break;s.push(l),i+=u}for(;s.length&&/[\s\-_.:/]/.test(s[s.length-1]);)s.pop();return`${s.join("")}…`}function gU(e,t,n,r){const s=(t==null?void 0:t.trim())??"",i=r?yU(n):void 0,l=[e,s||void 0,i].filter(Boolean);return{label:nj(e),name:s?nj(s):void 0,shortId:i,fullLabel:l.join(Mu)}}function yU(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}const Ea=18,sx=26,uM=12,wU=240;function vU(e,t){return(e+wU)*(t||1)}function xU(e,t){return{position:"absolute",left:0,top:0,transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,"--session-hue":t}}function bU(e,t,n){return{position:"absolute",left:e.x+16,top:e.y-uM/(t||1),transform:`scale(${1/(t||1)})`,transformOrigin:"left top",maxWidth:vU(e.w,t),"--session-hue":n}}function kU(e){const t=new Map;for(const s of e){if(s.type!=="agent"&&s.type!=="recapNote")continue;const i=s.data;if(!(i!=null&&i.sessionId)||i.exitAt!=null||s.width==null||s.height==null)continue;const l=s.position.x,u=s.position.y,d=l+s.width,f=u+s.height,h=t.get(i.sessionId),m=NU(i);h?(h.minX=Math.min(h.minX,l),h.minY=Math.min(h.minY,u),h.maxX=Math.max(h.maxX,d),h.maxY=Math.max(h.maxY,f),m&&(h.label=m.label??h.label,h.name=m.name,h.alarm=m.alarm,h.branch=m.branch)):t.set(i.sessionId,{minX:l,minY:u,maxX:d,maxY:f,label:(m==null?void 0:m.label)??i.sessionId,name:m==null?void 0:m.name,alarm:(m==null?void 0:m.alarm)??!1,branch:m==null?void 0:m.branch})}const n=new Map;for(const s of t.values())n.set(s.label,(n.get(s.label)??0)+1);const r=[];for(const[s,i]of t){const l=(n.get(i.label)??0)>1;r.push({sessionId:s,...gU(i.label,i.name,s,l),x:i.minX-Ea,y:i.minY-Ea-sx,w:i.maxX-i.minX+Ea*2,h:i.maxY-i.minY+Ea*2+sx,...i.alarm?{alarm:!0}:null,...i.branch?{branch:i.branch}:null})}return r}function NU(e){if(e.kind!=="root")return null;const t=e.branch;return{label:e.label,name:c0(e.sessionName,e.sessionTitle).face,alarm:lr(e.waiting),branch:t&&t.total>0?YA(t):void 0}}function jU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e[n],s=t[n];if(r.sessionId!==s.sessionId||r.label!==s.label||r.name!==s.name||r.shortId!==s.shortId||r.alarm!==s.alarm||r.branch!==s.branch||r.fullLabel!==s.fullLabel||r.x!==s.x||r.y!==s.y||r.w!==s.w||r.h!==s.h)return!1}return!0}function SU(e){return kU(e.nodeInternals.values())}function _U({onFocusSession:e}){const{x:t,y:n,zoom:r}=uA(),s=We(SU,jU);if(s.length<=1)return null;const i=u=>{try{e==null||e(u)}catch{}},l={transform:`translate(${t}px, ${n}px) scale(${r})`};return a.jsx("div",{className:"session-clusters",style:l,children:s.map(u=>{const d=Yu(u.sessionId),f=xU(u,d),h=bU(u,r,d);return a.jsxs(ce.Fragment,{children:[a.jsx("div",{className:"cluster-card",style:f,"aria-hidden":!0}),a.jsxs("button",{type:"button",className:"cluster-label","data-alarm":u.alarm?"":void 0,style:h,title:`${u.alarm?`Waiting on you
|
|
71
|
-
`:""}Zoom to ${u.fullLabel}
|
|
72
|
-
drag the wrapper to move the whole session`,onClick:()=>i(u.sessionId),children:[u.alarm?a.jsxs(a.Fragment,{children:[a.jsx(p0,{}),a.jsx("span",{className:"cluster-label-said",children:"waiting on you: "})]}):null,u.label,u.branch?a.jsx("span",{className:"cluster-label-branch",children:Mu+u.branch}):null,u.name?a.jsx("span",{className:"cluster-label-name",children:Mu+u.name}):null,u.shortId?a.jsx("span",{className:"cluster-label-id",children:Mu+u.shortId}):null]})]},u.sessionId)})})}function EU({data:e}){return a.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const dM=600,CU=4,TU=36,ax=16,RU=60,AU=6,rj=220,MU=96,$U=28;function IU(e,t){return Math.max(MU,61+[...t].length*6.8)}function OU(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function LU(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/dM)}function PU(e,t){const n=[],r=new Set;for(let s=e.length-1;s>=0&&n.length<t;s--){const i=e[s];r.has(i.id)||(r.add(i.id),n.push(i))}return n.reverse()}function DU(e,t,n,r,s,i){const l=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&i-u.exitAt>dM)continue;const d=r.get(u.id)??n.get(u.id);if(!d)continue;const f=PU(u.tools,CU);if(f.length===0)continue;const h=u.exitAt??null,m=s.get(u.id),g=Math.max((m==null?void 0:m.width)??rj,rj),w=(m==null?void 0:m.height)??130,b=d.x,x=d.y,k=b+g,j=x+w/2;f.forEach((S,_)=>{const E=_*TU,T=b+g+RU,R=x+AU+E,A=LU(i,h),B=S.inputPreview??"",$=OU(S),I=A<.999,D=f0(S.name);l.push({id:`${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:D.label,emoji:D.emoji,status:$,category:XA(S.name),mcpHue:D.hue,inputPreview:B,fade:A,fading:I,worldX:T,worldY:R,anchorX:k,anchorY:j,spawnDx:k-T,spawnDy:j-(R+ax)});const F=QA(S.name,S.input);if(F){const W=IU(S.name,D.label),M=T+W+$U,O=R,L=T+W,K=R+ax;l.push({id:`sub:${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:$8(F.label,F.category),fullName:F.label,emoji:F.emoji,isSub:!0,status:$,category:F.category,inputPreview:F.detail??B,fade:A,fading:I,worldX:M,worldY:O,anchorX:L,anchorY:K,spawnDx:L-M,spawnDy:0})}})}return l}function FU({agents:e,visibleAgentIds:t,positions:n,pinned:r,measured:s,spotlight:i,hiddenCategories:l,now:u,onOpenTool:d}){const f=DU(e,t,n,r,s,u),h=l&&l.size>0?f.filter(m=>!l.has(m.category)):f;return a.jsx(qU,{bursts:h,spotlight:i,onOpenTool:d})}function qU({bursts:e,spotlight:t,onOpenTool:n}){const{x:r,y:s,zoom:i}=uA();return a.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[a.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const u=l.anchorX*i+r,d=l.anchorY*i+s,f=(l.worldX+6)*i+r,h=(l.worldY+ax)*i+s,m=Math.max(1,f-u),g=Math.min(1,Math.abs(h-d)/m),w=u+m*(.55-.22*g),b=t!=null&&!t.has(l.agentId),x=l.fade*(b?.14:1);return a.jsx("path",{d:`M ${u} ${d} Q ${w} ${d}, ${f} ${h}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:x},`l:${l.id}`)})}),e.map(l=>a.jsx(UU,{b:l,x:r,y:s,zoom:i,dim:t!=null&&!t.has(l.agentId),onOpenTool:n},l.id))]})}function BU(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.fullName===r.fullName&&n.toolName===r.toolName&&n.inputPreview===r.inputPreview}const UU=v.memo(function({b:t,x:n,y:r,zoom:s,dim:i,onOpenTool:l}){const u=t.worldX*s+n,d=t.worldY*s+r,f={left:`${u}px`,top:`${d}px`,transform:`scale(${s})`,transformOrigin:"left top","--spawn-dx":`${t.spawnDx}px`,"--spawn-dy":`${t.spawnDy}px`},h=t.isSub?`${t.toolName} · ${t.fullName??t.name}`:t.toolName,m=t.inputPreview?`${h} · ${t.inputPreview}`:h,g=l!=null,w=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},b=i?" dim":"";return a.jsx("div",{className:"tool-burst-wrap",style:f,children:a.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${g?" clickable":""}${t.isSub?" sub":""}${b}`,style:w,title:m,onClick:g?()=>l(t.agentId,t.toolId):void 0,children:[a.jsx("span",{className:"tb-emoji",children:t.emoji}),a.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&a.jsx("span",{className:"tb-spin"}),t.status==="done"&&a.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&a.jsx("span",{className:"tb-mark err",children:"×"})]})})},BU),zU={agent:F8,sessionGroup:EU,recapNote:hU},HU={recapTie:fU},sj=400;function WU({graph:e,layout:t,viewport:n,clicks:r,drag:s,appearance:i,fm:l,autoFit:u,pause:d,stateRef:f,measuredRef:h,hiddenCats:m,now:g,openTool:w,focusAgent:b,requestClear:x,setKeyHelpOpen:k}){const{allNodes:j,edges:S,visibleAgentIds:_,spotlightSet:E}=e,{positionsRef:T,pinnedRef:R,handleRelayout:A}=t,{restoredViewport:B,onMoveStart:$,onMove:I}=n,{onNodeClick:D,onPaneClick:F,onNodeDoubleClick:W,onNodeMouseEnter:M,onNodeMouseLeave:O}=r,{onNodeDragStart:L,onNodeDrag:K,onNodeDragStop:Z}=s,{palette:q,minimapNodeFill:H,characterEnabled:P}=i,{fmVolume:Y,fmMuted:G,fmSource:z,fmPlayRequest:X,customFmStations:V,markFmStationAvailability:J}=l,{autoFitDisabled:ee,enableAutoFitAndRefit:re}=u,{paused:oe,pauseGate:fe,togglePause:Ne}=d;return a.jsxs(cA,{nodes:j,edges:S,nodeTypes:zU,edgesFocusable:!1,edgeTypes:HU,fitView:!B,fitViewOptions:{padding:.25,duration:Zv({durationMs:sj,documentHidden:document.hidden})?sj:0},minZoom:gA,maxZoom:yA,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:D,onPaneClick:F,onNodeDoubleClick:W,onNodeMouseEnter:M,onNodeMouseLeave:O,onMoveStart:$,onMove:I,onNodeDragStart:L,onNodeDrag:K,onNodeDragStop:Z,children:[a.jsx(UF,{gap:28,size:1,color:q["--grid-line"]}),a.jsx(_U,{onFocusSession:b}),a.jsx(FU,{agents:f.current.agents,visibleAgentIds:_,positions:T.current,pinned:R.current,measured:h.current,spotlight:E,hiddenCategories:m,now:g,onOpenTool:w}),ee&&a.jsx(W8,{enableAutoFitAndRefit:re}),a.jsx(eB,{autoFitDisabled:ee,enableAutoFitAndRefit:re,paused:oe,pauseGate:fe,togglePause:Ne,handleRelayout:A,requestClear:x,setKeyHelpOpen:k}),a.jsx(TF,{zoomable:!0,pannable:!0,nodeColor:H,nodeStrokeWidth:2,maskColor:q["--minimap-mask"],maskStrokeColor:q["--line"]}),P&&a.jsx(uU,{volume:Y,muted:G,source:z,playRequest:X,customStation:V.find(we=>La(we.id)===z),onAvailabilityChange:J})]})}function VU(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,r=0,s=0,i=0;for(const l of e){const u=un(l);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=l.usage.inputTokens,r+=l.usage.outputTokens,s+=l.usage.cacheReadTokens,i+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:r,cacheReadTokens:s,cacheCreateTokens:i,sum:n+r}}const GU="spend on this board",KU="on this board",aj=`Everything on the board right now, and only that.
|
|
73
|
-
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.
|
|
74
|
-
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,hM="session spend",ox="__unknown__",YU=12;function XU(e,t=Date.now()){const n=new Map;for(const r of e)for(const s of Ul(r)){const i=s.model??ox,l=Nl(s.usage,s.model,t),u=n.get(i);u?(u.inputTokens+=s.usage.inputTokens,u.outputTokens+=s.usage.outputTokens,u.cacheReadTokens+=s.usage.cacheReadTokens,u.cacheCreateTokens+=s.usage.cacheCreateTokens,u.cost.total+=l.total,u.cost.input+=l.input,u.cost.output+=l.output,u.cost.cacheRead+=l.cacheRead,u.cost.cacheWrite+=l.cacheWrite,u.agentCount++):n.set(i,{model:i,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens,cost:{...l},agentCount:1,priced:Fa(s.model,t)!=null})}return Array.from(n.values()).sort((r,s)=>s.cost.total-r.cost.total||s.inputTokens+s.outputTokens-(r.inputTokens+r.outputTokens))}function ZU(e,t=Date.now()){const n=[...e],r=[];for(const s of n){if(s.kind!=="root")continue;let i=un(s,t).total,l=s.usage.inputTokens,u=s.usage.outputTokens,d=jl(s,t);for(const f of n)f.sessionId!==s.sessionId||f.kind==="root"||(i+=un(f,t).total,l+=f.usage.inputTokens,u+=f.usage.outputTokens,d+=jl(f,t));r.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",state:s.state,cost:i,inputTokens:l,outputTokens:u,unpricedTokens:d})}return r.sort((s,i)=>i.cost-s.cost||i.inputTokens+i.outputTokens-(s.inputTokens+s.outputTokens)).slice(0,YU)}function oj(e){return e.waiting?lr(e.waiting)?0:1:e.state==="active"?2:3}function JU(e,t){const n=[];for(const r of e.agents.values()){if(r.kind!=="root")continue;let s=r.toolCount,i=un(r).total,l=r.endedAt??r.startedAt;for(const u of e.agents.values()){if(u.sessionId!==r.sessionId||u.kind==="root")continue;s+=u.toolCount,i+=un(u).total;const d=u.endedAt??u.startedAt;d>l&&(l=d)}n.push({sessionId:r.sessionId,label:r.label||r.cwdBasename||"session",cwdBasename:r.cwdBasename,state:r.state,waiting:r.waiting,recap:Sd(r),modelId:r.model,toolCount:s,cost:i,startedAt:r.startedAt,lastActivity:l})}return n.sort((r,s)=>{const i=oj(r),l=oj(s);return i!==l?i-l:r.waiting&&s.waiting?r.waiting.since-s.waiting.since:s.lastActivity-r.lastActivity}),n}function ij(e,t,n){const r=(t??n)-e;if(r<1e3)return"<1s";const s=Math.floor(r/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);return i<60?`${i}m`:`${Math.floor(i/60)}h ${i%60}m`}function QU({state:e,now:t,selectedIds:n,onSelect:r,onClose:s,removedIds:i,onBringBackAll:l}){const u=v.useMemo(()=>JU(e),[e,e.revision,t]),d=u.filter(h=>h.state==="active").length,f=u.filter(h=>lr(h.waiting)).length;return a.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[a.jsxs("div",{className:"sl-header",children:[a.jsxs("h2",{children:["Sessions ",a.jsx("span",{className:"sl-count",children:u.length})]}),f>0&&a.jsxs("span",{className:"sl-waiting-count",children:[f," waiting"]}),d>0&&a.jsxs("span",{className:"sl-live-count",children:[d," live"]}),a.jsx("button",{className:"glyph-btn sl-close",onClick:s,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),a.jsxs("ul",{className:"sl-rows",children:[u.length===0&&a.jsx("li",{className:"sl-empty",children:"No sessions yet."}),u.map(h=>{const m=n.has(h.sessionId),g=(i==null?void 0:i.has(h.sessionId))??!1;return a.jsx("li",{className:"sl-row-item",children:a.jsxs("button",{type:"button",className:`sl-row state-${h.state}${m?" selected":""}${g?" removed":""}`,"aria-current":m?"true":void 0,onClick:()=>r(h.sessionId),title:g?`Bring ${h.label} back to the board`:`Focus ${h.label}`,children:[a.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:Yo(h.state)}),a.jsxs("div",{className:"sl-row-body",children:[a.jsxs("div",{className:"sl-row-head",children:[a.jsx("span",{className:"sl-label",children:h.label}),g&&a.jsx("span",{className:"sl-removed",children:"off the board"}),h.modelId&&a.jsx("span",{className:"model-chip","data-family":bd(h.modelId),title:h.modelId,children:Hs(h.modelId)})]}),a.jsxs("div",{className:"sl-row-meta",children:[a.jsxs("span",{title:"tool calls",children:[a.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&a.jsx("span",{className:"sl-cost",title:hM,children:a.jsx("b",{children:qe(h.cost)})}),h.waiting?a.jsxs("span",{className:"sl-waiting",title:[Xo(h.waiting),xq(h.waiting,Xo(h.waiting)),`Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
75
|
-
`),children:["waiting ",ij(h.waiting.since,void 0,t),h.waiting.tool&&a.jsxs("span",{className:"sl-waiting-tool",children:[" · ",h.waiting.tool.name]})]}):a.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:ij(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]}),h.recap&&a.jsxs("span",{className:"sl-recap",title:h.recap.text,children:[a.jsx(Sl,{}),h.recap.text]})]})]})},h.sessionId)})]}),(()=>{const h=(i==null?void 0:i.size)??0;return h===0||!l?null:a.jsx("div",{className:"sl-foot",children:a.jsxs("button",{type:"button",className:"btn sl-bring-back",onClick:m=>{const g=m.currentTarget.closest(".session-list");l(),requestAnimationFrame(()=>{var w;return(w=g==null?void 0:g.querySelector(".sl-row"))==null?void 0:w.focus()})},children:["Bring back ",h," removed ",h===1?"card":"cards"]})})})()]})}const ix={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function ez(e){if(!e.synthetic)return!1;const t=e.usage;return t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreateTokens<=0}function lx(e,t){const n=new Map;for(const r of e){if(r.kind!=="root"||!r.sessionId||ez(r))continue;const s=un(r,t);n.set(r.sessionId,{cost:s.total,inputTokens:r.usage.inputTokens,outputTokens:r.usage.outputTokens,cacheReadTokens:r.usage.cacheReadTokens,cacheCreateTokens:r.usage.cacheCreateTokens})}return n}function tz(e,t){if(!e)return ix;const n={...ix};for(const[r,s]of t){const i=e.get(r);if(!i)continue;const l={cost:s.cost-i.cost,inputTokens:s.inputTokens-i.inputTokens,outputTokens:s.outputTokens-i.outputTokens,cacheReadTokens:s.cacheReadTokens-i.cacheReadTokens,cacheCreateTokens:s.cacheCreateTokens-i.cacheCreateTokens};l.cost<0||l.inputTokens<0||l.outputTokens<0||l.cost===0&&l.inputTokens===0&&l.outputTokens===0&&l.cacheReadTokens===0&&l.cacheCreateTokens===0||(n.cost+=l.cost,n.inputTokens+=Math.max(0,l.inputTokens),n.outputTokens+=Math.max(0,l.outputTokens),n.cacheReadTokens+=Math.max(0,l.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,l.cacheCreateTokens),n.sessions+=1)}return n}function lj(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const Td=[{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 nz(e,t,n=Td.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 fM(e,t=new Date){return e==="today"?lj(1,t):e==="month"?lj(t.getDate(),t):"20200101"}const on=e=>typeof e=="number"&&Number.isFinite(e)?e:0,$u=e=>typeof e=="string"?e:"";function pM(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const r of t){const s=Array.isArray(r==null?void 0:r.modelBreakdowns)?r.modelBreakdowns:[];for(const i of s){const l=$u(i==null?void 0:i.modelName);if(!l)continue;let u=n.get(l);u||(u={model:l,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(l,u)),u.cost+=on(i==null?void 0:i.cost),u.inputTokens+=on(i==null?void 0:i.inputTokens),u.outputTokens+=on(i==null?void 0:i.outputTokens),u.cacheReadTokens+=on(i==null?void 0:i.cacheReadTokens),u.cacheCreateTokens+=on(i==null?void 0:i.cacheCreationTokens)}}return[...n.values()].sort((r,s)=>s.cost-r.cost||s.tokens-r.tokens)}const rz=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function sz(e){var t;return((t=rz.exec(e))==null?void 0:t[0])??e}function az(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],r=[];for(const s of n){const i=$u(s==null?void 0:s.period);if(!i)continue;const l=sz(i),u=s==null?void 0:s.metadata,d=typeof(u==null?void 0:u.lastActivity)=="string"?Date.parse(u.lastActivity):NaN;r.push({sessionId:l,label:t.get(l)??null,agent:$u(s==null?void 0:s.agent)||"claude",cost:on(s==null?void 0:s.totalCost),tokens:on(s==null?void 0:s.totalTokens),models:Array.isArray(s==null?void 0:s.modelsUsed)?s.modelsUsed.map($u).filter(Boolean):[],lastActivityMs:Number.isFinite(d)?d:null})}return r.sort((s,i)=>i.cost-s.cost||i.tokens-s.tokens)}function oz(e,t=Rd(e).cost){const r=(Array.isArray(e==null?void 0:e.sessions)?e.sessions:[]).reduce((i,l)=>i+on(l==null?void 0:l.totalCost),0),s=Math.max(.01,t*.01);return{sum:r,total:t,over:r>t+s}}function iz(e,t,n){const r=`Sessions with activity ${e}, and what ccusage puts against each one.`;return t.over?`${r}
|
|
76
|
-
They add up to ${n(t.sum)}, more than the ${n(t.total)} above: what a session cost and what a day cost are two different measurements, and they need not agree.`:r}function Rd(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const d=on(t.cacheReadTokens),f=on(t.cacheCreationTokens),h=on(t.inputTokens),m=on(t.outputTokens);return{cost:on(t.totalCost),inputTokens:h,outputTokens:m,cacheReadTokens:d,cacheCreateTokens:f,tokens:on(t.totalTokens)||h+m+d+f}}const n=pM(e),r=d=>n.reduce((f,h)=>f+d(h),0),s=r(d=>d.inputTokens),i=r(d=>d.outputTokens),l=r(d=>d.cacheReadTokens),u=r(d=>d.cacheCreateTokens);return{cost:r(d=>d.cost),inputTokens:s,outputTokens:i,cacheReadTokens:l,cacheCreateTokens:u,tokens:s+i+l+u}}function lz(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 mM(e,t){var n;return((n=Td.find(r=>r.key===(e??t)))==null?void 0:n.noun)??"today"}function cz(e,t,n){const r=e!=null,s=Rd(e);return{fromRange:r,cost:r?s.cost+n.cost:t.cost.total,inputTokens:r?s.inputTokens+n.inputTokens:t.inputTokens,outputTokens:r?s.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:r?s.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:r?s.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:r?s.cost>0:t.cost.total>0,tokenSum:r?s.tokens:t.sum,showCostBar:!r}}const gM="agent-dag.usagePeriod";function uz(){const e=et(gM);return Td.some(t=>t.key===e)?e:"today"}function dz(e){Ye(gM,e)}const yM="agent-dag.usageSessionsOpen";function hz(){return et(yM)==="1"}function fz(e){Ye(yM,e?"1":"0")}function g0({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const r=(i,l,u)=>{if(i<=0)return null;const d=i/n*100;return a.jsx("span",{className:`cb-seg ${l}`,style:{width:`${d}%`},title:`${u}: ${qe(i)} (${d.toFixed(0)}%)`},l)},s=t==="lg";return a.jsxs("div",{className:s?"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")]})}const wt="ccdeck";function wM(e,t){const n=t.nextExpiryAt!=null?` · expires ${new Date(t.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`:"";return`${t.availableCount} ${e}${t.availableCount!==1?"s":""} available${n}`}function pz({incidents:e}){return a.jsx(a.Fragment,{children:e.map(t=>a.jsxs("a",{className:t.stale?"provider-incident provider-incident-stale":"provider-incident","data-state":t.state,href:t.href,target:"_blank",rel:"noopener noreferrer",title:t.detail,children:[a.jsx("span",{className:"pi-dot","aria-hidden":!0}),a.jsx("span",{className:"pi-name",children:t.name}),a.jsxs("span",{className:"pi-words",children:["· ",t.chipWords]}),a.jsxs("span",{className:"pi-short",children:["· ",t.shortWords]}),t.asOf&&a.jsxs("span",{className:"pi-asof",children:["· as of ",t.asOf]}),a.jsx("span",{className:"pi-go","aria-hidden":!0,children:"↗"}),a.jsxs("span",{className:"vis-hidden",children:[", on ",t.host,", opens in a new tab"]})]},t.provider))})}function vM({incident:e}){return e?a.jsxs("a",{className:e.stale?"up-incident up-incident-stale":"up-incident","data-state":e.state,href:e.href,target:"_blank",rel:"noopener noreferrer",title:e.detail,children:[a.jsx("span",{className:"pi-dot","aria-hidden":!0}),a.jsxs("span",{className:"up-incident-words",children:[a.jsxs("span",{className:"vis-hidden",children:[e.name,": "]}),e.words[0].toUpperCase()+e.words.slice(1),e.asOf?` · as of ${e.asOf}`:""]}),a.jsx("span",{className:"up-incident-go","aria-hidden":!0,children:"↗"}),e.what&&a.jsx("span",{className:"up-incident-what",children:e.what}),a.jsxs("span",{className:"vis-hidden",children:[", on ",e.host,", opens in a new tab"]})]}):null}function mz(e,t,n,r){const s=Math.max(0,t-r),i=Math.max(0,n-s);if(i<120)return null;const l=Math.min(100,i/n*100),u=e-l;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(u>0){const d=100-e,f=i>0?e/i:0,h=f>0?d/f:1/0,m={label:`${Math.round(u)}% over pace`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(h<s&&h<86400){const g=Math.floor(h/3600),w=Math.floor(h%3600/60);m.runsOutIn=g>0?`${g}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-u)}% under pace`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function Fs({pct:e,label:t,reset:n,resetAt:r,windowSec:s,limitReached:i,nowSec:l}){const u=e!=null,d=u?Math.min(100,Math.max(0,e)):0,h=i||d>=90?"var(--err)":d>=70?"var(--warn)":"var(--accent)",m=u?d===0?"< 1%":`${d}%`:"no reading",g=d===0?2:d,w=r?Cd(r,l):null,b=u&&r&&s?mz(d,r,s,l):null,[x,k]=v.useState(!1),j=v.useId();return a.jsxs("div",{className:"qb-row",children:[a.jsxs("div",{className:"qb-meta",children:[a.jsxs("span",{className:"qb-label",children:[t,i&&a.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),a.jsx("span",{className:"qb-pct",style:{color:u?h:"var(--muted)"},children:m})]}),a.jsxs("div",{className:"qb-track",children:[u&&a.jsx("div",{className:"qb-fill",style:{transform:`scaleX(${g/100})`,background:h,opacity:d===0?.4:1}}),b&&a.jsx("div",{className:"qb-pace-rail",style:{transform:`translateX(${b.expectedPct}%)`},children:a.jsx("div",{"aria-hidden":!0,className:"qb-pace-marker",style:{background:b.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(b.expectedPct)}% by now`})})]}),a.jsxs("div",{className:"qb-reset-row",children:[w?a.jsxs("span",{className:"qb-reset",children:["resets in ",w]}):n?a.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,b&&a.jsxs("button",{type:"button",className:"qb-pace",style:{color:b.color},"aria-expanded":x,"aria-controls":x?j:void 0,onClick:()=>k(S=>!S),children:[a.jsx("i",{className:"qb-pace-key","aria-hidden":!0,style:{background:b.isDeficit?"var(--err)":"var(--ok)"}}),b.runsOutIn?`runs out in ${b.runsOutIn}`:b.label]})]}),x&&b&&a.jsxs("div",{id:j,className:"qb-why",children:["To last until reset, stay near ",Math.round(b.expectedPct),"% by now."]})]})}function xM(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 gz(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget. Saved limit resets, which it does not collect, are read separately: every 30 minutes, or 5 on refresh":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 yz(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 wz(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."}}function vz({quota:e,quotaLoading:t,nowSec:n,incident:r}){const s=xM(e==null?void 0:e.fetchedAt,n);return a.jsxs("section",{className:"up-section up-quota-section",children:[a.jsxs("h3",{className:"up-section-title",children:["Claude quota",s&&!t&&a.jsx("span",{className:"up-section-age",title:gz(e==null?void 0:e.source),children:s})]}),a.jsx(vM,{incident:r}),e!=null&&e.ok?a.jsxs("div",{className:"up-quota-bars",children:[e.session5hPct!=null&&a.jsx(Fs,{label:"5-hour window",pct:e.session5hPct,reset:e.session5hReset,resetAt:e.session5hResetAt,windowSec:e.session5hWindowSec,nowSec:n}),a.jsx(Fs,{label:"7-day window",pct:e.week7dPct??null,reset:e.week7dReset,resetAt:e.week7dResetAt,windowSec:e.week7dWindowSec,nowSec:n}),e.weekSonnetPct!=null&&a.jsx(Fs,{label:"Sonnet (7d)",pct:e.weekSonnetPct,nowSec:n}),e.weekOpusPct!=null&&a.jsx(Fs,{label:"Opus (7d)",pct:e.weekOpusPct,nowSec:n}),e.extraEnabled&&e.extraUsedCredits!=null&&e.extraMonthlyLimit?a.jsx(Fs,{label:`Extra credits (month${e.extraCurrency?`, ${e.extraCurrency}`:""})`,pct:Math.min(100,Math.round(e.extraUsedCredits/e.extraMonthlyLimit*100)),nowSec:n}):e.extraEnabled&&a.jsx("div",{className:"up-quota-sub up-credits",children:"extra usage credits: on"}),e.resetCredits&&e.resetCredits.availableCount>0&&a.jsx("div",{className:"up-quota-sub up-reset-credits",title:`Saved in Claude as "Reset for free". Redeem one in Claude on the web or desktop — ${wt} only reports them`,children:wM("limit reset",e.resetCredits)})]}):(e==null?void 0:e.ok)===!1?a.jsxs("div",{className:"up-quota-na",children:[a.jsx("span",{children:e.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),a.jsx("span",{className:"up-quota-hint",children:yz(e.reason)})]}):a.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]})}function xz({codexQuota:e,codexLoading:t,codexUsage:n,nowSec:r,incident:s}){var l,u;const i=xM(e==null?void 0:e.fetchedAt,r);return a.jsxs("section",{className:"up-section up-quota-section",children:[a.jsxs("h3",{className:"up-section-title",children:["Codex quota",(e==null?void 0:e.ok)&&e.planLabel&&a.jsx("span",{className:"up-plan-badge",children:e.planLabel}),i&&!t&&a.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:i})]}),a.jsx(vM,{incident:s}),e!=null&&e.ok?a.jsxs("div",{className:"up-quota-bars",children:[(l=e.windows)==null?void 0:l.map(d=>a.jsx(Fs,{label:d.label,pct:d.pct,reset:d.reset??void 0,resetAt:d.resetAt??void 0,windowSec:d.windowSec??void 0,limitReached:e.limitReached&&d.pct>=100,nowSec:r},d.id)),(u=e.extraWindows)==null?void 0:u.map(d=>a.jsx(Fs,{label:d.label,pct:d.pct,reset:d.reset??void 0,resetAt:d.resetAt??void 0,windowSec:d.windowSec??void 0,nowSec:r},d.id)),e.creditLimit&&a.jsx(Fs,{label:`spend cap · $${Math.round(e.creditLimit.used)} of $${Math.round(e.creditLimit.limit)}`,pct:e.creditLimit.usedPct,reset:e.creditLimit.reset??void 0,resetAt:e.creditLimit.resetAt??void 0,limitReached:e.spendControlReached,nowSec:r}),e.creditsBalance&&!e.creditsUnlimited&&a.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",e.creditsBalance,e.overageReached&&" · overage limit reached"]}),e.creditsUnlimited&&a.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),e.resetCredits&&e.resetCredits.availableCount>0&&a.jsx("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${wt} only reports them`,children:wM("rate-limit reset",e.resetCredits)}),e.promo&&a.jsx("div",{className:"up-quota-sub",children:e.promo}),e.partial&&a.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(e==null?void 0:e.ok)===!1?a.jsxs("div",{className:"up-quota-na",children:[a.jsx("span",{children:"Quota unavailable."}),a.jsx("span",{className:"up-quota-hint",children:wz(e.reason)})]}):a.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(n==null?void 0:n.ok)&&n.window7d&&n.window7d.sessionCount>0&&a.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${n.window5h?`
|
|
77
|
-
last 5h: ${st(n.window5h.totalTokens)} tokens · ${n.window5h.sessionCount} session${n.window5h.sessionCount!==1?"s":""}`:""}`,children:[st(n.window7d.totalTokens)," tokens · ",n.window7d.sessionCount," session",n.window7d.sessionCount!==1?"s":""," (7d)"]})]})}function bz({fromRange:e,rangeModelRows:t,boardModelRows:n}){return a.jsxs("section",{className:"up-section",children:[a.jsx("h3",{className:"up-section-title",children:"By model"}),a.jsxs("table",{className:"up-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Model"}),a.jsx("th",{children:"Tokens"}),a.jsx("th",{children:"Cost"})]})}),a.jsx("tbody",{children:e?t.map(r=>a.jsxs("tr",{children:[a.jsx("td",{className:"up-model-name",title:r.model,children:Hs(r.model)}),a.jsx("td",{className:"up-num",children:st(r.tokens)}),r.cost>0?a.jsx("td",{className:"up-num up-cost-val",children:qe(r.cost)}):a.jsx("td",{className:"up-num up-unpriced",children:es})]},r.model)):n.map(r=>a.jsxs("tr",{children:[a.jsx("td",{className:"up-model-name",title:r.model===ox?"no model reported yet":r.model,children:r.model===ox?"unknown":Hs(r.model)}),a.jsx("td",{className:"up-num",children:st(r.inputTokens+r.outputTokens)}),r.priced?a.jsx("td",{className:"up-num up-cost-val",children:qe(r.cost.total)}):a.jsx("td",{className:"up-num up-unpriced",children:es})]},r.model))})]})]})}function kz({period:e,rangePending:t,setPeriod:n}){const r=v.useRef([]);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":t||void 0,onKeyDown:s=>{var u;const i=r.current.indexOf(s.target);if(i<0)return;const l=nz(s.key,i);l!==null&&(s.preventDefault(),(u=r.current[l])==null||u.focus())},children:Td.map((s,i)=>a.jsx("button",{type:"button",ref:l=>{r.current[i]=l},tabIndex:e===s.key?0:-1,"aria-pressed":e===s.key,"data-pending":e===s.key&&t?"":void 0,title:e===s.key&&t?`Reading ${s.noun} from the transcripts on this machine…`:s.hint,className:"uh-range-btn",onClick:()=>n(s.key),children:s.label},s.key))}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:t?`Reading ${mM(e,e)}…`:""})]})}function Nz({fromRange:e,rangeSessionRows:t,boardSessionRows:n,boardStates:r,sessionsOpen:s,setSessionsOpen:i,periodNoun:l,sessionScale:u}){const d=e?t.length:n.length;return a.jsxs("section",{className:"up-section",children:[a.jsx("h3",{className:"up-section-title",children:a.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":s,"aria-controls":"up-sessions",title:s?"Hide the per-session breakdown":`Show the per-session breakdown — ${d} session${d===1?"":"s"}`,onClick:()=>i(f=>!f),children:["By session",e&&a.jsxs("span",{className:"up-section-age",title:iz(l,u,qe),children:["active ",l]}),a.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:a.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),a.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!s,children:[e&&t.map(f=>{const h=r.get(f.sessionId);return a.jsxs("div",{className:"up-session-row",children:[h?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`sl-dot state-${h}`,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:Yo(h)})]}):a.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),a.jsx("span",{className:`up-session-label${f.label?"":" up-session-id"}`,title:f.label?`${f.label}
|
|
78
|
-
${f.sessionId}`:f.sessionId,children:f.label??f.sessionId.slice(0,8)}),a.jsx("span",{className:"up-session-tokens",children:st(f.tokens)}),f.cost>0?a.jsx("span",{className:"up-session-cost",title:f.models.join(", ")||void 0,children:qe(f.cost)}):a.jsx("span",{className:"up-session-cost up-unpriced",children:es})]},f.sessionId)}),!e&&n.map(f=>a.jsxs("div",{className:"up-session-row",children:[a.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:Yo(f.state)}),a.jsx("span",{className:"up-session-label",children:f.label}),a.jsx("span",{className:"up-session-tokens",children:st(f.inputTokens+f.outputTokens)}),f.cost>0?a.jsxs("span",{className:"up-session-cost",title:f.unpricedTokens>0?`${st(f.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[qe(f.cost),f.unpricedTokens>0?"+":""]}):a.jsx("span",{className:"up-session-cost up-unpriced",children:es})]},f.sessionId))]})]})}function Ws(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function Ad(e){return e==null}const cx="self";function zs(e,t=!1){const n=Ws(e?cx:null,cx);return{disabled:t||n.disabled,"aria-busy":n.busy}}function Sr(e){return Ad(e?cx:null)}const _l=400;function El({armedFor:e,target:t,armedAt:n,now:r,gapMs:s}){return e!==t?"arm":r-n<s?"ignore":"fire"}function bM(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function Cl(e){return e==null||e==="BODY"||e==="HTML"}const jz=6e4,Sz=2e4;function _z(e){const[t,n]=v.useState(null),[r,s]=v.useState(!1),i=v.useRef(null),l=v.useRef(!1),u=async(f=!1)=>{if(!(f&&!Sr(l.current))){f&&(l.current=!0,s(!0));try{const m=await fetch(f?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(Sz)});m.ok&&n(await m.json())}catch{}finally{f&&(l.current=!1,s(!1))}}};return v.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),jz),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{quota:t,loading:r,refresh:()=>{e&&u(!0)}}}const kM=6e4;function Ez(e){const[t,n]=v.useState(null),[r,s]=v.useState(!1),i=v.useRef(null),l=v.useRef(!1),u=async(f=!1)=>{if(!(f&&!Sr(l.current))){f&&(l.current=!0,s(!0));try{const m=await fetch(f?"/api/codex-quota?refresh=1":"/api/codex-quota");m.ok&&n(await m.json())}catch{}finally{f&&(l.current=!1,s(!1))}}};return v.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),kM),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t,loading:r,refresh:()=>{e&&u(!0)}}}function Cz(e){const[t,n]=v.useState(null),r=v.useRef(null),s=async()=>{try{const i=await fetch("/api/codex-usage");i.ok&&n(await i.json())}catch{}};return v.useEffect(()=>{if(e)return s(),r.current=window.setInterval(s,kM),()=>{r.current!=null&&window.clearInterval(r.current)}},[e]),{data:t}}const cj=6e4;function Tz(e,t,n){const[r,s]=v.useState(null),[i,l]=v.useState(!1),[u,d]=v.useState(0),f=v.useRef(0);v.useEffect(()=>{const m=()=>document.visibilityState==="visible",g=()=>{m()&&d(x=>x+1)},w=window.setInterval(g,cj),b=()=>{m()&&Date.now()-f.current>=cj&&d(x=>x+1)};return document.addEventListener("visibilitychange",b),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",b)}},[]);const h=v.useRef(t);return v.useEffect(()=>{let m=!0;const g=t!==h.current;h.current=t;const w=e,b=fM(w);return l(!0),fetch(`/api/ccusage?since=${b}${g?"&refresh=1":""}`).then(x=>x.ok?x.json():null).then(x=>{!m||!(x!=null&&x.ok)||(f.current=Date.now(),s({period:w,data:x,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&l(!1)}),()=>{m=!1}},[e,t,u]),{...lz(r,e),loading:i}}const Rz=e=>1-Math.pow(1-e,5),NM=420;function Az(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 Mz(e,t,n,r=NM){return n>=r?t:n<=0?e:e+(t-e)*Rz(n/r)}function jM(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function uj(e,t,n,r={}){const s=r.now??(()=>performance.now()),i=r.raf??(w=>requestAnimationFrame(w)),l=r.cancel??(w=>cancelAnimationFrame(w)),u=r.reducedMotion??jM,d=r.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||d()||!Az(e,t))return n(t),()=>{};const f=s();let h=0,m=!0;const g=()=>{if(!m)return;const w=s()-f;n(Mz(e,t,w)),w<NM&&(h=i(g))};return h=i(g),()=>{m=!1,h&&l(h)}}const $z=typeof window>"u"?v.useEffect:v.useLayoutEffect;function Na(e,{countIn:t=!1}={}){const[n,r]=v.useState(e),s=v.useRef(e),i=v.useRef(!0);return v.useEffect(()=>{s.current=n},[n]),$z(()=>{!t||jM()||(s.current=0,r(0))},[]),v.useEffect(()=>{if(i.current){if(i.current=!1,t)return uj(0,e,u=>{s.current=u,r(u)});s.current=e,r(e);return}return uj(s.current,e,u=>{s.current=u,r(u)})},[e]),n}function SM(e,t,n){const r=Oz*Math.max(1,n/EM);let s=0;for(const[i,l]of t){const u=e.get(i);if(u===void 0)continue;const d=l.cost-u.cost;d>0&&d<=r&&(s+=d)}return s}const dj={samples:[],last:new Map,watched:0},_M=10*6e4,Iz=6e4,EM=5e3,Oz=20;function Lz(e,t,n){const r=e.samples[e.samples.length-1];if(r&&t-r.t<EM)return e;const s=e.watched+SM(e.last,n,r?t-r.t:0),i=e.samples.filter(l=>t-l.t<=_M);return i.push({t,watched:s}),{samples:i,last:n,watched:s}}function Pz(e,t,n){const r=e.samples[0];if(!r)return null;const s=t-r.t;if(s<Iz)return null;const i=e.samples[e.samples.length-1].t,l=e.watched+SM(e.last,n,t-i)-r.watched;return l>0?{spent:l,spanSec:s/1e3,spanMin:Math.min(_M/6e4,Math.ceil(s/6e4))}:null}function Dz(e,t,n){const r=v.useRef(dj),s=v.useRef(null);return v.useMemo(()=>{const i=XU(e.agents.values()),l=VU(e.agents.values());s.current!==n&&(s.current=n,r.current=dj);const u=lx(e.agents.values(),t);n!=null&&(r.current=Lz(r.current,t,u));const d=n==null?null:Pz(r.current,t,u),f=d?{label:i0(d.spent,d.spanSec),spanMin:d.spanMin}:null;return{byModel:i,totalCost:l.cost,totalTokens:l,burnRate:f}},[e,e.revision,t,n])}const Fz=3e4;function CM(){const[e,t]=v.useState(()=>Math.floor(Date.now()/1e3));return v.useEffect(()=>{const n=window.setInterval(()=>t(Math.floor(Date.now()/1e3)),Fz);return()=>window.clearInterval(n)},[]),e}function hj(e){return(typeof e.cost=="number"?e.cost:e.cost.total)>0||e.inputTokens+e.outputTokens>0}function qz(e,t,n){return e?t.some(r=>r.cost<=0&&r.tokens>0):n.some(r=>!r.priced)}function Bz(e){return e.claude&&e.codex?"Refresh Claude + Codex quota":e.codex?"Refresh Codex quota":"Refresh Claude quota"}function Uz(e){const t=new Map;for(const n of e){if(n.kind!=="root"||!n.sessionId)continue;const r=n.label||n.cwdBasename;r&&t.set(n.sessionId,r)}return t}function zz(e){const t=new Map;for(const n of e)n.kind!=="root"||!n.sessionId||t.set(n.sessionId,n.state);return t}function Hz(e){const t=new Map;for(const n of e)n.label&&t.set(n.label,(t.get(n.label)??0)+1);return e.map(n=>n.label&&(t.get(n.label)??0)>1?{...n,label:`${n.label} ${n.sessionId.slice(0,4)}`}:n)}function Wz({state:e,now:t,providers:n,incidents:r=[],leaving:s,onClose:i,liveSince:l=null}){const{quota:u,loading:d,refresh:f}=_z(n.claude),{data:h,loading:m,refresh:g}=Ez(n.codex),{data:w}=Cz(n.codex),b=CM(),{byModel:x,totalCost:k,totalTokens:j,burnRate:S}=Dz(e,t,l),_=v.useMemo(()=>ZU(e.agents.values()),[e,e.revision]),[E,T]=v.useState(uz);v.useEffect(()=>{dz(E)},[E]);const[R,A]=v.useState(hz);v.useEffect(()=>{fz(R)},[R]);const[B,$]=v.useState(0),I=v.useRef(()=>new Map);I.current=()=>l==null?null:lx(e.agents.values(),t);const D=v.useCallback(()=>I.current(),[]),{data:F,shown:W,stale:M,loading:O,baseline:L}=Tz(E,B,D),K=F!=null,Z=O&&M,q=v.useMemo(()=>Uz(e.agents.values()),[e,e.revision]),H=v.useMemo(()=>zz(e.agents.values()),[e,e.revision]),P=v.useMemo(()=>K?pM(F):[],[F,K]),Y=v.useMemo(()=>K?Hz(az(F,q).slice(0,12)):[],[F,K,q]),G=v.useMemo(()=>Rd(F),[F]),z=v.useMemo(()=>oz(F,G.cost),[F,G.cost]),X=mM(W,E),V=v.useMemo(()=>K?tz(L,lx(e.agents.values(),t)):ix,[e,e.revision,L,K,t]),J=cz(F,{...j,cost:k},V),ee=J.hasCost,re=J.tokenSum,oe=Na(J.cost),fe=Na(J.inputTokens),Ne=Na(J.outputTokens),we=Na(J.cacheReadTokens),ye=Na(J.cacheCreateTokens),ve=x.filter(hj),Ie=_.filter(hj),xe=qz(K,P,ve),ue=d||m,se=()=>{f(),g(),$(Te=>Te+1)},be=Bz(n);return a.jsxs("aside",{className:`usage-panel${s?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[a.jsxs("div",{className:"up-header",children:[a.jsx("h2",{children:"Usage"}),S&&a.jsxs("span",{className:"up-rate",title:`Spend on this board over the last ${S.spanMin} min`,children:[S.label,a.jsxs("span",{className:"up-rate-span",children:[" · ",S.spanMin," min"]})]}),a.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&a.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:se,...zs(ue),"aria-label":be,title:be,children:ue?"…":"↻"}),a.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:i,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&a.jsx(vz,{quota:u,quotaLoading:d,nowSec:b,incident:r.find(Te=>Te.provider==="claude")}),n.codex&&a.jsx(xz,{codexQuota:h,codexLoading:m,codexUsage:w,nowSec:b,incident:r.find(Te=>Te.provider==="codex")}),K&&a.jsx(kz,{period:E,rangePending:Z,setPeriod:T}),re>0?a.jsxs(a.Fragment,{children:[ee&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"up-total",title:K?void 0:aj,children:[a.jsx("span",{className:"up-total-value",children:qe(oe)}),a.jsx("span",{className:"up-total-label",children:K?X:GU})]}),J.showCostBar&&a.jsx(g0,{cost:k})]}),a.jsxs("div",{className:"up-tokens-row",title:K?void 0:aj,children:[a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"in"}),st(fe)]}),a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"out"}),st(Ne)]}),J.cacheReadTokens>0&&a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"cache r"}),st(we)]}),J.cacheCreateTokens>0&&a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"cache c"}),st(ye)]}),!ee&&a.jsx("span",{className:"up-tok up-scope",children:KU})]}),(K?P.length:ve.length)>0&&a.jsx(bz,{fromRange:K,rangeModelRows:P,boardModelRows:ve}),K&&Y.length===0&&G.tokens>0&&a.jsxs("section",{className:"up-section",children:[a.jsx("h3",{className:"up-section-title",children:"By session"}),a.jsxs("div",{className:"up-hint",children:["No session is dated ",X," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(K?Y.length:Ie.length)>0&&a.jsx(Nz,{fromRange:K,rangeSessionRows:Y,boardSessionRows:Ie,boardStates:H,sessionsOpen:R,setSessionsOpen:A,periodNoun:X,sessionScale:z}),xe&&a.jsxs("div",{className:"up-hint",children:["“",es,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):a.jsx("div",{className:"up-empty",children:K?a.jsxs(a.Fragment,{children:["No usage ",X,".",a.jsx("br",{}),"Try a longer period."]}):a.jsxs(a.Fragment,{children:["No usage data yet.",a.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}function Vz(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function Gz(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}% ${Kz(t.lastMs,n)}`:"running at full speed, and never held back"}}function Kz(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 Yz(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 Xz(e){var n,r,s;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`:(s=e.network)!=null&&s.api&&e.network.api.ms==null?"the Claude API is not answering":null}function Zz(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})`:""}`}const Jz=3e3;function Qz(){const[e,t]=v.useState(null),n=v.useRef(null);return v.useEffect(()=>{let r=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const d=await fetch("/api/system");if(!d.ok)return;const f=await d.json();r&&(f!=null&&f.ok)&&t(f)}catch{}},i=()=>{n.current==null&&(s(),n.current=window.setInterval(s,Jz))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){l();return}i(),s()};return i(),document.addEventListener("visibilitychange",u),()=>{r=!1,l(),document.removeEventListener("visibilitychange",u)}},[]),e}function ap(e){return e<9.95?e.toFixed(1):String(Math.round(e))}function y0(e){const t=Number.isFinite(e)?Math.max(0,e):0;return t<50?{value:"0",unit:"KB/s"}:t<999500?{value:ap(t/1e3),unit:"KB/s"}:t<9995e5?{value:ap(t/1e6),unit:"MB/s"}:{value:ap(t/1e9),unit:"GB/s"}}function Md(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 Tl(e){return e.unit?e.unit==="%"||e.unit==="°C"?`${e.value}${e.unit}`:`${e.value} ${e.unit}`:e.value}function op(e,t){return t==="B/s"?y0(e):t==="ms"?Md(e):{value:String(e),unit:t==="C"?"°C":t}}const _t={l:30,r:6,t:6,b:2},Is={l:0,r:0,t:2,b:1},$d=104,eH=64;function nr(e,t=100,n=$d,r=_t){const s=n-r.t-r.b;return r.t+s*(1-Math.max(0,Math.min(t,e))/t)}function TM(e,t,n,r=100,s=$d,i=_t){if(!e.length)return"";const l=e[e.length-1].t-e[0].t,u=h=>{const m=t-i.l-i.r;return i.l+(l>0?m*(h-e[0].t)/l:m/2)};let d="",f=null;for(const h of e){const m=f&&h.t-f.t<=n*2?"L":"M";d+=`${m}${u(h.t).toFixed(1)} ${nr(h.v,r,s,i).toFixed(1)}`,f=h}return d}function RM(e,t,n,r=100,s=$d,i=_t){if(e.length<2)return"";const l=s-i.b,u=e[e.length-1].t-e[0].t,d=t-i.l-i.r,f=w=>i.l+(u>0?d*(w-e[0].t)/u:d/2);let h="",m=[];const g=()=>{if(m.length>=2){let w=`M${f(m[0].t).toFixed(1)} ${l}`;for(const b of m)w+=`L${f(b.t).toFixed(1)} ${nr(b.v,r,s,i).toFixed(1)}`;h+=`${w}L${f(m[m.length-1].t).toFixed(1)} ${l}Z`}m=[]};for(const w of e)m.length&&w.t-m[m.length-1].t>n*2&&g(),m.push(w);return g(),h}function tH(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 AM(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function nH(e,t,n=r=>ja(r)){const r=e.filter(l=>l.v>0);if(!e.length)return null;if(!r.length)return"never held back";const s=r.length*(t/6e4),i=r[r.length-1];return`held back for ${s===1?"1 minute":`${s} minutes`}, last at ${n(i.t)}`}function ja(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function w0(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),s=n%60;return s?`${r}h ${s}m`:`${r}h`}function rH({group:e,title:t,onClose:n}){const r=pt(n),[s,i]=v.useState(null);v.useEffect(()=>{let f=!0;const h=async()=>{try{const g=await fetch(`/api/system/history?group=${e}`);if(!g.ok)return;const w=await g.json();f&&(w!=null&&w.ok)&&i(w)}catch{}};h();const m=window.setInterval(h,2e4);return()=>{f=!1,window.clearInterval(m)}},[e]);const l=(s==null?void 0:s.series)??[],[u,d]=v.useMemo(()=>{let f=1/0,h=0;for(const m of l)m.points.length&&(f=Math.min(f,m.points[0].t),h=Math.max(h,m.points[m.points.length-1].t));return[Number.isFinite(f)?Math.max(f,(s==null?void 0:s.sinceMs)??0):(s==null?void 0:s.sinceMs)??0,h]},[l,s==null?void 0:s.sinceMs]);return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:r,className:"modal hist-modal",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[a.jsxs("div",{className:"modal-head",children:[a.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),s&&u>0&&a.jsxs("span",{className:"hist-since",children:["since ",ja(u)," · ",w0(u,d||Date.now())]}),a.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),a.jsx("div",{className:"hist-body",children:s==null?a.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?a.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(f=>a.jsx(sH,{series:f,stepMs:s.stepMs},f.label))})]})}),document.body)}function sH({series:e,stepMs:t}){const n=v.useRef(null),[r,s]=v.useState(560),[i,l]=v.useState(null);v.useEffect(()=>{const $=n.current;if(!$||typeof ResizeObserver>"u")return;const I=new ResizeObserver(([D])=>s(Math.max(160,D.contentRect.width)));return I.observe($),()=>I.disconnect()},[]);const{points:u,unit:d,warnAt:f,critAt:h,label:m,top:g,restsAtZero:w,changes:b}=e,x=w?eH:$d,{now:k,peak:j}=tH(u),S=k!=null?op(k,d):null,_=j!=null?op(j,d):null,E=m==="Throttling"?nH(u,t):null,T=i!=null?u[i]:null,R=u.length>1?u[u.length-1].t-u[0].t:0,A=$=>{const I=r-_t.l-_t.r;return _t.l+(R>0?I*($-u[0].t)/R:I/2)},B=$=>{if(u.length<2)return;const I=$.currentTarget.getBoundingClientRect(),D=($.clientX-I.left-_t.l)/Math.max(1,I.width-_t.l-_t.r),F=u[0].t+R*Math.max(0,Math.min(1,D));let W=0;for(let M=1;M<u.length;M++)Math.abs(u[M].t-F)<Math.abs(u[W].t-F)&&(W=M);l(W)};return a.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[a.jsxs("div",{className:"hist-head",children:[a.jsx("span",{className:"hist-label",children:m}),a.jsxs("span",{className:"hist-stats",children:[S&&a.jsxs(a.Fragment,{children:[a.jsx("b",{children:S.value}),a.jsxs("span",{children:[S.unit," now"]})]}),j!=null&&_&&a.jsxs(a.Fragment,{children:[a.jsx("b",{className:AM(j,f,h),children:_.value}),a.jsxs("span",{children:[_.unit," peak"]})]})]})]}),a.jsx("div",{className:"hist-plot",ref:n,children:a.jsxs("svg",{className:"hist-chart",width:"100%",height:x,viewBox:`0 0 ${r} ${x}`,preserveAspectRatio:"none",role:"img","aria-label":S==null||_==null?`${m}: nothing measured yet`:`${m}: ${Tl(S)} now, peak ${Tl(_)}, over ${w0(u[0].t,u[u.length-1].t)}`,onPointerMove:B,onPointerLeave:()=>l(null),children:[[["warn",f],["hot",h]].map(([$,I])=>I==null||I>g?null:a.jsxs("g",{children:[a.jsx("line",{className:`hist-rule ${$}`,x1:_t.l,x2:r-_t.r,y1:nr(I,g,x),y2:nr(I,g,x)}),a.jsx("text",{className:`hist-rule-tag ${$}`,x:2,y:nr(I,g,x)+3,children:I})]},$)),a.jsx("line",{className:"hist-floor",x1:_t.l,x2:r-_t.r,y1:x-_t.b,y2:x-_t.b}),(b??[]).filter($=>$.from!=null&&u.length>1&&$.t>=u[0].t&&$.t<=u[u.length-1].t).map($=>a.jsx("line",{className:"hist-mark",x1:A($.t),x2:A($.t),y1:_t.t,y2:x-_t.b},$.t)),a.jsx("path",{className:"hist-area",d:RM(u,r,t,g,x)}),a.jsx("path",{className:"hist-line",d:TM(u,r,t,g,x)}),u.length===1&&a.jsx("circle",{className:"hist-dot",cx:A(u[0].t),cy:nr(u[0].v,g,x),r:3}),T&&a.jsxs("g",{children:[a.jsx("line",{className:"hist-cross",x1:A(T.t),x2:A(T.t),y1:_t.t,y2:x-_t.b}),a.jsx("circle",{className:"hist-dot",cx:A(T.t),cy:nr(T.v,g,x),r:3})]})]})}),a.jsx("div",{className:"hist-axis",children:T?a.jsxs("span",{className:"hist-at",children:[ja(T.t)," — ",(()=>{const $=op(T.v,d);return a.jsxs(a.Fragment,{children:[a.jsx("b",{children:$.value}),$.unit==="%"||$.unit==="°C"||!$.unit?$.unit:` ${$.unit}`]})})()]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{children:u.length?ja(u[0].t):""}),a.jsx("span",{children:u.length?ja(u[u.length-1].t):""})]})}),E&&a.jsx("div",{className:"hist-note",children:E}),b==null?void 0:b.slice(-3).map($=>a.jsx("div",{className:"hist-note hist-route",children:$.from==null?`Since ${ja($.t)} — ${$.label}`:`${ja($.t)} — ${$.label.charAt(0).toUpperCase()+$.label.slice(1)}`},$.t))]})}const aH="thermal:Throttling";function oH(e){var n,r,s,i;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 l of((s=e.thermal)==null?void 0:s.celsius)??[])t[`thermal:${l.label}`]=l.celsius;return(i=e.thermal)!=null&&i.throttle&&(t[aH]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function dl(e,t){return t==="B/s"?Tl(y0(e)):t==="ms"?Tl(Md(e)):t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function pu(e,t){return t==="B/s"||t==="ms"||!Number.isInteger(e)?dl(e,t):t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`}const fj=["cores","memory","load","thermal"],xa=116,Nr=24,iH=60,lH=6e4;function cH(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function uH(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function dH(e,t=iH){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function hH({sys:e}){const[t,n]=v.useState({});v.useEffect(()=>{let l=!0;const u=async()=>{const f=await Promise.all(fj.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]}}));l&&n(h=>{const m={...h};for(const[g,w]of f)w!=null&&w.ok&&(m[g]=w);return m})};u();const d=setInterval(()=>void u(),lH);return()=>{l=!1,clearInterval(d)}},[]);const r=v.useMemo(()=>oH(e),[e]),s=v.useMemo(()=>fj.flatMap(l=>{const u=t[l];return u?u.series.filter(cH).map(d=>({series:dH(d),stepMs:u.stepMs})):[]}),[t]),i=v.useMemo(()=>{let l=1/0,u=-1/0;for(const{series:d}of s){const f=d.points;f.length&&(l=Math.min(l,f[0].t),u=Math.max(u,f[f.length-1].t))}return Number.isFinite(l)?w0(l,u):"less than a minute"},[s]);return Object.keys(r).length?a.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${i}`,children:s.map(({series:l,stepMs:u})=>a.jsx(fH,{series:l,stepMs:u,now:r[l.key],span:i},l.key))}):null}function fH({series:e,stepMs:t,now:n,span:r}){var w;const{points:s,top:i,unit:l,warnAt:u,critAt:d}=e,f=uH(e),h=n??((w=s[s.length-1])==null?void 0:w.v),m=h==null?"":AM(h,u,d),g=Math.max(...s.map(b=>b.v));return a.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${f} · peak ${dl(g,l)} over the last ${r}`,u!=null?`over ${pu(u,l)} is uncomfortable`:"",d!=null?`over ${pu(d,l)} the machine acts`:""].filter(Boolean).join(" · "),children:[a.jsxs("div",{className:"pl-cell-head",children:[a.jsx("span",{className:"pl-cell-label",children:f}),a.jsx("span",{className:"pl-cell-now",children:h==null?"—":dl(h,l)})]}),a.jsxs("svg",{className:"pl-spark",width:xa,height:Nr,viewBox:`0 0 ${xa} ${Nr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[a.jsx("line",{className:"pl-spark-floor",x1:0,x2:xa,y1:Nr-Is.b,y2:Nr-Is.b}),a.jsx("path",{className:"pl-spark-area",d:RM(s,xa,t,i,Nr,Is)}),u!=null&&a.jsx("line",{className:"pl-rule warn",x1:0,x2:xa,y1:nr(u,i,Nr,Is),y2:nr(u,i,Nr,Is)}),d!=null&&a.jsx("line",{className:"pl-rule hot",x1:0,x2:xa,y1:nr(d,i,Nr,Is),y2:nr(d,i,Nr,Is)}),a.jsx("path",{className:"pl-spark-line",d:TM(s,xa,t,i,Nr,Is)})]}),a.jsxs("span",{className:"vis-hidden",children:["peak ",dl(g,l)," over the last ",r,u!=null&&`, uncomfortable over ${pu(u,l)}`,d!=null&&`, the machine acts over ${pu(d,l)}`]})]})}const pH={key:"cpu",dir:"desc"};function mH(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function gH(e,t){const n=t.dir==="asc"?1:-1,r=i=>t.key==="cpu"?i.cpu:t.key==="mem"?i.mem:t.key==="rss"?i.rssBytes:t.key==="threads"?i.threads:i.uptimeSec,s=(i,l)=>{if(t.key==="name")return n*i.name.localeCompare(l.name,void 0,{sensitivity:"base"});if(t.key==="user"){const f=i.user??"",h=l.user??"";return!f||!h?f===h?0:f?-1:1:n*f.localeCompare(h,void 0,{sensitivity:"base"})}const u=r(i),d=r(l);return u==null||d==null?u==null?d==null?0:1:-1:n*(u-d)};return[...e].sort((i,l)=>s(i,l)||(l.cpu??-1)-(i.cpu??-1)||l.mem-i.mem||i.pid-l.pid)}function yH(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const wH=4e3;function vH(){const[e,t]=v.useState(null);return v.useEffect(()=>{let n=!0;const r=async()=>{if(document.visibilityState!=="hidden")try{const i=await fetch("/api/system/processes?detail=1");if(!i.ok)return;const l=await i.json();n&&(l!=null&&l.ok)&&t({procs:l.procs??[],total:l.total??0})}catch{}};r();const s=window.setInterval(r,wH);return()=>{n=!1,window.clearInterval(s)}},[]),e}function xH(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 bH({sys:e,onClose:t}){const n=pt(t),[r,s]=v.useState(pH),i=vH(),l=i?gH(i.procs,r):null;return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:a.jsxs("div",{ref:n,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[a.jsxs("div",{className:"modal-head",children:[a.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),i&&a.jsxs("span",{className:"pl-count",children:[l.length," of ",i.total," running"]}),a.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),a.jsxs("div",{className:"pl-split",children:[a.jsx("div",{className:"pl-body",children:l==null?a.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):l.length===0?a.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):a.jsxs("table",{className:"sd-procs pl-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx(Eo,{col:"cpu",label:"cpu",sort:r,onSort:s}),a.jsx(Eo,{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:s}),a.jsx(Eo,{col:"threads",label:"threads",sort:r,onSort:s}),a.jsx(Eo,{col:"uptime",label:"up",sort:r,onSort:s}),a.jsx(Eo,{col:"user",label:"user",sort:r,onSort:s}),a.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),a.jsx(Eo,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:r,onSort:s})]})}),a.jsx("tbody",{children:l.map(u=>a.jsxs("tr",{children:[a.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),a.jsx("td",{className:"sd-num sd-dim",title:`${u.mem.toFixed(1)}% of installed memory`,children:ka(u.rssBytes)}),a.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),a.jsx("td",{className:"sd-num sd-dim",children:xH(u.uptimeSec)}),a.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),a.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),a.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&a.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),a.jsx(hH,{sys:e})]})]})}),document.body)}function Eo({col:e,label:t,note:n,sort:r,onSort:s}){const i=yH(r,e);return a.jsx("th",{scope:"col","aria-sort":i,children:a.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
79
|
-
|
|
80
|
-
${n}`:`Sort by ${t}`,onClick:()=>s(mH(r,e)),children:[t,a.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}function ux({value:e,unit:t,cap:n}){return t?a.jsxs("span",{className:"sd-fig",children:[a.jsx("span",{className:"sd-fig-cap",children:n}),a.jsxs("span",{className:"sd-fig-read",children:[a.jsx("b",{children:e})," ",a.jsx("span",{className:"sd-fig-unit",children:t})]})]}):a.jsxs("span",{className:"sd-fig",children:[a.jsx("b",{children:e}),a.jsx("span",{className:"sd-fig-cap",children:n})]})}function Rl({group:e,title:t,action:n,label:r,value:s,hint:i,children:l}){const[u,d]=v.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"sd-open",onClick:()=>d(!0),title:n,"aria-label":s==null?n:`${n}, now ${s}`,"aria-describedby":i?`sd-hint-${e}`:void 0,children:[a.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[r," ",a.jsx("i",{className:"sd-row-more",children:"›"}),s!=null&&a.jsx("span",{className:"sd-h-val",children:s})]}),l]}),i&&a.jsx("span",{id:`sd-hint-${e}`,className:"vis-hidden",children:i}),u&&a.jsx(rH,{group:e,title:t,onClose:()=>d(!1)})]})}function ed({label:e,value:t,pct:n,tone:r="calm",note:s,mark:i,title:l,trackLabel:u}){return a.jsxs("div",{className:"sd-row",title:l,children:[a.jsxs("div",{className:"sd-row-head",children:[a.jsx("span",{className:"sd-row-label",children:e}),a.jsx("span",{className:"sd-row-val",children:t})]}),a.jsxs("span",{className:"sd-track",role:u?"img":void 0,"aria-label":u,children:[a.jsx("span",{className:`sd-fill${r==="calm"?"":` ${r}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}}),i!=null&&i>0&&i<100&&a.jsx("span",{className:"sd-mark",style:{left:`${i}%`},"aria-hidden":!0})]}),s&&a.jsx("div",{className:"sd-note",children:s})]})}function kH(e,t,n){if(n<=0||Nd(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 Bs=4,er=8;function v0(e,t,n){const r=n.width-er-(e.right+Bs),s=e.left-Bs-er,i=t.width<=r||r>=s?"right":"left",l=i==="right"?e.right+Bs:e.left-Bs-t.width,u=n.height-er*2,d=t.height<=u,f=d?t.height:Math.max(0,u);return{top:Math.max(er,Math.min(e.top,n.height-er-f)),left:Math.max(er,l),side:i,maxHeight:d?null:f}}function NH(e,t,n){const r=n.height-er-(e.bottom+Bs),s=e.top-Bs-er,i=t.height<=r||r>=s?"below":"above",l=i==="below"?r:s,u=t.height<=l,d=u?t.height:Math.max(0,l),f=i==="below"?e.bottom+Bs:e.top-Bs-d,h=Math.max(er,Math.min(e.right-t.width,n.width-er-t.width));return{top:Math.max(er,f),left:h,side:i,maxHeight:u?null:d}}function jH(e,t,n){return!(!e||t!=null&&t.contains(e)||n!=null&&n.contains(e))}function MM(e,t,n){const r=v.useRef(t);r.current=t;const s=v.useRef(n);s.current=n,v.useEffect(()=>{const i=l=>{jH(l.target,e.current,r.current())&&s.current()};return window.addEventListener("pointerdown",i,!0),()=>window.removeEventListener("pointerdown",i,!0)},[e])}const $M='[role="menuitem"]';function pj(e){return e?Array.from(e.querySelectorAll($M)).filter(t=>!t.disabled):[]}function x0({anchorId:e,boundaryId:t,id:n,className:r,role:s,labelledBy:i,start:l="first",onClose:u,children:d}){const f=v.useRef(u);f.current=u;const h=pt(()=>{var x;(x=document.getElementById(e))==null||x.focus(),f.current()},{popover:!0}),m=v.useCallback(()=>{var E;const x=h.current;if(!x)return;const k=document.getElementById(e);if(!k){f.current();return}const j=k.getBoundingClientRect(),S=t?(E=document.getElementById(t))==null?void 0:E.getBoundingClientRect():null;if(S&&(j.bottom<=S.top||j.top>=S.bottom)){x.contains(document.activeElement)&&k.focus({preventScroll:!0}),f.current();return}x.style.maxHeight="";const _=NH(j,{width:x.offsetWidth,height:x.offsetHeight},{width:window.innerWidth,height:window.innerHeight});x.style.top=`${_.top}px`,x.style.left=`${_.left}px`,x.style.maxHeight=_.maxHeight==null?"":`${_.maxHeight}px`,x.dataset.side=_.side},[e,t,h]);v.useLayoutEffect(()=>{m()}),v.useEffect(()=>{const x=k=>{var j;(j=h.current)!=null&&j.contains(k.target)||m()};return window.addEventListener("scroll",x,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",m)}},[m,h]),MM(h,()=>document.getElementById(e),u),v.useEffect(()=>{var k;if(s!=="menu")return;const x=pj(h.current);(k=l==="last"?x[x.length-1]:x[0])==null||k.focus()},[]);const g=x=>{var k;if(s==="menu"&&x.key==="Tab"){x.stopPropagation(),(k=document.getElementById(e))==null||k.focus(),x.shiftKey&&x.preventDefault(),f.current();return}if(s==="menu"){const j=pj(h.current),S=kH(x,j.indexOf(document.activeElement),j.length);S.kind==="focus"&&(x.preventDefault(),j[S.index].focus())}x.key.length===1&&x.stopPropagation()},w=x=>{x.target.closest("button, input, select, textarea, code")||x.preventDefault()},b=x=>{if(s!=="menu"||x.pointerType==="touch")return;const k=x.target.closest($M);k&&!k.disabled&&document.activeElement!==k&&k.focus({preventScroll:!0})};return It.createPortal(a.jsx("div",{ref:h,id:n,className:`anchored-popover${r?` ${r}`:""}`,role:s,"aria-labelledby":i,onKeyDown:g,onMouseDown:w,onPointerMove:b,children:d}),document.body)}function SH({network:e}){const{down:t,up:n,api:r,route:s}=e,[i,l]=v.useState(!1),u=r&&r.ms!=null?Md(r.ms):null,d=t!=null&&n!=null;return a.jsxs("div",{className:"sd-section",role:"group","aria-label":"Network",children:[a.jsxs(Rl,{group:"network",title:"Network history",action:"Show network history",label:"Network",children:[(d||u)&&a.jsxs("div",{className:"sd-figs sd-figs-named",children:[d&&[["Download",t],["Upload",n]].map(([f,h])=>{const m=y0(h);return a.jsx(ux,{value:m.value,unit:m.unit,cap:f},f)}),u&&a.jsx(ux,{value:u.value,unit:u.unit,cap:"Claude API"})]}),!d&&a.jsx("div",{className:"sd-note",children:"measuring…"}),r&&r.ms==null&&a.jsx("div",{className:"sd-note sd-note-warn",children:"Can’t reach Claude"})]}),s&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"sd-detail",id:"sd-conn","aria-expanded":i,"aria-haspopup":"dialog",onClick:()=>l(f=>!f),children:["Connection details",s.relay&&a.jsx("span",{className:"sd-route-relay",children:" · relayed"}),a.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),i&&a.jsx(_H,{route:s,api:r,onClose:()=>l(!1)})]})]})}function _H({route:e,api:t,onClose:n}){return a.jsxs(x0,{anchorId:"sd-conn",boundaryId:"system-panel",id:"sd-conn-pop",className:"sd-pop",role:"dialog",labelledBy:"sd-conn-title",onClose:n,children:[a.jsx("p",{className:"sd-pop-title",id:"sd-conn-title",children:"Connection"}),a.jsxs("dl",{className:"sd-pop-rows",children:[a.jsxs("div",{className:"sd-pop-row",children:[a.jsx("dt",{children:e.to==="claude"?"Traffic to Claude":"Internet traffic"}),a.jsxs("dd",{children:["through ",Zz(e)]})]}),e.relay&&a.jsxs("div",{className:"sd-pop-row",children:[a.jsx("dt",{children:"Relay"}),a.jsxs("dd",{children:[a.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&&a.jsxs("div",{className:"sd-pop-row",children:[a.jsx("dt",{children:"Round trip"}),a.jsx("dd",{children:t.ms==null?`${t.host} did not answer`:`${Tl(Md(t.ms))} to open a connection to ${t.host}`})]}),a.jsxs("div",{className:"sd-pop-row",children:[a.jsx("dt",{children:"Throughput"}),a.jsx("dd",{children:"every interface on this machine, not this path alone"})]})]})]})}function mj({usageOpen:e,leaving:t,sub:n,flag:r,onClose:s,children:i}){return a.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[a.jsxs("div",{className:"sd-top",children:[a.jsxs("div",{className:"sd-head",children:[a.jsx("h2",{className:"sd-title",id:"sd-title",children:"This machine"}),n&&a.jsx("span",{className:"sd-sub",children:n}),a.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close",title:"Close",children:"×"})]}),r&&a.jsx("p",{className:"sd-flag",children:r})]}),i]})}function EH({usageOpen:e,leaving:t,onClose:n}){const r=Qz();if(!r||r.cpu==null||!r.memory)return a.jsx(mj,{usageOpen:e,leaving:t,onClose:n,children:a.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:s,swap:i,perCore:l,loadavg:u,cores:d,uptimeSec:f,platform:h,thermal:m,network:g,cpu:w}=r;return a.jsxs(mj,{usageOpen:e,leaving:t,sub:`up ${Yz(f)} · ${d} cores`,flag:Xz(r),onClose:n,children:[a.jsx(CH,{cpu:w,perCore:l,loadavg:u,cores:d}),a.jsx(TH,{memory:s,swap:i,platform:h}),g&&a.jsx(SH,{network:g}),a.jsx(RH,{thermal:m}),a.jsx(AH,{sys:r})]})}function CH({cpu:e,perCore:t,loadavg:n,cores:r}){const s=!!t&&t.length>0;return!s&&!n?null:a.jsxs("div",{className:"sd-section sd-cpu",role:"group","aria-label":"CPU",children:[s&&a.jsx(Rl,{group:"cores",title:"Core history",action:"Show core history",label:"CPU",value:e==null?null:`${Math.round(e)}%`,children:a.jsx("div",{className:"sd-cores",role:"img","aria-label":`${t.length} logical cores, busiest at ${Math.round(Math.max(...t))}%`,children:t.map((i,l)=>a.jsx("span",{className:"sd-core",title:`logical core ${l+1} · ${i}% busy`,children:a.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,i)/100})`}})},l))})}),n&&a.jsxs(Rl,{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:[a.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((i,l)=>a.jsx(ux,{value:i.toFixed(2),cap:["1m","5m","15m"][l]},l))}),n[0]>r&&a.jsx("div",{className:"sd-note",children:`${(n[0]/r).toFixed(1)}× more work queued than cores to run it`})]})]})}function TH({memory:e,swap:t,platform:n}){const r=e.total-e.available,s=n==="win32"?"Commit":"Swap",i=t&&t.total>0?t.used/t.total*100:0;return a.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:a.jsxs(Rl,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a.jsx(ed,{label:"Physical",value:a.jsxs(a.Fragment,{children:[a.jsx("b",{children:ka(r)})," of ",ka(e.total)]}),pct:e.usedPct,tone:e.usedPct>=90?"warn":"calm",note:`${ka(e.available)} available`}),t&&t.total>0&&a.jsx(ed,{label:s,value:a.jsxs(a.Fragment,{children:[a.jsx("b",{children:ka(t.used)})," of ",ka(t.total)]}),pct:i,tone:i>=90?"warn":"calm"})]})})}function RH({thermal:e}){if(!e)return null;const t=e.throttle?Gz(e.throttle.speedLimit,e.heldBack):null;return a.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:a.jsxs(Rl,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>a.jsx(ed,{label:n.label,value:a.jsxs(a.Fragment,{children:[a.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius/n.critAt*100,mark:n.warnAt/n.critAt*100,tone:Vz(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&&a.jsx(ed,{label:"Throttling",value:a.jsx("b",{children:t.value}),pct:t.pct,tone:t.tone,note:t.note})]})})}function AH({sys:e}){const[t,n]=v.useState(!1);return a.jsxs("div",{className:"sd-section sd-door-section",children:[a.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:a.jsxs("span",{className:"sd-door-plate",children:[a.jsxs("span",{className:"sd-door-name",children:["Busiest processes",a.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),a.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&a.jsx(bH,{sys:e,onClose:()=>n(!1)})]})}function MH(e){return{inputTokens:e.i,outputTokens:e.o,cacheReadTokens:e.cr,cacheCreateTokens:e.cc,cacheCreate1hTokens:e.c1h,cacheCreate5mTokens:e.c5m}}function IM(e){return e.i+e.o+e.cr+e.cc}function gj(e){let t=0;for(const n of Object.values(e))t+=IM(n);return t}function $H(e){const t=s=>typeof s=="number"&&Number.isFinite(s)?s:0,n=new Map,r=e&&Array.isArray(e.days)?e.days:[];for(const s of r){const i=typeof s.period=="string"?s.period:"",l=Array.isArray(s.modelBreakdowns)?s.modelBreakdowns:[];for(const u of l){const d=typeof u.modelName=="string"?u.modelName:"";if(!i||!/claude/i.test(d)||u.missingPricing===!0)continue;const f=`${i}|${d}`,h=n.get(f),m=h?h.usage:{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,cacheCreate1hTokens:0,cacheCreate5mTokens:0};m.inputTokens+=t(u.inputTokens),m.outputTokens+=t(u.outputTokens),m.cacheReadTokens+=t(u.cacheReadTokens),m.cacheCreateTokens+=t(u.cacheCreationTokens),h?h.cost+=t(u.cost):n.set(f,{cost:t(u.cost),usage:m})}}return n}function IH(e,t,n,r=Date.now()){const s=new Map;let i=0,l=0;for(const[T,R]of n){const A=T.indexOf("|"),B=T.slice(0,A),$=T.slice(A+1),I=Nl(R.usage,$,r).total;if(!(I>0&&R.cost>0))continue;i+=R.cost,l+=I;let D=s.get(B);D||(D=new Map,s.set(B,D)),D.set($,R.cost/I)}const u=l>0,d=(T,R)=>{const A=s.get(T);return(A==null?void 0:A.get(R))??(A==null?void 0:A.get(ai(R)))??1},f=new Set,h=(T,R)=>{let A=0,B=0;for(const[$,I]of Object.entries(T)){if(Fa($,r)){A+=Nl(MH(I),$,r).total*R($);continue}const D=IM(I);D>0&&(B+=D,f.add($))}return{cost:A,unpriced:B}},m=new Map,g=[];for(const T of e){const R=new Map,A=new Map;let B=0;for(const $ of T.projects){const{cost:I,unpriced:D}=h($.models,W=>d(T.day,W));R.set($.path,(R.get($.path)??0)+I),D>0&&A.set($.path,(A.get($.path)??0)+D),B+=I;let F=m.get($.path);F||(F={path:$.path,cost:0,tokens:0,unpricedTokens:0},m.set($.path,F)),F.cost+=I,F.tokens+=gj($.models),F.unpricedTokens+=D}g.push({day:T.day,total:B,byPath:R,unpricedByPath:A})}const w=[...m.values()].sort((T,R)=>R.cost-T.cost||R.tokens-T.tokens),b=w.reduce((T,R)=>T+R.cost,0),x=w.reduce((T,R)=>T+R.tokens,0),k=w.reduce((T,R)=>T+R.unpricedTokens,0),j=u?i/l:1,S=t?gj(t):0,_=t?h(t,()=>j):{cost:0,unpriced:0},E=_.cost>0||S>0?{cost:_.cost,tokens:S,unpricedTokens:_.unpriced}:null;return{projects:w,totalCost:b,totalTokens:x,unpricedTokens:k,perDay:g,unattributed:E,unpricedModels:[...f].sort(),calibrated:u,reconciled:u&&k===0}}function jr(e,t,n=qe){return t>0?e>0?`${n(e)}+`:es:n(e)}function Co(e){return e>0?`${st(e)} of these tokens are on an unpriced model, so this is a floor`:void 0}function OH(e){if(e.length===0)return null;const t=e.length===1,n=t?e[0]:`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`;return t?`${n} is ${es}: this build holds no published rate for it, so its tokens are counted and its dollars are not.`:`${n} are ${es}: this build holds no published rate for them, so their tokens are counted and their dollars are not.`}const LH={phase:"running"},PH={phase:"failed"},DH={gen:0,report:null,error:null,early:null};function FH(e,t){var n,r;if(t.type!=="start"&&t.gen!==e.gen)return e;switch(t.type){case"start":return{...e,gen:t.gen,error:null,early:null};case"report":{const s=((n=e.early)==null?void 0:n.gen)===t.gen?e.early.cost:LH;return{...e,report:{gen:t.gen,days:t.days,data:t.data,cost:s},early:null}}case"reportFailed":return{...e,report:null,error:t.message,early:null};case"cost":return((r=e.report)==null?void 0:r.gen)===t.gen?{...e,report:{...e.report,cost:t.cost}}:{...e,early:{gen:t.gen,cost:t.cost}}}}function qH(e){var t;return((t=e.report)==null?void 0:t.gen)!==e.gen&&e.error===null}function BH(e){const t=e;return t&&t.ok!==!1?{phase:"ready",range:t}:PH}function yj(e){return`${e.getFullYear()}${String(e.getMonth()+1).padStart(2,"0")}${String(e.getDate()).padStart(2,"0")}`}function UH(e,t,n=Date.now()){const r=t===0?60:t,s=yj(new Date(n-(r-1)*864e5)),i=yj(new Date(n));return{report:`/api/account-projects?num=${e}&days=${t}`,ccusage:`/api/ccusage?since=${s}&until=${i}`}}function zH({num:e,days:t,gen:n,dispatch:r,get:s=(l,u)=>fetch(l,u),now:i=Date.now()}){const l=UH(e,t,i),u={credentials:"same-origin"};s(l.report,u).then(d=>d.ok?d.json():Promise.reject(new Error(`HTTP ${d.status}`))).then(d=>r({type:"report",gen:n,days:t,data:d}),d=>r({type:"reportFailed",gen:n,message:(d==null?void 0:d.message)||"Could not load"})),s(l.ccusage,u).then(d=>d.ok?d.json():null).catch(()=>null).then(d=>r({type:"cost",gen:n,cost:BH(d)}))}async function qa(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(s=>window.setTimeout(()=>s(!1),t))])}catch{n=!1}if(n)return!0;try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(s),s.select(),n=document.execCommand("copy"),s.remove()}catch{n=!1}return n}function OM(e){return/^[A-Za-z]:[\\/]$/.test(e)?e:e.replace(/[\\/]+$/,"")}function ip(e){const t=OM(e).replace(/\\/g,"/");return/^[A-Za-z]:\//.test(t)?t.toLowerCase():t}function wj(e){if(!e)return e;const t=OM(e),n=t.match(/^\/(?:Users|home)\/[^/]+(\/.*)?$/);if(n)return`~${n[1]??""}`;const r=t.replace(/\\/g,"/").match(/^[A-Za-z]:\/Users\/[^/]+(\/.*)?$/i);return r?`~${r[1]??""}`:t.replace(/\\/g,"/")}function HH(e,t){const n=ip(e);let r;for(const s of t){const i=ip(s.path);!i||i===n||!n.startsWith(`${i}/`)||(!r||ip(r.path).length<i.length)&&(r=s)}return r==null?void 0:r.label}function dx(e){return e===0?"all time":e===1?"today":`the last ${e} days`}function WH(e){return e===1?"No work attributed to this account yet today.":`No work attributed to this account in ${dx(e)}.`}function VH(e){return e===1?7:e===7?30:e===30?0:null}function GH(e,t){return e!==1&&t>0}const KH=[{days:1,label:"Today"},{days:7,label:"7d"},{days:30,label:"30d"},{days:0,label:"All"}],To=["var(--usage-blue)","var(--usage-teal)","var(--usage-lime)","var(--usage-purple)","var(--usage-indigo)","var(--usage-pink)","var(--usage-orange)","var(--usage-zinc)"],YH="var(--usage-zinc)",lp=6,XH=1600;function ZH(e){const t=qe(e),n=/^\$(\d{4,})$/.exec(t);return n?`$${Number(n[1]).toLocaleString("en-US")}`:t}function mu(e,t){if(t<=0||e<=0)return"0%";const n=e/t*100;return n<.01?"<0.01%":n<1?`${n.toFixed(2)}%`:n<10?`${n.toFixed(1)}%`:`${Math.round(n)}%`}function JH(e){const t=/^\d{4}-(\d{2})-(\d{2})$/.exec(e);return t?`${Number(t[1])}/${Number(t[2])}`:e}function QH(e){const t=Math.max(1,Math.ceil(e/6));return n=>n===0||n===e-1||n%t===0}function cp(e){if(!e)return"";try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function eW({num:e,name:t,onClose:n}){var O,L,K,Z;const[r,s]=v.useState(1),[i,l]=v.useReducer(FH,DH),u=((O=i.report)==null?void 0:O.data)??null,d=((L=i.report)==null?void 0:L.days)??r,f=((K=i.report)==null?void 0:K.cost.phase)==="ready"?i.report.cost.range:null,h=((Z=i.report)==null?void 0:Z.cost.phase)==="running",[m,g]=v.useState(null),[w,b]=v.useState(()=>new Set),x=qH(i),k=i.error,[j,S]=v.useState(null),_=v.useRef(void 0),E=v.useRef(!0);v.useEffect(()=>()=>{E.current=!1,window.clearTimeout(_.current)},[]);const T=v.useRef(null),R=pt(n,{focusRef:T}),A=v.useRef(0);v.useEffect(()=>{const q=++A.current;l({type:"start",gen:q}),g(null),b(new Set),zH({num:e,days:r,gen:q,dispatch:l})},[e,r]);const B=v.useMemo(()=>{const q=Date.now();if(!u)return null;const H=IH(u.daily??[],u.unattributed,$H(f),q),P=ue=>ue.replace(/[\\/]+$/,"").split(/[\\/]/).pop()||ue||"(unknown)",Y=new Map;for(const ue of H.projects)Y.set(P(ue.path),(Y.get(P(ue.path))??0)+1);const G=ue=>{const se=P(ue);if((Y.get(se)??0)<=1)return se;const be=ue.replace(/[\\/]+$/,"").split(/[\\/]/).slice(-2,-1)[0];return be?`${be}/${se}`:se},z=H.projects.map(ue=>({path:ue.path,label:G(ue.path)})),X=ue=>({path:ue.path,label:G(ue.path),parentLabel:HH(ue.path,z),cost:ue.cost,tokens:ue.tokens,unpricedTokens:ue.unpricedTokens}),V=To[lp%To.length],J=new Map,ee=[],re=H.projects.slice(0,lp),oe=H.projects.slice(lp);re.forEach((ue,se)=>{J.set(ue.path,To[se%To.length]),ee.push({key:ue.path,...X(ue),color:To[se%To.length]})}),oe.length&&ee.push({key:"__other__",label:`Other · ${oe.length} project${oe.length>1?"s":""}`,cost:oe.reduce((ue,se)=>ue+se.cost,0),tokens:oe.reduce((ue,se)=>ue+se.tokens,0),unpricedTokens:oe.reduce((ue,se)=>ue+se.unpricedTokens,0),color:V,muted:!0,members:oe.map(X)});const fe=H.totalCost,Ne=H.totalTokens,we=fe>0&&H.unpricedTokens===0?"cost":"tokens",ye=we==="cost"?fe:Ne,ve=ee.map(ue=>ue.color),Ie=H.perDay.map(ue=>{const se=new Map;for(const[Le,$e]of ue.byPath){const Oe=J.get(Le)??V;se.set(Oe,(se.get(Oe)??0)+$e)}const be=new Map;let Te=0;for(const[Le,$e]of ue.unpricedByPath){const Oe=J.get(Le)??V;be.set(Oe,(be.get(Oe)??0)+$e),Te+=$e}return{day:ue.day,total:ue.total,costByColor:se,unpricedByColor:be,unpriced:Te}}),xe=Ie.reduce((ue,se)=>Math.max(ue,se.total),0);return{rows:ee,totalCost:fe,totalTokens:Ne,basis:we,denom:ye,un:H.unattributed,chart:Ie,maxDay:xe,colorOrder:ve,unpricedTokens:H.unpricedTokens,unpricedNote:OH(H.unpricedModels),calibrated:H.calibrated,reconciled:H.reconciled}},[u,f]),$=(q,H)=>{qa(q).then(P=>{E.current&&(window.clearTimeout(_.current),S({path:q,label:H,ok:P}),_.current=window.setTimeout(()=>{E.current&&S(null)},XH))})},I=q=>j!=null&&j.ok&&j.path===q?"Copied":"Copy",D=u!=null&&u.trackedSince?`Tracked since ${cp(u.trackedSince)}`:"Tracking starts with this version",F=dx(d),W=VH(d),M=x&&!!u;return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:R,className:"modal ap-proj-modal",onClick:q=>q.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ap-proj-title ap-proj-sub",children:[a.jsxs("header",{className:"ap-proj-head",children:[a.jsxs("div",{className:"ap-proj-titlewrap",children:[a.jsx("div",{className:"ap-proj-title",id:"ap-proj-title",children:"Projects"}),a.jsx("div",{className:"ap-proj-sub",id:"ap-proj-sub",title:t,children:t})]}),a.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:KH.map(q=>a.jsx("button",{type:"button",className:"uh-range-btn","aria-pressed":r===q.days,onClick:()=>s(q.days),children:q.label},q.days))}),a.jsx("button",{ref:T,className:"glyph-btn ap-proj-close",onClick:n,"aria-label":"Close",children:"×"})]}),a.jsxs("div",{className:`ap-proj-body${M?" refreshing":""}`,"aria-busy":x,children:[x&&!u&&a.jsx("div",{className:"ap-proj-state",children:"Loading…"}),!x&&k&&a.jsxs("div",{className:"ap-proj-state ap-proj-error",children:["Couldn’t load this report: ",k]}),!k&&B&&a.jsx(a.Fragment,{children:B.rows.length===0?a.jsxs("div",{className:"ap-proj-state",children:[WH(d),W!=null&&a.jsx("div",{className:"ap-proj-widen-wrap",children:a.jsxs("button",{type:"button",className:"ap-proj-copy",onClick:()=>s(W),children:["Show ",dx(W)]})}),a.jsxs("div",{className:"ap-proj-note",children:[D,". Only work from this version onward can be tied to an account."]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"ap-proj-bar",role:"img","aria-label":B.basis==="cost"?`Share of ${qe(B.totalCost)} across ${B.rows.length} projects`:`Share of ${st(B.totalTokens)} tokens across ${B.rows.length} projects`,children:B.rows.map(q=>{const H=B.basis==="cost"?q.cost:q.tokens,P=B.denom>0?H/B.denom*100:0;if(P<=0)return null;const Y=B.basis==="cost"?mu(q.cost,B.totalCost):`${mu(q.tokens,B.totalTokens)} of tokens`;return a.jsx("span",{className:"ap-proj-seg",style:{width:`${P}%`,background:q.color},title:`${q.label} · ${jr(q.cost,q.unpricedTokens)} · ${Y}${q.tokens?` · ${st(q.tokens)} tokens`:""}`},q.key)})}),a.jsxs("div",{className:"ap-proj-totals",children:[a.jsx("span",{className:"ap-proj-total-cost",title:Co(B.unpricedTokens),children:jr(B.totalCost,B.unpricedTokens)}),a.jsxs("span",{className:"ap-proj-total-tok",children:[st(B.totalTokens)," tokens"]}),a.jsxs("span",{className:"ap-proj-total-win",children:["· ",F]}),h&&a.jsx("span",{className:"ap-proj-total-pending",children:"Reconciling cost…"})]}),B.unpricedNote&&a.jsx("div",{className:"ap-proj-note",children:B.unpricedNote}),GH(d,B.chart.length)&&a.jsxs("div",{className:"ap-proj-days",children:[a.jsxs("div",{className:"ap-proj-days-cap",children:["By day",B.chart.length>1?" · click a bar":""]}),a.jsx("div",{className:"ap-proj-days-plot",role:"img","aria-label":`Spend across ${B.chart.length} day${B.chart.length>1?"s":""}`,children:B.chart.map(q=>{const H=B.maxDay>0?q.total/B.maxDay*100:0,P=m===q.day,Y=B.rows.map(z=>({label:z.label,c:q.costByColor.get(z.color)??0,u:q.unpricedByColor.get(z.color)??0})).filter(z=>z.c>0||z.u>0),G=`${cp(Date.parse(`${q.day}T00:00:00`))}, ${jr(q.total,q.unpriced)}. ${Y.map(z=>`${z.label} ${jr(z.c,z.u)}`).join(", ")}`;return a.jsx("button",{type:"button",className:`ap-proj-day${P?" selected":""}`,"aria-pressed":P,"aria-label":G,title:`${q.day} · ${jr(q.total,q.unpriced)}`,onClick:()=>g(z=>z===q.day?null:q.day),children:a.jsx("span",{className:"ap-proj-col",style:{height:`${H}%`},children:B.colorOrder.map((z,X)=>{const V=q.costByColor.get(z)??0;return V<=0||q.total<=0?null:a.jsx("span",{className:"ap-proj-colseg",style:{height:`${V/q.total*100}%`,background:z}},X)})})},q.day)})}),(()=>{const q=QH(B.chart.length);return a.jsx("div",{className:"ap-proj-days-axis","aria-hidden":"true",children:B.chart.map((H,P)=>a.jsx("div",{className:"ap-proj-axis-cell",children:q(P)?JH(H.day):""},H.day))})})(),(()=>{const q=m?B.chart.find(P=>P.day===m):null;if(!q)return null;const H=B.rows.map(P=>({r:P,c:q.costByColor.get(P.color)??0,u:q.unpricedByColor.get(P.color)??0})).filter(P=>P.c>0||P.u>0);return a.jsxs("div",{className:"ap-proj-day-detail",children:[a.jsxs("div",{className:"ap-proj-day-detail-head",children:[a.jsx("span",{children:cp(Date.parse(`${q.day}T00:00:00`))}),a.jsx("span",{className:"ap-proj-day-detail-total",title:Co(q.unpriced),children:jr(q.total,q.unpriced)})]}),H.map(({r:P,c:Y,u:G})=>a.jsxs("div",{className:"ap-proj-day-detail-row",children:[a.jsx("span",{className:"ap-proj-dot",style:{background:P.color},"aria-hidden":"true"}),a.jsx("span",{className:"ap-proj-day-detail-name",children:P.label}),a.jsx("span",{className:"ap-proj-day-detail-cost",title:Co(G),children:jr(Y,G)})]},P.key))]})})()]}),a.jsx("ul",{className:"ap-proj-list",children:B.rows.map((q,H)=>{const P=B.basis==="cost"?q.cost:q.tokens,Y=B.denom>0?P/B.denom*100:0,G=w.has(q.key),z=`ap-proj-details-${H}`,X=G&&(!!q.path||!!q.members),V=q.members?`${G?"Hide":"Show"} the ${q.members.length} project${q.members.length>1?"s":""} folded into Other`:`${G?"Hide":"Show"} location for ${q.label}`;return a.jsxs("li",{className:`ap-proj-row${q.muted?" muted":""}${G?" expanded":""}`,children:[a.jsx("span",{className:"ap-proj-dot",style:{background:q.color},"aria-hidden":"true"}),a.jsxs("span",{className:"ap-proj-name",children:[q.label,q.parentLabel&&a.jsxs("span",{className:"ap-proj-parent",children:[" · in ",q.parentLabel]})]}),a.jsx("span",{className:"ap-proj-track",title:B.basis==="cost"?`${mu(q.cost,B.totalCost)} of tracked cost`:`${mu(q.tokens,B.totalTokens)} of tracked tokens`,children:a.jsx("span",{className:"ap-proj-fill",style:{width:`${Y}%`,background:q.color}})}),a.jsx("span",{className:"ap-proj-cost",title:Co(q.unpricedTokens),children:jr(q.cost,q.unpricedTokens)}),a.jsx("span",{className:"ap-proj-tok",children:st(q.tokens)}),a.jsx("button",{type:"button",className:"glyph-btn ap-proj-info","aria-expanded":G,"aria-controls":X?z:void 0,"aria-label":V,onClick:()=>b(J=>{const ee=new Set(J);return ee.has(q.key)?ee.delete(q.key):ee.add(q.key),ee}),children:"ⓘ"}),G&&q.path&&a.jsxs("div",{className:"ap-proj-details",id:z,children:[a.jsx("code",{className:"ap-proj-path",children:wj(q.path)}),a.jsx("button",{type:"button",className:"ap-proj-copy","aria-label":`${I(q.path)} location for ${q.label}`,onClick:()=>$(q.path,q.label),children:I(q.path)})]}),G&&q.members&&a.jsx("div",{className:"ap-proj-details ap-proj-other-members",id:z,children:q.members.map(J=>a.jsxs("div",{className:"ap-proj-other-member",children:[a.jsxs("div",{className:"ap-proj-other-name",children:[J.label,J.parentLabel&&a.jsxs("span",{className:"ap-proj-parent",children:[" · in ",J.parentLabel]})]}),a.jsx("code",{className:"ap-proj-path",children:wj(J.path)}),a.jsx("span",{className:"ap-proj-cost",title:Co(J.unpricedTokens),children:jr(J.cost,J.unpricedTokens)}),a.jsx("span",{className:"ap-proj-tok",children:st(J.tokens)}),a.jsx("button",{type:"button",className:"ap-proj-copy","aria-label":`${I(J.path)} location for ${J.label}`,onClick:()=>$(J.path,J.label),children:I(J.path)})]},J.path))})]},q.key)})}),B.un&&a.jsxs("div",{className:"ap-proj-unattributed",children:[a.jsx("span",{className:"ap-proj-dot",style:{background:YH},"aria-hidden":"true"}),a.jsxs("div",{className:"ap-proj-un-labels",children:[a.jsx("span",{className:"ap-proj-un-title",children:"Unattributed usage"}),a.jsx("span",{className:"ap-proj-un-tag",children:"Excluded from the project totals"})]}),a.jsx("span",{className:"ap-proj-un-cost",title:Co(B.un.unpricedTokens),children:jr(B.un.cost,B.un.unpricedTokens,ZH)}),a.jsx("span",{className:"ap-proj-un-tok",children:st(B.un.tokens)}),a.jsx("div",{className:"ap-proj-note",children:"Work no account could be tied to — from before tracking, or a gap."})]}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:j&&(j.ok?`Copied the location of ${j.label}`:`Could not copy the location of ${j.label} — select it and copy it by hand`)}),a.jsxs("div",{className:"ap-proj-foot",children:[h?"Dollars estimated · ccusage still running":B.reconciled?"Dollars from ccusage · split by activity":B.calibrated?"Dollars from ccusage for the priced models · split by activity":f?"Dollars estimated · ccusage could not price this window":"Dollars estimated · ccusage unavailable"," · ",D]})]})})]})]})}),document.body)}function Qo(e,t){return cM(t-Math.floor(e/1e3))}function tW(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 b0(){return a.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:[a.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),a.jsx("path",{d:"M7 5.6v2.9"}),a.jsx("path",{d:"M7 10.3v.05"})]})}function nW({anchorId:e,boundaryId:t,issue:n,who:r,fetchedAt:s,nowSec:i,onClose:l,onSignIn:u}){return a.jsx(x0,{anchorId:e,boundaryId:t,id:"ap-issue-pop",className:"ap-pop ap-issue-pop",role:"dialog",labelledBy:"ap-issue-title",onClose:()=>l(),children:a.jsxs("div",{className:"ap-pop-form",children:[a.jsxs("p",{className:"ap-pop-title ap-issue-title",id:"ap-issue-title","data-tone":n.tone,children:[n.tone==="warn"&&a.jsx(b0,{}),n.text]}),a.jsx("p",{className:"ap-pop-note ap-issue-hint",children:n.hint}),a.jsxs("p",{className:"ap-pop-note ap-issue-when",children:[a.jsx("span",{className:"ap-issue-who",children:r})," · ",s?`last collected ${Qo(s,i)}`:"never collected"]}),a.jsxs("div",{className:"ap-pop-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>l(!0),children:"Done"}),n.fix&&a.jsx("button",{type:"button",className:"btn primary",onClick:()=>{l(!0),u()},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:n.fix})]})]})})}function sl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function rW(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)),s=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} ${s} It tries again in ${r}m. No sign-in, no switch.`}}return{text:"numbers paused",hint:n}}function sW(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 aW(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 ei(e,t){if(e.staleCopy){const n=rW(e.repair??null,t);return{text:sl(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=aW(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:sl(n.text),hint:n.hint,fix:n.fix?sl(n.fix):null,tone:r||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:r}}if(e.error){const n=sW(e.error);return{text:sl(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function vj(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function oW(e){const t=e.filter(u=>!vj(u)),n=e.filter(u=>vj(u)),r=t.length?t:n,s=t.length?n:[],i=r.reduce((u,d)=>u&&u.pct>=d.pct?u:d,null);let l=null;for(const u of s)i&&u.pct<=i.pct||(!l||u.pct>l.pct)&&(l=u);return{shown:r,rest:s,fuller:l,peak:l??i}}const iW="\0";function _r(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}${iW}${n}`}function lW(e,t,n=_r){const r=n(t);return e.includes(r)?e.filter(s=>s!==r):[...e,r]}const Id="slot",k0=[{lane:"five_hour",name:"5h"},{lane:"seven_day",name:"7d"}],LM=e=>e.id.startsWith("scoped-");function cW(e){var t;return((t=k0.find(n=>n.lane===e.id))==null?void 0:t.name)??e.label}function uW(e){if(e==="room")return"room";const t=/^(.+):(full|empty)$/.exec(e);return t?t[1]:null}function PM(e){const t=[...new Set(e.flatMap(r=>(r.lanes??[]).filter(LM).map(s=>s.label)))].sort((r,s)=>r.localeCompare(s)),n=[...k0.map(r=>r.name),...t];return[{id:Id,label:"Slot"},...n.flatMap(r=>[{id:`${r}:full`,label:`${r} · fullest`},{id:`${r}:empty`,label:`${r} · emptiest`}]),{id:"room",label:"Most room"}]}function xj(e,t){const n=k0.find(s=>s.name===t),r=(e.lanes??[]).find(s=>n?s.id===n.lane:LM(s)&&s.label===t);return r&&Number.isFinite(r.pct)?r.pct:null}function dW(e,t,n=()=>!0){const r=[...e],s=f=>[...f.filter(n),...f.filter(h=>!n(h))];if(t==="room")return s(bj(r,f=>Number.isFinite(f.headroom)?f.headroom:null,"desc"));const i=/^(.+):(full|empty)$/.exec(t);if(!i)return r;const[,l,u]=i;if(!r.some(f=>xj(f,l)!=null))return r;const d=bj(r,f=>xj(f,l),u==="full"?"desc":"asc");return u==="empty"?s(d):d}function bj(e,t,n){const r=e.filter(i=>t(i)!=null),s=e.filter(i=>t(i)==null);return r.sort((i,l)=>n==="desc"?t(l)-t(i):t(i)-t(l)),[...r,...s]}function hW(e,t){return PM(t).some(n=>n.id===e)?e:Id}function DM(e,t){if(!t)return[...e];const n=new Map(t.map((i,l)=>[i,l])),r=e.filter(i=>n.has(_r(i))).sort((i,l)=>n.get(_r(i))-n.get(_r(l))),s=e.filter(i=>!n.has(_r(i)));return[...r,...s]}function N0(e){const t=_r(e);return t.startsWith("slot:")?t:`h:${fW(t)}`}function fW(e){let t=3735928559,n=1103547991;for(let r=0;r<e.length;r++){const s=e.charCodeAt(r);t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2097151&n)+(t>>>0)).toString(36)}const hx={mode:"some",keys:[]};function FM(e,t){const n=e.keys.includes(N0(t));return e.mode==="all"?!n:n}function pW(e,t){return{mode:e.mode,keys:lW(e.keys,t,N0)}}function qM(e,t){return t.length>0&&t.every(n=>FM(e,n))}function mW(e,t){return qM(e,t)?hx:{mode:"all",keys:[]}}function gW(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(N0)),r=e.keys.filter(s=>n.has(s));return r.length===e.keys.length?e:{mode:e.mode,keys:r}}function yW(e){return e>=90?"hi":e>=70?"mid":void 0}function wW({lane:e,nowSec:t,frozen:n,sortedBy:r}){const s=Math.min(100,Math.max(0,e.pct)),i=n?"var(--muted)":s>=90?"var(--err)":s>=70?"var(--warn)":"var(--accent)",l=e.resetAt&&!n?Cd(e.resetAt,t):null;return a.jsxs("div",{className:"ap-lane","data-sort-key":r?"":void 0,children:[a.jsx("span",{className:"ap-lane-label",title:e.label,children:e.label}),a.jsx("div",{className:"ap-lane-track",children:a.jsx("div",{className:"ap-lane-fill",style:{width:`${s===0?1.5:s}%`,background:i,opacity:s===0||n?.4:1}})}),a.jsxs("span",{className:"ap-lane-pct",style:{color:i},children:[s,"%"]}),a.jsx("span",{className:"ap-lane-reset",title:l?`${e.label} resets in ${l}`:void 0,children:l&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"vis-hidden",children:"resets in "}),l]})})]})}function vW({a:e,nowSec:t,opened:n,onToggleLanes:r,busy:s,pressProps:i,onSwitch:l,menuOpen:u,onOpenMenu:d,onCloseMenu:f,refusal:h,onDismissRefusal:m,switchedHere:g,swapped:w,displaced:b,issueExpanded:x,onOpenIssue:k,sortKey:j=null}){const{shown:S,fuller:_}=oW(e.lanes),E=j==="room"?e.lanes.reduce((F,W)=>F&&F.pct>=W.pct?F:W,null):j?e.lanes.find(F=>cW(F)===j)??null:null,T=ei(e,t),R=e.active||n,A=e.alias??e.email??`account ${e.num}`,B=e.alias&&e.email?`${e.alias} · ${e.email}`:A,$=e.stale||(T==null?void 0:T.blocksSwitch)===!0,I=_?[...S,_]:S,D=e.fetchedAt?Qo(e.fetchedAt,t):null;return a.jsxs("li",{className:`ap-account${e.active?" active":""}`,"aria-current":e.active?"true":void 0,"data-open":R?"":void 0,"data-frozen":$?"":void 0,children:[!e.active&&a.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${e.num}`,title:B,"aria-expanded":R,"aria-controls":R?`ap-detail-${e.num}`:void 0,"aria-describedby":[e.alias&&e.email?`ap-email-${e.num}`:null,!R&&!(T!=null&&T.blocksSwitch)?`ap-quota-${e.num}`:null].filter(Boolean).join(" ")||void 0,onClick:()=>r(),children:a.jsxs("span",{className:"vis-hidden",children:[A,", ",R?"hide details":"details"]})}),a.jsxs("div",{className:"ap-account-head",children:[e.active?a.jsx("span",{className:"ap-live",title:`Active account · slot ${e.num}`,children:a.jsxs("span",{className:"vis-hidden",children:["Active account, slot ",e.num,":"]})}):a.jsx("span",{className:"ap-num",children:e.num}),e.alias&&a.jsx("span",{className:"ap-alias",title:e.alias,children:e.alias}),a.jsx("span",{className:"ap-email",id:`ap-email-${e.num}`,title:e.email??void 0,children:e.email}),e.disabled&&a.jsx("span",{className:"ap-held",children:"held out"}),!e.active&&!e.disabled&&!(T!=null&&T.blocksSwitch)&&a.jsx("button",{type:"button",className:"ap-switch",...i(`switch-${e.num}`),onClick:()=>l(e.num,A),"aria-label":`Switch to ${A}`,title:`Switch to ${e.alias??e.email}`,children:s===`switch-${e.num}`?"…":"Switch"}),a.jsx("button",{type:"button",id:`ap-more-${e.num}`,className:"ap-more","aria-label":`More actions for ${e.email??e.alias??`account ${e.num}`}`,"aria-haspopup":"menu","aria-expanded":u,"aria-controls":u?`ap-menu-${e.num}`:void 0,title:"More actions",onClick:()=>u?f():d(e.num),onKeyDown:F=>{F.key!=="ArrowDown"&&F.key!=="ArrowUp"||(F.preventDefault(),d(e.num,F.key==="ArrowUp"?"last":"first"))},children:a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:[a.jsx("circle",{cx:"2.8",cy:"7",r:"1.15"}),a.jsx("circle",{cx:"7",cy:"7",r:"1.15"}),a.jsx("circle",{cx:"11.2",cy:"7",r:"1.15"})]})})]}),h&&a.jsxs("div",{className:"ap-failure ap-row-failure",role:"alert",children:[a.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),a.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),e.active&&g&&a.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."}),w&&(()=>{const F=(b==null?void 0:b.alias)??(b==null?void 0:b.email)??"the account that was there";return a.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${w.at} was taken, so the two accounts traded places: ${F} now holds slot ${w.displaced}.`,children:["swapped with slot ",w.displaced]})})(),T&&a.jsxs("div",{className:"ap-issue-line",children:[a.jsxs("button",{type:"button",id:`ap-issue-${e.num}`,className:"ap-issue","data-tone":T.tone,"aria-haspopup":"dialog","aria-expanded":x,"aria-controls":x?"ap-issue-pop":void 0,onClick:()=>k(e.num,`ap-issue-${e.num}`),children:[T.tone==="warn"&&a.jsx(b0,{}),a.jsx("span",{className:"ap-issue-text",children:T.text})]}),!R&&a.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:D??"never collected"})]}),!R&&!(T!=null&&T.blocksSwitch)&&a.jsxs("p",{className:"ap-quota",id:`ap-quota-${e.num}`,children:[I.length?I.map(F=>a.jsxs("span",{className:"ap-q","data-sort-key":F.id===(E==null?void 0:E.id)?"":void 0,children:[a.jsx("span",{className:"ap-q-label",children:F.label})," ",a.jsxs("span",{className:"ap-q-pct","data-level":$?void 0:yW(F.pct),children:[Math.round(F.pct),"%"]})]},F.id)):a.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),e.stale&&!T&&a.jsx("span",{className:"ap-q-age","data-never":D?void 0:"",title:"When claude-swap last read this account's usage",children:D??"never collected"})]}),R&&a.jsxs("div",{className:"ap-detail",id:`ap-detail-${e.num}`,children:[a.jsx("div",{className:"ap-lanes",children:e.lanes.length?e.lanes.map(F=>a.jsx(wW,{lane:F,nowSec:t,frozen:$,sortedBy:F.id===(E==null?void 0:E.id)},F.id)):a.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),a.jsx("div",{className:"ap-meta",children:e.fetchedAt?a.jsxs("span",{className:`ap-age${e.stale&&!T?" 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 ",Qo(e.fetchedAt,t),T!=null&&T.blocksSwitch?"":tW(e.nextAt,t)]}):a.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]})}function xW({data:e}){return a.jsx("div",{className:"ap-empty",children:e.reason==="cswap_installing"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"Installing claude-swap…"}),a.jsx("span",{className:"ap-hint",children:"The deck is setting it up in the background, so there is nothing to do here. On a new machine this can take a few minutes; the panel fills in by itself when it is done."})]}):e.reason==="no_cswap"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"claude-swap isn't installed."}),a.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."}),e.hint&&a.jsx("code",{className:"ap-cmd",children:e.hint}),a.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",a.jsx("strong",{children:"+"})," button above."]})]}):e.reason==="no_accounts"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"No accounts added yet."}),a.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",a.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"Couldn't read the account store."}),a.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",e.reason?` (${e.reason})`:"","."]})]})})}function bW({canShare:e,canReport:t,onAdd:n,onReport:r,onShareSet:s,onReload:i,pressProps:l,reloading:u,closeButton:d}){return a.jsxs("div",{className:"ap-header",children:[a.jsx("h2",{children:"Claude accounts"}),a.jsxs("div",{className:"ap-header-right",children:[a.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>n(),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:a.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),t&&a.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>r(),"aria-label":"Account capacity","aria-haspopup":"dialog",title:"Account capacity — how many accounts are ready, and what the 5h and 7d windows have left",children:a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[a.jsx("path",{d:"M2.5 10.9A5.2 5.2 0 1 1 11.5 10.9"}),a.jsx("path",{d:"M7 8.3l2.1-2.1"})]})}),e&&a.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>s(),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${wt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:a.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:[a.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),a.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),a.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>i(),...l("reload",u),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:a.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:[a.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),a.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),d]})]})}const Aa=[{id:"five_hour",label:"5h",long:"5-hour"},{id:"seven_day",label:"7d",long:"7-day"}];function kj(e){return e.counted?e.pct:e.why==="login"?null:e.estimate}function kW(e){const t=kj(e.five_hour),n=kj(e.seven_day);if(t==null||n==null)return"stale";const r=+(t>=100)+ +(n>=100);return r===0?"ready":r===1?"limited":"exhausted"}function NW(e,t){const n=Aa.map(r=>e.cells[r.id]);for(const r of n)if(!r.counted&&(r.why==="login"||r.why==="none"))return{text:r.say,old:!0};return e.updatedAt==null?{text:"never read",old:!0}:n.every(r=>r.counted)?{text:"now",old:!1}:{text:Qo(e.updatedAt,t),old:!0}}const jW=15*6e4,SW=e=>e.alias??e.email??`account ${e.num}`;function Nj(e,t,n){const r=Aa.find(h=>h.id===t).label,s=(e.lanes??[]).find(h=>h.id===t),i=s&&Number.isFinite(s.pct)?_W(s.pct):null,l=ei(e,n),u=(s==null?void 0:s.resetAt)!=null&&s.resetAt<=n,d=(h,m)=>({counted:!1,why:h,say:m,last:i,estimate:i==null?null:u?0:i,resetAt:u?null:(s==null?void 0:s.resetAt)??null});return l!=null&&l.blocksSwitch?d("login",l.text):i==null?d("none",`No ${r} reading`):e.stale||e.fetchedAt==null||n*1e3-e.fetchedAt>jW?d("stale",e.fetchedAt?`Updated ${Qo(e.fetchedAt,n)}`:"Never read"):u?d("reset",`Reset ${Qo(s.resetAt*1e3,n)}, not updated`):{counted:!0,pct:i,resetAt:s.resetAt}}const _W=e=>Math.min(100,Math.max(0,e));function EW(e,t){const n=Aa.find(u=>u.id===t);let r=0,s=0,i=0,l=null;for(const u of e){const d=u.cells[t],f=d.counted?d.pct:d.estimate;f!=null&&(r+=f,i++,d.counted&&s++,d.resetAt!=null&&(!l||d.resetAt<l.at-59?l={at:d.resetAt,name:u.name,pct:f,more:0}:d.resetAt-l.at<60&&l.more++))}return{id:t,label:n.label,long:n.long,reporting:s,included:i,total:e.length,used:i?r/i:null,nextReset:l}}function CW(e,t){const n=e.map(s=>{const i={five_hour:Nj(s,"five_hour",t),seven_day:Nj(s,"seven_day",t)};return{num:s.num,key:_r(s),name:SW(s),active:s.active,heldOut:s.disabled===!0,cells:i,status:kW(i),updatedAt:s.fetchedAt??null}}),r=n.filter(s=>s.status==="ready").length;return{rows:n,windows:Aa.map(s=>EW(n,s.id)),roomInBoth:r}}function td(e){return e>=100?100:Math.min(99,Math.round(e))}function TW(e){const t=td(e);return{used:t,available:100-t}}function RW(e,t,n){return e?`${e} These are the last readings.`:t&&n?"The account store could not be read just now. These are the last readings.":null}function BM(e){return e>=90?"hi":e>=70?"mid":void 0}const UM=(e,t,n)=>`${e} ${e===1?t:n}`;function jj(e){const t=e.more>0?`, and ${UM(e.more,"more account","more accounts")} in the same minute`:"";return`First: ${e.name} (${td(e.pct)}% used)${t}`}function AW({w:e,nowSec:t}){const n=`ap-report-${e.id}`,r=e.total-e.included,s=r>0&&a.jsxs("p",{className:"ap-report-basis",children:[r," never read"]}),{used:i,available:l}=TW(e.used??0),u=Math.round(Na(l,{countIn:!0}));if(e.used==null)return a.jsxs("section",{className:"ap-report-sum","aria-labelledby":n,children:[a.jsxs("h3",{className:"ap-report-win",id:n,children:[e.long," window"]}),a.jsxs("p",{className:"ap-report-none",children:["No account has a ",e.long," reading yet."]}),s]});const d=e.nextReset?Cd(e.nextReset.at,t):null;return a.jsxs("section",{className:"ap-report-sum","aria-labelledby":n,children:[a.jsxs("h3",{className:"ap-report-win",id:n,children:[e.long," window"]}),a.jsxs("p",{className:"ap-report-left",children:[a.jsxs("b",{children:[u,"%"]})," remaining"]}),a.jsx("div",{className:"ap-report-meter","data-level":BM(i),"aria-hidden":!0,children:a.jsx("i",{style:{"--left":l/100}})}),d&&e.nextReset&&a.jsxs("p",{className:"ap-report-reset",title:jj(e.nextReset),children:[a.jsxs("span",{children:["Next reset in ",a.jsx("span",{className:"ap-report-num",children:d})]}),a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsx("span",{className:"ap-report-who",children:e.nextReset.name}),e.nextReset.more>0&&a.jsxs("span",{className:"ap-report-more",children:["+",e.nextReset.more]}),a.jsxs("span",{className:"vis-hidden",children:[". ",jj(e.nextReset)]})]}),s]})}function MW({cell:e,nowSec:t}){if(!e.counted)return a.jsxs("td",{className:"ap-report-cell","data-uncounted":"",children:[a.jsx("span",{className:"ap-report-pct",children:e.last==null?a.jsxs(a.Fragment,{children:[a.jsx("span",{"aria-hidden":!0,children:"—"}),a.jsx("span",{className:"vis-hidden",children:"no reading"})]}):`${td(e.last)}%`}),a.jsx("span",{className:"vis-hidden",children:", not counted"})]});const n=e.resetAt!=null?Cd(e.resetAt,t):null;return a.jsxs("td",{className:"ap-report-cell",children:[a.jsxs("span",{className:"ap-report-pct","data-level":BM(e.pct),children:[td(e.pct),"%"]}),n&&a.jsxs("span",{className:"ap-report-in",children:[a.jsx("span",{className:"vis-hidden",children:"resets in "}),n]})]})}const $W={ready:"Ready",limited:"Limited",exhausted:"Exhausted",stale:"Stale"};function IW({row:e}){return a.jsx("td",{className:"ap-report-state","data-status":e.status,children:a.jsxs("span",{className:"ap-report-state-word",children:[a.jsx("i",{"aria-hidden":!0}),$W[e.status]]})})}function OW({row:e,nowSec:t}){const n=NW(e,t);return a.jsx("td",{className:"ap-report-upd","data-old":n.old?"":void 0,children:n.text})}function LW(){return a.jsxs("svg",{className:"ap-report-how-mark",viewBox:"0 0 16 16",width:"12",height:"12","aria-hidden":!0,focusable:"false",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),a.jsx("path",{d:"M8 7.2v4.1M8 4.8v.1",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function PW({accounts:e,nowSec:t,held:n}){const r=CW(e,t),s=r.rows.length,i=Math.round(Na(r.roomInBoth,{countIn:!0}));return a.jsxs("div",{className:"ap-proj-body ap-report-body",role:"region","aria-label":"Report",children:[n&&a.jsx("p",{className:"ap-report-held",children:n}),a.jsxs("p",{className:"ap-report-lead",children:[a.jsx("b",{children:i})," of ",UM(s,"Claude account","Claude accounts")," ready"]}),a.jsx("div",{className:"ap-report-sums",children:r.windows.map(l=>a.jsx(AW,{w:l,nowSec:t},l.id))}),a.jsxs("table",{className:"ap-report-table",children:[a.jsx("caption",{className:"vis-hidden",children:"Each account's use of each window, and what it can do now"}),a.jsxs("colgroup",{children:[a.jsx("col",{}),Aa.map(l=>a.jsx("col",{className:"ap-report-col-win"},l.id)),a.jsx("col",{className:"ap-report-col-state"}),a.jsx("col",{className:"ap-report-col-upd"})]}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",children:"Account"}),Aa.map(l=>a.jsxs("th",{scope:"col",children:[l.label," used"]},l.id)),a.jsx("th",{scope:"col",children:"Status"}),a.jsx("th",{scope:"col",className:"ap-report-upd-h",children:"Updated"})]})}),a.jsx("tbody",{children:r.rows.map((l,u)=>a.jsxs("tr",{"data-active":l.active?"":void 0,style:{"--row":u},children:[a.jsx("th",{scope:"row",className:"ap-report-acct",children:a.jsxs("span",{className:"ap-report-acct-in",children:[a.jsx("span",{className:"ap-report-name",title:l.name,children:l.name}),l.active&&a.jsx("span",{className:"ap-report-current",children:"Current"}),l.heldOut&&a.jsx("span",{className:"ap-report-tag",children:"held out"})]})}),Aa.map(d=>a.jsx(MW,{cell:l.cells[d.id],nowSec:t},d.id)),a.jsx(IW,{row:l}),a.jsx(OW,{row:l,nowSec:t})]},l.num))})]}),a.jsxs("details",{className:"ap-report-how",children:[a.jsxs("summary",{children:[a.jsx(LW,{}),"How usage is calculated"]}),a.jsxs("div",{className:"ap-report-how-body",children:[a.jsxs("p",{children:["Every account here, at its last reading: ",a.jsx("b",{children:"used"})," is their average, and ",a.jsx("b",{children:"remaining"})," is the rest."]}),a.jsxs("p",{children:[a.jsx("b",{children:"Ready"})," has room in both windows. ",a.jsx("b",{children:"Limited"})," is at the limit of one, and ",a.jsx("b",{children:"Exhausted"})," of both. ",a.jsx("b",{children:"Stale"})," was never read, or is signed out."]})]})]})]})}function DW({accounts:e,order:t,failed:n,nowSec:r,onClose:s}){const i=v.useRef(null),l=pt(s,{focusRef:i}),[u,d]=v.useState(e??[]);v.useEffect(()=>{e&&e.length>0&&d(e)},[e]);const f=RW(n,!e||e.length===0,u.length>0),h=DM(u,t);return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:a.jsxs("div",{ref:l,className:"modal ap-report-modal",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ap-report-title",children:[a.jsxs("header",{className:"ap-proj-head",children:[a.jsx("div",{className:"ap-proj-titlewrap",children:a.jsx("h2",{className:"ap-proj-title",id:"ap-report-title",children:"Account capacity"})}),a.jsx("button",{ref:i,type:"button",className:"glyph-btn ap-proj-close",onClick:s,"aria-label":"Close",children:"×"})]}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:f??""}),a.jsx(PW,{accounts:h,nowSec:r,held:f})]})}),document.body)}const up=[70,80,85,90,95];function FW(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!up.includes(t)?[...up,t]:up].sort((r,s)=>r-s)}function qW({auto:e,threshold:t,thresholdPick:n,thresholdCtl:r,thresholdSaved:s,thresholdRef:i,thresholdSaveRef:l,proposeThreshold:u,doThreshold:d,pressProps:f,post:h,load:m}){return a.jsxs("div",{className:"ap-policy-block",children:[a.jsxs("div",{className:"ap-policy",children:[a.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),a.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:a.jsx("select",{ref:i,"aria-label":"Switch threshold",value:n,...f("threshold"),onChange:g=>u(g.target.value),children:FW(t).map(g=>a.jsxs("option",{value:g,children:[g,"%"]},g))})}),(r.sends||s)&&a.jsx("button",{ref:l,type:"button",className:"ap-manage-btn",...f("threshold"),title:r.title,onClick:()=>d(n,r),children:s&&!r.sends?r.done:r.label}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":e.enabled,"aria-label":"Auto-switch",...f("enable"),onClick:()=>h({action:"enable",enabled:!e.enabled},"enable").then(()=>m(!0)),title:e.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:a.jsx("span",{className:"switch-knob"})})]}),e.external&&a.jsxs("p",{className:"ap-auto-note",children:[a.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",a.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",e.enabled?" — this toggle takes over when you stop it.":"."]})]})}const Sj=18,BW=1100,Ro=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},UW=Array.from({length:Sj},(e,t)=>{const n=-72+144*t/(Sj-1)+(Ro(t,1)-.5)*9,r=(n-90)*(Math.PI/180),s=(54+32*Math.cos(n*Math.PI/180))*(.74+Ro(t,2)*.52);return{dx:Math.cos(r)*s,dy:Math.sin(r)*s,rot:(t%2?1:-1)*(100+Ro(t,3)*260),delay:Math.round(Ro(t,4)*90),dur:760+Math.round(Ro(t,5)*260),scale:.8+Ro(t,6)*.45,hue:t%4,round:t%3===0}});function _j({anchor:e}){var s;const[t,n]=v.useState(null),r=typeof window<"u"&&((s=window.matchMedia)==null?void 0:s.call(window,"(prefers-reduced-motion: reduce)").matches);return v.useEffect(()=>{if(r)return;const i=e.current;if(!i)return;const l=i.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const u=window.setTimeout(()=>n(null),BW);return()=>window.clearTimeout(u)},[e,r]),r||!t?null:It.createPortal(a.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:UW.map((i,l)=>a.jsx("span",{className:`confetti-bit${i.round?" round":""}`,"data-hue":i.hue,style:{"--dx":`${i.dx.toFixed(1)}px`,"--dy":`${i.dy.toFixed(1)}px`,"--rot":`${i.rot}deg`,"--s":i.scale.toFixed(2),animationDelay:`${i.delay}ms`,animationDuration:`${i.dur}ms, ${i.dur}ms`}},l))}),document.body)}const zM=new Set(["awaiting_url","awaiting_code","registering"]);function zW(e){return e!=null&&zM.has(e)}function HM(e){return e!=null&&e!=="done"&&!zM.has(e)}const HW="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",WW="the sign-in did not complete";function VW({state:e,serverError:t,localError:n}){const r=e==="idle";return{title:r?"Sign-in ended":"Sign-in failed",message:n||t||(r?HW:WW)}}function GW({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 KW({started:e,state:t}){return!e||t==="done"?null:{action:"login-cancel"}}const YW="done";function XW(){let e=!1;return{shouldAnnounce(t){return t!==YW?(e=!1,!1):e?!1:(e=!0,!0)}}}function j0(e,t){return t?$t(e,t):void 0}const ZW={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 ${wt}`,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"},JW={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"},S0=`claude-swap could not read the login keychain — start ${wt} from a Terminal window rather than a background service`,QW={unreadable_here:{short:"Keychain locked on this Mac",long:`${S0}.`},no_credentials_here:{short:"no stored login here",long:"claude-swap still holds no login for it here."},relogin_required_here:{short:"login expired",long:"the imported login was rejected — sign in again on a deck where it still works."},unverified_here:{short:"not checked",long:"claude-swap could not confirm whether this Mac can read it."}};function nd(e){return e?$t(QW,e)??null:null}const WM={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 fx(e,t,n){const r=n==null?null:WM[n];if(r)return r;if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Al(e)))return S0;const s=j0(JW,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Al(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const e7={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"},t7="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 n7(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const r7="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",s7="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",a7=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),o7=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,i7=/[\\/]_npx[\\/]/i,l7=`the copy of ccusage ${wt} installed for itself`;function c7(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function pre(e,t){const n=u7(e,t),r=c7(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 ${el(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${el(n)}`;case"managed":return`${l7} failed to run: ${el(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${el(n)}`:`the ccusage this deck found on your PATH failed to run: ${el(n)}`;default:return n}}const el=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function u7(e,t){const n=Al(e);if(a7(n)){if(i7.test(n))return s7;if(o7.test(n))return r7}if(n7(n))return t7;const r=j0(e7,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function Lo(e,t,n){const r=n==null?null:WM[n];if(r)return r;if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&HM(e.state))return e.error;const s=j0(ZW,e==null?void 0:e.reason);return s||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function d7(e,t,n){if(n<=0||Nd(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 VM(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 h7(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(),s=n.alias||r||`account ${n.num}`,i=[];return n.alias&&r&&i.push(r),r&&(t.get(r.toLowerCase())??0)>1&&i.push(n.org||`slot ${n.num}`),{num:n.num,label:s,sub:i.length?i.join(" · "):null}})}function f7(e,t){return e.filter(n=>!t.includes(n.num)).map(n=>n.num)}function p7(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function m7(e){return e.length?{action:"share",accounts:[...e]}:null}function g7(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 px(e){return`${e.email}|${e.org??""}`}function y7(e,t,n){return e&&e.map(r=>px(r)===t?n:r)}function w7(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 v7(e){const t=e.length;if(!t)return"Nothing to import.";const n=h=>e.filter(m=>m.state===h).length,r=[],s=n("imported");s&&r.push(`${s} of ${t} imported`);const i=n("healed");i&&r.push(`${i} had a dead token replaced`);const l=n("updated");l&&r.push(`${l} updated`);const u=n("present");u&&r.push(`${u} already here`);const d=n("failed");d&&r.push(`${d} did not arrive`);const f=[...new Set(e.map(h=>{var m;return(m=nd(h.check))==null?void 0:m.short}).filter(h=>!!h))];return`${r.join(", ")}${f.length?`, ${f.join(", ")}`:""}.`}const x7=1500,gu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],Ej="aa-panel",Cj=e=>`aa-tab-${e}`;async function tl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const mx=ce.forwardRef((e,t)=>a.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[a.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),a.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));mx.displayName="SuccessMark";function b7({onClose:e,onChanged:t}){const[n,r]=v.useState("login"),[s,i]=v.useState(null),[l,u]=v.useState(""),[d,f]=v.useState(""),[h,m]=v.useState(!1),[g,w]=v.useState(null),[b,x]=v.useState(null),[k,j]=v.useState(null),[S,_]=v.useState(null),E=v.useRef(""),T=v.useRef(!1),R=v.useRef(!1),A=v.useRef(null),B=v.useRef(null),$=v.useRef(null),I=v.useRef(null),D=v.useRef([]),F=v.useRef(!1),W=v.useCallback(()=>{const V=KW({started:T.current,state:s==null?void 0:s.state});V&&tl(V).catch(()=>{}),e()},[e,s==null?void 0:s.state]),M=pt(W,{focusRef:$}),O=v.useCallback(async()=>{if(!Sr(R.current))return;R.current=!0,m(!0),w(null),T.current=!0;const V=await tl({action:"login"}).catch(()=>null);if(R.current=!1,m(!1),!(V!=null&&V.ok)){w(Lo(V,"could not start the sign-in"));return}i(V)},[]);v.useEffect(()=>{if(!zW(s==null?void 0:s.state))return;const V=window.setInterval(async()=>{try{const J=await fetch("/api/claude-accounts/login");J.ok&&i(await J.json())}catch{}},x7);return()=>window.clearInterval(V)},[s]);const L=v.useRef(t);L.current=t;const K=v.useState(XW)[0];v.useEffect(()=>{var V;(s==null?void 0:s.state)==="awaiting_code"&&((V=A.current)==null||V.focus()),K.shouldAnnounce(s==null?void 0:s.state)&&L.current()},[s==null?void 0:s.state,K]),v.useEffect(()=>{var V;n==="paste"&&!F.current&&((V=B.current)==null||V.focus()),F.current=!1},[n]);const Z=v.useCallback(V=>{var ee;const J=d7(V,gu.findIndex(re=>re.id===n),gu.length);J.kind!=="pass"&&(V.preventDefault(),F.current=!0,r(gu[J.index].id),(ee=D.current[J.index])==null||ee.focus())},[n]),q=v.useCallback(async()=>{var J;if(!Sr(R.current))return;R.current=!0,m(!0),w(null);const V=await tl({action:"login-code",code:l}).catch(()=>null);if(R.current=!1,m(!1),!(V!=null&&V.ok)){w(Lo(V,"the code was not accepted")),V!=null&&V.state&&i(V),(J=A.current)==null||J.select();return}u(""),i(V)},[l,s]),H=v.useCallback(async()=>{if(!Sr(R.current))return;R.current=!0,m(!0),w(null);const V=await tl({action:"import",blob:d}).catch(()=>null);if(R.current=!1,m(!1),!(V!=null&&V.ok)){w(Lo(V,"the import failed"));return}E.current=d,f(""),_(null),x(V.results??[]),t()},[d,t]),P=v.useCallback(async V=>{const J=px(V);if(!Sr(R.current)||!E.current)return;R.current=!0,m(!0),j(J),_(null);const ee=await tl({action:"import",blob:E.current,force:!0,only:{email:V.email,org:V.org??""}}).catch(()=>null);if(R.current=!1,m(!1),j(null),!(ee!=null&&ee.ok)){_({key:J,text:Lo(ee,"that account could not be updated")});return}const re=(ee.results??[])[0];re&&x(oe=>y7(oe,J,re)),t()},[t]),Y=(s==null?void 0:s.state)==="done"?s.account:null,G=GW({restored:s==null?void 0:s.restored,activeAccount:s==null?void 0:s.activeAccount}),z=HM(s==null?void 0:s.state)||!!(g&&T.current&&!h),X=VW({state:s==null?void 0:s.state,serverError:s==null?void 0:s.error,localError:g});return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:W,role:"presentation",children:a.jsxs("div",{ref:M,className:"modal aa-modal",onClick:V=>V.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:Z,children:gu.map((V,J)=>a.jsx("button",{type:"button",role:"tab",id:Cj(V.id),ref:ee=>{D.current[J]=ee},"aria-selected":n===V.id,"aria-controls":Ej,tabIndex:n===V.id?0:-1,className:`aa-tab${n===V.id?" on":""}`,onClick:()=>{F.current=!1,r(V.id)},children:V.label},V.id))})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:W,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsx("section",{className:"modal-body aa-body",id:Ej,role:"tabpanel","aria-labelledby":Cj(n),children:n==="login"?Y?a.jsxs("div",{className:"aa-done",children:[a.jsx(mx,{ref:I}),a.jsx(_j,{anchor:I}),a.jsx("h4",{children:Y.added?`Account ${Y.num} added`:"Credentials refreshed"}),a.jsxs("p",{className:"aa-note",children:[a.jsx("strong",{children:Y.email}),Y.added?G?" 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."]}),G?a.jsx("p",{className:"aa-note aa-warn",role:"status",children:G}):null,a.jsx("button",{type:"button",className:"btn primary",onClick:W,children:"Done"})]}):(s==null?void 0:s.state)==="awaiting_code"||(s==null?void 0:s.state)==="registering"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"aa-step",children:[a.jsx("h4",{children:"1 · Approve in the browser"}),a.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),a.jsx("a",{className:"aa-link",href:s.url??"#",target:"_blank",rel:"noreferrer noopener",children:s.url})]}),a.jsxs("div",{className:"aa-step",children:[a.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),a.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."}),a.jsxs("div",{className:"aa-field",children:[a.jsx("input",{ref:A,type:"text",value:l,onChange:V=>u(V.target.value),onKeyDown:V=>{V.key==="Enter"&&l.trim()&&!h&&q()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:s.state==="registering"}),a.jsx("button",{type:"button",className:"btn primary",...zs(h,!l.trim()||s.state==="registering"),onClick:q,children:s.state==="registering"?"registering…":"Continue"})]}),(g||s.error)&&a.jsx("p",{className:"aa-err",children:g??s.error}),a.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?a.jsxs("div",{className:"aa-step",children:[a.jsx("h4",{children:X.title}),a.jsx("p",{className:"aa-err",children:X.message}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,i(null),w(null),O()},children:"Try again"})]}):h||T.current?a.jsx("div",{className:"aa-step",children:a.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):a.jsxs("div",{className:"aa-step aa-primer",children:[a.jsx("h4",{children:"Sign in to Anthropic"}),a.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."}),a.jsx("div",{className:"aa-actions",children:a.jsx("button",{type:"button",ref:$,className:"btn primary",onClick:O,children:"Open the sign-in page"})})]}):b?(()=>{const V=b.filter(ee=>ee.state==="imported").length,J=b.some(ee=>nd(ee.check));return a.jsxs("div",{className:"aa-done",children:[!J&&a.jsx(mx,{ref:I}),V>0&&!J&&a.jsx(_j,{anchor:I}),a.jsx("h4",{children:v7(b)}),b.length>0&&a.jsx("ul",{className:"aa-results",children:b.map(ee=>{const re=px(ee),oe=nd(ee.check);return a.jsxs("li",{className:`aa-result ${ee.state}`,children:[a.jsx("span",{className:"aa-result-who",children:ee.email||(ee.num?`slot ${ee.num}`:"an account")}),a.jsx("span",{className:"aa-result-what",children:w7(ee.state)}),ee.state==="present"&&a.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":k===re,title:`Overwrite the stored login for ${ee.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>P(ee),children:k===re?"updating…":"update anyway"}),oe&&a.jsx("span",{className:"aa-result-err",children:oe.long}),(S==null?void 0:S.key)===re&&a.jsx("span",{className:"aa-result-err",children:S.text})]},re)})}),a.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",a.jsx("strong",{children:" update anyway"}),"."]}),a.jsxs("div",{className:"aa-actions",children:[a.jsx("button",{type:"button",className:"btn primary",onClick:W,children:"Done"}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{E.current="",_(null),x(null)},children:"Import another"})]})]})})():a.jsxs("div",{className:"aa-step",children:[a.jsx("h4",{children:"Paste an account shared from another deck"}),a.jsxs("div",{className:"aa-field",children:[a.jsx("input",{ref:B,type:"text",value:d,onChange:V=>f(V.target.value),onKeyDown:V=>{V.key==="Enter"&&d.trim()&&!h&&H()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),a.jsx("button",{type:"button",className:"btn primary",...zs(h,!d.trim()),onClick:H,children:h?"importing…":"Import"})]}),g&&a.jsx("p",{className:"aa-err",children:g}),a.jsxs("p",{className:"aa-note",children:["Use ",a.jsx("strong",{children:"share"})," on one account in the other deck, or ",a.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})}),document.body)}function k7(e,t){const n=new Set(e),r=e.length?Math.max(...e):0;return[...new Set([...e,r+1])].sort((s,i)=>s-i).map(s=>{const i=s===t?"here":n.has(s)?"swap":"free";return{slot:s,kind:i,label:i==="here"?`slot ${s}`:`slot ${s} · ${i}`}})}function N7(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 s=n.swapped===!0&&r!==t;return{menuFor:e.menuFor===t?r:s&&e.menuFor===r?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:s?{at:r,displaced:t}:null}}const j7=64;function S7(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}function _7(e,t,n){return t!=null&&e.some(r=>r.slot===t)?t:n}function E7(e,t,n){var s;const r=((s=e.find(i=>i.slot===t))==null?void 0:s.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 C7(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 T7({a:e,slots:t,nowSec:n,boundaryId:r,accountMenu:s,busy:i,pressProps:l,rotating:u,onProjects:d,onRotation:f}){const{menu:h,menuError:m,aliasDraft:g,confirmRemove:w,share:b,shareCopied:x,slotDraft:k,dropMenu:j,closeMenu:S,startRename:_,typeAlias:E,doAlias:T,startMove:R,pickSlot:A,doSlot:B,makeShare:$,copyShare:I,pressRemove:D}=s;if(!h)return null;const F=`ap-pop-title-${e.num}`,W=m&&a.jsx("p",{className:"ap-pop-error",role:"alert",title:m.raw||void 0,children:m.text});return a.jsxs(x0,{anchorId:`ap-more-${e.num}`,boundaryId:r,id:`ap-menu-${e.num}`,className:"ap-pop",role:h.view==="menu"?"menu":"dialog",labelledBy:h.view==="menu"?`ap-more-${e.num}`:F,start:h.start,onClose:j,children:[h.view==="menu"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>_(e.num,e.alias),children:"Rename"}),a.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>R(e.num),children:"Move to slot…"}),a.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...l(`share-${e.num}`),title:`Copy this account to another ${wt}. 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:()=>$(e.num),children:i===`share-${e.num}`?"Sharing…":"Share"}),a.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",title:"See how much this account worked in each project",onClick:()=>d(),children:"Projects"}),(u&&!e.active||e.disabled)&&a.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...l(`rot-${e.num}`),title:e.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",onClick:()=>f(),children:e.disabled?"Put back in rotation":"Hold out of rotation"}),a.jsx("div",{role:"separator",className:"ap-menu-sep"}),a.jsx("button",{type:"button",role:"menuitem",className:`ap-menu-item danger${w===e.num?" armed":""}`,...l(`rm-${e.num}`),"aria-label":w===e.num?"Confirm remove":void 0,title:w===e.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>D(e.num),children:i===`rm-${e.num}`?"Removing…":w===e.num?"Confirm":"Remove"}),W]}),h.view==="rename"&&a.jsxs("form",{className:"ap-pop-form",onSubmit:M=>{M.preventDefault(),T(e.num,e.alias)},children:[a.jsx("label",{className:"ap-pop-title",id:F,htmlFor:`ap-alias-${e.num}`,children:"Rename account"}),a.jsx("input",{id:`ap-alias-${e.num}`,className:"ap-manage-input",type:"text",value:g,onChange:M=>E(M.target.value),maxLength:j7,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:M=>M.currentTarget.select()}),W,a.jsxs("div",{className:"ap-pop-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>S(),children:"Cancel"}),a.jsx("button",{type:"submit",className:"btn primary",...l(`alias-${e.num}`),title:"A short name to show instead of the email",children:i===`alias-${e.num}`?"…":"Save"})]})]}),h.view==="move"&&(()=>{const M=k7(t,e.num),O=_7(M,k,e.num),L=E7(M,O,e.num);return a.jsxs("div",{className:"ap-pop-form",children:[a.jsx("label",{className:"ap-pop-title",id:F,htmlFor:`ap-slot-${e.num}`,children:"Move to slot"}),a.jsx("span",{className:"ap-field",children:a.jsx("select",{id:`ap-slot-${e.num}`,value:String(O),...l(`move-${e.num}`),onChange:K=>A(Number(K.target.value)),autoFocus:!0,children:M.map(K=>a.jsx("option",{value:K.slot,children:K.label},K.slot))})}),W,a.jsxs("div",{className:"ap-pop-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>S(),children:"Cancel"}),a.jsx("button",{type:"button",className:"btn primary",...l(`move-${e.num}`),title:L.title,onClick:()=>B(e.num,O,L),children:i===`move-${e.num}`?"…":sl(L.label)})]})]})})(),h.view==="share"&&(b==null?void 0:b.num)===e.num&&(()=>{const M=VM(b.expiresAt,n),O=M.tone==="gone";return a.jsxs("div",{className:"ap-pop-form",children:[a.jsx("p",{className:"ap-pop-title",id:F,children:"Share account"}),a.jsx("code",{className:"ap-share-blob",children:b.blob}),a.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:[a.jsx("span",{className:"ap-share-warn",children:"This is the password"})," · ",a.jsx("span",{className:`ap-share-expiry ${M.tone}`,children:M.text})]}),W,a.jsxs("div",{className:"ap-pop-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>S(),children:"Done"}),a.jsx("button",{type:"button",className:"btn primary",...l(`share-${e.num}`),autoFocus:!0,onClick:async()=>{if(O){await $(e.num);return}await I(b.blob)},children:O?"Make a new share":x?"Copied":"Copy"})]})]})})()]})}const R7=6;function A7(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`,s=n.length?"ok":"idle",i=t.strained&&!t.armed?M7(n):null,l=[r];return i!=null&&l.push(`${i}% free`),l.push(t.armed?`auto ${t.threshold??"on"}${t.threshold?"%":""}`:"auto off"),{text:l.join(" · "),tone:s,free:i}}function M7(e){const t=e.map(n=>n.headroom).filter(n=>typeof n=="number");return t.length?Math.max(...t):null}function $7(e){const t=[...e].sort((s,i)=>{if(s.ready!==i.ready)return s.ready?-1:1;if(!s.ready)return s.name.localeCompare(i.name);const l=s.headroom,u=i.headroom;return l==null&&u==null?s.name.localeCompare(i.name):l==null?1:u==null?-1:u-l}),n=t.slice(0,R7),r=t.length-n.length;return{title:e.some(s=>s.ready)?"Where you could switch":"Nothing to switch to",shown:n,rest:r>0?`and ${r} more`:null}}function Cr(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 s=Math.round(r/60);return s<48?`${s}h ago`:`${Math.round(s/24)}d ago`}const I7={keychain_unavailable:{short:"Keychain locked on the other Mac",long:`the other Mac could not export it. On that Mac: ${S0}. The next round brings it.`}};function gx(e){return e.why?$t(I7,e.why)??nd(e.why):null}const _0={"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"},"that deck pairs only by invite":{text:"it pairs only by invite",tone:"idle"},"this deck pairs only by invite":{text:"needs an invite · your setting",tone:"idle"}},O7={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 Tj(e){var r;const t=L7[e];if(t)return t;const n=(r=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:r[1];return n&&O7[n]||e}const L7={"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 Od(e,t){var h;if(!e)return null;if(e.error&&((h=e.done)!=null&&h.length)){const m=Od({...e,error:void 0},t),g=` · ${Cr(e.at,t)}`;return{...m,text:`${m.text.slice(0,-g.length)}, then ${Tj(e.error)}${g}`,tone:"bad"}}if(e.error)return _0[e.error]??{text:Tj(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Cr(e.at,t)}`,tone:"idle"};const r=n.filter(m=>m.ok),s=r.length===1?"login":"logins",i=n.map(m=>({d:m,why:gx(m)})).filter(m=>m.why),l=[...new Set(i.map(m=>m.why.short))],u=l.length?`, ${l.join(", ")}`:"",d=i.length?i.map(m=>`${m.d.email}: ${m.why.long}`).join(" "):void 0,f=Cr(e.at,t);return r.length===n.length?{text:`${r.length} ${s} arrived${u} · ${f}`,tone:i.length?"warn":"ok",...d?{hint:d}:{}}:{text:`${r.length} of ${n.length} logins arrived${u} · ${f}`,tone:"bad",...d?{hint:d}:{}}}const P7=9e4;function D7({error:e,host:t,port:n},r,s,i=45317){if(e!=="handshake timed out")return null;const l=(t??"").trim();if(!l)return null;const u=r.filter(f=>f.addr===l&&f.port&&f.at>0&&s-f.at<P7);if(!u.length)return null;const d=[...new Set(u.map(f=>f.port))];if(n!=null&&!d.includes(n)){const f=d.length===1?`port ${d[0]}`:`ports ${d.join(" and ")}`;return`A deck at ${l} is announcing itself on ${f}, 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 ${l}, not a network fault. Whoever uses it can allow two ports: UDP ${i} and TCP ${n??d[0]}.`}function GM(e,t){var n,r;return(n=e.last)!=null&&n.error&&!_0[e.last.error]?!1:!!((r=e.last)!=null&&r.at&&t-e.last.at<yx||e.lastSeen!=null&&t-e.lastSeen<yx)}const yx=95e3;function F7(e,t){const n=[],r=[];for(const s of e??[])(GM(s,t)?n:r).push(s);return{online:n,offline:r}}function q7(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 s=r.filter(w=>w.waiting),i=r.filter(w=>!w.waiting),l=s.filter(w=>KM(w.lastSeen,t)),{online:u,offline:d}=F7(i,t),f=[...d,...s.filter(w=>!l.includes(w))],h=u.length+l.length,m=u.filter(w=>{var b;return((b=w.last)==null?void 0:b.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:f.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${f.length} decks`,tone:"bad"};const g=h===1?"1 deck ready":`${h} decks ready`;return{text:f.length?`${g} · ${f.length} away`:g,tone:"ok"}}function B7(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const r=Cr(e,t);return r==="now"?"checked just now":`checked ${r}`}function E0(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 KM(e,t){return e!=null&&t-e<yx}function U7(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=KM(e,t);return{text:n?"online · one-way, it calls in":`one-way · last online ${Cr(e,t)}`,here:n}}function Rj(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Cr(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function z7(e,t){if(!e)return[];const n=[],r=new Set,s=(m,g)=>m.name.localeCompare(g.name,void 0,{numeric:!0}),i=e.aliases??{};for(const m of e.pending??[])!(m!=null&&m.fp)||r.has(m.fp)||(r.add(m.fp),n.push(H7(m,i,t)));const l=[],u=[];for(const m of e.peers??[]){const g=m.peerFp??m.fp;!g||r.has(g)||(r.add(g),!m.paired&&m.manual&&!m.met?u.push(W7(m,g,t)):l.push(V7(m,g,i,t)))}n.push(...Y7(l).sort(s),...u.sort(s));const d=[];for(const m of e.strangers??[])!(m!=null&&m.fp)||r.has(m.fp)||(r.add(m.fp),d.push(G7(m,i,e.pairingMode)));n.push(...d.sort(s));const f=[];for(const m of e.declined??[])!(m!=null&&m.fp)||r.has(m.fp)||(r.add(m.fp),f.push(K7(m,i)));n.push(...f.sort(s));const h=new Map;for(const m of n)h.set(m.name,(h.get(m.name)??0)+1);for(const m of n)(h.get(m.name)??0)<2||!m.addr||(m.state=m.quiet||!m.state?m.addr:`${m.addr} · ${m.state}`,m.quiet=!1);return n}function H7(e,t,n){const r=Ld(t,e.fp,e.name||e.fp);return{fp:e.fp,...r,addr:e.addr??"",kind:"asks",state:`wants to pair · ${E0(e.at,n)}`,tone:"wait",here:!0,hint:`${r.name} at ${e.addr}${e.via==="tailscale"?", over Tailscale,":""} is waiting for an answer.`,...Pd(e.via)}}function W7(e,t,n){var i;const r=Od(e.last,n),s=e.addr?`${e.addr}:${e.port}`:"";return{fp:s,name:s||e.name||t,addr:e.addr??"",kind:"dialling",state:r?wx(r):"trying…",tone:r?r.tone:"idle",here:!1,hint:(i=e.last)!=null&&i.error?`Nothing has answered at ${s} yet — ${e.last.error}.`:`Dialling ${s} until something answers.`,...Pd(e.via)}}function V7(e,t,n,r){var w,b,x,k;const s=Od(e.last,r),i=GM(e,r),l=e.addr?`${e.addr}:${e.port}`:"",u=e.waiting?U7(e.lastSeen,r):null,d=u?u.here:i,f=!u&&s?d?`online · ${wx(s)}`:`${wx(s)} · ${Rj(e,d,r)}`:u?u.text:Rj(e,d,r),h=(w=e.last)!=null&&w.error?_0[e.last.error]:null,m=!u&&d&&!((b=e.last)!=null&&b.error)&&!(((x=e.last)==null?void 0:x.done)??[]).length,g=e.manual&&!e.met?{name:l}:Ld(n,t,e.name||t);return{fp:t,...g,addr:e.addr??"",kind:"paired",state:f,quiet:m,tone:h?h.tone==="bad"?"bad":"wait":s?s.tone:d?"ok":"idle",here:u?u.here:i,...Pd(e.via),hint:u?`${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. ${e.lastSeen==null?"It has not called since this deck started.":`It last called ${Cr(e.lastSeen,r)}.`} Add its address with the + at the top of this section to reach it either way.`:`${g.name}${l?` at ${l}`:""}${(k=e.last)!=null&&k.error?` — ${e.last.error}`:""}${s!=null&&s.hint?` — ${s.hint}`:""}`}}function G7(e,t,n){const r=Ld(t,e.fp,e.name||e.fp);return{fp:e.fp,...r,addr:e.addr??"",kind:"nearby",state:n==="invite"?"needs an invite":"not paired yet",tone:"idle",here:!0,hint:e.via==="tailscale"?`${r.name} at ${e.addr} is on your tailnet and nothing is shared with it.`:`${r.name} at ${e.addr} is on this network and nothing is shared with it.`,...Pd(e.via)}}function K7(e,t){const n=Ld(t,e.fp,e.name||e.fp);return{fp:e.fp,...n,addr:e.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${n.name} asked and was turned away. It is not asking any more.`}}function Ld(e,t,n){const r=t?e[t]:void 0;return r&&r!==n?{name:r,self:n}:{name:n}}function Pd(e){return e==="tailscale"?{via:"tailscale"}:{}}function wx(e){return e.text.replace(/ · .*$/,"")}function Y7(e){const t=new Map;for(const r of e){const s=t.get(r.name);s?s.push(r):t.set(r.name,[r])}const n=[];for(const r of t.values()){const s=[...new Set(r.filter(i=>i.addr).map(i=>i.addr))];if(s.length>1){for(const i of s)n.push(Aj(r.filter(l=>l.addr===i)));n.push(...r.filter(i=>!i.addr))}else n.push(Aj(r))}return n}function Aj(e){const[t,...n]=[...e].sort((r,s)=>Number(s.here)-Number(r.here)||+!!s.addr-+!!r.addr);return n.length?{...t,twins:n}:t}function Mj(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function rd(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 X7(e,t){var i;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(l=>l.kind==="asks").length;if(n)return{text:n===1?"1 deck wants to pair":`${n} decks want to pair`,tone:"wait",live:!1};if((i=e.reach)!=null&&i.blocked)return{text:"nothing can get in",tone:"bad",live:!1};const r=t.filter(l=>l.kind==="paired");if(!r.length)return{text:"On · none paired yet",tone:"idle",live:!1};const s=r.filter(l=>l.here).length;return s?s===r.length?{text:`${s} online`,tone:"ok",live:!0}:{text:`${s} of ${r.length} online`,tone:"ok",live:!0}:{text:`none of ${r.length} online`,tone:"idle",live:!1}}function Z7(e,t){const n=e.filter(h=>h.kind==="asks"),r=e.filter(h=>h.kind!=="asks"),s=r.filter(h=>h.here),i=r.filter(h=>!h.here),l=i.filter(h=>h.tone==="bad").length,u=t||s.length===0,d=u?[...s,...i]:s,f=r.filter(h=>h.kind==="paired").length;return{asks:n,rest:r,live:s,folded:i,troubled:l,showFolded:u,shown:d,paired:f}}const YM=160,XM=140;function J7(){const[e,t]=v.useState(!1),n=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),{peek:e,openPeek:u=>{window.clearTimeout(n.current),n.current=window.setTimeout(()=>t(!0),u)},shutPeek:()=>{window.clearTimeout(n.current),n.current=window.setTimeout(()=>t(!1),XM)},holdPeek:()=>window.clearTimeout(n.current),dropPeek:()=>{window.clearTimeout(n.current),t(!1)}}}function Q7(e){var t;return((t=e==null?void 0:e.detail)==null?void 0:t.fix)==="give_back"}function Jn(e,t){return{text:e,giveBack:Q7(t),done:!1}}async function e9(){try{return await(await fetch("/api/prefs/give-back",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"})).json().catch(()=>null)}catch{return null}}const t9={cancelled:"Nothing changed — the password dialog was closed. The folder still belongs to another user.",timed_out:"Nothing changed — the password dialog was not answered in time.",busy:"The password dialog is already open. It may be behind this window."};function n9(e){if(e!=null&&e.ok)return{text:e.changed===!1?"The settings folder is already yours, and the deck has read it again. Try that once more.":"Done — the settings folder is yours again, and the deck has read it again. Try that once more.",giveBack:!1,done:!0};if(e==null)return{text:"Could not give it back — the deck did not answer.",giveBack:!0,done:!1};const t=e.reason?t9[e.reason]:void 0;return t?{text:t,giveBack:!0,done:!1}:{text:"macOS did not give the folder back. The deck's log has the command that does it by hand.",giveBack:!1,done:!1}}const vx=5e3,ZM=6e4;function Et(e,t){if(t==null)return`Could not ${e} — the deck did not answer.`;const n=t.reason?a9(t.reason,t.detail):void 0;return n?`Could not ${e} — ${n}`:t.reason?`Could not ${e} — the deck refused it (${t.reason}).`:`Could not ${e}.`}const r9={prefs_unreadable:"this deck cannot read its settings file, so it will not write over it. The file may belong to another user, for example after ccdeck was run with sudo. The deck's log names the file.",prefs_not_writable:"this deck is not allowed to save its settings. The settings folder may belong to another user, for example after ccdeck was run with sudo, or another program may be holding the file. The deck's log names the folder."},s9=new Set(["EACCES","EPERM"]);function a9(e,t){const n=r9[e];if(!n)return;const r=e==="prefs_unreadable"&&t?o9(t):void 0,s=t!=null&&t.code&&t.code!=="BADJSON"?` Error code: ${t.code}.`:"";return(r??n)+s}function o9({code:e,owner:t,on:n}){if(e==="BADJSON")return"its settings file is damaged and could not be moved aside, so it will not write over it. The deck's log names the file.";if(n==="folder"&&t==="other")return"this deck cannot open its settings folder, which belongs to another user, for example after ccdeck was run with sudo. The deck's log has the command that gives it back.";if(n==="folder"&&t==="you")return"this deck cannot open its own settings folder, so it will not write over what is in it. The deck's log names the folder.";if(t==="other")return"its settings file belongs to another user and could not be moved aside, so it will not write over it. The deck's log names the file.";if(t==="you")return"this deck cannot read its settings file although the file is yours, so it will not write over it. Something on this machine is blocking the read; the deck's log names the file.";if(e&&!s9.has(e))return"this deck cannot read its settings file, so it will not write over it. The deck's log names the file."}async function Ao(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function i9(e,t){const[n,r]=v.useState(null),[s,i]=v.useState([]),[l,u]=v.useState(null),[d,f]=v.useState(null),h=v.useRef(null),m=v.useCallback(D=>Ad(h.current)?(h.current=D,u(D),!0):!1,[]),g=v.useCallback(()=>{h.current=null,k.current&&u(null)},[]),w=D=>{const F=Ws(l,D);return{disabled:F.disabled,"aria-busy":F.busy}},[b,x]=v.useState(()=>Date.now()),k=v.useRef(!0),j=v.useRef(vx),S=v.useCallback(async()=>{var D,F;try{const[W,M]=await Promise.all([fetch("/api/lan").then(O=>O.json()),fetch("/api/prefs").then(O=>O.json())]);if(!k.current)return;W!=null&&W.ok&&r(W),M!=null&&M.ok&&i(Array.isArray((F=(D=M.prefs)==null?void 0:D.lan)==null?void 0:F.manual)?M.prefs.lan.manual:[]),j.current=(W==null?void 0:W.enabled)===!0?vx:ZM}catch{}},[]);v.useEffect(()=>{k.current=!0;let D=0;const F=async()=>{x(Date.now()),await S(),k.current&&(D=window.setTimeout(F,j.current))};return F(),()=>{k.current=!1,window.clearTimeout(D)}},[S]);const _=v.useCallback(async()=>{const D=(n==null?void 0:n.enabled)===!0;if(m("switch"))try{const F=await Ao("/api/prefs",{lan:{enabled:!D}});if(!k.current)return;F!=null&&F.ok?(f(null),D||t()):f(Jn(Et(D?"turn this off":"turn this on",F),F)),await S()}catch{k.current&&f(Jn(Et(D?"turn this off":"turn this on",null)))}finally{g()}},[n==null?void 0:n.enabled,S,m,g,t]),E=v.useCallback(async(D,F,W)=>{if(!m(`${D}:${F}`))return null;let M=null;try{const O=await Ao("/api/lan/peer",{action:D,fp:F});if(!k.current)return null;O!=null&&O.ok?(r(O),f(null)):(M=Et(W,O),f(Jn(M,O))),await S()}catch{M=Et(W,null),k.current&&f(Jn(M))}finally{g()}return M},[S,m,g]),T=v.useCallback(async D=>{if(!m(`drop:${D}`))return null;let F=null;try{const W=await Ao("/api/prefs",{lan:{manual:s.filter(M=>M!==D)}});if(!k.current)return null;W!=null&&W.ok?(f(null),e()):(F=Et("stop dialling that address",W),f(Jn(F,W))),await S()}catch{F=Et("stop dialling that address",null),k.current&&f(Jn(F))}finally{g()}return F},[s,S,e,m,g]),R=v.useCallback(async(D,F)=>{if(!m(`alias:${D}`))return"Something else is still being saved. Try again in a moment.";try{const W=await Ao("/api/lan/peer",{action:"alias",fp:D,name:F});return k.current?W!=null&&W.ok?(r(W),null):Et("rename that deck",W):null}catch{return Et("rename that deck",null)}finally{g()}},[m,g]),A=v.useCallback(async D=>{if(!m(`check:${D}`))return null;try{const F=await Ao("/api/lan/sync",{fp:D});return k.current?F!=null&&F.ok?(r(F),e(),null):(F==null?void 0:F.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.":Et("check that deck",F):null}catch{return Et("check that deck",null)}finally{g()}},[m,g,e]),B=v.useCallback(async()=>{if(m("check"))try{const D=await Ao("/api/lan/sync",{});if(!k.current)return;D!=null&&D.ok?(r(D),f(null)):f(Jn(Et("check the other decks",D),D)),e()}catch{k.current&&f(Jn(Et("check the other decks",null)))}finally{g()}},[m,g,e]);return{status:n,manual:s,now:b,busy:l,failure:d,dismissFailure:()=>f(null),answerGiveBack:D=>{f(D),D.done&&(S(),e())},pressProps:w,load:S,toggle:_,answer:E,dropAddress:T,rename:R,checkOne:A,checkNow:B}}function l9(e){const[t,n]=v.useState(null),r=v.useRef(0);return v.useEffect(()=>{if(t==null)return;const i=window.setTimeout(()=>n(null),4e3);return()=>window.clearTimeout(i)},[t]),{armed:t,pressUnpair:i=>{const l=Date.now(),u=El({armedFor:t,target:i.fp,armedAt:r.current,now:l,gapMs:_l});if(u==="arm"){n(i.fp),r.current=l;return}u!=="ignore"&&(n(null),e("unpair",i.fp,"unpair that deck"))}}}function JM({title:e,steps:t,finish:n,aside:r,onClose:s}){const i=v.useRef(null),l=pt(s,{focusRef:i}),[u,d]=v.useState(0),f=u===t.length-1,h=t[u],m=b=>d(Math.max(0,Math.min(t.length-1,b))),g=b=>{b.key!=="ArrowRight"&&b.key!=="ArrowLeft"||(b.preventDefault(),b.stopPropagation(),m(b.key==="ArrowRight"?u+1:u-1))},w=()=>{if(!f){m(u+1);return}n?n.act():s()};return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:a.jsxs("div",{ref:l,className:"modal guide",onClick:b=>b.stopPropagation(),onKeyDown:g,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),a.jsxs("span",{className:"modal-tool-id",children:[u+1," / ",t.length]})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[a.jsx("div",{className:"guide-stage",children:h.art},u),a.jsx("p",{className:"guide-line","aria-live":"polite",children:h.line}),a.jsx("p",{className:"guide-tip",children:h.tip??""}),a.jsxs("div",{className:"guide-foot",children:[a.jsx("div",{className:"guide-dots",children:t.map((b,x)=>a.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${x+1} of ${t.length}`,"aria-current":x===u?"step":void 0,onClick:()=>m(x)},x))}),f&&r&&a.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:r.act,children:r.label}),u>0&&a.jsx("button",{type:"button",className:"btn",onClick:()=>m(u-1),children:"Back"}),a.jsx("button",{ref:i,type:"button",className:"btn primary",onClick:w,children:f?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const xx={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function Pn({children:e}){return a.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function Ln({x:e,y:t=34,w:n=176,h:r=132,label:s}){return a.jsxs(a.Fragment,{children:[s&&a.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:s}),a.jsx("rect",{x:e,y:t,width:n,height:r,rx:10,className:"ga-screen"})]})}function sr({x:e,y:t,email:n,state:r,tone:s,bars:i}){return a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:e+3,cy:t-4,r:3,className:xx[s]}),a.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),a.jsx("text",{x:e+12,y:t+16,className:`ga-s ${xx[s]}`,children:r}),i==null?void 0:i.map((l,u)=>a.jsxs("g",{children:[a.jsx("text",{x:e,y:t+40+u*18,className:"ga-s",children:u?"7d":"5h"}),a.jsx("rect",{x:e+22,y:t+35+u*18,width:96,height:4,rx:2,className:"ga-track"}),a.jsx("rect",{x:e+22,y:t+35+u*18,width:96*l/100,height:4,rx:2,className:"ga-accent"}),a.jsxs("text",{x:e+148,y:t+40+u*18,className:"ga-s ga-accent",textAnchor:"end",children:[l,"%"]})]},u))]})}function QM({x:e,y:t,on:n}){return a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),a.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function yu({x:e,y:t,name:n,here:r=!0}){return a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:e+3,cy:t-4,r:3,className:r?"ga-ok":"ga-dim"}),a.jsx("text",{x:e+12,y:t,className:r?"ga-t":"ga-s",children:n})]})}function $j({x:e,y:t,on:n}){return n?a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),a.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):a.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function Ij({x:e,y:t,d:n}){return a.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function C0({x:e,y:t}){return a.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 T0(){return a.jsxs(a.Fragment,{children:[a.jsx("circle",{r:9,className:"ga-key-bed"}),a.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[a.jsx("circle",{cx:4.6,cy:7,r:2.6}),a.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function Po({x:e,y:t,w:n,title:r,sub:s,tone:i}){return a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),a.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:xx[i]}),a.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:r}),a.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:s})]})}function zo({x:e,y:t,label:n,live:r}){return a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:r?"ga-chip-live":"ga-chip"}),a.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function sd({x:e,y:t}){return a.jsxs(a.Fragment,{children:[a.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),a.jsx(QM,{x:e+118,y:t-13,on:!0})]})}function c9(){return a.jsxs(Pn,{children:[a.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),a.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),a.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),a.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),a.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),a.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),a.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),a.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),a.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),a.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),a.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),a.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),a.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),a.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),a.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),a.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),a.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),a.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),a.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),a.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),a.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),a.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function u9(){return a.jsxs(Pn,{children:[a.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),a.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),a.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),a.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),a.jsx(Po,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),a.jsx(Po,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),a.jsx(Po,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),a.jsx(Po,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),a.jsx(zo,{x:326,y:28,label:"Read"}),a.jsx(zo,{x:380,y:28,label:"Grep",live:!0}),a.jsx(zo,{x:326,y:90,label:"Bash",live:!0})]})}function Oj({x:e,y:t,label:n,pct:r,note:s}){return a.jsxs(a.Fragment,{children:[a.jsx("text",{x:e,y:t,className:"ga-s",children:n}),a.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[r,"%"]}),a.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),a.jsx("rect",{x:e,y:t+7,width:194*r/100,height:5,rx:2.5,className:"ga-accent"}),a.jsx("text",{x:e,y:t+26,className:"ga-s",children:s})]})}function d9(){return a.jsxs(Pn,{children:[a.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),a.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),a.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),a.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),a.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),a.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),a.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),a.jsx(Oj,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),a.jsx(Oj,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function h9(){return a.jsxs(Pn,{children:[a.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),a.jsx(Po,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),a.jsx(C0,{x:156,y:106}),a.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),a.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),a.jsx(Ln,{x:200,y:22,w:226,h:160}),a.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),a.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),a.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),a.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),a.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),a.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),a.jsx(zo,{x:214,y:122,label:"Read"}),a.jsx(zo,{x:266,y:122,label:"Edit"}),a.jsx(zo,{x:318,y:122,label:"Bash",live:!0}),a.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),a.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function f9(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return a.jsxs(Pn,{children:[a.jsx(Ln,{x:14,y:20,w:412,h:160}),a.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),a.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),a.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),a.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>a.jsxs("g",{children:[a.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),a.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),a.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),a.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),a.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),a.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),a.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),a.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),a.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),a.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),a.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),a.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),a.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),a.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function p9(){return a.jsxs(Pn,{children:[a.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),a.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),a.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),a.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[a.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),a.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),a.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),a.jsx("path",{d:"M210 100H238",className:"ga-arc"}),a.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),a.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),a.jsx("g",{className:"ga-pop",children:a.jsx(Po,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function m9(){return a.jsxs(Pn,{children:[a.jsx(Ln,{x:14,y:16,w:232,h:170}),a.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),a.jsx(Ij,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),a.jsx(Ij,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),a.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),a.jsx(sr,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),a.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),a.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),a.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),a.jsx(sr,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),a.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),a.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),a.jsx(C0,{x:221,y:161}),a.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),a.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),a.jsx(Ln,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),a.jsx("g",{className:"ga-pop",children:a.jsx(sr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function g9(){return a.jsxs(Pn,{children:[a.jsx(Ln,{x:14,label:"THIS MACHINE"}),a.jsx(sd,{x:28,y:60}),a.jsx("g",{className:"ga-swap-out",children:a.jsx(sr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),a.jsx("g",{className:"ga-swap-in",children:a.jsx(sr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),a.jsx(Ln,{x:250,label:"ANOTHER MACHINE"}),a.jsx(sd,{x:264,y:60}),a.jsx(sr,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),a.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),a.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:a.jsx(T0,{})})]})}const y9=[{art:a.jsx(c9,{}),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:a.jsx(u9,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:a.jsx(h9,{}),line:"Double-click any node: its prompt, every tool call, tokens and timing."},{art:a.jsx(d9,{}),line:"What each session costs, and how much quota is left."},{art:a.jsx(f9,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:a.jsx(m9,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:a.jsx(g9,{}),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:a.jsx(p9,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function w9(){return a.jsxs(Pn,{children:[a.jsx(Ln,{x:14,label:"THIS MACHINE"}),a.jsx(sr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),a.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),a.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),a.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),a.jsx(Ln,{x:250,label:"ANOTHER MACHINE"}),a.jsx(sr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function v9(){return a.jsxs(Pn,{children:[a.jsx(Ln,{x:14,label:"THIS MACHINE"}),a.jsx(sd,{x:28,y:60}),a.jsx(yu,{x:28,y:92,name:"Ana's MacBook"}),a.jsx(yu,{x:28,y:114,name:"Dorin's PC"}),a.jsx(Ln,{x:250,label:"ANOTHER MACHINE"}),a.jsx(sd,{x:264,y:60}),a.jsx(yu,{x:264,y:92,name:"Your MacBook"}),a.jsx(yu,{x:264,y:114,name:"Dorin's PC"}),a.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),a.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),a.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),a.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function x9(){return a.jsxs(Pn,{children:[a.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),a.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),a.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),a.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),a.jsx($j,{x:106,y:88,on:!0}),a.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),a.jsx($j,{x:106,y:112}),a.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),a.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),a.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),a.jsx(QM,{x:304,y:157,on:!0}),a.jsx(C0,{x:115,y:97})]})}function b9(){return a.jsxs(Pn,{children:[a.jsx(Ln,{x:14,label:"THIS MACHINE"}),a.jsx("g",{className:"ga-swap-out",children:a.jsx(sr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),a.jsx("g",{className:"ga-swap-in",children:a.jsx(sr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),a.jsx(Ln,{x:250,label:"ANOTHER MACHINE"}),a.jsx(sr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),a.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),a.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:a.jsx(T0,{})})]})}const k9=[{art:a.jsx(w9,{}),line:"A login can expire on one machine while it still works on another."},{art:a.jsx(v9,{}),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:a.jsx(x9,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:a.jsx(b9,{}),line:"An expired login is copied from a paired machine within a minute."}];function N9(){return a.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[a.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),a.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),a.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),a.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),a.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),a.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),a.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),a.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),a.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),a.jsx("g",{transform:"translate(116 13)",children:a.jsx(T0,{})})]})}const j9={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."},S9=1600;function e$({reach:e,where:t}){const[n,r]=v.useState(!1),s=v.useRef(!0);v.useEffect(()=>()=>{s.current=!1},[]);const i=(e==null?void 0:e.steps)??[],l=v.useCallback(async()=>{await qa(i.join(`
|
|
81
|
-
`))&&s.current&&(r(!0),window.setTimeout(()=>{s.current&&r(!1)},S9))},[i]);if(!(e!=null&&e.blocked))return null;const u=e.shell==="sh";return a.jsxs("div",{className:"ap-lan-reach",children:[a.jsx("p",{className:"lan-warn",children:e.text}),a.jsx("p",{className:"lan-note",children:j9[t]}),i.length>0&&a.jsxs("details",{className:"ap-lan-reach-fix",children:[a.jsx("summary",{children:"or let them find this deck on their own"}),a.jsxs("p",{className:"lan-note",children:[u?a.jsx(a.Fragment,{children:"Run this in a terminal on this machine, then restart the deck."}):a.jsxs(a.Fragment,{children:["Run this in PowerShell ",a.jsx("strong",{children:"as Administrator"}),", then restart the deck."]}),e.category==="Public"&&a.jsx(a.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&&a.jsxs(a.Fragment,{children:[" ",e.unsure]})]}),a.jsx("pre",{className:"ap-lan-cmd",children:a.jsx("code",{children:i.join(`
|
|
82
|
-
`)})}),a.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>void l(),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"})]})]})}function _9(e){const t=(e??"").trim(),n=t.lastIndexOf(":");if(n<=0||n===t.length-1)return null;const r=t.slice(0,n).trim(),s=Number(t.slice(n+1).trim());return!r||!Number.isInteger(s)||s<1||s>65535||r.includes(":")&&!(r.startsWith("[")&&r.endsWith("]"))?null:{addr:r,port:s}}function E9(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}async function dp(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const C9={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."},T9={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function Lj(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Et(n,t)}function R9({status:e,manual:t,startWith:n,onClose:r,onChanged:s}){const i=v.useRef(null),l=v.useRef(null),u=v.useRef(null),d=e.pairingMode==="invite",f=pt(r,{focusRef:d?l:i}),[h,m]=v.useState(""),[g,w]=v.useState(""),[b,x]=v.useState(null),[k,j]=v.useState(null),[S,_]=v.useState(null),[E,T]=v.useState(null),[R,A]=v.useState(()=>Date.now());v.useEffect(()=>{const G=window.setInterval(()=>A(Date.now()),1e3);return()=>window.clearInterval(G)},[]);const B=v.useRef(!0);v.useEffect(()=>()=>{B.current=!1},[]);const $=v.useRef(null),I=v.useCallback(G=>Ad($.current)?($.current=G,_(G),!0):!1,[]),D=v.useCallback(()=>{$.current=null,B.current&&_(null)},[]),F=G=>{const z=Ws(S,G);return{disabled:z.disabled,"aria-busy":z.busy}},W=G=>(b==null?void 0:b.field)===G?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},M=G=>x(z=>z&&z.field===G?null:z),O=v.useCallback(async()=>{if(d)return;const G=_9(h);if(!G){x({text:A9(h),field:"addr"});return}const z=`${G.addr}:${G.port}`,X=e.peers.find(V=>V.addr===G.addr&&V.port===G.port&&V.paired);if(X){x({text:`Already paired with ${X.name} at that address.`,field:"addr"});return}if(t.includes(z)){x({text:"This deck already calls that address.",field:"addr"});return}if(I("add"))try{const V=await dp("/api/prefs",{lan:{manual:[...t,z]}});if(!B.current)return;V!=null&&V.ok?(x(null),m(""),s(),r()):x({text:Et("add that address",V),field:"addr"})}catch{B.current&&x({text:Et("add that address",null),field:"addr"})}finally{D()}},[h,d,t,e.peers,s,r,I,D]),L=v.useCallback(async G=>{if(!I(`invite:${G}`))return;const z=G==="make"?"make an invite":"cancel that invite";try{const X=await dp("/api/lan/invite",{action:G});if(!B.current)return;X!=null&&X.ok?(x(null),j(null),s()):x({text:Lj(T9,X,z)})}catch{B.current&&x({text:Et(z,null)})}finally{D()}},[s,I,D]),K=v.useCallback(async()=>{const G=g.trim();if(!(!G||!I("join"))){T(null);try{const z=await dp("/api/lan/invite",{action:"join",token:G});if(!B.current)return;z!=null&&z.ok?(w(""),x(null),s(),r()):(z==null?void 0:z.reason)==="unreachable"&&Array.isArray(z.tried)&&z.tried.length?(T(z.tried),x(null)):(T(null),x({text:Lj(C9,z,"use that invite"),field:"join"}))}catch{B.current&&x({text:Et("use that invite",null),field:"join"})}finally{D()}}},[g,s,r,I,D]),Z=v.useCallback(async(G,z)=>{try{await navigator.clipboard.writeText(G),j(z),window.setTimeout(()=>{B.current&&j(X=>X===z?null:X)},1600)}catch{x({text:"Could not copy it — select the text and copy it by hand."})}},[]),q=e.invite&&e.invite.expiresAt>R?e.invite:null,H=v.useRef(!1);v.useEffect(()=>{n!=="invite"||H.current||q||(H.current=!0,L("make"))},[n,q,L]);const P=v.useRef(!1);v.useEffect(()=>{var G;n!=="invite"||P.current||!q||(P.current=!0,(G=u.current)==null||G.focus())},[n,q]);const Y=e.port!=null?(e.addrs??[]).map(G=>`${G}:${e.port}`):[];return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:a.jsxs("div",{ref:f,className:"modal lan-add",onClick:G=>G.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{className:"glyph-btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[b&&a.jsxs("div",{className:"ap-failure",role:"alert",children:[a.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:b.text}),a.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>x(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),a.jsx(e$,{reach:e.reach,where:"dialog"}),d&&a.jsx("div",{className:"modal-section",children:a.jsx("p",{className:"lan-note",children:"Adding by address is off while this deck pairs only by invite."})}),!d&&a.jsxs("div",{className:"modal-section",children:[a.jsx("h3",{className:"lan-h",children:"By address"}),a.jsxs("div",{className:"ap-lan-row",children:[a.jsx("input",{ref:i,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:h,placeholder:"192.168.1.5:54340",spellCheck:!1,...W("addr"),onChange:G=>{m(G.target.value),M("addr")},onKeyDown:G=>{G.key==="Enter"&&O()}}),h.trim()!==""&&a.jsx("button",{type:"button",className:"ap-manage-btn",...F("add"),onClick:()=>void O(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),a.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."}),e.port!=null&&Y.length>0&&a.jsxs("p",{className:"lan-note",children:["They type this deck’s own address into the same field on theirs:"," ",Y.map((G,z)=>a.jsxs("span",{children:[z>0&&" or ",a.jsx("code",{className:"ap-lan-code",children:G})]},G)),a.jsx("button",{type:"button",className:"ap-lan-word lan-copy",...F("copy:mine"),onClick:()=>void Z(Y.join(" "),"mine"),title:"Copy this deck's address, to send to whoever is adding it",children:k==="mine"?"copied":"copy"})]})]}),a.jsxs("div",{className:"modal-section",children:[a.jsxs("h3",{className:"lan-h",children:["With an invite",!q&&a.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...F("invite:make"),onClick:()=>void L("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:S==="invite:make"?"making…":"make one to send"})]}),a.jsxs("div",{className:"ap-lan-row",children:[a.jsx("input",{ref:l,className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:g,placeholder:"paste one you were sent",spellCheck:!1,...W("join"),onChange:G=>{w(G.target.value),T(null),M("join")},onKeyDown:G=>{G.key==="Enter"&&K()}}),g.trim()!==""&&a.jsx("button",{type:"button",className:"ap-manage-btn",...F("join"),onClick:()=>void K(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:S==="join"?"joining…":"join"})]}),a.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),E&&a.jsxs("div",{className:"ap-lan-tried",children:[a.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."}),E.map(G=>a.jsxs("span",{className:"ap-lan-tried-row",children:[a.jsx("code",{className:"ap-lan-code",children:G.addr}),a.jsx("span",{className:"ap-lan-bad",children:G.why})]},G.addr))]}),q&&a.jsxs("div",{className:"ap-lan-invite",children:[a.jsxs("div",{className:"ap-lan-invite-head",children:[a.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),a.jsxs("span",{className:"ap-lan-invite-left",id:"lan-invite-left",children:[E9(q.expiresAt,R)," left"]})]}),a.jsx("code",{className:"ap-lan-token",children:q.token}),a.jsxs("div",{className:"ap-lan-acts",children:[a.jsx("button",{type:"button",className:"ap-manage-btn",ref:u,...F("copy:invite"),"aria-label":k==="invite"?"Invite copied":"Copy invite","aria-describedby":"lan-invite-left",onClick:()=>void Z(q.token,"invite"),title:"Copy it, and send it however you already talk to them",children:k==="invite"?"copied":"copy"}),a.jsx("button",{type:"button",className:"ap-manage-btn",...F("invite:withdraw"),onClick:()=>void L("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),a.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function A9(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}".`}function M9({asks:e,pressProps:t,answer:n}){return a.jsx("div",{className:"ap-lan-asks",role:"alert",children:e.map(r=>a.jsxs("div",{className:"ap-lan-ask",children:[a.jsxs("span",{className:"ap-lan-ask-what",children:[a.jsx("strong",{className:"ap-lan-peer-name",children:r.name})," at ",a.jsx("code",{className:"ap-lan-code",children:r.addr})," wants to pair"]}),a.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",a.jsx("code",{className:"ap-lan-code",children:r.fp})]}),a.jsxs("span",{className:"ap-lan-ask-acts",children:[a.jsx("button",{type:"button",className:"ap-manage-btn",...t(`accept:${r.fp}`),onClick:()=>void n("accept",r.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${r.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),a.jsx("button",{type:"button",className:"ap-manage-btn",...t(`dismiss:${r.fp}`),onClick:()=>void n("dismiss",r.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},r.fp))})}function $9({rows:e,pairingMode:t,armed:n,pressProps:r,answer:s,dropAddress:i,onUnpair:l,onOpenPeer:u,onInvite:d}){return a.jsx("ul",{className:"ap-lan-here",children:e.map((f,h)=>a.jsxs("li",{className:"ap-lan-who","data-tone":f.tone,children:[a.jsx("i",{className:f.here?"ap-pulse":"ap-dot","aria-hidden":!0}),a.jsxs("span",{className:"ap-lan-who-name","aria-hidden":!0,children:[f.name,f.via==="tailscale"&&a.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]}),a.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${h}`,onClick:()=>u(f.fp),children:a.jsxs("span",{className:"vis-hidden",children:[f.name,f.via==="tailscale"?", over Tailscale":"",", details"]})}),a.jsx("span",{id:`lan-who-state-${h}`,className:f.quiet?"vis-hidden":"ap-lan-who-when",children:f.state}),f.kind==="nearby"&&t!=="invite"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...r(`accept:${f.fp}`),onClick:()=>void s("accept",f.fp,"reach that deck"),"aria-label":`Ask ${f.name} to pair`,title:`Send ${f.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${f.fp}.`,children:"ask"}),(f.kind==="nearby"||f.kind==="declined")&&t==="invite"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do","aria-haspopup":"dialog",onClick:d,"aria-label":`Invite ${f.name} to pair`,title:`This deck pairs only by invite. Make one and send it to whoever is at ${f.name}.`,children:"invite"}),f.kind==="paired"&&a.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${n===f.fp?" armed":""}`,...r(`unpair:${f.fp}`),onClick:()=>l(f),"aria-label":n===f.fp?`Confirm unpairing ${f.name}`:`Unpair ${f.name}`,title:n===f.fp?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:n===f.fp?"confirm":"unpair"}),f.kind==="dialling"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...r(`drop:${f.fp}`),onClick:()=>void i(f.fp),"aria-label":`Stop dialling ${f.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),f.kind==="declined"&&t!=="invite"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...r(`allow:${f.fp}`),onClick:()=>void s("allow",f.fp,"let that deck ask again"),"aria-label":`Let ${f.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${f.kind}:${f.fp}`))})}function I9(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 O9({on:e,status:t}){return a.jsxs(a.Fragment,{children:[e&&a.jsx(e$,{reach:t==null?void 0:t.reach,where:"panel"}),e&&(t==null?void 0:t.deaf)&&a.jsx("p",{className:"ap-lan-fine",children:t.deaf}),e&&(t==null?void 0:t.lanTunneled)&&a.jsx("p",{className:"ap-lan-fine",children:I9(t)})]})}const Pj=["online","offline","loose"],L9={online:0,offline:1,loose:1};function P9(e){return e.kind==="declined"?null:e.kind==="paired"?e.here?"online":"offline":"loose"}const D9=76,F9=62,q9=96,B9={1:[.62],2:[.58,1]},Dj=.16;function U9(e,t){return Math.PI*(3*(e+t)-Math.sqrt((3*e+t)*(e+3*t)))}function z9(e,t){return t<-Math.abs(e)*.6?"top":"bottom"}function H9(e,t){if(e<=2)return t%2===0?0:90;const n=360/e;return-90+(t%2===0?0:n/2)}function W9(e){return e.map((t,n)=>({...t,i:n})).sort((t,n)=>Pj.indexOf(t.tier)-Pj.indexOf(n.tier)||+(t.row.via==="tailscale")-+(n.row.via==="tailscale")||t.i-n.i).map(({row:t,tier:n})=>({row:t,tier:n}))}function V9(e,t,n){const r=new Map;for(const g of e){const w=P9(g);if(!w)continue;const b=L9[w];r.has(b)||r.set(b,[]),r.get(b).push({row:g,tier:w})}const s=[...r.keys()].sort((g,w)=>g-w),i=B9[s.length]??[],l=Math.max(0,t/2-D9),u=Math.max(0,n/2-F9),d=s.map((g,w)=>({ring:g,rx:l*i[w],ry:u*i[w],count:r.get(g).length})),f=[];let h=!1,m=0;return d.forEach((g,w)=>{const b=W9(r.get(g.ring)),x=b.length,k=x>1&&U9(g.rx,g.ry)/x<q9;k&&(h=!0);const S=w===d.length-1?-Dj*(i[w]-(i[w-1]??0)):Dj*(i[w+1]-i[w]),_=H9(x,w);b.forEach(({row:E,tier:T},R)=>{const A=(_+360/x*R)*Math.PI/180,B=k&&R%2===1?1+S/i[w]:1,$=Math.cos(A)*g.rx*B,I=Math.sin(A)*g.ry*B;f.push({row:E,tier:T,ring:g.ring,x:$,y:I,angle:G9(Math.atan2(I,$)*180/Math.PI),dist:Math.hypot($,I),side:z9($,I),order:m++})})}),{nodes:f,rings:d,dense:h}}function G9(e){return(e%360+360)%360}function K9(e){const t=n=>e.filter(n).length;return{paired:t(n=>n.kind==="paired"),online:t(n=>n.kind==="paired"&&n.here),offline:t(n=>n.kind==="paired"&&!n.here),nearby:t(n=>n.kind==="nearby"),asks:t(n=>n.kind==="asks"),dialling:t(n=>n.kind==="dialling"),declined:t(n=>n.kind==="declined"),tailnet:t(n=>n.kind!=="declined"&&n.via==="tailscale")}}function Y9(e){const t=[];return e.paired===0?t.push("no paired decks yet"):e.online===e.paired?t.push(`${e.paired} paired deck${e.paired===1?"":"s"}, all online`):t.push(`${e.online} of ${e.paired} paired deck${e.paired===1?"":"s"} online`),e.asks&&t.push(`${e.asks} asking to pair`),e.nearby&&t.push(`${e.nearby} nearby, not paired`),e.dialling&&t.push(`${e.dialling} still dialling`),t.join(" · ")}function X9(e,t){switch(e.kind){case"asks":return"wants to pair";case"nearby":return e.state;case"dialling":return"dialling";case"declined":return"declined";case"paired":{if(e.here)return t?Z9(t):"online";const n=n$(e);return n?n==="now"?"offline · just now":`offline · ${n}`:e.state.startsWith("one-way")?"one-way · quiet":"offline"}}}function t$(e){if(e.kind!=="paired")return e.via==="tailscale"?`${e.state}, over Tailscale`:e.state;if(e.here)return e.via==="tailscale"?"online, over Tailscale":"online";const t=n$(e),n=t?t==="now"?"offline · last online just now":`offline · last online ${t}`:e.state.startsWith("one-way")?e.state:"offline";return e.via==="tailscale"?`${n}, over Tailscale`:n}function n$(e){var t;return((t=/last online (.+)$/.exec(e.state))==null?void 0:t[1])??null}function Z9(e){return e.trim().split(/\s+/).slice(0,2).join(" ")}function J9(e){var r;if(!e)return[];const t=(e.addrs??[]).map(s=>`${s}:${e.port}`),n=(r=e.tailscale)==null?void 0:r.addr;return n&&!(e.addrs??[]).includes(n)&&t.push(`${n}:${e.port}`),t}function Os(e){let t=e.fp;for(const n of e.twins??[])n.fp<t&&(t=n.fp);return t}function Q9(e,t){if(e==null)return t;const n=((t-e)%360+540)%360-180;return e+n}function eV(e,t){const n=/^(\d+)\.(\d+)\.(\d+)/.exec(e??""),r=/^(\d+)\.(\d+)\.(\d+)/.exec(t??"");if(!n||!r)return null;for(let s=1;s<=3;s++){const i=Number(n[s])-Number(r[s]);if(i)return Math.sign(i)}return 0}function tV(e,t,n){const r=t?t.alive?t.shareable===!1?"cannot share here":"works here":"expired here":"not on this deck";if(e.alive&&e.shareable===!1)return{there:"cannot share there",here:r,note:null,tone:"idle"};if(!e.alive){const s=t&&!t.alive?"neither copy works — sign in again here":null;return{there:"broken there",here:r,note:s,tone:s?"bad":"idle"}}return t?t.alive?{there:"works there",here:r,note:null,tone:t.shareable===!1?"idle":"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 nV(e,t,n,r=null){var d;const s=new Map;for(const f of t)(d=s.get(f.key))!=null&&d.alive||s.set(f.key,f);const i=new Set(n),l=[],u=new Set;for(const f of e??[]){if(u.has(f.key))continue;u.add(f.key);const h=s.get(f.key)??null,m=i.has(f.key),g=tV(f,h,m),w=h?h.alive?h.shareable===!1?"unavailable":"works":"expired":"missing",b=!f.alive&&h&&!h.alive?g.note:[w==="works"?null:g.here,f.alive&&f.shareable!==!1?null:g.there,g.note].filter(Boolean).join(" · ")||null;l.push({key:f.key,email:f.email,here:w,there:f.alive?f.shareable===!1?"unavailable":"works":"broken",in:!f.alive||f.shareable===!1?"cut":g.tone==="wait"?"wait":g.tone==="bad"?"blocked":"live",out:m&&h?h.alive&&h.shareable!==!1?"live":"cut":null,caption:b,tone:g.tone,usedThere:r===f.key})}for(const f of n){const h=s.get(f);!h||u.has(f)||(u.add(f),l.push({key:f,email:h.email,here:h.alive?h.shareable===!1?"unavailable":"works":"expired",there:"unknown",in:null,out:h.alive&&h.shareable!==!1?"live":"cut",caption:h.alive?h.shareable===!1?"cannot share here":null:"expired here",tone:h.alive?h.shareable===!1?"idle":"ok":"bad",usedThere:!1}))}return l}const rV=1e3;function r$(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=Cr(e,t);return`${n} · ${r==="now"?"just now":r}`}function bx(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}const s$={works:"works here",expired:"expired here",missing:"not on this deck",unavailable:"cannot share here"},a$={works:"works there",broken:"broken there",unavailable:"cannot share there",unknown:"not offered by that deck"};function o$(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${s$[e.here]}, ${a$[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function i$({row:e,source:t,status:n,accounts:r,now:s}){var z,X,V,J,ee;const{peer:i,stranger:l}=t,u=e.kind==="paired",d=e.self??e.name,f=e.kind!=="dialling",h=e.kind==="dialling"?null:e.fp,m=i?i.addr?`${i.addr}:${i.port}`:"":l?l.port?`${l.addr}:${l.port}`:l.addr:e.addr,g=(i==null?void 0:i.about)??null,w=((z=n.about)==null?void 0:z.version)??null,b=u?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",x=bx(n.about),k=bx(g),j=g!=null&&g.version&&w?eV(g.version,w):null,S=i?Od(i.last,s):null,_=i&&((X=i.last)!=null&&X.error)?D7({error:i.last.error,host:i.addr,port:i.port},[...n.strangers??[],...n.pending??[],...(n.peers??[]).filter(re=>!re.manual&&re.addr).map(re=>({fp:re.fp,name:re.name,addr:re.addr,port:re.port,at:re.lastSeen??0}))],s):null,E=(V=i==null?void 0:i.last)!=null&&V.error&&S&&S.text!==i.last.error?i.last.error:null,T=((J=i==null?void 0:i.last)==null?void 0:J.done)??[],R=!!S&&!!E&&!e.quiet&&e.state.startsWith(S.text),A=u||e.kind==="dialling",B=((i==null?void 0:i.via)??e.via)==="tailscale",$=i?i.waiting?null:i.manual?B?"added by its Tailscale address":"added by address":B?"over Tailscale":"on this network":e.kind==="nearby"?B?"heard over Tailscale":"heard on this network":B?"asked this deck to pair, over Tailscale":"asked this deck to pair",I=e.tone==="bad"?"bad":u?e.here?"up":"down":"loose",D=(i==null?void 0:i.offers)??null,F=I==="up"?(D==null?void 0:D.current)??null:null,W=F&&"key"in F?F.key:null,M=!!F&&"hidden"in F,O=!!F&&"other"in F,L=u?nV((D==null?void 0:D.accounts)??null,r,n.shared??[],W):[],K=L.filter(re=>re.in==null&&re.out==="cut"),Z=L.some(re=>re.in!=null),q=L.some(re=>re.out!=null),H=new Map(T.map(re=>[re.email,re])),P=T.filter(re=>!L.some(oe=>oe.email===re.email)),Y=u?D?D.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.":(ee=i==null?void 0:i.last)!=null&&ee.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,G=D&&(i!=null&&i.last)&&i.last.at-D.at>rV?Cr(D.at,s):null;return{peer:i,stranger:l,paired:u,own:d,canRename:f,fp:h,where:m,about:g,unsaid:b,hereRuns:x,thereRuns:k,order:j,line:S,silence:_,raw:E,echoed:R,showRound:A,how:$,link:I,hiddenThere:M,otherThere:O,lanes:L,spent:K,taking:Z,giving:q,told:H,unplaced:P,unknown:Y,stale:G}}function kx(){return a.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:[a.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),a.jsx("path",{d:"M1 13h14"})]})}function wu({dir:e,gate:t=!1}){const n=t?12:8;return a.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:a.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"})})}function sV({view:e,row:t,status:n,asking:r,drawn:s,onSettings:i}){const{peer:l,paired:u,where:d,about:f,unsaid:h,hereRuns:m,thereRuns:g,order:w,line:b,silence:x,raw:k,echoed:j,showRound:S,how:_,link:E,hiddenThere:T,otherThere:R,lanes:A,spent:B,taking:$,giving:I,told:D,unplaced:F,unknown:W,stale:M}=e;return a.jsxs("div",{className:"lan-map","data-link":E,"data-asking":r||void 0,"data-bus":A.length>0||void 0,children:[a.jsxs("div",{className:"lan-ends",children:[a.jsxs("p",{className:"lan-end",children:[a.jsx("span",{className:"lan-end-name",children:"This deck"}),m&&a.jsx("span",{className:"lan-end-runs",children:m}),u&&n.shareActive===!1&&a.jsx("span",{className:"lan-end-note",children:"current account hidden"})]}),a.jsxs("p",{className:"lan-end","data-side":"there",children:[a.jsx("span",{className:"lan-end-name",children:t.name}),t.kind!=="dialling"&&a.jsxs("span",{className:"lan-end-runs",children:[g??(f?"not said":h),w?` · ${w<0?"older":"newer"}`:null]}),T&&a.jsx("span",{className:"lan-end-note",children:"current account hidden"}),R&&a.jsx("span",{className:"lan-end-note",children:"on another account"})]})]}),a.jsxs("div",{className:"lan-link",children:[a.jsx(kx,{}),a.jsxs("span",{className:"lan-span",children:[a.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[a.jsx("i",{className:"lan-glint","data-dir":"out"}),a.jsx("i",{className:"lan-glint","data-dir":"in"})]}),a.jsx("span",{className:"lan-link-label",children:d?a.jsx("code",{className:"ap-lan-code",children:d}):"none here — it calls this deck"})]}),a.jsx(kx,{}),(d&&_||S)&&a.jsxs("p",{className:"lan-link-sub",children:[d&&_,d&&_&&S&&" · ",S&&(b?j?a.jsx("code",{className:"ap-lan-code",children:k}):a.jsx("span",{className:"lan-round","data-tone":b.tone,children:b.text.replace(/ · now$/," · just now")}):"not asked yet"),S&&k&&!j&&a.jsx("code",{className:"lan-fact-raw",children:k})]}),F.length>0&&a.jsx("ul",{className:"lan-done",children:F.map(O=>{const L=gx(O);return a.jsxs("li",{"data-ok":O.ok&&!L,children:[O.email," ",a.jsxs("span",{className:"lan-done-what",children:[O.ok?"arrived":"did not arrive",L&&` — ${L.long}`]})]},`${O.email}:${O.action}`)})}),x&&a.jsx("p",{className:"lan-note lan-link-note",children:x}),(l==null?void 0:l.waiting)&&a.jsx("p",{className:"lan-note lan-link-note",children:t.hint}),(b==null?void 0:b.hint)&&a.jsx("p",{className:"lan-note lan-link-note",children:b.hint})]}),A.length>0&&a.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${t.name}`,children:A.map((O,L)=>{const K=D.get(O.email),Z=K?gx(K):null,q=O.out==="live"||O.in!=null&&O.in!=="cut";return a.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":O.tone,"data-draw":O.in&&O.out?"both":O.in?"in":"out","data-used-there":O.usedThere||void 0,style:{"--i":L},children:[a.jsx("i",{className:"lan-pip","data-end":"here","data-state":O.here,"aria-hidden":!0}),a.jsxs("span",{className:"lan-track",children:[a.jsxs("span",{className:"lan-wire","data-flow":q?"live":"cut","aria-hidden":!0,children:[(O.in==="live"||O.in==="wait")&&a.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":O.in}),O.out==="live"&&a.jsx("i",{className:"lan-glint","data-dir":"out"})]}),O.in&&O.in!=="cut"&&a.jsx(wu,{dir:"in",gate:O.in==="blocked"}),O.out==="live"&&a.jsx(wu,{dir:"out"}),a.jsx("span",{className:"lan-lane-email",children:O.email})]}),a.jsx("i",{className:"lan-pip","data-end":"there","data-state":O.there,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:o$(O)}),(O.caption||K)&&a.jsxs("span",{className:"lan-lane-note",children:[O.caption,O.caption&&K&&" · ",K&&a.jsxs("span",{className:"lan-lane-done","data-ok":K.ok&&!Z,children:[K.ok?"arrived last round":"did not arrive last round",Z&&` — ${Z.long}`]})]})]},O.key)})},s),u&&a.jsxs(a.Fragment,{children:[B.length>0&&a.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",B.length===1?B[0].email:"the expired ones"," until you sign in again here."]}),W&&a.jsx("p",{className:"lan-empty",children:W}),M&&a.jsxs("p",{className:"lan-stale",children:["As of ",M==="now"?"just now":M,", when it last answered."]}),a.jsxs("div",{className:"lan-legend",children:[$&&a.jsxs("span",{className:"lan-key",children:[a.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:a.jsx(wu,{dir:"in"})}),"from ",t.name]}),I?a.jsxs("span",{className:"lan-key",children:[a.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:a.jsx(wu,{dir:"out"})}),"from this deck, to every paired deck"]}):a.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),a.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:i,"aria-label":"Change what this deck offers",children:"change"})]})]})]})}const aV=20,Fj=34,oV=90,iV=5.2,lV=.61803398875;function cV({status:e,rows:t,accounts:n,now:r,covered:s,onOpenDeck:i,onClose:l}){const u=v.useRef(null),d=pt(l,{focusRef:u}),f=v.useRef(null),[h,m]=v.useState(null);v.useLayoutEffect(()=>{const P=f.current;if(!P)return;const Y=()=>m(z=>{const X=Math.round(P.clientWidth),V=Math.round(P.clientHeight);return z&&z.w===X&&z.h===V?z:{w:X,h:V}});if(Y(),typeof ResizeObserver>"u")return;const G=new ResizeObserver(Y);return G.observe(P),()=>G.disconnect()},[]);const g=v.useMemo(()=>h?V9(t,h.w,h.h):null,[t,h]),w=v.useMemo(()=>K9(t),[t]),b=(g==null?void 0:g.nodes)??[],x=v.useRef(new Map),k=v.useMemo(()=>{const P=new Map;for(const Y of b){const G=Os(Y.row);P.set(G,Q9(x.current.get(G),Y.angle))}return x.current=P,P},[b]),[j,S]=v.useState(null),[_,E]=v.useState(null),T=v.useRef(null),R=v.useCallback(P=>{T.current!=null&&window.clearTimeout(T.current),T.current=null,S(P),E(P)},[]),A=v.useCallback(()=>{T.current!=null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>S(null),oV)},[]);v.useEffect(()=>()=>{T.current!=null&&window.clearTimeout(T.current)},[]);const B=j&&b.some(P=>Os(P.row)===j)?j:null,$=_?t.find(P=>Os(P)===_)??null:null;v.useEffect(()=>{_&&!$&&E(null)},[_,$]);const[I,D]=v.useState(null),F=v.useRef(new Map),W=b.findIndex(P=>Os(P.row)===I),M=W<0?0:W,O=P=>{var X;if(b.length===0)return;const Y=P.key==="ArrowRight"||P.key==="ArrowDown"?1:P.key==="ArrowLeft"||P.key==="ArrowUp"?-1:0,G=P.key==="Home"?0:P.key==="End"?b.length-1:Y?(M+Y+b.length)%b.length:null;if(G==null)return;P.preventDefault();const z=Os(b[G].row);D(z),(X=F.current.get(z))==null||X.focus()},[L,K]=v.useState(()=>typeof document<"u"&&document.hidden);v.useEffect(()=>{const P=()=>K(document.hidden);return document.addEventListener("visibilitychange",P),()=>document.removeEventListener("visibilitychange",P)},[]);const Z=(e==null?void 0:e.enabled)===!0,q=e?Z?Y9(w):"Local network is off":"checking…",H=()=>{E(null),S(null)};return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:a.jsxs("div",{ref:d,className:"modal nm-modal",onClick:P=>P.stopPropagation(),"data-paused":s||L||void 0,role:"dialog","aria-modal":"true","aria-labelledby":"nm-title","aria-describedby":"nm-sub",children:[a.jsxs("header",{className:"modal-head nm-head",children:[a.jsxs("div",{className:"nm-heading",children:[a.jsx("h2",{id:"nm-title",className:"modal-title nm-title",children:"Network map"}),a.jsx("p",{id:"nm-sub",className:"nm-sub",children:q})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{ref:u,type:"button",className:"glyph-btn",onClick:l,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("div",{className:"nm-body",children:[a.jsxs("div",{className:"nm-view",children:[a.jsx("div",{ref:f,className:"nm-stage","data-focus":B?"":void 0,"data-dense":(g==null?void 0:g.dense)||void 0,onClick:P=>{P.target===P.currentTarget&&H()},children:h&&g&&a.jsxs(a.Fragment,{children:[a.jsx(uV,{layout:g,w:h.w,h:h.h}),b.map(P=>{const Y=Os(P.row);return a.jsx(dV,{node:P,angle:k.get(Y)??P.angle,lit:B===Y},Y)}),a.jsx(hV,{status:e}),a.jsx("div",{className:"nm-ring",role:"group","aria-label":"Decks around this deck",onKeyDown:O,children:b.map((P,Y)=>{var z,X;const G=Os(P.row);return a.jsx(fV,{node:P,angle:k.get(G)??P.angle,os:(X=(z=rd(e,P.row).peer)==null?void 0:z.about)==null?void 0:X.os,lit:B===G,shown:_===G,tabbable:Y===M,register:V=>{V?F.current.set(G,V):F.current.delete(G)},onHold:()=>{D(G),R(G)},onRelease:A,onOpen:()=>i(P.row.fp)},G)})}),b.length===0&&a.jsx(pV,{status:e})]})}),a.jsx(mV,{})]}),a.jsx("aside",{className:"nm-side","aria-label":"Details",children:$&&e?a.jsx(yV,{row:$,status:e,accounts:n,now:r,onOpen:()=>i($.fp),onBack:H},Os($)):a.jsx(gV,{status:e,summary:w})})]})]})}),document.body)}function l$(){return a.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:[a.jsx("circle",{cx:"7",cy:"7.4",r:"1.8"}),a.jsx("circle",{cx:"2.4",cy:"2.9",r:"1.2"}),a.jsx("circle",{cx:"11.6",cy:"2.9",r:"1.2"}),a.jsx("circle",{cx:"7",cy:"12.4",r:"1.1"}),a.jsx("path",{d:"M5.7 6.1 3.3 3.8M8.3 6.1l2.4-2.3M7 9.2v2.1"})]})}function uV({layout:e,w:t,h:n}){return a.jsx("svg",{className:"nm-orbits",width:t,height:n,viewBox:`0 0 ${t} ${n}`,"aria-hidden":!0,children:e.rings.map((r,s)=>a.jsx("ellipse",{className:"nm-orbit","data-ring":r.ring,cx:t/2,cy:n/2,rx:r.rx,ry:r.ry,style:{"--ring":s}},r.ring))})}function dV({node:e,angle:t,lit:n}){const r=e.row.kind==="paired"&&e.row.here,s=e.order*lV%1*iV;return a.jsx("span",{className:"nm-wire","aria-hidden":!0,"data-tier":e.tier,"data-via":e.row.via,"data-on":n||void 0,style:{"--nm-a":`${t.toFixed(2)}deg`,"--nm-d":`${e.dist.toFixed(1)}px`,"--from":`${Fj}px`,"--gap":`${Fj+aV}px`,"--i":e.order,"--phase":`${s.toFixed(2)}s`},children:r&&a.jsx("i",{className:"nm-glint"})})}function hV({status:e}){const t=(e==null?void 0:e.enabled)===!0&&e.running;return a.jsxs("div",{className:"nm-core","data-listening":t||void 0,children:[a.jsx("span",{className:"nm-core-orb","aria-hidden":!0}),a.jsxs("span",{className:"nm-core-label",children:[a.jsx("span",{className:"nm-core-name",children:(e==null?void 0:e.name)??"…"}),a.jsx("span",{className:"nm-core-what",children:"this deck"})]})]})}function fV({node:e,angle:t,os:n,lit:r,shown:s,tabbable:i,register:l,onHold:u,onRelease:d,onOpen:f}){const{row:h}=e,m=e.angle*Math.PI/180,g=X9(h,n);return a.jsxs("button",{ref:l,type:"button",className:"nm-node",tabIndex:i?0:-1,"data-tier":e.tier,"data-kind":h.kind,"data-side":e.side,"data-via":h.via,"data-on":r||void 0,"data-shown":s||void 0,"aria-label":`${h.name}: ${t$(h)}. Opens its own dialog.`,style:{"--nm-a":`${t.toFixed(2)}deg`,"--nm-d":`${e.dist.toFixed(1)}px`,"--i":e.order,"--in-x":`${(-Math.cos(m)*14).toFixed(1)}px`,"--in-y":`${(-Math.sin(m)*14).toFixed(1)}px`},onPointerEnter:w=>{w.pointerType==="mouse"&&u()},onPointerLeave:d,onFocus:u,onBlur:d,onClick:f,children:[a.jsx(kx,{}),a.jsx("i",{className:"nm-mark","data-tier":e.tier,"data-kind":h.kind,"aria-hidden":!0}),a.jsxs("span",{className:"nm-label","aria-hidden":!0,children:[a.jsx("span",{className:"nm-name",children:h.name}),a.jsx("span",{className:"nm-cap",children:g})]})]})}function pV({status:e}){const t=(e==null?void 0:e.enabled)===!0;return a.jsx("p",{className:"nm-empty",children:e?t?"No other deck yet. Decks on one network usually find each other within a minute.":"Local network is off, so this deck is not looking for any other.":"Asking this deck about the network…"})}function mV(){return a.jsxs("ul",{className:"nm-legend",children:[a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-mark","data-tier":"online","aria-hidden":!0}),"online"]}),a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-mark","data-tier":"offline","aria-hidden":!0}),"offline"]}),a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-mark","data-tier":"loose","aria-hidden":!0}),"not paired"]}),a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-wire","aria-hidden":!0}),"local network"]}),a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-wire","data-via":"tailscale","aria-hidden":!0}),"Tailscale"]}),a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-glint","aria-hidden":!0}),"a round, out and back"]})]})}function c$({facts:e}){return a.jsx("dl",{className:"lan-facts nm-facts",children:e.map(t=>a.jsxs("div",{className:"lan-fact","data-tone":t.quiet?"quiet":void 0,children:[a.jsx("dt",{children:t.label}),a.jsx("dd",{children:t.value})]},t.label))})}function gV({status:e,summary:t}){const n=J9(e),r=bx(e==null?void 0:e.about),s=[];r&&s.push({label:"Runs",value:r}),s.push({label:n.length>1?"Addresses":"Address",value:n.length?a.jsx("span",{className:"nm-addrs",children:n.map(l=>a.jsx("code",{className:"ap-lan-code",children:l},l))}):"none yet",quiet:n.length===0}),e!=null&&e.pairingMode&&s.push({label:"Pairing",value:e.pairingMode==="invite"?"by invite only":"asks and answers"});const i=[["online",t.online,"paired, and answering"],["offline",t.offline,"paired, and quiet"],["asks",t.asks,"asking to pair"],["nearby",t.nearby,"nearby, not paired"],["dialling",t.dialling,"addresses still dialling"],["tailnet",t.tailnet,"reached over Tailscale"],["declined",t.declined,"declined, not drawn"]];return a.jsxs("div",{className:"nm-panel","data-view":"network",children:[a.jsx("h3",{className:"nm-panel-name",children:(e==null?void 0:e.name)??"…"}),a.jsx("p",{className:"nm-panel-self",children:"this deck, at the centre of the map"}),a.jsx(c$,{facts:s}),a.jsx("ul",{className:"nm-counts",children:i.filter(([,l])=>l>0).map(([l,u,d])=>a.jsxs("li",{"data-count":l,children:[a.jsx("span",{className:"nm-count-n",children:u}),a.jsx("span",{className:"nm-count-words",children:d})]},l))}),a.jsx("p",{className:"nm-panel-hint",children:"Point at a deck, or reach one with the arrow keys, to see it here. Press it to open its own dialog."})]})}function yV({row:e,status:t,accounts:n,now:r,onOpen:s,onBack:i}){var w,b;const l=i$({row:e,source:rd(t,e),status:t,accounts:n,now:r}),u=[],d=l.how??((w=l.peer)!=null&&w.waiting?"it calls this deck; this deck has no address for it":null);d&&u.push({label:"Reached",value:d}),l.where&&u.push({label:"Address",value:a.jsx("code",{className:"ap-lan-code",children:l.where})}),u.push({label:"Runs",value:l.thereRuns?`${l.thereRuns}${l.order?` · ${l.order<0?"older than this deck":"newer than this deck"}`:""}`:l.unsaid,quiet:!l.thereRuns}),l.paired&&((b=l.peer)!=null&&b.pairedAt)&&u.push({label:"Paired",value:r$(l.peer.pairedAt,r)}),l.hiddenThere&&u.push({label:"Working on",value:"not said — its owner hides it",quiet:!0}),l.otherThere&&u.push({label:"Working on",value:"an account it does not share",quiet:!0});const f=e.kind==="paired"&&e.here||e.kind==="asks",m=l.lanes.slice(0,6),g=l.lanes.length-m.length;return a.jsxs("div",{className:"nm-panel","data-view":"deck","data-tier":e.kind==="paired"?e.here?"online":"offline":"loose",children:[a.jsxs("button",{type:"button",className:"ap-lan-word nm-back",onClick:i,children:[a.jsx("span",{"aria-hidden":!0,children:"‹ "}),"the whole network"]}),a.jsxs("h3",{className:"nm-panel-name",children:[a.jsx("i",{className:f?"ap-pulse":"ap-dot","data-kind":e.kind,"aria-hidden":!0}),e.name]}),e.self&&a.jsxs("p",{className:"nm-panel-self",children:["calls itself ",e.self]}),a.jsx("p",{className:"nm-panel-state","data-kind":e.kind,children:t$(e)}),a.jsx(c$,{facts:u}),l.paired&&a.jsxs("section",{className:"nm-logins","aria-label":"Logins the two decks share",children:[a.jsx("p",{className:"nm-logins-title",children:l.lanes.length===0?"No logins between the two":`${l.lanes.length} login${l.lanes.length===1?"":"s"} between the two`}),m.length>0&&a.jsx("ul",{className:"nm-lanes",children:m.map(x=>a.jsxs("li",{className:"nm-lane","data-tone":x.tone,children:[a.jsx("i",{className:"nm-lane-dot","aria-hidden":!0}),a.jsxs("span",{className:"nm-lane-text","aria-hidden":!0,children:[a.jsx("span",{className:"nm-lane-email",children:x.email}),qj(x)&&a.jsx("span",{className:"nm-lane-said",children:qj(x)})]}),x.usedThere&&a.jsx("span",{className:"nm-lane-used","aria-hidden":!0,children:"in use there"}),a.jsxs("span",{className:"vis-hidden",children:[x.email,": ",o$(x)]})]},x.key))}),g>0&&a.jsxs("p",{className:"nm-lanes-more",children:["and ",g," more in its own dialog"]}),l.unknown&&a.jsx("p",{className:"nm-panel-hint",children:l.unknown})]}),a.jsxs("button",{type:"button",className:"btn nm-open",onClick:s,children:["Open ",e.name]})]})}function qj(e){return e.caption?e.caption:e.tone==="ok"?null:`${s$[e.here]} · ${a$[e.there]}`}const wV=6;function vV({anchorId:e,id:t,rows:n,onHold:r,onLet:s}){const i=v.useRef(null),l=n.filter(g=>g.kind==="paired"),u=l.filter(g=>g.here),d=u.slice(0,wV),f=l.length-u.length,h=u.length>d.length?`and ${u.length-d.length} more`:f>0?`${f} not on right now`:null,m=v.useCallback(()=>{const g=i.current,w=document.getElementById(e);if(!g||!w)return;const b=v0(w.getBoundingClientRect(),{width:g.offsetWidth,height:g.offsetHeight},{width:window.innerWidth,height:window.innerHeight});g.style.top=`${b.top}px`,g.style.left=`${b.left}px`,g.style.maxHeight=b.maxHeight==null?"":`${b.maxHeight}px`,g.dataset.side=b.side},[e]);return v.useLayoutEffect(()=>{m()}),v.useEffect(()=>(window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}),[m]),It.createPortal(a.jsxs("div",{ref:i,id:t,className:"ap-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:s,children:[a.jsx("p",{className:"ap-peek-title",children:u.length?"On the network now":"Nobody on the network"}),d.length>0&&a.jsx("div",{className:"ap-peek-list",children:d.map(g=>a.jsxs("span",{className:"ap-peek-who",children:[a.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),a.jsxs("span",{children:[g.name,g.via==="tailscale"&&a.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]})]},`${g.kind}:${g.fp}`))}),h&&a.jsx("p",{className:"ap-peek-rest",children:h})]}),document.body)}function xV({entry:e,rows:t,onOpen:n,onMap:r,peek:s,openPeek:i,shutPeek:l,holdPeek:u,dropPeek:d}){return a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",id:"ap-lan-entry",className:"ap-nav",onClick:()=>{d(),n()},"aria-describedby":s?"ap-lan-peek":void 0,onPointerEnter:f=>{f.pointerType==="mouse"&&i(YM)},onPointerLeave:l,onFocus:f=>{f.target.matches(":focus-visible")&&i(0)},onBlur:l,children:[a.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:[a.jsx("rect",{x:"1.8",y:"2.3",width:"10.4",height:"7.2",rx:"1.2"}),a.jsx("path",{d:"M5 11.9h4M7 9.5v2.4"})]}),a.jsxs("span",{className:"ap-nav-text",children:[a.jsx("span",{className:"ap-nav-name",children:"Local network"}),a.jsxs("span",{className:"ap-nav-state","data-tone":e.tone,children:[e.live&&a.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),e.text]})]}),a.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:a.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),r&&a.jsx("button",{type:"button",className:"ap-lan-map",onClick:()=>{d(),r()},"aria-label":"Show the network map",title:"Network map — every deck this one knows, drawn around it",children:a.jsx(l$,{})}),s&&a.jsx(vV,{anchorId:"ap-lan-entry",id:"ap-lan-peek",rows:t,onHold:u,onLet:l})]})}function bV({row:e,run:t,onVerb:n,onUnpair:r}){const[s,i]=v.useState(!1),l=v.useRef(0),[u,d]=v.useState(null);return v.useEffect(()=>{if(!s)return;const m=window.setTimeout(()=>i(!1),4e3);return()=>window.clearTimeout(m)},[s]),v.useEffect(()=>{if(!u)return;const m=window.setTimeout(()=>d(null),4e3);return()=>window.clearTimeout(m)},[u]),{armed:s,armedTwin:u,pressOwn:()=>{const m=Date.now(),g=El({armedFor:s?e.fp:null,target:e.fp,armedAt:l.current,now:m,gapMs:_l});if(g==="arm"){i(!0),d(null),l.current=m;return}g!=="ignore"&&(i(!1),t(n))},pressTwin:m=>{if(!r)return;const g=Date.now(),w=El({armedFor:u,target:m,armedAt:l.current,now:g,gapMs:_l});if(w==="arm"){d(m),i(!1),l.current=g;return}w!=="ignore"&&(d(null),t(()=>r(m)))}}}function kV({row:e,paired:t,peer:n,status:r,busy:s,press:i,checkNow:l,armed:u,pressOwn:d,run:f,onVerb:h,onInvite:m}){return a.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&a.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),t&&!(n!=null&&n.waiting)&&a.jsx("button",{type:"button",className:"btn",...i(`check:${e.fp}`),onClick:l,title:"Ask this deck now instead of waiting for the next round",children:s===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&a.jsx("button",{type:"button",className:`btn danger lan-peer-verb${u?" armed":""}`,...i(`unpair:${e.fp}`),onKeyDown:g=>{g.repeat&&g.preventDefault()},onClick:()=>d(),"aria-label":u?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:u?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:s===`unpair:${e.fp}`?"Unpairing…":u?"Confirm unpair":"Unpair"}),e.kind==="nearby"&&r.pairingMode!=="invite"&&a.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...i(`accept:${e.fp}`),onClick:()=>void f(h),title:"Send it a request. Somebody at that machine has to accept it before anything is shared.",children:s===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&a.jsx("button",{type:"button",className:"btn lan-peer-verb",...i(`drop:${e.fp}`),onClick:()=>void f(h),title:"Stop trying this address. Nothing was ever paired here.",children:s===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&r.pairingMode!=="invite"&&a.jsx("button",{type:"button",className:"btn lan-peer-verb",...i(`allow:${e.fp}`),onClick:()=>void f(h),title:"Take the no back. That deck is still trying, so its request comes round again on its own.",children:s===`allow:${e.fp}`?"Allowing…":"Let it ask again"}),(e.kind==="nearby"||e.kind==="declined")&&r.pairingMode==="invite"&&m&&a.jsx("button",{type:"button",className:"btn primary lan-peer-verb",onClick:m,title:"This deck pairs only by invite. Make one and send it to whoever is at that machine.",children:"Invite to pair"})]})}function NV({instances:e,now:t,busy:n,press:r,armedTwin:s,pressTwin:i,onUnpair:l}){return a.jsxs("div",{className:"modal-section",children:[a.jsxs("h3",{className:"lan-h",children:[e.length," decks on this machine"]}),a.jsx("ul",{className:"lan-twins",role:"list",children:e.map((u,d)=>{var b,x,k,j;const f=(b=u.peer)!=null&&b.addr?`${u.peer.addr}:${u.peer.port}`:u.row.addr,h=f||u.row.fp,m=(x=u.peer)!=null&&x.pairedAt?Cr(u.peer.pairedAt,t):null,g=[(j=(k=u.peer)==null?void 0:k.about)!=null&&j.version?`runs ${u.peer.about.version}`:null,m?`paired ${m==="now"?"just now":m}`:null,u.row.state].filter(Boolean).join(" · "),w=u.row.fp;return a.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":u.row.tone,children:[a.jsx("i",{className:u.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),f?a.jsx("code",{className:"ap-lan-code lan-twin-at",children:f}):a.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),a.jsx("code",{className:"ap-lan-code lan-twin-fp",children:w}),d>0&&l&&a.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${s===w?" armed":""}`,...r(`unpair:${w}`),onKeyDown:S=>{S.repeat&&S.preventDefault()},onClick:()=>i(w),"aria-label":s===w?`Confirm unpairing ${h}`:`Unpair ${h}`,title:s===w?"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:n===`unpair:${w}`?"unpairing…":s===w?"confirm":"unpair"}),a.jsx("span",{className:"lan-twin-meta",children:d===0?`${g} · shown above`:g})]},w)})})]})}function jV(){return a.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:[a.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),a.jsx("path",{d:"M8.4 3.6l2 2"})]})}function SV({row:e,source:t,status:n,accounts:r,now:s,busy:i,onClose:l,onRename:u,onCheck:d,onVerb:f,onSettings:h,onInvite:m,twins:g=[],onUnpair:w}){const b=v.useRef(null),x=pt(l,{focusRef:b}),[k,j]=v.useState(null),[S,_]=v.useState(null),[E,T]=v.useState(!1),[R,A]=v.useState(0),B=v.useRef(null),$=v.useRef(!0);v.useEffect(()=>()=>{$.current=!1},[]);const I=k!=null;v.useEffect(()=>{var oe;I&&((oe=B.current)==null||oe.select())},[I]);const D=oe=>{const fe=Ws(i,oe);return{disabled:fe.disabled,"aria-busy":fe.busy}},F=async oe=>{const fe=await oe();return $.current&&_(fe),fe==null},{armed:W,armedTwin:M,pressOwn:O,pressTwin:L}=bV({row:e,run:F,onVerb:f,onUnpair:w}),K=i$({row:e,source:t,status:n,accounts:r,now:s}),{peer:Z,stranger:q,paired:H,own:P,canRename:Y,fp:G}=K,z=i===`check:${e.fp}`,X=async oe=>{const fe=oe.trim()===P?"":oe;await F(()=>u(fe))&&j(null)},V=()=>void F(d).then(oe=>{oe&&$.current&&A(fe=>fe+1)}),J=async()=>{if(G)try{if(await navigator.clipboard.writeText(G),!$.current)return;T(!0),window.setTimeout(()=>{$.current&&T(!1)},1600)}catch{$.current&&_("Could not copy it — select the fingerprint and copy it by hand.")}},ee=[];H&&(Z!=null&&Z.pairedAt)?ee.push({label:"Paired",value:r$(Z.pairedAt,s),tone:"meta"}):e.kind==="declined"&&q&&ee.push({label:"Paired",value:`no · you said no ${E0(q.at,s)}`,tone:"meta"}),ee.push({label:"Fingerprint",value:G?a.jsxs("span",{className:"lan-fp",children:[a.jsx("code",{className:"ap-lan-code",children:G}),a.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void J(),"aria-label":E?"Fingerprint copied":"Copy the fingerprint",children:E?"copied":"copy"})]}):"not known — nothing has answered there",tone:G?void 0:"quiet"});const re=g.length?[{row:e,peer:Z??null},...g]:[];return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:a.jsxs("div",{ref:x,className:"modal lan-peer","data-tone":e.tone,onClick:oe=>oe.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[a.jsxs("header",{className:"modal-head lan-peer-head",children:[a.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),a.jsxs("div",{className:"lan-peer-id",children:[I?a.jsxs("form",{className:"lan-peer-edit",onSubmit:oe=>{oe.preventDefault(),X(k??"")},children:[a.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),a.jsx("input",{ref:B,className:"ap-manage-input lan-peer-input",value:k??"",maxLength:48,placeholder:P,"aria-label":"Name for this deck, shown on this deck only",onChange:oe=>j(oe.target.value)}),a.jsx("button",{type:"submit",className:"ap-manage-btn",...D(`alias:${e.fp}`),children:"save"}),a.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>j(null),children:"cancel"})]}):a.jsxs("span",{className:"lan-peer-title",children:[a.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),Y&&a.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{_(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:a.jsx(jV,{})})]}),a.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&a.jsxs(a.Fragment,{children:["calls itself ",a.jsx("span",{className:"lan-peer-self",children:e.self}),I&&a.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...D(`alias:${e.fp}`),onClick:()=>void X(""),children:"use this name"}),a.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&a.jsx("span",{"aria-hidden":!0,children:" · "})]}),a.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{ref:b,type:"button",className:"glyph-btn",onClick:l,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body lan-peer-body",children:[S&&a.jsxs("div",{className:"ap-failure",role:"alert",children:[a.jsx("span",{className:"ap-failure-text",children:S}),a.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>_(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),a.jsx(sV,{view:K,row:e,status:n,asking:z,drawn:R,onSettings:h}),a.jsx("dl",{className:"lan-facts",children:ee.map(oe=>a.jsxs("div",{className:"lan-fact","data-tone":oe.tone,children:[a.jsx("dt",{children:oe.label}),a.jsx("dd",{children:oe.value})]},oe.label))}),re.length>1&&a.jsx(NV,{instances:re,now:s,busy:i,press:D,armedTwin:M,pressTwin:L,onUnpair:w})]}),a.jsx(kV,{row:e,paired:H,peer:Z,status:n,busy:i,press:D,checkNow:V,armed:W,pressOwn:O,run:F,onVerb:f,onInvite:m})]})}),document.body)}function _V(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function EV(e,t,n,r){const s=new Set(e??t);return r?s.add(n):s.delete(n),[...s]}function Bj(e,t,n){return e==null||n!=null&&!n.ok||_V(e,t)?null:e}function u$({line:e,onDismiss:t,onAnswer:n}){const[r,s]=v.useState(!1),i=v.useRef(!1),l=v.useRef(!0);v.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=v.useRef(null),d=v.useRef(null),f=v.useRef(!1);if(v.useEffect(()=>{var m;f.current&&(f.current=!1,e!=null&&e.giveBack||(m=d.current)==null||m.focus())},[e]),!e)return null;const h=async()=>{if(i.current)return;i.current=!0,s(!0);const m=await e9();i.current=!1,l.current&&(s(!1),f.current=document.activeElement===u.current,n(n9(m)))};return a.jsxs("div",{className:e.done?"ap-failure ap-failure-done":"ap-failure",role:"alert",children:[a.jsx("span",{className:"ap-failure-text",children:e.text}),e.giveBack&&a.jsx("button",{ref:u,type:"button",className:"ap-fix ap-give-back","aria-busy":r,onClick:h,title:"Opens macOS's password dialog to make the settings folder yours again",children:r?"waiting for macOS…":"give it back"}),a.jsx("button",{ref:d,type:"button",className:"ap-failure-x",onClick:t,"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]})}function CV(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}const vu="Paused while this deck pairs only by invite. Turn that off above to use it.";function TV({status:e,accounts:t,onClose:n,onChanged:r}){const s=pt(n),[i,l]=v.useState(null),[u,d]=v.useState(null),[f,h]=v.useState(!1),[m,g]=v.useState(null),w=v.useRef(null),b=M=>{const O=Ws(m,M);return{disabled:O.disabled,"aria-busy":O.busy}},x=v.useRef(null),k=v.useRef(!0);v.useEffect(()=>()=>{k.current=!1},[]),v.useEffect(()=>{x.current=Bj(x.current,e.shared??[],null)},[e.shared]);const j=v.useCallback(async(M,O,L="write")=>{w.current=L,g(L);try{const Z=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:M})})).json().catch(()=>null);return k.current?(Z!=null&&Z.ok?d(null):d(Jn(Et(O,Z),Z)),r(),(Z==null?void 0:Z.ok)===!0):!1}catch{return k.current&&d(Jn(Et(O,null))),!1}finally{w.current=null,k.current&&g(null)}},[r]),S=v.useCallback(async()=>{if(i!=null&&i!==(e.name??"")){if(!await j({name:i},"save the name","name"))return;k.current&&l(null)}n()},[i,e.name,j,n]),_=async()=>{if(!e.fp)return;const M=await qa(e.fp);if(k.current){if(!M){d(Jn("Could not copy it — select the fingerprint and copy it by hand."));return}h(!0),window.setTimeout(()=>{k.current&&h(!1)},1600)}},E=new Set(x.current??e.shared??[]),T=e.autoAsk!==!1,R=e.autoAccept!==!1,A=e.pairingMode==="invite",B=M=>{const O=b(M);return{...O,disabled:O.disabled||A}},$=e.shareActive!==!1,I=e.tailscale??null,D=!!(I!=null&&I.on),F=(I==null?void 0:I.ask)!==!1,W=(I==null?void 0:I.accept)!==!1;return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:s,className:"modal lan-modal",onClick:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[a.jsx(u$,{line:u,onDismiss:()=>d(null),onAnswer:M=>{d(M),M.done&&r()}}),a.jsxs("div",{className:"modal-section",children:[a.jsx("h3",{className:"lan-h",children:"Name"}),a.jsxs("div",{className:"ap-lan-row",children:[a.jsx("span",{className:"ap-lan-label",children:"appear as"}),a.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:i??e.name??"",placeholder:"this machine",onChange:M=>l(M.target.value),onKeyDown:M=>{M.key!=="Enter"||i==null||(j({name:i},"save the name","name"),l(null))}}),i!=null&&i!==(e.name??"")&&a.jsx("button",{type:"button",className:"ap-manage-btn",...b("name"),onClick:()=>{j({name:i},"save the name","name"),l(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),a.jsxs("div",{className:"ap-lan-row",children:[a.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?a.jsxs("span",{className:"lan-fp",children:[a.jsx("code",{className:"ap-lan-code",children:e.fp}),a.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void _(),"aria-label":f?"Fingerprint copied":"Copy this deck's fingerprint",children:f?"copied":"copy"})]}):a.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),a.jsxs("div",{className:"modal-section",children:[a.jsx("h3",{className:"lan-h",children:"Share these accounts"}),a.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&a.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(M=>a.jsxs("label",{className:"ap-lan-pick",title:M.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:[a.jsx("input",{type:"checkbox",checked:E.has(M.key),onChange:O=>{const L=EV(x.current,e.shared??[],M.key,O.target.checked);x.current=L,j({shared:L},O.target.checked?"share that account":"stop sharing that account").then(K=>{x.current===L&&(x.current=Bj(L,e.shared??[],{ok:K}))})}}),a.jsx("span",{className:"ap-lan-pick-name",children:M.email}),!M.alive&&a.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},M.key))]}),t.length>0&&a.jsxs("div",{className:"lan-switch",children:[a.jsx("span",{className:"lan-switch-what",children:"Show paired decks which of these this deck is using"}),a.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",...b("current"),onClick:()=>void j({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:a.jsx("span",{className:"switch-knob"})})]})]}),a.jsxs("div",{className:"modal-section",children:[a.jsx("h3",{className:"lan-h",id:"lan-pairing-h",children:"Pairing"}),a.jsx("div",{className:"lan-switches lan-switches-lead",role:"group","aria-labelledby":"lan-pairing-h",children:a.jsxs("div",{className:"lan-switch",children:[a.jsxs("span",{className:"lan-switch-what",children:["Pair new decks only by invite",A&&a.jsx("span",{id:"lan-invite-only-detail",className:"lan-switch-detail",children:"A new deck needs an invite from + in the panel. Paired decks stay paired."})]}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":A,"aria-label":"Pair new decks only by invite","aria-describedby":A?"lan-invite-only-detail":void 0,...b("mode"),onKeyDown:M=>{M.repeat&&M.preventDefault()},onClick:()=>void j({pairingMode:A?"automatic":"invite"},A?"let decks pair on their own again":"pair new decks only by invite","mode"),title:A?"Let decks on this network pair as the two switches below say again.":"Only a deck you send an invite to can pair with this one. Nearby decks can't ask, and requests waiting now are turned away.",children:a.jsx("span",{className:"switch-knob"})})]})}),a.jsxs("div",{className:"lan-auto",role:"group","aria-labelledby":"lan-auto-h",children:[a.jsxs("p",{className:"lan-sub",id:"lan-auto-h",children:["Automatic pairing",A&&a.jsx("span",{className:"lan-sub-state",children:" · paused while pairing is invite-only"})]}),a.jsxs("div",{className:"lan-switches","data-paused":A||void 0,children:[a.jsxs("div",{className:"lan-switch",children:[a.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":T,"aria-label":"Ask every deck this one finds",...B("ask"),onClick:()=>void j({autoAsk:!T},T?"stop asking automatically":"ask every deck this one finds","ask"),title:A?vu: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:a.jsx("span",{className:"switch-knob"})})]}),a.jsxs("div",{className:"lan-switch",children:[a.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),a.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",...B("accept"),onKeyDown:M=>{M.repeat&&M.preventDefault()},onClick:()=>void j({autoAccept:!R},R?"stop accepting automatically":"accept every deck that asks","accept"),title:A?vu: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:a.jsx("span",{className:"switch-knob"})})]})]})]})]}),(I==null?void 0:I.found)&&a.jsxs("div",{className:"modal-section",children:[a.jsx("h3",{className:"lan-h",children:"Tailscale"}),a.jsxs("div",{className:"lan-switches",children:[a.jsxs("div",{className:"lan-switch",children:[a.jsxs("span",{className:"lan-switch-what",children:["Look for my devices",a.jsx("span",{id:"lan-ts-detail",className:"lan-switch-detail",children:CV(I)})]}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":D,"aria-label":"Look for my devices over Tailscale","aria-describedby":"lan-ts-detail",...b("tailscale"),onClick:()=>void j({tailscale:!D},D?"stop looking over Tailscale":"look for your devices over Tailscale","tailscale"),title:D?"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:a.jsx("span",{className:"switch-knob"})})]}),D&&a.jsxs("div",{className:"lan-auto",role:"group","aria-labelledby":"lan-ts-auto-h",children:[a.jsxs("p",{className:"lan-sub",id:"lan-ts-auto-h",children:["Automatic pairing with my devices",A&&a.jsx("span",{className:"lan-sub-state",children:" · paused while pairing is invite-only"})]}),a.jsxs("div",{className:"lan-switches",children:[a.jsxs("div",{className:"lan-switch","data-paused":A||void 0,children:[a.jsx("span",{className:"lan-switch-what",children:"Ask each device it finds"}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":F,"aria-label":"Ask each of my devices it finds over Tailscale",...B("tailscale-ask"),onClick:()=>void j({tailscaleAsk:!F},F?"stop asking your devices automatically":"ask your devices automatically","tailscale-ask"),title:A?vu:F?"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:a.jsx("span",{className:"switch-knob"})})]}),a.jsxs("div",{className:"lan-switch","data-paused":A||void 0,children:[a.jsx("span",{className:"lan-switch-what",children:"Say yes to each device that asks"}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":W,"aria-label":"Say yes to my devices when they ask over Tailscale","data-tone":"warn",...B("tailscale-accept"),onKeyDown:M=>{M.repeat&&M.preventDefault()},onClick:()=>void j({tailscaleAccept:!W},W?"stop accepting your devices automatically":"accept your devices automatically","tailscale-accept"),title:A?vu:W?"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:a.jsx("span",{className:"switch-knob"})})]})]})]})]})]})]}),a.jsxs("footer",{className:"lan-setup-foot",children:[a.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),a.jsx("button",{type:"button",className:"btn primary",...b("name"),onClick:()=>void S(),children:"Done"})]})]})}),document.body)}function RV({on:e,status:t,paired:n,busy:r,pressProps:s,checkNow:i,setAddOpen:l,setSetupOpen:u,setMapOpen:d,onBack:f,closeButton:h}){return a.jsxs("div",{className:"ap-header",children:[a.jsx("button",{type:"button",id:"ap-lan-back",className:"glyph-btn ap-back",onClick:f,"aria-label":"Back to Claude accounts",title:"Back to Claude accounts",children:a.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:a.jsx("path",{d:"M8.4 3.4 4.8 7l3.6 3.6"})})}),a.jsx("h2",{id:"ap-lan-title",children:"Local network"}),a.jsxs("div",{className:"ap-header-right",children:[e&&a.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>d(!0),"aria-label":"Show the network map",title:"Network map — every deck this one knows, drawn around it",children:a.jsx(l$,{})}),e&&a.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>l("add"),"aria-label":"Add a deck",title:(t==null?void 0:t.pairingMode)==="invite"?"Send an invite, or use one you were sent. This deck pairs only by invite.":"Reach a deck that has not turned up on its own — by address, or with an invite",children:a.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:[a.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"}),a.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"})]})}),e&&n>0&&a.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...s("check"),onClick:()=>void i(),"aria-label":r==="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:a.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:[a.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),a.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"}),a.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"})]})}),e&&a.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...s("setup"),onClick:()=>u(!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:a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[a.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),a.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),a.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),h]})]})}function AV({accounts:e,onChanged:t,view:n,onOpen:r,onBack:s,closeButton:i}){const[l,u]=v.useState(!1),[d,f]=v.useState(!1),[h,m]=v.useState(!1),g=J7(),[w,b]=v.useState(!1),{status:x,manual:k,now:j,busy:S,failure:_,dismissFailure:E,answerGiveBack:T,pressProps:R,load:A,toggle:B,answer:$,dropAddress:I,rename:D,checkOne:F,checkNow:W}=i9(t,()=>u(!0)),{armed:M,pressUnpair:O}=l9($),[L,K]=v.useState(null),[Z,q]=v.useState(!1),H=(x==null?void 0:x.enabled)===!0,P=v.useMemo(()=>z7((x==null?void 0:x.pairingMode)==="invite"&&x?{...x,pending:[]}:x,j),[x,j]),Y=L?P.find(we=>{var ye;return we.fp===L||((ye=we.twins)==null?void 0:ye.some(ve=>ve.fp===L))})??null:null;v.useEffect(()=>{L&&x&&!Y&&K(null)},[L,x,Y]);const{asks:G,rest:z,live:X,folded:V,troubled:J,shown:ee,paired:re}=Z7(P,w),oe=q7(x,j),fe=X7(x,P),Ne=a.jsxs(a.Fragment,{children:[d&&x&&a.jsx(R9,{status:x,manual:k,startWith:d==="invite"?"invite":void 0,onClose:()=>f(!1),onChanged:()=>{A(),t()}}),h&&a.jsx(JM,{title:"How Local network works",steps:k9,finish:H?void 0:{label:"Turn it on",act:()=>{m(!1),B()}},onClose:()=>m(!1)}),l&&x&&a.jsx(TV,{status:{...x,manualRows:k},accounts:e,manual:k,onClose:()=>u(!1),onChanged:()=>{A(),t()}}),Z&&a.jsx(cV,{status:x,rows:P,accounts:e,now:j,covered:!!Y||l||!!d||h,onOpenDeck:K,onClose:()=>q(!1)}),Y&&x&&a.jsx(SV,{row:Y,source:rd(x,Y),status:x,accounts:e,now:j,busy:S,onClose:()=>K(null),onRename:we=>D(Y.fp,we),onCheck:()=>F(Y.fp),onVerb:()=>{switch(Y.kind){case"paired":return $("unpair",Y.fp,"unpair that deck");case"nearby":return $("accept",Y.fp,"reach that deck");case"declined":return $("allow",Y.fp,"let that deck ask again");case"dialling":return I(Y.fp);default:return Promise.resolve(null)}},onSettings:()=>{K(null),u(!0)},onInvite:()=>{K(null),f("invite")},twins:(Y.twins??[]).map(we=>({row:we,peer:rd(x,we).peer??null})),onUnpair:we=>$("unpair",we,"unpair that deck")})]});return n?a.jsxs("div",{className:"ap-lan-view",children:[a.jsx(RV,{on:H,status:x,paired:re,busy:S,pressProps:R,checkNow:W,setAddOpen:f,setSetupOpen:u,setMapOpen:q,onBack:s,closeButton:i}),a.jsx("div",{className:"ap-scroll",id:"ap-lan-scroll",children:a.jsxs("div",{className:"ap-lan",children:[a.jsxs("div",{className:"ap-policy",children:[a.jsx("h3",{className:"ap-auto-title",children:"Sync with paired decks"}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":H,"aria-label":"Sync with paired decks",...R("switch"),onClick:()=>void B(),title:H?"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:a.jsx("span",{className:"switch-knob"})})]}),a.jsx(O9,{on:H,status:x}),!H&&a.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>m(!0),title:"Four pictures: what this does, and what to do on each machine",children:[a.jsx(N9,{}),a.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),a.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),a.jsx("p",{className:`ap-lan-status ${oe.tone}`,role:"status",children:oe.tone==="ok"?"":oe.text}),a.jsx(u$,{line:_,onDismiss:E,onAnswer:T}),H&&a.jsxs(a.Fragment,{children:[G.length>0&&a.jsx(M9,{asks:G,pressProps:R,answer:$}),ee.length>0&&a.jsx($9,{rows:ee,pairingMode:x==null?void 0:x.pairingMode,armed:M,pressProps:R,answer:$,dropAddress:I,onUnpair:O,onOpenPeer:K,onInvite:()=>f("invite")}),(X.length>0&&V.length>0||H&&re>0)&&a.jsxs("div",{className:"ap-lan-tail",children:[X.length>0&&V.length>0&&a.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":w,onClick:()=>b(we=>!we),title:w?"Show only the decks that are on":`Show the ${V.length} deck${V.length===1?"":"s"} that are not responding right now`,children:[a.jsx("span",{className:`ap-lan-chev${w?" open":""}`,"aria-hidden":!0,children:"›"}),w?"fewer":`${V.length} more`,!w&&J>0&&a.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",J," not responding"]})]}),H&&re>0&&a.jsx("span",{className:"ap-lan-checked",children:B7(x==null?void 0:x.checkedAt,j,S==="check")})]}),z.length===0&&G.length===0&&!(x!=null&&x.stalled)&&!(x!=null&&x.deaf)&&!(x!=null&&x.lanTunneled)&&a.jsxs(a.Fragment,{children:[a.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."}),a.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>m(!0),children:"How it works"})]})]})]})}),Ne]}):a.jsxs("div",{className:"ap-foot",children:[a.jsx(xV,{entry:fe,rows:P,onOpen:r,onMap:H?()=>q(!0):void 0,...g}),a.jsx("p",{className:"vis-hidden",role:"status",children:oe.tone==="ok"?"":oe.text}),Ne]})}function MV({anchorId:e,id:t,peers:n,onHold:r,onLet:s}){const i=v.useRef(null),{title:l,shown:u,rest:d}=$7(n),f=v.useCallback(()=>{const h=i.current,m=document.getElementById(e);if(!h||!m)return;const g=v0(m.getBoundingClientRect(),{width:h.offsetWidth,height:h.offsetHeight},{width:window.innerWidth,height:window.innerHeight});h.style.top=`${g.top}px`,h.style.left=`${g.left}px`,h.style.maxHeight=g.maxHeight==null?"":`${g.maxHeight}px`,h.dataset.side=g.side},[e]);return v.useLayoutEffect(()=>{f()}),v.useEffect(()=>(window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}),[f]),It.createPortal(a.jsxs("div",{ref:i,id:t,className:"ap-peek ap-fold-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:s,children:[a.jsx("p",{className:"ap-peek-title",children:l}),a.jsx("div",{className:"ap-peek-list",children:u.map(h=>a.jsxs("span",{className:"ap-peek-who ap-fold-who",children:[a.jsx("span",{className:"ap-fold-name",children:h.name}),a.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))}),d&&a.jsx("p",{className:"ap-peek-rest",children:d})]}),document.body)}function $V({peers:e,strained:t,armed:n,threshold:r,open:s,onToggle:i,order:l,choices:u,onOrder:d,allOpen:f,onToggleAll:h,held:m=!1}){const[g,w]=v.useState(!1),b=v.useRef(0);v.useEffect(()=>()=>window.clearTimeout(b.current),[]),v.useEffect(()=>{s&&(window.clearTimeout(b.current),w(!1))},[s]);const x=E=>{s||(window.clearTimeout(b.current),b.current=window.setTimeout(()=>w(!0),E))},k=()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>w(!1),XM)},j=()=>window.clearTimeout(b.current),S=()=>{window.clearTimeout(b.current),w(!1)},_=A7(e,{strained:t&&!s,armed:n,threshold:r});return a.jsxs("div",{className:"ap-rest",children:[a.jsxs("button",{type:"button",id:"ap-rest-entry",className:"ap-nav","aria-expanded":s,"aria-controls":s?"ap-rest-panel":void 0,"aria-describedby":g?"ap-rest-peek":void 0,onClick:()=>{S(),i()},onPointerEnter:E=>{E.pointerType==="mouse"&&x(YM)},onPointerLeave:k,onFocus:E=>{E.target.matches(":focus-visible")&&x(0)},onBlur:k,children:[a.jsxs("span",{className:"ap-nav-text",children:[a.jsx("span",{className:"ap-nav-name",children:"Other accounts"}),a.jsx("span",{className:"ap-nav-state","data-tone":_.tone,children:_.text})]}),a.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:a.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),g&&a.jsx(MV,{anchorId:"ap-rest-entry",id:"ap-rest-peek",peers:e,onHold:j,onLet:k}),s&&a.jsx(IV,{order:l,choices:u,onOrder:d,allOpen:f,onToggleAll:h,held:m})]})}function IV({order:e,choices:t,onOrder:n,allOpen:r,onToggleAll:s,held:i}){var d;const l=v.useRef(null);v.useLayoutEffect(()=>{const f=l.current,h=f==null?void 0:f.parentElement;if(!f||!h)return;const m=()=>h.style.setProperty("--rest-tools-w",`${Math.ceil(f.offsetWidth)}px`);if(m(),typeof ResizeObserver>"u")return;const g=new ResizeObserver(m);return g.observe(f),()=>{g.disconnect(),h.style.removeProperty("--rest-tools-w")}},[]);const u=((d=t.find(f=>f.id===e))==null?void 0:d.label)??"Slot";return a.jsxs("div",{className:"ap-rest-tools",ref:l,children:[a.jsxs("span",{className:"ap-rest-sort",children:[a.jsx("select",{value:e,onChange:f=>n(f.target.value),"aria-label":"Order of the other accounts",title:i?`${u} — held where it was while you are in the list`:u,"data-sorted":e===Id?void 0:"","data-held":i?"":void 0,children:t.map(f=>a.jsx("option",{value:f.id,children:f.label},f.id))}),a.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:a.jsx("path",{d:"M2.5 3.8 5 6.3l2.5-2.5"})})]}),a.jsx("button",{type:"button",className:"ap-rest-all","aria-label":"Expand every account","aria-pressed":r,"aria-controls":"ap-rest-list",title:r?"Collapse every account":"Expand every account",onClick:s,children:a.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:a.jsx("path",{d:r?"M2 7h10M7 1.5V5M5.2 3.2 7 5l1.8-1.8M7 12.5V9M5.2 10.8 7 9l1.8 1.8":"M2 7h10M7 1.5V5M5.2 3.3 7 1.5l1.8 1.8M7 12.5V9M5.2 10.7 7 12.5l1.8-1.8"})})})]})}async function OV(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const LV=1800;function PV({accounts:e,onClose:t,copyText:n}){const[r,s]=v.useState([]),[i,l]=v.useState(null),[u,d]=v.useState(!1),[f,h]=v.useState(null),[m,g]=v.useState(!1),[w,b]=v.useState(()=>Math.floor(Date.now()/1e3)),x=v.useRef(null),k=v.useRef(!1),j=pt(t,{focusRef:x});v.useEffect(()=>{if(!i)return;b(Math.floor(Date.now()/1e3));const I=window.setInterval(()=>b(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(I)},[i]);const S=h7(e),_=f7(e,r),E=_.length===e.length,T=I=>s(D=>p7(D,I)),R=v.useCallback(async()=>{const I=m7(_);if(!Sr(k.current)||!I)return;k.current=!0,d(!0),h(null),g(!1);const D=await OV(I).catch(()=>null);if(k.current=!1,d(!1),!(D!=null&&D.ok)){h(Lo(D,"the share could not be made"));return}l({blob:D.blob,expiresAt:D.expiresAt,shared:D.shared??[],failed:D.failed??[]})},[e,_]),A=i?VM(i.expiresAt,w):null,B=(A==null?void 0:A.tone)==="gone",$=(i==null?void 0:i.shared.length)??0;return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:a.jsxs("div",{ref:j,className:"modal sa-modal",onClick:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("h3",{children:"Share accounts"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsx("section",{className:"modal-body sa-body",children:i?a.jsxs("div",{className:"sa-step",children:[a.jsx("h4",{children:B?"This share has expired":$===1?"1 account, ready to paste":`${$} accounts, ready to paste`}),a.jsx("code",{className:"ap-share-blob",children:i.blob}),a.jsxs("div",{className:"ap-share-foot",children:[a.jsx("button",{type:"button",className:"ap-manage-btn",ref:x,onClick:async()=>{if(B){l(null),R();return}await n(i.blob)&&(g(!0),window.setTimeout(()=>g(!1),LV))},children:B?"make a new share":m?"copied":`copy ${$===1?"the share":"all "+$}`}),a.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:[a.jsx("span",{className:"ap-share-warn",children:$===1?"this is the password":`this is ${$} passwords`})," · ",a.jsx("span",{className:`ap-share-expiry ${A==null?void 0:A.tone}`,children:A==null?void 0:A.text})]})]}),i.failed.length>0&&a.jsxs("div",{className:"sa-failed",role:"alert",children:[a.jsx("p",{className:"sa-failed-head",children:i.failed.length===1?"One account is not in this bundle:":`${i.failed.length} accounts are not in this bundle:`}),a.jsx("ul",{className:"sa-list",children:i.failed.map(I=>{var F;const D=!!(I.email&&((F=I.detail)!=null&&F.includes(I.email)));return a.jsxs("li",{children:[!D&&a.jsx("span",{className:"sa-who",children:I.email||`account ${I.num}`}),a.jsx("span",{className:"sa-why",children:I.detail||"could not be exported"})]},`${I.num}-${I.email}`)})})]}),a.jsx("p",{className:"sa-note",children:B?a.jsx(a.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):a.jsxs(a.Fragment,{children:["Paste it into the other deck with ",a.jsx("strong",{children:"+"})," → ",a.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),a.jsxs("div",{className:"sa-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),g(!1)},children:"Pick again"}),a.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?a.jsxs("div",{className:"sa-step",children:[a.jsx("h4",{children:"Nothing to share"}),a.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",a.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),a.jsx("div",{className:"sa-actions",children:a.jsx("button",{type:"button",className:"btn primary",ref:x,onClick:t,children:"Close"})})]}):a.jsxs("div",{className:"sa-step",children:[a.jsxs("h4",{children:["Which accounts go to the other ",wt,"?"]}),a.jsx("p",{className:`sa-count${_.length?"":" empty"}`,children:g7(_.length)}),a.jsx("ul",{className:"sa-list sa-pick",children:S.map(I=>a.jsx("li",{children:a.jsxs("label",{className:"sa-row",children:[a.jsx("input",{type:"checkbox",checked:_.includes(I.num),onChange:()=>T(I.num)}),a.jsx("span",{className:"sa-who",children:I.label}),I.sub&&a.jsx("span",{className:"sa-sub",children:I.sub})]})},I.num))}),f&&a.jsx("p",{className:"aa-err",children:f}),a.jsxs("div",{className:"sa-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>s(E?e.map(I=>I.num):[]),children:E?"Clear all":"Select all"}),a.jsx("button",{type:"button",className:"btn primary",ref:x,...zs(u,!_.length),onClick:R,children:u?"making the share…":_.length===0?"Share":_.length===1?"Share 1 account":`Share ${_.length} accounts`})]})]})})]})}),document.body)}function d$(e,t){var n;return!e.disabled&&!((n=ei(e,t))!=null&&n.blocksSwitch)}function DV(e,t){return e.map(n=>{const r=ei(n,t);return{key:_r(n),name:n.alias??n.email??`account ${n.num}`,ready:d$(n,t),why:n.disabled?"held out":r!=null&&r.blocksSwitch?r.text:null,warn:(r==null?void 0:r.tone)==="warn",headroom:n.headroom}})}function FV(e,t){const n=Number(t);return(e==null?void 0:e.headroom)!=null&&Number.isFinite(n)&&100-e.headroom>=n}function qV(e){return(e==null?void 0:e.ok)===!0&&(e.enabled||e.external)}function BV(e){return e.map(t=>({key:`${String(t.email??"").trim().toLowerCase()}@@${t.orgUuid??""}`,email:t.email??"",alive:t.alive===!0,shareable:t.collector==="ok"||t.collector==null&&!t.active}))}const h$="agent-dag.otherAccountsOrder",f$="agent-dag.otherAccountsOpen";function UV(){const e=et(h$);return typeof e=="string"&&e.length>0&&e.length<=64?e:Id}function zV(e){Ye(h$,e)}function HV(){const e=et(f$);if(!e)return hx;try{const t=JSON.parse(e);if(((t==null?void 0:t.mode)==="some"||(t==null?void 0:t.mode)==="all")&&Array.isArray(t.keys)&&t.keys.every(n=>typeof n=="string"))return{mode:t.mode,keys:t.keys.slice(0,200)}}catch{}return hx}function WV(e){Ye(f$,JSON.stringify({mode:e.mode,keys:e.keys.filter(t=>!t.startsWith("slot:"))}))}function VV(){const[e,t]=v.useState(null),n=v.useRef(null),r=v.useCallback(l=>Ad(n.current)?(n.current=l,t(l),!0):!1,[]),s=v.useCallback(()=>{n.current=null,t(null)},[]);return{busy:e,claim:r,release:s,pressProps:(l,u=!1)=>{const d=Ws(e,l);return{disabled:d.disabled,"aria-busy":d.busy||u}}}}const GV=8e3,KV=1800,YV=4e3;function XV({claim:e,release:t,load:n,clearFailure:r,rescueFocus:s}){const[i,l]=v.useState(null),u=(i==null?void 0:i.num)??null,d=v.useRef(i);d.current=i;const[f,h]=v.useState(null),[m,g]=v.useState(""),[w,b]=v.useState(null),x=v.useRef(0);v.useEffect(()=>{if(w==null)return;const G=window.setTimeout(()=>b(null),YV);return()=>window.clearTimeout(G)},[w]);const[k,j]=v.useState(null),[S,_]=v.useState(!1),[E,T]=v.useState(null),[R,A]=v.useState(null),B=v.useCallback(async(G,z)=>{if(!e(z))return null;r(),h(null);try{const X=await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(G)}),V=await X.json().catch(()=>null);return V!=null&&V.ok||h({text:Lo(V,"command failed",X.status)}),V}catch{return h({text:"server unreachable"}),null}finally{t()}},[e,t,r]),$=v.useCallback(()=>{l(null),h(null),b(null),j(null),_(!1)},[]),I=(G,z="first")=>{$(),A(null),l({num:G,view:"menu",start:z})},D=v.useCallback(G=>{var V,J;const z=d.current;if(!z||G!=null&&z.num!==G)return;const X=document.getElementById(`ap-menu-${z.num}`);(X!=null&&X.contains(document.activeElement)||Cl(((V=document.activeElement)==null?void 0:V.tagName)??null))&&((J=document.getElementById(`ap-more-${z.num}`))==null||J.focus()),$()},[$]),F=v.useCallback(G=>h(G),[]),W=(G,z)=>{g(z??""),h(null),l({num:G,view:"rename"})},M=G=>g(G),O=G=>{A(null),h(null),l({num:G,view:"move"})},L=G=>A(G),K=async G=>{var X;_(!1);const z=await B({action:"share",account:G},`share-${G}`);!(z!=null&&z.ok)||((X=d.current)==null?void 0:X.num)!==G||(j({num:G,blob:z.blob,expiresAt:z.expiresAt}),l({num:G,view:"share"}))},Z=async G=>{await qa(G)&&(_(!0),window.setTimeout(()=>_(!1),KV))},q=async(G,z)=>{const{commit:X,alias:V}=S7(m,z);if(X){const J=await B({action:"alias",account:G,alias:V},`alias-${G}`);if(await n(!0),!(J!=null&&J.ok))return}D(G)},H=async(G,z)=>{var J,ee,re;const X=await B({action:"move",account:G,slot:z},`move-${G}`),V=N7({menuFor:((J=d.current)==null?void 0:J.num)??null,shareFor:(k==null?void 0:k.num)??null},G,X);if(await n(!0),V){if(V.menuFor!=null){const fe=document.getElementById(`ap-menu-${G}`),Ne=document.getElementById(`ap-more-${V.menuFor}`);Ne&&(fe!=null&&fe.contains(document.activeElement)||Cl(((ee=document.activeElement)==null?void 0:ee.tagName)??null))&&Ne.focus()}((re=d.current)==null?void 0:re.num)===G&&$(),b(V.confirmRemove),V.shareFor==null&&(j(null),_(!1)),T(V.swapNote);const oe=V.swapNote;oe&&window.setTimeout(()=>T(fe=>fe===oe?null:fe),GV),A(null),s(V.menuFor)}return X};return{menu:i,menuFor:u,menuError:f,aliasDraft:m,confirmRemove:w,share:k,shareCopied:S,slotDraft:R,swapNote:E,showMenu:I,dropMenu:$,closeMenu:D,sayInMenu:F,startRename:W,typeAlias:M,doAlias:q,startMove:O,pickSlot:L,doSlot:async(G,z,X)=>{if(!X.sends){D(G);return}await H(G,z)},makeShare:K,copyShare:Z,pressRemove:G=>{const z=Date.now(),X=El({armedFor:w,target:G,armedAt:x.current,now:z,gapMs:_l});if(X==="arm"){b(G),x.current=z;return}X!=="ignore"&&(b(null),B({action:"remove",account:G},`rm-${G}`).then(V=>{var J;n(!0),V!=null&&V.ok&&(((J=d.current)==null?void 0:J.num)===G&&$(),s(null))}))}}}function ZV(e,t){return!e||!t||t.some(n=>n.num===e.num&&n.active)?e:null}function JV({data:e,claim:t,release:n,load:r,sayFailure:s,clearFailure:i,sayInMenu:l,rescueFocus:u}){const[d,f]=v.useState(null),h=v.useCallback(async(g,w,b="panel")=>{if(!t(w))return null;const x=b==="menu"?l:s;x(null);try{const k=await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),j=await k.json().catch(()=>null);return j!=null&&j.ok||x({text:fx(j,"command failed",k.status),raw:Al(j)}),j}catch{return x({text:"server unreachable"}),null}finally{n()}},[t,n,l,s]);return v.useEffect(()=>{!(e!=null&&e.ok)||!e.accounts||f(g=>ZV(g,e.accounts))},[e]),{switched:d,post:h,doSwitch:async(g,w)=>{if(t(`switch-${g}`)){i(),f(null);try{const x=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:g})})).json().catch(()=>null);x!=null&&x.ok?f({num:g,name:w}):s({text:fx(x,"the switch failed"),raw:Al(x),row:g}),await r(!0)}catch{s({text:"server unreachable",row:g})}finally{n(),u(g)}}}}}const QV=1800;function eG({auto:e,post:t,load:n}){var b;const[r,s]=v.useState(null),[i,l]=v.useState(!1),u=v.useRef(null),d=v.useRef(null),f=((b=e==null?void 0:e.settings["autoswitch.threshold"])==null?void 0:b.value)??"90",h=r??f,m=C7(h,f);return{threshold:f,thresholdPick:h,thresholdCtl:m,thresholdSaved:i,thresholdRef:u,thresholdSaveRef:d,proposeThreshold:x=>s(x),doThreshold:async(x,k)=>{if(k.sends){const j=await t({action:"setting",key:"autoswitch.threshold",value:x},"threshold");if(await n(!0),!(j!=null&&j.ok))return;s(null)}l(!0),window.setTimeout(()=>{var j;document.activeElement===d.current&&((j=u.current)==null||j.focus()),l(!1)},QV)}}}const tG=Object.freeze({text:"couldn't reach the deck server",reload:!0}),nG=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function Uj(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function rG(e){const t=e.find(r=>!r.ok);if(!t)return null;const n=Al(t.body);return{text:fx(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function zj(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 p$=15e3,sG=3e4;function aG(e){const[t,n]=v.useState(null),[r,s]=v.useState(null),[i,l]=v.useState(!1),[u,d]=v.useState(null),f=v.useRef(null),h=v.useCallback(async(w=!1)=>{w&&l(!0);const b=new AbortController,x=window.setTimeout(()=>b.abort(),sG);try{const[k,j]=await Promise.all([fetch(`/api/claude-accounts${w?"?refresh=1":""}`,{signal:b.signal}),fetch("/api/cswap-auto",{signal:b.signal})]);if(k.ok){const _=await k.json();n(_),e(_)}j.ok&&s(await j.json());const S=rG([await Uj(k),await Uj(j)]);d(_=>zj(_,S))}catch{d(k=>zj(k,b.signal.aborted?nG:tG))}finally{window.clearTimeout(x),w&&l(!1)}},[e]);v.useEffect(()=>(h(!0),f.current=window.setInterval(()=>h(!1),p$),()=>{f.current!=null&&window.clearInterval(f.current)}),[h]);const m=v.useCallback(w=>d(w),[]),g=v.useCallback(()=>d(null),[]);return{data:t,auto:r,reloading:i,failure:u,load:h,sayFailure:m,clearFailure:g}}const oG="#ap-rest-entry";function iG(e){return[`#${e}`,oG,...bM(null)]}function lG(e){const t=v.useRef(null),n=s=>{t.current=s.target.id||null},r=s=>{s.target.isConnected&&(t.current=null)};return v.useLayoutEffect(()=>{var i;const s=t.current;if(!(!s||!Cl(((i=document.activeElement)==null?void 0:i.tagName)??null)))for(const l of iG(s)){const u=document.querySelector(l);if(u){u.focus();return}}},[e]),{onFocus:n,onBlur:r}}function cG({onClose:e,leaving:t}){var Nn,gt,Bn;const{busy:n,claim:r,release:s,pressProps:i}=VV(),[l,u]=v.useState("accounts"),[d,f]=v.useState(!1),[h,m]=v.useState(null),g=v.useRef(h);g.current=h;const[w,b]=v.useState(!1),[x,k]=v.useState(!1),[j,S]=v.useState([]),[_,E]=v.useState(!1),[T,R]=v.useState(null),[A,B]=v.useState(HV),[$,I]=v.useState(UV),[D,F]=v.useState(null),[W,M]=v.useState(!1),O=v.useCallback(pe=>B(Be=>gW(Be,pe.accounts)),[]),{data:L,auto:K,reloading:Z,failure:q,load:H,sayFailure:P,clearFailure:Y}=aG(O),G=lG(L),z=v.useCallback(pe=>{window.requestAnimationFrame(()=>{var Be;if(Cl(((Be=document.activeElement)==null?void 0:Be.tagName)??null))for(const Je of bM(pe)){const fn=document.querySelector(Je);if(fn){fn.focus();return}}})},[]),X=XV({claim:r,release:s,load:H,clearFailure:Y,rescueFocus:z}),{menu:V,menuFor:J,swapNote:ee,showMenu:re,dropMenu:oe,closeMenu:fe,sayInMenu:Ne}=X,{switched:we,post:ye,doSwitch:ve}=JV({data:L,claim:r,release:s,load:H,sayFailure:P,clearFailure:Y,sayInMenu:Ne,rescueFocus:z}),{threshold:Ie,thresholdPick:xe,thresholdCtl:ue,thresholdSaved:se,thresholdRef:be,thresholdSaveRef:Te,proposeThreshold:Le,doThreshold:$e}=eG({auto:K,post:ye,load:H}),Oe=CM();v.useEffect(()=>{WV(A)},[A]),v.useEffect(()=>{zV($)},[$]);const Xe=(Nn=L==null?void 0:L.accounts)==null?void 0:Nn.find(pe=>pe.active),Ge=Xe?ei(Xe,Oe):null,Ze=(L==null?void 0:L.accounts)??[],Ve=Xe?Ze.filter(pe=>!pe.active):[],Ot=PM(Ve),mt=hW($,Ve),Pe=DM(dW(Ve,mt,pe=>d$(pe,Oe)),D),at=v.useRef(!1),Qe=v.useRef(!1),ot=v.useRef(!1),Ft=v.useCallback(()=>{!at.current&&!Qe.current&&!ot.current&&F(null)},[]),bt=()=>F(pe=>pe??Pe.map(_r)),kt={onPointerEnter:()=>{at.current=!0,bt()},onPointerLeave:()=>{at.current=!1,Ft()},onFocus:pe=>{pe.target.matches(":focus-visible")&&(Qe.current=!0,bt())},onBlur:pe=>{pe.currentTarget.contains(pe.relatedTarget)||(Qe.current=!1,Ft())}},qt=J!=null&&Ve.some(pe=>pe.num===J)||h!=null&&Ve.some(pe=>pe.num===h.num);v.useEffect(()=>{ot.current=qt,qt||Ft()},[qt,Ft]);const bn=W&&Ve.length>0;v.useEffect(()=>{bn||(at.current=Qe.current=ot.current=!1,F(null))},[bn]);const Gt=v.useRef(!1);v.useEffect(()=>{Gt.current&&Ve.length===0&&z(null),Gt.current=Ve.length>0},[Ve.length,z]);const Bt=Pe.length?Ze.filter(pe=>pe.active):Ze,dn=DV(Pe,Oe),Kt=FV(Xe,Ie),rs=qV(K),$r=pe=>W&&Pe.some(Be=>Be.num===pe)?"ap-rest-list":"ap-scroll",ss=(pe,Be="first")=>{re(pe,Be),m(null)},ur=(pe,Be)=>{oe(),m(Je=>(Je==null?void 0:Je.anchor)===Be?null:{num:pe,anchor:Be})},qn=v.useCallback((pe=!1)=>{var Je;const Be=g.current;pe&&Be&&((Je=document.getElementById(Be.anchor))==null||Je.focus()),m(null)},[]),as=()=>{oe(),m(null),u("lan")},kn=v.useRef(l);v.useEffect(()=>{kn.current!==l&&(kn.current=l,window.requestAnimationFrame(()=>{var pe;(pe=document.getElementById(l==="lan"?"ap-lan-back":"ap-lan-entry"))==null||pe.focus()}))},[l]),v.useEffect(()=>{L!=null&&L.ok&&f(!0)},[L==null?void 0:L.ok]),v.useEffect(()=>{t&&(oe(),m(null))},[t,oe]),v.useEffect(()=>{V&&(L!=null&&L.accounts)&&!L.accounts.some(pe=>pe.num===V.num)&&oe(),h&&(L!=null&&L.accounts)&&!L.accounts.some(pe=>pe.num===h.num)&&m(null)},[L,V,h,oe]),v.useEffect(()=>{T==null||!(L!=null&&L.accounts)||L.accounts.some(pe=>pe.num===T.num)||(R(null),z(null))},[L,T,z]);const dr=a.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:a.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})}),hn=pe=>{const Be=FM(A,pe),Je=J===pe.num,fn=(q==null?void 0:q.row)===pe.num?q:null,Ut=(we==null?void 0:we.num)===pe.num,hr=(ee==null?void 0:ee.at)===pe.num?ee:null,Ys=hr?Ze.find(Un=>Un.num===hr.displaced):void 0,is=(h==null?void 0:h.anchor)===`ap-issue-${pe.num}`;return a.jsx(vW,{a:pe,nowSec:Oe,opened:Be,onToggleLanes:()=>B(Un=>pW(Un,pe)),busy:n,pressProps:i,onSwitch:ve,menuOpen:Je,onOpenMenu:ss,onCloseMenu:fe,refusal:fn,onDismissRefusal:()=>Y(),switchedHere:Ut,swapped:hr,displaced:Ys,issueExpanded:is,onOpenIssue:ur,sortKey:pe.active?null:uW(mt)},pe.num)},os=L!=null&&L.ok&&(K!=null&&K.ok)?a.jsx(qW,{auto:K,threshold:Ie,thresholdPick:xe,thresholdCtl:ue,thresholdSaved:se,thresholdRef:be,thresholdSaveRef:Te,proposeThreshold:Le,doThreshold:$e,pressProps:i,post:ye,load:H}):null;return a.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",onFocus:G.onFocus,onBlur:G.onBlur,children:[l==="accounts"&&a.jsx(bW,{canShare:(((gt=L==null?void 0:L.accounts)==null?void 0:gt.length)??0)>0,canReport:(((Bn=L==null?void 0:L.accounts)==null?void 0:Bn.length)??0)>1||x,onAdd:()=>b(!0),onReport:()=>{S([...Bt,...Pe].map(_r)),k(!0)},onShareSet:()=>E(!0),onReload:()=>H(!0),pressProps:i,reloading:Z,closeButton:dr}),l==="accounts"&&a.jsx("div",{className:"ap-scroll",id:"ap-scroll",children:L==null?q?a.jsxs("div",{className:"ap-empty",role:"alert",children:[a.jsx("span",{title:q.raw||void 0,children:q.text}),a.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",p$/1e3," seconds."]}),a.jsx("button",{type:"button",className:"ap-fix",...i("reload",Z),onClick:()=>H(!0).then(()=>z(null)),children:Z?"trying…":"try again"})]}):a.jsx("div",{className:"ap-empty",children:"Checking…"}):L.ok?a.jsxs(a.Fragment,{children:[Xe&&(Ge==null?void 0:Ge.tone)==="warn"&&a.jsxs("div",{className:"ap-notice",children:[a.jsxs("button",{type:"button",id:"ap-notice",className:"ap-issue","data-tone":"warn","aria-haspopup":"dialog","aria-expanded":(h==null?void 0:h.anchor)==="ap-notice","aria-controls":(h==null?void 0:h.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>ur(Xe.num,"ap-notice"),children:[a.jsx(b0,{}),a.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),Ge.fix&&a.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>b(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"Sign in"})]}),a.jsx("ul",{className:"ap-list",children:Bt.map(hn)}),Pe.length>0&&a.jsx($V,{peers:dn,strained:Kt,armed:rs,threshold:K!=null&&K.ok?Ie:null,open:W,onToggle:()=>M(pe=>!pe),order:mt,choices:Ot,onOrder:I,allOpen:qM(A,Pe),onToggleAll:()=>B(pe=>mW(pe,Pe)),held:D!=null}),Pe.length>0&&W&&a.jsxs("div",{className:"ap-rest-panel",id:"ap-rest-panel",children:[a.jsx("ul",{className:"ap-list ap-others",id:"ap-rest-list",...kt,children:Pe.map(hn)}),os]}),Pe.length===0&&os,q&&q.row==null&&a.jsxs("div",{className:"ap-failure",role:"alert",children:[a.jsx("span",{className:"ap-failure-text",title:q.raw||void 0,children:q.text}),a.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>Y(),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),V&&(()=>{var Be;const pe=(Be=L.accounts)==null?void 0:Be.find(Je=>Je.num===V.num);return pe?a.jsx(T7,{a:pe,accountMenu:X,slots:(L.accounts??[]).map(Je=>Je.num),boundaryId:$r(pe.num),nowSec:Oe,busy:n,pressProps:i,rotating:!!(K!=null&&K.enabled||K!=null&&K.external),onProjects:()=>{R({num:pe.num,name:pe.alias??pe.email??`account ${pe.num}`}),fe(pe.num)},onRotation:()=>ye({action:"account",account:pe.num,enabled:pe.disabled},`rot-${pe.num}`,"menu").then(Je=>{H(!0),Je!=null&&Je.ok&&fe(pe.num)})}):null})(),h&&(()=>{var Je;const pe=(Je=L.accounts)==null?void 0:Je.find(fn=>fn.num===h.num),Be=pe?ei(pe,Oe):null;return!pe||!Be?null:a.jsx(nW,{anchorId:h.anchor,boundaryId:h.anchor==="ap-notice"?"ap-scroll":$r(pe.num),issue:Be,who:pe.alias??pe.email??`account ${pe.num}`,fetchedAt:pe.fetchedAt,nowSec:Oe,onClose:qn,onSignIn:()=>b(!0)})})()]}):a.jsx(xW,{data:L})}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:we?`Now active: ${we.name}`:""}),d&&a.jsx(AV,{accounts:BV((L==null?void 0:L.accounts)??[]),onChanged:()=>H(!0),view:l==="lan",onOpen:as,onBack:()=>u("accounts"),closeButton:dr}),w&&a.jsx(b7,{onClose:()=>b(!1),onChanged:()=>H(!0)}),_&&a.jsx(PV,{accounts:((L==null?void 0:L.accounts)??[]).map(pe=>({num:pe.num,email:pe.email,alias:pe.alias,org:pe.org})),onClose:()=>E(!1),copyText:qa}),T!=null&&(()=>{var Be;const pe=(Be=L==null?void 0:L.accounts)==null?void 0:Be.find(Je=>Je.num===T.num);return L!=null&&L.accounts&&!pe?null:a.jsx(eW,{num:T.num,name:pe?pe.alias??pe.email??`account ${pe.num}`:T.name,onClose:()=>R(null)})})(),x&&a.jsx(DW,{accounts:(L==null?void 0:L.accounts)??null,order:j,failed:q!=null&&q.reload?q.text:null,nowSec:Oe,onClose:()=>k(!1)})]})}const uG=16,dG=120;function hG(e,t,n=0){return e.clientX>=t.left-n&&e.clientX<=t.right+n&&e.clientY>=t.top-n&&e.clientY<=t.bottom+n}function fG(e,t){const n=Math.max(t.left-e.clientX,0,e.clientX-t.right),r=Math.max(t.top-e.clientY,0,e.clientY-t.bottom);return Math.hypot(n,r)}function pG(e,t){return hG(e,t,uG)?"over":fG(e,t)<=dG?"near":"far"}function mG(e){var n,r;if(typeof e.clientX=="number"&&typeof e.clientY=="number")return{clientX:e.clientX,clientY:e.clientY};const t=((n=e.changedTouches)==null?void 0:n[0])??((r=e.touches)==null?void 0:r[0]);return t?{clientX:t.clientX,clientY:t.clientY}:null}function gG(){const[e,t]=v.useState(!1),[n,r]=v.useState(""),[s,i]=v.useState("far"),l=v.useRef(null),u=Ru(e,140),d=v.useCallback(g=>{var x;const w=(x=l.current)==null?void 0:x.getBoundingClientRect(),b=mG(g);return w&&b?pG(b,w):"far"},[]),f=v.useCallback(g=>{g!==null&&(r(g),t(!0)),i("far")},[]),h=v.useCallback(g=>{i(d(g))},[d]),m=v.useCallback((g,w)=>{const b=w&&d(g)==="over";return t(!1),b},[d]);return{trashDragging:e,trashLabel:n,trashState:s,trashZoneRef:l,trashPhase:u,beginTrashDrag:f,trackTrashDrag:h,endTrashDrag:m}}const yG=420;function wG(){const[e,t]=v.useState(!1),n=v.useRef(null),r=v.useCallback(()=>{n.current&&(window.clearTimeout(n.current),n.current=null),t(!1)},[]),s=v.useCallback(i=>{i.length!==0&&queueMicrotask(()=>{t(!0),n.current&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>t(!1),yG+80)})},[]);return v.useEffect(()=>()=>{n.current&&window.clearTimeout(n.current)},[]),{bubbling:e,endBubble:r,onBubble:s}}const R0=11,m$=7.2,g$=6.6,vG={width:104,height:48},Hj={width:96,height:44},y$={width:220,height:103};function xG(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)?y$:{width:Math.max(160,t),height:Math.max(72,n)}}function hp(e,t,n){return e.width*t>=n.width&&e.height*t>=n.height}function bG(e,t,n=y$){if(!Number.isFinite(t)||t<=0)return e??"detail";const r=R0*t;return e==="detail"?r>=g$?"detail":hp(n,t,Hj)?"compact":"overview":r>=m$?"detail":e==="compact"?hp(n,t,Hj)?"compact":"overview":hp(n,t,vG)?"compact":"overview"}const kG=m$/R0,NG=g$/R0;function jG(e,t){return e>=kG?e:Math.max(e,Math.min(t,NG-.001))}const SG=.8,_G=1;function EG({stateRef:e,measuredRef:t,measuredVersionRef:n,canvasRef:r}){const[s,i]=v.useState("detail"),l=v.useRef(null),u=v.useRef(null),d=v.useCallback(()=>{var w;const h=n.current;if(((w=u.current)==null?void 0:w.version)===h)return u.current.card;const m=[];for(const b of e.current.agents.keys()){const x=t.current.get(b);x&&m.push(x)}const g=xG(m);return u.current={version:h,card:g},g},[]),f=v.useCallback(h=>{var g;const m=bG(l.current,h,d());return m===l.current?null:(l.current=m,(g=r.current)==null||g.setAttribute("data-lod",m),i(m),m)},[d,r]);return{lod:s,lodRef:l,applyZoom:f}}const CG=40,TG=120;function RG(e,t){let n=null,r=0,s=Number.NEGATIVE_INFINITY;const i=()=>{n=null,s=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(d,f,h)=>{if(n!=null){if(r<=d)return;l()}const m=Math.min(h,Math.max(0,d-f));r=d,n=t.setTimeout(i,m)};return{live(d=CG){const f=t.now(),h=Math.max(s+d,f);if(h<=f){l(),i();return}u(h,f,d)},replay(d=TG){l(),r=t.now()+d,n=t.setTimeout(i,d)},flush(){l(),i()},cancel(){l()}}}const AG=1024*1024,Wj=5,w$=.8,Nx=24,MG="agent-dag.soundCustom.done",$G="agent-dag.soundCustom.needs-input",hl={done:MG,"needs-input":$G};function Ml(e){if(e.kind!=="audio")return e;const{bytes:t,...n}=e;return n}function Vj(e){return!e||!/^[a-zA-Z0-9._-]{1,96}$/.test(e)?null:e}function IG(e){return{done:Vj(e(hl.done)),"needs-input":Vj(e(hl["needs-input"]))}}function OG(e,t){return{done:e.done===t?null:e.done,"needs-input":e["needs-input"]===t?null:e["needs-input"]}}function LG(e){return e.done&&e.done===e["needs-input"]?e.done:null}const PG={wav:"audio/wav",wave:"audio/wav",mp3:"audio/mpeg",ogg:"audio/ogg",oga:"audio/ogg",webm:"audio/webm",m4a:"audio/mp4",mp4:"audio/mp4"},v$=new Set(["audio/wav","audio/x-wav","audio/mpeg","audio/mp3","audio/ogg","audio/webm","audio/mp4"]);function x$(e,t){const n=t.toLowerCase().split(";")[0].trim();if(v$.has(n))return n;const r=e.toLowerCase().split(".").pop()??"";return PG[r]??n}function Gj(e,t){const n=x$(e.name,e.type);if(!v$.has(n))return"Use a WAV, MP3, OGG, or browser-recorded audio file.";if(!Number.isFinite(e.size)||e.size<=0)return"The audio file is empty.";if(e.size>AG)return"Audio must be 1 MB or smaller.";if(t!==void 0){if(!Number.isFinite(t)||t<=0)return"The audio file could not be decoded.";if(t>Wj)return`Audio must be ${Wj} seconds or shorter.`}return null}function jx(e){return e>=Nx?`There are already ${Nx} custom sounds. Delete one first.`:null}function DG(e,t){const n=e.indexOf(t);return n<0?null:e[n+1]??e[n-1]??null}function FG(e){let t=0;for(const n of e)for(let r=0;r<n.length;r++)t=Math.max(t,Math.abs(n[r]));return t<=1e-5?1:Math.min(16,w$/t)}function b$(){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)}`}async function qG(e,t,n=b$()){var f;const r=((f=e.name)==null?void 0:f.trim())||"Custom sound",s=Gj({name:r,type:e.type,size:e.size});if(s)throw new Error(s);const i=await e.arrayBuffer();let l;try{l=await t(i.slice(0))}catch{throw new Error("The audio file could not be decoded.")}const u=Gj({name:r,type:e.type,size:e.size},l.duration);if(u)throw new Error(u);const d=Array.from({length:l.numberOfChannels},(h,m)=>l.getChannelData(m));return{id:n,name:r.replace(/\.(wav|wave|mp3|ogg|oga|webm|m4a|mp4)$/i,"")||"Custom sound",kind:"audio",mime:x$(r,e.type),duration:l.duration,normalizationGain:FG(d),bytes:i}}function BG(e,t=b$()){const n=e.name.trim()||"Custom voice",r=e.text.trim();if(!r)throw new Error("Enter the words this voice should say.");const s=Number.isFinite(e.rate)?e.rate:1,i=Number.isFinite(e.pitch)?e.pitch:1;return{id:t,name:n,kind:"tts",text:r.slice(0,180),voiceURI:e.voiceURI??"",rate:Math.min(2,Math.max(.5,s)),pitch:Math.min(2,Math.max(.5,i))}}const UG="ccdeck-notification-audio",zG=2,ar="assets",Rr="summaries";function zl(){return typeof window<"u"?window.ccdeckNotificationAudio??null:null}function HG(){return new Promise((e,t)=>{const n=indexedDB.open(UG,zG);n.onupgradeneeded=r=>{const s=n.result,i=s.objectStoreNames.contains(ar)?n.transaction.objectStore(ar):s.createObjectStore(ar,{keyPath:"id"});if(s.objectStoreNames.contains(Rr))return;const l=s.createObjectStore(Rr,{keyPath:"id"});if(r.oldVersion<1)return;const u=i.openCursor();u.onsuccess=()=>{const d=u.result;d&&(l.put(Ml(d.value)),d.continue())}},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??new Error("Could not open local audio storage."))})}async function Hl(e,t,n){const r=await HG();try{return await new Promise((s,i)=>{const l=r.transaction(e,t),u=n(l),d=()=>i(l.error??new Error("Local audio storage failed."));l.oncomplete=()=>s(u?u.result:void 0),l.onerror=d,l.onabort=d})}finally{r.close()}}async function WG(){const e=zl();return e?e.list():typeof indexedDB>"u"?[]:await Hl([Rr],"readonly",t=>t.objectStore(Rr).getAll())??[]}async function VG(e){const t=zl();return t?t.get(e):typeof indexedDB>"u"?null:await Hl([ar],"readonly",n=>n.objectStore(ar).get(e))??null}async function Kj(e){const t=zl();if(t){await t.put(e);return}if(typeof indexedDB>"u")throw new Error("Local audio storage is unavailable in this browser.");await Hl([ar,Rr],"readwrite",n=>{n.objectStore(ar).put(e),n.objectStore(Rr).put(Ml(e))})}async function GG(e,t){const n=zl();if(n){const r=await n.get(e);r&&await n.put({...r,name:t});return}if(typeof indexedDB>"u")throw new Error("Local audio storage is unavailable in this browser.");await Hl([ar,Rr],"readwrite",r=>{const s=r.objectStore(ar),i=s.get(e);i.onsuccess=()=>{const l=i.result;if(!l)return;const u={...l,name:t};s.put(u),r.objectStore(Rr).put(Ml(u))}})}async function KG(e){const t=zl();if(t){await t.remove(e);return}typeof indexedDB>"u"||await Hl([ar,Rr],"readwrite",n=>{n.objectStore(ar).delete(e),n.objectStore(Rr).delete(e)})}const Iu=["done","needs-input"],YG=[{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}]}],XG=[{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}]}],A0={done:YG,"needs-input":XG},vn="two";function Sx(e,t){const n=A0[e];return n.find(r=>r.id===t)??n.find(r=>r.id===vn)??n[0]}function k$(e,t){return A0[e].some(r=>r.id===t)?t:vn}Sx("done",vn).notes,Sx("needs-input",vn).notes;const Yj=.04,N$=.24,Ou=0,ad=100,_x=5,Pa=50;function ti(e){if(!Number.isFinite(e))return Pa;const t=Math.round(e/_x)*_x;return Math.min(ad,Math.max(Ou,t))}function j$(e){if(e==null)return Pa;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?ti(Number(t)):Pa}function M0(e){const t=ti(e),n=Yj+(N$-Yj)*(t/ad);return Math.round(n*1e4)/1e4}function ZG(e,t){const n=t.trim,r=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(M0(e)*r*1e4)/1e4}const JG=.012,Xj=1e-4;function QG(e){return Math.min(1,M0(e)/N$)}function eK(e,t){const n=e*(M0(t)/w$);return Math.max(1e-4,n)}const tK=160,nK="agent-dag.soundLevel.done",rK="agent-dag.soundLevel.needs-input",sK="agent-dag.soundFigure.done",aK="agent-dag.soundFigure.needs-input",S$={done:nK,"needs-input":rK},od={done:sK,"needs-input":aK},Ex={done:{level:Pa,figure:vn},"needs-input":{level:Pa,figure:vn}};function oK(e){const t=n=>({level:j$(e(S$[n])),figure:k$(n,e(od[n]))});return{done:t("done"),"needs-input":t("needs-input")}}function iK(e,t){return(e??Ex)[t]??Ex[t]}const lK={Stop:"done",Notification:"needs-input"};function cK(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:$t(lK,n)??null}const uK=6,dK="ccdeck-tabs";function hK(e){return e>=uK}function fK(e,t,n){const r=s=>{const i=s.data;(i==null?void 0:i.kind)==="who"&&i.from!==t&&e.postMessage({kind:"here",from:t,to:i.from,streaming:n()})};return e.addEventListener("message",r),{ask(s,i=(l,u)=>setTimeout(l,u)){return new Promise(l=>{const u=new Set,d=f=>{const h=f.data;(h==null?void 0:h.kind)==="here"&&h.to===t&&h.streaming&&u.add(h.from)};e.addEventListener("message",d),e.postMessage({kind:"who",from:t}),i(()=>{e.removeEventListener("message",d),l(u.size)},s)})},leave(){var s;e.removeEventListener("message",r),(s=e.close)==null||s.call(e)}}}function pK({stateRef:e,rerender:t,pauseGate:n,chimesRef:r,desktopUpdateRef:s}){const[i,l]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState(!1),m=v.useRef(!0),[g,w]=v.useState(null);return v.useEffect(()=>{const b=new EventSource("/events"),x=RG(t,{now:()=>Date.now(),setTimeout:(_,E)=>window.setTimeout(_,E),clearTimeout:_=>window.clearTimeout(_)});let k=!1;const j=typeof BroadcastChannel=="function"?fK(new BroadcastChannel(dK),Math.random().toString(36).slice(2),()=>k):null,S=window.setInterval(()=>{k||!j||j.ask(600).then(_=>{k||d(hK(_))})},3e3);return b.addEventListener("open",()=>{l(!0),h(!0)}),b.addEventListener("error",()=>{l(!1),w(null)}),b.addEventListener("open",()=>{k=!0,d(!1)}),b.addEventListener("error",()=>{k=!1}),b.addEventListener("replay-end",()=>{m.current=!1,x.flush(),w(Date.now())}),b.addEventListener("desktop-update",_=>s.current(_.data)),b.addEventListener("hook",_=>{var E;try{const T=JSON.parse(_.data);if(!n.accept(T))return;e.current=$A(e.current,T);const R=T.replay===!0||m.current||Date.now()-T.receivedAt>3e4;R?x.replay():x.live();const A=cK(T,R);A&&((E=r.current)==null||E.play(A))}catch{}}),()=>{b.close(),x.cancel(),window.clearInterval(S),j==null||j.leave()}},[t]),{live:i,tabCapped:u,everConnected:f,liveSince:g}}const mK=200,gK=5*6e4,yK=6,wK=2*6e4;function xu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function vK(e,t){let n=!1;for(const s of e)if(!t.has(s)){n=!0;break}if(!n)return e;const r=new Set;for(const s of e)t.has(s)&&r.add(s);return r}function xK(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(d0(n.id));return t}function bK(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(d0(n.id));return t}function kK(e,t){let n=eq(e,t,_N);tq(e,t,_N)&&(n=!0);const r=[],s=i=>{r.push(i)};return Z6(e,t,mK,gK,s)&&(n=!0),J6(e,t,yK,wK,s)&&(n=!0),{changed:n,forgotten:r}}function NK(e,t){const[n,r]=v.useState(()=>new Set),[s,i]=v.useState(null),l=v.useCallback((f,h,m=!h)=>{r(g=>{if(!h)return new Set([f]);const w=new Set(g);return w.has(f)?w.delete(f):w.add(f),w}),i(g=>h&&g===f?g:f),!h&&m&&t(!0)},[]),u=v.useCallback(()=>{r(new Set),i(null)},[]),d=v.useCallback(()=>{r(f=>vK(f,e.current.agents)),i(f=>f!=null&&!e.current.agents.has(f)?null:f)},[e]);return{selectedIds:n,primarySelectedId:s,selectAgent:l,clearSelection:u,pruneSelectionToBoard:d}}function jK({stateRef:e,rerender:t,pruneSelectionToBoard:n,setContextFor:r,setSummaryFor:s}){const[i,l]=v.useState(Date.now());return v.useEffect(()=>{const u=setInterval(()=>{const d=Date.now();l(d);const{changed:f,forgotten:h}=kK(e.current,d);h.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:h})}).catch(()=>{}),n(),r(m=>m!=null&&!e.current.agents.has(m)?null:m),s(m=>m!=null&&!e.current.agents.has(m)?null:m),f&&t()},250);return()=>clearInterval(u)},[t]),i}function $0(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 fp,Zj;function SK(){if(Zj)return fp;Zj=1;function e(){this.__data__=[],this.size=0}return fp=e,fp}var pp,Jj;function ci(){if(Jj)return pp;Jj=1;function e(t,n){return t===n||t!==t&&n!==n}return pp=e,pp}var mp,Qj;function Dd(){if(Qj)return mp;Qj=1;var e=ci();function t(n,r){for(var s=n.length;s--;)if(e(n[s][0],r))return s;return-1}return mp=t,mp}var gp,eS;function _K(){if(eS)return gp;eS=1;var e=Dd(),t=Array.prototype,n=t.splice;function r(s){var i=this.__data__,l=e(i,s);if(l<0)return!1;var u=i.length-1;return l==u?i.pop():n.call(i,l,1),--this.size,!0}return gp=r,gp}var yp,tS;function EK(){if(tS)return yp;tS=1;var e=Dd();function t(n){var r=this.__data__,s=e(r,n);return s<0?void 0:r[s][1]}return yp=t,yp}var wp,nS;function CK(){if(nS)return wp;nS=1;var e=Dd();function t(n){return e(this.__data__,n)>-1}return wp=t,wp}var vp,rS;function TK(){if(rS)return vp;rS=1;var e=Dd();function t(n,r){var s=this.__data__,i=e(s,n);return i<0?(++this.size,s.push([n,r])):s[i][1]=r,this}return vp=t,vp}var xp,sS;function Fd(){if(sS)return xp;sS=1;var e=SK(),t=_K(),n=EK(),r=CK(),s=TK();function i(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=s,xp=i,xp}var bp,aS;function RK(){if(aS)return bp;aS=1;var e=Fd();function t(){this.__data__=new e,this.size=0}return bp=t,bp}var kp,oS;function AK(){if(oS)return kp;oS=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return kp=e,kp}var Np,iS;function MK(){if(iS)return Np;iS=1;function e(t){return this.__data__.get(t)}return Np=e,Np}var jp,lS;function $K(){if(lS)return jp;lS=1;function e(t){return this.__data__.has(t)}return jp=e,jp}var Sp,cS;function _$(){if(cS)return Sp;cS=1;var e=typeof tu=="object"&&tu&&tu.Object===Object&&tu;return Sp=e,Sp}var _p,uS;function cr(){if(uS)return _p;uS=1;var e=_$(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return _p=n,_p}var Ep,dS;function ui(){if(dS)return Ep;dS=1;var e=cr(),t=e.Symbol;return Ep=t,Ep}var Cp,hS;function IK(){if(hS)return Cp;hS=1;var e=ui(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,s=e?e.toStringTag:void 0;function i(l){var u=n.call(l,s),d=l[s];try{l[s]=void 0;var f=!0}catch{}var h=r.call(l);return f&&(u?l[s]=d:delete l[s]),h}return Cp=i,Cp}var Tp,fS;function OK(){if(fS)return Tp;fS=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Tp=n,Tp}var Rp,pS;function Ba(){if(pS)return Rp;pS=1;var e=ui(),t=IK(),n=OK(),r="[object Null]",s="[object Undefined]",i=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?s:r:i&&i in Object(u)?t(u):n(u)}return Rp=l,Rp}var Ap,mS;function Dn(){if(mS)return Ap;mS=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Ap=e,Ap}var Mp,gS;function Wl(){if(gS)return Mp;gS=1;var e=Ba(),t=Dn(),n="[object AsyncFunction]",r="[object Function]",s="[object GeneratorFunction]",i="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==r||d==s||d==n||d==i}return Mp=l,Mp}var $p,yS;function LK(){if(yS)return $p;yS=1;var e=cr(),t=e["__core-js_shared__"];return $p=t,$p}var Ip,wS;function PK(){if(wS)return Ip;wS=1;var e=LK(),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 Ip=n,Ip}var Op,vS;function E$(){if(vS)return Op;vS=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 Op=n,Op}var Lp,xS;function DK(){if(xS)return Lp;xS=1;var e=Wl(),t=PK(),n=Dn(),r=E$(),s=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,h=RegExp("^"+d.call(f).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(g){if(!n(g)||t(g))return!1;var w=e(g)?h:i;return w.test(r(g))}return Lp=m,Lp}var Pp,bS;function FK(){if(bS)return Pp;bS=1;function e(t,n){return t==null?void 0:t[n]}return Pp=e,Pp}var Dp,kS;function Ua(){if(kS)return Dp;kS=1;var e=DK(),t=FK();function n(r,s){var i=t(r,s);return e(i)?i:void 0}return Dp=n,Dp}var Fp,NS;function I0(){if(NS)return Fp;NS=1;var e=Ua(),t=cr(),n=e(t,"Map");return Fp=n,Fp}var qp,jS;function qd(){if(jS)return qp;jS=1;var e=Ua(),t=e(Object,"create");return qp=t,qp}var Bp,SS;function qK(){if(SS)return Bp;SS=1;var e=qd();function t(){this.__data__=e?e(null):{},this.size=0}return Bp=t,Bp}var Up,_S;function BK(){if(_S)return Up;_S=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Up=e,Up}var zp,ES;function UK(){if(ES)return zp;ES=1;var e=qd(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function s(i){var l=this.__data__;if(e){var u=l[i];return u===t?void 0:u}return r.call(l,i)?l[i]:void 0}return zp=s,zp}var Hp,CS;function zK(){if(CS)return Hp;CS=1;var e=qd(),t=Object.prototype,n=t.hasOwnProperty;function r(s){var i=this.__data__;return e?i[s]!==void 0:n.call(i,s)}return Hp=r,Hp}var Wp,TS;function HK(){if(TS)return Wp;TS=1;var e=qd(),t="__lodash_hash_undefined__";function n(r,s){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&s===void 0?t:s,this}return Wp=n,Wp}var Vp,RS;function WK(){if(RS)return Vp;RS=1;var e=qK(),t=BK(),n=UK(),r=zK(),s=HK();function i(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=s,Vp=i,Vp}var Gp,AS;function VK(){if(AS)return Gp;AS=1;var e=WK(),t=Fd(),n=I0();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Gp=r,Gp}var Kp,MS;function GK(){if(MS)return Kp;MS=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Kp=e,Kp}var Yp,$S;function Bd(){if($S)return Yp;$S=1;var e=GK();function t(n,r){var s=n.__data__;return e(r)?s[typeof r=="string"?"string":"hash"]:s.map}return Yp=t,Yp}var Xp,IS;function KK(){if(IS)return Xp;IS=1;var e=Bd();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Xp=t,Xp}var Zp,OS;function YK(){if(OS)return Zp;OS=1;var e=Bd();function t(n){return e(this,n).get(n)}return Zp=t,Zp}var Jp,LS;function XK(){if(LS)return Jp;LS=1;var e=Bd();function t(n){return e(this,n).has(n)}return Jp=t,Jp}var Qp,PS;function ZK(){if(PS)return Qp;PS=1;var e=Bd();function t(n,r){var s=e(this,n),i=s.size;return s.set(n,r),this.size+=s.size==i?0:1,this}return Qp=t,Qp}var em,DS;function O0(){if(DS)return em;DS=1;var e=VK(),t=KK(),n=YK(),r=XK(),s=ZK();function i(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=s,em=i,em}var tm,FS;function JK(){if(FS)return tm;FS=1;var e=Fd(),t=I0(),n=O0(),r=200;function s(i,l){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.length<r-1)return d.push([i,l]),this.size=++u.size,this;u=this.__data__=new n(d)}return u.set(i,l),this.size=u.size,this}return tm=s,tm}var nm,qS;function Ud(){if(qS)return nm;qS=1;var e=Fd(),t=RK(),n=AK(),r=MK(),s=$K(),i=JK();function l(u){var d=this.__data__=new e(u);this.size=d.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=s,l.prototype.set=i,nm=l,nm}var rm,BS;function L0(){if(BS)return rm;BS=1;function e(t,n){for(var r=-1,s=t==null?0:t.length;++r<s&&n(t[r],r,t)!==!1;);return t}return rm=e,rm}var sm,US;function C$(){if(US)return sm;US=1;var e=Ua(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return sm=t,sm}var am,zS;function zd(){if(zS)return am;zS=1;var e=C$();function t(n,r,s){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:s,writable:!0}):n[r]=s}return am=t,am}var om,HS;function Hd(){if(HS)return om;HS=1;var e=zd(),t=ci(),n=Object.prototype,r=n.hasOwnProperty;function s(i,l,u){var d=i[l];(!(r.call(i,l)&&t(d,u))||u===void 0&&!(l in i))&&e(i,l,u)}return om=s,om}var im,WS;function Vl(){if(WS)return im;WS=1;var e=Hd(),t=zd();function n(r,s,i,l){var u=!i;i||(i={});for(var d=-1,f=s.length;++d<f;){var h=s[d],m=l?l(i[h],r[h],h,i,r):void 0;m===void 0&&(m=r[h]),u?t(i,h,m):e(i,h,m)}return i}return im=n,im}var lm,VS;function QK(){if(VS)return lm;VS=1;function e(t,n){for(var r=-1,s=Array(t);++r<t;)s[r]=n(r);return s}return lm=e,lm}var cm,GS;function Mr(){if(GS)return cm;GS=1;function e(t){return t!=null&&typeof t=="object"}return cm=e,cm}var um,KS;function eY(){if(KS)return um;KS=1;var e=Ba(),t=Mr(),n="[object Arguments]";function r(s){return t(s)&&e(s)==n}return um=r,um}var dm,YS;function Gl(){if(YS)return dm;YS=1;var e=eY(),t=Mr(),n=Object.prototype,r=n.hasOwnProperty,s=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(l){return t(l)&&r.call(l,"callee")&&!s.call(l,"callee")};return dm=i,dm}var hm,XS;function xt(){if(XS)return hm;XS=1;var e=Array.isArray;return hm=e,hm}var al={exports:{}},fm,ZS;function tY(){if(ZS)return fm;ZS=1;function e(){return!1}return fm=e,fm}al.exports;var JS;function di(){return JS||(JS=1,(function(e,t){var n=cr(),r=tY(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===s,u=l?n.Buffer:void 0,d=u?u.isBuffer:void 0,f=d||r;e.exports=f})(al,al.exports)),al.exports}var pm,QS;function Wd(){if(QS)return pm;QS=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,s){var i=typeof r;return s=s??e,!!s&&(i=="number"||i!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<s}return pm=n,pm}var mm,e_;function P0(){if(e_)return mm;e_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return mm=t,mm}var gm,t_;function nY(){if(t_)return gm;t_=1;var e=Ba(),t=P0(),n=Mr(),r="[object Arguments]",s="[object Array]",i="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",f="[object Map]",h="[object Number]",m="[object Object]",g="[object RegExp]",w="[object Set]",b="[object String]",x="[object WeakMap]",k="[object ArrayBuffer]",j="[object DataView]",S="[object Float32Array]",_="[object Float64Array]",E="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",A="[object Uint8Array]",B="[object Uint8ClampedArray]",$="[object Uint16Array]",I="[object Uint32Array]",D={};D[S]=D[_]=D[E]=D[T]=D[R]=D[A]=D[B]=D[$]=D[I]=!0,D[r]=D[s]=D[k]=D[i]=D[j]=D[l]=D[u]=D[d]=D[f]=D[h]=D[m]=D[g]=D[w]=D[b]=D[x]=!1;function F(W){return n(W)&&t(W.length)&&!!D[e(W)]}return gm=F,gm}var ym,n_;function Vd(){if(n_)return ym;n_=1;function e(t){return function(n){return t(n)}}return ym=e,ym}var ol={exports:{}};ol.exports;var r_;function D0(){return r_||(r_=1,(function(e,t){var n=_$(),r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,i=s&&s.exports===r,l=i&&n.process,u=(function(){try{var d=s&&s.require&&s.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(ol,ol.exports)),ol.exports}var wm,s_;function Kl(){if(s_)return wm;s_=1;var e=nY(),t=Vd(),n=D0(),r=n&&n.isTypedArray,s=r?t(r):e;return wm=s,wm}var vm,a_;function T$(){if(a_)return vm;a_=1;var e=QK(),t=Gl(),n=xt(),r=di(),s=Wd(),i=Kl(),l=Object.prototype,u=l.hasOwnProperty;function d(f,h){var m=n(f),g=!m&&t(f),w=!m&&!g&&r(f),b=!m&&!g&&!w&&i(f),x=m||g||w||b,k=x?e(f.length,String):[],j=k.length;for(var S in f)(h||u.call(f,S))&&!(x&&(S=="length"||w&&(S=="offset"||S=="parent")||b&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||s(S,j)))&&k.push(S);return k}return vm=d,vm}var xm,o_;function Gd(){if(o_)return xm;o_=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,s=typeof r=="function"&&r.prototype||e;return n===s}return xm=t,xm}var bm,i_;function R$(){if(i_)return bm;i_=1;function e(t,n){return function(r){return t(n(r))}}return bm=e,bm}var km,l_;function rY(){if(l_)return km;l_=1;var e=R$(),t=e(Object.keys,Object);return km=t,km}var Nm,c_;function F0(){if(c_)return Nm;c_=1;var e=Gd(),t=rY(),n=Object.prototype,r=n.hasOwnProperty;function s(i){if(!e(i))return t(i);var l=[];for(var u in Object(i))r.call(i,u)&&u!="constructor"&&l.push(u);return l}return Nm=s,Nm}var jm,u_;function ts(){if(u_)return jm;u_=1;var e=Wl(),t=P0();function n(r){return r!=null&&t(r.length)&&!e(r)}return jm=n,jm}var Sm,d_;function Ks(){if(d_)return Sm;d_=1;var e=T$(),t=F0(),n=ts();function r(s){return n(s)?e(s):t(s)}return Sm=r,Sm}var _m,h_;function sY(){if(h_)return _m;h_=1;var e=Vl(),t=Ks();function n(r,s){return r&&e(s,t(s),r)}return _m=n,_m}var Em,f_;function aY(){if(f_)return Em;f_=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return Em=e,Em}var Cm,p_;function oY(){if(p_)return Cm;p_=1;var e=Dn(),t=Gd(),n=aY(),r=Object.prototype,s=r.hasOwnProperty;function i(l){if(!e(l))return n(l);var u=t(l),d=[];for(var f in l)f=="constructor"&&(u||!s.call(l,f))||d.push(f);return d}return Cm=i,Cm}var Tm,m_;function za(){if(m_)return Tm;m_=1;var e=T$(),t=oY(),n=ts();function r(s){return n(s)?e(s,!0):t(s)}return Tm=r,Tm}var Rm,g_;function iY(){if(g_)return Rm;g_=1;var e=Vl(),t=za();function n(r,s){return r&&e(s,t(s),r)}return Rm=n,Rm}var il={exports:{}};il.exports;var y_;function A$(){return y_||(y_=1,(function(e,t){var n=cr(),r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,i=s&&s.exports===r,l=i?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function d(f,h){if(h)return f.slice();var m=f.length,g=u?u(m):new f.constructor(m);return f.copy(g),g}e.exports=d})(il,il.exports)),il.exports}var Am,w_;function M$(){if(w_)return Am;w_=1;function e(t,n){var r=-1,s=t.length;for(n||(n=Array(s));++r<s;)n[r]=t[r];return n}return Am=e,Am}var Mm,v_;function $$(){if(v_)return Mm;v_=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,i=0,l=[];++r<s;){var u=t[r];n(u,r,t)&&(l[i++]=u)}return l}return Mm=e,Mm}var $m,x_;function I$(){if(x_)return $m;x_=1;function e(){return[]}return $m=e,$m}var Im,b_;function q0(){if(b_)return Im;b_=1;var e=$$(),t=I$(),n=Object.prototype,r=n.propertyIsEnumerable,s=Object.getOwnPropertySymbols,i=s?function(l){return l==null?[]:(l=Object(l),e(s(l),function(u){return r.call(l,u)}))}:t;return Im=i,Im}var Om,k_;function lY(){if(k_)return Om;k_=1;var e=Vl(),t=q0();function n(r,s){return e(r,t(r),s)}return Om=n,Om}var Lm,N_;function B0(){if(N_)return Lm;N_=1;function e(t,n){for(var r=-1,s=n.length,i=t.length;++r<s;)t[i+r]=n[r];return t}return Lm=e,Lm}var Pm,j_;function Kd(){if(j_)return Pm;j_=1;var e=R$(),t=e(Object.getPrototypeOf,Object);return Pm=t,Pm}var Dm,S_;function O$(){if(S_)return Dm;S_=1;var e=B0(),t=Kd(),n=q0(),r=I$(),s=Object.getOwnPropertySymbols,i=s?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:r;return Dm=i,Dm}var Fm,__;function cY(){if(__)return Fm;__=1;var e=Vl(),t=O$();function n(r,s){return e(r,t(r),s)}return Fm=n,Fm}var qm,E_;function L$(){if(E_)return qm;E_=1;var e=B0(),t=xt();function n(r,s,i){var l=s(r);return t(r)?l:e(l,i(r))}return qm=n,qm}var Bm,C_;function P$(){if(C_)return Bm;C_=1;var e=L$(),t=q0(),n=Ks();function r(s){return e(s,n,t)}return Bm=r,Bm}var Um,T_;function uY(){if(T_)return Um;T_=1;var e=L$(),t=O$(),n=za();function r(s){return e(s,n,t)}return Um=r,Um}var zm,R_;function dY(){if(R_)return zm;R_=1;var e=Ua(),t=cr(),n=e(t,"DataView");return zm=n,zm}var Hm,A_;function hY(){if(A_)return Hm;A_=1;var e=Ua(),t=cr(),n=e(t,"Promise");return Hm=n,Hm}var Wm,M_;function D$(){if(M_)return Wm;M_=1;var e=Ua(),t=cr(),n=e(t,"Set");return Wm=n,Wm}var Vm,$_;function fY(){if($_)return Vm;$_=1;var e=Ua(),t=cr(),n=e(t,"WeakMap");return Vm=n,Vm}var Gm,I_;function hi(){if(I_)return Gm;I_=1;var e=dY(),t=I0(),n=hY(),r=D$(),s=fY(),i=Ba(),l=E$(),u="[object Map]",d="[object Object]",f="[object Promise]",h="[object Set]",m="[object WeakMap]",g="[object DataView]",w=l(e),b=l(t),x=l(n),k=l(r),j=l(s),S=i;return(e&&S(new e(new ArrayBuffer(1)))!=g||t&&S(new t)!=u||n&&S(n.resolve())!=f||r&&S(new r)!=h||s&&S(new s)!=m)&&(S=function(_){var E=i(_),T=E==d?_.constructor:void 0,R=T?l(T):"";if(R)switch(R){case w:return g;case b:return u;case x:return f;case k:return h;case j:return m}return E}),Gm=S,Gm}var Km,O_;function pY(){if(O_)return Km;O_=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var s=r.length,i=new r.constructor(s);return s&&typeof r[0]=="string"&&t.call(r,"index")&&(i.index=r.index,i.input=r.input),i}return Km=n,Km}var Ym,L_;function F$(){if(L_)return Ym;L_=1;var e=cr(),t=e.Uint8Array;return Ym=t,Ym}var Xm,P_;function U0(){if(P_)return Xm;P_=1;var e=F$();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return Xm=t,Xm}var Zm,D_;function mY(){if(D_)return Zm;D_=1;var e=U0();function t(n,r){var s=r?e(n.buffer):n.buffer;return new n.constructor(s,n.byteOffset,n.byteLength)}return Zm=t,Zm}var Jm,F_;function gY(){if(F_)return Jm;F_=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return Jm=t,Jm}var Qm,q_;function yY(){if(q_)return Qm;q_=1;var e=ui(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(s){return n?Object(n.call(s)):{}}return Qm=r,Qm}var eg,B_;function q$(){if(B_)return eg;B_=1;var e=U0();function t(n,r){var s=r?e(n.buffer):n.buffer;return new n.constructor(s,n.byteOffset,n.length)}return eg=t,eg}var tg,U_;function wY(){if(U_)return tg;U_=1;var e=U0(),t=mY(),n=gY(),r=yY(),s=q$(),i="[object Boolean]",l="[object Date]",u="[object Map]",d="[object Number]",f="[object RegExp]",h="[object Set]",m="[object String]",g="[object Symbol]",w="[object ArrayBuffer]",b="[object DataView]",x="[object Float32Array]",k="[object Float64Array]",j="[object Int8Array]",S="[object Int16Array]",_="[object Int32Array]",E="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",A="[object Uint32Array]";function B($,I,D){var F=$.constructor;switch(I){case w:return e($);case i:case l:return new F(+$);case b:return t($,D);case x:case k:case j:case S:case _:case E:case T:case R:case A:return s($,D);case u:return new F;case d:case m:return new F($);case f:return n($);case h:return new F;case g:return r($)}}return tg=B,tg}var ng,z_;function B$(){if(z_)return ng;z_=1;var e=Dn(),t=Object.create,n=(function(){function r(){}return function(s){if(!e(s))return{};if(t)return t(s);r.prototype=s;var i=new r;return r.prototype=void 0,i}})();return ng=n,ng}var rg,H_;function U$(){if(H_)return rg;H_=1;var e=B$(),t=Kd(),n=Gd();function r(s){return typeof s.constructor=="function"&&!n(s)?e(t(s)):{}}return rg=r,rg}var sg,W_;function vY(){if(W_)return sg;W_=1;var e=hi(),t=Mr(),n="[object Map]";function r(s){return t(s)&&e(s)==n}return sg=r,sg}var ag,V_;function xY(){if(V_)return ag;V_=1;var e=vY(),t=Vd(),n=D0(),r=n&&n.isMap,s=r?t(r):e;return ag=s,ag}var og,G_;function bY(){if(G_)return og;G_=1;var e=hi(),t=Mr(),n="[object Set]";function r(s){return t(s)&&e(s)==n}return og=r,og}var ig,K_;function kY(){if(K_)return ig;K_=1;var e=bY(),t=Vd(),n=D0(),r=n&&n.isSet,s=r?t(r):e;return ig=s,ig}var lg,Y_;function z$(){if(Y_)return lg;Y_=1;var e=Ud(),t=L0(),n=Hd(),r=sY(),s=iY(),i=A$(),l=M$(),u=lY(),d=cY(),f=P$(),h=uY(),m=hi(),g=pY(),w=wY(),b=U$(),x=xt(),k=di(),j=xY(),S=Dn(),_=kY(),E=Ks(),T=za(),R=1,A=2,B=4,$="[object Arguments]",I="[object Array]",D="[object Boolean]",F="[object Date]",W="[object Error]",M="[object Function]",O="[object GeneratorFunction]",L="[object Map]",K="[object Number]",Z="[object Object]",q="[object RegExp]",H="[object Set]",P="[object String]",Y="[object Symbol]",G="[object WeakMap]",z="[object ArrayBuffer]",X="[object DataView]",V="[object Float32Array]",J="[object Float64Array]",ee="[object Int8Array]",re="[object Int16Array]",oe="[object Int32Array]",fe="[object Uint8Array]",Ne="[object Uint8ClampedArray]",we="[object Uint16Array]",ye="[object Uint32Array]",ve={};ve[$]=ve[I]=ve[z]=ve[X]=ve[D]=ve[F]=ve[V]=ve[J]=ve[ee]=ve[re]=ve[oe]=ve[L]=ve[K]=ve[Z]=ve[q]=ve[H]=ve[P]=ve[Y]=ve[fe]=ve[Ne]=ve[we]=ve[ye]=!0,ve[W]=ve[M]=ve[G]=!1;function Ie(xe,ue,se,be,Te,Le){var $e,Oe=ue&R,Xe=ue&A,Ge=ue&B;if(se&&($e=Te?se(xe,be,Te,Le):se(xe)),$e!==void 0)return $e;if(!S(xe))return xe;var Ze=x(xe);if(Ze){if($e=g(xe),!Oe)return l(xe,$e)}else{var Ve=m(xe),Ot=Ve==M||Ve==O;if(k(xe))return i(xe,Oe);if(Ve==Z||Ve==$||Ot&&!Te){if($e=Xe||Ot?{}:b(xe),!Oe)return Xe?d(xe,s($e,xe)):u(xe,r($e,xe))}else{if(!ve[Ve])return Te?xe:{};$e=w(xe,Ve,Oe)}}Le||(Le=new e);var mt=Le.get(xe);if(mt)return mt;Le.set(xe,$e),_(xe)?xe.forEach(function(Qe){$e.add(Ie(Qe,ue,se,Qe,xe,Le))}):j(xe)&&xe.forEach(function(Qe,ot){$e.set(ot,Ie(Qe,ue,se,ot,xe,Le))});var Pe=Ge?Xe?h:f:Xe?T:E,at=Ze?void 0:Pe(xe);return t(at||xe,function(Qe,ot){at&&(ot=Qe,Qe=xe[ot]),n($e,ot,Ie(Qe,ue,se,ot,xe,Le))}),$e}return lg=Ie,lg}var cg,X_;function NY(){if(X_)return cg;X_=1;var e=z$(),t=4;function n(r){return e(r,t)}return cg=n,cg}var ug,Z_;function z0(){if(Z_)return ug;Z_=1;function e(t){return function(){return t}}return ug=e,ug}var dg,J_;function jY(){if(J_)return dg;J_=1;function e(t){return function(n,r,s){for(var i=-1,l=Object(n),u=s(n),d=u.length;d--;){var f=u[t?d:++i];if(r(l[f],f,l)===!1)break}return n}}return dg=e,dg}var hg,Q_;function H0(){if(Q_)return hg;Q_=1;var e=jY(),t=e();return hg=t,hg}var fg,eE;function W0(){if(eE)return fg;eE=1;var e=H0(),t=Ks();function n(r,s){return r&&e(r,s,t)}return fg=n,fg}var pg,tE;function SY(){if(tE)return pg;tE=1;var e=ts();function t(n,r){return function(s,i){if(s==null)return s;if(!e(s))return n(s,i);for(var l=s.length,u=r?l:-1,d=Object(s);(r?u--:++u<l)&&i(d[u],u,d)!==!1;);return s}}return pg=t,pg}var mg,nE;function Yd(){if(nE)return mg;nE=1;var e=W0(),t=SY(),n=t(e);return mg=n,mg}var gg,rE;function Ha(){if(rE)return gg;rE=1;function e(t){return t}return gg=e,gg}var yg,sE;function H$(){if(sE)return yg;sE=1;var e=Ha();function t(n){return typeof n=="function"?n:e}return yg=t,yg}var wg,aE;function W$(){if(aE)return wg;aE=1;var e=L0(),t=Yd(),n=H$(),r=xt();function s(i,l){var u=r(i)?e:t;return u(i,n(l))}return wg=s,wg}var vg,oE;function V$(){return oE||(oE=1,vg=W$()),vg}var xg,iE;function _Y(){if(iE)return xg;iE=1;var e=Yd();function t(n,r){var s=[];return e(n,function(i,l,u){r(i,l,u)&&s.push(i)}),s}return xg=t,xg}var bg,lE;function EY(){if(lE)return bg;lE=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return bg=t,bg}var kg,cE;function CY(){if(cE)return kg;cE=1;function e(t){return this.__data__.has(t)}return kg=e,kg}var Ng,uE;function G$(){if(uE)return Ng;uE=1;var e=O0(),t=EY(),n=CY();function r(s){var i=-1,l=s==null?0:s.length;for(this.__data__=new e;++i<l;)this.add(s[i])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,Ng=r,Ng}var jg,dE;function TY(){if(dE)return jg;dE=1;function e(t,n){for(var r=-1,s=t==null?0:t.length;++r<s;)if(n(t[r],r,t))return!0;return!1}return jg=e,jg}var Sg,hE;function K$(){if(hE)return Sg;hE=1;function e(t,n){return t.has(n)}return Sg=e,Sg}var _g,fE;function Y$(){if(fE)return _g;fE=1;var e=G$(),t=TY(),n=K$(),r=1,s=2;function i(l,u,d,f,h,m){var g=d&r,w=l.length,b=u.length;if(w!=b&&!(g&&b>w))return!1;var x=m.get(l),k=m.get(u);if(x&&k)return x==u&&k==l;var j=-1,S=!0,_=d&s?new e:void 0;for(m.set(l,u),m.set(u,l);++j<w;){var E=l[j],T=u[j];if(f)var R=g?f(T,E,j,u,l,m):f(E,T,j,l,u,m);if(R!==void 0){if(R)continue;S=!1;break}if(_){if(!t(u,function(A,B){if(!n(_,B)&&(E===A||h(E,A,d,f,m)))return _.push(B)})){S=!1;break}}else if(!(E===T||h(E,T,d,f,m))){S=!1;break}}return m.delete(l),m.delete(u),S}return _g=i,_g}var Eg,pE;function RY(){if(pE)return Eg;pE=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s,i){r[++n]=[i,s]}),r}return Eg=e,Eg}var Cg,mE;function V0(){if(mE)return Cg;mE=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s){r[++n]=s}),r}return Cg=e,Cg}var Tg,gE;function AY(){if(gE)return Tg;gE=1;var e=ui(),t=F$(),n=ci(),r=Y$(),s=RY(),i=V0(),l=1,u=2,d="[object Boolean]",f="[object Date]",h="[object Error]",m="[object Map]",g="[object Number]",w="[object RegExp]",b="[object Set]",x="[object String]",k="[object Symbol]",j="[object ArrayBuffer]",S="[object DataView]",_=e?e.prototype:void 0,E=_?_.valueOf:void 0;function T(R,A,B,$,I,D,F){switch(B){case S:if(R.byteLength!=A.byteLength||R.byteOffset!=A.byteOffset)return!1;R=R.buffer,A=A.buffer;case j:return!(R.byteLength!=A.byteLength||!D(new t(R),new t(A)));case d:case f:case g:return n(+R,+A);case h:return R.name==A.name&&R.message==A.message;case w:case x:return R==A+"";case m:var W=s;case b:var M=$&l;if(W||(W=i),R.size!=A.size&&!M)return!1;var O=F.get(R);if(O)return O==A;$|=u,F.set(R,A);var L=r(W(R),W(A),$,I,D,F);return F.delete(R),L;case k:if(E)return E.call(R)==E.call(A)}return!1}return Tg=T,Tg}var Rg,yE;function MY(){if(yE)return Rg;yE=1;var e=P$(),t=1,n=Object.prototype,r=n.hasOwnProperty;function s(i,l,u,d,f,h){var m=u&t,g=e(i),w=g.length,b=e(l),x=b.length;if(w!=x&&!m)return!1;for(var k=w;k--;){var j=g[k];if(!(m?j in l:r.call(l,j)))return!1}var S=h.get(i),_=h.get(l);if(S&&_)return S==l&&_==i;var E=!0;h.set(i,l),h.set(l,i);for(var T=m;++k<w;){j=g[k];var R=i[j],A=l[j];if(d)var B=m?d(A,R,j,l,i,h):d(R,A,j,i,l,h);if(!(B===void 0?R===A||f(R,A,u,d,h):B)){E=!1;break}T||(T=j=="constructor")}if(E&&!T){var $=i.constructor,I=l.constructor;$!=I&&"constructor"in i&&"constructor"in l&&!(typeof $=="function"&&$ instanceof $&&typeof I=="function"&&I instanceof I)&&(E=!1)}return h.delete(i),h.delete(l),E}return Rg=s,Rg}var Ag,wE;function $Y(){if(wE)return Ag;wE=1;var e=Ud(),t=Y$(),n=AY(),r=MY(),s=hi(),i=xt(),l=di(),u=Kl(),d=1,f="[object Arguments]",h="[object Array]",m="[object Object]",g=Object.prototype,w=g.hasOwnProperty;function b(x,k,j,S,_,E){var T=i(x),R=i(k),A=T?h:s(x),B=R?h:s(k);A=A==f?m:A,B=B==f?m:B;var $=A==m,I=B==m,D=A==B;if(D&&l(x)){if(!l(k))return!1;T=!0,$=!1}if(D&&!$)return E||(E=new e),T||u(x)?t(x,k,j,S,_,E):n(x,k,A,j,S,_,E);if(!(j&d)){var F=$&&w.call(x,"__wrapped__"),W=I&&w.call(k,"__wrapped__");if(F||W){var M=F?x.value():x,O=W?k.value():k;return E||(E=new e),_(M,O,j,S,E)}}return D?(E||(E=new e),r(x,k,j,S,_,E)):!1}return Ag=b,Ag}var Mg,vE;function X$(){if(vE)return Mg;vE=1;var e=$Y(),t=Mr();function n(r,s,i,l,u){return r===s?!0:r==null||s==null||!t(r)&&!t(s)?r!==r&&s!==s:e(r,s,i,l,n,u)}return Mg=n,Mg}var $g,xE;function IY(){if(xE)return $g;xE=1;var e=Ud(),t=X$(),n=1,r=2;function s(i,l,u,d){var f=u.length,h=f,m=!d;if(i==null)return!h;for(i=Object(i);f--;){var g=u[f];if(m&&g[2]?g[1]!==i[g[0]]:!(g[0]in i))return!1}for(;++f<h;){g=u[f];var w=g[0],b=i[w],x=g[1];if(m&&g[2]){if(b===void 0&&!(w in i))return!1}else{var k=new e;if(d)var j=d(b,x,w,i,l,k);if(!(j===void 0?t(x,b,n|r,d,k):j))return!1}}return!0}return $g=s,$g}var Ig,bE;function Z$(){if(bE)return Ig;bE=1;var e=Dn();function t(n){return n===n&&!e(n)}return Ig=t,Ig}var Og,kE;function OY(){if(kE)return Og;kE=1;var e=Z$(),t=Ks();function n(r){for(var s=t(r),i=s.length;i--;){var l=s[i],u=r[l];s[i]=[l,u,e(u)]}return s}return Og=n,Og}var Lg,NE;function J$(){if(NE)return Lg;NE=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return Lg=e,Lg}var Pg,jE;function LY(){if(jE)return Pg;jE=1;var e=IY(),t=OY(),n=J$();function r(s){var i=t(s);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(l){return l===s||e(l,s,i)}}return Pg=r,Pg}var Dg,SE;function fi(){if(SE)return Dg;SE=1;var e=Ba(),t=Mr(),n="[object Symbol]";function r(s){return typeof s=="symbol"||t(s)&&e(s)==n}return Dg=r,Dg}var Fg,_E;function G0(){if(_E)return Fg;_E=1;var e=xt(),t=fi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function s(i,l){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||l!=null&&i in Object(l)}return Fg=s,Fg}var qg,EE;function PY(){if(EE)return qg;EE=1;var e=O0(),t="Expected a function";function n(r,s){if(typeof r!="function"||s!=null&&typeof s!="function")throw new TypeError(t);var i=function(){var l=arguments,u=s?s.apply(this,l):l[0],d=i.cache;if(d.has(u))return d.get(u);var f=r.apply(this,l);return i.cache=d.set(u,f)||d,f};return i.cache=new(n.Cache||e),i}return n.Cache=e,qg=n,qg}var Bg,CE;function DY(){if(CE)return Bg;CE=1;var e=PY(),t=500;function n(r){var s=e(r,function(l){return i.size===t&&i.clear(),l}),i=s.cache;return s}return Bg=n,Bg}var Ug,TE;function FY(){if(TE)return Ug;TE=1;var e=DY(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(s){var i=[];return s.charCodeAt(0)===46&&i.push(""),s.replace(t,function(l,u,d,f){i.push(d?f.replace(n,"$1"):u||l)}),i});return Ug=r,Ug}var zg,RE;function Xd(){if(RE)return zg;RE=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,i=Array(s);++r<s;)i[r]=n(t[r],r,t);return i}return zg=e,zg}var Hg,AE;function qY(){if(AE)return Hg;AE=1;var e=ui(),t=Xd(),n=xt(),r=fi(),s=e?e.prototype:void 0,i=s?s.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(r(u))return i?i.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return Hg=l,Hg}var Wg,ME;function Q$(){if(ME)return Wg;ME=1;var e=qY();function t(n){return n==null?"":e(n)}return Wg=t,Wg}var Vg,$E;function Zd(){if($E)return Vg;$E=1;var e=xt(),t=G0(),n=FY(),r=Q$();function s(i,l){return e(i)?i:t(i,l)?[i]:n(r(i))}return Vg=s,Vg}var Gg,IE;function Yl(){if(IE)return Gg;IE=1;var e=fi();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return Gg=t,Gg}var Kg,OE;function Jd(){if(OE)return Kg;OE=1;var e=Zd(),t=Yl();function n(r,s){s=e(s,r);for(var i=0,l=s.length;r!=null&&i<l;)r=r[t(s[i++])];return i&&i==l?r:void 0}return Kg=n,Kg}var Yg,LE;function BY(){if(LE)return Yg;LE=1;var e=Jd();function t(n,r,s){var i=n==null?void 0:e(n,r);return i===void 0?s:i}return Yg=t,Yg}var Xg,PE;function UY(){if(PE)return Xg;PE=1;function e(t,n){return t!=null&&n in Object(t)}return Xg=e,Xg}var Zg,DE;function eI(){if(DE)return Zg;DE=1;var e=Zd(),t=Gl(),n=xt(),r=Wd(),s=P0(),i=Yl();function l(u,d,f){d=e(d,u);for(var h=-1,m=d.length,g=!1;++h<m;){var w=i(d[h]);if(!(g=u!=null&&f(u,w)))break;u=u[w]}return g||++h!=m?g:(m=u==null?0:u.length,!!m&&s(m)&&r(w,m)&&(n(u)||t(u)))}return Zg=l,Zg}var Jg,FE;function tI(){if(FE)return Jg;FE=1;var e=UY(),t=eI();function n(r,s){return r!=null&&t(r,s,e)}return Jg=n,Jg}var Qg,qE;function zY(){if(qE)return Qg;qE=1;var e=X$(),t=BY(),n=tI(),r=G0(),s=Z$(),i=J$(),l=Yl(),u=1,d=2;function f(h,m){return r(h)&&s(m)?i(l(h),m):function(g){var w=t(g,h);return w===void 0&&w===m?n(g,h):e(m,w,u|d)}}return Qg=f,Qg}var ey,BE;function nI(){if(BE)return ey;BE=1;function e(t){return function(n){return n==null?void 0:n[t]}}return ey=e,ey}var ty,UE;function HY(){if(UE)return ty;UE=1;var e=Jd();function t(n){return function(r){return e(r,n)}}return ty=t,ty}var ny,zE;function WY(){if(zE)return ny;zE=1;var e=nI(),t=HY(),n=G0(),r=Yl();function s(i){return n(i)?e(r(i)):t(i)}return ny=s,ny}var ry,HE;function ns(){if(HE)return ry;HE=1;var e=LY(),t=zY(),n=Ha(),r=xt(),s=WY();function i(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?r(l)?t(l[0],l[1]):e(l):s(l)}return ry=i,ry}var sy,WE;function rI(){if(WE)return sy;WE=1;var e=$$(),t=_Y(),n=ns(),r=xt();function s(i,l){var u=r(i)?e:t;return u(i,n(l,3))}return sy=s,sy}var ay,VE;function VY(){if(VE)return ay;VE=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,s){return r!=null&&t.call(r,s)}return ay=n,ay}var oy,GE;function sI(){if(GE)return oy;GE=1;var e=VY(),t=eI();function n(r,s){return r!=null&&t(r,s,e)}return oy=n,oy}var iy,KE;function GY(){if(KE)return iy;KE=1;var e=F0(),t=hi(),n=Gl(),r=xt(),s=ts(),i=di(),l=Gd(),u=Kl(),d="[object Map]",f="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function g(w){if(w==null)return!0;if(s(w)&&(r(w)||typeof w=="string"||typeof w.splice=="function"||i(w)||u(w)||n(w)))return!w.length;var b=t(w);if(b==d||b==f)return!w.size;if(l(w))return!e(w).length;for(var x in w)if(m.call(w,x))return!1;return!0}return iy=g,iy}var ly,YE;function aI(){if(YE)return ly;YE=1;function e(t){return t===void 0}return ly=e,ly}var cy,XE;function oI(){if(XE)return cy;XE=1;var e=Yd(),t=ts();function n(r,s){var i=-1,l=t(r)?Array(r.length):[];return e(r,function(u,d,f){l[++i]=s(u,d,f)}),l}return cy=n,cy}var uy,ZE;function iI(){if(ZE)return uy;ZE=1;var e=Xd(),t=ns(),n=oI(),r=xt();function s(i,l){var u=r(i)?e:n;return u(i,t(l,3))}return uy=s,uy}var dy,JE;function KY(){if(JE)return dy;JE=1;function e(t,n,r,s){var i=-1,l=t==null?0:t.length;for(s&&l&&(r=t[++i]);++i<l;)r=n(r,t[i],i,t);return r}return dy=e,dy}var hy,QE;function YY(){if(QE)return hy;QE=1;function e(t,n,r,s,i){return i(t,function(l,u,d){r=s?(s=!1,l):n(r,l,u,d)}),r}return hy=e,hy}var fy,eC;function lI(){if(eC)return fy;eC=1;var e=KY(),t=Yd(),n=ns(),r=YY(),s=xt();function i(l,u,d){var f=s(l)?e:r,h=arguments.length<3;return f(l,n(u,4),d,h,t)}return fy=i,fy}var py,tC;function XY(){if(tC)return py;tC=1;var e=Ba(),t=xt(),n=Mr(),r="[object String]";function s(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==r}return py=s,py}var my,nC;function ZY(){if(nC)return my;nC=1;var e=nI(),t=e("length");return my=t,my}var gy,rC;function JY(){if(rC)return gy;rC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,i="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+s+i+"]");function d(f){return u.test(f)}return gy=d,gy}var yy,sC;function QY(){if(sC)return yy;sC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,i="\\ufe0e\\ufe0f",l="["+e+"]",u="["+s+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",b=f+"?",x="["+i+"]?",k="(?:"+w+"(?:"+[h,m,g].join("|")+")"+x+b+")*",j=x+b+k,S="(?:"+[h+u+"?",u,m,g,l].join("|")+")",_=RegExp(d+"(?="+d+")|"+S+j,"g");function E(T){for(var R=_.lastIndex=0;_.test(T);)++R;return R}return yy=E,yy}var wy,aC;function eX(){if(aC)return wy;aC=1;var e=ZY(),t=JY(),n=QY();function r(s){return t(s)?n(s):e(s)}return wy=r,wy}var vy,oC;function tX(){if(oC)return vy;oC=1;var e=F0(),t=hi(),n=ts(),r=XY(),s=eX(),i="[object Map]",l="[object Set]";function u(d){if(d==null)return 0;if(n(d))return r(d)?s(d):d.length;var f=t(d);return f==i||f==l?d.size:e(d).length}return vy=u,vy}var xy,iC;function nX(){if(iC)return xy;iC=1;var e=L0(),t=B$(),n=W0(),r=ns(),s=Kd(),i=xt(),l=di(),u=Wl(),d=Dn(),f=Kl();function h(m,g,w){var b=i(m),x=b||l(m)||f(m);if(g=r(g,4),w==null){var k=m&&m.constructor;x?w=b?new k:[]:d(m)?w=u(k)?t(s(m)):{}:w={}}return(x?e:n)(m,function(j,S,_){return g(w,j,S,_)}),w}return xy=h,xy}var by,lC;function rX(){if(lC)return by;lC=1;var e=ui(),t=Gl(),n=xt(),r=e?e.isConcatSpreadable:void 0;function s(i){return n(i)||t(i)||!!(r&&i&&i[r])}return by=s,by}var ky,cC;function K0(){if(cC)return ky;cC=1;var e=B0(),t=rX();function n(r,s,i,l,u){var d=-1,f=r.length;for(i||(i=t),u||(u=[]);++d<f;){var h=r[d];s>0&&i(h)?s>1?n(h,s-1,i,l,u):e(u,h):l||(u[u.length]=h)}return u}return ky=n,ky}var Ny,uC;function sX(){if(uC)return Ny;uC=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 Ny=e,Ny}var jy,dC;function cI(){if(dC)return jy;dC=1;var e=sX(),t=Math.max;function n(r,s,i){return s=t(s===void 0?r.length-1:s,0),function(){for(var l=arguments,u=-1,d=t(l.length-s,0),f=Array(d);++u<d;)f[u]=l[s+u];u=-1;for(var h=Array(s+1);++u<s;)h[u]=l[u];return h[s]=i(f),e(r,this,h)}}return jy=n,jy}var Sy,hC;function aX(){if(hC)return Sy;hC=1;var e=z0(),t=C$(),n=Ha(),r=t?function(s,i){return t(s,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return Sy=r,Sy}var _y,fC;function oX(){if(fC)return _y;fC=1;var e=800,t=16,n=Date.now;function r(s){var i=0,l=0;return function(){var u=n(),d=t-(u-l);if(l=u,d>0){if(++i>=e)return arguments[0]}else i=0;return s.apply(void 0,arguments)}}return _y=r,_y}var Ey,pC;function uI(){if(pC)return Ey;pC=1;var e=aX(),t=oX(),n=t(e);return Ey=n,Ey}var Cy,mC;function Qd(){if(mC)return Cy;mC=1;var e=Ha(),t=cI(),n=uI();function r(s,i){return n(t(s,i,e),s+"")}return Cy=r,Cy}var Ty,gC;function dI(){if(gC)return Ty;gC=1;function e(t,n,r,s){for(var i=t.length,l=r+(s?1:-1);s?l--:++l<i;)if(n(t[l],l,t))return l;return-1}return Ty=e,Ty}var Ry,yC;function iX(){if(yC)return Ry;yC=1;function e(t){return t!==t}return Ry=e,Ry}var Ay,wC;function lX(){if(wC)return Ay;wC=1;function e(t,n,r){for(var s=r-1,i=t.length;++s<i;)if(t[s]===n)return s;return-1}return Ay=e,Ay}var My,vC;function cX(){if(vC)return My;vC=1;var e=dI(),t=iX(),n=lX();function r(s,i,l){return i===i?n(s,i,l):e(s,t,l)}return My=r,My}var $y,xC;function uX(){if(xC)return $y;xC=1;var e=cX();function t(n,r){var s=n==null?0:n.length;return!!s&&e(n,r,0)>-1}return $y=t,$y}var Iy,bC;function dX(){if(bC)return Iy;bC=1;function e(t,n,r){for(var s=-1,i=t==null?0:t.length;++s<i;)if(r(n,t[s]))return!0;return!1}return Iy=e,Iy}var Oy,kC;function hX(){if(kC)return Oy;kC=1;function e(){}return Oy=e,Oy}var Ly,NC;function fX(){if(NC)return Ly;NC=1;var e=D$(),t=hX(),n=V0(),r=1/0,s=e&&1/n(new e([,-0]))[1]==r?function(i){return new e(i)}:t;return Ly=s,Ly}var Py,jC;function pX(){if(jC)return Py;jC=1;var e=G$(),t=uX(),n=dX(),r=K$(),s=fX(),i=V0(),l=200;function u(d,f,h){var m=-1,g=t,w=d.length,b=!0,x=[],k=x;if(h)b=!1,g=n;else if(w>=l){var j=f?null:s(d);if(j)return i(j);b=!1,g=r,k=new e}else k=f?[]:x;e:for(;++m<w;){var S=d[m],_=f?f(S):S;if(S=h||S!==0?S:0,b&&_===_){for(var E=k.length;E--;)if(k[E]===_)continue e;f&&k.push(_),x.push(S)}else g(k,_,h)||(k!==x&&k.push(_),x.push(S))}return x}return Py=u,Py}var Dy,SC;function hI(){if(SC)return Dy;SC=1;var e=ts(),t=Mr();function n(r){return t(r)&&e(r)}return Dy=n,Dy}var Fy,_C;function mX(){if(_C)return Fy;_C=1;var e=K0(),t=Qd(),n=pX(),r=hI(),s=t(function(i){return n(e(i,1,r,!0))});return Fy=s,Fy}var qy,EC;function gX(){if(EC)return qy;EC=1;var e=Xd();function t(n,r){return e(r,function(s){return n[s]})}return qy=t,qy}var By,CC;function fI(){if(CC)return By;CC=1;var e=gX(),t=Ks();function n(r){return r==null?[]:e(r,t(r))}return By=n,By}var Uy,TC;function Fn(){if(TC)return Uy;TC=1;var e;if(typeof $0=="function")try{e={clone:NY(),constant:z0(),each:V$(),filter:rI(),has:sI(),isArray:xt(),isEmpty:GY(),isFunction:Wl(),isUndefined:aI(),keys:Ks(),map:iI(),reduce:lI(),size:tX(),transform:nX(),union:mX(),values:fI()}}catch{}return e||(e=window._),Uy=e,Uy}var zy,RC;function Y0(){if(RC)return zy;RC=1;var e=Fn();zy=s;var t="\0",n="\0",r="";function s(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={}}s.prototype._nodeCount=0,s.prototype._edgeCount=0,s.prototype.isDirected=function(){return this._isDirected},s.prototype.isMultigraph=function(){return this._isMultigraph},s.prototype.isCompound=function(){return this._isCompound},s.prototype.setGraph=function(h){return this._label=h,this},s.prototype.graph=function(){return this._label},s.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},s.prototype.nodeCount=function(){return this._nodeCount},s.prototype.nodes=function(){return e.keys(this._nodes)},s.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._in[m])})},s.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._out[m])})},s.prototype.setNodes=function(h,m){var g=arguments,w=this;return e.each(h,function(b){g.length>1?w.setNode(b,m):w.setNode(b)}),this},s.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)},s.prototype.node=function(h){return this._nodes[h]},s.prototype.hasNode=function(h){return e.has(this._nodes,h)},s.prototype.removeNode=function(h){var m=this;if(e.has(this._nodes,h)){var g=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]),g),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),g),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},s.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 g=m;!e.isUndefined(g);g=this.parent(g))if(g===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},s.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},s.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},s.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[]}},s.prototype.predecessors=function(h){var m=this._preds[h];if(m)return e.keys(m)},s.prototype.successors=function(h){var m=this._sucs[h];if(m)return e.keys(m)},s.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return e.union(m,this.successors(h))},s.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},s.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var g=this;e.each(this._nodes,function(x,k){h(k)&&m.setNode(k,x)}),e.each(this._edgeObjs,function(x){m.hasNode(x.v)&&m.hasNode(x.w)&&m.setEdge(x,g.edge(x))});var w={};function b(x){var k=g.parent(x);return k===void 0||m.hasNode(k)?(w[x]=k,k):k in w?w[k]:b(k)}return this._isCompound&&e.each(m.nodes(),function(x){m.setParent(x,b(x))}),m},s.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return e.values(this._edgeObjs)},s.prototype.setPath=function(h,m){var g=this,w=arguments;return e.reduce(h,function(b,x){return w.length>1?g.setEdge(b,x,m):g.setEdge(b,x),x}),this},s.prototype.setEdge=function(){var h,m,g,w,b=!1,x=arguments[0];typeof x=="object"&&x!==null&&"v"in x?(h=x.v,m=x.w,g=x.name,arguments.length===2&&(w=arguments[1],b=!0)):(h=x,m=arguments[1],g=arguments[3],arguments.length>2&&(w=arguments[2],b=!0)),h=""+h,m=""+m,e.isUndefined(g)||(g=""+g);var k=u(this._isDirected,h,m,g);if(e.has(this._edgeLabels,k))return b&&(this._edgeLabels[k]=w),this;if(!e.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[k]=b?w:this._defaultEdgeLabelFn(h,m,g);var j=d(this._isDirected,h,m,g);return h=j.v,m=j.w,Object.freeze(j),this._edgeObjs[k]=j,i(this._preds[m],h),i(this._sucs[h],m),this._in[m][k]=j,this._out[h][k]=j,this._edgeCount++,this},s.prototype.edge=function(h,m,g){var w=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,h,m,g);return this._edgeLabels[w]},s.prototype.hasEdge=function(h,m,g){var w=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,h,m,g);return e.has(this._edgeLabels,w)},s.prototype.removeEdge=function(h,m,g){var w=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,h,m,g),b=this._edgeObjs[w];return b&&(h=b.v,m=b.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[m],h),l(this._sucs[h],m),delete this._in[m][w],delete this._out[h][w],this._edgeCount--),this},s.prototype.inEdges=function(h,m){var g=this._in[h];if(g){var w=e.values(g);return m?e.filter(w,function(b){return b.v===m}):w}},s.prototype.outEdges=function(h,m){var g=this._out[h];if(g){var w=e.values(g);return m?e.filter(w,function(b){return b.w===m}):w}},s.prototype.nodeEdges=function(h,m){var g=this.inEdges(h,m);if(g)return g.concat(this.outEdges(h,m))};function i(h,m){h[m]?h[m]++:h[m]=1}function l(h,m){--h[m]||delete h[m]}function u(h,m,g,w){var b=""+m,x=""+g;if(!h&&b>x){var k=b;b=x,x=k}return b+r+x+r+(e.isUndefined(w)?t:w)}function d(h,m,g,w){var b=""+m,x=""+g;if(!h&&b>x){var k=b;b=x,x=k}var j={v:b,w:x};return w&&(j.name=w),j}function f(h,m){return u(h,m.v,m.w,m.name)}return zy}var Hy,AC;function yX(){return AC||(AC=1,Hy="2.1.8"),Hy}var Wy,MC;function wX(){return MC||(MC=1,Wy={Graph:Y0(),version:yX()}),Wy}var Vy,$C;function vX(){if($C)return Vy;$C=1;var e=Fn(),t=Y0();Vy={write:n,read:i};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:r(l),edges:s(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function r(l){return e.map(l.nodes(),function(u){var d=l.node(u),f=l.parent(u),h={v:u};return e.isUndefined(d)||(h.value=d),e.isUndefined(f)||(h.parent=f),h})}function s(l){return e.map(l.edges(),function(u){var d=l.edge(u),f={v:u.v,w:u.w};return e.isUndefined(u.name)||(f.name=u.name),e.isUndefined(d)||(f.value=d),f})}function i(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(d){u.setNode(d.v,d.value),d.parent&&u.setParent(d.v,d.parent)}),e.each(l.edges,function(d){u.setEdge({v:d.v,w:d.w,name:d.name},d.value)}),u}return Vy}var Gy,IC;function xX(){if(IC)return Gy;IC=1;var e=Fn();Gy=t;function t(n){var r={},s=[],i;function l(u){e.has(r,u)||(r[u]=!0,i.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){i=[],l(u),i.length&&s.push(i)}),s}return Gy}var Ky,OC;function pI(){if(OC)return Ky;OC=1;var e=Fn();Ky=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 s=this._keyIndices;if(n=String(n),!e.has(s,n)){var i=this._arr,l=i.length;return s[n]=l,i.push({key:n,priority:r}),this._decrease(l),!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 s=this._keyIndices[n];if(r>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[s].priority+" New: "+r);this._arr[s].priority=r,this._decrease(s)},t.prototype._heapify=function(n){var r=this._arr,s=2*n,i=s+1,l=n;s<r.length&&(l=r[s].priority<r[l].priority?s:l,i<r.length&&(l=r[i].priority<r[l].priority?i:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var r=this._arr,s=r[n].priority,i;n!==0&&(i=n>>1,!(r[i].priority<s));)this._swap(n,i),n=i},t.prototype._swap=function(n,r){var s=this._arr,i=this._keyIndices,l=s[n],u=s[r];s[n]=u,s[r]=l,i[u.key]=n,i[l.key]=r},Ky}var Yy,LC;function mI(){if(LC)return Yy;LC=1;var e=Fn(),t=pI();Yy=r;var n=e.constant(1);function r(i,l,u,d){return s(i,String(l),u||n,d||function(f){return i.outEdges(f)})}function s(i,l,u,d){var f={},h=new t,m,g,w=function(b){var x=b.v!==m?b.v:b.w,k=f[x],j=u(b),S=g.distance+j;if(j<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+b+" Weight: "+j);S<k.distance&&(k.distance=S,k.predecessor=m,h.decrease(x,S))};for(i.nodes().forEach(function(b){var x=b===l?0:Number.POSITIVE_INFINITY;f[b]={distance:x},h.add(b,x)});h.size()>0&&(m=h.removeMin(),g=f[m],g.distance!==Number.POSITIVE_INFINITY);)d(m).forEach(w);return f}return Yy}var Xy,PC;function bX(){if(PC)return Xy;PC=1;var e=mI(),t=Fn();Xy=n;function n(r,s,i){return t.transform(r.nodes(),function(l,u){l[u]=e(r,u,s,i)},{})}return Xy}var Zy,DC;function gI(){if(DC)return Zy;DC=1;var e=Fn();Zy=t;function t(n){var r=0,s=[],i={},l=[];function u(d){var f=i[d]={onStack:!0,lowlink:r,index:r++};if(s.push(d),n.successors(d).forEach(function(g){e.has(i,g)?i[g].onStack&&(f.lowlink=Math.min(f.lowlink,i[g].index)):(u(g),f.lowlink=Math.min(f.lowlink,i[g].lowlink))}),f.lowlink===f.index){var h=[],m;do m=s.pop(),i[m].onStack=!1,h.push(m);while(d!==m);l.push(h)}}return n.nodes().forEach(function(d){e.has(i,d)||u(d)}),l}return Zy}var Jy,FC;function kX(){if(FC)return Jy;FC=1;var e=Fn(),t=gI();Jy=n;function n(r){return e.filter(t(r),function(s){return s.length>1||s.length===1&&r.hasEdge(s[0],s[0])})}return Jy}var Qy,qC;function NX(){if(qC)return Qy;qC=1;var e=Fn();Qy=n;var t=e.constant(1);function n(s,i,l){return r(s,i||t,l||function(u){return s.outEdges(u)})}function r(s,i,l){var u={},d=s.nodes();return d.forEach(function(f){u[f]={},u[f][f]={distance:0},d.forEach(function(h){f!==h&&(u[f][h]={distance:Number.POSITIVE_INFINITY})}),l(f).forEach(function(h){var m=h.v===f?h.w:h.v,g=i(h);u[f][m]={distance:g,predecessor:f}})}),d.forEach(function(f){var h=u[f];d.forEach(function(m){var g=u[m];d.forEach(function(w){var b=g[f],x=h[w],k=g[w],j=b.distance+x.distance;j<k.distance&&(k.distance=j,k.predecessor=x.predecessor)})})}),u}return Qy}var ew,BC;function yI(){if(BC)return ew;BC=1;var e=Fn();ew=t,t.CycleException=n;function t(r){var s={},i={},l=[];function u(d){if(e.has(i,d))throw new n;e.has(s,d)||(i[d]=!0,s[d]=!0,e.each(r.predecessors(d),u),delete i[d],l.push(d))}if(e.each(r.sinks(),u),e.size(s)!==r.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,ew}var tw,UC;function jX(){if(UC)return tw;UC=1;var e=yI();tw=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return tw}var nw,zC;function wI(){if(zC)return nw;zC=1;var e=Fn();nw=t;function t(r,s,i){e.isArray(s)||(s=[s]);var l=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],d={};return e.each(s,function(f){if(!r.hasNode(f))throw new Error("Graph does not have node: "+f);n(r,f,i==="post",d,l,u)}),u}function n(r,s,i,l,u,d){e.has(l,s)||(l[s]=!0,i||d.push(s),e.each(u(s),function(f){n(r,f,i,l,u,d)}),i&&d.push(s))}return nw}var rw,HC;function SX(){if(HC)return rw;HC=1;var e=wI();rw=t;function t(n,r){return e(n,r,"post")}return rw}var sw,WC;function _X(){if(WC)return sw;WC=1;var e=wI();sw=t;function t(n,r){return e(n,r,"pre")}return sw}var aw,VC;function EX(){if(VC)return aw;VC=1;var e=Fn(),t=Y0(),n=pI();aw=r;function r(s,i){var l=new t,u={},d=new n,f;function h(g){var w=g.v===f?g.w:g.v,b=d.priority(w);if(b!==void 0){var x=i(g);x<b&&(u[w]=f,d.decrease(w,x))}}if(s.nodeCount()===0)return l;e.each(s.nodes(),function(g){d.add(g,Number.POSITIVE_INFINITY),l.setNode(g)}),d.decrease(s.nodes()[0],0);for(var m=!1;d.size()>0;){if(f=d.removeMin(),e.has(u,f))l.setEdge(f,u[f]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(f).forEach(h)}return l}return aw}var ow,GC;function CX(){return GC||(GC=1,ow={components:xX(),dijkstra:mI(),dijkstraAll:bX(),findCycles:kX(),floydWarshall:NX(),isAcyclic:jX(),postorder:SX(),preorder:_X(),prim:EX(),tarjan:gI(),topsort:yI()}),ow}var iw,KC;function TX(){if(KC)return iw;KC=1;var e=wX();return iw={Graph:e.Graph,json:vX(),alg:CX(),version:e.version},iw}var lw,YC;function or(){if(YC)return lw;YC=1;var e;if(typeof $0=="function")try{e=TX()}catch{}return e||(e=window.graphlib),lw=e,lw}var cw,XC;function RX(){if(XC)return cw;XC=1;var e=z$(),t=1,n=4;function r(s){return e(s,t|n)}return cw=r,cw}var uw,ZC;function eh(){if(ZC)return uw;ZC=1;var e=ci(),t=ts(),n=Wd(),r=Dn();function s(i,l,u){if(!r(u))return!1;var d=typeof l;return(d=="number"?t(u)&&n(l,u.length):d=="string"&&l in u)?e(u[l],i):!1}return uw=s,uw}var dw,JC;function AX(){if(JC)return dw;JC=1;var e=Qd(),t=ci(),n=eh(),r=za(),s=Object.prototype,i=s.hasOwnProperty,l=e(function(u,d){u=Object(u);var f=-1,h=d.length,m=h>2?d[2]:void 0;for(m&&n(d[0],d[1],m)&&(h=1);++f<h;)for(var g=d[f],w=r(g),b=-1,x=w.length;++b<x;){var k=w[b],j=u[k];(j===void 0||t(j,s[k])&&!i.call(u,k))&&(u[k]=g[k])}return u});return dw=l,dw}var hw,QC;function MX(){if(QC)return hw;QC=1;var e=ns(),t=ts(),n=Ks();function r(s){return function(i,l,u){var d=Object(i);if(!t(i)){var f=e(l,3);i=n(i),l=function(m){return f(d[m],m,d)}}var h=s(i,l,u);return h>-1?d[f?i[h]:h]:void 0}}return hw=r,hw}var fw,eT;function $X(){if(eT)return fw;eT=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return fw=t,fw}var pw,tT;function IX(){if(tT)return pw;tT=1;var e=$X(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return pw=n,pw}var mw,nT;function OX(){if(nT)return mw;nT=1;var e=IX(),t=Dn(),n=fi(),r=NaN,s=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(n(f))return r;if(t(f)){var h=typeof f.valueOf=="function"?f.valueOf():f;f=t(h)?h+"":h}if(typeof f!="string")return f===0?f:+f;f=e(f);var m=i.test(f);return m||l.test(f)?u(f.slice(2),m?2:8):s.test(f)?r:+f}return mw=d,mw}var gw,rT;function vI(){if(rT)return gw;rT=1;var e=OX(),t=1/0,n=17976931348623157e292;function r(s){if(!s)return s===0?s:0;if(s=e(s),s===t||s===-t){var i=s<0?-1:1;return i*n}return s===s?s:0}return gw=r,gw}var yw,sT;function LX(){if(sT)return yw;sT=1;var e=vI();function t(n){var r=e(n),s=r%1;return r===r?s?r-s:r:0}return yw=t,yw}var ww,aT;function PX(){if(aT)return ww;aT=1;var e=dI(),t=ns(),n=LX(),r=Math.max;function s(i,l,u){var d=i==null?0:i.length;if(!d)return-1;var f=u==null?0:n(u);return f<0&&(f=r(d+f,0)),e(i,t(l,3),f)}return ww=s,ww}var vw,oT;function DX(){if(oT)return vw;oT=1;var e=MX(),t=PX(),n=e(t);return vw=n,vw}var xw,iT;function xI(){if(iT)return xw;iT=1;var e=K0();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return xw=t,xw}var bw,lT;function FX(){if(lT)return bw;lT=1;var e=H0(),t=H$(),n=za();function r(s,i){return s==null?s:e(s,t(i),n)}return bw=r,bw}var kw,cT;function qX(){if(cT)return kw;cT=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return kw=e,kw}var Nw,uT;function BX(){if(uT)return Nw;uT=1;var e=zd(),t=W0(),n=ns();function r(s,i){var l={};return i=n(i,3),t(s,function(u,d,f){e(l,d,i(u,d,f))}),l}return Nw=r,Nw}var jw,dT;function X0(){if(dT)return jw;dT=1;var e=fi();function t(n,r,s){for(var i=-1,l=n.length;++i<l;){var u=n[i],d=r(u);if(d!=null&&(f===void 0?d===d&&!e(d):s(d,f)))var f=d,h=u}return h}return jw=t,jw}var Sw,hT;function UX(){if(hT)return Sw;hT=1;function e(t,n){return t>n}return Sw=e,Sw}var _w,fT;function zX(){if(fT)return _w;fT=1;var e=X0(),t=UX(),n=Ha();function r(s){return s&&s.length?e(s,n,t):void 0}return _w=r,_w}var Ew,pT;function bI(){if(pT)return Ew;pT=1;var e=zd(),t=ci();function n(r,s,i){(i!==void 0&&!t(r[s],i)||i===void 0&&!(s in r))&&e(r,s,i)}return Ew=n,Ew}var Cw,mT;function HX(){if(mT)return Cw;mT=1;var e=Ba(),t=Kd(),n=Mr(),r="[object Object]",s=Function.prototype,i=Object.prototype,l=s.toString,u=i.hasOwnProperty,d=l.call(Object);function f(h){if(!n(h)||e(h)!=r)return!1;var m=t(h);if(m===null)return!0;var g=u.call(m,"constructor")&&m.constructor;return typeof g=="function"&&g instanceof g&&l.call(g)==d}return Cw=f,Cw}var Tw,gT;function kI(){if(gT)return Tw;gT=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Tw=e,Tw}var Rw,yT;function WX(){if(yT)return Rw;yT=1;var e=Vl(),t=za();function n(r){return e(r,t(r))}return Rw=n,Rw}var Aw,wT;function VX(){if(wT)return Aw;wT=1;var e=bI(),t=A$(),n=q$(),r=M$(),s=U$(),i=Gl(),l=xt(),u=hI(),d=di(),f=Wl(),h=Dn(),m=HX(),g=Kl(),w=kI(),b=WX();function x(k,j,S,_,E,T,R){var A=w(k,S),B=w(j,S),$=R.get(B);if($){e(k,S,$);return}var I=T?T(A,B,S+"",k,j,R):void 0,D=I===void 0;if(D){var F=l(B),W=!F&&d(B),M=!F&&!W&&g(B);I=B,F||W||M?l(A)?I=A:u(A)?I=r(A):W?(D=!1,I=t(B,!0)):M?(D=!1,I=n(B,!0)):I=[]:m(B)||i(B)?(I=A,i(A)?I=b(A):(!h(A)||f(A))&&(I=s(B))):D=!1}D&&(R.set(B,I),E(I,B,_,T,R),R.delete(B)),e(k,S,I)}return Aw=x,Aw}var Mw,vT;function GX(){if(vT)return Mw;vT=1;var e=Ud(),t=bI(),n=H0(),r=VX(),s=Dn(),i=za(),l=kI();function u(d,f,h,m,g){d!==f&&n(f,function(w,b){if(g||(g=new e),s(w))r(d,f,b,h,u,m,g);else{var x=m?m(l(d,b),w,b+"",d,f,g):void 0;x===void 0&&(x=w),t(d,b,x)}},i)}return Mw=u,Mw}var $w,xT;function KX(){if(xT)return $w;xT=1;var e=Qd(),t=eh();function n(r){return e(function(s,i){var l=-1,u=i.length,d=u>1?i[u-1]:void 0,f=u>2?i[2]:void 0;for(d=r.length>3&&typeof d=="function"?(u--,d):void 0,f&&t(i[0],i[1],f)&&(d=u<3?void 0:d,u=1),s=Object(s);++l<u;){var h=i[l];h&&r(s,h,l,d)}return s})}return $w=n,$w}var Iw,bT;function YX(){if(bT)return Iw;bT=1;var e=GX(),t=KX(),n=t(function(r,s,i){e(r,s,i)});return Iw=n,Iw}var Ow,kT;function NI(){if(kT)return Ow;kT=1;function e(t,n){return t<n}return Ow=e,Ow}var Lw,NT;function XX(){if(NT)return Lw;NT=1;var e=X0(),t=NI(),n=Ha();function r(s){return s&&s.length?e(s,n,t):void 0}return Lw=r,Lw}var Pw,jT;function ZX(){if(jT)return Pw;jT=1;var e=X0(),t=ns(),n=NI();function r(s,i){return s&&s.length?e(s,t(i,2),n):void 0}return Pw=r,Pw}var Dw,ST;function JX(){if(ST)return Dw;ST=1;var e=cr(),t=function(){return e.Date.now()};return Dw=t,Dw}var Fw,_T;function QX(){if(_T)return Fw;_T=1;var e=Hd(),t=Zd(),n=Wd(),r=Dn(),s=Yl();function i(l,u,d,f){if(!r(l))return l;u=t(u,l);for(var h=-1,m=u.length,g=m-1,w=l;w!=null&&++h<m;){var b=s(u[h]),x=d;if(b==="__proto__"||b==="constructor"||b==="prototype")return l;if(h!=g){var k=w[b];x=f?f(k,b,w):void 0,x===void 0&&(x=r(k)?k:n(u[h+1])?[]:{})}e(w,b,x),w=w[b]}return l}return Fw=i,Fw}var qw,ET;function eZ(){if(ET)return qw;ET=1;var e=Jd(),t=QX(),n=Zd();function r(s,i,l){for(var u=-1,d=i.length,f={};++u<d;){var h=i[u],m=e(s,h);l(m,h)&&t(f,n(h,s),m)}return f}return qw=r,qw}var Bw,CT;function tZ(){if(CT)return Bw;CT=1;var e=eZ(),t=tI();function n(r,s){return e(r,s,function(i,l){return t(r,l)})}return Bw=n,Bw}var Uw,TT;function nZ(){if(TT)return Uw;TT=1;var e=xI(),t=cI(),n=uI();function r(s){return n(t(s,void 0,e),s+"")}return Uw=r,Uw}var zw,RT;function rZ(){if(RT)return zw;RT=1;var e=tZ(),t=nZ(),n=t(function(r,s){return r==null?{}:e(r,s)});return zw=n,zw}var Hw,AT;function sZ(){if(AT)return Hw;AT=1;var e=Math.ceil,t=Math.max;function n(r,s,i,l){for(var u=-1,d=t(e((s-r)/(i||1)),0),f=Array(d);d--;)f[l?d:++u]=r,r+=i;return f}return Hw=n,Hw}var Ww,MT;function aZ(){if(MT)return Ww;MT=1;var e=sZ(),t=eh(),n=vI();function r(s){return function(i,l,u){return u&&typeof u!="number"&&t(i,l,u)&&(l=u=void 0),i=n(i),l===void 0?(l=i,i=0):l=n(l),u=u===void 0?i<l?1:-1:n(u),e(i,l,u,s)}}return Ww=r,Ww}var Vw,$T;function oZ(){if($T)return Vw;$T=1;var e=aZ(),t=e();return Vw=t,Vw}var Gw,IT;function iZ(){if(IT)return Gw;IT=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return Gw=e,Gw}var Kw,OT;function lZ(){if(OT)return Kw;OT=1;var e=fi();function t(n,r){if(n!==r){var s=n!==void 0,i=n===null,l=n===n,u=e(n),d=r!==void 0,f=r===null,h=r===r,m=e(r);if(!f&&!m&&!u&&n>r||u&&d&&h&&!f&&!m||i&&d&&h||!s&&h||!l)return 1;if(!i&&!u&&!m&&n<r||m&&s&&l&&!i&&!u||f&&s&&l||!d&&l||!h)return-1}return 0}return Kw=t,Kw}var Yw,LT;function cZ(){if(LT)return Yw;LT=1;var e=lZ();function t(n,r,s){for(var i=-1,l=n.criteria,u=r.criteria,d=l.length,f=s.length;++i<d;){var h=e(l[i],u[i]);if(h){if(i>=f)return h;var m=s[i];return h*(m=="desc"?-1:1)}}return n.index-r.index}return Yw=t,Yw}var Xw,PT;function uZ(){if(PT)return Xw;PT=1;var e=Xd(),t=Jd(),n=ns(),r=oI(),s=iZ(),i=Vd(),l=cZ(),u=Ha(),d=xt();function f(h,m,g){m.length?m=e(m,function(x){return d(x)?function(k){return t(k,x.length===1?x[0]:x)}:x}):m=[u];var w=-1;m=e(m,i(n));var b=r(h,function(x,k,j){var S=e(m,function(_){return _(x)});return{criteria:S,index:++w,value:x}});return s(b,function(x,k){return l(x,k,g)})}return Xw=f,Xw}var Zw,DT;function dZ(){if(DT)return Zw;DT=1;var e=K0(),t=uZ(),n=Qd(),r=eh(),s=n(function(i,l){if(i==null)return[];var u=l.length;return u>1&&r(i,l[0],l[1])?l=[]:u>2&&r(l[0],l[1],l[2])&&(l=[l[0]]),t(i,e(l,1),[])});return Zw=s,Zw}var Jw,FT;function hZ(){if(FT)return Jw;FT=1;var e=Q$(),t=0;function n(r){var s=++t;return e(r)+s}return Jw=n,Jw}var Qw,qT;function fZ(){if(qT)return Qw;qT=1;function e(t,n,r){for(var s=-1,i=t.length,l=n.length,u={};++s<i;){var d=s<l?n[s]:void 0;r(u,t[s],d)}return u}return Qw=e,Qw}var ev,BT;function pZ(){if(BT)return ev;BT=1;var e=Hd(),t=fZ();function n(r,s){return t(r||[],s||[],e)}return ev=n,ev}var tv,UT;function lt(){if(UT)return tv;UT=1;var e;if(typeof $0=="function")try{e={cloneDeep:RX(),constant:z0(),defaults:AX(),each:V$(),filter:rI(),find:DX(),flatten:xI(),forEach:W$(),forIn:FX(),has:sI(),isUndefined:aI(),last:qX(),map:iI(),mapValues:BX(),max:zX(),merge:YX(),min:XX(),minBy:ZX(),now:JX(),pick:rZ(),range:oZ(),reduce:lI(),sortBy:dZ(),uniqueId:hZ(),values:fI(),zipObject:pZ()}}catch{}return e||(e=window._),tv=e,tv}var nv,zT;function mZ(){if(zT)return nv;zT=1,nv=e;function e(){var r={};r._next=r._prev=r,this._sentinel=r}e.prototype.dequeue=function(){var r=this._sentinel,s=r._prev;if(s!==r)return t(s),s},e.prototype.enqueue=function(r){var s=this._sentinel;r._prev&&r._next&&t(r),r._next=s._next,s._next._prev=r,s._next=r,r._prev=s},e.prototype.toString=function(){for(var r=[],s=this._sentinel,i=s._prev;i!==s;)r.push(JSON.stringify(i,n)),i=i._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,s){if(r!=="_next"&&r!=="_prev")return s}return nv}var rv,HT;function gZ(){if(HT)return rv;HT=1;var e=lt(),t=or().Graph,n=mZ();rv=s;var r=e.constant(1);function s(f,h){if(f.nodeCount()<=1)return[];var m=u(f,h||r),g=i(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(g,function(w){return f.outEdges(w.v,w.w)}),!0)}function i(f,h,m){for(var g=[],w=h[h.length-1],b=h[0],x;f.nodeCount();){for(;x=b.dequeue();)l(f,h,m,x);for(;x=w.dequeue();)l(f,h,m,x);if(f.nodeCount()){for(var k=h.length-2;k>0;--k)if(x=h[k].dequeue(),x){g=g.concat(l(f,h,m,x,!0));break}}}return g}function l(f,h,m,g,w){var b=w?[]:void 0;return e.forEach(f.inEdges(g.v),function(x){var k=f.edge(x),j=f.node(x.v);w&&b.push({v:x.v,w:x.w}),j.out-=k,d(h,m,j)}),e.forEach(f.outEdges(g.v),function(x){var k=f.edge(x),j=x.w,S=f.node(j);S.in-=k,d(h,m,S)}),f.removeNode(g.v),b}function u(f,h){var m=new t,g=0,w=0;e.forEach(f.nodes(),function(k){m.setNode(k,{v:k,in:0,out:0})}),e.forEach(f.edges(),function(k){var j=m.edge(k.v,k.w)||0,S=h(k),_=j+S;m.setEdge(k.v,k.w,_),w=Math.max(w,m.node(k.v).out+=S),g=Math.max(g,m.node(k.w).in+=S)});var b=e.range(w+g+3).map(function(){return new n}),x=g+1;return e.forEach(m.nodes(),function(k){d(b,x,m.node(k))}),{graph:m,buckets:b,zeroIdx:x}}function d(f,h,m){m.out?m.in?f[m.out-m.in+h].enqueue(m):f[f.length-1].enqueue(m):f[0].enqueue(m)}return rv}var sv,WT;function yZ(){if(WT)return sv;WT=1;var e=lt(),t=gZ();sv={run:n,undo:s};function n(i){var l=i.graph().acyclicer==="greedy"?t(i,u(i)):r(i);e.forEach(l,function(d){var f=i.edge(d);i.removeEdge(d),f.forwardName=d.name,f.reversed=!0,i.setEdge(d.w,d.v,f,e.uniqueId("rev"))});function u(d){return function(f){return d.edge(f).weight}}}function r(i){var l=[],u={},d={};function f(h){e.has(d,h)||(d[h]=!0,u[h]=!0,e.forEach(i.outEdges(h),function(m){e.has(u,m.w)?l.push(m):f(m.w)}),delete u[h])}return e.forEach(i.nodes(),f),l}function s(i){e.forEach(i.edges(),function(l){var u=i.edge(l);if(u.reversed){i.removeEdge(l);var d=u.forwardName;delete u.reversed,delete u.forwardName,i.setEdge(l.w,l.v,u,d)}})}return sv}var av,VT;function cn(){if(VT)return av;VT=1;var e=lt(),t=or().Graph;av={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:i,predecessorWeights:l,intersectRect:u,buildLayerMatrix:d,normalizeRanks:f,removeEmptyRanks:h,addBorderNode:m,maxRank:g,partition:w,time:b,notime:x};function n(k,j,S,_){var E;do E=e.uniqueId(_);while(k.hasNode(E));return S.dummy=j,k.setNode(E,S),E}function r(k){var j=new t().setGraph(k.graph());return e.forEach(k.nodes(),function(S){j.setNode(S,k.node(S))}),e.forEach(k.edges(),function(S){var _=j.edge(S.v,S.w)||{weight:0,minlen:1},E=k.edge(S);j.setEdge(S.v,S.w,{weight:_.weight+E.weight,minlen:Math.max(_.minlen,E.minlen)})}),j}function s(k){var j=new t({multigraph:k.isMultigraph()}).setGraph(k.graph());return e.forEach(k.nodes(),function(S){k.children(S).length||j.setNode(S,k.node(S))}),e.forEach(k.edges(),function(S){j.setEdge(S,k.edge(S))}),j}function i(k){var j=e.map(k.nodes(),function(S){var _={};return e.forEach(k.outEdges(S),function(E){_[E.w]=(_[E.w]||0)+k.edge(E).weight}),_});return e.zipObject(k.nodes(),j)}function l(k){var j=e.map(k.nodes(),function(S){var _={};return e.forEach(k.inEdges(S),function(E){_[E.v]=(_[E.v]||0)+k.edge(E).weight}),_});return e.zipObject(k.nodes(),j)}function u(k,j){var S=k.x,_=k.y,E=j.x-S,T=j.y-_,R=k.width/2,A=k.height/2;if(!E&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var B,$;return Math.abs(T)*R>Math.abs(E)*A?(T<0&&(A=-A),B=A*E/T,$=A):(E<0&&(R=-R),B=R,$=R*T/E),{x:S+B,y:_+$}}function d(k){var j=e.map(e.range(g(k)+1),function(){return[]});return e.forEach(k.nodes(),function(S){var _=k.node(S),E=_.rank;e.isUndefined(E)||(j[E][_.order]=S)}),j}function f(k){var j=e.min(e.map(k.nodes(),function(S){return k.node(S).rank}));e.forEach(k.nodes(),function(S){var _=k.node(S);e.has(_,"rank")&&(_.rank-=j)})}function h(k){var j=e.min(e.map(k.nodes(),function(T){return k.node(T).rank})),S=[];e.forEach(k.nodes(),function(T){var R=k.node(T).rank-j;S[R]||(S[R]=[]),S[R].push(T)});var _=0,E=k.graph().nodeRankFactor;e.forEach(S,function(T,R){e.isUndefined(T)&&R%E!==0?--_:_&&e.forEach(T,function(A){k.node(A).rank+=_})})}function m(k,j,S,_){var E={width:0,height:0};return arguments.length>=4&&(E.rank=S,E.order=_),n(k,"border",E,j)}function g(k){return e.max(e.map(k.nodes(),function(j){var S=k.node(j).rank;if(!e.isUndefined(S))return S}))}function w(k,j){var S={lhs:[],rhs:[]};return e.forEach(k,function(_){j(_)?S.lhs.push(_):S.rhs.push(_)}),S}function b(k,j){var S=e.now();try{return j()}finally{console.log(k+" time: "+(e.now()-S)+"ms")}}function x(k,j){return j()}return av}var ov,GT;function wZ(){if(GT)return ov;GT=1;var e=lt(),t=cn();ov={run:n,undo:s};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(l){r(i,l)})}function r(i,l){var u=l.v,d=i.node(u).rank,f=l.w,h=i.node(f).rank,m=l.name,g=i.edge(l),w=g.labelRank;if(h!==d+1){i.removeEdge(l);var b,x,k;for(k=0,++d;d<h;++k,++d)g.points=[],x={width:0,height:0,edgeLabel:g,edgeObj:l,rank:d},b=t.addDummyNode(i,"edge",x,"_d"),d===w&&(x.width=g.width,x.height=g.height,x.dummy="edge-label",x.labelpos=g.labelpos),i.setEdge(u,b,{weight:g.weight},m),k===0&&i.graph().dummyChains.push(b),u=b;i.setEdge(u,f,{weight:g.weight},m)}}function s(i){e.forEach(i.graph().dummyChains,function(l){var u=i.node(l),d=u.edgeLabel,f;for(i.setEdge(u.edgeObj,d);u.dummy;)f=i.successors(l)[0],i.removeNode(l),d.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(d.x=u.x,d.y=u.y,d.width=u.width,d.height=u.height),l=f,u=i.node(l)})}return ov}var iv,KT;function id(){if(KT)return iv;KT=1;var e=lt();iv={longestPath:t,slack:n};function t(r){var s={};function i(l){var u=r.node(l);if(e.has(s,l))return u.rank;s[l]=!0;var d=e.min(e.map(r.outEdges(l),function(f){return i(f.w)-r.edge(f).minlen}));return(d===Number.POSITIVE_INFINITY||d===void 0||d===null)&&(d=0),u.rank=d}e.forEach(r.sources(),i)}function n(r,s){return r.node(s.w).rank-r.node(s.v).rank-r.edge(s).minlen}return iv}var lv,YT;function jI(){if(YT)return lv;YT=1;var e=lt(),t=or().Graph,n=id().slack;lv=r;function r(u){var d=new t({directed:!1}),f=u.nodes()[0],h=u.nodeCount();d.setNode(f,{});for(var m,g;s(d,u)<h;)m=i(d,u),g=d.hasNode(m.v)?n(u,m):-n(u,m),l(d,u,g);return d}function s(u,d){function f(h){e.forEach(d.nodeEdges(h),function(m){var g=m.v,w=h===g?m.w:g;!u.hasNode(w)&&!n(d,m)&&(u.setNode(w,{}),u.setEdge(h,w,{}),f(w))})}return e.forEach(u.nodes(),f),u.nodeCount()}function i(u,d){return e.minBy(d.edges(),function(f){if(u.hasNode(f.v)!==u.hasNode(f.w))return n(d,f)})}function l(u,d,f){e.forEach(u.nodes(),function(h){d.node(h).rank+=f})}return lv}var cv,XT;function vZ(){if(XT)return cv;XT=1;var e=lt(),t=jI(),n=id().slack,r=id().longestPath,s=or().alg.preorder,i=or().alg.postorder,l=cn().simplify;cv=u,u.initLowLimValues=m,u.initCutValues=d,u.calcCutValue=h,u.leaveEdge=w,u.enterEdge=b,u.exchangeEdges=x;function u(_){_=l(_),r(_);var E=t(_);m(E),d(E,_);for(var T,R;T=w(E);)R=b(E,_,T),x(E,_,T,R)}function d(_,E){var T=i(_,_.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){f(_,E,R)})}function f(_,E,T){var R=_.node(T),A=R.parent;_.edge(T,A).cutvalue=h(_,E,T)}function h(_,E,T){var R=_.node(T),A=R.parent,B=!0,$=E.edge(T,A),I=0;return $||(B=!1,$=E.edge(A,T)),I=$.weight,e.forEach(E.nodeEdges(T),function(D){var F=D.v===T,W=F?D.w:D.v;if(W!==A){var M=F===B,O=E.edge(D).weight;if(I+=M?O:-O,j(_,T,W)){var L=_.edge(T,W).cutvalue;I+=M?-L:L}}}),I}function m(_,E){arguments.length<2&&(E=_.nodes()[0]),g(_,{},1,E)}function g(_,E,T,R,A){var B=T,$=_.node(R);return E[R]=!0,e.forEach(_.neighbors(R),function(I){e.has(E,I)||(T=g(_,E,T,I,R))}),$.low=B,$.lim=T++,A?$.parent=A:delete $.parent,T}function w(_){return e.find(_.edges(),function(E){return _.edge(E).cutvalue<0})}function b(_,E,T){var R=T.v,A=T.w;E.hasEdge(R,A)||(R=T.w,A=T.v);var B=_.node(R),$=_.node(A),I=B,D=!1;B.lim>$.lim&&(I=$,D=!0);var F=e.filter(E.edges(),function(W){return D===S(_,_.node(W.v),I)&&D!==S(_,_.node(W.w),I)});return e.minBy(F,function(W){return n(E,W)})}function x(_,E,T,R){var A=T.v,B=T.w;_.removeEdge(A,B),_.setEdge(R.v,R.w,{}),m(_),d(_,E),k(_,E)}function k(_,E){var T=e.find(_.nodes(),function(A){return!E.node(A).parent}),R=s(_,T);R=R.slice(1),e.forEach(R,function(A){var B=_.node(A).parent,$=E.edge(A,B),I=!1;$||($=E.edge(B,A),I=!0),E.node(A).rank=E.node(B).rank+(I?$.minlen:-$.minlen)})}function j(_,E,T){return _.hasEdge(E,T)}function S(_,E,T){return T.low<=E.lim&&E.lim<=T.lim}return cv}var uv,ZT;function xZ(){if(ZT)return uv;ZT=1;var e=id(),t=e.longestPath,n=jI(),r=vZ();uv=s;function s(d){switch(d.graph().ranker){case"network-simplex":u(d);break;case"tight-tree":l(d);break;case"longest-path":i(d);break;default:u(d)}}var i=t;function l(d){t(d),n(d)}function u(d){r(d)}return uv}var dv,JT;function bZ(){if(JT)return dv;JT=1;var e=lt();dv=t;function t(s){var i=r(s);e.forEach(s.graph().dummyChains,function(l){for(var u=s.node(l),d=u.edgeObj,f=n(s,i,d.v,d.w),h=f.path,m=f.lca,g=0,w=h[g],b=!0;l!==d.w;){if(u=s.node(l),b){for(;(w=h[g])!==m&&s.node(w).maxRank<u.rank;)g++;w===m&&(b=!1)}if(!b){for(;g<h.length-1&&s.node(w=h[g+1]).minRank<=u.rank;)g++;w=h[g]}s.setParent(l,w),l=s.successors(l)[0]}})}function n(s,i,l,u){var d=[],f=[],h=Math.min(i[l].low,i[u].low),m=Math.max(i[l].lim,i[u].lim),g,w;g=l;do g=s.parent(g),d.push(g);while(g&&(i[g].low>h||m>i[g].lim));for(w=g,g=u;(g=s.parent(g))!==w;)f.push(g);return{path:d.concat(f.reverse()),lca:w}}function r(s){var i={},l=0;function u(d){var f=l;e.forEach(s.children(d),u),i[d]={low:f,lim:l++}}return e.forEach(s.children(),u),i}return dv}var hv,QT;function kZ(){if(QT)return hv;QT=1;var e=lt(),t=cn();hv={run:n,cleanup:l};function n(u){var d=t.addDummyNode(u,"root",{},"_root"),f=s(u),h=e.max(e.values(f))-1,m=2*h+1;u.graph().nestingRoot=d,e.forEach(u.edges(),function(w){u.edge(w).minlen*=m});var g=i(u)+1;e.forEach(u.children(),function(w){r(u,d,m,g,h,f,w)}),u.graph().nodeRankFactor=m}function r(u,d,f,h,m,g,w){var b=u.children(w);if(!b.length){w!==d&&u.setEdge(d,w,{weight:0,minlen:f});return}var x=t.addBorderNode(u,"_bt"),k=t.addBorderNode(u,"_bb"),j=u.node(w);u.setParent(x,w),j.borderTop=x,u.setParent(k,w),j.borderBottom=k,e.forEach(b,function(S){r(u,d,f,h,m,g,S);var _=u.node(S),E=_.borderTop?_.borderTop:S,T=_.borderBottom?_.borderBottom:S,R=_.borderTop?h:2*h,A=E!==T?1:m-g[w]+1;u.setEdge(x,E,{weight:R,minlen:A,nestingEdge:!0}),u.setEdge(T,k,{weight:R,minlen:A,nestingEdge:!0})}),u.parent(w)||u.setEdge(d,x,{weight:0,minlen:m+g[w]})}function s(u){var d={};function f(h,m){var g=u.children(h);g&&g.length&&e.forEach(g,function(w){f(w,m+1)}),d[h]=m}return e.forEach(u.children(),function(h){f(h,1)}),d}function i(u){return e.reduce(u.edges(),function(d,f){return d+u.edge(f).weight},0)}function l(u){var d=u.graph();u.removeNode(d.nestingRoot),delete d.nestingRoot,e.forEach(u.edges(),function(f){var h=u.edge(f);h.nestingEdge&&u.removeEdge(f)})}return hv}var fv,eR;function NZ(){if(eR)return fv;eR=1;var e=lt(),t=cn();fv=n;function n(s){function i(l){var u=s.children(l),d=s.node(l);if(u.length&&e.forEach(u,i),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var f=d.minRank,h=d.maxRank+1;f<h;++f)r(s,"borderLeft","_bl",l,d,f),r(s,"borderRight","_br",l,d,f)}}e.forEach(s.children(),i)}function r(s,i,l,u,d,f){var h={width:0,height:0,rank:f,borderType:i},m=d[i][f-1],g=t.addDummyNode(s,"border",h,l);d[i][f]=g,s.setParent(g,u),m&&s.setEdge(m,g,{weight:1})}return fv}var pv,tR;function jZ(){if(tR)return pv;tR=1;var e=lt();pv={adjust:t,undo:n};function t(f){var h=f.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&r(f)}function n(f){var h=f.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&i(f),(h==="lr"||h==="rl")&&(u(f),r(f))}function r(f){e.forEach(f.nodes(),function(h){s(f.node(h))}),e.forEach(f.edges(),function(h){s(f.edge(h))})}function s(f){var h=f.width;f.width=f.height,f.height=h}function i(f){e.forEach(f.nodes(),function(h){l(f.node(h))}),e.forEach(f.edges(),function(h){var m=f.edge(h);e.forEach(m.points,l),e.has(m,"y")&&l(m)})}function l(f){f.y=-f.y}function u(f){e.forEach(f.nodes(),function(h){d(f.node(h))}),e.forEach(f.edges(),function(h){var m=f.edge(h);e.forEach(m.points,d),e.has(m,"x")&&d(m)})}function d(f){var h=f.x;f.x=f.y,f.y=h}return pv}var mv,nR;function SZ(){if(nR)return mv;nR=1;var e=lt();mv=t;function t(n){var r={},s=e.filter(n.nodes(),function(f){return!n.children(f).length}),i=e.max(e.map(s,function(f){return n.node(f).rank})),l=e.map(e.range(i+1),function(){return[]});function u(f){if(!e.has(r,f)){r[f]=!0;var h=n.node(f);l[h.rank].push(f),e.forEach(n.successors(f),u)}}var d=e.sortBy(s,function(f){return n.node(f).rank});return e.forEach(d,u),l}return mv}var gv,rR;function _Z(){if(rR)return gv;rR=1;var e=lt();gv=t;function t(r,s){for(var i=0,l=1;l<s.length;++l)i+=n(r,s[l-1],s[l]);return i}function n(r,s,i){for(var l=e.zipObject(i,e.map(i,function(g,w){return w})),u=e.flatten(e.map(s,function(g){return e.sortBy(e.map(r.outEdges(g),function(w){return{pos:l[w.w],weight:r.edge(w).weight}}),"pos")}),!0),d=1;d<i.length;)d<<=1;var f=2*d-1;d-=1;var h=e.map(new Array(f),function(){return 0}),m=0;return e.forEach(u.forEach(function(g){var w=g.pos+d;h[w]+=g.weight;for(var b=0;w>0;)w%2&&(b+=h[w+1]),w=w-1>>1,h[w]+=g.weight;m+=g.weight*b})),m}return gv}var yv,sR;function EZ(){if(sR)return yv;sR=1;var e=lt();yv=t;function t(n,r){return e.map(r,function(s){var i=n.inEdges(s);if(i.length){var l=e.reduce(i,function(u,d){var f=n.edge(d),h=n.node(d.v);return{sum:u.sum+f.weight*h.order,weight:u.weight+f.weight}},{sum:0,weight:0});return{v:s,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:s}})}return yv}var wv,aR;function CZ(){if(aR)return wv;aR=1;var e=lt();wv=t;function t(s,i){var l={};e.forEach(s,function(d,f){var h=l[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:f};e.isUndefined(d.barycenter)||(h.barycenter=d.barycenter,h.weight=d.weight)}),e.forEach(i.edges(),function(d){var f=l[d.v],h=l[d.w];!e.isUndefined(f)&&!e.isUndefined(h)&&(h.indegree++,f.out.push(l[d.w]))});var u=e.filter(l,function(d){return!d.indegree});return n(u)}function n(s){var i=[];function l(f){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(f.barycenter)||h.barycenter>=f.barycenter)&&r(f,h)}}function u(f){return function(h){h.in.push(f),--h.indegree===0&&s.push(h)}}for(;s.length;){var d=s.pop();i.push(d),e.forEach(d.in.reverse(),l(d)),e.forEach(d.out,u(d))}return e.map(e.filter(i,function(f){return!f.merged}),function(f){return e.pick(f,["vs","i","barycenter","weight"])})}function r(s,i){var l=0,u=0;s.weight&&(l+=s.barycenter*s.weight,u+=s.weight),i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),s.vs=i.vs.concat(s.vs),s.barycenter=l/u,s.weight=u,s.i=Math.min(i.i,s.i),i.merged=!0}return wv}var vv,oR;function TZ(){if(oR)return vv;oR=1;var e=lt(),t=cn();vv=n;function n(i,l){var u=t.partition(i,function(x){return e.has(x,"barycenter")}),d=u.lhs,f=e.sortBy(u.rhs,function(x){return-x.i}),h=[],m=0,g=0,w=0;d.sort(s(!!l)),w=r(h,f,w),e.forEach(d,function(x){w+=x.vs.length,h.push(x.vs),m+=x.barycenter*x.weight,g+=x.weight,w=r(h,f,w)});var b={vs:e.flatten(h,!0)};return g&&(b.barycenter=m/g,b.weight=g),b}function r(i,l,u){for(var d;l.length&&(d=e.last(l)).i<=u;)l.pop(),i.push(d.vs),u++;return u}function s(i){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:i?u.i-l.i:l.i-u.i}}return vv}var xv,iR;function RZ(){if(iR)return xv;iR=1;var e=lt(),t=EZ(),n=CZ(),r=TZ();xv=s;function s(u,d,f,h){var m=u.children(d),g=u.node(d),w=g?g.borderLeft:void 0,b=g?g.borderRight:void 0,x={};w&&(m=e.filter(m,function(T){return T!==w&&T!==b}));var k=t(u,m);e.forEach(k,function(T){if(u.children(T.v).length){var R=s(u,T.v,f,h);x[T.v]=R,e.has(R,"barycenter")&&l(T,R)}});var j=n(k,f);i(j,x);var S=r(j,h);if(w&&(S.vs=e.flatten([w,S.vs,b],!0),u.predecessors(w).length)){var _=u.node(u.predecessors(w)[0]),E=u.node(u.predecessors(b)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+_.order+E.order)/(S.weight+2),S.weight+=2}return S}function i(u,d){e.forEach(u,function(f){f.vs=e.flatten(f.vs.map(function(h){return d[h]?d[h].vs:h}),!0)})}function l(u,d){e.isUndefined(u.barycenter)?(u.barycenter=d.barycenter,u.weight=d.weight):(u.barycenter=(u.barycenter*u.weight+d.barycenter*d.weight)/(u.weight+d.weight),u.weight+=d.weight)}return xv}var bv,lR;function AZ(){if(lR)return bv;lR=1;var e=lt(),t=or().Graph;bv=n;function n(s,i,l){var u=r(s),d=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(f){return s.node(f)});return e.forEach(s.nodes(),function(f){var h=s.node(f),m=s.parent(f);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(d.setNode(f),d.setParent(f,m||u),e.forEach(s[l](f),function(g){var w=g.v===f?g.w:g.v,b=d.edge(w,f),x=e.isUndefined(b)?0:b.weight;d.setEdge(w,f,{weight:s.edge(g).weight+x})}),e.has(h,"minRank")&&d.setNode(f,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),d}function r(s){for(var i;s.hasNode(i=e.uniqueId("_root")););return i}return bv}var kv,cR;function MZ(){if(cR)return kv;cR=1;var e=lt();kv=t;function t(n,r,s){var i={},l;e.forEach(s,function(u){for(var d=n.parent(u),f,h;d;){if(f=n.parent(d),f?(h=i[f],i[f]=d):(h=l,l=d),h&&h!==d){r.setEdge(h,d);return}d=f}})}return kv}var Nv,uR;function $Z(){if(uR)return Nv;uR=1;var e=lt(),t=SZ(),n=_Z(),r=RZ(),s=AZ(),i=MZ(),l=or().Graph,u=cn();Nv=d;function d(g){var w=u.maxRank(g),b=f(g,e.range(1,w+1),"inEdges"),x=f(g,e.range(w-1,-1,-1),"outEdges"),k=t(g);m(g,k);for(var j=Number.POSITIVE_INFINITY,S,_=0,E=0;E<4;++_,++E){h(_%2?b:x,_%4>=2),k=u.buildLayerMatrix(g);var T=n(g,k);T<j&&(E=0,S=e.cloneDeep(k),j=T)}m(g,S)}function f(g,w,b){return e.map(w,function(x){return s(g,x,b)})}function h(g,w){var b=new l;e.forEach(g,function(x){var k=x.graph().root,j=r(x,k,b,w);e.forEach(j.vs,function(S,_){x.node(S).order=_}),i(x,b,j.vs)})}function m(g,w){e.forEach(w,function(b){e.forEach(b,function(x,k){g.node(x).order=k})})}return Nv}var jv,dR;function IZ(){if(dR)return jv;dR=1;var e=lt(),t=or().Graph,n=cn();jv={positionX:b,findType1Conflicts:r,findType2Conflicts:s,addConflict:l,hasConflict:u,verticalAlignment:d,horizontalCompaction:f,alignCoordinates:g,findSmallestWidthAlignment:m,balance:w};function r(j,S){var _={};function E(T,R){var A=0,B=0,$=T.length,I=e.last(R);return e.forEach(R,function(D,F){var W=i(j,D),M=W?j.node(W).order:$;(W||D===I)&&(e.forEach(R.slice(B,F+1),function(O){e.forEach(j.predecessors(O),function(L){var K=j.node(L),Z=K.order;(Z<A||M<Z)&&!(K.dummy&&j.node(O).dummy)&&l(_,L,O)})}),B=F+1,A=M)}),R}return e.reduce(S,E),_}function s(j,S){var _={};function E(R,A,B,$,I){var D;e.forEach(e.range(A,B),function(F){D=R[F],j.node(D).dummy&&e.forEach(j.predecessors(D),function(W){var M=j.node(W);M.dummy&&(M.order<$||M.order>I)&&l(_,W,D)})})}function T(R,A){var B=-1,$,I=0;return e.forEach(A,function(D,F){if(j.node(D).dummy==="border"){var W=j.predecessors(D);W.length&&($=j.node(W[0]).order,E(A,I,F,B,$),I=F,B=$)}E(A,I,A.length,$,R.length)}),A}return e.reduce(S,T),_}function i(j,S){if(j.node(S).dummy)return e.find(j.predecessors(S),function(_){return j.node(_).dummy})}function l(j,S,_){if(S>_){var E=S;S=_,_=E}var T=j[S];T||(j[S]=T={}),T[_]=!0}function u(j,S,_){if(S>_){var E=S;S=_,_=E}return e.has(j[S],_)}function d(j,S,_,E){var T={},R={},A={};return e.forEach(S,function(B){e.forEach(B,function($,I){T[$]=$,R[$]=$,A[$]=I})}),e.forEach(S,function(B){var $=-1;e.forEach(B,function(I){var D=E(I);if(D.length){D=e.sortBy(D,function(L){return A[L]});for(var F=(D.length-1)/2,W=Math.floor(F),M=Math.ceil(F);W<=M;++W){var O=D[W];R[I]===I&&$<A[O]&&!u(_,I,O)&&(R[O]=I,R[I]=T[I]=T[O],$=A[O])}}})}),{root:T,align:R}}function f(j,S,_,E,T){var R={},A=h(j,S,_,T),B=T?"borderLeft":"borderRight";function $(F,W){for(var M=A.nodes(),O=M.pop(),L={};O;)L[O]?F(O):(L[O]=!0,M.push(O),M=M.concat(W(O))),O=M.pop()}function I(F){R[F]=A.inEdges(F).reduce(function(W,M){return Math.max(W,R[M.v]+A.edge(M))},0)}function D(F){var W=A.outEdges(F).reduce(function(O,L){return Math.min(O,R[L.w]-A.edge(L))},Number.POSITIVE_INFINITY),M=j.node(F);W!==Number.POSITIVE_INFINITY&&M.borderType!==B&&(R[F]=Math.max(R[F],W))}return $(I,A.predecessors.bind(A)),$(D,A.successors.bind(A)),e.forEach(E,function(F){R[F]=R[_[F]]}),R}function h(j,S,_,E){var T=new t,R=j.graph(),A=x(R.nodesep,R.edgesep,E);return e.forEach(S,function(B){var $;e.forEach(B,function(I){var D=_[I];if(T.setNode(D),$){var F=_[$],W=T.edge(F,D);T.setEdge(F,D,Math.max(A(j,I,$),W||0))}$=I})}),T}function m(j,S){return e.minBy(e.values(S),function(_){var E=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(_,function(R,A){var B=k(j,A)/2;E=Math.max(R+B,E),T=Math.min(R-B,T)}),E-T})}function g(j,S){var _=e.values(S),E=e.min(_),T=e.max(_);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function(A){var B=R+A,$=j[B],I;if($!==S){var D=e.values($);I=A==="l"?E-e.min(D):T-e.max(D),I&&(j[B]=e.mapValues($,function(F){return F+I}))}})})}function w(j,S){return e.mapValues(j.ul,function(_,E){if(S)return j[S.toLowerCase()][E];var T=e.sortBy(e.map(j,E));return(T[1]+T[2])/2})}function b(j){var S=n.buildLayerMatrix(j),_=e.merge(r(j,S),s(j,S)),E={},T;e.forEach(["u","d"],function(A){T=A==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(B){B==="r"&&(T=e.map(T,function(F){return e.values(F).reverse()}));var $=(A==="u"?j.predecessors:j.successors).bind(j),I=d(j,T,_,$),D=f(j,T,I.root,I.align,B==="r");B==="r"&&(D=e.mapValues(D,function(F){return-F})),E[A+B]=D})});var R=m(j,E);return g(E,R),w(E,j.graph().align)}function x(j,S,_){return function(E,T,R){var A=E.node(T),B=E.node(R),$=0,I;if($+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":I=-A.width/2;break;case"r":I=A.width/2;break}if(I&&($+=_?I:-I),I=0,$+=(A.dummy?S:j)/2,$+=(B.dummy?S:j)/2,$+=B.width/2,e.has(B,"labelpos"))switch(B.labelpos.toLowerCase()){case"l":I=B.width/2;break;case"r":I=-B.width/2;break}return I&&($+=_?I:-I),I=0,$}}function k(j,S){return j.node(S).width}return jv}var Sv,hR;function OZ(){if(hR)return Sv;hR=1;var e=lt(),t=cn(),n=IZ().positionX;Sv=r;function r(i){i=t.asNonCompoundGraph(i),s(i),e.forEach(n(i),function(l,u){i.node(u).x=l})}function s(i){var l=t.buildLayerMatrix(i),u=i.graph().ranksep,d=0;e.forEach(l,function(f){var h=e.max(e.map(f,function(m){return i.node(m).height}));e.forEach(f,function(m){i.node(m).y=d+h/2}),d+=h+u})}return Sv}var _v,fR;function LZ(){if(fR)return _v;fR=1;var e=lt(),t=yZ(),n=wZ(),r=xZ(),s=cn().normalizeRanks,i=bZ(),l=cn().removeEmptyRanks,u=kZ(),d=NZ(),f=jZ(),h=$Z(),m=OZ(),g=cn(),w=or().Graph;_v=b;function b(z,X){var V=X&&X.debugTiming?g.time:g.notime;V("layout",function(){var J=V(" buildLayoutGraph",function(){return $(z)});V(" runLayout",function(){x(J,V)}),V(" updateInputGraph",function(){k(z,J)})})}function x(z,X){X(" makeSpaceForEdgeLabels",function(){I(z)}),X(" removeSelfEdges",function(){q(z)}),X(" acyclic",function(){t.run(z)}),X(" nestingGraph.run",function(){u.run(z)}),X(" rank",function(){r(g.asNonCompoundGraph(z))}),X(" injectEdgeLabelProxies",function(){D(z)}),X(" removeEmptyRanks",function(){l(z)}),X(" nestingGraph.cleanup",function(){u.cleanup(z)}),X(" normalizeRanks",function(){s(z)}),X(" assignRankMinMax",function(){F(z)}),X(" removeEdgeLabelProxies",function(){W(z)}),X(" normalize.run",function(){n.run(z)}),X(" parentDummyChains",function(){i(z)}),X(" addBorderSegments",function(){d(z)}),X(" order",function(){h(z)}),X(" insertSelfEdges",function(){H(z)}),X(" adjustCoordinateSystem",function(){f.adjust(z)}),X(" position",function(){m(z)}),X(" positionSelfEdges",function(){P(z)}),X(" removeBorderNodes",function(){Z(z)}),X(" normalize.undo",function(){n.undo(z)}),X(" fixupEdgeLabelCoords",function(){L(z)}),X(" undoCoordinateSystem",function(){f.undo(z)}),X(" translateGraph",function(){M(z)}),X(" assignNodeIntersects",function(){O(z)}),X(" reversePoints",function(){K(z)}),X(" acyclic.undo",function(){t.undo(z)})}function k(z,X){e.forEach(z.nodes(),function(V){var J=z.node(V),ee=X.node(V);J&&(J.x=ee.x,J.y=ee.y,X.children(V).length&&(J.width=ee.width,J.height=ee.height))}),e.forEach(z.edges(),function(V){var J=z.edge(V),ee=X.edge(V);J.points=ee.points,e.has(ee,"x")&&(J.x=ee.x,J.y=ee.y)}),z.graph().width=X.graph().width,z.graph().height=X.graph().height}var j=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},_=["acyclicer","ranker","rankdir","align"],E=["width","height"],T={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},B=["labelpos"];function $(z){var X=new w({multigraph:!0,compound:!0}),V=G(z.graph());return X.setGraph(e.merge({},S,Y(V,j),e.pick(V,_))),e.forEach(z.nodes(),function(J){var ee=G(z.node(J));X.setNode(J,e.defaults(Y(ee,E),T)),X.setParent(J,z.parent(J))}),e.forEach(z.edges(),function(J){var ee=G(z.edge(J));X.setEdge(J,e.merge({},A,Y(ee,R),e.pick(ee,B)))}),X}function I(z){var X=z.graph();X.ranksep/=2,e.forEach(z.edges(),function(V){var J=z.edge(V);J.minlen*=2,J.labelpos.toLowerCase()!=="c"&&(X.rankdir==="TB"||X.rankdir==="BT"?J.width+=J.labeloffset:J.height+=J.labeloffset)})}function D(z){e.forEach(z.edges(),function(X){var V=z.edge(X);if(V.width&&V.height){var J=z.node(X.v),ee=z.node(X.w),re={rank:(ee.rank-J.rank)/2+J.rank,e:X};g.addDummyNode(z,"edge-proxy",re,"_ep")}})}function F(z){var X=0;e.forEach(z.nodes(),function(V){var J=z.node(V);J.borderTop&&(J.minRank=z.node(J.borderTop).rank,J.maxRank=z.node(J.borderBottom).rank,X=e.max(X,J.maxRank))}),z.graph().maxRank=X}function W(z){e.forEach(z.nodes(),function(X){var V=z.node(X);V.dummy==="edge-proxy"&&(z.edge(V.e).labelRank=V.rank,z.removeNode(X))})}function M(z){var X=Number.POSITIVE_INFINITY,V=0,J=Number.POSITIVE_INFINITY,ee=0,re=z.graph(),oe=re.marginx||0,fe=re.marginy||0;function Ne(we){var ye=we.x,ve=we.y,Ie=we.width,xe=we.height;X=Math.min(X,ye-Ie/2),V=Math.max(V,ye+Ie/2),J=Math.min(J,ve-xe/2),ee=Math.max(ee,ve+xe/2)}e.forEach(z.nodes(),function(we){Ne(z.node(we))}),e.forEach(z.edges(),function(we){var ye=z.edge(we);e.has(ye,"x")&&Ne(ye)}),X-=oe,J-=fe,e.forEach(z.nodes(),function(we){var ye=z.node(we);ye.x-=X,ye.y-=J}),e.forEach(z.edges(),function(we){var ye=z.edge(we);e.forEach(ye.points,function(ve){ve.x-=X,ve.y-=J}),e.has(ye,"x")&&(ye.x-=X),e.has(ye,"y")&&(ye.y-=J)}),re.width=V-X+oe,re.height=ee-J+fe}function O(z){e.forEach(z.edges(),function(X){var V=z.edge(X),J=z.node(X.v),ee=z.node(X.w),re,oe;V.points?(re=V.points[0],oe=V.points[V.points.length-1]):(V.points=[],re=ee,oe=J),V.points.unshift(g.intersectRect(J,re)),V.points.push(g.intersectRect(ee,oe))})}function L(z){e.forEach(z.edges(),function(X){var V=z.edge(X);if(e.has(V,"x"))switch((V.labelpos==="l"||V.labelpos==="r")&&(V.width-=V.labeloffset),V.labelpos){case"l":V.x-=V.width/2+V.labeloffset;break;case"r":V.x+=V.width/2+V.labeloffset;break}})}function K(z){e.forEach(z.edges(),function(X){var V=z.edge(X);V.reversed&&V.points.reverse()})}function Z(z){e.forEach(z.nodes(),function(X){if(z.children(X).length){var V=z.node(X),J=z.node(V.borderTop),ee=z.node(V.borderBottom),re=z.node(e.last(V.borderLeft)),oe=z.node(e.last(V.borderRight));V.width=Math.abs(oe.x-re.x),V.height=Math.abs(ee.y-J.y),V.x=re.x+V.width/2,V.y=J.y+V.height/2}}),e.forEach(z.nodes(),function(X){z.node(X).dummy==="border"&&z.removeNode(X)})}function q(z){e.forEach(z.edges(),function(X){if(X.v===X.w){var V=z.node(X.v);V.selfEdges||(V.selfEdges=[]),V.selfEdges.push({e:X,label:z.edge(X)}),z.removeEdge(X)}})}function H(z){var X=g.buildLayerMatrix(z);e.forEach(X,function(V){var J=0;e.forEach(V,function(ee,re){var oe=z.node(ee);oe.order=re+J,e.forEach(oe.selfEdges,function(fe){g.addDummyNode(z,"selfedge",{width:fe.label.width,height:fe.label.height,rank:oe.rank,order:re+ ++J,e:fe.e,label:fe.label},"_se")}),delete oe.selfEdges})})}function P(z){e.forEach(z.nodes(),function(X){var V=z.node(X);if(V.dummy==="selfedge"){var J=z.node(V.e.v),ee=J.x+J.width/2,re=J.y,oe=V.x-ee,fe=J.height/2;z.setEdge(V.e,V.label),z.removeNode(X),V.label.points=[{x:ee+2*oe/3,y:re-fe},{x:ee+5*oe/6,y:re-fe},{x:ee+oe,y:re},{x:ee+5*oe/6,y:re+fe},{x:ee+2*oe/3,y:re+fe}],V.label.x=V.x,V.label.y=V.y}})}function Y(z,X){return e.mapValues(e.pick(z,X),Number)}function G(z){var X={};return e.forEach(z,function(V,J){X[J.toLowerCase()]=V}),X}return _v}var Ev,pR;function PZ(){if(pR)return Ev;pR=1;var e=lt(),t=cn(),n=or().Graph;Ev={debugOrdering:r};function r(s){var i=t.buildLayerMatrix(s),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(s.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+s.node(u).rank)}),e.forEach(s.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(i,function(u,d){var f="layer"+d;l.setNode(f,{rank:"same"}),e.reduce(u,function(h,m){return l.setEdge(h,m,{style:"invis"}),m})}),l}return Ev}var Cv,mR;function DZ(){return mR||(mR=1,Cv="0.8.5"),Cv}var Tv,gR;function FZ(){return gR||(gR=1,Tv={graphlib:or(),layout:LZ(),debug:PZ(),util:{time:cn().time,notime:cn().notime},version:DZ()}),Tv}var qZ=FZ();const yR=Lx(qZ),ld=240,SI=130,Cx=Ea*2+sx+uM,BZ=72,Ho=Cx+BZ,Lu=24,_I=Ea*2+Lu,cd=Ho;function EI(e,t){var r;let n=ld;for(const s of e)n=Math.max(n,((r=t.get(s.id))==null?void 0:r.width)??ld);return n}const ud=420,CI=1;function UZ(e,t,n,r){return Math.min(CI,n/Math.max(1,e),r/Math.max(1,t))}function th(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function nh(e,t=()=>!0){const n=new Map;for(const r of e){if(!t(r))continue;const s=th(r),i=n.get(s);i?i.push(r):n.set(s,[r])}return n}function zZ(e,t){return((t==null?void 0:t.get(e))??0)>0?ud:0}function HZ(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function dd(e,t){const n=t.get(e);return{w:(n==null?void 0:n.width)??ld,h:(n==null?void 0:n.height)??SI}}function $l(e,t,n){const r=dd(e,t);return{w:r.w+zZ(e,n),h:Math.max(r.h,HZ(e,n))}}function WZ(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function VZ(e,t,n){const r=nh(e,s=>!t.has(s.id)&&n(s.id)!=null);if(r.size===0)return e;for(const s of r.values())s.sort((i,l)=>i.id.localeCompare(l.id));return e.map(s=>{var f;if(t.has(s.id)||n(s.id))return s;const i=r.get(th(s));if(!i)return s;const l=(f=s.data)==null?void 0:f.parentId,u=i.find(h=>h.id===l)??i[0],d=n(u.id);return{...s,position:{x:s.position.x+d.x-u.position.x,y:s.position.y+d.y-u.position.y}}})}function GZ(e,t,n,r,s,i,l){const u=_=>$l(_,r,i),d=_=>n.get(_)??t.get(_),f=_=>{const{w:E,h:T}=dd(_,r);return{cw:E,ch:T}},h=l!=null&&l.width>0&&l.height>0,m=nh(e,_=>d(_.id)!=null),g=new Set;for(const[_,E]of m)E.every(T=>s.has(T.id)&&!n.has(T.id))&&g.add(_);const w=new Map,b=[];for(const _ of e){const E=d(_.id);if(!E)continue;const{w:T,h:R}=u(_.id),A=th(_);g.has(A)?(w.get(A)??w.set(A,[]).get(A)).push(_):b.push({x:E.x,y:E.y,w:T,h:R,...f(_.id)})}if(w.size===0||h&&b.length===0)return[];const x=cd,k=(_,E,T,R)=>b.some(A=>_<A.x+A.w+Cx&&A.x<_+T+Cx&&E<A.y+A.h+x&&A.y<E+R+x),j=EI(e,r),S=[];for(const _ of[...w.keys()].sort()){const E=w.get(_);let T=1/0,R=1/0,A=-1/0,B=-1/0,$=-1/0,I=-1/0;for(const K of E){const Z=d(K.id),{w:q,h:H}=u(K.id),{cw:P,ch:Y}=f(K.id);T=Math.min(T,Z.x),R=Math.min(R,Z.y),A=Math.max(A,Z.x+q),B=Math.max(B,Z.y+H),$=Math.max($,Z.x+P),I=Math.max(I,Z.y+Y)}const D=A-T,F=B-R,W=[...new Set(b.map(K=>Math.round(K.x)))].sort((K,Z)=>K-Z),M=W.length?W:[T],O=[0,...b.map(K=>K.y+K.h+x)].sort((K,Z)=>K-Z);let L=null;if(h){let K=1/0,Z=1/0,q=-1/0,H=-1/0;for(const V of b)K=Math.min(K,V.x),Z=Math.min(Z,V.y),q=Math.max(q,V.x+V.cw),H=Math.max(H,V.y+V.ch);const P=(V,J)=>{const ee=l.width/(Math.max(q,V+$-T)-Math.min(K,V)+ud),re=l.height/(Math.max(H,J+I-R)-Math.min(Z,J));return[Math.min(CI,ee,re),Math.min(ee,re),Math.max(ee,re)]},Y=(V,J)=>{for(let ee=0;ee<V.length;ee++){if(V[ee]>J[ee]+1e-9)return!0;if(V[ee]<J[ee]-1e-9)return!1}return!1},G=Math.round(q+ud+j),z=[...new Set([...O,Z])].sort((V,J)=>V-J);let X=null;for(const V of[...M,G])for(const J of z){if(k(V,J,D,F))continue;const ee=P(V,J);(X===null||Y(ee,X))&&(X=ee,L={x:V,y:J})}L&&L.x===T&&L.y===R&&(L=null)}else e:for(const K of M)for(const Z of O){if(Z>=R)break;if(!k(K,Z,D,F)){L={x:K,y:Z};break e}}if(L){const K=L.x-T,Z=L.y-R;for(const q of E){const H=d(q.id);t.set(q.id,{x:H.x+K,y:H.y+Z})}S.push(_)}for(const K of E){const Z=d(K.id),{w:q,h:H}=u(K.id);b.push({x:Z.x,y:Z.y,w:q,h:H,...f(K.id)})}}return S}function KZ(e,t,n,r,s,i){const l=g=>$l(g,r,s),u=new Map(e.map(g=>[g.id,th(g)])),d=[],f=e.map(g=>({id:g.id,pos:n.get(g.id)??t.get(g.id)})).filter(g=>g.pos!=null).sort((g,w)=>g.pos.y-w.pos.y||g.pos.x-w.pos.x||g.id.localeCompare(w.id)),h=g=>(i==null?void 0:i.has(g))===!0&&!n.has(g);for(const{id:g,pos:w}of f){if(!h(g))continue;const{w:b,h:x}=l(g);d.push({x:w.x,y:w.y,w:b,h:x,sid:u.get(g)??"_default"})}const m=[];for(const{id:g,pos:w}of f){if(h(g))continue;const{w:b,h:x}=l(g),k=u.get(g)??"_default";if(n.has(g)){d.push({x:w.x,y:w.y,w:b,h:x,sid:k});continue}let j=w.y;for(let S=0;S<d.length+1;S++){const _=d.find(E=>{const T=E.sid===k?Lu:_I,R=E.sid===k?Lu:cd;return w.x<E.x+E.w+T&&E.x<w.x+b+T&&j<E.y+E.h+R&&E.y<j+x+R});if(!_)break;j=_.y+_.h+(_.sid===k?Lu:cd)}j!==w.y&&(t.set(g,{x:w.x,y:j}),m.push(g)),d.push({x:w.x,y:j,w:b,h:x,sid:k})}return m}function YZ(e,t,n,r,s,i=!1,l){const d=_I+1,f=cd+1,h=8,m=1.75,g=200,w=.7,b=.01,x=I=>$l(I,r,l),k=I=>n.get(I)??t.get(I),j=nh(e,I=>k(I.id)!=null),S=[],_=new Set,E=new Set,T=s.size===0;for(const I of[...j.keys()].sort()){const D=j.get(I);let F=1/0,W=1/0,M=-1/0,O=-1/0,L=!1;for(const H of D){const P=k(H.id),{w:Y,h:G}=x(H.id);F=Math.min(F,P.x),W=Math.min(W,P.y),M=Math.max(M,P.x+Y),O=Math.max(O,P.y+G),n.has(H.id)&&(L=!0)}const K=M-F,Z=O-W;E.add(I);const q=s.get(I);q&&(K>q.w+h||Z>q.h+h)&&_.add(I),s.set(I,{w:K,h:Z}),S.push({sid:I,members:D.map(H=>H.id),x:F,y:W,w:K,h:Z,anchored:L,mass:1})}for(const I of[...s.keys()])E.has(I)||s.delete(I);if(i||T)return[];let R=!1;for(let I=0;I<S.length&&!R;I++)for(let D=I+1;D<S.length;D++){const F=S[I],W=S[D];if(!(F.anchored&&W.anchored)&&Math.abs(F.x+F.w/2-(W.x+W.w/2))<(F.w+W.w)/2+d&&Math.abs(F.y+F.h/2-(W.y+W.h/2))<(F.h+W.h)/2+f){R=!0;break}}if(_.size===0&&!R)return[];if(_.size>0)for(const I of S)_.has(I.sid)&&(I.mass=8);else for(const I of S)I.mass=Math.max(1,I.w*I.h/(ld*SI));const A=new Map(S.map(I=>[I.sid,I.x])),B=new Map(S.map(I=>[I.sid,I.y]));for(let I=0;I<g;I++){const D=new Map,F=new Map;let W=0;for(let M=0;M<S.length;M++)for(let O=M+1;O<S.length;O++){const L=S[M],K=S[O];if(L.anchored&&K.anchored)continue;const Z=L.x+L.w/2,q=L.y+L.h/2,H=K.x+K.w/2,P=K.y+K.h/2,Y=(L.w+K.w)/2+d-Math.abs(Z-H),G=(L.h+K.h)/2+f-Math.abs(q-P);if(Y<=0||G<=0)continue;const z=($e,Oe)=>!$e.anchored&&!(Oe<0&&$e.x<=0),X=($e,Oe)=>!$e.anchored&&!(Oe<0&&$e.y<=0),V=($e,Oe,Xe)=>{const Ge=$e===Oe,Ze=Ge?L.sid<K.sid?-1:1:Math.sign($e-Oe);return Xe(L,Ze)||Xe(K,-Ze)?Ze:Ge&&(Xe(L,-Ze)||Xe(K,Ze))?-Ze:0},J=V(Z,H,z),ee=V(q,P,X),re=J!==0,oe=ee!==0;if(!re&&!oe)continue;const fe=re&&(!oe||Y*m<G),[Ne,we,ye,ve]=fe?[J,Y,D,z]:[ee,G,F,X],Ie=ve(L,Ne),xe=ve(K,-Ne),ue=L.mass,se=K.mass,be=Ie?xe?se/(ue+se):1:0,Te=xe?Ie?ue/(ue+se):1:0,Le=we*w;ye.set(L.sid,(ye.get(L.sid)??0)+Ne*Le*be),ye.set(K.sid,(ye.get(K.sid)??0)-Ne*Le*Te),W+=Le}for(const M of S)M.anchored||(M.x=Math.max(0,M.x+(D.get(M.sid)??0)),M.y=Math.max(0,M.y+(F.get(M.sid)??0)));if(W<b)break}const $=[];for(const I of S){const D=I.x-A.get(I.sid),F=I.y-B.get(I.sid);if(!(Math.abs(D)<1&&Math.abs(F)<1)){for(const W of I.members){if(n.has(W))continue;const M=t.get(W);M&&t.set(W,{x:M.x+D,y:M.y+F})}$.push(I.sid)}}return $}function XZ(e,t,n,r,s,i){const l=new yR.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(j=>!s.has(j)),d=new Set(u);for(const j of u){const{w:S,h:_}=$l(j,r,i);l.setNode(j,{width:S,height:_})}for(const j of t)d.has(j.source)&&d.has(j.target)&&l.setEdge(j.source,j.target);yR.layout(l);const f=new Map;let h=1/0,m=1/0,g=-1/0,w=-1/0;for(const j of u){const S=l.node(j);if(!S)continue;const{w:_,h:E}=dd(j,r),T=$l(j,r,i),R=S.x-T.w/2,A=S.y-T.h/2;f.set(j,{x:R,y:A}),R<h&&(h=R),A<m&&(m=A),R+_>g&&(g=R+_),A+E>w&&(w=A+E)}if(Number.isFinite(h)&&Number.isFinite(m))for(const[j,S]of f)f.set(j,{x:S.x-h,y:S.y-m});const b=Number.isFinite(g)?g-h:0,x=Number.isFinite(w)?w-m:0;let k=null;for(const j of e){const S=s.get(j);if(!S)continue;const{w:_,h:E}=dd(j,r);k=k===null?{minX:S.x,minY:S.y,maxX:S.x+_,maxY:S.y+E}:{minX:Math.min(k.minX,S.x),minY:Math.min(k.minY,S.y),maxX:Math.max(k.maxX,S.x+_),maxY:Math.max(k.maxY,S.y+E)}}return{positions:f,width:b,height:x,pinnedBox:k}}function TI(e,t,n){const r=n.direction??"LR",s=n.pinned??new Map,i=n.measured??new Map,l=n.lanes,u=nh(e);return{laid:Array.from(u.keys()).sort().map(h=>({sid:h,...XZ(u.get(h).map(m=>m.id),t,r,i,s,l)})),gap:EI(e,i)}}const RI=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+ud,ZZ=e=>e.reduce((t,n)=>t+n.height,0)+Ho*Math.max(0,e.length-1);function Tx(e,t,n,r){const s=d=>{const f=[[]];let h=0;for(const m of e)h>0&&h+m.height>d&&(f.push([]),h=0),f[f.length-1].push(m),h+=m.height+Ho;return f},i=[];for(let d=0;d<e.length;d++){let f=-Ho;for(let h=d;h<e.length;h++)i.push(f+=e[h].height+Ho)}i.sort((d,f)=>d-f);const l=d=>{let f=0,h=i.length-1;for(;f<h;){const m=f+h>>1;s(i[m]).length<=d?h=m:f=m+1}return s(i[f])};let u=[e];if(n>0&&r>0){const d=h=>UZ(h.reduce((m,g)=>m+RI(g),0)+t*(h.length-1),Math.max(...h.map(ZZ)),n,r);let f=d(u);for(let h=2;h<=e.length;h++){const m=l(h),g=d(m);g>f+1e-9&&(f=g,u=m)}}return u}function JZ(e,t,n,r,s){if(!(r.width>0&&r.height>0&&s.width>0&&s.height>0))return!1;const{laid:i,gap:l}=TI(e,t,n);return i.length<2?!1:Tx(i,l,r.width,r.height).length!==Tx(i,l,s.width,s.height).length}function QZ(e,t,n={}){const r=n.pinned??new Map,{laid:s,gap:i}=TI(e,t,n),l=Tx(s,i,n.availableWidth??0,n.availableHeight??0),u=new Map;let d=0;for(const f of l){const h=RI(f);let m=0;for(const{positions:g,height:w,pinnedBox:b}of f){for(const[k,j]of g)u.set(k,{x:j.x+d,y:j.y+m});let x=m+w;b&&b.maxY>x&&b.minX<d+h&&d<b.maxX&&(x=b.maxY),m=x+Ho}d+=h+i}return e.map(f=>{const h=r.get(f.id);if(h)return{...f,position:h};const m=u.get(f.id);return m?{...f,position:m}:f})}function Pu(e,t,n){return!t.has(e)||n.has(e)}function eJ(e,t,n,r){return!t.has(e)&&Pu(e,n,r)}function tJ(e,t,n){const r={x:0,y:0};return t.set(e,r),n.add(e),r}function wR(e,t,n,r){n.set(e,t),r.delete(e)}const nJ=300,vR=130,rJ=160,xR=new WeakMap;function sJ(e,t){let n=xR.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map,branches:s8(e.agents.values())},xR.set(e,n));const{byId:r,branches:s}=n;return i=>{let l=r.get(i.id);if(!l){const u=i.kind==="root"?s.get(i.sessionId):void 0;l=u?{...i,onOpenContext:t,branch:u}:{...i,onOpenContext:t},r.set(i.id,l)}return l}}function Z0(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 aJ(e,t,n,r,s,i,l,u,d,f,h,m,g,w,b,x,k,j,S,_){var L,K,Z,q;const E=[],T=[],R=sJ(e,j);for(const H of e.agents.values()){if(!k.has(H.id))continue;const P=H.exitAt!=null,Y=x!=null&&!x.has(H.id),G=[P?"rf-exiting":"",Y?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,z=i.get(H.id);if(E.push({id:H.id,type:"agent",position:{x:0,y:0},data:R(H),className:G,ariaLabel:vq(H,t,b.has(H.id)),...z?{width:z.width,height:z.height}:null}),H.parentId&&k.has(H.parentId)){const J=Yu(H.sessionId),ee=P,re=b.size>0&&(b.has(H.id)||b.has(H.parentId)),oe=x!=null&&!x.has(H.id)&&!x.has(H.parentId),fe=H.state==="active"?2:1.5,Ne=re?fe+1.5:fe,we=ee?.2:oe?.12:1,ye=["sess-edge",H.state==="active"?"sess-live":"sess-idle",ee?"rf-edge-exiting":"",re?"rf-edge-selected":""].filter(Boolean).join(" ");T.push({id:`e:${H.parentId}->${H.id}`,source:H.parentId,target:H.id,animated:(H.state==="active"||re)&&!ee,type:"smoothstep",style:{"--session-hue":J,strokeWidth:`calc(${Ne}px * var(--edge-k, 1))`,opacity:we,transition:"var(--edge-transition)"},className:ye})}const X=H.kind==="root"?Sd(H):null,V=X?GA(H.sessionId,X.at):null;if(X&&V&&!Jq(V)){const J=d0(H.id),ee=Yu(H.sessionId),re=i.get(J);E.push({id:J,type:"recapNote",position:{x:0,y:0},data:{sessionId:H.sessionId,parentId:H.id,recap:X,noteKey:V,hue:ee},className:Y?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${H.label}`,...re?{width:re.width,height:re.height}:null}),T.push({id:`e:recap:${H.id}`,source:J,target:H.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":ee}})}}const A=Z0(e),B=_.size>0&&!(d&&S);B||_.clear();const $=`${g}#lanes:${WZ(A)}${B?"#held":""}`,I=new Set(E.filter(H=>H.type==="recapNote").map(H=>H.id));for(const H of Array.from(h.keys()))S&&n8(H)&&!I.has(H)&&!s.has(H)&&(h.delete(H),m.delete(H));const D=E.filter(H=>eJ(H.id,s,h,m));if(D.length>0||$!==w.current){if(D.length>0){for(const P of D)_.delete(P.id);const H=VZ(QZ(E,T,{direction:"LR",pinned:s,measured:i,availableWidth:n,availableHeight:r,lanes:A}),s,P=>Pu(P,h,m)?void 0:h.get(P));for(const P of H)Pu(P.id,h,m)&&wR(P.id,P.position,h,m);GZ(E,h,s,i,new Set(D.filter(P=>P.type!=="recapNote").map(P=>P.id)),A,{width:n,height:r});for(const P of D){if(P.type!=="recapNote")continue;const Y=(L=P.data)==null?void 0:L.parentId;if(!Y)continue;const G=s.get(Y)??(Pu(Y,h,m)?void 0:h.get(Y));if(!G)continue;const z=((K=i.get(P.id))==null?void 0:K.width)??nJ,X=((Z=i.get(P.id))==null?void 0:Z.height)??vR,V=((q=i.get(Y))==null?void 0:q.height)??vR;wR(P.id,{x:G.x-rJ-z,y:G.y+(V-X)/2},h,m)}}KZ(E,h,s,i,A,B?_:void 0),w.current=$}const F=YZ(E,h,s,i,l,!d||f,A);F.length>0&&u(F);const W=bK(e.agents.values());S&&xu(h,W),xu(m,W),S&&xu(s,W),xu(i,xK(e.agents.values()));const M=[];let O=!1;for(const H of E){let P=s.get(H.id)??h.get(H.id);P||(P=tJ(H.id,h,m),O=!0),M.push({...H,position:P})}return O&&(w.current=""),{nodes:M,edges:T}}function oJ(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function iJ(e,t,n){var l;if(e.length===0)return null;const r=oJ(e),s=t?r.findIndex(u=>u.id===t):-1,i=s===-1?n===1?0:r.length-1:(s+n+r.length)%r.length;return((l=r[i])==null?void 0:l.id)??null}const lJ=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Backspace"]);function cJ(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:lJ.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const uJ=new Set(["","BODY","HTML","#DOCUMENT"]);function dJ(e){return!e||jd(e)?!1:!uJ.has(String(e.tagName??"").toUpperCase())}const AI="react-flow__node";function J0(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,AI))===!0}function hJ(e){try{const t=document.querySelector(`.${AI}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}let Ma=null,Do=null;const Rx=new Set,Ax=()=>{for(const e of Rx)e()},fJ=e=>(Rx.add(e),()=>{Rx.delete(e)}),bR=()=>Ma,pJ=90;function MI(e){!Do||e!=null&&Do.at.id!==e||(clearTimeout(Do.timer),Do=null)}function $I(e,t,n="pointer"){MI();const r={id:e,anchor:t,by:n};if(Ma||n==="focus"){Ma=r,Ax();return}Do={at:r,timer:setTimeout(()=>{Do=null,Ma=r,Ax()},pJ)}}function Vs(e){MI(e),!(!Ma||e!=null&&Ma.id!==e)&&(Ma=null,Ax())}function mJ({agentFor:e,recapFor:t,labelFor:n,bounds:r}){const s=v.useSyncExternalStore(fJ,bR,bR),i=s?e(s.id):void 0,l=s&&!i?t(s.id):void 0,u=s!=null&&(!i&&!l||!s.anchor.isConnected);return v.useEffect(()=>{u&&s&&Vs(s.id)},[u,s]),!s||u?null:i?a.jsx(yJ,{a:i,anchor:s.anchor,parentLabel:i.parentId?n(i.parentId):void 0,bounds:r},s.id):l?a.jsx(gJ,{r:l,anchor:s.anchor,bounds:r},s.id):null}function II(e,t){const n=v.useRef(null),r=v.useCallback(()=>{const s=n.current;if(!s||!e.isConnected)return;const i=v0(e.getBoundingClientRect(),{width:s.offsetWidth,height:s.offsetHeight},t());s.style.top=`${i.top}px`,s.style.left=`${i.left}px`,s.style.maxHeight=i.maxHeight==null?"":`${i.maxHeight}px`,s.dataset.side=i.side},[e,t]);return v.useLayoutEffect(()=>{r()}),n}function gJ({r:e,anchor:t,bounds:n}){const r=II(t,n),s=li(3e4),i=Qu(e.recap.at,s);return It.createPortal(a.jsxs("div",{ref:r,className:"ap-peek node-peek recap-peek",role:"tooltip",id:"node-peek",style:{"--session-hue":e.hue},children:[a.jsxs("div",{className:"node-peek-head",children:[a.jsxs("span",{className:"recap-peek-mark",children:[a.jsx(Sl,{}),"recap"]}),a.jsx("span",{className:"node-peek-time",title:i.title,children:i.label})]}),e.sessionLabel&&a.jsx("div",{className:"node-peek-kind",children:a.jsxs("span",{children:["Claude Code's recap of ",e.sessionLabel]})}),a.jsx("p",{className:"recap-peek-text",children:e.recap.text}),a.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for its details"})]}),document.body)}function yJ({a:e,anchor:t,parentLabel:n,bounds:r}){const s=II(t,r),i=li(1e3),l=c0(e.sessionName,e.sessionTitle),u=e.tools.filter(b=>b.ok===!1).length,d=e.tools.filter(b=>!b.endedAt).length,f=un(e,i).total,h=e.usage.inputTokens+e.usage.outputTokens,m=e.kind==="root"&&lr(e.waiting),g=e.kind==="root"?"session":n?`subagent of ${n}`:"subagent",w=[`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,d>0?`${d} in-flight`:null,h>0?`${st(h)} tok`:null,f>0?`${qe(f)}${jl(e,i)>0?"+":""}`:null].filter(Boolean).join(" · ");return It.createPortal(a.jsxs("div",{ref:s,className:"ap-peek node-peek",role:"tooltip",id:"node-peek",children:[a.jsxs("div",{className:"node-peek-head",children:[a.jsx("span",{className:"node-peek-name",children:e.label}),a.jsxs("span",{className:"node-peek-time",children:[e.synthetic?"≥ ":"",Zo(e.startedAt,e.endedAt,i)]})]}),a.jsxs("div",{className:"node-peek-kind",children:[a.jsxs("span",{className:"node-peek-state","data-kind":ex(e.state),children:[a.jsx(eM,{kind:ex(e.state)}),Yo(e.state)]}),a.jsx("span",{children:g}),e.model?a.jsx("span",{children:Hs(e.model)}):null]}),e.kind==="root"&&l.face&&a.jsx("p",{className:"node-peek-title",children:l.face}),e.kind==="root"&&e.waiting&&a.jsxs("p",{className:`node-peek-wait${m?" warn":""}`,children:[m&&a.jsx(p0,{}),a.jsx("span",{children:l0(e.waiting)}),a.jsx("b",{children:Zo(e.waiting.since,void 0,i)})]}),a.jsxs("p",{className:"node-peek-facts",children:[w,u>0&&a.jsxs("span",{className:"node-peek-failed",children:[" · ",u," failed"]})]}),e.branch&&e.branch.total>0&&a.jsx("p",{className:"node-peek-branch",children:KA(e.branch)}),a.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for details"})]}),document.body)}function wJ(e){const t=e.minZoom??SG,n=e.maxZoom??_G,r=e.fill??.9,s=e.insets.left,i=e.insets.top,l=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),d=e.context,f=e.anchor,h=Math.min(l/Math.max(1,d.width),u/Math.max(1,d.height))*r,m=Math.max(t,Math.min(n,h)),g=(w,b,x,k,j,S)=>{let _=w+(b-k*m)/2-x*m;const E=j*m+_,T=(j+S)*m+_;return S*m<=b?E<w?_+=w-E:T>w+b&&(_-=T-(w+b)):_+=w-E,_};return{x:g(s,l,d.x,d.width,f.x,f.width),y:g(i,u,d.y,d.height,f.y,f.height),zoom:m}}function vJ(e){let t=1/0,n=1/0,r=-1/0,s=-1/0;for(const i of e)t=Math.min(t,i.x),n=Math.min(n,i.y),r=Math.max(r,i.x+i.width),s=Math.max(s,i.y+i.height);return Number.isFinite(t)?{x:t,y:n,width:r-t,height:s-n}:null}function On(e){const t=v.useRef(e);return t.current=e,t}const Mx=80,$x=.86;function OI(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 s=r.getBoundingClientRect();s.width>0&&s.left>t.left&&(n=Math.min(n,s.left))}return Math.max(0,t.right-n)}function xJ({canvasRef:e,canvasSize:t,machinePhase:n,usagePhase:r,usagePanelOpen:s,detailShown:i}){const[l,u]=v.useState(0);v.useEffect(()=>{const m=OI(e.current);u(g=>Math.abs(g-m)>40?m:g)},[n,r,s,i,t.w]);const d=On(l),f=t.w>0?Math.max(0,(t.w-l-Mx*2)*$x):0,h=t.h>0?Math.max(0,(t.h-Mx*2)*$x):0;return{railInsetRef:d,availableWidth:f,availableHeight:h}}const LI=420;function bJ(){const e=si(),t=vt(),n=v.useCallback((d,f)=>{if(Zv({durationMs:f,documentHidden:document.hidden})){e.setViewport(d,{duration:f});return}const{d3Zoom:h,d3Selection:m}=t.getState(),g=m==null?void 0:m.property("__zoom");if(h&&m&&g&&g.k>0&&d.zoom>0){h.transform(m,g.scale(d.zoom/g.k).translate((d.x-g.x)/d.zoom,(d.y-g.y)/d.zoom));return}e.setViewport(d,{duration:0})},[e,t]),r=v.useRef(null),s=v.useRef(0),i=v.useRef(0),l=v.useCallback((d,f)=>{const h=++s.current;return n(d,f),i.current=Date.now(),r.current=Zv({durationMs:f,documentHidden:document.hidden})?{target:d,until:Date.now()+f+60}:null,h},[n]),u=v.useCallback((d=500)=>{const f=Mx,h=1,m=.2,g=$x;try{const w=document.querySelector(".canvas-wrap"),b=Array.from(document.querySelectorAll(".react-flow__node")).filter(O=>O.offsetWidth>0);if(!w||b.length===0)return;const x=w.getBoundingClientRect(),k=e.getViewport();if(!Number.isFinite(k.zoom)||k.zoom<=0)return;const j=O=>(O-x.left-k.x)/k.zoom,S=O=>(O-x.top-k.y)/k.zoom,_=b.map(O=>O.getBoundingClientRect()),E=Math.min(..._.map(O=>j(O.left))),T=Math.max(..._.map(O=>j(O.right))),R=Math.min(..._.map(O=>S(O.top))),A=Math.max(..._.map(O=>S(O.bottom))),B=T-E,$=A-R;if(!(B>0&&$>0))return;const I=OI(w),D=O=>Math.max(m,Math.min(h,(x.width-I-f*2)/(B+O)*g,(x.height-f*2)/$*g)),F=jG(D(LI),D(0)),W={x:f-E*F,y:Math.max(f,(x.height-$*F)/2)-R*F,zoom:F},M=l(W,d);window.setTimeout(()=>{var O;try{if(((O=r.current)==null?void 0:O.target)===W&&(r.current=null),s.current!==M)return;const L=e.getViewport();(Math.abs(L.zoom-F)>.01||Math.abs(L.x-W.x)>2)&&n(W,0)}catch{}},d+60)}catch{}},[e,n,l]);return v.useEffect(()=>{const d=()=>{if(!document.hidden)return;const f=r.current;if(r.current=null,!(!f||Date.now()>f.until)){try{n(f.target,0)}catch{}i.current=Date.now()}};return document.addEventListener("visibilitychange",d),()=>document.removeEventListener("visibilitychange",d)},[n]),{applyViewport:n,moveCamera:l,fitLeft:u,cameraEpochRef:s,lastFitTimeRef:i}}const kJ=450;function NJ({canvasRef:e,stateRef:t,measuredRef:n,nodesRef:r,railInsetRef:s,moveCamera:i,disableAutoFit:l,lastFocusRef:u,focusAgentRef:d,selectAgent:f,primarySelectedIdRef:h}){const m=v.useCallback(b=>{var B;const x=e.current,k=t.current.agents.get(b);if(!x||!k)return;const j=Z0(t.current),S=($,I)=>{const D=n.current.get($.id);if(!D)return null;const F=I&&j.has($.id)?LI:0;return{x:$.position.x,y:$.position.y,width:D.width+F,height:D.height}},_=r.current.find($=>$.id===b),E=_?S(_,!1):null;if(!E)return;const T=[];for(const $ of r.current){if($.type!=="agent"&&$.type!=="recapNote"||((B=$.data)==null?void 0:B.sessionId)!==k.sessionId)continue;const I=S($,$.type==="agent");I&&T.push(I)}const R=x.getBoundingClientRect(),A=wJ({pane:{width:R.width,height:R.height},insets:{top:56,left:72,bottom:32,right:s.current+32},context:vJ(T)??E,anchor:E});Vs(),l(),u.current={id:b,at:Date.now()},i(A,kJ)},[i,l]);d.current=m;const g=v.useCallback(b=>{const x=r.current.filter(_=>_.type==="agent"),k=iJ(x.map(_=>({id:_.id,x:_.position.x,y:_.position.y})),h.current,b),j=k?x.find(_=>_.id===k):void 0;if(!j)return;const S=J0(document.activeElement);f(j.id,!1),window.setTimeout(()=>{try{m(j.id)}catch{}S&&hJ(j.id)},30)},[f,m]),w=v.useCallback(b=>{f(b,!1),window.setTimeout(()=>{try{m(b)}catch{}},60)},[f,m]);return{focusAgent:m,stepAgent:g,focusSession:w}}function jJ({nodesRef:e,stateRef:t,canvasRef:n,railInsetRef:r}){const s=v.useCallback(d=>{const f=e.current.find(h=>h.id===d&&h.type==="agent");return f?f.data:void 0},[]),i=v.useCallback(d=>{var f;return(f=t.current.agents.get(d))==null?void 0:f.label},[]),l=v.useCallback(d=>{var m;const f=e.current.find(g=>g.id===d&&g.type==="recapNote");if(!f)return;const h=f.data;return{recap:h.recap,hue:h.hue,sessionLabel:(m=t.current.agents.get(h.parentId))==null?void 0:m.label}},[]),u=v.useCallback(()=>{var h;const d=(h=n.current)==null?void 0:h.getBoundingClientRect(),f=document.documentElement;return d?{width:d.right-r.current,height:d.bottom}:{width:f.clientWidth,height:f.clientHeight}},[]);return{peekAgent:s,peekLabel:i,peekRecap:l,peekBounds:u}}function SJ(e){const t=new Set(e.pins),n=new Map,r=new Map;for(const[s,i]of e.positions)n.set(s,i),t.has(s)&&r.set(s,i);return{positions:n,pinned:r,restored:new Set(n.keys())}}function kR(e){return Object.entries(e??{}).filter(([,t])=>t&&typeof t.x=="number"&&typeof t.y=="number")}function _J(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 s=kR(n);return{positions:s,pins:s.map(([i])=>i)}}const r=n;return{positions:kR(r.positions),pins:Array.isArray(r.pins)?r.pins:[]}}function EJ(e,t){const n={};for(const[r,s]of e)n[r]=s;for(const[r,s]of t)n[r]=s;return JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())})}function CJ(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 Q0="agent-dag.layout",eb="agent-dag.layoutFrame",tb="agent-dag.viewport";function TJ(){return _J(et(Q0))}function Il(e,t){Ye(Q0,EJ(e,t))}function RJ(){return CJ(et(eb))}function PI(e){Ye(eb,JSON.stringify(e))}function AJ(){return t6(et(tb))}function MJ(e){Ye(tb,JSON.stringify(e))}function DI(){Zr(Q0),Zr(tb),Zr(eb)}function $J(e){const t=v.useState(()=>SJ(TJ()))[0],n=v.useRef(t.pinned),r=v.useRef(t.positions),s=v.useRef(new Set),i=v.useRef(""),[l,u]=v.useState(0),d=v.useState(RJ)[0],f=v.useRef(d),h=v.useCallback(()=>{n.current.clear(),r.current.clear(),i.current="",DI(),u(m=>m+1),window.setTimeout(()=>{Il(r.current,n.current),f.current&&PI(f.current),e(500)},80)},[e]);return{restoredLayout:t,pinnedRef:n,positionsRef:r,provisionalRef:s,lastLayoutSigRef:i,layoutEpoch:l,setLayoutEpoch:u,lastLayoutFrameRef:f,handleRelayout:h}}function IJ(e,t){const{positionsRef:n,pinnedRef:r}=t,s=v.useRef(null);v.useEffect(()=>(s.current!=null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{Il(n.current,r.current)},1500),()=>{s.current!=null&&window.clearTimeout(s.current)}),[e])}function OJ({nodes:e,edges:t,settled:n,dragging:r,availableWidth:s,availableHeight:i,layout:l,camera:u,rf:d,measuredRef:f,stateRef:h,lastFocusRef:m,primarySelectedIdRef:g,focusAgentRef:w,autoFitDisabledRef:b}){const{lastLayoutFrameRef:x,pinnedRef:k,positionsRef:j,provisionalRef:S,lastLayoutSigRef:_,setLayoutEpoch:E}=l,{applyViewport:T,fitLeft:R,cameraEpochRef:A,lastFitTimeRef:B}=u;v.useEffect(()=>{if(!n||r)return;const $={width:s,height:i};if(!($.width>0&&$.height>0))return;const I=x.current;if(x.current=$,PI($),!I||I.width===$.width&&I.height===$.height)return;const D={direction:"LR",pinned:k.current,measured:f.current,lanes:Z0(h.current)};if(!JZ(e,t,D,I,$))return;const F=m.current&&Date.now()-m.current.at<1500?m.current.id:null,W=F??g.current,M=W?k.current.get(W)??j.current.get(W):void 0;for(const O of Array.from(j.current.keys()))k.current.has(O)||j.current.delete(O);S.current.clear(),_.current="",E(O=>O+1),window.setTimeout(()=>{if(Il(j.current,k.current),b.current){if(F){w.current(F);return}const O=W?k.current.get(W)??j.current.get(W):void 0;if(M&&O&&(O.x!==M.x||O.y!==M.y)){const L=d.getViewport();A.current+=1,T({x:L.x-(O.x-M.x)*L.zoom,y:L.y-(O.y-M.y)*L.zoom,zoom:L.zoom},0),B.current=Date.now()}return}R(500)},80)},[s,i,n,r,R,d,T])}const LJ=600;function nb(e,t){return!(e.exitAt!=null&&t-e.exitAt>LJ||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function PJ(e,t){const n=new Set;for(const r of e.agents.values())nb(r,t)&&n.add(r.id);return n}function DJ(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 FJ(e,t,n=0){if(!e)return!1;for(const r of t)if(DJ(e,r,n))return!0;return!1}function qJ(e,t,n,r,s){const i=[];for(const l of e)!nb(l,t)||n.has(l.id)||i.push(l.id+(l.parentId?`>${l.parentId}`:""));return i.sort(),`${i.join("|")}#sv${r}.${s}`}const rb="agent-dag.removedNodes";function BJ(e){try{const t=JSON.parse((e==null?void 0:e.getItem(rb))??"[]");return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function NR(e,t){try{e==null||e.setItem(rb,JSON.stringify([...t]))}catch{}}function FI(e,t){const n=new Map(e.map(i=>[i.id,i.parentId])),r=new Set(t),s=i=>{if(r.has(i))return!0;const l=new Set([i]);let u=n.get(i);for(;u&&!l.has(u);){if(r.has(u))return r.add(i),!0;l.add(u),u=n.get(u)}return!1};return i=>s(i.id)||s(i.sessionId??i.id)}function UJ(e,t){if(t.size===0)return new Set;const n=[...e],r=FI(n,t);return new Set(n.filter(r).map(s=>s.id))}function zJ(e,t,n){const r=u=>({id:u.id,parentId:u.data.parentId,sessionId:u.data.sessionId}),s=FI(e.map(r),n),i=e.filter(u=>!s(r(u))),l=new Set(i.map(u=>u.id));return{nodes:i,edges:t.filter(u=>l.has(u.source)&&l.has(u.target))}}function HJ(e,t){let n=null;for(const r of t)e.has(r)&&(n??(n=new Set(e)),n.delete(r));return n??e}function WJ(e,t){return t.size===0?[]:[...e].filter(n=>t.has(n.id)).map(n=>n.id)}function VJ(e){let t=e.kind==="subagent"?e.startedAt:-1/0;const n=e.tools[e.tools.length-1];n&&n.startedAt>t&&(t=n.startedAt);const r=e.prompts[e.prompts.length-1];return r&&r.at>t&&(t=r.at),e.lastOutputAt!=null&&e.lastOutputAt>t&&(t=e.lastOutputAt),t}function GJ(e,t,n){let r=null;for(const s of t)e.has(s)||(r??(r=new Map(e)),r.set(s,n));for(const s of e.keys())t.has(s)||(r??(r=new Map(e)),r.delete(s));return r??e}function KJ(e,t,n,r){if(n.size===0)return[];let s=1/0;for(const l of r.values())l<s&&(s=l);const i=new Set;for(const l of t){const u=e.get(l);if(!u)continue;const d=VJ(u);if(d<=s)continue;const f=[],h=new Set,m=w=>{var b;for(let x=w;x&&!h.has(x);x=(b=e.get(x))==null?void 0:b.parentId)h.add(x),n.has(x)&&f.push(x)};m(u.id),m(u.sessionId);let g=-1/0;for(const w of f)g=Math.max(g,r.get(w)??1/0);if(d>g)for(const w of f)i.add(w)}return[...i]}const qI="sessionGroup";function YJ(e,t){var r,s;if(e.type===qI)return"transparent";if(lr((r=e.data)==null?void 0:r.waiting))return t("--warn");if(e.type==="recapNote")return t("--muted");const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const bu=Ea;function XJ(e){const t=new Map;for(const r of e){const s=r.data;if(!(s!=null&&s.sessionId)||s.exitAt!=null)continue;const i=r.width,l=r.height;if(i==null||l==null)continue;const u=r.position.x,d=r.position.y,f=u+i,h=d+l,m=t.get(s.sessionId);m?(m.minX=Math.min(m.minX,u),m.minY=Math.min(m.minY,d),m.maxX=Math.max(m.maxX,f),m.maxY=Math.max(m.maxY,h)):t.set(s.sessionId,{minX:u,minY:d,maxX:f,maxY:h})}const n=[];for(const[r,s]of t){const i=s.maxX-s.minX+bu*2,l=s.maxY-s.minY+bu*2;n.push({id:`group:${r}`,type:qI,position:{x:s.minX-bu,y:s.minY-bu},data:{sessionId:r,w:i,h:l},width:i,height:l,style:{width:i,height:l},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return n}function ZJ(e,t){if(!t||!e.agents.get(t))return null;const r=new Set([t]);let s=t;for(;s;){const l=e.agents.get(s);if(!(l!=null&&l.parentId)||r.has(l.parentId))break;r.add(l.parentId),s=l.parentId}let i=!0;for(;i;){i=!1;for(const l of e.agents.values())l.parentId&&r.has(l.parentId)&&!r.has(l.id)&&(r.add(l.id),i=!0)}return r}function JJ(e,t){const n=new Set;for(const r of t){const s=ZJ(e,r);if(s)for(const i of s)n.add(i)}return n.size>0?n:null}function QJ({stateRef:e,now:t,removedAgentIds:n,sizeVersion:r,domSizeVersion:s}){return v.useMemo(()=>qJ(e.current.agents.values(),t,n,r,s),[e.current,e.current.revision,t,r,s,n])}function eQ({stateRef:e,now:t,availableWidth:n,availableHeight:r,layout:s,measuredRef:i,onBubble:l,settled:u,dragging:d,layoutSig:f,selectedIds:h,openContext:m,historyReplayed:g,removedNodes:w,removedAgentIds:b,dragTick:x,dragPatchRef:k,dragMoveTick:j}){const{pinnedRef:S,positionsRef:_,provisionalRef:E,lastLayoutSigRef:T,restoredLayout:R,layoutEpoch:A}=s,B=v.useMemo(()=>JJ(e.current,h),[e.current,e.current.revision,h]),$=v.useMemo(()=>{const L=PJ(e.current,t);for(const K of b)L.delete(K);return L},[e.current,e.current.revision,t,b]),I=v.useRef(new Map),D=r8(),{nodes:F,edges:W}=v.useMemo(()=>{const L=aJ(e.current,t,n,r,S.current,i.current,I.current,l,u,d,_.current,E.current,f,T,h,B,$,m,g,R.restored);return zJ(L.nodes,L.edges,w)},[e.current,e.current.revision,t,n,r,u,d,f,h,B,$,m,x,D,w,A,g]),M=v.useMemo(()=>XJ(F),[F]),O=v.useMemo(()=>{const L=[...M,...F],K=k.current;return!K||K.size===0?L:L.map(Z=>{const q=K.get(Z.id);return q?{...Z,position:q}:Z})},[M,F,j]);return{spotlightSet:B,visibleAgentIds:$,nodes:F,edges:W,allNodes:O}}function tQ(e,t,n){const r=e.x*t.zoom+t.x,s=e.y*t.zoom+t.y,i=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return i>0&&r<n.width&&l>0&&s<n.height}function nQ({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 s of n)if(r=!0,tQ(s,t,e))return!1;return r}function rQ({layoutSig:e,rf:t,stateRef:n,measuredRef:r,pinnedRef:s,positionsRef:i,paneSizeRef:l,lastInteractRef:u,autoFitDisabledRef:d,lastFitTimeRef:f,fitLeft:h}){const m=v.useRef(null),g=v.useRef("");v.useEffect(()=>{const w=setInterval(()=>{if(d.current||Date.now()-u.current<800)return;const b=n.current,x=Date.now(),k=[];for(const S of b.agents.values())nb(S,x)&&k.push({id:S.id});if(k.length===0)return;const j=[];for(const{id:S}of k){const _=r.current.get(S),E=s.current.get(S)??i.current.get(S);!_||!E||j.push({x:E.x,y:E.y,width:_.width,height:_.height})}nQ({pane:l.current,viewport:t.getViewport(),boxes:j})&&h(600)},1500);return()=>clearInterval(w)},[t]),v.useEffect(()=>{if(g.current===e)return;const w=g.current;if(g.current=e,!w||d.current)return;Date.now()-f.current>1200&&h(400),m.current&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>{d.current||h(500)},280)},[e,t,h])}function sQ({stateRef:e,pinnedRef:t,positionsRef:n,canvasRef:r,clearSelection:s,primarySelectedId:i}){const[l,u]=v.useState(()=>BJ(ul())),[d,f]=v.useState(null),h=v.useMemo(()=>UJ(e.current.agents.values(),l),[e.current,e.current.revision,l]),m=v.useCallback(j=>{const S=e.current.agents.get(j);S&&(u(_=>{const E=new Set(_);return E.add(j),NR(ul(),E),E}),f({id:j,label:S.label}),t.current.delete(j),n.current.delete(j),s())},[s]),g=v.useCallback(()=>{i&&m(i)},[i,m]),w=d&&l.has(d.id)?d:null;v.useEffect(()=>{var j;d&&((j=r.current)==null||j.focus())},[d]);const b=v.useCallback(j=>{const S=[...j];u(_=>{const E=HJ(_,S);return E!==_&&NR(ul(),E),E})},[]),x=v.useCallback(()=>{b([...l]),f(null)},[b,l]),k=v.useCallback(()=>{u(new Set),f(null),Zr(rb)},[]);return{removedNodes:l,lastRemoval:d,removedAgentIds:h,removeNode:m,removeSelectedNode:g,removalNotice:w,bringBack:b,bringBackAll:x,forgetRemovals:k}}function aQ({stateRef:e,waitingSessions:t,removedAgentIds:n,removedNodes:r,bringBack:s}){const i=v.useRef(new Map);v.useEffect(()=>{i.current=GJ(i.current,r,Date.now());const l=[...WJ(t,n),...KJ(e.current.agents,n,r,i.current)];l.length>0&&s(l)},[t,n,r,s])}function oQ({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${wt}`:wt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const ku={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Nu(e,t){const s=l=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${l}/>`;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"?s(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):s("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const iQ=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Nu(ku.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Nu(ku.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Nu(ku.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Nu(ku.idle,"idle"))}`});function lQ({stateRef:e,waitingSessions:t,live:n}){const r=v.useMemo(()=>hq(e.current.agents.values()),[e.current,e.current.revision]),s=v.useRef(null);v.useEffect(()=>{const i=oQ({waiting:t.length,running:r,connected:n}),l=s.current;if(s.current=i,(l==null?void 0:l.title)!==i.title&&(document.title=i.title),(l==null?void 0:l.icon)!==i.icon){const u=document.querySelector('link[rel="icon"]');u&&(u.href=iQ[i.icon])}},[t.length,r,n])}const cQ=1200,uQ=1e3;function Rv(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<cQ?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<uQ}function dQ({applyViewport:e,lastFitTimeRef:t,cameraEpochRef:n,disableAutoFit:r,markInteract:s,canvasRef:i,applyZoom:l}){const u=v.useState(()=>AJ())[0];v.useEffect(()=>{if(!u)return;const b=window.setTimeout(()=>{try{e(u,0)}catch{}t.current=Date.now()},60);return()=>window.clearTimeout(b)},[e,u]);const d=v.useRef(null),f=v.useRef(0),h=v.useCallback(()=>{f.current=Date.now()},[]),m=v.useCallback(b=>({hasSourceEvent:!!b,at:Date.now(),lastDeckFitAt:t.current,lastCanvasInputAt:f.current}),[]);return{restoredViewport:u,markCanvasInput:h,onMoveStart:b=>{Vs(),Rv(m(b))&&(n.current+=1),Rv(m(b))&&r()},onMove:(b,x)=>{var k;s(),Rv(m(b))&&r(),(k=i.current)==null||k.style.setProperty("--zoom",String(x.zoom)),l(x.zoom)==="detail"&&Vs(),d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>MJ(x),250)}}}function hQ({clearSelection:e,selectAgent:t,detailOpen:n,setDetailOpen:r,detailShown:s,focusAgent:i,draggingRef:l,lodRef:u}){return{onNodeClick:(w,b)=>{if(b.type==="sessionGroup"){e();return}const x=b.type==="recapNote"?b.data.parentId:b.id;t(x,w.shiftKey,!1),!w.shiftKey&&(n&&r(!1),s?window.setTimeout(()=>{try{i(x)}catch{}},80):i(x))},onPaneClick:()=>{Vs(),e()},onNodeDoubleClick:(w,b)=>{if(b.type!=="agent"&&b.type!=="recapNote")return;const x=b.type==="recapNote"?b.data.parentId:b.id;t(x,!1),window.setTimeout(()=>{try{i(x)}catch{}},80)},onNodeMouseEnter:(w,b)=>{b.type!=="agent"&&b.type!=="recapNote"||l.current||u.current==null||u.current==="detail"||$I(b.id,w.currentTarget)},onNodeMouseLeave:(w,b)=>Vs(b.id)}}function fQ(){const e=v.useRef(null),t=v.useRef(null),[n,r]=v.useState({w:0,h:0});return v.useEffect(()=>{const s=t.current;if(!s||typeof ResizeObserver>"u")return;const i=new ResizeObserver(l=>{var d;const u=(d=l[0])==null?void 0:d.contentRect;u&&(e.current={width:u.width,height:u.height},r(f=>Math.abs(f.w-u.width)>40||Math.abs(f.h-u.height)>40?{w:u.width,h:u.height}:f))});return i.observe(s),e.current={width:s.clientWidth,height:s.clientHeight},r({w:s.clientWidth,h:s.clientHeight}),()=>i.disconnect()},[]),{canvasRef:t,canvasSize:n,paneSizeRef:e}}function pQ(e){const t=v.useRef(new Map),n=v.useRef(0),r=v.useCallback(u=>{const d=t.current;let f=!1;for(const h of u.nodeInternals.values()){const m=h.width,g=h.height;if(m==null||g==null)continue;const w=d.get(h.id);w?(Math.abs(w.height-g)>4||Math.abs(w.width-m)>4)&&(d.set(h.id,{width:m,height:g}),f=!0):(d.set(h.id,{width:m,height:g}),f=!0)}return f&&(n.current+=1),n.current},[]),s=We(r),[i,l]=v.useState(0);return v.useEffect(()=>{let u=0;const d=()=>{const h=t.current;let m=!1;for(const g of document.querySelectorAll(".react-flow__node[data-id]")){const w=g.getAttribute("data-id");if(!w)continue;const b=g.offsetWidth,x=g.offsetHeight;if(!b||!x)continue;const k=h.get(w);(!k||Math.abs(k.width-b)>4||Math.abs(k.height-x)>4)&&(h.set(w,{width:b,height:x}),m=!0)}m&&l(g=>g+1)};if(e.current)return;let f=0;return document.visibilityState==="hidden"?f=window.setTimeout(d,32):u=requestAnimationFrame(d),()=>{cancelAnimationFrame(u),window.clearTimeout(f)}}),{measuredRef:t,measuredVersionRef:n,sizeVersion:s,domSizeVersion:i}}function mQ(){const[e,t]=v.useState(!1);return v.useEffect(()=>{const n=window.setTimeout(()=>t(!0),2500);return()=>window.clearTimeout(n)},[]),e}function gQ(){const e=v.useRef(null);return v.useEffect(()=>{let t=-1/0;const n=()=>{t=performance.now()},r=s=>{e.current=performance.now()-t<250?s.target:null};return window.addEventListener("pointerdown",n,!0),window.addEventListener("focusin",r,!0),()=>{window.removeEventListener("pointerdown",n,!0),window.removeEventListener("focusin",r,!0)}},[]),e}function yQ({pointerFocusRef:e,nodesRef:t,stateRef:n,primarySelectedIdRef:r,providersRef:s,soundOnRef:i,keyHelpOpenRef:l,modalOpenRef:u,waitingCursorRef:d,removeSelectedRef:f,activateSoundRef:h,clearSelection:m,selectAgent:g,focusAgent:w,stepAgent:b,focusSession:x,requestClear:k,handleRelayout:j,handleFit:S,togglePause:_,toggleSessionList:E,toggleAccountsPanel:T,setDetailOpen:R,setUsageHistoryOpen:A,setUsagePanelOpen:B,setMachinePanelOpen:$,setBrowserWatchOpen:I,setSoundMenuOpen:D,setKeyHelpOpen:F,setTheme:W}){v.useEffect(()=>{const M=O=>{var P,Y;const L=O.target,K={tagName:L==null?void 0:L.tagName,isContentEditable:L==null?void 0:L.isContentEditable,role:(P=L==null?void 0:L.getAttribute)==null?void 0:P.call(L,"role"),type:L==null?void 0:L.type,pointerFocused:L!=null&&L===e.current};if(O.key==="Escape"){const G=Cq({overlayOpen:cl.depth()>0,typing:jd(K)});G==="dismiss"?cl.dismissTop():G==="blur"?L==null||L.blur():(dJ(K)&&(L==null||L.blur()),m());return}if(Nd(O))return;const Z=J0(L)?(Y=L==null?void 0:L.getAttribute)==null?void 0:Y.call(L,"data-id"):null,q=Z&&t.current.some(G=>G.id===Z)?Z:null,H=cJ(O,q);if(H.kind==="activate"){O.preventDefault(),g(H.nodeId,H.additive);return}if(H.kind!=="node"&&!(H.nodeId==null&&Pq(K,O.key))&&!Dq({key:O.key,modalOpen:Fq({appModal:u.current,dialogDepth:cl.dialogDepth()}),sheetOpen:l.current})){if(O.key===" "&&(O.preventDefault(),_()),(O.key==="c"||O.key==="C")&&k("shortcut"),(O.key==="r"||O.key==="R")&&j(),(O.key==="f"||O.key==="F")&&S(),(O.key==="z"||O.key==="Z")&&r.current&&w(r.current),O.key==="Delete"&&f.current(),(O.key==="l"||O.key==="L")&&E(),O.key==="d"||O.key==="D")if(r.current)R(G=>!G);else{const G=Jv(n.current.agents.values());G.length>0?x(G[0].id):b(1)}if((O.key==="h"||O.key==="H")&&A(G=>!G),(O.key==="u"||O.key==="U")&&B(G=>!G),(O.key==="a"||O.key==="A")&&s.current.claude&&T(),(O.key==="j"||O.key==="J")&&b(1),(O.key==="k"||O.key==="K")&&b(-1),O.key==="w"||O.key==="W"){const G=dq(Jv(n.current.agents.values()),d.current);G&&(d.current=G.id,x(G.id))}(O.key==="t"||O.key==="T")&&W(G=>G==="dark"?"light":"dark"),(O.key==="m"||O.key==="M")&&s.current.claude&&i.current!==null&&h.current(O.shiftKey),(O.key==="s"||O.key==="S")&&$(G=>!G),(O.key==="b"||O.key==="B")&&I(G=>!G),(O.key==="v"||O.key==="V")&&s.current.claude&&i.current!==null&&D(G=>!G),O.key==="?"&&F(G=>!G)}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[k,j,S,m,g,b,x,w,_])}function wQ({nodes:e,stateRef:t,pinnedRef:n,positionsRef:r,draggingRef:s,dragPatchRef:i,setDragging:l,setDragMoveTick:u,setDragTick:d,endBubble:f,markInteract:h,disableAutoFit:m,beginTrashDrag:g,trackTrashDrag:w,endTrashDrag:b,removeNode:x}){const k=v.useRef(null);return{onNodeDragStart:(E,T)=>{var R,A;if(Vs(),f(),s.current=!0,i.current=new Map,l(!0),g(T.type==="agent"?((R=t.current.agents.get(T.id))==null?void 0:R.label)??"":null),h(),m(),T.type==="sessionGroup"){const B=(A=T.data)==null?void 0:A.sessionId,$=new Map;if(B)for(const I of e){const D=I.data;(D==null?void 0:D.sessionId)===B&&$.set(I.id,{x:I.position.x,y:I.position.y})}k.current={start:{x:T.position.x,y:T.position.y},members:$};return}n.current.set(T.id,{x:T.position.x,y:T.position.y})},onNodeDrag:(E,T)=>{var R;if(h(),T.type==="agent"&&w(E),T.type==="sessionGroup"){const A=k.current;if(!A)return;const B=T.position.x-A.start.x,$=T.position.y-A.start.y;for(const[D,F]of A.members){const W={x:F.x+B,y:F.y+$};n.current.set(D,W),r.current.set(D,W)}const I=i.current;if(I){for(const[D,F]of A.members)I.set(D,{x:F.x+B,y:F.y+$});I.set(T.id,{x:T.position.x,y:T.position.y})}u(D=>D+1);return}n.current.set(T.id,{x:T.position.x,y:T.position.y}),r.current.set(T.id,{x:T.position.x,y:T.position.y}),(R=i.current)==null||R.set(T.id,{x:T.position.x,y:T.position.y}),u(A=>A+1)},onNodeDragStop:(E,T)=>{h();const R=b(E,T.type==="agent");if(s.current=!1,i.current=null,l(!1),d(A=>A+1),T.type==="sessionGroup"){const A=k.current;if(A){const B=T.position.x-A.start.x,$=T.position.y-A.start.y;for(const[I,D]of A.members){const F={x:D.x+B,y:D.y+$};n.current.set(I,F),r.current.set(I,F)}}k.current=null,Il(r.current,n.current),d(B=>B+1);return}if(n.current.set(T.id,{x:T.position.x,y:T.position.y}),r.current.set(T.id,{x:T.position.x,y:T.position.y}),R){x(T.id);return}Il(r.current,n.current)}}}function vQ(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const xQ={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent",zcode:"ZCode"};function bQ(e){const t=e.toLowerCase(),n=$t(xQ,t);return n!==void 0?n:t?t[0].toUpperCase()+t.slice(1):""}function kQ(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function mre(e,t=[]){const n=t.length?kQ(t.map(bQ)):vQ(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function NQ(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 jQ(e,t){const n=t.prefs??Ex,r=ti(n.done.level),s=ti(n["needs-input"].level),i=r===s?`${r}%`:`${r}% and ${s}%`,l=t.on?`Sound: on at ${i} — 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?`
|
|
83
|
-
|
|
84
|
-
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.`:"",d=t.on&&t.locked?`
|
|
85
|
-
|
|
86
|
-
Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return l+u+d+`
|
|
87
|
-
|
|
88
|
-
Click to set the volume and the sound of each tone, and to hear either one.`}function SQ(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."}}function _Q(){return a.jsxs("div",{className:"empty-hero",children:[a.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[a.jsx("div",{className:"core"}),a.jsxs("div",{className:"orbit r1",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]}),a.jsxs("div",{className:"orbit r2",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]}),a.jsxs("div",{className:"orbit r3",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]})]}),a.jsxs("h2",{children:["Too many ",wt," tabs are open"]}),a.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",a.jsx("code",{children:wt})," tabs are holding them. Close one and this tab connects on its own."]})]})}function EQ({live:e,everConnected:t,providers:n,workspace:r,onTour:s}){const i=!e;return a.jsxs("div",{className:"empty-hero",children:[a.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[a.jsx("div",{className:"core"}),a.jsxs("div",{className:"orbit r1",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]}),a.jsxs("div",{className:"orbit r2",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]}),a.jsxs("div",{className:"orbit r3",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]})]}),i?a.jsxs(a.Fragment,{children:[a.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),a.jsxs("p",{children:[t?"This page lost its connection to ":"This page cannot reach ",a.jsx("code",{children:wt}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):CQ(n,r),!i&&a.jsx("button",{type:"button",className:"btn empty-tour",onClick:s,children:"Take the tour"})]})}function CQ(e,t){const n=SQ(t);return a.jsxs(a.Fragment,{children:[a.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?a.jsxs("p",{children:[n.lead," ",a.jsx("code",{children:n.workspace}),n.tail]}):a.jsxs("p",{children:["Run ",a.jsx("code",{children:"claude"})," or ",a.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."]}),NQ(e).map(r=>a.jsx("p",{className:"hint-row",children:r.spans.map((s,i)=>s.code?a.jsx("code",{children:s.text},i):a.jsx("span",{children:s.text},i))},r.provider))]})}const TQ=1;function RQ(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 AQ(e,t,n){const r=e.agents.get(t);if(!r)return null;const s=[];for(const i of e.agents.values())i.sessionId===t&&s.push(i);return{schemaVersion:TQ,exportedAt:n,sessionId:t,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:s.map(i=>({id:i.id,kind:i.kind,label:i.label,parentId:i.parentId,state:i.state,startedAt:i.startedAt,endedAt:i.endedAt,model:i.model,cwd:i.cwd,usage:i.usage,prompts:i.prompts,tools:i.tools.map(RQ)}))}}function MQ(e,t){const n=(e||"session").replace(/[^a-z0-9._-]/gi,"_");return`${wt}-${n}-${t.slice(0,8)}.json`}const BI={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},$Q={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 IQ({cat:e}){return a.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:a.jsx("path",{d:$Q[e]})})}const hd={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},UI=XA;function OQ({agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:s,onRemove:i}){const l=`${e.synthetic?"≥ ":""}${Zo(e.startedAt,e.endedAt,t)}`,u=un(e),d=u.total>0,f=e.usage.inputTokens+e.usage.outputTokens,h=new Map;for(const x of e.tools){const k=UI(x.name);h.set(k,(h.get(k)??0)+1)}const m=e.tools.filter(x=>x.ok===!1).length,g=e.tools.filter(x=>!x.endedAt).length,w=Array.from(h.entries()).sort((x,k)=>k[1]-x[1]),b=h.has("mcp")?I8(e.tools.map(x=>x.name)):null;return a.jsxs(a.Fragment,{children:[a.jsxs("header",{className:"detail-hero",children:[a.jsxs("div",{className:"hero-line",children:[a.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),a.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),a.jsxs("div",{className:"hero-meta",children:[a.jsx("span",{className:"hero-meta-item",children:e.kind==="root"?"session":"subagent"}),a.jsx("span",{className:"hero-sep",children:"·"}),a.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:l}),e.model&&(()=>{const x=PA(e);return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"hero-sep",children:"·"}),a.jsxs("span",{className:"model-chip","data-family":bd(e.model),title:x.length>0?`${e.model}
|
|
89
|
-
spend on this panel also covers:
|
|
90
|
-
${x.join(`
|
|
91
|
-
`)}`:e.model,children:[Hs(e.model),x.length>0?` +${x.length}`:""]})]})})()]}),d&&a.jsxs("div",{className:"hero-cost",children:[a.jsxs("div",{className:"hero-cost-headline",children:[a.jsx("span",{className:"hero-cost-value",children:qe(u.total)}),a.jsx("span",{className:"hero-cost-label",children:"spend"})]}),a.jsx(g0,{cost:u})]}),a.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&r&&a.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>r(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),s&&a.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Download this session as JSON",children:"Export JSON"}),i&&a.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:i,title:e.kind==="root"?"Take this session's cards off the board (Delete). The session carries on; the session list (L) brings it back":"Take this card and the ones under it off the board (Delete). The session list (L) brings it back",children:"Remove from board"})]})]}),(()=>{const x=Sd(e);if(!x)return null;const k=Qu(x.at,t);return a.jsxs("section",{className:"detail-section",children:[a.jsxs("h3",{children:["Recap ",a.jsx("span",{className:"section-count",title:k.title,children:k.label})]}),a.jsx("p",{className:"detail-recap",children:x.text})]})})(),e.tools.length>0&&a.jsxs("section",{className:"detail-section",children:[a.jsx("h3",{children:"Activity"}),a.jsxs("div",{className:"activity-row",children:[a.jsxs("div",{className:"activity-counters",children:[a.jsxs("span",{className:"ac-item",children:[a.jsx("b",{children:e.toolCount})," calls"]}),g>0&&a.jsxs("span",{className:"ac-item ac-live",children:[a.jsx("b",{children:g})," live"]}),m>0&&a.jsxs("span",{className:"ac-item ac-err",children:[a.jsx("b",{children:m})," err"]})]}),a.jsx("div",{className:"cat-strip",children:w.map(([x,k])=>{const j=x==="mcp"?b:null,S=j==null?void 0:j.hue,_=`${k} ${hd[x]} call${k===1?"":"s"}`;return a.jsxs("span",{className:`cat-chip cat-${x}${S!=null?" mcp-hue":""}`,style:S!=null?{"--mcp-hue":S}:void 0,title:j?`${_}, all to ${j.label}`:_,children:[a.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:BI[x]}),a.jsx("span",{className:"cat-name",children:hd[x]}),a.jsx("span",{className:"cat-count",children:k}),j&&a.jsx("span",{className:"cat-server",children:j.label})]},x)})})]})]}),f>0&&a.jsxs("section",{className:"detail-section",children:[a.jsx("h3",{children:"Tokens"}),a.jsxs("div",{className:"tokens-grid",children:[a.jsxs("div",{children:[a.jsx("span",{className:"k",children:"in"}),a.jsx("b",{title:e.usage.inputTokens.toLocaleString(),children:st(e.usage.inputTokens)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"k",children:"out"}),a.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:st(e.usage.outputTokens)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"k",children:"cache r"}),a.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:st(e.usage.cacheReadTokens)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"k",children:"cache c"}),a.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:st(e.usage.cacheCreateTokens)})]})]})]}),a.jsxs("section",{className:"detail-section",children:[a.jsx("h3",{children:"Identity"}),a.jsxs("div",{children:[e.cwd&&a.jsxs("div",{className:"row",children:[a.jsx("span",{className:"k",children:"cwd"}),a.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),a.jsxs("div",{className:"row",children:[a.jsx("span",{className:"k",children:"session"}),a.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&a.jsxs("div",{className:"row",children:[a.jsx("span",{className:"k",children:"parent"}),a.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&a.jsxs("section",{className:"detail-section",children:[a.jsxs("h3",{children:["Prompts ",a.jsx("span",{className:"section-count",children:CA(e.prompts).length})]}),a.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((x,k)=>{const j=Qu(x.at,t),S=o0(x.text);return S?a.jsxs("details",{className:"prompt-entry prompt-injected",children:[a.jsxs("summary",{children:[a.jsx("span",{className:"prompt-time",title:j.title,children:j.label}),a.jsx("span",{className:"prompt-injected-label",children:S.label})]}),S.detail&&a.jsx("div",{className:"prompt-injected-detail",children:S.detail})]},k):a.jsxs("div",{className:"prompt-entry",children:[a.jsx("div",{className:"prompt-time",title:j.title,children:j.label}),a.jsx("div",{className:"prompt-text",children:x.text})]},k)})})]}),a.jsxs("section",{className:"detail-section",children:[a.jsxs("h3",{children:["Tool calls ",a.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&a.jsx("div",{className:"empty",children:"No tool calls yet."}),a.jsx("div",{children:e.tools.slice().reverse().map(x=>a.jsx(PQ,{t:x,onClick:()=>n(e.id,x.id)},x.id))})]})]})}const LQ={inflight:"in-flight",done:"done",err:"error"};function PQ({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",r=FA(e,"…");return a.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[a.jsxs("span",{className:"name",children:[a.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:LQ[n]}),e.name]}),a.jsx("span",{style:{color:"var(--muted)"},children:r})]})}function DQ(e,t){const n=AQ(e,t,new Date().toISOString());if(!n)return;const r=JSON.stringify(n,null,2),s=new Blob([r],{type:"application/json"}),i=URL.createObjectURL(s),l=document.createElement("a");l.href=i,l.download=MQ(n.label,t),document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(i),1e3)}function FQ({selected:e,now:t,openTool:n,setSummaryFor:r,setDetailOpen:s,stateRef:i,removeSelectedNode:l}){return a.jsxs("aside",{className:"detail","aria-label":"Detail",children:[a.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>s(!1),children:"×"}),a.jsx(OQ,{agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:u=>DQ(i.current,u),onRemove:l})]})}function zI({id:e,value:t,onLevel:n,"aria-describedby":r}){return a.jsxs("div",{className:"sm-row",children:[a.jsx("label",{htmlFor:e,children:"Volume"}),a.jsx("input",{id:e,type:"range",min:Ou,max:ad,step:_x,value:t,"aria-describedby":r,onChange:s=>n(Number(s.target.value)),style:{"--sm-level":`${(t-Ou)/(ad-Ou)*100}%`}}),a.jsxs("span",{className:"sm-read",children:[t,"%"]})]})}const HI="agent-dag.character-enabled",WI="agent-dag.fm-volume",jR="agent-dag.fm-source",qQ=[{value:"claude-fm",label:"🎧 Claude FM"},{group:"📻 Lofi Girl",value:"lofi-relax",label:"📚 Relax / study"},{group:"📻 Lofi Girl",value:"lofi-game",label:"🎮 Chill / game"},{group:"📻 Lofi Girl",value:"lofi-vibe",label:"🌅 Vibe / chill"},{group:"📻 Lofi Girl",value:"lofi-sleep",label:"💤 Sleep / chill"},{group:"📻 Radio Mix",value:"radio-mix",label:"📡 Live radio mix"},{group:"📻 Best of Nostalgia",value:"best-of-nostalgia",label:"📼 Best of nostalgia live"},{group:"📻 The Good Life Radio",value:"good-life-radio",label:"🌴 The Good Life Radio"},{group:"☕ Cafe Music BGM",value:"cafe-music-bgm",label:"☕ Cafe music BGM"}];function BQ(e){return e==="lofi-relax"||e==="lofi-game"||e==="lofi-vibe"||e==="lofi-sleep"||e==="radio-mix"||e==="best-of-nostalgia"||e==="good-life-radio"||e==="cafe-music-bgm"?e:"claude-fm"}function UQ(e){return e!=="0"}function zQ(){return UQ(et(HI))}function HQ(e){return j$(e)}function WQ(){return HQ(et(WI))}const Mo=["light","dark"],VQ={light:"Light",dark:"Dark"},SR=qQ,$o="Give the station a name.",GQ="Use an https YouTube live or channel link, or a .mp3, .aac, .ogg or .m3u8 stream.";function KQ({theme:e}){return a.jsx("span",{className:"appearance-preview","data-swatch":e,children:a.jsxs("svg",{viewBox:"0 0 112 56","aria-hidden":!0,focusable:"false",children:[a.jsx("rect",{className:"tp-canvas",width:"112",height:"56"}),a.jsx("rect",{className:"tp-surface",width:"112",height:"7"}),a.jsx("rect",{className:"tp-rule",y:"7",width:"112",height:"1"}),a.jsx("rect",{className:"tp-surface",y:"8",width:"25",height:"48"}),a.jsx("rect",{className:"tp-rule",x:"25",y:"8",width:"1",height:"48"}),a.jsx("rect",{className:"tp-card",x:"36.5",y:"27.5",width:"28",height:"14",rx:"2.5"}),a.jsx("rect",{className:"tp-tag",x:"39.5",y:"25.5",width:"13",height:"4",rx:"2"}),a.jsx("rect",{className:"tp-card",x:"76.5",y:"14.5",width:"29",height:"20",rx:"2.5"}),a.jsx("rect",{className:"tp-rule",x:"81",y:"23",width:"20",height:"2",rx:"1"}),a.jsx("rect",{className:"tp-accent",x:"81",y:"23",width:"12",height:"2",rx:"1"})]})})}function YQ({theme:e,onTheme:t,characterEnabled:n,onToggleCharacter:r,fmVolume:s,onFmVolume:i,fmMuted:l,onFmMuted:u,fmSource:d,onFmSource:f,customFmStations:h,unavailableFmStations:m,onAddFmStation:g,onRenameFmStation:w,onRemoveFmStation:b,onClose:x}){var ue;const k=pt(x),j=[...SR.map(se=>({...se,label:m.has(se.value)?`${se.label} · not live`:se.label,unavailable:m.has(se.value)})),...h.map(se=>({group:"🎵 Your stations",value:La(se.id),label:m.has(se.id)?`${se.name} · unavailable`:se.name,unavailable:m.has(se.id)}))],S=j.some(se=>se.value===d&&se.unavailable),_=[];j.forEach((se,be)=>{const Te=_[_.length-1];Te&&Te.group===se.group?Te.indexes.push(be):_.push({group:se.group,indexes:[be]})});const[E,T]=v.useState(!1),[R,A]=v.useState(()=>Math.max(0,j.findIndex(se=>se.value===d))),[B,$]=v.useState(!1),[I,D]=v.useState(""),[F,W]=v.useState(""),[M,O]=v.useState(""),[L,K]=v.useState(!1),[Z,q]=v.useState(""),[H,P]=v.useState(""),Y=v.useRef(null),G=v.useRef(null),z=v.useRef(null),X=v.useRef(null),V=v.useRef(null),J=Ko(d),ee=J?h.find(se=>se.id===J):void 0;v.useEffect(()=>{const se=j.findIndex(be=>be.value===d);A(se<0?0:se)},[d,h,m]),v.useEffect(()=>{K(!1),q((ee==null?void 0:ee.name)??"")},[ee==null?void 0:ee.id,ee==null?void 0:ee.name]),v.useEffect(()=>{var se;E&&((se=document.getElementById(`appearance-fm-option-${R}`))==null||se.scrollIntoView({block:"nearest"}))},[R,E]),v.useEffect(()=>{if(!E)return;const se=be=>{var Le,$e;const Te=be.target;!((Le=Y.current)!=null&&Le.contains(Te))&&!(($e=V.current)!=null&&$e.contains(Te))&&T(!1)};return document.addEventListener("pointerdown",se),()=>document.removeEventListener("pointerdown",se)},[E]);const re=se=>{const be=se.relatedTarget;be&&!se.currentTarget.contains(be)&&T(!1)},oe=se=>{var Te;const be=j[se];be&&(A(se),f(be.value),T(!1),(Te=Y.current)==null||Te.focus())},fe=se=>{if(Eq(se.key)){if(!E)return;se.preventDefault(),se.stopPropagation(),T(!1);return}if(se.key==="Tab"){T(!1);return}if(se.key==="Enter"||se.key===" "){se.preventDefault(),E?oe(R):T(!0);return}se.key!=="ArrowDown"&&se.key!=="ArrowUp"&&se.key!=="Home"&&se.key!=="End"||(se.preventDefault(),T(!0),A(be=>se.key==="Home"?0:se.key==="End"?j.length-1:Math.min(j.length-1,Math.max(0,be+(se.key==="ArrowDown"?1:-1)))))},Ne=()=>{var se;return(se=Y.current)==null?void 0:se.focus()},we=se=>{var Te,Le;if(se.preventDefault(),!I.trim()){O($o),(Te=G.current)==null||Te.focus();return}const be=e6(I,F);if(!be){O(GQ),(Le=z.current)==null||Le.focus();return}g(be),f(La(be.id)),D(""),W(""),O(""),$(!1),Ne()},ye=se=>{var be;if(se.preventDefault(),!!J){if(!Z.trim()){P($o),(be=X.current)==null||be.focus();return}w(J,Z),K(!1),Ne()}},ve=se=>{var Le;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(se.key))return;se.preventDefault();const Te=(Mo.indexOf(e)+(se.key==="ArrowLeft"||se.key==="ArrowUp"?-1:1)+Mo.length)%Mo.length;t(Mo[Te]),(Le=se.currentTarget.querySelectorAll('[role="radio"]')[Te])==null||Le.focus()},Ie=se=>{var Te;if(se.key===" "){se.stopPropagation();return}if(jd(se.target)||se.key!=="t"&&se.key!=="T"||se.ctrlKey||se.metaKey||se.altKey)return;se.preventDefault(),se.stopPropagation();const be=e==="dark"?"light":"dark";t(be),se.target.getAttribute("role")==="radio"&&((Te=se.currentTarget.querySelectorAll('[role="radio"]')[Mo.indexOf(be)])==null||Te.focus())},xe=se=>{const be=j[se],Te="unavailable"in be&&be.unavailable;return a.jsxs("div",{className:"appearance-source-option",role:"option",id:`appearance-fm-option-${se}`,"aria-selected":d===be.value,"data-highlighted":R===se||void 0,"data-unavailable":Te||void 0,onMouseEnter:()=>A(se),onClick:()=>oe(se),children:[a.jsx("span",{children:be.label}),d===be.value&&a.jsx("span",{"aria-hidden":!0,children:"✓"})]},be.value)};return It.createPortal(a.jsx("div",{className:"modal-backdrop appearance-backdrop",onClick:x,role:"presentation",children:a.jsxs("div",{ref:k,id:"appearance-menu",className:"modal appearance-menu appearance-modal",role:"dialog","aria-modal":"true","aria-labelledby":"appearance-title",onClick:se=>se.stopPropagation(),onKeyDown:Ie,children:[a.jsxs("div",{className:"appearance-head",children:[a.jsxs("div",{className:"appearance-heading",children:[a.jsx("h2",{id:"appearance-title",className:"appearance-title",children:"Appearance"}),a.jsx("p",{className:"appearance-subtitle",children:"Tune the deck to your workspace."})]}),a.jsx("button",{type:"button",className:"glyph-btn appearance-close",onClick:x,"aria-label":"Close appearance settings",title:"Close (Esc)",children:"×"})]}),a.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-theme-caption",children:[a.jsxs("div",{className:"appearance-caption",children:[a.jsxs("div",{children:[a.jsx("h3",{id:"appearance-theme-caption",children:"Color theme"}),a.jsx("p",{className:"appearance-section-note",children:"Choose how the dashboard looks."})]}),a.jsx("kbd",{className:"appearance-key","aria-hidden":!0,title:"Press T anywhere to switch themes",children:"T"})]}),a.jsx("div",{className:"appearance-themes",role:"radiogroup","aria-labelledby":"appearance-theme-caption","aria-keyshortcuts":"T",onKeyDown:ve,children:Mo.map(se=>a.jsxs("button",{type:"button",className:"appearance-theme",role:"radio","aria-checked":e===se,tabIndex:e===se?0:-1,onClick:()=>t(se),children:[a.jsx(KQ,{theme:se}),a.jsxs("span",{className:"appearance-theme-name",children:[VQ[se],a.jsx("svg",{className:"appearance-check",viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:a.jsx("path",{d:"M2.5 6.4 4.9 8.7 9.5 3.6"})})]})]},se))})]}),a.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-fm-caption",children:[a.jsx("div",{className:"appearance-caption",children:a.jsx("h3",{id:"appearance-fm-caption",children:"Music source"})}),a.jsxs("div",{className:"appearance-controls",children:[a.jsxs("div",{className:"appearance-source-row",children:[a.jsx("label",{htmlFor:"appearance-fm-source",children:"Station"}),a.jsxs("div",{className:`appearance-source-picker${E?" is-open":""}`,onBlur:re,children:[a.jsxs("button",{ref:Y,type:"button",id:"appearance-fm-source",className:"appearance-source-trigger",role:"combobox","aria-haspopup":"listbox","aria-expanded":E,"aria-controls":E?"appearance-fm-source-list":void 0,"aria-activedescendant":E?`appearance-fm-option-${R}`:void 0,"aria-describedby":"appearance-fm-source-note",onClick:()=>T(se=>!se),onKeyDown:fe,children:[a.jsx("span",{children:((ue=j.find(se=>se.value===d))==null?void 0:ue.label)??SR[0].label}),a.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:a.jsx("path",{d:"m2.5 4.5 3.5 3 3.5-3"})})]}),E&&a.jsx("div",{ref:V,id:"appearance-fm-source-list",className:"appearance-source-list",role:"listbox","aria-label":"Music stations",children:_.map((se,be)=>se.group?a.jsxs("div",{role:"group","aria-labelledby":`appearance-fm-group-${be}`,children:[a.jsx("div",{id:`appearance-fm-group-${be}`,className:"appearance-source-group",role:"presentation",children:se.group}),se.indexes.map(xe)]},`group-${be}`):se.indexes.map(xe))})]})]}),a.jsx("span",{id:"appearance-fm-source-note",className:"vis-hidden",children:"Changing station starts live playback automatically."}),a.jsx("p",{className:"appearance-fm-status",role:"status",children:S?KF(Ko(d)!==null):""}),a.jsxs("div",{className:"appearance-station-manage",children:[a.jsx("button",{type:"button",className:"btn appearance-station-action","aria-expanded":B,onClick:()=>{$(se=>!se),O("")},children:B?"Cancel":"+ Add station"}),ee&&!L&&a.jsxs("span",{className:"appearance-station-edit",children:[a.jsx("button",{type:"button",className:"btn appearance-station-action",onClick:()=>{q(ee.name),P(""),K(!0)},children:"Rename"}),a.jsx("button",{type:"button",className:"btn danger appearance-station-action",onClick:()=>{b(ee.id),Ne()},children:"Remove"})]})]}),B&&a.jsxs("form",{className:"appearance-station-form",onSubmit:we,noValidate:!0,children:[a.jsxs("label",{className:"appearance-station-field",children:[a.jsx("span",{children:"Station name"}),a.jsx("input",{ref:G,className:"ap-manage-input",value:I,onChange:se=>D(se.target.value),"aria-invalid":M===$o||void 0,"aria-describedby":M===$o?"appearance-station-error":void 0,maxLength:bl,autoFocus:!0})]}),a.jsxs("label",{className:"appearance-station-field",children:[a.jsx("span",{children:"Link"}),a.jsx("input",{ref:z,className:"ap-manage-input",value:F,onChange:se=>W(se.target.value),placeholder:"https://…","aria-invalid":M!==""&&M!==$o||void 0,"aria-describedby":M&&M!==$o?"appearance-station-error":void 0,inputMode:"url",autoComplete:"off",spellCheck:!1,maxLength:mA})]}),a.jsx("button",{type:"submit",className:"btn primary",children:"Add"}),M&&a.jsx("p",{id:"appearance-station-error",className:"appearance-station-error",role:"alert",children:M})]}),ee&&L&&a.jsxs("form",{className:"appearance-station-form is-rename",onSubmit:ye,noValidate:!0,children:[a.jsxs("label",{className:"appearance-station-field",children:[a.jsx("span",{children:"Station name"}),a.jsx("input",{ref:X,className:"ap-manage-input",value:Z,onChange:se=>q(se.target.value),"aria-invalid":H!==""||void 0,"aria-describedby":H?"appearance-rename-error":void 0,maxLength:bl,autoFocus:!0})]}),a.jsx("button",{type:"submit",className:"btn primary",children:"Save"}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{K(!1),Ne()},children:"Cancel"}),H&&a.jsx("p",{id:"appearance-rename-error",className:"appearance-station-error",role:"alert",children:H})]}),a.jsxs("label",{className:"appearance-row",children:[a.jsx("span",{className:"appearance-row-label",id:"appearance-character-label",children:"Show character on minimap"}),a.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":n,"aria-labelledby":"appearance-character-label","aria-describedby":"appearance-character-note",onClick:r,children:a.jsx("span",{className:"switch-knob"})}),a.jsx("span",{id:"appearance-character-note",className:"vis-hidden",children:"Shows the animated minimap character and enables music playback."})]}),a.jsx(zI,{id:"appearance-fm-volume",value:s,"aria-describedby":"appearance-fm-volume-note",onLevel:i}),a.jsxs("label",{className:"appearance-row",children:[a.jsx("span",{className:"appearance-row-label",id:"appearance-fm-mute-label",children:"Mute music"}),a.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":l,"aria-labelledby":"appearance-fm-mute-label",onClick:u,children:a.jsx("span",{className:"switch-knob"})})]})]}),a.jsx("span",{id:"appearance-fm-volume-note",className:"vis-hidden",children:"Controls live music volume."})]})]})}),document.body)}const XQ="With no deck tab open, get a notification wherever a sound would have played.",ZQ="With the ccdeck window closed, get a notification wherever a sound would have played.";function JQ(e){return e?ZQ:XQ}const QQ="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",_R="Get notified when you're away from this tab.";function eee(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:_R};case"default":return{status:null,ask:!0,ok:!1,note:_R};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 Ol(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}const tee=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"];function nee(e){return tee.find(t=>e(t))}const ree=4400;function see(e){const t=e.split(";")[0];return{name:`Recorded voice.${t==="audio/mp4"?"m4a":t==="audio/ogg"?"ogg":"webm"}`,type:t}}function aee({full:e,setCustomError:t,runCustom:n,onImportCustom:r}){const[s,i]=v.useState(!1),l=v.useRef(null),u=v.useRef(null),d=()=>{var h;u.current!==null&&clearTimeout(u.current),u.current=null,((h=l.current)==null?void 0:h.state)==="recording"&&l.current.stop()},f=async()=>{var m;if(e)return;if(t(""),!((m=navigator.mediaDevices)!=null&&m.getUserMedia)||typeof MediaRecorder>"u"){t("Microphone recording is unavailable in this browser.");return}let h;try{h=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{t("Microphone access was denied or unavailable.");return}if(l.current){h.getTracks().forEach(g=>g.stop());return}try{const g=nee(x=>MediaRecorder.isTypeSupported(x)),w=new MediaRecorder(h,g?{mimeType:g}:void 0),b=[];l.current=w,w.ondataavailable=x=>{x.data.size&&b.push(x.data)},w.onerror=()=>t("Recording failed. Please try again."),w.onstop=()=>{h.getTracks().forEach(S=>S.stop()),u.current!==null&&clearTimeout(u.current),u.current=null;const x=l.current===w;if(x&&(l.current=null),i(!1),!x||!b.length)return;const k=see(w.mimeType),j=new File(b,k.name,{type:k.type});n(()=>r(j))},w.start(200),i(!0),u.current=setTimeout(d,ree)}catch{l.current=null,h.getTracks().forEach(g=>g.stop()),t("This browser cannot record a supported audio format.")}};return v.useEffect(()=>()=>{u.current!==null&&clearTimeout(u.current);const h=l.current;l.current=null,(h==null?void 0:h.state)==="recording"&&h.stop()},[]),{recording:s,startRecording:f,stopRecording:d}}function oee({full:e,fullProps:t,runCustom:n,onCreateVoice:r}){const[s,i]=v.useState("Custom voice"),[l,u]=v.useState("Your turn"),[d,f]=v.useState(""),[h,m]=v.useState("1"),[g,w]=v.useState("1"),[b,x]=v.useState([]);return v.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const k=()=>{x(window.speechSynthesis.getVoices())};return k(),window.speechSynthesis.addEventListener("voiceschanged",k),()=>window.speechSynthesis.removeEventListener("voiceschanged",k)},[]),a.jsxs("details",{className:"sm-voice",children:[a.jsxs("summary",{...t,onClick:k=>{const j=k.currentTarget.parentElement;e&&j&&!j.open&&k.preventDefault()},children:[a.jsx("span",{children:"Spoken voice"}),a.jsx("span",{children:"Create from text"})]}),a.jsxs("div",{className:"sm-voice-fields",children:[a.jsxs("label",{children:[a.jsx("span",{children:"Name"}),a.jsx("input",{className:"ap-manage-input",value:s,maxLength:80,onChange:k=>i(k.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:"Text"}),a.jsx("input",{className:"ap-manage-input",value:l,maxLength:180,onChange:k=>u(k.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:"Voice"}),a.jsxs("select",{className:"sm-select",value:d,onChange:k=>f(k.target.value),children:[a.jsx("option",{value:"",children:"System default"}),b.map(k=>a.jsx("option",{value:k.voiceURI,children:k.name},k.voiceURI))]})]}),a.jsxs("div",{className:"sm-voice-pair",children:[a.jsxs("label",{children:[a.jsx("span",{children:"Rate"}),a.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:h,onChange:k=>m(k.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:"Pitch"}),a.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:g,onChange:k=>w(k.target.value)})]})]}),a.jsx("button",{type:"button",className:"btn sm-custom-action",...t,onClick:()=>{e||n(async()=>{await r({name:s,text:l,voiceURI:d,rate:parseFloat(h),pitch:parseFloat(g)}),u("Your turn")})},children:"Add spoken voice"})]})]})}function iee({customAssets:e,onImportCustom:t,onCreateVoice:n,onRenameCustom:r,onPreviewCustom:s,onDeleteCustom:i}){const[l,u]=v.useState(""),d=e.length,f=jx(d),h=f!==null,m=h?{"aria-disabled":!0,"aria-describedby":"sm-custom-full"}:{},[g,w]=v.useState(null),b=v.useRef(0),x=v.useRef(new Map),k=v.useRef(null);v.useEffect(()=>{if(!g)return;const R=window.setTimeout(()=>w(null),4e3);return()=>window.clearTimeout(R)},[g]);const j=async R=>{u("");try{await R()}catch(A){u(A instanceof Error?A.message:"Custom audio could not be saved.")}},S=(R,A)=>{const B=Date.now(),$=El({armedFor:g,target:R,armedAt:b.current,now:B,gapMs:_l});if($==="arm"){w(R),b.current=B;return}if($==="ignore")return;w(null);const I=DG(e.map(D=>D.id),R);j(async()=>{var F;await i(R);const D=document.activeElement;D!==A&&!Cl((D==null?void 0:D.tagName)??null)||(F=I?x.current.get(I):k.current)==null||F.focus()})},{recording:_,startRecording:E,stopRecording:T}=aee({full:h,setCustomError:u,runCustom:j,onImportCustom:t});return a.jsxs("section",{className:"sm-custom","aria-labelledby":"sm-custom-title",children:[a.jsxs("div",{className:"sm-custom-head",children:[a.jsx("h3",{className:"sm-tone-name",id:"sm-custom-title",children:"Custom sounds"}),a.jsxs("span",{children:[d," of ",Nx,", kept on this machine"]})]}),h&&a.jsx("p",{className:"sm-note",id:"sm-custom-full",children:f}),a.jsxs("div",{className:"sm-custom-actions",children:[a.jsxs("label",{className:"sm-custom-card sm-file",children:[a.jsxs("span",{className:"sm-custom-card-copy",children:[a.jsx("strong",{children:"Import audio"}),a.jsx("span",{children:"WAV, MP3 or OGG"})]}),a.jsx("span",{className:"btn sm-custom-action","aria-hidden":"true",children:"Choose file"}),a.jsx("input",{ref:k,type:"file",accept:"audio/wav,audio/x-wav,audio/mpeg,audio/mp3,audio/ogg,.wav,.mp3,.ogg",...m,onClick:R=>{h&&R.preventDefault()},onChange:R=>{var B;const A=(B=R.target.files)==null?void 0:B[0];R.currentTarget.value="",A&&!h&&j(()=>t(A))}})]}),a.jsxs("div",{className:"sm-custom-card",children:[a.jsxs("span",{className:"sm-custom-card-copy",children:[a.jsx("strong",{children:"Record a clip"}),a.jsx("span",{children:_?"Recording…":"Up to 5 seconds"})]}),_?a.jsx("button",{type:"button",className:"btn sm-custom-action",onClick:T,children:"Stop & save"}):a.jsx("button",{type:"button",className:"btn sm-custom-action",...m,onClick:()=>void E(),children:"Record"})]})]}),a.jsx(oee,{full:h,fullProps:m,runCustom:j,onCreateVoice:n}),e.length>0&&a.jsx("div",{className:"sm-custom-list",children:e.map(R=>a.jsxs("div",{className:"sm-custom-item",children:[a.jsx("input",{className:"ap-manage-input","aria-label":`Rename ${R.name}`,defaultValue:R.name,maxLength:80,onBlur:A=>{if(!A.target.value.trim()){A.target.value=R.name;return}j(()=>r(R.id,A.target.value))},onKeyDown:A=>{A.key==="Enter"&&A.currentTarget.blur()}}),a.jsx("span",{children:R.kind==="audio"?`${R.duration.toFixed(1)}s`:"Voice"}),a.jsx("button",{type:"button",className:"btn sm-custom-icon","aria-label":`Play ${R.name}`,onClick:()=>s(R.id),children:"Play"}),a.jsx("button",{type:"button",ref:A=>{A?x.current.set(R.id,A):x.current.delete(R.id)},className:`btn sm-custom-icon${g===R.id?" armed":""}`,onKeyDown:A=>{A.repeat&&A.preventDefault()},onClick:A=>S(R.id,A.currentTarget),"aria-label":g===R.id?`Confirm deleting ${R.name}`:`Delete ${R.name}`,title:g===R.id?"Press again to delete this sound. It cannot be brought back.":"Delete this sound",children:g===R.id?"Confirm":"Delete"})]},R.id))}),l&&a.jsx("p",{className:"sm-custom-error",role:"alert",children:l})]})}const Ix="custom:";function ER(e){return`${Ix}${e}`}function lee(e){return e.startsWith(Ix)?e.slice(Ix.length):null}const CR={done:"Turn finished","needs-input":"Claude is asking"},cee={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function uee({chime:e,tone:t,soundOn:n,customAssets:r,customSelections:s,onLevel:i,onFigure:l,onPreview:u,onBuiltInSelected:d,onCustomSelected:f}){const h=`sm-level-${e}`,m=`sm-figure-${e}`,g=s[e];return a.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${e}`,children:[a.jsxs("div",{className:"sm-tone-head",children:[a.jsx("h3",{className:"sm-tone-name",id:`sm-name-${e}`,children:CR[e]}),a.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>u(e),"aria-label":`Hear the ${CR[e].toLowerCase()} tone`,title:n?"Play this tone now, at what it is set to":"Plays even when Sounds is off","aria-describedby":n?void 0:"sm-preview-note",children:[a.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:a.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),a.jsx(zI,{id:h,value:t.level,onLevel:w=>i(e,w)}),a.jsxs("div",{className:"sm-row",children:[a.jsx("label",{htmlFor:m,children:"Tone"}),a.jsxs("select",{id:m,className:"sm-select",value:g?ER(g):t.figure,onChange:w=>{const b=w.target.value,x=lee(b);x!==null?f(e,x):(d(e),l(e,b))},children:[A0[e].map(w=>a.jsx("option",{value:w.id,children:w.label},w.id)),r.length>0&&a.jsx("optgroup",{label:"Custom",children:r.map(w=>a.jsx("option",{value:ER(w.id),children:w.name},w.id))})]})]}),a.jsx("p",{className:"sm-note",children:cee[e]})]})}function dee({onClose:e,soundOn:t,onToggleSound:n,prefs:r,onLevel:s,onFigure:i,onPreview:l,openerRef:u,customAssets:d,customSelections:f,onBuiltInSelected:h,onCustomSelected:m,onImportCustom:g,onCreateVoice:w,onRenameCustom:b,onPreviewCustom:x,onDeleteCustom:k,notifyOn:j,onToggleNotify:S,notifyVetoed:_,notifyPermission:E,onAskNotify:T}){var F;const R=eee(E),A=Ol(),B=j&&!_&&!A,$=LG(f),I=((F=d.find(W=>W.id===$))==null?void 0:F.name)??"the same custom sound",D=pt(e,{popover:!0});return MM(D,()=>u.current,e),a.jsxs("div",{ref:D,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[a.jsxs("div",{className:"sm-switches",children:[a.jsxs("label",{className:"sm-switch",children:[a.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),a.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:a.jsx("span",{className:"switch-knob"})})]}),a.jsxs("div",{className:"sm-setting",children:[a.jsxs("label",{className:"sm-switch",children:[a.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications while closed"}),a.jsx("button",{type:"button",role:"switch","aria-checked":j,"aria-labelledby":"sm-notify-label",className:"switch",onClick:S,title:"With no deck tab open, a notification wherever a sound would play",children:a.jsx("span",{className:"switch-knob"})})]}),a.jsx("p",{className:"sm-note",children:_?QQ:JQ(A)})]})]}),B&&a.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[a.jsxs("div",{className:"sm-channel-head",children:[a.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),R.ask?a.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:T,children:"Enable"}):a.jsxs("span",{className:"sm-channel-state","data-ok":R.ok||void 0,children:[R.ok&&a.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:a.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),R.status]})]}),a.jsx("p",{className:"sm-note",children:R.note})]}),!t&&a.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."}),a.jsx("div",{className:"sm-tones",children:Iu.map(W=>a.jsx(uee,{chime:W,tone:r[W],soundOn:t,customAssets:d,customSelections:f,onLevel:s,onFigure:i,onPreview:l,onBuiltInSelected:h,onCustomSelected:m},W))}),$&&a.jsxs("p",{className:"sm-note",role:"status",children:["Both tones use “",I,"”. They may be harder to tell apart."]}),a.jsx(iee,{customAssets:d,onImportCustom:g,onCreateVoice:w,onRenameCustom:b,onPreviewCustom:x,onDeleteCustom:k}),a.jsxs("p",{className:"sm-foot",children:[a.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}function hee({sessionListOpen:e,toggleSessionList:t,usagePanelOpen:n,setUsagePanelOpen:r,setUsageHistoryOpen:s}){return a.jsxs("div",{className:"action-run",children:[a.jsxs("button",{className:"btn icon-btn",onClick:t,title:`${e?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":e,"aria-controls":e?"session-list":void 0,children:[a.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:[a.jsx("path",{d:"M5.4 3.6h6.6M5.4 7h6.6M5.4 10.4h6.6"}),a.jsx("path",{d:"M2.2 3.6h.2M2.2 7h.2M2.2 10.4h.2"})]}),a.jsx("span",{className:"tb-word",children:"Session list"})]}),a.jsxs("button",{className:"btn icon-btn",onClick:()=>r(i=>!i),title:`${n?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":n,"aria-controls":n?"usage-panel":void 0,children:[a.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:[a.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"}),a.jsx("path",{d:"M7 1.6v1.5M7 10.9v1.5"})]}),a.jsx("span",{className:"tb-word",children:"Usage"})]}),a.jsxs("button",{className:"btn icon-btn",onClick:()=>s(i=>!i),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:[a.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:[a.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),a.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),a.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]}),a.jsx("span",{className:"tb-word",children:"History"})]})]})}function fee({providers:e,accountsPanelOpen:t,toggleAccountsPanel:n,machinePanelOpen:r,setMachinePanelOpen:s,watchOn:i,watchUnseen:l,setBrowserWatchOpen:u}){return a.jsxs("div",{className:"action-run",children:[e.claude&&a.jsxs("button",{className:"btn icon-btn",onClick:n,title:`${t?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":t,"aria-controls":t?"accounts-panel":void 0,children:[a.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:[a.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),a.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]}),a.jsx("span",{className:"tb-word",children:"Accounts"})]}),a.jsxs("button",{className:"btn icon-btn",onClick:()=>s(d=>!d),title:`${r?"Hide":"Show"} this machine — cores, memory, temperature (S)`,"aria-label":"Toggle machine detail","aria-expanded":r,"aria-controls":r?"system-panel":void 0,children:[a.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:[a.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),a.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"})]}),a.jsx("span",{className:"tb-word",children:"Machine"})]}),a.jsxs("button",{className:"btn icon-btn bw-btn",onClick:()=>u(d=>!d),title:i?"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, ${i?"watching":"not watching"}`+(l>0?`, ${l} unread`:""),"aria-haspopup":"dialog",children:[a.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:[a.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"}),i||l>0?a.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):a.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),a.jsx("span",{className:"tb-word",children:"Browser watch"}),l>0&&a.jsx("span",{className:"bw-badge","aria-hidden":!0,children:l})]})]})}function pee({providers:e,sound:t,tones:n,customTones:r,notify:s,chimeState:i,menus:l,appearance:u,fm:d}){const{soundOn:f,toggleSound:h}=t,{tonePrefs:m,previewTone:g,changeTone:w}=n,{customSelections:b,customAssets:x,clearCustomOnly:k,selectCustomTone:j,importNotificationAudio:S,createNotificationVoice:_,renameCustomAsset:E,deleteCustomAsset:T,previewCustomAsset:R}=r,{notifyPermission:A,notifyOn:B,notifyVetoed:$,toggleNotify:I,notifySupported:D,askForNotifications:F}=s,{soundMenuOpen:W,setSoundMenuOpen:M,soundButtonRef:O,appearanceMenuOpen:L,setAppearanceMenuOpen:K,appearanceButtonRef:Z}=l,{theme:q,setTheme:H,characterEnabled:P,setCharacterEnabled:Y}=u,{fmVolume:G,setFmVolume:z,fmMuted:X,setFmMuted:V,fmSource:J,customFmStations:ee,unavailableFmStations:re,addFmStation:oe,renameFmStation:fe,removeFmStation:Ne,pickFmSource:we}=d;return a.jsxs("div",{className:"action-run action-run-utility",children:[e.claude&&f!==null&&a.jsxs("div",{className:"sound-slot",children:[a.jsxs("button",{ref:O,className:"btn icon-btn",onClick:()=>M(ye=>!ye),...zs(!1),title:jQ(e,{on:f===!0,locked:i==="locked",prefs:m}),"aria-label":`Sound settings, ${f?"on":"off"}`,"aria-haspopup":"dialog","aria-expanded":W,"aria-controls":W?"sound-menu":void 0,children:[a.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:[a.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),f?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),a.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M10 5.6l2.6 2.8"}),a.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]}),a.jsx("span",{className:"tb-word",children:"Sound"})]}),W&&a.jsx(dee,{onClose:()=>M(!1),soundOn:f===!0,onToggleSound:h,prefs:m,onLevel:(ye,ve)=>w(ye,{level:ve}),onFigure:(ye,ve)=>w(ye,{figure:ve}),onPreview:ye=>g(ye),customAssets:x,customSelections:b,onBuiltInSelected:k,onCustomSelected:j,onImportCustom:S,onCreateVoice:_,onRenameCustom:E,onPreviewCustom:R,onDeleteCustom:T,notifyOn:B,onToggleNotify:I,notifyVetoed:$,notifyPermission:D?A:"unsupported",onAskNotify:F,openerRef:O})]}),a.jsxs("div",{className:"appearance-slot",children:[a.jsx("button",{ref:Z,className:"btn icon-btn",onClick:()=>{M(!1),K(ye=>!ye)},title:"Appearance settings","aria-label":`Appearance settings, ${q} theme, character ${P?"shown":"hidden"}`,"aria-haspopup":"dialog","aria-expanded":L,"aria-controls":L?"appearance-menu":void 0,children:q==="dark"?a.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:[a.jsx("circle",{cx:"7",cy:"7",r:"2.5"}),a.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"})]}):a.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:a.jsx("path",{d:"M11.8 8.4A5 5 0 1 1 5.6 2.2a4 4 0 0 0 6.2 6.2Z"})})}),L&&a.jsx(YQ,{theme:q,onTheme:H,characterEnabled:P,onToggleCharacter:()=>Y(ye=>!ye),fmVolume:G,onFmVolume:z,fmMuted:X,onFmMuted:()=>V(ye=>!ye),fmSource:J,onFmSource:we,customFmStations:ee,unavailableFmStations:re,onAddFmStation:oe,onRenameFmStation:fe,onRemoveFmStation:Ne,onClose:()=>K(!1)})]})]})}const mee=5*6e4,gee=6e4;function yee({shown:e,tabVisible:t,lastReadAt:n,now:r,lastSince:s,since:i}){return!e||!t?!1:s&&i&&s!==i?!0:n===null||r-n>=mee}function TR(e=new Date){return fM("month",e)}function wee(e){const t=Rd(e);return{cost:t.cost,tokens:t.tokens}}function RR(e){return e>0?qe(e):"$0.00"}const vee=new Set(["idle","checking","current","downloading","ready","error"]);function AR(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.status!="string"||!vee.has(t.status))return null;const n=typeof t.version=="string"&&t.version.trim()?t.version.trim():null;return t.status==="ready"&&!n?null:{status:t.status,version:n}}function xee(e){return(e==null?void 0:e.status)==="ready"&&e.version?{version:e.version}:null}function bee(e=typeof navigator>"u"?"":navigator.userAgent){var t;return((t=/\bccdeck-desktop\/(\d[^\s]*)/.exec(e))==null?void 0:t[1])??null}const fd="Restart to update",VI=3e4;function kee(e=typeof navigator>"u"?"":navigator.userAgent){return/\bMac OS X\b|\bMacintosh\b/.test(e)?"the ccdeck menu in the menu bar":"the ccdeck tray menu"}function Nee(e,t){const n=`v${e} → v${t}`;return{text:n,label:`${n}, update downloaded and verified`,title:`ccdeck v${t} is downloaded and verified · click to open What's new, where ${fd} comes first`}}function jee(e){const t=e==null?void 0:e.reason;return t==="app_disconnected"||t==="update_not_ready"?t:"refused"}function See(e,t,n=typeof navigator>"u"?"":navigator.userAgent){const r=kee(n),s=`Use ${fd} in ${r}.`;switch(e){case"app_disconnected":return`Nothing restarted: the app is not connected to this deck, so the request had nowhere to go. ${s}`;case"update_not_ready":return`Nothing restarted: the app no longer has v${t} ready. When it has one, ${fd} is in ${r}.`;case"timeout":return`ccdeck has not restarted after ${VI/1e3} seconds. ${s}`;case"refused":return`Nothing restarted: the deck turned the request down. ${s}`;case"unreachable":return`Nothing restarted: the request did not reach the deck. ${s}`}}const _ee="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Av="click for what's new";function Eee(e){if(e.checkDisabled)return`${_ee} · ${Av}`;if(e.checking)return`Asking npm for the newest release… · ${Av}`;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 · ${Av}, and to check npm now`}function Cee(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 Tee(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 GI(e){return e?`${e.kind}:${e.to}`:""}function Ree(e,t){return e!=null&&t!==GI(e)}function Aee({readyAppUpdate:e,notice:t,noticeOpen:n,version:r,chipVersion:s,versionChecking:i,now:l,openReleaseNotes:u,showNotice:d,loadVersion:f}){return a.jsx(a.Fragment,{children:e?(()=>{const h=Nee(bee()??s,e.version);return a.jsxs("button",{type:"button",className:"v ready",onClick:u,"aria-haspopup":"dialog","aria-label":h.label,title:h.title,children:[h.text,a.jsx("span",{className:"v-dot","aria-hidden":!0})]})})():t?a.jsxs("button",{type:"button",className:"v stale",onClick:()=>{u(),d()},"aria-haspopup":"dialog","aria-label":Tee({...t,open:n}),title:t.kind==="restart"?`Running v${t.from}; v${t.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${t.from}; v${t.to} is on npm · click for what's new`,children:["v",t.from,a.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const h={running:s,latest:r==null?void 0:r.latest,latestPending:r==null?void 0:r.latestPending,checkedAgo:r!=null&&r.checkedAt?Ju(l-r.checkedAt):null,checkFailedAgo:r!=null&&r.checkFailedAt&&r.checkFailedAt>(r.checkedAt??0)?Ju(l-r.checkFailedAt):null,checkDisabled:r==null?void 0:r.checkDisabled,checking:i};return a.jsxs("button",{type:"button",className:i?"v checking":"v",onClick:()=>{u(),f(!0)},"aria-busy":i||void 0,"aria-haspopup":"dialog","aria-label":Cee(h),title:Eee(h),children:["v",h.running]})})()})}function Mee({live:e,paused:t,pauseGate:n,monthUsageRef:r,monthlyUsage:s,monthlyUsageUnavailable:i}){return a.jsxs("span",{className:"status",children:[(()=>{const l=Z8({connected:e,paused:t,held:n.size,dropped:n.dropped});return l.resting?null:a.jsx("span",{className:`pill ${l.tone}`,title:l.title,children:a.jsxs("span",{className:"pill-box",children:[a.jsx("span",{className:"pill-widest","aria-hidden":!0,children:l.widest}),a.jsx("span",{className:"pill-label",children:l.label})]})})})(),a.jsxs("span",{ref:r,className:"month-usage",title:s?`${s.tokens.toLocaleString()} tokens · ${RR(s.cost)} spent since the 1st of this local calendar month`:i?"Monthly usage is unavailable — ccusage could not be read":"Loading usage since the 1st of this local calendar month",children:[a.jsx("span",{className:"month-usage-label",children:"this month"}),s?a.jsxs(a.Fragment,{children:[a.jsx("b",{children:st(s.tokens)}),a.jsx("span",{className:"month-usage-unit",children:"tokens"}),a.jsx("span",{className:"month-usage-sep","aria-hidden":!0,children:"·"}),a.jsx("b",{children:RR(s.cost)})]}):a.jsx("span",{className:"month-usage-pending",children:i?"unavailable":"…"})]})]})}function $ee({waitingSessions:e,waitingCursorRef:t,focusSession:n,now:r}){return a.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{t.current=e[0].id,n(e[0].id)},title:`Blocked waiting for you — click, or press W, to go to the one that has been stuck longest:
|
|
92
|
-
${e.map(s=>` ${s.label}: ${Xo(s.waiting)} (${Ju(r-s.waiting.since)})`).join(`
|
|
93
|
-
`)}`,"aria-label":`${e.length} session${e.length===1?"":"s"} waiting for you`,children:[a.jsx("span",{className:"ap-pulse","aria-hidden":!0}),a.jsx("b",{children:e.length})," ",a.jsx("span",{className:"ws-word",children:"waiting"})]})}function Iee({notifySaid:e}){return a.jsx("span",{className:e==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:e==="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:e==="on"?"notifications on":"notifications blocked"})}function Oee({versionCheck:e,welcome:t,desktopUpdate:n,pause:r,monthly:s,announcements:i,notify:l,waitingSessions:u,waitingCursorRef:d,focusSession:f,live:h,now:m,incidents:g}){const{version:w,notice:b,noticeOpen:x,showNotice:k,versionChecking:j,loadVersion:S}=e,{chipVersion:_,openReleaseNotes:E}=t,{readyAppUpdate:T}=n,{paused:R,pauseGate:A}=r,{monthlyUsage:B,monthlyUsageUnavailable:$,monthUsageRef:I}=s,{blockedSaid:D,watchSaid:F,incidentSaid:W}=i,{notifySaid:M}=l;return a.jsxs("div",{className:"readout",children:[a.jsxs("div",{className:"brand",children:[a.jsx("span",{className:"logo"}),a.jsx("h1",{children:wt}),a.jsx(Aee,{readyAppUpdate:T,notice:b,noticeOpen:x,version:w,chipVersion:_,versionChecking:j,now:m,openReleaseNotes:E,showNotice:k,loadVersion:S})]}),a.jsx(Mee,{live:h,paused:R,pauseGate:A,monthUsageRef:I,monthlyUsage:B,monthlyUsageUnavailable:$}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:D}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:F}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:W}),a.jsx(pz,{incidents:g}),u.length>0&&a.jsx($ee,{waitingSessions:u,waitingCursorRef:d,focusSession:f,now:m}),M&&a.jsx(Iee,{notifySaid:M})]})}function Lee({selected:e,now:t,selectedIds:n,focusAgent:r,clearSelection:s}){const i=un(e),l=Math.max(0,((e.endedAt??t)-e.startedAt)/1e3),u=e.state==="active"?i0(i.total,l):null,d=n.size-1;return a.jsxs("button",{type:"button",className:"selected-ribbon",title:`Zoom to ${e.label} and its session (Z)${i.total>0?`
|
|
94
|
-
${qe(i.total)} spent${u?` · ${u}`:""}`:""}`,onClick:()=>{try{r(e.id)}catch{}},children:[a.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),a.jsx("span",{className:"selected-label",children:e.label}),i.total>0&&a.jsxs("span",{className:"selected-cost",children:[qe(i.total),u?a.jsxs("span",{className:"selected-rate",children:[" · ",u]}):null]}),d>0&&a.jsxs("span",{className:"selected-extra",children:["+",d]}),a.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:f=>{f.stopPropagation(),s()},children:"×"})]})}function Pee({catBarRef:e,catBarOccluded:t,presentCats:n,hiddenCats:r,toggleCat:s}){return a.jsx("div",{ref:e,className:`cat-filter-bar${t?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:n.map(i=>{const l=r.has(i);return a.jsxs("button",{type:"button",className:`cat-filter${l?" off":""}`,onClick:()=>s(i),"aria-pressed":!l,title:`${l?"Show":"Hide"} ${hd[i]} tools`,children:[a.jsx(IQ,{cat:i}),a.jsx("span",{className:"cat-name",children:hd[i]})]},i)})})}const Dee=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(",");function Fee(e){var n,r;const t=e.target;!(t!=null&&t.closest)||t.closest(Dee)!==e.currentTarget||(e.preventDefault(),(r=(n=document.activeElement)==null?void 0:n.blur)==null||r.call(n))}function qee({trashZoneRef:e,trashState:t,trashPhase:n,trashLabel:r}){return a.jsxs("div",{ref:e,className:`drag-trash-zone ${t}${n==="leaving"?" leaving":""}`,role:"status",children:[a.jsx("svg",{className:"drag-trash-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M8 7V5.8C8 4.8 8.8 4 9.8 4h4.4c1 0 1.8.8 1.8 1.8V7m-10 0h12M8 10v8m4-8v8m4-8v8M7 7l.7 13h8.6L17 7"})}),a.jsxs("span",{className:"drag-trash-copy",children:[a.jsx("span",{className:"drag-trash-text",children:t==="over"?a.jsxs(a.Fragment,{children:["Release to remove ",a.jsx("strong",{className:"drag-trash-name",children:r||"this card"})]}):"Drop here to remove from the board"}),a.jsx("span",{className:"drag-trash-hint",children:t==="over"?"The session list (L) brings it back":"The session keeps running"})]})]})}function Bee({canvasRef:e,bubbling:t,dragging:n,trash:r,zoom:s,viewport:i,stateRef:l,peek:u,children:d}){const{trashDragging:f,trashState:h,trashPhase:m,trashZoneRef:g,trashLabel:w}=r,{lod:b,lodRef:x}=s,{markCanvasInput:k}=i,{peekAgent:j,peekLabel:S,peekRecap:_,peekBounds:E}=u;return a.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${t?" bubbling":""}${n?" dragging-any":""}${f&&h==="over"?" trash-hover":""}`,"data-lod":b,ref:e,onMouseDownCapture:Fee,onPointerDownCapture:k,onPointerUpCapture:k,onWheelCapture:k,onFocusCapture:T=>{const R=T.target;if(!J0(R)||x.current==null||x.current==="detail")return;const A=R.getAttribute("data-id");A&&l.current.agents.has(A)&&R.matches(":focus-visible")&&$I(A,R,"focus")},onBlurCapture:T=>{var A,B;const R=(B=(A=T.target).getAttribute)==null?void 0:B.call(A,"data-id");R&&Vs(R)},children:[d,Tu(m)&&a.jsx(qee,{trashZoneRef:g,trashState:h,trashPhase:m,trashLabel:w}),a.jsx(mJ,{agentFor:j,recapFor:_,labelFor:S,bounds:E})]})}function Uee({restarting:e,restartMode:t,live:n,paused:r}){return a.jsxs("div",{className:"conn-banner",role:"alert",children:[a.jsx("span",{className:"conn-dot"}),e?t==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${wt}…`:(()=>{const s=Y8({connected:n,paused:r});return a.jsxs(a.Fragment,{children:[`Lost connection to the ${wt} server. Reconnecting…`,s&&a.jsx("span",{className:"conn-sub",children:s})]})})()]})}function zee({oldName:e,version:t,dismissOldName:n}){return a.jsxs("div",{className:"ver-banner",role:"status",children:[a.jsx("span",{className:"ver-dot"}),a.jsxs("strong",{children:[e," still works — the deck is called ",wt," now."]}),t!=null&&t.renameFix?a.jsx("span",{className:"ver-sub",children:t.renameFix}):null,a.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:n,children:"×"})]})}const Hee=3e4;function Wee({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function Vee({bundle:e,running:t,pending:n,lastTried:r}){return t?Wee({bundle:e,running:t,lastTried:r})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function Gee(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function Kee({asked:e,reported:t}){return t?t!==e:!1}function KI(e){const t=e.thresholdMs??Hee;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 Yee(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 Xee(e,t){return e?t==null?"auto when idle":`auto in ${Yee(t)}`:"auto-restart off"}function MR(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function Zee(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 Jee(e){const t=KI(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}}const $R={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:"};function Qee({notice:e,version:t,dismissNotice:n,upgradeState:r,startUpgrade:s,copyCommand:i,cmdCopied:l,autoRestart:u,toggleAutoRestart:d,askRestart:f,restartCopy:h,restartFuseMs:m,restarting:g}){var w,b,x;return a.jsxs("div",{className:`ver-banner ${e.kind}`,role:"status",children:[a.jsx("span",{className:`ver-dot${m==null?"":" armed"}`}),e.kind==="restart"?a.jsxs(a.Fragment,{children:[a.jsxs("strong",{children:["v",e.to," is installed — this deck still runs v",e.from,"."]}),t!=null&&t.canRestart?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"ver-act",onClick:()=>f(),...zs(g),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
95
|
-
|
|
96
|
-
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:g?"restarting…":h.label}),!g&&a.jsx("span",{className:"ver-sub",children:h.clause}),a.jsxs("label",{className:"ver-auto",children:[a.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":u,onClick:d,"aria-label":"Auto-restart when idle",title:u?"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:a.jsx("span",{className:"switch-knob"})}),a.jsx("span",{"aria-hidden":!0,children:Xee(u,m)})]})]}):a.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."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("strong",{children:[wt," v",e.to," is out — you are on v",e.from,"."]}),(t==null?void 0:t.upgradeMode)==="install"&&r!=="failed"&&a.jsx("button",{type:"button",className:"ver-act",onClick:s,...zs(r==="running",r==="done"),title:`Runs ${((w=t==null?void 0:t.upgrade)==null?void 0:w.command)??(t==null?void 0:t.command)??"npm i -g"} here, then restarts once nothing is running.`,children:r==="running"?"installing…":r==="done"?"installed":"Update now"}),(t==null?void 0:t.upgradeMode)==="npx"&&(t==null?void 0:t.canRestart)&&a.jsx("button",{type:"button",className:"ver-act",onClick:()=>f({upgrade:!0}),...zs(g),title:`Runs ${t==null?void 0:t.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:g?"fetching…":r==="failed"?"Retry update":"Update & restart"}),r==="failed"?a.jsxs("span",{className:"ver-sub fail",title:((b=t==null?void 0:t.upgrade)==null?void 0:b.error)??"",children:[(t==null?void 0:t.upgradeMode)==="npx"?"update failed":"install failed",": ",((x=t==null?void 0:t.upgrade)==null?void 0:x.error)??"unknown error"," — run it yourself:"]}):(t==null?void 0:t.upgradeMode)==="npx"?a.jsx("span",{className:"ver-sub",children:t!=null&&t.canRestart?"npx cannot upgrade in place, so the deck re-runs:":$R.npx}):t!=null&&t.upgradeBlocked?a.jsx("span",{className:"ver-sub",children:$t($R,t.upgradeBlocked)??"cannot install from here"}):null,a.jsxs("button",{type:"button",className:"ver-cmd",onClick:i,title:"Copy to clipboard",children:[a.jsx("code",{children:t==null?void 0:t.command}),a.jsx("span",{className:"ver-cmd-hint",children:l?"copied":"copy"})]})]}),a.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:n,children:"×"})]})}function ete({restart:e,versionCheck:t,upgrade:n,oldNameNotice:r,everConnected:s,live:i,paused:l}){const{autoRestart:u,toggleAutoRestart:d,restarting:f,restartMode:h,restartedTo:m,askRestart:g,restartCopy:w,restartFuseMs:b}=e,{version:x,notice:k,noticeOpen:j,dismissNotice:S}=t,{upgradeState:_,startUpgrade:E,copyCommand:T,cmdCopied:R}=n,{oldName:A,oldNameOpen:B,dismissOldName:$}=r;return m?a.jsxs("div",{className:"ver-banner done",role:"status",children:[a.jsx("span",{className:"ver-dot"}),a.jsxs("strong",{children:["Restarted — now running v",m,"."]}),a.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):s&&!i?a.jsx(Uee,{restarting:f,restartMode:h,live:i,paused:l}):j&&k?a.jsx(Qee,{notice:k,version:x,dismissNotice:S,upgradeState:_,startUpgrade:E,copyCommand:T,cmdCopied:R,autoRestart:u,toggleAutoRestart:d,askRestart:g,restartCopy:w,restartFuseMs:b,restarting:f}):B&&A?a.jsx(zee,{oldName:A,version:x,dismissOldName:$}):null}function tte(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function nte(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 rte(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function ste(e,t){const n=rte(e),r=(...l)=>[n?`${n} on the canvas`:null,...l,"layout, pins and selection"].filter(u=>u!==null),s="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:s,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. ${s}`,confirm:"Clear everything"};if(!t.mine){const l=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 — ${l}${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:s,confirm:"Clear everything"};const i=t.decks-1;return{goes:r(`the event log ${i===1?"1 other running deck shares":`${i} other running decks share`} with this one — every session recorded in it, not just the ones drawn here`),stays:[i===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:s,confirm:"Clear everything"}}function ate({agentCount:e,onConfirm:t,onCancel:n}){const r=v.useRef(null),s=pt(n,{focusRef:r,layer:Sq}),[i,l]=v.useState(null);v.useEffect(()=>{let m=!1;return fetch("/api/clear").then(g=>g.ok?g.json():null).then(g=>{m||l(nte(g))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:d,final:f,confirm:h}=ste(e,i);return a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:s,className:"modal clear-confirm",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{className:"status-dot err","aria-hidden":!0}),a.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[a.jsxs("dl",{className:"cc-plan",children:[a.jsx("dt",{children:"Goes"}),a.jsx("dd",{children:u.map(m=>a.jsx("span",{children:m},m))}),a.jsx("dt",{children:"Stays"}),a.jsx("dd",{children:d.length>0?d.map(m=>a.jsx("span",{children:m},m)):a.jsx("span",{children:"nothing"})})]}),f&&a.jsx("p",{className:"cc-final",children:f}),a.jsxs("div",{className:"cc-actions",children:[a.jsx("button",{type:"button",ref:r,className:"btn",onClick:n,children:"Cancel"}),a.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const ote="Press Esc first if a key does nothing.",ite=[{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:"Delete",action:"take the selected card off the board — Undo brings it back",binds:["Delete"]},{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 lte({onClose:e,onTour:t}){const n=pt(e);return a.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:a.jsxs("div",{ref:n,className:"modal key-help",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[t&&a.jsxs("div",{className:"guide-door",children:[a.jsx("span",{children:"Eight pictures of what the deck shows."}),a.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),a.jsx("div",{className:"shortcuts",children:ite.map(r=>a.jsxs(v.Fragment,{children:[a.jsx("h3",{className:"kh-group",children:r.title}),r.rows.map(s=>a.jsxs("div",{className:"sc",children:[a.jsx("kbd",{children:s.cap}),a.jsx("span",{children:s.action})]},`${r.title}:${s.cap}:${s.action}`))]},r.title))}),a.jsx("p",{className:"kh-foot",children:ote})]})]})})}function cte(e,t){const n=(e??[]).filter(s=>s&&typeof s.fp=="string"&&!t.has(s.fp));if(!n.length)return{request:null,waiting:0};const r=[...n].sort((s,i)=>(s.at??0)-(i.at??0));return{request:r[0],waiting:r.length-1}}function ute({request:e,waiting:t,busy:n,now:r,onAccept:s,onDecline:i,onLater:l}){const u=v.useRef(null),d=pt(l,{focusRef:u}),f=Ws(n,"accept"),h=Ws(n,"dismiss");return a.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:a.jsxs("div",{ref:d,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("i",{className:"ap-pulse","aria-hidden":!0}),a.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:l,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[a.jsxs("p",{className:"lan-ask-who",children:[a.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",a.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",E0(e.at,r)]}),a.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."}),a.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",a.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&&a.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.`}),a.jsxs("div",{className:"lan-ask-acts",children:[a.jsx("button",{type:"button",ref:u,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:i,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),a.jsx("button",{type:"button",className:"btn primary",disabled:f.disabled,"aria-busy":f.busy,onClick:s,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function dte({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:r,deferLanPair:s}){const{request:i,waiting:l}=cte(e,t.current);return i?a.jsx(ute,{request:i,waiting:l,busy:n,now:Date.now(),onAccept:()=>void r("accept",i.fp),onDecline:()=>void r("dismiss",i.fp),onLater:()=>s(i.fp)}):null}const hte={"//":["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.27.6","3.27.7","3.28.0","3.28.1","3.29.3","3.29.4","3.29.6","3.29.7","3.29.9"],"3.32.1":[{title:"🔔 The tray icon comes back on Linux",body:"On Linux the app could lose its icon in the panel, after it updated itself or when the panel restarted, and stay without it until it was quit. It now notices within a minute and restarts by itself the next time you are away from its window, the way it installs an update. It does this at most once every six hours, and not again if a restart did not help."},{title:"🔕 A window you closed stays closed after a self-update",body:"When the app restarted by itself to install an update, it opened its window again even if you had closed it, and while that window was open the deck held back its notifications. A window you closed now stays closed."},{title:"🪟 No empty icon when ccdeck is already open",body:'Opening ccdeck again while it was running flashed an empty "…" icon in the Linux panel before bringing the window forward. It now only brings the window forward.'}],"3.32.0":[{title:"🗺️ A map of your network",body:"A new button on the Local network row, and in its view's header, opens a map of every deck around this one. This deck is at the centre and the paired decks that are on stand around it. Further out are the quiet ones, the machines nearby and any deck asking to pair. Wires are solid on your local network and dashed over Tailscale. Pointing at a deck says how it is reached, what it runs and which logins the two share, and pressing it opens that deck's own dialog."}],"3.31.0":[{title:"📊 Account capacity",body:"A gauge button in the accounts panel's header opens Account capacity: how many of your Claude accounts are ready now, what the 5-hour and 7-day windows have left across all of them, and a row for each account with its use, its state (Ready, Limited, Exhausted or Stale) and when it was last read. Each window also says whose reset comes next."},{title:"🚦 Claude and Codex incidents",body:"When Anthropic's or OpenAI's status page reports an incident on something your sessions use, the deck says so in the topbar, the Usage panel and the tray, and every mark links to the status page. A provider with nothing wrong draws nothing."},{title:"↕️ Order your other accounts",body:"The Other accounts row can sort the list by slot, by how full a window is, or by most room, and open every account at once. Both stay as you left them after a reload."},{title:"🔐 A settings folder left by sudo can be given back",body:'On a Mac, running ccdeck once with sudo left its settings folder owned by another user, and every settings change was refused, sharing an account included. The message now offers "give it back": macOS asks for your password, the folder is yours again, and the deck reads its settings back without a restart.'}],"3.30.0":[{title:"🧮 Token counts and costs are no longer doubled",body:"Claude Code writes a reply that has thinking, text and tool calls as several transcript lines, each carrying the whole request's usage. The deck added up every line, so a session's tokens and cost on its card came out close to twice what it was billed, and the context panel counted each part of a reply as its own message. Each request is now counted once. Expect the totals on your cards to come down."},{title:"⏳ Claude's saved limit resets on the Usage panel",body:`When your Claude account has free limit resets to spend ("Reset for free" in Claude's Settings → Usage), the Claude card now says how many there are and when the first one expires, the way the Codex card already did. The deck only reports them; you spend them in Claude's own settings.`},{title:"🔑 LAN invites need the other deck updated",body:`An invite's code is now a long random secret instead of six digits, so nobody else on the network can work it out and pair in your place, and a wrong code is refused by name. An invite made on this version can only be joined from a deck on this version or later: an older deck answers "That is not an invite". Update that deck, or make the invite on the older one and join it here.`},{title:"🔕 AGENTS_DECK_NO_NOTIFY keeps Browser Watch quiet too",body:"A deck started with AGENTS_DECK_NO_NOTIFY=1 still raised a desktop notification for every new Browser Watch finding. It no longer does. The finding is still in the Browser Watch panel and its log, which says why no notification came."},{title:"🛠️ Smaller fixes",body:'Delete removes the card you just clicked. A LAN address you typed stays in the list when a round cannot reach it, and the status line under the LAN switch now agrees with the rows below it. In the desktop app, a dismissed "update is ready" notice stays dismissed after you answer the first-launch question. Sizes read the same in every panel ("1.1 KB"). Faded text stays readable, a keyboard can see the scrollbar, and numbers use a monospaced font on Windows and Linux as well.'}],"3.29.11":[{title:"💲 Claude Sonnet 5.5 has a price",body:`Sessions on Claude Sonnet 5.5 showed "not priced" on the board, and the Projects report could only show a minimum for them. They are now priced at Anthropic's published rate, the same as Sonnet 5: $2 per million input tokens and $10 per million output tokens.`}],"3.29.10":[{title:"💲 Claude Opus 5.5 has a price",body:`Sessions on Claude Opus 5.5 showed "not priced" on the board, and the Projects report counted them as costing nothing, so its totals read far too low. They are now priced at Anthropic's published rate. If a model still has no price, Projects shows its total as a minimum, like $11.19+, and names the model, instead of a total that looks complete.`}],"3.29.8":[{title:"🔁 Removed cards come back when their agent works again",body:"Remove from board is for finished work. If the agent behind a card you removed starts a tool call, gets a new prompt or starts a subagent, the card returns on its own, together with the card it hangs from, and it stays back after a reload. Cards whose agents stay idle stay removed."}],"3.29.1":[{title:"🗂️ One row per project in Projects",body:"The Projects report now counts a session's work under the folder you started it in, the same name its card has on the canvas, instead of adding a row for every folder the agent moved into. The first start after updating re-reads your transcripts once to regroup the report."},{title:"🔔 Tidier custom sounds",body:"Importing a sound, recording one and choosing a spoken voice now sit in compact cards that respond to clicks and focus like the rest of the deck."}],"3.29.0":[{title:"🎵 Your own stations in Claude FM",body:"Add any YouTube live link or radio stream as a station in Appearance, next to the built-in ones, and mute the music without losing your volume. When a station is not live, the picker now says so instead of staying silent."},{title:"🔔 Notification sounds and voices of your own",body:"Pick a local audio file or a spoken voice for each alert, so the sound that means an agent is waiting is one you will recognise."},{title:"🗑️ Drag a card off the board to remove it",body:"Drag a card to the target at the bottom of the canvas to take it off the board, or use Remove from board in the detail panel (Delete). The session keeps running, and the session list (L) brings it back."},{title:"🔐 Optional invite-only pairing",body:"Pairing works as before, with or without an invite. If you want, Local network can now be set to accept only decks that join with an invite you created, so a nearby machine cannot ask to pair on its own."},{title:"🌐 Account sharing between your machines is more reliable",body:"A locked macOS Keychain is explained instead of failing silently, a login that is broken or belongs to another account is never shared, and a sync that stops partway keeps what already arrived."},{title:"📅 Projects opens on Today",body:"The Projects report per account starts with today's work, and an empty window offers the next wider one. The topbar also shows this month's usage, and the desktop app can restart into an update from its own window."}],"3.27.0":[{title:"📊 Projects: where each account spent its work",body:"Each account card's ⋯ menu now breaks its cost down by project, over 7d / 30d / all."}],"3.27.1":[{title:"🎨 Make Appearance easier to tune",body:"The Appearance dialog now has clearer sections, stronger selection states, and a calmer layout for choosing a theme and configuring music. Your existing settings and keyboard shortcuts continue to work."}],"3.27.2":[{title:"💰 Project costs now match Usage",body:"Project cost totals no longer count the same Claude request once for every content block. Existing project history is rebuilt automatically so the totals align with the Usage panel."}],"3.27.3":[{title:"🎵 Station selection works in the desktop app",body:"The music station picker now opens inside ccdeck instead of relying on the operating system popup, so choosing a station works reliably in the Electron app."}],"3.27.4":[{title:"✅ Desktop picker release checks are green",body:"The station picker now keeps the same keyboard, motion, focus, and layout behavior as the rest of ccdeck across desktop and browser builds."}],"3.27.5":[{title:"🧭 The welcome tour stays dismissed",body:"Electron now remembers that you completed the onboarding tour at the deck level, so an update or loopback port change no longer shows the same tour again."},{title:"🎵 The station picker has a clearer finish",body:"The music selector has a tighter trigger, a purposeful chevron, and more deliberate option spacing so it reads like a native part of Appearance."}],"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.
|
|
97
|
-
|
|
98
|
-
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.
|
|
99
|
-
|
|
100
|
-
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.
|
|
101
|
-
|
|
102
|
-
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.
|
|
103
|
-
|
|
104
|
-
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.
|
|
105
|
-
|
|
106
|
-
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".
|
|
107
|
-
|
|
108
|
-
**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.
|
|
109
|
-
|
|
110
|
-
\`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.
|
|
111
|
-
|
|
112
|
-
**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.
|
|
113
|
-
|
|
114
|
-
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.
|
|
115
|
-
|
|
116
|
-
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.
|
|
117
|
-
|
|
118
|
-
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.
|
|
119
|
-
|
|
120
|
-
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.
|
|
121
|
-
|
|
122
|
-
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.
|
|
123
|
-
|
|
124
|
-
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.
|
|
125
|
-
|
|
126
|
-
What you are reading is the first version that does not.
|
|
127
|
-
|
|
128
|
-
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.
|
|
129
|
-
|
|
130
|
-
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.
|
|
131
|
-
|
|
132
|
-
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.
|
|
133
|
-
|
|
134
|
-
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.
|
|
135
|
-
|
|
136
|
-
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.
|
|
137
|
-
|
|
138
|
-
The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
|
|
139
|
-
|
|
140
|
-
**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.
|
|
141
|
-
|
|
142
|
-
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.
|
|
143
|
-
|
|
144
|
-
\`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.
|
|
145
|
-
|
|
146
|
-
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.
|
|
147
|
-
|
|
148
|
-
**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.
|
|
149
|
-
|
|
150
|
-
**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.
|
|
151
|
-
|
|
152
|
-
**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.
|
|
153
|
-
|
|
154
|
-
**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.
|
|
155
|
-
|
|
156
|
-
**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.
|
|
157
|
-
|
|
158
|
-
**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.
|
|
159
|
-
|
|
160
|
-
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.
|
|
161
|
-
|
|
162
|
-
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.
|
|
163
|
-
|
|
164
|
-
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.
|
|
165
|
-
|
|
166
|
-
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.
|
|
167
|
-
|
|
168
|
-
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.
|
|
169
|
-
|
|
170
|
-
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.
|
|
171
|
-
|
|
172
|
-
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.
|
|
173
|
-
|
|
174
|
-
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.
|
|
175
|
-
|
|
176
|
-
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.
|
|
177
|
-
|
|
178
|
-
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.
|
|
179
|
-
|
|
180
|
-
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.
|
|
181
|
-
|
|
182
|
-
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.
|
|
183
|
-
|
|
184
|
-
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.
|
|
185
|
-
|
|
186
|
-
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.
|
|
187
|
-
|
|
188
|
-
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.
|
|
189
|
-
|
|
190
|
-
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.
|
|
191
|
-
|
|
192
|
-
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.
|
|
193
|
-
|
|
194
|
-
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.
|
|
195
|
-
|
|
196
|
-
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.
|
|
197
|
-
|
|
198
|
-
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.
|
|
199
|
-
|
|
200
|
-
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.
|
|
201
|
-
|
|
202
|
-
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.
|
|
203
|
-
|
|
204
|
-
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.
|
|
205
|
-
|
|
206
|
-
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.
|
|
207
|
-
|
|
208
|
-
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.
|
|
209
|
-
|
|
210
|
-
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.
|
|
211
|
-
|
|
212
|
-
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.
|
|
213
|
-
|
|
214
|
-
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.
|
|
215
|
-
|
|
216
|
-
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.
|
|
217
|
-
|
|
218
|
-
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.
|
|
219
|
-
|
|
220
|
-
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.
|
|
221
|
-
|
|
222
|
-
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.
|
|
223
|
-
|
|
224
|
-
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.
|
|
225
|
-
|
|
226
|
-
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.
|
|
227
|
-
|
|
228
|
-
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.
|
|
229
|
-
|
|
230
|
-
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.
|
|
231
|
-
|
|
232
|
-
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.
|
|
233
|
-
|
|
234
|
-
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.
|
|
235
|
-
|
|
236
|
-
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.
|
|
237
|
-
|
|
238
|
-
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".
|
|
239
|
-
|
|
240
|
-
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.
|
|
241
|
-
|
|
242
|
-
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.
|
|
243
|
-
|
|
244
|
-
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.
|
|
245
|
-
|
|
246
|
-
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.
|
|
247
|
-
|
|
248
|
-
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.
|
|
249
|
-
|
|
250
|
-
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.
|
|
251
|
-
|
|
252
|
-
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.
|
|
253
|
-
|
|
254
|
-
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.
|
|
255
|
-
|
|
256
|
-
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.
|
|
257
|
-
|
|
258
|
-
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.
|
|
259
|
-
|
|
260
|
-
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.
|
|
261
|
-
|
|
262
|
-
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.
|
|
263
|
-
|
|
264
|
-
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.
|
|
265
|
-
|
|
266
|
-
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.
|
|
267
|
-
|
|
268
|
-
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.
|
|
269
|
-
|
|
270
|
-
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.
|
|
271
|
-
|
|
272
|
-
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.
|
|
273
|
-
|
|
274
|
-
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.
|
|
275
|
-
|
|
276
|
-
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.
|
|
277
|
-
|
|
278
|
-
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.
|
|
279
|
-
|
|
280
|
-
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.
|
|
281
|
-
|
|
282
|
-
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.
|
|
283
|
-
|
|
284
|
-
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.
|
|
285
|
-
|
|
286
|
-
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.
|
|
287
|
-
|
|
288
|
-
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.`}]},sb="agent-dag.releaseNotesSeen";function IR(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function ni(e,t){const n=IR(e),r=IR(t);for(let s=0;s<Math.max(n.length,r.length);s++){const i=(n[s]??0)-(r[s]??0);if(i!==0)return i<0?-1:1}return 0}function ri(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function fte(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 pte(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,r]of Object.entries(e)){if(!ri(n)||!Array.isArray(r))continue;const s=r.filter(fte);s.length&&t.push({version:n,notes:s})}return t.sort((n,r)=>ni(r.version,n.version))}const OR=pte(hte);function YI(e,t,n){return e.filter(r=>ni(r.version,n)<=0&&(t===null||ni(r.version,t)>0))}function mte(e,t){return e.filter(n=>ni(n.version,t)===0)}function gte(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 yte({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 l=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${l} changed something you would notice. Clicking the version in the topbar brings this back.`}if(r&&ri(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 s=n[0].version;if(!ri(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 i=ni(s,t);return i<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.`:i>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 wte=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function vte(e){const t=wte.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function xte(e){if(!e)return null;let t=null;try{t=e.getItem(sb)}catch{return null}return ri(t)?t:null}function bte(e){if(!e)return!1;try{return e.getItem(sb),!0}catch{return!1}}function kte(e,t){if(!e)return!1;try{return e.setItem(sb,t),!0}catch{return!1}}const XI="agent-dag.tourSeen";function Nte(e){if(!e)return!1;try{return e.getItem(XI)==="1"}catch{return!1}}function jte(e){if(!e)return!1;try{return e.setItem(XI,"1"),!0}catch{return!1}}function Ste({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 _te({stored:e,running:t,notes:n,remembers:r=!0}){if(!ri(t))return{show:[],record:null,reason:"no-version"};if(!ri(e)){if(!r)return{show:[],record:t,reason:"cannot-remember"};const l=mte(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const s=ni(e,t);if(s===0)return{show:[],record:null,reason:"seen"};if(s>0)return{show:[],record:null,reason:"ahead"};const i=YI(n,e,t);return i.length?{show:i,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function Ete(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 ZI(e,t=!0){const n=[];let r="";const s=()=>{r&&(n.push({kind:"text",text:r}),r="")};let i=0;for(;i<e.length;){if(e[i]==="`"){const l=e.indexOf("`",i+1);if(l>i+1){s(),n.push({kind:"code",text:e.slice(i+1,l)}),i=l+1;continue}}else if(t&&e.startsWith("**",i)){const l=Ete(e,i);if(l>0){s(),n.push({kind:"bold",kids:ZI(e.slice(i+2,l),!1)}),i=l+2;continue}}r+=e[i],i+=1}return s(),n}function Cte({entries:e,since:t,running:n,firstRun:r,onClose:s,onTour:i,updateVersion:l,updateBusy:u,onUpdateRestart:d,updateFailure:f,onRestart:h}){const m=pt(s),g=gte(e);return a.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:a.jsxs("div",{ref:m,className:"modal release-notes",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),g&&a.jsx("span",{className:"modal-tool-id",children:g})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[(l||f)&&a.jsxs("div",{className:"rn-update",children:[l&&d&&a.jsxs("div",{className:"guide-door",children:[a.jsxs("span",{children:["ccdeck v",l," is downloaded and verified."]}),a.jsx("button",{type:"button",className:"btn",onClick:d,"aria-busy":u||void 0,children:u?"Restarting…":fd})]}),a.jsx("p",{className:"rn-update-said",role:"status",children:f})]}),a.jsx("p",{className:"modal-note",children:yte({since:t,running:n,firstRun:r,entries:e})}),i&&!l&&a.jsxs("div",{className:"guide-door",children:[a.jsx("span",{children:"Eight pictures of what the deck shows."}),a.jsx("button",{type:"button",className:"btn",onClick:i,children:"Take the tour"})]}),h&&a.jsxs("div",{className:"guide-door",children:[a.jsx("span",{children:"Restart the deck. Sessions, settings and pairings come back as they were."}),a.jsx("button",{type:"button",className:"btn",onClick:h,children:"Restart"})]}),e.map(w=>a.jsxs("section",{className:"modal-section",children:[a.jsxs("h3",{className:"rn-version",children:["v",w.version]}),a.jsx("ul",{className:"rn-notes",children:w.notes.map((b,x)=>{const{icon:k,rest:j}=vte(b.title);return a.jsxs("li",{className:"rn-note",children:[a.jsxs("p",{className:"rn-note-title",children:[k&&a.jsx("span",{className:"rn-note-icon",children:k}),j]}),a.jsx("p",{className:"rn-note-body",children:JI(ZI(b.body))})]},x)})})]},w.version))]})]})})}function JI(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?a.jsx("code",{className:"rn-code",children:t.text},n):a.jsx("strong",{className:"rn-strong",children:JI(t.kids)},n))}function Tte({state:e,sessionId:t,onClose:n}){const r=v.useMemo(()=>Rte(e,t),[e,t]),s=v.useRef(null),i=pt(n,{focusRef:s});return r?a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:i,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[a.jsxs("div",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),a.jsx("span",{id:"ss-title",className:"modal-tool-name",title:r.cwd??r.sessionId,children:r.label}),a.jsxs("span",{className:"modal-tool-id",children:["· ",r.sessionId.slice(0,8)]})]}),a.jsxs("div",{className:"modal-actions",children:[a.jsx("span",{className:"modal-dur",title:"Total wall time",children:r.durationLabel}),a.jsx("button",{type:"button",ref:s,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),a.jsxs("div",{className:"modal-body",children:[a.jsxs("section",{className:"ss-hero",children:[a.jsxs("div",{className:"ss-hero-left",children:[a.jsx("div",{className:"ss-cost-label",children:hM}),a.jsx("div",{className:"ss-cost",children:qe(r.cost.total)}),r.modelChips.length>0&&a.jsx("div",{className:"ss-models",children:r.modelChips.map(l=>a.jsx("span",{className:"model-chip","data-family":bd(l),title:l,children:Hs(l)},l))})]}),a.jsx("div",{className:"ss-hero-right",children:r.cost.total>0&&a.jsxs(a.Fragment,{children:[a.jsx(g0,{cost:r.cost,size:"lg"}),a.jsxs("div",{className:"ss-cost-legend",children:[a.jsxs("span",{className:"ssl ssl-in",children:["input ",a.jsx("b",{children:qe(r.cost.input)})]}),a.jsxs("span",{className:"ssl ssl-out",children:["output ",a.jsx("b",{children:qe(r.cost.output)})]}),a.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",a.jsx("b",{children:qe(r.cost.cacheRead)})]}),a.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",a.jsx("b",{children:qe(r.cost.cacheWrite)})]})]})]})})]}),a.jsxs("section",{className:"ss-stats",children:[a.jsx(Io,{label:"agents",value:r.agentCount}),a.jsx(Io,{label:"subagents",value:r.subagentCount}),a.jsx(Io,{label:"tool calls",value:r.toolCount}),a.jsx(Io,{label:"prompts",value:r.promptCount}),a.jsx(Io,{label:"tokens",value:r.tokensSum.toLocaleString()}),r.errCount>0&&a.jsx(Io,{label:"errors",value:r.errCount,tone:"err"})]}),r.topTools.length>0&&a.jsxs("section",{className:"modal-section",children:[a.jsx("h4",{children:"Most-used tools"}),a.jsx("div",{className:"ss-top-tools",children:r.topTools.map(([l,u])=>a.jsxs("div",{className:"ss-tt",children:[a.jsx("span",{className:"ss-tt-name",children:l}),a.jsx("span",{className:"ss-tt-bar",children:a.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/r.topTools[0][1]*100}%`}})}),a.jsx("span",{className:"ss-tt-count",children:u})]},l))})]}),r.firstPrompt&&a.jsxs("section",{className:"modal-section",children:[a.jsx("h4",{children:"Opening prompt"}),a.jsx("div",{className:"ss-prompt",children:r.firstPrompt})]})]})]})}):null}function Io({label:e,value:t,tone:n}){return a.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[a.jsx("div",{className:"ss-stat-value",children:t}),a.jsx("div",{className:"ss-stat-label",children:e})]})}function Rte(e,t){const n=e.agents.get(t);if(!n)return null;const r=[];for(const _ of e.agents.values())_.sessionId===t&&r.push(_);if(r.length===0)return null;const s={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},i=new Set,l=new Map;let u=0,d=0,f=0,h=0,m=0,g,w=1/0,b=0;for(const _ of r){const E=un(_);s.input+=E.input,s.output+=E.output,s.cacheRead+=E.cacheRead,s.cacheWrite+=E.cacheWrite,s.total+=E.total;for(const R of LA(_))i.add(R);_.model&&i.add(_.model),_.kind==="subagent"&&m++;const T=CA(_.prompts);d+=T.length,!g&&T.length>0&&(g=T[0].text),f+=_.usage.inputTokens+_.usage.outputTokens,u+=_.toolCount,w=Math.min(w,_.startedAt),b=Math.max(b,_.endedAt??Date.now());for(const R of _.tools)l.set(R.name,(l.get(R.name)??0)+1),R.ok===!1&&h++}const x=Math.max(0,b-w),k=Math.floor(x/1e3),j=k<60?`${k}s`:k<3600?`${Math.floor(k/60)}m ${String(k%60).padStart(2,"0")}s`:`${Math.floor(k/3600)}h ${Math.floor(k%3600/60)}m`,S=Array.from(l.entries()).sort((_,E)=>E[1]-_[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:j,cost:s,modelChips:Array.from(i),agentCount:r.length,subagentCount:m,toolCount:u,promptCount:d,tokensSum:f,errCount:h,topTools:S,firstPrompt:g}}const Ate=60,Mte=6e3,Tr=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),yn=e=>typeof e=="string"?e:null;function Da(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((i,l)=>[String(l),i]):Object.entries(e);if(r.length===0)return n?"[]":"{}";const s=[];for(const[i,l]of r){const u=n?`${t}-`:`${t}${i}:`;if(typeof l=="string"&&l.includes(`
|
|
289
|
-
`)){s.push(u);for(const d of l.split(`
|
|
290
|
-
`))s.push(`${t} ${d}`)}else if(l!==null&&typeof l=="object"){const d=Da(l,`${t} `);d==="[]"||d==="{}"?s.push(`${u} ${d}`):s.push(u,d)}else s.push(`${u} ${l===void 0?"(none)":String(l)}`)}return s.join(`
|
|
291
|
-
`)}function $te(e){return e.lines??e.text.split(`
|
|
292
|
-
`).map(t=>({text:t}))}function Ite(e,t){if(t)return{shown:e,cut:!1};const n=[];let r=0;for(const s of e){if(n.length===Ate)return{shown:n,cut:!0};const i=Mte-r;if(s.text.length>i)return n.push({...s,text:`${s.text.slice(0,Math.max(i,0))}…`}),{shown:n,cut:!0};n.push(s),r+=s.text.length+1}return{shown:n,cut:!1}}const Qt=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),wn=(e,t)=>({label:e,text:t,inline:!0}),QI=(e,t)=>({label:e,text:t.map(n=>n.text).join(`
|
|
293
|
-
`),lines:t});function Ote(e,t){return[...e.split(`
|
|
294
|
-
`).map(n=>({text:`- ${n}`,tone:"del"})),...t.split(`
|
|
295
|
-
`).map(n=>({text:`+ ${n}`,tone:"add"}))]}function Lte(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!Tr(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 s=String(r);t.push(s.startsWith("+")?{text:s,tone:"add"}:s.startsWith("-")?{text:s,tone:"del"}:{text:s})}}return t}function LR(e){if(typeof e=="string")return[Qt(void 0,e)];if(!Tr(e))return[Qt(void 0,Da(e))];const t=[],n=yn(e.type);n==="create"&&t.push(wn("result","created the file"));const r=Lte(e.structuredPatch);return r&&t.push(QI("applied",r)),e.userModified===!0&&t.push(wn("note","the user changed it before it was applied")),t.length?t:[wn("result",n==="update"?"updated the file":"done")]}function Pte(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 Dte(e){if(typeof e=="string")return[Qt(void 0,e)];const t=Tr(e)&&Tr(e.file)?e.file:null,n=yn(t==null?void 0:t.content);if(t&&n!=null){const s=[],i=Number(t.numLines),l=Number(t.totalLines),u=Number(t.startLine);return Number.isFinite(i)&&Number.isFinite(l)&&l>0&&s.push(wn("lines",i>=l?`all ${l}`:Number.isFinite(u)?`${u}–${u+i-1} of ${l}`:`${i} of ${l}`)),s.push(Qt("content",n)),s}const r=Tr(e)?yn(e.type):null;return r&&r!=="text"?[wn("result",`${/^[aeiou]/i.test(r)?"an":"a"} ${r} file`)]:[Qt(void 0,Da(e))]}function Fte(e){if(typeof e=="string")return[Qt("output",e)];if(!Tr(e))return[Qt(void 0,Da(e))];const t=yn(e.stdout),n=yn(e.stderr);if(t==null&&n==null)return[Qt(void 0,Da(e))];const r=[];return t&&r.push(Qt("output",t.replace(/\n$/,""))),n&&r.push(Qt("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&r.push(wn("note","interrupted before it finished")),r.length?r:[wn("output","none")]}function qte(e,t,n){const r=Tr(t)?t:null;if(r&&(e==="Edit"||e==="MultiEdit")){const s=yn(r.file_path),i=(e==="MultiEdit"?Array.isArray(r.edits)?r.edits:[]:[r]).filter(Tr).filter(l=>yn(l.old_string)!=null&&yn(l.new_string)!=null);if(s&&i.length){const l=[wn("file",s)];return i.forEach((u,d)=>{const f=u.replace_all===!0?", every occurrence":"";l.push(QI(i.length>1?`change ${d+1}${f}`:`change${f}`,Ote(u.old_string,u.new_string)))}),{input:l,response:LR(n)}}}if(r&&e==="Write"){const s=yn(r.file_path),i=yn(r.content);if(s&&i!=null)return{input:[wn("file",s),Qt("content",i)],response:LR(n)}}if(r&&e==="Read"){const s=yn(r.file_path);if(s){const i=Pte(r);return{input:i?[wn("file",s),wn("lines",i)]:[wn("file",s)],response:Dte(n)}}}if(r&&e==="Bash"){const s=yn(r.command);if(s!=null){const i=yn(r.description);return{input:i?[Qt("command",s),wn("why",i)]:[Qt("command",s)],response:Fte(n)}}}return{input:[Qt(void 0,Da(t))],response:[Qt(void 0,Da(n))]}}function PR(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(Tr(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(`
|
|
296
|
-
`);if(e==="Read"&&t==="response"&&Tr(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 Bte({tool:e,onClose:t}){const n=pt(t),r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=e.input??e.inputPreview,i=e.response??e.errorPreview,l=qte(e.name,s,i);return a.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:a.jsxs("div",{ref:n,className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),a.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),a.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),a.jsxs("div",{className:"modal-actions",children:[a.jsx("span",{className:"modal-dur",children:FA(e,"in-flight…")}),a.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),a.jsxs("section",{className:"modal-body",children:[e.trimmed&&a.jsx("div",{className:"modal-section",children:a.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),a.jsxs("div",{className:"modal-section",children:[a.jsxs("div",{className:"tm-head",children:[a.jsx("h4",{children:"Input"}),a.jsx(FR,{text:PR(e.name,"input",s),what:"input"})]}),l.input.map((u,d)=>a.jsx(DR,{block:u},d))]}),a.jsxs("div",{className:"modal-section",children:[a.jsxs("div",{className:"tm-head",children:[a.jsxs("h4",{children:["Response ",r==="err"&&a.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&a.jsx(FR,{text:PR(e.name,"response",i),what:"response"})]}),e.endedAt==null?a.jsx("pre",{children:"(waiting…)"}):l.response.map((u,d)=>a.jsx(DR,{block:u},d))]})]})]})})}const Ute={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function DR({block:e}){const[t,n]=v.useState(!1);if(e.inline)return a.jsxs("p",{className:"tm-inline",children:[e.label&&a.jsx("span",{className:"tm-label",children:e.label}),a.jsx("code",{children:e.text})]});const{shown:r,cut:s}=Ite($te(e),t);return a.jsxs("div",{className:"tm-block",children:[e.label&&a.jsx("span",{className:"tm-label",children:e.label}),a.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?r.map((i,l)=>a.jsxs("span",{className:i.tone?Ute[i.tone]:void 0,children:[i.text,l<r.length-1?`
|
|
297
|
-
`:""]},l)):r.map(i=>i.text).join(`
|
|
298
|
-
`)}),s&&a.jsx("button",{type:"button",className:"btn tm-more",onClick:()=>n(!0),children:"show all"})]})}function FR({text:e,what:t}){const[n,r]=v.useState(!1),s=v.useRef(!0);return v.useEffect(()=>()=>{s.current=!1},[]),a.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void qa(e).then(i=>{!i||!s.current||(r(!0),window.setTimeout(()=>{s.current&&r(!1)},1600))}),children:n?"copied":"copy"})}const zte=v.lazy(()=>m0(()=>import("./UsageHistoryModal-CNjMaM59.js"),[])),Hte=v.lazy(()=>m0(()=>import("./BrowserWatchModal-ohP7oQCN.js"),[]));function Wte({dialogs:e,welcome:t,desktopUpdate:n,versionCheck:r,restart:s,lanPairs:i,clearFlow:l,watchBadge:u,announcements:d,appearance:f,providers:h,stateRef:m,agentCount:g}){const{openedTool:w,setOpenedToolKey:b,usageHistoryOpen:x,setUsageHistoryOpen:k,browserWatchOpen:j,setBrowserWatchOpen:S,contextAgent:_,setContextFor:E,summaryFor:T,setSummaryFor:R,keyHelpOpen:A,setKeyHelpOpen:B}=e,{tourOpen:$,openTour:I,closeTour:D,releaseNotes:F,closeReleaseNotes:W,chipVersion:M}=t,{desktopUpdateRestarting:O,desktopUpdateFailure:L,readyAppUpdate:K,askDesktopUpdateRestart:Z}=n,{version:q}=r,{askRestart:H}=s,{clearConfirmOpen:P,setClearConfirmOpen:Y,requestClear:G}=l,{setWatchOn:z,markWatchSeen:X}=u,{setWatchSaid:V}=d,{palette:J}=f;return a.jsxs(a.Fragment,{children:[w&&a.jsx(Bte,{tool:w,onClose:()=>b(null)}),x&&a.jsx(v.Suspense,{fallback:null,children:a.jsx(zte,{providers:h,onClose:()=>k(!1)})}),j&&a.jsx(v.Suspense,{fallback:null,children:a.jsx(Hte,{onClose:()=>S(!1),onSeen:ee=>{V(""),X(ee)},onWatching:z,palette:J})}),_&&a.jsx(Hq,{agent:_,onClose:()=>E(null)}),T&&a.jsx(Tte,{state:m.current,sessionId:T,onClose:()=>R(null)}),F&&a.jsx(Cte,{entries:F.entries,since:F.since,firstRun:F.firstRun,running:M,onClose:W,onTour:()=>{W(),I()},updateVersion:K==null?void 0:K.version,updateBusy:O,updateFailure:L&&(!K||K.version===L.version)?See(L.failure,L.version):void 0,onUpdateRestart:K?()=>{Z(K.version)}:void 0,onRestart:!K&&(q!=null&&q.canRestart)?()=>{W(),H()}:void 0}),a.jsx(dte,{...i}),A&&a.jsx(lte,{onClose:()=>B(!1),onTour:()=>{B(!1),I()}}),$&&a.jsx(JM,{title:"What the deck shows you",steps:y9,onClose:D}),P&&a.jsx(ate,{agentCount:g,onConfirm:()=>G("confirmation"),onCancel:()=>Y(!1)})]})}const Vte=1e3;function Gte(e={}){const t=Math.max(1,Math.floor(e.limit??Vte)),n=e.protect;let r=!1,s=[],i=new Set,l=0,u=0,d=null;return{get paused(){return r},get size(){return s.length},get dropped(){return l},get overflowed(){return l>0},get through(){return u},accept(f){const h=typeof(f==null?void 0:f.seq)=="number"?f.seq:null,m=(f==null?void 0:f.epoch)??null,g=m!==null&&m!==d;g&&(d=m,u=0);const w=h!==null&&!g&&h<=u;if(h!==null&&h>u&&(u=h),!r)return!0;if(w)return!1;if(s.push(f),n!=null&&n(f)&&i.add(f),s.length>t){let b=0;if(i.size<s.length)for(;i.has(s[b]);)b++;const[x]=s.splice(b,1);i.delete(x),l++}return!1},setPaused(f){if(r=f,f)return[];const h=s;return s=[],i=new Set,l=0,h}}}function Kte(e){const t=v.useState(()=>Gte({protect:i=>N6(e.current,i)}))[0],[n,r]=v.useState(!1),s=v.useCallback(()=>{const i=t.paused&&t.dropped>0,l=t.setPaused(!t.paused);i&&Q6(e.current);for(const u of l)e.current=$A(e.current,u);r(t.paused)},[t,e]);return{pauseGate:t,paused:n,togglePause:s}}const Ox={kind:"assumed",claude:!0,codex:!0};function Yte(e){if(!e||typeof e!="object")return Ox;const t=e.providers;if(!t||typeof t!="object")return Ox;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Xte(e){const[t,n]=v.useState(null),[r,s]=v.useState(Ox);v.useEffect(()=>{let l=!1;return fetch("/api/health").then(u=>u.ok?u.json():null).then(u=>{l||(s(Yte(u)),!(!u||typeof u.workspace!="string")&&n(u.workspace))}).catch(()=>{}),()=>{l=!0}},[e]);const i=On(r);return{workspace:t,providers:r,providersRef:i}}const eO=3*6e4,Zte=2e4;function Jte({fetchReport:e,visible:t,now:n,onReport:r}){let s=0,i=!0;const l=async()=>{if(!t())return;const u=await e();!i||!u||(s=n(),r(u))};return{tick:l,wake:async()=>{t()&&n()-s>=eO&&await l()},stop:()=>{i=!1}}}async function Qte(){try{const e=await fetch("/api/provider-status",{signal:AbortSignal.timeout(Zte)});return e.ok?await e.json():null}catch{return null}}function ene(e){const[t,n]=v.useState(null);return v.useEffect(()=>{if(!e){n(null);return}const r=Jte({fetchReport:Qte,visible:()=>document.visibilityState==="visible",now:()=>Date.now(),onReport:n});r.tick();const s=window.setInterval(r.tick,eO),i=()=>{r.wake()};return document.addEventListener("visibilitychange",i),()=>{r.stop(),window.clearInterval(s),document.removeEventListener("visibilitychange",i)}},[e]),t}const tne={degraded:"degraded performance",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},nne={degraded:"degraded",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},rne={degraded:"degraded",partial_outage:"outage",major_outage:"outage",maintenance:"maint."},sne={claude:"Claude",codex:"Codex"},ane=new Set(["status.claude.com","status.openai.com"]),one=30*6e4,ine=10*6e4;function lne(e){if(typeof e!="string")return null;try{const t=new URL(e);return t.protocol==="https:"&&ane.has(t.hostname)?t:null}catch{return null}}function qR(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hourCycle:"h23"})}function cne(e){const t=Math.floor(e/6e4);return t<1?"just now":t<60?`${t} min ago`:`${Math.floor(t/60)} h ago`}function une(e,t){if(!e||typeof e!="object")return null;const n=$t(tne,e.state),r=$t(sne,e.provider);if(!n||!r||typeof e.checkedAt!="number"||t-e.checkedAt>one)return null;const s=lne(e.statusPageUrl);if(!s)return null;const i=Array.isArray(e.components)?e.components:[],l=e.stale===!0||t-e.checkedAt>ine,u=[`${r}: ${n}${e.summary?` — ${e.summary}`:""}`,i.length>0?`Affected: ${i.join(", ")}`:null,e.scope==="page"?`The page's overall status: it names none of ${r}'s components`:null,l?`Last read from ${s.hostname} at ${qR(e.checkedAt)}; this is the last thing it said`:`Reported by ${s.hostname}, checked ${cne(t-e.checkedAt)}`,"Opens the status page"],d=l?qR(e.checkedAt):null;return{provider:e.provider,state:e.state,name:r,label:`${r} · ${n}${d?` · as of ${d}`:""}`,words:n,chipWords:$t(nne,e.state)??n,shortWords:$t(rne,e.state)??n,asOf:d,what:e.summary||(i.length>0?i.join(", "):null),href:s.href,host:s.hostname,stale:l,detail:u.filter(Boolean).join(`
|
|
299
|
-
`)}}function dne(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>une(n,t)).filter(n=>n!==null)}function hne(e){return e.map(t=>`${t.name}'s status page reports ${t.state.endsWith("outage")?`a ${t.words}`:t.words}.`).join(" ")}const fne="The providers' status pages report no incident.";function pne({version:e,loadVersion:t}){var f;const[n,r]=v.useState(!1),s=((f=e==null?void 0:e.upgrade)==null?void 0:f.state)??"idle",i=Gee(e==null?void 0:e.upgrade),l=v.useRef(!1),u=v.useCallback(async()=>{if(Sr(l.current||s==="running")){l.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await t(),l.current=!1}},[s,t]);v.useEffect(()=>{if(s!=="running")return;const h=window.setInterval(t,3e3);return()=>window.clearInterval(h)},[s,t]);const d=v.useCallback(async()=>{const h=e==null?void 0:e.command;!h||!await qa(h)||(r(!0),window.setTimeout(()=>r(!1),1600))},[e==null?void 0:e.command]);return{upgradeState:s,upgradeFailure:i,startUpgrade:u,copyCommand:d,cmdCopied:n}}const BR="agent-dag.browserWatch.seenMs";function mne(e,t){return e.filter(n=>n.startMs>t)}function gne(){const[e,t]=v.useState(()=>Number(et(BR))||0),[n,r]=v.useState([]),[s,i]=v.useState(!1);v.useEffect(()=>{let d=!0;const f=()=>{fetch("/api/browser-watch?live=0").then(m=>m.ok?m.json():null).then(m=>{var g;!d||!(m!=null&&m.ok)||(r(m.episodes??[]),i(((g=m.settings)==null?void 0:g.enabled)===!0))}).catch(()=>{})};f();const h=setInterval(f,5*6e4);return()=>{d=!1,clearInterval(h)}},[]);const l=v.useMemo(()=>mne(n,e).length,[n,e]),u=v.useCallback(d=>{t(d),Ye(BR,String(d))},[]);return{watchOn:s,setWatchOn:i,watchUnseen:l,markWatchSeen:u}}const tO=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function UR(e){const t={};for(const n of tO)t[n]=e(n);return t}function yne(e){return t=>e[t]??""}function wne(e,t){return tO.every(n=>e[n]===t[n])}const nO="agent-dag.theme";function vne(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function xne(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function bne(){return vne(et(nO),xne())}function zR(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function kne(){const[e,t]=v.useState(bne),[n,r]=v.useState(zQ),[s,i]=v.useState(()=>UR(zR)),l=v.useMemo(()=>yne(s),[s]),u=v.useCallback(d=>YJ(d,l),[l]);return v.useEffect(()=>{document.documentElement.dataset.theme=e,Ye(nO,e),i(d=>{const f=UR(zR);return wne(d,f)?d:f})},[e]),v.useEffect(()=>{Ye(HI,n?"1":"0")},[n]),v.useEffect(()=>{const d=document.querySelector('meta[name="theme-color"]'),f=s["--panel"];d&&f&&d.setAttribute("content",f)},[s]),{theme:e,setTheme:t,characterEnabled:n,setCharacterEnabled:r,palette:s,minimapNodeFill:u}}function Nne(e){const t=v.useRef(null),[n,r]=v.useState(!1),[s,i]=v.useState(()=>new Set),l=v.useMemo(()=>{const d=new Set;for(const f of e.current.agents.values())for(const h of f.tools)d.add(UI(h.name));return Object.keys(BI).filter(f=>d.has(f))},[e.current,e.current.revision]);v.useEffect(()=>{if(l.length<=1){r(!1);return}let d=0;const f=()=>{const h=t.current;if(h&&!document.hidden){const m=h.getBoundingClientRect(),g=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(b=>b.getBoundingClientRect()),w=FJ(m,g,8);r(b=>b===w?b:w)}d=window.setTimeout(f,300)};return f(),()=>window.clearTimeout(d)},[l.length]);const u=v.useCallback(d=>{i(f=>{const h=new Set(f);return h.has(d)?h.delete(d):h.add(d),h})},[]);return{presentCats:l,hiddenCats:s,toggleCat:u,catBarRef:t,catBarOccluded:n}}function jne(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,r=!1;const s=()=>e.enabled()?r&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",i=()=>{var m;return(m=e.onState)==null?void 0:m.call(e,s())};function l(){var m;if(!(!t||r))try{n=n??new t,(m=n.resume)==null||m.call(n).then(i,()=>{}),r=!0,i()}catch{}}function u(m,g,w=g.figure){if(!n||n.state!=="running")return!1;const b=Sx(m,w),x=ZG(g.level,b),k=n.currentTime;for(const j of b.notes){const S=n.createOscillator(),_=n.createGain();S.type=b.type??"sine",S.frequency.value=j.hz;const E=k+j.at,T=E+j.ms/1e3;_.gain.setValueAtTime(Xj,E),_.gain.exponentialRampToValueAtTime(x,E+JG),_.gain.exponentialRampToValueAtTime(Xj,T),S.connect(_).connect(n.destination),S.start(E),S.stop(T+.02)}return!0}async function d(m,g){if(!e.loadCustom)return"unavailable";let w;try{w=await e.loadCustom(m)}catch{return"unavailable"}if(!w)return"missing";if(w.kind==="tts"){if(typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return"unavailable";const x=new SpeechSynthesisUtterance(w.text),k=window.speechSynthesis.getVoices();x.voice=k.find(j=>j.voiceURI===w.voiceURI)??null,x.rate=w.rate,x.pitch=w.pitch,x.volume=QG(g.level);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(x),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let b;try{b=await n.decodeAudioData(w.bytes.slice(0))}catch{return"broken"}try{const x=n.createBufferSource(),k=n.createGain();return x.buffer=b,k.gain.setValueAtTime(eK(w.normalizationGain,g.level),n.currentTime),x.connect(k).connect(n.destination),x.start(n.currentTime),"played"}catch{return"unavailable"}}function f(m,g=!1){var x,k;if(!g&&!e.enabled())return!1;const w=iK((x=e.prefs)==null?void 0:x.call(e),m),b=((k=e.customSelection)==null?void 0:k.call(e)[m])??null;return b&&e.loadCustom?(d(b,w).then(j=>{var S;j==="played"||j==="locked"||((j==="missing"||j==="broken")&&((S=e.onCustomFailure)==null||S.call(e,m,b)),u(m,{...w,figure:vn},vn))}),!0):!n||n.state!=="running"?!1:u(m,w)}function h(m,g=Pa){return d(m,{level:ti(g),figure:vn}),!0}return{unlock:l,play:f,previewCustom:h,state:s,get context(){return n}}}function Sne({chimesRef:e,soundOnRef:t,tonePrefsRef:n,customSelectionsRef:r,fallbackCustomRef:s}){const[i,l]=v.useState("locked");return v.useEffect(()=>{const u=jne({enabled:()=>t.current===!0,prefs:()=>n.current,customSelection:()=>r.current,loadCustom:VG,onCustomFailure:(f,h)=>s.current(f,h),onState:l});e.current=u,l(u.state());const d=()=>u.unlock();return window.addEventListener("pointerdown",d,{once:!0,capture:!0}),window.addEventListener("keydown",d,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",d,{capture:!0}),window.removeEventListener("keydown",d,{capture:!0})}},[]),{chimeState:i}}function _ne(){const[e,t]=v.useState(WQ),[n,r]=v.useState(()=>XF(et(wN))),[s,i]=v.useState(()=>YF(et(vN))),[l,u]=v.useState(()=>ZF(et(jR),n,BQ)),[d,f]=v.useState(()=>new Set),[h,m]=v.useState(0);v.useEffect(()=>{Ye(WI,String(e))},[e]),v.useEffect(()=>{Ye(vN,s?"1":"0")},[s]),v.useEffect(()=>{Ye(wN,JSON.stringify(n))},[n]),v.useEffect(()=>{Ye(jR,l)},[l]);const g=v.useCallback(j=>{r(S=>S.some(_=>_.id===j.id)?S:[...S,j]),f(S=>{if(!S.has(j.id))return S;const _=new Set(S);return _.delete(j.id),_})},[]),w=v.useCallback((j,S)=>{const _=S.trim();!_||_.length>bl||r(E=>E.map(T=>T.id===j?{...T,name:_}:T))},[]),b=v.useCallback(j=>{r(S=>S.filter(_=>_.id!==j)),u(S=>JF(S,j)),f(S=>{if(!S.has(j))return S;const _=new Set(S);return _.delete(j),_})},[]),x=v.useCallback(j=>{const S=xN(j),_=d.has(S);j===l&&!_||(_&&f(E=>{const T=new Set(E);return T.delete(S),T}),u(j),m(E=>E+1))},[l,d]),k=v.useCallback((j,S)=>{const _=xN(j);f(E=>{if(E.has(_)===S)return E;const R=new Set(E);return S?R.add(_):R.delete(_),R})},[]);return{fmVolume:e,setFmVolume:t,fmMuted:s,setFmMuted:i,fmSource:l,customFmStations:n,unavailableFmStations:d,fmPlayRequest:h,addFmStation:g,renameFmStation:w,removeFmStation:b,pickFmSource:x,markFmStationAvailability:k}}function Ene(e){const[t,n]=v.useState(null),[r,s]=v.useState(!1),[i,l]=v.useState(null),u=v.useRef(0);v.useEffect(()=>{if(!e||!Ol())return;let b=!1;const x=u.current;return fetch("/api/desktop-update").then(k=>k.ok?k.json():null).then(k=>{if(b||u.current!==x)return;const j=AR(k);j&&n(j)}).catch(()=>{}),()=>{b=!0}},[e]);const d=xee(t),f=v.useRef(!1),h=v.useRef(0),m=v.useRef(0);v.useEffect(()=>()=>window.clearTimeout(h.current),[]);const g=v.useCallback(async b=>{if(!Sr(f.current))return;const x=++m.current;window.clearTimeout(h.current),f.current=!0,s(!0),l(null);const k=j=>{x===m.current&&(window.clearTimeout(h.current),f.current=!1,s(!1),l({failure:j,version:b}))};try{const j=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:b})});if(!j.ok)return k(jee(await j.json().catch(()=>null)))}catch{return k("unreachable")}x===m.current&&(h.current=window.setTimeout(()=>k("timeout"),VI))},[]),w=v.useCallback(b=>{if(Ol())try{const x=AR(JSON.parse(b));x&&(u.current++,n(x),x.status!=="ready"&&(m.current++,window.clearTimeout(h.current),f.current=!1,s(!1)))}catch{}},[]);return{desktopUpdateRestarting:r,desktopUpdateFailure:i,readyAppUpdate:d,askDesktopUpdateRestart:g,onDesktopUpdateEvent:w}}const ju="agent-dag.autoRestart",HR="agent-dag.bundleReloadedFor";function Cne({now:e,stateRef:t,version:n,notice:r,noticeOpen:s,upgradeFailure:i}){const[l,u]=v.useState(()=>et(ju)!=="0"),d=v.useRef(!1),f=v.useCallback(()=>{const $=!l;d.current=!0,Zr(ju),u($),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:$})}).then(I=>I.ok?I.json():null).then(I=>{var D;I!=null&&I.ok&&u(((D=I.prefs)==null?void 0:D.autoUpdate)!==!1)}).catch(()=>{})},[l]),[h,m]=v.useState(!1),[g,w]=v.useState("restart"),[b,x]=v.useState(null),k=v.useRef(!1),j=v.useRef(null),S=v.useRef(0),_=v.useCallback(async $=>{if(!Sr(k.current))return;const I=($==null?void 0:$.upgrade)===!0;k.current=!0,j.current=i;const D=++S.current;w(I?"npx":"restart"),m(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(r==null?void 0:r.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:I})})}catch{}window.setTimeout(()=>{if(S.current===D&&k.current){k.current=!1,m(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},I?18e4:3e4)},[r==null?void 0:r.to,i]),E=v.useRef(null);v.useEffect(()=>{const $=MR(t.current.agents.values())>0,I=Jee({enabled:l,kind:r==null?void 0:r.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:s,visible:document.visibilityState==="visible",busy:$,idleSince:E.current,now:e});E.current=I.idleSince,I.restart&&_()},[l,r==null?void 0:r.kind,n==null?void 0:n.canRestart,s,e,_]);const T=MR(t.current.agents.values()),R=Zee(T),A=KI({enabled:l,kind:r==null?void 0:r.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:s,visible:document.visibilityState==="visible",busy:T>0,idleSince:E.current,now:e});v.useEffect(()=>{const $=n==null?void 0:n.running;let I=null,D=null;try{I=window.sessionStorage.getItem("agent-dag.restartPending"),D=window.sessionStorage.getItem(HR)}catch{return}const F=Vee({bundle:"3.32.1",running:$,pending:I,lastTried:D});if(F==="reload"){try{window.sessionStorage.setItem(HR,$??"")}catch{return}window.location.reload();return}if(F!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}k.current=!1,m(!1),x($??null);const W=window.setTimeout(()=>x(null),6e3);return()=>window.clearTimeout(W)},[n==null?void 0:n.running]),v.useEffect(()=>{if(h&&Kee({asked:j.current,reported:i})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}k.current=!1,m(!1)}},[h,i]);const B=v.useCallback($=>{var I,D;if(!d.current){const F=et(ju)==="0";Zr(ju),F&&((I=$.prefs)==null?void 0:I.autoUpdate)!==!1?(u(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):u(((D=$.prefs)==null?void 0:D.autoUpdate)!==!1)}},[]);return{autoRestart:l,toggleAutoRestart:f,restarting:h,restartMode:g,restartedTo:b,askRestart:_,restartCopy:R,restartFuseMs:A,loadAutoRestartPrefs:B}}function Tne(){const[e,t]=v.useState([]),n=v.useRef(new Set),[r,s]=v.useState(null);v.useEffect(()=>{let u=!0,d=0;const f=()=>{fetch("/api/lan").then(h=>h.ok?h.json():null).then(h=>u?(h!=null&&h.ok&&t(Mj(Array.isArray(h.pending)?h.pending:[],h.aliases)),h):null).catch(()=>null).then(h=>{u&&(d=window.setTimeout(f,(h==null?void 0:h.enabled)===!0?vx:ZM))})};return f(),()=>{u=!1,window.clearTimeout(d)}},[]);const i=v.useCallback(async(u,d)=>{if(!r){s(u);try{const h=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:u,fp:d})})).json().catch(()=>null);h&&Array.isArray(h.pending)?t(Mj(h.pending,h.aliases)):t(m=>m.filter(g=>g.fp!==d))}catch{}finally{s(null)}}},[r]),l=v.useCallback(u=>{r||(n.current.add(u),t(d=>[...d]))},[r]);return{lanPending:e,lanDeferred:n,lanBusy:r,answerLanPair:i,deferLanPair:l}}const rO="agent-dag.sessionListOpen",sO="agent-dag.accountsPanelOpen";function Rne(){return et(rO)==="1"}function Ane(e){Ye(rO,e?"1":"0")}function Mne(){const e=et(sO);return e===null?!0:e==="1"}function $ne(){const[e,t]=v.useState(Rne);v.useEffect(()=>{Ane(e)},[e]);const n=v.useRef(!1),[r,s]=v.useState(()=>{const f=Mne();return f&&e?(n.current=!0,!1):f});v.useEffect(()=>{!r&&n.current||Ye(sO,r?"1":"0")},[r]),v.useEffect(()=>{!e&&n.current&&(n.current=!1,s(!0))},[e]);const i=v.useCallback(()=>{t(f=>(f||s(h=>(h&&(n.current=!0),!1)),!f))},[]),l=v.useCallback(()=>{n.current=!1,s(f=>(f||t(!1),!f))},[]),u=v.useCallback(()=>t(!1),[]),d=v.useCallback(()=>s(!1),[]);return{sessionListOpen:e,accountsPanelOpen:r,toggleSessionList:i,toggleAccountsPanel:l,closeSessionList:u,closeAccountsPanel:d}}const aO="agent-dag.detailOpen",oO="agent-dag.usagePanelOpen",iO="agent-dag.systemPanelOpen";function Ine(){return et(aO)==="1"}function One(e){Ye(aO,e?"1":"0")}function Lne(){const e=et(oO);return e===null?!0:e==="1"}function Pne(e){Ye(oO,e?"1":"0")}function Dne(){const e=et(iO);return e===null?!0:e==="1"}function Fne(e){Ye(iO,e?"1":"0")}function qne(){const[e,t]=v.useState(Ine);v.useEffect(()=>{One(e)},[e]);const[n,r]=v.useState(Lne);v.useEffect(()=>{Pne(n)},[n]);const[s,i]=v.useState(Dne);return v.useEffect(()=>{Fne(s)},[s]),{detailOpen:e,setDetailOpen:t,usagePanelOpen:n,setUsagePanelOpen:r,machinePanelOpen:s,setMachinePanelOpen:i}}const Bne="No sessions are waiting for you.";function Une(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 Mv(e,t,n=Bne){return t!==""?t:e===""?"":n}function zne({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[r,s]=v.useState(""),i=Une(e);v.useEffect(()=>{s(g=>Mv(g,i))},[i]);const[l,u]=v.useState(""),d=t>0?`Browser watch has ${t} unread ${t===1?"finding":"findings"}.`:"";v.useEffect(()=>{u(g=>Mv(g,d,"Browser watch has no unread findings."))},[d]);const[f,h]=v.useState(""),m=hne(n);return v.useEffect(()=>{h(g=>Mv(g,m,fne))},[m]),{blockedSaid:r,watchSaid:l,setWatchSaid:u,incidentSaid:f}}function Hne({waitingSessions:e,liveSince:t,focusSession:n}){const[r,s]=v.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[i,l]=v.useState(null),[u,d]=v.useState(!1),[f,h]=v.useState(!1),m=v.useRef(()=>{}),g=v.useCallback(()=>{const E=!u;d(E),E&&typeof Notification<"u"&&Notification.permission==="default"&&m.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:E})}).then(T=>T.ok?T.json():null).then(T=>{var R;T!=null&&T.ok&&(d(((R=T.prefs)==null?void 0:R.notifications)===!0),h(T.notificationsVetoed===!0))}).catch(()=>{})},[u]),w=typeof Notification<"u";v.useEffect(()=>{if(!i)return;const T=setTimeout(()=>l(null),i==="blocked"?8e3:4e3);return()=>clearTimeout(T)},[i]);const b=v.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(E=>{const T=E;s(T),T==="granted"?l("on"):T==="denied"&&l("blocked")})},[]);m.current=b;const x=v.useRef(new Set),k=v.useRef(null),j=e.map(E=>kd(E.id,E.waiting)).join("|");v.useEffect(()=>{gq(k.current,r)&&(k.current=r,x.current=Jf(e))},[r]);const S=v.useRef(!1);v.useEffect(()=>{yq(S.current,t)&&(S.current=!0,x.current=Jf(e))},[t]),v.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!wq(k.current,t))return;const E=typeof document>"u"||!document.hidden,T=pq(e,x.current,E,u);for(const R of T)try{const A=new Notification(R.title,{body:R.body,tag:R.key});A.onclick=()=>{window.focus(),n(R.sessionId),A.close()}}catch{}x.current=E?Jf(e):mq(e,T,x.current)},[j,t]);const _=v.useCallback(E=>{var T;d(((T=E.prefs)==null?void 0:T.notifications)===!0),h(E.notificationsVetoed===!0)},[]);return{notifyPermission:r,notifySaid:i,notifyOn:u,notifyVetoed:f,toggleNotify:g,notifySupported:w,askForNotifications:b,loadNotifyPrefs:_}}function Wne({openedTool:e,usageHistoryOpen:t,contextFor:n,tourOpen:r,summaryFor:s,browserWatchOpen:i,keyHelpOpen:l,releaseNotes:u}){const d=On(l),f=v.useRef(!1);return f.current=e!=null||t||n!=null||r||s!=null||i||l||u!=null,{keyHelpOpenRef:d,modalOpenRef:f}}function Vne({stateRef:e,tourOpen:t,releaseNotes:n}){const[r,s]=v.useState(null),i=v.useCallback((T,R)=>s({agentId:T,toolId:R}),[]),[l,u]=v.useState(null),[d,f]=v.useState(null),h=v.useCallback(T=>f(T),[]),[m,g]=v.useState(!1),[w,b]=v.useState(!1),[x,k]=v.useState(!1),j=r?w6(e.current.agents,r.agentId,r.toolId):null,S=d?e.current.agents.get(d):void 0,{keyHelpOpenRef:_,modalOpenRef:E}=Wne({openedTool:j,usageHistoryOpen:w,contextFor:d,tourOpen:t,summaryFor:l,browserWatchOpen:x,keyHelpOpen:m,releaseNotes:n});return{setOpenedToolKey:s,openTool:i,openedTool:j,summaryFor:l,setSummaryFor:u,contextFor:d,setContextFor:f,openContext:h,contextAgent:S,keyHelpOpen:m,setKeyHelpOpen:g,usageHistoryOpen:w,setUsageHistoryOpen:b,browserWatchOpen:x,setBrowserWatchOpen:k,keyHelpOpenRef:_,modalOpenRef:E}}function Gne({stateRef:e,pinnedRef:t,measuredRef:n,positionsRef:r,lastLayoutSigRef:s,forgetRemovals:i,clearSelection:l,rerender:u,modalOpenRef:d}){const[f,h]=v.useState(!1),m=v.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}e.current=r0(),t.current.clear(),n.current.clear(),r.current.clear(),s.current="",DI(),i(),l(),u()},[u,l,i]),g=On(f),w=v.useCallback(b=>{const x=tte(b,{confirmOpen:g.current,modalOpen:d.current});x==="confirm"?h(!0):x==="clear"&&(h(!1),m())},[m]);return{clearConfirmOpen:f,setClearConfirmOpen:h,requestClear:w}}const WR="agent-dag.oldNameNoticeDismissed";function Kne(e){const[t,n]=v.useState(()=>et(WR)??""),r=e!=null&&e.invokedAs&&e.invokedAs!==wt?e.invokedAs:null,s=r!=null&&t!==r,i=v.useCallback(()=>{r&&(n(r),Ye(WR,r))},[r]);return{oldName:r,oldNameOpen:s,dismissOldName:i}}function Yne({chimesRef:e,setTonePrefs:t,tonePrefsRef:n,previewTone:r}){const[s,i]=v.useState(()=>IG(et)),l=On(s),[u,d]=v.useState([]),f=v.useCallback(S=>{i(_=>{const E={..._,[S]:null};return l.current=E,E}),Zr(hl[S])},[]),h=v.useCallback((S,_)=>{const E=l.current[S];_&&E!==_||(f(S),t(T=>{const R={...T,[S]:{...T[S],figure:vn}};return n.current=R,R}),Ye(od[S],vn))},[f]),m=On(h);v.useEffect(()=>{let S=!0;return WG().then(_=>{if(!S)return;d(_);const E=new Set(_.map(T=>T.id));for(const T of Iu){const R=l.current[T];R&&!E.has(R)&&m.current(T,R)}},()=>{}),()=>{S=!1}},[]);const g=v.useCallback((S,_)=>{if(!u.some(T=>T.id===_))return;const E={...l.current,[S]:_};l.current=E,i(E),Ye(hl[S],_),r(S,!0)},[u,r]),w=v.useCallback(async S=>{var R;const _=jx(u.length);if(_)throw new Error(_);const E=window.AudioContext??window.webkitAudioContext;if(!E)throw new Error("This browser cannot decode audio files.");const T=new E;try{const A=await qG(S,$=>T.decodeAudioData($));await Kj(A);const B=Ml(A);d($=>[...$.filter(I=>I.id!==B.id),B])}finally{(R=T.close)==null||R.call(T)}},[u.length]),b=v.useCallback(async S=>{const _=jx(u.length);if(_)throw new Error(_);const E=BG(S);await Kj(E);const T=Ml(E);d(R=>[...R.filter(A=>A.id!==T.id),T])},[u.length]),x=v.useCallback(async(S,_)=>{const E=u.find(R=>R.id===S),T=_.trim().slice(0,80);!E||!T||T===E.name||(await GG(S,T),d(R=>R.map(A=>A.id===S?{...A,name:T}:A)))},[u]),k=v.useCallback(async S=>{await KG(S),d(R=>R.filter(A=>A.id!==S));const _=l.current,E=OG(_,S);l.current=E,i(E);const T=Iu.filter(R=>_[R]===S);for(const R of T)Zr(hl[R]),Ye(od[R],vn);T.length>0&&t(R=>{const A={...R};for(const B of T)A[B]={...A[B],figure:vn};return n.current=A,A})},[]),j=v.useCallback(S=>{var T,R;const _=Iu.find(A=>l.current[A]===S),E=_?n.current[_].level:Pa;(T=e.current)==null||T.unlock(),(R=e.current)==null||R.previewCustom(S,E)},[]);return{customSelections:s,customSelectionsRef:l,customAssets:u,clearCustomOnly:f,fallbackCustomRef:m,selectCustomTone:g,importNotificationAudio:w,createNotificationVoice:b,renameCustomAsset:x,deleteCustomAsset:k,previewCustomAsset:j}}function Xne(e){const[t,n]=v.useState(()=>oK(et)),r=On(t),s=v.useRef(null),i=v.useCallback((u,d=!1)=>{var f,h;if((f=e.current)==null||f.unlock(),s.current!==null&&clearTimeout(s.current),s.current=null,!d){(h=e.current)==null||h.play(u,!0);return}s.current=setTimeout(()=>{var m;s.current=null,(m=e.current)==null||m.play(u,!0)},tK)},[]),l=v.useCallback((u,d)=>{n(f=>{const h={level:ti(d.level??f[u].level),figure:k$(u,d.figure??f[u].figure)};return Ye(S$[u],String(h.level)),Ye(od[u],h.figure),{...f,[u]:h}}),i(u,!0)},[i]);return v.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),{tonePrefs:t,setTonePrefs:n,tonePrefsRef:r,previewTone:i,changeTone:l}}const Zne=15e3;function Jne(e){return e.visibilityState==="visible"&&e.hasFocus()}function Qne(e,t){return t||e===!0}function ere(){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)}`}function tre(){v.useEffect(()=>{const e=ere();let t=null;const n=l=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:e,looking:l}),keepalive:!0}).catch(()=>{})},r=()=>{const l=Jne(document);Qne(t,l)&&n(l),t=l},s=()=>{t&&n(!1),t=!1};r();const i=window.setInterval(r,Zne);return window.addEventListener("focus",r),window.addEventListener("blur",r),document.addEventListener("visibilitychange",r),window.addEventListener("pagehide",s),()=>{window.clearInterval(i),window.removeEventListener("focus",r),window.removeEventListener("blur",r),document.removeEventListener("visibilitychange",r),window.removeEventListener("pagehide",s),s()}},[])}function nre({loadAutoRestartPrefs:e,loadNotifyPrefs:t}){v.useEffect(()=>{let n=!0;return fetch("/api/prefs").then(r=>r.ok?r.json():null).then(r=>{!n||!(r!=null&&r.ok)||(e(r),t(r))}).catch(()=>{}),()=>{n=!1}},[])}const $v="agent-dag.versionNoticeDismissed",rre=15*6e4;function sre(e){const[t,n]=v.useState(null),[r,s]=v.useState(()=>et($v)??""),i=v.useRef(0),[l,u]=v.useState(!1),d=v.useCallback((x=!1)=>(x&&(i.current=Date.now(),u(!0)),fetch(x?"/api/version?refresh=1":"/api/version").then(k=>k.ok?k.json():null).then(k=>{k&&n(k)}).catch(()=>{}).finally(()=>{x&&u(!1)})),[]),f=v.useCallback(()=>{d(Date.now()-i.current>=rre)},[d]);v.useEffect(()=>{d();const x=window.setInterval(f,5*6e4),k=()=>{document.visibilityState==="visible"&&f()};return document.addEventListener("visibilitychange",k),()=>{window.clearInterval(x),document.removeEventListener("visibilitychange",k)}},[d,f]),v.useEffect(()=>{e&&d()},[e,d]);const h=(t==null?void 0:t.notice)??null,m=GI(h),g=Ree(h,r),w=v.useCallback(()=>{s(""),Ye($v,"")},[]),b=v.useCallback(()=>{h&&(s(m),Ye($v,m))},[h,m]);return{version:t,notice:h,noticeOpen:g,showNotice:w,dismissNotice:b,versionChecking:l,loadVersion:d}}function are({version:e,readyAppUpdate:t}){const[n,r]=v.useState(!1),s=v.useRef(null),[i,l]=v.useState(null),u=i&&t?t.version:null,d=v.useRef(null);v.useEffect(()=>{!u||d.current===u||(d.current=u,fetch("/api/desktop-update/seen",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:u})}).catch(()=>{}))},[u]);const f=v.useRef(!1);v.useEffect(()=>{if(f.current)return;const k=ul(),j=xte(k),S=_te({stored:j,running:(e==null?void 0:e.running)??null,notes:OR,remembers:bte(k)});if(S.reason==="no-version")return;f.current=!0,S.record&&kte(k,S.record);let _=!0;return(async()=>{var B;let T=Nte(k);if(Ol())try{const $=await fetch("/api/prefs");if(!$.ok)throw new Error("desktop tour preferences unavailable");const I=await $.json();if(!(I!=null&&I.ok))throw new Error("desktop tour preferences unavailable");const D=((B=I.prefs)==null?void 0:B.tourSeen)===!0;T&&!D&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),T=T||D}catch{T=!0}if(!_)return;const R=Ste({tourSeen:T,decision:S}),A=S.show.length?{entries:S.show,since:j,firstRun:!1}:null;R.tour&&r(!0),R.notes==="now"?l(A):R.notes==="after"&&(s.current=A)})(),()=>{_=!1}},[e==null?void 0:e.running]);const h=(e==null?void 0:e.running)??"3.32.1",m=v.useMemo(()=>YI(OR,null,h),[h]),g=v.useCallback(()=>{l({entries:m,since:null,firstRun:!1})},[m]),w=v.useCallback(()=>r(!0),[]),b=v.useCallback(()=>l(null),[]),x=v.useCallback(()=>{r(!1),jte(ul()),Ol()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const k=s.current;s.current=null,k&&l(k)},[]);return{tourOpen:n,openTour:w,closeTour:x,releaseNotes:i,closeReleaseNotes:b,chipVersion:h,openReleaseNotes:g}}function ore(){const[e,t]=v.useState(null),[n,r]=v.useState(!1),s=v.useRef(null);return v.useEffect(()=>{let i=!0,l=!1,u=null,d=null,f="";const h=x=>{i&&(r(!0),x!==f&&t(null))},m=()=>{if(l)return;l=!0,u=Date.now();const x=TR();d=x,fetch(`/api/ccusage?since=${x}`).then(k=>k.ok?k.json():null).then(k=>{if(i){if(!(k!=null&&k.ok)){h(x);return}f=x,t(wee(k)),r(!1)}}).catch(()=>h(x)).finally(()=>{l=!1})},g=()=>{const x=s.current;yee({shown:!!x&&x.getClientRects().length>0,tabVisible:document.visibilityState==="visible",lastSince:d,since:TR(),lastReadAt:u,now:Date.now()})&&m()};g();const w=window.setInterval(g,gee);document.addEventListener("visibilitychange",g);let b=null;return s.current&&typeof ResizeObserver<"u"&&(b=new ResizeObserver(g),b.observe(s.current)),()=>{i=!1,window.clearInterval(w),document.removeEventListener("visibilitychange",g),b==null||b.disconnect()}},[]),{monthlyUsage:e,monthlyUsageUnavailable:n,monthUsageRef:s}}function ire(e){const[t,n]=v.useState(null);v.useEffect(()=>{const u=et("agent-dag.sound");n(u===null?!0:u==="on")},[]);const r=v.useCallback(()=>{n(u=>{var f;const d=u!==!0;return Ye("agent-dag.sound",d?"on":"off"),d&&((f=e.current)==null||f.unlock()),d})},[]),s=v.useCallback(u=>{r()},[r]),i=On(s),l=On(t);return{soundOn:t,toggleSound:r,activateSoundRef:i,soundOnRef:l}}function lre(){const[e,t]=v.useState(!1),n=v.useRef(null),[r,s]=v.useState(!1),i=v.useRef(null);return v.useEffect(()=>{e&&s(!1)},[e]),{soundMenuOpen:e,setSoundMenuOpen:t,soundButtonRef:n,appearanceMenuOpen:r,setAppearanceMenuOpen:s,appearanceButtonRef:i}}const cre="agent-dag.autoFitDisabled";function ure(e){const t=v.useRef(!1),[n,r]=v.useState(!1);v.useEffect(()=>{Zr(cre)},[]);const s=v.useCallback(()=>{t.current||(t.current=!0,r(!0))},[]),i=v.useCallback(()=>{t.current=!1,r(!1),e(400)},[e]);return{autoFitDisabled:n,autoFitDisabledRef:t,disableAutoFit:s,enableAutoFitAndRefit:i}}function dre(){return a.jsx(e0,{children:a.jsx(hre,{})})}function hre(){const e=si(),t=v.useState(r0)[0],n=v.useRef(t),[,r]=v.useState(0),s=v.useCallback(()=>r(Fr=>Fr+1),[]),{detailOpen:i,setDetailOpen:l,usagePanelOpen:u,setUsagePanelOpen:d,machinePanelOpen:f,setMachinePanelOpen:h}=qne(),{selectedIds:m,primarySelectedId:g,selectAgent:w,clearSelection:b,pruneSelectionToBoard:x}=NK(n,l),{sessionListOpen:k,accountsPanelOpen:j,toggleSessionList:S,toggleAccountsPanel:_,closeSessionList:E,closeAccountsPanel:T}=$ne(),R=ore(),A=Ru(j,200),B=Ru(u,130),$=Ru(f,130),I=v.useRef(null),D=ire(I),{activateSoundRef:F,soundOnRef:W}=D,M=Xne(I),{setTonePrefs:O,tonePrefsRef:L,previewTone:K}=M,Z=Yne({chimesRef:I,setTonePrefs:O,tonePrefsRef:L,previewTone:K}),{customSelectionsRef:q,fallbackCustomRef:H}=Z,P=lre(),{setSoundMenuOpen:Y}=P,{chimeState:G}=Sne({chimesRef:I,soundOnRef:W,tonePrefsRef:L,customSelectionsRef:q,fallbackCustomRef:H}),z=Kte(n),{pauseGate:X,paused:V,togglePause:J}=z,ee=v.useRef(()=>{}),{live:re,tabCapped:oe,everConnected:fe,liveSince:Ne}=pK({stateRef:n,rerender:s,pauseGate:X,chimesRef:I,desktopUpdateRef:ee}),we=sre(re),{version:ye,notice:ve,noticeOpen:Ie,loadVersion:xe}=we,ue=Ene(re),{readyAppUpdate:se,onDesktopUpdateEvent:be}=ue;ee.current=be,tre();const Te=are({version:ye,readyAppUpdate:se}),{tourOpen:Le,openTour:$e,releaseNotes:Oe}=Te,{workspace:Xe,providers:Ge,providersRef:Ze}=Xte(re),Ve=Kne(ye),Ot=pne({version:ye,loadVersion:xe}),{upgradeFailure:mt}=Ot,Pe=Vne({stateRef:n,tourOpen:Le,releaseNotes:Oe}),{openTool:at,setSummaryFor:Qe,setContextFor:ot,openContext:Ft,setKeyHelpOpen:bt,setUsageHistoryOpen:kt,setBrowserWatchOpen:qt,keyHelpOpenRef:bn,modalOpenRef:Gt}=Pe,Bt=gne(),{watchOn:dn,watchUnseen:Kt}=Bt,rs=Tne(),[$r,ss]=v.useState(0),{presentCats:ur,hiddenCats:qn,toggleCat:as,catBarRef:kn,catBarOccluded:dr}=Nne(n),hn=v.useRef(null),[os,Nn]=v.useState(0),gt=jK({stateRef:n,rerender:s,pruneSelectionToBoard:x,setContextFor:ot,setSummaryFor:Qe}),Bn=ene(Ge.claude||Ge.codex),pe=dne(Bn,gt),Be=Cne({now:gt,stateRef:n,version:ye,notice:ve,noticeOpen:Ie,upgradeFailure:mt}),{askRestart:Je,loadAutoRestartPrefs:fn}=Be,Ut=kne(),{setTheme:hr,palette:Ys}=Ut,is=_ne(),Un=bJ(),{applyViewport:Wa,moveCamera:Va,fitLeft:fr,cameraEpochRef:Ga,lastFitTimeRef:Ka}=Un,Ke=$J(fr),{pinnedRef:ls,positionsRef:pr,lastLayoutSigRef:Ya,handleRelayout:cs}=Ke,Xs=v.useRef(null),Zs=v.useRef(()=>{}),us=Ne!==null,Yt=v.useRef(0),ds=v.useCallback(()=>{Yt.current=Date.now()},[]),{canvasRef:Nt,canvasSize:rh,paneSizeRef:sh}=fQ(),Xl=ure(fr),{autoFitDisabledRef:Js,disableAutoFit:hs}=Xl,Ir=v.useRef(!1),{measuredRef:jn,measuredVersionRef:ah,sizeVersion:oh,domSizeVersion:pi}=pQ(Ir),{removedNodes:mi,removedAgentIds:mr,removeNode:Qs,removeSelectedNode:Zl,removalNotice:Xa,bringBack:Ue,bringBackAll:Jl,forgetRemovals:Ql}=sQ({stateRef:n,pinnedRef:ls,positionsRef:pr,canvasRef:Nt,clearSelection:b,primarySelectedId:g}),ea=QJ({stateRef:n,now:gt,removedAgentIds:mr,sizeVersion:oh,domSizeVersion:pi});IJ(ea,Ke),rQ({layoutSig:ea,rf:e,stateRef:n,measuredRef:jn,pinnedRef:ls,positionsRef:pr,paneSizeRef:sh,lastInteractRef:Yt,autoFitDisabledRef:Js,lastFitTimeRef:Ka,fitLeft:fr});const gi=mQ(),{bubbling:ec,endBubble:tc,onBubble:yi}=wG(),[fs,gr]=v.useState(!1),zn=gG(),{beginTrashDrag:yr,trackTrashDrag:ta,endTrashDrag:na}=zn,Hn=EG({stateRef:n,measuredRef:jn,measuredVersionRef:ah,canvasRef:Nt}),{lodRef:ih,applyZoom:nc}=Hn,ps=dQ({applyViewport:Wa,lastFitTimeRef:Ka,cameraEpochRef:Ga,disableAutoFit:hs,markInteract:ds,canvasRef:Nt,applyZoom:nc}),ra=g?n.current.agents.get(g):null,wi=i&&ra!=null,{railInsetRef:sa,availableWidth:vi,availableHeight:rc}=xJ({canvasRef:Nt,canvasSize:rh,machinePhase:$,usagePhase:B,usagePanelOpen:u,detailShown:wi}),ms=eQ({stateRef:n,now:gt,availableWidth:vi,availableHeight:rc,layout:Ke,measuredRef:jn,onBubble:yi,settled:gi,dragging:fs,layoutSig:ea,selectedIds:m,openContext:Ft,historyReplayed:us,removedNodes:mi,removedAgentIds:mr,dragTick:$r,dragPatchRef:hn,dragMoveTick:os}),{nodes:Or,edges:gs}=ms,ys=On(g);OJ({nodes:Or,edges:gs,settled:gi,dragging:fs,availableWidth:vi,availableHeight:rc,layout:Ke,camera:Un,rf:e,measuredRef:jn,stateRef:n,lastFocusRef:Xs,primarySelectedIdRef:ys,focusAgentRef:Zs,autoFitDisabledRef:Js});const sc=Gne({stateRef:n,pinnedRef:ls,measuredRef:jn,positionsRef:pr,lastLayoutSigRef:Ya,forgetRemovals:Ql,clearSelection:b,rerender:s,modalOpenRef:Gt}),{requestClear:ac}=sc,xi=wQ({nodes:Or,stateRef:n,pinnedRef:ls,positionsRef:pr,draggingRef:Ir,dragPatchRef:hn,setDragging:gr,setDragMoveTick:Nn,setDragTick:ss,endBubble:tc,markInteract:ds,disableAutoFit:hs,beginTrashDrag:yr,trackTrashDrag:ta,endTrashDrag:na,removeNode:Qs}),Za=v.useCallback(()=>fr(500),[fr]),aa=On(Or),{focusAgent:oa,stepAgent:wr,focusSession:Lr}=NJ({canvasRef:Nt,stateRef:n,measuredRef:jn,nodesRef:aa,railInsetRef:sa,moveCamera:Va,disableAutoFit:hs,lastFocusRef:Xs,focusAgentRef:Zs,selectAgent:w,primarySelectedIdRef:ys}),Ja=hQ({clearSelection:b,selectAgent:w,detailOpen:i,setDetailOpen:l,detailShown:wi,focusAgent:oa,draggingRef:Ir,lodRef:ih}),oc=jJ({nodesRef:aa,stateRef:n,canvasRef:Nt,railInsetRef:sa}),Qa=On(Zl),ia=v.useRef(null),ic=v.useCallback(Fr=>{mr.has(Fr)&&Ue([Fr]),Lr(Fr)},[mr,Ue,Lr]),Xt=gQ();yQ({pointerFocusRef:Xt,nodesRef:aa,stateRef:n,primarySelectedIdRef:ys,providersRef:Ze,soundOnRef:W,keyHelpOpenRef:bn,modalOpenRef:Gt,waitingCursorRef:ia,removeSelectedRef:Qa,activateSoundRef:F,clearSelection:b,selectAgent:w,focusAgent:oa,stepAgent:wr,focusSession:Lr,requestClear:ac,handleRelayout:cs,handleFit:Za,togglePause:J,toggleSessionList:S,toggleAccountsPanel:_,setDetailOpen:l,setUsageHistoryOpen:kt,setUsagePanelOpen:d,setMachinePanelOpen:h,setBrowserWatchOpen:qt,setSoundMenuOpen:Y,setKeyHelpOpen:bt,setTheme:hr});const Pr=n.current.agents.size,Dr=v.useMemo(()=>Jv(n.current.agents.values()),[n.current,n.current.revision]);aQ({stateRef:n,waitingSessions:Dr,removedAgentIds:mr,removedNodes:mi,bringBack:Ue}),lQ({stateRef:n,waitingSessions:Dr,live:re});const ws=zne({waitingSessions:Dr,watchUnseen:Kt,incidents:pe}),bi=Hne({waitingSessions:Dr,liveSince:Ne,focusSession:Lr}),{loadNotifyPrefs:ki}=bi;return nre({loadAutoRestartPrefs:fn,loadNotifyPrefs:ki}),a.jsxs("div",{className:"app",children:[a.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),a.jsxs("header",{className:"topbar",children:[a.jsx(Oee,{versionCheck:we,welcome:Te,desktopUpdate:ue,pause:z,monthly:R,announcements:ws,notify:bi,waitingSessions:Dr,waitingCursorRef:ia,focusSession:Lr,live:re,now:gt,incidents:pe}),ra&&a.jsx(Lee,{selected:ra,now:gt,selectedIds:m,focusAgent:oa,clearSelection:b}),a.jsxs("div",{className:"actions",children:[a.jsx(hee,{sessionListOpen:k,toggleSessionList:S,usagePanelOpen:u,setUsagePanelOpen:d,setUsageHistoryOpen:kt}),a.jsx(fee,{providers:Ge,accountsPanelOpen:j,toggleAccountsPanel:_,machinePanelOpen:f,setMachinePanelOpen:h,watchOn:dn,watchUnseen:Kt,setBrowserWatchOpen:qt}),a.jsx(pee,{providers:Ge,sound:D,tones:M,customTones:Z,notify:bi,chimeState:G,menus:P,appearance:Ut,fm:is})]})]}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Xa?`${Xa.label} removed from the board.`:""}),a.jsx(ete,{restart:Be,versionCheck:we,upgrade:Ot,oldNameNotice:Ve,everConnected:fe,live:re,paused:V}),Tu(A)&&Ge.claude&&a.jsx(cG,{leaving:A==="leaving",onClose:T}),k&&a.jsx(QU,{state:n.current,now:gt,selectedIds:m,onSelect:ic,onClose:E,removedIds:mr,onBringBackAll:Jl}),a.jsxs(Bee,{canvasRef:Nt,bubbling:ec,dragging:fs,trash:zn,zoom:Hn,viewport:ps,stateRef:n,peek:oc,children:[Pr===0&&(!re&&oe?a.jsx(_Q,{}):a.jsx(EQ,{live:re,everConnected:fe,providers:Ge,workspace:Xe,onTour:$e})),(ur.length>1||qn.size>0)&&a.jsx(Pee,{catBarRef:kn,catBarOccluded:dr,presentCats:ur,hiddenCats:qn,toggleCat:as}),a.jsx(WU,{graph:ms,layout:Ke,viewport:ps,clicks:Ja,drag:xi,appearance:Ut,fm:is,autoFit:Xl,pause:z,stateRef:n,measuredRef:jn,hiddenCats:qn,now:gt,openTool:at,focusAgent:oa,requestClear:ac,setKeyHelpOpen:bt})]}),Tu(B)&&a.jsx(Wz,{state:n.current,now:gt,providers:Ge,incidents:pe,liveSince:Ne,leaving:B==="leaving",onClose:()=>d(!1)}),Tu($)&&a.jsx(EH,{usageOpen:u,leaving:$==="leaving",onClose:()=>h(!1)}),i&&ra?a.jsx(FQ,{selected:ra,now:gt,openTool:at,setSummaryFor:Qe,setDetailOpen:l,stateRef:n,removeSelectedNode:Zl}):null,a.jsx(Wte,{dialogs:Pe,welcome:Te,desktopUpdate:ue,versionCheck:we,restart:Be,lanPairs:rs,clearFlow:sc,watchBadge:Bt,announcements:ws,appearance:Ut,providers:Ge,stateRef:n,agentCount:Pr})]})}try{Xq(window.localStorage)}catch{}const fre=BL.createRoot(document.getElementById("root"));fre.render(a.jsx(dre,{}));export{bQ as a,st as b,Hs as c,mre as d,zs as e,qe as f,pre as g,Al as h,ka as i,a as j,qa as k,lj as p,v as r,Sr as s,pt as u};
|