ccdeck 3.29.11 → 3.31.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 +4 -3
- package/bin/agent-dag.js +67 -118
- package/bin/cli/help.js +67 -0
- package/bin/cli/login-item.js +182 -0
- package/bin/cli/one-shot.js +254 -0
- package/bin/cli/package.js +39 -0
- package/bin/cli/pulse.js +98 -0
- package/bin/cli/restart.js +179 -0
- package/bin/cli/screen.js +166 -0
- package/bin/cli/second-start.js +120 -0
- package/bin/cli/startup.js +459 -0
- package/bin/cli/uninstall.js +169 -0
- package/bin/deck.js +112 -1559
- package/dist/web/assets/BrowserWatchModal-n63GjLhv.js +1 -0
- package/dist/web/assets/UsageHistoryModal-DEwBX4Fk.js +1 -0
- package/dist/web/assets/index-CZJf1Cpp.js +299 -0
- package/dist/web/assets/index-D4q1ElXU.css +1 -0
- package/dist/web/index.html +2 -2
- package/hook/hook.js +15 -14
- package/package.json +1 -1
- package/release-notes.json +40 -0
- package/src/server/account-projects.mjs +25 -11
- package/src/server/account-routes.mjs +254 -0
- package/src/server/activity.mjs +3 -3
- package/src/server/append-budget.mjs +185 -0
- package/src/server/append-failures.mjs +147 -0
- package/src/server/args.mjs +37 -5
- package/src/server/atomic-write.mjs +300 -0
- package/src/server/block-notify.mjs +0 -5
- package/src/server/boot-lock.mjs +1 -1
- package/src/server/brand.mjs +7 -6
- package/src/server/browser-react.mjs +10 -2
- package/src/server/browser-watch-decks.mjs +146 -0
- package/src/server/browser-watch-feed.mjs +69 -0
- package/src/server/browser-watch-log.mjs +173 -0
- package/src/server/browser-watch-mtime.mjs +18 -0
- package/src/server/browser-watch-relay.mjs +112 -0
- package/src/server/browser-watch-routes.mjs +172 -0
- package/src/server/browser-watch-seen.mjs +127 -0
- package/src/server/browser-watch-store.mjs +14 -143
- package/src/server/browser-watch.mjs +278 -626
- package/src/server/canonical-path.mjs +150 -0
- package/src/server/ccusage-failure.mjs +64 -0
- package/src/server/ccusage-install.mjs +459 -0
- package/src/server/ccusage-runner.mjs +271 -0
- package/src/server/ccusage.mjs +21 -756
- package/src/server/claude-accounts.mjs +220 -464
- package/src/server/claude-collector.mjs +189 -0
- package/src/server/claude-dir.mjs +7 -3
- package/src/server/claude-identity.mjs +5 -4
- package/src/server/claude-reset-credits.mjs +130 -0
- package/src/server/claude-verdicts.mjs +174 -0
- package/src/server/clear-route.mjs +191 -0
- package/src/server/codex-auth.mjs +4 -4
- package/src/server/codex-dir.mjs +52 -8
- package/src/server/codex-enrichment.mjs +310 -0
- package/src/server/codex-quota.mjs +5 -3
- package/src/server/codex-translate.mjs +407 -0
- package/src/server/codex-usage.mjs +8 -5
- package/src/server/codex-watch.mjs +496 -0
- package/src/server/cswap-auto-loop.mjs +342 -0
- package/src/server/cswap-auto-readers.mjs +303 -0
- package/src/server/cswap-auto.mjs +51 -609
- package/src/server/cswap-install.mjs +69 -265
- package/src/server/cswap-layout.mjs +242 -0
- package/src/server/deck-home.mjs +2 -2
- package/src/server/deck-prefs.mjs +58 -184
- package/src/server/deck-scope.mjs +52 -0
- package/src/server/desktop-update-routes.mjs +75 -0
- package/src/server/detach.mjs +78 -0
- package/src/server/discovery.mjs +298 -0
- package/src/server/event-log.mjs +328 -0
- package/src/server/event-pipeline.mjs +235 -0
- package/src/server/event-ring.mjs +214 -0
- package/src/server/event-routes.mjs +352 -0
- package/src/server/event-sink.mjs +26 -0
- package/src/server/exec-children.mjs +128 -0
- package/src/server/exec-not-found.mjs +213 -0
- package/src/server/exec-output.mjs +23 -0
- package/src/server/exec-spec.mjs +341 -0
- package/src/server/exec.mjs +74 -661
- package/src/server/health-route.mjs +42 -0
- package/src/server/hook-challenge.mjs +37 -0
- package/src/server/http-io.mjs +104 -0
- package/src/server/index.mjs +174 -7620
- package/src/server/install-layout.mjs +506 -0
- package/src/server/installer.mjs +79 -608
- package/src/server/jsonl-chunks.mjs +139 -0
- package/src/server/lan-accounts.mjs +27 -0
- package/src/server/lan-beacon.mjs +457 -0
- package/src/server/lan-call.mjs +239 -0
- package/src/server/lan-copies.mjs +270 -0
- package/src/server/lan-deck.mjs +583 -0
- package/src/server/lan-dials.mjs +161 -0
- package/src/server/lan-engine.mjs +475 -1024
- package/src/server/lan-hearing.mjs +49 -0
- package/src/server/lan-inbound.mjs +100 -0
- package/src/server/lan-invite-offer.mjs +77 -0
- package/src/server/lan-invite.mjs +207 -0
- package/src/server/lan-lines.mjs +73 -0
- package/src/server/lan-manifest.mjs +74 -0
- package/src/server/lan-reach.mjs +82 -69
- package/src/server/lan-requests.mjs +249 -0
- package/src/server/lan-round-record.mjs +45 -0
- package/src/server/lan-round-timer.mjs +62 -0
- package/src/server/lan-routes.mjs +143 -0
- package/src/server/lan-serve.mjs +112 -0
- package/src/server/lan-socket.mjs +243 -925
- package/src/server/lan-sync.mjs +58 -1026
- package/src/server/lan-tailnet-poll.mjs +57 -0
- package/src/server/lan-turns.mjs +80 -0
- package/src/server/lan-wire.mjs +620 -0
- package/src/server/lifecycle.mjs +421 -0
- package/src/server/listen.mjs +110 -0
- package/src/server/live-decks.mjs +138 -0
- package/src/server/load-average.mjs +32 -0
- package/src/server/log-election.mjs +235 -0
- package/src/server/log-replay.mjs +374 -0
- package/src/server/log-writer.mjs +72 -557
- package/src/server/login-service.mjs +3 -2
- package/src/server/macmon.mjs +1 -1
- package/src/server/memory-files.mjs +163 -0
- package/src/server/memory-metrics.mjs +178 -0
- package/src/server/metrics-history.mjs +94 -0
- package/src/server/metrics-run.mjs +100 -0
- package/src/server/music-routes.mjs +134 -0
- package/src/server/network-metrics.mjs +5 -3
- package/src/server/network-sampler.mjs +256 -0
- package/src/server/npm-latest.mjs +385 -0
- package/src/server/npm-upgrade.mjs +352 -0
- package/src/server/npx.mjs +41 -7
- package/src/server/output-watch.mjs +5 -4
- package/src/server/pinned-build.mjs +110 -0
- package/src/server/prefs-give-back.mjs +206 -0
- package/src/server/prefs-path.mjs +14 -0
- package/src/server/prefs-refusal.mjs +86 -0
- package/src/server/prefs-routes.mjs +99 -0
- package/src/server/prefs-set-aside.mjs +86 -0
- package/src/server/prefs-state.mjs +70 -0
- package/src/server/process-command.mjs +104 -0
- package/src/server/process-list.mjs +547 -0
- package/src/server/provider-status.mjs +307 -0
- package/src/server/pulse-line.mjs +132 -0
- package/src/server/purge-key.mjs +7 -7
- package/src/server/quota-cli.mjs +174 -0
- package/src/server/quota-oauth.mjs +190 -0
- package/src/server/quota-shape.mjs +229 -0
- package/src/server/quota-store-resets.mjs +206 -0
- package/src/server/quota.mjs +123 -509
- package/src/server/relay-guard.mjs +3 -3
- package/src/server/request-gates.mjs +441 -0
- package/src/server/restart-note.mjs +180 -0
- package/src/server/retire-sound-hook.mjs +3 -3
- package/src/server/ring-bounds.mjs +215 -0
- package/src/server/running-deck.mjs +1 -1
- package/src/server/running-version.mjs +24 -0
- package/src/server/self-update.mjs +39 -1371
- package/src/server/session-enrichment.mjs +622 -0
- package/src/server/session-read-gate.mjs +49 -0
- package/src/server/session-tracking.mjs +242 -0
- package/src/server/sse-clients.mjs +222 -0
- package/src/server/stale-discovery.mjs +30 -0
- package/src/server/static-serve.mjs +81 -0
- package/src/server/supervisor.mjs +73 -12
- package/src/server/system-metrics.mjs +169 -1935
- package/src/server/term.mjs +11 -249
- package/src/server/thermal-metrics.mjs +520 -0
- package/src/server/thermal-sampler.mjs +204 -0
- package/src/server/token-redact.mjs +123 -0
- package/src/server/transcript-gate.mjs +107 -0
- package/src/server/transcript-scan.mjs +563 -0
- package/src/server/usage-routes.mjs +108 -0
- package/src/server/uv-bootstrap.mjs +1 -1
- package/src/server/wordmark.mjs +127 -0
- package/dist/web/assets/BrowserWatchModal-CyAFTvAY.js +0 -1
- package/dist/web/assets/UsageHistoryModal-KJfli0oa.js +0 -1
- package/dist/web/assets/index-Ck2RAla3.css +0 -1
- package/dist/web/assets/index-jmrcEsCj.js +0 -298
|
@@ -1,298 +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 l of s)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();var rh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nm={exports:{}},Qc={},rm={exports:{}},pt={};/**
|
|
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 $1;function SO(){if($1)return pt;$1=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"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=m&&D[m]||D["@@iterator"],typeof D=="function"?D:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,b={};function _(D,K,re){this.props=D,this.context=K,this.refs=b,this.updater=re||v}_.prototype.isReactComponent={},_.prototype.setState=function(D,K){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,K,"setState")},_.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function k(){}k.prototype=_.prototype;function j(D,K,re){this.props=D,this.context=K,this.refs=b,this.updater=re||v}var E=j.prototype=new k;E.constructor=j,S(E,_.prototype),E.isPureReactComponent=!0;var C=Array.isArray,R=Object.prototype.hasOwnProperty,I={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function q(D,K,re){var z,Z={},U=null,ae=null;if(K!=null)for(z in K.ref!==void 0&&(ae=K.ref),K.key!==void 0&&(U=""+K.key),K)R.call(K,z)&&!$.hasOwnProperty(z)&&(Z[z]=K[z]);var le=arguments.length-2;if(le===1)Z.children=re;else if(1<le){for(var ge=Array(le),Ne=0;Ne<le;Ne++)ge[Ne]=arguments[Ne+2];Z.children=ge}if(D&&D.defaultProps)for(z in le=D.defaultProps,le)Z[z]===void 0&&(Z[z]=le[z]);return{$$typeof:e,type:D,key:U,ref:ae,props:Z,_owner:I.current}}function B(D,K){return{$$typeof:e,type:D.type,key:K,ref:D.ref,props:D.props,_owner:D._owner}}function P(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function W(D){var K={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(re){return K[re]})}var ne=/\/+/g;function ee(D,K){return typeof D=="object"&&D!==null&&D.key!=null?W(""+D.key):K.toString(36)}function M(D,K,re,z,Z){var U=typeof D;(U==="undefined"||U==="boolean")&&(D=null);var ae=!1;if(D===null)ae=!0;else switch(U){case"string":case"number":ae=!0;break;case"object":switch(D.$$typeof){case e:case t:ae=!0}}if(ae)return ae=D,Z=Z(ae),D=z===""?"."+ee(ae,0):z,C(Z)?(re="",D!=null&&(re=D.replace(ne,"$&/")+"/"),M(Z,K,re,"",function(Ne){return Ne})):Z!=null&&(P(Z)&&(Z=B(Z,re+(!Z.key||ae&&ae.key===Z.key?"":(""+Z.key).replace(ne,"$&/")+"/")+D)),K.push(Z)),1;if(ae=0,z=z===""?".":z+":",C(D))for(var le=0;le<D.length;le++){U=D[le];var ge=z+ee(U,le);ae+=M(U,K,re,ge,Z)}else if(ge=y(D),typeof ge=="function")for(D=ge.call(D),le=0;!(U=D.next()).done;)U=U.value,ge=z+ee(U,le++),ae+=M(U,K,re,ge,Z);else if(U==="object")throw K=String(D),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return ae}function X(D,K,re){if(D==null)return D;var z=[],Z=0;return M(D,z,"","",function(U){return K.call(re,U,Z++)}),z}function V(D){if(D._status===-1){var K=D._result;K=K(),K.then(function(re){(D._status===0||D._status===-1)&&(D._status=1,D._result=re)},function(re){(D._status===0||D._status===-1)&&(D._status=2,D._result=re)}),D._status===-1&&(D._status=0,D._result=K)}if(D._status===1)return D._result.default;throw D._result}var G={current:null},F={transition:null},L={ReactCurrentDispatcher:G,ReactCurrentBatchConfig:F,ReactCurrentOwner:I};function H(){throw Error("act(...) is not supported in production builds of React.")}return pt.Children={map:X,forEach:function(D,K,re){X(D,function(){K.apply(this,arguments)},re)},count:function(D){var K=0;return X(D,function(){K++}),K},toArray:function(D){return X(D,function(K){return K})||[]},only:function(D){if(!P(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},pt.Component=_,pt.Fragment=n,pt.Profiler=s,pt.PureComponent=j,pt.StrictMode=r,pt.Suspense=f,pt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L,pt.act=H,pt.cloneElement=function(D,K,re){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var z=S({},D.props),Z=D.key,U=D.ref,ae=D._owner;if(K!=null){if(K.ref!==void 0&&(U=K.ref,ae=I.current),K.key!==void 0&&(Z=""+K.key),D.type&&D.type.defaultProps)var le=D.type.defaultProps;for(ge in K)R.call(K,ge)&&!$.hasOwnProperty(ge)&&(z[ge]=K[ge]===void 0&&le!==void 0?le[ge]:K[ge])}var ge=arguments.length-2;if(ge===1)z.children=re;else if(1<ge){le=Array(ge);for(var Ne=0;Ne<ge;Ne++)le[Ne]=arguments[Ne+2];z.children=le}return{$$typeof:e,type:D.type,key:Z,ref:U,props:z,_owner:ae}},pt.createContext=function(D){return D={$$typeof:c,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},D.Provider={$$typeof:l,_context:D},D.Consumer=D},pt.createElement=q,pt.createFactory=function(D){var K=q.bind(null,D);return K.type=D,K},pt.createRef=function(){return{current:null}},pt.forwardRef=function(D){return{$$typeof:u,render:D}},pt.isValidElement=P,pt.lazy=function(D){return{$$typeof:h,_payload:{_status:-1,_result:D},_init:V}},pt.memo=function(D,K){return{$$typeof:p,type:D,compare:K===void 0?null:K}},pt.startTransition=function(D){var K=F.transition;F.transition={};try{D()}finally{F.transition=K}},pt.unstable_act=H,pt.useCallback=function(D,K){return G.current.useCallback(D,K)},pt.useContext=function(D){return G.current.useContext(D)},pt.useDebugValue=function(){},pt.useDeferredValue=function(D){return G.current.useDeferredValue(D)},pt.useEffect=function(D,K){return G.current.useEffect(D,K)},pt.useId=function(){return G.current.useId()},pt.useImperativeHandle=function(D,K,re){return G.current.useImperativeHandle(D,K,re)},pt.useInsertionEffect=function(D,K){return G.current.useInsertionEffect(D,K)},pt.useLayoutEffect=function(D,K){return G.current.useLayoutEffect(D,K)},pt.useMemo=function(D,K){return G.current.useMemo(D,K)},pt.useReducer=function(D,K,re){return G.current.useReducer(D,K,re)},pt.useRef=function(D){return G.current.useRef(D)},pt.useState=function(D){return G.current.useState(D)},pt.useSyncExternalStore=function(D,K,re){return G.current.useSyncExternalStore(D,K,re)},pt.useTransition=function(){return G.current.useTransition()},pt.version="18.3.1",pt}var O1;function qu(){return O1||(O1=1,rm.exports=SO()),rm.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 L1;function jO(){if(L1)return Qc;L1=1;var e=qu(),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,l={key:!0,ref:!0,__self:!0,__source:!0};function c(u,f,p){var h,m={},y=null,v=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(v=f.ref);for(h in f)r.call(f,h)&&!l.hasOwnProperty(h)&&(m[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)m[h]===void 0&&(m[h]=f[h]);return{$$typeof:t,type:u,key:y,ref:v,props:m,_owner:s.current}}return Qc.Fragment=n,Qc.jsx=c,Qc.jsxs=c,Qc}var P1;function _O(){return P1||(P1=1,nm.exports=jO()),nm.exports}var o=_O(),sh={},sm={exports:{}},nr={},am={exports:{}},om={};/**
|
|
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 D1;function EO(){return D1||(D1=1,(function(e){function t(F,L){var H=F.length;F.push(L);e:for(;0<H;){var D=H-1>>>1,K=F[D];if(0<s(K,L))F[D]=L,F[H]=K,H=D;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var L=F[0],H=F.pop();if(H!==L){F[0]=H;e:for(var D=0,K=F.length,re=K>>>1;D<re;){var z=2*(D+1)-1,Z=F[z],U=z+1,ae=F[U];if(0>s(Z,H))U<K&&0>s(ae,Z)?(F[D]=ae,F[U]=H,D=U):(F[D]=Z,F[z]=H,D=z);else if(U<K&&0>s(ae,H))F[D]=ae,F[U]=H,D=U;else break e}}return L}function s(F,L){var H=F.sortIndex-L.sortIndex;return H!==0?H:F.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],p=[],h=1,m=null,y=3,v=!1,S=!1,b=!1,_=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(F){for(var L=n(p);L!==null;){if(L.callback===null)r(p);else if(L.startTime<=F)r(p),L.sortIndex=L.expirationTime,t(f,L);else break;L=n(p)}}function C(F){if(b=!1,E(F),!S)if(n(f)!==null)S=!0,V(R);else{var L=n(p);L!==null&&G(C,L.startTime-F)}}function R(F,L){S=!1,b&&(b=!1,k(q),q=-1),v=!0;var H=y;try{for(E(L),m=n(f);m!==null&&(!(m.expirationTime>L)||F&&!W());){var D=m.callback;if(typeof D=="function"){m.callback=null,y=m.priorityLevel;var K=D(m.expirationTime<=L);L=e.unstable_now(),typeof K=="function"?m.callback=K:m===n(f)&&r(f),E(L)}else r(f);m=n(f)}if(m!==null)var re=!0;else{var z=n(p);z!==null&&G(C,z.startTime-L),re=!1}return re}finally{m=null,y=H,v=!1}}var I=!1,$=null,q=-1,B=5,P=-1;function W(){return!(e.unstable_now()-P<B)}function ne(){if($!==null){var F=e.unstable_now();P=F;var L=!0;try{L=$(!0,F)}finally{L?ee():(I=!1,$=null)}}else I=!1}var ee;if(typeof j=="function")ee=function(){j(ne)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,X=M.port2;M.port1.onmessage=ne,ee=function(){X.postMessage(null)}}else ee=function(){_(ne,0)};function V(F){$=F,I||(I=!0,ee())}function G(F,L){q=_(function(){F(e.unstable_now())},L)}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(F){F.callback=null},e.unstable_continueExecution=function(){S||v||(S=!0,V(R))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(F){switch(y){case 1:case 2:case 3:var L=3;break;default:L=y}var H=y;y=L;try{return F()}finally{y=H}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,L){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var H=y;y=F;try{return L()}finally{y=H}},e.unstable_scheduleCallback=function(F,L,H){var D=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?D+H:D):H=D,F){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=H+K,F={id:h++,callback:L,priorityLevel:F,startTime:H,expirationTime:K,sortIndex:-1},H>D?(F.sortIndex=H,t(p,F),n(f)===null&&F===n(p)&&(b?(k(q),q=-1):b=!0,G(C,H-D))):(F.sortIndex=K,t(f,F),S||v||(S=!0,V(R))),F},e.unstable_shouldYield=W,e.unstable_wrapCallback=function(F){var L=y;return function(){var H=y;y=L;try{return F.apply(this,arguments)}finally{y=H}}}})(om)),om}var F1;function CO(){return F1||(F1=1,am.exports=EO()),am.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 q1;function TO(){if(q1)return nr;q1=1;var e=qu(),t=CO();function n(a){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+a,d=1;d<arguments.length;d++)i+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+a+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,s={};function l(a,i){c(a,i),c(a+"Capture",i)}function c(a,i){for(s[a]=i,a=0;a<i.length;a++)r.add(i[a])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},m={};function y(a){return f.call(m,a)?!0:f.call(h,a)?!1:p.test(a)?m[a]=!0:(h[a]=!0,!1)}function v(a,i,d,g){if(d!==null&&d.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return g?!1:d!==null?!d.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function S(a,i,d,g){if(i===null||typeof i>"u"||v(a,i,d,g))return!0;if(g)return!1;if(d!==null)switch(d.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function b(a,i,d,g,x,N,O){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=g,this.attributeNamespace=x,this.mustUseProperty=d,this.propertyName=a,this.type=i,this.sanitizeURL=N,this.removeEmptyString=O}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){_[a]=new b(a,0,!1,a,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var i=a[0];_[i]=new b(i,1,!1,a[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(a){_[a]=new b(a,2,!1,a.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){_[a]=new b(a,2,!1,a,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(a){_[a]=new b(a,3,!1,a.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(a){_[a]=new b(a,3,!0,a,null,!1,!1)}),["capture","download"].forEach(function(a){_[a]=new b(a,4,!1,a,null,!1,!1)}),["cols","rows","size","span"].forEach(function(a){_[a]=new b(a,6,!1,a,null,!1,!1)}),["rowSpan","start"].forEach(function(a){_[a]=new b(a,5,!1,a.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function j(a){return a[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(a){var i=a.replace(k,j);_[i]=new b(i,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var i=a.replace(k,j);_[i]=new b(i,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var i=a.replace(k,j);_[i]=new b(i,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(a){_[a]=new b(a,1,!1,a.toLowerCase(),null,!1,!1)}),_.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(a){_[a]=new b(a,1,!1,a.toLowerCase(),null,!0,!0)});function E(a,i,d,g){var x=_.hasOwnProperty(i)?_[i]:null;(x!==null?x.type!==0:g||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(S(i,d,x,g)&&(d=null),g||x===null?y(i)&&(d===null?a.removeAttribute(i):a.setAttribute(i,""+d)):x.mustUseProperty?a[x.propertyName]=d===null?x.type===3?!1:"":d:(i=x.attributeName,g=x.attributeNamespace,d===null?a.removeAttribute(i):(x=x.type,d=x===3||x===4&&d===!0?"":""+d,g?a.setAttributeNS(g,i,d):a.setAttribute(i,d))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,R=Symbol.for("react.element"),I=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),W=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),G=Symbol.for("react.offscreen"),F=Symbol.iterator;function L(a){return a===null||typeof a!="object"?null:(a=F&&a[F]||a["@@iterator"],typeof a=="function"?a:null)}var H=Object.assign,D;function K(a){if(D===void 0)try{throw Error()}catch(d){var i=d.stack.trim().match(/\n( *(at )?)/);D=i&&i[1]||""}return`
|
|
34
|
-
`+D+a}var re=!1;function z(a,i){if(!a||re)return"";re=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(we){var g=we}Reflect.construct(a,[],i)}else{try{i.call()}catch(we){g=we}a.call(i.prototype)}else{try{throw Error()}catch(we){g=we}a()}}catch(we){if(we&&g&&typeof we.stack=="string"){for(var x=we.stack.split(`
|
|
35
|
-
`),N=g.stack.split(`
|
|
36
|
-
`),O=x.length-1,J=N.length-1;1<=O&&0<=J&&x[O]!==N[J];)J--;for(;1<=O&&0<=J;O--,J--)if(x[O]!==N[J]){if(O!==1||J!==1)do if(O--,J--,0>J||x[O]!==N[J]){var oe=`
|
|
37
|
-
`+x[O].replace(" at new "," at ");return a.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",a.displayName)),oe}while(1<=O&&0<=J);break}}}finally{re=!1,Error.prepareStackTrace=d}return(a=a?a.displayName||a.name:"")?K(a):""}function Z(a){switch(a.tag){case 5:return K(a.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return a=z(a.type,!1),a;case 11:return a=z(a.type.render,!1),a;case 1:return a=z(a.type,!0),a;default:return""}}function U(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case $:return"Fragment";case I:return"Portal";case B:return"Profiler";case q:return"StrictMode";case ee:return"Suspense";case M:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case W:return(a.displayName||"Context")+".Consumer";case P:return(a._context.displayName||"Context")+".Provider";case ne:var i=a.render;return a=a.displayName,a||(a=i.displayName||i.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case X:return i=a.displayName||null,i!==null?i:U(a.type)||"Memo";case V:i=a._payload,a=a._init;try{return U(a(i))}catch{}}return null}function ae(a){var i=a.type;switch(a.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=i.render,a=a.displayName||a.name||"",i.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return U(i);case 8:return i===q?"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 i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function le(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function ge(a){var i=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Ne(a){var i=ge(a)?"checked":"value",d=Object.getOwnPropertyDescriptor(a.constructor.prototype,i),g=""+a[i];if(!a.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var x=d.get,N=d.set;return Object.defineProperty(a,i,{configurable:!0,get:function(){return x.call(this)},set:function(O){g=""+O,N.call(this,O)}}),Object.defineProperty(a,i,{enumerable:d.enumerable}),{getValue:function(){return g},setValue:function(O){g=""+O},stopTracking:function(){a._valueTracker=null,delete a[i]}}}}function Ie(a){a._valueTracker||(a._valueTracker=Ne(a))}function Ge(a){if(!a)return!1;var i=a._valueTracker;if(!i)return!0;var d=i.getValue(),g="";return a&&(g=ge(a)?a.checked?"true":"false":a.value),a=g,a!==d?(i.setValue(a),!0):!1}function Pe(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function ze(a,i){var d=i.checked;return H({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??a._wrapperState.initialChecked})}function Re(a,i){var d=i.defaultValue==null?"":i.defaultValue,g=i.checked!=null?i.checked:i.defaultChecked;d=le(i.value!=null?i.value:d),a._wrapperState={initialChecked:g,initialValue:d,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function st(a,i){i=i.checked,i!=null&&E(a,"checked",i,!1)}function ue(a,i){st(a,i);var d=le(i.value),g=i.type;if(d!=null)g==="number"?(d===0&&a.value===""||a.value!=d)&&(a.value=""+d):a.value!==""+d&&(a.value=""+d);else if(g==="submit"||g==="reset"){a.removeAttribute("value");return}i.hasOwnProperty("value")?se(a,i.type,d):i.hasOwnProperty("defaultValue")&&se(a,i.type,le(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(a.defaultChecked=!!i.defaultChecked)}function ce(a,i,d){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var g=i.type;if(!(g!=="submit"&&g!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+a._wrapperState.initialValue,d||i===a.value||(a.value=i),a.defaultValue=i}d=a.name,d!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,d!==""&&(a.name=d)}function se(a,i,d){(i!=="number"||Pe(a.ownerDocument)!==a)&&(d==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+d&&(a.defaultValue=""+d))}var be=Array.isArray;function Le(a,i,d,g){if(a=a.options,i){i={};for(var x=0;x<d.length;x++)i["$"+d[x]]=!0;for(d=0;d<a.length;d++)x=i.hasOwnProperty("$"+a[d].value),a[d].selected!==x&&(a[d].selected=x),x&&g&&(a[d].defaultSelected=!0)}else{for(d=""+le(d),i=null,x=0;x<a.length;x++){if(a[x].value===d){a[x].selected=!0,g&&(a[x].defaultSelected=!0);return}i!==null||a[x].disabled||(i=a[x])}i!==null&&(i.selected=!0)}}function de(a,i){if(i.dangerouslySetInnerHTML!=null)throw Error(n(91));return H({},i,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function fe(a,i){var d=i.value;if(d==null){if(d=i.children,i=i.defaultValue,d!=null){if(i!=null)throw Error(n(92));if(be(d)){if(1<d.length)throw Error(n(93));d=d[0]}i=d}i==null&&(i=""),d=i}a._wrapperState={initialValue:le(d)}}function Ce(a,i){var d=le(i.value),g=le(i.defaultValue);d!=null&&(d=""+d,d!==a.value&&(a.value=d),i.defaultValue==null&&a.defaultValue!==d&&(a.defaultValue=d)),g!=null&&(a.defaultValue=""+g)}function pe(a){var i=a.textContent;i===a._wrapperState.initialValue&&i!==""&&i!==null&&(a.value=i)}function _e(a){switch(a){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 Ye(a,i){return a==null||a==="http://www.w3.org/1999/xhtml"?_e(i):a==="http://www.w3.org/2000/svg"&&i==="foreignObject"?"http://www.w3.org/1999/xhtml":a}var qe,ke=(function(a){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(i,d,g,x){MSApp.execUnsafeLocalFunction(function(){return a(i,d,g,x)})}:a})(function(a,i){if(a.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in a)a.innerHTML=i;else{for(qe=qe||document.createElement("div"),qe.innerHTML="<svg>"+i.valueOf().toString()+"</svg>",i=qe.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;i.firstChild;)a.appendChild(i.firstChild)}});function Ae(a,i){if(i){var d=a.firstChild;if(d&&d===a.lastChild&&d.nodeType===3){d.nodeValue=i;return}}a.textContent=i}var Ue={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},Fe=["Webkit","ms","Moz","O"];Object.keys(Ue).forEach(function(a){Fe.forEach(function(i){i=i+a.charAt(0).toUpperCase()+a.substring(1),Ue[i]=Ue[a]})});function Ve(a,i,d){return i==null||typeof i=="boolean"||i===""?"":d||typeof i!="number"||i===0||Ue.hasOwnProperty(a)&&Ue[a]?(""+i).trim():i+"px"}function rt(a,i){a=a.style;for(var d in i)if(i.hasOwnProperty(d)){var g=d.indexOf("--")===0,x=Ve(d,i[d],g);d==="float"&&(d="cssFloat"),g?a.setProperty(d,x):a[d]=x}}var ut=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 ct(a,i){if(i){if(ut[a]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(n(137,a));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(n(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(n(61))}if(i.style!=null&&typeof i.style!="object")throw Error(n(62))}}function yt(a,i){if(a.indexOf("-")===-1)return typeof i.is=="string";switch(a){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 It=null;function zt(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Xt=null,Ft=null,rn=null;function Se(a){if(a=Fo(a)){if(typeof Xt!="function")throw Error(n(280));var i=a.stateNode;i&&(i=al(i),Xt(a.stateNode,a.type,i))}}function vt(a){Ft?rn?rn.push(a):rn=[a]:Ft=a}function kt(){if(Ft){var a=Ft,i=rn;if(rn=Ft=null,Se(a),i)for(a=0;a<i.length;a++)Se(i[a])}}function _n(a,i){return a(i)}function Ut(){}var Vn=!1;function Vt(a,i,d){if(Vn)return a(i,d);Vn=!0;try{return _n(a,i,d)}finally{Vn=!1,(Ft!==null||rn!==null)&&(Ut(),kt())}}function $t(a,i){var d=a.stateNode;if(d===null)return null;var g=al(d);if(g===null)return null;d=g[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(a=a.type,g=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!g;break e;default:a=!1}if(a)return null;if(d&&typeof d!="function")throw Error(n(231,i,typeof d));return d}var Zt=!1;if(u)try{var Ln={};Object.defineProperty(Ln,"passive",{get:function(){Zt=!0}}),window.addEventListener("test",Ln,Ln),window.removeEventListener("test",Ln,Ln)}catch{Zt=!1}function Ur(a,i,d,g,x,N,O,J,oe){var we=Array.prototype.slice.call(arguments,3);try{i.apply(d,we)}catch(Te){this.onError(Te)}}var xe=!1,ir=null,Ns=!1,Hr=null,ma={onError:function(a){xe=!0,ir=a}};function Ss(a,i,d,g,x,N,O,J,oe){xe=!1,ir=null,Ur.apply(ma,arguments)}function xr(a,i,d,g,x,N,O,J,oe){if(Ss.apply(this,arguments),xe){if(xe){var we=ir;xe=!1,ir=null}else throw Error(n(198));Ns||(Ns=!0,Hr=we)}}function Pn(a){var i=a,d=a;if(a.alternate)for(;i.return;)i=i.return;else{a=i;do i=a,(i.flags&4098)!==0&&(d=i.return),a=i.return;while(a)}return i.tag===3?d:null}function Hs(a){if(a.tag===13){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function Q(a){if(Pn(a)!==a)throw Error(n(188))}function De(a){var i=a.alternate;if(!i){if(i=Pn(a),i===null)throw Error(n(188));return i!==a?null:a}for(var d=a,g=i;;){var x=d.return;if(x===null)break;var N=x.alternate;if(N===null){if(g=x.return,g!==null){d=g;continue}break}if(x.child===N.child){for(N=x.child;N;){if(N===d)return Q(x),a;if(N===g)return Q(x),i;N=N.sibling}throw Error(n(188))}if(d.return!==g.return)d=x,g=N;else{for(var O=!1,J=x.child;J;){if(J===d){O=!0,d=x,g=N;break}if(J===g){O=!0,g=x,d=N;break}J=J.sibling}if(!O){for(J=N.child;J;){if(J===d){O=!0,d=N,g=x;break}if(J===g){O=!0,g=N,d=x;break}J=J.sibling}if(!O)throw Error(n(189))}}if(d.alternate!==g)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?a:i}function Je(a){return a=De(a),a!==null?He(a):null}function He(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var i=He(a);if(i!==null)return i;a=a.sibling}return null}var tt=t.unstable_scheduleCallback,wt=t.unstable_cancelCallback,gt=t.unstable_shouldYield,At=t.unstable_requestPaint,Ct=t.unstable_now,Qt=t.unstable_getCurrentPriorityLevel,St=t.unstable_ImmediatePriority,br=t.unstable_UserBlockingPriority,lr=t.unstable_NormalPriority,Ci=t.unstable_LowPriority,dt=t.unstable_IdlePriority,cr=null,sn=null;function Wr(a){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(cr,a,void 0,(a.current.flags&128)===128)}catch{}}var Gn=Math.clz32?Math.clz32:ed,Ju=Math.log,uo=Math.LN2;function ed(a){return a>>>=0,a===0?32:31-(Ju(a)/uo|0)|0}var ga=64,Ti=4194304;function ho(a){switch(a&-a){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 a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function Kn(a,i){var d=a.pendingLanes;if(d===0)return 0;var g=0,x=a.suspendedLanes,N=a.pingedLanes,O=d&268435455;if(O!==0){var J=O&~x;J!==0?g=ho(J):(N&=O,N!==0&&(g=ho(N)))}else O=d&~x,O!==0?g=ho(O):N!==0&&(g=ho(N));if(g===0)return 0;if(i!==0&&i!==g&&(i&x)===0&&(x=g&-g,N=i&-i,x>=N||x===16&&(N&4194240)!==0))return i;if((g&4)!==0&&(g|=d&16),i=a.entangledLanes,i!==0)for(a=a.entanglements,i&=g;0<i;)d=31-Gn(i),x=1<<d,g|=a[d],i&=~x;return g}function ep(a,i){switch(a){case 1:case 2:case 4:return i+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 i+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 Ri(a,i){for(var d=a.suspendedLanes,g=a.pingedLanes,x=a.expirationTimes,N=a.pendingLanes;0<N;){var O=31-Gn(N),J=1<<O,oe=x[O];oe===-1?((J&d)===0||(J&g)!==0)&&(x[O]=ep(J,i)):oe<=i&&(a.expiredLanes|=J),N&=~J}}function fo(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function ya(){var a=ga;return ga<<=1,(ga&4194240)===0&&(ga=64),a}function cc(a){for(var i=[],d=0;31>d;d++)i.push(a);return i}function po(a,i,d){a.pendingLanes|=i,i!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,i=31-Gn(i),a[i]=d}function tp(a,i){var d=a.pendingLanes&~i;a.pendingLanes=i,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=i,a.mutableReadLanes&=i,a.entangledLanes&=i,i=a.entanglements;var g=a.eventTimes;for(a=a.expirationTimes;0<d;){var x=31-Gn(d),N=1<<x;i[x]=0,g[x]=-1,a[x]=-1,d&=~N}}function uc(a,i){var d=a.entangledLanes|=i;for(a=a.entanglements;d;){var g=31-Gn(d),x=1<<g;x&i|a[g]&i&&(a[g]|=i),d&=~x}}var ht=0;function td(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var nd,Dn,mo,Ai,rd,dc=!1,go=[],Vr=null,Gr=null,kr=null,wa=new Map,Ws=new Map,Kr=[],np="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 hc(a,i){switch(a){case"focusin":case"focusout":Vr=null;break;case"dragenter":case"dragleave":Gr=null;break;case"mouseover":case"mouseout":kr=null;break;case"pointerover":case"pointerout":wa.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ws.delete(i.pointerId)}}function yo(a,i,d,g,x,N){return a===null||a.nativeEvent!==N?(a={blockedOn:i,domEventName:d,eventSystemFlags:g,nativeEvent:N,targetContainers:[x]},i!==null&&(i=Fo(i),i!==null&&Dn(i)),a):(a.eventSystemFlags|=g,i=a.targetContainers,x!==null&&i.indexOf(x)===-1&&i.push(x),a)}function fc(a,i,d,g,x){switch(i){case"focusin":return Vr=yo(Vr,a,i,d,g,x),!0;case"dragenter":return Gr=yo(Gr,a,i,d,g,x),!0;case"mouseover":return kr=yo(kr,a,i,d,g,x),!0;case"pointerover":var N=x.pointerId;return wa.set(N,yo(wa.get(N)||null,a,i,d,g,x)),!0;case"gotpointercapture":return N=x.pointerId,Ws.set(N,yo(Ws.get(N)||null,a,i,d,g,x)),!0}return!1}function pc(a){var i=Ts(a.target);if(i!==null){var d=Pn(i);if(d!==null){if(i=d.tag,i===13){if(i=Hs(d),i!==null){a.blockedOn=i,rd(a.priority,function(){mo(d)});return}}else if(i===3&&d.stateNode.current.memoizedState.isDehydrated){a.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}a.blockedOn=null}function Mi(a){if(a.blockedOn!==null)return!1;for(var i=a.targetContainers;0<i.length;){var d=Oi(a.domEventName,a.eventSystemFlags,i[0],a.nativeEvent);if(d===null){d=a.nativeEvent;var g=new d.constructor(d.type,d);It=g,d.target.dispatchEvent(g),It=null}else return i=Fo(d),i!==null&&Dn(i),a.blockedOn=d,!1;i.shift()}return!0}function wo(a,i,d){Mi(a)&&d.delete(i)}function sd(){dc=!1,Vr!==null&&Mi(Vr)&&(Vr=null),Gr!==null&&Mi(Gr)&&(Gr=null),kr!==null&&Mi(kr)&&(kr=null),wa.forEach(wo),Ws.forEach(wo)}function js(a,i){a.blockedOn===i&&(a.blockedOn=null,dc||(dc=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,sd)))}function va(a){function i(x){return js(x,a)}if(0<go.length){js(go[0],a);for(var d=1;d<go.length;d++){var g=go[d];g.blockedOn===a&&(g.blockedOn=null)}}for(Vr!==null&&js(Vr,a),Gr!==null&&js(Gr,a),kr!==null&&js(kr,a),wa.forEach(i),Ws.forEach(i),d=0;d<Kr.length;d++)g=Kr[d],g.blockedOn===a&&(g.blockedOn=null);for(;0<Kr.length&&(d=Kr[0],d.blockedOn===null);)pc(d),d.blockedOn===null&&Kr.shift()}var Vs=C.ReactCurrentBatchConfig,ur=!0;function rp(a,i,d,g){var x=ht,N=Vs.transition;Vs.transition=null;try{ht=1,Ii(a,i,d,g)}finally{ht=x,Vs.transition=N}}function ad(a,i,d,g){var x=ht,N=Vs.transition;Vs.transition=null;try{ht=4,Ii(a,i,d,g)}finally{ht=x,Vs.transition=N}}function Ii(a,i,d,g){if(ur){var x=Oi(a,i,d,g);if(x===null)el(a,i,g,$i,d),hc(a,g);else if(fc(x,a,i,d,g))g.stopPropagation();else if(hc(a,g),i&4&&-1<np.indexOf(a)){for(;x!==null;){var N=Fo(x);if(N!==null&&nd(N),N=Oi(a,i,d,g),N===null&&el(a,i,g,$i,d),N===x)break;x=N}x!==null&&g.stopPropagation()}else el(a,i,g,null,d)}}var $i=null;function Oi(a,i,d,g){if($i=null,a=zt(g),a=Ts(a),a!==null)if(i=Pn(a),i===null)a=null;else if(d=i.tag,d===13){if(a=Hs(i),a!==null)return a;a=null}else if(d===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;a=null}else i!==a&&(a=null);return $i=a,null}function xa(a){switch(a){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(Qt()){case St:return 1;case br:return 4;case lr:case Ci:return 16;case dt:return 536870912;default:return 16}default:return 16}}var _s=null,Li=null,En=null;function vo(){if(En)return En;var a,i=Li,d=i.length,g,x="value"in _s?_s.value:_s.textContent,N=x.length;for(a=0;a<d&&i[a]===x[a];a++);var O=d-a;for(g=1;g<=O&&i[d-g]===x[N-g];g++);return En=x.slice(a,1<g?1-g:void 0)}function Pi(a){var i=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&i===13&&(a=13)):a=i,a===10&&(a=13),32<=a||a===13?a:0}function ba(){return!0}function Jt(){return!1}function Fn(a){function i(d,g,x,N,O){this._reactName=d,this._targetInst=x,this.type=g,this.nativeEvent=N,this.target=O,this.currentTarget=null;for(var J in a)a.hasOwnProperty(J)&&(d=a[J],this[J]=d?d(N):N[J]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?ba:Jt,this.isPropagationStopped=Jt,this}return H(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=ba)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=ba)},persist:function(){},isPersistent:ba}),i}var qn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ka=Fn(qn),Na=H({},qn,{view:0,detail:0}),sp=Fn(Na),Nr,Sa,xo,Di=H({},Na,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vc,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==xo&&(xo&&a.type==="mousemove"?(Nr=a.screenX-xo.screenX,Sa=a.screenY-xo.screenY):Sa=Nr=0,xo=a),Nr)},movementY:function(a){return"movementY"in a?a.movementY:Sa}}),mc=Fn(Di),od=H({},Di,{dataTransfer:0}),ja=Fn(od),id=H({},Na,{relatedTarget:0}),Fi=Fn(id),bo=H({},qn,{animationName:0,elapsedTime:0,pseudoElement:0}),gc=Fn(bo),ld=H({},qn,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),cd=Fn(ld),ud=H({},qn,{data:0}),yc=Fn(ud),Gt={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qi={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"},Bi={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wc(a){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(a):(a=Bi[a])?!!i[a]:!1}function vc(){return wc}var _a=H({},Na,{key:function(a){if(a.key){var i=Gt[a.key]||a.key;if(i!=="Unidentified")return i}return a.type==="keypress"?(a=Pi(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?qi[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vc,charCode:function(a){return a.type==="keypress"?Pi(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?Pi(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),dd=Fn(_a),ko=H({},Di,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hd=Fn(ko),zi=H({},Na,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vc}),ap=Fn(zi),No=H({},qn,{propertyName:0,elapsedTime:0,pseudoElement:0}),xc=Fn(No),Ui=H({},Di,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),op=Fn(Ui),Gs=[9,13,27,32],Hi=u&&"CompositionEvent"in window,Ks=null;u&&"documentMode"in document&&(Ks=document.documentMode);var Wi=u&&"TextEvent"in window&&!Ks,fd=u&&(!Hi||Ks&&8<Ks&&11>=Ks),pd=" ",Yr=!1;function md(a,i){switch(a){case"keyup":return Gs.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bc(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Ea=!1;function gd(a,i){switch(a){case"compositionend":return bc(i);case"keypress":return i.which!==32?null:(Yr=!0,pd);case"textInput":return a=i.data,a===pd&&Yr?null:a;default:return null}}function ip(a,i){if(Ea)return a==="compositionend"||!Hi&&md(a,i)?(a=vo(),En=Li=_s=null,Ea=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return fd&&i.locale!=="ko"?null:i.data;default:return null}}var lp={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 yd(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i==="input"?!!lp[a.type]:i==="textarea"}function wd(a,i,d,g){vt(g),i=tl(i,"onChange"),0<i.length&&(d=new ka("onChange","change",null,d,g),a.push({event:d,listeners:i}))}var So=null,jo=null;function dr(a){bd(a,0)}function Xr(a){var i=es(a);if(Ge(i))return a}function _o(a,i){if(a==="change")return i}var Eo=!1;if(u){var Vi;if(u){var Gi="oninput"in document;if(!Gi){var Ca=document.createElement("div");Ca.setAttribute("oninput","return;"),Gi=typeof Ca.oninput=="function"}Vi=Gi}else Vi=!1;Eo=Vi&&(!document.documentMode||9<document.documentMode)}function kc(){So&&(So.detachEvent("onpropertychange",Ki),jo=So=null)}function Ki(a){if(a.propertyName==="value"&&Xr(jo)){var i=[];wd(i,jo,a,zt(a)),Vt(dr,i)}}function Ys(a,i,d){a==="focusin"?(kc(),So=i,jo=d,So.attachEvent("onpropertychange",Ki)):a==="focusout"&&kc()}function vd(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return Xr(jo)}function Yn(a,i){if(a==="click")return Xr(i)}function Nc(a,i){if(a==="input"||a==="change")return Xr(i)}function Sc(a,i){return a===i&&(a!==0||1/a===1/i)||a!==a&&i!==i}var Xn=typeof Object.is=="function"?Object.is:Sc;function Es(a,i){if(Xn(a,i))return!0;if(typeof a!="object"||a===null||typeof i!="object"||i===null)return!1;var d=Object.keys(a),g=Object.keys(i);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var x=d[g];if(!f.call(i,x)||!Xn(a[x],i[x]))return!1}return!0}function Yi(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function jc(a,i){var d=Yi(a);a=0;for(var g;d;){if(d.nodeType===3){if(g=a+d.textContent.length,a<=i&&g>=i)return{node:d,offset:i-a};a=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Yi(d)}}function Xi(a,i){return a&&i?a===i?!0:a&&a.nodeType===3?!1:i&&i.nodeType===3?Xi(a,i.parentNode):"contains"in a?a.contains(i):a.compareDocumentPosition?!!(a.compareDocumentPosition(i)&16):!1:!1}function Zi(){for(var a=window,i=Pe();i instanceof a.HTMLIFrameElement;){try{var d=typeof i.contentWindow.location.href=="string"}catch{d=!1}if(d)a=i.contentWindow;else break;i=Pe(a.document)}return i}function _c(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i&&(i==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||i==="textarea"||a.contentEditable==="true")}function Xs(a){var i=Zi(),d=a.focusedElem,g=a.selectionRange;if(i!==d&&d&&d.ownerDocument&&Xi(d.ownerDocument.documentElement,d)){if(g!==null&&_c(d)){if(i=g.start,a=g.end,a===void 0&&(a=i),"selectionStart"in d)d.selectionStart=i,d.selectionEnd=Math.min(a,d.value.length);else if(a=(i=d.ownerDocument||document)&&i.defaultView||window,a.getSelection){a=a.getSelection();var x=d.textContent.length,N=Math.min(g.start,x);g=g.end===void 0?N:Math.min(g.end,x),!a.extend&&N>g&&(x=g,g=N,N=x),x=jc(d,N);var O=jc(d,g);x&&O&&(a.rangeCount!==1||a.anchorNode!==x.node||a.anchorOffset!==x.offset||a.focusNode!==O.node||a.focusOffset!==O.offset)&&(i=i.createRange(),i.setStart(x.node,x.offset),a.removeAllRanges(),N>g?(a.addRange(i),a.extend(O.node,O.offset)):(i.setEnd(O.node,O.offset),a.addRange(i)))}}for(i=[],a=d;a=a.parentNode;)a.nodeType===1&&i.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<i.length;d++)a=i[d],a.element.scrollLeft=a.left,a.element.scrollTop=a.top}}var Ec=u&&"documentMode"in document&&11>=document.documentMode,Zs=null,Qs=null,Ta=null,Ra=!1;function Sr(a,i,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Ra||Zs==null||Zs!==Pe(g)||(g=Zs,"selectionStart"in g&&_c(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Ta&&Es(Ta,g)||(Ta=g,g=tl(Qs,"onSelect"),0<g.length&&(i=new ka("onSelect","select",null,i,d),a.push({event:i,listeners:g}),i.target=Zs)))}function Aa(a,i){var d={};return d[a.toLowerCase()]=i.toLowerCase(),d["Webkit"+a]="webkit"+i,d["Moz"+a]="moz"+i,d}var Ma={animationend:Aa("Animation","AnimationEnd"),animationiteration:Aa("Animation","AnimationIteration"),animationstart:Aa("Animation","AnimationStart"),transitionend:Aa("Transition","TransitionEnd")},Qi={},Cc={};u&&(Cc=document.createElement("div").style,"AnimationEvent"in window||(delete Ma.animationend.animation,delete Ma.animationiteration.animation,delete Ma.animationstart.animation),"TransitionEvent"in window||delete Ma.transitionend.transition);function Ji(a){if(Qi[a])return Qi[a];if(!Ma[a])return a;var i=Ma[a],d;for(d in i)if(i.hasOwnProperty(d)&&d in Cc)return Qi[a]=i[d];return a}var Kt=Ji("animationend"),Tc=Ji("animationiteration"),Co=Ji("animationstart"),hr=Ji("transitionend"),Js=new Map,Ia="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 jr(a,i){Js.set(a,i),l(i,[a])}for(var To=0;To<Ia.length;To++){var _r=Ia[To],Ro=_r.toLowerCase(),xd=_r[0].toUpperCase()+_r.slice(1);jr(Ro,"on"+xd)}jr(Kt,"onAnimationEnd"),jr(Tc,"onAnimationIteration"),jr(Co,"onAnimationStart"),jr("dblclick","onDoubleClick"),jr("focusin","onFocus"),jr("focusout","onBlur"),jr(hr,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ao="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(" "),cp=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ao));function Mo(a,i,d){var g=a.type||"unknown-event";a.currentTarget=d,xr(g,i,void 0,a),a.currentTarget=null}function bd(a,i){i=(i&4)!==0;for(var d=0;d<a.length;d++){var g=a[d],x=g.event;g=g.listeners;e:{var N=void 0;if(i)for(var O=g.length-1;0<=O;O--){var J=g[O],oe=J.instance,we=J.currentTarget;if(J=J.listener,oe!==N&&x.isPropagationStopped())break e;Mo(x,J,we),N=oe}else for(O=0;O<g.length;O++){if(J=g[O],oe=J.instance,we=J.currentTarget,J=J.listener,oe!==N&&x.isPropagationStopped())break e;Mo(x,J,we),N=oe}}}if(Ns)throw a=Hr,Ns=!1,Hr=null,a}function Mt(a,i){var d=i[sl];d===void 0&&(d=i[sl]=new Set);var g=a+"__bubble";d.has(g)||(Rc(i,a,2,!1),d.add(g))}function Io(a,i,d){var g=0;i&&(g|=4),Rc(d,a,g,i)}var fr="_reactListening"+Math.random().toString(36).slice(2);function Zr(a){if(!a[fr]){a[fr]=!0,r.forEach(function(d){d!=="selectionchange"&&(cp.has(d)||Io(d,!1,a),Io(d,!0,a))});var i=a.nodeType===9?a:a.ownerDocument;i===null||i[fr]||(i[fr]=!0,Io("selectionchange",!1,i))}}function Rc(a,i,d,g){switch(xa(i)){case 1:var x=rp;break;case 4:x=ad;break;default:x=Ii}d=x.bind(null,i,d,a),x=void 0,!Zt||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(x=!0),g?x!==void 0?a.addEventListener(i,d,{capture:!0,passive:x}):a.addEventListener(i,d,!0):x!==void 0?a.addEventListener(i,d,{passive:x}):a.addEventListener(i,d,!1)}function el(a,i,d,g,x){var N=g;if((i&1)===0&&(i&2)===0&&g!==null)e:for(;;){if(g===null)return;var O=g.tag;if(O===3||O===4){var J=g.stateNode.containerInfo;if(J===x||J.nodeType===8&&J.parentNode===x)break;if(O===4)for(O=g.return;O!==null;){var oe=O.tag;if((oe===3||oe===4)&&(oe=O.stateNode.containerInfo,oe===x||oe.nodeType===8&&oe.parentNode===x))return;O=O.return}for(;J!==null;){if(O=Ts(J),O===null)return;if(oe=O.tag,oe===5||oe===6){g=N=O;continue e}J=J.parentNode}}g=g.return}Vt(function(){var we=N,Te=zt(d),Me=[];e:{var Ee=Js.get(a);if(Ee!==void 0){var We=ka,Xe=a;switch(a){case"keypress":if(Pi(d)===0)break e;case"keydown":case"keyup":We=dd;break;case"focusin":Xe="focus",We=Fi;break;case"focusout":Xe="blur",We=Fi;break;case"beforeblur":case"afterblur":We=Fi;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":We=mc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":We=ja;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":We=ap;break;case Kt:case Tc:case Co:We=gc;break;case hr:We=xc;break;case"scroll":We=sp;break;case"wheel":We=op;break;case"copy":case"cut":case"paste":We=cd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":We=hd}var Ze=(i&4)!==0,Yt=!Ze&&a==="scroll",he=Ze?Ee!==null?Ee+"Capture":null:Ee;Ze=[];for(var ie=we,me;ie!==null;){me=ie;var $e=me.stateNode;if(me.tag===5&&$e!==null&&(me=$e,he!==null&&($e=$t(ie,he),$e!=null&&Ze.push($a(ie,$e,me)))),Yt)break;ie=ie.return}0<Ze.length&&(Ee=new We(Ee,Xe,null,d,Te),Me.push({event:Ee,listeners:Ze}))}}if((i&7)===0){e:{if(Ee=a==="mouseover"||a==="pointerover",We=a==="mouseout"||a==="pointerout",Ee&&d!==It&&(Xe=d.relatedTarget||d.fromElement)&&(Ts(Xe)||Xe[gn]))break e;if((We||Ee)&&(Ee=Te.window===Te?Te:(Ee=Te.ownerDocument)?Ee.defaultView||Ee.parentWindow:window,We?(Xe=d.relatedTarget||d.toElement,We=we,Xe=Xe?Ts(Xe):null,Xe!==null&&(Yt=Pn(Xe),Xe!==Yt||Xe.tag!==5&&Xe.tag!==6)&&(Xe=null)):(We=null,Xe=we),We!==Xe)){if(Ze=mc,$e="onMouseLeave",he="onMouseEnter",ie="mouse",(a==="pointerout"||a==="pointerover")&&(Ze=hd,$e="onPointerLeave",he="onPointerEnter",ie="pointer"),Yt=We==null?Ee:es(We),me=Xe==null?Ee:es(Xe),Ee=new Ze($e,ie+"leave",We,d,Te),Ee.target=Yt,Ee.relatedTarget=me,$e=null,Ts(Te)===we&&(Ze=new Ze(he,ie+"enter",Xe,d,Te),Ze.target=me,Ze.relatedTarget=Yt,$e=Ze),Yt=$e,We&&Xe)t:{for(Ze=We,he=Xe,ie=0,me=Ze;me;me=Oa(me))ie++;for(me=0,$e=he;$e;$e=Oa($e))me++;for(;0<ie-me;)Ze=Oa(Ze),ie--;for(;0<me-ie;)he=Oa(he),me--;for(;ie--;){if(Ze===he||he!==null&&Ze===he.alternate)break t;Ze=Oa(Ze),he=Oa(he)}Ze=null}else Ze=null;We!==null&&$o(Me,Ee,We,Ze,!1),Xe!==null&&Yt!==null&&$o(Me,Yt,Xe,Ze,!0)}}e:{if(Ee=we?es(we):window,We=Ee.nodeName&&Ee.nodeName.toLowerCase(),We==="select"||We==="input"&&Ee.type==="file")var Qe=_o;else if(yd(Ee))if(Eo)Qe=Nc;else{Qe=vd;var at=Ys}else(We=Ee.nodeName)&&We.toLowerCase()==="input"&&(Ee.type==="checkbox"||Ee.type==="radio")&&(Qe=Yn);if(Qe&&(Qe=Qe(a,we))){wd(Me,Qe,d,Te);break e}at&&at(a,Ee,we),a==="focusout"&&(at=Ee._wrapperState)&&at.controlled&&Ee.type==="number"&&se(Ee,"number",Ee.value)}switch(at=we?es(we):window,a){case"focusin":(yd(at)||at.contentEditable==="true")&&(Zs=at,Qs=we,Ta=null);break;case"focusout":Ta=Qs=Zs=null;break;case"mousedown":Ra=!0;break;case"contextmenu":case"mouseup":case"dragend":Ra=!1,Sr(Me,d,Te);break;case"selectionchange":if(Ec)break;case"keydown":case"keyup":Sr(Me,d,Te)}var ot;if(Hi)e:{switch(a){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else Ea?md(a,d)&&(it="onCompositionEnd"):a==="keydown"&&d.keyCode===229&&(it="onCompositionStart");it&&(fd&&d.locale!=="ko"&&(Ea||it!=="onCompositionStart"?it==="onCompositionEnd"&&Ea&&(ot=vo()):(_s=Te,Li="value"in _s?_s.value:_s.textContent,Ea=!0)),at=tl(we,it),0<at.length&&(it=new yc(it,a,null,d,Te),Me.push({event:it,listeners:at}),ot?it.data=ot:(ot=bc(d),ot!==null&&(it.data=ot)))),(ot=Wi?gd(a,d):ip(a,d))&&(we=tl(we,"onBeforeInput"),0<we.length&&(Te=new yc("onBeforeInput","beforeinput",null,d,Te),Me.push({event:Te,listeners:we}),Te.data=ot))}bd(Me,i)})}function $a(a,i,d){return{instance:a,listener:i,currentTarget:d}}function tl(a,i){for(var d=i+"Capture",g=[];a!==null;){var x=a,N=x.stateNode;x.tag===5&&N!==null&&(x=N,N=$t(a,d),N!=null&&g.unshift($a(a,N,x)),N=$t(a,i),N!=null&&g.push($a(a,N,x))),a=a.return}return g}function Oa(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5);return a||null}function $o(a,i,d,g,x){for(var N=i._reactName,O=[];d!==null&&d!==g;){var J=d,oe=J.alternate,we=J.stateNode;if(oe!==null&&oe===g)break;J.tag===5&&we!==null&&(J=we,x?(oe=$t(d,N),oe!=null&&O.unshift($a(d,oe,J))):x||(oe=$t(d,N),oe!=null&&O.push($a(d,oe,J)))),d=d.return}O.length!==0&&a.push({event:i,listeners:O})}var kd=/\r\n?/g,Nd=/\u0000|\uFFFD/g;function Ac(a){return(typeof a=="string"?a:""+a).replace(kd,`
|
|
38
|
-
`).replace(Nd,"")}function Oo(a,i,d){if(i=Ac(i),Ac(a)!==i&&d)throw Error(n(425))}function nl(){}var Mc=null,Qr=null;function Lo(a,i){return a==="textarea"||a==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Ic=typeof setTimeout=="function"?setTimeout:void 0,up=typeof clearTimeout=="function"?clearTimeout:void 0,Sd=typeof Promise=="function"?Promise:void 0,Cn=typeof queueMicrotask=="function"?queueMicrotask:typeof Sd<"u"?function(a){return Sd.resolve(null).then(a).catch(jd)}:Ic;function jd(a){setTimeout(function(){throw a})}function Po(a,i){var d=i,g=0;do{var x=d.nextSibling;if(a.removeChild(d),x&&x.nodeType===8)if(d=x.data,d==="/$"){if(g===0){a.removeChild(x),va(i);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=x}while(d);va(i)}function Cs(a){for(;a!=null;a=a.nextSibling){var i=a.nodeType;if(i===1||i===3)break;if(i===8){if(i=a.data,i==="$"||i==="$!"||i==="$?")break;if(i==="/$")return null}}return a}function rl(a){a=a.previousSibling;for(var i=0;a;){if(a.nodeType===8){var d=a.data;if(d==="$"||d==="$!"||d==="$?"){if(i===0)return a;i--}else d==="/$"&&i++}a=a.previousSibling}return null}var Jr=Math.random().toString(36).slice(2),Bn="__reactFiber$"+Jr,Do="__reactProps$"+Jr,gn="__reactContainer$"+Jr,sl="__reactEvents$"+Jr,dp="__reactListeners$"+Jr,_d="__reactHandles$"+Jr;function Ts(a){var i=a[Bn];if(i)return i;for(var d=a.parentNode;d;){if(i=d[gn]||d[Bn]){if(d=i.alternate,i.child!==null||d!==null&&d.child!==null)for(a=rl(a);a!==null;){if(d=a[Bn])return d;a=rl(a)}return i}a=d,d=a.parentNode}return null}function Fo(a){return a=a[Bn]||a[gn],!a||a.tag!==5&&a.tag!==6&&a.tag!==13&&a.tag!==3?null:a}function es(a){if(a.tag===5||a.tag===6)return a.stateNode;throw Error(n(33))}function al(a){return a[Do]||null}var qo=[],ea=-1;function Er(a){return{current:a}}function Tt(a){0>ea||(a.current=qo[ea],qo[ea]=null,ea--)}function Rt(a,i){ea++,qo[ea]=a.current,a.current=i}var Zn={},an=Er(Zn),kn=Er(!1),ts=Zn;function ns(a,i){var d=a.type.contextTypes;if(!d)return Zn;var g=a.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===i)return g.__reactInternalMemoizedMaskedChildContext;var x={},N;for(N in d)x[N]=i[N];return g&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=i,a.__reactInternalMemoizedMaskedChildContext=x),x}function yn(a){return a=a.childContextTypes,a!=null}function Bo(){Tt(kn),Tt(an)}function Rs(a,i,d){if(an.current!==Zn)throw Error(n(168));Rt(an,i),Rt(kn,d)}function zn(a,i,d){var g=a.stateNode;if(i=i.childContextTypes,typeof g.getChildContext!="function")return d;g=g.getChildContext();for(var x in g)if(!(x in i))throw Error(n(108,ae(a)||"Unknown",x));return H({},d,g)}function ol(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Zn,ts=an.current,Rt(an,a),Rt(kn,kn.current),!0}function Ed(a,i,d){var g=a.stateNode;if(!g)throw Error(n(169));d?(a=zn(a,i,ts),g.__reactInternalMemoizedMergedChildContext=a,Tt(kn),Tt(an),Rt(an,a)):Tt(kn),Rt(kn,d)}var rs=null,il=!1,As=!1;function $c(a){rs===null?rs=[a]:rs.push(a)}function ll(a){il=!0,$c(a)}function Cr(){if(!As&&rs!==null){As=!0;var a=0,i=ht;try{var d=rs;for(ht=1;a<d.length;a++){var g=d[a];do g=g(!0);while(g!==null)}rs=null,il=!1}catch(x){throw rs!==null&&(rs=rs.slice(a+1)),tt(St,Cr),x}finally{ht=i,As=!1}}return null}var Qn=[],La=0,zo=null,Uo=0,_t=[],Tn=0,Ms=null,Tr=1,ss="";function ta(a,i){Qn[La++]=Uo,Qn[La++]=zo,zo=a,Uo=i}function Oc(a,i,d){_t[Tn++]=Tr,_t[Tn++]=ss,_t[Tn++]=Ms,Ms=a;var g=Tr;a=ss;var x=32-Gn(g)-1;g&=~(1<<x),d+=1;var N=32-Gn(i)+x;if(30<N){var O=x-x%5;N=(g&(1<<O)-1).toString(32),g>>=O,x-=O,Tr=1<<32-Gn(i)+x|d<<x|g,ss=N+a}else Tr=1<<N|d<<x|g,ss=a}function Lc(a){a.return!==null&&(ta(a,1),Oc(a,1,0))}function cl(a){for(;a===zo;)zo=Qn[--La],Qn[La]=null,Uo=Qn[--La],Qn[La]=null;for(;a===Ms;)Ms=_t[--Tn],_t[Tn]=null,ss=_t[--Tn],_t[Tn]=null,Tr=_t[--Tn],_t[Tn]=null}var Rn=null,wn=null,Ot=!1,on=null;function ul(a,i){var d=Ir(5,null,null,0);d.elementType="DELETED",d.stateNode=i,d.return=a,i=a.deletions,i===null?(a.deletions=[d],a.flags|=16):i.push(d)}function Ho(a,i){switch(a.tag){case 5:var d=a.type;return i=i.nodeType!==1||d.toLowerCase()!==i.nodeName.toLowerCase()?null:i,i!==null?(a.stateNode=i,Rn=a,wn=Cs(i.firstChild),!0):!1;case 6:return i=a.pendingProps===""||i.nodeType!==3?null:i,i!==null?(a.stateNode=i,Rn=a,wn=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(d=Ms!==null?{id:Tr,overflow:ss}:null,a.memoizedState={dehydrated:i,treeContext:d,retryLane:1073741824},d=Ir(18,null,null,0),d.stateNode=i,d.return=a,a.child=d,Rn=a,wn=null,!0):!1;default:return!1}}function Wo(a){return(a.mode&1)!==0&&(a.flags&128)===0}function Pc(a){if(Ot){var i=wn;if(i){var d=i;if(!Ho(a,i)){if(Wo(a))throw Error(n(418));i=Cs(d.nextSibling);var g=Rn;i&&Ho(a,i)?ul(g,d):(a.flags=a.flags&-4097|2,Ot=!1,Rn=a)}}else{if(Wo(a))throw Error(n(418));a.flags=a.flags&-4097|2,Ot=!1,Rn=a}}}function Dc(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;Rn=a}function Vo(a){if(a!==Rn)return!1;if(!Ot)return Dc(a),Ot=!0,!1;var i;if((i=a.tag!==3)&&!(i=a.tag!==5)&&(i=a.type,i=i!=="head"&&i!=="body"&&!Lo(a.type,a.memoizedProps)),i&&(i=wn)){if(Wo(a))throw Cd(),Error(n(418));for(;i;)ul(a,i),i=Cs(i.nextSibling)}if(Dc(a),a.tag===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));e:{for(a=a.nextSibling,i=0;a;){if(a.nodeType===8){var d=a.data;if(d==="/$"){if(i===0){wn=Cs(a.nextSibling);break e}i--}else d!=="$"&&d!=="$!"&&d!=="$?"||i++}a=a.nextSibling}wn=null}}else wn=Rn?Cs(a.stateNode.nextSibling):null;return!0}function Cd(){for(var a=wn;a;)a=Cs(a.nextSibling)}function Pa(){wn=Rn=null,Ot=!1}function dl(a){on===null?on=[a]:on.push(a)}var Go=C.ReactCurrentBatchConfig;function na(a,i,d){if(a=d.ref,a!==null&&typeof a!="function"&&typeof a!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var g=d.stateNode}if(!g)throw Error(n(147,a));var x=g,N=""+a;return i!==null&&i.ref!==null&&typeof i.ref=="function"&&i.ref._stringRef===N?i.ref:(i=function(O){var J=x.refs;O===null?delete J[N]:J[N]=O},i._stringRef=N,i)}if(typeof a!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,a))}return a}function hl(a,i){throw a=Object.prototype.toString.call(i),Error(n(31,a==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":a))}function Fc(a){var i=a._init;return i(a._payload)}function qc(a){function i(he,ie){if(a){var me=he.deletions;me===null?(he.deletions=[ie],he.flags|=16):me.push(ie)}}function d(he,ie){if(!a)return null;for(;ie!==null;)i(he,ie),ie=ie.sibling;return null}function g(he,ie){for(he=new Map;ie!==null;)ie.key!==null?he.set(ie.key,ie):he.set(ie.index,ie),ie=ie.sibling;return he}function x(he,ie){return he=Va(he,ie),he.index=0,he.sibling=null,he}function N(he,ie,me){return he.index=me,a?(me=he.alternate,me!==null?(me=me.index,me<ie?(he.flags|=2,ie):me):(he.flags|=2,ie)):(he.flags|=1048576,ie)}function O(he){return a&&he.alternate===null&&(he.flags|=2),he}function J(he,ie,me,$e){return ie===null||ie.tag!==6?(ie=Xp(me,he.mode,$e),ie.return=he,ie):(ie=x(ie,me),ie.return=he,ie)}function oe(he,ie,me,$e){var Qe=me.type;return Qe===$?Te(he,ie,me.props.children,$e,me.key):ie!==null&&(ie.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===V&&Fc(Qe)===ie.type)?($e=x(ie,me.props),$e.ref=na(he,ie,me),$e.return=he,$e):($e=Yd(me.type,me.key,me.props,null,he.mode,$e),$e.ref=na(he,ie,me),$e.return=he,$e)}function we(he,ie,me,$e){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==me.containerInfo||ie.stateNode.implementation!==me.implementation?(ie=Zp(me,he.mode,$e),ie.return=he,ie):(ie=x(ie,me.children||[]),ie.return=he,ie)}function Te(he,ie,me,$e,Qe){return ie===null||ie.tag!==7?(ie=ri(me,he.mode,$e,Qe),ie.return=he,ie):(ie=x(ie,me),ie.return=he,ie)}function Me(he,ie,me){if(typeof ie=="string"&&ie!==""||typeof ie=="number")return ie=Xp(""+ie,he.mode,me),ie.return=he,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case R:return me=Yd(ie.type,ie.key,ie.props,null,he.mode,me),me.ref=na(he,null,ie),me.return=he,me;case I:return ie=Zp(ie,he.mode,me),ie.return=he,ie;case V:var $e=ie._init;return Me(he,$e(ie._payload),me)}if(be(ie)||L(ie))return ie=ri(ie,he.mode,me,null),ie.return=he,ie;hl(he,ie)}return null}function Ee(he,ie,me,$e){var Qe=ie!==null?ie.key:null;if(typeof me=="string"&&me!==""||typeof me=="number")return Qe!==null?null:J(he,ie,""+me,$e);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case R:return me.key===Qe?oe(he,ie,me,$e):null;case I:return me.key===Qe?we(he,ie,me,$e):null;case V:return Qe=me._init,Ee(he,ie,Qe(me._payload),$e)}if(be(me)||L(me))return Qe!==null?null:Te(he,ie,me,$e,null);hl(he,me)}return null}function We(he,ie,me,$e,Qe){if(typeof $e=="string"&&$e!==""||typeof $e=="number")return he=he.get(me)||null,J(ie,he,""+$e,Qe);if(typeof $e=="object"&&$e!==null){switch($e.$$typeof){case R:return he=he.get($e.key===null?me:$e.key)||null,oe(ie,he,$e,Qe);case I:return he=he.get($e.key===null?me:$e.key)||null,we(ie,he,$e,Qe);case V:var at=$e._init;return We(he,ie,me,at($e._payload),Qe)}if(be($e)||L($e))return he=he.get(me)||null,Te(ie,he,$e,Qe,null);hl(ie,$e)}return null}function Xe(he,ie,me,$e){for(var Qe=null,at=null,ot=ie,it=ie=0,bn=null;ot!==null&&it<me.length;it++){ot.index>it?(bn=ot,ot=null):bn=ot.sibling;var jt=Ee(he,ot,me[it],$e);if(jt===null){ot===null&&(ot=bn);break}a&&ot&&jt.alternate===null&&i(he,ot),ie=N(jt,ie,it),at===null?Qe=jt:at.sibling=jt,at=jt,ot=bn}if(it===me.length)return d(he,ot),Ot&&ta(he,it),Qe;if(ot===null){for(;it<me.length;it++)ot=Me(he,me[it],$e),ot!==null&&(ie=N(ot,ie,it),at===null?Qe=ot:at.sibling=ot,at=ot);return Ot&&ta(he,it),Qe}for(ot=g(he,ot);it<me.length;it++)bn=We(ot,he,it,me[it],$e),bn!==null&&(a&&bn.alternate!==null&&ot.delete(bn.key===null?it:bn.key),ie=N(bn,ie,it),at===null?Qe=bn:at.sibling=bn,at=bn);return a&&ot.forEach(function(Ga){return i(he,Ga)}),Ot&&ta(he,it),Qe}function Ze(he,ie,me,$e){var Qe=L(me);if(typeof Qe!="function")throw Error(n(150));if(me=Qe.call(me),me==null)throw Error(n(151));for(var at=Qe=null,ot=ie,it=ie=0,bn=null,jt=me.next();ot!==null&&!jt.done;it++,jt=me.next()){ot.index>it?(bn=ot,ot=null):bn=ot.sibling;var Ga=Ee(he,ot,jt.value,$e);if(Ga===null){ot===null&&(ot=bn);break}a&&ot&&Ga.alternate===null&&i(he,ot),ie=N(Ga,ie,it),at===null?Qe=Ga:at.sibling=Ga,at=Ga,ot=bn}if(jt.done)return d(he,ot),Ot&&ta(he,it),Qe;if(ot===null){for(;!jt.done;it++,jt=me.next())jt=Me(he,jt.value,$e),jt!==null&&(ie=N(jt,ie,it),at===null?Qe=jt:at.sibling=jt,at=jt);return Ot&&ta(he,it),Qe}for(ot=g(he,ot);!jt.done;it++,jt=me.next())jt=We(ot,he,it,jt.value,$e),jt!==null&&(a&&jt.alternate!==null&&ot.delete(jt.key===null?it:jt.key),ie=N(jt,ie,it),at===null?Qe=jt:at.sibling=jt,at=jt);return a&&ot.forEach(function(NO){return i(he,NO)}),Ot&&ta(he,it),Qe}function Yt(he,ie,me,$e){if(typeof me=="object"&&me!==null&&me.type===$&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case R:e:{for(var Qe=me.key,at=ie;at!==null;){if(at.key===Qe){if(Qe=me.type,Qe===$){if(at.tag===7){d(he,at.sibling),ie=x(at,me.props.children),ie.return=he,he=ie;break e}}else if(at.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===V&&Fc(Qe)===at.type){d(he,at.sibling),ie=x(at,me.props),ie.ref=na(he,at,me),ie.return=he,he=ie;break e}d(he,at);break}else i(he,at);at=at.sibling}me.type===$?(ie=ri(me.props.children,he.mode,$e,me.key),ie.return=he,he=ie):($e=Yd(me.type,me.key,me.props,null,he.mode,$e),$e.ref=na(he,ie,me),$e.return=he,he=$e)}return O(he);case I:e:{for(at=me.key;ie!==null;){if(ie.key===at)if(ie.tag===4&&ie.stateNode.containerInfo===me.containerInfo&&ie.stateNode.implementation===me.implementation){d(he,ie.sibling),ie=x(ie,me.children||[]),ie.return=he,he=ie;break e}else{d(he,ie);break}else i(he,ie);ie=ie.sibling}ie=Zp(me,he.mode,$e),ie.return=he,he=ie}return O(he);case V:return at=me._init,Yt(he,ie,at(me._payload),$e)}if(be(me))return Xe(he,ie,me,$e);if(L(me))return Ze(he,ie,me,$e);hl(he,me)}return typeof me=="string"&&me!==""||typeof me=="number"?(me=""+me,ie!==null&&ie.tag===6?(d(he,ie.sibling),ie=x(ie,me),ie.return=he,he=ie):(d(he,ie),ie=Xp(me,he.mode,$e),ie.return=he,he=ie),O(he)):d(he,ie)}return Yt}var ra=qc(!0),Bc=qc(!1),Ko=Er(null),T=null,A=null,Y=null;function te(){Y=A=T=null}function ye(a){var i=Ko.current;Tt(Ko),a._currentValue=i}function je(a,i,d){for(;a!==null;){var g=a.alternate;if((a.childLanes&i)!==i?(a.childLanes|=i,g!==null&&(g.childLanes|=i)):g!==null&&(g.childLanes&i)!==i&&(g.childLanes|=i),a===d)break;a=a.return}}function Oe(a,i){T=a,Y=A=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&i)!==0&&(Jn=!0),a.firstContext=null)}function Be(a){var i=a._currentValue;if(Y!==a)if(a={context:a,memoizedValue:i,next:null},A===null){if(T===null)throw Error(n(308));A=a,T.dependencies={lanes:0,firstContext:a}}else A=A.next=a;return i}var lt=null;function et(a){lt===null?lt=[a]:lt.push(a)}function xt(a,i,d,g){var x=i.interleaved;return x===null?(d.next=d,et(i)):(d.next=x.next,x.next=d),i.interleaved=d,ft(a,g)}function ft(a,i){a.lanes|=i;var d=a.alternate;for(d!==null&&(d.lanes|=i),d=a,a=a.return;a!==null;)a.childLanes|=i,d=a.alternate,d!==null&&(d.childLanes|=i),d=a,a=a.return;return d.tag===3?d.stateNode:null}var An=!1;function sa(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Yo(a,i){a=a.updateQueue,i.updateQueue===a&&(i.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function as(a,i){return{eventTime:a,lane:i,tag:0,payload:null,callback:null,next:null}}function os(a,i,d){var g=a.updateQueue;if(g===null)return null;if(g=g.shared,(Nt&2)!==0){var x=g.pending;return x===null?i.next=i:(i.next=x.next,x.next=i),g.pending=i,ft(a,d)}return x=g.interleaved,x===null?(i.next=i,et(g)):(i.next=x.next,x.next=i),g.interleaved=i,ft(a,d)}function Da(a,i,d){if(i=i.updateQueue,i!==null&&(i=i.shared,(d&4194240)!==0)){var g=i.lanes;g&=a.pendingLanes,d|=g,i.lanes=d,uc(a,d)}}function Td(a,i){var d=a.updateQueue,g=a.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var x=null,N=null;if(d=d.firstBaseUpdate,d!==null){do{var O={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};N===null?x=N=O:N=N.next=O,d=d.next}while(d!==null);N===null?x=N=i:N=N.next=i}else x=N=i;d={baseState:g.baseState,firstBaseUpdate:x,lastBaseUpdate:N,shared:g.shared,effects:g.effects},a.updateQueue=d;return}a=d.lastBaseUpdate,a===null?d.firstBaseUpdate=i:a.next=i,d.lastBaseUpdate=i}function Xo(a,i,d,g){var x=a.updateQueue;An=!1;var N=x.firstBaseUpdate,O=x.lastBaseUpdate,J=x.shared.pending;if(J!==null){x.shared.pending=null;var oe=J,we=oe.next;oe.next=null,O===null?N=we:O.next=we,O=oe;var Te=a.alternate;Te!==null&&(Te=Te.updateQueue,J=Te.lastBaseUpdate,J!==O&&(J===null?Te.firstBaseUpdate=we:J.next=we,Te.lastBaseUpdate=oe))}if(N!==null){var Me=x.baseState;O=0,Te=we=oe=null,J=N;do{var Ee=J.lane,We=J.eventTime;if((g&Ee)===Ee){Te!==null&&(Te=Te.next={eventTime:We,lane:0,tag:J.tag,payload:J.payload,callback:J.callback,next:null});e:{var Xe=a,Ze=J;switch(Ee=i,We=d,Ze.tag){case 1:if(Xe=Ze.payload,typeof Xe=="function"){Me=Xe.call(We,Me,Ee);break e}Me=Xe;break e;case 3:Xe.flags=Xe.flags&-65537|128;case 0:if(Xe=Ze.payload,Ee=typeof Xe=="function"?Xe.call(We,Me,Ee):Xe,Ee==null)break e;Me=H({},Me,Ee);break e;case 2:An=!0}}J.callback!==null&&J.lane!==0&&(a.flags|=64,Ee=x.effects,Ee===null?x.effects=[J]:Ee.push(J))}else We={eventTime:We,lane:Ee,tag:J.tag,payload:J.payload,callback:J.callback,next:null},Te===null?(we=Te=We,oe=Me):Te=Te.next=We,O|=Ee;if(J=J.next,J===null){if(J=x.shared.pending,J===null)break;Ee=J,J=Ee.next,Ee.next=null,x.lastBaseUpdate=Ee,x.shared.pending=null}}while(!0);if(Te===null&&(oe=Me),x.baseState=oe,x.firstBaseUpdate=we,x.lastBaseUpdate=Te,i=x.shared.interleaved,i!==null){x=i;do O|=x.lane,x=x.next;while(x!==i)}else N===null&&(x.shared.lanes=0);Jo|=O,a.lanes=O,a.memoizedState=Me}}function Fa(a,i,d){if(a=i.effects,i.effects=null,a!==null)for(i=0;i<a.length;i++){var g=a[i],x=g.callback;if(x!==null){if(g.callback=null,g=d,typeof x!="function")throw Error(n(191,x));x.call(g)}}}var is={},Rr=Er(is),Lt=Er(is),qa=Er(is);function Zo(a){if(a===is)throw Error(n(174));return a}function hp(a,i){switch(Rt(qa,i),Rt(Lt,a),Rt(Rr,is),a=i.nodeType,a){case 9:case 11:i=(i=i.documentElement)?i.namespaceURI:Ye(null,"");break;default:a=a===8?i.parentNode:i,i=a.namespaceURI||null,a=a.tagName,i=Ye(i,a)}Tt(Rr),Rt(Rr,i)}function fl(){Tt(Rr),Tt(Lt),Tt(qa)}function wk(a){Zo(qa.current);var i=Zo(Rr.current),d=Ye(i,a.type);i!==d&&(Rt(Lt,a),Rt(Rr,d))}function fp(a){Lt.current===a&&(Tt(Rr),Tt(Lt))}var qt=Er(0);function Rd(a){for(var i=a;i!==null;){if(i.tag===13){var d=i.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!==void 0){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break;for(;i.sibling===null;){if(i.return===null||i.return===a)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var pp=[];function mp(){for(var a=0;a<pp.length;a++)pp[a]._workInProgressVersionPrimary=null;pp.length=0}var Ad=C.ReactCurrentDispatcher,gp=C.ReactCurrentBatchConfig,Qo=0,Bt=null,ln=null,vn=null,Md=!1,zc=!1,Uc=0,W$=0;function Mn(){throw Error(n(321))}function yp(a,i){if(i===null)return!1;for(var d=0;d<i.length&&d<a.length;d++)if(!Xn(a[d],i[d]))return!1;return!0}function wp(a,i,d,g,x,N){if(Qo=N,Bt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,Ad.current=a===null||a.memoizedState===null?Y$:X$,a=d(g,x),zc){N=0;do{if(zc=!1,Uc=0,25<=N)throw Error(n(301));N+=1,vn=ln=null,i.updateQueue=null,Ad.current=Z$,a=d(g,x)}while(zc)}if(Ad.current=Od,i=ln!==null&&ln.next!==null,Qo=0,vn=ln=Bt=null,Md=!1,i)throw Error(n(300));return a}function vp(){var a=Uc!==0;return Uc=0,a}function Is(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vn===null?Bt.memoizedState=vn=a:vn=vn.next=a,vn}function Ar(){if(ln===null){var a=Bt.alternate;a=a!==null?a.memoizedState:null}else a=ln.next;var i=vn===null?Bt.memoizedState:vn.next;if(i!==null)vn=i,ln=a;else{if(a===null)throw Error(n(310));ln=a,a={memoizedState:ln.memoizedState,baseState:ln.baseState,baseQueue:ln.baseQueue,queue:ln.queue,next:null},vn===null?Bt.memoizedState=vn=a:vn=vn.next=a}return vn}function Hc(a,i){return typeof i=="function"?i(a):i}function xp(a){var i=Ar(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=a;var g=ln,x=g.baseQueue,N=d.pending;if(N!==null){if(x!==null){var O=x.next;x.next=N.next,N.next=O}g.baseQueue=x=N,d.pending=null}if(x!==null){N=x.next,g=g.baseState;var J=O=null,oe=null,we=N;do{var Te=we.lane;if((Qo&Te)===Te)oe!==null&&(oe=oe.next={lane:0,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null}),g=we.hasEagerState?we.eagerState:a(g,we.action);else{var Me={lane:Te,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};oe===null?(J=oe=Me,O=g):oe=oe.next=Me,Bt.lanes|=Te,Jo|=Te}we=we.next}while(we!==null&&we!==N);oe===null?O=g:oe.next=J,Xn(g,i.memoizedState)||(Jn=!0),i.memoizedState=g,i.baseState=O,i.baseQueue=oe,d.lastRenderedState=g}if(a=d.interleaved,a!==null){x=a;do N=x.lane,Bt.lanes|=N,Jo|=N,x=x.next;while(x!==a)}else x===null&&(d.lanes=0);return[i.memoizedState,d.dispatch]}function bp(a){var i=Ar(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=a;var g=d.dispatch,x=d.pending,N=i.memoizedState;if(x!==null){d.pending=null;var O=x=x.next;do N=a(N,O.action),O=O.next;while(O!==x);Xn(N,i.memoizedState)||(Jn=!0),i.memoizedState=N,i.baseQueue===null&&(i.baseState=N),d.lastRenderedState=N}return[N,g]}function vk(){}function xk(a,i){var d=Bt,g=Ar(),x=i(),N=!Xn(g.memoizedState,x);if(N&&(g.memoizedState=x,Jn=!0),g=g.queue,kp(Nk.bind(null,d,g,a),[a]),g.getSnapshot!==i||N||vn!==null&&vn.memoizedState.tag&1){if(d.flags|=2048,Wc(9,kk.bind(null,d,g,x,i),void 0,null),xn===null)throw Error(n(349));(Qo&30)!==0||bk(d,i,x)}return x}function bk(a,i,d){a.flags|=16384,a={getSnapshot:i,value:d},i=Bt.updateQueue,i===null?(i={lastEffect:null,stores:null},Bt.updateQueue=i,i.stores=[a]):(d=i.stores,d===null?i.stores=[a]:d.push(a))}function kk(a,i,d,g){i.value=d,i.getSnapshot=g,Sk(i)&&jk(a)}function Nk(a,i,d){return d(function(){Sk(i)&&jk(a)})}function Sk(a){var i=a.getSnapshot;a=a.value;try{var d=i();return!Xn(a,d)}catch{return!0}}function jk(a){var i=ft(a,1);i!==null&&ds(i,a,1,-1)}function _k(a){var i=Is();return typeof a=="function"&&(a=a()),i.memoizedState=i.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Hc,lastRenderedState:a},i.queue=a,a=a.dispatch=K$.bind(null,Bt,a),[i.memoizedState,a]}function Wc(a,i,d,g){return a={tag:a,create:i,destroy:d,deps:g,next:null},i=Bt.updateQueue,i===null?(i={lastEffect:null,stores:null},Bt.updateQueue=i,i.lastEffect=a.next=a):(d=i.lastEffect,d===null?i.lastEffect=a.next=a:(g=d.next,d.next=a,a.next=g,i.lastEffect=a)),a}function Ek(){return Ar().memoizedState}function Id(a,i,d,g){var x=Is();Bt.flags|=a,x.memoizedState=Wc(1|i,d,void 0,g===void 0?null:g)}function $d(a,i,d,g){var x=Ar();g=g===void 0?null:g;var N=void 0;if(ln!==null){var O=ln.memoizedState;if(N=O.destroy,g!==null&&yp(g,O.deps)){x.memoizedState=Wc(i,d,N,g);return}}Bt.flags|=a,x.memoizedState=Wc(1|i,d,N,g)}function Ck(a,i){return Id(8390656,8,a,i)}function kp(a,i){return $d(2048,8,a,i)}function Tk(a,i){return $d(4,2,a,i)}function Rk(a,i){return $d(4,4,a,i)}function Ak(a,i){if(typeof i=="function")return a=a(),i(a),function(){i(null)};if(i!=null)return a=a(),i.current=a,function(){i.current=null}}function Mk(a,i,d){return d=d!=null?d.concat([a]):null,$d(4,4,Ak.bind(null,i,a),d)}function Np(){}function Ik(a,i){var d=Ar();i=i===void 0?null:i;var g=d.memoizedState;return g!==null&&i!==null&&yp(i,g[1])?g[0]:(d.memoizedState=[a,i],a)}function $k(a,i){var d=Ar();i=i===void 0?null:i;var g=d.memoizedState;return g!==null&&i!==null&&yp(i,g[1])?g[0]:(a=a(),d.memoizedState=[a,i],a)}function Ok(a,i,d){return(Qo&21)===0?(a.baseState&&(a.baseState=!1,Jn=!0),a.memoizedState=d):(Xn(d,i)||(d=ya(),Bt.lanes|=d,Jo|=d,a.baseState=!0),i)}function V$(a,i){var d=ht;ht=d!==0&&4>d?d:4,a(!0);var g=gp.transition;gp.transition={};try{a(!1),i()}finally{ht=d,gp.transition=g}}function Lk(){return Ar().memoizedState}function G$(a,i,d){var g=Ha(a);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},Pk(a))Dk(i,d);else if(d=xt(a,i,d,g),d!==null){var x=Hn();ds(d,a,g,x),Fk(d,i,g)}}function K$(a,i,d){var g=Ha(a),x={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(Pk(a))Dk(i,x);else{var N=a.alternate;if(a.lanes===0&&(N===null||N.lanes===0)&&(N=i.lastRenderedReducer,N!==null))try{var O=i.lastRenderedState,J=N(O,d);if(x.hasEagerState=!0,x.eagerState=J,Xn(J,O)){var oe=i.interleaved;oe===null?(x.next=x,et(i)):(x.next=oe.next,oe.next=x),i.interleaved=x;return}}catch{}finally{}d=xt(a,i,x,g),d!==null&&(x=Hn(),ds(d,a,g,x),Fk(d,i,g))}}function Pk(a){var i=a.alternate;return a===Bt||i!==null&&i===Bt}function Dk(a,i){zc=Md=!0;var d=a.pending;d===null?i.next=i:(i.next=d.next,d.next=i),a.pending=i}function Fk(a,i,d){if((d&4194240)!==0){var g=i.lanes;g&=a.pendingLanes,d|=g,i.lanes=d,uc(a,d)}}var Od={readContext:Be,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useInsertionEffect:Mn,useLayoutEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useMutableSource:Mn,useSyncExternalStore:Mn,useId:Mn,unstable_isNewReconciler:!1},Y$={readContext:Be,useCallback:function(a,i){return Is().memoizedState=[a,i===void 0?null:i],a},useContext:Be,useEffect:Ck,useImperativeHandle:function(a,i,d){return d=d!=null?d.concat([a]):null,Id(4194308,4,Ak.bind(null,i,a),d)},useLayoutEffect:function(a,i){return Id(4194308,4,a,i)},useInsertionEffect:function(a,i){return Id(4,2,a,i)},useMemo:function(a,i){var d=Is();return i=i===void 0?null:i,a=a(),d.memoizedState=[a,i],a},useReducer:function(a,i,d){var g=Is();return i=d!==void 0?d(i):i,g.memoizedState=g.baseState=i,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:i},g.queue=a,a=a.dispatch=G$.bind(null,Bt,a),[g.memoizedState,a]},useRef:function(a){var i=Is();return a={current:a},i.memoizedState=a},useState:_k,useDebugValue:Np,useDeferredValue:function(a){return Is().memoizedState=a},useTransition:function(){var a=_k(!1),i=a[0];return a=V$.bind(null,a[1]),Is().memoizedState=a,[i,a]},useMutableSource:function(){},useSyncExternalStore:function(a,i,d){var g=Bt,x=Is();if(Ot){if(d===void 0)throw Error(n(407));d=d()}else{if(d=i(),xn===null)throw Error(n(349));(Qo&30)!==0||bk(g,i,d)}x.memoizedState=d;var N={value:d,getSnapshot:i};return x.queue=N,Ck(Nk.bind(null,g,N,a),[a]),g.flags|=2048,Wc(9,kk.bind(null,g,N,d,i),void 0,null),d},useId:function(){var a=Is(),i=xn.identifierPrefix;if(Ot){var d=ss,g=Tr;d=(g&~(1<<32-Gn(g)-1)).toString(32)+d,i=":"+i+"R"+d,d=Uc++,0<d&&(i+="H"+d.toString(32)),i+=":"}else d=W$++,i=":"+i+"r"+d.toString(32)+":";return a.memoizedState=i},unstable_isNewReconciler:!1},X$={readContext:Be,useCallback:Ik,useContext:Be,useEffect:kp,useImperativeHandle:Mk,useInsertionEffect:Tk,useLayoutEffect:Rk,useMemo:$k,useReducer:xp,useRef:Ek,useState:function(){return xp(Hc)},useDebugValue:Np,useDeferredValue:function(a){var i=Ar();return Ok(i,ln.memoizedState,a)},useTransition:function(){var a=xp(Hc)[0],i=Ar().memoizedState;return[a,i]},useMutableSource:vk,useSyncExternalStore:xk,useId:Lk,unstable_isNewReconciler:!1},Z$={readContext:Be,useCallback:Ik,useContext:Be,useEffect:kp,useImperativeHandle:Mk,useInsertionEffect:Tk,useLayoutEffect:Rk,useMemo:$k,useReducer:bp,useRef:Ek,useState:function(){return bp(Hc)},useDebugValue:Np,useDeferredValue:function(a){var i=Ar();return ln===null?i.memoizedState=a:Ok(i,ln.memoizedState,a)},useTransition:function(){var a=bp(Hc)[0],i=Ar().memoizedState;return[a,i]},useMutableSource:vk,useSyncExternalStore:xk,useId:Lk,unstable_isNewReconciler:!1};function ls(a,i){if(a&&a.defaultProps){i=H({},i),a=a.defaultProps;for(var d in a)i[d]===void 0&&(i[d]=a[d]);return i}return i}function Sp(a,i,d,g){i=a.memoizedState,d=d(g,i),d=d==null?i:H({},i,d),a.memoizedState=d,a.lanes===0&&(a.updateQueue.baseState=d)}var Ld={isMounted:function(a){return(a=a._reactInternals)?Pn(a)===a:!1},enqueueSetState:function(a,i,d){a=a._reactInternals;var g=Hn(),x=Ha(a),N=as(g,x);N.payload=i,d!=null&&(N.callback=d),i=os(a,N,x),i!==null&&(ds(i,a,x,g),Da(i,a,x))},enqueueReplaceState:function(a,i,d){a=a._reactInternals;var g=Hn(),x=Ha(a),N=as(g,x);N.tag=1,N.payload=i,d!=null&&(N.callback=d),i=os(a,N,x),i!==null&&(ds(i,a,x,g),Da(i,a,x))},enqueueForceUpdate:function(a,i){a=a._reactInternals;var d=Hn(),g=Ha(a),x=as(d,g);x.tag=2,i!=null&&(x.callback=i),i=os(a,x,g),i!==null&&(ds(i,a,g,d),Da(i,a,g))}};function qk(a,i,d,g,x,N,O){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(g,N,O):i.prototype&&i.prototype.isPureReactComponent?!Es(d,g)||!Es(x,N):!0}function Bk(a,i,d){var g=!1,x=Zn,N=i.contextType;return typeof N=="object"&&N!==null?N=Be(N):(x=yn(i)?ts:an.current,g=i.contextTypes,N=(g=g!=null)?ns(a,x):Zn),i=new i(d,N),a.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Ld,a.stateNode=i,i._reactInternals=a,g&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=x,a.__reactInternalMemoizedMaskedChildContext=N),i}function zk(a,i,d,g){a=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(d,g),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(d,g),i.state!==a&&Ld.enqueueReplaceState(i,i.state,null)}function jp(a,i,d,g){var x=a.stateNode;x.props=d,x.state=a.memoizedState,x.refs={},sa(a);var N=i.contextType;typeof N=="object"&&N!==null?x.context=Be(N):(N=yn(i)?ts:an.current,x.context=ns(a,N)),x.state=a.memoizedState,N=i.getDerivedStateFromProps,typeof N=="function"&&(Sp(a,i,N,d),x.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(i=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),i!==x.state&&Ld.enqueueReplaceState(x,x.state,null),Xo(a,d,x,g),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308)}function pl(a,i){try{var d="",g=i;do d+=Z(g),g=g.return;while(g);var x=d}catch(N){x=`
|
|
39
|
-
Error generating stack: `+N.message+`
|
|
40
|
-
`+N.stack}return{value:a,source:i,stack:x,digest:null}}function _p(a,i,d){return{value:a,source:null,stack:d??null,digest:i??null}}function Ep(a,i){try{console.error(i.value)}catch(d){setTimeout(function(){throw d})}}var Q$=typeof WeakMap=="function"?WeakMap:Map;function Uk(a,i,d){d=as(-1,d),d.tag=3,d.payload={element:null};var g=i.value;return d.callback=function(){Ud||(Ud=!0,zp=g),Ep(a,i)},d}function Hk(a,i,d){d=as(-1,d),d.tag=3;var g=a.type.getDerivedStateFromError;if(typeof g=="function"){var x=i.value;d.payload=function(){return g(x)},d.callback=function(){Ep(a,i)}}var N=a.stateNode;return N!==null&&typeof N.componentDidCatch=="function"&&(d.callback=function(){Ep(a,i),typeof g!="function"&&(za===null?za=new Set([this]):za.add(this));var O=i.stack;this.componentDidCatch(i.value,{componentStack:O!==null?O:""})}),d}function Wk(a,i,d){var g=a.pingCache;if(g===null){g=a.pingCache=new Q$;var x=new Set;g.set(i,x)}else x=g.get(i),x===void 0&&(x=new Set,g.set(i,x));x.has(d)||(x.add(d),a=hO.bind(null,a,i,d),i.then(a,a))}function Vk(a){do{var i;if((i=a.tag===13)&&(i=a.memoizedState,i=i!==null?i.dehydrated!==null:!0),i)return a;a=a.return}while(a!==null);return null}function Gk(a,i,d,g,x){return(a.mode&1)===0?(a===i?a.flags|=65536:(a.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(i=as(-1,1),i.tag=2,os(d,i,1))),d.lanes|=1),a):(a.flags|=65536,a.lanes=x,a)}var J$=C.ReactCurrentOwner,Jn=!1;function Un(a,i,d,g){i.child=a===null?Bc(i,null,d,g):ra(i,a.child,d,g)}function Kk(a,i,d,g,x){d=d.render;var N=i.ref;return Oe(i,x),g=wp(a,i,d,g,N,x),d=vp(),a!==null&&!Jn?(i.updateQueue=a.updateQueue,i.flags&=-2053,a.lanes&=~x,aa(a,i,x)):(Ot&&d&&Lc(i),i.flags|=1,Un(a,i,g,x),i.child)}function Yk(a,i,d,g,x){if(a===null){var N=d.type;return typeof N=="function"&&!Yp(N)&&N.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(i.tag=15,i.type=N,Xk(a,i,N,g,x)):(a=Yd(d.type,null,g,i,i.mode,x),a.ref=i.ref,a.return=i,i.child=a)}if(N=a.child,(a.lanes&x)===0){var O=N.memoizedProps;if(d=d.compare,d=d!==null?d:Es,d(O,g)&&a.ref===i.ref)return aa(a,i,x)}return i.flags|=1,a=Va(N,g),a.ref=i.ref,a.return=i,i.child=a}function Xk(a,i,d,g,x){if(a!==null){var N=a.memoizedProps;if(Es(N,g)&&a.ref===i.ref)if(Jn=!1,i.pendingProps=g=N,(a.lanes&x)!==0)(a.flags&131072)!==0&&(Jn=!0);else return i.lanes=a.lanes,aa(a,i,x)}return Cp(a,i,d,g,x)}function Zk(a,i,d){var g=i.pendingProps,x=g.children,N=a!==null?a.memoizedState:null;if(g.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},Rt(gl,pr),pr|=d;else{if((d&1073741824)===0)return a=N!==null?N.baseLanes|d:d,i.lanes=i.childLanes=1073741824,i.memoizedState={baseLanes:a,cachePool:null,transitions:null},i.updateQueue=null,Rt(gl,pr),pr|=a,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=N!==null?N.baseLanes:d,Rt(gl,pr),pr|=g}else N!==null?(g=N.baseLanes|d,i.memoizedState=null):g=d,Rt(gl,pr),pr|=g;return Un(a,i,x,d),i.child}function Qk(a,i){var d=i.ref;(a===null&&d!==null||a!==null&&a.ref!==d)&&(i.flags|=512,i.flags|=2097152)}function Cp(a,i,d,g,x){var N=yn(d)?ts:an.current;return N=ns(i,N),Oe(i,x),d=wp(a,i,d,g,N,x),g=vp(),a!==null&&!Jn?(i.updateQueue=a.updateQueue,i.flags&=-2053,a.lanes&=~x,aa(a,i,x)):(Ot&&g&&Lc(i),i.flags|=1,Un(a,i,d,x),i.child)}function Jk(a,i,d,g,x){if(yn(d)){var N=!0;ol(i)}else N=!1;if(Oe(i,x),i.stateNode===null)Dd(a,i),Bk(i,d,g),jp(i,d,g,x),g=!0;else if(a===null){var O=i.stateNode,J=i.memoizedProps;O.props=J;var oe=O.context,we=d.contextType;typeof we=="object"&&we!==null?we=Be(we):(we=yn(d)?ts:an.current,we=ns(i,we));var Te=d.getDerivedStateFromProps,Me=typeof Te=="function"||typeof O.getSnapshotBeforeUpdate=="function";Me||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(J!==g||oe!==we)&&zk(i,O,g,we),An=!1;var Ee=i.memoizedState;O.state=Ee,Xo(i,g,O,x),oe=i.memoizedState,J!==g||Ee!==oe||kn.current||An?(typeof Te=="function"&&(Sp(i,d,Te,g),oe=i.memoizedState),(J=An||qk(i,d,J,g,Ee,oe,we))?(Me||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(i.flags|=4194308)):(typeof O.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=g,i.memoizedState=oe),O.props=g,O.state=oe,O.context=we,g=J):(typeof O.componentDidMount=="function"&&(i.flags|=4194308),g=!1)}else{O=i.stateNode,Yo(a,i),J=i.memoizedProps,we=i.type===i.elementType?J:ls(i.type,J),O.props=we,Me=i.pendingProps,Ee=O.context,oe=d.contextType,typeof oe=="object"&&oe!==null?oe=Be(oe):(oe=yn(d)?ts:an.current,oe=ns(i,oe));var We=d.getDerivedStateFromProps;(Te=typeof We=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(J!==Me||Ee!==oe)&&zk(i,O,g,oe),An=!1,Ee=i.memoizedState,O.state=Ee,Xo(i,g,O,x);var Xe=i.memoizedState;J!==Me||Ee!==Xe||kn.current||An?(typeof We=="function"&&(Sp(i,d,We,g),Xe=i.memoizedState),(we=An||qk(i,d,we,g,Ee,Xe,oe)||!1)?(Te||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(g,Xe,oe),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(g,Xe,oe)),typeof O.componentDidUpdate=="function"&&(i.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof O.componentDidUpdate!="function"||J===a.memoizedProps&&Ee===a.memoizedState||(i.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||J===a.memoizedProps&&Ee===a.memoizedState||(i.flags|=1024),i.memoizedProps=g,i.memoizedState=Xe),O.props=g,O.state=Xe,O.context=oe,g=we):(typeof O.componentDidUpdate!="function"||J===a.memoizedProps&&Ee===a.memoizedState||(i.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||J===a.memoizedProps&&Ee===a.memoizedState||(i.flags|=1024),g=!1)}return Tp(a,i,d,g,N,x)}function Tp(a,i,d,g,x,N){Qk(a,i);var O=(i.flags&128)!==0;if(!g&&!O)return x&&Ed(i,d,!1),aa(a,i,N);g=i.stateNode,J$.current=i;var J=O&&typeof d.getDerivedStateFromError!="function"?null:g.render();return i.flags|=1,a!==null&&O?(i.child=ra(i,a.child,null,N),i.child=ra(i,null,J,N)):Un(a,i,J,N),i.memoizedState=g.state,x&&Ed(i,d,!0),i.child}function e1(a){var i=a.stateNode;i.pendingContext?Rs(a,i.pendingContext,i.pendingContext!==i.context):i.context&&Rs(a,i.context,!1),hp(a,i.containerInfo)}function t1(a,i,d,g,x){return Pa(),dl(x),i.flags|=256,Un(a,i,d,g),i.child}var Rp={dehydrated:null,treeContext:null,retryLane:0};function Ap(a){return{baseLanes:a,cachePool:null,transitions:null}}function n1(a,i,d){var g=i.pendingProps,x=qt.current,N=!1,O=(i.flags&128)!==0,J;if((J=O)||(J=a!==null&&a.memoizedState===null?!1:(x&2)!==0),J?(N=!0,i.flags&=-129):(a===null||a.memoizedState!==null)&&(x|=1),Rt(qt,x&1),a===null)return Pc(i),a=i.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((i.mode&1)===0?i.lanes=1:a.data==="$!"?i.lanes=8:i.lanes=1073741824,null):(O=g.children,a=g.fallback,N?(g=i.mode,N=i.child,O={mode:"hidden",children:O},(g&1)===0&&N!==null?(N.childLanes=0,N.pendingProps=O):N=Xd(O,g,0,null),a=ri(a,g,d,null),N.return=i,a.return=i,N.sibling=a,i.child=N,i.child.memoizedState=Ap(d),i.memoizedState=Rp,a):Mp(i,O));if(x=a.memoizedState,x!==null&&(J=x.dehydrated,J!==null))return eO(a,i,O,g,J,x,d);if(N){N=g.fallback,O=i.mode,x=a.child,J=x.sibling;var oe={mode:"hidden",children:g.children};return(O&1)===0&&i.child!==x?(g=i.child,g.childLanes=0,g.pendingProps=oe,i.deletions=null):(g=Va(x,oe),g.subtreeFlags=x.subtreeFlags&14680064),J!==null?N=Va(J,N):(N=ri(N,O,d,null),N.flags|=2),N.return=i,g.return=i,g.sibling=N,i.child=g,g=N,N=i.child,O=a.child.memoizedState,O=O===null?Ap(d):{baseLanes:O.baseLanes|d,cachePool:null,transitions:O.transitions},N.memoizedState=O,N.childLanes=a.childLanes&~d,i.memoizedState=Rp,g}return N=a.child,a=N.sibling,g=Va(N,{mode:"visible",children:g.children}),(i.mode&1)===0&&(g.lanes=d),g.return=i,g.sibling=null,a!==null&&(d=i.deletions,d===null?(i.deletions=[a],i.flags|=16):d.push(a)),i.child=g,i.memoizedState=null,g}function Mp(a,i){return i=Xd({mode:"visible",children:i},a.mode,0,null),i.return=a,a.child=i}function Pd(a,i,d,g){return g!==null&&dl(g),ra(i,a.child,null,d),a=Mp(i,i.pendingProps.children),a.flags|=2,i.memoizedState=null,a}function eO(a,i,d,g,x,N,O){if(d)return i.flags&256?(i.flags&=-257,g=_p(Error(n(422))),Pd(a,i,O,g)):i.memoizedState!==null?(i.child=a.child,i.flags|=128,null):(N=g.fallback,x=i.mode,g=Xd({mode:"visible",children:g.children},x,0,null),N=ri(N,x,O,null),N.flags|=2,g.return=i,N.return=i,g.sibling=N,i.child=g,(i.mode&1)!==0&&ra(i,a.child,null,O),i.child.memoizedState=Ap(O),i.memoizedState=Rp,N);if((i.mode&1)===0)return Pd(a,i,O,null);if(x.data==="$!"){if(g=x.nextSibling&&x.nextSibling.dataset,g)var J=g.dgst;return g=J,N=Error(n(419)),g=_p(N,g,void 0),Pd(a,i,O,g)}if(J=(O&a.childLanes)!==0,Jn||J){if(g=xn,g!==null){switch(O&-O){case 4:x=2;break;case 16:x=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:x=32;break;case 536870912:x=268435456;break;default:x=0}x=(x&(g.suspendedLanes|O))!==0?0:x,x!==0&&x!==N.retryLane&&(N.retryLane=x,ft(a,x),ds(g,a,x,-1))}return Kp(),g=_p(Error(n(421))),Pd(a,i,O,g)}return x.data==="$?"?(i.flags|=128,i.child=a.child,i=fO.bind(null,a),x._reactRetry=i,null):(a=N.treeContext,wn=Cs(x.nextSibling),Rn=i,Ot=!0,on=null,a!==null&&(_t[Tn++]=Tr,_t[Tn++]=ss,_t[Tn++]=Ms,Tr=a.id,ss=a.overflow,Ms=i),i=Mp(i,g.children),i.flags|=4096,i)}function r1(a,i,d){a.lanes|=i;var g=a.alternate;g!==null&&(g.lanes|=i),je(a.return,i,d)}function Ip(a,i,d,g,x){var N=a.memoizedState;N===null?a.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:x}:(N.isBackwards=i,N.rendering=null,N.renderingStartTime=0,N.last=g,N.tail=d,N.tailMode=x)}function s1(a,i,d){var g=i.pendingProps,x=g.revealOrder,N=g.tail;if(Un(a,i,g.children,d),g=qt.current,(g&2)!==0)g=g&1|2,i.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=i.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&r1(a,d,i);else if(a.tag===19)r1(a,d,i);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}g&=1}if(Rt(qt,g),(i.mode&1)===0)i.memoizedState=null;else switch(x){case"forwards":for(d=i.child,x=null;d!==null;)a=d.alternate,a!==null&&Rd(a)===null&&(x=d),d=d.sibling;d=x,d===null?(x=i.child,i.child=null):(x=d.sibling,d.sibling=null),Ip(i,!1,x,d,N);break;case"backwards":for(d=null,x=i.child,i.child=null;x!==null;){if(a=x.alternate,a!==null&&Rd(a)===null){i.child=x;break}a=x.sibling,x.sibling=d,d=x,x=a}Ip(i,!0,d,null,N);break;case"together":Ip(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function Dd(a,i){(i.mode&1)===0&&a!==null&&(a.alternate=null,i.alternate=null,i.flags|=2)}function aa(a,i,d){if(a!==null&&(i.dependencies=a.dependencies),Jo|=i.lanes,(d&i.childLanes)===0)return null;if(a!==null&&i.child!==a.child)throw Error(n(153));if(i.child!==null){for(a=i.child,d=Va(a,a.pendingProps),i.child=d,d.return=i;a.sibling!==null;)a=a.sibling,d=d.sibling=Va(a,a.pendingProps),d.return=i;d.sibling=null}return i.child}function tO(a,i,d){switch(i.tag){case 3:e1(i),Pa();break;case 5:wk(i);break;case 1:yn(i.type)&&ol(i);break;case 4:hp(i,i.stateNode.containerInfo);break;case 10:var g=i.type._context,x=i.memoizedProps.value;Rt(Ko,g._currentValue),g._currentValue=x;break;case 13:if(g=i.memoizedState,g!==null)return g.dehydrated!==null?(Rt(qt,qt.current&1),i.flags|=128,null):(d&i.child.childLanes)!==0?n1(a,i,d):(Rt(qt,qt.current&1),a=aa(a,i,d),a!==null?a.sibling:null);Rt(qt,qt.current&1);break;case 19:if(g=(d&i.childLanes)!==0,(a.flags&128)!==0){if(g)return s1(a,i,d);i.flags|=128}if(x=i.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),Rt(qt,qt.current),g)break;return null;case 22:case 23:return i.lanes=0,Zk(a,i,d)}return aa(a,i,d)}var a1,$p,o1,i1;a1=function(a,i){for(var d=i.child;d!==null;){if(d.tag===5||d.tag===6)a.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===i)break;for(;d.sibling===null;){if(d.return===null||d.return===i)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},$p=function(){},o1=function(a,i,d,g){var x=a.memoizedProps;if(x!==g){a=i.stateNode,Zo(Rr.current);var N=null;switch(d){case"input":x=ze(a,x),g=ze(a,g),N=[];break;case"select":x=H({},x,{value:void 0}),g=H({},g,{value:void 0}),N=[];break;case"textarea":x=de(a,x),g=de(a,g),N=[];break;default:typeof x.onClick!="function"&&typeof g.onClick=="function"&&(a.onclick=nl)}ct(d,g);var O;d=null;for(we in x)if(!g.hasOwnProperty(we)&&x.hasOwnProperty(we)&&x[we]!=null)if(we==="style"){var J=x[we];for(O in J)J.hasOwnProperty(O)&&(d||(d={}),d[O]="")}else we!=="dangerouslySetInnerHTML"&&we!=="children"&&we!=="suppressContentEditableWarning"&&we!=="suppressHydrationWarning"&&we!=="autoFocus"&&(s.hasOwnProperty(we)?N||(N=[]):(N=N||[]).push(we,null));for(we in g){var oe=g[we];if(J=x!=null?x[we]:void 0,g.hasOwnProperty(we)&&oe!==J&&(oe!=null||J!=null))if(we==="style")if(J){for(O in J)!J.hasOwnProperty(O)||oe&&oe.hasOwnProperty(O)||(d||(d={}),d[O]="");for(O in oe)oe.hasOwnProperty(O)&&J[O]!==oe[O]&&(d||(d={}),d[O]=oe[O])}else d||(N||(N=[]),N.push(we,d)),d=oe;else we==="dangerouslySetInnerHTML"?(oe=oe?oe.__html:void 0,J=J?J.__html:void 0,oe!=null&&J!==oe&&(N=N||[]).push(we,oe)):we==="children"?typeof oe!="string"&&typeof oe!="number"||(N=N||[]).push(we,""+oe):we!=="suppressContentEditableWarning"&&we!=="suppressHydrationWarning"&&(s.hasOwnProperty(we)?(oe!=null&&we==="onScroll"&&Mt("scroll",a),N||J===oe||(N=[])):(N=N||[]).push(we,oe))}d&&(N=N||[]).push("style",d);var we=N;(i.updateQueue=we)&&(i.flags|=4)}},i1=function(a,i,d,g){d!==g&&(i.flags|=4)};function Vc(a,i){if(!Ot)switch(a.tailMode){case"hidden":i=a.tail;for(var d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?a.tail=null:d.sibling=null;break;case"collapsed":d=a.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?i||a.tail===null?a.tail=null:a.tail.sibling=null:g.sibling=null}}function In(a){var i=a.alternate!==null&&a.alternate.child===a.child,d=0,g=0;if(i)for(var x=a.child;x!==null;)d|=x.lanes|x.childLanes,g|=x.subtreeFlags&14680064,g|=x.flags&14680064,x.return=a,x=x.sibling;else for(x=a.child;x!==null;)d|=x.lanes|x.childLanes,g|=x.subtreeFlags,g|=x.flags,x.return=a,x=x.sibling;return a.subtreeFlags|=g,a.childLanes=d,i}function nO(a,i,d){var g=i.pendingProps;switch(cl(i),i.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return In(i),null;case 1:return yn(i.type)&&Bo(),In(i),null;case 3:return g=i.stateNode,fl(),Tt(kn),Tt(an),mp(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(a===null||a.child===null)&&(Vo(i)?i.flags|=4:a===null||a.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,on!==null&&(Wp(on),on=null))),$p(a,i),In(i),null;case 5:fp(i);var x=Zo(qa.current);if(d=i.type,a!==null&&i.stateNode!=null)o1(a,i,d,g,x),a.ref!==i.ref&&(i.flags|=512,i.flags|=2097152);else{if(!g){if(i.stateNode===null)throw Error(n(166));return In(i),null}if(a=Zo(Rr.current),Vo(i)){g=i.stateNode,d=i.type;var N=i.memoizedProps;switch(g[Bn]=i,g[Do]=N,a=(i.mode&1)!==0,d){case"dialog":Mt("cancel",g),Mt("close",g);break;case"iframe":case"object":case"embed":Mt("load",g);break;case"video":case"audio":for(x=0;x<Ao.length;x++)Mt(Ao[x],g);break;case"source":Mt("error",g);break;case"img":case"image":case"link":Mt("error",g),Mt("load",g);break;case"details":Mt("toggle",g);break;case"input":Re(g,N),Mt("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!N.multiple},Mt("invalid",g);break;case"textarea":fe(g,N),Mt("invalid",g)}ct(d,N),x=null;for(var O in N)if(N.hasOwnProperty(O)){var J=N[O];O==="children"?typeof J=="string"?g.textContent!==J&&(N.suppressHydrationWarning!==!0&&Oo(g.textContent,J,a),x=["children",J]):typeof J=="number"&&g.textContent!==""+J&&(N.suppressHydrationWarning!==!0&&Oo(g.textContent,J,a),x=["children",""+J]):s.hasOwnProperty(O)&&J!=null&&O==="onScroll"&&Mt("scroll",g)}switch(d){case"input":Ie(g),ce(g,N,!0);break;case"textarea":Ie(g),pe(g);break;case"select":case"option":break;default:typeof N.onClick=="function"&&(g.onclick=nl)}g=x,i.updateQueue=g,g!==null&&(i.flags|=4)}else{O=x.nodeType===9?x:x.ownerDocument,a==="http://www.w3.org/1999/xhtml"&&(a=_e(d)),a==="http://www.w3.org/1999/xhtml"?d==="script"?(a=O.createElement("div"),a.innerHTML="<script><\/script>",a=a.removeChild(a.firstChild)):typeof g.is=="string"?a=O.createElement(d,{is:g.is}):(a=O.createElement(d),d==="select"&&(O=a,g.multiple?O.multiple=!0:g.size&&(O.size=g.size))):a=O.createElementNS(a,d),a[Bn]=i,a[Do]=g,a1(a,i,!1,!1),i.stateNode=a;e:{switch(O=yt(d,g),d){case"dialog":Mt("cancel",a),Mt("close",a),x=g;break;case"iframe":case"object":case"embed":Mt("load",a),x=g;break;case"video":case"audio":for(x=0;x<Ao.length;x++)Mt(Ao[x],a);x=g;break;case"source":Mt("error",a),x=g;break;case"img":case"image":case"link":Mt("error",a),Mt("load",a),x=g;break;case"details":Mt("toggle",a),x=g;break;case"input":Re(a,g),x=ze(a,g),Mt("invalid",a);break;case"option":x=g;break;case"select":a._wrapperState={wasMultiple:!!g.multiple},x=H({},g,{value:void 0}),Mt("invalid",a);break;case"textarea":fe(a,g),x=de(a,g),Mt("invalid",a);break;default:x=g}ct(d,x),J=x;for(N in J)if(J.hasOwnProperty(N)){var oe=J[N];N==="style"?rt(a,oe):N==="dangerouslySetInnerHTML"?(oe=oe?oe.__html:void 0,oe!=null&&ke(a,oe)):N==="children"?typeof oe=="string"?(d!=="textarea"||oe!=="")&&Ae(a,oe):typeof oe=="number"&&Ae(a,""+oe):N!=="suppressContentEditableWarning"&&N!=="suppressHydrationWarning"&&N!=="autoFocus"&&(s.hasOwnProperty(N)?oe!=null&&N==="onScroll"&&Mt("scroll",a):oe!=null&&E(a,N,oe,O))}switch(d){case"input":Ie(a),ce(a,g,!1);break;case"textarea":Ie(a),pe(a);break;case"option":g.value!=null&&a.setAttribute("value",""+le(g.value));break;case"select":a.multiple=!!g.multiple,N=g.value,N!=null?Le(a,!!g.multiple,N,!1):g.defaultValue!=null&&Le(a,!!g.multiple,g.defaultValue,!0);break;default:typeof x.onClick=="function"&&(a.onclick=nl)}switch(d){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(i.flags|=4)}i.ref!==null&&(i.flags|=512,i.flags|=2097152)}return In(i),null;case 6:if(a&&i.stateNode!=null)i1(a,i,a.memoizedProps,g);else{if(typeof g!="string"&&i.stateNode===null)throw Error(n(166));if(d=Zo(qa.current),Zo(Rr.current),Vo(i)){if(g=i.stateNode,d=i.memoizedProps,g[Bn]=i,(N=g.nodeValue!==d)&&(a=Rn,a!==null))switch(a.tag){case 3:Oo(g.nodeValue,d,(a.mode&1)!==0);break;case 5:a.memoizedProps.suppressHydrationWarning!==!0&&Oo(g.nodeValue,d,(a.mode&1)!==0)}N&&(i.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[Bn]=i,i.stateNode=g}return In(i),null;case 13:if(Tt(qt),g=i.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(Ot&&wn!==null&&(i.mode&1)!==0&&(i.flags&128)===0)Cd(),Pa(),i.flags|=98560,N=!1;else if(N=Vo(i),g!==null&&g.dehydrated!==null){if(a===null){if(!N)throw Error(n(318));if(N=i.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(n(317));N[Bn]=i}else Pa(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;In(i),N=!1}else on!==null&&(Wp(on),on=null),N=!0;if(!N)return i.flags&65536?i:null}return(i.flags&128)!==0?(i.lanes=d,i):(g=g!==null,g!==(a!==null&&a.memoizedState!==null)&&g&&(i.child.flags|=8192,(i.mode&1)!==0&&(a===null||(qt.current&1)!==0?cn===0&&(cn=3):Kp())),i.updateQueue!==null&&(i.flags|=4),In(i),null);case 4:return fl(),$p(a,i),a===null&&Zr(i.stateNode.containerInfo),In(i),null;case 10:return ye(i.type._context),In(i),null;case 17:return yn(i.type)&&Bo(),In(i),null;case 19:if(Tt(qt),N=i.memoizedState,N===null)return In(i),null;if(g=(i.flags&128)!==0,O=N.rendering,O===null)if(g)Vc(N,!1);else{if(cn!==0||a!==null&&(a.flags&128)!==0)for(a=i.child;a!==null;){if(O=Rd(a),O!==null){for(i.flags|=128,Vc(N,!1),g=O.updateQueue,g!==null&&(i.updateQueue=g,i.flags|=4),i.subtreeFlags=0,g=d,d=i.child;d!==null;)N=d,a=g,N.flags&=14680066,O=N.alternate,O===null?(N.childLanes=0,N.lanes=a,N.child=null,N.subtreeFlags=0,N.memoizedProps=null,N.memoizedState=null,N.updateQueue=null,N.dependencies=null,N.stateNode=null):(N.childLanes=O.childLanes,N.lanes=O.lanes,N.child=O.child,N.subtreeFlags=0,N.deletions=null,N.memoizedProps=O.memoizedProps,N.memoizedState=O.memoizedState,N.updateQueue=O.updateQueue,N.type=O.type,a=O.dependencies,N.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),d=d.sibling;return Rt(qt,qt.current&1|2),i.child}a=a.sibling}N.tail!==null&&Ct()>yl&&(i.flags|=128,g=!0,Vc(N,!1),i.lanes=4194304)}else{if(!g)if(a=Rd(O),a!==null){if(i.flags|=128,g=!0,d=a.updateQueue,d!==null&&(i.updateQueue=d,i.flags|=4),Vc(N,!0),N.tail===null&&N.tailMode==="hidden"&&!O.alternate&&!Ot)return In(i),null}else 2*Ct()-N.renderingStartTime>yl&&d!==1073741824&&(i.flags|=128,g=!0,Vc(N,!1),i.lanes=4194304);N.isBackwards?(O.sibling=i.child,i.child=O):(d=N.last,d!==null?d.sibling=O:i.child=O,N.last=O)}return N.tail!==null?(i=N.tail,N.rendering=i,N.tail=i.sibling,N.renderingStartTime=Ct(),i.sibling=null,d=qt.current,Rt(qt,g?d&1|2:d&1),i):(In(i),null);case 22:case 23:return Gp(),g=i.memoizedState!==null,a!==null&&a.memoizedState!==null!==g&&(i.flags|=8192),g&&(i.mode&1)!==0?(pr&1073741824)!==0&&(In(i),i.subtreeFlags&6&&(i.flags|=8192)):In(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function rO(a,i){switch(cl(i),i.tag){case 1:return yn(i.type)&&Bo(),a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 3:return fl(),Tt(kn),Tt(an),mp(),a=i.flags,(a&65536)!==0&&(a&128)===0?(i.flags=a&-65537|128,i):null;case 5:return fp(i),null;case 13:if(Tt(qt),a=i.memoizedState,a!==null&&a.dehydrated!==null){if(i.alternate===null)throw Error(n(340));Pa()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 19:return Tt(qt),null;case 4:return fl(),null;case 10:return ye(i.type._context),null;case 22:case 23:return Gp(),null;case 24:return null;default:return null}}var Fd=!1,$n=!1,sO=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function ml(a,i){var d=a.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(g){Ht(a,i,g)}else d.current=null}function Op(a,i,d){try{d()}catch(g){Ht(a,i,g)}}var l1=!1;function aO(a,i){if(Mc=ur,a=Zi(),_c(a)){if("selectionStart"in a)var d={start:a.selectionStart,end:a.selectionEnd};else e:{d=(d=a.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var x=g.anchorOffset,N=g.focusNode;g=g.focusOffset;try{d.nodeType,N.nodeType}catch{d=null;break e}var O=0,J=-1,oe=-1,we=0,Te=0,Me=a,Ee=null;t:for(;;){for(var We;Me!==d||x!==0&&Me.nodeType!==3||(J=O+x),Me!==N||g!==0&&Me.nodeType!==3||(oe=O+g),Me.nodeType===3&&(O+=Me.nodeValue.length),(We=Me.firstChild)!==null;)Ee=Me,Me=We;for(;;){if(Me===a)break t;if(Ee===d&&++we===x&&(J=O),Ee===N&&++Te===g&&(oe=O),(We=Me.nextSibling)!==null)break;Me=Ee,Ee=Me.parentNode}Me=We}d=J===-1||oe===-1?null:{start:J,end:oe}}else d=null}d=d||{start:0,end:0}}else d=null;for(Qr={focusedElem:a,selectionRange:d},ur=!1,Ke=i;Ke!==null;)if(i=Ke,a=i.child,(i.subtreeFlags&1028)!==0&&a!==null)a.return=i,Ke=a;else for(;Ke!==null;){i=Ke;try{var Xe=i.alternate;if((i.flags&1024)!==0)switch(i.tag){case 0:case 11:case 15:break;case 1:if(Xe!==null){var Ze=Xe.memoizedProps,Yt=Xe.memoizedState,he=i.stateNode,ie=he.getSnapshotBeforeUpdate(i.elementType===i.type?Ze:ls(i.type,Ze),Yt);he.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:var me=i.stateNode.containerInfo;me.nodeType===1?me.textContent="":me.nodeType===9&&me.documentElement&&me.removeChild(me.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch($e){Ht(i,i.return,$e)}if(a=i.sibling,a!==null){a.return=i.return,Ke=a;break}Ke=i.return}return Xe=l1,l1=!1,Xe}function Gc(a,i,d){var g=i.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var x=g=g.next;do{if((x.tag&a)===a){var N=x.destroy;x.destroy=void 0,N!==void 0&&Op(i,d,N)}x=x.next}while(x!==g)}}function qd(a,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var d=i=i.next;do{if((d.tag&a)===a){var g=d.create;d.destroy=g()}d=d.next}while(d!==i)}}function Lp(a){var i=a.ref;if(i!==null){var d=a.stateNode;switch(a.tag){case 5:a=d;break;default:a=d}typeof i=="function"?i(a):i.current=a}}function c1(a){var i=a.alternate;i!==null&&(a.alternate=null,c1(i)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(i=a.stateNode,i!==null&&(delete i[Bn],delete i[Do],delete i[sl],delete i[dp],delete i[_d])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function u1(a){return a.tag===5||a.tag===3||a.tag===4}function d1(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||u1(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Pp(a,i,d){var g=a.tag;if(g===5||g===6)a=a.stateNode,i?d.nodeType===8?d.parentNode.insertBefore(a,i):d.insertBefore(a,i):(d.nodeType===8?(i=d.parentNode,i.insertBefore(a,d)):(i=d,i.appendChild(a)),d=d._reactRootContainer,d!=null||i.onclick!==null||(i.onclick=nl));else if(g!==4&&(a=a.child,a!==null))for(Pp(a,i,d),a=a.sibling;a!==null;)Pp(a,i,d),a=a.sibling}function Dp(a,i,d){var g=a.tag;if(g===5||g===6)a=a.stateNode,i?d.insertBefore(a,i):d.appendChild(a);else if(g!==4&&(a=a.child,a!==null))for(Dp(a,i,d),a=a.sibling;a!==null;)Dp(a,i,d),a=a.sibling}var Nn=null,cs=!1;function Ba(a,i,d){for(d=d.child;d!==null;)h1(a,i,d),d=d.sibling}function h1(a,i,d){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(cr,d)}catch{}switch(d.tag){case 5:$n||ml(d,i);case 6:var g=Nn,x=cs;Nn=null,Ba(a,i,d),Nn=g,cs=x,Nn!==null&&(cs?(a=Nn,d=d.stateNode,a.nodeType===8?a.parentNode.removeChild(d):a.removeChild(d)):Nn.removeChild(d.stateNode));break;case 18:Nn!==null&&(cs?(a=Nn,d=d.stateNode,a.nodeType===8?Po(a.parentNode,d):a.nodeType===1&&Po(a,d),va(a)):Po(Nn,d.stateNode));break;case 4:g=Nn,x=cs,Nn=d.stateNode.containerInfo,cs=!0,Ba(a,i,d),Nn=g,cs=x;break;case 0:case 11:case 14:case 15:if(!$n&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){x=g=g.next;do{var N=x,O=N.destroy;N=N.tag,O!==void 0&&((N&2)!==0||(N&4)!==0)&&Op(d,i,O),x=x.next}while(x!==g)}Ba(a,i,d);break;case 1:if(!$n&&(ml(d,i),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(J){Ht(d,i,J)}Ba(a,i,d);break;case 21:Ba(a,i,d);break;case 22:d.mode&1?($n=(g=$n)||d.memoizedState!==null,Ba(a,i,d),$n=g):Ba(a,i,d);break;default:Ba(a,i,d)}}function f1(a){var i=a.updateQueue;if(i!==null){a.updateQueue=null;var d=a.stateNode;d===null&&(d=a.stateNode=new sO),i.forEach(function(g){var x=pO.bind(null,a,g);d.has(g)||(d.add(g),g.then(x,x))})}}function us(a,i){var d=i.deletions;if(d!==null)for(var g=0;g<d.length;g++){var x=d[g];try{var N=a,O=i,J=O;e:for(;J!==null;){switch(J.tag){case 5:Nn=J.stateNode,cs=!1;break e;case 3:Nn=J.stateNode.containerInfo,cs=!0;break e;case 4:Nn=J.stateNode.containerInfo,cs=!0;break e}J=J.return}if(Nn===null)throw Error(n(160));h1(N,O,x),Nn=null,cs=!1;var oe=x.alternate;oe!==null&&(oe.return=null),x.return=null}catch(we){Ht(x,i,we)}}if(i.subtreeFlags&12854)for(i=i.child;i!==null;)p1(i,a),i=i.sibling}function p1(a,i){var d=a.alternate,g=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(us(i,a),$s(a),g&4){try{Gc(3,a,a.return),qd(3,a)}catch(Ze){Ht(a,a.return,Ze)}try{Gc(5,a,a.return)}catch(Ze){Ht(a,a.return,Ze)}}break;case 1:us(i,a),$s(a),g&512&&d!==null&&ml(d,d.return);break;case 5:if(us(i,a),$s(a),g&512&&d!==null&&ml(d,d.return),a.flags&32){var x=a.stateNode;try{Ae(x,"")}catch(Ze){Ht(a,a.return,Ze)}}if(g&4&&(x=a.stateNode,x!=null)){var N=a.memoizedProps,O=d!==null?d.memoizedProps:N,J=a.type,oe=a.updateQueue;if(a.updateQueue=null,oe!==null)try{J==="input"&&N.type==="radio"&&N.name!=null&&st(x,N),yt(J,O);var we=yt(J,N);for(O=0;O<oe.length;O+=2){var Te=oe[O],Me=oe[O+1];Te==="style"?rt(x,Me):Te==="dangerouslySetInnerHTML"?ke(x,Me):Te==="children"?Ae(x,Me):E(x,Te,Me,we)}switch(J){case"input":ue(x,N);break;case"textarea":Ce(x,N);break;case"select":var Ee=x._wrapperState.wasMultiple;x._wrapperState.wasMultiple=!!N.multiple;var We=N.value;We!=null?Le(x,!!N.multiple,We,!1):Ee!==!!N.multiple&&(N.defaultValue!=null?Le(x,!!N.multiple,N.defaultValue,!0):Le(x,!!N.multiple,N.multiple?[]:"",!1))}x[Do]=N}catch(Ze){Ht(a,a.return,Ze)}}break;case 6:if(us(i,a),$s(a),g&4){if(a.stateNode===null)throw Error(n(162));x=a.stateNode,N=a.memoizedProps;try{x.nodeValue=N}catch(Ze){Ht(a,a.return,Ze)}}break;case 3:if(us(i,a),$s(a),g&4&&d!==null&&d.memoizedState.isDehydrated)try{va(i.containerInfo)}catch(Ze){Ht(a,a.return,Ze)}break;case 4:us(i,a),$s(a);break;case 13:us(i,a),$s(a),x=a.child,x.flags&8192&&(N=x.memoizedState!==null,x.stateNode.isHidden=N,!N||x.alternate!==null&&x.alternate.memoizedState!==null||(Bp=Ct())),g&4&&f1(a);break;case 22:if(Te=d!==null&&d.memoizedState!==null,a.mode&1?($n=(we=$n)||Te,us(i,a),$n=we):us(i,a),$s(a),g&8192){if(we=a.memoizedState!==null,(a.stateNode.isHidden=we)&&!Te&&(a.mode&1)!==0)for(Ke=a,Te=a.child;Te!==null;){for(Me=Ke=Te;Ke!==null;){switch(Ee=Ke,We=Ee.child,Ee.tag){case 0:case 11:case 14:case 15:Gc(4,Ee,Ee.return);break;case 1:ml(Ee,Ee.return);var Xe=Ee.stateNode;if(typeof Xe.componentWillUnmount=="function"){g=Ee,d=Ee.return;try{i=g,Xe.props=i.memoizedProps,Xe.state=i.memoizedState,Xe.componentWillUnmount()}catch(Ze){Ht(g,d,Ze)}}break;case 5:ml(Ee,Ee.return);break;case 22:if(Ee.memoizedState!==null){y1(Me);continue}}We!==null?(We.return=Ee,Ke=We):y1(Me)}Te=Te.sibling}e:for(Te=null,Me=a;;){if(Me.tag===5){if(Te===null){Te=Me;try{x=Me.stateNode,we?(N=x.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none"):(J=Me.stateNode,oe=Me.memoizedProps.style,O=oe!=null&&oe.hasOwnProperty("display")?oe.display:null,J.style.display=Ve("display",O))}catch(Ze){Ht(a,a.return,Ze)}}}else if(Me.tag===6){if(Te===null)try{Me.stateNode.nodeValue=we?"":Me.memoizedProps}catch(Ze){Ht(a,a.return,Ze)}}else if((Me.tag!==22&&Me.tag!==23||Me.memoizedState===null||Me===a)&&Me.child!==null){Me.child.return=Me,Me=Me.child;continue}if(Me===a)break e;for(;Me.sibling===null;){if(Me.return===null||Me.return===a)break e;Te===Me&&(Te=null),Me=Me.return}Te===Me&&(Te=null),Me.sibling.return=Me.return,Me=Me.sibling}}break;case 19:us(i,a),$s(a),g&4&&f1(a);break;case 21:break;default:us(i,a),$s(a)}}function $s(a){var i=a.flags;if(i&2){try{e:{for(var d=a.return;d!==null;){if(u1(d)){var g=d;break e}d=d.return}throw Error(n(160))}switch(g.tag){case 5:var x=g.stateNode;g.flags&32&&(Ae(x,""),g.flags&=-33);var N=d1(a);Dp(a,N,x);break;case 3:case 4:var O=g.stateNode.containerInfo,J=d1(a);Pp(a,J,O);break;default:throw Error(n(161))}}catch(oe){Ht(a,a.return,oe)}a.flags&=-3}i&4096&&(a.flags&=-4097)}function oO(a,i,d){Ke=a,m1(a)}function m1(a,i,d){for(var g=(a.mode&1)!==0;Ke!==null;){var x=Ke,N=x.child;if(x.tag===22&&g){var O=x.memoizedState!==null||Fd;if(!O){var J=x.alternate,oe=J!==null&&J.memoizedState!==null||$n;J=Fd;var we=$n;if(Fd=O,($n=oe)&&!we)for(Ke=x;Ke!==null;)O=Ke,oe=O.child,O.tag===22&&O.memoizedState!==null?w1(x):oe!==null?(oe.return=O,Ke=oe):w1(x);for(;N!==null;)Ke=N,m1(N),N=N.sibling;Ke=x,Fd=J,$n=we}g1(a)}else(x.subtreeFlags&8772)!==0&&N!==null?(N.return=x,Ke=N):g1(a)}}function g1(a){for(;Ke!==null;){var i=Ke;if((i.flags&8772)!==0){var d=i.alternate;try{if((i.flags&8772)!==0)switch(i.tag){case 0:case 11:case 15:$n||qd(5,i);break;case 1:var g=i.stateNode;if(i.flags&4&&!$n)if(d===null)g.componentDidMount();else{var x=i.elementType===i.type?d.memoizedProps:ls(i.type,d.memoizedProps);g.componentDidUpdate(x,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var N=i.updateQueue;N!==null&&Fa(i,N,g);break;case 3:var O=i.updateQueue;if(O!==null){if(d=null,i.child!==null)switch(i.child.tag){case 5:d=i.child.stateNode;break;case 1:d=i.child.stateNode}Fa(i,O,d)}break;case 5:var J=i.stateNode;if(d===null&&i.flags&4){d=J;var oe=i.memoizedProps;switch(i.type){case"button":case"input":case"select":case"textarea":oe.autoFocus&&d.focus();break;case"img":oe.src&&(d.src=oe.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(i.memoizedState===null){var we=i.alternate;if(we!==null){var Te=we.memoizedState;if(Te!==null){var Me=Te.dehydrated;Me!==null&&va(Me)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}$n||i.flags&512&&Lp(i)}catch(Ee){Ht(i,i.return,Ee)}}if(i===a){Ke=null;break}if(d=i.sibling,d!==null){d.return=i.return,Ke=d;break}Ke=i.return}}function y1(a){for(;Ke!==null;){var i=Ke;if(i===a){Ke=null;break}var d=i.sibling;if(d!==null){d.return=i.return,Ke=d;break}Ke=i.return}}function w1(a){for(;Ke!==null;){var i=Ke;try{switch(i.tag){case 0:case 11:case 15:var d=i.return;try{qd(4,i)}catch(oe){Ht(i,d,oe)}break;case 1:var g=i.stateNode;if(typeof g.componentDidMount=="function"){var x=i.return;try{g.componentDidMount()}catch(oe){Ht(i,x,oe)}}var N=i.return;try{Lp(i)}catch(oe){Ht(i,N,oe)}break;case 5:var O=i.return;try{Lp(i)}catch(oe){Ht(i,O,oe)}}}catch(oe){Ht(i,i.return,oe)}if(i===a){Ke=null;break}var J=i.sibling;if(J!==null){J.return=i.return,Ke=J;break}Ke=i.return}}var iO=Math.ceil,Bd=C.ReactCurrentDispatcher,Fp=C.ReactCurrentOwner,Mr=C.ReactCurrentBatchConfig,Nt=0,xn=null,en=null,Sn=0,pr=0,gl=Er(0),cn=0,Kc=null,Jo=0,zd=0,qp=0,Yc=null,er=null,Bp=0,yl=1/0,oa=null,Ud=!1,zp=null,za=null,Hd=!1,Ua=null,Wd=0,Xc=0,Up=null,Vd=-1,Gd=0;function Hn(){return(Nt&6)!==0?Ct():Vd!==-1?Vd:Vd=Ct()}function Ha(a){return(a.mode&1)===0?1:(Nt&2)!==0&&Sn!==0?Sn&-Sn:Go.transition!==null?(Gd===0&&(Gd=ya()),Gd):(a=ht,a!==0||(a=window.event,a=a===void 0?16:xa(a.type)),a)}function ds(a,i,d,g){if(50<Xc)throw Xc=0,Up=null,Error(n(185));po(a,d,g),((Nt&2)===0||a!==xn)&&(a===xn&&((Nt&2)===0&&(zd|=d),cn===4&&Wa(a,Sn)),tr(a,g),d===1&&Nt===0&&(i.mode&1)===0&&(yl=Ct()+500,il&&Cr()))}function tr(a,i){var d=a.callbackNode;Ri(a,i);var g=Kn(a,a===xn?Sn:0);if(g===0)d!==null&&wt(d),a.callbackNode=null,a.callbackPriority=0;else if(i=g&-g,a.callbackPriority!==i){if(d!=null&&wt(d),i===1)a.tag===0?ll(x1.bind(null,a)):$c(x1.bind(null,a)),Cn(function(){(Nt&6)===0&&Cr()}),d=null;else{switch(td(g)){case 1:d=St;break;case 4:d=br;break;case 16:d=lr;break;case 536870912:d=dt;break;default:d=lr}d=C1(d,v1.bind(null,a))}a.callbackPriority=i,a.callbackNode=d}}function v1(a,i){if(Vd=-1,Gd=0,(Nt&6)!==0)throw Error(n(327));var d=a.callbackNode;if(wl()&&a.callbackNode!==d)return null;var g=Kn(a,a===xn?Sn:0);if(g===0)return null;if((g&30)!==0||(g&a.expiredLanes)!==0||i)i=Kd(a,g);else{i=g;var x=Nt;Nt|=2;var N=k1();(xn!==a||Sn!==i)&&(oa=null,yl=Ct()+500,ti(a,i));do try{uO();break}catch(J){b1(a,J)}while(!0);te(),Bd.current=N,Nt=x,en!==null?i=0:(xn=null,Sn=0,i=cn)}if(i!==0){if(i===2&&(x=fo(a),x!==0&&(g=x,i=Hp(a,x))),i===1)throw d=Kc,ti(a,0),Wa(a,g),tr(a,Ct()),d;if(i===6)Wa(a,g);else{if(x=a.current.alternate,(g&30)===0&&!lO(x)&&(i=Kd(a,g),i===2&&(N=fo(a),N!==0&&(g=N,i=Hp(a,N))),i===1))throw d=Kc,ti(a,0),Wa(a,g),tr(a,Ct()),d;switch(a.finishedWork=x,a.finishedLanes=g,i){case 0:case 1:throw Error(n(345));case 2:ni(a,er,oa);break;case 3:if(Wa(a,g),(g&130023424)===g&&(i=Bp+500-Ct(),10<i)){if(Kn(a,0)!==0)break;if(x=a.suspendedLanes,(x&g)!==g){Hn(),a.pingedLanes|=a.suspendedLanes&x;break}a.timeoutHandle=Ic(ni.bind(null,a,er,oa),i);break}ni(a,er,oa);break;case 4:if(Wa(a,g),(g&4194240)===g)break;for(i=a.eventTimes,x=-1;0<g;){var O=31-Gn(g);N=1<<O,O=i[O],O>x&&(x=O),g&=~N}if(g=x,g=Ct()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*iO(g/1960))-g,10<g){a.timeoutHandle=Ic(ni.bind(null,a,er,oa),g);break}ni(a,er,oa);break;case 5:ni(a,er,oa);break;default:throw Error(n(329))}}}return tr(a,Ct()),a.callbackNode===d?v1.bind(null,a):null}function Hp(a,i){var d=Yc;return a.current.memoizedState.isDehydrated&&(ti(a,i).flags|=256),a=Kd(a,i),a!==2&&(i=er,er=d,i!==null&&Wp(i)),a}function Wp(a){er===null?er=a:er.push.apply(er,a)}function lO(a){for(var i=a;;){if(i.flags&16384){var d=i.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var g=0;g<d.length;g++){var x=d[g],N=x.getSnapshot;x=x.value;try{if(!Xn(N(),x))return!1}catch{return!1}}}if(d=i.child,i.subtreeFlags&16384&&d!==null)d.return=i,i=d;else{if(i===a)break;for(;i.sibling===null;){if(i.return===null||i.return===a)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Wa(a,i){for(i&=~qp,i&=~zd,a.suspendedLanes|=i,a.pingedLanes&=~i,a=a.expirationTimes;0<i;){var d=31-Gn(i),g=1<<d;a[d]=-1,i&=~g}}function x1(a){if((Nt&6)!==0)throw Error(n(327));wl();var i=Kn(a,0);if((i&1)===0)return tr(a,Ct()),null;var d=Kd(a,i);if(a.tag!==0&&d===2){var g=fo(a);g!==0&&(i=g,d=Hp(a,g))}if(d===1)throw d=Kc,ti(a,0),Wa(a,i),tr(a,Ct()),d;if(d===6)throw Error(n(345));return a.finishedWork=a.current.alternate,a.finishedLanes=i,ni(a,er,oa),tr(a,Ct()),null}function Vp(a,i){var d=Nt;Nt|=1;try{return a(i)}finally{Nt=d,Nt===0&&(yl=Ct()+500,il&&Cr())}}function ei(a){Ua!==null&&Ua.tag===0&&(Nt&6)===0&&wl();var i=Nt;Nt|=1;var d=Mr.transition,g=ht;try{if(Mr.transition=null,ht=1,a)return a()}finally{ht=g,Mr.transition=d,Nt=i,(Nt&6)===0&&Cr()}}function Gp(){pr=gl.current,Tt(gl)}function ti(a,i){a.finishedWork=null,a.finishedLanes=0;var d=a.timeoutHandle;if(d!==-1&&(a.timeoutHandle=-1,up(d)),en!==null)for(d=en.return;d!==null;){var g=d;switch(cl(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&Bo();break;case 3:fl(),Tt(kn),Tt(an),mp();break;case 5:fp(g);break;case 4:fl();break;case 13:Tt(qt);break;case 19:Tt(qt);break;case 10:ye(g.type._context);break;case 22:case 23:Gp()}d=d.return}if(xn=a,en=a=Va(a.current,null),Sn=pr=i,cn=0,Kc=null,qp=zd=Jo=0,er=Yc=null,lt!==null){for(i=0;i<lt.length;i++)if(d=lt[i],g=d.interleaved,g!==null){d.interleaved=null;var x=g.next,N=d.pending;if(N!==null){var O=N.next;N.next=x,g.next=O}d.pending=g}lt=null}return a}function b1(a,i){do{var d=en;try{if(te(),Ad.current=Od,Md){for(var g=Bt.memoizedState;g!==null;){var x=g.queue;x!==null&&(x.pending=null),g=g.next}Md=!1}if(Qo=0,vn=ln=Bt=null,zc=!1,Uc=0,Fp.current=null,d===null||d.return===null){cn=1,Kc=i,en=null;break}e:{var N=a,O=d.return,J=d,oe=i;if(i=Sn,J.flags|=32768,oe!==null&&typeof oe=="object"&&typeof oe.then=="function"){var we=oe,Te=J,Me=Te.tag;if((Te.mode&1)===0&&(Me===0||Me===11||Me===15)){var Ee=Te.alternate;Ee?(Te.updateQueue=Ee.updateQueue,Te.memoizedState=Ee.memoizedState,Te.lanes=Ee.lanes):(Te.updateQueue=null,Te.memoizedState=null)}var We=Vk(O);if(We!==null){We.flags&=-257,Gk(We,O,J,N,i),We.mode&1&&Wk(N,we,i),i=We,oe=we;var Xe=i.updateQueue;if(Xe===null){var Ze=new Set;Ze.add(oe),i.updateQueue=Ze}else Xe.add(oe);break e}else{if((i&1)===0){Wk(N,we,i),Kp();break e}oe=Error(n(426))}}else if(Ot&&J.mode&1){var Yt=Vk(O);if(Yt!==null){(Yt.flags&65536)===0&&(Yt.flags|=256),Gk(Yt,O,J,N,i),dl(pl(oe,J));break e}}N=oe=pl(oe,J),cn!==4&&(cn=2),Yc===null?Yc=[N]:Yc.push(N),N=O;do{switch(N.tag){case 3:N.flags|=65536,i&=-i,N.lanes|=i;var he=Uk(N,oe,i);Td(N,he);break e;case 1:J=oe;var ie=N.type,me=N.stateNode;if((N.flags&128)===0&&(typeof ie.getDerivedStateFromError=="function"||me!==null&&typeof me.componentDidCatch=="function"&&(za===null||!za.has(me)))){N.flags|=65536,i&=-i,N.lanes|=i;var $e=Hk(N,J,i);Td(N,$e);break e}}N=N.return}while(N!==null)}S1(d)}catch(Qe){i=Qe,en===d&&d!==null&&(en=d=d.return);continue}break}while(!0)}function k1(){var a=Bd.current;return Bd.current=Od,a===null?Od:a}function Kp(){(cn===0||cn===3||cn===2)&&(cn=4),xn===null||(Jo&268435455)===0&&(zd&268435455)===0||Wa(xn,Sn)}function Kd(a,i){var d=Nt;Nt|=2;var g=k1();(xn!==a||Sn!==i)&&(oa=null,ti(a,i));do try{cO();break}catch(x){b1(a,x)}while(!0);if(te(),Nt=d,Bd.current=g,en!==null)throw Error(n(261));return xn=null,Sn=0,cn}function cO(){for(;en!==null;)N1(en)}function uO(){for(;en!==null&&!gt();)N1(en)}function N1(a){var i=E1(a.alternate,a,pr);a.memoizedProps=a.pendingProps,i===null?S1(a):en=i,Fp.current=null}function S1(a){var i=a;do{var d=i.alternate;if(a=i.return,(i.flags&32768)===0){if(d=nO(d,i,pr),d!==null){en=d;return}}else{if(d=rO(d,i),d!==null){d.flags&=32767,en=d;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{cn=6,en=null;return}}if(i=i.sibling,i!==null){en=i;return}en=i=a}while(i!==null);cn===0&&(cn=5)}function ni(a,i,d){var g=ht,x=Mr.transition;try{Mr.transition=null,ht=1,dO(a,i,d,g)}finally{Mr.transition=x,ht=g}return null}function dO(a,i,d,g){do wl();while(Ua!==null);if((Nt&6)!==0)throw Error(n(327));d=a.finishedWork;var x=a.finishedLanes;if(d===null)return null;if(a.finishedWork=null,a.finishedLanes=0,d===a.current)throw Error(n(177));a.callbackNode=null,a.callbackPriority=0;var N=d.lanes|d.childLanes;if(tp(a,N),a===xn&&(en=xn=null,Sn=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Hd||(Hd=!0,C1(lr,function(){return wl(),null})),N=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||N){N=Mr.transition,Mr.transition=null;var O=ht;ht=1;var J=Nt;Nt|=4,Fp.current=null,aO(a,d),p1(d,a),Xs(Qr),ur=!!Mc,Qr=Mc=null,a.current=d,oO(d),At(),Nt=J,ht=O,Mr.transition=N}else a.current=d;if(Hd&&(Hd=!1,Ua=a,Wd=x),N=a.pendingLanes,N===0&&(za=null),Wr(d.stateNode),tr(a,Ct()),i!==null)for(g=a.onRecoverableError,d=0;d<i.length;d++)x=i[d],g(x.value,{componentStack:x.stack,digest:x.digest});if(Ud)throw Ud=!1,a=zp,zp=null,a;return(Wd&1)!==0&&a.tag!==0&&wl(),N=a.pendingLanes,(N&1)!==0?a===Up?Xc++:(Xc=0,Up=a):Xc=0,Cr(),null}function wl(){if(Ua!==null){var a=td(Wd),i=Mr.transition,d=ht;try{if(Mr.transition=null,ht=16>a?16:a,Ua===null)var g=!1;else{if(a=Ua,Ua=null,Wd=0,(Nt&6)!==0)throw Error(n(331));var x=Nt;for(Nt|=4,Ke=a.current;Ke!==null;){var N=Ke,O=N.child;if((Ke.flags&16)!==0){var J=N.deletions;if(J!==null){for(var oe=0;oe<J.length;oe++){var we=J[oe];for(Ke=we;Ke!==null;){var Te=Ke;switch(Te.tag){case 0:case 11:case 15:Gc(8,Te,N)}var Me=Te.child;if(Me!==null)Me.return=Te,Ke=Me;else for(;Ke!==null;){Te=Ke;var Ee=Te.sibling,We=Te.return;if(c1(Te),Te===we){Ke=null;break}if(Ee!==null){Ee.return=We,Ke=Ee;break}Ke=We}}}var Xe=N.alternate;if(Xe!==null){var Ze=Xe.child;if(Ze!==null){Xe.child=null;do{var Yt=Ze.sibling;Ze.sibling=null,Ze=Yt}while(Ze!==null)}}Ke=N}}if((N.subtreeFlags&2064)!==0&&O!==null)O.return=N,Ke=O;else e:for(;Ke!==null;){if(N=Ke,(N.flags&2048)!==0)switch(N.tag){case 0:case 11:case 15:Gc(9,N,N.return)}var he=N.sibling;if(he!==null){he.return=N.return,Ke=he;break e}Ke=N.return}}var ie=a.current;for(Ke=ie;Ke!==null;){O=Ke;var me=O.child;if((O.subtreeFlags&2064)!==0&&me!==null)me.return=O,Ke=me;else e:for(O=ie;Ke!==null;){if(J=Ke,(J.flags&2048)!==0)try{switch(J.tag){case 0:case 11:case 15:qd(9,J)}}catch(Qe){Ht(J,J.return,Qe)}if(J===O){Ke=null;break e}var $e=J.sibling;if($e!==null){$e.return=J.return,Ke=$e;break e}Ke=J.return}}if(Nt=x,Cr(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(cr,a)}catch{}g=!0}return g}finally{ht=d,Mr.transition=i}}return!1}function j1(a,i,d){i=pl(d,i),i=Uk(a,i,1),a=os(a,i,1),i=Hn(),a!==null&&(po(a,1,i),tr(a,i))}function Ht(a,i,d){if(a.tag===3)j1(a,a,d);else for(;i!==null;){if(i.tag===3){j1(i,a,d);break}else if(i.tag===1){var g=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(za===null||!za.has(g))){a=pl(d,a),a=Hk(i,a,1),i=os(i,a,1),a=Hn(),i!==null&&(po(i,1,a),tr(i,a));break}}i=i.return}}function hO(a,i,d){var g=a.pingCache;g!==null&&g.delete(i),i=Hn(),a.pingedLanes|=a.suspendedLanes&d,xn===a&&(Sn&d)===d&&(cn===4||cn===3&&(Sn&130023424)===Sn&&500>Ct()-Bp?ti(a,0):qp|=d),tr(a,i)}function _1(a,i){i===0&&((a.mode&1)===0?i=1:(i=Ti,Ti<<=1,(Ti&130023424)===0&&(Ti=4194304)));var d=Hn();a=ft(a,i),a!==null&&(po(a,i,d),tr(a,d))}function fO(a){var i=a.memoizedState,d=0;i!==null&&(d=i.retryLane),_1(a,d)}function pO(a,i){var d=0;switch(a.tag){case 13:var g=a.stateNode,x=a.memoizedState;x!==null&&(d=x.retryLane);break;case 19:g=a.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(i),_1(a,d)}var E1;E1=function(a,i,d){if(a!==null)if(a.memoizedProps!==i.pendingProps||kn.current)Jn=!0;else{if((a.lanes&d)===0&&(i.flags&128)===0)return Jn=!1,tO(a,i,d);Jn=(a.flags&131072)!==0}else Jn=!1,Ot&&(i.flags&1048576)!==0&&Oc(i,Uo,i.index);switch(i.lanes=0,i.tag){case 2:var g=i.type;Dd(a,i),a=i.pendingProps;var x=ns(i,an.current);Oe(i,d),x=wp(null,i,g,a,x,d);var N=vp();return i.flags|=1,typeof x=="object"&&x!==null&&typeof x.render=="function"&&x.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,yn(g)?(N=!0,ol(i)):N=!1,i.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,sa(i),x.updater=Ld,i.stateNode=x,x._reactInternals=i,jp(i,g,a,d),i=Tp(null,i,g,!0,N,d)):(i.tag=0,Ot&&N&&Lc(i),Un(null,i,x,d),i=i.child),i;case 16:g=i.elementType;e:{switch(Dd(a,i),a=i.pendingProps,x=g._init,g=x(g._payload),i.type=g,x=i.tag=gO(g),a=ls(g,a),x){case 0:i=Cp(null,i,g,a,d);break e;case 1:i=Jk(null,i,g,a,d);break e;case 11:i=Kk(null,i,g,a,d);break e;case 14:i=Yk(null,i,g,ls(g.type,a),d);break e}throw Error(n(306,g,""))}return i;case 0:return g=i.type,x=i.pendingProps,x=i.elementType===g?x:ls(g,x),Cp(a,i,g,x,d);case 1:return g=i.type,x=i.pendingProps,x=i.elementType===g?x:ls(g,x),Jk(a,i,g,x,d);case 3:e:{if(e1(i),a===null)throw Error(n(387));g=i.pendingProps,N=i.memoizedState,x=N.element,Yo(a,i),Xo(i,g,null,d);var O=i.memoizedState;if(g=O.element,N.isDehydrated)if(N={element:g,isDehydrated:!1,cache:O.cache,pendingSuspenseBoundaries:O.pendingSuspenseBoundaries,transitions:O.transitions},i.updateQueue.baseState=N,i.memoizedState=N,i.flags&256){x=pl(Error(n(423)),i),i=t1(a,i,g,d,x);break e}else if(g!==x){x=pl(Error(n(424)),i),i=t1(a,i,g,d,x);break e}else for(wn=Cs(i.stateNode.containerInfo.firstChild),Rn=i,Ot=!0,on=null,d=Bc(i,null,g,d),i.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Pa(),g===x){i=aa(a,i,d);break e}Un(a,i,g,d)}i=i.child}return i;case 5:return wk(i),a===null&&Pc(i),g=i.type,x=i.pendingProps,N=a!==null?a.memoizedProps:null,O=x.children,Lo(g,x)?O=null:N!==null&&Lo(g,N)&&(i.flags|=32),Qk(a,i),Un(a,i,O,d),i.child;case 6:return a===null&&Pc(i),null;case 13:return n1(a,i,d);case 4:return hp(i,i.stateNode.containerInfo),g=i.pendingProps,a===null?i.child=ra(i,null,g,d):Un(a,i,g,d),i.child;case 11:return g=i.type,x=i.pendingProps,x=i.elementType===g?x:ls(g,x),Kk(a,i,g,x,d);case 7:return Un(a,i,i.pendingProps,d),i.child;case 8:return Un(a,i,i.pendingProps.children,d),i.child;case 12:return Un(a,i,i.pendingProps.children,d),i.child;case 10:e:{if(g=i.type._context,x=i.pendingProps,N=i.memoizedProps,O=x.value,Rt(Ko,g._currentValue),g._currentValue=O,N!==null)if(Xn(N.value,O)){if(N.children===x.children&&!kn.current){i=aa(a,i,d);break e}}else for(N=i.child,N!==null&&(N.return=i);N!==null;){var J=N.dependencies;if(J!==null){O=N.child;for(var oe=J.firstContext;oe!==null;){if(oe.context===g){if(N.tag===1){oe=as(-1,d&-d),oe.tag=2;var we=N.updateQueue;if(we!==null){we=we.shared;var Te=we.pending;Te===null?oe.next=oe:(oe.next=Te.next,Te.next=oe),we.pending=oe}}N.lanes|=d,oe=N.alternate,oe!==null&&(oe.lanes|=d),je(N.return,d,i),J.lanes|=d;break}oe=oe.next}}else if(N.tag===10)O=N.type===i.type?null:N.child;else if(N.tag===18){if(O=N.return,O===null)throw Error(n(341));O.lanes|=d,J=O.alternate,J!==null&&(J.lanes|=d),je(O,d,i),O=N.sibling}else O=N.child;if(O!==null)O.return=N;else for(O=N;O!==null;){if(O===i){O=null;break}if(N=O.sibling,N!==null){N.return=O.return,O=N;break}O=O.return}N=O}Un(a,i,x.children,d),i=i.child}return i;case 9:return x=i.type,g=i.pendingProps.children,Oe(i,d),x=Be(x),g=g(x),i.flags|=1,Un(a,i,g,d),i.child;case 14:return g=i.type,x=ls(g,i.pendingProps),x=ls(g.type,x),Yk(a,i,g,x,d);case 15:return Xk(a,i,i.type,i.pendingProps,d);case 17:return g=i.type,x=i.pendingProps,x=i.elementType===g?x:ls(g,x),Dd(a,i),i.tag=1,yn(g)?(a=!0,ol(i)):a=!1,Oe(i,d),Bk(i,g,x),jp(i,g,x,d),Tp(null,i,g,!0,a,d);case 19:return s1(a,i,d);case 22:return Zk(a,i,d)}throw Error(n(156,i.tag))};function C1(a,i){return tt(a,i)}function mO(a,i,d,g){this.tag=a,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ir(a,i,d,g){return new mO(a,i,d,g)}function Yp(a){return a=a.prototype,!(!a||!a.isReactComponent)}function gO(a){if(typeof a=="function")return Yp(a)?1:0;if(a!=null){if(a=a.$$typeof,a===ne)return 11;if(a===X)return 14}return 2}function Va(a,i){var d=a.alternate;return d===null?(d=Ir(a.tag,i,a.key,a.mode),d.elementType=a.elementType,d.type=a.type,d.stateNode=a.stateNode,d.alternate=a,a.alternate=d):(d.pendingProps=i,d.type=a.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=a.flags&14680064,d.childLanes=a.childLanes,d.lanes=a.lanes,d.child=a.child,d.memoizedProps=a.memoizedProps,d.memoizedState=a.memoizedState,d.updateQueue=a.updateQueue,i=a.dependencies,d.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},d.sibling=a.sibling,d.index=a.index,d.ref=a.ref,d}function Yd(a,i,d,g,x,N){var O=2;if(g=a,typeof a=="function")Yp(a)&&(O=1);else if(typeof a=="string")O=5;else e:switch(a){case $:return ri(d.children,x,N,i);case q:O=8,x|=8;break;case B:return a=Ir(12,d,i,x|2),a.elementType=B,a.lanes=N,a;case ee:return a=Ir(13,d,i,x),a.elementType=ee,a.lanes=N,a;case M:return a=Ir(19,d,i,x),a.elementType=M,a.lanes=N,a;case G:return Xd(d,x,N,i);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case P:O=10;break e;case W:O=9;break e;case ne:O=11;break e;case X:O=14;break e;case V:O=16,g=null;break e}throw Error(n(130,a==null?a:typeof a,""))}return i=Ir(O,d,i,x),i.elementType=a,i.type=g,i.lanes=N,i}function ri(a,i,d,g){return a=Ir(7,a,g,i),a.lanes=d,a}function Xd(a,i,d,g){return a=Ir(22,a,g,i),a.elementType=G,a.lanes=d,a.stateNode={isHidden:!1},a}function Xp(a,i,d){return a=Ir(6,a,null,i),a.lanes=d,a}function Zp(a,i,d){return i=Ir(4,a.children!==null?a.children:[],a.key,i),i.lanes=d,i.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},i}function yO(a,i,d,g,x){this.tag=i,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=cc(0),this.expirationTimes=cc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cc(0),this.identifierPrefix=g,this.onRecoverableError=x,this.mutableSourceEagerHydrationData=null}function Qp(a,i,d,g,x,N,O,J,oe){return a=new yO(a,i,d,J,oe),i===1?(i=1,N===!0&&(i|=8)):i=0,N=Ir(3,null,null,i),a.current=N,N.stateNode=a,N.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},sa(N),a}function wO(a,i,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:I,key:g==null?null:""+g,children:a,containerInfo:i,implementation:d}}function T1(a){if(!a)return Zn;a=a._reactInternals;e:{if(Pn(a)!==a||a.tag!==1)throw Error(n(170));var i=a;do{switch(i.tag){case 3:i=i.stateNode.context;break e;case 1:if(yn(i.type)){i=i.stateNode.__reactInternalMemoizedMergedChildContext;break e}}i=i.return}while(i!==null);throw Error(n(171))}if(a.tag===1){var d=a.type;if(yn(d))return zn(a,d,i)}return i}function R1(a,i,d,g,x,N,O,J,oe){return a=Qp(d,g,!0,a,x,N,O,J,oe),a.context=T1(null),d=a.current,g=Hn(),x=Ha(d),N=as(g,x),N.callback=i??null,os(d,N,x),a.current.lanes=x,po(a,x,g),tr(a,g),a}function Zd(a,i,d,g){var x=i.current,N=Hn(),O=Ha(x);return d=T1(d),i.context===null?i.context=d:i.pendingContext=d,i=as(N,O),i.payload={element:a},g=g===void 0?null:g,g!==null&&(i.callback=g),a=os(x,i,O),a!==null&&(ds(a,x,O,N),Da(a,x,O)),O}function Qd(a){if(a=a.current,!a.child)return null;switch(a.child.tag){case 5:return a.child.stateNode;default:return a.child.stateNode}}function A1(a,i){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var d=a.retryLane;a.retryLane=d!==0&&d<i?d:i}}function Jp(a,i){A1(a,i),(a=a.alternate)&&A1(a,i)}function vO(){return null}var M1=typeof reportError=="function"?reportError:function(a){console.error(a)};function em(a){this._internalRoot=a}Jd.prototype.render=em.prototype.render=function(a){var i=this._internalRoot;if(i===null)throw Error(n(409));Zd(a,i,null,null)},Jd.prototype.unmount=em.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var i=a.containerInfo;ei(function(){Zd(null,a,null,null)}),i[gn]=null}};function Jd(a){this._internalRoot=a}Jd.prototype.unstable_scheduleHydration=function(a){if(a){var i=Ai();a={blockedOn:null,target:a,priority:i};for(var d=0;d<Kr.length&&i!==0&&i<Kr[d].priority;d++);Kr.splice(d,0,a),d===0&&pc(a)}};function tm(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function eh(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11&&(a.nodeType!==8||a.nodeValue!==" react-mount-point-unstable "))}function I1(){}function xO(a,i,d,g,x){if(x){if(typeof g=="function"){var N=g;g=function(){var we=Qd(O);N.call(we)}}var O=R1(i,g,a,0,null,!1,!1,"",I1);return a._reactRootContainer=O,a[gn]=O.current,Zr(a.nodeType===8?a.parentNode:a),ei(),O}for(;x=a.lastChild;)a.removeChild(x);if(typeof g=="function"){var J=g;g=function(){var we=Qd(oe);J.call(we)}}var oe=Qp(a,0,!1,null,null,!1,!1,"",I1);return a._reactRootContainer=oe,a[gn]=oe.current,Zr(a.nodeType===8?a.parentNode:a),ei(function(){Zd(i,oe,d,g)}),oe}function th(a,i,d,g,x){var N=d._reactRootContainer;if(N){var O=N;if(typeof x=="function"){var J=x;x=function(){var oe=Qd(O);J.call(oe)}}Zd(i,O,a,x)}else O=xO(d,i,a,x,g);return Qd(O)}nd=function(a){switch(a.tag){case 3:var i=a.stateNode;if(i.current.memoizedState.isDehydrated){var d=ho(i.pendingLanes);d!==0&&(uc(i,d|1),tr(i,Ct()),(Nt&6)===0&&(yl=Ct()+500,Cr()))}break;case 13:ei(function(){var g=ft(a,1);if(g!==null){var x=Hn();ds(g,a,1,x)}}),Jp(a,1)}},Dn=function(a){if(a.tag===13){var i=ft(a,134217728);if(i!==null){var d=Hn();ds(i,a,134217728,d)}Jp(a,134217728)}},mo=function(a){if(a.tag===13){var i=Ha(a),d=ft(a,i);if(d!==null){var g=Hn();ds(d,a,i,g)}Jp(a,i)}},Ai=function(){return ht},rd=function(a,i){var d=ht;try{return ht=a,i()}finally{ht=d}},Xt=function(a,i,d){switch(i){case"input":if(ue(a,d),i=d.name,d.type==="radio"&&i!=null){for(d=a;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+i)+'][type="radio"]'),i=0;i<d.length;i++){var g=d[i];if(g!==a&&g.form===a.form){var x=al(g);if(!x)throw Error(n(90));Ge(g),ue(g,x)}}}break;case"textarea":Ce(a,d);break;case"select":i=d.value,i!=null&&Le(a,!!d.multiple,i,!1)}},_n=Vp,Ut=ei;var bO={usingClientEntryPoint:!1,Events:[Fo,es,al,vt,kt,Vp]},Zc={findFiberByHostInstance:Ts,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},kO={bundleType:Zc.bundleType,version:Zc.version,rendererPackageName:Zc.rendererPackageName,rendererConfig:Zc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(a){return a=Je(a),a===null?null:a.stateNode},findFiberByHostInstance:Zc.findFiberByHostInstance||vO,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 nh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nh.isDisabled&&nh.supportsFiber)try{cr=nh.inject(kO),sn=nh}catch{}}return nr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=bO,nr.createPortal=function(a,i){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!tm(i))throw Error(n(200));return wO(a,i,null,d)},nr.createRoot=function(a,i){if(!tm(a))throw Error(n(299));var d=!1,g="",x=M1;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(g=i.identifierPrefix),i.onRecoverableError!==void 0&&(x=i.onRecoverableError)),i=Qp(a,1,!1,null,null,d,!1,g,x),a[gn]=i.current,Zr(a.nodeType===8?a.parentNode:a),new em(i)},nr.findDOMNode=function(a){if(a==null)return null;if(a.nodeType===1)return a;var i=a._reactInternals;if(i===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=Je(i),a=a===null?null:a.stateNode,a},nr.flushSync=function(a){return ei(a)},nr.hydrate=function(a,i,d){if(!eh(i))throw Error(n(200));return th(null,a,i,!0,d)},nr.hydrateRoot=function(a,i,d){if(!tm(a))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,x=!1,N="",O=M1;if(d!=null&&(d.unstable_strictMode===!0&&(x=!0),d.identifierPrefix!==void 0&&(N=d.identifierPrefix),d.onRecoverableError!==void 0&&(O=d.onRecoverableError)),i=R1(i,null,a,1,d??null,x,!1,N,O),a[gn]=i.current,Zr(a),g)for(a=0;a<g.length;a++)d=g[a],x=d._getVersion,x=x(d._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[d,x]:i.mutableSourceEagerHydrationData.push(d,x);return new Jd(i)},nr.render=function(a,i,d){if(!eh(i))throw Error(n(200));return th(null,a,i,!1,d)},nr.unmountComponentAtNode=function(a){if(!eh(a))throw Error(n(40));return a._reactRootContainer?(ei(function(){th(null,null,a,!1,function(){a._reactRootContainer=null,a[gn]=null})}),!0):!1},nr.unstable_batchedUpdates=Vp,nr.unstable_renderSubtreeIntoContainer=function(a,i,d,g){if(!eh(d))throw Error(n(200));if(a==null||a._reactInternals===void 0)throw Error(n(38));return th(a,i,d,!1,g)},nr.version="18.3.1-next-f1338f8080-20240426",nr}var B1;function SR(){if(B1)return sm.exports;B1=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(),sm.exports=TO(),sm.exports}var z1;function RO(){if(z1)return sh;z1=1;var e=SR();return sh.createRoot=e.createRoot,sh.hydrateRoot=e.hydrateRoot,sh}var AO=RO();const MO="modulepreload",IO=function(e){return"/"+e},U1={},ab=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let c=function(p){return Promise.all(p.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=c(n.map(p=>{if(p=IO(p),p in U1)return;U1[p]=!0;const h=p.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":MO,h||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),h)return new Promise((v,S)=>{y.addEventListener("load",v),y.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return s.then(c=>{for(const u of c||[])u.status==="rejected"&&l(u.reason);return t().catch(l)})};var w=qu();const ve=sb(w);function jn(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=jn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var im={exports:{}},lm={},cm={exports:{}},um={};/**
|
|
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 H1;function $O(){if(H1)return um;H1=1;var e=qu();function t(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,l=e.useLayoutEffect,c=e.useDebugValue;function u(m,y){var v=y(),S=r({inst:{value:v,getSnapshot:y}}),b=S[0].inst,_=S[1];return l(function(){b.value=v,b.getSnapshot=y,f(b)&&_({inst:b})},[m,v,y]),s(function(){return f(b)&&_({inst:b}),m(function(){f(b)&&_({inst:b})})},[m]),c(v),v}function f(m){var y=m.getSnapshot;m=m.value;try{var v=y();return!n(m,v)}catch{return!0}}function p(m,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return um.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,um}var W1;function OO(){return W1||(W1=1,cm.exports=$O()),cm.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 V1;function LO(){if(V1)return lm;V1=1;var e=qu(),t=OO();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return lm.useSyncExternalStoreWithSelector=function(p,h,m,y,v){var S=l(null);if(S.current===null){var b={hasValue:!1,value:null};S.current=b}else b=S.current;S=u(function(){function k(I){if(!j){if(j=!0,E=I,I=y(I),v!==void 0&&b.hasValue){var $=b.value;if(v($,I))return C=$}return C=I}if($=C,r(E,I))return $;var q=y(I);return v!==void 0&&v($,q)?(E=I,$):(E=I,C=q)}var j=!1,E,C,R=m===void 0?null:m;return[function(){return k(h())},R===null?void 0:function(){return k(R())}]},[h,m,y,v]);var _=s(p,S[0],S[1]);return c(function(){b.hasValue=!0,b.value=_},[_]),f(_),_},lm}var G1;function PO(){return G1||(G1=1,im.exports=LO()),im.exports}var DO=PO();const FO=sb(DO),qO={},K1=e=>{let t;const n=new Set,r=(h,m)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const v=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(S=>S(t,v))}},s=()=>t,f={setState:r,getState:s,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(qO?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(r,s,f);return f},BO=e=>e?K1(e):K1,{useDebugValue:zO}=ve,{useSyncExternalStoreWithSelector:UO}=FO,HO=e=>e;function jR(e,t=HO,n){const r=UO(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return zO(r),r}const Y1=(e,t)=>{const n=BO(e),r=(s,l=t)=>jR(n,s,l);return Object.assign(r,n),r},WO=(e,t)=>e?Y1(e,t):Y1;function pn(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 VO={value:()=>{}};function gf(){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 Oh(n)}function Oh(e){this._=e}function GO(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}})}Oh.prototype=gf.prototype={constructor:Oh,on:function(e,t){var n=this._,r=GO(e+"",n),s,l=-1,c=r.length;if(arguments.length<2){for(;++l<c;)if((s=(e=r[l]).type)&&(s=KO(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<c;)if(s=(e=r[l]).type)n[s]=X1(n[s],e.name,t);else if(t==null)for(s in n)n[s]=X1(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 Oh(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,l;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],r=0,s=l.length;r<s;++r)l[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,l=r.length;s<l;++s)r[s].value.apply(t,n)}};function KO(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function X1(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=VO,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var d0="http://www.w3.org/1999/xhtml";const Z1={svg:"http://www.w3.org/2000/svg",xhtml:d0,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function yf(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Z1.hasOwnProperty(t)?{space:Z1[t],local:e}:e}function YO(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===d0&&t.documentElement.namespaceURI===d0?t.createElement(e):t.createElementNS(n,e)}}function XO(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _R(e){var t=yf(e);return(t.local?XO:YO)(t)}function ZO(){}function ob(e){return e==null?ZO:function(){return this.querySelector(e)}}function QO(e){typeof e!="function"&&(e=ob(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var l=t[s],c=l.length,u=r[s]=new Array(c),f,p,h=0;h<c;++h)(f=l[h])&&(p=e.call(f,f.__data__,h,l))&&("__data__"in f&&(p.__data__=f.__data__),u[h]=p);return new vr(r,this._parents)}function JO(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function eL(){return[]}function ER(e){return e==null?eL:function(){return this.querySelectorAll(e)}}function tL(e){return function(){return JO(e.apply(this,arguments))}}function nL(e){typeof e=="function"?e=tL(e):e=ER(e);for(var t=this._groups,n=t.length,r=[],s=[],l=0;l<n;++l)for(var c=t[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&(r.push(e.call(f,f.__data__,p,c)),s.push(f));return new vr(r,s)}function CR(e){return function(){return this.matches(e)}}function TR(e){return function(t){return t.matches(e)}}var rL=Array.prototype.find;function sL(e){return function(){return rL.call(this.children,e)}}function aL(){return this.firstElementChild}function oL(e){return this.select(e==null?aL:sL(typeof e=="function"?e:TR(e)))}var iL=Array.prototype.filter;function lL(){return Array.from(this.children)}function cL(e){return function(){return iL.call(this.children,e)}}function uL(e){return this.selectAll(e==null?lL:cL(typeof e=="function"?e:TR(e)))}function dL(e){typeof e!="function"&&(e=CR(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var l=t[s],c=l.length,u=r[s]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new vr(r,this._parents)}function RR(e){return new Array(e.length)}function hL(){return new vr(this._enter||this._groups.map(RR),this._parents)}function Wh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Wh.prototype={constructor:Wh,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 fL(e){return function(){return e}}function pL(e,t,n,r,s,l){for(var c=0,u,f=t.length,p=l.length;c<p;++c)(u=t[c])?(u.__data__=l[c],r[c]=u):n[c]=new Wh(e,l[c]);for(;c<f;++c)(u=t[c])&&(s[c]=u)}function mL(e,t,n,r,s,l,c){var u,f,p=new Map,h=t.length,m=l.length,y=new Array(h),v;for(u=0;u<h;++u)(f=t[u])&&(y[u]=v=c.call(f,f.__data__,u,t)+"",p.has(v)?s[u]=f:p.set(v,f));for(u=0;u<m;++u)v=c.call(e,l[u],u,l)+"",(f=p.get(v))?(r[u]=f,f.__data__=l[u],p.delete(v)):n[u]=new Wh(e,l[u]);for(u=0;u<h;++u)(f=t[u])&&p.get(y[u])===f&&(s[u]=f)}function gL(e){return e.__data__}function yL(e,t){if(!arguments.length)return Array.from(this,gL);var n=t?mL:pL,r=this._parents,s=this._groups;typeof e!="function"&&(e=fL(e));for(var l=s.length,c=new Array(l),u=new Array(l),f=new Array(l),p=0;p<l;++p){var h=r[p],m=s[p],y=m.length,v=wL(e.call(h,h&&h.__data__,p,r)),S=v.length,b=u[p]=new Array(S),_=c[p]=new Array(S),k=f[p]=new Array(y);n(h,m,b,_,k,v,t);for(var j=0,E=0,C,R;j<S;++j)if(C=b[j]){for(j>=E&&(E=j+1);!(R=_[E])&&++E<S;);C._next=R||null}}return c=new vr(c,r),c._enter=u,c._exit=f,c}function wL(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function vL(){return new vr(this._exit||this._groups.map(RR),this._parents)}function xL(e,t,n){var r=this.enter(),s=this,l=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?l.remove():n(l),r&&s?r.merge(s).order():s}function bL(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,l=r.length,c=Math.min(s,l),u=new Array(s),f=0;f<c;++f)for(var p=n[f],h=r[f],m=p.length,y=u[f]=new Array(m),v,S=0;S<m;++S)(v=p[S]||h[S])&&(y[S]=v);for(;f<s;++f)u[f]=n[f];return new vr(u,this._parents)}function kL(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,l=r[s],c;--s>=0;)(c=r[s])&&(l&&c.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(c,l),l=c);return this}function NL(e){e||(e=SL);function t(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var n=this._groups,r=n.length,s=new Array(r),l=0;l<r;++l){for(var c=n[l],u=c.length,f=s[l]=new Array(u),p,h=0;h<u;++h)(p=c[h])&&(f[h]=p);f.sort(t)}return new vr(s,this._parents).order()}function SL(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function jL(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function _L(){return Array.from(this)}function EL(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,l=r.length;s<l;++s){var c=r[s];if(c)return c}return null}function CL(){let e=0;for(const t of this)++e;return e}function TL(){return!this.node()}function RL(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],l=0,c=s.length,u;l<c;++l)(u=s[l])&&e.call(u,u.__data__,l,s);return this}function AL(e){return function(){this.removeAttribute(e)}}function ML(e){return function(){this.removeAttributeNS(e.space,e.local)}}function IL(e,t){return function(){this.setAttribute(e,t)}}function $L(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function OL(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function LL(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 PL(e,t){var n=yf(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?ML:AL:typeof t=="function"?n.local?LL:OL:n.local?$L:IL)(n,t))}function AR(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function DL(e){return function(){this.style.removeProperty(e)}}function FL(e,t,n){return function(){this.style.setProperty(e,t,n)}}function qL(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function BL(e,t,n){return arguments.length>1?this.each((t==null?DL:typeof t=="function"?qL:FL)(e,t,n??"")):Ul(this.node(),e)}function Ul(e,t){return e.style.getPropertyValue(t)||AR(e).getComputedStyle(e,null).getPropertyValue(t)}function zL(e){return function(){delete this[e]}}function UL(e,t){return function(){this[e]=t}}function HL(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function WL(e,t){return arguments.length>1?this.each((t==null?zL:typeof t=="function"?HL:UL)(e,t)):this.node()[e]}function MR(e){return e.trim().split(/^|\s+/)}function ib(e){return e.classList||new IR(e)}function IR(e){this._node=e,this._names=MR(e.getAttribute("class")||"")}IR.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 $R(e,t){for(var n=ib(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function OR(e,t){for(var n=ib(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function VL(e){return function(){$R(this,e)}}function GL(e){return function(){OR(this,e)}}function KL(e,t){return function(){(t.apply(this,arguments)?$R:OR)(this,e)}}function YL(e,t){var n=MR(e+"");if(arguments.length<2){for(var r=ib(this.node()),s=-1,l=n.length;++s<l;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?KL:t?VL:GL)(n,t))}function XL(){this.textContent=""}function ZL(e){return function(){this.textContent=e}}function QL(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function JL(e){return arguments.length?this.each(e==null?XL:(typeof e=="function"?QL:ZL)(e)):this.node().textContent}function e3(){this.innerHTML=""}function t3(e){return function(){this.innerHTML=e}}function n3(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function r3(e){return arguments.length?this.each(e==null?e3:(typeof e=="function"?n3:t3)(e)):this.node().innerHTML}function s3(){this.nextSibling&&this.parentNode.appendChild(this)}function a3(){return this.each(s3)}function o3(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function i3(){return this.each(o3)}function l3(e){var t=typeof e=="function"?e:_R(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function c3(){return null}function u3(e,t){var n=typeof e=="function"?e:_R(e),r=t==null?c3:typeof t=="function"?t:ob(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function d3(){var e=this.parentNode;e&&e.removeChild(this)}function h3(){return this.each(d3)}function f3(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function p3(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function m3(e){return this.select(e?p3:f3)}function g3(e){return arguments.length?this.property("__data__",e):this.node().__data__}function y3(e){return function(t){e.call(this,t,this.__data__)}}function w3(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 v3(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,l;n<s;++n)l=t[n],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++r]=l;++r?t.length=r:delete this.__on}}}function x3(e,t,n){return function(){var r=this.__on,s,l=y3(t);if(r){for(var c=0,u=r.length;c<u;++c)if((s=r[c]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=l,s.options=n),s.value=t;return}}this.addEventListener(e.type,l,n),s={type:e.type,name:e.name,value:t,listener:l,options:n},r?r.push(s):this.__on=[s]}}function b3(e,t,n){var r=w3(e+""),s,l=r.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,p=u.length,h;f<p;++f)for(s=0,h=u[f];s<l;++s)if((c=r[s]).type===h.type&&c.name===h.name)return h.value}return}for(u=t?x3:v3,s=0;s<l;++s)this.each(u(r[s],t,n));return this}function LR(e,t,n){var r=AR(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 k3(e,t){return function(){return LR(this,e,t)}}function N3(e,t){return function(){return LR(this,e,t.apply(this,arguments))}}function S3(e,t){return this.each((typeof t=="function"?N3:k3)(e,t))}function*j3(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,l=r.length,c;s<l;++s)(c=r[s])&&(yield c)}var PR=[null];function vr(e,t){this._groups=e,this._parents=t}function Bu(){return new vr([[document.documentElement]],PR)}function _3(){return this}vr.prototype=Bu.prototype={constructor:vr,select:QO,selectAll:nL,selectChild:oL,selectChildren:uL,filter:dL,data:yL,enter:hL,exit:vL,join:xL,merge:bL,selection:_3,order:kL,sort:NL,call:jL,nodes:_L,node:EL,size:CL,empty:TL,each:RL,attr:PL,style:BL,property:WL,classed:YL,text:JL,html:r3,raise:a3,lower:i3,append:l3,insert:u3,remove:h3,clone:m3,datum:g3,on:b3,dispatch:S3,[Symbol.iterator]:j3};function Lr(e){return typeof e=="string"?new vr([[document.querySelector(e)]],[document.documentElement]):new vr([[e]],PR)}function E3(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fs(e,t){if(e=E3(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 C3={passive:!1},xu={capture:!0,passive:!1};function dm(e){e.stopImmediatePropagation()}function Dl(e){e.preventDefault(),e.stopImmediatePropagation()}function DR(e){var t=e.document.documentElement,n=Lr(e).on("dragstart.drag",Dl,xu);"onselectstart"in t?n.on("selectstart.drag",Dl,xu):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function FR(e,t){var n=e.document.documentElement,r=Lr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Dl,xu),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 ah=e=>()=>e;function h0(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:l,x:c,y:u,dx:f,dy:p,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}h0.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function T3(e){return!e.ctrlKey&&!e.button}function R3(){return this.parentNode}function A3(e,t){return t??{x:e.x,y:e.y}}function M3(){return navigator.maxTouchPoints||"ontouchstart"in this}function I3(){var e=T3,t=R3,n=A3,r=M3,s={},l=gf("start","drag","end"),c=0,u,f,p,h,m=0;function y(C){C.on("mousedown.drag",v).filter(r).on("touchstart.drag",_).on("touchmove.drag",k,C3).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(C,R){if(!(h||!e.call(this,C,R))){var I=E(this,t.call(this,C,R),C,R,"mouse");I&&(Lr(C.view).on("mousemove.drag",S,xu).on("mouseup.drag",b,xu),DR(C.view),dm(C),p=!1,u=C.clientX,f=C.clientY,I("start",C))}}function S(C){if(Dl(C),!p){var R=C.clientX-u,I=C.clientY-f;p=R*R+I*I>m}s.mouse("drag",C)}function b(C){Lr(C.view).on("mousemove.drag mouseup.drag",null),FR(C.view,p),Dl(C),s.mouse("end",C)}function _(C,R){if(e.call(this,C,R)){var I=C.changedTouches,$=t.call(this,C,R),q=I.length,B,P;for(B=0;B<q;++B)(P=E(this,$,C,R,I[B].identifier,I[B]))&&(dm(C),P("start",C,I[B]))}}function k(C){var R=C.changedTouches,I=R.length,$,q;for($=0;$<I;++$)(q=s[R[$].identifier])&&(Dl(C),q("drag",C,R[$]))}function j(C){var R=C.changedTouches,I=R.length,$,q;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),$=0;$<I;++$)(q=s[R[$].identifier])&&(dm(C),q("end",C,R[$]))}function E(C,R,I,$,q,B){var P=l.copy(),W=fs(B||I,R),ne,ee,M;if((M=n.call(C,new h0("beforestart",{sourceEvent:I,target:y,identifier:q,active:c,x:W[0],y:W[1],dx:0,dy:0,dispatch:P}),$))!=null)return ne=M.x-W[0]||0,ee=M.y-W[1]||0,function X(V,G,F){var L=W,H;switch(V){case"start":s[q]=X,H=c++;break;case"end":delete s[q],--c;case"drag":W=fs(F||G,R),H=c;break}P.call(V,C,new h0(V,{sourceEvent:G,subject:M,target:y,identifier:q,active:H,x:W[0]+ne,y:W[1]+ee,dx:W[0]-L[0],dy:W[1]-L[1],dispatch:P}),$)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:ah(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:ah(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:ah(C),y):n},y.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:ah(!!C),y):r},y.on=function(){var C=l.on.apply(l,arguments);return C===l?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function lb(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function qR(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function zu(){}var bu=.7,Vh=1/bu,Fl="\\s*([+-]?\\d+)\\s*",ku="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ds="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$3=/^#([0-9a-f]{3,8})$/,O3=new RegExp(`^rgb\\(${Fl},${Fl},${Fl}\\)$`),L3=new RegExp(`^rgb\\(${Ds},${Ds},${Ds}\\)$`),P3=new RegExp(`^rgba\\(${Fl},${Fl},${Fl},${ku}\\)$`),D3=new RegExp(`^rgba\\(${Ds},${Ds},${Ds},${ku}\\)$`),F3=new RegExp(`^hsl\\(${ku},${Ds},${Ds}\\)$`),q3=new RegExp(`^hsla\\(${ku},${Ds},${Ds},${ku}\\)$`),Q1={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};lb(zu,Nu,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:J1,formatHex:J1,formatHex8:B3,formatHsl:z3,formatRgb:eN,toString:eN});function J1(){return this.rgb().formatHex()}function B3(){return this.rgb().formatHex8()}function z3(){return BR(this).formatHsl()}function eN(){return this.rgb().formatRgb()}function Nu(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=$3.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?tN(t):n===3?new sr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?oh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?oh(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=O3.exec(e))?new sr(t[1],t[2],t[3],1):(t=L3.exec(e))?new sr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=P3.exec(e))?oh(t[1],t[2],t[3],t[4]):(t=D3.exec(e))?oh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=F3.exec(e))?sN(t[1],t[2]/100,t[3]/100,1):(t=q3.exec(e))?sN(t[1],t[2]/100,t[3]/100,t[4]):Q1.hasOwnProperty(e)?tN(Q1[e]):e==="transparent"?new sr(NaN,NaN,NaN,0):null}function tN(e){return new sr(e>>16&255,e>>8&255,e&255,1)}function oh(e,t,n,r){return r<=0&&(e=t=n=NaN),new sr(e,t,n,r)}function U3(e){return e instanceof zu||(e=Nu(e)),e?(e=e.rgb(),new sr(e.r,e.g,e.b,e.opacity)):new sr}function f0(e,t,n,r){return arguments.length===1?U3(e):new sr(e,t,n,r??1)}function sr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}lb(sr,f0,qR(zu,{brighter(e){return e=e==null?Vh:Math.pow(Vh,e),new sr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?bu:Math.pow(bu,e),new sr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new sr(ci(this.r),ci(this.g),ci(this.b),Gh(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:nN,formatHex:nN,formatHex8:H3,formatRgb:rN,toString:rN}));function nN(){return`#${ii(this.r)}${ii(this.g)}${ii(this.b)}`}function H3(){return`#${ii(this.r)}${ii(this.g)}${ii(this.b)}${ii((isNaN(this.opacity)?1:this.opacity)*255)}`}function rN(){const e=Gh(this.opacity);return`${e===1?"rgb(":"rgba("}${ci(this.r)}, ${ci(this.g)}, ${ci(this.b)}${e===1?")":`, ${e})`}`}function Gh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ci(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ii(e){return e=ci(e),(e<16?"0":"")+e.toString(16)}function sN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ms(e,t,n,r)}function BR(e){if(e instanceof ms)return new ms(e.h,e.s,e.l,e.opacity);if(e instanceof zu||(e=Nu(e)),!e)return new ms;if(e instanceof ms)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),l=Math.max(t,n,r),c=NaN,u=l-s,f=(l+s)/2;return u?(t===l?c=(n-r)/u+(n<r)*6:n===l?c=(r-t)/u+2:c=(t-n)/u+4,u/=f<.5?l+s:2-l-s,c*=60):u=f>0&&f<1?0:c,new ms(c,u,f,e.opacity)}function W3(e,t,n,r){return arguments.length===1?BR(e):new ms(e,t,n,r??1)}function ms(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}lb(ms,W3,qR(zu,{brighter(e){return e=e==null?Vh:Math.pow(Vh,e),new ms(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?bu:Math.pow(bu,e),new ms(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 sr(hm(e>=240?e-240:e+120,s,r),hm(e,s,r),hm(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new ms(aN(this.h),ih(this.s),ih(this.l),Gh(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=Gh(this.opacity);return`${e===1?"hsl(":"hsla("}${aN(this.h)}, ${ih(this.s)*100}%, ${ih(this.l)*100}%${e===1?")":`, ${e})`}`}}));function aN(e){return e=(e||0)%360,e<0?e+360:e}function ih(e){return Math.max(0,Math.min(1,e||0))}function hm(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 zR=e=>()=>e;function V3(e,t){return function(n){return e+n*t}}function G3(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 K3(e){return(e=+e)==1?UR:function(t,n){return n-t?G3(t,n,e):zR(isNaN(t)?n:t)}}function UR(e,t){var n=t-e;return n?V3(e,n):zR(isNaN(e)?t:e)}const oN=(function e(t){var n=K3(t);function r(s,l){var c=n((s=f0(s)).r,(l=f0(l)).r),u=n(s.g,l.g),f=n(s.b,l.b),p=UR(s.opacity,l.opacity);return function(h){return s.r=c(h),s.g=u(h),s.b=f(h),s.opacity=p(h),s+""}}return r.gamma=e,r})(1);function Qa(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var p0=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fm=new RegExp(p0.source,"g");function Y3(e){return function(){return e}}function X3(e){return function(t){return e(t)+""}}function Z3(e,t){var n=p0.lastIndex=fm.lastIndex=0,r,s,l,c=-1,u=[],f=[];for(e=e+"",t=t+"";(r=p0.exec(e))&&(s=fm.exec(t));)(l=s.index)>n&&(l=t.slice(n,l),u[c]?u[c]+=l:u[++c]=l),(r=r[0])===(s=s[0])?u[c]?u[c]+=s:u[++c]=s:(u[++c]=null,f.push({i:c,x:Qa(r,s)})),n=fm.lastIndex;return n<t.length&&(l=t.slice(n),u[c]?u[c]+=l:u[++c]=l),u.length<2?f[0]?X3(f[0].x):Y3(t):(t=f.length,function(p){for(var h=0,m;h<t;++h)u[(m=f[h]).i]=m.x(p);return u.join("")})}var iN=180/Math.PI,m0={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function HR(e,t,n,r,s,l){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*n+t*r)&&(n-=e*f,r-=t*f),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,f/=u),e*r<t*n&&(e=-e,t=-t,f=-f,c=-c),{translateX:s,translateY:l,rotate:Math.atan2(t,e)*iN,skewX:Math.atan(f)*iN,scaleX:c,scaleY:u}}var lh;function Q3(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?m0:HR(t.a,t.b,t.c,t.d,t.e,t.f)}function J3(e){return e==null||(lh||(lh=document.createElementNS("http://www.w3.org/2000/svg","g")),lh.setAttribute("transform",e),!(e=lh.transform.baseVal.consolidate()))?m0:(e=e.matrix,HR(e.a,e.b,e.c,e.d,e.e,e.f))}function WR(e,t,n,r){function s(p){return p.length?p.pop()+" ":""}function l(p,h,m,y,v,S){if(p!==m||h!==y){var b=v.push("translate(",null,t,null,n);S.push({i:b-4,x:Qa(p,m)},{i:b-2,x:Qa(h,y)})}else(m||y)&&v.push("translate("+m+t+y+n)}function c(p,h,m,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:m.push(s(m)+"rotate(",null,r)-2,x:Qa(p,h)})):h&&m.push(s(m)+"rotate("+h+r)}function u(p,h,m,y){p!==h?y.push({i:m.push(s(m)+"skewX(",null,r)-2,x:Qa(p,h)}):h&&m.push(s(m)+"skewX("+h+r)}function f(p,h,m,y,v,S){if(p!==m||h!==y){var b=v.push(s(v)+"scale(",null,",",null,")");S.push({i:b-4,x:Qa(p,m)},{i:b-2,x:Qa(h,y)})}else(m!==1||y!==1)&&v.push(s(v)+"scale("+m+","+y+")")}return function(p,h){var m=[],y=[];return p=e(p),h=e(h),l(p.translateX,p.translateY,h.translateX,h.translateY,m,y),c(p.rotate,h.rotate,m,y),u(p.skewX,h.skewX,m,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,m,y),p=h=null,function(v){for(var S=-1,b=y.length,_;++S<b;)m[(_=y[S]).i]=_.x(v);return m.join("")}}}var eP=WR(Q3,"px, ","px)","deg)"),tP=WR(J3,", ",")",")"),nP=1e-12;function lN(e){return((e=Math.exp(e))+1/e)/2}function rP(e){return((e=Math.exp(e))-1/e)/2}function sP(e){return((e=Math.exp(2*e))-1)/(e+1)}const aP=(function e(t,n,r){function s(l,c){var u=l[0],f=l[1],p=l[2],h=c[0],m=c[1],y=c[2],v=h-u,S=m-f,b=v*v+S*S,_,k;if(b<nP)k=Math.log(y/p)/t,_=function($){return[u+$*v,f+$*S,p*Math.exp(t*$*k)]};else{var j=Math.sqrt(b),E=(y*y-p*p+r*b)/(2*p*n*j),C=(y*y-p*p-r*b)/(2*y*n*j),R=Math.log(Math.sqrt(E*E+1)-E),I=Math.log(Math.sqrt(C*C+1)-C);k=(I-R)/t,_=function($){var q=$*k,B=lN(R),P=p/(n*j)*(B*sP(t*q+R)-rP(R));return[u+P*v,f+P*S,p*B/lN(t*q+R)]}}return _.duration=k*1e3*t/Math.SQRT2,_}return s.rho=function(l){var c=Math.max(.001,+l),u=c*c,f=u*u;return e(c,u,f)},s})(Math.SQRT2,2,4);var Hl=0,lu=0,Jc=0,VR=1e3,Kh,cu,Yh=0,pi=0,wf=0,Su=typeof performance=="object"&&performance.now?performance:Date,GR=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function cb(){return pi||(GR(oP),pi=Su.now()+wf)}function oP(){pi=0}function Xh(){this._call=this._time=this._next=null}Xh.prototype=KR.prototype={constructor:Xh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?cb():+n)+(t==null?0:+t),!this._next&&cu!==this&&(cu?cu._next=this:Kh=this,cu=this),this._call=e,this._time=n,g0()},stop:function(){this._call&&(this._call=null,this._time=1/0,g0())}};function KR(e,t,n){var r=new Xh;return r.restart(e,t,n),r}function iP(){cb(),++Hl;for(var e=Kh,t;e;)(t=pi-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Hl}function cN(){pi=(Yh=Su.now())+wf,Hl=lu=0;try{iP()}finally{Hl=0,cP(),pi=0}}function lP(){var e=Su.now(),t=e-Yh;t>VR&&(wf-=t,Yh=e)}function cP(){for(var e,t=Kh,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:Kh=n);cu=e,g0(r)}function g0(e){if(!Hl){lu&&(lu=clearTimeout(lu));var t=e-pi;t>24?(e<1/0&&(lu=setTimeout(cN,e-Su.now()-wf)),Jc&&(Jc=clearInterval(Jc))):(Jc||(Yh=Su.now(),Jc=setInterval(lP,VR)),Hl=1,GR(cN))}}function uN(e,t,n){var r=new Xh;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var uP=gf("start","end","cancel","interrupt"),dP=[],YR=0,dN=1,y0=2,Lh=3,hN=4,w0=5,Ph=6;function vf(e,t,n,r,s,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;hP(e,n,{name:t,index:r,group:s,on:uP,tween:dP,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:YR})}function ub(e,t){var n=bs(e,t);if(n.state>YR)throw new Error("too late; already scheduled");return n}function zs(e,t){var n=bs(e,t);if(n.state>Lh)throw new Error("too late; already running");return n}function bs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function hP(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=KR(l,0,n.time);function l(p){n.state=dN,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var h,m,y,v;if(n.state!==dN)return f();for(h in r)if(v=r[h],v.name===n.name){if(v.state===Lh)return uN(c);v.state===hN?(v.state=Ph,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete r[h]):+h<t&&(v.state=Ph,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete r[h])}if(uN(function(){n.state===Lh&&(n.state=hN,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=y0,n.on.call("start",e,e.__data__,n.index,n.group),n.state===y0){for(n.state=Lh,s=new Array(y=n.tween.length),h=0,m=-1;h<y;++h)(v=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(s[++m]=v);s.length=m+1}}function u(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=w0,1),m=-1,y=s.length;++m<y;)s[m].call(e,h);n.state===w0&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Ph,n.timer.stop(),delete r[t];for(var p in r)return;delete e.__transition}}function Dh(e,t){var n=e.__transition,r,s,l=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((r=n[c]).name!==t){l=!1;continue}s=r.state>y0&&r.state<w0,r.state=Ph,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[c]}l&&delete e.__transition}}function fP(e){return this.each(function(){Dh(this,e)})}function pP(e,t){var n,r;return function(){var s=zs(this,e),l=s.tween;if(l!==n){r=n=l;for(var c=0,u=r.length;c<u;++c)if(r[c].name===t){r=r.slice(),r.splice(c,1);break}}s.tween=r}}function mP(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var l=zs(this,e),c=l.tween;if(c!==r){s=(r=c).slice();for(var u={name:t,value:n},f=0,p=s.length;f<p;++f)if(s[f].name===t){s[f]=u;break}f===p&&s.push(u)}l.tween=s}}function gP(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=bs(this.node(),n).tween,s=0,l=r.length,c;s<l;++s)if((c=r[s]).name===e)return c.value;return null}return this.each((t==null?pP:mP)(n,e,t))}function db(e,t,n){var r=e._id;return e.each(function(){var s=zs(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return bs(s,r).value[t]}}function XR(e,t){var n;return(typeof t=="number"?Qa:t instanceof Nu?oN:(n=Nu(t))?(t=n,oN):Z3)(e,t)}function yP(e){return function(){this.removeAttribute(e)}}function wP(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vP(e,t,n){var r,s=n+"",l;return function(){var c=this.getAttribute(e);return c===s?null:c===r?l:l=t(r=c,n)}}function xP(e,t,n){var r,s=n+"",l;return function(){var c=this.getAttributeNS(e.space,e.local);return c===s?null:c===r?l:l=t(r=c,n)}}function bP(e,t,n){var r,s,l;return function(){var c,u=n(this),f;return u==null?void this.removeAttribute(e):(c=this.getAttribute(e),f=u+"",c===f?null:c===r&&f===s?l:(s=f,l=t(r=c,u)))}}function kP(e,t,n){var r,s,l;return function(){var c,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),f=u+"",c===f?null:c===r&&f===s?l:(s=f,l=t(r=c,u)))}}function NP(e,t){var n=yf(e),r=n==="transform"?tP:XR;return this.attrTween(e,typeof t=="function"?(n.local?kP:bP)(n,r,db(this,"attr."+e,t)):t==null?(n.local?wP:yP)(n):(n.local?xP:vP)(n,r,t))}function SP(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function jP(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function _P(e,t){var n,r;function s(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&jP(e,l)),n}return s._value=t,s}function EP(e,t){var n,r;function s(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&SP(e,l)),n}return s._value=t,s}function CP(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=yf(e);return this.tween(n,(r.local?_P:EP)(r,t))}function TP(e,t){return function(){ub(this,e).delay=+t.apply(this,arguments)}}function RP(e,t){return t=+t,function(){ub(this,e).delay=t}}function AP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?TP:RP)(t,e)):bs(this.node(),t).delay}function MP(e,t){return function(){zs(this,e).duration=+t.apply(this,arguments)}}function IP(e,t){return t=+t,function(){zs(this,e).duration=t}}function $P(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?MP:IP)(t,e)):bs(this.node(),t).duration}function OP(e,t){if(typeof t!="function")throw new Error;return function(){zs(this,e).ease=t}}function LP(e){var t=this._id;return arguments.length?this.each(OP(t,e)):bs(this.node(),t).ease}function PP(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;zs(this,e).ease=n}}function DP(e){if(typeof e!="function")throw new Error;return this.each(PP(this._id,e))}function FP(e){typeof e!="function"&&(e=CR(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var l=t[s],c=l.length,u=r[s]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new da(r,this._parents,this._name,this._id)}function qP(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,l=Math.min(r,s),c=new Array(r),u=0;u<l;++u)for(var f=t[u],p=n[u],h=f.length,m=c[u]=new Array(h),y,v=0;v<h;++v)(y=f[v]||p[v])&&(m[v]=y);for(;u<r;++u)c[u]=t[u];return new da(c,this._parents,this._name,this._id)}function BP(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 zP(e,t,n){var r,s,l=BP(t)?ub:zs;return function(){var c=l(this,e),u=c.on;u!==r&&(s=(r=u).copy()).on(t,n),c.on=s}}function UP(e,t){var n=this._id;return arguments.length<2?bs(this.node(),n).on.on(e):this.each(zP(n,e,t))}function HP(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function WP(){return this.on("end.remove",HP(this._id))}function VP(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ob(e));for(var r=this._groups,s=r.length,l=new Array(s),c=0;c<s;++c)for(var u=r[c],f=u.length,p=l[c]=new Array(f),h,m,y=0;y<f;++y)(h=u[y])&&(m=e.call(h,h.__data__,y,u))&&("__data__"in h&&(m.__data__=h.__data__),p[y]=m,vf(p[y],t,n,y,p,bs(h,n)));return new da(l,this._parents,t,n)}function GP(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ER(e));for(var r=this._groups,s=r.length,l=[],c=[],u=0;u<s;++u)for(var f=r[u],p=f.length,h,m=0;m<p;++m)if(h=f[m]){for(var y=e.call(h,h.__data__,m,f),v,S=bs(h,n),b=0,_=y.length;b<_;++b)(v=y[b])&&vf(v,t,n,b,y,S);l.push(y),c.push(h)}return new da(l,c,t,n)}var KP=Bu.prototype.constructor;function YP(){return new KP(this._groups,this._parents)}function XP(e,t){var n,r,s;return function(){var l=Ul(this,e),c=(this.style.removeProperty(e),Ul(this,e));return l===c?null:l===n&&c===r?s:s=t(n=l,r=c)}}function ZR(e){return function(){this.style.removeProperty(e)}}function ZP(e,t,n){var r,s=n+"",l;return function(){var c=Ul(this,e);return c===s?null:c===r?l:l=t(r=c,n)}}function QP(e,t,n){var r,s,l;return function(){var c=Ul(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),Ul(this,e))),c===f?null:c===r&&f===s?l:(s=f,l=t(r=c,u))}}function JP(e,t){var n,r,s,l="style."+t,c="end."+l,u;return function(){var f=zs(this,e),p=f.on,h=f.value[l]==null?u||(u=ZR(t)):void 0;(p!==n||s!==h)&&(r=(n=p).copy()).on(c,s=h),f.on=r}}function e4(e,t,n){var r=(e+="")=="transform"?eP:XR;return t==null?this.styleTween(e,XP(e,r)).on("end.style."+e,ZR(e)):typeof t=="function"?this.styleTween(e,QP(e,r,db(this,"style."+e,t))).each(JP(this._id,e)):this.styleTween(e,ZP(e,r,t),n).on("end.style."+e,null)}function t4(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function n4(e,t,n){var r,s;function l(){var c=t.apply(this,arguments);return c!==s&&(r=(s=c)&&t4(e,c,n)),r}return l._value=t,l}function r4(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,n4(e,t,n??""))}function s4(e){return function(){this.textContent=e}}function a4(e){return function(){var t=e(this);this.textContent=t??""}}function o4(e){return this.tween("text",typeof e=="function"?a4(db(this,"text",e)):s4(e==null?"":e+""))}function i4(e){return function(t){this.textContent=e.call(this,t)}}function l4(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&i4(s)),t}return r._value=e,r}function c4(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,l4(e))}function u4(){for(var e=this._name,t=this._id,n=QR(),r=this._groups,s=r.length,l=0;l<s;++l)for(var c=r[l],u=c.length,f,p=0;p<u;++p)if(f=c[p]){var h=bs(f,t);vf(f,e,n,p,c,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new da(r,this._parents,e,n)}function d4(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(l,c){var u={value:c},f={value:function(){--s===0&&l()}};n.each(function(){var p=zs(this,r),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),p.on=t}),s===0&&l()})}var h4=0;function da(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function QR(){return++h4}var ia=Bu.prototype;da.prototype={constructor:da,select:VP,selectAll:GP,selectChild:ia.selectChild,selectChildren:ia.selectChildren,filter:FP,merge:qP,selection:YP,transition:u4,call:ia.call,nodes:ia.nodes,node:ia.node,size:ia.size,empty:ia.empty,each:ia.each,on:UP,attr:NP,attrTween:CP,style:e4,styleTween:r4,text:o4,textTween:c4,remove:WP,tween:gP,delay:AP,duration:$P,ease:LP,easeVarying:DP,end:d4,[Symbol.iterator]:ia[Symbol.iterator]};function f4(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var p4={time:null,delay:0,duration:250,ease:f4};function m4(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 g4(e){var t,n;e instanceof da?(t=e._id,e=e._name):(t=QR(),(n=p4).time=cb(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,l=0;l<s;++l)for(var c=r[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&vf(f,e,t,p,c,n||m4(f,t));return new da(r,this._parents,e,t)}Bu.prototype.interrupt=fP;Bu.prototype.transition=g4;const ch=e=>()=>e;function y4(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 ca(e,t,n){this.k=e,this.x=t,this.y=n}ca.prototype={constructor:ca,scale:function(e){return e===1?this:new ca(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ca(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 ua=new ca(1,0,0);ca.prototype;function pm(e){e.stopImmediatePropagation()}function eu(e){e.preventDefault(),e.stopImmediatePropagation()}function w4(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function v4(){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 fN(){return this.__zoom||ua}function x4(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function b4(){return navigator.maxTouchPoints||"ontouchstart"in this}function k4(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),c>l?(l+c)/2:Math.min(0,l)||Math.max(0,c))}function JR(){var e=w4,t=v4,n=k4,r=x4,s=b4,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=aP,p=gf("start","zoom","end"),h,m,y,v=500,S=150,b=0,_=10;function k(M){M.property("__zoom",fN).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",P).filter(s).on("touchstart.zoom",W).on("touchmove.zoom",ne).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(M,X,V,G){var F=M.selection?M.selection():M;F.property("__zoom",fN),M!==F?R(M,X,V,G):F.interrupt().each(function(){I(this,arguments).event(G).start().zoom(null,typeof X=="function"?X.apply(this,arguments):X).end()})},k.scaleBy=function(M,X,V,G){k.scaleTo(M,function(){var F=this.__zoom.k,L=typeof X=="function"?X.apply(this,arguments):X;return F*L},V,G)},k.scaleTo=function(M,X,V,G){k.transform(M,function(){var F=t.apply(this,arguments),L=this.__zoom,H=V==null?C(F):typeof V=="function"?V.apply(this,arguments):V,D=L.invert(H),K=typeof X=="function"?X.apply(this,arguments):X;return n(E(j(L,K),H,D),F,c)},V,G)},k.translateBy=function(M,X,V,G){k.transform(M,function(){return n(this.__zoom.translate(typeof X=="function"?X.apply(this,arguments):X,typeof V=="function"?V.apply(this,arguments):V),t.apply(this,arguments),c)},null,G)},k.translateTo=function(M,X,V,G,F){k.transform(M,function(){var L=t.apply(this,arguments),H=this.__zoom,D=G==null?C(L):typeof G=="function"?G.apply(this,arguments):G;return n(ua.translate(D[0],D[1]).scale(H.k).translate(typeof X=="function"?-X.apply(this,arguments):-X,typeof V=="function"?-V.apply(this,arguments):-V),L,c)},G,F)};function j(M,X){return X=Math.max(l[0],Math.min(l[1],X)),X===M.k?M:new ca(X,M.x,M.y)}function E(M,X,V){var G=X[0]-V[0]*M.k,F=X[1]-V[1]*M.k;return G===M.x&&F===M.y?M:new ca(M.k,G,F)}function C(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function R(M,X,V,G){M.on("start.zoom",function(){I(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){I(this,arguments).event(G).end()}).tween("zoom",function(){var F=this,L=arguments,H=I(F,L).event(G),D=t.apply(F,L),K=V==null?C(D):typeof V=="function"?V.apply(F,L):V,re=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),z=F.__zoom,Z=typeof X=="function"?X.apply(F,L):X,U=f(z.invert(K).concat(re/z.k),Z.invert(K).concat(re/Z.k));return function(ae){if(ae===1)ae=Z;else{var le=U(ae),ge=re/le[2];ae=new ca(ge,K[0]-le[0]*ge,K[1]-le[1]*ge)}H.zoom(null,ae)}})}function I(M,X,V){return!V&&M.__zooming||new $(M,X)}function $(M,X){this.that=M,this.args=X,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,X),this.taps=0}$.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,X){return this.mouse&&M!=="mouse"&&(this.mouse[1]=X.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=X.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=X.invert(this.touch1[0])),this.that.__zoom=X,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var X=Lr(this.that).datum();p.call(M,this.that,new y4(M,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:p}),X)}};function q(M,...X){if(!e.apply(this,arguments))return;var V=I(this,X).event(M),G=this.__zoom,F=Math.max(l[0],Math.min(l[1],G.k*Math.pow(2,r.apply(this,arguments)))),L=fs(M);if(V.wheel)(V.mouse[0][0]!==L[0]||V.mouse[0][1]!==L[1])&&(V.mouse[1]=G.invert(V.mouse[0]=L)),clearTimeout(V.wheel);else{if(G.k===F)return;V.mouse=[L,G.invert(L)],Dh(this),V.start()}eu(M),V.wheel=setTimeout(H,S),V.zoom("mouse",n(E(j(G,F),V.mouse[0],V.mouse[1]),V.extent,c));function H(){V.wheel=null,V.end()}}function B(M,...X){if(y||!e.apply(this,arguments))return;var V=M.currentTarget,G=I(this,X,!0).event(M),F=Lr(M.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",re,!0),L=fs(M,V),H=M.clientX,D=M.clientY;DR(M.view),pm(M),G.mouse=[L,this.__zoom.invert(L)],Dh(this),G.start();function K(z){if(eu(z),!G.moved){var Z=z.clientX-H,U=z.clientY-D;G.moved=Z*Z+U*U>b}G.event(z).zoom("mouse",n(E(G.that.__zoom,G.mouse[0]=fs(z,V),G.mouse[1]),G.extent,c))}function re(z){F.on("mousemove.zoom mouseup.zoom",null),FR(z.view,G.moved),eu(z),G.event(z).end()}}function P(M,...X){if(e.apply(this,arguments)){var V=this.__zoom,G=fs(M.changedTouches?M.changedTouches[0]:M,this),F=V.invert(G),L=V.k*(M.shiftKey?.5:2),H=n(E(j(V,L),G,F),t.apply(this,X),c);eu(M),u>0?Lr(this).transition().duration(u).call(R,H,G,M):Lr(this).call(k.transform,H,G,M)}}function W(M,...X){if(e.apply(this,arguments)){var V=M.touches,G=V.length,F=I(this,X,M.changedTouches.length===G).event(M),L,H,D,K;for(pm(M),H=0;H<G;++H)D=V[H],K=fs(D,this),K=[K,this.__zoom.invert(K),D.identifier],F.touch0?!F.touch1&&F.touch0[2]!==K[2]&&(F.touch1=K,F.taps=0):(F.touch0=K,L=!0,F.taps=1+!!h);h&&(h=clearTimeout(h)),L&&(F.taps<2&&(m=K[0],h=setTimeout(function(){h=null},v)),Dh(this),F.start())}}function ne(M,...X){if(this.__zooming){var V=I(this,X).event(M),G=M.changedTouches,F=G.length,L,H,D,K;for(eu(M),L=0;L<F;++L)H=G[L],D=fs(H,this),V.touch0&&V.touch0[2]===H.identifier?V.touch0[0]=D:V.touch1&&V.touch1[2]===H.identifier&&(V.touch1[0]=D);if(H=V.that.__zoom,V.touch1){var re=V.touch0[0],z=V.touch0[1],Z=V.touch1[0],U=V.touch1[1],ae=(ae=Z[0]-re[0])*ae+(ae=Z[1]-re[1])*ae,le=(le=U[0]-z[0])*le+(le=U[1]-z[1])*le;H=j(H,Math.sqrt(ae/le)),D=[(re[0]+Z[0])/2,(re[1]+Z[1])/2],K=[(z[0]+U[0])/2,(z[1]+U[1])/2]}else if(V.touch0)D=V.touch0[0],K=V.touch0[1];else return;V.zoom("touch",n(E(H,D,K),V.extent,c))}}function ee(M,...X){if(this.__zooming){var V=I(this,X).event(M),G=M.changedTouches,F=G.length,L,H;for(pm(M),y&&clearTimeout(y),y=setTimeout(function(){y=null},v),L=0;L<F;++L)H=G[L],V.touch0&&V.touch0[2]===H.identifier?delete V.touch0:V.touch1&&V.touch1[2]===H.identifier&&delete V.touch1;if(V.touch1&&!V.touch0&&(V.touch0=V.touch1,delete V.touch1),V.touch0)V.touch0[1]=this.__zoom.invert(V.touch0[0]);else if(V.end(),V.taps===2&&(H=fs(H,this),Math.hypot(m[0]-H[0],m[1]-H[1])<_)){var D=Lr(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return k.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:ch(+M),k):r},k.filter=function(M){return arguments.length?(e=typeof M=="function"?M:ch(!!M),k):e},k.touchable=function(M){return arguments.length?(s=typeof M=="function"?M:ch(!!M),k):s},k.extent=function(M){return arguments.length?(t=typeof M=="function"?M:ch([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),k):t},k.scaleExtent=function(M){return arguments.length?(l[0]=+M[0],l[1]=+M[1],k):[l[0],l[1]]},k.translateExtent=function(M){return arguments.length?(c[0][0]=+M[0][0],c[1][0]=+M[1][0],c[0][1]=+M[0][1],c[1][1]=+M[1][1],k):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},k.constrain=function(M){return arguments.length?(n=M,k):n},k.duration=function(M){return arguments.length?(u=+M,k):u},k.interpolate=function(M){return arguments.length?(f=M,k):f},k.on=function(){var M=p.on.apply(p,arguments);return M===p?k:M},k.clickDistance=function(M){return arguments.length?(b=(M=+M)*M,k):Math.sqrt(b)},k.tapDistance=function(M){return arguments.length?(_=+M,k):_},k}var On=SR();const xf=w.createContext(null),N4=xf.Provider,ha={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.`},eA=ha.error001();function Et(e,t){const n=w.useContext(xf);if(n===null)throw new Error(eA);return jR(n,e,t)}const tn=()=>{const e=w.useContext(xf);if(e===null)throw new Error(eA);return w.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},S4=e=>e.userSelectionActive?"none":"all";function hb({position:e,children:t,className:n,style:r,...s}){const l=Et(S4),c=`${e}`.split("-");return ve.createElement("div",{className:jn(["react-flow__panel",n,...c]),style:{...r,pointerEvents:l},...s},t)}function j4({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ve.createElement(hb,{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"},ve.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const _4=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:l={},labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...h})=>{const m=w.useRef(null),[y,v]=w.useState({x:0,y:0,width:0,height:0}),S=jn(["react-flow__edge-textwrapper",p]);return w.useEffect(()=>{if(m.current){const b=m.current.getBBox();v({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),typeof n>"u"||!n?null:ve.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:S,visibility:y.width?"visible":"hidden",...h},s&&ve.createElement("rect",{width:y.width+2*c[0],x:-c[0],y:-c[1],height:y.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),ve.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:r},n),f)};var E4=w.memo(_4);const fb=e=>({width:e.offsetWidth,height:e.offsetHeight}),Wl=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),pb=(e={x:0,y:0},t)=>({x:Wl(e.x,t[0][0],t[1][0]),y:Wl(e.y,t[0][1],t[1][1])}),pN=(e,t,n)=>e<t?Wl(Math.abs(e-t),1,50)/50:e>n?-Wl(Math.abs(e-n),1,50)/50:0,tA=(e,t)=>{const n=pN(e.x,35,t.width-35)*20,r=pN(e.y,35,t.height-35)*20;return[n,r]},nA=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},rA=(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)}),ju=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),sA=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),mN=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),C4=(e,t)=>sA(rA(ju(e),ju(t))),v0=(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)},T4=e=>Pr(e.width)&&Pr(e.height)&&Pr(e.x)&&Pr(e.y),Pr=e=>!isNaN(e)&&isFinite(e),Wt=Symbol.for("internals"),aA=["Enter"," ","Escape"],R4=(e,t)=>{},A4=e=>"nativeEvent"in e;function x0(e){var s,l;const t=A4(e)?e.nativeEvent:e,n=((l=(s=t.composedPath)==null?void 0:s.call(t))==null?void 0:l[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const oA=e=>"clientX"in e,so=(e,t)=>{var l,c;const n=oA(e),r=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,s=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Zh=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Uu=({id:e,path:t,labelX:n,labelY:r,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:v=20})=>ve.createElement(ve.Fragment,null,ve.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),v&&ve.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:v,className:"react-flow__edge-interaction"}),s&&Pr(n)&&Pr(r)?ve.createElement(E4,{x:n,y:r,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);Uu.displayName="BaseEdge";function tu(e,t,n){return n===void 0?n:r=>{const s=t().edges.find(l=>l.id===e);s&&n(r,{...s})}}function iA({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,l=n<e?n+s:n-s,c=Math.abs(r-t)/2,u=r<t?r+c:r-c;return[l,u,s,c]}function lA({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:l,targetControlX:c,targetControlY:u}){const f=e*.125+s*.375+c*.375+n*.125,p=t*.125+l*.375+u*.375+r*.125,h=Math.abs(f-e),m=Math.abs(p-t);return[f,p,h,m]}var mi;(function(e){e.Strict="strict",e.Loose="loose"})(mi||(mi={}));var li;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(li||(li={}));var _u;(function(e){e.Partial="partial",e.Full="full"})(_u||(_u={}));var eo;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(eo||(eo={}));var Qh;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Qh||(Qh={}));var nt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(nt||(nt={}));function gN({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===nt.Left||e===nt.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function cA({sourceX:e,sourceY:t,sourcePosition:n=nt.Bottom,targetX:r,targetY:s,targetPosition:l=nt.Top}){const[c,u]=gN({pos:n,x1:e,y1:t,x2:r,y2:s}),[f,p]=gN({pos:l,x1:r,y1:s,x2:e,y2:t}),[h,m,y,v]=lA({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${c},${u} ${f},${p} ${r},${s}`,h,m,y,v]}const mb=w.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s=nt.Bottom,targetPosition:l=nt.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:S,interactionWidth:b})=>{const[_,k,j]=cA({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:l});return ve.createElement(Uu,{path:_,labelX:k,labelY:j,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:S,interactionWidth:b})});mb.displayName="SimpleBezierEdge";const yN={[nt.Left]:{x:-1,y:0},[nt.Right]:{x:1,y:0},[nt.Top]:{x:0,y:-1},[nt.Bottom]:{x:0,y:1}},M4=({source:e,sourcePosition:t=nt.Bottom,target:n})=>t===nt.Left||t===nt.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},wN=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function I4({source:e,sourcePosition:t=nt.Bottom,target:n,targetPosition:r=nt.Top,center:s,offset:l}){const c=yN[t],u=yN[r],f={x:e.x+c.x*l,y:e.y+c.y*l},p={x:n.x+u.x*l,y:n.y+u.y*l},h=M4({source:f,sourcePosition:t,target:p}),m=h.x!==0?"x":"y",y=h[m];let v=[],S,b;const _={x:0,y:0},k={x:0,y:0},[j,E,C,R]=iA({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*u[m]===-1){S=s.x??j,b=s.y??E;const $=[{x:S,y:f.y},{x:S,y:p.y}],q=[{x:f.x,y:b},{x:p.x,y:b}];c[m]===y?v=m==="x"?$:q:v=m==="x"?q:$}else{const $=[{x:f.x,y:p.y}],q=[{x:p.x,y:f.y}];if(m==="x"?v=c.x===y?q:$:v=c.y===y?$:q,t===r){const ee=Math.abs(e[m]-n[m]);if(ee<=l){const M=Math.min(l-1,l-ee);c[m]===y?_[m]=(f[m]>e[m]?-1:1)*M:k[m]=(p[m]>n[m]?-1:1)*M}}if(t!==r){const ee=m==="x"?"y":"x",M=c[m]===u[ee],X=f[ee]>p[ee],V=f[ee]<p[ee];(c[m]===1&&(!M&&X||M&&V)||c[m]!==1&&(!M&&V||M&&X))&&(v=m==="x"?$:q)}const B={x:f.x+_.x,y:f.y+_.y},P={x:p.x+k.x,y:p.y+k.y},W=Math.max(Math.abs(B.x-v[0].x),Math.abs(P.x-v[0].x)),ne=Math.max(Math.abs(B.y-v[0].y),Math.abs(P.y-v[0].y));W>=ne?(S=(B.x+P.x)/2,b=v[0].y):(S=v[0].x,b=(B.y+P.y)/2)}return[[e,{x:f.x+_.x,y:f.y+_.y},...v,{x:p.x+k.x,y:p.y+k.y},n],S,b,C,R]}function $4(e,t,n,r){const s=Math.min(wN(e,t)/2,wN(t,n)/2,r),{x:l,y:c}=t;if(e.x===l&&l===n.x||e.y===c&&c===n.y)return`L${l} ${c}`;if(e.y===c){const p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${l+s*p},${c}Q ${l},${c} ${l},${c+s*h}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${l},${c+s*f}Q ${l},${c} ${l+s*u},${c}`}function b0({sourceX:e,sourceY:t,sourcePosition:n=nt.Bottom,targetX:r,targetY:s,targetPosition:l=nt.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[h,m,y,v,S]=I4({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:l,center:{x:u,y:f},offset:p});return[h.reduce((_,k,j)=>{let E="";return j>0&&j<h.length-1?E=$4(h[j-1],k,h[j+1],c):E=`${j===0?"M":"L"}${k.x} ${k.y}`,_+=E,_},""),m,y,v,S]}const bf=w.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:m=nt.Bottom,targetPosition:y=nt.Top,markerEnd:v,markerStart:S,pathOptions:b,interactionWidth:_})=>{const[k,j,E]=b0({sourceX:e,sourceY:t,sourcePosition:m,targetX:n,targetY:r,targetPosition:y,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return ve.createElement(Uu,{path:k,labelX:j,labelY:E,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:v,markerStart:S,interactionWidth:_})});bf.displayName="SmoothStepEdge";const gb=w.memo(e=>{var t;return ve.createElement(bf,{...e,pathOptions:w.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});gb.displayName="StepEdge";function O4({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,l,c,u]=iA({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,l,c,u]}const yb=w.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:v})=>{const[S,b,_]=O4({sourceX:e,sourceY:t,targetX:n,targetY:r});return ve.createElement(Uu,{path:S,labelX:b,labelY:_,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:v})});yb.displayName="StraightEdge";function uh(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vN({pos:e,x1:t,y1:n,x2:r,y2:s,c:l}){switch(e){case nt.Left:return[t-uh(t-r,l),n];case nt.Right:return[t+uh(r-t,l),n];case nt.Top:return[t,n-uh(n-s,l)];case nt.Bottom:return[t,n+uh(s-n,l)]}}function wb({sourceX:e,sourceY:t,sourcePosition:n=nt.Bottom,targetX:r,targetY:s,targetPosition:l=nt.Top,curvature:c=.25}){const[u,f]=vN({pos:n,x1:e,y1:t,x2:r,y2:s,c}),[p,h]=vN({pos:l,x1:r,y1:s,x2:e,y2:t,c}),[m,y,v,S]=lA({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${u},${f} ${p},${h} ${r},${s}`,m,y,v,S]}const Jh=w.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s=nt.Bottom,targetPosition:l=nt.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:S,pathOptions:b,interactionWidth:_})=>{const[k,j,E]=wb({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:l,curvature:b==null?void 0:b.curvature});return ve.createElement(Uu,{path:k,labelX:j,labelY:E,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:S,interactionWidth:_})});Jh.displayName="BezierEdge";const vb=w.createContext(null),L4=vb.Provider;vb.Consumer;const P4=()=>w.useContext(vb),D4=e=>"id"in e&&"source"in e&&"target"in e,F4=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,k0=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,q4=(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)),B4=(e,t)=>{if(!e.source||!e.target)return t;let n;return D4(e)?n={...e}:n={...e,id:F4(e)},q4(n,t)?t:t.concat(n)},N0=({x:e,y:t},[n,r,s],l,[c,u])=>{const f={x:(e-n)/s,y:(t-r)/s};return l?{x:c*Math.round(f.x/c),y:u*Math.round(f.y/u)}:f},uA=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r}),ui=(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}},kf=(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:l,y:c}=ui(s,t).positionAbsolute;return rA(r,ju({x:l,y:c,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return sA(n)},dA=(e,t,[n,r,s]=[0,0,1],l=!1,c=!1,u=[0,0])=>{const f={x:(t.x-n)/s,y:(t.y-r)/s,width:t.width/s,height:t.height/s},p=[];return e.forEach(h=>{const{width:m,height:y,selectable:v=!0,hidden:S=!1}=h;if(c&&!v||S)return!1;const{positionAbsolute:b}=ui(h,u),_={x:b.x,y:b.y,width:m||0,height:y||0},k=v0(f,_),j=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&k>0,C=(m||0)*(y||0);(j||E||k>=C||h.dragging)&&p.push(h)}),p},hA=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},fA=(e,t,n,r,s,l=.1)=>{const c=t/(e.width*(1+l)),u=n/(e.height*(1+l)),f=Math.min(c,u),p=Wl(f,r,s),h=e.x+e.width/2,m=e.y+e.height/2,y=t/2-h*p,v=n/2-m*p;return{x:y,y:v,zoom:p}},ai=(e,t=0)=>e.transition().duration(t);function xN(e,t,n,r){return(t[n]||[]).reduce((s,l)=>{var c,u;return`${e.id}-${l.id}-${n}`!==r&&s.push({id:l.id||null,type:n,nodeId:e.id,x:(((c=e.positionAbsolute)==null?void 0:c.x)??0)+l.x+l.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+l.y+l.height/2}),s},[])}function z4(e,t,n,r,s,l){const{x:c,y:u}=so(e),p=t.elementsFromPoint(c,u).find(S=>S.classList.contains("react-flow__handle"));if(p){const S=p.getAttribute("data-nodeid");if(S){const b=xb(void 0,p),_=p.getAttribute("data-handleid"),k=l({nodeId:S,id:_,type:b});if(k){const j=s.find(E=>E.nodeId===S&&E.type===b&&E.id===_);return{handle:{id:_,type:b,nodeId:S,x:(j==null?void 0:j.x)||n.x,y:(j==null?void 0:j.y)||n.y},validHandleResult:k}}}}let h=[],m=1/0;if(s.forEach(S=>{const b=Math.sqrt((S.x-n.x)**2+(S.y-n.y)**2);if(b<=r){const _=l(S);b<=m&&(b<m?h=[{handle:S,validHandleResult:_}]:b===m&&h.push({handle:S,validHandleResult:_}),m=b)}}),!h.length)return{handle:null,validHandleResult:pA()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:S})=>S.isValid),v=h.some(({handle:S})=>S.type==="target");return h.find(({handle:S,validHandleResult:b})=>v?S.type==="target":y?b.isValid:!0)||h[0]}const U4={source:null,target:null,sourceHandle:null,targetHandle:null},pA=()=>({handleDomNode:null,isValid:!1,connection:U4,endHandle:null});function mA(e,t,n,r,s,l,c){const u=s==="target",f=c.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...pA(),handleDomNode:f};if(f){const h=xb(void 0,f),m=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),v=f.classList.contains("connectable"),S=f.classList.contains("connectableend"),b={source:u?m:n,sourceHandle:u?y:r,target:u?n:m,targetHandle:u?r:y};p.connection=b,v&&S&&(t===mi.Strict?u&&h==="source"||!u&&h==="target":m!==n||y!==r)&&(p.endHandle={nodeId:m,handleId:y,type:h},p.isValid=l(b))}return p}function H4({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((s,l)=>{if(l[Wt]){const{handleBounds:c}=l[Wt];let u=[],f=[];c&&(u=xN(l,c,"source",`${t}-${n}-${r}`),f=xN(l,c,"target",`${t}-${n}-${r}`)),s.push(...u,...f)}return s},[])}function xb(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function mm(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function W4(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function gA({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:s,getState:l,setState:c,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const h=nA(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:v,connectionRadius:S,onConnectStart:b,panBy:_,getNodes:k,cancelConnection:j}=l();let E=0,C;const{x:R,y:I}=so(e),$=h==null?void 0:h.elementFromPoint(R,I),q=xb(f,$),B=y==null?void 0:y.getBoundingClientRect();if(!B||!q)return;let P,W=so(e,B),ne=!1,ee=null,M=!1,X=null;const V=H4({nodes:k(),nodeId:n,handleId:t,handleType:q}),G=()=>{if(!v)return;const[H,D]=tA(W,B);_({x:H,y:D}),E=requestAnimationFrame(G)};c({connectionPosition:W,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:q,connectionStartHandle:{nodeId:n,handleId:t,type:q},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:q});function F(H){const{transform:D}=l();W=so(H,B);const{handle:K,validHandleResult:re}=z4(H,h,N0(W,D,!1,[1,1]),S,V,z=>mA(z,m,n,t,s?"target":"source",u,h));if(C=K,ne||(G(),ne=!0),X=re.handleDomNode,ee=re.connection,M=re.isValid,c({connectionPosition:C&&M?uA({x:C.x,y:C.y},D):W,connectionStatus:W4(!!C,M),connectionEndHandle:re.endHandle}),!C&&!M&&!X)return mm(P);ee.source!==ee.target&&X&&(mm(P),P=X,X.classList.add("connecting","react-flow__handle-connecting"),X.classList.toggle("valid",M),X.classList.toggle("react-flow__handle-valid",M))}function L(H){var D,K;(C||X)&&ee&&M&&(r==null||r(ee)),(K=(D=l()).onConnectEnd)==null||K.call(D,H),f&&(p==null||p(H)),mm(P),j(),cancelAnimationFrame(E),ne=!1,M=!1,ee=null,X=null,h.removeEventListener("mousemove",F),h.removeEventListener("mouseup",L),h.removeEventListener("touchmove",F),h.removeEventListener("touchend",L)}h.addEventListener("mousemove",F),h.addEventListener("mouseup",L),h.addEventListener("touchmove",F),h.addEventListener("touchend",L)}const bN=()=>!0,V4=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),G4=(e,t,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:l,connectionClickStartHandle:c}=r;return{connecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n,clickConnecting:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.handleId)===t&&(c==null?void 0:c.type)===n}},yA=w.forwardRef(({type:e="source",position:t=nt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:l=!0,id:c,onConnect:u,children:f,className:p,onMouseDown:h,onTouchStart:m,...y},v)=>{var B,P;const S=c||null,b=e==="target",_=tn(),k=P4(),{connectOnClick:j,noPanClassName:E}=Et(V4,pn),{connecting:C,clickConnecting:R}=Et(G4(k,S,e),pn);k||(P=(B=_.getState()).onError)==null||P.call(B,"010",ha.error010());const I=W=>{const{defaultEdgeOptions:ne,onConnect:ee,hasDefaultEdges:M}=_.getState(),X={...ne,...W};if(M){const{edges:V,setEdges:G}=_.getState();G(B4(X,V))}ee==null||ee(X),u==null||u(X)},$=W=>{if(!k)return;const ne=oA(W);s&&(ne&&W.button===0||!ne)&&gA({event:W,handleId:S,nodeId:k,onConnect:I,isTarget:b,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||bN}),ne?h==null||h(W):m==null||m(W)},q=W=>{const{onClickConnectStart:ne,onClickConnectEnd:ee,connectionClickStartHandle:M,connectionMode:X,isValidConnection:V}=_.getState();if(!k||!M&&!s)return;if(!M){ne==null||ne(W,{nodeId:k,handleId:S,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:k,type:e,handleId:S}});return}const G=nA(W.target),F=n||V||bN,{connection:L,isValid:H}=mA({nodeId:k,id:S,type:e},X,M.nodeId,M.handleId||null,M.type,F,G);H&&I(L),ee==null||ee(W),_.setState({connectionClickStartHandle:null})};return ve.createElement("div",{"data-handleid":S,"data-nodeid":k,"data-handlepos":t,"data-id":`${k}-${S}-${e}`,className:jn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!b,target:b,connectable:r,connectablestart:s,connectableend:l,connecting:R,connectionindicator:r&&(s&&!C||l&&C)}]),onMouseDown:$,onTouchStart:$,onClick:j?q:void 0,ref:v,...y},f)});yA.displayName="Handle";var gi=w.memo(yA);const wA=({data:e,isConnectable:t,targetPosition:n=nt.Top,sourcePosition:r=nt.Bottom})=>ve.createElement(ve.Fragment,null,ve.createElement(gi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,ve.createElement(gi,{type:"source",position:r,isConnectable:t}));wA.displayName="DefaultNode";var S0=w.memo(wA);const vA=({data:e,isConnectable:t,sourcePosition:n=nt.Bottom})=>ve.createElement(ve.Fragment,null,e==null?void 0:e.label,ve.createElement(gi,{type:"source",position:n,isConnectable:t}));vA.displayName="InputNode";var xA=w.memo(vA);const bA=({data:e,isConnectable:t,targetPosition:n=nt.Top})=>ve.createElement(ve.Fragment,null,ve.createElement(gi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);bA.displayName="OutputNode";var kA=w.memo(bA);const bb=()=>null;bb.displayName="GroupNode";const K4=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),dh=e=>e.id;function Y4(e,t){return pn(e.selectedNodes.map(dh),t.selectedNodes.map(dh))&&pn(e.selectedEdges.map(dh),t.selectedEdges.map(dh))}const NA=w.memo(({onSelectionChange:e})=>{const t=tn(),{selectedNodes:n,selectedEdges:r}=Et(K4,Y4);return w.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChange.forEach(l=>l(s))},[n,r,e]),null});NA.displayName="SelectionListener";const X4=e=>!!e.onSelectionChange;function Z4({onSelectionChange:e}){const t=Et(X4);return e||t?ve.createElement(NA,{onSelectionChange:e}):null}const Q4=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 vl(e,t){w.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function mt(e,t,n){w.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const J4=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:l,onConnectEnd:c,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:v,elevateNodesOnSelect:S,minZoom:b,maxZoom:_,nodeExtent:k,onNodesChange:j,onEdgesChange:E,elementsSelectable:C,connectionMode:R,snapGrid:I,snapToGrid:$,translateExtent:q,connectOnClick:B,defaultEdgeOptions:P,fitView:W,fitViewOptions:ne,onNodesDelete:ee,onEdgesDelete:M,onNodeDrag:X,onNodeDragStart:V,onNodeDragStop:G,onSelectionDrag:F,onSelectionDragStart:L,onSelectionDragStop:H,noPanClassName:D,nodeOrigin:K,rfId:re,autoPanOnConnect:z,autoPanOnNodeDrag:Z,onError:U,connectionRadius:ae,isValidConnection:le,nodeDragThreshold:ge})=>{const{setNodes:Ne,setEdges:Ie,setDefaultNodesAndEdges:Ge,setMinZoom:Pe,setMaxZoom:ze,setTranslateExtent:Re,setNodeExtent:st,reset:ue}=Et(Q4,pn),ce=tn();return w.useEffect(()=>{const se=r==null?void 0:r.map(be=>({...be,...P}));return Ge(n,se),()=>{ue()}},[]),mt("defaultEdgeOptions",P,ce.setState),mt("connectionMode",R,ce.setState),mt("onConnect",s,ce.setState),mt("onConnectStart",l,ce.setState),mt("onConnectEnd",c,ce.setState),mt("onClickConnectStart",u,ce.setState),mt("onClickConnectEnd",f,ce.setState),mt("nodesDraggable",p,ce.setState),mt("nodesConnectable",h,ce.setState),mt("nodesFocusable",m,ce.setState),mt("edgesFocusable",y,ce.setState),mt("edgesUpdatable",v,ce.setState),mt("elementsSelectable",C,ce.setState),mt("elevateNodesOnSelect",S,ce.setState),mt("snapToGrid",$,ce.setState),mt("snapGrid",I,ce.setState),mt("onNodesChange",j,ce.setState),mt("onEdgesChange",E,ce.setState),mt("connectOnClick",B,ce.setState),mt("fitViewOnInit",W,ce.setState),mt("fitViewOnInitOptions",ne,ce.setState),mt("onNodesDelete",ee,ce.setState),mt("onEdgesDelete",M,ce.setState),mt("onNodeDrag",X,ce.setState),mt("onNodeDragStart",V,ce.setState),mt("onNodeDragStop",G,ce.setState),mt("onSelectionDrag",F,ce.setState),mt("onSelectionDragStart",L,ce.setState),mt("onSelectionDragStop",H,ce.setState),mt("noPanClassName",D,ce.setState),mt("nodeOrigin",K,ce.setState),mt("rfId",re,ce.setState),mt("autoPanOnConnect",z,ce.setState),mt("autoPanOnNodeDrag",Z,ce.setState),mt("onError",U,ce.setState),mt("connectionRadius",ae,ce.setState),mt("isValidConnection",le,ce.setState),mt("nodeDragThreshold",ge,ce.setState),vl(e,Ne),vl(t,Ie),vl(b,Pe),vl(_,ze),vl(q,Re),vl(k,st),null},kN={display:"none"},eD={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},SA="react-flow__node-desc",jA="react-flow__edge-desc",tD="react-flow__aria-live",nD=e=>e.ariaLiveMessage;function rD({rfId:e}){const t=Et(nD);return ve.createElement("div",{id:`${tD}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:eD},t)}function sD({rfId:e,disableKeyboardA11y:t}){return ve.createElement(ve.Fragment,null,ve.createElement("div",{id:`${SA}-${e}`,style:kN},"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."," "),ve.createElement("div",{id:`${jA}-${e}`,style:kN},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&ve.createElement(rD,{rfId:e}))}var Eu=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=w.useState(!1),s=w.useRef(!1),l=w.useRef(new Set([])),[c,u]=w.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=p.reduce((m,y)=>m.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return w.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=v=>{if(s.current=v.ctrlKey||v.metaKey||v.shiftKey,(!s.current||s.current&&!t.actInsideInputWithModifier)&&x0(v))return!1;const b=SN(v.code,u);l.current.add(v[b]),NN(c,l.current,!1)&&(v.preventDefault(),r(!0))},m=v=>{if((!s.current||s.current&&!t.actInsideInputWithModifier)&&x0(v))return!1;const b=SN(v.code,u);NN(c,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(v[b]),v.key==="Meta"&&l.current.clear(),s.current=!1},y=()=>{l.current.clear(),r(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,r]),n};function NN(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function SN(e,t){return t.includes(e)?"code":"key"}function _A(e,t,n,r){var u,f;const s=e.parentNode||e.parentId;if(!s)return n;const l=t.get(s),c=ui(l,r);return _A(l,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((u=l[Wt])==null?void 0:u.z)??0)>(n.z??0)?((f=l[Wt])==null?void 0:f.z)??0:n.z??0},r)}function EA(e,t,n){e.forEach(r=>{var l;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:c,y:u,z:f}=_A(r,e,{...r.position,z:((l=r[Wt])==null?void 0:l.z)??0},t);r.positionAbsolute={x:c,y:u},r[Wt].z=f,n!=null&&n[r.id]&&(r[Wt].isParent=!0)}})}function gm(e,t,n,r){const s=new Map,l={},c=r?1e3:0;return e.forEach(u=>{var v;const f=(Pr(u.zIndex)?u.zIndex:0)+(u.selected?c:0),p=t.get(u.id),h={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},m=u.parentNode||u.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(h,Wt,{enumerable:!1,value:{handleBounds:y||(v=p==null?void 0:p[Wt])==null?void 0:v.handleBounds,z:f}}),s.set(u.id,h)}),EA(s,n,l),s}function CA(e,t={}){const{getNodes:n,width:r,height:s,minZoom:l,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:m}=e(),y=t.initial&&!p&&h;if(u&&f&&(y||!t.initial)){const S=n().filter(_=>{var j;const k=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(j=t.nodes)!=null&&j.length?k&&t.nodes.some(E=>E.id===_.id):k}),b=S.every(_=>_.width&&_.height);if(S.length>0&&b){const _=kf(S,m),{x:k,y:j,zoom:E}=fA(_,r,s,t.minZoom??l,t.maxZoom??c,t.padding??.1),C=ua.translate(k,j).scale(E);return typeof t.duration=="number"&&t.duration>0?u.transform(ai(f,t.duration),C):u.transform(f,C),!0}}return!1}function aD(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Wt]:r[Wt],selected:n.selected})}),new Map(t)}function oD(e,t){return t.map(n=>{const r=e.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function hh({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:s,edges:l,onNodesChange:c,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&r({nodeInternals:aD(e,s)}),c==null||c(e)),t!=null&&t.length&&(p&&r({edges:oD(t,l)}),u==null||u(t))}const xl=()=>{},iD={zoomIn:xl,zoomOut:xl,zoomTo:xl,getZoom:()=>1,setViewport:xl,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:xl,fitBounds:xl,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},lD=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),cD=()=>{const e=tn(),{d3Zoom:t,d3Selection:n}=Et(lD,pn);return w.useMemo(()=>n&&t?{zoomIn:s=>t.scaleBy(ai(n,s==null?void 0:s.duration),1.2),zoomOut:s=>t.scaleBy(ai(n,s==null?void 0:s.duration),1/1.2),zoomTo:(s,l)=>t.scaleTo(ai(n,l==null?void 0:l.duration),s),getZoom:()=>e.getState().transform[2],setViewport:(s,l)=>{const[c,u,f]=e.getState().transform,p=ua.translate(s.x??c,s.y??u).scale(s.zoom??f);t.transform(ai(n,l==null?void 0:l.duration),p)},getViewport:()=>{const[s,l,c]=e.getState().transform;return{x:s,y:l,zoom:c}},fitView:s=>CA(e.getState,s),setCenter:(s,l,c)=>{const{width:u,height:f,maxZoom:p}=e.getState(),h=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,m=u/2-s*h,y=f/2-l*h,v=ua.translate(m,y).scale(h);t.transform(ai(n,c==null?void 0:c.duration),v)},fitBounds:(s,l)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:m,zoom:y}=fA(s,c,u,f,p,(l==null?void 0:l.padding)??.1),v=ua.translate(h,m).scale(y);t.transform(ai(n,l==null?void 0:l.duration),v)},project:s=>{const{transform:l,snapToGrid:c,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),N0(s,l,c,u)},screenToFlowPosition:s=>{const{transform:l,snapToGrid:c,snapGrid:u,domNode:f}=e.getState();if(!f)return s;const{x:p,y:h}=f.getBoundingClientRect(),m={x:s.x-p,y:s.y-h};return N0(m,l,c,u)},flowToScreenPosition:s=>{const{transform:l,domNode:c}=e.getState();if(!c)return s;const{x:u,y:f}=c.getBoundingClientRect(),p=uA(s,l);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:iD,[t,n])};function Nf(){const e=cD(),t=tn(),n=w.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),r=w.useCallback(b=>t.getState().nodeInternals.get(b),[]),s=w.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(_=>({..._}))},[]),l=w.useCallback(b=>{const{edges:_=[]}=t.getState();return _.find(k=>k.id===b)},[]),c=w.useCallback(b=>{const{getNodes:_,setNodes:k,hasDefaultNodes:j,onNodesChange:E}=t.getState(),C=_(),R=typeof b=="function"?b(C):b;if(j)k(R);else if(E){const I=R.length===0?C.map($=>({type:"remove",id:$.id})):R.map($=>({item:$,type:"reset"}));E(I)}},[]),u=w.useCallback(b=>{const{edges:_=[],setEdges:k,hasDefaultEdges:j,onEdgesChange:E}=t.getState(),C=typeof b=="function"?b(_):b;if(j)k(C);else if(E){const R=C.length===0?_.map(I=>({type:"remove",id:I.id})):C.map(I=>({item:I,type:"reset"}));E(R)}},[]),f=w.useCallback(b=>{const _=Array.isArray(b)?b:[b],{getNodes:k,setNodes:j,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const I=[...k(),..._];j(I)}else if(C){const R=_.map(I=>({item:I,type:"add"}));C(R)}},[]),p=w.useCallback(b=>{const _=Array.isArray(b)?b:[b],{edges:k=[],setEdges:j,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)j([...k,..._]);else if(C){const R=_.map(I=>({item:I,type:"add"}));C(R)}},[]),h=w.useCallback(()=>{const{getNodes:b,edges:_=[],transform:k}=t.getState(),[j,E,C]=k;return{nodes:b().map(R=>({...R})),edges:_.map(R=>({...R})),viewport:{x:j,y:E,zoom:C}}},[]),m=w.useCallback(({nodes:b,edges:_})=>{const{nodeInternals:k,getNodes:j,edges:E,hasDefaultNodes:C,hasDefaultEdges:R,onNodesDelete:I,onEdgesDelete:$,onNodesChange:q,onEdgesChange:B}=t.getState(),P=(b||[]).map(X=>X.id),W=(_||[]).map(X=>X.id),ne=j().reduce((X,V)=>{const G=V.parentNode||V.parentId,F=!P.includes(V.id)&&G&&X.find(H=>H.id===G);return(typeof V.deletable=="boolean"?V.deletable:!0)&&(P.includes(V.id)||F)&&X.push(V),X},[]),ee=E.filter(X=>typeof X.deletable=="boolean"?X.deletable:!0),M=ee.filter(X=>W.includes(X.id));if(ne||M){const X=hA(ne,ee),V=[...M,...X],G=V.reduce((F,L)=>(F.includes(L.id)||F.push(L.id),F),[]);if((R||C)&&(R&&t.setState({edges:E.filter(F=>!G.includes(F.id))}),C&&(ne.forEach(F=>{k.delete(F.id)}),t.setState({nodeInternals:new Map(k)}))),G.length>0&&($==null||$(V),B&&B(G.map(F=>({id:F,type:"remove"})))),ne.length>0&&(I==null||I(ne),q)){const F=ne.map(L=>({id:L.id,type:"remove"}));q(F)}}},[]),y=w.useCallback(b=>{const _=T4(b),k=_?null:t.getState().nodeInternals.get(b.id);return!_&&!k?[null,null,_]:[_?b:mN(k),k,_]},[]),v=w.useCallback((b,_=!0,k)=>{const[j,E,C]=y(b);return j?(k||t.getState().getNodes()).filter(R=>{if(!C&&(R.id===E.id||!R.positionAbsolute))return!1;const I=mN(R),$=v0(I,j);return _&&$>0||$>=j.width*j.height}):[]},[]),S=w.useCallback((b,_,k=!0)=>{const[j]=y(b);if(!j)return!1;const E=v0(j,_);return k&&E>0||E>=j.width*j.height},[]);return w.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:s,getEdge:l,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:h,deleteElements:m,getIntersectingNodes:v,isNodeIntersecting:S}),[e,n,r,s,l,c,u,f,p,h,m,v,S])}const uD={actInsideInputWithModifier:!1};var dD=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=tn(),{deleteElements:r}=Nf(),s=Eu(e,uD),l=Eu(t);w.useEffect(()=>{if(s){const{edges:c,getNodes:u}=n.getState(),f=u().filter(h=>h.selected),p=c.filter(h=>h.selected);r({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[s]),w.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])};function hD(e){const t=tn();w.useEffect(()=>{let n;const r=()=>{var l,c;if(!e.current)return;const s=fb(e.current);(s.height===0||s.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",ha.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 kb={position:"absolute",width:"100%",height:"100%",top:0,left:0},fD=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,fh=e=>({x:e.x,y:e.y,zoom:e.k}),bl=(e,t)=>e.target.closest(`.${t}`),jN=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),_N=e=>{const t=e.ctrlKey&&Zh()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},pD=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),mD=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:l=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=li.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:y,translateExtent:v,minZoom:S,maxZoom:b,zoomActivationKeyCode:_,preventScrolling:k=!0,children:j,noWheelClassName:E,noPanClassName:C})=>{const R=w.useRef(),I=tn(),$=w.useRef(!1),q=w.useRef(!1),B=w.useRef(null),P=w.useRef({x:0,y:0,zoom:0}),{d3Zoom:W,d3Selection:ne,d3ZoomHandler:ee,userSelectionActive:M}=Et(pD,pn),X=Eu(_),V=w.useRef(0),G=w.useRef(!1),F=w.useRef();return hD(B),w.useEffect(()=>{if(B.current){const L=B.current.getBoundingClientRect(),H=JR().scaleExtent([S,b]).translateExtent(v),D=Lr(B.current).call(H),K=ua.translate(y.x,y.y).scale(Wl(y.zoom,S,b)),re=[[0,0],[L.width,L.height]],z=H.constrain()(K,re,v);H.transform(D,z),H.wheelDelta(_N),I.setState({d3Zoom:H,d3Selection:D,d3ZoomHandler:D.on("wheel.zoom"),transform:[z.x,z.y,z.k],domNode:B.current.closest(".react-flow")})}},[]),w.useEffect(()=>{ne&&W&&(c&&!X&&!M?ne.on("wheel.zoom",L=>{if(bl(L,E))return!1;L.preventDefault(),L.stopImmediatePropagation();const H=ne.property("__zoom").k||1;if(L.ctrlKey&&l){const le=fs(L),ge=_N(L),Ne=H*Math.pow(2,ge);W.scaleTo(ne,Ne,le,L);return}const D=L.deltaMode===1?20:1;let K=f===li.Vertical?0:L.deltaX*D,re=f===li.Horizontal?0:L.deltaY*D;!Zh()&&L.shiftKey&&f!==li.Vertical&&(K=L.deltaY*D,re=0),W.translateBy(ne,-(K/H)*u,-(re/H)*u,{internal:!0});const z=fh(ne.property("__zoom")),{onViewportChangeStart:Z,onViewportChange:U,onViewportChangeEnd:ae}=I.getState();clearTimeout(F.current),G.current||(G.current=!0,t==null||t(L,z),Z==null||Z(z)),G.current&&(e==null||e(L,z),U==null||U(z),F.current=setTimeout(()=>{n==null||n(L,z),ae==null||ae(z),G.current=!1},150))},{passive:!1}):typeof ee<"u"&&ne.on("wheel.zoom",function(L,H){if(!k&&L.type==="wheel"&&!L.ctrlKey||bl(L,E))return null;L.preventDefault(),ee.call(this,L,H)},{passive:!1}))},[M,c,f,ne,W,ee,X,l,k,E,t,e,n]),w.useEffect(()=>{W&&W.on("start",L=>{var K,re;if(!L.sourceEvent||L.sourceEvent.internal)return null;V.current=(K=L.sourceEvent)==null?void 0:K.button;const{onViewportChangeStart:H}=I.getState(),D=fh(L.transform);$.current=!0,P.current=D,((re=L.sourceEvent)==null?void 0:re.type)==="mousedown"&&I.setState({paneDragging:!0}),H==null||H(D),t==null||t(L.sourceEvent,D)})},[W,t]),w.useEffect(()=>{W&&(M&&!$.current?W.on("zoom",null):M||W.on("zoom",L=>{var D;const{onViewportChange:H}=I.getState();if(I.setState({transform:[L.transform.x,L.transform.y,L.transform.k]}),q.current=!!(r&&jN(m,V.current??0)),(e||H)&&!((D=L.sourceEvent)!=null&&D.internal)){const K=fh(L.transform);H==null||H(K),e==null||e(L.sourceEvent,K)}}))},[M,W,e,m,r]),w.useEffect(()=>{W&&W.on("end",L=>{if(!L.sourceEvent||L.sourceEvent.internal)return null;const{onViewportChangeEnd:H}=I.getState();if($.current=!1,I.setState({paneDragging:!1}),r&&jN(m,V.current??0)&&!q.current&&r(L.sourceEvent),q.current=!1,(n||H)&&fD(P.current,L.transform)){const D=fh(L.transform);P.current=D,clearTimeout(R.current),R.current=setTimeout(()=>{H==null||H(D),n==null||n(L.sourceEvent,D)},c?150:0)}})},[W,c,m,n,r]),w.useEffect(()=>{W&&W.filter(L=>{const H=X||s,D=l&&L.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&L.button===1&&L.type==="mousedown"&&(bl(L,"react-flow__node")||bl(L,"react-flow__edge")))return!0;if(!m&&!H&&!c&&!p&&!l||M||!p&&L.type==="dblclick"||bl(L,E)&&L.type==="wheel"||bl(L,C)&&(L.type!=="wheel"||c&&L.type==="wheel"&&!X)||!l&&L.ctrlKey&&L.type==="wheel"||!H&&!c&&!D&&L.type==="wheel"||!m&&(L.type==="mousedown"||L.type==="touchstart")||Array.isArray(m)&&!m.includes(L.button)&&L.type==="mousedown")return!1;const K=Array.isArray(m)&&m.includes(L.button)||!L.button||L.button<=1;return(!L.ctrlKey||L.type==="wheel")&&K})},[M,W,s,l,c,p,m,h,X]),ve.createElement("div",{className:"react-flow__renderer",ref:B,style:kb},j)},gD=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function yD(){const{userSelectionActive:e,userSelectionRect:t}=Et(gD,pn);return e&&t?ve.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 EN(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,l=t.position.y+t.height-r.height;if(s>0||l>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,s>0&&(r.style.width+=s),l>0&&(r.style.height+=l),t.position.x<0){const c=Math.abs(t.position.x);r.position.x=r.position.x-c,r.style.width+=c,t.position.x=0}if(t.position.y<0){const c=Math.abs(t.position.y);r.position.y=r.position.y-c,r.style.height+=c,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function wD(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 l=e.filter(u=>u.id===s.id);if(l.length===0)return r.push(s),r;const c={...s};for(const u of l)if(u)switch(u.type){case"select":{c.selected=u.selected;break}case"position":{typeof u.position<"u"&&(c.position=u.position),typeof u.positionAbsolute<"u"&&(c.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(c.dragging=u.dragging),c.expandParent&&EN(r,c);break}case"dimensions":{typeof u.dimensions<"u"&&(c.width=u.dimensions.width,c.height=u.dimensions.height),typeof u.updateStyle<"u"&&(c.style={...c.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(c.resizing=u.resizing),c.expandParent&&EN(r,c);break}case"remove":return r}return r.push(c),r},n)}function vD(e,t){return wD(e,t)}const Ja=(e,t)=>({id:e,type:"select",selected:t});function Il(e,t){return e.reduce((n,r)=>{const s=t.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(Ja(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(Ja(r.id,!1))),n},[])}const ym=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},xD=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),TA=w.memo(({isSelecting:e,selectionMode:t=_u.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:m})=>{const y=w.useRef(null),v=tn(),S=w.useRef(0),b=w.useRef(0),_=w.useRef(),{userSelectionActive:k,elementsSelectable:j,dragging:E}=Et(xD,pn),C=()=>{v.setState({userSelectionActive:!1,userSelectionRect:null}),S.current=0,b.current=0},R=ee=>{l==null||l(ee),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},I=ee=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){ee.preventDefault();return}c==null||c(ee)},$=u?ee=>u(ee):void 0,q=ee=>{const{resetSelectedElements:M,domNode:X}=v.getState();if(_.current=X==null?void 0:X.getBoundingClientRect(),!j||!e||ee.button!==0||ee.target!==y.current||!_.current)return;const{x:V,y:G}=so(ee,_.current);M(),v.setState({userSelectionRect:{width:0,height:0,startX:V,startY:G,x:V,y:G}}),r==null||r(ee)},B=ee=>{const{userSelectionRect:M,nodeInternals:X,edges:V,transform:G,onNodesChange:F,onEdgesChange:L,nodeOrigin:H,getNodes:D}=v.getState();if(!e||!_.current||!M)return;v.setState({userSelectionActive:!0,nodesSelectionActive:!1});const K=so(ee,_.current),re=M.startX??0,z=M.startY??0,Z={...M,x:K.x<re?K.x:re,y:K.y<z?K.y:z,width:Math.abs(K.x-re),height:Math.abs(K.y-z)},U=D(),ae=dA(X,Z,G,t===_u.Partial,!0,H),le=hA(ae,V).map(Ne=>Ne.id),ge=ae.map(Ne=>Ne.id);if(S.current!==ge.length){S.current=ge.length;const Ne=Il(U,ge);Ne.length&&(F==null||F(Ne))}if(b.current!==le.length){b.current=le.length;const Ne=Il(V,le);Ne.length&&(L==null||L(Ne))}v.setState({userSelectionRect:Z})},P=ee=>{if(ee.button!==0)return;const{userSelectionRect:M}=v.getState();!k&&M&&ee.target===y.current&&(R==null||R(ee)),v.setState({nodesSelectionActive:S.current>0}),C(),s==null||s(ee)},W=ee=>{k&&(v.setState({nodesSelectionActive:S.current>0}),s==null||s(ee)),C()},ne=j&&(e||k);return ve.createElement("div",{className:jn(["react-flow__pane",{dragging:E,selection:e}]),onClick:ne?void 0:ym(R,y),onContextMenu:ym(I,y),onWheel:ym($,y),onMouseEnter:ne?void 0:f,onMouseDown:ne?q:void 0,onMouseMove:ne?B:p,onMouseUp:ne?P:void 0,onMouseLeave:ne?W:h,ref:y,style:kb},m,ve.createElement(yD,null))});TA.displayName="Pane";function RA(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:RA(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 bD(e,t,n,r){return Array.from(e.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!RA(s,e))&&(s.draggable||t&&typeof s.draggable>"u")).map(s=>{var l,c;return{id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((l=s.positionAbsolute)==null?void 0:l.x)??0),y:n.y-(((c=s.positionAbsolute)==null?void 0:c.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 kD(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function AA(e,t,n,r,s=[0,0],l){const c=kD(e,e.extent||r);let u=c;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const m=n.get(f),{x:y,y:v}=ui(m,s).positionAbsolute;u=m&&Pr(y)&&Pr(v)&&Pr(m.width)&&Pr(m.height)?[[y+e.width*s[0],v+e.height*s[1]],[y+m.width-e.width+e.width*s[0],v+m.height-e.height+e.height*s[1]]]:u}else l==null||l("005",ha.error005()),u=c;else if(e.extent&&f&&e.extent!=="parent"){const m=n.get(f),{x:y,y:v}=ui(m,s).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+v],[e.extent[1][0]+y,e.extent[1][1]+v]]}let p={x:0,y:0};if(f){const m=n.get(f);p=ui(m,s).positionAbsolute}const h=u&&u!=="parent"?pb(t,u):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function wm({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 TN=(e,t,n,r)=>{const s=t.querySelectorAll(e);if(!s||!s.length)return null;const l=Array.from(s),c=t.getBoundingClientRect(),u={x:c.width*r[0],y:c.height*r[1]};return l.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-c.left-u.x)/n,y:(p.top-c.top-u.y)/n,...fb(f)}})};function nu(e,t,n){return n===void 0?n:r=>{const s=t().nodeInternals.get(e);s&&n(r,{...s})}}function j0({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:l,multiSelectionActive:c,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f==null||f("012",ha.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=r==null?void 0:r.current)==null?void 0:h.blur()})):s([e])}function ND(){const e=tn();return w.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:l}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,f={x:(c-r[0])/r[2],y:(u-r[1])/r[2]};return{xSnapped:l?s[0]*Math.round(f.x/s[0]):f.x,ySnapped:l?s[1]*Math.round(f.y/s[1]):f.y,...f}},[])}function vm(e){return(t,n,r)=>e==null?void 0:e(t,r)}function MA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:l,selectNodesOnDrag:c}){const u=tn(),[f,p]=w.useState(!1),h=w.useRef([]),m=w.useRef({x:null,y:null}),y=w.useRef(0),v=w.useRef(null),S=w.useRef({x:0,y:0}),b=w.useRef(null),_=w.useRef(!1),k=w.useRef(!1),j=w.useRef(!1),E=ND();return w.useEffect(()=>{if(e!=null&&e.current){const C=Lr(e.current),R=({x:q,y:B})=>{const{nodeInternals:P,onNodeDrag:W,onSelectionDrag:ne,updateNodePositions:ee,nodeExtent:M,snapGrid:X,snapToGrid:V,nodeOrigin:G,onError:F}=u.getState();m.current={x:q,y:B};let L=!1,H={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&M){const K=kf(h.current,G);H=ju(K)}if(h.current=h.current.map(K=>{const re={x:q-K.distance.x,y:B-K.distance.y};V&&(re.x=X[0]*Math.round(re.x/X[0]),re.y=X[1]*Math.round(re.y/X[1]));const z=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];h.current.length>1&&M&&!K.extent&&(z[0][0]=K.positionAbsolute.x-H.x+M[0][0],z[1][0]=K.positionAbsolute.x+(K.width??0)-H.x2+M[1][0],z[0][1]=K.positionAbsolute.y-H.y+M[0][1],z[1][1]=K.positionAbsolute.y+(K.height??0)-H.y2+M[1][1]);const Z=AA(K,re,P,z,G,F);return L=L||K.position.x!==Z.position.x||K.position.y!==Z.position.y,K.position=Z.position,K.positionAbsolute=Z.positionAbsolute,K}),!L)return;ee(h.current,!0,!0),p(!0);const D=s?W:vm(ne);if(D&&b.current){const[K,re]=wm({nodeId:s,dragItems:h.current,nodeInternals:P});D(b.current,K,re)}},I=()=>{if(!v.current)return;const[q,B]=tA(S.current,v.current);if(q!==0||B!==0){const{transform:P,panBy:W}=u.getState();m.current.x=(m.current.x??0)-q/P[2],m.current.y=(m.current.y??0)-B/P[2],W({x:q,y:B})&&R(m.current)}y.current=requestAnimationFrame(I)},$=q=>{var G;const{nodeInternals:B,multiSelectionActive:P,nodesDraggable:W,unselectNodesAndEdges:ne,onNodeDragStart:ee,onSelectionDragStart:M}=u.getState();k.current=!0;const X=s?ee:vm(M);(!c||!l)&&!P&&s&&((G=B.get(s))!=null&&G.selected||ne()),s&&l&&c&&j0({id:s,store:u,nodeRef:e});const V=E(q);if(m.current=V,h.current=bD(B,W,V,s),X&&h.current){const[F,L]=wm({nodeId:s,dragItems:h.current,nodeInternals:B});X(q.sourceEvent,F,L)}};if(t)C.on(".drag",null);else{const q=I3().on("start",B=>{const{domNode:P,nodeDragThreshold:W}=u.getState();W===0&&$(B),j.current=!1;const ne=E(B);m.current=ne,v.current=(P==null?void 0:P.getBoundingClientRect())||null,S.current=so(B.sourceEvent,v.current)}).on("drag",B=>{var ee,M;const P=E(B),{autoPanOnNodeDrag:W,nodeDragThreshold:ne}=u.getState();if(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1&&(j.current=!0),!j.current){if(!_.current&&k.current&&W&&(_.current=!0,I()),!k.current){const X=P.xSnapped-(((ee=m==null?void 0:m.current)==null?void 0:ee.x)??0),V=P.ySnapped-(((M=m==null?void 0:m.current)==null?void 0:M.y)??0);Math.sqrt(X*X+V*V)>ne&&$(B)}(m.current.x!==P.xSnapped||m.current.y!==P.ySnapped)&&h.current&&k.current&&(b.current=B.sourceEvent,S.current=so(B.sourceEvent,v.current),R(P))}}).on("end",B=>{if(!(!k.current||j.current)&&(p(!1),_.current=!1,k.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:P,nodeInternals:W,onNodeDragStop:ne,onSelectionDragStop:ee}=u.getState(),M=s?ne:vm(ee);if(P(h.current,!1,!1),M){const[X,V]=wm({nodeId:s,dragItems:h.current,nodeInternals:W});M(B.sourceEvent,X,V)}}}).filter(B=>{const P=B.target;return!B.button&&(!n||!CN(P,`.${n}`,e))&&(!r||CN(P,r,e))});return C.call(q),()=>{C.on(".drag",null)}}}},[e,t,n,r,l,u,s,c,E]),f}function IA(){const e=tn();return w.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:l,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),m=c().filter(j=>j.selected&&(j.draggable||h&&typeof j.draggable>"u")),y=u?f[0]:5,v=u?f[1]:5,S=n.isShiftPressed?4:1,b=n.x*y*S,_=n.y*v*S,k=m.map(j=>{if(j.positionAbsolute){const E={x:j.positionAbsolute.x+b,y:j.positionAbsolute.y+_};u&&(E.x=f[0]*Math.round(E.x/f[0]),E.y=f[1]*Math.round(E.y/f[1]));const{positionAbsolute:C,position:R}=AA(j,E,r,s,void 0,p);j.position=R,j.positionAbsolute=C}return j});l(k,!0,!1)},[])}const ql={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ru=e=>{const t=({id:n,type:r,data:s,xPos:l,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:m,onMouseMove:y,onMouseLeave:v,onContextMenu:S,onDoubleClick:b,style:_,className:k,isDraggable:j,isSelectable:E,isConnectable:C,isFocusable:R,selectNodesOnDrag:I,sourcePosition:$,targetPosition:q,hidden:B,resizeObserver:P,dragHandle:W,zIndex:ne,isParent:ee,noDragClassName:M,noPanClassName:X,initialized:V,disableKeyboardA11y:G,ariaLabel:F,rfId:L,hasHandleBounds:H})=>{const D=tn(),K=w.useRef(null),re=w.useRef(null),z=w.useRef($),Z=w.useRef(q),U=w.useRef(r),ae=E||j||h||m||y||v,le=IA(),ge=nu(n,D.getState,m),Ne=nu(n,D.getState,y),Ie=nu(n,D.getState,v),Ge=nu(n,D.getState,S),Pe=nu(n,D.getState,b),ze=ue=>{const{nodeDragThreshold:ce}=D.getState();if(E&&(!I||!j||ce>0)&&j0({id:n,store:D,nodeRef:K}),h){const se=D.getState().nodeInternals.get(n);se&&h(ue,{...se})}},Re=ue=>{if(!x0(ue)&&!G)if(aA.includes(ue.key)&&E){const ce=ue.key==="Escape";j0({id:n,store:D,unselect:ce,nodeRef:K})}else j&&p&&Object.prototype.hasOwnProperty.call(ql,ue.key)&&(D.setState({ariaLiveMessage:`Moved selected node ${ue.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~c}`}),le({x:ql[ue.key].x,y:ql[ue.key].y,isShiftPressed:ue.shiftKey}))};w.useEffect(()=>()=>{re.current&&(P==null||P.unobserve(re.current),re.current=null)},[]),w.useEffect(()=>{if(K.current&&!B){const ue=K.current;(!V||!H||re.current!==ue)&&(re.current&&(P==null||P.unobserve(re.current)),P==null||P.observe(ue),re.current=ue)}},[B,V,H]),w.useEffect(()=>{const ue=U.current!==r,ce=z.current!==$,se=Z.current!==q;K.current&&(ue||ce||se)&&(ue&&(U.current=r),ce&&(z.current=$),se&&(Z.current=q),D.getState().updateNodeDimensions([{id:n,nodeElement:K.current,forceUpdate:!0}]))},[n,r,$,q]);const st=MA({nodeRef:K,disabled:B||!j,noDragClassName:M,handleSelector:W,nodeId:n,isSelectable:E,selectNodesOnDrag:I});return B?null:ve.createElement("div",{className:jn(["react-flow__node",`react-flow__node-${r}`,{[X]:j},k,{selected:p,selectable:E,parent:ee,dragging:st}]),ref:K,style:{zIndex:ne,transform:`translate(${u}px,${f}px)`,pointerEvents:ae?"all":"none",visibility:V?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:ge,onMouseMove:Ne,onMouseLeave:Ie,onContextMenu:Ge,onClick:ze,onDoubleClick:Pe,onKeyDown:R?Re:void 0,tabIndex:R?0:void 0,role:R?"button":void 0,"aria-describedby":G?void 0:`${SA}-${L}`,"aria-label":F},ve.createElement(L4,{value:n},ve.createElement(e,{id:n,data:s,type:r,xPos:l,yPos:c,selected:p,isConnectable:C,sourcePosition:$,targetPosition:q,dragging:st,dragHandle:W,zIndex:ne})))};return t.displayName="NodeWrapper",w.memo(t)};const SD=e=>{const t=e.getNodes().filter(n=>n.selected);return{...kf(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function jD({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=tn(),{width:s,height:l,x:c,y:u,transformString:f,userSelectionActive:p}=Et(SD,pn),h=IA(),m=w.useRef(null);if(w.useEffect(()=>{var S;n||(S=m.current)==null||S.focus({preventScroll:!0})},[n]),MA({nodeRef:m}),p||!s||!l)return null;const y=e?S=>{const b=r.getState().getNodes().filter(_=>_.selected);e(S,b)}:void 0,v=S=>{Object.prototype.hasOwnProperty.call(ql,S.key)&&h({x:ql[S.key].x,y:ql[S.key].y,isShiftPressed:S.shiftKey})};return ve.createElement("div",{className:jn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},ve.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:v,style:{width:s,height:l,top:u,left:c}}))}var _D=w.memo(jD);const ED=e=>e.nodesSelectionActive,$A=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:l,onPaneScroll:c,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:v,onSelectionStart:S,onSelectionEnd:b,multiSelectionKeyCode:_,panActivationKeyCode:k,zoomActivationKeyCode:j,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:R,panOnScroll:I,panOnScrollSpeed:$,panOnScrollMode:q,zoomOnDoubleClick:B,panOnDrag:P,defaultViewport:W,translateExtent:ne,minZoom:ee,maxZoom:M,preventScrolling:X,onSelectionContextMenu:V,noWheelClassName:G,noPanClassName:F,disableKeyboardA11y:L})=>{const H=Et(ED),D=Eu(m),K=Eu(k),re=K||P,z=K||I,Z=D||y&&re!==!0;return dD({deleteKeyCode:u,multiSelectionKeyCode:_}),ve.createElement(mD,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:R,panOnScroll:z,panOnScrollSpeed:$,panOnScrollMode:q,zoomOnDoubleClick:B,panOnDrag:!D&&re,defaultViewport:W,translateExtent:ne,minZoom:ee,maxZoom:M,zoomActivationKeyCode:j,preventScrolling:X,noWheelClassName:G,noPanClassName:F},ve.createElement(TA,{onSelectionStart:S,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:re,isSelecting:!!Z,selectionMode:v},e,H&&ve.createElement(_D,{onSelectionContextMenu:V,noPanClassName:F,disableKeyboardA11y:L})))};$A.displayName="FlowRenderer";var CD=w.memo($A);function TD(e){return Et(w.useCallback(n=>e?dA(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function RD(e){const t={input:ru(e.input||xA),default:ru(e.default||S0),output:ru(e.output||kA),group:ru(e.group||bb)},n={},r=Object.keys(e).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,l)=>(s[l]=ru(e[l]||S0),s),n);return{...t,...r}}const AD=({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]},MD=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),OA=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:l,onError:c}=Et(MD,pn),u=TD(e.onlyRenderVisibleElements),f=w.useRef(),p=w.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const y=m.map(v=>({id:v.target.getAttribute("data-id"),nodeElement:v.target,forceUpdate:!0}));l(y)});return f.current=h,h},[]);return w.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),ve.createElement("div",{className:"react-flow__nodes",style:kb},u.map(h=>{var R,I,$;let m=h.type||"default";e.nodeTypes[m]||(c==null||c("003",ha.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,v=!!(h.draggable||t&&typeof h.draggable>"u"),S=!!(h.selectable||s&&typeof h.selectable>"u"),b=!!(h.connectable||n&&typeof h.connectable>"u"),_=!!(h.focusable||r&&typeof h.focusable>"u"),k=e.nodeExtent?pb(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,j=(k==null?void 0:k.x)??0,E=(k==null?void 0:k.y)??0,C=AD({x:j,y:E,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return ve.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||nt.Bottom,targetPosition:h.targetPosition||nt.Top,hidden:h.hidden,xPos:j,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:v,isSelectable:S,isConnectable:b,isFocusable:_,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((R=h[Wt])==null?void 0:R.z)??0,isParent:!!((I=h[Wt])!=null&&I.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!(($=h[Wt])!=null&&$.handleBounds)})}))};OA.displayName="NodeRenderer";var ID=w.memo(OA);const $D=(e,t,n)=>n===nt.Left?e-t:n===nt.Right?e+t:e,OD=(e,t,n)=>n===nt.Top?e-t:n===nt.Bottom?e+t:e,RN="react-flow__edgeupdater",AN=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:l,onMouseOut:c,type:u})=>ve.createElement("circle",{onMouseDown:s,onMouseEnter:l,onMouseOut:c,className:jn([RN,`${RN}-${u}`]),cx:$D(t,r,e),cy:OD(n,r,e),r,stroke:"transparent",fill:"transparent"}),LD=()=>!0;var kl=e=>{const t=({id:n,className:r,type:s,data:l,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:b,style:_,source:k,target:j,sourceX:E,sourceY:C,targetX:R,targetY:I,sourcePosition:$,targetPosition:q,elementsSelectable:B,hidden:P,sourceHandleId:W,targetHandleId:ne,onContextMenu:ee,onMouseEnter:M,onMouseMove:X,onMouseLeave:V,reconnectRadius:G,onReconnect:F,onReconnectStart:L,onReconnectEnd:H,markerEnd:D,markerStart:K,rfId:re,ariaLabel:z,isFocusable:Z,isReconnectable:U,pathOptions:ae,interactionWidth:le,disableKeyboardA11y:ge})=>{const Ne=w.useRef(null),[Ie,Ge]=w.useState(!1),[Pe,ze]=w.useState(!1),Re=tn(),st=w.useMemo(()=>`url('#${k0(K,re)}')`,[K,re]),ue=w.useMemo(()=>`url('#${k0(D,re)}')`,[D,re]);if(P)return null;const ce=Ue=>{var yt;const{edges:Fe,addSelectedEdges:Ve,unselectNodesAndEdges:rt,multiSelectionActive:ut}=Re.getState(),ct=Fe.find(It=>It.id===n);ct&&(B&&(Re.setState({nodesSelectionActive:!1}),ct.selected&&ut?(rt({nodes:[],edges:[ct]}),(yt=Ne.current)==null||yt.blur()):Ve([n])),c&&c(Ue,ct))},se=tu(n,Re.getState,u),be=tu(n,Re.getState,ee),Le=tu(n,Re.getState,M),de=tu(n,Re.getState,X),fe=tu(n,Re.getState,V),Ce=(Ue,Fe)=>{if(Ue.button!==0)return;const{edges:Ve,isValidConnection:rt}=Re.getState(),ut=Fe?j:k,ct=(Fe?ne:W)||null,yt=Fe?"target":"source",It=rt||LD,zt=Fe,Xt=Ve.find(Se=>Se.id===n);ze(!0),L==null||L(Ue,Xt,yt);const Ft=Se=>{ze(!1),H==null||H(Se,Xt,yt)};gA({event:Ue,handleId:ct,nodeId:ut,onConnect:Se=>F==null?void 0:F(Xt,Se),isTarget:zt,getState:Re.getState,setState:Re.setState,isValidConnection:It,edgeUpdaterType:yt,onReconnectEnd:Ft})},pe=Ue=>Ce(Ue,!0),_e=Ue=>Ce(Ue,!1),Ye=()=>Ge(!0),qe=()=>Ge(!1),ke=!B&&!c,Ae=Ue=>{var Fe;if(!ge&&aA.includes(Ue.key)&&B){const{unselectNodesAndEdges:Ve,addSelectedEdges:rt,edges:ut}=Re.getState();Ue.key==="Escape"?((Fe=Ne.current)==null||Fe.blur(),Ve({edges:[ut.find(yt=>yt.id===n)]})):rt([n])}};return ve.createElement("g",{className:jn(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:f,animated:p,inactive:ke,updating:Ie}]),onClick:ce,onDoubleClick:se,onContextMenu:be,onMouseEnter:Le,onMouseMove:de,onMouseLeave:fe,onKeyDown:Z?Ae:void 0,tabIndex:Z?0:void 0,role:Z?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":z===null?void 0:z||`Edge from ${k} to ${j}`,"aria-describedby":Z?`${jA}-${re}`:void 0,ref:Ne},!Pe&&ve.createElement(e,{id:n,source:k,target:j,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:b,data:l,style:_,sourceX:E,sourceY:C,targetX:R,targetY:I,sourcePosition:$,targetPosition:q,sourceHandleId:W,targetHandleId:ne,markerStart:st,markerEnd:ue,pathOptions:ae,interactionWidth:le}),U&&ve.createElement(ve.Fragment,null,(U==="source"||U===!0)&&ve.createElement(AN,{position:$,centerX:E,centerY:C,radius:G,onMouseDown:pe,onMouseEnter:Ye,onMouseOut:qe,type:"source"}),(U==="target"||U===!0)&&ve.createElement(AN,{position:q,centerX:R,centerY:I,radius:G,onMouseDown:_e,onMouseEnter:Ye,onMouseOut:qe,type:"target"})))};return t.displayName="EdgeWrapper",w.memo(t)};function PD(e){const t={default:kl(e.default||Jh),straight:kl(e.bezier||yb),step:kl(e.step||gb),smoothstep:kl(e.step||bf),simplebezier:kl(e.simplebezier||mb)},n={},r=Object.keys(e).filter(s=>!["default","bezier"].includes(s)).reduce((s,l)=>(s[l]=kl(e[l]||Jh),s),n);return{...t,...r}}function MN(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,l=(n==null?void 0:n.width)||t.width,c=(n==null?void 0:n.height)||t.height;switch(e){case nt.Top:return{x:r+l/2,y:s};case nt.Right:return{x:r+l,y:s+c/2};case nt.Bottom:return{x:r+l/2,y:s+c};case nt.Left:return{x:r,y:s+c/2}}}function IN(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const DD=(e,t,n,r,s,l)=>{const c=MN(n,e,t),u=MN(l,r,s);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function FD({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:l,width:c,height:u,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+s),y2:Math.max(e.y+r,t.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=ju({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:c/f[2],height:u/f[2]}),m=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),y=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(m*y)>0}function $N(e){var r,s,l,c,u;const t=((r=e==null?void 0:e[Wt])==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((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const qD=[{level:0,isMaxLevel:!0,edges:[]}];function BD(e,t,n=!1){let r=-1;const s=e.reduce((c,u)=>{var h,m;const f=Pr(u.zIndex);let p=f?u.zIndex:0;if(n){const y=t.get(u.target),v=t.get(u.source),S=u.selected||(y==null?void 0:y.selected)||(v==null?void 0:v.selected),b=Math.max(((h=v==null?void 0:v[Wt])==null?void 0:h.z)||0,((m=y==null?void 0:y[Wt])==null?void 0:m.z)||0,1e3);p=(f?u.zIndex:0)+(S?b:0)}return c[p]?c[p].push(u):c[p]=[u],r=p>r?p:r,c},{}),l=Object.entries(s).map(([c,u])=>{const f=+c;return{edges:u,level:f,isMaxLevel:f===r}});return l.length===0?qD:l}function zD(e,t,n){const r=Et(w.useCallback(s=>e?s.edges.filter(l=>{const c=t.get(l.source),u=t.get(l.target);return(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&FD({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:u.width,targetHeight:u.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[e,t]));return BD(r,t,n)}const UD=({color:e="none",strokeWidth:t=1})=>ve.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),HD=({color:e="none",strokeWidth:t=1})=>ve.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),ON={[Qh.Arrow]:UD,[Qh.ArrowClosed]:HD};function WD(e){const t=tn();return w.useMemo(()=>{var s,l;return Object.prototype.hasOwnProperty.call(ON,e)?ON[e]:((l=(s=t.getState()).onError)==null||l.call(s,"009",ha.error009(e)),null)},[e])}const VD=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=WD(t);return f?ve.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:u,refX:"0",refY:"0"},ve.createElement(f,{color:n,strokeWidth:c})):null},GD=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((s,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=k0(c,t);r.includes(u)||(s.push({id:u,color:c.color||e,...c}),r.push(u))}}),s),[]).sort((s,l)=>s.id.localeCompare(l.id))},LA=({defaultColor:e,rfId:t})=>{const n=Et(w.useCallback(GD({defaultColor:e,rfId:t}),[e,t]),(r,s)=>!(r.length!==s.length||r.some((l,c)=>l.id!==s[c].id)));return ve.createElement("defs",null,n.map(r=>ve.createElement(VD,{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})))};LA.displayName="MarkerDefinitions";var KD=w.memo(LA);const YD=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}),PA=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:l,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:S,reconnectRadius:b,children:_,disableKeyboardA11y:k})=>{const{edgesFocusable:j,edgesUpdatable:E,elementsSelectable:C,width:R,height:I,connectionMode:$,nodeInternals:q,onError:B}=Et(YD,pn),P=zD(t,q,n);return R?ve.createElement(ve.Fragment,null,P.map(({level:W,edges:ne,isMaxLevel:ee})=>ve.createElement("svg",{key:W,style:{zIndex:W},width:R,height:I,className:"react-flow__edges react-flow__container"},ee&&ve.createElement(KD,{defaultColor:e,rfId:r}),ve.createElement("g",null,ne.map(M=>{const[X,V,G]=$N(q.get(M.source)),[F,L,H]=$N(q.get(M.target));if(!G||!H)return null;let D=M.type||"default";s[D]||(B==null||B("011",ha.error011(D)),D="default");const K=s[D]||s.default,re=$===mi.Strict?L.target:(L.target??[]).concat(L.source??[]),z=IN(V.source,M.sourceHandle),Z=IN(re,M.targetHandle),U=(z==null?void 0:z.position)||nt.Bottom,ae=(Z==null?void 0:Z.position)||nt.Top,le=!!(M.focusable||j&&typeof M.focusable>"u"),ge=M.reconnectable||M.updatable,Ne=typeof y<"u"&&(ge||E&&typeof ge>"u");if(!z||!Z)return B==null||B("008",ha.error008(z,M)),null;const{sourceX:Ie,sourceY:Ge,targetX:Pe,targetY:ze}=DD(X,z,U,F,Z,ae);return ve.createElement(K,{key:M.id,id:M.id,className:jn([M.className,l]),type:D,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:Ie,sourceY:Ge,targetX:Pe,targetY:ze,sourcePosition:U,targetPosition:ae,elementsSelectable:C,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:S,reconnectRadius:b,rfId:r,ariaLabel:M.ariaLabel,isFocusable:le,isReconnectable:Ne,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:k})})))),_):null};PA.displayName="EdgeRenderer";var XD=w.memo(PA);const ZD=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function QD({children:e}){const t=Et(ZD);return ve.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function JD(e){const t=Nf(),n=w.useRef(!1);w.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const e5={[nt.Left]:nt.Right,[nt.Right]:nt.Left,[nt.Top]:nt.Bottom,[nt.Bottom]:nt.Top},DA=({nodeId:e,handleType:t,style:n,type:r=eo.Bezier,CustomComponent:s,connectionStatus:l})=>{var I,$,q;const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:h}=Et(w.useCallback(B=>({fromNode:B.nodeInternals.get(e),handleId:B.connectionHandleId,toX:(B.connectionPosition.x-B.transform[0])/B.transform[2],toY:(B.connectionPosition.y-B.transform[1])/B.transform[2],connectionMode:B.connectionMode}),[e]),pn),m=(I=c==null?void 0:c[Wt])==null?void 0:I.handleBounds;let y=m==null?void 0:m[t];if(h===mi.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const v=u?y.find(B=>B.id===u):y[0],S=v?v.x+v.width/2:(c.width??0)/2,b=v?v.y+v.height/2:c.height??0,_=((($=c.positionAbsolute)==null?void 0:$.x)??0)+S,k=(((q=c.positionAbsolute)==null?void 0:q.y)??0)+b,j=v==null?void 0:v.position,E=j?e5[j]:null;if(!j||!E)return null;if(s)return ve.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:c,fromHandle:v,fromX:_,fromY:k,toX:f,toY:p,fromPosition:j,toPosition:E,connectionStatus:l});let C="";const R={sourceX:_,sourceY:k,sourcePosition:j,targetX:f,targetY:p,targetPosition:E};return r===eo.Bezier?[C]=wb(R):r===eo.Step?[C]=b0({...R,borderRadius:0}):r===eo.SmoothStep?[C]=b0(R):r===eo.SimpleBezier?[C]=cA(R):C=`M${_},${k} ${f},${p}`,ve.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};DA.displayName="ConnectionLine";const t5=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function n5({containerStyle:e,style:t,type:n,component:r}){const{nodeId:s,handleType:l,nodesConnectable:c,width:u,height:f,connectionStatus:p}=Et(t5,pn);return!(s&&l&&u&&c)?null:ve.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},ve.createElement("g",{className:jn(["react-flow__connection",p])},ve.createElement(DA,{nodeId:s,handleType:l,style:t,type:n,CustomComponent:r,connectionStatus:p})))}function LN(e,t){return w.useRef(null),tn(),w.useMemo(()=>t(e),[e])}const FA=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:l,onNodeClick:c,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:v,onSelectionContextMenu:S,onSelectionStart:b,onSelectionEnd:_,connectionLineType:k,connectionLineStyle:j,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:R,selectionOnDrag:I,selectionMode:$,multiSelectionKeyCode:q,panActivationKeyCode:B,zoomActivationKeyCode:P,deleteKeyCode:W,onlyRenderVisibleElements:ne,elementsSelectable:ee,selectNodesOnDrag:M,defaultViewport:X,translateExtent:V,minZoom:G,maxZoom:F,preventScrolling:L,defaultMarkerColor:H,zoomOnScroll:D,zoomOnPinch:K,panOnScroll:re,panOnScrollSpeed:z,panOnScrollMode:Z,zoomOnDoubleClick:U,panOnDrag:ae,onPaneClick:le,onPaneMouseEnter:ge,onPaneMouseMove:Ne,onPaneMouseLeave:Ie,onPaneScroll:Ge,onPaneContextMenu:Pe,onEdgeContextMenu:ze,onEdgeMouseEnter:Re,onEdgeMouseMove:st,onEdgeMouseLeave:ue,onReconnect:ce,onReconnectStart:se,onReconnectEnd:be,reconnectRadius:Le,noDragClassName:de,noWheelClassName:fe,noPanClassName:Ce,elevateEdgesOnSelect:pe,disableKeyboardA11y:_e,nodeOrigin:Ye,nodeExtent:qe,rfId:ke})=>{const Ae=LN(e,RD),Ue=LN(t,PD);return JD(l),ve.createElement(CD,{onPaneClick:le,onPaneMouseEnter:ge,onPaneMouseMove:Ne,onPaneMouseLeave:Ie,onPaneContextMenu:Pe,onPaneScroll:Ge,deleteKeyCode:W,selectionKeyCode:R,selectionOnDrag:I,selectionMode:$,onSelectionStart:b,onSelectionEnd:_,multiSelectionKeyCode:q,panActivationKeyCode:B,zoomActivationKeyCode:P,elementsSelectable:ee,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:D,zoomOnPinch:K,zoomOnDoubleClick:U,panOnScroll:re,panOnScrollSpeed:z,panOnScrollMode:Z,panOnDrag:ae,defaultViewport:X,translateExtent:V,minZoom:G,maxZoom:F,onSelectionContextMenu:S,preventScrolling:L,noDragClassName:de,noWheelClassName:fe,noPanClassName:Ce,disableKeyboardA11y:_e},ve.createElement(QD,null,ve.createElement(XD,{edgeTypes:Ue,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:ne,onEdgeContextMenu:ze,onEdgeMouseEnter:Re,onEdgeMouseMove:st,onEdgeMouseLeave:ue,onReconnect:ce,onReconnectStart:se,onReconnectEnd:be,reconnectRadius:Le,defaultMarkerColor:H,noPanClassName:Ce,elevateEdgesOnSelect:!!pe,disableKeyboardA11y:_e,rfId:ke},ve.createElement(n5,{style:j,type:k,component:E,containerStyle:C})),ve.createElement("div",{className:"react-flow__edgelabel-renderer"}),ve.createElement(ID,{nodeTypes:Ae,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:v,selectNodesOnDrag:M,onlyRenderVisibleElements:ne,noPanClassName:Ce,noDragClassName:de,disableKeyboardA11y:_e,nodeOrigin:Ye,nodeExtent:qe,rfId:ke})))};FA.displayName="GraphView";var r5=w.memo(FA);const _0=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ka={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:_0,nodeExtent:_0,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:mi.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:R4,isValidConnection:void 0},s5=()=>WO((e,t)=>({...Ka,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:l}=t();e({nodeInternals:gm(n,r,s,l)})},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",l=typeof r<"u",c=s?gm(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:l?r:[],hasDefaultNodes:s,hasDefaultEdges:l})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:l,fitViewOnInitDone:c,fitViewOnInitOptions:u,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(m.transform),v=n.reduce((b,_)=>{const k=s.get(_.id);if(k!=null&&k.hidden)s.set(k.id,{...k,[Wt]:{...k[Wt],handleBounds:void 0}});else if(k){const j=fb(_.nodeElement);!!(j.width&&j.height&&(k.width!==j.width||k.height!==j.height||_.forceUpdate))&&(s.set(k.id,{...k,[Wt]:{...k[Wt],handleBounds:{source:TN(".source",_.nodeElement,y,p),target:TN(".target",_.nodeElement,y,p)}},...j}),b.push({id:k.id,type:"dimensions",dimensions:j}))}return b},[]);EA(s,p);const S=c||l&&!c&&CA(t,{initial:!0,...u});e({nodeInternals:new Map(s),fitViewOnInitDone:S}),(v==null?void 0:v.length)>0&&(r==null||r(v))},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:l}=t(),c=n.map(u=>{const f={id:u.id,type:"position",dragging:s};return r&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});l(c)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:l,nodeOrigin:c,getNodes:u,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(l){const p=vD(n,u()),h=gm(p,s,c,f);e({nodeInternals:h})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:l}=t();let c,u=null;r?c=n.map(f=>Ja(f,!0)):(c=Il(l(),n),u=Il(s,[])),hh({changedNodes:c,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:l}=t();let c,u=null;r?c=n.map(f=>Ja(f,!0)):(c=Il(s,n),u=Il(l(),[])),hh({changedNodes:u,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:l}=t(),c=n||l(),u=r||s,f=c.map(h=>(h.selected=!1,Ja(h.id,!1))),p=u.map(h=>Ja(h.id,!1));hh({changedNodes:f,changedEdges:p,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(),l=r().filter(u=>u.selected).map(u=>Ja(u.id,!1)),c=n.filter(u=>u.selected).map(u=>Ja(u.id,!1));hh({changedNodes:l,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(s=>{s.positionAbsolute=pb(s.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:l,d3Zoom:c,d3Selection:u,translateExtent:f}=t();if(!c||!u||!n.x&&!n.y)return!1;const p=ua.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),h=[[0,0],[s,l]],m=c==null?void 0:c.constrain()(p,h,f);return c.transform(u,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Ka.connectionNodeId,connectionHandleId:Ka.connectionHandleId,connectionHandleType:Ka.connectionHandleType,connectionStatus:Ka.connectionStatus,connectionStartHandle:Ka.connectionStartHandle,connectionEndHandle:Ka.connectionEndHandle}),reset:()=>e({...Ka})}),Object.is),Nb=({children:e})=>{const t=w.useRef(null);return t.current||(t.current=s5()),ve.createElement(N4,{value:t.current},e)};Nb.displayName="ReactFlowProvider";const qA=({children:e})=>w.useContext(xf)?ve.createElement(ve.Fragment,null,e):ve.createElement(Nb,null,e);qA.displayName="ReactFlowWrapper";const a5={input:xA,default:S0,output:kA,group:bb},o5={default:Jh,straight:yb,step:gb,smoothstep:bf,simplebezier:mb},i5=[0,0],l5=[15,15],c5={x:0,y:0,zoom:1},u5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},BA=w.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:l=a5,edgeTypes:c=o5,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onConnect:v,onConnectStart:S,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:k,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:R,onNodeDoubleClick:I,onNodeDragStart:$,onNodeDrag:q,onNodeDragStop:B,onNodesDelete:P,onEdgesDelete:W,onSelectionChange:ne,onSelectionDragStart:ee,onSelectionDrag:M,onSelectionDragStop:X,onSelectionContextMenu:V,onSelectionStart:G,onSelectionEnd:F,connectionMode:L=mi.Strict,connectionLineType:H=eo.Bezier,connectionLineStyle:D,connectionLineComponent:K,connectionLineContainerStyle:re,deleteKeyCode:z="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:U=!1,selectionMode:ae=_u.Full,panActivationKeyCode:le="Space",multiSelectionKeyCode:ge=Zh()?"Meta":"Control",zoomActivationKeyCode:Ne=Zh()?"Meta":"Control",snapToGrid:Ie=!1,snapGrid:Ge=l5,onlyRenderVisibleElements:Pe=!1,selectNodesOnDrag:ze=!0,nodesDraggable:Re,nodesConnectable:st,nodesFocusable:ue,nodeOrigin:ce=i5,edgesFocusable:se,edgesUpdatable:be,elementsSelectable:Le,defaultViewport:de=c5,minZoom:fe=.5,maxZoom:Ce=2,translateExtent:pe=_0,preventScrolling:_e=!0,nodeExtent:Ye,defaultMarkerColor:qe="#b1b1b7",zoomOnScroll:ke=!0,zoomOnPinch:Ae=!0,panOnScroll:Ue=!1,panOnScrollSpeed:Fe=.5,panOnScrollMode:Ve=li.Free,zoomOnDoubleClick:rt=!0,panOnDrag:ut=!0,onPaneClick:ct,onPaneMouseEnter:yt,onPaneMouseMove:It,onPaneMouseLeave:zt,onPaneScroll:Xt,onPaneContextMenu:Ft,children:rn,onEdgeContextMenu:Se,onEdgeDoubleClick:vt,onEdgeMouseEnter:kt,onEdgeMouseMove:_n,onEdgeMouseLeave:Ut,onEdgeUpdate:Vn,onEdgeUpdateStart:Vt,onEdgeUpdateEnd:$t,onReconnect:Zt,onReconnectStart:Ln,onReconnectEnd:Ur,reconnectRadius:xe=10,edgeUpdaterRadius:ir=10,onNodesChange:Ns,onEdgesChange:Hr,noDragClassName:ma="nodrag",noWheelClassName:Ss="nowheel",noPanClassName:xr="nopan",fitView:Pn=!1,fitViewOptions:Hs,connectOnClick:Q=!0,attributionPosition:De,proOptions:Je,defaultEdgeOptions:He,elevateNodesOnSelect:tt=!0,elevateEdgesOnSelect:wt=!1,disableKeyboardA11y:gt=!1,autoPanOnConnect:At=!0,autoPanOnNodeDrag:Ct=!0,connectionRadius:Qt=20,isValidConnection:St,onError:br,style:lr,id:Ci,nodeDragThreshold:dt,...cr},sn)=>{const Wr=Ci||"1";return ve.createElement("div",{...cr,style:{...lr,...u5},ref:sn,className:jn(["react-flow",s]),"data-testid":"rf__wrapper",id:Ci},ve.createElement(qA,null,ve.createElement(r5,{onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:R,onNodeDoubleClick:I,nodeTypes:l,edgeTypes:c,connectionLineType:H,connectionLineStyle:D,connectionLineComponent:K,connectionLineContainerStyle:re,selectionKeyCode:Z,selectionOnDrag:U,selectionMode:ae,deleteKeyCode:z,multiSelectionKeyCode:ge,panActivationKeyCode:le,zoomActivationKeyCode:Ne,onlyRenderVisibleElements:Pe,selectNodesOnDrag:ze,defaultViewport:de,translateExtent:pe,minZoom:fe,maxZoom:Ce,preventScrolling:_e,zoomOnScroll:ke,zoomOnPinch:Ae,zoomOnDoubleClick:rt,panOnScroll:Ue,panOnScrollSpeed:Fe,panOnScrollMode:Ve,panOnDrag:ut,onPaneClick:ct,onPaneMouseEnter:yt,onPaneMouseMove:It,onPaneMouseLeave:zt,onPaneScroll:Xt,onPaneContextMenu:Ft,onSelectionContextMenu:V,onSelectionStart:G,onSelectionEnd:F,onEdgeContextMenu:Se,onEdgeDoubleClick:vt,onEdgeMouseEnter:kt,onEdgeMouseMove:_n,onEdgeMouseLeave:Ut,onReconnect:Zt??Vn,onReconnectStart:Ln??Vt,onReconnectEnd:Ur??$t,reconnectRadius:xe??ir,defaultMarkerColor:qe,noDragClassName:ma,noWheelClassName:Ss,noPanClassName:xr,elevateEdgesOnSelect:wt,rfId:Wr,disableKeyboardA11y:gt,nodeOrigin:ce,nodeExtent:Ye}),ve.createElement(J4,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:v,onConnectStart:S,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:k,nodesDraggable:Re,nodesConnectable:st,nodesFocusable:ue,edgesFocusable:se,edgesUpdatable:be,elementsSelectable:Le,elevateNodesOnSelect:tt,minZoom:fe,maxZoom:Ce,nodeExtent:Ye,onNodesChange:Ns,onEdgesChange:Hr,snapToGrid:Ie,snapGrid:Ge,connectionMode:L,translateExtent:pe,connectOnClick:Q,defaultEdgeOptions:He,fitView:Pn,fitViewOptions:Hs,onNodesDelete:P,onEdgesDelete:W,onNodeDragStart:$,onNodeDrag:q,onNodeDragStop:B,onSelectionDrag:M,onSelectionDragStart:ee,onSelectionDragStop:X,noPanClassName:xr,nodeOrigin:ce,rfId:Wr,autoPanOnConnect:At,autoPanOnNodeDrag:Ct,onError:br,connectionRadius:Qt,isValidConnection:St,nodeDragThreshold:dt}),ve.createElement(Z4,{onSelectionChange:ne}),rn,ve.createElement(j4,{proOptions:Je,position:De}),ve.createElement(sD,{rfId:Wr,disableKeyboardA11y:gt})))});BA.displayName="ReactFlow";const d5=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function zA(){return Et(d5,pn)}const UA=({id:e,x:t,y:n,width:r,height:s,style:l,color:c,strokeColor:u,strokeWidth:f,className:p,borderRadius:h,shapeRendering:m,onClick:y,selected:v})=>{const{background:S,backgroundColor:b}=l||{},_=c||S||b;return ve.createElement("rect",{className:jn(["react-flow__minimap-node",{selected:v},p]),x:t,y:n,rx:h,ry:h,width:r,height:s,fill:_,stroke:u,strokeWidth:f,shapeRendering:m,onClick:y?k=>y(k,e):void 0})};UA.displayName="MiniMapNode";var h5=w.memo(UA);const f5=e=>e.nodeOrigin,p5=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),xm=e=>e instanceof Function?e:()=>e;function m5({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:l=h5,onClick:c}){const u=Et(p5,pn),f=Et(f5),p=xm(t),h=xm(e),m=xm(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ve.createElement(ve.Fragment,null,u.map(v=>{const{x:S,y:b}=ui(v,f).positionAbsolute;return ve.createElement(l,{key:v.id,x:S,y:b,width:v.width,height:v.height,style:v.style,selected:v.selected,className:m(v),color:p(v),borderRadius:r,strokeColor:h(v),strokeWidth:s,shapeRendering:y,onClick:c,id:v.id})}))}var g5=w.memo(m5);const y5=200,w5=150,v5=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?C4(kf(t,e.nodeOrigin),n):n,rfId:e.rfId}},x5="react-flow__minimap-desc";function HA({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:l=5,nodeStrokeWidth:c=2,nodeComponent:u,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:y,onNodeClick:v,pannable:S=!1,zoomable:b=!1,ariaLabel:_="React Flow mini map",inversePan:k=!1,zoomStep:j=10,offsetScale:E=5}){const C=tn(),R=w.useRef(null),{boundingRect:I,viewBB:$,rfId:q}=Et(v5,pn),B=(e==null?void 0:e.width)??y5,P=(e==null?void 0:e.height)??w5,W=I.width/B,ne=I.height/P,ee=Math.max(W,ne),M=ee*B,X=ee*P,V=E*ee,G=I.x-(M-I.width)/2-V,F=I.y-(X-I.height)/2-V,L=M+V*2,H=X+V*2,D=`${x5}-${q}`,K=w.useRef(0);K.current=ee,w.useEffect(()=>{if(R.current){const Z=Lr(R.current),U=ge=>{const{transform:Ne,d3Selection:Ie,d3Zoom:Ge}=C.getState();if(ge.sourceEvent.type!=="wheel"||!Ie||!Ge)return;const Pe=-ge.sourceEvent.deltaY*(ge.sourceEvent.deltaMode===1?.05:ge.sourceEvent.deltaMode?1:.002)*j,ze=Ne[2]*Math.pow(2,Pe);Ge.scaleTo(Ie,ze)},ae=ge=>{const{transform:Ne,d3Selection:Ie,d3Zoom:Ge,translateExtent:Pe,width:ze,height:Re}=C.getState();if(ge.sourceEvent.type!=="mousemove"||!Ie||!Ge)return;const st=K.current*Math.max(1,Ne[2])*(k?-1:1),ue={x:Ne[0]-ge.sourceEvent.movementX*st,y:Ne[1]-ge.sourceEvent.movementY*st},ce=[[0,0],[ze,Re]],se=ua.translate(ue.x,ue.y).scale(Ne[2]),be=Ge.constrain()(se,ce,Pe);Ge.transform(Ie,be)},le=JR().on("zoom",S?ae:null).on("zoom.wheel",b?U:null);return Z.call(le),()=>{Z.on("zoom",null)}}},[S,b,k,j]);const re=y?Z=>{const U=fs(Z);y(Z,{x:U[0],y:U[1]})}:void 0,z=v?(Z,U)=>{const ae=C.getState().nodeInternals.get(U);v(Z,ae)}:void 0;return ve.createElement(hb,{position:m,style:e,className:jn(["react-flow__minimap",t]),"data-testid":"rf__minimap"},ve.createElement("svg",{width:B,height:P,viewBox:`${G} ${F} ${L} ${H}`,role:"img","aria-labelledby":D,ref:R,onClick:re},_&&ve.createElement("title",{id:D},_),ve.createElement(g5,{onClick:z,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:s,nodeStrokeWidth:c,nodeComponent:u}),ve.createElement("path",{className:"react-flow__minimap-mask",d:`M${G-V},${F-V}h${L+V*2}v${H+V*2}h${-L-V*2}z
|
|
57
|
-
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}HA.displayName="MiniMap";var b5=w.memo(HA);function k5(){return ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ve.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function N5(){return ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ve.createElement("path",{d:"M0 0h32v4.2H0z"}))}function S5(){return ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ve.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 j5(){return ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ve.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 _5(){return ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ve.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 Or=({children:e,className:t,...n})=>ve.createElement("button",{type:"button",className:jn(["react-flow__controls-button",t]),...n},e);Or.displayName="ControlButton";const E5=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),WA=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:l,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:p,children:h,position:m="bottom-left"})=>{const y=tn(),[v,S]=w.useState(!1),{isInteractive:b,minZoomReached:_,maxZoomReached:k}=Et(E5,pn),{zoomIn:j,zoomOut:E,fitView:C}=Nf();if(w.useEffect(()=>{S(!0)},[]),!v)return null;const R=()=>{j(),l==null||l()},I=()=>{E(),c==null||c()},$=()=>{C(s),u==null||u()},q=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),f==null||f(!b)};return ve.createElement(hb,{className:jn(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&ve.createElement(ve.Fragment,null,ve.createElement(Or,{onClick:R,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},ve.createElement(k5,null)),ve.createElement(Or,{onClick:I,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:_},ve.createElement(N5,null))),n&&ve.createElement(Or,{className:"react-flow__controls-fitview",onClick:$,title:"fit view","aria-label":"fit view"},ve.createElement(S5,null)),r&&ve.createElement(Or,{className:"react-flow__controls-interactive",onClick:q,title:"toggle interactivity","aria-label":"toggle interactivity"},b?ve.createElement(_5,null):ve.createElement(j5,null)),h)};WA.displayName="Controls";var C5=w.memo(WA),ys;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ys||(ys={}));function T5({color:e,dimensions:t,lineWidth:n}){return ve.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function R5({color:e,radius:t}){return ve.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const A5={[ys.Dots]:"#91919a",[ys.Lines]:"#eee",[ys.Cross]:"#e2e2e2"},M5={[ys.Dots]:1,[ys.Lines]:1,[ys.Cross]:6},I5=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function VA({id:e,variant:t=ys.Dots,gap:n=20,size:r,lineWidth:s=1,offset:l=2,color:c,style:u,className:f}){const p=w.useRef(null),{transform:h,patternId:m}=Et(I5,pn),y=c||A5[t],v=r||M5[t],S=t===ys.Dots,b=t===ys.Cross,_=Array.isArray(n)?n:[n,n],k=[_[0]*h[2]||1,_[1]*h[2]||1],j=v*h[2],E=b?[j,j]:k,C=S?[j/l,j/l]:[E[0]/l,E[1]/l];return ve.createElement("svg",{className:jn(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ve.createElement("pattern",{id:m+e,x:h[0]%k[0],y:h[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},S?ve.createElement(R5,{color:y,radius:j/l}):ve.createElement(T5,{dimensions:E,color:y,lineWidth:s})),ve.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}VA.displayName="Background";var $5=w.memo(VA);const O5=["us-gov","global","apac","us","eu","jp","au"],L5=new RegExp(`^(?:(?:${O5.join("|")})\\.)?anthropic\\.`,"i");function nc(e){return e.replace(L5,"")}const P5=["command","cmd","file_path","path","url","pattern","notebook_path"],PN=120,bm=e=>e.length>PN?`${e.slice(0,PN-1)}…`:e;function D5(e){if(typeof e=="string")return e.trim()?bm(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of P5){const r=t[n];if(typeof r=="string"&&r.trim())return bm(r.trim());if(Array.isArray(r)&&r.length>0&&r.every(s=>typeof s=="string")){const s=r.join(" ").trim();if(s)return bm(s)}}return null}const F5=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function DN(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const FN={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function Sb(e){const t=F5.exec(e);if(!t)return null;const n=DN(t[1],"status");return{label:(n&&Object.hasOwn(FN,n)?FN[n]:void 0)??"background task update",detail:DN(t[1],"summary")}}function GA(e){return e.filter(t=>!Sb(t.text))}const q5=/[0-9a-f]{16,}/i,B5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function KA(e){return q5.test(e)||B5.test(e)}function z5(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!KA(t[n]))return t[n];return t[t.length-1]}function YA(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function jb(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 U5(e){const t=jb(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 H5(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]=U5(r));return Object.keys(t).length?t:void 0}function XA(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),...jb(n)};for(const r of Object.values(n)){const s=XA(r,t+1);if(s)return s}return null}const W5=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,V5=new Set(["tool_input","tool_response"]);function ZA(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&W5.test(nc(n.model)))return n.model;for(const[r,s]of Object.entries(n)){if(V5.has(r))continue;const l=ZA(s,t+1);if(l)return l}return null}function E0(){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 ao(e){return z5(e)}function qN(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Vl(e,t){return`${e}::${t}`}function oo(e,t){return`${e}\0${t}`}function ef(e){const t=e.agent_type??e.subagent_type;return t&&!KA(t)?t:"subagent"}function mu(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function $l(e,t,n,r){const s=t;let l=e.agents.get(s);return l||(l={id:s,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:r,usage:YA()},e.agents.set(s,l),l)}function QA(e,t,n,r){const s=Vl(t,n),l=e.agents.get(s);if(!l)return null;!l.cwd&&r.cwd&&(l.cwd=r.cwd,l.cwdBasename=ao(r.cwd));const c=ef(r);return c&&(l.label==="subagent"||!l.label)&&(l.label=c),l}function G5(e,t,n){const r=t.session_id??"unknown",s=mu(t);if(s){const f=QA(e,r,s,t);if(f)return f}const l=e.activeSubagentStack.get(r),c=l&&l.length>0?l[l.length-1]:null;if(c){const f=e.agents.get(Vl(r,c));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=ao(t.cwd)),f}const u=$l(e,r,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=ao(t.cwd)),u.label==="session"&&t.cwd&&(u.label=ao(t.cwd)??"session"),u}function K5(e,t,n,r,s){const l=Vl(t,n),c=$l(e,t,s,!0);let u=e.agents.get(l);if(u){!u.cwd&&r.cwd&&(u.cwd=r.cwd,u.cwdBasename=ao(r.cwd));const p=ef(r);return p&&(u.label==="subagent"||!u.label)&&(u.label=p),u}u={id:l,sessionId:t,label:ef(r),kind:"subagent",parentId:c.id,state:"active",startedAt:s,tools:[],prompts:[],cwd:r.cwd,cwdBasename:ao(r.cwd),toolCount:0,childCount:0,usage:YA()},e.agents.set(l,u);const f=e.pendingSubagentModels.get(l);return f&&(u.model=f,e.pendingSubagentModels.delete(l)),c.childCount+=1,u}function Y5(e,t,n){const r=e.activeSubagentStack.get(t)??[];r.includes(n)||(r.push(n),e.activeSubagentStack.set(t,r))}function BN(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 ph(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 zN=200;function X5(e,t){for(const n of e.values()){const r=n.tools.find(s=>s.id===t);if(r)return r}return null}const Z5=25;function Q5(e,t){const n=t.tools;if(n.length>zN){const r=n.splice(0,n.length-zN);for(const s of r){const l=oo(t.sessionId,s.id);e.toolIndex.get(l)===s&&e.toolIndex.delete(l)}}for(let r=n.length-Z5-1;r>=0;r--){const s=n[r];if(s.trimmed)break;s.input=void 0,s.response=void 0,s.trimmed=!0}}function J5(e,t,n){const r=e.toolIndex.get(oo(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}const UN=2e3;function e6(e,t,n){for(let r=e.prompts.length-1;r>=0;r--){const s=e.prompts[r];if(s.at<t-UN)return!1;if(s.text===n&&s.at<=t+UN)return!0}return!1}const mh=2e3;function t6(e){let t=e.startedAt;for(const n of e.prompts)n.at>t&&(t=n.at);return t}function JA(e,t){for(const n of t.tools){const r=oo(t.sessionId,n.id);e.toolIndex.get(r)===n&&e.toolIndex.delete(r)}}function Hu(e,t){return t&&(e.revision+=1),t}function n6(e,t,n,r,s){if(e.agents.size<=n)return!1;const l=m=>m.state==="done"&&m.endedAt!=null&&t-m.endedAt>r,c=[],u=new Map;for(const[m,y]of e.agents){if(y.parentId!=null){const v=u.get(y.parentId);v?v.push(m):u.set(y.parentId,[m])}l(y)&&c.push({id:m,endedAt:y.endedAt})}if(c.length===0)return!1;c.sort((m,y)=>m.endedAt-y.endedAt);let f=0;const p=new Set,h=m=>{const y=e.agents.get(m);y&&(JA(e,y),e.agents.delete(m),p.add(y.sessionId),f++)};for(const m of c){if(e.agents.size<=n)break;if(!e.agents.has(m.id))continue;const y=(u.get(m.id)??[]).map(v=>e.agents.get(v)).filter(v=>v!=null);if(!y.some(v=>!l(v))){for(const v of y)h(v.id);h(m.id)}}if(s&&p.size>0){const m=new Set;for(const y of e.agents.values())m.add(y.sessionId);for(const y of p)m.has(y)||s(y)}return Hu(e,f>0)}function r6(e,t,n,r,s){const l=new Map;for(const[h,m]of e.agents){let y=l.get(m.sessionId);y||(y={ids:[],endedAt:0,live:!1,closed:!1},l.set(m.sessionId,y)),y.ids.push(h),m.kind==="root"&&m.closedAt!=null&&(y.closed=!0),m.state==="done"&&m.endedAt!=null?y.endedAt=Math.max(y.endedAt,m.endedAt):y.live=!0}const c=[...l].filter(([,h])=>!h.live&&h.endedAt>0&&t-h.endedAt>r).sort(([,h],[,m])=>h.closed===m.closed?h.endedAt-m.endedAt:h.closed?-1:1);let f=[...l.values()].filter(h=>!h.live).length-n;if(f<=0)return!1;let p=!1;for(const[h,m]of c){if(f<=0)break;for(const y of m.ids){const v=e.agents.get(y);v&&JA(e,v),e.agents.delete(y)}for(const y of e.pendingSubagentModels.keys())y.startsWith(`${h}::`)&&e.pendingSubagentModels.delete(y);s==null||s(h),f--,p=!0}return Hu(e,p)}function s6(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(oo((n==null?void 0:n.session_id)??"unknown",s))}function a6(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 Hu(e,t)}function o6(e,t,n){let r=!1;for(const s of e.agents.values()){if(s.provider==="codex")continue;const l=e.agents.get(s.sessionId),c=(l==null?void 0:l.lastEventAt)??(l==null?void 0:l.startedAt);for(const u of s.tools){const f=Math.max(u.startedAt,c??u.startedAt);u.endedAt==null&&t-f>n&&(u.endedAt=f,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(oo(s.sessionId,u.id)),r=!0)}}return Hu(e,r)}const HN=90*6e4;function i6(e,t,n){let r=!1;for(const s of e.agents.values()){if(s.kind!=="root")continue;const l=s.lastEventAt??s.startedAt;if(!(t-l<=n)){s.waiting&&(s.waiting=null,r=!0),s.closedAt==null&&(s.closedAt=l),s.state==="active"&&(s.state="done",s.endedAt=l,s.reaped=!0,r=!0);for(const c of e.agents.values())c.sessionId!==s.sessionId||c.kind==="root"||c.state!=="active"||(c.state="done",c.endedAt=l,r=!0);e.activeSubagentStack.delete(s.sessionId)}}return Hu(e,r)}function l6(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const c6=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped"]);function u6(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 d6=3e4;function h6(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>d6)&&!(e.startedAt>t))return{name:e.name,preview:D5(e.input)??""}}function f6(e,t,n,r,s){if(n!=="permission")return{kind:n,message:r,since:s};const l=u6(e,t),c={kind:n,message:r,since:s};l!=null&&l.explicitSubagentId&&(c.subagentId=l.explicitSubagentId);const u=h6(l,s);return u&&(c.tool=u),c}function p6(e,t,n){if(e.kind==="idle")return!0;const r=mu(t);return r==null?!0:e.subagentId!=null&&Vl(n,r)===e.subagentId}function WN(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,l=r.hook_event_name??"Unknown";if(l==="__clear")return{...E0(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const c=r.session_id??"unknown";if(!c6.has(l)){const h=e.agents.get(c);h!=null&&h.waiting&&p6(h.waiting,r,c)&&(h.waiting=null)}const u=e.agents.get(c);if(u&&s>(u.lastEventAt??0)&&(u.lastEventAt=s,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof r.model_context_window=="number"&&r.model_context_window>0){const h=e.agents.get(c);h&&(h.contextWindow=r.model_context_window)}if(typeof r.approval_policy=="string"&&r.approval_policy){const h=e.agents.get(c);h&&(h.approvalPolicy=r.approval_policy)}if(typeof r.context_tokens=="number"&&r.context_tokens>=0){const h=e.agents.get(c);h&&(h.context={...h.context??qN(),currentContextTokens:r.context_tokens})}if(l==="ModelObserved"){const h=typeof r.model=="string"?r.model:null;if(h){const y=e.agents.get(c);y&&(y.model=h)}const m=r.subagentModels;if(m&&typeof m=="object")for(const[y,v]of Object.entries(m)){if(typeof v!="string")continue;const S=`${c}::${y}`,b=e.agents.get(S);if(b)b.model=v,e.pendingSubagentModels.delete(S);else if(e.pendingSubagentModels.delete(S),e.pendingSubagentModels.set(S,v),e.pendingSubagentModels.size>256){const _=e.pendingSubagentModels.keys().next().value;_!==void 0&&e.pendingSubagentModels.delete(_)}}return e}if(l==="ContextObserved"){const h=r.context??null;if(h){const m=e.agents.get(c);if(m){const y=m.context??qN(),v=(b,_)=>typeof h[b]=="number"?h[b]:_,S=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;m.context={msgsUser:v("msgsUser",y.msgsUser),msgsAssistant:v("msgsAssistant",y.msgsAssistant),toolUses:v("toolUses",y.toolUses),toolResults:v("toolResults",y.toolResults),systemReminders:v("systemReminders",y.systemReminders),currentContextTokens:v("currentContextTokens",y.currentContextTokens),memoryFiles:S??y.memoryFiles}}}return e}if(l==="SessionNamed"){const h=e.agents.get(c);if(h){const m=typeof r.sessionName=="string"?r.sessionName.trim():"",y=typeof r.sessionTitle=="string"?r.sessionTitle.trim():"";m&&(h.sessionName=m),y&&(h.sessionTitle=y);const v=h.sessionName??"";h.sessionTitle&&v&&h.sessionTitle.toLowerCase()===v.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(l==="SessionRecapped"){const h=e.agents.get(c);if(h){const m=r.recap;m===null?h.recap=void 0:m&&typeof m.text=="string"&&m.text.trim()&&Number.isFinite(m.at)&&(h.recap={text:m.text.trim(),at:m.at})}return e}if(l==="OutputObserved"){const h=r.kind==="thinking"||r.kind==="text"||r.kind==="tool_use"?r.kind:null,m=typeof r.at=="number"&&Number.isFinite(r.at)?r.at:s;if(!h)return e;const y=e.agents.get(c);if(!y||y.lastOutputAt!=null&&m<=y.lastOutputAt)return e;if(y.lastOutputAt=m,h!=="tool_use"){const v=(y.outputs??[]).filter(S=>m-S<m6);v.push(m),y.outputs=v.length>VN?v.slice(-VN):v}return e.revision+=1,e}if(l==="UsageObserved"){const h=r.usage??null;if(h){const m=e.agents.get(c);if(m){m.usage.inputTokens=Number(h.input_tokens??0),m.usage.outputTokens=Number(h.output_tokens??0),m.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const y=jb(h);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),m.usageByModel=H5(r.usageByModel)}}return e}const f=G5(e,r,s);f.provider||(f.provider=r.provider==="codex"?"codex":"claude");const p=ZA(r);switch(p&&(f.model=p),l){case"SessionStart":{const h=$l(e,c,s,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.endedAt=void 0,h.startedAt=Math.min(h.startedAt??s,s),!h.cwd&&r.cwd&&(h.cwd=r.cwd,h.cwdBasename=ao(r.cwd)),h.label==="session"&&r.cwd&&(h.label=ao(r.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===c&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<s&&(y.exitAt=s);const h=$l(e,c,s,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const m=(typeof r.prompt=="string"?r.prompt:typeof r.message=="string"?r.message:"")??"";m&&!e6(h,s,m)&&(h.prompts.push({at:s,text:m}),!h.firstPrompt&&!Sb(m)&&(h.firstPrompt=ph(m,120)));break}case"PreToolUse":{const h=r.tool_use_id?J5(e,f,r.tool_use_id):null;if(h){r.tool_name&&h.name==="?"&&(h.name=r.tool_name),h.endedAt==null&&!h.trimmed&&r.tool_input!==void 0&&(h.input=r.tool_input,h.inputPreview=ph(r.tool_input));break}const m=r.tool_use_id??`${f.id}:${f.toolCount}`,y=mu(r),v={id:m,name:r.tool_name??"?",input:r.tool_input,inputPreview:ph(r.tool_input),agentId:f.id,explicitSubagentId:y?Vl(c,y):void 0,startedAt:s};f.tools.push(v),f.toolCount+=1,f.state="active",e.toolIndex.set(oo(f.sessionId,m),v),Q5(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=r.tool_use_id;if(!h)break;const m=oo(c,h);let y=e.toolIndex.get(m),v=!1;if(!y)for(const b of e.agents.values()){if(b.sessionId!==c)continue;const _=b.tools.find(k=>k.id===h);if(_){y=_,v=!0;break}}if(!y||y.outcomeApplied)break;y.outcomeApplied=!0,y.outcomeGap=void 0,y.endedAt=s,y.ok=l==="PostToolUse",y.trimmed||(y.response=r.tool_response),l==="PostToolUseFailure"?y.errorPreview=ph(r.tool_response):v&&(y.errorPreview=void 0);const S=XA(r.tool_response);S&&(y.usage=S),e.toolIndex.delete(m);break}case"SubagentStart":{const h=mu(r);if(!h)break;const m=K5(e,c,h,r,s),y=ef(r);y&&(m.label=y);const v=e.subagentTombstones.get(m.id);v!=null&&e.subagentTombstones.delete(m.id);const S=m.endedAt!=null&&s-m.endedAt<=mh,b=v!=null&&s-v<=mh;if(S||b){const _=b?v:m.endedAt;m.state="done",m.endedAt=_,m.startedAt=Math.min(m.startedAt,_),BN(e,c,h);break}m.state="active",m.startedAt=m.startedAt||s,m.exitAt=void 0,m.endedAt=void 0,Y5(e,c,h);break}case"SubagentStop":{const h=mu(r);if(!h)break;const m=QA(e,c,h,r);if(!m){for(const[y,v]of e.subagentTombstones)s-v>mh&&e.subagentTombstones.delete(y);e.subagentTombstones.set(Vl(c,h),s);break}m.state="done",m.endedAt=Math.min(m.endedAt??s,s),BN(e,c,h);break}case"Stop":case"SessionEnd":{const h=$l(e,c,s,!1),m=t6(h);if(s<m)break;const y=h.lastTurnEndAt;if(y!=null&&m>y&&s<=y+mh)break;h.state="done",h.endedAt=s,h.lastTurnEndAt=s;for(const v of h.provider==="codex"?[]:e.agents.values())if(v.sessionId===c)for(const S of v.tools)S.endedAt==null&&S.explicitSubagentId==null&&(S.endedAt=s,S.ok=!1,S.errorPreview=S.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(oo(v.sessionId,S.id)));l==="SessionEnd"&&(h.closedAt=s),e.activeSubagentStack.delete(c);break}case"Notification":{const h=l6(r.notification_type);if(!h)break;const m=$l(e,c,s,!1),y=typeof r.message=="string"?r.message:"",v=m.waiting;m.waiting=v&&v.kind===h&&v.message===y?{...v,since:Math.min(v.since,s)}:f6(e,c,h,y,s);break}}return e}const m6=6e4,VN=64;function tf(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}const g6={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},y6=[{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:g6},{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 w6(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Ni(e,t=Date.now()){if(!e)return null;const n=nc(e);for(const r of y6)if(r.match.test(n))return typeof r.rates=="function"?r.rates(t):r.rates;return null}function eM(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),l=r+s,c=t.cacheWrite1h??t.cacheWrite;return{tokens5m:l,tokens1h:n,usd5m:l*t.cacheWrite/1e6,usd1h:n*c/1e6}}function tM(e,t,n=Date.now()){if(!w6(t))return e.inputTokens;const r=Ni(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 Cu(e,t,n=Date.now()){const r=Ni(t,n);if(!r)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const s=tM(e,t,n)*r.input/1e6,l=e.outputTokens*r.output/1e6,c=e.cacheReadTokens*r.cacheRead/1e6,u=eM(e,r),f=u.usd5m+u.usd1h;return{input:s,output:l,cacheRead:c,cacheWrite:f,total:s+l+c+f}}const GN=2e5,v6=1e6,x6=[/\[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],b6=[{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 k6(e){if(!e)return GN;const t=nc(e);for(const n of x6)if(n.test(t))return v6;for(const n of b6)if(n.match.test(t))return n.window;return GN}function nM(e,t){return typeof e=="number"&&e>0?e:k6(t)}const la="not priced";function bt(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const t=(e*100).toFixed(e<.1?1:0);if(Number(t)<100)return`${t}¢`}if(e<100){const t=e.toFixed(2);if(Number(t)<100)return`$${t}`}if(e<1e4){const t=e.toFixed(0);if(Number(t)<1e4)return`$${t}`}return`$${(e/1e3).toFixed(1)}k`}function _b(e,t){if(e<=0||t<10)return null;const n=e/t,r=n*60;return r>=.01?`${bt(r)}/min`:`${bt(n*3600)}/hr`}function N6(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 S6(e,t){let n=0,r=0,s=0,l=0,c=0,u=0;for(const m of t)n+=m.inputTokens,r+=m.outputTokens,s+=m.cacheReadTokens,l+=m.cacheCreateTokens,c+=m.cacheCreate1hTokens??0,u+=m.cacheCreate5mTokens??0;const f=(m,y)=>Math.max(0,m-y),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,r),cacheReadTokens:f(e.cacheReadTokens,s),cacheCreateTokens:f(e.cacheCreateTokens,l)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,c),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Wu(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const r=n.map(l=>({model:l,usage:t[l]})),s=S6(e.usage,r.map(l=>l.usage));if(s){const l=r.findIndex(c=>c.model===e.model);l>=0?r[l]={model:r[l].model,usage:N6(r[l].usage,s)}:r.push({model:e.model,usage:s})}return r}function or(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const r of Wu(e)){const s=Cu(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 Tu(e,t=Date.now()){let n=0;for(const r of Wu(e))Ni(r.model,t)==null&&(n+=r.usage.inputTokens+r.usage.outputTokens);return n}function rM(e){const t=[];for(const n of Wu(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 sM(e){return rM(e).filter(t=>t!==e.model)}const j6=new Set(["untrusted","on-request","on-failure"]);function _6(e){return typeof e!="string"||!e?null:j6.has(e)?!0:e==="never"?!1:null}function E6(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=_6(e.approvalPolicy);return t===!1?null:{label:"approvals not visible",detail:`${t===!0?`This session's approval policy is "${e.approvalPolicy}", so Codex can stop and ask you to approve a command.`:"This session's approval policy has not been read yet, so it may be able to stop and ask you to approve a command."}
|
|
58
|
-
|
|
59
|
-
Codex writes no approval request to its rollout files, which are the only thing this deck can read — so when it does ask, this card, the sidebar, the topbar count, the tab title and the favicon will all stay silent. Check the terminal.`}}function KN(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function io(e){const t=nc(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const s=KN(n[1]),l=n[2].replace(/[-_]/g,".");return`${s} ${l}`}const r=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(r){const s=r[1].replace(/[-_]/g,"."),l=r[2].split(/[-_]/).filter(Boolean).map(KN);return[`GPT-${s}`,...l].join(" ")}return e}function Sf(e){const t=nc(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Dr(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function km(e){const t=[];for(const n of e)n.kind==="root"&&Dr(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 C6(e,t){if(e.length===0)return null;const n=e.findIndex(r=>r.id===t);return e[(n+1)%e.length]}function T6(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function jf(e,t){return`${e}@${t.since}`}function aM(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 R6(e){const t=e.message||"Needs your permission",n=aM(e,t);return n?`${t}
|
|
60
|
-
Likely on: ${n}`:t}function A6(e,t,n,r=!0){if(!r)return[];if(n)return[];const s=[];for(const l of e){if(!Dr(l.waiting))continue;const c=jf(l.id,l.waiting);t.has(c)||s.push({key:c,title:l.label,body:R6(l.waiting),sessionId:l.id})}return s}function M6(e,t,n){const r=new Set;for(const l of e)r.add(jf(l.id,l.waiting));const s=new Set;for(const l of n)r.has(l)&&s.add(l);for(const l of t)s.add(l.key);return s}function Nm(e){return new Set(e.map(t=>jf(t.id,t.waiting)))}function I6(e,t){return e!==t}function $6(e,t){return!e&&t!=null}function O6(e,t){return e!==null&&t!=null}function Pt(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 Gl(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 l=Math.floor(s/60),c=s%60;return`${l}m ${String(c).padStart(2,"0")}s`}function oM(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 Eb(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 L6=1;function P6(){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,l="dialog"){const c={dismiss:r,layer:s,kind:l,seq:t++};return e.push(c),()=>{const u=e.indexOf(c);u!==-1&&e.splice(u,1)}},dismissTop(){const r=n();return r?(r.dismiss(),!0):!1},isTop(r){const s=n();return s!=null&&s.dismiss===r},depth(){return e.length},dialogDepth(){return e.filter(r=>r.kind==="dialog").length}}}const gu=P6(),D6=e=>e==="Escape";function F6(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function YN(e){return String(e.tagName??"").toUpperCase()==="BODY"}function q6(e,t){return!e||!e.isConnected||YN(e)?!1:t==null||YN(t)}const XN="a[href], button, input, select, textarea, [tabindex]";function B6(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function z6(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function U6({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 _f(e){return e.ctrlKey||e.metaKey||e.altKey}const H6=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),W6=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),V6=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function Cb(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function G6(e){return Cb(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function Ef(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=Cb(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!H6.has(String(e.type??"text").toLowerCase())}function K6(e,t){if(!e)return!1;if(Ef(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&G6(e))return!1;if(W6.has(Cb(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>V6.has(r))}function Y6({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function X6({appModal:e,dialogDepth:t}){return e||t>0}function iM(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(XN))return B6({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&z6({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(XN)!=null})}):[]}function Z6(e,t){const n=iM(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 mn(e,t={}){const{focusRef:n,layer:r,popover:s}=t,l=s?"popover":"dialog",c=w.useRef(null),u=w.useRef(e);u.current=e;const f=w.useRef(null);f.current===null&&(f.current=()=>u.current());const p=f.current;return w.useEffect(()=>gu.push(p,r,l),[p,r,l]),w.useEffect(()=>{var m;const h=document.activeElement;return(m=(n==null?void 0:n.current)??iM(c.current)[0])==null||m.focus(),()=>{q6(h,document.activeElement)&&h.focus()}},[]),w.useEffect(()=>{const h=m=>{var k;if(m.key!=="Tab"||_f(m))return;const y=c.current;if(!y)return;const v=document.activeElement;if(!(v!=null&&y.contains(v))&&!gu.isTop(p))return;const b=Z6(y,v),_=U6({count:b.length,index:v?b.indexOf(v):-1,shiftKey:m.shiftKey});_.kind!=="allow"&&(m.preventDefault(),_.kind==="focus"&&((k=b[_.index])==null||k.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[p]),c}function Q6(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 $r(e){return e.toLocaleString()}function J6(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const eF=60;function tF(e,t=eF){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 nF({agent:e,onClose:t}){var y;const n=w.useRef(null),r=mn(t,{focusRef:n}),s=e.context,l=e.usage,c=(s==null?void 0:s.currentContextTokens)??0,u=nM(e.contextWindow,e.model),f=Math.min(100,c/u*100),p=or(e),h=e.provider==="codex"?l.inputTokens+l.outputTokens:l.inputTokens+l.outputTokens+l.cacheReadTokens+l.cacheCreateTokens,m=Q6(e.provider);return o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:r,className:"modal ctx-modal",onClick:v=>v.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[o.jsxs("header",{className:"ctx-modal-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),o.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),o.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),o.jsxs("section",{className:"ctx-window-row",children:[o.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-label":"Context window used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:o.jsx("div",{className:"ctx-window-fill",style:{transform:`scaleX(${Math.min(100,Math.max(0,f))/100})`}})}),o.jsxs("div",{className:"ctx-window-meta",children:[o.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),o.jsxs("span",{children:[$r(c)," / ",$r(u)," tok (",m.windowScope,")"]})]})]}),o.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),o.jsxs("div",{className:"ctx-grid",children:[o.jsx(hs,{label:"input tokens",val:$r(l.inputTokens)}),o.jsx(hs,{label:"output tokens",val:$r(l.outputTokens)}),o.jsx(hs,{label:"cache reads",val:$r(l.cacheReadTokens)}),o.jsx(hs,{label:"cache writes",val:$r(l.cacheCreateTokens)}),o.jsx(hs,{label:"cumulative total",val:$r(h)}),o.jsx(hs,{label:"estimated cost",val:bt(p.total),accent:!0})]}),o.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?o.jsxs("div",{className:"ctx-grid",children:[o.jsx(hs,{label:"user messages",val:$r((s==null?void 0:s.msgsUser)??0)}),o.jsx(hs,{label:"assistant messages",val:$r((s==null?void 0:s.msgsAssistant)??0)}),o.jsx(hs,{label:"tool uses",val:$r((s==null?void 0:s.toolUses)??0)}),o.jsx(hs,{label:"tool results",val:$r((s==null?void 0:s.toolResults)??0)}),o.jsx(hs,{label:"system-reminders",val:$r((s==null?void 0:s.systemReminders)??0)})]}):o.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),o.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=s==null?void 0:s.memoryFiles)==null?void 0:y.length)??0)===0?o.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):o.jsx("ul",{className:"ctx-md-list",children:s.memoryFiles.map(v=>o.jsxs("li",{children:[o.jsx("span",{className:"ctx-md-path",title:v.path,children:tF(v.path)}),o.jsx("span",{className:"ctx-md-size",children:J6(v.bytes)})]},v.path))})]})})}function hs({label:e,val:t,accent:n}){return o.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[o.jsx("span",{className:"ctx-row-label",children:e}),o.jsx("span",{className:"ctx-row-val",children:t})]})}function rF({currentContextTokens:e,modelId:t,contextWindow:n,size:r=26,onClick:s}){const l=nM(n,t),c=Math.min(1,e/l),u=r/2-3,f=r/2,p=2*Math.PI*u,h=p*c,m=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return o.jsx("button",{type:"button",className:"ctx-donut",onClick:s,title:`context: ${e.toLocaleString()} / ${l.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":`Context ${Math.round(c*100)}% of ${l.toLocaleString()} tokens — show breakdown`,children:o.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,"aria-hidden":"true",children:[o.jsx("circle",{cx:f,cy:f,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),o.jsx("circle",{cx:f,cy:f,r:u,stroke:m,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),o.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}const ZN=new Map;function lM(e){let t=ZN.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},ZN.set(e,t)),t}function sF(e,t){const n=lM(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 aF(e){return lM(e).now}const QN=new Map,JN=new Map;function rc(e=1e3){let t=QN.get(e);t||(t=r=>sF(e,r),QN.set(e,t));let n=JN.get(e);return n||(n=()=>aF(e),JN.set(e,n)),w.useSyncExternalStore(t,n,n)}function Cf(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 oF="1",eS="agent-dag.schema",iF=["agent-dag.layout","agent-dag.viewport"];function yr(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function lF(e,t=oF){let n=null;try{n=e.getItem(eS)}catch{return[]}if(n===t)return[];const r=[];if(n!==null)for(const s of iF)try{e.getItem(s)!==null&&(e.removeItem(s),r.push(s))}catch{}try{e.setItem(eS,t)}catch{}return r}const cM="agent-dag.recapsDismissed",tS=200;function cF(){const e=yr(cM);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let Kl=new Set(cF());const C0=new Set;let uM=0;function dM(e){return C0.add(e),()=>{C0.delete(e)}}function hM(e){if(Kl=e,uM++,typeof window<"u")try{const t=Array.from(e);window.localStorage.setItem(cM,JSON.stringify(t.length>tS?t.slice(-tS):t))}catch{}for(const t of C0)t()}function fM(e,t){return`${e}@${t}`}function uF(e){return Kl.has(e)}function dF(e){if(Kl.has(e))return;const t=new Set(Kl);t.add(e),hM(t)}function hF(e){const t=new Set(Kl);t.delete(e)||t.add(e),hM(t)}function fF(e){return w.useSyncExternalStore(dM,()=>e!=null&&Kl.has(e),()=>!1)}function Tb(e){return`recap:${e}`}function pF(e){return e.startsWith("recap:")}function mF(){return w.useSyncExternalStore(dM,()=>uM,()=>0)}function gF(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 pM(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 mM(e){return e.live>0?`→ ${e.total} · ${e.live} live`:`→ ${e.total} · done`}function yF(e,t,n){const r=e.kind==="root"?e.waiting:null;if(r&&Dr(r))return{tone:"warn",long:n.sayWaiting(r),short:r.kind==="permission"?"Needs you":"Asked you"};if(r&&r.kind==="idle"){const l=n.sayWaiting(r);return{tone:"idle",long:l,short:l}}const s=e.tools.filter(l=>l.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:pM(t),short:mM(t)};if(e.state==="active")for(let l=e.tools.length-1;l>=0;l--){const c=e.tools[l];if(c.endedAt!=null)continue;const{name:u,subject:f}=n.describeCall(c);return{tone:"muted",long:f?`${u} · ${f}`:u,short:u}}return null}function T0(e){return e==="active"?"live":e==="done"?"done":"err"}const Tf={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"}},wF=Object.fromEntries(Object.entries(Tf).map(([e,t])=>[e,t.category])),vF=Object.fromEntries(Object.entries(Tf).map(([e,t])=>[e,t.emoji])),xF=Object.fromEntries(Object.entries(Tf).map(([e,t])=>[e,t.label])),bF=new Set(Object.entries(Tf).filter(([,e])=>e.shell).map(([e])=>e)),nS={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",...wF};function gM(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(nS,e)?nS[e]:"other"}const kF=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,NF=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function SF(e){if(typeof e!="string"||!e)return null;const t=kF.exec(e);if(t){const r=jF(t[2]);if(r.trim())return r}const n=NF.exec(e);return n?n[1]:null}function jF(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
61
|
-
`:n==="r"?"\r":n==="t"?" ":n)}const yM=600,_F=4,EF=36,R0=16,CF=60,TF=6,rS=220,RF=96,AF=28,sS={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:"📡",...vF};function aS(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(sS,e)?sS[e]:"✨"}const oS={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 wM(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 wM(n[1]);for(;;){const l=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;t=t.slice(l[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const r=t.match(/^([^\s|;&<>(]+)/);if(!r)return null;let 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 MF(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=SF(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 IF=new Set(["Bash","PowerShell",...bF]);function $F(e,t){return Math.max(RF,61+[...t].length*6.8)}function OF(e,t){if(!IF.has(e))return null;const n=MF(t);if(!n)return null;const r=wM(n);return r?{emoji:Object.hasOwn(oS,r)?oS[r]:"⚙️",label:r,category:"shell",detail:n}:null}const LF=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),iS={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:"🗄️"},lS={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 PF(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),r=n.lastIndexOf("/");return r>=0?n.slice(r+1):n}function DF(e){const t=e.toLowerCase();if(Object.hasOwn(lS,t))return lS[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const r=t.slice(n+1);if(Object.hasOwn(iS,r))return iS[r]}return"📄"}function FF(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 qF(e,t){if(!LF.has(e))return null;const n=FF(e,t);if(!n)return null;const r=PF(n);return r?{emoji:e==="LS"?"📂":DF(r),label:r,category:"file",detail:n}:null}const cS={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 Rb(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 BF(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 vM(e){const t=e.toLowerCase();return Object.hasOwn(cS,t)?cS[t]:void 0}function zF(e,t){const n=Rb(e);if(!n)return null;const{server:r,method:s}=n;if(!s)return null;const l=vM(r);return{emoji:(l==null?void 0:l.emoji)??"🔌",label:s,category:"mcp",detail:l?`${l.name} · ${s}`:`${r} · ${s}`}}function xM(e,t){return OF(e,t)??qF(e,t)??zF(e)}function UF(e,t){var n;return((n=xM(e,t))==null?void 0:n.label)??null}const uS=xF,dS=18;function gh(e){const t=[...e];return t.length<=dS?e:t.slice(0,dS-1).join("")+"…"}const Sm=13,HF=6;function WF(e,t){const n=[...e];if(n.length<=Sm)return e;const r=n.lastIndexOf("."),s=r>0?n.slice(r):[];return t==="file"&&s.length>1&&s.length<=HF?n.slice(0,Sm-1-s.length).join("")+"…"+s.join(""):n.slice(0,Sm-1).join("")+"…"}function Ab(e){const t=Rb(e);if(t){const r=vM(t.server);return r?{emoji:r.emoji,label:gh(r.name)}:{emoji:"🔌",label:gh(t.server),hue:BF(t.server)}}const n=Object.hasOwn(uS,e)?uS[e]:"";return n?{emoji:aS(e),label:gh(n)}:{emoji:aS(e),label:gh(e)}}function VF(e){let t=null,n="";for(const r of e){const s=Rb(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:Ab(n)}function GF(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function KF(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/yM)}function YF(e,t){const n=[],r=new Set;for(let s=e.length-1;s>=0&&n.length<t;s--){const l=e[s];r.has(l.id)||(r.add(l.id),n.push(l))}return n.reverse()}function XF(e,t,n,r,s,l){const c=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&l-u.exitAt>yM)continue;const f=r.get(u.id)??n.get(u.id);if(!f)continue;const p=YF(u.tools,_F);if(p.length===0)continue;const h=u.exitAt??null,m=s.get(u.id),y=Math.max((m==null?void 0:m.width)??rS,rS),v=(m==null?void 0:m.height)??130,S=f.x,b=f.y,_=S+y,k=b+v/2;p.forEach((j,E)=>{const C=E*EF,R=S+y+CF,I=b+TF+C,$=KF(l,h),q=j.inputPreview??"",B=GF(j),P=$<.999,W=Ab(j.name);c.push({id:`${u.id}::${j.id}`,toolId:j.id,agentId:u.id,toolName:j.name,name:W.label,emoji:W.emoji,status:B,category:gM(j.name),mcpHue:W.hue,inputPreview:q,fade:$,fading:P,worldX:R,worldY:I,anchorX:_,anchorY:k,spawnDx:_-R,spawnDy:k-(I+R0)});const ne=xM(j.name,j.input);if(ne){const ee=$F(j.name,W.label),M=R+ee+AF,X=I,V=R+ee,G=I+R0;c.push({id:`sub:${u.id}::${j.id}`,toolId:j.id,agentId:u.id,toolName:j.name,name:WF(ne.label,ne.category),fullName:ne.label,emoji:ne.emoji,isSub:!0,status:B,category:ne.category,inputPreview:ne.detail??q,fade:$,fading:P,worldX:M,worldY:X,anchorX:V,anchorY:G,spawnDx:V-M,spawnDy:0})}})}return c}function ZF({agents:e,visibleAgentIds:t,positions:n,pinned:r,measured:s,spotlight:l,hiddenCategories:c,now:u,onOpenTool:f}){const p=XF(e,t,n,r,s,u),h=c&&c.size>0?p.filter(m=>!c.has(m.category)):p;return o.jsx(QF,{bursts:h,spotlight:l,onOpenTool:f})}function QF({bursts:e,spotlight:t,onOpenTool:n}){const{x:r,y:s,zoom:l}=zA();return o.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[o.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const u=c.anchorX*l+r,f=c.anchorY*l+s,p=(c.worldX+6)*l+r,h=(c.worldY+R0)*l+s,m=Math.max(1,p-u),y=Math.min(1,Math.abs(h-f)/m),v=u+m*(.55-.22*y),S=t!=null&&!t.has(c.agentId),b=c.fade*(S?.14:1);return o.jsx("path",{d:`M ${u} ${f} Q ${v} ${f}, ${p} ${h}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:b},`l:${c.id}`)})}),e.map(c=>o.jsx(eq,{b:c,x:r,y:s,zoom:l,dim:t!=null&&!t.has(c.agentId),onOpenTool:n},c.id))]})}function JF(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 eq=w.memo(function({b:t,x:n,y:r,zoom:s,dim:l,onOpenTool:c}){const u=t.worldX*s+n,f=t.worldY*s+r,p={left:`${u}px`,top:`${f}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,y=c!=null,v=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},S=l?" dim":"";return o.jsx("div",{className:"tool-burst-wrap",style:p,children:o.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${y?" clickable":""}${t.isSub?" sub":""}${S}`,style:v,title:m,onClick:y?()=>c(t.toolId):void 0,children:[o.jsx("span",{className:"tb-emoji",children:t.emoji}),o.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&o.jsx("span",{className:"tb-spin"}),t.status==="done"&&o.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&o.jsx("span",{className:"tb-mark err",children:"×"})]})})},JF);function bM({kind:e}){return o.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"&&o.jsx("circle",{cx:"5",cy:"5",r:"3.2",fill:"currentColor"}),e==="done"&&o.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"&&o.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 Mb(){return o.jsxs("svg",{className:"alert-mark",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",focusable:"false",children:[o.jsx("path",{d:"M6 1.4l4.7 8.3H1.3z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",fill:"none"}),o.jsx("path",{d:"M6 4.6v2.4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),o.jsx("circle",{cx:"6",cy:"8.35",r:"0.72",fill:"currentColor"})]})}function hS(e,t){const n=Ni(t);if(!n)return`model: ${t}
|
|
62
|
-
no published rate in this build — the tokens are counted, the dollars are not`;const r=h=>h.toLocaleString(),s=h=>`$${h}/MTok`,l=Cu(e,t),c=eM(e,n),u=c.tokens1h>0?[`cache w5m${r(c.tokens5m).padStart(14)} × ${s(n.cacheWrite).padEnd(11)} = ${bt(c.usd5m)}`,`cache w1h${r(c.tokens1h).padStart(14)} × ${s(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${bt(c.usd1h)}`]:[`cache w ${r(c.tokens5m).padStart(14)} × ${s(n.cacheWrite).padEnd(11)} = ${bt(c.usd5m)}`],f=tM(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${r(f).padStart(14)} × ${s(n.input).padEnd(11)} = ${bt(l.input)}`,`output ${r(e.outputTokens).padStart(14)} × ${s(n.output).padEnd(11)} = ${bt(l.output)}`,`cache r ${r(e.cacheReadTokens).padStart(14)} × ${s(n.cacheRead).padEnd(11)} = ${bt(l.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${bt(l.total)}`].join(`
|
|
63
|
-
`)}function fS(e){const t=Wu(e);return t.length<=1?hS(e.usage,e.model):[...t.map(n=>hS(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${bt(or(e).total)}`].join(`
|
|
64
|
-
`)}function tq({data:e,selected:t}){var _,k;const n=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),r=e.tools.filter(j=>!j.endedAt).length,s=e.tools.filter(j=>j.ok===!1).length,l=tf(e.sessionId),c=((_=e.context)==null?void 0:_.currentContextTokens)??0,u=e.kind==="root"&&c>0,f=e.sessionTitle?e.cwd?`${e.cwd}
|
|
65
|
-
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=sM(e),h=p.length>0?`${e.model}
|
|
66
|
-
spend on this card also covers:
|
|
67
|
-
${p.join(`
|
|
68
|
-
`)}`:e.model,m=Eb(e.sessionName,e.sessionTitle),y=Cf(e),v=y?fM(e.sessionId,y.at):null,S=fF(v),b=y!=null&&!S;return o.jsxs("div",{className:n,style:{"--session-hue":l},children:[o.jsx("span",{className:"accent-stripe"}),o.jsx(gi,{type:"target",position:nt.Left,style:{background:"transparent",border:"none"}}),o.jsxs("div",{className:"head",children:[o.jsxs("div",{className:"title",children:[o.jsx(aq,{state:e.state}),o.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&o.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"}),y&&v&&o.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":"Claude Code's recap","aria-expanded":b,title:b?"Hide the recap":"Show Claude Code's recap",onClick:j=>{j.stopPropagation(),hF(v)},children:o.jsx(Ru,{})})]}),o.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&o.jsx(rF,{currentContextTokens:c,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),o.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?"≥ ":"",o.jsx(sq,{start:e.startedAt,end:e.endedAt})]})]})]}),o.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&o.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?o.jsxs("span",{className:"model-chip","data-family":Sf(e.model),title:h,children:[io(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?o.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&m.face&&o.jsx("div",{className:"session-name",title:m.tooltip,children:m.face}),e.waiting&&o.jsx(lq,{waiting:e.waiting}),(()=>{const j=E6(e);return j?o.jsxs("div",{className:"approval-blind-row",title:j.detail,children:[o.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),o.jsx("span",{className:"approval-blind-said",children:j.label})]}):null})(),(e.tools.length>0||(((k=e.outputs)==null?void 0:k.length)??0)>0)&&o.jsx(cq,{tools:e.tools,outputs:e.outputs}),o.jsxs("div",{className:"meta",children:[o.jsxs("span",{children:[o.jsx("b",{children:e.toolCount})," tools"]}),s>0&&o.jsxs("span",{className:"failed-meta",title:`${s} tool ${s===1?"call":"calls"} returned an error`,children:[o.jsx("b",{children:s})," err"]}),r>0&&o.jsxs("span",{className:"inflight-meta",children:[o.jsx("b",{children:r})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&o.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:[o.jsx("b",{children:Pt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const j=Ni(e.model),E=or(e),C=Tu(e);if(!j&&E.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:o.jsx("span",{className:"cost-unpriced",title:fS(e),children:la});if(E.total<=0)return null;const R=Math.max(0,((e.endedAt??Date.now())-e.startedAt)/1e3),I=e.state==="active"&&!e.synthetic?_b(E.total,R):null,$=fS(e)+(I?`
|
|
69
|
-
burn: ${I}`:"");return o.jsx("span",{className:"cost-meta",title:$,children:o.jsxs("b",{children:[bt(E.total),C>0?"+":""]})})})()]}),o.jsx(rq,{data:e,title:e.kind==="root"?m.face:void 0}),o.jsx(gi,{type:"source",position:nt.Right,style:{background:"transparent",border:"none"}})]})}const nq=w.memo(tq);function rq({data:e,title:t}){const n=e.kind==="root"&&Dr(e.waiting),r=yF(e,e.branch,{sayWaiting:Ib,describeCall:s=>({name:Ab(s.name).label,subject:UF(s.name,s.input)})});return o.jsxs("div",{className:"lod-face","data-kind":e.kind,"data-alarm":n?"":void 0,"data-signal":r?"":void 0,"aria-hidden":!0,children:[o.jsxs("div",{className:"lod-id",children:[o.jsx(bM,{kind:T0(e.state)}),o.jsx("span",{className:"lod-name",children:e.label}),r&&o.jsx("span",{className:"lod-inline","data-tone":r.tone,children:r.short}),n&&o.jsx(Mb,{})]}),t&&o.jsx("div",{className:"lod-title",children:t}),r&&o.jsxs("div",{className:"lod-signal","data-tone":r.tone,children:[o.jsx("span",{className:"lod-long",children:r.long}),o.jsx("span",{className:"lod-short",children:r.short})]})]})}function sq({start:e,end:t}){const n=rc(1e3);return o.jsx(o.Fragment,{children:Gl(e,t,n)})}function Yl(e){return e==="active"?"live":e==="done"?"done":"err"}function aq({state:e}){return o.jsx("span",{className:`state-pill state-${e}`,children:Yl(e)})}function Xl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function oq(e,t=Date.now(),n=!1){const r=e.tools.filter(l=>l.ok===!1).length,s=or(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",Yl(e.state),Dr(e.waiting)?Xl(e.waiting):null,e.model?io(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,r>0?`${r} failed`:null,s>0?`${bt(s)}${Tu(e,t)>0?"+":""}`:null,n?"selected":null].filter(Boolean).join(", ")}function iq(e,t){const n=aM(e,t);return n?`Likely on: ${n}`:null}function Ib(e){return e.kind==="idle"?"Your turn":Xl(e)}function lq({waiting:e}){const t=rc(1e3),n=Dr(e),r=Xl(e);return o.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${r}
|
|
70
|
-
Blocked for ${Gl(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?o.jsx("span",{className:"ap-pulse","aria-hidden":!0}):o.jsx("span",{className:"waiting-dot","aria-hidden":!0}),o.jsx("span",{className:"waiting-said",children:Ib(e)}),o.jsx("b",{children:Gl(e.since,void 0,t)})]})}function Ru(){return o.jsxs("svg",{className:"recap-glyph",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[o.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"}),o.jsx("circle",{cx:"6",cy:"1.2",r:"1.05",fill:"currentColor"}),o.jsx("circle",{cx:"6",cy:"10.8",r:"1.05",fill:"currentColor"}),o.jsx("circle",{cx:"1.2",cy:"6",r:"1.05",fill:"currentColor"}),o.jsx("circle",{cx:"10.8",cy:"6",r:"1.05",fill:"currentColor"})]})}function cq({tools:e,outputs:t}){const n=rc(1e3),r=6e4,s=24,l=r/s,c=new Array(s).fill(0);let u=0;const f=E=>{const C=n-E;if(C<0||C>=r)return;const R=s-1-Math.floor(C/l);R>=0&&R<s&&(c[R]+=1,u+=1)};for(const E of e)f(E.startedAt);for(const E of t??[])f(E);const p=2,h=Math.max(0,...c),m=132,y=14,v=m/s,S=h/(l/1e3),b=e.filter(E=>n-E.startedAt>=0&&n-E.startedAt<r).length,_=u-b,k=[b>0?`${b} tool ${b===1?"call":"calls"}`:"",_>0?`${_} ${_===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),j=u===0?"nothing in the last 60s":`${k.join(" · ")} in last 60s · peak ${S.toFixed(1)}/s`;return o.jsxs("div",{className:"tool-spark-row",title:j,children:[o.jsx("svg",{className:"tool-spark",width:m,height:y,viewBox:`0 0 ${m} ${y}`,"aria-hidden":!0,children:c.map((E,C)=>{const R=E===0?1.5:Math.max(1.5,Math.min(1,E/p)*y),I=C===s-1&&E>0,q=`tool-spark-bar${E>0?" active":""}${I?" latest":""}`;return o.jsx("rect",{x:C*v+.4,y:y-R,width:Math.max(.5,v-1),height:R,rx:.8,className:q},I?`landed:${E}`:C)})}),o.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function uq(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function yh(e){return e!=="gone"}function wh(e,t){const[n,r]=w.useState(()=>e?"here":"gone"),s=w.useRef(null);return w.useEffect(()=>{r(l=>uq(e,l))},[e]),w.useEffect(()=>{if(n==="leaving")return s.current=window.setTimeout(()=>r("gone"),t),()=>{s.current!=null&&window.clearTimeout(s.current)}},[n,t]),w.useEffect(()=>{n==="entering"&&r("here")},[n]),n}async function yi(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}const dq=60,hq=6e3,Fs=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),mr=e=>typeof e=="string"?e:null;function wi(e,t=""){if(e==null)return"(none)";if(typeof e=="string")return e;if(typeof e!="object")return String(e);const n=Array.isArray(e),r=n?e.map((l,c)=>[String(c),l]):Object.entries(e);if(r.length===0)return n?"[]":"{}";const s=[];for(const[l,c]of r){const u=n?`${t}-`:`${t}${l}:`;if(typeof c=="string"&&c.includes(`
|
|
71
|
-
`)){s.push(u);for(const f of c.split(`
|
|
72
|
-
`))s.push(`${t} ${f}`)}else if(c!==null&&typeof c=="object"){const f=wi(c,`${t} `);f==="[]"||f==="{}"?s.push(`${u} ${f}`):s.push(u,f)}else s.push(`${u} ${c===void 0?"(none)":String(c)}`)}return s.join(`
|
|
73
|
-
`)}function fq(e){return e.lines??e.text.split(`
|
|
74
|
-
`).map(t=>({text:t}))}function pq(e,t){if(t)return{shown:e,cut:!1};const n=[];let r=0;for(const s of e){if(n.length===dq)return{shown:n,cut:!0};const l=hq-r;if(s.text.length>l)return n.push({...s,text:`${s.text.slice(0,Math.max(l,0))}…`}),{shown:n,cut:!0};n.push(s),r+=s.text.length+1}return{shown:n,cut:!1}}const Wn=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),gr=(e,t)=>({label:e,text:t,inline:!0}),kM=(e,t)=>({label:e,text:t.map(n=>n.text).join(`
|
|
75
|
-
`),lines:t});function mq(e,t){return[...e.split(`
|
|
76
|
-
`).map(n=>({text:`- ${n}`,tone:"del"})),...t.split(`
|
|
77
|
-
`).map(n=>({text:`+ ${n}`,tone:"add"}))]}function gq(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!Fs(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 pS(e){if(typeof e=="string")return[Wn(void 0,e)];if(!Fs(e))return[Wn(void 0,wi(e))];const t=[],n=mr(e.type);n==="create"&&t.push(gr("result","created the file"));const r=gq(e.structuredPatch);return r&&t.push(kM("applied",r)),e.userModified===!0&&t.push(gr("note","the user changed it before it was applied")),t.length?t:[gr("result",n==="update"?"updated the file":"done")]}function yq(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 wq(e){if(typeof e=="string")return[Wn(void 0,e)];const t=Fs(e)&&Fs(e.file)?e.file:null,n=mr(t==null?void 0:t.content);if(t&&n!=null){const s=[],l=Number(t.numLines),c=Number(t.totalLines),u=Number(t.startLine);return Number.isFinite(l)&&Number.isFinite(c)&&c>0&&s.push(gr("lines",l>=c?`all ${c}`:Number.isFinite(u)?`${u}–${u+l-1} of ${c}`:`${l} of ${c}`)),s.push(Wn("content",n)),s}const r=Fs(e)?mr(e.type):null;return r&&r!=="text"?[gr("result",`${/^[aeiou]/i.test(r)?"an":"a"} ${r} file`)]:[Wn(void 0,wi(e))]}function vq(e){if(typeof e=="string")return[Wn("output",e)];if(!Fs(e))return[Wn(void 0,wi(e))];const t=mr(e.stdout),n=mr(e.stderr);if(t==null&&n==null)return[Wn(void 0,wi(e))];const r=[];return t&&r.push(Wn("output",t.replace(/\n$/,""))),n&&r.push(Wn("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&r.push(gr("note","interrupted before it finished")),r.length?r:[gr("output","none")]}function xq(e,t,n){const r=Fs(t)?t:null;if(r&&(e==="Edit"||e==="MultiEdit")){const s=mr(r.file_path),l=(e==="MultiEdit"?Array.isArray(r.edits)?r.edits:[]:[r]).filter(Fs).filter(c=>mr(c.old_string)!=null&&mr(c.new_string)!=null);if(s&&l.length){const c=[gr("file",s)];return l.forEach((u,f)=>{const p=u.replace_all===!0?", every occurrence":"";c.push(kM(l.length>1?`change ${f+1}${p}`:`change${p}`,mq(u.old_string,u.new_string)))}),{input:c,response:pS(n)}}}if(r&&e==="Write"){const s=mr(r.file_path),l=mr(r.content);if(s&&l!=null)return{input:[gr("file",s),Wn("content",l)],response:pS(n)}}if(r&&e==="Read"){const s=mr(r.file_path);if(s){const l=yq(r);return{input:l?[gr("file",s),gr("lines",l)]:[gr("file",s)],response:wq(n)}}}if(r&&e==="Bash"){const s=mr(r.command);if(s!=null){const l=mr(r.description);return{input:l?[Wn("command",s),gr("why",l)]:[Wn("command",s)],response:vq(n)}}}return{input:[Wn(void 0,wi(t))],response:[Wn(void 0,wi(n))]}}function mS(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(Fs(n)){if(e==="Bash"&&t==="input"&&typeof n.command=="string")return n.command;if(e==="Bash"&&t==="response"&&(typeof n.stdout=="string"||typeof n.stderr=="string"))return[n.stdout,n.stderr].filter(r=>typeof r=="string"&&r!=="").join(`
|
|
78
|
-
`);if(e==="Read"&&t==="response"&&Fs(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 bq({tool:e,onClose:t}){const n=mn(t),r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=e.input??e.inputPreview,l=e.response??e.errorPreview,c=xq(e.name,s,l);return o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:n,className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),o.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),o.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("span",{className:"modal-dur",children:oM(e,"in-flight…")}),o.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),o.jsxs("section",{className:"modal-body",children:[e.trimmed&&o.jsx("div",{className:"modal-section",children:o.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),o.jsxs("div",{className:"modal-section",children:[o.jsxs("div",{className:"tm-head",children:[o.jsx("h4",{children:"Input"}),o.jsx(yS,{text:mS(e.name,"input",s),what:"input"})]}),c.input.map((u,f)=>o.jsx(gS,{block:u},f))]}),o.jsxs("div",{className:"modal-section",children:[o.jsxs("div",{className:"tm-head",children:[o.jsxs("h4",{children:["Response ",r==="err"&&o.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&o.jsx(yS,{text:mS(e.name,"response",l),what:"response"})]}),e.endedAt==null?o.jsx("pre",{children:"(waiting…)"}):c.response.map((u,f)=>o.jsx(gS,{block:u},f))]})]})]})})}const kq={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function gS({block:e}){const[t,n]=w.useState(!1);if(e.inline)return o.jsxs("p",{className:"tm-inline",children:[e.label&&o.jsx("span",{className:"tm-label",children:e.label}),o.jsx("code",{children:e.text})]});const{shown:r,cut:s}=pq(fq(e),t);return o.jsxs("div",{className:"tm-block",children:[e.label&&o.jsx("span",{className:"tm-label",children:e.label}),o.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?r.map((l,c)=>o.jsxs("span",{className:l.tone?kq[l.tone]:void 0,children:[l.text,c<r.length-1?`
|
|
79
|
-
`:""]},c)):r.map(l=>l.text).join(`
|
|
80
|
-
`)}),s&&o.jsx("button",{type:"button",className:"btn tm-more",onClick:()=>n(!0),children:"show all"})]})}function yS({text:e,what:t}){const[n,r]=w.useState(!1),s=w.useRef(!0);return w.useEffect(()=>()=>{s.current=!1},[]),o.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void yi(e).then(l=>{!l||!s.current||(r(!0),window.setTimeout(()=>{s.current&&r(!1)},1600))}),children:n?"copied":"copy"})}const vh=18,wS=26,Nq=12,Sq=240;function jq(e,t){return(e+Sq)*(t||1)}function _q(e){return Eq(e.nodeInternals.values())}function Eq(e){const t=new Map;for(const s of e){if(s.type!=="agent"&&s.type!=="recapNote")continue;const l=s.data;if(!(l!=null&&l.sessionId)||l.exitAt!=null||s.width==null||s.height==null)continue;const c=s.position.x,u=s.position.y,f=c+s.width,p=u+s.height,h=t.get(l.sessionId);h?(h.minX=Math.min(h.minX,c),h.minY=Math.min(h.minY,u),h.maxX=Math.max(h.maxX,f),h.maxY=Math.max(h.maxY,p),l.kind==="root"&&(h.label=kS(l)??h.label),l.kind==="root"&&(h.name=NS(l)),l.kind==="root"&&(h.alarm=Dr(l.waiting)),l.kind==="root"&&(h.branch=bS(l))):t.set(l.sessionId,{minX:c,minY:u,maxX:f,maxY:p,label:kS(l)??l.sessionId,name:NS(l),alarm:l.kind==="root"&&Dr(l.waiting),branch:bS(l)})}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,l]of t){const c=(n.get(l.label)??0)>1;r.push({sessionId:s,...Rq(l.label,l.name,s,c),x:l.minX-vh,y:l.minY-vh-wS,w:l.maxX-l.minX+vh*2,h:l.maxY-l.minY+vh*2+wS,...l.alarm?{alarm:!0}:null,...l.branch?{branch:l.branch}:null})}return r}const Fh=" · ",Cq=32,Tq=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function vS(e){return Tq.test(e)?2:1}function xS(e,t=Cq){const n=[...e];let r=0;for(const c of n)r+=vS(c);if(r<=t)return e;const s=[];let l=0;for(const c of n){const u=vS(c);if(l+u>t-1)break;s.push(c),l+=u}for(;s.length&&/[\s\-_.:/]/.test(s[s.length-1]);)s.pop();return`${s.join("")}…`}function Rq(e,t,n,r){const s=(t==null?void 0:t.trim())??"",l=r?Aq(n):void 0,c=[e,s||void 0,l].filter(Boolean);return{label:xS(e),name:s?xS(s):void 0,shortId:l,fullLabel:c.join(Fh)}}function Aq(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function bS(e){if(e.kind!=="root")return;const t=e.branch;return t&&t.total>0?mM(t):void 0}function kS(e){if(e.kind==="root")return e.label}function NS(e){if(e.kind==="root")return Eb(e.sessionName,e.sessionTitle).face}function Mq({onFocusSession:e}){const{x:t,y:n,zoom:r}=zA(),s=Et(_q,Iq);if(s.length<=1)return null;const l=u=>{try{e==null||e(u)}catch{}},c={transform:`translate(${t}px, ${n}px) scale(${r})`};return o.jsx("div",{className:"session-clusters",style:c,children:s.map(u=>{const f=tf(u.sessionId),p={position:"absolute",left:0,top:0,transform:`translate(${u.x}px, ${u.y}px)`,width:u.w,height:u.h,"--session-hue":f},h={position:"absolute",left:u.x+16,top:u.y-Nq/(r||1),transform:`scale(${1/(r||1)})`,transformOrigin:"left top",maxWidth:jq(u.w,r),"--session-hue":f};return o.jsxs(ve.Fragment,{children:[o.jsx("div",{className:"cluster-card",style:p,"aria-hidden":!0}),o.jsxs("button",{type:"button",className:"cluster-label","data-alarm":u.alarm?"":void 0,style:h,title:`${u.alarm?`Waiting on you
|
|
81
|
-
`:""}Zoom to ${u.fullLabel}
|
|
82
|
-
drag the wrapper to move the whole session`,onClick:()=>l(u.sessionId),children:[u.alarm?o.jsxs(o.Fragment,{children:[o.jsx(Mb,{}),o.jsx("span",{className:"cluster-label-said",children:"waiting on you: "})]}):null,u.label,u.branch?o.jsx("span",{className:"cluster-label-branch",children:Fh+u.branch}):null,u.name?o.jsx("span",{className:"cluster-label-name",children:Fh+u.name}):null,u.shortId?o.jsx("span",{className:"cluster-label-id",children:Fh+u.shortId}):null]})]},u.sessionId)})})}function Iq(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 $q({data:e}){return o.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}function NM(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 qh(e){return NM(Math.floor(e/1e3))}function SM(e,t){const n=e-t;if(n<=0)return null;const r=Math.floor(n/86400),s=Math.floor(n%86400/3600),l=Math.floor(n%3600/60);return r>0?`${r}d ${s}h`:s>0?`${s}h ${l}m`:`${l}m`}function Oq(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function nf(e,t,n){const r=new Date(e),s=qh(t-e);return{label:Oq(r,new Date(t))?s:`${s} · ${r.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:r.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function Lq({data:e}){const t=rc(3e4),n=nf(e.recap.at,t);return o.jsxs("div",{className:"recap-note",role:"note","aria-label":"Claude Code's recap",style:{"--session-hue":e.hue},children:[o.jsxs("div",{className:"recap-note-head",children:[o.jsxs("span",{className:"recap-note-mark",children:[o.jsx(Ru,{}),"recap"]}),o.jsx("span",{className:"recap-note-age",title:n.title,children:n.label}),o.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(),dF(e.noteKey)},children:"×"})]}),o.jsx("p",{className:"recap-note-text",children:e.recap.text}),o.jsxs("div",{className:"lod-face recap-face","aria-hidden":!0,children:[o.jsxs("div",{className:"lod-id",children:[o.jsxs("span",{className:"recap-note-mark",children:[o.jsx(Ru,{}),"recap"]}),o.jsx("span",{className:"recap-face-age",children:n.label})]}),o.jsx("p",{className:"recap-face-text",children:e.recap.text})]}),o.jsx(gi,{type:"source",position:nt.Right,style:{background:"transparent",border:"none"}})]})}function Pq({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s,targetPosition:l,style:c}){const[u]=wb({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:l,curvature:.35});return o.jsxs("g",{className:"recap-tie",style:c,children:[o.jsx("path",{className:"recap-tie-thread",d:u}),o.jsx("path",{className:"recap-tie-beads",d:u}),o.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),o.jsx("circle",{className:"recap-tie-end",cx:n,cy:r,r:3.5})]})}function Dq(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,r=0,s=0,l=0;for(const c of e){const u=or(c);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=c.usage.inputTokens,r+=c.usage.outputTokens,s+=c.usage.cacheReadTokens,l+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:r,cacheReadTokens:s,cacheCreateTokens:l,sum:n+r}}const Fq="spend on this board",qq="on this board",SS=`Everything on the board right now, and only that.
|
|
83
|
-
Finished sessions are evicted from the canvas a couple of minutes after they end, and their tokens and dollars leave with them — so this figure falls on its own.
|
|
84
|
-
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,jM="session spend",A0="__unknown__",Bq=12;function zq(e,t=Date.now()){const n=new Map;for(const r of e)for(const s of Wu(r)){const l=s.model??A0,c=Cu(s.usage,s.model,t),u=n.get(l);u?(u.inputTokens+=s.usage.inputTokens,u.outputTokens+=s.usage.outputTokens,u.cacheReadTokens+=s.usage.cacheReadTokens,u.cacheCreateTokens+=s.usage.cacheCreateTokens,u.cost.total+=c.total,u.cost.input+=c.input,u.cost.output+=c.output,u.cost.cacheRead+=c.cacheRead,u.cost.cacheWrite+=c.cacheWrite,u.agentCount++):n.set(l,{model:l,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens,cost:{...c},agentCount:1,priced:Ni(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 Uq(e,t=Date.now()){const n=[...e],r=[];for(const s of n){if(s.kind!=="root")continue;let l=or(s,t).total,c=s.usage.inputTokens,u=s.usage.outputTokens,f=Tu(s,t);for(const p of n)p.sessionId!==s.sessionId||p.kind==="root"||(l+=or(p,t).total,c+=p.usage.inputTokens,u+=p.usage.outputTokens,f+=Tu(p,t));r.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",state:s.state,cost:l,inputTokens:c,outputTokens:u,unpricedTokens:f})}return r.sort((s,l)=>l.cost-s.cost||l.inputTokens+l.outputTokens-(s.inputTokens+s.outputTokens)).slice(0,Bq)}function $b({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const r=(l,c,u)=>{if(l<=0)return null;const f=l/n*100;return o.jsx("span",{className:`cb-seg ${c}`,style:{width:`${f}%`},title:`${u}: ${bt(l)} (${f.toFixed(0)}%)`},c)},s=t==="lg";return o.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")]})}function Hq({state:e,sessionId:t,onClose:n}){const r=w.useMemo(()=>Wq(e,t),[e,t]),s=w.useRef(null),l=mn(n,{focusRef:s});return r?o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:l,className:"modal session-summary",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[o.jsxs("div",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),o.jsx("span",{id:"ss-title",className:"modal-tool-name",title:r.cwd??r.sessionId,children:r.label}),o.jsxs("span",{className:"modal-tool-id",children:["· ",r.sessionId.slice(0,8)]})]}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("span",{className:"modal-dur",title:"Total wall time",children:r.durationLabel}),o.jsx("button",{type:"button",ref:s,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),o.jsxs("div",{className:"modal-body",children:[o.jsxs("section",{className:"ss-hero",children:[o.jsxs("div",{className:"ss-hero-left",children:[o.jsx("div",{className:"ss-cost-label",children:jM}),o.jsx("div",{className:"ss-cost",children:bt(r.cost.total)}),r.modelChips.length>0&&o.jsx("div",{className:"ss-models",children:r.modelChips.map(c=>o.jsx("span",{className:"model-chip","data-family":Sf(c),title:c,children:io(c)},c))})]}),o.jsx("div",{className:"ss-hero-right",children:r.cost.total>0&&o.jsxs(o.Fragment,{children:[o.jsx($b,{cost:r.cost,size:"lg"}),o.jsxs("div",{className:"ss-cost-legend",children:[o.jsxs("span",{className:"ssl ssl-in",children:["input ",o.jsx("b",{children:bt(r.cost.input)})]}),o.jsxs("span",{className:"ssl ssl-out",children:["output ",o.jsx("b",{children:bt(r.cost.output)})]}),o.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",o.jsx("b",{children:bt(r.cost.cacheRead)})]}),o.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",o.jsx("b",{children:bt(r.cost.cacheWrite)})]})]})]})})]}),o.jsxs("section",{className:"ss-stats",children:[o.jsx(Nl,{label:"agents",value:r.agentCount}),o.jsx(Nl,{label:"subagents",value:r.subagentCount}),o.jsx(Nl,{label:"tool calls",value:r.toolCount}),o.jsx(Nl,{label:"prompts",value:r.promptCount}),o.jsx(Nl,{label:"tokens",value:r.tokensSum.toLocaleString()}),r.errCount>0&&o.jsx(Nl,{label:"errors",value:r.errCount,tone:"err"})]}),r.topTools.length>0&&o.jsxs("section",{className:"modal-section",children:[o.jsx("h4",{children:"Most-used tools"}),o.jsx("div",{className:"ss-top-tools",children:r.topTools.map(([c,u])=>o.jsxs("div",{className:"ss-tt",children:[o.jsx("span",{className:"ss-tt-name",children:c}),o.jsx("span",{className:"ss-tt-bar",children:o.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/r.topTools[0][1]*100}%`}})}),o.jsx("span",{className:"ss-tt-count",children:u})]},c))})]}),r.firstPrompt&&o.jsxs("section",{className:"modal-section",children:[o.jsx("h4",{children:"Opening prompt"}),o.jsx("div",{className:"ss-prompt",children:r.firstPrompt})]})]})]})}):null}function Nl({label:e,value:t,tone:n}){return o.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[o.jsx("div",{className:"ss-stat-value",children:t}),o.jsx("div",{className:"ss-stat-label",children:e})]})}function Wq(e,t){const n=e.agents.get(t);if(!n)return null;const r=[];for(const E of e.agents.values())E.sessionId===t&&r.push(E);if(r.length===0)return null;const s={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},l=new Set,c=new Map;let u=0,f=0,p=0,h=0,m=0,y,v=1/0,S=0;for(const E of r){const C=or(E);s.input+=C.input,s.output+=C.output,s.cacheRead+=C.cacheRead,s.cacheWrite+=C.cacheWrite,s.total+=C.total;for(const I of rM(E))l.add(I);E.model&&l.add(E.model),E.kind==="subagent"&&m++;const R=GA(E.prompts);f+=R.length,!y&&R.length>0&&(y=R[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,u+=E.toolCount,v=Math.min(v,E.startedAt),S=Math.max(S,E.endedAt??Date.now());for(const I of E.tools)c.set(I.name,(c.get(I.name)??0)+1),I.ok===!1&&h++}const b=Math.max(0,S-v),_=Math.floor(b/1e3),k=_<60?`${_}s`:_<3600?`${Math.floor(_/60)}m ${String(_%60).padStart(2,"0")}s`:`${Math.floor(_/3600)}h ${Math.floor(_%3600/60)}m`,j=Array.from(c.entries()).sort((E,C)=>C[1]-E[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:k,cost:s,modelChips:Array.from(l),agentCount:r.length,subagentCount:m,toolCount:u,promptCount:f,tokensSum:p,errCount:h,topTools:j,firstPrompt:y}}function jS(e){return e.waiting?Dr(e.waiting)?0:1:e.state==="active"?2:3}function Vq(e,t){const n=[];for(const r of e.agents.values()){if(r.kind!=="root")continue;let s=r.toolCount,l=or(r).total,c=r.endedAt??r.startedAt;for(const u of e.agents.values()){if(u.sessionId!==r.sessionId||u.kind==="root")continue;s+=u.toolCount,l+=or(u).total;const f=u.endedAt??u.startedAt;f>c&&(c=f)}n.push({sessionId:r.sessionId,label:r.label||r.cwdBasename||"session",cwdBasename:r.cwdBasename,state:r.state,waiting:r.waiting,recap:Cf(r),modelId:r.model,toolCount:s,cost:l,startedAt:r.startedAt,lastActivity:c})}return n.sort((r,s)=>{const l=jS(r),c=jS(s);return l!==c?l-c:r.waiting&&s.waiting?r.waiting.since-s.waiting.since:s.lastActivity-r.lastActivity}),n}function _S(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 l=Math.floor(s/60);return l<60?`${l}m`:`${Math.floor(l/60)}h ${l%60}m`}function Gq({state:e,now:t,selectedIds:n,onSelect:r,onClose:s,removedIds:l,onBringBackAll:c}){const u=w.useMemo(()=>Vq(e),[e,e.revision,t]),f=u.filter(h=>h.state==="active").length,p=u.filter(h=>Dr(h.waiting)).length;return o.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[o.jsxs("div",{className:"sl-header",children:[o.jsxs("h2",{children:["Sessions ",o.jsx("span",{className:"sl-count",children:u.length})]}),p>0&&o.jsxs("span",{className:"sl-waiting-count",children:[p," waiting"]}),f>0&&o.jsxs("span",{className:"sl-live-count",children:[f," live"]}),o.jsx("button",{className:"glyph-btn sl-close",onClick:s,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),o.jsxs("ul",{className:"sl-rows",children:[u.length===0&&o.jsx("li",{className:"sl-empty",children:"No sessions yet."}),u.map(h=>{const m=n.has(h.sessionId),y=(l==null?void 0:l.has(h.sessionId))??!1;return o.jsx("li",{className:"sl-row-item",children:o.jsxs("button",{type:"button",className:`sl-row state-${h.state}${m?" selected":""}${y?" removed":""}`,"aria-current":m?"true":void 0,onClick:()=>r(h.sessionId),title:y?`Bring ${h.label} back to the board`:`Focus ${h.label}`,children:[o.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:Yl(h.state)}),o.jsxs("div",{className:"sl-row-body",children:[o.jsxs("div",{className:"sl-row-head",children:[o.jsx("span",{className:"sl-label",children:h.label}),y&&o.jsx("span",{className:"sl-removed",children:"off the board"}),h.modelId&&o.jsx("span",{className:"model-chip","data-family":Sf(h.modelId),title:h.modelId,children:io(h.modelId)})]}),o.jsxs("div",{className:"sl-row-meta",children:[o.jsxs("span",{title:"tool calls",children:[o.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&o.jsx("span",{className:"sl-cost",title:jM,children:o.jsx("b",{children:bt(h.cost)})}),h.waiting?o.jsxs("span",{className:"sl-waiting",title:[Xl(h.waiting),iq(h.waiting,Xl(h.waiting)),`Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
85
|
-
`),children:["waiting ",_S(h.waiting.since,void 0,t),h.waiting.tool&&o.jsxs("span",{className:"sl-waiting-tool",children:[" · ",h.waiting.tool.name]})]}):o.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:_S(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]}),h.recap&&o.jsxs("span",{className:"sl-recap",title:h.recap.text,children:[o.jsx(Ru,{}),h.recap.text]})]})]})},h.sessionId)})]}),(()=>{const h=(l==null?void 0:l.size)??0;return h===0||!c?null:o.jsx("div",{className:"sl-foot",children:o.jsxs("button",{type:"button",className:"btn sl-bring-back",onClick:m=>{const y=m.currentTarget.closest(".session-list");c(),requestAnimationFrame(()=>{var v;return(v=y==null?void 0:y.querySelector(".sl-row"))==null?void 0:v.focus()})},children:["Bring back ",h," removed ",h===1?"card":"cards"]})})})()]})}const Kq=e=>1-Math.pow(1-e,5),_M=420;function Yq(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 Xq(e,t,n,r=_M){return n>=r?t:n<=0?e:e+(t-e)*Kq(n/r)}function Zq(e,t,n,r={}){const s=r.now??(()=>performance.now()),l=r.raf??(v=>requestAnimationFrame(v)),c=r.cancel??(v=>cancelAnimationFrame(v)),u=r.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=r.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||f()||!Yq(e,t))return n(t),()=>{};const p=s();let h=0,m=!0;const y=()=>{if(!m)return;const v=s()-p;n(Xq(e,t,v)),v<_M&&(h=l(y))};return h=l(y),()=>{m=!1,h&&c(h)}}const M0={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function Qq(e){if(!e.synthetic)return!1;const t=e.usage;return t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreateTokens<=0}function jm(e,t){const n=new Map;for(const r of e){if(r.kind!=="root"||!r.sessionId||Qq(r))continue;const s=or(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 Jq(e,t){if(!e)return M0;const n={...M0};for(const[r,s]of t){const l=e.get(r);if(!l)continue;const c={cost:s.cost-l.cost,inputTokens:s.inputTokens-l.inputTokens,outputTokens:s.outputTokens-l.outputTokens,cacheReadTokens:s.cacheReadTokens-l.cacheReadTokens,cacheCreateTokens:s.cacheCreateTokens-l.cacheCreateTokens};c.cost<0||c.inputTokens<0||c.outputTokens<0||c.cost===0&&c.inputTokens===0&&c.outputTokens===0&&c.cacheReadTokens===0&&c.cacheCreateTokens===0||(n.cost+=c.cost,n.inputTokens+=Math.max(0,c.inputTokens),n.outputTokens+=Math.max(0,c.outputTokens),n.cacheReadTokens+=Math.max(0,c.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,c.cacheCreateTokens),n.sessions+=1)}return n}function EM(e,t,n){const r=t8*Math.max(1,n/TM);let s=0;for(const[l,c]of t){const u=e.get(l);if(u===void 0)continue;const f=c.cost-u.cost;f>0&&f<=r&&(s+=f)}return s}const ES={samples:[],last:new Map,watched:0},CM=10*6e4,e8=6e4,TM=5e3,t8=20;function n8(e,t,n){const r=e.samples[e.samples.length-1];if(r&&t-r.t<TM)return e;const s=e.watched+EM(e.last,n,r?t-r.t:0),l=e.samples.filter(c=>t-c.t<=CM);return l.push({t,watched:s}),{samples:l,last:n,watched:s}}function r8(e,t,n){const r=e.samples[0];if(!r)return null;const s=t-r.t;if(s<e8)return null;const l=e.samples[e.samples.length-1].t,c=e.watched+EM(e.last,n,t-l)-r.watched;return c>0?{spent:c,spanSec:s/1e3,spanMin:Math.min(CM/6e4,Math.ceil(s/6e4))}:null}function CS(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const Rf=[{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 s8(e,t,n=Rf.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 RM(e,t=new Date){return e==="today"?CS(1,t):e==="month"?CS(t.getDate(),t):"20200101"}const rr=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Bh=e=>typeof e=="string"?e:"";function AM(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 l of s){const c=Bh(l==null?void 0:l.modelName);if(!c)continue;let u=n.get(c);u||(u={model:c,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(c,u)),u.cost+=rr(l==null?void 0:l.cost),u.inputTokens+=rr(l==null?void 0:l.inputTokens),u.outputTokens+=rr(l==null?void 0:l.outputTokens),u.cacheReadTokens+=rr(l==null?void 0:l.cacheReadTokens),u.cacheCreateTokens+=rr(l==null?void 0:l.cacheCreationTokens)}}return[...n.values()].sort((r,s)=>s.cost-r.cost||s.tokens-r.tokens)}const a8=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function o8(e){var t;return((t=a8.exec(e))==null?void 0:t[0])??e}function i8(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],r=[];for(const s of n){const l=Bh(s==null?void 0:s.period);if(!l)continue;const c=o8(l),u=s==null?void 0:s.metadata,f=typeof(u==null?void 0:u.lastActivity)=="string"?Date.parse(u.lastActivity):NaN;r.push({sessionId:c,label:t.get(c)??null,agent:Bh(s==null?void 0:s.agent)||"claude",cost:rr(s==null?void 0:s.totalCost),tokens:rr(s==null?void 0:s.totalTokens),models:Array.isArray(s==null?void 0:s.modelsUsed)?s.modelsUsed.map(Bh).filter(Boolean):[],lastActivityMs:Number.isFinite(f)?f:null})}return r.sort((s,l)=>l.cost-s.cost||l.tokens-s.tokens)}function l8(e,t=Af(e).cost){const r=(Array.isArray(e==null?void 0:e.sessions)?e.sessions:[]).reduce((l,c)=>l+rr(c==null?void 0:c.totalCost),0),s=Math.max(.01,t*.01);return{sum:r,total:t,over:r>t+s}}function c8(e,t,n){const r=`Sessions with activity ${e}, and what ccusage puts against each one.`;return t.over?`${r}
|
|
86
|
-
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 Af(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=rr(t.cacheReadTokens),p=rr(t.cacheCreationTokens),h=rr(t.inputTokens),m=rr(t.outputTokens);return{cost:rr(t.totalCost),inputTokens:h,outputTokens:m,cacheReadTokens:f,cacheCreateTokens:p,tokens:rr(t.totalTokens)||h+m+f+p}}const n=AM(e),r=f=>n.reduce((p,h)=>p+f(h),0),s=r(f=>f.inputTokens),l=r(f=>f.outputTokens),c=r(f=>f.cacheReadTokens),u=r(f=>f.cacheCreateTokens);return{cost:r(f=>f.cost),inputTokens:s,outputTokens:l,cacheReadTokens:c,cacheCreateTokens:u,tokens:s+l+c+u}}function u8(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 TS(e,t){var n;return((n=Rf.find(r=>r.key===(e??t)))==null?void 0:n.noun)??"today"}function d8(e,t,n){const r=e!=null,s=Af(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 hn="ccdeck";function lo(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function Mf(e){return e==null}const I0="self";function to(e,t=!1){const n=lo(e?I0:null,I0);return{disabled:t||n.disabled,"aria-busy":n.busy}}function Ps(e){return Mf(e?I0:null)}function Au({armedFor:e,target:t,armedAt:n,now:r,gapMs:s}){return e!==t?"arm":r-n<s?"ignore":"fire"}function h8(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function $0(e){return e==null||e==="BODY"||e==="HTML"}const MM="agent-dag.usagePeriod";function f8(){const e=yr(MM);return Rf.some(t=>t.key===e)?e:"today"}function p8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(MM,e)}catch{}}const IM="agent-dag.usageSessionsOpen";function m8(){return yr(IM)==="1"}function g8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(IM,e?"1":"0")}catch{}}function RS(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 y8(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget":e==="api"?"Fetched from Anthropic's usage endpoint, at most once every 5 minutes":e==="cli"?"Parsed from `claude /usage`, at most once every 5 minutes":"Last update"}function w8(e,t,n,r){const s=Math.max(0,t-r),l=Math.max(0,n-s);if(l<120)return null;const c=Math.min(100,l/n*100),u=e-c;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:c,isDeficit:!1};if(u>0){const f=100-e,p=l>0?e/l:0,h=p>0?f/p:1/0,m={label:`${Math.round(u)}% over pace`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(h<s&&h<86400){const y=Math.floor(h/3600),v=Math.floor(h%3600/60);m.runsOutIn=y>0?`${y}h ${v}m`:`${v}m`}return m}return{label:`${Math.round(-u)}% under pace`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function Ya({pct:e,label:t,reset:n,resetAt:r,windowSec:s,limitReached:l,nowSec:c}){const u=Math.min(100,Math.max(0,e)),p=l||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",h=u===0?"< 1%":`${u}%`,m=u===0?2:u,y=r?SM(r,c):null,v=r&&s?w8(u,r,s,c):null,[S,b]=w.useState(!1),_=w.useId();return o.jsxs("div",{className:"qb-row",children:[o.jsxs("div",{className:"qb-meta",children:[o.jsxs("span",{className:"qb-label",children:[t,l&&o.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),o.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),o.jsxs("div",{className:"qb-track",children:[o.jsx("div",{className:"qb-fill",style:{transform:`scaleX(${m/100})`,background:p,opacity:u===0?.4:1}}),v&&o.jsx("div",{className:"qb-pace-rail",style:{transform:`translateX(${v.expectedPct}%)`},children:o.jsx("div",{"aria-hidden":!0,className:"qb-pace-marker",style:{background:v.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(v.expectedPct)}% by now`})})]}),o.jsxs("div",{className:"qb-reset-row",children:[y?o.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?o.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,v&&o.jsxs("button",{type:"button",className:"qb-pace",style:{color:v.color},"aria-expanded":S,"aria-controls":S?_:void 0,onClick:()=>b(k=>!k),children:[o.jsx("i",{className:"qb-pace-key","aria-hidden":!0,style:{background:v.isDeficit?"var(--err)":"var(--ok)"}}),v.runsOutIn?`runs out in ${v.runsOutIn}`:v.label]})]}),S&&v&&o.jsxs("div",{id:_,className:"qb-why",children:["To last until reset, stay near ",Math.round(v.expectedPct),"% by now."]})]})}const v8=6e4,x8=2e4;function b8(e){const[t,n]=w.useState(null),[r,s]=w.useState(!1),l=w.useRef(null),c=w.useRef(!1),u=async(p=!1)=>{if(!(p&&!Ps(c.current))){p&&(c.current=!0,s(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(x8)});m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,s(!1))}}};return w.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),v8),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:t,loading:r,refresh:()=>{e&&u(!0)}}}function k8(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 N8(e){switch(e){case"no_token":return"Run codex login to authenticate.";case"api_key_mode":return"API-key login — ChatGPT quota is only available for codex login.";case"refresh_rejected":return"Codex session expired — run codex login.";case"refresh_failed":return"Couldn't refresh the Codex token — click ↻ to retry.";case"untrusted_base_url":return"chatgpt_base_url in ~/.codex/config.toml is not an https OpenAI host, so the token was not sent.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const $M=6e4,AS=6e4;function S8(e){const[t,n]=w.useState(null),[r,s]=w.useState(!1),l=w.useRef(null),c=w.useRef(!1),u=async(p=!1)=>{if(!(p&&!Ps(c.current))){p&&(c.current=!0,s(!0));try{const m=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,s(!1))}}};return w.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),$M),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:t,loading:r,refresh:()=>{e&&u(!0)}}}function j8(e){const[t,n]=w.useState(null),r=w.useRef(null),s=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&n(await l.json())}catch{}};return w.useEffect(()=>{if(e)return s(),r.current=window.setInterval(s,$M),()=>{r.current!=null&&window.clearInterval(r.current)}},[e]),{data:t}}function _8(e,t,n){const[r,s]=w.useState(null),[l,c]=w.useState(!1),[u,f]=w.useState(0),p=w.useRef(0);w.useEffect(()=>{const m=()=>document.visibilityState==="visible",y=()=>{m()&&f(b=>b+1)},v=window.setInterval(y,AS),S=()=>{m()&&Date.now()-p.current>=AS&&f(b=>b+1)};return document.addEventListener("visibilitychange",S),()=>{window.clearInterval(v),document.removeEventListener("visibilitychange",S)}},[]);const h=w.useRef(t);return w.useEffect(()=>{let m=!0;const y=t!==h.current;h.current=t;const v=e,S=RM(v);return c(!0),fetch(`/api/ccusage?since=${S}${y?"&refresh=1":""}`).then(b=>b.ok?b.json():null).then(b=>{!m||!(b!=null&&b.ok)||(p.current=Date.now(),s({period:v,data:b,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e,t,u]),{...u8(r,e),loading:l}}function su(e){const[t,n]=w.useState(e),r=w.useRef(e),s=w.useRef(!0);return w.useEffect(()=>{r.current=t},[t]),w.useEffect(()=>{if(s.current){s.current=!1,r.current=e,n(e);return}return Zq(r.current,e,c=>{r.current=c,n(c)})},[e]),t}function E8({state:e,now:t,providers:n,leaving:r,onClose:s,liveSince:l=null}){var Ye,qe;const{quota:c,loading:u,refresh:f}=b8(n.claude),{data:p,loading:h,refresh:m}=S8(n.codex),{data:y}=j8(n.codex),[v,S]=w.useState(()=>Math.floor(Date.now()/1e3));w.useEffect(()=>{const ke=window.setInterval(()=>S(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ke)},[]);const b=w.useRef(ES),_=w.useRef(null),{byModel:k,totalCost:j,totalTokens:E,burnRate:C}=w.useMemo(()=>{const ke=zq(e.agents.values()),Ae=Dq(e.agents.values());_.current!==l&&(_.current=l,b.current=ES);const Ue=jm(e.agents.values(),t);l!=null&&(b.current=n8(b.current,t,Ue));const Fe=l==null?null:r8(b.current,t,Ue),Ve=Fe?{label:_b(Fe.spent,Fe.spanSec),spanMin:Fe.spanMin}:null;return{byModel:ke,totalCost:Ae.cost,totalTokens:Ae,burnRate:Ve}},[e,e.revision,t,l]),R=w.useMemo(()=>Uq(e.agents.values()),[e,e.revision]),[I,$]=w.useState(f8);w.useEffect(()=>{p8(I)},[I]);const[q,B]=w.useState(m8);w.useEffect(()=>{g8(q)},[q]);const P=w.useRef([]),[W,ne]=w.useState(0),ee=w.useRef(()=>new Map);ee.current=()=>jm(e.agents.values(),t);const M=w.useCallback(()=>ee.current(),[]),{data:X,shown:V,stale:G,loading:F,baseline:L}=_8(I,W,M),H=X!=null,D=F&&G,K=w.useMemo(()=>{const ke=new Map;for(const Ae of e.agents.values()){if(Ae.kind!=="root"||!Ae.sessionId)continue;const Ue=Ae.label||Ae.cwdBasename;Ue&&ke.set(Ae.sessionId,Ue)}return ke},[e,e.revision]),re=w.useMemo(()=>{const ke=new Map;for(const Ae of e.agents.values())Ae.kind!=="root"||!Ae.sessionId||ke.set(Ae.sessionId,Ae.state);return ke},[e,e.revision]),z=w.useMemo(()=>H?AM(X):[],[X,H]),Z=w.useMemo(()=>{if(!H)return[];const ke=i8(X,K).slice(0,12),Ae=new Map;for(const Ue of ke)Ue.label&&Ae.set(Ue.label,(Ae.get(Ue.label)??0)+1);return ke.map(Ue=>Ue.label&&(Ae.get(Ue.label)??0)>1?{...Ue,label:`${Ue.label} ${Ue.sessionId.slice(0,4)}`}:Ue)},[X,H,K]),U=w.useMemo(()=>Af(X),[X]),ae=w.useMemo(()=>l8(X,U.cost),[X,U.cost]),le=TS(V,I),ge=G?" up-stale":"",Ne=w.useMemo(()=>H?Jq(L,jm(e.agents.values(),t)):M0,[e,e.revision,L,H,t]),Ie=d8(X,{...E,cost:j},Ne),Ge=Ie.hasCost,Pe=Ie.tokenSum,ze=su(Ie.cost),Re=su(Ie.inputTokens),st=su(Ie.outputTokens),ue=su(Ie.cacheReadTokens),ce=su(Ie.cacheCreateTokens),se=k.filter(ke=>ke.cost.total>0||ke.inputTokens+ke.outputTokens>0),be=R.filter(ke=>ke.cost>0||ke.inputTokens+ke.outputTokens>0),Le=H?z.some(ke=>ke.cost<=0&&ke.tokens>0):se.some(ke=>!ke.priced),de=u||h,fe=RS(c==null?void 0:c.fetchedAt,v),Ce=RS(p==null?void 0:p.fetchedAt,v),pe=()=>{f(),m(),ne(ke=>ke+1)},_e=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return o.jsxs("aside",{className:`usage-panel${r?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[o.jsxs("div",{className:"up-header",children:[o.jsx("h2",{children:"Usage"}),C&&o.jsxs("span",{className:"up-rate",title:`Spend on this board over the last ${C.spanMin} min`,children:[C.label,o.jsxs("span",{className:"up-rate-span",children:[" · ",C.spanMin," min"]})]}),o.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&o.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:pe,...to(de),"aria-label":_e,title:_e,children:de?"…":"↻"}),o.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:s,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&o.jsxs("section",{className:"up-section up-quota-section",children:[o.jsxs("h3",{className:"up-section-title",children:["Claude quota",fe&&!u&&o.jsx("span",{className:"up-section-age",title:y8(c==null?void 0:c.source),children:fe})]}),c!=null&&c.ok?o.jsxs("div",{className:"up-quota-bars",children:[c.session5hPct!=null&&o.jsx(Ya,{label:"5-hour window",pct:c.session5hPct,reset:c.session5hReset,resetAt:c.session5hResetAt,windowSec:c.session5hWindowSec,nowSec:v}),c.week7dPct!=null&&o.jsx(Ya,{label:"7-day window",pct:c.week7dPct,reset:c.week7dReset,resetAt:c.week7dResetAt,windowSec:c.week7dWindowSec,nowSec:v}),c.weekSonnetPct!=null&&o.jsx(Ya,{label:"Sonnet (7d)",pct:c.weekSonnetPct,nowSec:v}),c.weekOpusPct!=null&&o.jsx(Ya,{label:"Opus (7d)",pct:c.weekOpusPct,nowSec:v}),c.extraEnabled&&c.extraUsedCredits!=null&&c.extraMonthlyLimit?o.jsx(Ya,{label:`Extra credits (month${c.extraCurrency?`, ${c.extraCurrency}`:""})`,pct:Math.min(100,Math.round(c.extraUsedCredits/c.extraMonthlyLimit*100)),nowSec:v}):c.extraEnabled&&o.jsx("div",{className:"up-quota-sub up-credits",children:"extra usage credits: on"})]}):(c==null?void 0:c.ok)===!1?o.jsxs("div",{className:"up-quota-na",children:[o.jsx("span",{children:c.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),o.jsx("span",{className:"up-quota-hint",children:k8(c.reason)})]}):o.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&o.jsxs("section",{className:"up-section up-quota-section",children:[o.jsxs("h3",{className:"up-section-title",children:["Codex quota",(p==null?void 0:p.ok)&&p.planLabel&&o.jsx("span",{className:"up-plan-badge",children:p.planLabel}),Ce&&!h&&o.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:Ce})]}),p!=null&&p.ok?o.jsxs("div",{className:"up-quota-bars",children:[(Ye=p.windows)==null?void 0:Ye.map(ke=>o.jsx(Ya,{label:ke.label,pct:ke.pct,reset:ke.reset??void 0,resetAt:ke.resetAt??void 0,windowSec:ke.windowSec??void 0,limitReached:p.limitReached&&ke.pct>=100,nowSec:v},ke.id)),(qe=p.extraWindows)==null?void 0:qe.map(ke=>o.jsx(Ya,{label:ke.label,pct:ke.pct,reset:ke.reset??void 0,resetAt:ke.resetAt??void 0,windowSec:ke.windowSec??void 0,nowSec:v},ke.id)),p.creditLimit&&o.jsx(Ya,{label:`spend cap · $${Math.round(p.creditLimit.used)} of $${Math.round(p.creditLimit.limit)}`,pct:p.creditLimit.usedPct,reset:p.creditLimit.reset??void 0,resetAt:p.creditLimit.resetAt??void 0,limitReached:p.spendControlReached,nowSec:v}),p.creditsBalance&&!p.creditsUnlimited&&o.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",p.creditsBalance,p.overageReached&&" · overage limit reached"]}),p.creditsUnlimited&&o.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),p.resetCredits&&p.resetCredits.availableCount>0&&o.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${hn} only reports them`,children:[p.resetCredits.availableCount," rate-limit reset",p.resetCredits.availableCount!==1?"s":""," available",p.resetCredits.nextExpiryAt&&` · expires ${new Date(p.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),p.promo&&o.jsx("div",{className:"up-quota-sub",children:p.promo}),p.partial&&o.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(p==null?void 0:p.ok)===!1?o.jsxs("div",{className:"up-quota-na",children:[o.jsx("span",{children:"Quota unavailable."}),o.jsx("span",{className:"up-quota-hint",children:N8(p.reason)})]}):o.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(y==null?void 0:y.ok)&&y.window7d&&y.window7d.sessionCount>0&&o.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${y.window5h?`
|
|
87
|
-
last 5h: ${Pt(y.window5h.totalTokens)} tokens · ${y.window5h.sessionCount} session${y.window5h.sessionCount!==1?"s":""}`:""}`,children:[Pt(y.window7d.totalTokens)," tokens · ",y.window7d.sessionCount," session",y.window7d.sessionCount!==1?"s":""," (7d)"]})]}),H&&o.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":D||void 0,onKeyDown:ke=>{var Fe;const Ae=P.current.indexOf(ke.target);if(Ae<0)return;const Ue=s8(ke.key,Ae);Ue!==null&&(ke.preventDefault(),(Fe=P.current[Ue])==null||Fe.focus())},children:Rf.map((ke,Ae)=>o.jsx("button",{type:"button",ref:Ue=>{P.current[Ae]=Ue},tabIndex:I===ke.key?0:-1,"aria-pressed":I===ke.key,"data-pending":I===ke.key&&D?"":void 0,title:I===ke.key&&D?`Reading ${ke.noun} from the transcripts on this machine…`:ke.hint,className:"uh-range-btn",onClick:()=>$(ke.key),children:ke.label},ke.key))}),H&&o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:D?`Reading ${TS(I,I)}…`:""}),Pe>0?o.jsxs(o.Fragment,{children:[Ge&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`up-total${ge}`,title:H?void 0:SS,children:[o.jsx("span",{className:"up-total-value",children:bt(ze)}),o.jsx("span",{className:"up-total-label",children:H?le:Fq})]}),Ie.showCostBar&&o.jsx($b,{cost:j})]}),o.jsxs("div",{className:`up-tokens-row${ge}`,title:H?void 0:SS,children:[o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"in"}),Pt(Re)]}),o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"out"}),Pt(st)]}),Ie.cacheReadTokens>0&&o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"cache r"}),Pt(ue)]}),Ie.cacheCreateTokens>0&&o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"cache c"}),Pt(ce)]}),!Ge&&o.jsx("span",{className:"up-tok up-scope",children:qq})]}),(H?z.length:se.length)>0&&o.jsxs("section",{className:`up-section${ge}`,children:[o.jsx("h3",{className:"up-section-title",children:"By model"}),o.jsxs("table",{className:"up-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Model"}),o.jsx("th",{children:"Tokens"}),o.jsx("th",{children:"Cost"})]})}),o.jsx("tbody",{children:H?z.map(ke=>o.jsxs("tr",{children:[o.jsx("td",{className:"up-model-name",title:ke.model,children:io(ke.model)}),o.jsx("td",{className:"up-num",children:Pt(ke.tokens)}),ke.cost>0?o.jsx("td",{className:"up-num up-cost-val",children:bt(ke.cost)}):o.jsx("td",{className:"up-num up-unpriced",children:la})]},ke.model)):se.map(ke=>o.jsxs("tr",{children:[o.jsx("td",{className:"up-model-name",title:ke.model===A0?"no model reported yet":ke.model,children:ke.model===A0?"unknown":io(ke.model)}),o.jsx("td",{className:"up-num",children:Pt(ke.inputTokens+ke.outputTokens)}),ke.priced?o.jsx("td",{className:"up-num up-cost-val",children:bt(ke.cost.total)}):o.jsx("td",{className:"up-num up-unpriced",children:la})]},ke.model))})]})]}),H&&Z.length===0&&U.tokens>0&&o.jsxs("section",{className:"up-section",children:[o.jsx("h3",{className:"up-section-title",children:"By session"}),o.jsxs("div",{className:"up-hint",children:["No session is dated ",le," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(H?Z.length:be.length)>0&&(()=>{const ke=H?Z.length:be.length;return o.jsxs("section",{className:`up-section${ge}`,children:[o.jsx("h3",{className:"up-section-title",children:o.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":q,"aria-controls":"up-sessions",title:q?"Hide the per-session breakdown":`Show the per-session breakdown — ${ke} session${ke===1?"":"s"}`,onClick:()=>B(Ae=>!Ae),children:["By session",H&&o.jsxs("span",{className:"up-section-age",title:c8(le,ae,bt),children:["active ",le]}),o.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:o.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),o.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!q,children:[H&&Z.map(Ae=>{const Ue=re.get(Ae.sessionId);return o.jsxs("div",{className:"up-session-row",children:[Ue?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`sl-dot state-${Ue}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:Yl(Ue)})]}):o.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),o.jsx("span",{className:`up-session-label${Ae.label?"":" up-session-id"}`,title:Ae.label?`${Ae.label}
|
|
88
|
-
${Ae.sessionId}`:Ae.sessionId,children:Ae.label??Ae.sessionId.slice(0,8)}),o.jsx("span",{className:"up-session-tokens",children:Pt(Ae.tokens)}),Ae.cost>0?o.jsx("span",{className:"up-session-cost",title:Ae.models.join(", ")||void 0,children:bt(Ae.cost)}):o.jsx("span",{className:"up-session-cost up-unpriced",children:la})]},Ae.sessionId)}),!H&&be.map(Ae=>o.jsxs("div",{className:"up-session-row",children:[o.jsx("span",{className:`sl-dot state-${Ae.state}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:Yl(Ae.state)}),o.jsx("span",{className:"up-session-label",children:Ae.label}),o.jsx("span",{className:"up-session-tokens",children:Pt(Ae.inputTokens+Ae.outputTokens)}),Ae.cost>0?o.jsxs("span",{className:"up-session-cost",title:Ae.unpricedTokens>0?`${Pt(Ae.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[bt(Ae.cost),Ae.unpricedTokens>0?"+":""]}):o.jsx("span",{className:"up-session-cost up-unpriced",children:la})]},Ae.sessionId))]})]})})(),Le&&o.jsxs("div",{className:"up-hint",children:["“",la,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):o.jsx("div",{className:"up-empty",children:H?o.jsxs(o.Fragment,{children:["No usage ",le,".",o.jsx("br",{}),"Try a longer period."]}):o.jsxs(o.Fragment,{children:["No usage data yet.",o.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}function _m(e){return e<9.95?e.toFixed(1):String(Math.round(e))}function Ob(e){const t=Number.isFinite(e)?Math.max(0,e):0;return t<50?{value:"0",unit:"KB/s"}:t<999500?{value:_m(t/1e3),unit:"KB/s"}:t<9995e5?{value:_m(t/1e6),unit:"MB/s"}:{value:_m(t/1e9),unit:"GB/s"}}function If(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 Mu(e){return e.unit?e.unit==="%"||e.unit==="°C"?`${e.value}${e.unit}`:`${e.value} ${e.unit}`:e.value}function Em(e,t){return t==="B/s"?Ob(e):t==="ms"?If(e):{value:String(e),unit:t==="C"?"°C":t}}const un={l:30,r:6,t:6,b:2},Xa={l:0,r:0,t:2,b:1},$f=104,C8=64;function gs(e,t=100,n=$f,r=un){const s=n-r.t-r.b;return r.t+s*(1-Math.max(0,Math.min(t,e))/t)}function OM(e,t,n,r=100,s=$f,l=un){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,u=h=>{const m=t-l.l-l.r;return l.l+(c>0?m*(h-e[0].t)/c:m/2)};let f="",p=null;for(const h of e){const m=p&&h.t-p.t<=n*2?"L":"M";f+=`${m}${u(h.t).toFixed(1)} ${gs(h.v,r,s,l).toFixed(1)}`,p=h}return f}function LM(e,t,n,r=100,s=$f,l=un){if(e.length<2)return"";const c=s-l.b,u=e[e.length-1].t-e[0].t,f=t-l.l-l.r,p=v=>l.l+(u>0?f*(v-e[0].t)/u:f/2);let h="",m=[];const y=()=>{if(m.length>=2){let v=`M${p(m[0].t).toFixed(1)} ${c}`;for(const S of m)v+=`L${p(S.t).toFixed(1)} ${gs(S.v,r,s,l).toFixed(1)}`;h+=`${v}L${p(m[m.length-1].t).toFixed(1)} ${c}Z`}m=[]};for(const v of e)m.length&&v.t-m[m.length-1].t>n*2&&y(),m.push(v);return y(),h}function T8(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 PM(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function R8(e,t,n=r=>oi(r)){const r=e.filter(c=>c.v>0);if(!e.length)return null;if(!r.length)return"never held back";const s=r.length*(t/6e4),l=r[r.length-1];return`held back for ${s===1?"1 minute":`${s} minutes`}, last at ${n(l.t)}`}function oi(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Lb(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 A8({group:e,title:t,onClose:n}){const r=mn(n),[s,l]=w.useState(null);w.useEffect(()=>{let p=!0;const h=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const v=await y.json();p&&(v!=null&&v.ok)&&l(v)}catch{}};h();const m=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(m)}},[e]);const c=(s==null?void 0:s.series)??[],[u,f]=w.useMemo(()=>{let p=1/0,h=0;for(const m of c)m.points.length&&(p=Math.min(p,m.points[0].t),h=Math.max(h,m.points[m.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(s==null?void 0:s.sinceMs)??0):(s==null?void 0:s.sinceMs)??0,h]},[c,s==null?void 0:s.sinceMs]);return On.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:r,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[o.jsxs("div",{className:"modal-head",children:[o.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),s&&u>0&&o.jsxs("span",{className:"hist-since",children:["since ",oi(u)," · ",Lb(u,f||Date.now())]}),o.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),o.jsx("div",{className:"hist-body",children:s==null?o.jsx("p",{className:"hist-empty",children:"Reading…"}):c.length===0?o.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):c.map(p=>o.jsx(M8,{series:p,stepMs:s.stepMs},p.label))})]})}),document.body)}function M8({series:e,stepMs:t}){const n=w.useRef(null),[r,s]=w.useState(560),[l,c]=w.useState(null);w.useEffect(()=>{const B=n.current;if(!B||typeof ResizeObserver>"u")return;const P=new ResizeObserver(([W])=>s(Math.max(160,W.contentRect.width)));return P.observe(B),()=>P.disconnect()},[]);const{points:u,unit:f,warnAt:p,critAt:h,label:m,top:y,restsAtZero:v,changes:S}=e,b=v?C8:$f,{now:_,peak:k}=T8(u),j=_!=null?Em(_,f):null,E=k!=null?Em(k,f):null,C=m==="Throttling"?R8(u,t):null,R=l!=null?u[l]:null,I=u.length>1?u[u.length-1].t-u[0].t:0,$=B=>{const P=r-un.l-un.r;return un.l+(I>0?P*(B-u[0].t)/I:P/2)},q=B=>{if(u.length<2)return;const P=B.currentTarget.getBoundingClientRect(),W=(B.clientX-P.left-un.l)/Math.max(1,P.width-un.l-un.r),ne=u[0].t+I*Math.max(0,Math.min(1,W));let ee=0;for(let M=1;M<u.length;M++)Math.abs(u[M].t-ne)<Math.abs(u[ee].t-ne)&&(ee=M);c(ee)};return o.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[o.jsxs("div",{className:"hist-head",children:[o.jsx("span",{className:"hist-label",children:m}),o.jsxs("span",{className:"hist-stats",children:[j&&o.jsxs(o.Fragment,{children:[o.jsx("b",{children:j.value}),o.jsxs("span",{children:[j.unit," now"]})]}),k!=null&&E&&o.jsxs(o.Fragment,{children:[o.jsx("b",{className:PM(k,p,h),children:E.value}),o.jsxs("span",{children:[E.unit," peak"]})]})]})]}),o.jsx("div",{className:"hist-plot",ref:n,children:o.jsxs("svg",{className:"hist-chart",width:"100%",height:b,viewBox:`0 0 ${r} ${b}`,preserveAspectRatio:"none",role:"img","aria-label":j==null||E==null?`${m}: nothing measured yet`:`${m}: ${Mu(j)} now, peak ${Mu(E)}, over ${Lb(u[0].t,u[u.length-1].t)}`,onPointerMove:q,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",h]].map(([B,P])=>P==null||P>y?null:o.jsxs("g",{children:[o.jsx("line",{className:`hist-rule ${B}`,x1:un.l,x2:r-un.r,y1:gs(P,y,b),y2:gs(P,y,b)}),o.jsx("text",{className:`hist-rule-tag ${B}`,x:2,y:gs(P,y,b)+3,children:P})]},B)),o.jsx("line",{className:"hist-floor",x1:un.l,x2:r-un.r,y1:b-un.b,y2:b-un.b}),(S??[]).filter(B=>B.from!=null&&u.length>1&&B.t>=u[0].t&&B.t<=u[u.length-1].t).map(B=>o.jsx("line",{className:"hist-mark",x1:$(B.t),x2:$(B.t),y1:un.t,y2:b-un.b},B.t)),o.jsx("path",{className:"hist-area",d:LM(u,r,t,y,b)}),o.jsx("path",{className:"hist-line",d:OM(u,r,t,y,b)}),u.length===1&&o.jsx("circle",{className:"hist-dot",cx:$(u[0].t),cy:gs(u[0].v,y,b),r:3}),R&&o.jsxs("g",{children:[o.jsx("line",{className:"hist-cross",x1:$(R.t),x2:$(R.t),y1:un.t,y2:b-un.b}),o.jsx("circle",{className:"hist-dot",cx:$(R.t),cy:gs(R.v,y,b),r:3})]})]})}),o.jsx("div",{className:"hist-axis",children:R?o.jsxs("span",{className:"hist-at",children:[oi(R.t)," — ",(()=>{const B=Em(R.v,f);return o.jsxs(o.Fragment,{children:[o.jsx("b",{children:B.value}),B.unit==="%"||B.unit==="°C"||!B.unit?B.unit:` ${B.unit}`]})})()]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:u.length?oi(u[0].t):""}),o.jsx("span",{children:u.length?oi(u[u.length-1].t):""})]})}),C&&o.jsx("div",{className:"hist-note",children:C}),S==null?void 0:S.slice(-3).map(B=>o.jsx("div",{className:"hist-note hist-route",children:B.from==null?`Since ${oi(B.t)} — ${B.label}`:`${oi(B.t)} — ${B.label.charAt(0).toUpperCase()+B.label.slice(1)}`},B.t))]})}function I8(e,t,n){if(n<=0||_f(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 no=4,ps=8;function Pb(e,t,n){const r=n.width-ps-(e.right+no),s=e.left-no-ps,l=t.width<=r||r>=s?"right":"left",c=l==="right"?e.right+no:e.left-no-t.width,u=n.height-ps*2,f=t.height<=u,p=f?t.height:Math.max(0,u);return{top:Math.max(ps,Math.min(e.top,n.height-ps-p)),left:Math.max(ps,c),side:l,maxHeight:f?null:p}}function $8(e,t,n){const r=n.height-ps-(e.bottom+no),s=e.top-no-ps,l=t.height<=r||r>=s?"below":"above",c=l==="below"?r:s,u=t.height<=c,f=u?t.height:Math.max(0,c),p=l==="below"?e.bottom+no:e.top-no-f,h=Math.max(ps,Math.min(e.right-t.width,n.width-ps-t.width));return{top:Math.max(ps,p),left:h,side:l,maxHeight:u?null:f}}const DM='[role="menuitem"]';function MS(e){return e?Array.from(e.querySelectorAll(DM)).filter(t=>!t.disabled):[]}function O0({anchorId:e,boundaryId:t,id:n,className:r,role:s,labelledBy:l,start:c="first",onClose:u,children:f}){const p=w.useRef(u);p.current=u;const h=mn(()=>{var b;(b=document.getElementById(e))==null||b.focus(),p.current()},{popover:!0}),m=w.useCallback(()=>{var C;const b=h.current;if(!b)return;const _=document.getElementById(e);if(!_){p.current();return}const k=_.getBoundingClientRect(),j=t?(C=document.getElementById(t))==null?void 0:C.getBoundingClientRect():null;if(j&&(k.bottom<=j.top||k.top>=j.bottom)){b.contains(document.activeElement)&&_.focus({preventScroll:!0}),p.current();return}b.style.maxHeight="";const E=$8(k,{width:b.offsetWidth,height:b.offsetHeight},{width:window.innerWidth,height:window.innerHeight});b.style.top=`${E.top}px`,b.style.left=`${E.left}px`,b.style.maxHeight=E.maxHeight==null?"":`${E.maxHeight}px`,b.dataset.side=E.side},[e,t,h]);w.useLayoutEffect(()=>{m()}),w.useEffect(()=>{const b=_=>{var k;(k=h.current)!=null&&k.contains(_.target)||m()};return window.addEventListener("scroll",b,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",m)}},[m,h]),w.useEffect(()=>{const b=_=>{var j,E;const k=_.target;!k||(j=h.current)!=null&&j.contains(k)||(E=document.getElementById(e))!=null&&E.contains(k)||p.current()};return window.addEventListener("pointerdown",b,!0),()=>window.removeEventListener("pointerdown",b,!0)},[e,h]),w.useEffect(()=>{var _;if(s!=="menu")return;const b=MS(h.current);(_=c==="last"?b[b.length-1]:b[0])==null||_.focus()},[]);const y=b=>{var _;if(s==="menu"&&b.key==="Tab"){b.stopPropagation(),(_=document.getElementById(e))==null||_.focus(),b.shiftKey&&b.preventDefault(),p.current();return}if(s==="menu"){const k=MS(h.current),j=I8(b,k.indexOf(document.activeElement),k.length);j.kind==="focus"&&(b.preventDefault(),k[j.index].focus())}b.key.length===1&&b.stopPropagation()},v=b=>{b.target.closest("button, input, select, textarea, code")||b.preventDefault()},S=b=>{if(s!=="menu"||b.pointerType==="touch")return;const _=b.target.closest(DM);_&&!_.disabled&&document.activeElement!==_&&_.focus({preventScroll:!0})};return On.createPortal(o.jsx("div",{ref:h,id:n,className:`anchored-popover${r?` ${r}`:""}`,role:s,"aria-labelledby":l,onKeyDown:y,onMouseDown:v,onPointerMove:S,children:f}),document.body)}const O8="thermal:Throttling";function L8(e){var n,r,s,l;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(r=e.loadavg)!=null&&r.length&&(t["load:1m"]=e.loadavg[0]);for(const c of((s=e.thermal)==null?void 0:s.celsius)??[])t[`thermal:${c.label}`]=c.celsius;return(l=e.thermal)!=null&&l.throttle&&(t[O8]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function yu(e,t){return t==="B/s"?Mu(Ob(e)):t==="ms"?Mu(If(e)):t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function xh(e,t){return t==="B/s"||t==="ms"||!Number.isInteger(e)?yu(e,t):t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`}const IS=["cores","memory","load","thermal"],si=116,Os=24,P8=60,D8=6e4;function F8(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function q8(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function B8(e,t=P8){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function z8({sys:e}){const[t,n]=w.useState({});w.useEffect(()=>{let c=!0;const u=async()=>{const p=await Promise.all(IS.map(async h=>{try{const m=await fetch(`/api/system/history?group=${h}`);return m.ok?[h,await m.json()]:[h,null]}catch{return[h,null]}}));c&&n(h=>{const m={...h};for(const[y,v]of p)v!=null&&v.ok&&(m[y]=v);return m})};u();const f=setInterval(()=>void u(),D8);return()=>{c=!1,clearInterval(f)}},[]);const r=w.useMemo(()=>L8(e),[e]),s=w.useMemo(()=>IS.flatMap(c=>{const u=t[c];return u?u.series.filter(F8).map(f=>({series:B8(f),stepMs:u.stepMs})):[]}),[t]),l=w.useMemo(()=>{let c=1/0,u=-1/0;for(const{series:f}of s){const p=f.points;p.length&&(c=Math.min(c,p[0].t),u=Math.max(u,p[p.length-1].t))}return Number.isFinite(c)?Lb(c,u):"less than a minute"},[s]);return Object.keys(r).length?o.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${l}`,children:s.map(({series:c,stepMs:u})=>o.jsx(U8,{series:c,stepMs:u,now:r[c.key],span:l},c.key))}):null}function U8({series:e,stepMs:t,now:n,span:r}){var v;const{points:s,top:l,unit:c,warnAt:u,critAt:f}=e,p=q8(e),h=n??((v=s[s.length-1])==null?void 0:v.v),m=h==null?"":PM(h,u,f),y=Math.max(...s.map(S=>S.v));return o.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${yu(y,c)} over the last ${r}`,u!=null?`over ${xh(u,c)} is uncomfortable`:"",f!=null?`over ${xh(f,c)} the machine acts`:""].filter(Boolean).join(" · "),children:[o.jsxs("div",{className:"pl-cell-head",children:[o.jsx("span",{className:"pl-cell-label",children:p}),o.jsx("span",{className:"pl-cell-now",children:h==null?"—":yu(h,c)})]}),o.jsxs("svg",{className:"pl-spark",width:si,height:Os,viewBox:`0 0 ${si} ${Os}`,preserveAspectRatio:"none","aria-hidden":!0,children:[o.jsx("line",{className:"pl-spark-floor",x1:0,x2:si,y1:Os-Xa.b,y2:Os-Xa.b}),o.jsx("path",{className:"pl-spark-area",d:LM(s,si,t,l,Os,Xa)}),u!=null&&o.jsx("line",{className:"pl-rule warn",x1:0,x2:si,y1:gs(u,l,Os,Xa),y2:gs(u,l,Os,Xa)}),f!=null&&o.jsx("line",{className:"pl-rule hot",x1:0,x2:si,y1:gs(f,l,Os,Xa),y2:gs(f,l,Os,Xa)}),o.jsx("path",{className:"pl-spark-line",d:OM(s,si,t,l,Os,Xa)})]}),o.jsxs("span",{className:"vis-hidden",children:["peak ",yu(y,c)," over the last ",r,u!=null&&`, uncomfortable over ${xh(u,c)}`,f!=null&&`, the machine acts over ${xh(f,c)}`]})]})}const H8={key:"cpu",dir:"desc"};function W8(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function V8(e,t){const n=t.dir==="asc"?1:-1,r=l=>t.key==="cpu"?l.cpu:t.key==="mem"?l.mem:t.key==="rss"?l.rssBytes:t.key==="threads"?l.threads:l.uptimeSec,s=(l,c)=>{if(t.key==="name")return n*l.name.localeCompare(c.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=l.user??"",h=c.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const u=r(l),f=r(c);return u==null||f==null?u==null?f==null?0:1:-1:n*(u-f)};return[...e].sort((l,c)=>s(l,c)||(c.cpu??-1)-(l.cpu??-1)||c.mem-l.mem||l.pid-c.pid)}function G8(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const K8=4e3;function Y8(){const[e,t]=w.useState(null);return w.useEffect(()=>{let n=!0;const r=async()=>{if(document.visibilityState!=="hidden")try{const l=await fetch("/api/system/processes?detail=1");if(!l.ok)return;const c=await l.json();n&&(c!=null&&c.ok)&&t({procs:c.procs??[],total:c.total??0})}catch{}};r();const s=window.setInterval(r,K8);return()=>{n=!1,window.clearInterval(s)}},[]),e}function X8(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e<1024)return`${Math.round(e)} B`;const t=["KB","MB","GB","TB"];let n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n>=100?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function Z8(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 Q8({sys:e,onClose:t}){const n=mn(t),[r,s]=w.useState(H8),l=Y8(),c=l?V8(l.procs,r):null;return On.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:n,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[o.jsxs("div",{className:"modal-head",children:[o.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),l&&o.jsxs("span",{className:"pl-count",children:[c.length," of ",l.total," running"]}),o.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),o.jsxs("div",{className:"pl-split",children:[o.jsx("div",{className:"pl-body",children:c==null?o.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):c.length===0?o.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):o.jsxs("table",{className:"sd-procs pl-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx(Sl,{col:"cpu",label:"cpu",sort:r,onSort:s}),o.jsx(Sl,{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}),o.jsx(Sl,{col:"threads",label:"threads",sort:r,onSort:s}),o.jsx(Sl,{col:"uptime",label:"up",sort:r,onSort:s}),o.jsx(Sl,{col:"user",label:"user",sort:r,onSort:s}),o.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),o.jsx(Sl,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:r,onSort:s})]})}),o.jsx("tbody",{children:c.map(u=>o.jsxs("tr",{children:[o.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),o.jsx("td",{className:"sd-num sd-dim",title:`${u.mem.toFixed(1)}% of installed memory`,children:X8(u.rssBytes)}),o.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),o.jsx("td",{className:"sd-num sd-dim",children:Z8(u.uptimeSec)}),o.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),o.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),o.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&o.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),o.jsx(z8,{sys:e})]})]})}),document.body)}function Sl({col:e,label:t,note:n,sort:r,onSort:s}){const l=G8(r,e);return o.jsx("th",{scope:"col","aria-sort":l,children:o.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
89
|
-
|
|
90
|
-
${n}`:`Sort by ${t}`,onClick:()=>s(W8(r,e)),children:[t,o.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:l==="none"?"":l==="ascending"?"↑":"↓"})]})})}const J8=3e3;function eB(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function tB(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}% ${nB(t.lastMs,n)}`:"running at full speed, and never held back"}}function nB(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 au(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} KB`}function rB(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 sB(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 aB(){const[e,t]=w.useState(null),n=w.useRef(null);return w.useEffect(()=>{let r=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();r&&(p!=null&&p.ok)&&t(p)}catch{}},l=()=>{n.current==null&&(s(),n.current=window.setInterval(s,J8))},c=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){c();return}l(),s()};return l(),document.addEventListener("visibilitychange",u),()=>{r=!1,c(),document.removeEventListener("visibilitychange",u)}},[]),e}function $S({usageOpen:e,leaving:t,sub:n,flag:r,onClose:s,children:l}){return o.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[o.jsxs("div",{className:"sd-top",children:[o.jsxs("div",{className:"sd-head",children:[o.jsx("h2",{className:"sd-title",id:"sd-title",children:"This machine"}),n&&o.jsx("span",{className:"sd-sub",children:n}),o.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close",title:"Close",children:"×"})]}),r&&o.jsx("p",{className:"sd-flag",children:r})]}),l]})}function oB({usageOpen:e,leaving:t,onClose:n}){const r=aB();if(!r||r.cpu==null||!r.memory)return o.jsx($S,{usageOpen:e,leaving:t,onClose:n,children:o.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:s,swap:l,perCore:c,loadavg:u,cores:f,uptimeSec:p,platform:h,thermal:m,network:y,cpu:v}=r;return o.jsxs($S,{usageOpen:e,leaving:t,sub:`up ${rB(p)} · ${f} cores`,flag:sB(r),onClose:n,children:[o.jsx(iB,{cpu:v,perCore:c,loadavg:u,cores:f}),o.jsx(lB,{memory:s,swap:l,platform:h}),y&&o.jsx(cB,{network:y}),o.jsx(hB,{thermal:m}),o.jsx(fB,{sys:r})]})}function iB({cpu:e,perCore:t,loadavg:n,cores:r}){const s=!!t&&t.length>0;return!s&&!n?null:o.jsxs("div",{className:"sd-section sd-cpu",role:"group","aria-label":"CPU",children:[s&&o.jsx(Iu,{group:"cores",title:"Core history",action:"Show core history",label:"CPU",value:e==null?null:`${Math.round(e)}%`,children:o.jsx("div",{className:"sd-cores",role:"img","aria-label":`${t.length} logical cores, busiest at ${Math.round(Math.max(...t))}%`,children:t.map((l,c)=>o.jsx("span",{className:"sd-core",title:`logical core ${c+1} · ${l}% busy`,children:o.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,l)/100})`}})},c))})}),n&&o.jsxs(Iu,{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:[o.jsx("div",{className:"sd-figs",title:"The queue for this machine's cores, averaged over one, five and fifteen minutes. A count of tasks, not a share of the CPU.",children:n.map((l,c)=>o.jsx(L0,{value:l.toFixed(2),cap:["1m","5m","15m"][c]},c))}),n[0]>r&&o.jsx("div",{className:"sd-note",children:`${(n[0]/r).toFixed(1)}× more work queued than cores to run it`})]})]})}function lB({memory:e,swap:t,platform:n}){const r=e.total-e.available,s=n==="win32"?"Commit":"Swap",l=t&&t.total>0?t.used/t.total*100:0;return o.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:o.jsxs(Iu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[o.jsx(rf,{label:"Physical",value:o.jsxs(o.Fragment,{children:[o.jsx("b",{children:au(r)})," of ",au(e.total)]}),pct:e.usedPct,tone:e.usedPct>=90?"warn":"calm",note:`${au(e.available)} available`}),t&&t.total>0&&o.jsx(rf,{label:s,value:o.jsxs(o.Fragment,{children:[o.jsx("b",{children:au(t.used)})," of ",au(t.total)]}),pct:l,tone:l>=90?"warn":"calm"})]})})}function cB({network:e}){const{down:t,up:n,api:r,route:s}=e,[l,c]=w.useState(!1),u=r&&r.ms!=null?If(r.ms):null,f=t!=null&&n!=null;return o.jsxs("div",{className:"sd-section",role:"group","aria-label":"Network",children:[o.jsxs(Iu,{group:"network",title:"Network history",action:"Show network history",label:"Network",children:[(f||u)&&o.jsxs("div",{className:"sd-figs sd-figs-named",children:[f&&[["Download",t],["Upload",n]].map(([p,h])=>{const m=Ob(h);return o.jsx(L0,{value:m.value,unit:m.unit,cap:p},p)}),u&&o.jsx(L0,{value:u.value,unit:u.unit,cap:"Claude API"})]}),!f&&o.jsx("div",{className:"sd-note",children:"measuring…"}),r&&r.ms==null&&o.jsx("div",{className:"sd-note sd-note-warn",children:"Can’t reach Claude"})]}),s&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sd-detail",id:"sd-conn","aria-expanded":l,"aria-haspopup":"dialog",onClick:()=>c(p=>!p),children:["Connection details",s.relay&&o.jsx("span",{className:"sd-route-relay",children:" · relayed"}),o.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),l&&o.jsx(dB,{route:s,api:r,onClose:()=>c(!1)})]})]})}function L0({value:e,unit:t,cap:n}){return t?o.jsxs("span",{className:"sd-fig",children:[o.jsx("span",{className:"sd-fig-cap",children:n}),o.jsxs("span",{className:"sd-fig-read",children:[o.jsx("b",{children:e})," ",o.jsx("span",{className:"sd-fig-unit",children:t})]})]}):o.jsxs("span",{className:"sd-fig",children:[o.jsx("b",{children:e}),o.jsx("span",{className:"sd-fig-cap",children:n})]})}function uB(e){return e.kind==="tailscale-exit"?e.node?`Tailscale exit node ${e.node}`:"a Tailscale exit node":e.kind==="tailscale"?"Tailscale":`${e.name?`${e.name} `:""}VPN${e.iface?` (${e.iface})`:""}`}function dB({route:e,api:t,onClose:n}){return o.jsxs(O0,{anchorId:"sd-conn",boundaryId:"system-panel",id:"sd-conn-pop",className:"sd-pop",role:"dialog",labelledBy:"sd-conn-title",onClose:n,children:[o.jsx("p",{className:"sd-pop-title",id:"sd-conn-title",children:"Connection"}),o.jsxs("dl",{className:"sd-pop-rows",children:[o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:e.to==="claude"?"Traffic to Claude":"Internet traffic"}),o.jsxs("dd",{children:["through ",uB(e)]})]}),e.relay&&o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:"Relay"}),o.jsxs("dd",{children:[o.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&&o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:"Round trip"}),o.jsx("dd",{children:t.ms==null?`${t.host} did not answer`:`${Mu(If(t.ms))} to open a connection to ${t.host}`})]}),o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:"Throughput"}),o.jsx("dd",{children:"every interface on this machine, not this path alone"})]})]})]})}function Iu({group:e,title:t,action:n,label:r,value:s,hint:l,children:c}){const[u,f]=w.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sd-open",onClick:()=>f(!0),title:n,"aria-label":s==null?n:`${n}, now ${s}`,"aria-describedby":l?`sd-hint-${e}`:void 0,children:[o.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[r," ",o.jsx("i",{className:"sd-row-more",children:"›"}),s!=null&&o.jsx("span",{className:"sd-h-val",children:s})]}),c]}),l&&o.jsx("span",{id:`sd-hint-${e}`,className:"vis-hidden",children:l}),u&&o.jsx(A8,{group:e,title:t,onClose:()=>f(!1)})]})}function hB({thermal:e}){if(!e)return null;const t=e.throttle?tB(e.throttle.speedLimit,e.heldBack):null;return o.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:o.jsxs(Iu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>o.jsx(rf,{label:n.label,value:o.jsxs(o.Fragment,{children:[o.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius/n.critAt*100,mark:n.warnAt/n.critAt*100,tone:eB(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&&o.jsx(rf,{label:"Throttling",value:o.jsx("b",{children:t.value}),pct:t.pct,tone:t.tone,note:t.note})]})})}function fB({sys:e}){const[t,n]=w.useState(!1);return o.jsxs("div",{className:"sd-section sd-door-section",children:[o.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:o.jsxs("span",{className:"sd-door-plate",children:[o.jsxs("span",{className:"sd-door-name",children:["Busiest processes",o.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),o.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&o.jsx(Q8,{sys:e,onClose:()=>n(!1)})]})}function rf({label:e,value:t,pct:n,tone:r="calm",note:s,mark:l,title:c,trackLabel:u}){return o.jsxs("div",{className:"sd-row",title:c,children:[o.jsxs("div",{className:"sd-row-head",children:[o.jsx("span",{className:"sd-row-label",children:e}),o.jsx("span",{className:"sd-row-val",children:t})]}),o.jsxs("span",{className:"sd-track",role:u?"img":void 0,"aria-label":u,children:[o.jsx("span",{className:`sd-fill${r==="calm"?"":` ${r}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}}),l!=null&&l>0&&l<100&&o.jsx("span",{className:"sd-mark",style:{left:`${l}%`},"aria-hidden":!0})]}),s&&o.jsx("div",{className:"sd-note",children:s})]})}function pB(e){return{inputTokens:e.i,outputTokens:e.o,cacheReadTokens:e.cr,cacheCreateTokens:e.cc,cacheCreate1hTokens:e.c1h,cacheCreate5mTokens:e.c5m}}function FM(e){return e.i+e.o+e.cr+e.cc}function OS(e){let t=0;for(const n of Object.values(e))t+=FM(n);return t}function mB(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 l=typeof s.period=="string"?s.period:"",c=Array.isArray(s.modelBreakdowns)?s.modelBreakdowns:[];for(const u of c){const f=typeof u.modelName=="string"?u.modelName:"";if(!l||!/claude/i.test(f)||u.missingPricing===!0)continue;const p=`${l}|${f}`,h=n.get(p),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(p,{cost:t(u.cost),usage:m})}}return n}function gB(e,t,n,r=Date.now()){const s=new Map;let l=0,c=0;for(const[R,I]of n){const $=R.indexOf("|"),q=R.slice(0,$),B=R.slice($+1),P=Cu(I.usage,B,r).total;if(!(P>0&&I.cost>0))continue;l+=I.cost,c+=P;let W=s.get(q);W||(W=new Map,s.set(q,W)),W.set(B,I.cost/P)}const u=c>0,f=(R,I)=>{const $=s.get(R);return($==null?void 0:$.get(I))??($==null?void 0:$.get(nc(I)))??1},p=new Set,h=(R,I)=>{let $=0,q=0;for(const[B,P]of Object.entries(R)){if(Ni(B,r)){$+=Cu(pB(P),B,r).total*I(B);continue}const W=FM(P);W>0&&(q+=W,p.add(B))}return{cost:$,unpriced:q}},m=new Map,y=[];for(const R of e){const I=new Map,$=new Map;let q=0;for(const B of R.projects){const{cost:P,unpriced:W}=h(B.models,ee=>f(R.day,ee));I.set(B.path,(I.get(B.path)??0)+P),W>0&&$.set(B.path,($.get(B.path)??0)+W),q+=P;let ne=m.get(B.path);ne||(ne={path:B.path,cost:0,tokens:0,unpricedTokens:0},m.set(B.path,ne)),ne.cost+=P,ne.tokens+=OS(B.models),ne.unpricedTokens+=W}y.push({day:R.day,total:q,byPath:I,unpricedByPath:$})}const v=[...m.values()].sort((R,I)=>I.cost-R.cost||I.tokens-R.tokens),S=v.reduce((R,I)=>R+I.cost,0),b=v.reduce((R,I)=>R+I.tokens,0),_=v.reduce((R,I)=>R+I.unpricedTokens,0),k=u?l/c:1,j=t?OS(t):0,E=t?h(t,()=>k):{cost:0,unpriced:0},C=E.cost>0||j>0?{cost:E.cost,tokens:j,unpricedTokens:E.unpriced}:null;return{projects:v,totalCost:S,totalTokens:b,unpricedTokens:_,perDay:y,unattributed:C,unpricedModels:[...p].sort(),calibrated:u,reconciled:u&&_===0}}function Ls(e,t,n=bt){return t>0?e>0?`${n(e)}+`:la:n(e)}function jl(e){return e>0?`${Pt(e)} of these tokens are on an unpriced model, so this is a floor`:void 0}function yB(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 ${la}: this build holds no published rate for it, so its tokens are counted and its dollars are not.`:`${n} are ${la}: this build holds no published rate for them, so their tokens are counted and their dollars are not.`}const wB={phase:"running"},vB={phase:"failed"},xB={gen:0,report:null,error:null,early:null};function bB(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:wB;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 kB(e){var t;return((t=e.report)==null?void 0:t.gen)!==e.gen&&e.error===null}function NB(e){const t=e;return t&&t.ok!==!1?{phase:"ready",range:t}:vB}function LS(e){return`${e.getFullYear()}${String(e.getMonth()+1).padStart(2,"0")}${String(e.getDate()).padStart(2,"0")}`}function SB(e,t,n=Date.now()){const r=t===0?60:t,s=LS(new Date(n-(r-1)*864e5)),l=LS(new Date(n));return{report:`/api/account-projects?num=${e}&days=${t}`,ccusage:`/api/ccusage?since=${s}&until=${l}`}}function jB({num:e,days:t,gen:n,dispatch:r,get:s=(c,u)=>fetch(c,u),now:l=Date.now()}){const c=SB(e,t,l),u={credentials:"same-origin"};s(c.report,u).then(f=>f.ok?f.json():Promise.reject(new Error(`HTTP ${f.status}`))).then(f=>r({type:"report",gen:n,days:t,data:f}),f=>r({type:"reportFailed",gen:n,message:(f==null?void 0:f.message)||"Could not load"})),s(c.ccusage,u).then(f=>f.ok?f.json():null).catch(()=>null).then(f=>r({type:"cost",gen:n,cost:NB(f)}))}function qM(e){return/^[A-Za-z]:[\\/]$/.test(e)?e:e.replace(/[\\/]+$/,"")}function Cm(e){const t=qM(e).replace(/\\/g,"/");return/^[A-Za-z]:\//.test(t)?t.toLowerCase():t}function PS(e){if(!e)return e;const t=qM(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 _B(e,t){const n=Cm(e);let r;for(const s of t){const l=Cm(s.path);!l||l===n||!n.startsWith(`${l}/`)||(!r||Cm(r.path).length<l.length)&&(r=s)}return r==null?void 0:r.label}function P0(e){return e===0?"all time":e===1?"today":`the last ${e} days`}function EB(e){return e===1?"No work attributed to this account yet today.":`No work attributed to this account in ${P0(e)}.`}function CB(e){return e===1?7:e===7?30:e===30?0:null}function TB(e,t){return e!==1&&t>0}const RB=[{days:1,label:"Today"},{days:7,label:"7d"},{days:30,label:"30d"},{days:0,label:"All"}],_l=["var(--usage-blue)","var(--usage-green)","var(--usage-amber)","var(--usage-purple)","var(--usage-indigo)","var(--usage-red)","var(--usage-orange)","var(--usage-zinc)"],AB="var(--usage-zinc)",Tm=6,MB=1600;function IB(e){const t=bt(e),n=/^\$(\d{4,})$/.exec(t);return n?`$${Number(n[1]).toLocaleString("en-US")}`:t}function bh(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 $B(e){const t=/^\d{4}-(\d{2})-(\d{2})$/.exec(e);return t?`${Number(t[1])}/${Number(t[2])}`:e}function OB(e){const t=Math.max(1,Math.ceil(e/6));return n=>n===0||n===e-1||n%t===0}function Rm(e){if(!e)return"";try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function LB({num:e,name:t,onClose:n}){var X,V,G,F;const[r,s]=w.useState(1),[l,c]=w.useReducer(bB,xB),u=((X=l.report)==null?void 0:X.data)??null,f=((V=l.report)==null?void 0:V.days)??r,p=((G=l.report)==null?void 0:G.cost.phase)==="ready"?l.report.cost.range:null,h=((F=l.report)==null?void 0:F.cost.phase)==="running",[m,y]=w.useState(null),[v,S]=w.useState(()=>new Set),b=kB(l),_=l.error,[k,j]=w.useState(null),E=w.useRef(void 0),C=w.useRef(!0);w.useEffect(()=>()=>{C.current=!1,window.clearTimeout(E.current)},[]);const R=w.useRef(null),I=mn(n,{focusRef:R}),$=w.useRef(0);w.useEffect(()=>{const L=++$.current;c({type:"start",gen:L}),y(null),S(new Set),jB({num:e,days:r,gen:L,dispatch:c})},[e,r]);const q=w.useMemo(()=>{const L=Date.now();if(!u)return null;const H=gB(u.daily??[],u.unattributed,mB(p),L),D=ce=>ce.replace(/[\\/]+$/,"").split(/[\\/]/).pop()||ce||"(unknown)",K=new Map;for(const ce of H.projects)K.set(D(ce.path),(K.get(D(ce.path))??0)+1);const re=ce=>{const se=D(ce);if((K.get(se)??0)<=1)return se;const be=ce.replace(/[\\/]+$/,"").split(/[\\/]/).slice(-2,-1)[0];return be?`${be}/${se}`:se},z=H.projects.map(ce=>({path:ce.path,label:re(ce.path)})),Z=ce=>({path:ce.path,label:re(ce.path),parentLabel:_B(ce.path,z),cost:ce.cost,tokens:ce.tokens,unpricedTokens:ce.unpricedTokens}),U=_l[Tm%_l.length],ae=new Map,le=[],ge=H.projects.slice(0,Tm),Ne=H.projects.slice(Tm);ge.forEach((ce,se)=>{ae.set(ce.path,_l[se%_l.length]),le.push({key:ce.path,...Z(ce),color:_l[se%_l.length]})}),Ne.length&&le.push({key:"__other__",label:`Other · ${Ne.length} project${Ne.length>1?"s":""}`,cost:Ne.reduce((ce,se)=>ce+se.cost,0),tokens:Ne.reduce((ce,se)=>ce+se.tokens,0),unpricedTokens:Ne.reduce((ce,se)=>ce+se.unpricedTokens,0),color:U,muted:!0,members:Ne.map(Z)});const Ie=H.totalCost,Ge=H.totalTokens,Pe=Ie>0&&H.unpricedTokens===0?"cost":"tokens",ze=Pe==="cost"?Ie:Ge,Re=le.map(ce=>ce.color),st=H.perDay.map(ce=>{const se=new Map;for(const[de,fe]of ce.byPath){const Ce=ae.get(de)??U;se.set(Ce,(se.get(Ce)??0)+fe)}const be=new Map;let Le=0;for(const[de,fe]of ce.unpricedByPath){const Ce=ae.get(de)??U;be.set(Ce,(be.get(Ce)??0)+fe),Le+=fe}return{day:ce.day,total:ce.total,costByColor:se,unpricedByColor:be,unpriced:Le}}),ue=st.reduce((ce,se)=>Math.max(ce,se.total),0);return{rows:le,totalCost:Ie,totalTokens:Ge,basis:Pe,denom:ze,un:H.unattributed,chart:st,maxDay:ue,colorOrder:Re,unpricedTokens:H.unpricedTokens,unpricedNote:yB(H.unpricedModels),calibrated:H.calibrated,reconciled:H.reconciled}},[u,p]),B=(L,H)=>{yi(L).then(D=>{C.current&&(window.clearTimeout(E.current),j({path:L,label:H,ok:D}),E.current=window.setTimeout(()=>{C.current&&j(null)},MB))})},P=L=>k!=null&&k.ok&&k.path===L?"Copied":"Copy",W=u!=null&&u.trackedSince?`Tracked since ${Rm(u.trackedSince)}`:"Tracking starts with this version",ne=P0(f),ee=CB(f),M=b&&!!u;return On.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:I,className:"modal ap-proj-modal",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ap-proj-title ap-proj-sub",children:[o.jsxs("header",{className:"ap-proj-head",children:[o.jsxs("div",{className:"ap-proj-titlewrap",children:[o.jsx("div",{className:"ap-proj-title",id:"ap-proj-title",children:"Projects"}),o.jsx("div",{className:"ap-proj-sub",id:"ap-proj-sub",title:t,children:t})]}),o.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:RB.map(L=>o.jsx("button",{type:"button",className:"uh-range-btn","aria-pressed":r===L.days,onClick:()=>s(L.days),children:L.label},L.days))}),o.jsx("button",{ref:R,className:"glyph-btn ap-proj-close",onClick:n,"aria-label":"Close",children:"×"})]}),o.jsxs("div",{className:`ap-proj-body${M?" refreshing":""}`,"aria-busy":b,children:[b&&!u&&o.jsx("div",{className:"ap-proj-state",children:"Loading…"}),!b&&_&&o.jsxs("div",{className:"ap-proj-state ap-proj-error",children:["Couldn’t load this report: ",_]}),!_&&q&&o.jsx(o.Fragment,{children:q.rows.length===0?o.jsxs("div",{className:"ap-proj-state",children:[EB(f),ee!=null&&o.jsx("div",{className:"ap-proj-widen-wrap",children:o.jsxs("button",{type:"button",className:"ap-proj-copy",onClick:()=>s(ee),children:["Show ",P0(ee)]})}),o.jsxs("div",{className:"ap-proj-note",children:[W,". Only work from this version onward can be tied to an account."]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"ap-proj-bar",role:"img","aria-label":q.basis==="cost"?`Share of ${bt(q.totalCost)} across ${q.rows.length} projects`:`Share of ${Pt(q.totalTokens)} tokens across ${q.rows.length} projects`,children:q.rows.map(L=>{const H=q.basis==="cost"?L.cost:L.tokens,D=q.denom>0?H/q.denom*100:0;if(D<=0)return null;const K=q.basis==="cost"?bh(L.cost,q.totalCost):`${bh(L.tokens,q.totalTokens)} of tokens`;return o.jsx("span",{className:"ap-proj-seg",style:{width:`${D}%`,background:L.color},title:`${L.label} · ${Ls(L.cost,L.unpricedTokens)} · ${K}${L.tokens?` · ${Pt(L.tokens)} tokens`:""}`},L.key)})}),o.jsxs("div",{className:"ap-proj-totals",children:[o.jsx("span",{className:"ap-proj-total-cost",title:jl(q.unpricedTokens),children:Ls(q.totalCost,q.unpricedTokens)}),o.jsxs("span",{className:"ap-proj-total-tok",children:[Pt(q.totalTokens)," tokens"]}),o.jsxs("span",{className:"ap-proj-total-win",children:["· ",ne]}),h&&o.jsx("span",{className:"ap-proj-total-pending",children:"Reconciling cost…"})]}),q.unpricedNote&&o.jsx("div",{className:"ap-proj-note",children:q.unpricedNote}),TB(f,q.chart.length)&&o.jsxs("div",{className:"ap-proj-days",children:[o.jsxs("div",{className:"ap-proj-days-cap",children:["By day",q.chart.length>1?" · click a bar":""]}),o.jsx("div",{className:"ap-proj-days-plot",role:"img","aria-label":`Spend across ${q.chart.length} day${q.chart.length>1?"s":""}`,children:q.chart.map(L=>{const H=q.maxDay>0?L.total/q.maxDay*100:0,D=m===L.day,K=q.rows.map(z=>({label:z.label,c:L.costByColor.get(z.color)??0,u:L.unpricedByColor.get(z.color)??0})).filter(z=>z.c>0||z.u>0),re=`${Rm(Date.parse(`${L.day}T00:00:00`))}, ${Ls(L.total,L.unpriced)}. ${K.map(z=>`${z.label} ${Ls(z.c,z.u)}`).join(", ")}`;return o.jsx("button",{type:"button",className:`ap-proj-day${D?" selected":""}`,"aria-pressed":D,"aria-label":re,title:`${L.day} · ${Ls(L.total,L.unpriced)}`,onClick:()=>y(z=>z===L.day?null:L.day),children:o.jsx("span",{className:"ap-proj-col",style:{height:`${H}%`},children:q.colorOrder.map((z,Z)=>{const U=L.costByColor.get(z)??0;return U<=0||L.total<=0?null:o.jsx("span",{className:"ap-proj-colseg",style:{height:`${U/L.total*100}%`,background:z}},Z)})})},L.day)})}),(()=>{const L=OB(q.chart.length);return o.jsx("div",{className:"ap-proj-days-axis","aria-hidden":"true",children:q.chart.map((H,D)=>o.jsx("div",{className:"ap-proj-axis-cell",children:L(D)?$B(H.day):""},H.day))})})(),(()=>{const L=m?q.chart.find(D=>D.day===m):null;if(!L)return null;const H=q.rows.map(D=>({r:D,c:L.costByColor.get(D.color)??0,u:L.unpricedByColor.get(D.color)??0})).filter(D=>D.c>0||D.u>0);return o.jsxs("div",{className:"ap-proj-day-detail",children:[o.jsxs("div",{className:"ap-proj-day-detail-head",children:[o.jsx("span",{children:Rm(Date.parse(`${L.day}T00:00:00`))}),o.jsx("span",{className:"ap-proj-day-detail-total",title:jl(L.unpriced),children:Ls(L.total,L.unpriced)})]}),H.map(({r:D,c:K,u:re})=>o.jsxs("div",{className:"ap-proj-day-detail-row",children:[o.jsx("span",{className:"ap-proj-dot",style:{background:D.color},"aria-hidden":"true"}),o.jsx("span",{className:"ap-proj-day-detail-name",children:D.label}),o.jsx("span",{className:"ap-proj-day-detail-cost",title:jl(re),children:Ls(K,re)})]},D.key))]})})()]}),o.jsx("ul",{className:"ap-proj-list",children:q.rows.map((L,H)=>{const D=q.basis==="cost"?L.cost:L.tokens,K=q.denom>0?D/q.denom*100:0,re=v.has(L.key),z=`ap-proj-details-${H}`,Z=re&&(!!L.path||!!L.members),U=L.members?`${re?"Hide":"Show"} the ${L.members.length} project${L.members.length>1?"s":""} folded into Other`:`${re?"Hide":"Show"} location for ${L.label}`;return o.jsxs("li",{className:`ap-proj-row${L.muted?" muted":""}${re?" expanded":""}`,children:[o.jsx("span",{className:"ap-proj-dot",style:{background:L.color},"aria-hidden":"true"}),o.jsxs("span",{className:"ap-proj-name",children:[L.label,L.parentLabel&&o.jsxs("span",{className:"ap-proj-parent",children:[" · in ",L.parentLabel]})]}),o.jsx("span",{className:"ap-proj-track",title:q.basis==="cost"?`${bh(L.cost,q.totalCost)} of tracked cost`:`${bh(L.tokens,q.totalTokens)} of tracked tokens`,children:o.jsx("span",{className:"ap-proj-fill",style:{width:`${K}%`,background:L.color}})}),o.jsx("span",{className:"ap-proj-cost",title:jl(L.unpricedTokens),children:Ls(L.cost,L.unpricedTokens)}),o.jsx("span",{className:"ap-proj-tok",children:Pt(L.tokens)}),o.jsx("button",{type:"button",className:"glyph-btn ap-proj-info","aria-expanded":re,"aria-controls":Z?z:void 0,"aria-label":U,onClick:()=>S(ae=>{const le=new Set(ae);return le.has(L.key)?le.delete(L.key):le.add(L.key),le}),children:"ⓘ"}),re&&L.path&&o.jsxs("div",{className:"ap-proj-details",id:z,children:[o.jsx("code",{className:"ap-proj-path",children:PS(L.path)}),o.jsx("button",{type:"button",className:"ap-proj-copy","aria-label":`${P(L.path)} location for ${L.label}`,onClick:()=>B(L.path,L.label),children:P(L.path)})]}),re&&L.members&&o.jsx("div",{className:"ap-proj-details ap-proj-other-members",id:z,children:L.members.map(ae=>o.jsxs("div",{className:"ap-proj-other-member",children:[o.jsxs("div",{className:"ap-proj-other-name",children:[ae.label,ae.parentLabel&&o.jsxs("span",{className:"ap-proj-parent",children:[" · in ",ae.parentLabel]})]}),o.jsx("code",{className:"ap-proj-path",children:PS(ae.path)}),o.jsx("span",{className:"ap-proj-cost",title:jl(ae.unpricedTokens),children:Ls(ae.cost,ae.unpricedTokens)}),o.jsx("span",{className:"ap-proj-tok",children:Pt(ae.tokens)}),o.jsx("button",{type:"button",className:"ap-proj-copy","aria-label":`${P(ae.path)} location for ${ae.label}`,onClick:()=>B(ae.path,ae.label),children:P(ae.path)})]},ae.path))})]},L.key)})}),q.un&&o.jsxs("div",{className:"ap-proj-unattributed",children:[o.jsx("span",{className:"ap-proj-dot",style:{background:AB},"aria-hidden":"true"}),o.jsxs("div",{className:"ap-proj-un-labels",children:[o.jsx("span",{className:"ap-proj-un-title",children:"Unattributed usage"}),o.jsx("span",{className:"ap-proj-un-tag",children:"Excluded from the project totals"})]}),o.jsx("span",{className:"ap-proj-un-cost",title:jl(q.un.unpricedTokens),children:Ls(q.un.cost,q.un.unpricedTokens,IB)}),o.jsx("span",{className:"ap-proj-un-tok",children:Pt(q.un.tokens)}),o.jsx("div",{className:"ap-proj-note",children:"Work no account could be tied to — from before tracking, or a gap."})]}),o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:k&&(k.ok?`Copied the location of ${k.label}`:`Could not copy the location of ${k.label} — select it and copy it by hand`)}),o.jsxs("div",{className:"ap-proj-foot",children:[h?"Dollars estimated · ccusage still running":q.reconciled?"Dollars from ccusage · split by activity":q.calibrated?"Dollars from ccusage for the priced models · split by activity":p?"Dollars estimated · ccusage could not price this window":"Dollars estimated · ccusage unavailable"," · ",W]})]})})]})]})}),document.body)}const DS=18,PB=1100,El=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},DB=Array.from({length:DS},(e,t)=>{const n=-72+144*t/(DS-1)+(El(t,1)-.5)*9,r=(n-90)*(Math.PI/180),s=(54+32*Math.cos(n*Math.PI/180))*(.74+El(t,2)*.52);return{dx:Math.cos(r)*s,dy:Math.sin(r)*s,rot:(t%2?1:-1)*(100+El(t,3)*260),delay:Math.round(El(t,4)*90),dur:760+Math.round(El(t,5)*260),scale:.8+El(t,6)*.45,hue:t%4,round:t%3===0}});function FS({anchor:e}){var s;const[t,n]=w.useState(null),r=typeof window<"u"&&((s=window.matchMedia)==null?void 0:s.call(window,"(prefers-reduced-motion: reduce)").matches);return w.useEffect(()=>{if(r)return;const l=e.current;if(!l)return;const c=l.getBoundingClientRect();n({x:c.left+c.width/2,y:c.top+c.height/2});const u=window.setTimeout(()=>n(null),PB);return()=>window.clearTimeout(u)},[e,r]),r||!t?null:On.createPortal(o.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:DB.map((l,c)=>o.jsx("span",{className:`confetti-bit${l.round?" round":""}`,"data-hue":l.hue,style:{"--dx":`${l.dx.toFixed(1)}px`,"--dy":`${l.dy.toFixed(1)}px`,"--rot":`${l.rot}deg`,"--s":l.scale.toFixed(2),animationDelay:`${l.delay}ms`,animationDuration:`${l.dur}ms, ${l.dur}ms`}},c))}),document.body)}const BM=new Set(["awaiting_url","awaiting_code","registering"]);function FB(e){return e!=null&&BM.has(e)}function zM(e){return e!=null&&e!=="done"&&!BM.has(e)}const qB="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",BB="the sign-in did not complete";function zB({state:e,serverError:t,localError:n}){const r=e==="idle";return{title:r?"Sign-in ended":"Sign-in failed",message:n||t||(r?qB:BB)}}function UB({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 HB({started:e,state:t}){return!e||t==="done"?null:{action:"login-cancel"}}const WB="done";function VB(){let e=!1;return{shouldAnnounce(t){return t!==WB?(e=!1,!1):e?!1:(e=!0,!0)}}}function Db(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const GB={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 ${hn}`,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"},KB={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"},Fb=`claude-swap could not read the login keychain — start ${hn} from a Terminal window rather than a background service`,qS={unreadable_here:{short:"Keychain locked on this Mac",long:`${Fb}.`},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 sf(e){return e&&Object.hasOwn(qS,e)?qS[e]:null}const UM={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 D0(e,t,n){const r=n==null?null:UM[n];if(r)return r;if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test($u(e)))return Fb;const s=Db(KB,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function $u(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const YB={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"},XB="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 ZB(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const QB="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",JB="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",ez=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),tz=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,nz=/[\\/]_npx[\\/]/i,rz=`the copy of ccusage ${hn} installed for itself`;function sz(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function fZ(e,t){const n=az(e,t),r=sz(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 ${ou(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${ou(n)}`;case"managed":return`${rz} failed to run: ${ou(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${ou(n)}`:`the ccusage this deck found on your PATH failed to run: ${ou(n)}`;default:return n}}const ou=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function az(e,t){const n=$u(e);if(ez(n)){if(nz.test(n))return JB;if(tz.test(n))return QB}if(ZB(n))return XB;const r=Db(YB,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function Ol(e,t,n){const r=n==null?null:UM[n];if(r)return r;if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&zM(e.state))return e.error;const s=Db(GB,e==null?void 0:e.reason);return s||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function oz(e,t,n){if(n<=0||_f(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 HM(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 iz(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}`,l=[];return n.alias&&r&&l.push(r),r&&(t.get(r.toLowerCase())??0)>1&&l.push(n.org||`slot ${n.num}`),{num:n.num,label:s,sub:l.length?l.join(" · "):null}})}function lz(e,t){return e.filter(n=>!t.includes(n.num)).map(n=>n.num)}function cz(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function uz(e){return e.length?{action:"share",accounts:[...e]}:null}function dz(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 F0(e){return`${e.email}|${e.org??""}`}function hz(e,t,n){return e&&e.map(r=>F0(r)===t?n:r)}function fz(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 pz(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 l=n("healed");l&&r.push(`${l} had a dead token replaced`);const c=n("updated");c&&r.push(`${c} updated`);const u=n("present");u&&r.push(`${u} already here`);const f=n("failed");f&&r.push(`${f} did not arrive`);const p=[...new Set(e.map(h=>{var m;return(m=sf(h.check))==null?void 0:m.short}).filter(h=>!!h))];return`${r.join(", ")}${p.length?`, ${p.join(", ")}`:""}.`}const mz=1500,kh=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],BS="aa-panel",zS=e=>`aa-tab-${e}`;async function iu(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const q0=ve.forwardRef((e,t)=>o.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[o.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),o.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));q0.displayName="SuccessMark";function gz({onClose:e,onChanged:t}){const[n,r]=w.useState("login"),[s,l]=w.useState(null),[c,u]=w.useState(""),[f,p]=w.useState(""),[h,m]=w.useState(!1),[y,v]=w.useState(null),[S,b]=w.useState(null),[_,k]=w.useState(null),[j,E]=w.useState(null),C=w.useRef(""),R=w.useRef(!1),I=w.useRef(!1),$=w.useRef(null),q=w.useRef(null),B=w.useRef(null),P=w.useRef(null),W=w.useRef([]),ne=w.useRef(!1),ee=w.useCallback(()=>{const U=HB({started:R.current,state:s==null?void 0:s.state});U&&iu(U).catch(()=>{}),e()},[e,s==null?void 0:s.state]),M=mn(ee,{focusRef:B}),X=w.useCallback(async()=>{if(!Ps(I.current))return;I.current=!0,m(!0),v(null),R.current=!0;const U=await iu({action:"login"}).catch(()=>null);if(I.current=!1,m(!1),!(U!=null&&U.ok)){v(Ol(U,"could not start the sign-in"));return}l(U)},[]);w.useEffect(()=>{if(!FB(s==null?void 0:s.state))return;const U=window.setInterval(async()=>{try{const ae=await fetch("/api/claude-accounts/login");ae.ok&&l(await ae.json())}catch{}},mz);return()=>window.clearInterval(U)},[s]);const V=w.useRef(t);V.current=t;const G=w.useState(VB)[0];w.useEffect(()=>{var U;(s==null?void 0:s.state)==="awaiting_code"&&((U=$.current)==null||U.focus()),G.shouldAnnounce(s==null?void 0:s.state)&&V.current()},[s==null?void 0:s.state,G]),w.useEffect(()=>{var U;n==="paste"&&!ne.current&&((U=q.current)==null||U.focus()),ne.current=!1},[n]);const F=w.useCallback(U=>{var le;const ae=oz(U,kh.findIndex(ge=>ge.id===n),kh.length);ae.kind!=="pass"&&(U.preventDefault(),ne.current=!0,r(kh[ae.index].id),(le=W.current[ae.index])==null||le.focus())},[n]),L=w.useCallback(async()=>{var ae;if(!Ps(I.current))return;I.current=!0,m(!0),v(null);const U=await iu({action:"login-code",code:c}).catch(()=>null);if(I.current=!1,m(!1),!(U!=null&&U.ok)){v(Ol(U,"the code was not accepted")),U!=null&&U.state&&l(U),(ae=$.current)==null||ae.select();return}u(""),l(U)},[c,s]),H=w.useCallback(async()=>{if(!Ps(I.current))return;I.current=!0,m(!0),v(null);const U=await iu({action:"import",blob:f}).catch(()=>null);if(I.current=!1,m(!1),!(U!=null&&U.ok)){v(Ol(U,"the import failed"));return}C.current=f,p(""),E(null),b(U.results??[]),t()},[f,t]),D=w.useCallback(async U=>{const ae=F0(U);if(!Ps(I.current)||!C.current)return;I.current=!0,m(!0),k(ae),E(null);const le=await iu({action:"import",blob:C.current,force:!0,only:{email:U.email,org:U.org??""}}).catch(()=>null);if(I.current=!1,m(!1),k(null),!(le!=null&&le.ok)){E({key:ae,text:Ol(le,"that account could not be updated")});return}const ge=(le.results??[])[0];ge&&b(Ne=>hz(Ne,ae,ge)),t()},[t]),K=(s==null?void 0:s.state)==="done"?s.account:null,re=UB({restored:s==null?void 0:s.restored,activeAccount:s==null?void 0:s.activeAccount}),z=zM(s==null?void 0:s.state)||!!(y&&R.current&&!h),Z=zB({state:s==null?void 0:s.state,serverError:s==null?void 0:s.error,localError:y});return On.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:ee,role:"presentation",children:o.jsxs("div",{ref:M,className:"modal aa-modal",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:F,children:kh.map((U,ae)=>o.jsx("button",{type:"button",role:"tab",id:zS(U.id),ref:le=>{W.current[ae]=le},"aria-selected":n===U.id,"aria-controls":BS,tabIndex:n===U.id?0:-1,className:`aa-tab${n===U.id?" on":""}`,onClick:()=>{ne.current=!1,r(U.id)},children:U.label},U.id))})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:ee,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsx("section",{className:"modal-body aa-body",id:BS,role:"tabpanel","aria-labelledby":zS(n),children:n==="login"?K?o.jsxs("div",{className:"aa-done",children:[o.jsx(q0,{ref:P}),o.jsx(FS,{anchor:P}),o.jsx("h4",{children:K.added?`Account ${K.num} added`:"Credentials refreshed"}),o.jsxs("p",{className:"aa-note",children:[o.jsx("strong",{children:K.email}),K.added?re?" 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."]}),re?o.jsx("p",{className:"aa-note aa-warn",role:"status",children:re}):null,o.jsx("button",{type:"button",className:"btn primary",onClick:ee,children:"Done"})]}):(s==null?void 0:s.state)==="awaiting_code"||(s==null?void 0:s.state)==="registering"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:"1 · Approve in the browser"}),o.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),o.jsx("a",{className:"aa-link",href:s.url??"#",target:"_blank",rel:"noreferrer noopener",children:s.url})]}),o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),o.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."}),o.jsxs("div",{className:"aa-field",children:[o.jsx("input",{ref:$,type:"text",value:c,onChange:U=>u(U.target.value),onKeyDown:U=>{U.key==="Enter"&&c.trim()&&!h&&L()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:s.state==="registering"}),o.jsx("button",{type:"button",className:"btn primary",...to(h,!c.trim()||s.state==="registering"),onClick:L,children:s.state==="registering"?"registering…":"Continue"})]}),(y||s.error)&&o.jsx("p",{className:"aa-err",children:y??s.error}),o.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?o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:Z.title}),o.jsx("p",{className:"aa-err",children:Z.message}),o.jsx("button",{type:"button",className:"btn",onClick:()=>{R.current=!1,l(null),v(null),X()},children:"Try again"})]}):h||R.current?o.jsx("div",{className:"aa-step",children:o.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):o.jsxs("div",{className:"aa-step aa-primer",children:[o.jsx("h4",{children:"Sign in to Anthropic"}),o.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."}),o.jsx("div",{className:"aa-actions",children:o.jsx("button",{type:"button",ref:B,className:"btn primary",onClick:X,children:"Open the sign-in page"})})]}):S?(()=>{const U=S.filter(le=>le.state==="imported").length,ae=S.some(le=>sf(le.check));return o.jsxs("div",{className:"aa-done",children:[!ae&&o.jsx(q0,{ref:P}),U>0&&!ae&&o.jsx(FS,{anchor:P}),o.jsx("h4",{children:pz(S)}),S.length>0&&o.jsx("ul",{className:"aa-results",children:S.map(le=>{const ge=F0(le),Ne=sf(le.check);return o.jsxs("li",{className:`aa-result ${le.state}`,children:[o.jsx("span",{className:"aa-result-who",children:le.email||(le.num?`slot ${le.num}`:"an account")}),o.jsx("span",{className:"aa-result-what",children:fz(le.state)}),le.state==="present"&&o.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":_===ge,title:`Overwrite the stored login for ${le.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>D(le),children:_===ge?"updating…":"update anyway"}),Ne&&o.jsx("span",{className:"aa-result-err",children:Ne.long}),(j==null?void 0:j.key)===ge&&o.jsx("span",{className:"aa-result-err",children:j.text})]},ge)})}),o.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",o.jsx("strong",{children:" update anyway"}),"."]}),o.jsxs("div",{className:"aa-actions",children:[o.jsx("button",{type:"button",className:"btn primary",onClick:ee,children:"Done"}),o.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),b(null)},children:"Import another"})]})]})})():o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:"Paste an account shared from another deck"}),o.jsxs("div",{className:"aa-field",children:[o.jsx("input",{ref:q,type:"text",value:f,onChange:U=>p(U.target.value),onKeyDown:U=>{U.key==="Enter"&&f.trim()&&!h&&H()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),o.jsx("button",{type:"button",className:"btn primary",...to(h,!f.trim()),onClick:H,children:h?"importing…":"Import"})]}),y&&o.jsx("p",{className:"aa-err",children:y}),o.jsxs("p",{className:"aa-note",children:["Use ",o.jsx("strong",{children:"share"})," on one account in the other deck, or ",o.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})}),document.body)}const yz=6;function wz(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",l=t.strained&&!t.armed?vz(n):null,c=[r];return l!=null&&c.push(`${l}% free`),c.push(t.armed?`auto ${t.threshold??"on"}${t.threshold?"%":""}`:"auto off"),{text:c.join(" · "),tone:s,free:l}}function vz(e){const t=e.map(n=>n.headroom).filter(n=>typeof n=="number");return t.length?Math.max(...t):null}function xz(e){const t=[...e].sort((s,l)=>{if(s.ready!==l.ready)return s.ready?-1:1;if(!s.ready)return s.name.localeCompare(l.name);const c=s.headroom,u=l.headroom;return c==null&&u==null?s.name.localeCompare(l.name):c==null?1:u==null?-1:u-c}),n=t.slice(0,yz),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 WM({title:e,steps:t,finish:n,aside:r,onClose:s}){const l=w.useRef(null),c=mn(s,{focusRef:l}),[u,f]=w.useState(0),p=u===t.length-1,h=t[u],m=S=>f(Math.max(0,Math.min(t.length-1,S))),y=S=>{S.key!=="ArrowRight"&&S.key!=="ArrowLeft"||(S.preventDefault(),S.stopPropagation(),m(S.key==="ArrowRight"?u+1:u-1))},v=()=>{if(!p){m(u+1);return}n?n.act():s()};return On.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:o.jsxs("div",{ref:c,className:"modal guide",onClick:S=>S.stopPropagation(),onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),o.jsxs("span",{className:"modal-tool-id",children:[u+1," / ",t.length]})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[o.jsx("div",{className:"guide-stage",children:h.art},u),o.jsx("p",{className:"guide-line","aria-live":"polite",children:h.line}),o.jsx("p",{className:"guide-tip",children:h.tip??""}),o.jsxs("div",{className:"guide-foot",children:[o.jsx("div",{className:"guide-dots",children:t.map((S,b)=>o.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${b+1} of ${t.length}`,"aria-current":b===u?"step":void 0,onClick:()=>m(b)},b))}),p&&r&&o.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:r.act,children:r.label}),u>0&&o.jsx("button",{type:"button",className:"btn",onClick:()=>m(u-1),children:"Back"}),o.jsx("button",{ref:l,type:"button",className:"btn primary",onClick:v,children:p?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const B0={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function qr({children:e}){return o.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function Fr({x:e,y:t=34,w:n=176,h:r=132,label:s}){return o.jsxs(o.Fragment,{children:[s&&o.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:s}),o.jsx("rect",{x:e,y:t,width:n,height:r,rx:10,className:"ga-screen"})]})}function ws({x:e,y:t,email:n,state:r,tone:s,bars:l}){return o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:e+3,cy:t-4,r:3,className:B0[s]}),o.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),o.jsx("text",{x:e+12,y:t+16,className:`ga-s ${B0[s]}`,children:r}),l==null?void 0:l.map((c,u)=>o.jsxs("g",{children:[o.jsx("text",{x:e,y:t+40+u*18,className:"ga-s",children:u?"7d":"5h"}),o.jsx("rect",{x:e+22,y:t+35+u*18,width:96,height:4,rx:2,className:"ga-track"}),o.jsx("rect",{x:e+22,y:t+35+u*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),o.jsxs("text",{x:e+148,y:t+40+u*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},u))]})}function VM({x:e,y:t,on:n}){return o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),o.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function Nh({x:e,y:t,name:n,here:r=!0}){return o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:e+3,cy:t-4,r:3,className:r?"ga-ok":"ga-dim"}),o.jsx("text",{x:e+12,y:t,className:r?"ga-t":"ga-s",children:n})]})}function US({x:e,y:t,on:n}){return n?o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),o.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):o.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function HS({x:e,y:t,d:n}){return o.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function qb({x:e,y:t}){return o.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 Bb(){return o.jsxs(o.Fragment,{children:[o.jsx("circle",{r:9,className:"ga-key-bed"}),o.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[o.jsx("circle",{cx:4.6,cy:7,r:2.6}),o.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function Ll({x:e,y:t,w:n,title:r,sub:s,tone:l}){return o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),o.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:B0[l]}),o.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:r}),o.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:s})]})}function Bl({x:e,y:t,label:n,live:r}){return o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:r?"ga-chip-live":"ga-chip"}),o.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function af({x:e,y:t}){return o.jsxs(o.Fragment,{children:[o.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),o.jsx(VM,{x:e+118,y:t-13,on:!0})]})}function bz(){return o.jsxs(qr,{children:[o.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),o.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),o.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),o.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),o.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),o.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),o.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),o.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),o.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),o.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),o.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),o.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),o.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),o.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),o.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),o.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),o.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),o.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),o.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),o.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),o.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),o.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function kz(){return o.jsxs(qr,{children:[o.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),o.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),o.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),o.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),o.jsx(Ll,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),o.jsx(Ll,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),o.jsx(Ll,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),o.jsx(Ll,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),o.jsx(Bl,{x:326,y:28,label:"Read"}),o.jsx(Bl,{x:380,y:28,label:"Grep",live:!0}),o.jsx(Bl,{x:326,y:90,label:"Bash",live:!0})]})}function WS({x:e,y:t,label:n,pct:r,note:s}){return o.jsxs(o.Fragment,{children:[o.jsx("text",{x:e,y:t,className:"ga-s",children:n}),o.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[r,"%"]}),o.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),o.jsx("rect",{x:e,y:t+7,width:194*r/100,height:5,rx:2.5,className:"ga-accent"}),o.jsx("text",{x:e,y:t+26,className:"ga-s",children:s})]})}function Nz(){return o.jsxs(qr,{children:[o.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),o.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),o.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),o.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),o.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),o.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),o.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),o.jsx(WS,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),o.jsx(WS,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function Sz(){return o.jsxs(qr,{children:[o.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),o.jsx(Ll,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),o.jsx(qb,{x:156,y:106}),o.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),o.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),o.jsx(Fr,{x:200,y:22,w:226,h:160}),o.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),o.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),o.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),o.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),o.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),o.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),o.jsx(Bl,{x:214,y:122,label:"Read"}),o.jsx(Bl,{x:266,y:122,label:"Edit"}),o.jsx(Bl,{x:318,y:122,label:"Bash",live:!0}),o.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),o.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function jz(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return o.jsxs(qr,{children:[o.jsx(Fr,{x:14,y:20,w:412,h:160}),o.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),o.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),o.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),o.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>o.jsxs("g",{children:[o.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),o.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),o.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),o.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),o.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),o.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),o.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),o.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),o.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),o.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),o.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),o.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),o.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),o.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function _z(){return o.jsxs(qr,{children:[o.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),o.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),o.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),o.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[o.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),o.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),o.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),o.jsx("path",{d:"M210 100H238",className:"ga-arc"}),o.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),o.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),o.jsx("g",{className:"ga-pop",children:o.jsx(Ll,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function Ez(){return o.jsxs(qr,{children:[o.jsx(Fr,{x:14,y:16,w:232,h:170}),o.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),o.jsx(HS,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),o.jsx(HS,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),o.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),o.jsx(ws,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),o.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),o.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),o.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),o.jsx(ws,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),o.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),o.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),o.jsx(qb,{x:221,y:161}),o.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),o.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),o.jsx(Fr,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),o.jsx("g",{className:"ga-pop",children:o.jsx(ws,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function Cz(){return o.jsxs(qr,{children:[o.jsx(Fr,{x:14,label:"THIS MACHINE"}),o.jsx(af,{x:28,y:60}),o.jsx("g",{className:"ga-swap-out",children:o.jsx(ws,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),o.jsx("g",{className:"ga-swap-in",children:o.jsx(ws,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),o.jsx(Fr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(af,{x:264,y:60}),o.jsx(ws,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),o.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),o.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:o.jsx(Bb,{})})]})}const Tz=[{art:o.jsx(bz,{}),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:o.jsx(kz,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:o.jsx(Sz,{}),line:"Double-click any node: its prompt, every tool call, tokens and timing."},{art:o.jsx(Nz,{}),line:"What each session costs, and how much quota is left."},{art:o.jsx(jz,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:o.jsx(Ez,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:o.jsx(Cz,{}),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:o.jsx(_z,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function Rz(){return o.jsxs(qr,{children:[o.jsx(Fr,{x:14,label:"THIS MACHINE"}),o.jsx(ws,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),o.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),o.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),o.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),o.jsx(Fr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(ws,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function Az(){return o.jsxs(qr,{children:[o.jsx(Fr,{x:14,label:"THIS MACHINE"}),o.jsx(af,{x:28,y:60}),o.jsx(Nh,{x:28,y:92,name:"Ana's MacBook"}),o.jsx(Nh,{x:28,y:114,name:"Dorin's PC"}),o.jsx(Fr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(af,{x:264,y:60}),o.jsx(Nh,{x:264,y:92,name:"Your MacBook"}),o.jsx(Nh,{x:264,y:114,name:"Dorin's PC"}),o.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),o.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),o.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),o.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function Mz(){return o.jsxs(qr,{children:[o.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),o.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),o.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),o.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),o.jsx(US,{x:106,y:88,on:!0}),o.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),o.jsx(US,{x:106,y:112}),o.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),o.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),o.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),o.jsx(VM,{x:304,y:157,on:!0}),o.jsx(qb,{x:115,y:97})]})}function Iz(){return o.jsxs(qr,{children:[o.jsx(Fr,{x:14,label:"THIS MACHINE"}),o.jsx("g",{className:"ga-swap-out",children:o.jsx(ws,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),o.jsx("g",{className:"ga-swap-in",children:o.jsx(ws,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),o.jsx(Fr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(ws,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),o.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),o.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:o.jsx(Bb,{})})]})}const $z=[{art:o.jsx(Rz,{}),line:"A login can expire on one machine while it still works on another."},{art:o.jsx(Az,{}),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:o.jsx(Mz,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:o.jsx(Iz,{}),line:"An expired login is copied from a paired machine within a minute."}];function Oz(){return o.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[o.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),o.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),o.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),o.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),o.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),o.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),o.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),o.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),o.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),o.jsx("g",{transform:"translate(116 13)",children:o.jsx(Bb,{})})]})}const Lz={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."},Pz=1600;function GM({reach:e,where:t}){const[n,r]=w.useState(!1),s=w.useRef(!0);w.useEffect(()=>()=>{s.current=!1},[]);const l=(e==null?void 0:e.steps)??[],c=w.useCallback(async()=>{await yi(l.join(`
|
|
91
|
-
`))&&s.current&&(r(!0),window.setTimeout(()=>{s.current&&r(!1)},Pz))},[l]);if(!(e!=null&&e.blocked))return null;const u=e.shell==="sh";return o.jsxs("div",{className:"ap-lan-reach",children:[o.jsx("p",{className:"lan-warn",children:e.text}),o.jsx("p",{className:"lan-note",children:Lz[t]}),l.length>0&&o.jsxs("details",{className:"ap-lan-reach-fix",children:[o.jsx("summary",{children:"or let them find this deck on their own"}),o.jsxs("p",{className:"lan-note",children:[u?o.jsx(o.Fragment,{children:"Run this in a terminal on this machine, then restart the deck."}):o.jsxs(o.Fragment,{children:["Run this in PowerShell ",o.jsx("strong",{children:"as Administrator"}),", then restart the deck."]}),e.category==="Public"&&o.jsx(o.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&&o.jsxs(o.Fragment,{children:[" ",e.unsure]})]}),o.jsx("pre",{className:"ap-lan-cmd",children:o.jsx("code",{children:l.join(`
|
|
92
|
-
`)})}),o.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>void c(),title:u?"Copy these lines, then paste them into a terminal":"Copy these lines, then paste them into an elevated PowerShell",children:n?"copied":"copy command"})]})]})}async function Am(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const Dz={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."},Fz={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function VS(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||dn(n,t)}function qz({status:e,manual:t,startWith:n,onClose:r,onChanged:s}){const l=w.useRef(null),c=w.useRef(null),u=w.useRef(null),f=e.pairingMode==="invite",p=mn(r,{focusRef:f?c:l}),[h,m]=w.useState(""),[y,v]=w.useState(""),[S,b]=w.useState(null),[_,k]=w.useState(null),[j,E]=w.useState(null),[C,R]=w.useState(null),[I,$]=w.useState(()=>Date.now());w.useEffect(()=>{const re=window.setInterval(()=>$(Date.now()),1e3);return()=>window.clearInterval(re)},[]);const q=w.useRef(!0);w.useEffect(()=>()=>{q.current=!1},[]);const B=w.useRef(null),P=w.useCallback(re=>Mf(B.current)?(B.current=re,E(re),!0):!1,[]),W=w.useCallback(()=>{B.current=null,q.current&&E(null)},[]),ne=re=>{const z=lo(j,re);return{disabled:z.disabled,"aria-busy":z.busy}},ee=re=>(S==null?void 0:S.field)===re?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},M=re=>b(z=>z&&z.field===re?null:z),X=w.useCallback(async()=>{if(f)return;const re=tU(h);if(!re){b({text:Bz(h),field:"addr"});return}const z=`${re.addr}:${re.port}`,Z=e.peers.find(U=>U.addr===re.addr&&U.port===re.port&&U.paired);if(Z){b({text:`Already paired with ${Z.name} at that address.`,field:"addr"});return}if(t.includes(z)){b({text:"This deck already calls that address.",field:"addr"});return}if(P("add"))try{const U=await Am("/api/prefs",{lan:{manual:[...t,z]}});if(!q.current)return;U!=null&&U.ok?(b(null),m(""),s(),r()):b({text:dn("add that address",U),field:"addr"})}catch{q.current&&b({text:dn("add that address",null),field:"addr"})}finally{W()}},[h,f,t,e.peers,s,r,P,W]),V=w.useCallback(async re=>{if(!P(`invite:${re}`))return;const z=re==="make"?"make an invite":"cancel that invite";try{const Z=await Am("/api/lan/invite",{action:re});if(!q.current)return;Z!=null&&Z.ok?(b(null),k(null),s()):b({text:VS(Fz,Z,z)})}catch{q.current&&b({text:dn(z,null)})}finally{W()}},[s,P,W]),G=w.useCallback(async()=>{const re=y.trim();if(!(!re||!P("join"))){R(null);try{const z=await Am("/api/lan/invite",{action:"join",token:re});if(!q.current)return;z!=null&&z.ok?(v(""),b(null),s(),r()):(z==null?void 0:z.reason)==="unreachable"&&Array.isArray(z.tried)&&z.tried.length?(R(z.tried),b(null)):(R(null),b({text:VS(Dz,z,"use that invite"),field:"join"}))}catch{q.current&&b({text:dn("use that invite",null),field:"join"})}finally{W()}}},[y,s,r,P,W]),F=w.useCallback(async(re,z)=>{try{await navigator.clipboard.writeText(re),k(z),window.setTimeout(()=>{q.current&&k(Z=>Z===z?null:Z)},1600)}catch{b({text:"Could not copy it — select the text and copy it by hand."})}},[]),L=e.invite&&e.invite.expiresAt>I?e.invite:null,H=w.useRef(!1);w.useEffect(()=>{n!=="invite"||H.current||L||(H.current=!0,V("make"))},[n,L,V]);const D=w.useRef(!1);w.useEffect(()=>{var re;n!=="invite"||D.current||!L||(D.current=!0,(re=u.current)==null||re.focus())},[n,L]);const K=e.port!=null?(e.addrs??[]).map(re=>`${re}:${e.port}`):[];return On.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:o.jsxs("div",{ref:p,className:"modal lan-add",onClick:re=>re.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{className:"glyph-btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[S&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:S.text}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>b(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),o.jsx(GM,{reach:e.reach,where:"dialog"}),f&&o.jsx("div",{className:"modal-section",children:o.jsx("p",{className:"lan-note",children:"Adding by address is off while this deck pairs only by invite."})}),!f&&o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"By address"}),o.jsxs("div",{className:"ap-lan-row",children:[o.jsx("input",{ref:l,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:h,placeholder:"192.168.1.5:54340",spellCheck:!1,...ee("addr"),onChange:re=>{m(re.target.value),M("addr")},onKeyDown:re=>{re.key==="Enter"&&X()}}),h.trim()!==""&&o.jsx("button",{type:"button",className:"ap-manage-btn",...ne("add"),onClick:()=>void X(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),o.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."}),e.port!=null&&K.length>0&&o.jsxs("p",{className:"lan-note",children:["They type this deck’s own address into the same field on theirs:"," ",K.map((re,z)=>o.jsxs("span",{children:[z>0&&" or ",o.jsx("code",{className:"ap-lan-code",children:re})]},re)),o.jsx("button",{type:"button",className:"ap-lan-word lan-copy",...ne("copy:mine"),onClick:()=>void F(K.join(" "),"mine"),title:"Copy this deck's address, to send to whoever is adding it",children:_==="mine"?"copied":"copy"})]})]}),o.jsxs("div",{className:"modal-section",children:[o.jsxs("h3",{className:"lan-h",children:["With an invite",!L&&o.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...ne("invite:make"),onClick:()=>void V("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:j==="invite:make"?"making…":"make one to send"})]}),o.jsxs("div",{className:"ap-lan-row",children:[o.jsx("input",{ref:c,className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:y,placeholder:"paste one you were sent",spellCheck:!1,...ee("join"),onChange:re=>{v(re.target.value),R(null),M("join")},onKeyDown:re=>{re.key==="Enter"&&G()}}),y.trim()!==""&&o.jsx("button",{type:"button",className:"ap-manage-btn",...ne("join"),onClick:()=>void G(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:j==="join"?"joining…":"join"})]}),o.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),C&&o.jsxs("div",{className:"ap-lan-tried",children:[o.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."}),C.map(re=>o.jsxs("span",{className:"ap-lan-tried-row",children:[o.jsx("code",{className:"ap-lan-code",children:re.addr}),o.jsx("span",{className:"ap-lan-bad",children:re.why})]},re.addr))]}),L&&o.jsxs("div",{className:"ap-lan-invite",children:[o.jsxs("div",{className:"ap-lan-invite-head",children:[o.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),o.jsxs("span",{className:"ap-lan-invite-left",id:"lan-invite-left",children:[lU(L.expiresAt,I)," left"]})]}),o.jsx("code",{className:"ap-lan-token",children:L.token}),o.jsxs("div",{className:"ap-lan-acts",children:[o.jsx("button",{type:"button",className:"ap-manage-btn",ref:u,...ne("copy:invite"),"aria-label":_==="invite"?"Invite copied":"Copy invite","aria-describedby":"lan-invite-left",onClick:()=>void F(L.token,"invite"),title:"Copy it, and send it however you already talk to them",children:_==="invite"?"copied":"copy"}),o.jsx("button",{type:"button",className:"ap-manage-btn",...ne("invite:withdraw"),onClick:()=>void V("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),o.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function Bz(e){const t=(e??"").trim();if(t==="")return"Type an address and a port, like 192.168.1.5:54340.";if(!t.startsWith("[")&&(t.match(/:/g)??[]).length>1)return"Too many colons to split. Use that deck's IPv4 address or its name, like 192.168.1.5:54340.";if(!t.includes(":"))return`Add the port too, like ${t}:54340.`;const n=t.slice(t.lastIndexOf(":")+1).trim();return n===""?"That is missing its port — try 192.168.1.5:54340.":/^\d+$/.test(n)?`A port runs from 1 to 65535, and this one is ${n}.`:`A port is a number, and this one is "${n}".`}const zz=1e3;function Uz(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=qs(e,t);return`${n} · ${r==="now"?"just now":r}`}function GS(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function Hz(){return o.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:[o.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),o.jsx("path",{d:"M8.4 3.6l2 2"})]})}function KS(){return o.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:[o.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),o.jsx("path",{d:"M1 13h14"})]})}function Sh({dir:e,gate:t=!1}){const n=t?12:8;return o.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:o.jsx("path",{d:e==="out"?"M2.8 1L6 4 2.8 7":t?"M1 1v6M9.6 1L6.4 4l3.2 3":"M5.2 1L2 4l3.2 3"})})}const Wz={works:"works here",expired:"expired here",missing:"not on this deck",unavailable:"cannot share here"},Vz={works:"works there",broken:"broken there",unavailable:"cannot share there",unknown:"not offered by that deck"};function Gz(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${Wz[e.here]}, ${Vz[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function Kz({row:e,source:t,status:n,accounts:r,now:s,busy:l,onClose:c,onRename:u,onCheck:f,onVerb:p,onSettings:h,onInvite:m,twins:y=[],onUnpair:v}){var It,zt,Xt,Ft,rn;const S=w.useRef(null),b=mn(c,{focusRef:S}),[_,k]=w.useState(null),[j,E]=w.useState(null),[C,R]=w.useState(!1),I=w.useRef(0),[$,q]=w.useState(null),[B,P]=w.useState(!1),[W,ne]=w.useState(0),ee=w.useRef(null),M=w.useRef(!0);w.useEffect(()=>()=>{M.current=!1},[]);const X=_!=null;w.useEffect(()=>{var Se;X&&((Se=ee.current)==null||Se.select())},[X]),w.useEffect(()=>{if(!C)return;const Se=window.setTimeout(()=>R(!1),4e3);return()=>window.clearTimeout(Se)},[C]),w.useEffect(()=>{if(!$)return;const Se=window.setTimeout(()=>q(null),4e3);return()=>window.clearTimeout(Se)},[$]);const V=Se=>{const vt=lo(l,Se);return{disabled:vt.disabled,"aria-busy":vt.busy}},G=async Se=>{const vt=await Se();return M.current&&E(vt),vt==null},{peer:F,stranger:L}=t,H=e.kind==="paired",D=e.self??e.name,K=e.kind!=="dialling",re=e.kind==="dialling"?null:e.fp,z=F?F.addr?`${F.addr}:${F.port}`:"":L?L.port?`${L.addr}:${L.port}`:L.addr:e.addr,Z=(F==null?void 0:F.about)??null,U=((It=n.about)==null?void 0:It.version)??null,ae=async Se=>{const vt=Se.trim()===D?"":Se;await G(()=>u(vt))&&k(null)},le=async()=>{if(re)try{if(await navigator.clipboard.writeText(re),!M.current)return;P(!0),window.setTimeout(()=>{M.current&&P(!1)},1600)}catch{M.current&&E("Could not copy it — select the fingerprint and copy it by hand.")}},ge=H?F!=null&&F.waiting?F.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":F!=null&&F.offers?"not said — it runs an older version":"not reached yet":"shown once paired",Ne=GS(n.about),Ie=GS(Z),Ge=Z!=null&&Z.version&&U?yU(Z.version,U):null,Pe=F?Ub(F.last,s):null,ze=F&&((zt=F.last)!=null&&zt.error)?eU({error:F.last.error,host:F.addr,port:F.port},[...n.strangers??[],...n.pending??[],...(n.peers??[]).filter(Se=>!Se.manual&&Se.addr).map(Se=>({fp:Se.fp,name:Se.name,addr:Se.addr,port:Se.port,at:Se.lastSeen??0}))],s):null,Re=(Xt=F==null?void 0:F.last)!=null&&Xt.error&&Pe&&Pe.text!==F.last.error?F.last.error:null,st=((Ft=F==null?void 0:F.last)==null?void 0:Ft.done)??[],ue=!!Pe&&!!Re&&!e.quiet&&e.state.startsWith(Pe.text),ce=H||e.kind==="dialling",se=((F==null?void 0:F.via)??e.via)==="tailscale",be=F?F.waiting?null:F.manual?se?"added by its Tailscale address":"added by address":se?"over Tailscale":"on this network":e.kind==="nearby"?se?"heard over Tailscale":"heard on this network":se?"asked this deck to pair, over Tailscale":"asked this deck to pair",Le=e.tone==="bad"?"bad":H?e.here?"up":"down":"loose",de=l===`check:${e.fp}`,fe=(F==null?void 0:F.offers)??null,Ce=Le==="up"?(fe==null?void 0:fe.current)??null:null,pe=Ce&&"key"in Ce?Ce.key:null,_e=!!Ce&&"hidden"in Ce,Ye=!!Ce&&"other"in Ce,qe=H?vU((fe==null?void 0:fe.accounts)??null,r,n.shared??[],pe):[],ke=qe.filter(Se=>Se.in==null&&Se.out==="cut"),Ae=qe.some(Se=>Se.in!=null),Ue=qe.some(Se=>Se.out!=null),Fe=new Map(st.map(Se=>[Se.email,Se])),Ve=st.filter(Se=>!qe.some(vt=>vt.email===Se.email)),rt=H?fe?fe.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:F!=null&&F.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.":(rn=F==null?void 0:F.last)!=null&&rn.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,ut=fe&&(F!=null&&F.last)&&F.last.at-fe.at>zz?qs(fe.at,s):null,ct=[];H&&(F!=null&&F.pairedAt)?ct.push({label:"Paired",value:Uz(F.pairedAt,s),tone:"meta"}):e.kind==="declined"&&L&&ct.push({label:"Paired",value:`no · you said no ${Hb(L.at,s)}`,tone:"meta"}),ct.push({label:"Fingerprint",value:re?o.jsxs("span",{className:"lan-fp",children:[o.jsx("code",{className:"ap-lan-code",children:re}),o.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void le(),"aria-label":B?"Fingerprint copied":"Copy the fingerprint",children:B?"copied":"copy"})]}):"not known — nothing has answered there",tone:re?void 0:"quiet"});const yt=y.length?[{row:e,peer:F??null},...y]:[];return On.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:o.jsxs("div",{ref:b,className:"modal lan-peer","data-tone":e.tone,onClick:Se=>Se.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[o.jsxs("header",{className:"modal-head lan-peer-head",children:[o.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),o.jsxs("div",{className:"lan-peer-id",children:[X?o.jsxs("form",{className:"lan-peer-edit",onSubmit:Se=>{Se.preventDefault(),ae(_??"")},children:[o.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),o.jsx("input",{ref:ee,className:"ap-manage-input lan-peer-input",value:_??"",maxLength:48,placeholder:D,"aria-label":"Name for this deck, shown on this deck only",onChange:Se=>k(Se.target.value)}),o.jsx("button",{type:"submit",className:"ap-manage-btn",...V(`alias:${e.fp}`),children:"save"}),o.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>k(null),children:"cancel"})]}):o.jsxs("span",{className:"lan-peer-title",children:[o.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),K&&o.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{E(null),k(e.name)},"aria-label":`Rename ${e.name} on this deck`,title:"Give it a name of your own. Only this deck sees it.",children:o.jsx(Hz,{})})]}),o.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&o.jsxs(o.Fragment,{children:["calls itself ",o.jsx("span",{className:"lan-peer-self",children:e.self}),X&&o.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...V(`alias:${e.fp}`),onClick:()=>void ae(""),children:"use this name"}),o.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&o.jsx("span",{"aria-hidden":!0,children:" · "})]}),o.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{ref:S,type:"button",className:"glyph-btn",onClick:c,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body lan-peer-body",children:[j&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",children:j}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>E(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),o.jsxs("div",{className:"lan-map","data-link":Le,"data-asking":de||void 0,"data-bus":qe.length>0||void 0,children:[o.jsxs("div",{className:"lan-ends",children:[o.jsxs("p",{className:"lan-end",children:[o.jsx("span",{className:"lan-end-name",children:"This deck"}),Ne&&o.jsx("span",{className:"lan-end-runs",children:Ne}),H&&n.shareActive===!1&&o.jsx("span",{className:"lan-end-note",children:"current account hidden"})]}),o.jsxs("p",{className:"lan-end","data-side":"there",children:[o.jsx("span",{className:"lan-end-name",children:e.name}),e.kind!=="dialling"&&o.jsxs("span",{className:"lan-end-runs",children:[Ie??(Z?"not said":ge),Ge?` · ${Ge<0?"older":"newer"}`:null]}),_e&&o.jsx("span",{className:"lan-end-note",children:"current account hidden"}),Ye&&o.jsx("span",{className:"lan-end-note",children:"on another account"})]})]}),o.jsxs("div",{className:"lan-link",children:[o.jsx(KS,{}),o.jsxs("span",{className:"lan-span",children:[o.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[o.jsx("i",{className:"lan-glint","data-dir":"out"}),o.jsx("i",{className:"lan-glint","data-dir":"in"})]}),o.jsx("span",{className:"lan-link-label",children:z?o.jsx("code",{className:"ap-lan-code",children:z}):"none here — it calls this deck"})]}),o.jsx(KS,{}),(z&&be||ce)&&o.jsxs("p",{className:"lan-link-sub",children:[z&&be,z&&be&&ce&&" · ",ce&&(Pe?ue?o.jsx("code",{className:"ap-lan-code",children:Re}):o.jsx("span",{className:"lan-round","data-tone":Pe.tone,children:Pe.text.replace(/ · now$/," · just now")}):"not asked yet"),ce&&Re&&!ue&&o.jsx("code",{className:"lan-fact-raw",children:Re})]}),Ve.length>0&&o.jsx("ul",{className:"lan-done",children:Ve.map(Se=>{const vt=z0(Se);return o.jsxs("li",{"data-ok":Se.ok&&!vt,children:[Se.email," ",o.jsxs("span",{className:"lan-done-what",children:[Se.ok?"arrived":"did not arrive",vt&&` — ${vt.long}`]})]},`${Se.email}:${Se.action}`)})}),ze&&o.jsx("p",{className:"lan-note lan-link-note",children:ze}),(F==null?void 0:F.waiting)&&o.jsx("p",{className:"lan-note lan-link-note",children:e.hint}),(Pe==null?void 0:Pe.hint)&&o.jsx("p",{className:"lan-note lan-link-note",children:Pe.hint})]}),qe.length>0&&o.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:qe.map((Se,vt)=>{const kt=Fe.get(Se.email),_n=kt?z0(kt):null,Ut=Se.out==="live"||Se.in!=null&&Se.in!=="cut";return o.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":Se.tone,"data-draw":Se.in&&Se.out?"both":Se.in?"in":"out","data-used-there":Se.usedThere||void 0,style:{"--i":vt},children:[o.jsx("i",{className:"lan-pip","data-end":"here","data-state":Se.here,"aria-hidden":!0}),o.jsxs("span",{className:"lan-track",children:[o.jsxs("span",{className:"lan-wire","data-flow":Ut?"live":"cut","aria-hidden":!0,children:[(Se.in==="live"||Se.in==="wait")&&o.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":Se.in}),Se.out==="live"&&o.jsx("i",{className:"lan-glint","data-dir":"out"})]}),Se.in&&Se.in!=="cut"&&o.jsx(Sh,{dir:"in",gate:Se.in==="blocked"}),Se.out==="live"&&o.jsx(Sh,{dir:"out"}),o.jsx("span",{className:"lan-lane-email",children:Se.email})]}),o.jsx("i",{className:"lan-pip","data-end":"there","data-state":Se.there,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:Gz(Se)}),(Se.caption||kt)&&o.jsxs("span",{className:"lan-lane-note",children:[Se.caption,Se.caption&&kt&&" · ",kt&&o.jsxs("span",{className:"lan-lane-done","data-ok":kt.ok&&!_n,children:[kt.ok?"arrived last round":"did not arrive last round",_n&&` — ${_n.long}`]})]})]},Se.key)})},W),H&&o.jsxs(o.Fragment,{children:[ke.length>0&&o.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",ke.length===1?ke[0].email:"the expired ones"," until you sign in again here."]}),rt&&o.jsx("p",{className:"lan-empty",children:rt}),ut&&o.jsxs("p",{className:"lan-stale",children:["As of ",ut==="now"?"just now":ut,", when it last answered."]}),o.jsxs("div",{className:"lan-legend",children:[Ae&&o.jsxs("span",{className:"lan-key",children:[o.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:o.jsx(Sh,{dir:"in"})}),"from ",e.name]}),Ue?o.jsxs("span",{className:"lan-key",children:[o.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:o.jsx(Sh,{dir:"out"})}),"from this deck, to every paired deck"]}):o.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),o.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:h,"aria-label":"Change what this deck offers",children:"change"})]})]})]}),o.jsx("dl",{className:"lan-facts",children:ct.map(Se=>o.jsxs("div",{className:"lan-fact","data-tone":Se.tone,children:[o.jsx("dt",{children:Se.label}),o.jsx("dd",{children:Se.value})]},Se.label))}),yt.length>1&&o.jsxs("div",{className:"modal-section",children:[o.jsxs("h3",{className:"lan-h",children:[yt.length," decks on this machine"]}),o.jsx("ul",{className:"lan-twins",role:"list",children:yt.map((Se,vt)=>{var $t,Zt,Ln,Ur;const kt=($t=Se.peer)!=null&&$t.addr?`${Se.peer.addr}:${Se.peer.port}`:Se.row.addr,_n=kt||Se.row.fp,Ut=(Zt=Se.peer)!=null&&Zt.pairedAt?qs(Se.peer.pairedAt,s):null,Vn=[(Ur=(Ln=Se.peer)==null?void 0:Ln.about)!=null&&Ur.version?`runs ${Se.peer.about.version}`:null,Ut?`paired ${Ut==="now"?"just now":Ut}`:null,Se.row.state].filter(Boolean).join(" · "),Vt=Se.row.fp;return o.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":Se.row.tone,children:[o.jsx("i",{className:Se.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),kt?o.jsx("code",{className:"ap-lan-code lan-twin-at",children:kt}):o.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),o.jsx("code",{className:"ap-lan-code lan-twin-fp",children:Vt}),vt>0&&v&&o.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${$===Vt?" armed":""}`,...V(`unpair:${Vt}`),onKeyDown:xe=>{xe.repeat&&xe.preventDefault()},onClick:()=>{const xe=Date.now(),ir=Au({armedFor:$,target:Vt,armedAt:I.current,now:xe,gapMs:Ou});if(ir==="arm"){q(Vt),I.current=xe;return}ir!=="ignore"&&(q(null),G(()=>v(Vt)))},"aria-label":$===Vt?`Confirm unpairing ${_n}`:`Unpair ${_n}`,title:$===Vt?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this one of the machine's decks",children:l===`unpair:${Vt}`?"unpairing…":$===Vt?"confirm":"unpair"}),o.jsx("span",{className:"lan-twin-meta",children:vt===0?`${Vn} · shown above`:Vn})]},Vt)})})]})]}),o.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&o.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),H&&!(F!=null&&F.waiting)&&o.jsx("button",{type:"button",className:"btn",...V(`check:${e.fp}`),onClick:()=>void G(f).then(Se=>{Se&&M.current&&ne(vt=>vt+1)}),title:"Ask this deck now instead of waiting for the next round",children:l===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&o.jsx("button",{type:"button",className:`btn danger lan-peer-verb${C?" armed":""}`,...V(`unpair:${e.fp}`),onKeyDown:Se=>{Se.repeat&&Se.preventDefault()},onClick:()=>{const Se=Date.now(),vt=Au({armedFor:C?e.fp:null,target:e.fp,armedAt:I.current,now:Se,gapMs:Ou});if(vt==="arm"){R(!0),I.current=Se;return}vt!=="ignore"&&(R(!1),G(p))},"aria-label":C?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:C?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:l===`unpair:${e.fp}`?"Unpairing…":C?"Confirm unpair":"Unpair"}),e.kind==="nearby"&&n.pairingMode!=="invite"&&o.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...V(`accept:${e.fp}`),onClick:()=>void G(p),title:"Send it a request. Somebody at that machine has to accept it before anything is shared.",children:l===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&o.jsx("button",{type:"button",className:"btn lan-peer-verb",...V(`drop:${e.fp}`),onClick:()=>void G(p),title:"Stop trying this address. Nothing was ever paired here.",children:l===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&n.pairingMode!=="invite"&&o.jsx("button",{type:"button",className:"btn lan-peer-verb",...V(`allow:${e.fp}`),onClick:()=>void G(p),title:"Take the no back. That deck is still trying, so its request comes round again on its own.",children:l===`allow:${e.fp}`?"Allowing…":"Let it ask again"}),(e.kind==="nearby"||e.kind==="declined")&&n.pairingMode==="invite"&&m&&o.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"})]})]})}),document.body)}function Yz(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 jh="Paused while this deck pairs only by invite. Turn that off above to use it.";function Xz({status:e,accounts:t,onClose:n,onChanged:r}){const s=mn(n),[l,c]=w.useState(null),[u,f]=w.useState(null),[p,h]=w.useState(!1),[m,y]=w.useState(null),v=w.useRef(null),S=M=>{const X=lo(m,M);return{disabled:X.disabled,"aria-busy":X.busy}},b=w.useRef(null),_=w.useRef(!0);w.useEffect(()=>()=>{_.current=!1},[]),w.useEffect(()=>{b.current=ZS(b.current,e.shared??[],null)},[e.shared]);const k=w.useCallback(async(M,X,V="write")=>{v.current=V,y(V);try{const F=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:M})})).json().catch(()=>null);return _.current?(F!=null&&F.ok?f(null):f(dn(X,F)),r(),(F==null?void 0:F.ok)===!0):!1}catch{return _.current&&f(dn(X,null)),!1}finally{v.current=null,_.current&&y(null)}},[r]),j=w.useCallback(async()=>{if(l!=null&&l!==(e.name??"")){if(!await k({name:l},"save the name","name"))return;_.current&&c(null)}n()},[l,e.name,k,n]),E=async()=>{if(!e.fp)return;const M=await yi(e.fp);if(_.current){if(!M){f("Could not copy it — select the fingerprint and copy it by hand.");return}h(!0),window.setTimeout(()=>{_.current&&h(!1)},1600)}},C=new Set(b.current??e.shared??[]),R=e.autoAsk!==!1,I=e.autoAccept!==!1,$=e.pairingMode==="invite",q=M=>{const X=S(M);return{...X,disabled:X.disabled||$}},B=e.shareActive!==!1,P=e.tailscale??null,W=!!(P!=null&&P.on),ne=(P==null?void 0:P.ask)!==!1,ee=(P==null?void 0:P.accept)!==!1;return On.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:s,className:"modal lan-modal",onClick:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[u&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",children:u}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"Name"}),o.jsxs("div",{className:"ap-lan-row",children:[o.jsx("span",{className:"ap-lan-label",children:"appear as"}),o.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:l??e.name??"",placeholder:"this machine",onChange:M=>c(M.target.value),onKeyDown:M=>{M.key!=="Enter"||l==null||(k({name:l},"save the name","name"),c(null))}}),l!=null&&l!==(e.name??"")&&o.jsx("button",{type:"button",className:"ap-manage-btn",...S("name"),onClick:()=>{k({name:l},"save the name","name"),c(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),o.jsxs("div",{className:"ap-lan-row",children:[o.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?o.jsxs("span",{className:"lan-fp",children:[o.jsx("code",{className:"ap-lan-code",children:e.fp}),o.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void E(),"aria-label":p?"Fingerprint copied":"Copy this deck's fingerprint",children:p?"copied":"copy"})]}):o.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"Share these accounts"}),o.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&o.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=>o.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:[o.jsx("input",{type:"checkbox",checked:C.has(M.key),onChange:X=>{const V=iU(b.current,e.shared??[],M.key,X.target.checked);b.current=V,k({shared:V},X.target.checked?"share that account":"stop sharing that account").then(G=>{b.current===V&&(b.current=ZS(V,e.shared??[],{ok:G}))})}}),o.jsx("span",{className:"ap-lan-pick-name",children:M.email}),!M.alive&&o.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},M.key))]}),t.length>0&&o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Show paired decks which of these this deck is using"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":B,"aria-label":"Show paired decks which of these this deck is using",...S("current"),onClick:()=>void k({shareActive:!B},B?"stop showing which account this deck is using":"show which account this deck is using","current"),title:B?"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:o.jsx("span",{className:"switch-knob"})})]})]}),o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",id:"lan-pairing-h",children:"Pairing"}),o.jsx("div",{className:"lan-switches lan-switches-lead",role:"group","aria-labelledby":"lan-pairing-h",children:o.jsxs("div",{className:"lan-switch",children:[o.jsxs("span",{className:"lan-switch-what",children:["Pair new decks only by invite",$&&o.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."})]}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":$,"aria-label":"Pair new decks only by invite","aria-describedby":$?"lan-invite-only-detail":void 0,...S("mode"),onKeyDown:M=>{M.repeat&&M.preventDefault()},onClick:()=>void k({pairingMode:$?"automatic":"invite"},$?"let decks pair on their own again":"pair new decks only by invite","mode"),title:$?"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:o.jsx("span",{className:"switch-knob"})})]})}),o.jsxs("div",{className:"lan-auto",role:"group","aria-labelledby":"lan-auto-h",children:[o.jsxs("p",{className:"lan-sub",id:"lan-auto-h",children:["Automatic pairing",$&&o.jsx("span",{className:"lan-sub-state",children:" · paused while pairing is invite-only"})]}),o.jsxs("div",{className:"lan-switches","data-paused":$||void 0,children:[o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":R,"aria-label":"Ask every deck this one finds",...q("ask"),onClick:()=>void k({autoAsk:!R},R?"stop asking automatically":"ask every deck this one finds","ask"),title:$?jh:R?"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:o.jsx("span",{className:"switch-knob"})})]}),o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":I,"aria-label":"Say yes to every deck that asks","data-tone":"warn",...q("accept"),onKeyDown:M=>{M.repeat&&M.preventDefault()},onClick:()=>void k({autoAccept:!I},I?"stop accepting automatically":"accept every deck that asks","accept"),title:$?jh:I?"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:o.jsx("span",{className:"switch-knob"})})]})]})]})]}),(P==null?void 0:P.found)&&o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"Tailscale"}),o.jsxs("div",{className:"lan-switches",children:[o.jsxs("div",{className:"lan-switch",children:[o.jsxs("span",{className:"lan-switch-what",children:["Look for my devices",o.jsx("span",{id:"lan-ts-detail",className:"lan-switch-detail",children:Yz(P)})]}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":W,"aria-label":"Look for my devices over Tailscale","aria-describedby":"lan-ts-detail",...S("tailscale"),onClick:()=>void k({tailscale:!W},W?"stop looking over Tailscale":"look for your devices over Tailscale","tailscale"),title:W?"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:o.jsx("span",{className:"switch-knob"})})]}),W&&o.jsxs("div",{className:"lan-auto",role:"group","aria-labelledby":"lan-ts-auto-h",children:[o.jsxs("p",{className:"lan-sub",id:"lan-ts-auto-h",children:["Automatic pairing with my devices",$&&o.jsx("span",{className:"lan-sub-state",children:" · paused while pairing is invite-only"})]}),o.jsxs("div",{className:"lan-switches",children:[o.jsxs("div",{className:"lan-switch","data-paused":$||void 0,children:[o.jsx("span",{className:"lan-switch-what",children:"Ask each device it finds"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":ne,"aria-label":"Ask each of my devices it finds over Tailscale",...q("tailscale-ask"),onClick:()=>void k({tailscaleAsk:!ne},ne?"stop asking your devices automatically":"ask your devices automatically","tailscale-ask"),title:$?jh:ne?"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:o.jsx("span",{className:"switch-knob"})})]}),o.jsxs("div",{className:"lan-switch","data-paused":$||void 0,children:[o.jsx("span",{className:"lan-switch-what",children:"Say yes to each device that asks"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":ee,"aria-label":"Say yes to my devices when they ask over Tailscale","data-tone":"warn",...q("tailscale-accept"),onKeyDown:M=>{M.repeat&&M.preventDefault()},onClick:()=>void k({tailscaleAccept:!ee},ee?"stop accepting your devices automatically":"accept your devices automatically","tailscale-accept"),title:$?jh:ee?"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:o.jsx("span",{className:"switch-knob"})})]})]})]})]})]})]}),o.jsxs("footer",{className:"lan-setup-foot",children:[o.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),o.jsx("button",{type:"button",className:"btn primary",...S("name"),onClick:()=>void j(),children:"Done"})]})]})}),document.body)}function qs(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 YS={keychain_unavailable:{short:"Keychain locked on the other Mac",long:`the other Mac could not export it. On that Mac: ${Fb}. The next round brings it.`}};function z0(e){return e.why?Object.hasOwn(YS,e.why)?YS[e.why]:sf(e.why):null}const zb={"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"}},Zz={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 XS(e){var r;const t=Qz[e];if(t)return t;const n=(r=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:r[1];return n&&Zz[n]||e}const Qz={"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 Ub(e,t){var h;if(!e)return null;if(e.error&&((h=e.done)!=null&&h.length)){const m=Ub({...e,error:void 0},t),y=` · ${qs(e.at,t)}`;return{...m,text:`${m.text.slice(0,-y.length)}, then ${XS(e.error)}${y}`,tone:"bad"}}if(e.error)return zb[e.error]??{text:XS(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${qs(e.at,t)}`,tone:"idle"};const r=n.filter(m=>m.ok),s=r.length===1?"login":"logins",l=n.map(m=>({d:m,why:z0(m)})).filter(m=>m.why),c=[...new Set(l.map(m=>m.why.short))],u=c.length?`, ${c.join(", ")}`:"",f=l.length?l.map(m=>`${m.d.email}: ${m.why.long}`).join(" "):void 0,p=qs(e.at,t);return r.length===n.length?{text:`${r.length} ${s} arrived${u} · ${p}`,tone:l.length?"warn":"ok",...f?{hint:f}:{}}:{text:`${r.length} of ${n.length} logins arrived${u} · ${p}`,tone:"bad",...f?{hint:f}:{}}}const Jz=9e4;function eU({error:e,host:t,port:n},r,s,l=45317){if(e!=="handshake timed out")return null;const c=(t??"").trim();if(!c)return null;const u=r.filter(p=>p.addr===c&&p.port&&p.at>0&&s-p.at<Jz);if(!u.length)return null;const f=[...new Set(u.map(p=>p.port))];if(n!=null&&!f.includes(n)){const p=f.length===1?`port ${f[0]}`:`ports ${f.join(" and ")}`;return`A deck at ${c} is announcing itself on ${p}, not on ${n}. This deck already hears it and dials it there, so this typed row has nothing to reach.`}return`That machine is running the deck — its beacon arrives here every half minute — and what this deck sends back never gets there. That is a firewall on ${c}, not a network fault. Whoever uses it can allow two ports: UDP ${l} and TCP ${n??f[0]}.`}const U0=5e3,KM=6e4,Ou=400;function tU(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 dn(e,t){if(t==null)return`Could not ${e} — the deck did not answer.`;const n=t.reason?sU(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 nU={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."},rU=new Set(["EACCES","EPERM"]);function sU(e,t){const n=nU[e];if(!n)return;const r=e==="prefs_unreadable"&&t?aU(t):void 0,s=t!=null&&t.code&&t.code!=="BADJSON"?` Error code: ${t.code}.`:"";return(r??n)+s}function aU({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&&!rU.has(e))return"this deck cannot read its settings file, so it will not write over it. The deck's log names the file."}function oU(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function iU(e,t,n,r){const s=new Set(e??t);return r?s.add(n):s.delete(n),[...s]}function ZS(e,t,n){return e==null||n!=null&&!n.ok||oU(e,t)?null:e}function lU(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function YM(e,t){var n,r;return(n=e.last)!=null&&n.error&&!zb[e.last.error]?!1:!!((r=e.last)!=null&&r.at&&t-e.last.at<of||e.lastSeen!=null&&t-e.lastSeen<of)}const of=95e3,XM=160,cU=6,ZM=140;function uU(e,t){const n=[],r=[];for(const s of e??[])(YM(s,t)?n:r).push(s);return{online:n,offline:r}}function dU(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 hU(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(v=>v.paired!==!1||v.met);if(!r.length)return{text:"no deck paired yet",tone:"idle"};const s=r.filter(v=>v.waiting),l=r.filter(v=>!v.waiting),c=s.filter(v=>{var S;return!((S=v.last)!=null&&S.error)&&v.lastSeen!=null&&t-v.lastSeen<of}),{online:u,offline:f}=uU(l,t),p=[...f,...s.filter(v=>!c.includes(v))],h=u.length+c.length,m=u.filter(v=>{var S;return((S=v.last)==null?void 0:S.error)==="waiting for the other deck to accept this one"});if(h&&m.length===h)return{text:h===1?"1 deck found · waiting for them to accept":`${h} decks found · waiting for them to accept`,tone:"wait"};if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const y=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function fU(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const r=qs(e,t);return r==="now"?"checked just now":`checked ${r}`}function Hb(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 pU(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<of;return{text:n?"online · one-way, it calls in":`one-way · last online ${qs(e,t)}`,here:n}}function QS(e,t,n){return t?"online":e.lastSeen!=null?`last online ${qs(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function mU(e,t){var y,v,S,b,_;if(!e)return[];const n=[],r=new Set,s=(k,j)=>k.name.localeCompare(j.name,void 0,{numeric:!0}),l=e.aliases??{},c=(k,j)=>{const E=k?l[k]:void 0;return E&&E!==j?{name:E,self:j}:{name:j}};for(const k of e.pending??[]){if(!(k!=null&&k.fp)||r.has(k.fp))continue;r.add(k.fp);const j=c(k.fp,k.name||k.fp);n.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.addr??"",kind:"asks",state:`wants to pair · ${Hb(k.at,t)}`,tone:"wait",here:!0,hint:`${j.name} at ${k.addr}${k.via==="tailscale"?", over Tailscale,":""} is waiting for an answer.`,...k.via==="tailscale"?{via:"tailscale"}:{}})}const u=[],f=[];for(const k of e.peers??[]){const j=k.peerFp??k.fp;if(!j||r.has(j))continue;r.add(j);const E=Ub(k.last,t),C=YM(k,t),R=k.addr?`${k.addr}:${k.port}`:"";if(!k.paired&&k.manual&&!k.met){f.push({fp:R,name:R||k.name||j,addr:k.addr??"",kind:"dialling",state:E?E.text.replace(/ · .*$/,""):"trying…",tone:E?E.tone:"idle",here:!1,hint:(y=k.last)!=null&&y.error?`Nothing has answered at ${R} yet — ${k.last.error}.`:`Dialling ${R} until something answers.`,...k.via==="tailscale"?{via:"tailscale"}:{}});continue}const I=k.waiting?pU(k.lastSeen,t):null,$=I?I.here:C,q=!I&&E?$?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${QS(k,$,t)}`:I?I.text:QS(k,$,t),B=(v=k.last)!=null&&v.error?zb[k.last.error]:null,P=!I&&$&&!((S=k.last)!=null&&S.error)&&!(((b=k.last)==null?void 0:b.done)??[]).length,W=k.manual&&!k.met?{name:R}:c(j,k.name||j);u.push({fp:j,name:W.name,...W.self?{self:W.self}:{},addr:k.addr??"",kind:"paired",state:q,quiet:P,tone:B?B.tone==="bad"?"bad":"wait":E?E.tone:$?"ok":"idle",here:I?I.here:C,...k.via==="tailscale"?{via:"tailscale"}:{},hint:I?`${W.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. ${k.lastSeen==null?"It has not called since this deck started.":`It last called ${qs(k.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${W.name}${R?` at ${R}`:""}${(_=k.last)!=null&&_.error?` — ${k.last.error}`:""}${E!=null&&E.hint?` — ${E.hint}`:""}`})}n.push(...gU(u).sort(s),...f.sort(s));const p=[];for(const k of e.strangers??[]){if(!(k!=null&&k.fp)||r.has(k.fp))continue;r.add(k.fp);const j=c(k.fp,k.name||k.fp);p.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.addr??"",kind:"nearby",state:e.pairingMode==="invite"?"needs an invite":"not paired yet",tone:"idle",here:!0,hint:k.via==="tailscale"?`${j.name} at ${k.addr} is on your tailnet and nothing is shared with it.`:`${j.name} at ${k.addr} is on this network and nothing is shared with it.`,...k.via==="tailscale"?{via:"tailscale"}:{}})}n.push(...p.sort(s));const h=[];for(const k of e.declined??[]){if(!(k!=null&&k.fp)||r.has(k.fp))continue;r.add(k.fp);const j=c(k.fp,k.name||k.fp);h.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${j.name} asked and was turned away. It is not asking any more.`})}n.push(...h.sort(s));const m=new Map;for(const k of n)m.set(k.name,(m.get(k.name)??0)+1);for(const k of n)(m.get(k.name)??0)<2||!k.addr||(k.state=k.quiet||!k.state?k.addr:`${k.addr} · ${k.state}`,k.quiet=!1);return n}function gU(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(l=>l.addr).map(l=>l.addr))];if(s.length>1){for(const l of s)n.push(JS(r.filter(c=>c.addr===l)));n.push(...r.filter(l=>!l.addr))}else n.push(JS(r))}return n}function JS(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 ej(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function tj(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 yU(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 l=Number(n[s])-Number(r[s]);if(l)return Math.sign(l)}return 0}function wU(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 vU(e,t,n,r=null){var f;const s=new Map;for(const p of t)(f=s.get(p.key))!=null&&f.alive||s.set(p.key,p);const l=new Set(n),c=[],u=new Set;for(const p of e??[]){if(u.has(p.key))continue;u.add(p.key);const h=s.get(p.key)??null,m=l.has(p.key),y=wU(p,h,m),v=h?h.alive?h.shareable===!1?"unavailable":"works":"expired":"missing",S=!p.alive&&h&&!h.alive?y.note:[v==="works"?null:y.here,p.alive&&p.shareable!==!1?null:y.there,y.note].filter(Boolean).join(" · ")||null;c.push({key:p.key,email:p.email,here:v,there:p.alive?p.shareable===!1?"unavailable":"works":"broken",in:!p.alive||p.shareable===!1?"cut":y.tone==="wait"?"wait":y.tone==="bad"?"blocked":"live",out:m&&h?h.alive&&h.shareable!==!1?"live":"cut":null,caption:S,tone:y.tone,usedThere:r===p.key})}for(const p of n){const h=s.get(p);!h||u.has(p)||(u.add(p),c.push({key:p,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 c}async function Cl(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function xU({anchorId:e,id:t,rows:n,onHold:r,onLet:s}){const l=w.useRef(null),c=n.filter(y=>y.kind==="paired"),u=c.filter(y=>y.here),f=u.slice(0,cU),p=c.length-u.length,h=u.length>f.length?`and ${u.length-f.length} more`:p>0?`${p} not on right now`:null,m=w.useCallback(()=>{const y=l.current,v=document.getElementById(e);if(!y||!v)return;const S=Pb(v.getBoundingClientRect(),{width:y.offsetWidth,height:y.offsetHeight},{width:window.innerWidth,height:window.innerHeight});y.style.top=`${S.top}px`,y.style.left=`${S.left}px`,y.style.maxHeight=S.maxHeight==null?"":`${S.maxHeight}px`,y.dataset.side=S.side},[e]);return w.useLayoutEffect(()=>{m()}),w.useEffect(()=>(window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}),[m]),On.createPortal(o.jsxs("div",{ref:l,id:t,className:"ap-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:s,children:[o.jsx("p",{className:"ap-peek-title",children:u.length?"On the network now":"Nobody on the network"}),f.length>0&&o.jsx("div",{className:"ap-peek-list",children:f.map(y=>o.jsxs("span",{className:"ap-peek-who",children:[o.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),o.jsxs("span",{children:[y.name,y.via==="tailscale"&&o.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]})]},`${y.kind}:${y.fp}`))}),h&&o.jsx("p",{className:"ap-peek-rest",children:h})]}),document.body)}function bU(e,t){var l;if(!e)return{text:"checking…",tone:"idle",live:!1};if(!e.enabled)return{text:"Off",tone:"idle",live:!1};if(e.stalled)return{text:"could not start",tone:"bad",live:!1};if(!e.running)return{text:"starting…",tone:"wait",live:!1};const n=t.filter(c=>c.kind==="asks").length;if(n)return{text:n===1?"1 deck wants to pair":`${n} decks want to pair`,tone:"wait",live:!1};if((l=e.reach)!=null&&l.blocked)return{text:"nothing can get in",tone:"bad",live:!1};const r=t.filter(c=>c.kind==="paired");if(!r.length)return{text:"On · none paired yet",tone:"idle",live:!1};const s=r.filter(c=>c.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 kU({accounts:e,onChanged:t,view:n,onOpen:r,onBack:s,closeButton:l}){const[c,u]=w.useState(null),[f,p]=w.useState([]),[h,m]=w.useState(null),[y,v]=w.useState(!1),[S,b]=w.useState(null),_=w.useRef(0),[k,j]=w.useState(!1),[E,C]=w.useState(!1),[R,I]=w.useState(!1),$=w.useRef(0);w.useEffect(()=>()=>window.clearTimeout($.current),[]);const[q,B]=w.useState(!1),[P,W]=w.useState(null),ne=w.useRef(null),ee=w.useCallback(de=>Mf(ne.current)?(ne.current=de,m(de),!0):!1,[]),M=w.useCallback(()=>{ne.current=null,F.current&&m(null)},[]),X=de=>{const fe=lo(h,de);return{disabled:fe.disabled,"aria-busy":fe.busy}},[V,G]=w.useState(()=>Date.now()),F=w.useRef(!0),L=w.useRef(U0),H=w.useCallback(async()=>{var de,fe;try{const[Ce,pe]=await Promise.all([fetch("/api/lan").then(_e=>_e.json()),fetch("/api/prefs").then(_e=>_e.json())]);if(!F.current)return;Ce!=null&&Ce.ok&&u(Ce),pe!=null&&pe.ok&&p(Array.isArray((fe=(de=pe.prefs)==null?void 0:de.lan)==null?void 0:fe.manual)?pe.prefs.lan.manual:[]),L.current=(Ce==null?void 0:Ce.enabled)===!0?U0:KM}catch{}},[]);w.useEffect(()=>{F.current=!0;let de=0;const fe=async()=>{G(Date.now()),await H(),F.current&&(de=window.setTimeout(fe,L.current))};return fe(),()=>{F.current=!1,window.clearTimeout(de)}},[H]);const D=w.useCallback(async()=>{const de=(c==null?void 0:c.enabled)===!0;if(ee("switch"))try{const fe=await Cl("/api/prefs",{lan:{enabled:!de}});if(!F.current)return;fe!=null&&fe.ok?(W(null),de||v(!0)):W(dn(de?"turn this off":"turn this on",fe)),await H()}catch{F.current&&W(dn(de?"turn this off":"turn this on",null))}finally{M()}},[c==null?void 0:c.enabled,H,ee,M]),K=w.useCallback(async(de,fe,Ce)=>{if(!ee(`${de}:${fe}`))return null;let pe=null;try{const _e=await Cl("/api/lan/peer",{action:de,fp:fe});if(!F.current)return null;_e!=null&&_e.ok?(u(_e),W(null)):(pe=dn(Ce,_e),W(pe)),await H()}catch{pe=dn(Ce,null),F.current&&W(pe)}finally{M()}return pe},[H,ee,M]),re=w.useCallback(async de=>{if(!ee(`drop:${de}`))return null;let fe=null;try{const Ce=await Cl("/api/prefs",{lan:{manual:f.filter(pe=>pe!==de)}});if(!F.current)return null;Ce!=null&&Ce.ok?(W(null),t()):(fe=dn("stop dialling that address",Ce),W(fe)),await H()}catch{fe=dn("stop dialling that address",null),F.current&&W(fe)}finally{M()}return fe},[f,H,t,ee,M]),[z,Z]=w.useState(null),U=w.useCallback(async(de,fe)=>{if(!ee(`alias:${de}`))return"Something else is still being saved. Try again in a moment.";try{const Ce=await Cl("/api/lan/peer",{action:"alias",fp:de,name:fe});return F.current?Ce!=null&&Ce.ok?(u(Ce),null):dn("rename that deck",Ce):null}catch{return dn("rename that deck",null)}finally{M()}},[ee,M]),ae=w.useCallback(async de=>{if(!ee(`check:${de}`))return null;try{const fe=await Cl("/api/lan/sync",{fp:de});return F.current?fe!=null&&fe.ok?(u(fe),t(),null):(fe==null?void 0:fe.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.":dn("check that deck",fe):null}catch{return dn("check that deck",null)}finally{M()}},[ee,M,t]),le=w.useCallback(async()=>{if(ee("check"))try{const de=await Cl("/api/lan/sync",{});if(!F.current)return;de!=null&&de.ok?(u(de),W(null)):W(dn("check the other decks",de)),t()}catch{F.current&&W(dn("check the other decks",null))}finally{M()}},[ee,M,t]),ge=(c==null?void 0:c.enabled)===!0,Ne=mU((c==null?void 0:c.pairingMode)==="invite"&&c?{...c,pending:[]}:c,V),Ie=z?Ne.find(de=>{var fe;return de.fp===z||((fe=de.twins)==null?void 0:fe.some(Ce=>Ce.fp===z))})??null:null;w.useEffect(()=>{z&&c&&!Ie&&Z(null)},[z,c,Ie]);const Ge=Ne.filter(de=>de.kind==="asks"),Pe=Ne.filter(de=>de.kind!=="asks"),ze=Pe.filter(de=>de.here),Re=Pe.filter(de=>!de.here),st=Re.filter(de=>de.tone==="bad").length,ue=q||ze.length===0,ce=hU(c,V),se=Pe.filter(de=>de.kind==="paired").length,be=bU(c,Ne),Le=o.jsxs(o.Fragment,{children:[k&&c&&o.jsx(qz,{status:c,manual:f,startWith:k==="invite"?"invite":void 0,onClose:()=>j(!1),onChanged:()=>{H(),t()}}),E&&o.jsx(WM,{title:"How Local network works",steps:$z,finish:ge?void 0:{label:"Turn it on",act:()=>{C(!1),D()}},onClose:()=>C(!1)}),y&&c&&o.jsx(Xz,{status:{...c,manualRows:f},accounts:e,manual:f,onClose:()=>v(!1),onChanged:()=>{H(),t()}}),Ie&&c&&o.jsx(Kz,{row:Ie,source:tj(c,Ie),status:c,accounts:e,now:V,busy:h,onClose:()=>Z(null),onRename:de=>U(Ie.fp,de),onCheck:()=>ae(Ie.fp),onVerb:()=>{switch(Ie.kind){case"paired":return K("unpair",Ie.fp,"unpair that deck");case"nearby":return K("accept",Ie.fp,"reach that deck");case"declined":return K("allow",Ie.fp,"let that deck ask again");case"dialling":return re(Ie.fp);default:return Promise.resolve(null)}},onSettings:()=>{Z(null),v(!0)},onInvite:()=>{Z(null),j("invite")},twins:(Ie.twins??[]).map(de=>({row:de,peer:tj(c,de).peer??null})),onUnpair:de=>K("unpair",de,"unpair that deck")})]});if(!n){const de=_e=>{window.clearTimeout($.current),$.current=window.setTimeout(()=>I(!0),_e)},fe=()=>{window.clearTimeout($.current),$.current=window.setTimeout(()=>I(!1),ZM)},Ce=()=>window.clearTimeout($.current),pe=()=>{window.clearTimeout($.current),I(!1)};return o.jsxs("div",{className:"ap-foot",children:[o.jsxs("button",{type:"button",id:"ap-lan-entry",className:"ap-nav",onClick:()=>{pe(),r()},"aria-describedby":R?"ap-lan-peek":void 0,onPointerEnter:_e=>{_e.pointerType==="mouse"&&de(XM)},onPointerLeave:fe,onFocus:_e=>{_e.target.matches(":focus-visible")&&de(0)},onBlur:fe,children:[o.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:[o.jsx("rect",{x:"1.8",y:"2.3",width:"10.4",height:"7.2",rx:"1.2"}),o.jsx("path",{d:"M5 11.9h4M7 9.5v2.4"})]}),o.jsxs("span",{className:"ap-nav-text",children:[o.jsx("span",{className:"ap-nav-name",children:"Local network"}),o.jsxs("span",{className:"ap-nav-state","data-tone":be.tone,children:[be.live&&o.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),be.text]})]}),o.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:o.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),R&&o.jsx(xU,{anchorId:"ap-lan-entry",id:"ap-lan-peek",rows:Ne,onHold:Ce,onLet:fe}),o.jsx("p",{className:"vis-hidden",role:"status",children:ce.tone==="ok"?"":ce.text}),Le]})}return o.jsxs("div",{className:"ap-lan-view",children:[o.jsxs("div",{className:"ap-header",children:[o.jsx("button",{type:"button",id:"ap-lan-back",className:"glyph-btn ap-back",onClick:s,"aria-label":"Back to Claude accounts",title:"Back to Claude accounts",children:o.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:o.jsx("path",{d:"M8.4 3.4 4.8 7l3.6 3.6"})})}),o.jsx("h2",{id:"ap-lan-title",children:"Local network"}),o.jsxs("div",{className:"ap-header-right",children:[ge&&o.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>j("add"),"aria-label":"Add a deck",title:(c==null?void 0:c.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:o.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:[o.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"}),o.jsx("path",{d:"M7.9 6.1a2.6 2.6 0 0 0-3.7 0L2.3 8a2.6 2.6 0 0 0 3.7 3.7l.9-.9"})]})}),ge&&se>0&&o.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...X("check"),onClick:()=>void le(),"aria-label":h==="check"?"Checking every paired deck":"Check every paired deck now",title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next round",children:o.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:[o.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),o.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"}),o.jsx("path",{d:"M2.6 2.6a6.2 6.2 0 0 0 0 8.8M11.4 2.6a6.2 6.2 0 0 1 0 8.8"})]})}),ge&&o.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...X("setup"),onClick:()=>v(!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:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),o.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),o.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),l]})]}),o.jsx("div",{className:"ap-scroll",id:"ap-lan-scroll",children:o.jsxs("div",{className:"ap-lan",children:[o.jsxs("div",{className:"ap-policy",children:[o.jsx("h3",{className:"ap-auto-title",children:"Sync with paired decks"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":ge,"aria-label":"Sync with paired decks",...X("switch"),onClick:()=>void D(),title:ge?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins",children:o.jsx("span",{className:"switch-knob"})})]}),ge&&o.jsx(GM,{reach:c==null?void 0:c.reach,where:"panel"}),ge&&(c==null?void 0:c.deaf)&&o.jsx("p",{className:"ap-lan-fine",children:c.deaf}),ge&&(c==null?void 0:c.lanTunneled)&&o.jsx("p",{className:"ap-lan-fine",children:dU(c)}),!ge&&o.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>C(!0),title:"Four pictures: what this does, and what to do on each machine",children:[o.jsx(Oz,{}),o.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),o.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),o.jsx("p",{className:`ap-lan-status ${ce.tone}`,role:"status",children:ce.tone==="ok"?"":ce.text}),P&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",children:P}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>W(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),ge&&o.jsxs(o.Fragment,{children:[Ge.length>0&&o.jsx("div",{className:"ap-lan-asks",role:"alert",children:Ge.map(de=>o.jsxs("div",{className:"ap-lan-ask",children:[o.jsxs("span",{className:"ap-lan-ask-what",children:[o.jsx("strong",{className:"ap-lan-peer-name",children:de.name})," at ",o.jsx("code",{className:"ap-lan-code",children:de.addr})," wants to pair"]}),o.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",o.jsx("code",{className:"ap-lan-code",children:de.fp})]}),o.jsxs("span",{className:"ap-lan-ask-acts",children:[o.jsx("button",{type:"button",className:"ap-manage-btn",...X(`accept:${de.fp}`),onClick:()=>void K("accept",de.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${de.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),o.jsx("button",{type:"button",className:"ap-manage-btn",...X(`dismiss:${de.fp}`),onClick:()=>void K("dismiss",de.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},de.fp))}),(ue?[...ze,...Re]:ze).length>0&&o.jsx("ul",{className:"ap-lan-here",children:(ue?[...ze,...Re]:ze).map((de,fe)=>o.jsxs("li",{className:"ap-lan-who","data-tone":de.tone,children:[o.jsx("i",{className:de.here?"ap-pulse":"ap-dot","aria-hidden":!0}),o.jsxs("span",{className:"ap-lan-who-name","aria-hidden":!0,children:[de.name,de.via==="tailscale"&&o.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]}),o.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${fe}`,onClick:()=>Z(de.fp),children:o.jsxs("span",{className:"vis-hidden",children:[de.name,de.via==="tailscale"?", over Tailscale":"",", details"]})}),o.jsx("span",{id:`lan-who-state-${fe}`,className:de.quiet?"vis-hidden":"ap-lan-who-when",children:de.state}),de.kind==="nearby"&&(c==null?void 0:c.pairingMode)!=="invite"&&o.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`accept:${de.fp}`),onClick:()=>void K("accept",de.fp,"reach that deck"),"aria-label":`Ask ${de.name} to pair`,title:`Send ${de.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${de.fp}.`,children:"ask"}),(de.kind==="nearby"||de.kind==="declined")&&(c==null?void 0:c.pairingMode)==="invite"&&o.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do","aria-haspopup":"dialog",onClick:()=>j("invite"),"aria-label":`Invite ${de.name} to pair`,title:`This deck pairs only by invite. Make one and send it to whoever is at ${de.name}.`,children:"invite"}),de.kind==="paired"&&o.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${S===de.fp?" armed":""}`,...X(`unpair:${de.fp}`),onClick:()=>{const Ce=Date.now(),pe=Au({armedFor:S,target:de.fp,armedAt:_.current,now:Ce,gapMs:Ou});if(pe==="arm"){b(de.fp),_.current=Ce,window.setTimeout(()=>b(_e=>_e===de.fp?null:_e),4e3);return}pe!=="ignore"&&(b(null),K("unpair",de.fp,"unpair that deck"))},"aria-label":S===de.fp?`Confirm unpairing ${de.name}`:`Unpair ${de.name}`,title:S===de.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:S===de.fp?"confirm":"unpair"}),de.kind==="dialling"&&o.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`drop:${de.fp}`),onClick:()=>void re(de.fp),"aria-label":`Stop dialling ${de.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),de.kind==="declined"&&(c==null?void 0:c.pairingMode)!=="invite"&&o.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`allow:${de.fp}`),onClick:()=>void K("allow",de.fp,"let that deck ask again"),"aria-label":`Let ${de.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${de.kind}:${de.fp}`))}),(ze.length>0&&Re.length>0||ge&&se>0)&&o.jsxs("div",{className:"ap-lan-tail",children:[ze.length>0&&Re.length>0&&o.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":q,onClick:()=>B(de=>!de),title:q?"Show only the decks that are on":`Show the ${Re.length} deck${Re.length===1?"":"s"} that are not responding right now`,children:[o.jsx("span",{className:`ap-lan-chev${q?" open":""}`,"aria-hidden":!0,children:"›"}),q?"fewer":`${Re.length} more`,!q&&st>0&&o.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",st," not responding"]})]}),ge&&se>0&&o.jsx("span",{className:"ap-lan-checked",children:fU(c==null?void 0:c.checkedAt,V,h==="check")})]}),Pe.length===0&&Ge.length===0&&!(c!=null&&c.stalled)&&!(c!=null&&c.deaf)&&!(c!=null&&c.lanTunneled)&&o.jsxs(o.Fragment,{children:[o.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."}),o.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>C(!0),children:"How it works"})]})]})]})}),Le]})}function NU({anchorId:e,id:t,peers:n,onHold:r,onLet:s}){const l=w.useRef(null),{title:c,shown:u,rest:f}=xz(n),p=w.useCallback(()=>{const h=l.current,m=document.getElementById(e);if(!h||!m)return;const y=Pb(m.getBoundingClientRect(),{width:h.offsetWidth,height:h.offsetHeight},{width:window.innerWidth,height:window.innerHeight});h.style.top=`${y.top}px`,h.style.left=`${y.left}px`,h.style.maxHeight=y.maxHeight==null?"":`${y.maxHeight}px`,h.dataset.side=y.side},[e]);return w.useLayoutEffect(()=>{p()}),w.useEffect(()=>(window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}),[p]),On.createPortal(o.jsxs("div",{ref:l,id:t,className:"ap-peek ap-fold-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:s,children:[o.jsx("p",{className:"ap-peek-title",children:c}),o.jsx("div",{className:"ap-peek-list",children:u.map(h=>o.jsxs("span",{className:"ap-peek-who ap-fold-who",children:[o.jsx("span",{className:"ap-fold-name",children:h.name}),o.jsx("span",{className:"ap-fold-state","data-tone":h.ready?"ok":h.warn?"warn":"idle",children:h.ready?h.headroom==null?"not read yet":`${h.headroom}% free`:h.why})]},h.key))}),f&&o.jsx("p",{className:"ap-peek-rest",children:f})]}),document.body)}function SU({peers:e,strained:t,armed:n,threshold:r,open:s,onToggle:l}){const[c,u]=w.useState(!1),f=w.useRef(0);w.useEffect(()=>()=>window.clearTimeout(f.current),[]),w.useEffect(()=>{s&&(window.clearTimeout(f.current),u(!1))},[s]);const p=S=>{s||(window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!0),S))},h=()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!1),ZM)},m=()=>window.clearTimeout(f.current),y=()=>{window.clearTimeout(f.current),u(!1)},v=wz(e,{strained:t&&!s,armed:n,threshold:r});return o.jsxs("div",{className:"ap-rest",children:[o.jsxs("button",{type:"button",id:"ap-rest-entry",className:"ap-nav","aria-expanded":s,"aria-controls":s?"ap-rest-panel":void 0,"aria-describedby":c?"ap-rest-peek":void 0,onClick:()=>{y(),l()},onPointerEnter:S=>{S.pointerType==="mouse"&&p(XM)},onPointerLeave:h,onFocus:S=>{S.target.matches(":focus-visible")&&p(0)},onBlur:h,children:[o.jsxs("span",{className:"ap-nav-text",children:[o.jsx("span",{className:"ap-nav-name",children:"Other accounts"}),o.jsx("span",{className:"ap-nav-state","data-tone":v.tone,children:v.text})]}),o.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:o.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),c&&o.jsx(NU,{anchorId:"ap-rest-entry",id:"ap-rest-peek",peers:e,onHold:m,onLet:h})]})}async function jU(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const _U=1800;function EU({accounts:e,onClose:t,copyText:n}){const[r,s]=w.useState([]),[l,c]=w.useState(null),[u,f]=w.useState(!1),[p,h]=w.useState(null),[m,y]=w.useState(!1),[v,S]=w.useState(()=>Math.floor(Date.now()/1e3)),b=w.useRef(null),_=w.useRef(!1),k=mn(t,{focusRef:b});w.useEffect(()=>{if(!l)return;S(Math.floor(Date.now()/1e3));const P=window.setInterval(()=>S(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(P)},[l]);const j=iz(e),E=lz(e,r),C=E.length===e.length,R=P=>s(W=>cz(W,P)),I=w.useCallback(async()=>{const P=uz(E);if(!Ps(_.current)||!P)return;_.current=!0,f(!0),h(null),y(!1);const W=await jU(P).catch(()=>null);if(_.current=!1,f(!1),!(W!=null&&W.ok)){h(Ol(W,"the share could not be made"));return}c({blob:W.blob,expiresAt:W.expiresAt,shared:W.shared??[],failed:W.failed??[]})},[e,E]),$=l?HM(l.expiresAt,v):null,q=($==null?void 0:$.tone)==="gone",B=(l==null?void 0:l.shared.length)??0;return On.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:k,className:"modal sa-modal",onClick:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("h3",{children:"Share accounts"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsx("section",{className:"modal-body sa-body",children:l?o.jsxs("div",{className:"sa-step",children:[o.jsx("h4",{children:q?"This share has expired":B===1?"1 account, ready to paste":`${B} accounts, ready to paste`}),o.jsx("code",{className:`ap-share-blob${q?" sa-dead":""}`,children:l.blob}),o.jsxs("div",{className:"ap-share-foot",children:[o.jsx("button",{type:"button",className:"ap-manage-btn",ref:b,onClick:async()=>{if(q){c(null),I();return}await n(l.blob)&&(y(!0),window.setTimeout(()=>y(!1),_U))},children:q?"make a new share":m?"copied":`copy ${B===1?"the share":"all "+B}`}),o.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:[o.jsx("span",{className:"ap-share-warn",children:B===1?"this is the password":`this is ${B} passwords`})," · ",o.jsx("span",{className:`ap-share-expiry ${$==null?void 0:$.tone}`,children:$==null?void 0:$.text})]})]}),l.failed.length>0&&o.jsxs("div",{className:"sa-failed",role:"alert",children:[o.jsx("p",{className:"sa-failed-head",children:l.failed.length===1?"One account is not in this bundle:":`${l.failed.length} accounts are not in this bundle:`}),o.jsx("ul",{className:"sa-list",children:l.failed.map(P=>{var ne;const W=!!(P.email&&((ne=P.detail)!=null&&ne.includes(P.email)));return o.jsxs("li",{children:[!W&&o.jsx("span",{className:"sa-who",children:P.email||`account ${P.num}`}),o.jsx("span",{className:"sa-why",children:P.detail||"could not be exported"})]},`${P.num}-${P.email}`)})})]}),o.jsx("p",{className:"sa-note",children:q?o.jsx(o.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):o.jsxs(o.Fragment,{children:["Paste it into the other deck with ",o.jsx("strong",{children:"+"})," → ",o.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),o.jsxs("div",{className:"sa-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>{c(null),y(!1)},children:"Pick again"}),o.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?o.jsxs("div",{className:"sa-step",children:[o.jsx("h4",{children:"Nothing to share"}),o.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",o.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),o.jsx("div",{className:"sa-actions",children:o.jsx("button",{type:"button",className:"btn primary",ref:b,onClick:t,children:"Close"})})]}):o.jsxs("div",{className:"sa-step",children:[o.jsxs("h4",{children:["Which accounts go to the other ",hn,"?"]}),o.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:dz(E.length)}),o.jsx("ul",{className:"sa-list sa-pick",children:j.map(P=>o.jsx("li",{children:o.jsxs("label",{className:"sa-row",children:[o.jsx("input",{type:"checkbox",checked:E.includes(P.num),onChange:()=>R(P.num)}),o.jsx("span",{className:"sa-who",children:P.label}),P.sub&&o.jsx("span",{className:"sa-sub",children:P.sub})]})},P.num))}),p&&o.jsx("p",{className:"aa-err",children:p}),o.jsxs("div",{className:"sa-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>s(C?e.map(P=>P.num):[]),children:C?"Clear all":"Select all"}),o.jsx("button",{type:"button",className:"btn primary",ref:b,...to(u,!E.length),onClick:I,children:u?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})}),document.body)}function CU(e,t){const n=new Set(e),r=e.length?Math.max(...e):0;return[...new Set([...e,r+1])].sort((s,l)=>s-l).map(s=>{const l=s===t?"here":n.has(s)?"swap":"free";return{slot:s,kind:l,label:l==="here"?`slot ${s}`:`slot ${s} · ${l}`}})}function TU(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}}function RU(e,t,n){return t!=null&&e.some(r=>r.slot===t)?t:n}function AU(e,t,n){var s;const r=((s=e.find(l=>l.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 MU(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 nj(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function IU(e){const t=e.filter(u=>!nj(u)),n=e.filter(u=>nj(u)),r=t.length?t:n,s=t.length?n:[],l=r.reduce((u,f)=>u&&u.pct>=f.pct?u:f,null);let c=null;for(const u of s)l&&u.pct<=l.pct||(!c||u.pct>c.pct)&&(c=u);return{shown:r,rest:s,fuller:c,peak:c??l}}const $U="\0";function lf(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}${$U}${n}`}function OU(e,t){const n=lf(t);return e.includes(n)?e.filter(r=>r!==n):[...e,n]}function LU(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(lf)),r=e.filter(s=>n.has(s));return r.length===e.length?e:r}const PU=64;function DU(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}function FU(e,t){return!e||!t||t.some(n=>n.num===e.num&&n.active)?e:null}const qU=Object.freeze({text:"couldn't reach the deck server",reload:!0}),BU=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function rj(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function zU(e){const t=e.find(r=>!r.ok);if(!t)return null;const n=$u(t.body);return{text:D0(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function sj(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 aj=15e3,UU=8e3,HU=1800,WU=3e4,Mm=[70,80,85,90,95];function Im(e,t){return NM(t-Math.floor(e/1e3))}function VU(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 uu(e){return e.charAt(0).toUpperCase()+e.slice(1)}function GU(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 KU(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 YU(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 _h(e,t){if(e.staleCopy){const n=GU(e.repair??null,t);return{text:uu(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=YU(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:uu(n.text),hint:n.hint,fix:n.fix?uu(n.fix):null,tone:r||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:r}}if(e.error){const n=KU(e.error);return{text:uu(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function $m(){return o.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:[o.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),o.jsx("path",{d:"M7 5.6v2.9"}),o.jsx("path",{d:"M7 10.3v.05"})]})}function XU(e){return e>=90?"hi":e>=70?"mid":void 0}function ZU(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!Mm.includes(t)?[...Mm,t]:Mm].sort((r,s)=>r-s)}function QU({lane:e,nowSec:t,frozen:n}){const r=Math.min(100,Math.max(0,e.pct)),s=n?"var(--muted)":r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",l=e.resetAt&&!n?SM(e.resetAt,t):null;return o.jsxs("div",{className:"ap-lane",children:[o.jsx("span",{className:"ap-lane-label",title:e.label,children:e.label}),o.jsx("div",{className:"ap-lane-track",children:o.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:s,opacity:r===0||n?.4:1}})}),o.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[r,"%"]}),o.jsx("span",{className:"ap-lane-reset",title:l?`${e.label} resets in ${l}`:void 0,children:l&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"vis-hidden",children:"resets in "}),l]})})]})}function JU({onClose:e,leaving:t}){var xr,Pn,Hs;const[n,r]=w.useState(null),[s,l]=w.useState(null),[c,u]=w.useState(null),[f,p]=w.useState(!1),[h,m]=w.useState(null),[y,v]=w.useState(null),[S,b]=w.useState("accounts"),[_,k]=w.useState(!1),[j,E]=w.useState(null),C=w.useRef(j);C.current=j;const[R,I]=w.useState(()=>Math.floor(Date.now()/1e3)),$=w.useRef(null),[q,B]=w.useState(null),P=(q==null?void 0:q.num)??null,W=w.useRef(q);W.current=q;const[ne,ee]=w.useState(null),[M,X]=w.useState(!1),[V,G]=w.useState(""),[F,L]=w.useState(null),H=w.useRef(0),[D,K]=w.useState(null),[re,z]=w.useState(!1),[Z,U]=w.useState(!1),[ae,le]=w.useState(null),[ge,Ne]=w.useState(null),[Ie,Ge]=w.useState(null),[Pe,ze]=w.useState(null),[Re,st]=w.useState(!1),ue=w.useRef(null),ce=w.useRef(null),[se,be]=w.useState([]),[Le,de]=w.useState(!1),fe=w.useRef(null),Ce=w.useCallback(Q=>Mf(fe.current)?(fe.current=Q,u(Q),!0):!1,[]),pe=w.useCallback(()=>{fe.current=null,u(null)},[]),_e=(Q,De=!1)=>{const Je=lo(c,Q);return{disabled:Je.disabled,"aria-busy":Je.busy||De}},Ye=w.useCallback(Q=>{window.requestAnimationFrame(()=>{var De;if($0(((De=document.activeElement)==null?void 0:De.tagName)??null))for(const Je of h8(Q)){const He=document.querySelector(Je);if(He){He.focus();return}}})},[]),qe=w.useCallback(async(Q=!1)=>{Q&&p(!0);const De=new AbortController,Je=window.setTimeout(()=>De.abort(),WU);try{const[He,tt]=await Promise.all([fetch(`/api/claude-accounts${Q?"?refresh=1":""}`,{signal:De.signal}),fetch("/api/cswap-auto",{signal:De.signal})]);if(He.ok){const gt=await He.json();r(gt),be(At=>LU(At,gt.accounts))}tt.ok&&l(await tt.json());const wt=zU([await rj(He),await rj(tt)]);m(gt=>sj(gt,wt))}catch{m(He=>sj(He,De.signal.aborted?BU:qU))}finally{window.clearTimeout(Je),Q&&p(!1)}},[]),ke=w.useCallback(async(Q,De,Je="panel")=>{if(!Ce(De))return null;const He=Je==="menu"?ee:m;He(null);try{const tt=await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Q)}),wt=await tt.json().catch(()=>null);return wt!=null&&wt.ok||He({text:D0(wt,"command failed",tt.status),raw:$u(wt)}),wt}catch{return He({text:"server unreachable"}),null}finally{pe()}},[Ce,pe]),Ae=w.useCallback(async(Q,De)=>{if(!Ce(De))return null;m(null),ee(null);try{const Je=await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Q)}),He=await Je.json().catch(()=>null);return He!=null&&He.ok||ee({text:Ol(He,"command failed",Je.status)}),He}catch{return ee({text:"server unreachable"}),null}finally{pe()}},[Ce,pe]);w.useEffect(()=>(qe(!0),$.current=window.setInterval(()=>qe(!1),aj),()=>{$.current!=null&&window.clearInterval($.current)}),[qe]),w.useEffect(()=>{!(n!=null&&n.ok)||!n.accounts||v(Q=>FU(Q,n.accounts))},[n]),w.useEffect(()=>{const Q=window.setInterval(()=>I(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(Q)},[]);const Ue=((xr=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:xr.value)??"90",Fe=Pe??Ue,Ve=MU(Fe,Ue),rt=(Pn=n==null?void 0:n.accounts)==null?void 0:Pn.find(Q=>Q.active),ut=rt?_h(rt,R):null,ct=(n==null?void 0:n.accounts)??[],yt=rt?ct.filter(Q=>!Q.active):[],It=yt.length?ct.filter(Q=>Q.active):ct,zt=yt.map(Q=>{const De=_h(Q,R);return{key:lf(Q),name:Q.alias??Q.email??`account ${Q.num}`,ready:!Q.disabled&&!(De!=null&&De.blocksSwitch),why:Q.disabled?"held out":De!=null&&De.blocksSwitch?De.text:null,warn:(De==null?void 0:De.tone)==="warn",headroom:Q.headroom}}),Xt=Number(Ue),Ft=(rt==null?void 0:rt.headroom)!=null&&Number.isFinite(Xt)&&100-rt.headroom>=Xt,rn=(s==null?void 0:s.ok)===!0&&(s.enabled||s.external),Se=Q=>Le&&yt.some(De=>De.num===Q)?"ap-rest-list":"ap-scroll",vt=async(Q,De)=>{if(Ce(`switch-${Q}`)){m(null),v(null);try{const He=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:Q})})).json().catch(()=>null);He!=null&&He.ok?v({num:Q,name:De}):m({text:D0(He,"the switch failed"),raw:$u(He),row:Q}),await qe(!0)}catch{m({text:"server unreachable",row:Q})}finally{pe(),Ye(Q)}}},kt=w.useCallback(()=>{B(null),ee(null),L(null),K(null),U(!1)},[]),_n=(Q,De="first")=>{kt(),E(null),Ge(null),B({num:Q,view:"menu",start:De})},Ut=(Q,De)=>{kt(),E(Je=>(Je==null?void 0:Je.anchor)===De?null:{num:Q,anchor:De})},Vn=w.useCallback((Q=!1)=>{var Je;const De=C.current;Q&&De&&((Je=document.getElementById(De.anchor))==null||Je.focus()),E(null)},[]),Vt=()=>{kt(),E(null),b("lan")},$t=w.useRef(S);w.useEffect(()=>{$t.current!==S&&($t.current=S,window.requestAnimationFrame(()=>{var Q;(Q=document.getElementById(S==="lan"?"ap-lan-back":"ap-lan-entry"))==null||Q.focus()}))},[S]),w.useEffect(()=>{n!=null&&n.ok&&k(!0)},[n==null?void 0:n.ok]);const Zt=w.useCallback(Q=>{var He,tt;const De=W.current;if(!De||Q!=null&&De.num!==Q)return;const Je=document.getElementById(`ap-menu-${De.num}`);(Je!=null&&Je.contains(document.activeElement)||$0(((He=document.activeElement)==null?void 0:He.tagName)??null))&&((tt=document.getElementById(`ap-more-${De.num}`))==null||tt.focus()),kt()},[kt]);w.useEffect(()=>{t&&(kt(),E(null))},[t,kt]),w.useEffect(()=>{q&&(n!=null&&n.accounts)&&!n.accounts.some(Q=>Q.num===q.num)&&kt(),j&&(n!=null&&n.accounts)&&!n.accounts.some(Q=>Q.num===j.num)&&E(null)},[n,q,j,kt]);const Ln=async Q=>{var Je;U(!1);const De=await Ae({action:"share",account:Q},`share-${Q}`);!(De!=null&&De.ok)||((Je=W.current)==null?void 0:Je.num)!==Q||(K({num:Q,blob:De.blob,expiresAt:De.expiresAt}),B({num:Q,view:"share"}))},Ur=async(Q,De)=>{const{commit:Je,alias:He}=DU(V,De);if(Je){const tt=await Ae({action:"alias",account:Q,alias:He},`alias-${Q}`);if(await qe(!0),!(tt!=null&&tt.ok))return}Zt(Q)},xe=async(Q,De)=>{var tt,wt;const Je=await Ae({action:"move",account:Q,slot:De},`move-${Q}`),He=TU({menuFor:((tt=W.current)==null?void 0:tt.num)??null,shareFor:(D==null?void 0:D.num)??null},Q,Je);if(await qe(!0),He){((wt=W.current)==null?void 0:wt.num)===Q&&kt(),L(He.confirmRemove),He.shareFor==null&&(K(null),U(!1)),Ne(He.swapNote);const gt=He.swapNote;gt&&window.setTimeout(()=>Ne(At=>At===gt?null:At),UU),Ge(null),Ye(He.menuFor)}return Je},ir=async(Q,De,Je)=>{if(!Je.sends){Zt(Q);return}await xe(Q,De)},Ns=async(Q,De)=>{if(De.sends){const Je=await ke({action:"setting",key:"autoswitch.threshold",value:Q},"threshold");if(await qe(!0),!(Je!=null&&Je.ok))return;ze(null)}st(!0),window.setTimeout(()=>{var Je;document.activeElement===ce.current&&((Je=ue.current)==null||Je.focus()),st(!1)},HU)},Hr=o.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:o.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:o.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})}),ma=Q=>{const{shown:De,fuller:Je}=IU(Q.lanes),He=_h(Q,R),tt=Q.active||se.includes(lf(Q)),wt=Q.alias??Q.email??`account ${Q.num}`,gt=Q.alias&&Q.email?`${Q.alias} · ${Q.email}`:wt,At=Q.stale||(He==null?void 0:He.blocksSwitch)===!0,Ct=Je?[...De,Je]:De,Qt=Q.fetchedAt?Im(Q.fetchedAt,R):null;return o.jsxs("li",{className:`ap-account${Q.active?" active":""}`,"aria-current":Q.active?"true":void 0,"data-open":tt?"":void 0,"data-frozen":At?"":void 0,children:[!Q.active&&o.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${Q.num}`,title:gt,"aria-expanded":tt,"aria-controls":tt?`ap-detail-${Q.num}`:void 0,"aria-describedby":[Q.alias&&Q.email?`ap-email-${Q.num}`:null,!tt&&!(He!=null&&He.blocksSwitch)?`ap-quota-${Q.num}`:null].filter(Boolean).join(" ")||void 0,onClick:()=>be(St=>OU(St,Q)),children:o.jsxs("span",{className:"vis-hidden",children:[wt,", ",tt?"hide details":"details"]})}),o.jsxs("div",{className:"ap-account-head",children:[Q.active?o.jsx("span",{className:"ap-live",title:`Active account · slot ${Q.num}`,children:o.jsxs("span",{className:"vis-hidden",children:["Active account, slot ",Q.num,":"]})}):o.jsx("span",{className:"ap-num",children:Q.num}),Q.alias&&o.jsx("span",{className:"ap-alias",title:Q.alias,children:Q.alias}),o.jsx("span",{className:"ap-email",id:`ap-email-${Q.num}`,title:Q.email??void 0,children:Q.email}),Q.disabled&&o.jsx("span",{className:"ap-held",children:"held out"}),!Q.active&&!Q.disabled&&!(He!=null&&He.blocksSwitch)&&o.jsx("button",{type:"button",className:"ap-switch",..._e(`switch-${Q.num}`),onClick:()=>vt(Q.num,wt),"aria-label":`Switch to ${wt}`,title:`Switch to ${Q.alias??Q.email}`,children:c===`switch-${Q.num}`?"…":"Switch"}),o.jsx("button",{type:"button",id:`ap-more-${Q.num}`,className:"ap-more","aria-label":`More actions for ${Q.email??Q.alias??`account ${Q.num}`}`,"aria-haspopup":"menu","aria-expanded":P===Q.num,"aria-controls":P===Q.num?`ap-menu-${Q.num}`:void 0,title:"More actions",onClick:()=>P===Q.num?Zt():_n(Q.num),onKeyDown:St=>{St.key!=="ArrowDown"&&St.key!=="ArrowUp"||(St.preventDefault(),_n(Q.num,St.key==="ArrowUp"?"last":"first"))},children:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:[o.jsx("circle",{cx:"2.8",cy:"7",r:"1.15"}),o.jsx("circle",{cx:"7",cy:"7",r:"1.15"}),o.jsx("circle",{cx:"11.2",cy:"7",r:"1.15"})]})})]}),(h==null?void 0:h.row)===Q.num&&o.jsxs("div",{className:"ap-failure ap-row-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),Q.active&&(y==null?void 0:y.num)===Q.num&&o.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."}),(ge==null?void 0:ge.at)===Q.num&&(()=>{const St=ct.find(lr=>lr.num===ge.displaced),br=(St==null?void 0:St.alias)??(St==null?void 0:St.email)??"the account that was there";return o.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${ge.at} was taken, so the two accounts traded places: ${br} now holds slot ${ge.displaced}.`,children:["swapped with slot ",ge.displaced]})})(),He&&o.jsxs("div",{className:"ap-issue-line",children:[o.jsxs("button",{type:"button",id:`ap-issue-${Q.num}`,className:"ap-issue","data-tone":He.tone,"aria-haspopup":"dialog","aria-expanded":(j==null?void 0:j.anchor)===`ap-issue-${Q.num}`,"aria-controls":(j==null?void 0:j.anchor)===`ap-issue-${Q.num}`?"ap-issue-pop":void 0,onClick:()=>Ut(Q.num,`ap-issue-${Q.num}`),children:[He.tone==="warn"&&o.jsx($m,{}),o.jsx("span",{className:"ap-issue-text",children:He.text})]}),!tt&&o.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:Qt??"never collected"})]}),!tt&&!(He!=null&&He.blocksSwitch)&&o.jsxs("p",{className:"ap-quota",id:`ap-quota-${Q.num}`,children:[Ct.length?Ct.map(St=>o.jsxs("span",{className:"ap-q",children:[o.jsx("span",{className:"ap-q-label",children:St.label})," ",o.jsxs("span",{className:"ap-q-pct","data-level":At?void 0:XU(St.pct),children:[Math.round(St.pct),"%"]})]},St.id)):o.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),Q.stale&&!He&&o.jsx("span",{className:"ap-q-age","data-never":Qt?void 0:"",title:"When claude-swap last read this account's usage",children:Qt??"never collected"})]}),tt&&o.jsxs("div",{className:"ap-detail",id:`ap-detail-${Q.num}`,children:[o.jsx("div",{className:"ap-lanes",children:Q.lanes.length?Q.lanes.map(St=>o.jsx(QU,{lane:St,nowSec:R,frozen:At},St.id)):o.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),o.jsx("div",{className:"ap-meta",children:Q.fetchedAt?o.jsxs("span",{className:`ap-age${Q.stale&&!He?" 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 ",Im(Q.fetchedAt,R),He!=null&&He.blocksSwitch?"":VU(Q.nextAt,R)]}):o.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]},Q.num)},Ss=n!=null&&n.ok&&(s!=null&&s.ok)?o.jsxs("div",{className:"ap-policy-block",children:[o.jsxs("div",{className:"ap-policy",children:[o.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),o.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:o.jsx("select",{ref:ue,"aria-label":"Switch threshold",value:Fe,..._e("threshold"),onChange:Q=>ze(Q.target.value),children:ZU(Ue).map(Q=>o.jsxs("option",{value:Q,children:[Q,"%"]},Q))})}),(Ve.sends||Re)&&o.jsx("button",{ref:ce,type:"button",className:"ap-manage-btn",..._e("threshold"),title:Ve.title,onClick:()=>Ns(Fe,Ve),children:Re&&!Ve.sends?Ve.done:Ve.label}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",..._e("enable"),onClick:()=>ke({action:"enable",enabled:!s.enabled},"enable").then(()=>qe(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:o.jsx("span",{className:"switch-knob"})})]}),s.external&&o.jsxs("p",{className:"ap-auto-note",children:[o.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",o.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",s.enabled?" — this toggle takes over when you stop it.":"."]})]}):null;return o.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",children:[S==="accounts"&&o.jsxs("div",{className:"ap-header",children:[o.jsx("h2",{children:"Claude accounts"}),o.jsxs("div",{className:"ap-header-right",children:[o.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>X(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:o.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:o.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((Hs=n==null?void 0:n.accounts)==null?void 0:Hs.length)??0)>0&&o.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>z(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${hn} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:o.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:[o.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),o.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),o.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>qe(!0),..._e("reload",f),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:o.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:[o.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),o.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),Hr]})]}),S==="accounts"&&o.jsx("div",{className:"ap-scroll",id:"ap-scroll",children:n==null?h?o.jsxs("div",{className:"ap-empty",role:"alert",children:[o.jsx("span",{title:h.raw||void 0,children:h.text}),o.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",aj/1e3," seconds."]}),o.jsx("button",{type:"button",className:"ap-fix",disabled:f,onClick:()=>qe(!0),children:f?"trying…":"try again"})]}):o.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?o.jsxs(o.Fragment,{children:[rt&&(ut==null?void 0:ut.tone)==="warn"&&o.jsxs("div",{className:"ap-notice",children:[o.jsxs("button",{type:"button",id:"ap-notice",className:"ap-issue","data-tone":"warn","aria-haspopup":"dialog","aria-expanded":(j==null?void 0:j.anchor)==="ap-notice","aria-controls":(j==null?void 0:j.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>Ut(rt.num,"ap-notice"),children:[o.jsx($m,{}),o.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),ut.fix&&o.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>X(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"Sign in"})]}),o.jsx("ul",{className:"ap-list",children:It.map(ma)}),yt.length>0&&o.jsx(SU,{peers:zt,strained:Ft,armed:rn,threshold:s!=null&&s.ok?Ue:null,open:Le,onToggle:()=>de(Q=>!Q)}),yt.length>0&&Le&&o.jsxs("div",{className:"ap-rest-panel",id:"ap-rest-panel",children:[o.jsx("ul",{className:"ap-list ap-others",id:"ap-rest-list",children:yt.map(ma)}),Ss]}),yt.length===0&&Ss,h&&h.row==null&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),q&&(()=>{var He;const Q=(He=n.accounts)==null?void 0:He.find(tt=>tt.num===q.num);if(!Q)return null;const De=`ap-pop-title-${Q.num}`,Je=ne&&o.jsx("p",{className:"ap-pop-error",role:"alert",title:ne.raw||void 0,children:ne.text});return o.jsxs(O0,{anchorId:`ap-more-${Q.num}`,boundaryId:Se(Q.num),id:`ap-menu-${Q.num}`,className:"ap-pop",role:q.view==="menu"?"menu":"dialog",labelledBy:q.view==="menu"?`ap-more-${Q.num}`:De,start:q.start,onClose:kt,children:[q.view==="menu"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{G(Q.alias??""),ee(null),B({num:Q.num,view:"rename"})},children:"Rename"}),o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{Ge(null),ee(null),B({num:Q.num,view:"move"})},children:"Move to slot…"}),o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",..._e(`share-${Q.num}`),title:`Copy this account to another ${hn}. 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:()=>Ln(Q.num),children:c===`share-${Q.num}`?"Sharing…":"Share"}),o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",title:"See how much this account worked in each project",onClick:()=>{le(Q.num),Zt(Q.num)},children:"Projects"}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!Q.active||Q.disabled)&&o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",..._e(`rot-${Q.num}`),title:Q.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",onClick:()=>ke({action:"account",account:Q.num,enabled:Q.disabled},`rot-${Q.num}`,"menu").then(tt=>{qe(!0),tt!=null&&tt.ok&&Zt(Q.num)}),children:Q.disabled?"Put back in rotation":"Hold out of rotation"}),o.jsx("div",{role:"separator",className:"ap-menu-sep"}),o.jsx("button",{type:"button",role:"menuitem",className:`ap-menu-item danger${F===Q.num?" armed":""}`,..._e(`rm-${Q.num}`),"aria-label":F===Q.num?"Confirm remove":void 0,title:F===Q.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{const tt=Date.now(),wt=Au({armedFor:F,target:Q.num,armedAt:H.current,now:tt,gapMs:Ou});if(wt==="arm"){L(Q.num),H.current=tt,window.setTimeout(()=>L(gt=>gt===Q.num?null:gt),4e3);return}wt!=="ignore"&&(L(null),Ae({action:"remove",account:Q.num},`rm-${Q.num}`).then(gt=>{var At;qe(!0),gt!=null&>.ok&&(((At=W.current)==null?void 0:At.num)===Q.num&&kt(),Ye(null))}))},children:c===`rm-${Q.num}`?"Removing…":F===Q.num?"Confirm":"Remove"}),Je]}),q.view==="rename"&&o.jsxs("form",{className:"ap-pop-form",onSubmit:tt=>{tt.preventDefault(),Ur(Q.num,Q.alias)},children:[o.jsx("label",{className:"ap-pop-title",id:De,htmlFor:`ap-alias-${Q.num}`,children:"Rename account"}),o.jsx("input",{id:`ap-alias-${Q.num}`,className:"ap-manage-input",type:"text",value:V,onChange:tt=>G(tt.target.value),maxLength:PU,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:tt=>tt.currentTarget.select()}),Je,o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>Zt(),children:"Cancel"}),o.jsx("button",{type:"submit",className:"btn primary",..._e(`alias-${Q.num}`),title:"A short name to show instead of the email",children:c===`alias-${Q.num}`?"…":"Save"})]})]}),q.view==="move"&&(()=>{const tt=CU((n.accounts??[]).map(At=>At.num),Q.num),wt=RU(tt,Ie,Q.num),gt=AU(tt,wt,Q.num);return o.jsxs("div",{className:"ap-pop-form",children:[o.jsx("label",{className:"ap-pop-title",id:De,htmlFor:`ap-slot-${Q.num}`,children:"Move to slot"}),o.jsx("span",{className:"ap-field",children:o.jsx("select",{id:`ap-slot-${Q.num}`,value:String(wt),..._e(`move-${Q.num}`),onChange:At=>Ge(Number(At.target.value)),autoFocus:!0,children:tt.map(At=>o.jsx("option",{value:At.slot,children:At.label},At.slot))})}),Je,o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>Zt(),children:"Cancel"}),o.jsx("button",{type:"button",className:"btn primary",..._e(`move-${Q.num}`),title:gt.title,onClick:()=>ir(Q.num,wt,gt),children:c===`move-${Q.num}`?"…":uu(gt.label)})]})]})})(),q.view==="share"&&(D==null?void 0:D.num)===Q.num&&(()=>{const tt=HM(D.expiresAt,R),wt=tt.tone==="gone";return o.jsxs("div",{className:`ap-pop-form ap-share${wt?" expired":""}`,children:[o.jsx("p",{className:"ap-pop-title",id:De,children:"Share account"}),o.jsx("code",{className:"ap-share-blob",children:D.blob}),o.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:[o.jsx("span",{className:"ap-share-warn",children:"This is the password"})," · ",o.jsx("span",{className:`ap-share-expiry ${tt.tone}`,children:tt.text})]}),Je,o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>Zt(),children:"Done"}),o.jsx("button",{type:"button",className:"btn primary",..._e(`share-${Q.num}`),autoFocus:!0,onClick:async()=>{if(wt){await Ln(Q.num);return}await yi(D.blob)&&(U(!0),window.setTimeout(()=>U(!1),1800))},children:wt?"Make a new share":Z?"Copied":"Copy"})]})]})})()]})})(),j&&(()=>{var Je;const Q=(Je=n.accounts)==null?void 0:Je.find(He=>He.num===j.num),De=Q?_h(Q,R):null;return!Q||!De?null:o.jsx(O0,{anchorId:j.anchor,boundaryId:j.anchor==="ap-notice"?"ap-scroll":Se(Q.num),id:"ap-issue-pop",className:"ap-pop ap-issue-pop",role:"dialog",labelledBy:"ap-issue-title",onClose:()=>Vn(),children:o.jsxs("div",{className:"ap-pop-form",children:[o.jsxs("p",{className:"ap-pop-title ap-issue-title",id:"ap-issue-title","data-tone":De.tone,children:[De.tone==="warn"&&o.jsx($m,{}),De.text]}),o.jsx("p",{className:"ap-pop-note ap-issue-hint",children:De.hint}),o.jsxs("p",{className:"ap-pop-note ap-issue-when",children:[o.jsx("span",{className:"ap-issue-who",children:Q.alias??Q.email??`account ${Q.num}`})," · ",Q.fetchedAt?`last collected ${Im(Q.fetchedAt,R)}`:"never collected"]}),o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>Vn(!0),children:"Done"}),De.fix&&o.jsx("button",{type:"button",className:"btn primary",onClick:()=>{Vn(!0),X(!0)},title:"Open the sign-in dialog. Signing in as this account puts its login back in this slot — it keeps its slot, its alias and its history.",children:De.fix})]})]})})})()]}):o.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"claude-swap isn't installed."}),o.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&o.jsx("code",{className:"ap-cmd",children:n.hint}),o.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",o.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"No accounts added yet."}),o.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",o.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Couldn't read the account store."}),o.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})})}),o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:y?`Now active: ${y.name}`:""}),_&&o.jsx(kU,{accounts:((n==null?void 0:n.accounts)??[]).map(Q=>({key:`${String(Q.email??"").trim().toLowerCase()}@@${Q.orgUuid??""}`,email:Q.email??"",alive:Q.alive===!0,shareable:Q.collector==="ok"||Q.collector==null&&!Q.active})),onChanged:()=>qe(!0),view:S==="lan",onOpen:Vt,onBack:()=>b("accounts"),closeButton:Hr}),M&&o.jsx(gz,{onClose:()=>X(!1),onChanged:()=>qe(!0)}),re&&o.jsx(EU,{accounts:((n==null?void 0:n.accounts)??[]).map(Q=>({num:Q.num,email:Q.email,alias:Q.alias,org:Q.org})),onClose:()=>z(!1),copyText:yi}),ae!=null&&(()=>{const Q=((n==null?void 0:n.accounts)??[]).find(De=>De.num===ae);return Q?o.jsx(LB,{num:Q.num,name:Q.alias??Q.email??`account ${Q.num}`,onClose:()=>le(null)}):(le(null),null)})()]})}const eH=3e4;function tH({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function nH({bundle:e,running:t,pending:n,lastTried:r}){return t?tH({bundle:e,running:t,lastTried:r})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function rH(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function sH({asked:e,reported:t}){return t?t!==e:!1}function QM(e){const t=e.thresholdMs??eH;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 aH(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 oH(e,t){return e?t==null?"auto when idle":`auto in ${aH(t)}`:"auto-restart off"}function oj(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function iH(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 lH(e){const t=QM(e);return t==null?{idleSince:null,restart:!1,remainingMs:null}:e.idleSince==null||e.now<e.idleSince?{idleSince:e.now,restart:!1,remainingMs:t}:{idleSince:e.idleSince,restart:t===0,remainingMs:t}}function Wb(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 Om,ij;function cH(){if(ij)return Om;ij=1;function e(){this.__data__=[],this.size=0}return Om=e,Om}var Lm,lj;function sc(){if(lj)return Lm;lj=1;function e(t,n){return t===n||t!==t&&n!==n}return Lm=e,Lm}var Pm,cj;function Of(){if(cj)return Pm;cj=1;var e=sc();function t(n,r){for(var s=n.length;s--;)if(e(n[s][0],r))return s;return-1}return Pm=t,Pm}var Dm,uj;function uH(){if(uj)return Dm;uj=1;var e=Of(),t=Array.prototype,n=t.splice;function r(s){var l=this.__data__,c=e(l,s);if(c<0)return!1;var u=l.length-1;return c==u?l.pop():n.call(l,c,1),--this.size,!0}return Dm=r,Dm}var Fm,dj;function dH(){if(dj)return Fm;dj=1;var e=Of();function t(n){var r=this.__data__,s=e(r,n);return s<0?void 0:r[s][1]}return Fm=t,Fm}var qm,hj;function hH(){if(hj)return qm;hj=1;var e=Of();function t(n){return e(this.__data__,n)>-1}return qm=t,qm}var Bm,fj;function fH(){if(fj)return Bm;fj=1;var e=Of();function t(n,r){var s=this.__data__,l=e(s,n);return l<0?(++this.size,s.push([n,r])):s[l][1]=r,this}return Bm=t,Bm}var zm,pj;function Lf(){if(pj)return zm;pj=1;var e=cH(),t=uH(),n=dH(),r=hH(),s=fH();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=r,l.prototype.set=s,zm=l,zm}var Um,mj;function pH(){if(mj)return Um;mj=1;var e=Lf();function t(){this.__data__=new e,this.size=0}return Um=t,Um}var Hm,gj;function mH(){if(gj)return Hm;gj=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return Hm=e,Hm}var Wm,yj;function gH(){if(yj)return Wm;yj=1;function e(t){return this.__data__.get(t)}return Wm=e,Wm}var Vm,wj;function yH(){if(wj)return Vm;wj=1;function e(t){return this.__data__.has(t)}return Vm=e,Vm}var Gm,vj;function JM(){if(vj)return Gm;vj=1;var e=typeof rh=="object"&&rh&&rh.Object===Object&&rh;return Gm=e,Gm}var Km,xj;function ks(){if(xj)return Km;xj=1;var e=JM(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Km=n,Km}var Ym,bj;function ac(){if(bj)return Ym;bj=1;var e=ks(),t=e.Symbol;return Ym=t,Ym}var Xm,kj;function wH(){if(kj)return Xm;kj=1;var e=ac(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,s=e?e.toStringTag:void 0;function l(c){var u=n.call(c,s),f=c[s];try{c[s]=void 0;var p=!0}catch{}var h=r.call(c);return p&&(u?c[s]=f:delete c[s]),h}return Xm=l,Xm}var Zm,Nj;function vH(){if(Nj)return Zm;Nj=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Zm=n,Zm}var Qm,Sj;function Si(){if(Sj)return Qm;Sj=1;var e=ac(),t=wH(),n=vH(),r="[object Null]",s="[object Undefined]",l=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?s:r:l&&l in Object(u)?t(u):n(u)}return Qm=c,Qm}var Jm,jj;function Br(){if(jj)return Jm;jj=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Jm=e,Jm}var eg,_j;function Vu(){if(_j)return eg;_j=1;var e=Si(),t=Br(),n="[object AsyncFunction]",r="[object Function]",s="[object GeneratorFunction]",l="[object Proxy]";function c(u){if(!t(u))return!1;var f=e(u);return f==r||f==s||f==n||f==l}return eg=c,eg}var tg,Ej;function xH(){if(Ej)return tg;Ej=1;var e=ks(),t=e["__core-js_shared__"];return tg=t,tg}var ng,Cj;function bH(){if(Cj)return ng;Cj=1;var e=xH(),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 ng=n,ng}var rg,Tj;function eI(){if(Tj)return rg;Tj=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 rg=n,rg}var sg,Rj;function kH(){if(Rj)return sg;Rj=1;var e=Vu(),t=bH(),n=Br(),r=eI(),s=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,f=c.toString,p=u.hasOwnProperty,h=RegExp("^"+f.call(p).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var v=e(y)?h:l;return v.test(r(y))}return sg=m,sg}var ag,Aj;function NH(){if(Aj)return ag;Aj=1;function e(t,n){return t==null?void 0:t[n]}return ag=e,ag}var og,Mj;function ji(){if(Mj)return og;Mj=1;var e=kH(),t=NH();function n(r,s){var l=t(r,s);return e(l)?l:void 0}return og=n,og}var ig,Ij;function Vb(){if(Ij)return ig;Ij=1;var e=ji(),t=ks(),n=e(t,"Map");return ig=n,ig}var lg,$j;function Pf(){if($j)return lg;$j=1;var e=ji(),t=e(Object,"create");return lg=t,lg}var cg,Oj;function SH(){if(Oj)return cg;Oj=1;var e=Pf();function t(){this.__data__=e?e(null):{},this.size=0}return cg=t,cg}var ug,Lj;function jH(){if(Lj)return ug;Lj=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return ug=e,ug}var dg,Pj;function _H(){if(Pj)return dg;Pj=1;var e=Pf(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function s(l){var c=this.__data__;if(e){var u=c[l];return u===t?void 0:u}return r.call(c,l)?c[l]:void 0}return dg=s,dg}var hg,Dj;function EH(){if(Dj)return hg;Dj=1;var e=Pf(),t=Object.prototype,n=t.hasOwnProperty;function r(s){var l=this.__data__;return e?l[s]!==void 0:n.call(l,s)}return hg=r,hg}var fg,Fj;function CH(){if(Fj)return fg;Fj=1;var e=Pf(),t="__lodash_hash_undefined__";function n(r,s){var l=this.__data__;return this.size+=this.has(r)?0:1,l[r]=e&&s===void 0?t:s,this}return fg=n,fg}var pg,qj;function TH(){if(qj)return pg;qj=1;var e=SH(),t=jH(),n=_H(),r=EH(),s=CH();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=r,l.prototype.set=s,pg=l,pg}var mg,Bj;function RH(){if(Bj)return mg;Bj=1;var e=TH(),t=Lf(),n=Vb();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return mg=r,mg}var gg,zj;function AH(){if(zj)return gg;zj=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return gg=e,gg}var yg,Uj;function Df(){if(Uj)return yg;Uj=1;var e=AH();function t(n,r){var s=n.__data__;return e(r)?s[typeof r=="string"?"string":"hash"]:s.map}return yg=t,yg}var wg,Hj;function MH(){if(Hj)return wg;Hj=1;var e=Df();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return wg=t,wg}var vg,Wj;function IH(){if(Wj)return vg;Wj=1;var e=Df();function t(n){return e(this,n).get(n)}return vg=t,vg}var xg,Vj;function $H(){if(Vj)return xg;Vj=1;var e=Df();function t(n){return e(this,n).has(n)}return xg=t,xg}var bg,Gj;function OH(){if(Gj)return bg;Gj=1;var e=Df();function t(n,r){var s=e(this,n),l=s.size;return s.set(n,r),this.size+=s.size==l?0:1,this}return bg=t,bg}var kg,Kj;function Gb(){if(Kj)return kg;Kj=1;var e=RH(),t=MH(),n=IH(),r=$H(),s=OH();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=r,l.prototype.set=s,kg=l,kg}var Ng,Yj;function LH(){if(Yj)return Ng;Yj=1;var e=Lf(),t=Vb(),n=Gb(),r=200;function s(l,c){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<r-1)return f.push([l,c]),this.size=++u.size,this;u=this.__data__=new n(f)}return u.set(l,c),this.size=u.size,this}return Ng=s,Ng}var Sg,Xj;function Ff(){if(Xj)return Sg;Xj=1;var e=Lf(),t=pH(),n=mH(),r=gH(),s=yH(),l=LH();function c(u){var f=this.__data__=new e(u);this.size=f.size}return c.prototype.clear=t,c.prototype.delete=n,c.prototype.get=r,c.prototype.has=s,c.prototype.set=l,Sg=c,Sg}var jg,Zj;function Kb(){if(Zj)return jg;Zj=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 jg=e,jg}var _g,Qj;function tI(){if(Qj)return _g;Qj=1;var e=ji(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return _g=t,_g}var Eg,Jj;function qf(){if(Jj)return Eg;Jj=1;var e=tI();function t(n,r,s){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:s,writable:!0}):n[r]=s}return Eg=t,Eg}var Cg,e_;function Bf(){if(e_)return Cg;e_=1;var e=qf(),t=sc(),n=Object.prototype,r=n.hasOwnProperty;function s(l,c,u){var f=l[c];(!(r.call(l,c)&&t(f,u))||u===void 0&&!(c in l))&&e(l,c,u)}return Cg=s,Cg}var Tg,t_;function Gu(){if(t_)return Tg;t_=1;var e=Bf(),t=qf();function n(r,s,l,c){var u=!l;l||(l={});for(var f=-1,p=s.length;++f<p;){var h=s[f],m=c?c(l[h],r[h],h,l,r):void 0;m===void 0&&(m=r[h]),u?t(l,h,m):e(l,h,m)}return l}return Tg=n,Tg}var Rg,n_;function PH(){if(n_)return Rg;n_=1;function e(t,n){for(var r=-1,s=Array(t);++r<t;)s[r]=n(r);return s}return Rg=e,Rg}var Ag,r_;function Us(){if(r_)return Ag;r_=1;function e(t){return t!=null&&typeof t=="object"}return Ag=e,Ag}var Mg,s_;function DH(){if(s_)return Mg;s_=1;var e=Si(),t=Us(),n="[object Arguments]";function r(s){return t(s)&&e(s)==n}return Mg=r,Mg}var Ig,a_;function Ku(){if(a_)return Ig;a_=1;var e=DH(),t=Us(),n=Object.prototype,r=n.hasOwnProperty,s=n.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(c){return t(c)&&r.call(c,"callee")&&!s.call(c,"callee")};return Ig=l,Ig}var $g,o_;function nn(){if(o_)return $g;o_=1;var e=Array.isArray;return $g=e,$g}var du={exports:{}},Og,i_;function FH(){if(i_)return Og;i_=1;function e(){return!1}return Og=e,Og}du.exports;var l_;function oc(){return l_||(l_=1,(function(e,t){var n=ks(),r=FH(),s=t&&!t.nodeType&&t,l=s&&!0&&e&&!e.nodeType&&e,c=l&&l.exports===s,u=c?n.Buffer:void 0,f=u?u.isBuffer:void 0,p=f||r;e.exports=p})(du,du.exports)),du.exports}var Lg,c_;function zf(){if(c_)return Lg;c_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,s){var l=typeof r;return s=s??e,!!s&&(l=="number"||l!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<s}return Lg=n,Lg}var Pg,u_;function Yb(){if(u_)return Pg;u_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Pg=t,Pg}var Dg,d_;function qH(){if(d_)return Dg;d_=1;var e=Si(),t=Yb(),n=Us(),r="[object Arguments]",s="[object Array]",l="[object Boolean]",c="[object Date]",u="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",m="[object Object]",y="[object RegExp]",v="[object Set]",S="[object String]",b="[object WeakMap]",_="[object ArrayBuffer]",k="[object DataView]",j="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",R="[object Int16Array]",I="[object Int32Array]",$="[object Uint8Array]",q="[object Uint8ClampedArray]",B="[object Uint16Array]",P="[object Uint32Array]",W={};W[j]=W[E]=W[C]=W[R]=W[I]=W[$]=W[q]=W[B]=W[P]=!0,W[r]=W[s]=W[_]=W[l]=W[k]=W[c]=W[u]=W[f]=W[p]=W[h]=W[m]=W[y]=W[v]=W[S]=W[b]=!1;function ne(ee){return n(ee)&&t(ee.length)&&!!W[e(ee)]}return Dg=ne,Dg}var Fg,h_;function Uf(){if(h_)return Fg;h_=1;function e(t){return function(n){return t(n)}}return Fg=e,Fg}var hu={exports:{}};hu.exports;var f_;function Xb(){return f_||(f_=1,(function(e,t){var n=JM(),r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,l=s&&s.exports===r,c=l&&n.process,u=(function(){try{var f=s&&s.require&&s.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}})();e.exports=u})(hu,hu.exports)),hu.exports}var qg,p_;function Yu(){if(p_)return qg;p_=1;var e=qH(),t=Uf(),n=Xb(),r=n&&n.isTypedArray,s=r?t(r):e;return qg=s,qg}var Bg,m_;function nI(){if(m_)return Bg;m_=1;var e=PH(),t=Ku(),n=nn(),r=oc(),s=zf(),l=Yu(),c=Object.prototype,u=c.hasOwnProperty;function f(p,h){var m=n(p),y=!m&&t(p),v=!m&&!y&&r(p),S=!m&&!y&&!v&&l(p),b=m||y||v||S,_=b?e(p.length,String):[],k=_.length;for(var j in p)(h||u.call(p,j))&&!(b&&(j=="length"||v&&(j=="offset"||j=="parent")||S&&(j=="buffer"||j=="byteLength"||j=="byteOffset")||s(j,k)))&&_.push(j);return _}return Bg=f,Bg}var zg,g_;function Hf(){if(g_)return zg;g_=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,s=typeof r=="function"&&r.prototype||e;return n===s}return zg=t,zg}var Ug,y_;function rI(){if(y_)return Ug;y_=1;function e(t,n){return function(r){return t(n(r))}}return Ug=e,Ug}var Hg,w_;function BH(){if(w_)return Hg;w_=1;var e=rI(),t=e(Object.keys,Object);return Hg=t,Hg}var Wg,v_;function Zb(){if(v_)return Wg;v_=1;var e=Hf(),t=BH(),n=Object.prototype,r=n.hasOwnProperty;function s(l){if(!e(l))return t(l);var c=[];for(var u in Object(l))r.call(l,u)&&u!="constructor"&&c.push(u);return c}return Wg=s,Wg}var Vg,x_;function fa(){if(x_)return Vg;x_=1;var e=Vu(),t=Yb();function n(r){return r!=null&&t(r.length)&&!e(r)}return Vg=n,Vg}var Gg,b_;function co(){if(b_)return Gg;b_=1;var e=nI(),t=Zb(),n=fa();function r(s){return n(s)?e(s):t(s)}return Gg=r,Gg}var Kg,k_;function zH(){if(k_)return Kg;k_=1;var e=Gu(),t=co();function n(r,s){return r&&e(s,t(s),r)}return Kg=n,Kg}var Yg,N_;function UH(){if(N_)return Yg;N_=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return Yg=e,Yg}var Xg,S_;function HH(){if(S_)return Xg;S_=1;var e=Br(),t=Hf(),n=UH(),r=Object.prototype,s=r.hasOwnProperty;function l(c){if(!e(c))return n(c);var u=t(c),f=[];for(var p in c)p=="constructor"&&(u||!s.call(c,p))||f.push(p);return f}return Xg=l,Xg}var Zg,j_;function _i(){if(j_)return Zg;j_=1;var e=nI(),t=HH(),n=fa();function r(s){return n(s)?e(s,!0):t(s)}return Zg=r,Zg}var Qg,__;function WH(){if(__)return Qg;__=1;var e=Gu(),t=_i();function n(r,s){return r&&e(s,t(s),r)}return Qg=n,Qg}var fu={exports:{}};fu.exports;var E_;function sI(){return E_||(E_=1,(function(e,t){var n=ks(),r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,l=s&&s.exports===r,c=l?n.Buffer:void 0,u=c?c.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var m=p.length,y=u?u(m):new p.constructor(m);return p.copy(y),y}e.exports=f})(fu,fu.exports)),fu.exports}var Jg,C_;function aI(){if(C_)return Jg;C_=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 Jg=e,Jg}var ey,T_;function oI(){if(T_)return ey;T_=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,l=0,c=[];++r<s;){var u=t[r];n(u,r,t)&&(c[l++]=u)}return c}return ey=e,ey}var ty,R_;function iI(){if(R_)return ty;R_=1;function e(){return[]}return ty=e,ty}var ny,A_;function Qb(){if(A_)return ny;A_=1;var e=oI(),t=iI(),n=Object.prototype,r=n.propertyIsEnumerable,s=Object.getOwnPropertySymbols,l=s?function(c){return c==null?[]:(c=Object(c),e(s(c),function(u){return r.call(c,u)}))}:t;return ny=l,ny}var ry,M_;function VH(){if(M_)return ry;M_=1;var e=Gu(),t=Qb();function n(r,s){return e(r,t(r),s)}return ry=n,ry}var sy,I_;function Jb(){if(I_)return sy;I_=1;function e(t,n){for(var r=-1,s=n.length,l=t.length;++r<s;)t[l+r]=n[r];return t}return sy=e,sy}var ay,$_;function Wf(){if($_)return ay;$_=1;var e=rI(),t=e(Object.getPrototypeOf,Object);return ay=t,ay}var oy,O_;function lI(){if(O_)return oy;O_=1;var e=Jb(),t=Wf(),n=Qb(),r=iI(),s=Object.getOwnPropertySymbols,l=s?function(c){for(var u=[];c;)e(u,n(c)),c=t(c);return u}:r;return oy=l,oy}var iy,L_;function GH(){if(L_)return iy;L_=1;var e=Gu(),t=lI();function n(r,s){return e(r,t(r),s)}return iy=n,iy}var ly,P_;function cI(){if(P_)return ly;P_=1;var e=Jb(),t=nn();function n(r,s,l){var c=s(r);return t(r)?c:e(c,l(r))}return ly=n,ly}var cy,D_;function uI(){if(D_)return cy;D_=1;var e=cI(),t=Qb(),n=co();function r(s){return e(s,n,t)}return cy=r,cy}var uy,F_;function KH(){if(F_)return uy;F_=1;var e=cI(),t=lI(),n=_i();function r(s){return e(s,n,t)}return uy=r,uy}var dy,q_;function YH(){if(q_)return dy;q_=1;var e=ji(),t=ks(),n=e(t,"DataView");return dy=n,dy}var hy,B_;function XH(){if(B_)return hy;B_=1;var e=ji(),t=ks(),n=e(t,"Promise");return hy=n,hy}var fy,z_;function dI(){if(z_)return fy;z_=1;var e=ji(),t=ks(),n=e(t,"Set");return fy=n,fy}var py,U_;function ZH(){if(U_)return py;U_=1;var e=ji(),t=ks(),n=e(t,"WeakMap");return py=n,py}var my,H_;function ic(){if(H_)return my;H_=1;var e=YH(),t=Vb(),n=XH(),r=dI(),s=ZH(),l=Si(),c=eI(),u="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",m="[object WeakMap]",y="[object DataView]",v=c(e),S=c(t),b=c(n),_=c(r),k=c(s),j=l;return(e&&j(new e(new ArrayBuffer(1)))!=y||t&&j(new t)!=u||n&&j(n.resolve())!=p||r&&j(new r)!=h||s&&j(new s)!=m)&&(j=function(E){var C=l(E),R=C==f?E.constructor:void 0,I=R?c(R):"";if(I)switch(I){case v:return y;case S:return u;case b:return p;case _:return h;case k:return m}return C}),my=j,my}var gy,W_;function QH(){if(W_)return gy;W_=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var s=r.length,l=new r.constructor(s);return s&&typeof r[0]=="string"&&t.call(r,"index")&&(l.index=r.index,l.input=r.input),l}return gy=n,gy}var yy,V_;function hI(){if(V_)return yy;V_=1;var e=ks(),t=e.Uint8Array;return yy=t,yy}var wy,G_;function ek(){if(G_)return wy;G_=1;var e=hI();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return wy=t,wy}var vy,K_;function JH(){if(K_)return vy;K_=1;var e=ek();function t(n,r){var s=r?e(n.buffer):n.buffer;return new n.constructor(s,n.byteOffset,n.byteLength)}return vy=t,vy}var xy,Y_;function eW(){if(Y_)return xy;Y_=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return xy=t,xy}var by,X_;function tW(){if(X_)return by;X_=1;var e=ac(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(s){return n?Object(n.call(s)):{}}return by=r,by}var ky,Z_;function fI(){if(Z_)return ky;Z_=1;var e=ek();function t(n,r){var s=r?e(n.buffer):n.buffer;return new n.constructor(s,n.byteOffset,n.length)}return ky=t,ky}var Ny,Q_;function nW(){if(Q_)return Ny;Q_=1;var e=ek(),t=JH(),n=eW(),r=tW(),s=fI(),l="[object Boolean]",c="[object Date]",u="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",m="[object String]",y="[object Symbol]",v="[object ArrayBuffer]",S="[object DataView]",b="[object Float32Array]",_="[object Float64Array]",k="[object Int8Array]",j="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",R="[object Uint8ClampedArray]",I="[object Uint16Array]",$="[object Uint32Array]";function q(B,P,W){var ne=B.constructor;switch(P){case v:return e(B);case l:case c:return new ne(+B);case S:return t(B,W);case b:case _:case k:case j:case E:case C:case R:case I:case $:return s(B,W);case u:return new ne;case f:case m:return new ne(B);case p:return n(B);case h:return new ne;case y:return r(B)}}return Ny=q,Ny}var Sy,J_;function pI(){if(J_)return Sy;J_=1;var e=Br(),t=Object.create,n=(function(){function r(){}return function(s){if(!e(s))return{};if(t)return t(s);r.prototype=s;var l=new r;return r.prototype=void 0,l}})();return Sy=n,Sy}var jy,eE;function mI(){if(eE)return jy;eE=1;var e=pI(),t=Wf(),n=Hf();function r(s){return typeof s.constructor=="function"&&!n(s)?e(t(s)):{}}return jy=r,jy}var _y,tE;function rW(){if(tE)return _y;tE=1;var e=ic(),t=Us(),n="[object Map]";function r(s){return t(s)&&e(s)==n}return _y=r,_y}var Ey,nE;function sW(){if(nE)return Ey;nE=1;var e=rW(),t=Uf(),n=Xb(),r=n&&n.isMap,s=r?t(r):e;return Ey=s,Ey}var Cy,rE;function aW(){if(rE)return Cy;rE=1;var e=ic(),t=Us(),n="[object Set]";function r(s){return t(s)&&e(s)==n}return Cy=r,Cy}var Ty,sE;function oW(){if(sE)return Ty;sE=1;var e=aW(),t=Uf(),n=Xb(),r=n&&n.isSet,s=r?t(r):e;return Ty=s,Ty}var Ry,aE;function gI(){if(aE)return Ry;aE=1;var e=Ff(),t=Kb(),n=Bf(),r=zH(),s=WH(),l=sI(),c=aI(),u=VH(),f=GH(),p=uI(),h=KH(),m=ic(),y=QH(),v=nW(),S=mI(),b=nn(),_=oc(),k=sW(),j=Br(),E=oW(),C=co(),R=_i(),I=1,$=2,q=4,B="[object Arguments]",P="[object Array]",W="[object Boolean]",ne="[object Date]",ee="[object Error]",M="[object Function]",X="[object GeneratorFunction]",V="[object Map]",G="[object Number]",F="[object Object]",L="[object RegExp]",H="[object Set]",D="[object String]",K="[object Symbol]",re="[object WeakMap]",z="[object ArrayBuffer]",Z="[object DataView]",U="[object Float32Array]",ae="[object Float64Array]",le="[object Int8Array]",ge="[object Int16Array]",Ne="[object Int32Array]",Ie="[object Uint8Array]",Ge="[object Uint8ClampedArray]",Pe="[object Uint16Array]",ze="[object Uint32Array]",Re={};Re[B]=Re[P]=Re[z]=Re[Z]=Re[W]=Re[ne]=Re[U]=Re[ae]=Re[le]=Re[ge]=Re[Ne]=Re[V]=Re[G]=Re[F]=Re[L]=Re[H]=Re[D]=Re[K]=Re[Ie]=Re[Ge]=Re[Pe]=Re[ze]=!0,Re[ee]=Re[M]=Re[re]=!1;function st(ue,ce,se,be,Le,de){var fe,Ce=ce&I,pe=ce&$,_e=ce&q;if(se&&(fe=Le?se(ue,be,Le,de):se(ue)),fe!==void 0)return fe;if(!j(ue))return ue;var Ye=b(ue);if(Ye){if(fe=y(ue),!Ce)return c(ue,fe)}else{var qe=m(ue),ke=qe==M||qe==X;if(_(ue))return l(ue,Ce);if(qe==F||qe==B||ke&&!Le){if(fe=pe||ke?{}:S(ue),!Ce)return pe?f(ue,s(fe,ue)):u(ue,r(fe,ue))}else{if(!Re[qe])return Le?ue:{};fe=v(ue,qe,Ce)}}de||(de=new e);var Ae=de.get(ue);if(Ae)return Ae;de.set(ue,fe),E(ue)?ue.forEach(function(Ve){fe.add(st(Ve,ce,se,Ve,ue,de))}):k(ue)&&ue.forEach(function(Ve,rt){fe.set(rt,st(Ve,ce,se,rt,ue,de))});var Ue=_e?pe?h:p:pe?R:C,Fe=Ye?void 0:Ue(ue);return t(Fe||ue,function(Ve,rt){Fe&&(rt=Ve,Ve=ue[rt]),n(fe,rt,st(Ve,ce,se,rt,ue,de))}),fe}return Ry=st,Ry}var Ay,oE;function iW(){if(oE)return Ay;oE=1;var e=gI(),t=4;function n(r){return e(r,t)}return Ay=n,Ay}var My,iE;function tk(){if(iE)return My;iE=1;function e(t){return function(){return t}}return My=e,My}var Iy,lE;function lW(){if(lE)return Iy;lE=1;function e(t){return function(n,r,s){for(var l=-1,c=Object(n),u=s(n),f=u.length;f--;){var p=u[t?f:++l];if(r(c[p],p,c)===!1)break}return n}}return Iy=e,Iy}var $y,cE;function nk(){if(cE)return $y;cE=1;var e=lW(),t=e();return $y=t,$y}var Oy,uE;function rk(){if(uE)return Oy;uE=1;var e=nk(),t=co();function n(r,s){return r&&e(r,s,t)}return Oy=n,Oy}var Ly,dE;function cW(){if(dE)return Ly;dE=1;var e=fa();function t(n,r){return function(s,l){if(s==null)return s;if(!e(s))return n(s,l);for(var c=s.length,u=r?c:-1,f=Object(s);(r?u--:++u<c)&&l(f[u],u,f)!==!1;);return s}}return Ly=t,Ly}var Py,hE;function Vf(){if(hE)return Py;hE=1;var e=rk(),t=cW(),n=t(e);return Py=n,Py}var Dy,fE;function Ei(){if(fE)return Dy;fE=1;function e(t){return t}return Dy=e,Dy}var Fy,pE;function yI(){if(pE)return Fy;pE=1;var e=Ei();function t(n){return typeof n=="function"?n:e}return Fy=t,Fy}var qy,mE;function wI(){if(mE)return qy;mE=1;var e=Kb(),t=Vf(),n=yI(),r=nn();function s(l,c){var u=r(l)?e:t;return u(l,n(c))}return qy=s,qy}var By,gE;function vI(){return gE||(gE=1,By=wI()),By}var zy,yE;function uW(){if(yE)return zy;yE=1;var e=Vf();function t(n,r){var s=[];return e(n,function(l,c,u){r(l,c,u)&&s.push(l)}),s}return zy=t,zy}var Uy,wE;function dW(){if(wE)return Uy;wE=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Uy=t,Uy}var Hy,vE;function hW(){if(vE)return Hy;vE=1;function e(t){return this.__data__.has(t)}return Hy=e,Hy}var Wy,xE;function xI(){if(xE)return Wy;xE=1;var e=Gb(),t=dW(),n=hW();function r(s){var l=-1,c=s==null?0:s.length;for(this.__data__=new e;++l<c;)this.add(s[l])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,Wy=r,Wy}var Vy,bE;function fW(){if(bE)return Vy;bE=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 Vy=e,Vy}var Gy,kE;function bI(){if(kE)return Gy;kE=1;function e(t,n){return t.has(n)}return Gy=e,Gy}var Ky,NE;function kI(){if(NE)return Ky;NE=1;var e=xI(),t=fW(),n=bI(),r=1,s=2;function l(c,u,f,p,h,m){var y=f&r,v=c.length,S=u.length;if(v!=S&&!(y&&S>v))return!1;var b=m.get(c),_=m.get(u);if(b&&_)return b==u&&_==c;var k=-1,j=!0,E=f&s?new e:void 0;for(m.set(c,u),m.set(u,c);++k<v;){var C=c[k],R=u[k];if(p)var I=y?p(R,C,k,u,c,m):p(C,R,k,c,u,m);if(I!==void 0){if(I)continue;j=!1;break}if(E){if(!t(u,function($,q){if(!n(E,q)&&(C===$||h(C,$,f,p,m)))return E.push(q)})){j=!1;break}}else if(!(C===R||h(C,R,f,p,m))){j=!1;break}}return m.delete(c),m.delete(u),j}return Ky=l,Ky}var Yy,SE;function pW(){if(SE)return Yy;SE=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s,l){r[++n]=[l,s]}),r}return Yy=e,Yy}var Xy,jE;function sk(){if(jE)return Xy;jE=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s){r[++n]=s}),r}return Xy=e,Xy}var Zy,_E;function mW(){if(_E)return Zy;_E=1;var e=ac(),t=hI(),n=sc(),r=kI(),s=pW(),l=sk(),c=1,u=2,f="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",y="[object Number]",v="[object RegExp]",S="[object Set]",b="[object String]",_="[object Symbol]",k="[object ArrayBuffer]",j="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function R(I,$,q,B,P,W,ne){switch(q){case j:if(I.byteLength!=$.byteLength||I.byteOffset!=$.byteOffset)return!1;I=I.buffer,$=$.buffer;case k:return!(I.byteLength!=$.byteLength||!W(new t(I),new t($)));case f:case p:case y:return n(+I,+$);case h:return I.name==$.name&&I.message==$.message;case v:case b:return I==$+"";case m:var ee=s;case S:var M=B&c;if(ee||(ee=l),I.size!=$.size&&!M)return!1;var X=ne.get(I);if(X)return X==$;B|=u,ne.set(I,$);var V=r(ee(I),ee($),B,P,W,ne);return ne.delete(I),V;case _:if(C)return C.call(I)==C.call($)}return!1}return Zy=R,Zy}var Qy,EE;function gW(){if(EE)return Qy;EE=1;var e=uI(),t=1,n=Object.prototype,r=n.hasOwnProperty;function s(l,c,u,f,p,h){var m=u&t,y=e(l),v=y.length,S=e(c),b=S.length;if(v!=b&&!m)return!1;for(var _=v;_--;){var k=y[_];if(!(m?k in c:r.call(c,k)))return!1}var j=h.get(l),E=h.get(c);if(j&&E)return j==c&&E==l;var C=!0;h.set(l,c),h.set(c,l);for(var R=m;++_<v;){k=y[_];var I=l[k],$=c[k];if(f)var q=m?f($,I,k,c,l,h):f(I,$,k,l,c,h);if(!(q===void 0?I===$||p(I,$,u,f,h):q)){C=!1;break}R||(R=k=="constructor")}if(C&&!R){var B=l.constructor,P=c.constructor;B!=P&&"constructor"in l&&"constructor"in c&&!(typeof B=="function"&&B instanceof B&&typeof P=="function"&&P instanceof P)&&(C=!1)}return h.delete(l),h.delete(c),C}return Qy=s,Qy}var Jy,CE;function yW(){if(CE)return Jy;CE=1;var e=Ff(),t=kI(),n=mW(),r=gW(),s=ic(),l=nn(),c=oc(),u=Yu(),f=1,p="[object Arguments]",h="[object Array]",m="[object Object]",y=Object.prototype,v=y.hasOwnProperty;function S(b,_,k,j,E,C){var R=l(b),I=l(_),$=R?h:s(b),q=I?h:s(_);$=$==p?m:$,q=q==p?m:q;var B=$==m,P=q==m,W=$==q;if(W&&c(b)){if(!c(_))return!1;R=!0,B=!1}if(W&&!B)return C||(C=new e),R||u(b)?t(b,_,k,j,E,C):n(b,_,$,k,j,E,C);if(!(k&f)){var ne=B&&v.call(b,"__wrapped__"),ee=P&&v.call(_,"__wrapped__");if(ne||ee){var M=ne?b.value():b,X=ee?_.value():_;return C||(C=new e),E(M,X,k,j,C)}}return W?(C||(C=new e),r(b,_,k,j,E,C)):!1}return Jy=S,Jy}var ew,TE;function NI(){if(TE)return ew;TE=1;var e=yW(),t=Us();function n(r,s,l,c,u){return r===s?!0:r==null||s==null||!t(r)&&!t(s)?r!==r&&s!==s:e(r,s,l,c,n,u)}return ew=n,ew}var tw,RE;function wW(){if(RE)return tw;RE=1;var e=Ff(),t=NI(),n=1,r=2;function s(l,c,u,f){var p=u.length,h=p,m=!f;if(l==null)return!h;for(l=Object(l);p--;){var y=u[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<h;){y=u[p];var v=y[0],S=l[v],b=y[1];if(m&&y[2]){if(S===void 0&&!(v in l))return!1}else{var _=new e;if(f)var k=f(S,b,v,l,c,_);if(!(k===void 0?t(b,S,n|r,f,_):k))return!1}}return!0}return tw=s,tw}var nw,AE;function SI(){if(AE)return nw;AE=1;var e=Br();function t(n){return n===n&&!e(n)}return nw=t,nw}var rw,ME;function vW(){if(ME)return rw;ME=1;var e=SI(),t=co();function n(r){for(var s=t(r),l=s.length;l--;){var c=s[l],u=r[c];s[l]=[c,u,e(u)]}return s}return rw=n,rw}var sw,IE;function jI(){if(IE)return sw;IE=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return sw=e,sw}var aw,$E;function xW(){if($E)return aw;$E=1;var e=wW(),t=vW(),n=jI();function r(s){var l=t(s);return l.length==1&&l[0][2]?n(l[0][0],l[0][1]):function(c){return c===s||e(c,s,l)}}return aw=r,aw}var ow,OE;function lc(){if(OE)return ow;OE=1;var e=Si(),t=Us(),n="[object Symbol]";function r(s){return typeof s=="symbol"||t(s)&&e(s)==n}return ow=r,ow}var iw,LE;function ak(){if(LE)return iw;LE=1;var e=nn(),t=lc(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function s(l,c){if(e(l))return!1;var u=typeof l;return u=="number"||u=="symbol"||u=="boolean"||l==null||t(l)?!0:r.test(l)||!n.test(l)||c!=null&&l in Object(c)}return iw=s,iw}var lw,PE;function bW(){if(PE)return lw;PE=1;var e=Gb(),t="Expected a function";function n(r,s){if(typeof r!="function"||s!=null&&typeof s!="function")throw new TypeError(t);var l=function(){var c=arguments,u=s?s.apply(this,c):c[0],f=l.cache;if(f.has(u))return f.get(u);var p=r.apply(this,c);return l.cache=f.set(u,p)||f,p};return l.cache=new(n.Cache||e),l}return n.Cache=e,lw=n,lw}var cw,DE;function kW(){if(DE)return cw;DE=1;var e=bW(),t=500;function n(r){var s=e(r,function(c){return l.size===t&&l.clear(),c}),l=s.cache;return s}return cw=n,cw}var uw,FE;function NW(){if(FE)return uw;FE=1;var e=kW(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(s){var l=[];return s.charCodeAt(0)===46&&l.push(""),s.replace(t,function(c,u,f,p){l.push(f?p.replace(n,"$1"):u||c)}),l});return uw=r,uw}var dw,qE;function Gf(){if(qE)return dw;qE=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,l=Array(s);++r<s;)l[r]=n(t[r],r,t);return l}return dw=e,dw}var hw,BE;function SW(){if(BE)return hw;BE=1;var e=ac(),t=Gf(),n=nn(),r=lc(),s=e?e.prototype:void 0,l=s?s.toString:void 0;function c(u){if(typeof u=="string")return u;if(n(u))return t(u,c)+"";if(r(u))return l?l.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return hw=c,hw}var fw,zE;function _I(){if(zE)return fw;zE=1;var e=SW();function t(n){return n==null?"":e(n)}return fw=t,fw}var pw,UE;function Kf(){if(UE)return pw;UE=1;var e=nn(),t=ak(),n=NW(),r=_I();function s(l,c){return e(l)?l:t(l,c)?[l]:n(r(l))}return pw=s,pw}var mw,HE;function Xu(){if(HE)return mw;HE=1;var e=lc();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return mw=t,mw}var gw,WE;function Yf(){if(WE)return gw;WE=1;var e=Kf(),t=Xu();function n(r,s){s=e(s,r);for(var l=0,c=s.length;r!=null&&l<c;)r=r[t(s[l++])];return l&&l==c?r:void 0}return gw=n,gw}var yw,VE;function jW(){if(VE)return yw;VE=1;var e=Yf();function t(n,r,s){var l=n==null?void 0:e(n,r);return l===void 0?s:l}return yw=t,yw}var ww,GE;function _W(){if(GE)return ww;GE=1;function e(t,n){return t!=null&&n in Object(t)}return ww=e,ww}var vw,KE;function EI(){if(KE)return vw;KE=1;var e=Kf(),t=Ku(),n=nn(),r=zf(),s=Yb(),l=Xu();function c(u,f,p){f=e(f,u);for(var h=-1,m=f.length,y=!1;++h<m;){var v=l(f[h]);if(!(y=u!=null&&p(u,v)))break;u=u[v]}return y||++h!=m?y:(m=u==null?0:u.length,!!m&&s(m)&&r(v,m)&&(n(u)||t(u)))}return vw=c,vw}var xw,YE;function CI(){if(YE)return xw;YE=1;var e=_W(),t=EI();function n(r,s){return r!=null&&t(r,s,e)}return xw=n,xw}var bw,XE;function EW(){if(XE)return bw;XE=1;var e=NI(),t=jW(),n=CI(),r=ak(),s=SI(),l=jI(),c=Xu(),u=1,f=2;function p(h,m){return r(h)&&s(m)?l(c(h),m):function(y){var v=t(y,h);return v===void 0&&v===m?n(y,h):e(m,v,u|f)}}return bw=p,bw}var kw,ZE;function TI(){if(ZE)return kw;ZE=1;function e(t){return function(n){return n==null?void 0:n[t]}}return kw=e,kw}var Nw,QE;function CW(){if(QE)return Nw;QE=1;var e=Yf();function t(n){return function(r){return e(r,n)}}return Nw=t,Nw}var Sw,JE;function TW(){if(JE)return Sw;JE=1;var e=TI(),t=CW(),n=ak(),r=Xu();function s(l){return n(l)?e(r(l)):t(l)}return Sw=s,Sw}var jw,eC;function pa(){if(eC)return jw;eC=1;var e=xW(),t=EW(),n=Ei(),r=nn(),s=TW();function l(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?r(c)?t(c[0],c[1]):e(c):s(c)}return jw=l,jw}var _w,tC;function RI(){if(tC)return _w;tC=1;var e=oI(),t=uW(),n=pa(),r=nn();function s(l,c){var u=r(l)?e:t;return u(l,n(c,3))}return _w=s,_w}var Ew,nC;function RW(){if(nC)return Ew;nC=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,s){return r!=null&&t.call(r,s)}return Ew=n,Ew}var Cw,rC;function AI(){if(rC)return Cw;rC=1;var e=RW(),t=EI();function n(r,s){return r!=null&&t(r,s,e)}return Cw=n,Cw}var Tw,sC;function AW(){if(sC)return Tw;sC=1;var e=Zb(),t=ic(),n=Ku(),r=nn(),s=fa(),l=oc(),c=Hf(),u=Yu(),f="[object Map]",p="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function y(v){if(v==null)return!0;if(s(v)&&(r(v)||typeof v=="string"||typeof v.splice=="function"||l(v)||u(v)||n(v)))return!v.length;var S=t(v);if(S==f||S==p)return!v.size;if(c(v))return!e(v).length;for(var b in v)if(m.call(v,b))return!1;return!0}return Tw=y,Tw}var Rw,aC;function MI(){if(aC)return Rw;aC=1;function e(t){return t===void 0}return Rw=e,Rw}var Aw,oC;function II(){if(oC)return Aw;oC=1;var e=Vf(),t=fa();function n(r,s){var l=-1,c=t(r)?Array(r.length):[];return e(r,function(u,f,p){c[++l]=s(u,f,p)}),c}return Aw=n,Aw}var Mw,iC;function $I(){if(iC)return Mw;iC=1;var e=Gf(),t=pa(),n=II(),r=nn();function s(l,c){var u=r(l)?e:n;return u(l,t(c,3))}return Mw=s,Mw}var Iw,lC;function MW(){if(lC)return Iw;lC=1;function e(t,n,r,s){var l=-1,c=t==null?0:t.length;for(s&&c&&(r=t[++l]);++l<c;)r=n(r,t[l],l,t);return r}return Iw=e,Iw}var $w,cC;function IW(){if(cC)return $w;cC=1;function e(t,n,r,s,l){return l(t,function(c,u,f){r=s?(s=!1,c):n(r,c,u,f)}),r}return $w=e,$w}var Ow,uC;function OI(){if(uC)return Ow;uC=1;var e=MW(),t=Vf(),n=pa(),r=IW(),s=nn();function l(c,u,f){var p=s(c)?e:r,h=arguments.length<3;return p(c,n(u,4),f,h,t)}return Ow=l,Ow}var Lw,dC;function $W(){if(dC)return Lw;dC=1;var e=Si(),t=nn(),n=Us(),r="[object String]";function s(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==r}return Lw=s,Lw}var Pw,hC;function OW(){if(hC)return Pw;hC=1;var e=TI(),t=e("length");return Pw=t,Pw}var Dw,fC;function LW(){if(fC)return Dw;fC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,l="\\ufe0e\\ufe0f",c="\\u200d",u=RegExp("["+c+e+s+l+"]");function f(p){return u.test(p)}return Dw=f,Dw}var Fw,pC;function PW(){if(pC)return Fw;pC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,l="\\ufe0e\\ufe0f",c="["+e+"]",u="["+s+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+f+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",S=p+"?",b="["+l+"]?",_="(?:"+v+"(?:"+[h,m,y].join("|")+")"+b+S+")*",k=b+S+_,j="(?:"+[h+u+"?",u,m,y,c].join("|")+")",E=RegExp(f+"(?="+f+")|"+j+k,"g");function C(R){for(var I=E.lastIndex=0;E.test(R);)++I;return I}return Fw=C,Fw}var qw,mC;function DW(){if(mC)return qw;mC=1;var e=OW(),t=LW(),n=PW();function r(s){return t(s)?n(s):e(s)}return qw=r,qw}var Bw,gC;function FW(){if(gC)return Bw;gC=1;var e=Zb(),t=ic(),n=fa(),r=$W(),s=DW(),l="[object Map]",c="[object Set]";function u(f){if(f==null)return 0;if(n(f))return r(f)?s(f):f.length;var p=t(f);return p==l||p==c?f.size:e(f).length}return Bw=u,Bw}var zw,yC;function qW(){if(yC)return zw;yC=1;var e=Kb(),t=pI(),n=rk(),r=pa(),s=Wf(),l=nn(),c=oc(),u=Vu(),f=Br(),p=Yu();function h(m,y,v){var S=l(m),b=S||c(m)||p(m);if(y=r(y,4),v==null){var _=m&&m.constructor;b?v=S?new _:[]:f(m)?v=u(_)?t(s(m)):{}:v={}}return(b?e:n)(m,function(k,j,E){return y(v,k,j,E)}),v}return zw=h,zw}var Uw,wC;function BW(){if(wC)return Uw;wC=1;var e=ac(),t=Ku(),n=nn(),r=e?e.isConcatSpreadable:void 0;function s(l){return n(l)||t(l)||!!(r&&l&&l[r])}return Uw=s,Uw}var Hw,vC;function ok(){if(vC)return Hw;vC=1;var e=Jb(),t=BW();function n(r,s,l,c,u){var f=-1,p=r.length;for(l||(l=t),u||(u=[]);++f<p;){var h=r[f];s>0&&l(h)?s>1?n(h,s-1,l,c,u):e(u,h):c||(u[u.length]=h)}return u}return Hw=n,Hw}var Ww,xC;function zW(){if(xC)return Ww;xC=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 Ww=e,Ww}var Vw,bC;function LI(){if(bC)return Vw;bC=1;var e=zW(),t=Math.max;function n(r,s,l){return s=t(s===void 0?r.length-1:s,0),function(){for(var c=arguments,u=-1,f=t(c.length-s,0),p=Array(f);++u<f;)p[u]=c[s+u];u=-1;for(var h=Array(s+1);++u<s;)h[u]=c[u];return h[s]=l(p),e(r,this,h)}}return Vw=n,Vw}var Gw,kC;function UW(){if(kC)return Gw;kC=1;var e=tk(),t=tI(),n=Ei(),r=t?function(s,l){return t(s,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:n;return Gw=r,Gw}var Kw,NC;function HW(){if(NC)return Kw;NC=1;var e=800,t=16,n=Date.now;function r(s){var l=0,c=0;return function(){var u=n(),f=t-(u-c);if(c=u,f>0){if(++l>=e)return arguments[0]}else l=0;return s.apply(void 0,arguments)}}return Kw=r,Kw}var Yw,SC;function PI(){if(SC)return Yw;SC=1;var e=UW(),t=HW(),n=t(e);return Yw=n,Yw}var Xw,jC;function Xf(){if(jC)return Xw;jC=1;var e=Ei(),t=LI(),n=PI();function r(s,l){return n(t(s,l,e),s+"")}return Xw=r,Xw}var Zw,_C;function DI(){if(_C)return Zw;_C=1;function e(t,n,r,s){for(var l=t.length,c=r+(s?1:-1);s?c--:++c<l;)if(n(t[c],c,t))return c;return-1}return Zw=e,Zw}var Qw,EC;function WW(){if(EC)return Qw;EC=1;function e(t){return t!==t}return Qw=e,Qw}var Jw,CC;function VW(){if(CC)return Jw;CC=1;function e(t,n,r){for(var s=r-1,l=t.length;++s<l;)if(t[s]===n)return s;return-1}return Jw=e,Jw}var ev,TC;function GW(){if(TC)return ev;TC=1;var e=DI(),t=WW(),n=VW();function r(s,l,c){return l===l?n(s,l,c):e(s,t,c)}return ev=r,ev}var tv,RC;function KW(){if(RC)return tv;RC=1;var e=GW();function t(n,r){var s=n==null?0:n.length;return!!s&&e(n,r,0)>-1}return tv=t,tv}var nv,AC;function YW(){if(AC)return nv;AC=1;function e(t,n,r){for(var s=-1,l=t==null?0:t.length;++s<l;)if(r(n,t[s]))return!0;return!1}return nv=e,nv}var rv,MC;function XW(){if(MC)return rv;MC=1;function e(){}return rv=e,rv}var sv,IC;function ZW(){if(IC)return sv;IC=1;var e=dI(),t=XW(),n=sk(),r=1/0,s=e&&1/n(new e([,-0]))[1]==r?function(l){return new e(l)}:t;return sv=s,sv}var av,$C;function QW(){if($C)return av;$C=1;var e=xI(),t=KW(),n=YW(),r=bI(),s=ZW(),l=sk(),c=200;function u(f,p,h){var m=-1,y=t,v=f.length,S=!0,b=[],_=b;if(h)S=!1,y=n;else if(v>=c){var k=p?null:s(f);if(k)return l(k);S=!1,y=r,_=new e}else _=p?[]:b;e:for(;++m<v;){var j=f[m],E=p?p(j):j;if(j=h||j!==0?j:0,S&&E===E){for(var C=_.length;C--;)if(_[C]===E)continue e;p&&_.push(E),b.push(j)}else y(_,E,h)||(_!==b&&_.push(E),b.push(j))}return b}return av=u,av}var ov,OC;function FI(){if(OC)return ov;OC=1;var e=fa(),t=Us();function n(r){return t(r)&&e(r)}return ov=n,ov}var iv,LC;function JW(){if(LC)return iv;LC=1;var e=ok(),t=Xf(),n=QW(),r=FI(),s=t(function(l){return n(e(l,1,r,!0))});return iv=s,iv}var lv,PC;function e7(){if(PC)return lv;PC=1;var e=Gf();function t(n,r){return e(r,function(s){return n[s]})}return lv=t,lv}var cv,DC;function qI(){if(DC)return cv;DC=1;var e=e7(),t=co();function n(r){return r==null?[]:e(r,t(r))}return cv=n,cv}var uv,FC;function zr(){if(FC)return uv;FC=1;var e;if(typeof Wb=="function")try{e={clone:iW(),constant:tk(),each:vI(),filter:RI(),has:AI(),isArray:nn(),isEmpty:AW(),isFunction:Vu(),isUndefined:MI(),keys:co(),map:$I(),reduce:OI(),size:FW(),transform:qW(),union:JW(),values:qI()}}catch{}return e||(e=window._),uv=e,uv}var dv,qC;function ik(){if(qC)return dv;qC=1;var e=zr();dv=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 y=arguments,v=this;return e.each(h,function(S){y.length>1?v.setNode(S,m):v.setNode(S)}),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 y=function(v){m.removeEdge(m._edgeObjs[v])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(v){m.setParent(v)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},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 y=m;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},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 y=this;e.each(this._nodes,function(b,_){h(_)&&m.setNode(_,b)}),e.each(this._edgeObjs,function(b){m.hasNode(b.v)&&m.hasNode(b.w)&&m.setEdge(b,y.edge(b))});var v={};function S(b){var _=y.parent(b);return _===void 0||m.hasNode(_)?(v[b]=_,_):_ in v?v[_]:S(_)}return this._isCompound&&e.each(m.nodes(),function(b){m.setParent(b,S(b))}),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 y=this,v=arguments;return e.reduce(h,function(S,b){return v.length>1?y.setEdge(S,b,m):y.setEdge(S,b),b}),this},s.prototype.setEdge=function(){var h,m,y,v,S=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(h=b.v,m=b.w,y=b.name,arguments.length===2&&(v=arguments[1],S=!0)):(h=b,m=arguments[1],y=arguments[3],arguments.length>2&&(v=arguments[2],S=!0)),h=""+h,m=""+m,e.isUndefined(y)||(y=""+y);var _=u(this._isDirected,h,m,y);if(e.has(this._edgeLabels,_))return S&&(this._edgeLabels[_]=v),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[_]=S?v:this._defaultEdgeLabelFn(h,m,y);var k=f(this._isDirected,h,m,y);return h=k.v,m=k.w,Object.freeze(k),this._edgeObjs[_]=k,l(this._preds[m],h),l(this._sucs[h],m),this._in[m][_]=k,this._out[h][_]=k,this._edgeCount++,this},s.prototype.edge=function(h,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return this._edgeLabels[v]},s.prototype.hasEdge=function(h,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return e.has(this._edgeLabels,v)},s.prototype.removeEdge=function(h,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y),S=this._edgeObjs[v];return S&&(h=S.v,m=S.w,delete this._edgeLabels[v],delete this._edgeObjs[v],c(this._preds[m],h),c(this._sucs[h],m),delete this._in[m][v],delete this._out[h][v],this._edgeCount--),this},s.prototype.inEdges=function(h,m){var y=this._in[h];if(y){var v=e.values(y);return m?e.filter(v,function(S){return S.v===m}):v}},s.prototype.outEdges=function(h,m){var y=this._out[h];if(y){var v=e.values(y);return m?e.filter(v,function(S){return S.w===m}):v}},s.prototype.nodeEdges=function(h,m){var y=this.inEdges(h,m);if(y)return y.concat(this.outEdges(h,m))};function l(h,m){h[m]?h[m]++:h[m]=1}function c(h,m){--h[m]||delete h[m]}function u(h,m,y,v){var S=""+m,b=""+y;if(!h&&S>b){var _=S;S=b,b=_}return S+r+b+r+(e.isUndefined(v)?t:v)}function f(h,m,y,v){var S=""+m,b=""+y;if(!h&&S>b){var _=S;S=b,b=_}var k={v:S,w:b};return v&&(k.name=v),k}function p(h,m){return u(h,m.v,m.w,m.name)}return dv}var hv,BC;function t7(){return BC||(BC=1,hv="2.1.8"),hv}var fv,zC;function n7(){return zC||(zC=1,fv={Graph:ik(),version:t7()}),fv}var pv,UC;function r7(){if(UC)return pv;UC=1;var e=zr(),t=ik();pv={write:n,read:l};function n(c){var u={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:r(c),edges:s(c)};return e.isUndefined(c.graph())||(u.value=e.clone(c.graph())),u}function r(c){return e.map(c.nodes(),function(u){var f=c.node(u),p=c.parent(u),h={v:u};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function s(c){return e.map(c.edges(),function(u){var f=c.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(f)||(p.value=f),p})}function l(c){var u=new t(c.options).setGraph(c.value);return e.each(c.nodes,function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),e.each(c.edges,function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return pv}var mv,HC;function s7(){if(HC)return mv;HC=1;var e=zr();mv=t;function t(n){var r={},s=[],l;function c(u){e.has(r,u)||(r[u]=!0,l.push(u),e.each(n.successors(u),c),e.each(n.predecessors(u),c))}return e.each(n.nodes(),function(u){l=[],c(u),l.length&&s.push(l)}),s}return mv}var gv,WC;function BI(){if(WC)return gv;WC=1;var e=zr();gv=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 l=this._arr,c=l.length;return s[n]=c,l.push({key:n,priority:r}),this._decrease(c),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,r){var 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,l=s+1,c=n;s<r.length&&(c=r[s].priority<r[c].priority?s:c,l<r.length&&(c=r[l].priority<r[c].priority?l:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var r=this._arr,s=r[n].priority,l;n!==0&&(l=n>>1,!(r[l].priority<s));)this._swap(n,l),n=l},t.prototype._swap=function(n,r){var s=this._arr,l=this._keyIndices,c=s[n],u=s[r];s[n]=u,s[r]=c,l[u.key]=n,l[c.key]=r},gv}var yv,VC;function zI(){if(VC)return yv;VC=1;var e=zr(),t=BI();yv=r;var n=e.constant(1);function r(l,c,u,f){return s(l,String(c),u||n,f||function(p){return l.outEdges(p)})}function s(l,c,u,f){var p={},h=new t,m,y,v=function(S){var b=S.v!==m?S.v:S.w,_=p[b],k=u(S),j=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+S+" Weight: "+k);j<_.distance&&(_.distance=j,_.predecessor=m,h.decrease(b,j))};for(l.nodes().forEach(function(S){var b=S===c?0:Number.POSITIVE_INFINITY;p[S]={distance:b},h.add(S,b)});h.size()>0&&(m=h.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(v);return p}return yv}var wv,GC;function a7(){if(GC)return wv;GC=1;var e=zI(),t=zr();wv=n;function n(r,s,l){return t.transform(r.nodes(),function(c,u){c[u]=e(r,u,s,l)},{})}return wv}var vv,KC;function UI(){if(KC)return vv;KC=1;var e=zr();vv=t;function t(n){var r=0,s=[],l={},c=[];function u(f){var p=l[f]={onStack:!0,lowlink:r,index:r++};if(s.push(f),n.successors(f).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var h=[],m;do m=s.pop(),l[m].onStack=!1,h.push(m);while(f!==m);c.push(h)}}return n.nodes().forEach(function(f){e.has(l,f)||u(f)}),c}return vv}var xv,YC;function o7(){if(YC)return xv;YC=1;var e=zr(),t=UI();xv=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 xv}var bv,XC;function i7(){if(XC)return bv;XC=1;var e=zr();bv=n;var t=e.constant(1);function n(s,l,c){return r(s,l||t,c||function(u){return s.outEdges(u)})}function r(s,l,c){var u={},f=s.nodes();return f.forEach(function(p){u[p]={},u[p][p]={distance:0},f.forEach(function(h){p!==h&&(u[p][h]={distance:Number.POSITIVE_INFINITY})}),c(p).forEach(function(h){var m=h.v===p?h.w:h.v,y=l(h);u[p][m]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=u[p];f.forEach(function(m){var y=u[m];f.forEach(function(v){var S=y[p],b=h[v],_=y[v],k=S.distance+b.distance;k<_.distance&&(_.distance=k,_.predecessor=b.predecessor)})})}),u}return bv}var kv,ZC;function HI(){if(ZC)return kv;ZC=1;var e=zr();kv=t,t.CycleException=n;function t(r){var s={},l={},c=[];function u(f){if(e.has(l,f))throw new n;e.has(s,f)||(l[f]=!0,s[f]=!0,e.each(r.predecessors(f),u),delete l[f],c.push(f))}if(e.each(r.sinks(),u),e.size(s)!==r.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,kv}var Nv,QC;function l7(){if(QC)return Nv;QC=1;var e=HI();Nv=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return Nv}var Sv,JC;function WI(){if(JC)return Sv;JC=1;var e=zr();Sv=t;function t(r,s,l){e.isArray(s)||(s=[s]);var c=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],f={};return e.each(s,function(p){if(!r.hasNode(p))throw new Error("Graph does not have node: "+p);n(r,p,l==="post",f,c,u)}),u}function n(r,s,l,c,u,f){e.has(c,s)||(c[s]=!0,l||f.push(s),e.each(u(s),function(p){n(r,p,l,c,u,f)}),l&&f.push(s))}return Sv}var jv,eT;function c7(){if(eT)return jv;eT=1;var e=WI();jv=t;function t(n,r){return e(n,r,"post")}return jv}var _v,tT;function u7(){if(tT)return _v;tT=1;var e=WI();_v=t;function t(n,r){return e(n,r,"pre")}return _v}var Ev,nT;function d7(){if(nT)return Ev;nT=1;var e=zr(),t=ik(),n=BI();Ev=r;function r(s,l){var c=new t,u={},f=new n,p;function h(y){var v=y.v===p?y.w:y.v,S=f.priority(v);if(S!==void 0){var b=l(y);b<S&&(u[v]=p,f.decrease(v,b))}}if(s.nodeCount()===0)return c;e.each(s.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),f.decrease(s.nodes()[0],0);for(var m=!1;f.size()>0;){if(p=f.removeMin(),e.has(u,p))c.setEdge(p,u[p]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(p).forEach(h)}return c}return Ev}var Cv,rT;function h7(){return rT||(rT=1,Cv={components:s7(),dijkstra:zI(),dijkstraAll:a7(),findCycles:o7(),floydWarshall:i7(),isAcyclic:l7(),postorder:c7(),preorder:u7(),prim:d7(),tarjan:UI(),topsort:HI()}),Cv}var Tv,sT;function f7(){if(sT)return Tv;sT=1;var e=n7();return Tv={Graph:e.Graph,json:r7(),alg:h7(),version:e.version},Tv}var Rv,aT;function xs(){if(aT)return Rv;aT=1;var e;if(typeof Wb=="function")try{e=f7()}catch{}return e||(e=window.graphlib),Rv=e,Rv}var Av,oT;function p7(){if(oT)return Av;oT=1;var e=gI(),t=1,n=4;function r(s){return e(s,t|n)}return Av=r,Av}var Mv,iT;function Zf(){if(iT)return Mv;iT=1;var e=sc(),t=fa(),n=zf(),r=Br();function s(l,c,u){if(!r(u))return!1;var f=typeof c;return(f=="number"?t(u)&&n(c,u.length):f=="string"&&c in u)?e(u[c],l):!1}return Mv=s,Mv}var Iv,lT;function m7(){if(lT)return Iv;lT=1;var e=Xf(),t=sc(),n=Zf(),r=_i(),s=Object.prototype,l=s.hasOwnProperty,c=e(function(u,f){u=Object(u);var p=-1,h=f.length,m=h>2?f[2]:void 0;for(m&&n(f[0],f[1],m)&&(h=1);++p<h;)for(var y=f[p],v=r(y),S=-1,b=v.length;++S<b;){var _=v[S],k=u[_];(k===void 0||t(k,s[_])&&!l.call(u,_))&&(u[_]=y[_])}return u});return Iv=c,Iv}var $v,cT;function g7(){if(cT)return $v;cT=1;var e=pa(),t=fa(),n=co();function r(s){return function(l,c,u){var f=Object(l);if(!t(l)){var p=e(c,3);l=n(l),c=function(m){return p(f[m],m,f)}}var h=s(l,c,u);return h>-1?f[p?l[h]:h]:void 0}}return $v=r,$v}var Ov,uT;function y7(){if(uT)return Ov;uT=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Ov=t,Ov}var Lv,dT;function w7(){if(dT)return Lv;dT=1;var e=y7(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Lv=n,Lv}var Pv,hT;function v7(){if(hT)return Pv;hT=1;var e=w7(),t=Br(),n=lc(),r=NaN,s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return r;if(t(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=t(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||c.test(p)?u(p.slice(2),m?2:8):s.test(p)?r:+p}return Pv=f,Pv}var Dv,fT;function VI(){if(fT)return Dv;fT=1;var e=v7(),t=1/0,n=17976931348623157e292;function r(s){if(!s)return s===0?s:0;if(s=e(s),s===t||s===-t){var l=s<0?-1:1;return l*n}return s===s?s:0}return Dv=r,Dv}var Fv,pT;function x7(){if(pT)return Fv;pT=1;var e=VI();function t(n){var r=e(n),s=r%1;return r===r?s?r-s:r:0}return Fv=t,Fv}var qv,mT;function b7(){if(mT)return qv;mT=1;var e=DI(),t=pa(),n=x7(),r=Math.max;function s(l,c,u){var f=l==null?0:l.length;if(!f)return-1;var p=u==null?0:n(u);return p<0&&(p=r(f+p,0)),e(l,t(c,3),p)}return qv=s,qv}var Bv,gT;function k7(){if(gT)return Bv;gT=1;var e=g7(),t=b7(),n=e(t);return Bv=n,Bv}var zv,yT;function GI(){if(yT)return zv;yT=1;var e=ok();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return zv=t,zv}var Uv,wT;function N7(){if(wT)return Uv;wT=1;var e=nk(),t=yI(),n=_i();function r(s,l){return s==null?s:e(s,t(l),n)}return Uv=r,Uv}var Hv,vT;function S7(){if(vT)return Hv;vT=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Hv=e,Hv}var Wv,xT;function j7(){if(xT)return Wv;xT=1;var e=qf(),t=rk(),n=pa();function r(s,l){var c={};return l=n(l,3),t(s,function(u,f,p){e(c,f,l(u,f,p))}),c}return Wv=r,Wv}var Vv,bT;function lk(){if(bT)return Vv;bT=1;var e=lc();function t(n,r,s){for(var l=-1,c=n.length;++l<c;){var u=n[l],f=r(u);if(f!=null&&(p===void 0?f===f&&!e(f):s(f,p)))var p=f,h=u}return h}return Vv=t,Vv}var Gv,kT;function _7(){if(kT)return Gv;kT=1;function e(t,n){return t>n}return Gv=e,Gv}var Kv,NT;function E7(){if(NT)return Kv;NT=1;var e=lk(),t=_7(),n=Ei();function r(s){return s&&s.length?e(s,n,t):void 0}return Kv=r,Kv}var Yv,ST;function KI(){if(ST)return Yv;ST=1;var e=qf(),t=sc();function n(r,s,l){(l!==void 0&&!t(r[s],l)||l===void 0&&!(s in r))&&e(r,s,l)}return Yv=n,Yv}var Xv,jT;function C7(){if(jT)return Xv;jT=1;var e=Si(),t=Wf(),n=Us(),r="[object Object]",s=Function.prototype,l=Object.prototype,c=s.toString,u=l.hasOwnProperty,f=c.call(Object);function p(h){if(!n(h)||e(h)!=r)return!1;var m=t(h);if(m===null)return!0;var y=u.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&c.call(y)==f}return Xv=p,Xv}var Zv,_T;function YI(){if(_T)return Zv;_T=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Zv=e,Zv}var Qv,ET;function T7(){if(ET)return Qv;ET=1;var e=Gu(),t=_i();function n(r){return e(r,t(r))}return Qv=n,Qv}var Jv,CT;function R7(){if(CT)return Jv;CT=1;var e=KI(),t=sI(),n=fI(),r=aI(),s=mI(),l=Ku(),c=nn(),u=FI(),f=oc(),p=Vu(),h=Br(),m=C7(),y=Yu(),v=YI(),S=T7();function b(_,k,j,E,C,R,I){var $=v(_,j),q=v(k,j),B=I.get(q);if(B){e(_,j,B);return}var P=R?R($,q,j+"",_,k,I):void 0,W=P===void 0;if(W){var ne=c(q),ee=!ne&&f(q),M=!ne&&!ee&&y(q);P=q,ne||ee||M?c($)?P=$:u($)?P=r($):ee?(W=!1,P=t(q,!0)):M?(W=!1,P=n(q,!0)):P=[]:m(q)||l(q)?(P=$,l($)?P=S($):(!h($)||p($))&&(P=s(q))):W=!1}W&&(I.set(q,P),C(P,q,E,R,I),I.delete(q)),e(_,j,P)}return Jv=b,Jv}var ex,TT;function A7(){if(TT)return ex;TT=1;var e=Ff(),t=KI(),n=nk(),r=R7(),s=Br(),l=_i(),c=YI();function u(f,p,h,m,y){f!==p&&n(p,function(v,S){if(y||(y=new e),s(v))r(f,p,S,h,u,m,y);else{var b=m?m(c(f,S),v,S+"",f,p,y):void 0;b===void 0&&(b=v),t(f,S,b)}},l)}return ex=u,ex}var tx,RT;function M7(){if(RT)return tx;RT=1;var e=Xf(),t=Zf();function n(r){return e(function(s,l){var c=-1,u=l.length,f=u>1?l[u-1]:void 0,p=u>2?l[2]:void 0;for(f=r.length>3&&typeof f=="function"?(u--,f):void 0,p&&t(l[0],l[1],p)&&(f=u<3?void 0:f,u=1),s=Object(s);++c<u;){var h=l[c];h&&r(s,h,c,f)}return s})}return tx=n,tx}var nx,AT;function I7(){if(AT)return nx;AT=1;var e=A7(),t=M7(),n=t(function(r,s,l){e(r,s,l)});return nx=n,nx}var rx,MT;function XI(){if(MT)return rx;MT=1;function e(t,n){return t<n}return rx=e,rx}var sx,IT;function $7(){if(IT)return sx;IT=1;var e=lk(),t=XI(),n=Ei();function r(s){return s&&s.length?e(s,n,t):void 0}return sx=r,sx}var ax,$T;function O7(){if($T)return ax;$T=1;var e=lk(),t=pa(),n=XI();function r(s,l){return s&&s.length?e(s,t(l,2),n):void 0}return ax=r,ax}var ox,OT;function L7(){if(OT)return ox;OT=1;var e=ks(),t=function(){return e.Date.now()};return ox=t,ox}var ix,LT;function P7(){if(LT)return ix;LT=1;var e=Bf(),t=Kf(),n=zf(),r=Br(),s=Xu();function l(c,u,f,p){if(!r(c))return c;u=t(u,c);for(var h=-1,m=u.length,y=m-1,v=c;v!=null&&++h<m;){var S=s(u[h]),b=f;if(S==="__proto__"||S==="constructor"||S==="prototype")return c;if(h!=y){var _=v[S];b=p?p(_,S,v):void 0,b===void 0&&(b=r(_)?_:n(u[h+1])?[]:{})}e(v,S,b),v=v[S]}return c}return ix=l,ix}var lx,PT;function D7(){if(PT)return lx;PT=1;var e=Yf(),t=P7(),n=Kf();function r(s,l,c){for(var u=-1,f=l.length,p={};++u<f;){var h=l[u],m=e(s,h);c(m,h)&&t(p,n(h,s),m)}return p}return lx=r,lx}var cx,DT;function F7(){if(DT)return cx;DT=1;var e=D7(),t=CI();function n(r,s){return e(r,s,function(l,c){return t(r,c)})}return cx=n,cx}var ux,FT;function q7(){if(FT)return ux;FT=1;var e=GI(),t=LI(),n=PI();function r(s){return n(t(s,void 0,e),s+"")}return ux=r,ux}var dx,qT;function B7(){if(qT)return dx;qT=1;var e=F7(),t=q7(),n=t(function(r,s){return r==null?{}:e(r,s)});return dx=n,dx}var hx,BT;function z7(){if(BT)return hx;BT=1;var e=Math.ceil,t=Math.max;function n(r,s,l,c){for(var u=-1,f=t(e((s-r)/(l||1)),0),p=Array(f);f--;)p[c?f:++u]=r,r+=l;return p}return hx=n,hx}var fx,zT;function U7(){if(zT)return fx;zT=1;var e=z7(),t=Zf(),n=VI();function r(s){return function(l,c,u){return u&&typeof u!="number"&&t(l,c,u)&&(c=u=void 0),l=n(l),c===void 0?(c=l,l=0):c=n(c),u=u===void 0?l<c?1:-1:n(u),e(l,c,u,s)}}return fx=r,fx}var px,UT;function H7(){if(UT)return px;UT=1;var e=U7(),t=e();return px=t,px}var mx,HT;function W7(){if(HT)return mx;HT=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return mx=e,mx}var gx,WT;function V7(){if(WT)return gx;WT=1;var e=lc();function t(n,r){if(n!==r){var s=n!==void 0,l=n===null,c=n===n,u=e(n),f=r!==void 0,p=r===null,h=r===r,m=e(r);if(!p&&!m&&!u&&n>r||u&&f&&h&&!p&&!m||l&&f&&h||!s&&h||!c)return 1;if(!l&&!u&&!m&&n<r||m&&s&&c&&!l&&!u||p&&s&&c||!f&&c||!h)return-1}return 0}return gx=t,gx}var yx,VT;function G7(){if(VT)return yx;VT=1;var e=V7();function t(n,r,s){for(var l=-1,c=n.criteria,u=r.criteria,f=c.length,p=s.length;++l<f;){var h=e(c[l],u[l]);if(h){if(l>=p)return h;var m=s[l];return h*(m=="desc"?-1:1)}}return n.index-r.index}return yx=t,yx}var wx,GT;function K7(){if(GT)return wx;GT=1;var e=Gf(),t=Yf(),n=pa(),r=II(),s=W7(),l=Uf(),c=G7(),u=Ei(),f=nn();function p(h,m,y){m.length?m=e(m,function(b){return f(b)?function(_){return t(_,b.length===1?b[0]:b)}:b}):m=[u];var v=-1;m=e(m,l(n));var S=r(h,function(b,_,k){var j=e(m,function(E){return E(b)});return{criteria:j,index:++v,value:b}});return s(S,function(b,_){return c(b,_,y)})}return wx=p,wx}var vx,KT;function Y7(){if(KT)return vx;KT=1;var e=ok(),t=K7(),n=Xf(),r=Zf(),s=n(function(l,c){if(l==null)return[];var u=c.length;return u>1&&r(l,c[0],c[1])?c=[]:u>2&&r(c[0],c[1],c[2])&&(c=[c[0]]),t(l,e(c,1),[])});return vx=s,vx}var xx,YT;function X7(){if(YT)return xx;YT=1;var e=_I(),t=0;function n(r){var s=++t;return e(r)+s}return xx=n,xx}var bx,XT;function Z7(){if(XT)return bx;XT=1;function e(t,n,r){for(var s=-1,l=t.length,c=n.length,u={};++s<l;){var f=s<c?n[s]:void 0;r(u,t[s],f)}return u}return bx=e,bx}var kx,ZT;function Q7(){if(ZT)return kx;ZT=1;var e=Bf(),t=Z7();function n(r,s){return t(r||[],s||[],e)}return kx=n,kx}var Nx,QT;function Dt(){if(QT)return Nx;QT=1;var e;if(typeof Wb=="function")try{e={cloneDeep:p7(),constant:tk(),defaults:m7(),each:vI(),filter:RI(),find:k7(),flatten:GI(),forEach:wI(),forIn:N7(),has:AI(),isUndefined:MI(),last:S7(),map:$I(),mapValues:j7(),max:E7(),merge:I7(),min:$7(),minBy:O7(),now:L7(),pick:B7(),range:H7(),reduce:OI(),sortBy:Y7(),uniqueId:X7(),values:qI(),zipObject:Q7()}}catch{}return e||(e=window._),Nx=e,Nx}var Sx,JT;function J7(){if(JT)return Sx;JT=1,Sx=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,l=s._prev;l!==s;)r.push(JSON.stringify(l,n)),l=l._prev;return"["+r.join(", ")+"]"};function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,s){if(r!=="_next"&&r!=="_prev")return s}return Sx}var jx,e2;function e9(){if(e2)return jx;e2=1;var e=Dt(),t=xs().Graph,n=J7();jx=s;var r=e.constant(1);function s(p,h){if(p.nodeCount()<=1)return[];var m=u(p,h||r),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(v){return p.outEdges(v.v,v.w)}),!0)}function l(p,h,m){for(var y=[],v=h[h.length-1],S=h[0],b;p.nodeCount();){for(;b=S.dequeue();)c(p,h,m,b);for(;b=v.dequeue();)c(p,h,m,b);if(p.nodeCount()){for(var _=h.length-2;_>0;--_)if(b=h[_].dequeue(),b){y=y.concat(c(p,h,m,b,!0));break}}}return y}function c(p,h,m,y,v){var S=v?[]:void 0;return e.forEach(p.inEdges(y.v),function(b){var _=p.edge(b),k=p.node(b.v);v&&S.push({v:b.v,w:b.w}),k.out-=_,f(h,m,k)}),e.forEach(p.outEdges(y.v),function(b){var _=p.edge(b),k=b.w,j=p.node(k);j.in-=_,f(h,m,j)}),p.removeNode(y.v),S}function u(p,h){var m=new t,y=0,v=0;e.forEach(p.nodes(),function(_){m.setNode(_,{v:_,in:0,out:0})}),e.forEach(p.edges(),function(_){var k=m.edge(_.v,_.w)||0,j=h(_),E=k+j;m.setEdge(_.v,_.w,E),v=Math.max(v,m.node(_.v).out+=j),y=Math.max(y,m.node(_.w).in+=j)});var S=e.range(v+y+3).map(function(){return new n}),b=y+1;return e.forEach(m.nodes(),function(_){f(S,b,m.node(_))}),{graph:m,buckets:S,zeroIdx:b}}function f(p,h,m){m.out?m.in?p[m.out-m.in+h].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return jx}var _x,t2;function t9(){if(t2)return _x;t2=1;var e=Dt(),t=e9();_x={run:n,undo:s};function n(l){var c=l.graph().acyclicer==="greedy"?t(l,u(l)):r(l);e.forEach(c,function(f){var p=l.edge(f);l.removeEdge(f),p.forwardName=f.name,p.reversed=!0,l.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function u(f){return function(p){return f.edge(p).weight}}}function r(l){var c=[],u={},f={};function p(h){e.has(f,h)||(f[h]=!0,u[h]=!0,e.forEach(l.outEdges(h),function(m){e.has(u,m.w)?c.push(m):p(m.w)}),delete u[h])}return e.forEach(l.nodes(),p),c}function s(l){e.forEach(l.edges(),function(c){var u=l.edge(c);if(u.reversed){l.removeEdge(c);var f=u.forwardName;delete u.reversed,delete u.forwardName,l.setEdge(c.w,c.v,u,f)}})}return _x}var Ex,n2;function ar(){if(n2)return Ex;n2=1;var e=Dt(),t=xs().Graph;Ex={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:l,predecessorWeights:c,intersectRect:u,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:m,maxRank:y,partition:v,time:S,notime:b};function n(_,k,j,E){var C;do C=e.uniqueId(E);while(_.hasNode(C));return j.dummy=k,_.setNode(C,j),C}function r(_){var k=new t().setGraph(_.graph());return e.forEach(_.nodes(),function(j){k.setNode(j,_.node(j))}),e.forEach(_.edges(),function(j){var E=k.edge(j.v,j.w)||{weight:0,minlen:1},C=_.edge(j);k.setEdge(j.v,j.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),k}function s(_){var k=new t({multigraph:_.isMultigraph()}).setGraph(_.graph());return e.forEach(_.nodes(),function(j){_.children(j).length||k.setNode(j,_.node(j))}),e.forEach(_.edges(),function(j){k.setEdge(j,_.edge(j))}),k}function l(_){var k=e.map(_.nodes(),function(j){var E={};return e.forEach(_.outEdges(j),function(C){E[C.w]=(E[C.w]||0)+_.edge(C).weight}),E});return e.zipObject(_.nodes(),k)}function c(_){var k=e.map(_.nodes(),function(j){var E={};return e.forEach(_.inEdges(j),function(C){E[C.v]=(E[C.v]||0)+_.edge(C).weight}),E});return e.zipObject(_.nodes(),k)}function u(_,k){var j=_.x,E=_.y,C=k.x-j,R=k.y-E,I=_.width/2,$=_.height/2;if(!C&&!R)throw new Error("Not possible to find intersection inside of the rectangle");var q,B;return Math.abs(R)*I>Math.abs(C)*$?(R<0&&($=-$),q=$*C/R,B=$):(C<0&&(I=-I),q=I,B=I*R/C),{x:j+q,y:E+B}}function f(_){var k=e.map(e.range(y(_)+1),function(){return[]});return e.forEach(_.nodes(),function(j){var E=_.node(j),C=E.rank;e.isUndefined(C)||(k[C][E.order]=j)}),k}function p(_){var k=e.min(e.map(_.nodes(),function(j){return _.node(j).rank}));e.forEach(_.nodes(),function(j){var E=_.node(j);e.has(E,"rank")&&(E.rank-=k)})}function h(_){var k=e.min(e.map(_.nodes(),function(R){return _.node(R).rank})),j=[];e.forEach(_.nodes(),function(R){var I=_.node(R).rank-k;j[I]||(j[I]=[]),j[I].push(R)});var E=0,C=_.graph().nodeRankFactor;e.forEach(j,function(R,I){e.isUndefined(R)&&I%C!==0?--E:E&&e.forEach(R,function($){_.node($).rank+=E})})}function m(_,k,j,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=j,C.order=E),n(_,"border",C,k)}function y(_){return e.max(e.map(_.nodes(),function(k){var j=_.node(k).rank;if(!e.isUndefined(j))return j}))}function v(_,k){var j={lhs:[],rhs:[]};return e.forEach(_,function(E){k(E)?j.lhs.push(E):j.rhs.push(E)}),j}function S(_,k){var j=e.now();try{return k()}finally{console.log(_+" time: "+(e.now()-j)+"ms")}}function b(_,k){return k()}return Ex}var Cx,r2;function n9(){if(r2)return Cx;r2=1;var e=Dt(),t=ar();Cx={run:n,undo:s};function n(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(c){r(l,c)})}function r(l,c){var u=c.v,f=l.node(u).rank,p=c.w,h=l.node(p).rank,m=c.name,y=l.edge(c),v=y.labelRank;if(h!==f+1){l.removeEdge(c);var S,b,_;for(_=0,++f;f<h;++_,++f)y.points=[],b={width:0,height:0,edgeLabel:y,edgeObj:c,rank:f},S=t.addDummyNode(l,"edge",b,"_d"),f===v&&(b.width=y.width,b.height=y.height,b.dummy="edge-label",b.labelpos=y.labelpos),l.setEdge(u,S,{weight:y.weight},m),_===0&&l.graph().dummyChains.push(S),u=S;l.setEdge(u,p,{weight:y.weight},m)}}function s(l){e.forEach(l.graph().dummyChains,function(c){var u=l.node(c),f=u.edgeLabel,p;for(l.setEdge(u.edgeObj,f);u.dummy;)p=l.successors(c)[0],l.removeNode(c),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),c=p,u=l.node(c)})}return Cx}var Tx,s2;function cf(){if(s2)return Tx;s2=1;var e=Dt();Tx={longestPath:t,slack:n};function t(r){var s={};function l(c){var u=r.node(c);if(e.has(s,c))return u.rank;s[c]=!0;var f=e.min(e.map(r.outEdges(c),function(p){return l(p.w)-r.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(r.sources(),l)}function n(r,s){return r.node(s.w).rank-r.node(s.v).rank-r.edge(s).minlen}return Tx}var Rx,a2;function ZI(){if(a2)return Rx;a2=1;var e=Dt(),t=xs().Graph,n=cf().slack;Rx=r;function r(u){var f=new t({directed:!1}),p=u.nodes()[0],h=u.nodeCount();f.setNode(p,{});for(var m,y;s(f,u)<h;)m=l(f,u),y=f.hasNode(m.v)?n(u,m):-n(u,m),c(f,u,y);return f}function s(u,f){function p(h){e.forEach(f.nodeEdges(h),function(m){var y=m.v,v=h===y?m.w:y;!u.hasNode(v)&&!n(f,m)&&(u.setNode(v,{}),u.setEdge(h,v,{}),p(v))})}return e.forEach(u.nodes(),p),u.nodeCount()}function l(u,f){return e.minBy(f.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(f,p)})}function c(u,f,p){e.forEach(u.nodes(),function(h){f.node(h).rank+=p})}return Rx}var Ax,o2;function r9(){if(o2)return Ax;o2=1;var e=Dt(),t=ZI(),n=cf().slack,r=cf().longestPath,s=xs().alg.preorder,l=xs().alg.postorder,c=ar().simplify;Ax=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=v,u.enterEdge=S,u.exchangeEdges=b;function u(E){E=c(E),r(E);var C=t(E);m(C),f(C,E);for(var R,I;R=v(C);)I=S(C,E,R),b(C,E,R,I)}function f(E,C){var R=l(E,E.nodes());R=R.slice(0,R.length-1),e.forEach(R,function(I){p(E,C,I)})}function p(E,C,R){var I=E.node(R),$=I.parent;E.edge(R,$).cutvalue=h(E,C,R)}function h(E,C,R){var I=E.node(R),$=I.parent,q=!0,B=C.edge(R,$),P=0;return B||(q=!1,B=C.edge($,R)),P=B.weight,e.forEach(C.nodeEdges(R),function(W){var ne=W.v===R,ee=ne?W.w:W.v;if(ee!==$){var M=ne===q,X=C.edge(W).weight;if(P+=M?X:-X,k(E,R,ee)){var V=E.edge(R,ee).cutvalue;P+=M?-V:V}}}),P}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,R,I,$){var q=R,B=E.node(I);return C[I]=!0,e.forEach(E.neighbors(I),function(P){e.has(C,P)||(R=y(E,C,R,P,I))}),B.low=q,B.lim=R++,$?B.parent=$:delete B.parent,R}function v(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function S(E,C,R){var I=R.v,$=R.w;C.hasEdge(I,$)||(I=R.w,$=R.v);var q=E.node(I),B=E.node($),P=q,W=!1;q.lim>B.lim&&(P=B,W=!0);var ne=e.filter(C.edges(),function(ee){return W===j(E,E.node(ee.v),P)&&W!==j(E,E.node(ee.w),P)});return e.minBy(ne,function(ee){return n(C,ee)})}function b(E,C,R,I){var $=R.v,q=R.w;E.removeEdge($,q),E.setEdge(I.v,I.w,{}),m(E),f(E,C),_(E,C)}function _(E,C){var R=e.find(E.nodes(),function($){return!C.node($).parent}),I=s(E,R);I=I.slice(1),e.forEach(I,function($){var q=E.node($).parent,B=C.edge($,q),P=!1;B||(B=C.edge(q,$),P=!0),C.node($).rank=C.node(q).rank+(P?B.minlen:-B.minlen)})}function k(E,C,R){return E.hasEdge(C,R)}function j(E,C,R){return R.low<=C.lim&&C.lim<=R.lim}return Ax}var Mx,i2;function s9(){if(i2)return Mx;i2=1;var e=cf(),t=e.longestPath,n=ZI(),r=r9();Mx=s;function s(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":c(f);break;case"longest-path":l(f);break;default:u(f)}}var l=t;function c(f){t(f),n(f)}function u(f){r(f)}return Mx}var Ix,l2;function a9(){if(l2)return Ix;l2=1;var e=Dt();Ix=t;function t(s){var l=r(s);e.forEach(s.graph().dummyChains,function(c){for(var u=s.node(c),f=u.edgeObj,p=n(s,l,f.v,f.w),h=p.path,m=p.lca,y=0,v=h[y],S=!0;c!==f.w;){if(u=s.node(c),S){for(;(v=h[y])!==m&&s.node(v).maxRank<u.rank;)y++;v===m&&(S=!1)}if(!S){for(;y<h.length-1&&s.node(v=h[y+1]).minRank<=u.rank;)y++;v=h[y]}s.setParent(c,v),c=s.successors(c)[0]}})}function n(s,l,c,u){var f=[],p=[],h=Math.min(l[c].low,l[u].low),m=Math.max(l[c].lim,l[u].lim),y,v;y=c;do y=s.parent(y),f.push(y);while(y&&(l[y].low>h||m>l[y].lim));for(v=y,y=u;(y=s.parent(y))!==v;)p.push(y);return{path:f.concat(p.reverse()),lca:v}}function r(s){var l={},c=0;function u(f){var p=c;e.forEach(s.children(f),u),l[f]={low:p,lim:c++}}return e.forEach(s.children(),u),l}return Ix}var $x,c2;function o9(){if(c2)return $x;c2=1;var e=Dt(),t=ar();$x={run:n,cleanup:c};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),p=s(u),h=e.max(e.values(p))-1,m=2*h+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(v){u.edge(v).minlen*=m});var y=l(u)+1;e.forEach(u.children(),function(v){r(u,f,m,y,h,p,v)}),u.graph().nodeRankFactor=m}function r(u,f,p,h,m,y,v){var S=u.children(v);if(!S.length){v!==f&&u.setEdge(f,v,{weight:0,minlen:p});return}var b=t.addBorderNode(u,"_bt"),_=t.addBorderNode(u,"_bb"),k=u.node(v);u.setParent(b,v),k.borderTop=b,u.setParent(_,v),k.borderBottom=_,e.forEach(S,function(j){r(u,f,p,h,m,y,j);var E=u.node(j),C=E.borderTop?E.borderTop:j,R=E.borderBottom?E.borderBottom:j,I=E.borderTop?h:2*h,$=C!==R?1:m-y[v]+1;u.setEdge(b,C,{weight:I,minlen:$,nestingEdge:!0}),u.setEdge(R,_,{weight:I,minlen:$,nestingEdge:!0})}),u.parent(v)||u.setEdge(f,b,{weight:0,minlen:m+y[v]})}function s(u){var f={};function p(h,m){var y=u.children(h);y&&y.length&&e.forEach(y,function(v){p(v,m+1)}),f[h]=m}return e.forEach(u.children(),function(h){p(h,1)}),f}function l(u){return e.reduce(u.edges(),function(f,p){return f+u.edge(p).weight},0)}function c(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(u.edges(),function(p){var h=u.edge(p);h.nestingEdge&&u.removeEdge(p)})}return $x}var Ox,u2;function i9(){if(u2)return Ox;u2=1;var e=Dt(),t=ar();Ox=n;function n(s){function l(c){var u=s.children(c),f=s.node(c);if(u.length&&e.forEach(u,l),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)r(s,"borderLeft","_bl",c,f,p),r(s,"borderRight","_br",c,f,p)}}e.forEach(s.children(),l)}function r(s,l,c,u,f,p){var h={width:0,height:0,rank:p,borderType:l},m=f[l][p-1],y=t.addDummyNode(s,"border",h,c);f[l][p]=y,s.setParent(y,u),m&&s.setEdge(m,y,{weight:1})}return Ox}var Lx,d2;function l9(){if(d2)return Lx;d2=1;var e=Dt();Lx={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&r(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&l(p),(h==="lr"||h==="rl")&&(u(p),r(p))}function r(p){e.forEach(p.nodes(),function(h){s(p.node(h))}),e.forEach(p.edges(),function(h){s(p.edge(h))})}function s(p){var h=p.width;p.width=p.height,p.height=h}function l(p){e.forEach(p.nodes(),function(h){c(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,c),e.has(m,"y")&&c(m)})}function c(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return Lx}var Px,h2;function c9(){if(h2)return Px;h2=1;var e=Dt();Px=t;function t(n){var r={},s=e.filter(n.nodes(),function(p){return!n.children(p).length}),l=e.max(e.map(s,function(p){return n.node(p).rank})),c=e.map(e.range(l+1),function(){return[]});function u(p){if(!e.has(r,p)){r[p]=!0;var h=n.node(p);c[h.rank].push(p),e.forEach(n.successors(p),u)}}var f=e.sortBy(s,function(p){return n.node(p).rank});return e.forEach(f,u),c}return Px}var Dx,f2;function u9(){if(f2)return Dx;f2=1;var e=Dt();Dx=t;function t(r,s){for(var l=0,c=1;c<s.length;++c)l+=n(r,s[c-1],s[c]);return l}function n(r,s,l){for(var c=e.zipObject(l,e.map(l,function(y,v){return v})),u=e.flatten(e.map(s,function(y){return e.sortBy(e.map(r.outEdges(y),function(v){return{pos:c[v.w],weight:r.edge(v).weight}}),"pos")}),!0),f=1;f<l.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(u.forEach(function(y){var v=y.pos+f;h[v]+=y.weight;for(var S=0;v>0;)v%2&&(S+=h[v+1]),v=v-1>>1,h[v]+=y.weight;m+=y.weight*S})),m}return Dx}var Fx,p2;function d9(){if(p2)return Fx;p2=1;var e=Dt();Fx=t;function t(n,r){return e.map(r,function(s){var l=n.inEdges(s);if(l.length){var c=e.reduce(l,function(u,f){var p=n.edge(f),h=n.node(f.v);return{sum:u.sum+p.weight*h.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:s,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:s}})}return Fx}var qx,m2;function h9(){if(m2)return qx;m2=1;var e=Dt();qx=t;function t(s,l){var c={};e.forEach(s,function(f,p){var h=c[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(l.edges(),function(f){var p=c[f.v],h=c[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(c[f.w]))});var u=e.filter(c,function(f){return!f.indegree});return n(u)}function n(s){var l=[];function c(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&r(p,h)}}function u(p){return function(h){h.in.push(p),--h.indegree===0&&s.push(h)}}for(;s.length;){var f=s.pop();l.push(f),e.forEach(f.in.reverse(),c(f)),e.forEach(f.out,u(f))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function r(s,l){var c=0,u=0;s.weight&&(c+=s.barycenter*s.weight,u+=s.weight),l.weight&&(c+=l.barycenter*l.weight,u+=l.weight),s.vs=l.vs.concat(s.vs),s.barycenter=c/u,s.weight=u,s.i=Math.min(l.i,s.i),l.merged=!0}return qx}var Bx,g2;function f9(){if(g2)return Bx;g2=1;var e=Dt(),t=ar();Bx=n;function n(l,c){var u=t.partition(l,function(b){return e.has(b,"barycenter")}),f=u.lhs,p=e.sortBy(u.rhs,function(b){return-b.i}),h=[],m=0,y=0,v=0;f.sort(s(!!c)),v=r(h,p,v),e.forEach(f,function(b){v+=b.vs.length,h.push(b.vs),m+=b.barycenter*b.weight,y+=b.weight,v=r(h,p,v)});var S={vs:e.flatten(h,!0)};return y&&(S.barycenter=m/y,S.weight=y),S}function r(l,c,u){for(var f;c.length&&(f=e.last(c)).i<=u;)c.pop(),l.push(f.vs),u++;return u}function s(l){return function(c,u){return c.barycenter<u.barycenter?-1:c.barycenter>u.barycenter?1:l?u.i-c.i:c.i-u.i}}return Bx}var zx,y2;function p9(){if(y2)return zx;y2=1;var e=Dt(),t=d9(),n=h9(),r=f9();zx=s;function s(u,f,p,h){var m=u.children(f),y=u.node(f),v=y?y.borderLeft:void 0,S=y?y.borderRight:void 0,b={};v&&(m=e.filter(m,function(R){return R!==v&&R!==S}));var _=t(u,m);e.forEach(_,function(R){if(u.children(R.v).length){var I=s(u,R.v,p,h);b[R.v]=I,e.has(I,"barycenter")&&c(R,I)}});var k=n(_,p);l(k,b);var j=r(k,h);if(v&&(j.vs=e.flatten([v,j.vs,S],!0),u.predecessors(v).length)){var E=u.node(u.predecessors(v)[0]),C=u.node(u.predecessors(S)[0]);e.has(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+E.order+C.order)/(j.weight+2),j.weight+=2}return j}function l(u,f){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function c(u,f){e.isUndefined(u.barycenter)?(u.barycenter=f.barycenter,u.weight=f.weight):(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight)}return zx}var Ux,w2;function m9(){if(w2)return Ux;w2=1;var e=Dt(),t=xs().Graph;Ux=n;function n(s,l,c){var u=r(s),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return s.node(p)});return e.forEach(s.nodes(),function(p){var h=s.node(p),m=s.parent(p);(h.rank===l||h.minRank<=l&&l<=h.maxRank)&&(f.setNode(p),f.setParent(p,m||u),e.forEach(s[c](p),function(y){var v=y.v===p?y.w:y.v,S=f.edge(v,p),b=e.isUndefined(S)?0:S.weight;f.setEdge(v,p,{weight:s.edge(y).weight+b})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[l],borderRight:h.borderRight[l]}))}),f}function r(s){for(var l;s.hasNode(l=e.uniqueId("_root")););return l}return Ux}var Hx,v2;function g9(){if(v2)return Hx;v2=1;var e=Dt();Hx=t;function t(n,r,s){var l={},c;e.forEach(s,function(u){for(var f=n.parent(u),p,h;f;){if(p=n.parent(f),p?(h=l[p],l[p]=f):(h=c,c=f),h&&h!==f){r.setEdge(h,f);return}f=p}})}return Hx}var Wx,x2;function y9(){if(x2)return Wx;x2=1;var e=Dt(),t=c9(),n=u9(),r=p9(),s=m9(),l=g9(),c=xs().Graph,u=ar();Wx=f;function f(y){var v=u.maxRank(y),S=p(y,e.range(1,v+1),"inEdges"),b=p(y,e.range(v-1,-1,-1),"outEdges"),_=t(y);m(y,_);for(var k=Number.POSITIVE_INFINITY,j,E=0,C=0;C<4;++E,++C){h(E%2?S:b,E%4>=2),_=u.buildLayerMatrix(y);var R=n(y,_);R<k&&(C=0,j=e.cloneDeep(_),k=R)}m(y,j)}function p(y,v,S){return e.map(v,function(b){return s(y,b,S)})}function h(y,v){var S=new c;e.forEach(y,function(b){var _=b.graph().root,k=r(b,_,S,v);e.forEach(k.vs,function(j,E){b.node(j).order=E}),l(b,S,k.vs)})}function m(y,v){e.forEach(v,function(S){e.forEach(S,function(b,_){y.node(b).order=_})})}return Wx}var Vx,b2;function w9(){if(b2)return Vx;b2=1;var e=Dt(),t=xs().Graph,n=ar();Vx={positionX:S,findType1Conflicts:r,findType2Conflicts:s,addConflict:c,hasConflict:u,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:v};function r(k,j){var E={};function C(R,I){var $=0,q=0,B=R.length,P=e.last(I);return e.forEach(I,function(W,ne){var ee=l(k,W),M=ee?k.node(ee).order:B;(ee||W===P)&&(e.forEach(I.slice(q,ne+1),function(X){e.forEach(k.predecessors(X),function(V){var G=k.node(V),F=G.order;(F<$||M<F)&&!(G.dummy&&k.node(X).dummy)&&c(E,V,X)})}),q=ne+1,$=M)}),I}return e.reduce(j,C),E}function s(k,j){var E={};function C(I,$,q,B,P){var W;e.forEach(e.range($,q),function(ne){W=I[ne],k.node(W).dummy&&e.forEach(k.predecessors(W),function(ee){var M=k.node(ee);M.dummy&&(M.order<B||M.order>P)&&c(E,ee,W)})})}function R(I,$){var q=-1,B,P=0;return e.forEach($,function(W,ne){if(k.node(W).dummy==="border"){var ee=k.predecessors(W);ee.length&&(B=k.node(ee[0]).order,C($,P,ne,q,B),P=ne,q=B)}C($,P,$.length,B,I.length)}),$}return e.reduce(j,R),E}function l(k,j){if(k.node(j).dummy)return e.find(k.predecessors(j),function(E){return k.node(E).dummy})}function c(k,j,E){if(j>E){var C=j;j=E,E=C}var R=k[j];R||(k[j]=R={}),R[E]=!0}function u(k,j,E){if(j>E){var C=j;j=E,E=C}return e.has(k[j],E)}function f(k,j,E,C){var R={},I={},$={};return e.forEach(j,function(q){e.forEach(q,function(B,P){R[B]=B,I[B]=B,$[B]=P})}),e.forEach(j,function(q){var B=-1;e.forEach(q,function(P){var W=C(P);if(W.length){W=e.sortBy(W,function(V){return $[V]});for(var ne=(W.length-1)/2,ee=Math.floor(ne),M=Math.ceil(ne);ee<=M;++ee){var X=W[ee];I[P]===P&&B<$[X]&&!u(E,P,X)&&(I[X]=P,I[P]=R[P]=R[X],B=$[X])}}})}),{root:R,align:I}}function p(k,j,E,C,R){var I={},$=h(k,j,E,R),q=R?"borderLeft":"borderRight";function B(ne,ee){for(var M=$.nodes(),X=M.pop(),V={};X;)V[X]?ne(X):(V[X]=!0,M.push(X),M=M.concat(ee(X))),X=M.pop()}function P(ne){I[ne]=$.inEdges(ne).reduce(function(ee,M){return Math.max(ee,I[M.v]+$.edge(M))},0)}function W(ne){var ee=$.outEdges(ne).reduce(function(X,V){return Math.min(X,I[V.w]-$.edge(V))},Number.POSITIVE_INFINITY),M=k.node(ne);ee!==Number.POSITIVE_INFINITY&&M.borderType!==q&&(I[ne]=Math.max(I[ne],ee))}return B(P,$.predecessors.bind($)),B(W,$.successors.bind($)),e.forEach(C,function(ne){I[ne]=I[E[ne]]}),I}function h(k,j,E,C){var R=new t,I=k.graph(),$=b(I.nodesep,I.edgesep,C);return e.forEach(j,function(q){var B;e.forEach(q,function(P){var W=E[P];if(R.setNode(W),B){var ne=E[B],ee=R.edge(ne,W);R.setEdge(ne,W,Math.max($(k,P,B),ee||0))}B=P})}),R}function m(k,j){return e.minBy(e.values(j),function(E){var C=Number.NEGATIVE_INFINITY,R=Number.POSITIVE_INFINITY;return e.forIn(E,function(I,$){var q=_(k,$)/2;C=Math.max(I+q,C),R=Math.min(I-q,R)}),C-R})}function y(k,j){var E=e.values(j),C=e.min(E),R=e.max(E);e.forEach(["u","d"],function(I){e.forEach(["l","r"],function($){var q=I+$,B=k[q],P;if(B!==j){var W=e.values(B);P=$==="l"?C-e.min(W):R-e.max(W),P&&(k[q]=e.mapValues(B,function(ne){return ne+P}))}})})}function v(k,j){return e.mapValues(k.ul,function(E,C){if(j)return k[j.toLowerCase()][C];var R=e.sortBy(e.map(k,C));return(R[1]+R[2])/2})}function S(k){var j=n.buildLayerMatrix(k),E=e.merge(r(k,j),s(k,j)),C={},R;e.forEach(["u","d"],function($){R=$==="u"?j:e.values(j).reverse(),e.forEach(["l","r"],function(q){q==="r"&&(R=e.map(R,function(ne){return e.values(ne).reverse()}));var B=($==="u"?k.predecessors:k.successors).bind(k),P=f(k,R,E,B),W=p(k,R,P.root,P.align,q==="r");q==="r"&&(W=e.mapValues(W,function(ne){return-ne})),C[$+q]=W})});var I=m(k,C);return y(C,I),v(C,k.graph().align)}function b(k,j,E){return function(C,R,I){var $=C.node(R),q=C.node(I),B=0,P;if(B+=$.width/2,e.has($,"labelpos"))switch($.labelpos.toLowerCase()){case"l":P=-$.width/2;break;case"r":P=$.width/2;break}if(P&&(B+=E?P:-P),P=0,B+=($.dummy?j:k)/2,B+=(q.dummy?j:k)/2,B+=q.width/2,e.has(q,"labelpos"))switch(q.labelpos.toLowerCase()){case"l":P=q.width/2;break;case"r":P=-q.width/2;break}return P&&(B+=E?P:-P),P=0,B}}function _(k,j){return k.node(j).width}return Vx}var Gx,k2;function v9(){if(k2)return Gx;k2=1;var e=Dt(),t=ar(),n=w9().positionX;Gx=r;function r(l){l=t.asNonCompoundGraph(l),s(l),e.forEach(n(l),function(c,u){l.node(u).x=c})}function s(l){var c=t.buildLayerMatrix(l),u=l.graph().ranksep,f=0;e.forEach(c,function(p){var h=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=f+h/2}),f+=h+u})}return Gx}var Kx,N2;function x9(){if(N2)return Kx;N2=1;var e=Dt(),t=t9(),n=n9(),r=s9(),s=ar().normalizeRanks,l=a9(),c=ar().removeEmptyRanks,u=o9(),f=i9(),p=l9(),h=y9(),m=v9(),y=ar(),v=xs().Graph;Kx=S;function S(z,Z){var U=Z&&Z.debugTiming?y.time:y.notime;U("layout",function(){var ae=U(" buildLayoutGraph",function(){return B(z)});U(" runLayout",function(){b(ae,U)}),U(" updateInputGraph",function(){_(z,ae)})})}function b(z,Z){Z(" makeSpaceForEdgeLabels",function(){P(z)}),Z(" removeSelfEdges",function(){L(z)}),Z(" acyclic",function(){t.run(z)}),Z(" nestingGraph.run",function(){u.run(z)}),Z(" rank",function(){r(y.asNonCompoundGraph(z))}),Z(" injectEdgeLabelProxies",function(){W(z)}),Z(" removeEmptyRanks",function(){c(z)}),Z(" nestingGraph.cleanup",function(){u.cleanup(z)}),Z(" normalizeRanks",function(){s(z)}),Z(" assignRankMinMax",function(){ne(z)}),Z(" removeEdgeLabelProxies",function(){ee(z)}),Z(" normalize.run",function(){n.run(z)}),Z(" parentDummyChains",function(){l(z)}),Z(" addBorderSegments",function(){f(z)}),Z(" order",function(){h(z)}),Z(" insertSelfEdges",function(){H(z)}),Z(" adjustCoordinateSystem",function(){p.adjust(z)}),Z(" position",function(){m(z)}),Z(" positionSelfEdges",function(){D(z)}),Z(" removeBorderNodes",function(){F(z)}),Z(" normalize.undo",function(){n.undo(z)}),Z(" fixupEdgeLabelCoords",function(){V(z)}),Z(" undoCoordinateSystem",function(){p.undo(z)}),Z(" translateGraph",function(){M(z)}),Z(" assignNodeIntersects",function(){X(z)}),Z(" reversePoints",function(){G(z)}),Z(" acyclic.undo",function(){t.undo(z)})}function _(z,Z){e.forEach(z.nodes(),function(U){var ae=z.node(U),le=Z.node(U);ae&&(ae.x=le.x,ae.y=le.y,Z.children(U).length&&(ae.width=le.width,ae.height=le.height))}),e.forEach(z.edges(),function(U){var ae=z.edge(U),le=Z.edge(U);ae.points=le.points,e.has(le,"x")&&(ae.x=le.x,ae.y=le.y)}),z.graph().width=Z.graph().width,z.graph().height=Z.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],j={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],R={width:0,height:0},I=["minlen","weight","width","height","labeloffset"],$={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},q=["labelpos"];function B(z){var Z=new v({multigraph:!0,compound:!0}),U=re(z.graph());return Z.setGraph(e.merge({},j,K(U,k),e.pick(U,E))),e.forEach(z.nodes(),function(ae){var le=re(z.node(ae));Z.setNode(ae,e.defaults(K(le,C),R)),Z.setParent(ae,z.parent(ae))}),e.forEach(z.edges(),function(ae){var le=re(z.edge(ae));Z.setEdge(ae,e.merge({},$,K(le,I),e.pick(le,q)))}),Z}function P(z){var Z=z.graph();Z.ranksep/=2,e.forEach(z.edges(),function(U){var ae=z.edge(U);ae.minlen*=2,ae.labelpos.toLowerCase()!=="c"&&(Z.rankdir==="TB"||Z.rankdir==="BT"?ae.width+=ae.labeloffset:ae.height+=ae.labeloffset)})}function W(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z);if(U.width&&U.height){var ae=z.node(Z.v),le=z.node(Z.w),ge={rank:(le.rank-ae.rank)/2+ae.rank,e:Z};y.addDummyNode(z,"edge-proxy",ge,"_ep")}})}function ne(z){var Z=0;e.forEach(z.nodes(),function(U){var ae=z.node(U);ae.borderTop&&(ae.minRank=z.node(ae.borderTop).rank,ae.maxRank=z.node(ae.borderBottom).rank,Z=e.max(Z,ae.maxRank))}),z.graph().maxRank=Z}function ee(z){e.forEach(z.nodes(),function(Z){var U=z.node(Z);U.dummy==="edge-proxy"&&(z.edge(U.e).labelRank=U.rank,z.removeNode(Z))})}function M(z){var Z=Number.POSITIVE_INFINITY,U=0,ae=Number.POSITIVE_INFINITY,le=0,ge=z.graph(),Ne=ge.marginx||0,Ie=ge.marginy||0;function Ge(Pe){var ze=Pe.x,Re=Pe.y,st=Pe.width,ue=Pe.height;Z=Math.min(Z,ze-st/2),U=Math.max(U,ze+st/2),ae=Math.min(ae,Re-ue/2),le=Math.max(le,Re+ue/2)}e.forEach(z.nodes(),function(Pe){Ge(z.node(Pe))}),e.forEach(z.edges(),function(Pe){var ze=z.edge(Pe);e.has(ze,"x")&&Ge(ze)}),Z-=Ne,ae-=Ie,e.forEach(z.nodes(),function(Pe){var ze=z.node(Pe);ze.x-=Z,ze.y-=ae}),e.forEach(z.edges(),function(Pe){var ze=z.edge(Pe);e.forEach(ze.points,function(Re){Re.x-=Z,Re.y-=ae}),e.has(ze,"x")&&(ze.x-=Z),e.has(ze,"y")&&(ze.y-=ae)}),ge.width=U-Z+Ne,ge.height=le-ae+Ie}function X(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z),ae=z.node(Z.v),le=z.node(Z.w),ge,Ne;U.points?(ge=U.points[0],Ne=U.points[U.points.length-1]):(U.points=[],ge=le,Ne=ae),U.points.unshift(y.intersectRect(ae,ge)),U.points.push(y.intersectRect(le,Ne))})}function V(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z);if(e.has(U,"x"))switch((U.labelpos==="l"||U.labelpos==="r")&&(U.width-=U.labeloffset),U.labelpos){case"l":U.x-=U.width/2+U.labeloffset;break;case"r":U.x+=U.width/2+U.labeloffset;break}})}function G(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z);U.reversed&&U.points.reverse()})}function F(z){e.forEach(z.nodes(),function(Z){if(z.children(Z).length){var U=z.node(Z),ae=z.node(U.borderTop),le=z.node(U.borderBottom),ge=z.node(e.last(U.borderLeft)),Ne=z.node(e.last(U.borderRight));U.width=Math.abs(Ne.x-ge.x),U.height=Math.abs(le.y-ae.y),U.x=ge.x+U.width/2,U.y=ae.y+U.height/2}}),e.forEach(z.nodes(),function(Z){z.node(Z).dummy==="border"&&z.removeNode(Z)})}function L(z){e.forEach(z.edges(),function(Z){if(Z.v===Z.w){var U=z.node(Z.v);U.selfEdges||(U.selfEdges=[]),U.selfEdges.push({e:Z,label:z.edge(Z)}),z.removeEdge(Z)}})}function H(z){var Z=y.buildLayerMatrix(z);e.forEach(Z,function(U){var ae=0;e.forEach(U,function(le,ge){var Ne=z.node(le);Ne.order=ge+ae,e.forEach(Ne.selfEdges,function(Ie){y.addDummyNode(z,"selfedge",{width:Ie.label.width,height:Ie.label.height,rank:Ne.rank,order:ge+ ++ae,e:Ie.e,label:Ie.label},"_se")}),delete Ne.selfEdges})})}function D(z){e.forEach(z.nodes(),function(Z){var U=z.node(Z);if(U.dummy==="selfedge"){var ae=z.node(U.e.v),le=ae.x+ae.width/2,ge=ae.y,Ne=U.x-le,Ie=ae.height/2;z.setEdge(U.e,U.label),z.removeNode(Z),U.label.points=[{x:le+2*Ne/3,y:ge-Ie},{x:le+5*Ne/6,y:ge-Ie},{x:le+Ne,y:ge},{x:le+5*Ne/6,y:ge+Ie},{x:le+2*Ne/3,y:ge+Ie}],U.label.x=U.x,U.label.y=U.y}})}function K(z,Z){return e.mapValues(e.pick(z,Z),Number)}function re(z){var Z={};return e.forEach(z,function(U,ae){Z[ae.toLowerCase()]=U}),Z}return Kx}var Yx,S2;function b9(){if(S2)return Yx;S2=1;var e=Dt(),t=ar(),n=xs().Graph;Yx={debugOrdering:r};function r(s){var l=t.buildLayerMatrix(s),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(s.nodes(),function(u){c.setNode(u,{label:u}),c.setParent(u,"layer"+s.node(u).rank)}),e.forEach(s.edges(),function(u){c.setEdge(u.v,u.w,{},u.name)}),e.forEach(l,function(u,f){var p="layer"+f;c.setNode(p,{rank:"same"}),e.reduce(u,function(h,m){return c.setEdge(h,m,{style:"invis"}),m})}),c}return Yx}var Xx,j2;function k9(){return j2||(j2=1,Xx="0.8.5"),Xx}var Zx,_2;function N9(){return _2||(_2=1,Zx={graphlib:xs(),layout:x9(),debug:b9(),util:{time:ar().time,notime:ar().notime},version:k9()}),Zx}var S9=N9();const E2=sb(S9),vi=240,Lu=130,zl=74,Qf=72,wu=zl+Qf;function QI(e,t){var r;let n=vi;for(const s of e)n=Math.max(n,((r=t.get(s.id))==null?void 0:r.width)??vi);return n}const uf=420,JI=1;function j9(e,t,n,r){return Math.min(JI,n/Math.max(1,e),r/Math.max(1,t))}function xi(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function _9(e,t){return((t==null?void 0:t.get(e))??0)>0?uf:0}function E9(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Pu(e,t,n){const r=t.get(e);return{w:((r==null?void 0:r.width)??vi)+_9(e,n),h:Math.max((r==null?void 0:r.height)??Lu,E9(e,n))}}function C9(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function T9(e,t,n,r,s,l){const c=new E2.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(k=>!s.has(k)),f=new Set(u);for(const k of u){const{w:j,h:E}=Pu(k,r,l);c.setNode(k,{width:j,height:E})}for(const k of t)f.has(k.source)&&f.has(k.target)&&c.setEdge(k.source,k.target);E2.layout(c);const p=new Map;let h=1/0,m=1/0,y=-1/0,v=-1/0;for(const k of u){const j=c.node(k);if(!j)continue;const E=r.get(k),C=(E==null?void 0:E.width)??vi,R=(E==null?void 0:E.height)??Lu,I=Pu(k,r,l),$=j.x-I.w/2,q=j.y-I.h/2;p.set(k,{x:$,y:q}),$<h&&(h=$),q<m&&(m=q),$+C>y&&(y=$+C),q+R>v&&(v=q+R)}if(Number.isFinite(h)&&Number.isFinite(m))for(const[k,j]of p)p.set(k,{x:j.x-h,y:j.y-m});const S=Number.isFinite(y)?y-h:0,b=Number.isFinite(v)?v-m:0;let _=null;for(const k of e){const j=s.get(k);if(!j)continue;const E=r.get(k),C=(E==null?void 0:E.width)??vi,R=(E==null?void 0:E.height)??Lu;_=_===null?{minX:j.x,minY:j.y,maxX:j.x+C,maxY:j.y+R}:{minX:Math.min(_.minX,j.x),minY:Math.min(_.minY,j.y),maxX:Math.max(_.maxX,j.x+C),maxY:Math.max(_.maxY,j.y+R)}}return{positions:p,width:S,height:b,pinnedBox:_}}function e$(e,t,n){const r=n.direction??"LR",s=n.pinned??new Map,l=n.measured??new Map,c=n.lanes,u=new Map;for(const h of e){const m=xi(h),y=u.get(m);y?y.push(h.id):u.set(m,[h.id])}return{laid:Array.from(u.keys()).sort().map(h=>({sid:h,...T9(u.get(h),t,r,l,s,c)})),gap:QI(e,l)}}const t$=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+uf,R9=e=>e.reduce((t,n)=>t+n.height,0)+wu*Math.max(0,e.length-1);function H0(e,t,n,r){const s=f=>{const p=[[]];let h=0;for(const m of e)h>0&&h+m.height>f&&(p.push([]),h=0),p[p.length-1].push(m),h+=m.height+wu;return p},l=[];for(let f=0;f<e.length;f++){let p=-wu;for(let h=f;h<e.length;h++)l.push(p+=e[h].height+wu)}l.sort((f,p)=>f-p);const c=f=>{let p=0,h=l.length-1;for(;p<h;){const m=p+h>>1;s(l[m]).length<=f?h=m:p=m+1}return s(l[p])};let u=[e];if(n>0&&r>0){const f=h=>j9(h.reduce((m,y)=>m+t$(y),0)+t*(h.length-1),Math.max(...h.map(R9)),n,r);let p=f(u);for(let h=2;h<=e.length;h++){const m=c(h),y=f(m);y>p+1e-9&&(p=y,u=m)}}return u}function A9(e,t,n,r,s){if(!(r.width>0&&r.height>0&&s.width>0&&s.height>0))return!1;const{laid:l,gap:c}=e$(e,t,n);return l.length<2?!1:H0(l,c,r.width,r.height).length!==H0(l,c,s.width,s.height).length}function M9(e,t,n={}){const r=n.pinned??new Map,{laid:s,gap:l}=e$(e,t,n),c=H0(s,l,n.availableWidth??0,n.availableHeight??0),u=new Map;let f=0;for(const p of c){const h=t$(p);let m=0;for(const{positions:y,height:v,pinnedBox:S}of p){for(const[_,k]of y)u.set(_,{x:k.x+f,y:k.y+m});let b=m+v;S&&S.maxY>b&&S.minX<f+h&&f<S.maxX&&(b=S.maxY),m=b+wu}f+=h+l}return e.map(p=>{const h=r.get(p.id);if(h)return{...p,position:h};const m=u.get(p.id);return m?{...p,position:m}:p})}function I9(e,t,n,r,s){const c=zl+Qf,u=60,f=v=>Pu(v,r,s),p=new Map(e.map(v=>[v.id,xi(v)])),h=[],m=e.map(v=>({id:v.id,pos:n.get(v.id)??t.get(v.id)})).filter(v=>v.pos!=null).sort((v,S)=>v.pos.y-S.pos.y||v.pos.x-S.pos.x||v.id.localeCompare(S.id)),y=[];for(const{id:v,pos:S}of m){const{w:b,h:_}=f(v),k=p.get(v)??"_default";if(n.has(v)){h.push({x:S.x,y:S.y,w:b,h:_,sid:k});continue}let j=S.y;for(let E=0;E<h.length+1;E++){const C=h.find(R=>{const I=R.sid===k?24:u,$=R.sid===k?24:c;return S.x<R.x+R.w+I&&R.x<S.x+b+I&&j<R.y+R.h+$&&R.y<j+_+$});if(!C)break;j=C.y+C.h+(C.sid===k?24:c)}j!==S.y&&(t.set(v,{x:S.x,y:j}),y.push(v)),h.push({x:S.x,y:j,w:b,h:_,sid:k})}return y}function $9(e,t,n,r,s,l,c){const u=E=>Pu(E,r,l),f=E=>n.get(E)??t.get(E),p=E=>{const C=r.get(E);return{cw:(C==null?void 0:C.width)??vi,ch:(C==null?void 0:C.height)??Lu}},h=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!f(E.id))continue;const C=xi(E),R=m.get(C);R?R.push(E):m.set(C,[E])}const y=new Set;for(const[E,C]of m)C.every(R=>s.has(R.id)&&!n.has(R.id))&&y.add(E);const v=new Map,S=[];for(const E of e){const C=f(E.id);if(!C)continue;const{w:R,h:I}=u(E.id),$=xi(E);y.has($)?(v.get($)??v.set($,[]).get($)).push(E):S.push({x:C.x,y:C.y,w:R,h:I,...p(E.id)})}if(v.size===0||h&&S.length===0)return[];const b=zl+Qf,_=(E,C,R,I)=>S.some($=>E<$.x+$.w+zl&&$.x<E+R+zl&&C<$.y+$.h+b&&$.y<C+I+b),k=QI(e,r),j=[];for(const E of[...v.keys()].sort()){const C=v.get(E);let R=1/0,I=1/0,$=-1/0,q=-1/0,B=-1/0,P=-1/0;for(const G of C){const F=f(G.id),{w:L,h:H}=u(G.id),{cw:D,ch:K}=p(G.id);R=Math.min(R,F.x),I=Math.min(I,F.y),$=Math.max($,F.x+L),q=Math.max(q,F.y+H),B=Math.max(B,F.x+D),P=Math.max(P,F.y+K)}const W=$-R,ne=q-I,ee=[...new Set(S.map(G=>Math.round(G.x)))].sort((G,F)=>G-F),M=ee.length?ee:[R],X=[0,...S.map(G=>G.y+G.h+b)].sort((G,F)=>G-F);let V=null;if(h){let G=1/0,F=1/0,L=-1/0,H=-1/0;for(const U of S)G=Math.min(G,U.x),F=Math.min(F,U.y),L=Math.max(L,U.x+U.cw),H=Math.max(H,U.y+U.ch);const D=(U,ae)=>{const le=c.width/(Math.max(L,U+B-R)-Math.min(G,U)+uf),ge=c.height/(Math.max(H,ae+P-I)-Math.min(F,ae));return[Math.min(JI,le,ge),Math.min(le,ge),Math.max(le,ge)]},K=(U,ae)=>{for(let le=0;le<U.length;le++){if(U[le]>ae[le]+1e-9)return!0;if(U[le]<ae[le]-1e-9)return!1}return!1},re=Math.round(L+uf+k),z=[...new Set([...X,F])].sort((U,ae)=>U-ae);let Z=null;for(const U of[...M,re])for(const ae of z){if(_(U,ae,W,ne))continue;const le=D(U,ae);(Z===null||K(le,Z))&&(Z=le,V={x:U,y:ae})}V&&V.x===R&&V.y===I&&(V=null)}else e:for(const G of M)for(const F of X){if(F>=I)break;if(!_(G,F,W,ne)){V={x:G,y:F};break e}}if(V){const G=V.x-R,F=V.y-I;for(const L of C){const H=f(L.id);t.set(L.id,{x:H.x+G,y:H.y+F})}j.push(E)}for(const G of C){const F=f(G.id),{w:L,h:H}=u(G.id);S.push({x:F.x,y:F.y,w:L,h:H,...p(G.id)})}}return j}function O9(e,t,n){const r=new Map;for(const s of e){if(t.has(s.id)||!n(s.id))continue;const l=xi(s);(r.get(l)??r.set(l,[]).get(l)).push(s)}if(r.size===0)return e;for(const s of r.values())s.sort((l,c)=>l.id.localeCompare(c.id));return e.map(s=>{var p;if(t.has(s.id)||n(s.id))return s;const l=r.get(xi(s));if(!l)return s;const c=(p=s.data)==null?void 0:p.parentId,u=l.find(h=>h.id===c)??l[0],f=n(u.id);return{...s,position:{x:s.position.x+f.x-u.position.x,y:s.position.y+f.y-u.position.y}}})}function L9(e,t,n,r,s,l=!1,c){const p=zl+Qf+1,h=8,m=1.75,y=200,v=.7,S=.01,b=P=>Pu(P,r,c),_=P=>n.get(P)??t.get(P),k=new Map;for(const P of e){if(!_(P.id))continue;const W=xi(P),ne=k.get(W);ne?ne.push(P):k.set(W,[P])}const j=[],E=new Set,C=new Set,R=s.size===0;for(const P of[...k.keys()].sort()){const W=k.get(P);let ne=1/0,ee=1/0,M=-1/0,X=-1/0,V=!1;for(const H of W){const D=_(H.id),{w:K,h:re}=b(H.id);ne=Math.min(ne,D.x),ee=Math.min(ee,D.y),M=Math.max(M,D.x+K),X=Math.max(X,D.y+re),n.has(H.id)&&(V=!0)}const G=M-ne,F=X-ee;C.add(P);const L=s.get(P);L&&(G>L.w+h||F>L.h+h)&&E.add(P),s.set(P,{w:G,h:F}),j.push({sid:P,members:W.map(H=>H.id),x:ne,y:ee,w:G,h:F,anchored:V,mass:1})}for(const P of[...s.keys()])C.has(P)||s.delete(P);if(l||R)return[];let I=!1;for(let P=0;P<j.length&&!I;P++)for(let W=P+1;W<j.length;W++){const ne=j[P],ee=j[W];if(!(ne.anchored&&ee.anchored)&&Math.abs(ne.x+ne.w/2-(ee.x+ee.w/2))<(ne.w+ee.w)/2+61&&Math.abs(ne.y+ne.h/2-(ee.y+ee.h/2))<(ne.h+ee.h)/2+p){I=!0;break}}if(E.size===0&&!I)return[];if(E.size>0)for(const P of j)E.has(P.sid)&&(P.mass=8);else for(const P of j)P.mass=Math.max(1,P.w*P.h/(vi*Lu));const $=new Map(j.map(P=>[P.sid,P.x])),q=new Map(j.map(P=>[P.sid,P.y]));for(let P=0;P<y;P++){const W=new Map,ne=new Map;let ee=0;for(let M=0;M<j.length;M++)for(let X=M+1;X<j.length;X++){const V=j[M],G=j[X];if(V.anchored&&G.anchored)continue;const F=V.x+V.w/2,L=V.y+V.h/2,H=G.x+G.w/2,D=G.y+G.h/2,K=(V.w+G.w)/2+61-Math.abs(F-H),re=(V.h+G.h)/2+p-Math.abs(L-D);if(K<=0||re<=0)continue;const z=(fe,Ce)=>!fe.anchored&&!(Ce<0&&fe.x<=0),Z=(fe,Ce)=>!fe.anchored&&!(Ce<0&&fe.y<=0),U=(fe,Ce,pe)=>{const _e=fe===Ce,Ye=_e?V.sid<G.sid?-1:1:Math.sign(fe-Ce);return pe(V,Ye)||pe(G,-Ye)?Ye:_e&&(pe(V,-Ye)||pe(G,Ye))?-Ye:0},ae=U(F,H,z),le=U(L,D,Z),ge=ae!==0,Ne=le!==0;if(!ge&&!Ne)continue;const Ie=ge&&(!Ne||K*m<re),[Ge,Pe,ze,Re]=Ie?[ae,K,W,z]:[le,re,ne,Z],st=Re(V,Ge),ue=Re(G,-Ge),ce=V.mass,se=G.mass,be=st?ue?se/(ce+se):1:0,Le=ue?st?ce/(ce+se):1:0,de=Pe*v;ze.set(V.sid,(ze.get(V.sid)??0)+Ge*de*be),ze.set(G.sid,(ze.get(G.sid)??0)-Ge*de*Le),ee+=de}for(const M of j)M.anchored||(M.x=Math.max(0,M.x+(W.get(M.sid)??0)),M.y=Math.max(0,M.y+(ne.get(M.sid)??0)));if(ee<S)break}const B=[];for(const P of j){const W=P.x-$.get(P.sid),ne=P.y-q.get(P.sid);if(!(Math.abs(W)<1&&Math.abs(ne)<1)){for(const ee of P.members){if(n.has(ee))continue;const M=t.get(ee);M&&t.set(ee,{x:M.x+W,y:M.y+ne})}B.push(P.sid)}}return B}function zh(e,t,n){return!t.has(e)||n.has(e)}function P9(e,t,n,r){return!t.has(e)&&zh(e,n,r)}function D9(e,t,n){const r={x:0,y:0};return t.set(e,r),n.add(e),r}function C2(e,t,n,r){n.set(e,t),r.delete(e)}const F9=200,q9=5*6e4,B9=6,z9=2*6e4;function Eh(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function U9(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 H9(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(Tb(n.id));return t}function W9(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(Tb(n.id));return t}function V9(e,t){let n=o6(e,t,HN);i6(e,t,HN)&&(n=!0);const r=[],s=l=>{r.push(l)};return n6(e,t,F9,q9,s)&&(n=!0),r6(e,t,B9,z9,s)&&(n=!0),{changed:n,forgotten:r}}const G9=300,T2=130,K9=160,R2=new WeakMap;function Y9(e,t){let n=R2.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map,branches:gF(e.agents.values())},R2.set(e,n));const{byId:r,branches:s}=n;return l=>{let c=r.get(l.id);if(!c){const u=l.kind==="root"?s.get(l.sessionId):void 0;c=u?{...l,onOpenContext:t,branch:u}:{...l,onOpenContext:t},r.set(l.id,c)}return c}}function W0(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 X9(e,t,n,r,s,l,c,u,f,p,h,m,y,v,S,b,_,k){var ee,M,X,V;const j=[],E=[],C=Y9(e,k);for(const G of e.agents.values()){if(!_.has(G.id))continue;const F=G.exitAt!=null,L=b!=null&&!b.has(G.id),H=[F?"rf-exiting":"",L?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,D=l.get(G.id);if(j.push({id:G.id,type:"agent",position:{x:0,y:0},data:C(G),className:H,ariaLabel:oq(G,t,S.has(G.id)),...D?{width:D.width,height:D.height}:null}),G.parentId&&_.has(G.parentId)){const z=tf(G.sessionId),Z=F,U=S.size>0&&(S.has(G.id)||S.has(G.parentId)),ae=b!=null&&!b.has(G.id)&&!b.has(G.parentId),le=G.state==="active"?2:1.5,ge=U?le+1.5:le,Ne=Z?.2:ae?.12:1,Ie=["sess-edge",G.state==="active"?"sess-live":"sess-idle",Z?"rf-edge-exiting":"",U?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${G.parentId}->${G.id}`,source:G.parentId,target:G.id,animated:(G.state==="active"||U)&&!Z,type:"smoothstep",style:{"--session-hue":z,strokeWidth:`calc(${ge}px * var(--edge-k, 1))`,opacity:Ne,transition:"var(--edge-transition)"},className:Ie})}const K=G.kind==="root"?Cf(G):null,re=K?fM(G.sessionId,K.at):null;if(K&&re&&!uF(re)){const z=Tb(G.id),Z=tf(G.sessionId),U=l.get(z);j.push({id:z,type:"recapNote",position:{x:0,y:0},data:{sessionId:G.sessionId,parentId:G.id,recap:K,noteKey:re,hue:Z},className:L?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${G.label}`,...U?{width:U.width,height:U.height}:null}),E.push({id:`e:recap:${G.id}`,source:z,target:G.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":Z}})}}const R=W0(e),I=`${y}#lanes:${C9(R)}`,$=new Set(j.filter(G=>G.type==="recapNote").map(G=>G.id));for(const G of Array.from(h.keys()))pF(G)&&!$.has(G)&&!s.has(G)&&(h.delete(G),m.delete(G));const q=j.filter(G=>P9(G.id,s,h,m));if(q.length>0||I!==v.current){if(q.length>0){const G=O9(M9(j,E,{direction:"LR",pinned:s,measured:l,availableWidth:n,availableHeight:r,lanes:R}),s,F=>zh(F,h,m)?void 0:h.get(F));for(const F of G)zh(F.id,h,m)&&C2(F.id,F.position,h,m);$9(j,h,s,l,new Set(q.filter(F=>F.type!=="recapNote").map(F=>F.id)),R,{width:n,height:r});for(const F of q){if(F.type!=="recapNote")continue;const L=(ee=F.data)==null?void 0:ee.parentId;if(!L)continue;const H=s.get(L)??(zh(L,h,m)?void 0:h.get(L));if(!H)continue;const D=((M=l.get(F.id))==null?void 0:M.width)??G9,K=((X=l.get(F.id))==null?void 0:X.height)??T2,re=((V=l.get(L))==null?void 0:V.height)??T2;C2(F.id,{x:H.x-K9-D,y:H.y+(re-K)/2},h,m)}}I9(j,h,s,l,R),v.current=I}const B=L9(j,h,s,l,c,!f||p,R);B.length>0&&u(B);const P=W9(e.agents.values());Eh(h,P),Eh(m,P),Eh(s,P),Eh(l,H9(e.agents.values()));const W=[];let ne=!1;for(const G of j){let F=s.get(G.id)??h.get(G.id);F||(F=D9(G.id,h,m),ne=!0),W.push({...G,position:F})}return ne&&(v.current=""),{nodes:W,edges:E}}const Z9=1;function Q9(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 J9(e,t,n){const r=e.agents.get(t);if(!r)return null;const s=[];for(const l of e.agents.values())l.sessionId===t&&s.push(l);return{schemaVersion:Z9,exportedAt:n,sessionId:t,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:s.map(l=>({id:l.id,kind:l.kind,label:l.label,parentId:l.parentId,state:l.state,startedAt:l.startedAt,endedAt:l.endedAt,model:l.model,cwd:l.cwd,usage:l.usage,prompts:l.prompts,tools:l.tools.map(Q9)}))}}function eV(e,t){const n=(e||"session").replace(/[^a-z0-9._-]/gi,"_");return`${hn}-${n}-${t.slice(0,8)}.json`}function tV(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function nV(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 rV(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function sV(e,t){const n=rV(e),r=(...c)=>[n?`${n} on the canvas`:null,...c,"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 c=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,u=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{goes:r(),stays:[`the event log — ${c}${u}`,"restart this deck and the log replays back onto it"],final:null,confirm:"Clear this canvas"}}if(t.decks<=1)return{goes:r("this deck's event log — the file a restarted deck replays to rebuild what you see"),stays:[],final:s,confirm:"Clear everything"};const l=t.decks-1;return{goes:r(`the event log ${l===1?"1 other running deck shares":`${l} other running decks share`} with this one — every session recorded in it, not just the ones drawn here`),stays:[l===1?"what that deck shows, until it restarts — then it is gone there too":"what those decks show, until they restart — then it is gone there too"],final:s,confirm:"Clear everything"}}function aV({agentCount:e,onConfirm:t,onCancel:n}){const r=w.useRef(null),s=mn(n,{focusRef:r,layer:L6}),[l,c]=w.useState(null);w.useEffect(()=>{let m=!1;return fetch("/api/clear").then(y=>y.ok?y.json():null).then(y=>{m||c(nV(y))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:f,final:p,confirm:h}=sV(e,l);return o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:s,className:"modal clear-confirm",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{className:"status-dot err","aria-hidden":!0}),o.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[o.jsxs("dl",{className:"cc-plan",children:[o.jsx("dt",{children:"Goes"}),o.jsx("dd",{children:u.map(m=>o.jsx("span",{children:m},m))}),o.jsx("dt",{children:"Stays"}),o.jsx("dd",{children:f.length>0?f.map(m=>o.jsx("span",{children:m},m)):o.jsx("span",{children:"nothing"})})]}),p&&o.jsx("p",{className:"cc-final",children:p}),o.jsxs("div",{className:"cc-actions",children:[o.jsx("button",{type:"button",ref:r,className:"btn",onClick:n,children:"Cancel"}),o.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const oV="Press Esc first if a key does nothing.",iV=[{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 lV({onClose:e,onTour:t}){const n=mn(e);return o.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:o.jsxs("div",{ref:n,className:"modal key-help",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[t&&o.jsxs("div",{className:"guide-door",children:[o.jsx("span",{children:"Eight pictures of what the deck shows."}),o.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),o.jsx("div",{className:"shortcuts",children:iV.map(r=>o.jsxs(w.Fragment,{children:[o.jsx("h3",{className:"kh-group",children:r.title}),r.rows.map(s=>o.jsxs("div",{className:"sc",children:[o.jsx("kbd",{children:s.cap}),o.jsx("span",{children:s.action})]},`${r.title}:${s.cap}:${s.action}`))]},r.title))}),o.jsx("p",{className:"kh-foot",children:oV})]})]})})}const cV=1024*1024,A2=5,n$=.8,V0=24,uV="agent-dag.soundCustom.done",dV="agent-dag.soundCustom.needs-input",vu={done:uV,"needs-input":dV};function Du(e){if(e.kind!=="audio")return e;const{bytes:t,...n}=e;return n}function M2(e){return!e||!/^[a-zA-Z0-9._-]{1,96}$/.test(e)?null:e}function hV(e){return{done:M2(e(vu.done)),"needs-input":M2(e(vu["needs-input"]))}}function fV(e,t){return{done:e.done===t?null:e.done,"needs-input":e["needs-input"]===t?null:e["needs-input"]}}function pV(e){return e.done&&e.done===e["needs-input"]?e.done:null}const mV={wav:"audio/wav",wave:"audio/wav",mp3:"audio/mpeg",ogg:"audio/ogg",oga:"audio/ogg",webm:"audio/webm",m4a:"audio/mp4",mp4:"audio/mp4"},r$=new Set(["audio/wav","audio/x-wav","audio/mpeg","audio/mp3","audio/ogg","audio/webm","audio/mp4"]);function s$(e,t){const n=t.toLowerCase().split(";")[0].trim();if(r$.has(n))return n;const r=e.toLowerCase().split(".").pop()??"";return mV[r]??n}function I2(e,t){const n=s$(e.name,e.type);if(!r$.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>cV)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>A2)return`Audio must be ${A2} seconds or shorter.`}return null}function G0(e){return e>=V0?`There are already ${V0} custom sounds. Delete one first.`:null}function gV(e,t){const n=e.indexOf(t);return n<0?null:e[n+1]??e[n-1]??null}function yV(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,n$/t)}function a$(){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 wV(e,t,n=a$()){var p;const r=((p=e.name)==null?void 0:p.trim())||"Custom sound",s=I2({name:r,type:e.type,size:e.size});if(s)throw new Error(s);const l=await e.arrayBuffer();let c;try{c=await t(l.slice(0))}catch{throw new Error("The audio file could not be decoded.")}const u=I2({name:r,type:e.type,size:e.size},c.duration);if(u)throw new Error(u);const f=Array.from({length:c.numberOfChannels},(h,m)=>c.getChannelData(m));return{id:n,name:r.replace(/\.(wav|wave|mp3|ogg|oga|webm|m4a|mp4)$/i,"")||"Custom sound",kind:"audio",mime:s$(r,e.type),duration:c.duration,normalizationGain:yV(f),bytes:l}}function vV(e,t=a$()){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,l=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,l))}}const xV="ccdeck-notification-audio",bV=2,vs="assets",Bs="summaries";function Zu(){return typeof window<"u"?window.ccdeckNotificationAudio??null:null}function kV(){return new Promise((e,t)=>{const n=indexedDB.open(xV,bV);n.onupgradeneeded=r=>{const s=n.result,l=s.objectStoreNames.contains(vs)?n.transaction.objectStore(vs):s.createObjectStore(vs,{keyPath:"id"});if(s.objectStoreNames.contains(Bs))return;const c=s.createObjectStore(Bs,{keyPath:"id"});if(r.oldVersion<1)return;const u=l.openCursor();u.onsuccess=()=>{const f=u.result;f&&(c.put(Du(f.value)),f.continue())}},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??new Error("Could not open local audio storage."))})}async function Qu(e,t,n){const r=await kV();try{return await new Promise((s,l)=>{const c=r.transaction(e,t),u=n(c),f=()=>l(c.error??new Error("Local audio storage failed."));c.oncomplete=()=>s(u?u.result:void 0),c.onerror=f,c.onabort=f})}finally{r.close()}}async function NV(){const e=Zu();return e?e.list():typeof indexedDB>"u"?[]:await Qu([Bs],"readonly",t=>t.objectStore(Bs).getAll())??[]}async function SV(e){const t=Zu();return t?t.get(e):typeof indexedDB>"u"?null:await Qu([vs],"readonly",n=>n.objectStore(vs).get(e))??null}async function $2(e){const t=Zu();if(t){await t.put(e);return}if(typeof indexedDB>"u")throw new Error("Local audio storage is unavailable in this browser.");await Qu([vs,Bs],"readwrite",n=>{n.objectStore(vs).put(e),n.objectStore(Bs).put(Du(e))})}async function jV(e,t){const n=Zu();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 Qu([vs,Bs],"readwrite",r=>{const s=r.objectStore(vs),l=s.get(e);l.onsuccess=()=>{const c=l.result;if(!c)return;const u={...c,name:t};s.put(u),r.objectStore(Bs).put(Du(u))}})}async function _V(e){const t=Zu();if(t){await t.remove(e);return}typeof indexedDB>"u"||await Qu([vs,Bs],"readwrite",n=>{n.objectStore(vs).delete(e),n.objectStore(Bs).delete(e)})}const Uh=["done","needs-input"],EV=[{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}]}],CV=[{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}]}],ck={done:EV,"needs-input":CV},wr="two";function K0(e,t){const n=ck[e];return n.find(r=>r.id===t)??n.find(r=>r.id===wr)??n[0]}function o$(e,t){return ck[e].some(r=>r.id===t)?t:wr}K0("done",wr).notes,K0("needs-input",wr).notes;const O2=.04,i$=.24,di=0,Zl=100,df=5,bi=50;function Ql(e){if(!Number.isFinite(e))return bi;const t=Math.round(e/df)*df;return Math.min(Zl,Math.max(di,t))}function l$(e){if(e==null)return bi;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?Ql(Number(t)):bi}function Y0(e){const t=Ql(e),n=O2+(i$-O2)*(t/Zl);return Math.round(n*1e4)/1e4}function TV(e,t){const n=t.trim,r=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(Y0(e)*r*1e4)/1e4}const RV=160,AV="agent-dag.soundLevel.done",MV="agent-dag.soundLevel.needs-input",IV="agent-dag.soundFigure.done",$V="agent-dag.soundFigure.needs-input",c$={done:AV,"needs-input":MV},Hh={done:IV,"needs-input":$V},X0={done:{level:bi,figure:wr},"needs-input":{level:bi,figure:wr}};function OV(e){const t=n=>({level:l$(e(c$[n])),figure:o$(n,e(Hh[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const L2={Stop:"done",Notification:"needs-input"};function LV(e,t){var r;if(t)return null;const n=(r=e==null?void 0:e.payload)==null?void 0:r.hook_event_name;return typeof n!="string"?null:Object.hasOwn(L2,n)?L2[n]:null}function PV(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",l=()=>{var m;return(m=e.onState)==null?void 0:m.call(e,s())};function c(){var m;if(!(!t||r))try{n=n??new t,(m=n.resume)==null||m.call(n).then(l,()=>{}),r=!0,l()}catch{}}function u(m,y,v=y.figure){if(!n||n.state!=="running")return!1;const S=K0(m,v),b=TV(y.level,S),_=n.currentTime;for(const k of S.notes){const j=n.createOscillator(),E=n.createGain();j.type=S.type??"sine",j.frequency.value=k.hz;const C=_+k.at,R=C+k.ms/1e3;E.gain.setValueAtTime(1e-4,C),E.gain.exponentialRampToValueAtTime(b,C+.012),E.gain.exponentialRampToValueAtTime(1e-4,R),j.connect(E).connect(n.destination),j.start(C),j.stop(R+.02)}return!0}async function f(m,y){if(!e.loadCustom)return"unavailable";let v;try{v=await e.loadCustom(m)}catch{return"unavailable"}if(!v)return"missing";if(v.kind==="tts"){if(typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return"unavailable";const b=new SpeechSynthesisUtterance(v.text),_=window.speechSynthesis.getVoices();b.voice=_.find(k=>k.voiceURI===v.voiceURI)??null,b.rate=v.rate,b.pitch=v.pitch,b.volume=Math.min(1,Y0(y.level)/i$);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(b),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let S;try{S=await n.decodeAudioData(v.bytes.slice(0))}catch{return"broken"}try{const b=n.createBufferSource(),_=n.createGain();b.buffer=S;const k=v.normalizationGain*(Y0(y.level)/n$);return _.gain.setValueAtTime(Math.max(1e-4,k),n.currentTime),b.connect(_).connect(n.destination),b.start(n.currentTime),"played"}catch{return"unavailable"}}function p(m,y=!1){var b,_;if(!y&&!e.enabled())return!1;const v=(((b=e.prefs)==null?void 0:b.call(e))??X0)[m]??X0[m],S=((_=e.customSelection)==null?void 0:_.call(e)[m])??null;return S&&e.loadCustom?(f(S,v).then(k=>{var j;k==="played"||k==="locked"||((k==="missing"||k==="broken")&&((j=e.onCustomFailure)==null||j.call(e,m,S)),u(m,{...v,figure:wr},wr))}),!0):!n||n.state!=="running"?!1:u(m,v)}function h(m,y=bi){return f(m,{level:Ql(y),figure:wr}),!0}return{unlock:c,play:p,previewCustom:h,state:s,get context(){return n}}}const DV="With no deck tab open, get a notification wherever a sound would have played.",FV="With the ccdeck window closed, get a notification wherever a sound would have played.";function qV(e){return e?FV:DV}const BV="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",P2="Get notified when you're away from this tab.";function zV(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:P2};case"default":return{status:null,ask:!0,ok:!1,note:P2};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 pu(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}const D2={done:"Turn finished","needs-input":"Claude is asking"},UV={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function HV({onClose:e,soundOn:t,onToggleSound:n,prefs:r,onLevel:s,onFigure:l,onPreview:c,openerRef:u,customAssets:f,customSelections:p,onBuiltInSelected:h,onCustomSelected:m,onImportCustom:y,onCreateVoice:v,onRenameCustom:S,onPreviewCustom:b,onDeleteCustom:_,notifyOn:k,onToggleNotify:j,notifyVetoed:E,notifyPermission:C,onAskNotify:R}){var Ce;const I=zV(C),$=pu(),q=k&&!E&&!$,[B,P]=w.useState(""),[W,ne]=w.useState("Custom voice"),[ee,M]=w.useState("Your turn"),[X,V]=w.useState(""),[G,F]=w.useState("1"),[L,H]=w.useState("1"),[D,K]=w.useState([]),[re,z]=w.useState(!1),Z=w.useRef(null),U=w.useRef(null),ae=pV(p),le=((Ce=f.find(pe=>pe.id===ae))==null?void 0:Ce.name)??"the same custom sound",ge=f.length,Ne=G0(ge),Ie=Ne!==null,Ge=Ie?{"aria-disabled":!0,"aria-describedby":"sm-custom-full"}:{},[Pe,ze]=w.useState(null),Re=w.useRef(0),st=w.useRef(new Map),ue=w.useRef(null);w.useEffect(()=>{if(!Pe)return;const pe=window.setTimeout(()=>ze(null),4e3);return()=>window.clearTimeout(pe)},[Pe]),w.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const pe=()=>{const _e=window.speechSynthesis.getVoices();K(_e),V(Ye=>{var qe;return Ye||((qe=_e[0])==null?void 0:qe.voiceURI)||""})};return pe(),window.speechSynthesis.addEventListener("voiceschanged",pe),()=>window.speechSynthesis.removeEventListener("voiceschanged",pe)},[]);const ce=async pe=>{P("");try{await pe()}catch(_e){P(_e instanceof Error?_e.message:"Custom audio could not be saved.")}},se=(pe,_e)=>{const Ye=Date.now(),qe=Au({armedFor:Pe,target:pe,armedAt:Re.current,now:Ye,gapMs:Ou});if(qe==="arm"){ze(pe),Re.current=Ye;return}if(qe==="ignore")return;ze(null);const ke=gV(f.map(Ae=>Ae.id),pe);ce(async()=>{var Ue;await _(pe);const Ae=document.activeElement;Ae!==_e&&!$0((Ae==null?void 0:Ae.tagName)??null)||(Ue=ke?st.current.get(ke):ue.current)==null||Ue.focus()})},be=()=>{var pe;U.current!==null&&clearTimeout(U.current),U.current=null,((pe=Z.current)==null?void 0:pe.state)==="recording"&&Z.current.stop()},Le=async()=>{var _e;if(Ie)return;if(P(""),!((_e=navigator.mediaDevices)!=null&&_e.getUserMedia)||typeof MediaRecorder>"u"){P("Microphone recording is unavailable in this browser.");return}let pe;try{pe=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{P("Microphone access was denied or unavailable.");return}if(Z.current){pe.getTracks().forEach(Ye=>Ye.stop());return}try{const Ye=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"].find(Ae=>MediaRecorder.isTypeSupported(Ae)),qe=new MediaRecorder(pe,Ye?{mimeType:Ye}:void 0),ke=[];Z.current=qe,qe.ondataavailable=Ae=>{Ae.data.size&&ke.push(Ae.data)},qe.onerror=()=>P("Recording failed. Please try again."),qe.onstop=()=>{pe.getTracks().forEach(rt=>rt.stop()),U.current!==null&&clearTimeout(U.current),U.current=null;const Ae=Z.current===qe;if(Ae&&(Z.current=null),z(!1),!Ae||!ke.length)return;const Ue=qe.mimeType.split(";")[0],Fe=Ue==="audio/mp4"?"m4a":Ue==="audio/ogg"?"ogg":"webm",Ve=new File(ke,`Recorded voice.${Fe}`,{type:Ue});ce(()=>y(Ve))},qe.start(200),z(!0),U.current=setTimeout(be,4400)}catch{Z.current=null,pe.getTracks().forEach(Ye=>Ye.stop()),P("This browser cannot record a supported audio format.")}};w.useEffect(()=>()=>{U.current!==null&&clearTimeout(U.current);const pe=Z.current;Z.current=null,(pe==null?void 0:pe.state)==="recording"&&pe.stop()},[]);const de=mn(e,{popover:!0}),fe=w.useRef(e);return fe.current=e,w.useEffect(()=>{const pe=_e=>{var qe,ke;const Ye=_e.target;Ye&&((qe=de.current)!=null&&qe.contains(Ye)||(ke=u.current)!=null&&ke.contains(Ye)||fe.current())};return window.addEventListener("pointerdown",pe,!0),()=>window.removeEventListener("pointerdown",pe,!0)},[de,u]),o.jsxs("div",{ref:de,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[o.jsxs("div",{className:"sm-switches",children:[o.jsxs("label",{className:"sm-switch",children:[o.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),o.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:o.jsx("span",{className:"switch-knob"})})]}),o.jsxs("div",{className:"sm-setting",children:[o.jsxs("label",{className:"sm-switch",children:[o.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications while closed"}),o.jsx("button",{type:"button",role:"switch","aria-checked":k,"aria-labelledby":"sm-notify-label",className:"switch",onClick:j,title:"With no deck tab open, a notification wherever a sound would play",children:o.jsx("span",{className:"switch-knob"})})]}),o.jsx("p",{className:"sm-note",children:E?BV:qV($)})]})]}),q&&o.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[o.jsxs("div",{className:"sm-channel-head",children:[o.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),I.ask?o.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:R,children:"Enable"}):o.jsxs("span",{className:"sm-channel-state","data-ok":I.ok||void 0,children:[I.ok&&o.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:o.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),I.status]})]}),o.jsx("p",{className:"sm-note",children:I.note})]}),!t&&o.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."}),o.jsx("div",{className:"sm-tones",children:Uh.map(pe=>{const _e=r[pe],Ye=`sm-level-${pe}`,qe=`sm-figure-${pe}`;return o.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${pe}`,children:[o.jsxs("div",{className:"sm-tone-head",children:[o.jsx("h3",{className:"sm-tone-name",id:`sm-name-${pe}`,children:D2[pe]}),o.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(pe),"aria-label":`Hear the ${D2[pe].toLowerCase()} tone`,title:t?"Play this tone now, at what it is set to":"Plays even when Sounds is off","aria-describedby":t?void 0:"sm-preview-note",children:[o.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:o.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),o.jsxs("div",{className:"sm-row",children:[o.jsx("label",{htmlFor:Ye,children:"Volume"}),o.jsx("input",{id:Ye,type:"range",min:di,max:Zl,step:df,value:_e.level,onChange:ke=>s(pe,Number(ke.target.value)),style:{"--sm-level":`${(_e.level-di)/(Zl-di)*100}%`}}),o.jsxs("span",{className:"sm-read",children:[_e.level,"%"]})]}),o.jsxs("div",{className:"sm-row",children:[o.jsx("label",{htmlFor:qe,children:"Tone"}),o.jsxs("select",{id:qe,className:"sm-select",value:p[pe]?`custom:${p[pe]}`:_e.figure,onChange:ke=>{const Ae=ke.target.value;Ae.startsWith("custom:")?m(pe,Ae.slice(7)):(h(pe),l(pe,Ae))},children:[ck[pe].map(ke=>o.jsx("option",{value:ke.id,children:ke.label},ke.id)),f.length>0&&o.jsx("optgroup",{label:"Custom",children:f.map(ke=>o.jsx("option",{value:`custom:${ke.id}`,children:ke.name},ke.id))})]})]}),o.jsx("p",{className:"sm-note",children:UV[pe]})]},pe)})}),ae&&o.jsxs("p",{className:"sm-note",role:"status",children:["Both tones use “",le,"”. They may be harder to tell apart."]}),o.jsxs("section",{className:"sm-custom","aria-labelledby":"sm-custom-title",children:[o.jsxs("div",{className:"sm-custom-head",children:[o.jsx("h3",{className:"sm-tone-name",id:"sm-custom-title",children:"Custom sounds"}),o.jsxs("span",{children:[ge," of ",V0,", kept on this machine"]})]}),Ie&&o.jsx("p",{className:"sm-note",id:"sm-custom-full",children:Ne}),o.jsxs("div",{className:"sm-custom-actions",children:[o.jsxs("label",{className:"sm-custom-card sm-file",children:[o.jsxs("span",{className:"sm-custom-card-copy",children:[o.jsx("strong",{children:"Import audio"}),o.jsx("span",{children:"WAV, MP3 or OGG"})]}),o.jsx("span",{className:"btn sm-custom-action","aria-hidden":"true",children:"Choose file"}),o.jsx("input",{ref:ue,type:"file",accept:"audio/wav,audio/x-wav,audio/mpeg,audio/mp3,audio/ogg,.wav,.mp3,.ogg",...Ge,onClick:pe=>{Ie&&pe.preventDefault()},onChange:pe=>{var Ye;const _e=(Ye=pe.target.files)==null?void 0:Ye[0];pe.currentTarget.value="",_e&&!Ie&&ce(()=>y(_e))}})]}),o.jsxs("div",{className:"sm-custom-card",children:[o.jsxs("span",{className:"sm-custom-card-copy",children:[o.jsx("strong",{children:"Record a clip"}),o.jsx("span",{children:re?"Recording…":"Up to 5 seconds"})]}),re?o.jsx("button",{type:"button",className:"btn sm-custom-action",onClick:be,children:"Stop & save"}):o.jsx("button",{type:"button",className:"btn sm-custom-action",...Ge,onClick:()=>void Le(),children:"Record"})]})]}),o.jsxs("details",{className:"sm-voice",children:[o.jsxs("summary",{...Ge,onClick:pe=>{const _e=pe.currentTarget.parentElement;Ie&&_e&&!_e.open&&pe.preventDefault()},children:[o.jsx("span",{children:"Spoken voice"}),o.jsx("span",{children:"Create from text"})]}),o.jsxs("div",{className:"sm-voice-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"Name"}),o.jsx("input",{className:"ap-manage-input",value:W,maxLength:80,onChange:pe=>ne(pe.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Text"}),o.jsx("input",{className:"ap-manage-input",value:ee,maxLength:180,onChange:pe=>M(pe.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Voice"}),o.jsxs("select",{className:"sm-select",value:X,onChange:pe=>V(pe.target.value),children:[o.jsx("option",{value:"",children:"System default"}),D.map(pe=>o.jsx("option",{value:pe.voiceURI,children:pe.name},pe.voiceURI))]})]}),o.jsxs("div",{className:"sm-voice-pair",children:[o.jsxs("label",{children:[o.jsx("span",{children:"Rate"}),o.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:G,onChange:pe=>F(pe.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Pitch"}),o.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:L,onChange:pe=>H(pe.target.value)})]})]}),o.jsx("button",{type:"button",className:"btn sm-custom-action",...Ge,onClick:()=>{Ie||ce(async()=>{await v({name:W,text:ee,voiceURI:X,rate:parseFloat(G),pitch:parseFloat(L)}),M("Your turn")})},children:"Add spoken voice"})]})]}),f.length>0&&o.jsx("div",{className:"sm-custom-list",children:f.map(pe=>o.jsxs("div",{className:"sm-custom-item",children:[o.jsx("input",{className:"ap-manage-input","aria-label":`Rename ${pe.name}`,defaultValue:pe.name,maxLength:80,onBlur:_e=>{if(!_e.target.value.trim()){_e.target.value=pe.name;return}ce(()=>S(pe.id,_e.target.value))},onKeyDown:_e=>{_e.key==="Enter"&&_e.currentTarget.blur()}}),o.jsx("span",{children:pe.kind==="audio"?`${pe.duration.toFixed(1)}s`:"Voice"}),o.jsx("button",{type:"button",className:"btn sm-custom-icon","aria-label":`Play ${pe.name}`,onClick:()=>b(pe.id),children:"Play"}),o.jsx("button",{type:"button",ref:_e=>{_e?st.current.set(pe.id,_e):st.current.delete(pe.id)},className:`btn sm-custom-icon${Pe===pe.id?" armed":""}`,onKeyDown:_e=>{_e.repeat&&_e.preventDefault()},onClick:_e=>se(pe.id,_e.currentTarget),"aria-label":Pe===pe.id?`Confirm deleting ${pe.name}`:`Delete ${pe.name}`,title:Pe===pe.id?"Press again to delete this sound. It cannot be brought back.":"Delete this sound",children:Pe===pe.id?"Confirm":"Delete"})]},pe.id))}),B&&o.jsx("p",{className:"sm-custom-error",role:"alert",children:B})]}),o.jsxs("p",{className:"sm-foot",children:[o.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const u$="agent-dag.character-enabled",d$="agent-dag.fm-volume",F2="agent-dag.fm-source",WV=[{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 VV(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 GV(e){return e!=="0"}function KV(){return GV(yr(u$))}function YV(e){return l$(e)}function XV(){return YV(yr(d$))}const q2="agent-dag.fm-custom-stations",B2="agent-dag.fm-muted",Z0="custom:",ZV=/^UC[A-Za-z0-9_-]{22}$/,QV=/^[A-Za-z0-9_-]{11}$/,uk=/^[A-Za-z0-9_-]{1,80}$/,JV=/\.(mp3|aac|ogg)$/i,eG=/\.m3u8$/i,h$=2048,Fu=80;function ki(e){return`${Z0}${e}`}function Jl(e){if(!e.startsWith(Z0))return null;const t=e.slice(Z0.length);return uk.test(t)?t:null}function z2(e){return Jl(e)??e}function tG(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 dk(e){var c,u;const t=e.trim();if(t.length>h$)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 f=(c=/^\/channel\/([^/]+)(?:\/live)?\/?$/.exec(n.pathname))==null?void 0:c[1];if(f&&ZV.test(f))return{kind:"youtube-channel",url:r,channel:f};const p=(u=/^\/@([^/]+)\/live\/?$/.exec(n.pathname))==null?void 0:u[1];if(p&&/^[A-Za-z0-9._-]{1,64}$/.test(p))return{kind:"youtube-handle",url:r,handle:p};if(n.pathname==="/watch"){const h=n.searchParams.get("v")??"";if(QV.test(h))return{kind:"youtube-video",url:r,video:h}}return null}return eG.test(n.pathname)?{kind:"direct-audio",url:r,format:"hls"}:JV.test(n.pathname)?{kind:"direct-audio",url:r,format:"audio"}:null}function nG(e){return e==="1"}function rG(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 l=typeof s.id=="string"?s.id:"",c=typeof s.name=="string"?s.name.trim():"",u=typeof s.url=="string"?s.url.trim():"",f=dk(u);!uk.test(l)||n.has(l)||!c||c.length>Fu||!f||(n.add(l),r.push({id:l,name:c,url:f.url}))}return r}function sG(e,t,n){const r=Jl(e??"");return r&&t.some(s=>s.id===r)?ki(r):n(e)}function aG(e,t){return e===ki(t)?"claude-fm":e}function oG(){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 iG(e,t,n=oG()){const r=e.trim(),s=dk(t);return!r||r.length>Fu||!uk.test(n)||!s?null:{id:n,name:r,url:s.url}}const Tl=["light","dark"],lG={light:"Light",dark:"Dark"},U2=WV,Rl="Give the station a name.",cG="Use an https YouTube live or channel link, or a .mp3, .aac, .ogg or .m3u8 stream.";function uG({theme:e}){return o.jsx("span",{className:"appearance-preview","data-swatch":e,children:o.jsxs("svg",{viewBox:"0 0 112 56","aria-hidden":!0,focusable:"false",children:[o.jsx("rect",{className:"tp-canvas",width:"112",height:"56"}),o.jsx("rect",{className:"tp-surface",width:"112",height:"7"}),o.jsx("rect",{className:"tp-rule",y:"7",width:"112",height:"1"}),o.jsx("rect",{className:"tp-surface",y:"8",width:"25",height:"48"}),o.jsx("rect",{className:"tp-rule",x:"25",y:"8",width:"1",height:"48"}),o.jsx("rect",{className:"tp-card",x:"36.5",y:"27.5",width:"28",height:"14",rx:"2.5"}),o.jsx("rect",{className:"tp-tag",x:"39.5",y:"25.5",width:"13",height:"4",rx:"2"}),o.jsx("rect",{className:"tp-card",x:"76.5",y:"14.5",width:"29",height:"20",rx:"2.5"}),o.jsx("rect",{className:"tp-rule",x:"81",y:"23",width:"20",height:"2",rx:"1"}),o.jsx("rect",{className:"tp-accent",x:"81",y:"23",width:"12",height:"2",rx:"1"})]})})}function dG({theme:e,onTheme:t,characterEnabled:n,onToggleCharacter:r,fmVolume:s,onFmVolume:l,fmMuted:c,onFmMuted:u,fmSource:f,onFmSource:p,customFmStations:h,unavailableFmStations:m,onAddFmStation:y,onRenameFmStation:v,onRemoveFmStation:S,onClose:b}){var ce;const _=mn(b),k=[...U2.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:ki(se.id),label:m.has(se.id)?`${se.name} · unavailable`:se.name,unavailable:m.has(se.id)}))],j=k.some(se=>se.value===f&&se.unavailable),E=[];k.forEach((se,be)=>{const Le=E[E.length-1];Le&&Le.group===se.group?Le.indexes.push(be):E.push({group:se.group,indexes:[be]})});const[C,R]=w.useState(!1),[I,$]=w.useState(()=>Math.max(0,k.findIndex(se=>se.value===f))),[q,B]=w.useState(!1),[P,W]=w.useState(""),[ne,ee]=w.useState(""),[M,X]=w.useState(""),[V,G]=w.useState(!1),[F,L]=w.useState(""),[H,D]=w.useState(""),K=w.useRef(null),re=w.useRef(null),z=w.useRef(null),Z=w.useRef(null),U=w.useRef(null),ae=Jl(f),le=ae?h.find(se=>se.id===ae):void 0;w.useEffect(()=>{const se=k.findIndex(be=>be.value===f);$(se<0?0:se)},[f,h,m]),w.useEffect(()=>{G(!1),L((le==null?void 0:le.name)??"")},[le==null?void 0:le.id,le==null?void 0:le.name]),w.useEffect(()=>{var se;C&&((se=document.getElementById(`appearance-fm-option-${I}`))==null||se.scrollIntoView({block:"nearest"}))},[I,C]),w.useEffect(()=>{if(!C)return;const se=be=>{var de,fe;const Le=be.target;!((de=K.current)!=null&&de.contains(Le))&&!((fe=U.current)!=null&&fe.contains(Le))&&R(!1)};return document.addEventListener("pointerdown",se),()=>document.removeEventListener("pointerdown",se)},[C]);const ge=se=>{const be=se.relatedTarget;be&&!se.currentTarget.contains(be)&&R(!1)},Ne=se=>{var Le;const be=k[se];be&&($(se),p(be.value),R(!1),(Le=K.current)==null||Le.focus())},Ie=se=>{if(D6(se.key)){if(!C)return;se.preventDefault(),se.stopPropagation(),R(!1);return}if(se.key==="Tab"){R(!1);return}if(se.key==="Enter"||se.key===" "){se.preventDefault(),C?Ne(I):R(!0);return}se.key!=="ArrowDown"&&se.key!=="ArrowUp"&&se.key!=="Home"&&se.key!=="End"||(se.preventDefault(),R(!0),$(be=>se.key==="Home"?0:se.key==="End"?k.length-1:Math.min(k.length-1,Math.max(0,be+(se.key==="ArrowDown"?1:-1)))))},Ge=()=>{var se;return(se=K.current)==null?void 0:se.focus()},Pe=se=>{var Le,de;if(se.preventDefault(),!P.trim()){X(Rl),(Le=re.current)==null||Le.focus();return}const be=iG(P,ne);if(!be){X(cG),(de=z.current)==null||de.focus();return}y(be),p(ki(be.id)),W(""),ee(""),X(""),B(!1),Ge()},ze=se=>{var be;if(se.preventDefault(),!!ae){if(!F.trim()){D(Rl),(be=Z.current)==null||be.focus();return}v(ae,F),G(!1),Ge()}},Re=se=>{var de;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(se.key))return;se.preventDefault();const Le=(Tl.indexOf(e)+(se.key==="ArrowLeft"||se.key==="ArrowUp"?-1:1)+Tl.length)%Tl.length;t(Tl[Le]),(de=se.currentTarget.querySelectorAll('[role="radio"]')[Le])==null||de.focus()},st=se=>{var Le;if(se.key===" "){se.stopPropagation();return}if(Ef(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"&&((Le=se.currentTarget.querySelectorAll('[role="radio"]')[Tl.indexOf(be)])==null||Le.focus())},ue=se=>{const be=k[se],Le="unavailable"in be&&be.unavailable;return o.jsxs("div",{className:"appearance-source-option",role:"option",id:`appearance-fm-option-${se}`,"aria-selected":f===be.value,"data-highlighted":I===se||void 0,"data-unavailable":Le||void 0,onMouseEnter:()=>$(se),onClick:()=>Ne(se),children:[o.jsx("span",{children:be.label}),f===be.value&&o.jsx("span",{"aria-hidden":!0,children:"✓"})]},be.value)};return On.createPortal(o.jsx("div",{className:"modal-backdrop appearance-backdrop",onClick:b,role:"presentation",children:o.jsxs("div",{ref:_,id:"appearance-menu",className:"modal appearance-menu appearance-modal",role:"dialog","aria-modal":"true","aria-labelledby":"appearance-title",onClick:se=>se.stopPropagation(),onKeyDown:st,children:[o.jsxs("div",{className:"appearance-head",children:[o.jsxs("div",{className:"appearance-heading",children:[o.jsx("h2",{id:"appearance-title",className:"appearance-title",children:"Appearance"}),o.jsx("p",{className:"appearance-subtitle",children:"Tune the deck to your workspace."})]}),o.jsx("button",{type:"button",className:"glyph-btn appearance-close",onClick:b,"aria-label":"Close appearance settings",title:"Close (Esc)",children:"×"})]}),o.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-theme-caption",children:[o.jsxs("div",{className:"appearance-caption",children:[o.jsxs("div",{children:[o.jsx("h3",{id:"appearance-theme-caption",children:"Color theme"}),o.jsx("p",{className:"appearance-section-note",children:"Choose how the dashboard looks."})]}),o.jsx("kbd",{className:"appearance-key","aria-hidden":!0,title:"Press T anywhere to switch themes",children:"T"})]}),o.jsx("div",{className:"appearance-themes",role:"radiogroup","aria-labelledby":"appearance-theme-caption","aria-keyshortcuts":"T",onKeyDown:Re,children:Tl.map(se=>o.jsxs("button",{type:"button",className:"appearance-theme",role:"radio","aria-checked":e===se,tabIndex:e===se?0:-1,onClick:()=>t(se),children:[o.jsx(uG,{theme:se}),o.jsxs("span",{className:"appearance-theme-name",children:[lG[se],o.jsx("svg",{className:"appearance-check",viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:o.jsx("path",{d:"M2.5 6.4 4.9 8.7 9.5 3.6"})})]})]},se))})]}),o.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-fm-caption",children:[o.jsx("div",{className:"appearance-caption",children:o.jsx("h3",{id:"appearance-fm-caption",children:"Music source"})}),o.jsxs("div",{className:"appearance-controls",children:[o.jsxs("div",{className:"appearance-source-row",children:[o.jsx("label",{htmlFor:"appearance-fm-source",children:"Station"}),o.jsxs("div",{className:`appearance-source-picker${C?" is-open":""}`,onBlur:ge,children:[o.jsxs("button",{ref:K,type:"button",id:"appearance-fm-source",className:"appearance-source-trigger",role:"combobox","aria-haspopup":"listbox","aria-expanded":C,"aria-controls":C?"appearance-fm-source-list":void 0,"aria-activedescendant":C?`appearance-fm-option-${I}`:void 0,"aria-describedby":"appearance-fm-source-note",onClick:()=>R(se=>!se),onKeyDown:Ie,children:[o.jsx("span",{children:((ce=k.find(se=>se.value===f))==null?void 0:ce.label)??U2[0].label}),o.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:o.jsx("path",{d:"m2.5 4.5 3.5 3 3.5-3"})})]}),C&&o.jsx("div",{ref:U,id:"appearance-fm-source-list",className:"appearance-source-list",role:"listbox","aria-label":"Music stations",children:E.map((se,be)=>se.group?o.jsxs("div",{role:"group","aria-labelledby":`appearance-fm-group-${be}`,children:[o.jsx("div",{id:`appearance-fm-group-${be}`,className:"appearance-source-group",role:"presentation",children:se.group}),se.indexes.map(ue)]},`group-${be}`):se.indexes.map(ue))})]})]}),o.jsx("span",{id:"appearance-fm-source-note",className:"vis-hidden",children:"Changing station starts live playback automatically."}),o.jsx("p",{className:"appearance-fm-status",role:"status",children:j?tG(Jl(f)!==null):""}),o.jsxs("div",{className:"appearance-station-manage",children:[o.jsx("button",{type:"button",className:"btn appearance-station-action","aria-expanded":q,onClick:()=>{B(se=>!se),X("")},children:q?"Cancel":"+ Add station"}),le&&!V&&o.jsxs("span",{className:"appearance-station-edit",children:[o.jsx("button",{type:"button",className:"btn appearance-station-action",onClick:()=>{L(le.name),D(""),G(!0)},children:"Rename"}),o.jsx("button",{type:"button",className:"btn danger appearance-station-action",onClick:()=>{S(le.id),Ge()},children:"Remove"})]})]}),q&&o.jsxs("form",{className:"appearance-station-form",onSubmit:Pe,noValidate:!0,children:[o.jsxs("label",{className:"appearance-station-field",children:[o.jsx("span",{children:"Station name"}),o.jsx("input",{ref:re,className:"ap-manage-input",value:P,onChange:se=>W(se.target.value),"aria-invalid":M===Rl||void 0,"aria-describedby":M===Rl?"appearance-station-error":void 0,maxLength:Fu,autoFocus:!0})]}),o.jsxs("label",{className:"appearance-station-field",children:[o.jsx("span",{children:"Link"}),o.jsx("input",{ref:z,className:"ap-manage-input",value:ne,onChange:se=>ee(se.target.value),placeholder:"https://…","aria-invalid":M!==""&&M!==Rl||void 0,"aria-describedby":M&&M!==Rl?"appearance-station-error":void 0,inputMode:"url",autoComplete:"off",spellCheck:!1,maxLength:h$})]}),o.jsx("button",{type:"submit",className:"btn primary",children:"Add"}),M&&o.jsx("p",{id:"appearance-station-error",className:"appearance-station-error",role:"alert",children:M})]}),le&&V&&o.jsxs("form",{className:"appearance-station-form is-rename",onSubmit:ze,noValidate:!0,children:[o.jsxs("label",{className:"appearance-station-field",children:[o.jsx("span",{children:"Station name"}),o.jsx("input",{ref:Z,className:"ap-manage-input",value:F,onChange:se=>L(se.target.value),"aria-invalid":H!==""||void 0,"aria-describedby":H?"appearance-rename-error":void 0,maxLength:Fu,autoFocus:!0})]}),o.jsx("button",{type:"submit",className:"btn primary",children:"Save"}),o.jsx("button",{type:"button",className:"btn",onClick:()=>{G(!1),Ge()},children:"Cancel"}),H&&o.jsx("p",{id:"appearance-rename-error",className:"appearance-station-error",role:"alert",children:H})]}),o.jsxs("label",{className:"appearance-row",children:[o.jsx("span",{className:"appearance-row-label",id:"appearance-character-label",children:"Show character on minimap"}),o.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":n,"aria-labelledby":"appearance-character-label","aria-describedby":"appearance-character-note",onClick:r,children:o.jsx("span",{className:"switch-knob"})}),o.jsx("span",{id:"appearance-character-note",className:"vis-hidden",children:"Shows the animated minimap character and enables music playback."})]}),o.jsxs("div",{className:"sm-row",children:[o.jsx("label",{htmlFor:"appearance-fm-volume",children:"Volume"}),o.jsx("input",{id:"appearance-fm-volume",type:"range",min:di,max:Zl,step:df,value:s,"aria-describedby":"appearance-fm-volume-note",onChange:se=>l(Number(se.target.value)),style:{"--sm-level":`${(s-di)/(Zl-di)*100}%`}}),o.jsxs("span",{className:"sm-read",children:[s,"%"]})]}),o.jsxs("label",{className:"appearance-row",children:[o.jsx("span",{className:"appearance-row-label",id:"appearance-fm-mute-label",children:"Mute music"}),o.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":c,"aria-labelledby":"appearance-fm-mute-label",onClick:u,children:o.jsx("span",{className:"switch-knob"})})]})]}),o.jsx("span",{id:"appearance-fm-volume-note",className:"vis-hidden",children:"Controls live music volume."})]})]})}),document.body)}const Q0="https://www.youtube-nocookie.com";function hG(e,t,n){const r=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${Q0}/embed/${n?encodeURIComponent(n):"live_stream"}?${r.toString()}`}function Al(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function fG(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const pG=[1,3],mG=[0,2],gG=[2,5,100,101,150];function yG(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:pG.includes(s)?{kind:"playing",playing:!0}:mG.includes(s)?{kind:"playing",playing:!1}:null}return null}const f$=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],H2=18,wG=f$.length,p$=new Set(["a","c","p"]);function Jf(e=f$){const t=[];return e.forEach((n,r)=>{let s=0;for(;s<n.length;){const l=n[s];if(l==="."){s+=1;continue}let c=1;for(;s+c<n.length&&n[s+c]===l;)c+=1;t.push({x:s,y:r,w:c,cell:l}),s+=c}}),t}const hi=148,W2=6e3,vG=16e3,m$=46,ro=34;function xG(e,t,n=hi){let r=-Math.round(t()*n);if(Math.abs(r-e)<ro){const s=e-ro>=-n?-ro:ro;r=Math.max(-n,Math.min(0,Math.round(e+s)))}return{to:r,ms:Math.round(Math.abs(r-e)*m$)}}function bG(e){return Math.round(W2+e()*(vG-W2))}const V2=[{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 kG(e){const t=V2.reduce((r,s)=>r+s.weight,0);let n=e()*t;for(const r of V2)if(n-=r.weight,n<0)return r.kind;return"stroll"}const NG=720,SG=260,jG=620,_G=220,G2=520,g$=1600,K2=7e3,EG=15e3,Y2=6e3,CG=14e3;function Ml(e,t,n=hi){let r=-Math.round(t()*n);if(Math.abs(r-e)<ro){const s=e-ro>=-n?-ro:ro;r=Math.max(-n,Math.min(0,Math.round(e+s)))}return r}const fn=(e,t)=>Math.round(Math.abs(t-e)*m$),TG=120,Ch=0;function RG(e,t){const n=r=>({kind:"litter",at:t,...r});return[{x:t,prop:n({}),act:"walk",ms:fn(e,t)},{x:t,prop:n({}),act:"stoop",ms:NG},{x:Ch,prop:n({held:!0}),act:"carry",ms:fn(t,Ch)},{x:Ch,prop:n({held:!0}),act:"windup",ms:SG},{x:Ch,prop:n({held:!0,leaving:!0}),act:"toss",ms:jG}]}function AG(e,t){const n=t>e?1:-1,r=t-n*Math.min(15,Math.abs(t-e)),s=(l={})=>({kind:"ball",at:t,...l});return[{x:r,prop:s(),act:"walk",ms:fn(e,r)},{x:r,prop:s(),act:"windup",ms:_G,facing:n>0?"right":"left"},{x:r,prop:s({leaving:!0}),act:"kick",ms:G2,facing:n>0?"right":"left"},{x:r,prop:s({leaving:!0}),act:"stand",ms:g$-G2}]}const y$=640;function MG(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:fn(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:fn(r,0)}]}function IG(e,t,n){const r=Math.max(-110,Math.min(-30,t)),s={x:r,prop:null};return[{...s,act:"walk",ms:fn(e,r)},{...s,act:"skip-ready",ms:500},{...s,act:"skip",ms:y$*(6+Math.floor(n()*5))},{...s,act:"skip-rest",ms:600},{...s,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:fn(r,0)}]}function $G(e,t,n){return[{x:t,prop:null,act:"walk",ms:fn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(Y2+n()*(CG-Y2))},{x:t,prop:null,act:"stand",ms:400}]}function OG(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:fn(e,t)},{x:t,prop:r(),act:"watch",ms:Math.round(K2+n()*(EG-K2))},{x:t,prop:r(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function Qx(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 LG=1500,PG=e=>Math.round(1e3*Math.sqrt(2*e/LG)),DG=115,FG=e=>Math.round(e/DG*1e3),qG=620,BG=200,zG=760,UG=600,HG=240;function WG(e,t,n){const s=-(t.ledgeSpan??hi),l=PG(t.ledgeH),c=FG(t.ledgeH),u=n(),f=n(),p=-Math.round(u*t.floorSpan),h=-Math.round(f*t.floorSpan);return[{x:s,act:"walk",prop:null,ms:fn(e,s)},{x:s,act:"peer",prop:null,ms:qG},{x:s,act:"fall",prop:null,ms:l,place:"floor"},{x:s,act:"land",prop:null,ms:BG,place:"floor"},{x:p,act:"walk",prop:null,ms:fn(s,p),place:"floor",floorFrac:u},{x:h,act:"walk",prop:null,ms:fn(p,h),place:"floor",floorFrac:f},{x:s,act:"walk",prop:null,ms:fn(h,s),place:"floor"},{x:s,act:"lasso",prop:null,ms:zG,place:"floor"},{x:s,act:"rope-throw",prop:null,ms:UG,place:"floor"},{x:s,act:"rope-catch",prop:null,ms:HG,place:"floor"},{x:s,act:"climb",prop:null,ms:c},{x:s,act:"pull-up",prop:null,ms:480}]}function VG(e,t,n){const r=(n==null?void 0:n.ledgeSpan)??hi;switch(kG(t)){case"tidy":return RG(e,Ml(e,t,r));case"kick":return AG(e,Ml(e,t,r));case"sit":return $G(e,Ml(e,t,r),t);case"watch":return OG(e,Ml(e,t,r),t);case"fish":return MG(e,Ml(e,t,r),t);case"skip":return IG(e,Ml(e,t,r),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return WG(e,n,t)}}const l=xG(e,t,r);return[{x:l.to,prop:null,act:"walk",ms:l.ms}]}const GG=[".xx.","xxxx",".xx."],KG=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],YG=["...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."],Jx={litter:GG,ball:KG,scope:YG},w$=["bob","sway","groove"],X2=9e3,XG=16e3,v$=1e3,ZG=.08;function QG(e,t){const n=w$.filter(l=>l!==e),r=n[Math.min(n.length-1,Math.floor(t()*n.length))],s=(t()*2-1)*ZG;return{dance:r,beatMs:Math.round(v$*(1+s))}}function JG(e){return Math.round(X2+e()*(XG-X2))}const eK=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],tK=3,nK=-1,J0=11,Z2=9,rK=420;function sK(e,t,n){const r=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(rK,Math.max(0,r))}const aK=260,oK=200;function iK(e,t,n){const r=(h,m=fn(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 c=t>e,u=c?n.left:n.right,f=c?n.right:n.left,p={place:"floor",riser:n.height,prop:null};return[r(u,fn(e,u)),{...p,x:u,act:"mount",ms:aK},{...p,x:f,act:"walk",ms:fn(u,f)},{x:f,prop:null,act:"dismount",ms:oK,place:"floor"},{x:t,prop:null,act:"walk",ms:fn(f,t),place:"floor"}]}function Q2(e){let t=null,n=null,r=0,s=0,l=!1;const c=()=>{t!==null&&clearTimeout(t),t=null},u=()=>{l||e.hidden||!n||t!==null||(s=performance.now(),t=setTimeout(()=>{t=null;const p=n;n=null,p==null||p()},r))},f=()=>{e.hidden&&t!==null?(r=Math.max(0,r-(performance.now()-s)),c()):e.hidden||u()};return e.addEventListener("visibilitychange",f),{schedule(p,h){l||(c(),n=p,r=Math.max(0,h),u())},dispose(){l=!0,c(),n=null,e.removeEventListener("visibilitychange",f)}}}const lK={"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 cK(e,t){return t&&ki(t.id)===e?t.name:Jl(e)?"Custom FM":lK[e]}const uK={"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 e0(e,t){var r;const n=((r=e[0])==null?void 0:r.length)??0;return o.jsx("svg",{viewBox:`0 0 ${n} ${e.length}`,shapeRendering:"crispEdges","aria-hidden":!0,children:Jf(e).map(s=>o.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 t0={e:"fm-eye",s:"fm-shade",p:"fm-pad"},hf=Jf().filter(e=>!p$.has(e.cell)),dK=Jf().filter(e=>p$.has(e.cell)),J2=hf.filter(e=>e.cell==="e"),hK=Jf(eK),fK=hf.filter(e=>e.y<J0&&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),pK={left:hf.filter(e=>e.y>=J0&&e.x<Z2),right:hf.filter(e=>e.y>=J0&&e.x>=Z2)},eR={litter:e0(Jx.litter,"litter"),ball:e0(Jx.ball,"ball"),scope:e0(Jx.scope,"scope")};function mK(e){try{return new URL(e).host}catch{return"the station's server"}}const gK=w.memo(function({fetchImpl:t,volume:n,muted:r=!1,source:s="claude-fm",playRequest:l=0,customStation:c,onAvailabilityChange:u}){const[f,p]=w.useState(null),[h,m]=w.useState(!1),[y,v]=w.useState(!1),[S,b]=w.useState(!1),_=w.useRef(l),k=w.useRef(null),j=w.useRef(null),[E,C]=w.useState(0),[R,I]=w.useState(0),[$,q]=w.useState(null),[B,P]=w.useState(null),[W,ne]=w.useState({x:0,drop:0}),[ee,M]=w.useState("ledge"),[X,V]=w.useState("left"),[G,F]=w.useState(0),L=w.useRef(null),[H,D]=w.useState(()=>document.hidden);w.useEffect(()=>{const ue=new Set,ce=()=>{var se;if(document.hidden){for(const be of((se=L.current)==null?void 0:se.getAnimations({subtree:!0}))??[])if(be.playState==="running"||be.pending){const Le=be.currentTime;be.pause(),Le!==null&&(be.currentTime=Le),ue.add(be)}}else{for(const be of ue)be.playState==="paused"&&be.play();ue.clear()}D(document.hidden)};return ce(),document.addEventListener("visibilitychange",ce),()=>document.removeEventListener("visibilitychange",ce)},[f,h]);const[K,re]=w.useState(null),[z,Z]=w.useState(v$),[U,ae]=w.useState(()=>{var ue;return((ue=window.matchMedia)==null?void 0:ue.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});w.useEffect(()=>{var se;const ue=(se=window.matchMedia)==null?void 0:se.call(window,"(prefers-reduced-motion: reduce)");if(!ue)return;const ce=()=>ae(ue.matches);return ce(),ue.addEventListener("change",ce),()=>ue.removeEventListener("change",ce)},[]);const le=w.useRef(null),ge=w.useCallback(()=>{var ce;(ce=j.current)==null||ce.destroy(),j.current=null;const ue=k.current;ue&&(ue.pause(),ue.removeAttribute("src"),ue.load(),k.current=null)},[]),Ne=w.useCallback(ue=>{var ce,se;(se=(ce=le.current)==null?void 0:ce.contentWindow)==null||se.postMessage(ue,Q0)},[]),Ie=w.useRef(n);Ie.current=n;const Ge=w.useRef(r);Ge.current=r;const Pe=w.useCallback((ue,ce,se)=>{ge();const be=new Audio;be.preload="none",be.volume=Ie.current/100,be.muted=Ge.current,k.current=be,v(!0),b(!0);const Le=()=>k.current===be,de=()=>{ge(),v(!1),b(!1)},fe=()=>{Le()&&(de(),m(!0),u==null||u(se,!0))},Ce=pe=>{if(Le()){if(pe instanceof DOMException&&pe.name==="NotAllowedError"){de();return}fe()}};be.addEventListener("playing",()=>{Le()&&(b(!0),u==null||u(se,!1))}),be.addEventListener("ended",()=>{Le()&&de()}),be.addEventListener("error",fe,{once:!0}),ce&&!be.canPlayType("application/vnd.apple.mpegurl")?ab(async()=>{const{default:pe}=await import("./hls-BFpXDghs.js");return{default:pe}},[]).then(({default:pe})=>{if(!Le())return;if(!pe.isSupported()){fe();return}const _e=new pe;j.current=_e,_e.on(pe.Events.ERROR,(Ye,qe)=>{qe.fatal&&fe()}),_e.on(pe.Events.MEDIA_ATTACHED,()=>_e.loadSource(ue)),_e.on(pe.Events.MANIFEST_PARSED,()=>{be.play().catch(Ce)}),_e.attachMedia(be)},fe):(be.src=ue,be.play().catch(Ce))},[u,ge]);if(w.useEffect(()=>{y&&(Ne(Al("setVolume",[n])),Ne(Al(r?"mute":"unMute")),k.current&&(k.current.volume=n/100,k.current.muted=r))},[n,r,y,Ne]),w.useEffect(()=>{let ue=!0;const ce=t??fetch,se=_.current!==l;_.current=l,p(null),m(!1),v(se),b(se),ge();const be=c&&ki(c.id)===s?dk(c.url):null;if(be)return be.kind==="direct-audio"?(p({live:!0,channel:"",audio:be.url,hls:be.format==="hls"}),u==null||u(s,!1),se&&Pe(be.url,be.format==="hls",s),()=>{ue=!1}):(ce(`/api/fm-station?url=${encodeURIComponent(be.url)}`).then(fe=>fe.ok?fe.json():null).then(fe=>{ue&&(fe!=null&&fe.channel||fe!=null&&fe.video?(p({live:!0,channel:fe.channel??"",video:fe.video??void 0}),u==null||u(s,!1)):(m(!0),u==null||u(s,!0)))}).catch(()=>{ue&&(m(!0),u==null||u(s,!0))}),()=>{ue=!1});if(Jl(s))return m(!0),u==null||u(s,!0),()=>{ue=!1};const Le=s,de=uK[Le];if(de)ce(de).then(fe=>fe.ok?fe.json():null).then(fe=>{ue&&(fe!=null&&fe.video&&p({live:!0,channel:"",video:fe.video}),u==null||u(s,!(fe!=null&&fe.video)))}).catch(()=>{ue&&(u==null||u(s,!0))});else if(Le!=="claude-fm"){const fe=Le.replace("lofi-","");ce(`/api/lofi-girl?station=${encodeURIComponent(fe)}`).then(Ce=>Ce.ok?Ce.json():null).then(Ce=>{ue&&(Ce!=null&&Ce.video&&p({live:!0,channel:"",video:Ce.video}),u==null||u(s,!(Ce!=null&&Ce.video)))}).catch(()=>{ue&&(u==null||u(s,!0))})}else ce("/api/claude-fm").then(fe=>fe.ok?fe.json():null).then(fe=>{if(!ue)return;const Ce=!!(fe!=null&&fe.live&&(fe!=null&&fe.channel));Ce&&p({live:!0,channel:fe.channel}),u==null||u(s,!Ce)}).catch(()=>{ue&&(u==null||u(s,!0))});return()=>{ue=!1}},[c==null?void 0:c.id,c==null?void 0:c.url,t,u,l,s,Pe,ge]),w.useEffect(()=>()=>ge(),[ge]),w.useEffect(()=>{if(!y)return;const ue=ce=>{var be;if(ce.origin!==Q0||ce.source!==((be=le.current)==null?void 0:be.contentWindow))return;const se=yG(ce.data);if(se){if(se.kind==="ready"){Ne(Al("setVolume",[Ie.current])),Ne(Al(r?"mute":"unMute")),Ne(Al("playVideo"));return}if(se.kind==="playing"){b(se.playing);return}gG.includes(se.code)&&(v(!1),b(!1),m(!0),u==null||u(s,!0))}};return window.addEventListener("message",ue),()=>window.removeEventListener("message",ue)},[y,r,u,Ne,s]),w.useEffect(()=>{var Ue;if(!f||h||U)return;const ue=Q2(document);let ce=0;C(Fe=>ce=Fe);let se=null,be=0,Le=0;const de=Fe=>{var yt,It;const[Ve,...rt]=Fe;if(!Ve){se=null,q(null),P(null),qe();return}q(Ve.act),P(Ve.prop),M(Ve.place??"ledge"),F(Ve.riser??0);const ut=ce,ct=_e(Ve);if(Ve.act==="kick"){const zt=(It=(yt=L.current)==null?void 0:yt.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:It.getBoundingClientRect();zt&&ne({x:sK(zt.x,Qx(Ve,ut,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-zt.y+24)})}Le=Ve.act==="walk"?Math.max(fn(ut,ct),TG):Ve.ms,Ve.act==="carry"&&(Le=fn(ut,ct)),I(Le),V(zt=>Qx({...Ve,x:ct},ut,zt)),C(ct),ce=ct,se=Ve,be=Date.now(),ue.schedule(()=>de(rt),Le)},fe=()=>{const Fe=L.current,Ve=Fe==null?void 0:Fe.querySelector(".fm-sprite"),rt=Fe==null?void 0:Fe.parentElement;if(!Fe||!Ve||!rt)return null;const ut=Fe.getBoundingClientRect(),ct=rt.getBoundingClientRect(),yt=ct.right-ut.right,It=ct.width-yt*2-Ve.offsetWidth;return It>0?It:null},Ce=()=>{const Fe=L.current,Ve=Fe==null?void 0:Fe.querySelector(".fm-walker"),rt=fe();if(!Fe||!Ve||rt==null)return;const ut=Fe.getBoundingClientRect().bottom-Ve.getBoundingClientRect().bottom;if(ut>0)return{ledgeH:ut,floorSpan:rt}},pe=()=>{const Fe=L.current,Ve=document.querySelector(".autofit-chip");if(!Fe||!Ve)return null;const rt=Fe.getBoundingClientRect(),ut=Ve.getBoundingClientRect();return ut.width<=0||ut.height<=0?null:{left:ut.left-rt.right,right:ut.right-rt.right,height:ut.height}},_e=Fe=>{const Ve=(Fe.place??"ledge")==="floor",rt=Ve?fe()??hi:hi,ut=Ve&&Fe.floorFrac!=null?-Math.round(Fe.floorFrac*rt):Fe.x;return Math.max(-rt,Math.min(0,ut))},Ye=()=>{if(!se)return;const Fe=_e(se);Fe!==ce&&(I(Math.max(0,be+Le-Date.now())),V(Ve=>Qx({...se,x:Fe},ce,Ve)),C(Fe),ce=Fe)},qe=()=>{ue.schedule(()=>{const Fe=VG(ce,Math.random,Ce()),Ve=Fe.some(ct=>ct.place==="floor")?pe():null;let rt=ce;const ut=Fe.flatMap(ct=>{const yt=rt;if(rt=ct.x,!(ct.place==="floor"&&ct.act==="walk"))return[ct];const It=iK(yt,ct.x,Ve),zt=It.length-1;return ct.floorFrac==null?It:It.map((Xt,Ft)=>Ft===zt?{...Xt,floorFrac:ct.floorFrac}:Xt)});de(ut)},bG(Math.random))},ke=(Ue=L.current)==null?void 0:Ue.parentElement,Ae=typeof ResizeObserver>"u"?null:new ResizeObserver(Ye);return ke&&Ae&&Ae.observe(ke),qe(),()=>{ue.dispose(),Ae==null||Ae.disconnect(),M("ledge"),C(Fe=>Math.max(-hi,Math.min(0,Fe))),I(0),q(null),P(null),F(0)}},[f,h,U]),w.useEffect(()=>{if(!S||U){re(null);return}const ue=Q2(document),ce=se=>{const be=QG(se,Math.random);re(be.dance),Z(be.beatMs),ue.schedule(()=>ce(be.dance),JG(Math.random))};return ce(null),()=>ue.dispose()},[S,U]),!f||h)return null;const ze=()=>{if(f.audio){if(y){ge(),v(!1),b(!1);return}Pe(f.audio,f.hls===!0,s);return}if(!y){v(!0),b(!0);return}const ue=!S;b(ue),Ne(Al(ue?"playVideo":"pauseVideo")),ue||v(!1)},Re=cK(s,c),st=f.audio?mK(f.audio):"YouTube";return o.jsxs("div",{ref:L,className:"fm","data-suspended":H?"":void 0,"data-place":ee,style:{"--fm-beat":`${z}ms`},children:[B&&!B.held&&o.jsx("div",{className:"fm-prop","data-prop":B.kind,"data-leaving":B.leaving?"":void 0,style:{"--fm-prop-x":`${B.at}px`,"--fm-roll-to":`${W.x}px`,"--fm-ball-drop":`${W.drop}px`,"--fm-ball-flight-ms":`${g$}ms`,"--fm-ball-turn":X==="right"?"1080deg":"-1080deg"},children:eR[B.kind]}),($==="lasso"||$==="rope-throw"||$==="rope-catch"||$==="climb"||$==="pull-up")&&o.jsxs("div",{className:"fm-rope","data-act":$,style:{"--fm-rope-x":`${E}px`,"--fm-rope-ms":`${R}ms`},children:[o.jsx("div",{className:"fm-rope-line"}),o.jsxs("svg",{className:"fm-rope-hook",viewBox:"0 0 9 9",shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsx("path",{d:"M4 8V3H3V1H1V3H0V5H2V4H3V6H5V4H6V5H8V3H7V1H5V3H4"}),o.jsx("rect",{className:"fm-rope-knot",x:"3",y:"6",width:"3",height:"2"})]})]}),o.jsxs("div",{className:"fm-walker","data-act":$??void 0,"data-place":ee,"data-facing":X,style:{"--fm-x":`${E}px`,"--fm-walk-ms":`${R}ms`,"--fm-riser":`${G}px`,"--fm-skip-beat":`${y$}ms`},children:[(B==null?void 0:B.held)&&o.jsx("div",{className:"fm-held","data-prop":B.kind,"data-toss":B.leaving?"":void 0,children:eR[B.kind]}),["cast","fish","reel","stow"].includes($)&&o.jsxs("svg",{className:"fm-fishing",viewBox:"0 0 24 32",shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsxs("g",{children:[o.jsx("path",{d:"M24 11H22V9H20V7H18V5H16V3H13V2H8"}),o.jsx("rect",{className:"fm-fishing-grip",x:"21",y:"9",width:"3",height:"3"})]}),o.jsxs("g",{className:"fm-fishing-line",children:[o.jsx("path",{d:"M8 2V26"}),o.jsxs("g",{className:"fm-float",children:[o.jsx("rect",{x:"7",y:"25",width:"3",height:"2"}),o.jsx("rect",{x:"8",y:"24",width:"1",height:"1"})]})]}),o.jsx("path",{className:"fm-ripple",d:"M3 28H6M10 28H14M5 30H12"})]}),["skip-ready","skip","skip-rest"].includes($)&&o.jsxs("svg",{className:"fm-skipping-rope",viewBox:"0 0 26 26",shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsx("path",{className:"fm-skip-back",d:"M5 18H3V8H5V5H8V2H18V5H21V8H23V18H21"}),o.jsx("path",{className:"fm-skip-forward",d:"M5 18H3V14H5V11H8V9H18V11H21V14H23V18H21"}),o.jsx("path",{className:"fm-skip-front",d:"M5 18H3V21H5V23H8V25H18V23H21V21H23V18H21"}),o.jsx("path",{className:"fm-skip-return",d:"M5 18H3V19H8V20H18V19H23V18H21"}),o.jsx("path",{className:"fm-skip-handles",d:"M5 17V19M21 17V19"})]}),o.jsx("button",{type:"button",className:"fm-sprite","data-playing":S?"":void 0,"data-dance":S?K??w$[0]:void 0,onClick:ze,title:S?`Stop ${Re}`:`Play ${Re} — streams from ${st}`,"aria-label":S?`Stop ${Re}`:`Play ${Re}`,children:o.jsxs("svg",{viewBox:`0 0 ${H2} ${wG}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsx("g",{className:"fm-gear",children:o.jsx("g",{className:"fm-gear-motion",children:dK.map(ue=>o.jsx("rect",{x:ue.x,y:ue.y,width:ue.w,height:1,className:t0[ue.cell]},`g${ue.y}-${ue.x}`))})}),o.jsxs("g",{className:"fm-body",children:[J2.map(ue=>o.jsx("rect",{x:ue.x,y:ue.y,width:ue.w,height:1,fill:"var(--accent)"},`eye-bed-${ue.x}`)),fK.map(ue=>o.jsx("rect",{x:ue.x,y:ue.y,width:ue.w,height:1,className:t0[ue.cell]},`b${ue.y}-${ue.x}`)),o.jsxs("g",{className:"fm-arms",children:[o.jsx("rect",{x:4,y:8,width:2,height:2}),o.jsx("rect",{x:12,y:8,width:1,height:2}),o.jsx("rect",{x:13,y:8,width:1,height:2,className:"fm-shade"})]}),J2.map(ue=>o.jsx("rect",{x:ue.x-(ue.x>=H2/2?1:0)+(X==="right"?1:0),y:ue.y,width:ue.w,height:1,className:"fm-eye"},`eye-${ue.x}`))]}),o.jsx("g",{className:"fm-hat",children:hK.map(ue=>o.jsx("rect",{x:tK+ue.x,y:nK+ue.y,width:ue.w,height:1,className:ue.cell==="k"?"fm-hatband":void 0},`h${ue.y}-${ue.x}`))}),($==="climb"||$==="rope-throw"||$==="rope-catch"||$==="pull-up")&&o.jsxs("g",{className:"fm-grip",children:[o.jsx("path",{className:"fm-grip-left",d:"M5 9H4V4H7V3H9V5H6V9Z"}),o.jsx("path",{className:"fm-grip-right",d:"M12 9H14V6H11V5H9V7H12Z"})]}),($==="land"||$==="dismount")&&o.jsxs("g",{className:"fm-crouch-legs",children:[o.jsx("path",{d:"M6 11H8V13H6Z"}),o.jsx("path",{d:"M10 11H12V13H10Z"})]}),["sit","cast","fish","reel","stow"].includes($)&&o.jsxs("g",{className:"fm-seated-legs",children:[o.jsx("path",{className:"fm-seated-far",d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),o.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(ue=>o.jsx("g",{className:"fm-leg","data-side":ue,children:pK[ue].map(ce=>o.jsx("rect",{x:ce.x,y:ce.y,width:ce.w,height:1,className:t0[ce.cell]},`${ue}${ce.y}-${ce.x}`))},ue))]})})]}),y&&!f.audio&&(f.channel||f.video)&&o.jsx("iframe",{ref:le,className:"fm-frame",title:Re,src:hG(f.channel,window.location.origin,f.video),onLoad:()=>Ne(fG()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})]})}),yK=15e3;function wK(e){return e.visibilityState==="visible"&&e.hasFocus()}function vK(e,t){return t||e===!0}function xK(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}const bK={"//":["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.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.
|
|
93
|
-
|
|
94
|
-
A problem stays on the row — an expired login, one that was never stored, a keychain the deck cannot open — with the reason and the sign-in one press away. Auto-switch is one row now: its threshold and its switch. Local network moved out of the column into a view of its own, reached from a row at the foot that says how many of the paired machines are on right now, and shows which ones when you hover it.`},{title:"💬 A resting session shows Claude Code's recap beside its card",body:"When a session stops, Claude Code's own recap of what it did is drawn beside the card — so a board you come back to says what happened without opening anything."},{title:"🪟 The chrome went quiet",body:`The topbar is borderless, one set of corners runs through the app, the canvas ground is flat, and the minimap, the zoom controls, the type filter and the Machine and Usage panels read as tooling rather than as cards.
|
|
95
|
-
|
|
96
|
-
The canvas also says when auto-fit is off, with one press to bring new sessions back into view.`},{title:"🔍 A tool call's detail reads as the call",body:"A tool call's arguments are shown as the call rather than as escaped JSON, and can be copied."},{title:"🔐 Saying yes to every deck that asks takes two presses",body:"The switch that accepts every pairing request arms first and says what it hands over, so one stray click cannot put this machine's logins on another deck."},{title:"🖐️ Targets, themes and contrast",body:"The panel's smallest controls reach the 24px target floor, and grow further under a finger. A first run follows the system's light or dark setting instead of picking one. Status dots, meters and switch knobs survive a Windows Contrast theme."}],"3.22.15":[{title:"🖱️ Clicking a card opens its details",body:"Selecting an agent is inspecting it: a click, `j`/`k`, a session picked from the list and Enter on a focused card all open the detail panel — prompt, every tool call, tokens, timing. It used to open only with `D`, so anybody who closed it with its × and never found the key did not get it back. The × still closes it until the next selection, and `D` still toggles it.\n\n`D` with nothing selected now picks a card first — the session that has waited longest, or the one `j` would land on — instead of flipping a switch with nothing on screen to show for it."},{title:"⌨️ The keyboard and screen readers reach the whole deck",body:`Shortcuts keep working after a mouse click on a button. A click left focus on the button it pressed, and the key handler leaves a focused control its own keys, so every single-key shortcut was dead until you pressed Esc — with nothing on screen to say so.
|
|
97
|
-
|
|
98
|
-
Tab follows the page now — topbar, the accounts column, the canvas, usage, machine — instead of zig-zagging left and right across it, and a canvas card reached by Tab draws the focus ring. A screen reader hears each card by name, with its kind, state, model and cost, rather than every word on it run together; the machine panel has a heading its region is named by; and the theme button is named for the theme it switches to.
|
|
99
|
-
|
|
100
|
-
With **Reduce motion** set, the camera no longer flies across the canvas to a card.`},{title:"💵 The money figures say what they measure",body:"The usage header's **$/min** is spend over a trailing window, and says which span it measured: `$3.54/min · 2 min`. It used to divide the live agents' cost by how long the longest of them had been running, so one deck read $2.39/min in a tab left open and $19.49/min in a tab opened minutes later.\n\nA quota bar's pace says **over pace** or **under pace**. It said `ahead`, which is how plain English says winning, on the very line meant to warn you that you are burning the window faster than it lasts.\n\nA card's clock reads `≥ 53m 52s` for a session this page joined after it had started, instead of presenting the part it saw as the whole of it — and that card's per-minute burn is left out rather than divided by the short clock."},{title:"↔️ Narrow windows keep every topbar control on screen",body:`At 400px six of the topbar's buttons sat past the right edge and the page scrolled sideways. The readouts give way first now and the controls stay; below 640px the side panels span the window instead of leaving the canvas a sliver; and the category filter wraps inside the canvas rather than being clipped by it.
|
|
101
|
-
|
|
102
|
-
Zoomed out, a card's name and a cluster's label stay readable instead of shrinking to about four pixels — which is the view a board of any size actually sits at.`},{title:"🔑 A paired deck's dialog says which account that machine is on",body:`The lane of the account the other machine is working on takes the accent and a slow ring on that machine's end. An account is named only if that deck shares it: on one it does not share, the dialog reads "on another account" and never which. A new switch under **SHARE THESE ACCOUNTS**, on by default, turns the telling off, and paired decks then read "current account hidden".
|
|
103
|
-
|
|
104
|
-
**This deck on the network** prints this deck's own fingerprint again. A pairing request asks you to match it against the one on the other machine's screen, and no screen here was showing it — so the one check a person can make against a rogue deck could not be made, on the step that hands over logins.`},{title:"💬 The deck's messages send you somewhere worth going",body:'An empty canvas no longer ends with "Make sure ccdeck is running" while the page is plainly connected to it. The capture hints under that line, one per CLI, are the real reasons a canvas stays empty, and they stay. With the stream down the screen says whether this page lost a deck that was there or never found one, in those words, rather than naming the `/events` route nobody who typed `npx ccdeck` has seen.\n\nAnd a slow `claude-swap` now reads as a slow answer — "still waiting on the deck server" — instead of "couldn\'t reach the deck server", which sent people off to restart a server that was fine.'}],"3.22.10":[{title:"🖱️ Icon buttons are easier to hit",body:"Icon buttons react when the pointer is near them — no need to hit the icon exactly."},{title:"🧩 Sessions spread across the canvas",body:"Sessions now spread across the canvas in columns instead of one tall column, and new sessions and subagents land in the free space beside them. Nothing is placed under the Machine or Usage panels. Press R once to rearrange a board you already have."}],"3.21.0":[{title:"🖼️ The deck explains itself in pictures",body:"🎬 First run opens an eight-picture tour instead of the changelog — who is waiting on you, the tree, a node's inside, cost and quota, this machine, accounts, local network, how to start. `Take the tour` on an empty canvas brings it back.\n\n📡 **Local network** has a guide: a card while it is off, `How it works` under an empty list, four pictures ending on `Turn it on`. A machine's row opens its own dialog — address, version and system, the logins it offers, and a name of your own for it. Setup ends on Done.\n\n🔄 The deck updates itself when nobody is looking: no tab focused, no agent mid-turn, thirty seconds quiet. The banner's `auto when idle` switch governs it.\n\n🔑 An account whose numbers were paused resumes on its own, and the panel is titled **Claude accounts** — a Codex login is not in it."}],"3.20.0":[{title:"🟢 The deck keeps running after you close the terminal",body:"`ccdeck` prints the same boot report and gives you the prompt back. The deck stays up, and starts again when you log in.\n\n🛑 **`ccdeck --stop` is the off switch now** — Ctrl+C only cancels a start that is still printing. `--status` says what is running, `--logs` shows what the deck wrote while you were away, and `--foreground` holds the terminal the way every version before this one did.\n\n🔁 Typing `ccdeck` beside a deck that is already up opens **that deck's tab** instead of building a second one. `ccdeck --stop --all` clears any older deck still running from before this version. An `npx` run cannot start at login — `npx ccdeck --install` puts it on your PATH and sets that up.\n\n🔑 An account that will not collect now says which of three things is wrong: **no stored login**, a **login that expired**, or a **keychain the deck cannot open** — with the fix beside it. One with no stored login is filled over the local network by a paired deck that has it.\n\n📡 And decks find each other again on a machine with a VPN up: the beacon was going to an address that never left the machine, so this deck could hear colleagues and none of them could hear it."}],"3.19.0":[{title:"🟢 Local network: fixes and improvements",body:`The list of decks is quiet now. A deck that is **on**, with nothing to repair, is a name and a green mark — no sentence under it. Every healthy row used to carry the same words, so the one row worth reading looked like all the others. A failure, a login that arrived, a machine that is away, still say so, and they are now the only rows with anything written on them.
|
|
105
|
-
|
|
106
|
-
\`unpair\` arrives when you point at a row rather than sitting on every one of them, two machines that share a name show their addresses, and the ↻ turns while a round is out.
|
|
107
|
-
|
|
108
|
-
**Add a deck** is two ways in — by address, or with an invite — with \`make one to send\` beside the invite heading instead of under the paste field, where it read as that field's button. A refused address now says which mistake it was, and an invite that will not work says whether it ran out, was not an invite, or reached nothing.
|
|
109
|
-
|
|
110
|
-
Switching **Local network** on opens your name and shared logins, every time, so nothing goes on the network without you having just seen what goes with it.`}],"3.18.3":[{title:"🟢 The list shows what is on, and folds the rest",body:'A machine that is off, or nearby and unpaired, or one you said no to, is context rather than an answer to "who can I use right now" — so the decks that are **on** lead the list and everything else is one line: `2 more`. Nothing worrying is hidden by it: a deck that cannot be reached is counted in that line, in the warning colour, so the fold says whether it is worth opening.\n\nThe round moved to a **↻ beside the switch**, where the accounts header has kept the same act since it was written, and the line under the state now says when it last ran — `checked 2m ago`, or `not checked yet`. A list that refreshes itself and a list that has stopped used to look identical, and pressing the button to find out was the only way to tell.'}],"3.18.1":[{title:"🔁 A deck stops asking to pair over and over",body:"Several decks on one computer share a config directory, so they start with one key. Each read the others' beacons as somebody wearing its name, took a fresh key, and wrote it to the file the others read — a loop that never settles. Every new key is a **new deck** to everyone else on the network, so one machine sent a fresh pairing request every few seconds and accepting one accomplished nothing: the deck that asked no longer existed by the time the answer arrived.\n\nDecks on one computer now recognise each other as the same machine and leave the key alone. The clash still worth healing — a `~/.claude` copied to a second machine — is unchanged.\n\nThis also collapses the rows: a computer that has run the deck a few times appeared several times on everybody else's panel and is one row now. **Both machines need this version** for that to take effect on the other one's screen.\n\nA deck that answered is no longer counted as unreachable, the list refreshes itself in seconds while somebody is deciding rather than at the next minute, and a failed round says what happened — `not listening`, `no route to it` — with the address and the raw error on the hover."}],"3.18.0":[{title:"🟢 A deck that is switched off no longer reads as on",body:"A paired deck this one has no address for was drawn **live** on the strength of being paired — a machine closed an hour ago still sat under `1 deck ready`. Every row now leads with whether that machine is actually there, and when it last was: `online · 1 login arrived`, `no answer · last online 20m ago`, `never reached`. The mark beside the name is a traffic light — green for a deck that answered, amber for one that cannot be reached, grey for one nothing has heard from.\n\n**+ add a deck** opens a dialog now instead of unfolding inside the panel. An address, an invite and the firewall note never fitted a 288px column, and unfolded they turned a list of machines into a form."}],"3.17.0":[{title:"🔔 Pairing is two presses",body:`When another deck asks to pair, the question now arrives **over the deck** rather than in a row three sections down a panel: its name, its address, the fingerprint to compare, **Accept** or **Decline**. Escape means later — the request stays in the panel until you answer it.
|
|
111
|
-
|
|
112
|
-
The rest is one list. Every deck you are paired with, every deck on the network, and every one you turned away, each a row with its state under the name and one verb at the end — and a deck that cannot be reached now reads differently from one that is fine. Saying no also reaches the other machine now, instead of leaving it waiting forever; you can take it back.
|
|
113
|
-
|
|
114
|
-
The dialog behind **setup** is down to the two things it is really about: what this deck is called, and which logins it offers.`}],"3.15.0":[{title:"🔗 Decks on one network heal each other's dead logins",body:`A login dies on the machine that has not used it while the same account keeps working on the machine that has. The fix was a blob copied out of one deck and pasted into another. Now: **Accounts ▸ Local network**, the same passphrase on each deck — it offers you six words — and they find each other and repair themselves.
|
|
115
|
-
|
|
116
|
-
A deck only **adds** an account it does not have, or **replaces one it has proven dead** — proven by Anthropic refusing the token, not guessed. A credential that works is never touched. The passphrase is the only gate; a stranger on the same wifi sees that a deck exists and nothing else.`},{title:"⚠️ What sharing a login actually means",body:`**A login you share is a live one, and it cannot be taken back.** Turning the switch off stops what has not happened yet; a credential that has left your machine is gone, and the only real revocation is signing in again at Anthropic — which ends the session everywhere at once.
|
|
117
|
-
|
|
118
|
-
Sharing a Claude account may also be against Anthropic's terms. Your call; the deck says it once and does not nag.`}],"3.14.0":[{title:"📊 The machine comes back beside the list that covers it",body:`**Busiest processes** opens over the machine panel and hides the very readings that sent you looking. They are back beside the list — cores, memory, swap, queued work, temperature — with up to an hour behind each: a column down the side on a wide screen, a band under the table on a narrow one.
|
|
119
|
-
|
|
120
|
-
Each is drawn against the line it is measured to — memory and swap at 90%, load at your core count, the GPU at 75° and again at 90° — so swap sitting *on* its line is something you see rather than work out. The processor readings get no line on purpose: a CPU at 90% is your machine doing what you asked for. Throttling appears only once your machine has actually been held back, and the band says how much history it really has rather than claiming an hour it has not had.`},{title:"📋 The process dialog's footnote moved onto the columns it was about",body:"A band ran along the bottom of **Busiest processes** saying three things. Two were worth keeping and are now on the header of the column they describe — hover `memory` to read what that number measures, `process` to read that the command-line redaction is a filter rather than a promise.\n\nThe third said the list is the busiest by processor and memory, refreshed every four seconds. The heading, the count beside it and the moving numbers were already saying that."},{title:"📝 These notes render what they were written in",body:`Every note in this dialog is written in Markdown — **bold** for the sentence that carries the change, backticks for a flag or a path — and the dialog printed the string raw. So the first window you see after an upgrade has been showing you \`**this**\`, backticks and all, since the feature shipped: 25 of 52 notes, 52 bold spans, 54 code spans.
|
|
121
|
-
|
|
122
|
-
What you are reading is the first version that does not.
|
|
123
|
-
|
|
124
|
-
No Markdown library came along for it. Counted in the file: bold 52, code 54, links 0, headings 0, lists 0 — and the smallest library that reads all of Markdown is 40KB on a bundle the deck fetches while you wait for it to start.`},{title:"⎋ Esc leaves the machine panel where it is",body:"The × on **This machine** read `Close (Esc)`, so Escape put the panel away. Escape belongs to the canvas — it deselects and hands the keyboard back — and pressing it while you are reading your instruments should not close them.\n\nThe panel now closes the two ways it opens: its ×, and the meter in the topbar. The × says `Close`, and names no key it does not answer."},{title:"🖥 The machine moved out of the topbar and into a button",body:"The small CPU sparkline and memory bar in the topbar are gone. A chip glyph in the icon row beside `$` and the accounts silhouette opens the same **This machine** panel — cores, memory, swap, load, temperature, busiest processes — and the bar stops moving in the corner of your eye.\n\nIt also stops asking. The deck read your machine every three seconds for the life of every tab to feed that meter; it now reads only while the panel is open, and the history behind the readings is kept by the deck itself, so a panel opened an hour from now still has the hour behind it."},{title:"🔎 The panel's eight process rows became one way in",body:"The machine panel drew eight processes in a 280px box: three columns, names cut off mid-word, and a `ps` run every four seconds to keep them moving. **Busiest processes** is a single row you press now, and the dialog behind it is what it always was — every candidate the deck sees, its memory in bytes, threads, user, pid, and the command line that tells you which `node` this one is.\n\nWith that dialog closed, the deck reads no process list at all."},{title:"⏱ The restart banner says whether the press is safe, and shows the fuse",body:"The button read `Restart now` whether the machine was idle or five agents were mid-turn — and the events fired while the server is down are lost for good. It reads **`Restart anyway`** now when something is running, with the count beside it, and `Restart now` with *nothing is running* when the machine is quiet.\n\nThe automatic restart said only `auto when idle`, while a 30-second clock ran where nobody could see it. It counts — **`auto in 18s`** — which is also how you stop it, since the switch is the label. The amber dot pulses only while that clock runs.\n\nThe switch also says `auto-restart off` in words rather than in a colour, both its label and the button are readable in the light theme now, and a tab you are not looking at no longer restarts the deck under the tab you are."}],"3.13.0":[{title:"📊 Usage history stops jumping out from under you",body:`Pressing **H** put \`running ccusage…\` in a box 186px tall. Two to four seconds later the chart, the totals and the legend arrived and the box became 429px — and because the dialog is centred, that growth moved the whole thing **121px upward**, under the cursor that had just pressed something.
|
|
125
|
-
|
|
126
|
-
The chart's place is now reserved from the first frame: the 168px the chart is tall plus the 16px it keeps for its day labels, both taken from the chart's own rule so the placeholder and the thing it holds room for cannot drift apart. The jump goes from 243px to 156px. It deliberately stops there — the totals and the legend are content, the legend's height depends on how many models ran, and reserving those would have meant drawing four plausible empty cards for a reading that had not arrived.
|
|
127
|
-
|
|
128
|
-
What is drawn in the reserved space is **the chart's baseline and nothing else**: one line, in the same colour, at the height the columns will land on. Not a skeleton of grey bars — a skeleton stands in for content, an axis is furniture, and furniture is honest before the data exists. The light on it travels rather than fills, because the deck knows a subprocess is running and does not know how far through your transcripts it has got.
|
|
129
|
-
|
|
130
|
-
Then the days rise out of that line, **oldest first**. The stagger is divided rather than fixed — 200ms of spread whether the range is 7 days or 90 — so the longest range is not also the slowest to appear.
|
|
131
|
-
|
|
132
|
-
With reduced motion both loops and both entrances are off. The reserved space is layout, not animation, and stays outside that rule: asking for less movement gets you the same dialog that does not jump.`},{title:"⏳ The period mark says it is being read",body:"The first read of **today**, **month** or **all** takes two to three seconds — it walks the transcripts on this machine, and the cost is the walk, not the size of the range you asked for. Until now the panel said nothing for the whole of it, so pressing `month` looked like pressing nothing, and the honest response was to press it again.\n\nThe mark under the period now pulses while that read is in flight, and it **pulses rather than fills**: nothing measures how far through the transcripts ccusage has got, so a bar that filled would be inventing a number. Hovering the pending period says which one is being read, and screen readers are told the same thing through a live region rather than being left with a silent button."}],"3.12.0":[{title:"🔍 Busiest processes tells you which one",body:"The list could say what was eating the machine and not **which** of nine identical `Google Chrome Helper` rows was the headless Chrome you left running. It now shows the arguments after the name — `--type=renderer` beside one, `serve admin-portal --port 44440` beside a node — and four columns it did not have: **memory in MB and GB** instead of a percentage, **threads**, **how long it has been up**, and **user**. Every column sorts; press its heading.\n\n**Command lines have anything secret-shaped removed before they leave your machine** — the value of any flag whose name says token, password, key or secret, the password in a URL, and the shapes that identify themselves. It is a filter and not a guarantee: a secret that looks like an ordinary word looks like an ordinary word. The reading happens only while this modal is open, so a deck whose process list you never open never reads a command line at all.\n\n**Memory is resident set size** — what `ps` and Windows Task Manager report. On macOS this is *not* the number Activity Monitor shows in its Memory column; that one is the physical footprint, and on the machine this was built on the two disagree by up to fourteen times on the same process. No unprivileged command reports the footprint quickly, so the deck shows the figure that means the same thing on all three platforms and says which one it is.\n\n**There is no Ports column**, and the reason is the same kind of honesty: Mach ports do not exist on Linux, are not what Windows calls a handle, and on macOS the only way to count them takes four seconds — against a list that refreshes every four."},{title:"🔢 A token count that stays a whole number",body:"Switching the Usage panel from **month** to **today** counted down smoothly and then, for a fraction of a second, showed something like `in 594.3268260610639` where a token count belongs.\n\nThe count was never wrong; the printing was. The figures animate between two readings, so the formatter is handed a fraction on most of its frames — every size above a thousand was already rounded and the one below it was not."}],"3.11.0":[{title:"🗂 The session list waits to be asked for",body:`**BY SESSION in the Usage panel now starts collapsed.** It is the one block in that panel with no ceiling — every other section is two or three rows, or a model table bounded by the models that exist — and it was the reason the panel scrolled at all. Shut, the whole panel is one screen: quota, period, money, models. Press the heading to open it, and it stays open; ccdeck remembers your answer from then on.
|
|
133
|
-
|
|
134
|
-
The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
|
|
135
|
-
|
|
136
|
-
**Scrollbars are also gone until you point at the thing that scrolls.** Nothing moves when they appear — the track keeps its width in both states, so no text shifts under the pointer as it arrives.`},{title:"📊 today · month · all, as tabs that remember",body:"**The Usage panel's period switcher is a full-width row of tabs** rather than a pill floating over the column, with a thin cyan mark under the word it belongs to. It governs the figures beneath it, so it now looks like it does.\n\n**Your chosen period survives a reload.** It was the one preference in that panel that did not.\n\n**It costs one Tab stop instead of three.** Tab into the strip, then move with ←/→ or Home/End, and press Enter to choose. Arrowing past a period no longer starts reading it — moving and choosing are separate now, which matters on `all`.\n\nAnd **`month` says which month.** Hover it: this is the calendar month, from the 1st — not the last 30 days. `today` and `all` say what they cover too."},{title:"🔔 Sounds and Notifications are two switches, and Browser notifications is a channel",body:`**The sound menu has been rebuilt.** Sounds and Notifications are real switches now instead of words that read like status. Under them, **Browser notifications** is named as what it is — one of the two ways ccdeck can reach you — rather than sitting there as a third setting that seemed to contradict the one above it.
|
|
137
|
-
|
|
138
|
-
There are two notifiers and they never both fire: the page raises one when the deck is open but hidden, and the server raises one when no page is open at all. Only the first needs a browser permission, which is why the permission belongs to a channel and not to the feature. **Turning Notifications on now asks the browser on that same press** — no second control to hunt for.
|
|
139
|
-
|
|
140
|
-
\`M\` mutes and unmutes sounds from anywhere. **Hear it** plays the tone even when Sounds is off, so you can pick one before turning them back on.`},{title:"🧹 No agent, no empty panel",body:`**The detail panel no longer appears when nothing is selected.** It used to sit there empty, and a tab on the edge of the canvas existed to bring it back after you closed it — both are gone. Select an agent and the panel is there; press **D** to toggle it yourself.
|
|
141
|
-
|
|
142
|
-
The canvas is that much wider whenever you are not reading one agent.`}],"3.10.0":[{title:"🔌 Who else can drive your browser, and where to see it",body:"**Browser Watch has a Remote control section.** The Claude in Chrome extension holds a connection open to Anthropic's relay, and that connection is registered against your **account**, not against this machine — so any Claude Code session signed in to the same account, running anywhere, can enumerate and drive this browser, and nothing prompts you on the machine being driven.\n\nThe panel now says whether that is the case here, and what the extension is actually allowed to do in each profile — enabled or switched off, every site or only the ones it was granted, and which of the powerful APIs it holds. That last part is not what `chrome://extensions` shows you: the per-site list there is enforced by the extension, on itself, while the grant underneath stays exactly as wide as it was.\n\nIf you want it closed, the section hands you the one command that closes it — as text, to paste in your own terminal. **ccdeck never runs it and never asks for your password**, and it never will: no part of this deck elevates, and a dashboard that could raise a password box on request would be a gift to anything else running on the machine. If the block is already in place, the section offers the command that takes it back out. And if something else in your hosts file already points that name somewhere, it says so and leaves the line alone — ccdeck only removes the line ccdeck wrote.\n\nAll of this is two file reads and no network call. It was written some releases ago and, until now, was not connected to any screen.\n\n**Also:** the README said `share` produces a `ccdeck1:` blob. It produces `ccdeck2:` — `ccdeck1:` has been read-only legacy for a while."}],"3.9.0":[{title:"🎛️ Five switches that were not where the thing they control is",body:'**The session list has a button again.** It lost one a while back and only the `L` key was left — and `L` is written down in one place, a shortcuts sheet behind a small `?` in the corner of the canvas. If you use a mouse there was no way to open the list at all. The `☰` is back at the left of the top bar.\n\n**The Notifications switch now tells you whether the browser will actually show one.** It said `on` while this browser had never been asked for permission, which is not the same thing. It now says so on that row and offers the ask right there. Before, the only place to grant it was a button that appears solely while a session is stuck waiting — so on a machine where that rarely happens you could not switch notifications on at all.\n\n**Started with `--workspace` or `--scope` and seeing nothing?** The empty screen used to tell everyone to "run `claude` or `codex` in any folder", which is the one thing that cannot work for you. It now names the folder the deck is actually watching.\n\n**Browser Watch says when a setting did not save.** Flipping the switch and having it fail showed a red line reading "Could not read" — about reading history, not about your press — and ten seconds later the panel wiped it and looked perfectly healthy with the setting unchanged. A failed save now says so, in its own words, and stays until you dismiss it. The "nobody browsing for" menu also follows the stored value again: change it in a second tab and this one never caught up.\n\n**The deck no longer restarts itself when nothing on screen offers to stop it.** Thirty seconds after the last agent went quiet, with a new version on disk, the server would exit, come back and reload the page. The `auto when idle` switch that controls that lives inside the update banner — so if you had closed the banner with its `×`, it happened with no visible setting anywhere. Closing the banner now also stands down the restart; clicking the version chip brings back both together.'}],"3.8.9":[{title:"🖥️ Four things that only went wrong on somebody else's operating system",body:"**Ubuntu:** the deck knew where Chromium and Brave keep their profiles when installed as a snap or a flatpak — which on a default Ubuntu is the only place Chromium is — but not what those programs are called. So it reported them as not running while they were, and refused to quit them. Both now work.\n\n**Windows:** the deck asked the system whether it could write to the folder an update installs into, and Windows always answers yes for a folder whatever the permissions say. It offered you an update that then died inside npm with a permission error. It now finds out by trying, and declines up front with the command to run yourself — which is what every other platform already got.\n\n**Linux:** if `XDG_DATA_HOME` was set to something starting with `~`, as it is from a systemd unit or a Dockerfile, the deck and claude-swap looked in two different places for your accounts. The panel said you had none while `cswap list` showed them all.\n\n**Plain terminals:** six messages used a typographic dash the old Windows console and the Linux text console cannot draw, so a box appeared mid-sentence — including in the line that explains why no events are arriving. They use the plain form on those terminals now, like everything else already did."}],"3.8.8":[{title:"📉 A false 99% on the memory chart, and three other quiet failures",body:`**The machine meter no longer invents a reading.** When the deck could not measure memory — a subprocess that would not start under load, or one that took too long — it substituted a number that means something else, and on a Mac that reads as about 99% used. The meter went red for half a minute, and because the chart keeps the highest value in each minute, that false peak stayed on it for a full day. A poll that cannot measure now keeps the last reading and records nothing: a gap in the chart is honest.
|
|
143
|
-
|
|
144
|
-
**A failed ccusage repair no longer disables the repair.** If the deck found a half-installed copy it removes it and starts again. On Windows that removal can fail for a few seconds because the program it just ran still has the folder open — and the deck then treated the attempt as spent and never tried again for the rest of the session, leaving the panel permanently unable to read your usage. It now only counts a repair that happened.
|
|
145
|
-
|
|
146
|
-
**Changing the auto-switch interval takes effect even during startup.** Set it in the first seconds after launch and the timer kept the old value for the life of the process, while the panel showed the new one.
|
|
147
|
-
|
|
148
|
-
**Codex sessions with very large histories no longer cost hundreds of megabytes to read.** The deck read the whole file to find four values that live at its two ends — measured at 185 MB of memory and 95ms of frozen interface for one 44 MB session. It now reads only the ends.`}],"3.8.7":[{title:"🧠 Four things in the panel that behaved wrongly",body:`**Today's figure no longer overshoots.** Once a minute, when a fresh reading landed, the headline briefly counted past the true number and back down — it was measuring the last minute of spend from a starting point one moment out of date. The reading and its starting point are now recorded together, so there is no moment where they can disagree.
|
|
149
|
-
|
|
150
|
-
**Browser Watch marks findings read when you close it, not when you open it.** It was clearing the badge immediately, and stamping every new finding as read the moment it arrived — so anything that turned up while you were reading was never badged at all. It was also writing to storage four times a second the whole time the panel was open.
|
|
151
|
-
|
|
152
|
-
**A hidden tool category can always be brought back.** Hide one, leave the deck running, and once the canvas had turned over the row of chips disappeared while the filter stayed on — no bubbles, and nothing to press. Only reloading fixed it. The chips now stay for as long as anything is hidden.
|
|
153
|
-
|
|
154
|
-
**Clicking a session's name no longer switches auto-fit off.** The deck was reading its own camera move as you grabbing the canvas, and remembered it across restarts, with nothing said.`}],"3.8.6":[{title:"🗂️ Two decks can no longer both claim the same log",body:"When several decks share one events log they elect a single writer for it, so nothing is recorded twice. That election compared the path as typed — so two decks reaching the SAME file by different spellings each thought they were alone, both wrote every event, and each believed the log was theirs to clear.\n\nDifferent spellings are ordinary, not exotic: a shortened Windows home directory, a mapped or substituted drive, a junction, or on macOS `/tmp` against `/private/tmp`. The visible symptoms were duplicated tool calls after a restart, and Clear wiping history belonging to another deck.\n\nThe path is now canonicalised the same way the watched folder already was. It works on a first run too, before the log file exists."}],"3.8.5":[{title:"⛔ Cancelling a sign-in no longer adds the account anyway",body:`Press Escape while adding a Claude account and the deck killed the sign-in — and then, sometimes, registered the account regardless, switched to it, and told you it had worked.
|
|
155
|
-
|
|
156
|
-
The deck asks the tools it runs whether they finished cleanly. A program that is well behaved about being cancelled tidies up and exits with a success code, and the deck was reading that as "it finished" rather than "I stopped it". \`claude auth login\` is exactly that kind of program.
|
|
157
|
-
|
|
158
|
-
A cancelled run now reports as cancelled. Everything that was not cancelled is unaffected.`}],"3.8.4":[{title:"🧷 Your own hooks can no longer be eaten by two decks starting together",body:'If you keep hooks of your own in `settings.json`, the deck parks them while it installs and puts them back afterwards. Two decks starting at the same moment could interleave inside that, and the loser wrote a version of the file computed before the restore — so your hook was gone from `settings.json` and gone from the park, which was its only other copy.\n\nThere was already a check for this, and it had a hole: if the last-moment re-read of the file failed, it read that as "nothing changed" and wrote anyway. A failed read is the one moment that check was most needed, because the usual reason a file cannot be read for a few milliseconds is that something else has just written it.\n\n`ccdeck --uninstall` had no such check at all and could overwrite a deck that was starting, then exit 0 saying it had succeeded. It has one now, and when it declines it says so and tells you to run it again rather than reporting that there was nothing to remove.'}],"3.8.3":[{title:"🪟 Windows: two settings files that could refuse to save",body:`On Windows a file cannot be moved into place while anything else has it open, and Defender and the search indexer open a file the instant it is written. The deck has had a retry for that for a long time, and two files written in the last few days were not using it: the notifications preference, and Browser Watch's episode archive.
|
|
159
|
-
|
|
160
|
-
When it bit, the notifications switch silently did not stick, and Browser Watch answered an error and showed an empty panel. Both now retry the way everything else in the deck already did.
|
|
161
|
-
|
|
162
|
-
Nothing changes on macOS or Linux, where the operating system never refused the move in the first place — which is why this got past a green test suite on both.`}],"3.8.2":[{title:"⌨️ A closed-behind-your-back dialog no longer kills every keyboard shortcut",body:`Open the context ring on a session's card and leave it open. The session finishes, and a couple of minutes later the canvas evicts it — or you press Clear. The dialog vanished, and from that moment every shortcut in the deck stopped working: Space, C, R, F, L, H, U, A, J, K, T, M, and the trash button too. Only reloading the page brought them back.
|
|
163
|
-
|
|
164
|
-
The deck was still counting the dialog as open, because it remembered which session you had opened it for rather than whether anything was on screen. It now closes the dialog when its session leaves the board, which is what should have happened in the first place. The end-of-session recap had the same problem and is fixed with it.`}],"3.8.1":[{title:"🔒 Security: update if the deck runs on a Mac",body:"A local process able to reach the deck's port — no token, no browser, no tab — could get a string of its choosing compiled as AppleScript when the deck raised a desktop notification with no page open. On macOS that is code running as you.\n\nThe strings were already passed as arguments rather than pasted into the script, which is normally the whole defence. It is not enough for `osascript`: its option parser reads any argument starting with a dash as an option, so a name beginning with `-e` was taken as more script instead of as text. Every place the deck hands `osascript` or `notify-send` something from outside now carries an explicit end-of-options marker, so nothing from outside can be read as an instruction again.\n\nNothing to change on your side beyond updating. If you would rather keep the deck off the desktop entirely, the Notifications switch in the sound menu does that, and `AGENTS_DECK_NO_NOTIFY=1` does it at launch — but the fix is the thing to have."}],"3.8.0":[{title:"🔕 Notifications now have an off switch",body:`3.7.0 gave you a "notify me" button and no way back. Turning them off meant digging into your browser's site settings — which no page can do for you — and that still left the other notifier, the one the deck raises when no page is open at all. Silencing that one meant quitting the deck and starting it again with \`AGENTS_DECK_NO_NOTIFY=1\` in front. The person who wanted quiet was the one doing the work.
|
|
165
|
-
|
|
166
|
-
There is a **Notifications** switch in the sound menu now, beside the one for sound — that menu is already "how loudly does this deck interrupt me". One switch governs both notifiers, it takes effect immediately without a restart, and it is remembered across restarts.
|
|
167
|
-
|
|
168
|
-
It is kept by the deck rather than by your browser, because the second notifier runs when no page exists and a setting living in a page could never reach it. \`AGENTS_DECK_NO_NOTIFY=1\` still wins over the switch — a machine told at launch to stay off the desktop stays off it — and when that is the case the menu says so instead of showing an "on" that will not happen.`}],"3.7.1":[{title:"🔔 The notifications now fire on the thing that actually stops your agent",body:`3.7.0 could tell you a session was waiting — but only when Claude Code asked permission to run a tool. If you work with permissions bypassed, that never happens, and the whole feature was silent for you. Measured on one real log: 1683 events, every one of them in bypassPermissions, and a single permission prompt in the entire history.
|
|
169
|
-
|
|
170
|
-
What fires constantly on that setup is the other kind: the agent asking you a question and stopping for the answer. The deck was throwing those away — no amber chip, no row in the sidebar, no notification, and no "notify me" button, because the button only appears while something is actually blocked.
|
|
171
|
-
|
|
172
|
-
Now they count. The card carries the question itself rather than a generic "Your turn" — "paycore needs your input: merge both branches to main, or just one?" — and so does the notification, on the desktop, whether the tab is behind something or not open at all.
|
|
173
|
-
|
|
174
|
-
An idle prompt still stays quiet: a turn that ended is not a session that is stuck, and a channel that cries wolf is one you switch off.`}],"3.7.0":[{title:"🔔 The deck can reach you when you are not looking at it",body:`The deck's whole point is telling you which agent is waiting on you, and until now it could only say so on screen — the amber chip, the tab title, the favicon. Every one of those is drawn inside a page, so the one moment it matters, when you have walked away and four agents have gone quiet, the deck was silent.
|
|
175
|
-
|
|
176
|
-
Now it reaches the desktop, two ways that never overlap. With the deck open behind something, the page raises the notification itself: a "notify me" button appears in the top bar the first time a session blocks, and the browser asks you — nothing is requested before there is something to notify you about. With no page open at all, the server raises it, because it can see that nobody is connected and therefore that no other surface is saying anything.
|
|
177
|
-
|
|
178
|
-
One notification per session, replaced rather than stacked if a second deck raises it too. Clicking it brings the tab forward. \`AGENTS_DECK_NO_NOTIFY=1\` turns the desktop side off entirely, and if you refuse the browser prompt the deck says so plainly instead of leaving you thinking you switched something on — after a refusal only your browser's site settings can undo it, which no page is allowed to touch.`},{title:"🧩 A blocked session now says what it is asking for",body:'"Waiting on you" told you to go and look. The session row and the card now carry the tool the prompt is most likely about, and the tooltip carries the one line of its input that a person actually reads — `rm -rf node_modules` rather than `{"command":"rm -rf node_modules"}`.\n\nIt is a guess and it is worded as one: the deck sees the tool calls, not the permission dialog, so it says "likely on". The deck still cannot allow, deny or answer anything for your agent, and it never will.'},{title:"🧮 Today's figure was counting some sessions twice",body:`The panel reads your usage from ccusage once a minute and fills the gap in between from what the deck is watching. The filling-in was wrong: any session that reached the canvas after the reading had landed was added in full, and since the canvas is still loading when the first reading arrives, that was most of them.
|
|
179
|
-
|
|
180
|
-
Measured on a deck four seconds old: ccusage said $450 for today and the panel said $1,006. The table underneath it said $450 the whole time, which is the disagreement to trust.
|
|
181
|
-
|
|
182
|
-
The deck now adds only work it has actually watched happen. A session that starts while you are looking shows up at the next reading instead of instantly — up to a minute — which is how the panel behaved before the live figure existed at all. Everything already on screen keeps moving as it did.`}],"3.6.0":[{title:"✂️ The two figures at the end of the top bar are gone",body:`The bar used to end with a token count and a dollar figure. Both were sums over what is on the canvas at that moment, and the canvas drops finished sessions a couple of minutes after they end — so both numbers fell on their own, with nothing on screen to explain the fall. They carried the word "board" and a three-line tooltip for exactly that reason.
|
|
183
|
-
|
|
184
|
-
The usage panel answers the same question without the apology: it reads the logs on disk, it covers sessions this deck never watched, and it does not forget. Press U for the panel, or H for the full history.
|
|
185
|
-
|
|
186
|
-
What is left in the bar is what is true right now — whether the stream is alive, and what your machine is doing.`}],"3.5.0":[{title:"⚡ The figures move when the work happens",body:`Reading your usage off the logs is not free — measured here, one reading is 7.8 seconds of CPU, because ccusage walks every transcript on the machine whatever period you asked for. Once a minute is affordable; once every ten seconds would be three quarters of a core, permanently, for numbers that move slowly.
|
|
187
|
-
|
|
188
|
-
So the reading stays on a minute and the deck fills the gap with what it already knows. Every hook event carries its session's running total, so the panel adds whatever has been spent since the last reading and counts up to it. The headline now moves when a turn finishes rather than on the clock, and it costs nothing extra.
|
|
189
|
-
|
|
190
|
-
It only ever adds. A session leaving the canvas cannot pull the figure down, and the next reading corrects whatever the estimate got wrong — the tokens are exact, and the dollars in between are priced by the deck's own table.
|
|
191
|
-
|
|
192
|
-
Two smaller things with it: pressing today, month or all now counts between the two figures instead of swapping them, and coming back to the tab only re-reads if what is on screen is actually stale.`}],"3.4.0":[{title:"🔢 The figures count to their new value, once a minute",body:`The Usage panel re-reads its numbers every minute now rather than every five, and it is a real minute — the server used to hold a reading for two, so a shorter poll would have handed the same figure back.
|
|
193
|
-
|
|
194
|
-
And they no longer teleport. Replaced in a single frame, $170 → $269 says only "this is different now": no direction, no sense of how much, and nothing at all if your eye was a few pixels away. Counted over a fifth of a second, the same change says up, and roughly how far.
|
|
195
|
-
|
|
196
|
-
What deliberately does not count: the first paint, a change of period — "today" and "all time" are different quantities rather than one that moved — the tables, a change too small to read, and anything at all if you have reduced motion on or the tab is in the background.`},{title:"🧹 The board's own figure is out of the Usage panel",body:`3.3.0 put the canvas's live spend on its own labelled line, under whichever period you had chosen. In front of a panel that answers today, this month and all time from the logs on disk, that second money figure answers a question nobody asked at that moment — and it invited a comparison it could never win, $7,385 on the board beneath $170 for today.
|
|
197
|
-
|
|
198
|
-
It is gone. The board's tokens and cost are still on the topbar, with the sentence that explains why they fall on their own, and the panel still shows them when ccusage cannot answer at all.`}],"3.3.0":[{title:"📊 The Usage panel answers for a period, not just for the board",body:`It used to add up the sessions drawn on the canvas — which is an honest number with a scope nobody reads it as having: finished sessions are evicted a couple of minutes after they end, so the figure fell on its own while nothing had happened and nothing was refunded.
|
|
199
|
-
|
|
200
|
-
It now reads ccusage, the same source the H modal uses, and offers today, this month and all time. BY MODEL and BY SESSION come from there too, and each session is named by the project the board knows it as rather than by a uuid.
|
|
201
|
-
|
|
202
|
-
The live figure is still there, on its own line and labelled — what the sessions currently on the board have spent — because that is a different question from what the month cost.
|
|
203
|
-
|
|
204
|
-
One thing worth knowing about the source: ccusage reports a session's LIFETIME total, so the rows under "active today" can add up to more than the day above them. The heading says so.`},{title:"🪟 Windows: a deck started from an elevated terminal was being treated as dead",body:"The hook decides whether a deck is still running by trying to signal it. On POSIX a process you may not signal answers EPERM; on Windows it answers EACCES, and only EPERM was accepted — so a deck started from an elevated terminal, or under another account, read as gone. Its registration was deleted on every event and rewritten five seconds later, while its banner went on saying it was connected and almost nothing arrived.\n\nThree more Windows-only faults went with it: a read-only settings.json made every hook install fail for good (the atomic write could not replace the file); the machine panel answered 500 every four seconds whenever the process read failed; and a bare command name was looked for in the working directory before PATH, which is where `npx ccdeck` was run."},{title:"👁 Browser Watch reads nothing while it is switched off",body:`The switch used to control only what was KEPT. The read happened anyway — every five minutes, on every deck, the panel's badge poll discovered each Chromium profile and copied its whole History database to a temp file to query it. A switch that says off while that continues is not a switch.
|
|
205
|
-
|
|
206
|
-
With the watch off, nothing touches a browser now. Opening the panel still reads live, because that is you looking, and a watch that is ON still records in the background — that is the feature. The trade is that the topbar badge no longer counts findings while the watch is off; open the panel to see them.
|
|
207
|
-
|
|
208
|
-
The README has a Browser Watch section now: what is read, when, where the copy goes, and that only visits after the deck started are ever considered.`},{title:"🔒 The deck's own data is no longer readable by anything on the machine",body:"Changing an account needed the deck's credential; reading the event ring did not. Anything running on your machine could `curl` the events — prompt text, the commands an agent ran, the paths and contents it touched — plus the account list and the browsing episodes.\n\nThose reads now answer to the same rule the mutations do: the deck's own page, or its token. Nothing changes for you in the browser. A script of yours that reads those routes needs the token from `~/.claude/agent-dag/<pid>.json`, sent as `x-ccdeck-token`."},{title:"💳 An API-key, Bedrock or Vertex install is told there is no quota window",body:`Those installs are billed per token and have no five-hour window. The CLI ran, printed no quota lines, and the deck read that as a genuine "under 1%" — drawing two empty bars for a measurement nobody had taken, or telling you to run /usage, which cannot help there.
|
|
209
|
-
|
|
210
|
-
It now says what it is, in one line, the way the Codex half already did.`},{title:"🎨 The model chip is coloured by its model again",body:`A session that switched model — Sonnet, then Opus — drew a chip reading "Opus 5 +1" in Sonnet blue, because the colour was picked from the tooltip and the tooltip lists every model the card's spend covers. Add a Fable turn and it went yellow.
|
|
211
|
-
|
|
212
|
-
Also fixed on the way past: an account import the CLI rejected could take the whole deck down with it, and a corrupt compressed Codex rollout leaked a file handle on every poll.`}],"3.2.1":[{title:"💵 Sonnet 5 was being costed fifty per cent high",body:`Sonnet 5 launched at $2/$10 per million tokens as introductory pricing, with a rise to $3/$15 announced for September 1. The deck implemented that schedule, and on September 1 it started charging the higher rate.
|
|
213
|
-
|
|
214
|
-
The increase was cancelled. Anthropic's pricing page now says the $2/$10 rate is simply the price and the rise "will not occur" — so every Sonnet 5 session since the 1st has been shown to you at half again what it cost.
|
|
215
|
-
|
|
216
|
-
It is corrected, and there is no date logic left in that rate to go stale a second time. Numbers already on your board are recomputed from the log the next time the deck starts; nothing was billed by us, only displayed.
|
|
217
|
-
|
|
218
|
-
Fable 5.1 and Mythos 5.1 are also priced now, including the cache read that is a quarter of Fable 5's — which is most of what a long session pays for.`}],"3.2.0":[{title:"🌡️ Windows shows a temperature where it can find one",body:`On most Windows laptops there is nothing to show, and that is Windows rather than this deck: modern machines declare no ACPI thermal zone, and the sensors that do exist sit behind an interface only an administrator may read. Measured on real hardware, elevated and not.
|
|
219
|
-
|
|
220
|
-
One thing does work, and it costs you nothing to have. If LibreHardwareMonitor happens to be running with its web server on, the deck now reads its numbers over localhost — which needs no privileges at all.
|
|
221
|
-
|
|
222
|
-
It is only ever a read. Nothing is installed, nothing is asked of you, and a machine without it shows no section, exactly as before.`}],"3.1.0":[{title:"🚀 The first run stops looking like it hung",body:`\`npx ccdeck\` on a machine that has never run it used to sit on a spinner at "checking claude-swap" and say nothing else. Measured on a Windows box: seventeen and a half seconds before it told you where to point a browser. It is now one and a half.
|
|
223
|
-
|
|
224
|
-
The deck was waiting for an install nobody asked for during that boot — a Python toolchain being fetched so the accounts panel would work. The port had been open the whole time; there was just nothing on screen to say so.
|
|
225
|
-
|
|
226
|
-
It no longer waits. Anything still working past the boot says so on its own line and keeps going in the background, and the deck comes up without it.`},{title:"⚡ Every start is quicker, and stays quicker",body:`The event log was read from the beginning on every boot to fill a buffer that only keeps the last two thousand events — so four fifths of that reading existed to be thrown away, and it got slower the longer you had been using the deck. It reads from the end now and stops when the buffer is full: 258ms down to 20ms here, on a 34 MB log, and it no longer grows.
|
|
227
|
-
|
|
228
|
-
The accounts tool is also asked for its version once instead of twice, which on this machine was the single largest thing in an ordinary boot.`},{title:"📉 Ten fewer packages to install",body:"Opening your browser used to cost a dependency that brought nine more with it — ten downloads on a cold `npx ccdeck` before the deck's own files were unpacked. It is now done with the commands the operating system already has.\n\nThe package has no runtime dependencies at all."},{title:"🌡️ Temperature, on the machines that could not show it",body:`On Windows the deck was asking somewhere it is not allowed to look: that reading lives behind a namespace that needs administrator, so it failed for everybody and the section never appeared. It reads a performance counter now, which needs nothing.
|
|
229
|
-
|
|
230
|
-
On Apple Silicon there is no command that ships with macOS which prints a temperature at all — the sensors are behind an interface only native code can reach. The deck fetches a small signed tool for it, verified against the checksum its release publishes, in the background and only on the Macs that need it. You do not have to install anything. \`AGENTS_DECK_NO_DOWNLOAD=1\` turns that off.
|
|
231
|
-
|
|
232
|
-
A machine with no sensor still shows no section, which includes every virtual machine. Nothing is drawn that was not measured.`},{title:"😌 The terminal goes quiet when there is nothing happening",body:`The dot at the bottom blinked every 800ms for as long as the deck ran, which is what a terminal does while it is working — so a deck that had finished in a second looked like one that never finished.
|
|
233
|
-
|
|
234
|
-
It now moves only while something actually is: a job still running, or hooks that cannot find the deck. Otherwise it is drawn once and left alone, and it says what the job is rather than just blinking. A step that takes more than three seconds shows how long it has been going, which is the whole of "is this stuck".
|
|
235
|
-
|
|
236
|
-
And a machine with no Claude Code installed stops being told about it every few seconds — that one is said once now, on its own line instead of across the status line.`}],"3.0.0":[{title:"📈 The machine panel now shows what it DID, not just what it is",body:`Click any section of the machine panel — Cores, Memory, Load average, Thermal — and it opens a chart of what that reading has done since the deck started.
|
|
237
|
-
|
|
238
|
-
The panel could always tell you the machine is busy now. It could not tell you whether it got hot while that three-hour build was running, or how deep the queue went while you were away, and those are the questions you actually have afterwards.
|
|
239
|
-
|
|
240
|
-
Thermal is new as well. Where the machine will give degrees, it gives degrees; on a Mac it also reports whether the CPU is being held back to cool down, which is the consequence a temperature has to be interpreted into anyway. Nothing is drawn that was not measured — a machine with no sensor gets no section at all, rather than a zero.`},{title:"🔍 The whole process list, not just the busiest eight",body:`"more" beside Busiest processes opens the full list the deck is watching — around fifty processes rather than eight — with the pid and the untruncated name.
|
|
241
|
-
|
|
242
|
-
This closes a gap. The panel's eight rows are the busiest, so sorting them by name only reorders those eight: "is my test runner still going" could not be answered if the test runner was not already on screen. Now it can.
|
|
243
|
-
|
|
244
|
-
It is deliberately not a task manager. Nothing here ends a process; Activity Monitor and Task Manager are better at that and it is not a thing this deck should own.`},{title:"🔤 Process names in Cyrillic, Greek or with accents read correctly",body:`An application named Яндекс Музыка was showing up as M-PM-/M-PM-=M-PM-4M-PM-5… in the process list, and so was every other name the deck could not spell in plain ASCII.
|
|
245
|
-
|
|
246
|
-
The deck was forcing a fixed locale on the commands it runs, to guarantee that a decimal point stays a point on a machine set to German or Russian — and that also forced the character set. It forces only the number format now. Your own character set is left alone, which is what makes the name arrive intact.`},{title:"📦 The text you copy to share accounts is a third of its size",body:`Sharing three accounts used to produce 6168 characters. It is now 1896.
|
|
247
|
-
|
|
248
|
-
Most of that text was never the credentials — two OAuth tokens are about two hundred characters between them, and the rest was the envelope, whose field names repeated in full for every account added. So the saving grows with the number of accounts rather than shrinking.
|
|
249
|
-
|
|
250
|
-
A blob you copied before this still imports until it expires. One made now cannot be read by a deck older than this version — that is the one thing in this release that older decks cannot follow.`}],"1.48.0":[{title:"👁 Browser Watch — see what a program opened while you were away",body:`There is a new eye in the top bar. It watches the browsers on this machine and tells you when a program — an extension, an agent, a command — opened pages while nobody was touching the browser.
|
|
251
|
-
|
|
252
|
-
Usually that is your own agent doing what you asked, and the panel says so rather than crying intrusion. What it gives you is the evidence: which pages, in which browser, at what time, with every address written out in full.
|
|
253
|
-
|
|
254
|
-
It is off until you switch it on, and nothing leaves this machine. It reads a copy of the browser's own history and only pages newer than the moment the deck started — never anything from before, never cookies, never saved passwords. Open ⚙ inside the panel and "What Browser Watch can access" says exactly what it reads, keeps and sends.
|
|
255
|
-
|
|
256
|
-
When it finds something the eye turns amber with a count. You can dismiss a finding once you have looked at it and it stays gone, while the log file on disk keeps the record. On a Mac it can also close the tab it found, or quit the browser.`},{title:"🔑 Move all your accounts to another machine in one paste",body:`Sharing accounts between two decks used to be one account at a time, and step four of six is where people stop — leaving the second deck half set up with nothing saying so.
|
|
257
|
-
|
|
258
|
-
Pick the accounts you want, copy one blob, paste it into the other deck. The import adds what is missing, leaves what already works alone, heals an account whose token has died, and tells you which of those happened to each one.
|
|
259
|
-
|
|
260
|
-
The blob carries real credentials, so it expires ten minutes after you make it and the deck refuses an expired one before it unwraps anything.`}],"1.47.0":[{title:"🔌 The top bar goes quiet when everything is fine",body:`The green "live" pill used to sit up there permanently to tell you nothing was broken. It is gone while things are working.
|
|
261
|
-
|
|
262
|
-
You will still see a pill when it matters: amber when you pause the canvas, with how many events are waiting, and red when the deck loses its connection to the server. No pill means all is well.`},{title:"🔴 The browser tab tells you when the connection drops",body:`The little icon in the tab has always shown what your sessions are doing — grey when it is quiet, blue when something is working, amber when a session is waiting on you.
|
|
263
|
-
|
|
264
|
-
It could not say the one thing that matters most: that the deck has stopped hearing from the server. Until now it just kept showing whatever it had last seen. It turns into a broken red ring instead, so you can spot it from another tab without switching over.`}],"1.46.0":[{title:"🔊 Pick a volume and a sound for each of the two tones",body:`Click the speaker in the top bar and a small menu opens. There are two tones — one when a turn finishes, one when Claude is waiting for you — and each has its own volume and its own sound, six to choose from. Press "Hear it" to try one straight away, without waiting for a real turn.
|
|
265
|
-
|
|
266
|
-
The two lists are separate on purpose, so you can never end up with both tones sounding the same. A finish tone always falls; an asking tone always rises. That is how you tell them apart without looking at the screen.
|
|
267
|
-
|
|
268
|
-
M still turns the sound on and off from anywhere.`},{title:"✨ This box is new",body:`After an update, the deck tells you what changed — once, and only when there is something worth telling. Most updates have nothing to say and you will see nothing at all.
|
|
269
|
-
|
|
270
|
-
Click the version at the top of the deck to read it again whenever you like.`}],"1.45.0":[{title:"🔕 The deck no longer puts anything in your settings.json",body:"It used to add a hook there so Claude Code would play a sound when a turn ended. That entry is removed the first time you start this version, and any sound hook you wrote yourself is put back exactly where you had it. Nothing else in that file is touched. The deck makes the sound itself now — which is also why you finally hear one when a Codex turn ends, not just a Claude one."}],"3.16.0":[{title:"🤝 Pair two decks with one piece of text",body:`**Accounts ▸ Local network ▸ setup… ▸ make an invite.** Send the text however you already talk to them; they paste it and the two decks are paired. Nobody presses accept, and neither of you has to know which of your addresses the other can reach — the invite carries them all and their deck tries each one.
|
|
271
|
-
|
|
272
|
-
Decks on the same router still find each other on their own and appear under **on this network right now**. An invite is for the case that does not work: another subnet, a VPN, a firewall.
|
|
273
|
-
|
|
274
|
-
The invite lasts 10 minutes and is used once. Anyone who gets hold of the text can pair with your deck until it runs out, so send it the way you would send anything else you would not want forwarded.`},{title:"⚠️ Both machines have to be on this version",body:`The two decks no longer speak the old protocol, and there is no fallback: a 3.15 deck and a 3.16 deck cannot see each other at all. Update both.
|
|
275
|
-
|
|
276
|
-
The group passphrase is gone. If you had one set, that pairing is not carried over — make an invite and pair again. It was replaced because a passphrase that differs by one character produced a closed socket and no other symptom on either machine, and a secret is the one thing a panel must never print, so neither person could check theirs against the other's.`}],"3.22.1":[{title:"🖥️ A first run now opens This machine too",body:`Accounts and usage already opened themselves the first time you ran the deck; the machine panel did not, and now does. It is the panel that answers "is this box coping" — cores, memory, load, temperature — and somebody meeting the deck for the first time cannot ask for a panel they do not know is there.
|
|
277
|
-
|
|
278
|
-
It only does this when you have never said otherwise. Close it once and it stays closed, on that browser, for good — the same rule the other two panels have always followed. Nothing reopens it behind you.
|
|
279
|
-
|
|
280
|
-
While it is open it polls this machine once every few seconds, and it stops the moment you close it or switch tabs.`}],"3.22.4":[{title:"📈 A card stops looking idle while it is thinking",body:`The activity chart on each card counted tool calls and nothing else, so the time an agent spends reading, reasoning and writing drew as a flat line — measured on this machine, 16.5% of all working time, more than the time spent inside the tools themselves. A session that was busy looked exactly like one that had died, and the only way to tell them apart was to wait and see whether anything ever appeared.
|
|
281
|
-
|
|
282
|
-
It marks that work now. A chart with bars in it means the agent is doing something, whether or not it has called a tool in the last minute; a flat chart means it genuinely is not. Hover it for the split — how many tool calls and how many blocks of thinking and writing landed in the last 60 seconds.
|
|
283
|
-
|
|
284
|
-
Nothing was added to the card and nothing new is polled. The deck already reads each session's transcript for its token counts; this reads the same file for what the model has finished writing, and a session that is quiet costs one file check per second and a half.`}]},hk="agent-dag.releaseNotesSeen";function tR(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function ec(e,t){const n=tR(e),r=tR(t);for(let s=0;s<Math.max(n.length,r.length);s++){const l=(n[s]??0)-(r[s]??0);if(l!==0)return l<0?-1:1}return 0}function tc(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function kK(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 NK(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,r]of Object.entries(e)){if(!tc(n)||!Array.isArray(r))continue;const s=r.filter(kK);s.length&&t.push({version:n,notes:s})}return t.sort((n,r)=>ec(r.version,n.version))}const nR=NK(bK);function x$(e,t,n){return e.filter(r=>ec(r.version,n)<=0&&(t===null||ec(r.version,t)>0))}function SK(e,t){return e.filter(n=>ec(n.version,t)===0)}function jK(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 _K({since:e,running:t,entries:n,firstRun:r}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const c=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${c} changed something you would notice. Clicking the version in the topbar brings this back.`}if(r&&tc(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(!tc(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const l=ec(s,t);return l<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:l>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const EK=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function CK(e){const t=EK.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function rR(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function TK(e){if(!e)return null;let t=null;try{t=e.getItem(hk)}catch{return null}return tc(t)?t:null}function RK(e){if(!e)return!1;try{return e.getItem(hk),!0}catch{return!1}}function AK(e,t){if(!e)return!1;try{return e.setItem(hk,t),!0}catch{return!1}}const b$="agent-dag.tourSeen";function MK(e){if(!e)return!1;try{return e.getItem(b$)==="1"}catch{return!1}}function IK(e){if(!e)return!1;try{return e.setItem(b$,"1"),!0}catch{return!1}}function $K({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 OK({stored:e,running:t,notes:n,remembers:r=!0}){if(!tc(t))return{show:[],record:null,reason:"no-version"};if(!tc(e)){if(!r)return{show:[],record:t,reason:"cannot-remember"};const c=SK(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const s=ec(e,t);if(s===0)return{show:[],record:null,reason:"seen"};if(s>0)return{show:[],record:null,reason:"ahead"};const l=x$(n,e,t);return l.length?{show:l,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function LK(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 k$(e,t=!0){const n=[];let r="";const s=()=>{r&&(n.push({kind:"text",text:r}),r="")};let l=0;for(;l<e.length;){if(e[l]==="`"){const c=e.indexOf("`",l+1);if(c>l+1){s(),n.push({kind:"code",text:e.slice(l+1,c)}),l=c+1;continue}}else if(t&&e.startsWith("**",l)){const c=LK(e,l);if(c>0){s(),n.push({kind:"bold",kids:k$(e.slice(l+2,c),!1)}),l=c+2;continue}}r+=e[l],l+=1}return s(),n}const PK=new Set(["idle","checking","current","downloading","ready","error"]);function sR(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.status!="string"||!PK.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 DK(e){return(e==null?void 0:e.status)==="ready"&&e.version?{version:e.version}:null}function FK(e=typeof navigator>"u"?"":navigator.userAgent){var t;return((t=/\bccdeck-desktop\/(\d[^\s]*)/.exec(e))==null?void 0:t[1])??null}const ff="Restart to update",N$=3e4;function qK(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 BK(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 ${ff} comes first`}}function zK(e){const t=e==null?void 0:e.reason;return t==="app_disconnected"||t==="update_not_ready"?t:"refused"}function UK(e,t,n=typeof navigator>"u"?"":navigator.userAgent){const r=qK(n),s=`Use ${ff} 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, ${ff} is in ${r}.`;case"timeout":return`ccdeck has not restarted after ${N$/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}`}}function HK({entries:e,since:t,running:n,firstRun:r,onClose:s,onTour:l,updateVersion:c,updateBusy:u,onUpdateRestart:f,updateFailure:p,onRestart:h}){const m=mn(s),y=jK(e);return o.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:o.jsxs("div",{ref:m,className:"modal release-notes",onClick:v=>v.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),y&&o.jsx("span",{className:"modal-tool-id",children:y})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[(c||p)&&o.jsxs("div",{className:"rn-update",children:[c&&f&&o.jsxs("div",{className:"guide-door",children:[o.jsxs("span",{children:["ccdeck v",c," is downloaded and verified."]}),o.jsx("button",{type:"button",className:"btn",onClick:f,"aria-busy":u||void 0,children:u?"Restarting…":ff})]}),o.jsx("p",{className:"rn-update-said",role:"status",children:p})]}),o.jsx("p",{className:"modal-note",children:_K({since:t,running:n,firstRun:r,entries:e})}),l&&!c&&o.jsxs("div",{className:"guide-door",children:[o.jsx("span",{children:"Eight pictures of what the deck shows."}),o.jsx("button",{type:"button",className:"btn",onClick:l,children:"Take the tour"})]}),h&&o.jsxs("div",{className:"guide-door",children:[o.jsx("span",{children:"Restart the deck. Sessions, settings and pairings come back as they were."}),o.jsx("button",{type:"button",className:"btn",onClick:h,children:"Restart"})]}),e.map(v=>o.jsxs("section",{className:"modal-section",children:[o.jsxs("h3",{className:"rn-version",children:["v",v.version]}),o.jsx("ul",{className:"rn-notes",children:v.notes.map((S,b)=>{const{icon:_,rest:k}=CK(S.title);return o.jsxs("li",{className:"rn-note",children:[o.jsxs("p",{className:"rn-note-title",children:[_&&o.jsx("span",{className:"rn-note-icon",children:_}),k]}),o.jsx("p",{className:"rn-note-body",children:S$(k$(S.body))})]},b)})})]},v.version))]})]})})}function S$(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?o.jsx("code",{className:"rn-code",children:t.text},n):o.jsx("strong",{className:"rn-strong",children:S$(t.kids)},n))}function WK(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function VK(e,t,n){var c;if(e.length===0)return null;const r=WK(e),s=t?r.findIndex(u=>u.id===t):-1,l=s===-1?n===1?0:r.length-1:(s+n+r.length)%r.length;return((c=r[l])==null?void 0:c.id)??null}const GK=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function KK(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:GK.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const YK=new Set(["","BODY","HTML","#DOCUMENT"]);function XK(e){return!e||Ef(e)?!1:!YK.has(String(e.tagName??"").toUpperCase())}const fk="agent-dag.removedNodes";function ZK(e){try{const t=JSON.parse((e==null?void 0:e.getItem(fk))??"[]");return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function aR(e,t){try{e==null||e.setItem(fk,JSON.stringify([...t]))}catch{}}function j$(e,t){const n=new Map(e.map(l=>[l.id,l.parentId])),r=new Set(t),s=l=>{if(r.has(l))return!0;const c=new Set([l]);let u=n.get(l);for(;u&&!c.has(u);){if(r.has(u))return r.add(l),!0;c.add(u),u=n.get(u)}return!1};return l=>s(l.id)||s(l.sessionId??l.id)}function QK(e,t){if(t.size===0)return new Set;const n=[...e],r=j$(n,t);return new Set(n.filter(r).map(s=>s.id))}function JK(e,t,n){const r=u=>({id:u.id,parentId:u.data.parentId,sessionId:u.data.sessionId}),s=j$(e.map(r),n),l=e.filter(u=>!s(r(u))),c=new Set(l.map(u=>u.id));return{nodes:l,edges:t.filter(u=>c.has(u.source)&&c.has(u.target))}}function eY(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 tY(e,t){return t.size===0?[]:[...e].filter(n=>t.has(n.id)).map(n=>n.id)}function nY(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 rY(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 sY(e,t,n,r){if(n.size===0)return[];let s=1/0;for(const c of r.values())c<s&&(s=c);const l=new Set;for(const c of t){const u=e.get(c);if(!u)continue;const f=nY(u);if(f<=s)continue;const p=[],h=new Set,m=v=>{var S;for(let b=v;b&&!h.has(b);b=(S=e.get(b))==null?void 0:S.parentId)h.add(b),n.has(b)&&p.push(b)};m(u.id),m(u.sessionId);let y=-1/0;for(const v of p)y=Math.max(y,r.get(v)??1/0);if(f>y)for(const v of p)l.add(v)}return[...l]}const aY=16,oY=120;function iY(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 lY(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 cY(e,t){return iY(e,t,aY)?"over":lY(e,t)<=oY?"near":"far"}function uY(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 dY(e,t){if(!t||!e.agents.get(t))return null;const r=new Set([t]);let s=t;for(;s;){const c=e.agents.get(s);if(!(c!=null&&c.parentId)||r.has(c.parentId))break;r.add(c.parentId),s=c.parentId}let l=!0;for(;l;){l=!1;for(const c of e.agents.values())c.parentId&&r.has(c.parentId)&&!r.has(c.id)&&(r.add(c.id),l=!0)}return r}function hY(e,t){const n=new Set;for(const r of t){const s=dY(e,r);if(s)for(const l of s)n.add(l)}return n.size>0?n:null}const fY=40,pY=120;function mY(e,t){let n=null,r=0,s=Number.NEGATIVE_INFINITY;const l=()=>{n=null,s=t.now(),e()},c=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(f,p,h)=>{if(n!=null){if(r<=f)return;c()}const m=Math.min(h,Math.max(0,f-p));r=f,n=t.setTimeout(l,m)};return{live(f=fY){const p=t.now(),h=Math.max(s+f,p);if(h<=p){c(),l();return}u(h,p,f)},replay(f=pY){c(),r=t.now()+f,n=t.setTimeout(l,f)},flush(){c(),l()},cancel(){c()}}}const gY=1e3;function yY(e={}){const t=Math.max(1,Math.floor(e.limit??gY)),n=e.protect;let r=!1,s=[],l=new Set,c=0,u=0,f=null;return{get paused(){return r},get size(){return s.length},get dropped(){return c},get overflowed(){return c>0},get through(){return u},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,m=(p==null?void 0:p.epoch)??null,y=m!==null&&m!==f;y&&(f=m,u=0);const v=h!==null&&!y&&h<=u;if(h!==null&&h>u&&(u=h),!r)return!0;if(v)return!1;if(s.push(p),n!=null&&n(p)&&l.add(p),s.length>t){let S=0;if(l.size<s.length)for(;l.has(s[S]);)S++;const[b]=s.splice(S,1);l.delete(b),c++}return!1},setPaused(p){if(r=p,p)return[];const h=s;return s=[],l=new Set,c=0,h}}}const _$="agent-dag.theme";function wY(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function vY(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function xY(){return wY(yr(_$),vY())}const bY=6,kY="ccdeck-tabs";function NY(e){return e>=bY}function SY(e,t,n){const r=s=>{const l=s.data;(l==null?void 0:l.kind)==="who"&&l.from!==t&&e.postMessage({kind:"here",from:t,to:l.from,streaming:n()})};return e.addEventListener("message",r),{ask(s,l=(c,u)=>setTimeout(c,u)){return new Promise(c=>{const u=new Set,f=p=>{const h=p.data;(h==null?void 0:h.kind)==="here"&&h.to===t&&h.streaming&&u.add(h.from)};e.addEventListener("message",f),e.postMessage({kind:"who",from:t}),l(()=>{e.removeEventListener("message",f),c(u.size)},s)})},leave(){var s;e.removeEventListener("message",r),(s=e.close)==null||s.call(e)}}}function jY({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${hn}`:hn,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const Th={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Rh(e,t){const s=c=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${c}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?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 _Y=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Rh(Th.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Rh(Th.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Rh(Th.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Rh(Th.idle,"idle"))}`}),EY="No sessions are waiting for you.";function CY(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 oR(e,t,n=EY){return t!==""?t:e===""?"":n}const iR="agent-dag.browserWatch.seenMs";function TY(e,t){return e.filter(n=>n.startMs>t)}function RY(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,l)=>(s.at??0)-(l.at??0));return{request:r[0],waiting:r.length-1}}function AY({request:e,waiting:t,busy:n,now:r,onAccept:s,onDecline:l,onLater:c}){const u=w.useRef(null),f=mn(c,{focusRef:u}),p=lo(n,"accept"),h=lo(n,"dismiss");return o.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:o.jsxs("div",{ref:f,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("i",{className:"ap-pulse","aria-hidden":!0}),o.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:c,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[o.jsxs("p",{className:"lan-ask-who",children:[o.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",o.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",Hb(e.at,r)]}),o.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."}),o.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",o.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&&o.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.`}),o.jsxs("div",{className:"lan-ask-acts",children:[o.jsx("button",{type:"button",ref:u,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:l,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),o.jsx("button",{type:"button",className:"btn primary",disabled:p.disabled,"aria-busy":p.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"})]})]})]})})}const MY=600;function eb(e,t){return!(e.exitAt!=null&&t-e.exitAt>MY||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function IY(e,t){const n=new Set;for(const r of e.agents.values())eb(r,t)&&n.add(r.id);return n}function $Y(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 OY(e,t,n=0){if(!e)return!1;for(const r of t)if($Y(e,r,n))return!0;return!1}const E$="sessionGroup";function LY(e,t){var r,s;if(e.type===E$)return"transparent";if(Dr((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 C$=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function lR(e){const t={};for(const n of C$)t[n]=e(n);return t}function PY(e){return t=>e[t]??""}function DY(e,t){return C$.every(n=>e[n]===t[n])}function FY(e){const t=new Set(e.pins),n=new Map,r=new Map;for(const[s,l]of e.positions)n.set(s,l),t.has(s)&&r.set(s,l);return{positions:n,pinned:r}}function cR(e){return Object.entries(e??{}).filter(([,t])=>t&&typeof t.x=="number"&&typeof t.y=="number")}function qY(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=cR(n);return{positions:s,pins:s.map(([l])=>l)}}const r=n;return{positions:cR(r.positions),pins:Array.isArray(r.pins)?r.pins:[]}}function BY(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 zY(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 T$=.2,R$=1.6;function UY(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<T$||s>R$?null:{x:n,y:r,zoom:s}}const HY=1200,WY=1e3;function n0(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<HY?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<WY}function Ah({durationMs:e,documentHidden:t,reducedMotion:n=VY()}){return t||n?!1:Number.isFinite(e)&&e>0}function VY(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function GY(e,t,n){const r=e.x*t.zoom+t.x,s=e.y*t.zoom+t.y,l=(e.x+e.width)*t.zoom+t.x,c=(e.y+e.height)*t.zoom+t.y;return l>0&&r<n.width&&c>0&&s<n.height}function KY({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,GY(s,t,e))return!1;return r}const pk=11,A$=7.2,M$=6.6,YY={width:104,height:48},uR={width:96,height:44},I$={width:220,height:103};function XY(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)?I$:{width:Math.max(160,t),height:Math.max(72,n)}}function r0(e,t,n){return e.width*t>=n.width&&e.height*t>=n.height}function ZY(e,t,n=I$){if(!Number.isFinite(t)||t<=0)return e??"detail";const r=pk*t;return e==="detail"?r>=M$?"detail":r0(n,t,uR)?"compact":"overview":r>=A$?"detail":e==="compact"?r0(n,t,uR)?"compact":"overview":r0(n,t,YY)?"compact":"overview"}const QY=A$/pk,JY=M$/pk;function eX(e,t){return e>=QY?e:Math.max(e,Math.min(t,JY-.001))}const tX=.8,nX=1;function rX(e){const t=e.minZoom??tX,n=e.maxZoom??nX,r=e.fill??.9,s=e.insets.left,l=e.insets.top,c=Math.max(1,e.pane.width-e.insets.left-e.insets.right),u=Math.max(1,e.pane.height-e.insets.top-e.insets.bottom),f=e.context,p=e.anchor,h=Math.min(c/Math.max(1,f.width),u/Math.max(1,f.height))*r,m=Math.max(t,Math.min(n,h)),y=(v,S,b,_,k,j)=>{let E=v+(S-_*m)/2-b*m;const C=k*m+E,R=(k+j)*m+E;return j*m<=S?C<v?E+=v-C:R>v+S&&(E-=R-(v+S)):E+=v-C,E};return{x:y(s,c,f.x,f.width,p.x,p.width),y:y(l,u,f.y,f.height,p.y,p.height),zoom:m}}function sX(e){let t=1/0,n=1/0,r=-1/0,s=-1/0;for(const l of e)t=Math.min(t,l.x),n=Math.min(n,l.y),r=Math.max(r,l.x+l.width),s=Math.max(s,l.y+l.height);return Number.isFinite(t)?{x:t,y:n,width:r-t,height:s-n}:null}let fi=null,Pl=null;const tb=new Set,nb=()=>{for(const e of tb)e()},aX=e=>(tb.add(e),()=>{tb.delete(e)}),dR=()=>fi,oX=90;function $$(e){!Pl||e!=null&&Pl.at.id!==e||(clearTimeout(Pl.timer),Pl=null)}function hR(e,t,n="pointer"){$$();const r={id:e,anchor:t,by:n};if(fi||n==="focus"){fi=r,nb();return}Pl={at:r,timer:setTimeout(()=>{Pl=null,fi=r,nb()},oX)}}function Za(e){$$(e),!(!fi||e!=null&&fi.id!==e)&&(fi=null,nb())}function iX({agentFor:e,recapFor:t,labelFor:n,bounds:r}){const s=w.useSyncExternalStore(aX,dR,dR),l=s?e(s.id):void 0,c=s&&!l?t(s.id):void 0,u=s!=null&&(!l&&!c||!s.anchor.isConnected);return w.useEffect(()=>{u&&s&&Za(s.id)},[u,s]),!s||u?null:l?o.jsx(cX,{a:l,anchor:s.anchor,parentLabel:l.parentId?n(l.parentId):void 0,bounds:r},s.id):c?o.jsx(lX,{r:c,anchor:s.anchor,bounds:r},s.id):null}function O$(e,t){const n=w.useRef(null),r=w.useCallback(()=>{const s=n.current;if(!s||!e.isConnected)return;const l=Pb(e.getBoundingClientRect(),{width:s.offsetWidth,height:s.offsetHeight},t());s.style.top=`${l.top}px`,s.style.left=`${l.left}px`,s.style.maxHeight=l.maxHeight==null?"":`${l.maxHeight}px`,s.dataset.side=l.side},[e,t]);return w.useLayoutEffect(()=>{r()}),n}function lX({r:e,anchor:t,bounds:n}){const r=O$(t,n),s=rc(3e4),l=nf(e.recap.at,s);return On.createPortal(o.jsxs("div",{ref:r,className:"ap-peek node-peek recap-peek",role:"tooltip",id:"node-peek",style:{"--session-hue":e.hue},children:[o.jsxs("div",{className:"node-peek-head",children:[o.jsxs("span",{className:"recap-peek-mark",children:[o.jsx(Ru,{}),"recap"]}),o.jsx("span",{className:"node-peek-time",title:l.title,children:l.label})]}),e.sessionLabel&&o.jsx("div",{className:"node-peek-kind",children:o.jsxs("span",{children:["Claude Code's recap of ",e.sessionLabel]})}),o.jsx("p",{className:"recap-peek-text",children:e.recap.text}),o.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for its details"})]}),document.body)}function cX({a:e,anchor:t,parentLabel:n,bounds:r}){const s=O$(t,r),l=rc(1e3),c=Eb(e.sessionName,e.sessionTitle),u=e.tools.filter(S=>S.ok===!1).length,f=e.tools.filter(S=>!S.endedAt).length,p=or(e,l).total,h=e.usage.inputTokens+e.usage.outputTokens,m=e.kind==="root"&&Dr(e.waiting),y=e.kind==="root"?"session":n?`subagent of ${n}`:"subagent",v=[`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,f>0?`${f} in-flight`:null,h>0?`${Pt(h)} tok`:null,p>0?`${bt(p)}${Tu(e,l)>0?"+":""}`:null].filter(Boolean).join(" · ");return On.createPortal(o.jsxs("div",{ref:s,className:"ap-peek node-peek",role:"tooltip",id:"node-peek",children:[o.jsxs("div",{className:"node-peek-head",children:[o.jsx("span",{className:"node-peek-name",children:e.label}),o.jsxs("span",{className:"node-peek-time",children:[e.synthetic?"≥ ":"",Gl(e.startedAt,e.endedAt,l)]})]}),o.jsxs("div",{className:"node-peek-kind",children:[o.jsxs("span",{className:"node-peek-state","data-kind":T0(e.state),children:[o.jsx(bM,{kind:T0(e.state)}),Yl(e.state)]}),o.jsx("span",{children:y}),e.model?o.jsx("span",{children:io(e.model)}):null]}),e.kind==="root"&&c.face&&o.jsx("p",{className:"node-peek-title",children:c.face}),e.kind==="root"&&e.waiting&&o.jsxs("p",{className:`node-peek-wait${m?" warn":""}`,children:[m&&o.jsx(Mb,{}),o.jsx("span",{children:Ib(e.waiting)}),o.jsx("b",{children:Gl(e.waiting.since,void 0,l)})]}),o.jsxs("p",{className:"node-peek-facts",children:[v,u>0&&o.jsxs("span",{className:"node-peek-failed",children:[" · ",u," failed"]})]}),e.branch&&e.branch.total>0&&o.jsx("p",{className:"node-peek-branch",children:pM(e.branch)}),o.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for details"})]}),document.body)}const uX=5*6e4,dX=6e4;function hX({shown:e,tabVisible:t,lastReadAt:n,now:r,lastSince:s,since:l}){return!e||!t?!1:s&&l&&s!==l?!0:n===null||r-n>=uX}function fR(e=new Date){return RM("month",e)}function fX(e){const t=Af(e);return{cost:t.cost,tokens:t.tokens}}function pR(e){return e>0?bt(e):"$0.00"}const pX="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",s0="click for what's new";function mX(e){if(e.checkDisabled)return`${pX} · ${s0}`;if(e.checking)return`Asking npm for the newest release… · ${s0}`;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 · ${s0}, and to check npm now`}function gX(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 yX(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 L$(e){return e?`${e.kind}:${e.to}`:""}function wX(e,t){return e!=null&&t!==L$(e)}function vX(e){if(e==null)return{kind:"unknown",lead:"No data yet. Start a Claude Code or Codex session — it appears here as soon as the deck sees its first event.",workspace:null,tail:""};const t=e.trim();return t===""?{kind:"machine",lead:"No data yet. Start a Claude Code or Codex session anywhere on this machine — this deck is unscoped and captures every workspace.",workspace:null,tail:""}:{kind:"scoped",lead:"No data yet. This deck only captures sessions running under",workspace:t,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const rb={kind:"assumed",claude:!0,codex:!0};function xX(e){if(!e||typeof e!="object")return rb;const t=e.providers;if(!t||typeof t!="object")return rb;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function bX(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const mR={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent",zcode:"ZCode"};function kX(e){const t=e.toLowerCase();return Object.hasOwn(mR,t)?mR[t]:t?t[0].toUpperCase()+t.slice(1):""}function NX(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function pZ(e,t=[]){const n=t.length?NX(t.map(kX)):bX(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function SX(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 jX(e,t){const n=t.prefs??X0,r=Ql(n.done.level),s=Ql(n["needs-input"].level),l=r===s?`${r}%`:`${r}% and ${s}%`,c=t.on?`Sound: on at ${l} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
|
|
285
|
-
|
|
286
|
-
Both CLIs get the finish tone. The second tone — Claude is waiting for you — has no Codex equivalent to fire on, so it only ever plays for Claude Code.`:"",f=t.on&&t.locked?`
|
|
287
|
-
|
|
288
|
-
Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return c+u+f+`
|
|
289
|
-
|
|
290
|
-
Click to set the volume and the sound of each tone, and to hear either one.`}function pf(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const gR=99;function _X(e){const t=Math.max(0,Math.floor(e));return t>gR?`${gR}+`:String(t)}const EX="Pause the canvas";function CX(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 — ${pf(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)":`${pf(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function TX(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 P$="paused · full",RX=(e,t)=>t>0?P$:e>0?`paused · ${_X(e)}`:"paused";function AX(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:RX(e.held,t),widest:P$,title:t>0?`Connected — the pause is full at ${pf(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${pf(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 MX=w.lazy(()=>ab(()=>import("./UsageHistoryModal-KJfli0oa.js"),[])),IX=w.lazy(()=>ab(()=>import("./BrowserWatchModal-CyAFTvAY.js"),[]));function yR(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const $X={agent:nq,sessionGroup:$q,recapNote:Lq},OX={recapTie:Pq},D$="react-flow__node";function a0(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,D$))===!0}const o0=80,i0=.86;function wR(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 LX(e){try{const t=document.querySelector(`.${D$}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const PX=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),DX=420,Mh=18,vR=400,l0=450,mk="agent-dag.layout",gk="agent-dag.layoutFrame",yk="agent-dag.viewport",F$="agent-dag.sessionListOpen",q$="agent-dag.detailOpen",B$="agent-dag.usagePanelOpen",z$="agent-dag.systemPanelOpen",xR="agent-dag.accountsPanelOpen",c0="agent-dag.versionNoticeDismissed",bR="agent-dag.oldNameNoticeDismissed",FX=15*6e4,u0={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:"},Ih="agent-dag.autoRestart",kR="agent-dag.bundleReloadedFor";function qX(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(F$)==="1"}catch{return!1}}function BX(e){if(!(typeof window>"u"))try{window.localStorage.setItem(F$,e?"1":"0")}catch{}}function zX(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(q$)==="1"}catch{return!1}}function UX(e){if(!(typeof window>"u"))try{window.localStorage.setItem(q$,e?"1":"0")}catch{}}function HX(){const e=yr(B$);return e===null?!0:e==="1"}function WX(e){if(!(typeof window>"u"))try{window.localStorage.setItem(B$,e?"1":"0")}catch{}}function VX(){const e=yr(z$);return e===null?!0:e==="1"}function GX(e){if(!(typeof window>"u"))try{window.localStorage.setItem(z$,e?"1":"0")}catch{}}function KX(){if(typeof window>"u")return{positions:[],pins:[]};try{return qY(window.localStorage.getItem(mk))}catch{return{positions:[],pins:[]}}}function $h(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(mk,BY(e,t))}catch{}}function YX(){if(typeof window>"u")return null;try{return zY(window.localStorage.getItem(gk))}catch{return null}}function XX(e){if(!(typeof window>"u"))try{window.localStorage.setItem(gk,JSON.stringify(e))}catch{}}function ZX(){if(typeof window>"u")return null;try{return UY(window.localStorage.getItem(yk))}catch{return null}}function QX(e){if(!(typeof window>"u"))try{window.localStorage.setItem(yk,JSON.stringify(e))}catch{}}function NR(){if(!(typeof window>"u")){try{window.localStorage.removeItem(mk)}catch{}try{window.localStorage.removeItem(yk)}catch{}try{window.localStorage.removeItem(gk)}catch{}}}function JX(e,t){const n=J9(e,t,new Date().toISOString());if(!n)return;const r=JSON.stringify(n,null,2),s=new Blob([r],{type:"application/json"}),l=URL.createObjectURL(s),c=document.createElement("a");c.href=l,c.download=eV(n.label,t),document.body.appendChild(c),c.click(),document.body.removeChild(c),setTimeout(()=>URL.revokeObjectURL(l),1e3)}const U$={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},eZ={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 tZ({cat:e}){return o.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:o.jsx("path",{d:eZ[e]})})}const mf={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},H$=gM;function nZ(){return o.jsx(Nb,{children:o.jsx(aZ,{})})}const rZ=e=>e.transform[2]>=e.maxZoom,sZ=e=>e.transform[2]<=e.minZoom;function aZ(){var qc,ra,Bc,Ko;const e=Nf(),t=Et(rZ),n=Et(sZ),r=tn(),s=w.useState(E0)[0],l=w.useRef(s),[c,u]=w.useState(()=>ZK(typeof window>"u"?null:window.localStorage)),[f,p]=w.useState(null),[,h]=w.useState(0),m=w.useCallback(()=>h(T=>T+1),[]),[y,v]=w.useState(zX);w.useEffect(()=>{UX(y)},[y]);const[S,b]=w.useState(()=>new Set),[_,k]=w.useState(null),[j,E]=w.useState(null),C=w.useCallback((T,A,Y=!A)=>{b(te=>{if(!A)return new Set([T]);const ye=new Set(te);return ye.has(T)?ye.delete(T):ye.add(T),ye}),k(te=>A&&te===T?te:T),!A&&Y&&v(!0)},[]),R=w.useCallback(()=>{b(new Set),k(null)},[]),[I,$]=w.useState(null),[q,B]=w.useState(null),P=w.useCallback(T=>B(T),[]),[W,ne]=w.useState(!1),[ee,M]=w.useState(!1),[X,V]=w.useState(!1),G=w.useRef(null),[F,L]=w.useState(qX);w.useEffect(()=>{BX(F)},[F]);const[H,D]=w.useState(HX);w.useEffect(()=>{WX(H)},[H]);const[K,re]=w.useState(null),[z,Z]=w.useState(!1),U=w.useRef(null);w.useEffect(()=>{let T=!0,A=!1,Y=null,te=null,ye="";const je=xt=>{T&&(Z(!0),xt!==ye&&re(null))},Oe=()=>{if(A)return;A=!0,Y=Date.now();const xt=fR();te=xt,fetch(`/api/ccusage?since=${xt}`).then(ft=>ft.ok?ft.json():null).then(ft=>{if(T){if(!(ft!=null&&ft.ok)){je(xt);return}ye=xt,re(fX(ft)),Z(!1)}}).catch(()=>je(xt)).finally(()=>{A=!1})},Be=()=>{const xt=U.current;hX({shown:!!xt&&xt.getClientRects().length>0,tabVisible:document.visibilityState==="visible",lastSince:te,since:fR(),lastReadAt:Y,now:Date.now()})&&Oe()};Be();const lt=window.setInterval(Be,dX);document.addEventListener("visibilitychange",Be);let et=null;return U.current&&typeof ResizeObserver<"u"&&(et=new ResizeObserver(Be),et.observe(U.current)),()=>{T=!1,window.clearInterval(lt),document.removeEventListener("visibilitychange",Be),et==null||et.disconnect()}},[]);const[ae,le]=w.useState(VX);w.useEffect(()=>{GX(ae)},[ae]);const ge=w.useRef(!1),[Ne,Ie]=w.useState(()=>{const T=(()=>{try{const A=window.localStorage.getItem(xR);return A===null?!0:A==="1"}catch{return!0}})();return T&&F?(ge.current=!0,!1):T});w.useEffect(()=>{if(!(!Ne&&ge.current))try{window.localStorage.setItem(xR,Ne?"1":"0")}catch{}},[Ne]),w.useEffect(()=>{!F&&ge.current&&(ge.current=!1,Ie(!0))},[F]);const Ge=wh(Ne,200),Pe=wh(H,130),ze=wh(ae,130),[Re,st]=w.useState(null);w.useEffect(()=>{let T=null;try{T=localStorage.getItem("agent-dag.sound")}catch{}st(T===null?!0:T==="on")},[]);const ue=w.useCallback(()=>{st(T=>{var Y;const A=T!==!0;try{localStorage.setItem("agent-dag.sound",A?"on":"off")}catch{}return A&&((Y=Ut.current)==null||Y.unlock()),A})},[]),ce=w.useCallback(T=>{ue()},[ue]),se=w.useRef(ce);se.current=ce;const be=w.useRef(Re);be.current=Re;const[Le,de]=w.useState(()=>OV(yr)),fe=w.useRef(Le);fe.current=Le;const[Ce,pe]=w.useState(()=>hV(yr)),_e=w.useRef(Ce);_e.current=Ce;const[Ye,qe]=w.useState([]),ke=w.useCallback(T=>{pe(A=>{const Y={...A,[T]:null};return _e.current=Y,Y});try{localStorage.removeItem(vu[T])}catch{}},[]),Ae=w.useCallback((T,A)=>{const Y=_e.current[T];if(!(A&&Y!==A)){ke(T),de(te=>{const ye={...te,[T]:{...te[T],figure:wr}};return fe.current=ye,ye});try{localStorage.setItem(Hh[T],wr)}catch{}}},[ke]),Ue=w.useRef(Ae);Ue.current=Ae,w.useEffect(()=>{let T=!0;return NV().then(A=>{if(!T)return;qe(A);const Y=new Set(A.map(te=>te.id));for(const te of Uh){const ye=_e.current[te];ye&&!Y.has(ye)&&Ue.current(te,ye)}},()=>{}),()=>{T=!1}},[]);const Fe=w.useRef(null),Ve=w.useCallback((T,A=!1)=>{var Y,te;if((Y=Ut.current)==null||Y.unlock(),Fe.current!==null&&clearTimeout(Fe.current),Fe.current=null,!A){(te=Ut.current)==null||te.play(T,!0);return}Fe.current=setTimeout(()=>{var ye;Fe.current=null,(ye=Ut.current)==null||ye.play(T,!0)},RV)},[]),rt=w.useCallback((T,A)=>{de(Y=>{const te={level:Ql(A.level??Y[T].level),figure:o$(T,A.figure??Y[T].figure)};try{localStorage.setItem(c$[T],String(te.level)),localStorage.setItem(Hh[T],te.figure)}catch{}return{...Y,[T]:te}}),Ve(T,!0)},[Ve]),ut=w.useCallback((T,A)=>{if(!Ye.some(te=>te.id===A))return;const Y={..._e.current,[T]:A};_e.current=Y,pe(Y);try{localStorage.setItem(vu[T],A)}catch{}Ve(T,!0)},[Ye,Ve]),ct=w.useCallback(async T=>{var ye;const A=G0(Ye.length);if(A)throw new Error(A);const Y=window.AudioContext??window.webkitAudioContext;if(!Y)throw new Error("This browser cannot decode audio files.");const te=new Y;try{const je=await wV(T,Be=>te.decodeAudioData(Be));await $2(je);const Oe=Du(je);qe(Be=>[...Be.filter(lt=>lt.id!==Oe.id),Oe])}finally{(ye=te.close)==null||ye.call(te)}},[Ye.length]),yt=w.useCallback(async T=>{const A=G0(Ye.length);if(A)throw new Error(A);const Y=vV(T);await $2(Y);const te=Du(Y);qe(ye=>[...ye.filter(je=>je.id!==te.id),te])},[Ye.length]),It=w.useCallback(async(T,A)=>{const Y=Ye.find(ye=>ye.id===T),te=A.trim().slice(0,80);!Y||!te||te===Y.name||(await jV(T,te),qe(ye=>ye.map(je=>je.id===T?{...je,name:te}:je)))},[Ye]),zt=w.useCallback(async T=>{await _V(T),qe(ye=>ye.filter(je=>je.id!==T));const A=_e.current,Y=fV(A,T);_e.current=Y,pe(Y);const te=Uh.filter(ye=>A[ye]===T);for(const ye of te)try{localStorage.removeItem(vu[ye]),localStorage.setItem(Hh[ye],wr)}catch{}te.length>0&&de(ye=>{const je={...ye};for(const Oe of te)je[Oe]={...je[Oe],figure:wr};return fe.current=je,je})},[]),Xt=w.useCallback(T=>{var te,ye;const A=Uh.find(je=>_e.current[je]===T),Y=A?fe.current[A].level:bi;(te=Ut.current)==null||te.unlock(),(ye=Ut.current)==null||ye.previewCustom(T,Y)},[]);w.useEffect(()=>()=>{Fe.current!==null&&clearTimeout(Fe.current)},[]);const[Ft,rn]=w.useState(!1),Se=w.useRef(null),[vt,kt]=w.useState(!1),_n=w.useRef(null);w.useEffect(()=>{Ft&&kt(!1)},[Ft]);const Ut=w.useRef(null),[Vn,Vt]=w.useState("locked");w.useEffect(()=>{const T=PV({enabled:()=>be.current===!0,prefs:()=>fe.current,customSelection:()=>_e.current,loadCustom:SV,onCustomFailure:(Y,te)=>Ue.current(Y,te),onState:Vt});Ut.current=T,Vt(T.state());const A=()=>T.unlock();return window.addEventListener("pointerdown",A,{once:!0,capture:!0}),window.addEventListener("keydown",A,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",A,{capture:!0}),window.removeEventListener("keydown",A,{capture:!0})}},[]);const[$t,Zt]=w.useState(!1),[Ln,Ur]=w.useState(!1),[xe,ir]=w.useState(null),[Ns,Hr]=w.useState(null),[ma,Ss]=w.useState(!1),[xr,Pn]=w.useState(null),[Hs,Q]=w.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(c0)??""}catch{return""}}),[De,Je]=w.useState(!1),He=w.useRef(0),[tt,wt]=w.useState(!1),gt=w.useCallback((T=!1)=>(T&&(He.current=Date.now(),wt(!0)),fetch(T?"/api/version?refresh=1":"/api/version").then(A=>A.ok?A.json():null).then(A=>{A&&ir(A)}).catch(()=>{}).finally(()=>{T&&wt(!1)})),[]),At=w.useCallback(()=>{gt(Date.now()-He.current>=FX)},[gt]);w.useEffect(()=>{gt();const T=window.setInterval(At,5*6e4),A=()=>{document.visibilityState==="visible"&&At()};return document.addEventListener("visibilitychange",A),()=>{window.clearInterval(T),document.removeEventListener("visibilitychange",A)}},[gt,At]),w.useEffect(()=>{$t&>()},[$t,gt]);const Ct=w.useRef(0);w.useEffect(()=>{if(!$t||!pu())return;let T=!1;const A=Ct.current;return fetch("/api/desktop-update").then(Y=>Y.ok?Y.json():null).then(Y=>{if(T||Ct.current!==A)return;const te=sR(Y);te&&Hr(te)}).catch(()=>{}),()=>{T=!0}},[$t]);const Qt=DK(Ns),St=w.useRef(!1),br=w.useRef(0),lr=w.useRef(0);w.useEffect(()=>()=>window.clearTimeout(br.current),[]);const Ci=w.useCallback(async T=>{if(!Ps(St.current))return;const A=++lr.current;window.clearTimeout(br.current),St.current=!0,Ss(!0),Pn(null);const Y=te=>{A===lr.current&&(window.clearTimeout(br.current),St.current=!1,Ss(!1),Pn({failure:te,version:T}))};try{const te=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:T})});if(!te.ok)return Y(zK(await te.json().catch(()=>null)))}catch{return Y("unreachable")}A===lr.current&&(br.current=window.setTimeout(()=>Y("timeout"),N$))},[]);w.useEffect(()=>{const T=xK();let A=null;const Y=Oe=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:T,looking:Oe}),keepalive:!0}).catch(()=>{})},te=()=>{const Oe=wK(document);vK(A,Oe)&&Y(Oe),A=Oe},ye=()=>{A&&Y(!1),A=!1};te();const je=window.setInterval(te,yK);return window.addEventListener("focus",te),window.addEventListener("blur",te),document.addEventListener("visibilitychange",te),window.addEventListener("pagehide",ye),()=>{window.clearInterval(je),window.removeEventListener("focus",te),window.removeEventListener("blur",te),document.removeEventListener("visibilitychange",te),window.removeEventListener("pagehide",ye),ye()}},[]);const dt=(xe==null?void 0:xe.notice)??null,[cr,sn]=w.useState(null),Wr=cr&&Qt?Qt.version:null,Gn=w.useRef(null);w.useEffect(()=>{!Wr||Gn.current===Wr||(Gn.current=Wr,fetch("/api/desktop-update/seen",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:Wr})}).catch(()=>{}))},[Wr]);const Ju=w.useRef(!1);w.useEffect(()=>{if(Ju.current)return;const T=rR(),A=TK(T),Y=OK({stored:A,running:(xe==null?void 0:xe.running)??null,notes:nR,remembers:RK(T)});if(Y.reason==="no-version")return;Ju.current=!0,Y.record&&AK(T,Y.record);let te=!0;return(async()=>{var lt;let je=MK(T);if(pu())try{const et=await fetch("/api/prefs");if(!et.ok)throw new Error("desktop tour preferences unavailable");const xt=await et.json();if(!(xt!=null&&xt.ok))throw new Error("desktop tour preferences unavailable");const ft=((lt=xt.prefs)==null?void 0:lt.tourSeen)===!0;je&&!ft&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),je=je||ft}catch{je=!0}if(!te)return;const Oe=$K({tourSeen:je,decision:Y}),Be=Y.show.length?{entries:Y.show,since:A,firstRun:!1}:null;Oe.tour&&V(!0),Oe.notes==="now"?sn(Be):Oe.notes==="after"&&(G.current=Be)})(),()=>{te=!1}},[xe==null?void 0:xe.running]);const uo=(xe==null?void 0:xe.running)??"3.29.11",ed=w.useMemo(()=>x$(nR,null,uo),[uo]),ga=w.useCallback(()=>{sn({entries:ed,since:null,firstRun:!1})},[ed]),[Ti,ho]=w.useState(null),[Kn,ep]=w.useState(rb);w.useEffect(()=>{let T=!1;return fetch("/api/health").then(A=>A.ok?A.json():null).then(A=>{T||(ep(xX(A)),!(!A||typeof A.workspace!="string")&&ho(A.workspace))}).catch(()=>{}),()=>{T=!0}},[$t]);const Ri=w.useRef(Kn);Ri.current=Kn;const fo=L$(dt),ya=wX(dt,Hs),cc=w.useCallback(()=>{Q("");try{window.localStorage.setItem(c0,"")}catch{}},[]),po=w.useCallback(()=>{if(dt){Q(fo);try{window.localStorage.setItem(c0,fo)}catch{}}},[dt,fo]),[tp,uc]=w.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(bR)??""}catch{return""}}),ht=xe!=null&&xe.invokedAs&&xe.invokedAs!==hn?xe.invokedAs:null,td=ht!=null&&tp!==ht,nd=w.useCallback(()=>{if(ht){uc(ht);try{window.localStorage.setItem(bR,ht)}catch{}}},[ht]),Dn=((qc=xe==null?void 0:xe.upgrade)==null?void 0:qc.state)??"idle",mo=rH(xe==null?void 0:xe.upgrade),Ai=w.useRef(!1),rd=w.useCallback(async()=>{if(Ps(Ai.current||Dn==="running")){Ai.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await gt(),Ai.current=!1}},[Dn,gt]);w.useEffect(()=>{if(Dn!=="running")return;const T=window.setInterval(gt,3e3);return()=>window.clearInterval(T)},[Dn,gt]);const dc=w.useCallback(async()=>{const T=xe==null?void 0:xe.command;!T||!await yi(T)||(Je(!0),window.setTimeout(()=>Je(!1),1600))},[xe==null?void 0:xe.command]),go=w.useCallback(()=>{L(T=>(T||Ie(A=>(A&&(ge.current=!0),!1)),!T))},[]),Vr=w.useCallback(()=>{ge.current=!1,Ie(T=>(T||L(!1),!T))},[]),[Gr,kr]=w.useState(!1),[wa,Ws]=w.useState(!1),[Kr,np]=w.useState(()=>{try{return Number(localStorage.getItem(iR))||0}catch{return 0}}),[hc,yo]=w.useState([]),[fc,pc]=w.useState(!1);w.useEffect(()=>{let T=!0;const A=()=>{fetch("/api/browser-watch?live=0").then(te=>te.ok?te.json():null).then(te=>{var ye;!T||!(te!=null&&te.ok)||(yo(te.episodes??[]),pc(((ye=te.settings)==null?void 0:ye.enabled)===!0))}).catch(()=>{})};A();const Y=setInterval(A,5*6e4);return()=>{T=!1,clearInterval(Y)}},[]);const[Mi,wo]=w.useState([]),sd=w.useRef(new Set),[js,va]=w.useState(null);w.useEffect(()=>{let T=!0,A=0;const Y=()=>{fetch("/api/lan").then(te=>te.ok?te.json():null).then(te=>T?(te!=null&&te.ok&&wo(ej(Array.isArray(te.pending)?te.pending:[],te.aliases)),te):null).catch(()=>null).then(te=>{T&&(A=window.setTimeout(Y,(te==null?void 0:te.enabled)===!0?U0:KM))})};return Y(),()=>{T=!1,window.clearTimeout(A)}},[]);const Vs=w.useCallback(async(T,A)=>{if(!js){va(T);try{const te=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:T,fp:A})})).json().catch(()=>null);te&&Array.isArray(te.pending)?wo(ej(te.pending,te.aliases)):wo(ye=>ye.filter(je=>je.fp!==A))}catch{}finally{va(null)}}},[js]),ur=w.useMemo(()=>TY(hc,Kr).length,[hc,Kr]),[rp,ad]=w.useState(0),Ii=w.useRef(null),[$i,Oi]=w.useState(!1),xa=w.useRef(null),[_s,Li]=w.useState(0),En=w.useState(()=>yY({protect:T=>s6(l.current,T)}))[0],[vo,Pi]=w.useState(!1),ba=w.useCallback(()=>{const T=En.paused&&En.dropped>0,A=En.setPaused(!En.paused);T&&a6(l.current);for(const Y of A)l.current=WN(l.current,Y);Pi(En.paused)},[En]),[Jt,Fn]=w.useState(Date.now()),[qn,ka]=w.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(Ih)!=="0"}catch{return!0}}),Na=w.useRef(!1),sp=w.useCallback(()=>{const T=!qn;Na.current=!0;try{window.localStorage.removeItem(Ih)}catch{}ka(T),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:T})}).then(A=>A.ok?A.json():null).then(A=>{var Y;A!=null&&A.ok&&ka(((Y=A.prefs)==null?void 0:Y.autoUpdate)!==!1)}).catch(()=>{})},[qn]),[Nr,Sa]=w.useState(!1),[xo,Di]=w.useState("restart"),[mc,od]=w.useState(null),ja=w.useRef(!1),id=w.useRef(null),Fi=w.useRef(0),bo=w.useCallback(async T=>{if(!Ps(ja.current))return;const A=(T==null?void 0:T.upgrade)===!0;ja.current=!0,id.current=mo;const Y=++Fi.current;Di(A?"npx":"restart"),Sa(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(dt==null?void 0:dt.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:A})})}catch{}window.setTimeout(()=>{if(Fi.current===Y&&ja.current){ja.current=!1,Sa(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},A?18e4:3e4)},[dt==null?void 0:dt.to,mo]),gc=w.useRef(null);w.useEffect(()=>{const T=oj(l.current.agents.values())>0,A=lH({enabled:qn,kind:dt==null?void 0:dt.kind,canRestart:(xe==null?void 0:xe.canRestart)===!0,noticeOpen:ya,visible:document.visibilityState==="visible",busy:T,idleSince:gc.current,now:Jt});gc.current=A.idleSince,A.restart&&bo()},[qn,dt==null?void 0:dt.kind,xe==null?void 0:xe.canRestart,ya,Jt,bo]);const ld=oj(l.current.agents.values()),cd=iH(ld),ud=QM({enabled:qn,kind:dt==null?void 0:dt.kind,canRestart:(xe==null?void 0:xe.canRestart)===!0,noticeOpen:ya,visible:document.visibilityState==="visible",busy:ld>0,idleSince:gc.current,now:Jt});w.useEffect(()=>{const T=xe==null?void 0:xe.running;let A=null,Y=null;try{A=window.sessionStorage.getItem("agent-dag.restartPending"),Y=window.sessionStorage.getItem(kR)}catch{return}const te=nH({bundle:"3.29.11",running:T,pending:A,lastTried:Y});if(te==="reload"){try{window.sessionStorage.setItem(kR,T??"")}catch{return}window.location.reload();return}if(te!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ja.current=!1,Sa(!1),od(T??null);const ye=window.setTimeout(()=>od(null),6e3);return()=>window.clearTimeout(ye)},[xe==null?void 0:xe.running]),w.useEffect(()=>{if(Nr&&sH({asked:id.current,reported:mo})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ja.current=!1,Sa(!1)}},[Nr,mo]);const yc=w.useState(()=>FY(KX()))[0],Gt=w.useRef(yc.pinned),qi=w.useRef(null),Bi=w.useState(()=>ZX())[0],[wc,vc]=w.useState(()=>new Set),[_a,dd]=w.useState(xY),[ko,hd]=w.useState(KV),[zi,ap]=w.useState(XV),[No,xc]=w.useState(()=>rG(yr(q2))),[Ui,op]=w.useState(()=>nG(yr(B2))),[Gs,Hi]=w.useState(()=>sG(yr(F2),No,VV)),[Ks,Wi]=w.useState(()=>new Set),[fd,pd]=w.useState(0),[Yr,md]=w.useState(()=>lR(yR)),bc=w.useMemo(()=>PY(Yr),[Yr]),Ea=w.useCallback(T=>LY(T,bc),[bc]),[gd,ip]=w.useState(!1);w.useEffect(()=>{document.documentElement.dataset.theme=_a;try{window.localStorage.setItem(_$,_a)}catch{}md(T=>{const A=lR(yR);return DY(T,A)?T:A})},[_a]),w.useEffect(()=>{try{window.localStorage.setItem(u$,ko?"1":"0")}catch{}},[ko]),w.useEffect(()=>{try{window.localStorage.setItem(d$,String(zi))}catch{}},[zi]),w.useEffect(()=>{try{window.localStorage.setItem(B2,Ui?"1":"0")}catch{}},[Ui]),w.useEffect(()=>{try{window.localStorage.setItem(q2,JSON.stringify(No))}catch{}},[No]),w.useEffect(()=>{try{window.localStorage.setItem(F2,Gs)}catch{}},[Gs]);const lp=w.useCallback(T=>{xc(A=>A.some(Y=>Y.id===T.id)?A:[...A,T]),Wi(A=>{if(!A.has(T.id))return A;const Y=new Set(A);return Y.delete(T.id),Y})},[]),yd=w.useCallback((T,A)=>{const Y=A.trim();!Y||Y.length>Fu||xc(te=>te.map(ye=>ye.id===T?{...ye,name:Y}:ye))},[]),wd=w.useCallback(T=>{xc(A=>A.filter(Y=>Y.id!==T)),Hi(A=>aG(A,T)),Wi(A=>{if(!A.has(T))return A;const Y=new Set(A);return Y.delete(T),Y})},[]),So=w.useCallback(T=>{const A=z2(T),Y=Ks.has(A);T===Gs&&!Y||(Y&&Wi(te=>{const ye=new Set(te);return ye.delete(A),ye}),Hi(T),pd(te=>te+1))},[Gs,Ks]),jo=w.useCallback((T,A)=>{const Y=z2(T);Wi(te=>{if(te.has(Y)===A)return te;const je=new Set(te);return A?je.add(Y):je.delete(Y),je})},[]);w.useEffect(()=>{const T=document.querySelector('meta[name="theme-color"]'),A=Yr["--panel"];T&&A&&T.setAttribute("content",A)},[Yr]);const dr=w.useCallback((T,A)=>{if(Ah({durationMs:A,documentHidden:document.hidden})){e.setViewport(T,{duration:A});return}const{d3Zoom:Y,d3Selection:te}=r.getState(),ye=te==null?void 0:te.property("__zoom");if(Y&&te&&ye&&ye.k>0&&T.zoom>0){Y.transform(te,ye.scale(T.zoom/ye.k).translate((T.x-ye.x)/T.zoom,(T.y-ye.y)/T.zoom));return}e.setViewport(T,{duration:0})},[e,r]),Xr=w.useRef(null),_o=w.useRef(0),Eo=w.useRef(null),Vi=w.useRef(()=>{});w.useEffect(()=>{if(!Bi)return;const T=window.setTimeout(()=>{try{dr(Bi,0)}catch{}Ys.current=Date.now()},60);return()=>window.clearTimeout(T)},[dr,Bi]);const Gi=w.useRef(!0),[Ca,kc]=w.useState(null);w.useEffect(()=>{const T=new EventSource("/events"),A=mY(m,{now:()=>Date.now(),setTimeout:(je,Oe)=>window.setTimeout(je,Oe),clearTimeout:je=>window.clearTimeout(je)});let Y=!1;const te=typeof BroadcastChannel=="function"?SY(new BroadcastChannel(kY),Math.random().toString(36).slice(2),()=>Y):null,ye=window.setInterval(()=>{Y||!te||te.ask(600).then(je=>{Y||Ur(NY(je))})},3e3);return T.addEventListener("open",()=>{Zt(!0),ip(!0)}),T.addEventListener("error",()=>{Zt(!1),kc(null)}),T.addEventListener("open",()=>{Y=!0,Ur(!1)}),T.addEventListener("error",()=>{Y=!1}),T.addEventListener("replay-end",()=>{Gi.current=!1,A.flush(),kc(Date.now())}),T.addEventListener("desktop-update",je=>{if(pu())try{const Oe=sR(JSON.parse(je.data));Oe&&(Ct.current++,Hr(Oe),Oe.status!=="ready"&&(lr.current++,window.clearTimeout(br.current),St.current=!1,Ss(!1)))}catch{}}),T.addEventListener("hook",je=>{var Oe;try{const Be=JSON.parse(je.data);if(!En.accept(Be))return;l.current=WN(l.current,Be);const lt=Be.replay===!0||Gi.current||Date.now()-Be.receivedAt>3e4;lt?A.replay():A.live();const et=LV(Be,lt);et&&((Oe=Ut.current)==null||Oe.play(et))}catch{}}),()=>{T.close(),A.cancel(),window.clearInterval(ye),te==null||te.leave()}},[m]),w.useEffect(()=>{const T=setInterval(()=>{const A=Date.now();Fn(A);const{changed:Y,forgotten:te}=V9(l.current,A);te.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:te})}).catch(()=>{}),b(ye=>U9(ye,l.current.agents)),k(ye=>ye!=null&&!l.current.agents.has(ye)?null:ye),B(ye=>ye!=null&&!l.current.agents.has(ye)?null:ye),$(ye=>ye!=null&&!l.current.agents.has(ye)?null:ye),Y&&m()},250);return()=>clearInterval(T)},[m]);const Ki=w.useRef(null),Ys=w.useRef(0),vd=420,Yn=w.useCallback((T=500)=>{const A=o0,Y=1,te=.2,ye=i0;try{const je=document.querySelector(".canvas-wrap"),Oe=Array.from(document.querySelectorAll(".react-flow__node")).filter(Lt=>Lt.offsetWidth>0);if(!je||Oe.length===0)return;const Be=je.getBoundingClientRect(),lt=e.getViewport();if(!Number.isFinite(lt.zoom)||lt.zoom<=0)return;const et=Lt=>(Lt-Be.left-lt.x)/lt.zoom,xt=Lt=>(Lt-Be.top-lt.y)/lt.zoom,ft=Oe.map(Lt=>Lt.getBoundingClientRect()),An=Math.min(...ft.map(Lt=>et(Lt.left))),sa=Math.max(...ft.map(Lt=>et(Lt.right))),Yo=Math.min(...ft.map(Lt=>xt(Lt.top))),as=Math.max(...ft.map(Lt=>xt(Lt.bottom))),os=sa-An,Da=as-Yo;if(!(os>0&&Da>0))return;const Td=wR(je),Xo=Lt=>Math.max(te,Math.min(Y,(Be.width-Td-A*2)/(os+Lt)*ye,(Be.height-A*2)/Da*ye)),Fa=eX(Xo(vd),Xo(0)),is={x:A-An*Fa,y:Math.max(A,(Be.height-Da*Fa)/2)-Yo*Fa,zoom:Fa},Rr=++_o.current;dr(is,T),Ys.current=Date.now(),Xr.current=Ah({durationMs:T,documentHidden:document.hidden})?{target:is,until:Date.now()+T+60}:null,window.setTimeout(()=>{var Lt;try{if(((Lt=Xr.current)==null?void 0:Lt.target)===is&&(Xr.current=null),_o.current!==Rr)return;const qa=e.getViewport();(Math.abs(qa.zoom-Fa)>.01||Math.abs(qa.x-is.x)>2)&&dr(is,0)}catch{}},T+60)}catch{}},[e,dr]);w.useEffect(()=>{const T=()=>{if(!document.hidden)return;const A=Xr.current;if(Xr.current=null,!(!A||Date.now()>A.until)){try{dr(A.target,0)}catch{}Ys.current=Date.now()}};return document.addEventListener("visibilitychange",T),()=>document.removeEventListener("visibilitychange",T)},[dr]);const Nc=w.useRef(""),Sc=w.useRef(null),Xn=w.useRef(0),Es=w.useCallback(()=>{Xn.current=Date.now()},[]),Yi=w.useRef(null),jc=w.useRef(0),Xi=w.useCallback(()=>{jc.current=Date.now()},[]),Zi=w.useCallback(T=>({hasSourceEvent:!!T,at:Date.now(),lastDeckFitAt:Ys.current,lastCanvasInputAt:jc.current}),[]),_c="agent-dag.autoFitDisabled",Xs=w.useRef(!1),[Ec,Zs]=w.useState(!1);w.useEffect(()=>{try{window.localStorage.removeItem(_c)}catch{}},[]);const Qs=w.useCallback(()=>{Xs.current||(Xs.current=!0,Zs(!0))},[]),Ta=w.useCallback(()=>{Xs.current=!1,Zs(!1),Yn(400)},[e,Yn]);w.useEffect(()=>{const T=setInterval(()=>{if(Xs.current||Date.now()-Xn.current<800)return;const A=l.current,Y=Date.now(),te=[];for(const je of A.agents.values())eb(je,Y)&&te.push({id:je.id});if(te.length===0)return;const ye=[];for(const{id:je}of te){const Oe=Sr.current.get(je),Be=Gt.current.get(je)??Kt.current.get(je);!Oe||!Be||ye.push({x:Be.x,y:Be.y,width:Oe.width,height:Oe.height})}KY({pane:Yi.current,viewport:e.getViewport(),boxes:ye})&&Yn(600)},1500);return()=>clearInterval(T)},[e]);const Ra=w.useRef(!1),Sr=w.useRef(new Map),Aa=w.useRef(0),Ma=w.useCallback(T=>{const A=Sr.current;let Y=!1;for(const te of T.nodeInternals.values()){const ye=te.width,je=te.height;if(ye==null||je==null)continue;const Oe=A.get(te.id);Oe?(Math.abs(Oe.height-je)>4||Math.abs(Oe.width-ye)>4)&&(A.set(te.id,{width:ye,height:je}),Y=!0):(A.set(te.id,{width:ye,height:je}),Y=!0)}return Y&&(Aa.current+=1),Aa.current},[]),Qi=Et(Ma),[Cc,Ji]=w.useState(0);w.useEffect(()=>{let T=0;const A=()=>{const te=Sr.current;let ye=!1;for(const je of document.querySelectorAll(".react-flow__node[data-id]")){const Oe=je.getAttribute("data-id");if(!Oe)continue;const Be=je.offsetWidth,lt=je.offsetHeight;if(!Be||!lt)continue;const et=te.get(Oe);(!et||Math.abs(et.width-Be)>4||Math.abs(et.height-lt)>4)&&(te.set(Oe,{width:Be,height:lt}),ye=!0)}ye&&Ji(je=>je+1)};if(Ra.current)return;let Y=0;return document.visibilityState==="hidden"?Y=window.setTimeout(A,32):T=requestAnimationFrame(A),()=>{cancelAnimationFrame(T),window.clearTimeout(Y)}});const Kt=w.useRef(yc.positions),Tc=w.useRef(new Set),Co=w.useRef(""),hr=w.useMemo(()=>QK(l.current.agents.values(),c),[l.current,l.current.revision,c]),Js=w.useMemo(()=>{const T=[];for(const A of l.current.agents.values())!eb(A,Jt)||hr.has(A.id)||T.push(A.id+(A.parentId?`>${A.parentId}`:""));return T.sort(),`${T.join("|")}#sv${Qi}.${Cc}`},[l.current,l.current.revision,Jt,Qi,Cc,hr]),Ia=w.useRef(null);w.useEffect(()=>(Ia.current!=null&&window.clearTimeout(Ia.current),Ia.current=window.setTimeout(()=>{$h(Kt.current,Gt.current)},1500),()=>{Ia.current!=null&&window.clearTimeout(Ia.current)}),[Js]),w.useEffect(()=>{if(Nc.current===Js)return;const T=Nc.current;if(Nc.current=Js,!T||Xs.current)return;Date.now()-Ys.current>1200&&Yn(400),Ki.current&&window.clearTimeout(Ki.current),Ki.current=window.setTimeout(()=>{Xs.current||Yn(500)},280)},[Js,e,Yn]);const jr=w.useMemo(()=>hY(l.current,S),[l.current,l.current.revision,S]),To=w.useMemo(()=>{const T=IY(l.current,Jt);for(const A of hr)T.delete(A);return T},[l.current,l.current.revision,Jt,hr]),_r=w.useRef(null),[Ro,xd]=w.useState({w:0,h:0});w.useEffect(()=>{const T=_r.current;if(!T||typeof ResizeObserver>"u")return;const A=new ResizeObserver(Y=>{var ye;const te=(ye=Y[0])==null?void 0:ye.contentRect;te&&(Yi.current={width:te.width,height:te.height},xd(je=>Math.abs(je.w-te.width)>40||Math.abs(je.h-te.height)>40?{w:te.width,h:te.height}:je))});return A.observe(T),Yi.current={width:T.clientWidth,height:T.clientHeight},xd({w:T.clientWidth,h:T.clientHeight}),()=>A.disconnect()},[]);const Ao=w.useCallback(T=>{var Y,te;const A=T.target;!(A!=null&&A.closest)||A.closest(PX)!==T.currentTarget||(T.preventDefault(),(te=(Y=document.activeElement)==null?void 0:Y.blur)==null||te.call(Y))},[]),cp=w.useRef(new Map),[Mo,bd]=w.useState(!1);w.useEffect(()=>{const T=window.setTimeout(()=>bd(!0),2500);return()=>window.clearTimeout(T)},[]);const[Mt,Io]=w.useState(!1),fr=w.useRef(null),[Zr,Rc]=w.useState(!1),[el,$a]=w.useState(!1),[tl,Oa]=w.useState(""),[$o,kd]=w.useState("far"),Nd=w.useRef(null),Ac=wh(el,140),Oo=w.useCallback(T=>{var te;const A=(te=Nd.current)==null?void 0:te.getBoundingClientRect(),Y=uY(T);return A&&Y?cY(Y,A):"far"},[]),[nl,Mc]=w.useState("detail"),Qr=w.useRef(null),Lo=w.useRef(null),Ic=w.useCallback(()=>{var te;const T=Aa.current;if(((te=Lo.current)==null?void 0:te.version)===T)return Lo.current.card;const A=[];for(const ye of l.current.agents.keys()){const je=Sr.current.get(ye);je&&A.push(je)}const Y=XY(A);return Lo.current={version:T,card:Y},Y},[]),up=w.useCallback(()=>{fr.current&&(window.clearTimeout(fr.current),fr.current=null),Io(!1)},[]),Sd=w.useCallback(T=>{T.length!==0&&queueMicrotask(()=>{Io(!0),fr.current&&window.clearTimeout(fr.current),fr.current=window.setTimeout(()=>Io(!1),DX+80)})},[]);w.useEffect(()=>()=>{fr.current&&window.clearTimeout(fr.current)},[]);const Cn=_?l.current.agents.get(_):null,jd=y&&Cn!=null,[Po,Cs]=w.useState(0);w.useEffect(()=>{const T=wR(_r.current);Cs(A=>Math.abs(A-T)>40?T:A)},[ze,Pe,H,jd,Ro.w]);const rl=w.useRef(Po);rl.current=Po;const Jr=Ro.w>0?Math.max(0,(Ro.w-Po-o0*2)*i0):0,Bn=Ro.h>0?Math.max(0,(Ro.h-o0*2)*i0):0,Do=mF(),{nodes:gn,edges:sl}=w.useMemo(()=>{const T=X9(l.current,Jt,Jr,Bn,Gt.current,Sr.current,cp.current,Sd,Mo,Zr,Kt.current,Tc.current,Js,Co,S,jr,To,P);return JK(T.nodes,T.edges,c)},[l.current,l.current.revision,Jt,Jr,Bn,Mo,Zr,Js,S,jr,To,P,rp,Do,c]),dp=w.useState(YX)[0],_d=w.useRef(dp);w.useEffect(()=>{if(!Mo||Zr)return;const T={width:Jr,height:Bn};if(!(T.width>0&&T.height>0))return;const A=_d.current;if(_d.current=T,XX(T),!A||A.width===T.width&&A.height===T.height)return;const Y={direction:"LR",pinned:Gt.current,measured:Sr.current,lanes:W0(l.current)};if(!A9(gn,sl,Y,A,T))return;const te=Eo.current&&Date.now()-Eo.current.at<1500?Eo.current.id:null,ye=te??As.current,je=ye?Gt.current.get(ye)??Kt.current.get(ye):void 0;for(const Oe of Array.from(Kt.current.keys()))Gt.current.has(Oe)||Kt.current.delete(Oe);Tc.current.clear(),Co.current="",m(),window.setTimeout(()=>{if($h(Kt.current,Gt.current),Xs.current){if(te){Vi.current(te);return}const Oe=ye?Gt.current.get(ye)??Kt.current.get(ye):void 0;if(je&&Oe&&(Oe.x!==je.x||Oe.y!==je.y)){const Be=e.getViewport();_o.current+=1,dr({x:Be.x-(Oe.x-je.x)*Be.zoom,y:Be.y-(Oe.y-je.y)*Be.zoom,zoom:Be.zoom},0),Ys.current=Date.now()}return}Yn(500)},80)},[Jr,Bn,Mo,Zr,m,Yn,e,dr]);const Ts=w.useMemo(()=>{const T=new Map;for(const Y of gn){const te=Y.data;if(!(te!=null&&te.sessionId)||te.exitAt!=null)continue;const ye=Y.width,je=Y.height;if(ye==null||je==null)continue;const Oe=Y.position.x,Be=Y.position.y,lt=Oe+ye,et=Be+je,xt=T.get(te.sessionId);xt?(xt.minX=Math.min(xt.minX,Oe),xt.minY=Math.min(xt.minY,Be),xt.maxX=Math.max(xt.maxX,lt),xt.maxY=Math.max(xt.maxY,et)):T.set(te.sessionId,{minX:Oe,minY:Be,maxX:lt,maxY:et})}const A=[];for(const[Y,te]of T){const ye=te.maxX-te.minX+Mh*2,je=te.maxY-te.minY+Mh*2;A.push({id:`group:${Y}`,type:E$,position:{x:te.minX-Mh,y:te.minY-Mh},data:{sessionId:Y,w:ye,h:je},width:ye,height:je,style:{width:ye,height:je},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return A},[gn]),Fo=w.useMemo(()=>{const T=[...Ts,...gn],A=xa.current;return!A||A.size===0?T:T.map(Y=>{const te=A.get(Y.id);return te?{...Y,position:te}:Y})},[Ts,gn,_s]),es=w.useMemo(()=>{const T=new Set;for(const A of l.current.agents.values())for(const Y of A.tools)T.add(H$(Y.name));return Object.keys(U$).filter(A=>T.has(A))},[l.current,l.current.revision]);w.useEffect(()=>{if(es.length<=1){Oi(!1);return}let T=0;const A=()=>{const Y=Ii.current;if(Y&&!document.hidden){const te=Y.getBoundingClientRect(),ye=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Oe=>Oe.getBoundingClientRect()),je=OY(te,ye,8);Oi(Oe=>Oe===je?Oe:je)}T=window.setTimeout(A,300)};return A(),()=>window.clearTimeout(T)},[es.length]);const al=w.useCallback(T=>{vc(A=>{const Y=new Set(A);return Y.has(T)?Y.delete(T):Y.add(T),Y})},[]),qo=j?X5(l.current.agents,j):null,ea=w.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}l.current=E0(),Gt.current.clear(),Sr.current.clear(),Kt.current.clear(),Co.current="",NR(),u(new Set),p(null);try{window.localStorage.removeItem(fk)}catch{}R(),m()},[m,R]),Er=w.useCallback(T=>{const A=l.current.agents.get(T);A&&(u(Y=>{const te=new Set(Y);return te.add(T),aR(window.localStorage,te),te}),p({id:T,label:A.label}),Gt.current.delete(T),Kt.current.delete(T),R())},[R]),Tt=w.useCallback(()=>{_&&Er(_)},[_,Er]),Rt=f&&c.has(f.id)?f:null;w.useEffect(()=>{var T;f&&((T=_r.current)==null||T.focus())},[f]);const Zn=w.useCallback(T=>{const A=[...T];u(Y=>{const te=eY(Y,A);return te!==Y&&aR(window.localStorage,te),te})},[]),an=w.useRef(W);an.current=W;const kn=w.useRef(ee);kn.current=ee;const ts=w.useRef(!1);ts.current=qo!=null||Gr||q!=null||X||I!=null||wa||ee||cr!=null;const ns=w.useCallback(T=>{const A=tV(T,{confirmOpen:an.current,modalOpen:ts.current});A==="confirm"?ne(!0):A==="clear"&&(ne(!1),ea())},[ea]),yn=w.useCallback(()=>{Gt.current.clear(),Kt.current.clear(),Co.current="",NR(),m(),window.setTimeout(()=>Yn(500),80)},[m,e,Yn]),Bo=w.useCallback(()=>Yn(500),[Yn]),Rs=w.useRef(gn);Rs.current=gn;const zn=w.useCallback(T=>{var xt;const A=_r.current,Y=l.current.agents.get(T);if(!A||!Y)return;const te=W0(l.current),ye=(ft,An)=>{const sa=Sr.current.get(ft.id);if(!sa)return null;const Yo=An&&te.has(ft.id)?vd:0;return{x:ft.position.x,y:ft.position.y,width:sa.width+Yo,height:sa.height}},je=Rs.current.find(ft=>ft.id===T),Oe=je?ye(je,!1):null;if(!Oe)return;const Be=[];for(const ft of Rs.current){if(ft.type!=="agent"&&ft.type!=="recapNote"||((xt=ft.data)==null?void 0:xt.sessionId)!==Y.sessionId)continue;const An=ye(ft,ft.type==="agent");An&&Be.push(An)}const lt=A.getBoundingClientRect(),et=rX({pane:{width:lt.width,height:lt.height},insets:{top:56,left:72,bottom:32,right:rl.current+32},context:sX(Be)??Oe,anchor:Oe});Za(),Qs(),Eo.current={id:T,at:Date.now()},_o.current+=1,dr(et,l0),Ys.current=Date.now(),Xr.current=Ah({durationMs:l0,documentHidden:document.hidden})?{target:et,until:Date.now()+l0+60}:null},[dr,Qs]);Vi.current=zn;const ol=w.useCallback(T=>{const A=Rs.current.find(Y=>Y.id===T&&Y.type==="agent");return A?A.data:void 0},[]),Ed=w.useCallback(T=>{var A;return(A=l.current.agents.get(T))==null?void 0:A.label},[]),rs=w.useCallback(T=>{var te;const A=Rs.current.find(ye=>ye.id===T&&ye.type==="recapNote");if(!A)return;const Y=A.data;return{recap:Y.recap,hue:Y.hue,sessionLabel:(te=l.current.agents.get(Y.parentId))==null?void 0:te.label}},[]),il=w.useCallback(()=>{var Y;const T=(Y=_r.current)==null?void 0:Y.getBoundingClientRect(),A=document.documentElement;return T?{width:T.right-rl.current,height:T.bottom}:{width:A.clientWidth,height:A.clientHeight}},[]),As=w.useRef(_);As.current=_;const $c=w.useRef(Tt);$c.current=Tt;const ll=w.useCallback(T=>{const A=Rs.current.filter(je=>je.type==="agent"),Y=VK(A.map(je=>({id:je.id,x:je.position.x,y:je.position.y})),As.current,T),te=Y?A.find(je=>je.id===Y):void 0;if(!te)return;const ye=a0(document.activeElement);C(te.id,!1),window.setTimeout(()=>{try{zn(te.id)}catch{}ye&&LX(te.id)},30)},[C,zn]),Cr=w.useRef(null),Qn=w.useCallback(T=>{C(T,!1),window.setTimeout(()=>{try{zn(T)}catch{}},60)},[C,zn]),La=w.useCallback(T=>{hr.has(T)&&Zn([T]),Qn(T)},[hr,Zn,Qn]),zo=w.useRef(null);w.useEffect(()=>{let T=-1/0;const A=()=>{T=performance.now()},Y=te=>{zo.current=performance.now()-T<250?te.target:null};return window.addEventListener("pointerdown",A,!0),window.addEventListener("focusin",Y,!0),()=>{window.removeEventListener("pointerdown",A,!0),window.removeEventListener("focusin",Y,!0)}},[]),w.useEffect(()=>{const T=A=>{var Be,lt;const Y=A.target,te={tagName:Y==null?void 0:Y.tagName,isContentEditable:Y==null?void 0:Y.isContentEditable,role:(Be=Y==null?void 0:Y.getAttribute)==null?void 0:Be.call(Y,"role"),type:Y==null?void 0:Y.type,pointerFocused:Y!=null&&Y===zo.current};if(A.key==="Escape"){const et=F6({overlayOpen:gu.depth()>0,typing:Ef(te)});et==="dismiss"?gu.dismissTop():et==="blur"?Y==null||Y.blur():(XK(te)&&(Y==null||Y.blur()),R());return}if(_f(A))return;const ye=a0(Y)?(lt=Y==null?void 0:Y.getAttribute)==null?void 0:lt.call(Y,"data-id"):null,je=ye&&Rs.current.some(et=>et.id===ye)?ye:null,Oe=KK(A,je);if(Oe.kind==="activate"){A.preventDefault(),C(Oe.nodeId,Oe.additive);return}if(Oe.kind!=="node"&&!(Oe.nodeId==null&&K6(te,A.key))&&!Y6({key:A.key,modalOpen:X6({appModal:ts.current,dialogDepth:gu.dialogDepth()}),sheetOpen:kn.current})){if(A.key===" "&&(A.preventDefault(),ba()),(A.key==="c"||A.key==="C")&&ns("shortcut"),(A.key==="r"||A.key==="R")&&yn(),(A.key==="f"||A.key==="F")&&Bo(),(A.key==="z"||A.key==="Z")&&As.current&&zn(As.current),A.key==="Delete"&&$c.current(),(A.key==="l"||A.key==="L")&&go(),A.key==="d"||A.key==="D")if(As.current)v(et=>!et);else{const et=km(l.current.agents.values());et.length>0?Qn(et[0].id):ll(1)}if((A.key==="h"||A.key==="H")&&kr(et=>!et),(A.key==="u"||A.key==="U")&&D(et=>!et),(A.key==="a"||A.key==="A")&&Ri.current.claude&&Vr(),(A.key==="j"||A.key==="J")&&ll(1),(A.key==="k"||A.key==="K")&&ll(-1),A.key==="w"||A.key==="W"){const et=C6(km(l.current.agents.values()),Cr.current);et&&(Cr.current=et.id,Qn(et.id))}(A.key==="t"||A.key==="T")&&dd(et=>et==="dark"?"light":"dark"),(A.key==="m"||A.key==="M")&&Ri.current.claude&&be.current!==null&&se.current(A.shiftKey),(A.key==="s"||A.key==="S")&&le(et=>!et),(A.key==="b"||A.key==="B")&&Ws(et=>!et),(A.key==="v"||A.key==="V")&&Ri.current.claude&&be.current!==null&&rn(et=>!et),A.key==="?"&&M(et=>!et)}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[ns,yn,Bo,R,C,ll,Qn,zn,ba]);const Uo=l.current.agents.size,_t=w.useMemo(()=>km(l.current.agents.values()),[l.current,l.current.revision]),Tn=w.useRef(new Map);w.useEffect(()=>{Tn.current=rY(Tn.current,c,Date.now());const T=[...tY(_t,hr),...sY(l.current.agents,hr,c,Tn.current)];T.length>0&&Zn(T)},[_t,hr,c,Zn]);const Ms=w.useMemo(()=>T6(l.current.agents.values()),[l.current,l.current.revision]),Tr=w.useRef(null);w.useEffect(()=>{const T=jY({waiting:_t.length,running:Ms,connected:$t}),A=Tr.current;if(Tr.current=T,(A==null?void 0:A.title)!==T.title&&(document.title=T.title),(A==null?void 0:A.icon)!==T.icon){const Y=document.querySelector('link[rel="icon"]');Y&&(Y.href=_Y[T.icon])}},[_t.length,Ms,$t]);const[ss,ta]=w.useState(""),Oc=CY(_t);w.useEffect(()=>{ta(T=>oR(T,Oc))},[Oc]);const[Lc,cl]=w.useState(""),Rn=ur>0?`Browser watch has ${ur} unread ${ur===1?"finding":"findings"}.`:"";w.useEffect(()=>{cl(T=>oR(T,Rn,"Browser watch has no unread findings."))},[Rn]);const[wn,Ot]=w.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[on,ul]=w.useState(null),[Ho,Wo]=w.useState(!1),[Pc,Dc]=w.useState(!1);w.useEffect(()=>{let T=!0;return fetch("/api/prefs").then(A=>A.ok?A.json():null).then(A=>{var Y,te,ye;if(!(!T||!(A!=null&&A.ok))){if(!Na.current){let je=!1;try{je=window.localStorage.getItem(Ih)==="0",window.localStorage.removeItem(Ih)}catch{}je&&((Y=A.prefs)==null?void 0:Y.autoUpdate)!==!1?(ka(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):ka(((te=A.prefs)==null?void 0:te.autoUpdate)!==!1)}Wo(((ye=A.prefs)==null?void 0:ye.notifications)===!0),Dc(A.notificationsVetoed===!0)}}).catch(()=>{}),()=>{T=!1}},[]);const Vo=w.useRef(()=>{}),Cd=w.useCallback(()=>{const T=!Ho;Wo(T),T&&typeof Notification<"u"&&Notification.permission==="default"&&Vo.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:T})}).then(A=>A.ok?A.json():null).then(A=>{var Y;A!=null&&A.ok&&(Wo(((Y=A.prefs)==null?void 0:Y.notifications)===!0),Dc(A.notificationsVetoed===!0))}).catch(()=>{})},[Ho]),Pa=typeof Notification<"u";w.useEffect(()=>{if(!on)return;const A=setTimeout(()=>ul(null),on==="blocked"?8e3:4e3);return()=>clearTimeout(A)},[on]);const dl=w.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(T=>{const A=T;Ot(A),A==="granted"?ul("on"):A==="denied"&&ul("blocked")})},[]);Vo.current=dl;const Go=w.useRef(new Set),na=w.useRef(null),hl=_t.map(T=>jf(T.id,T.waiting)).join("|");w.useEffect(()=>{I6(na.current,wn)&&(na.current=wn,Go.current=Nm(_t))},[wn]);const Fc=w.useRef(!1);return w.useEffect(()=>{$6(Fc.current,Ca)&&(Fc.current=!0,Go.current=Nm(_t))},[Ca]),w.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!O6(na.current,Ca))return;const T=typeof document>"u"||!document.hidden,A=A6(_t,Go.current,T,Ho);for(const Y of A)try{const te=new Notification(Y.title,{body:Y.body,tag:Y.key});te.onclick=()=>{window.focus(),Qn(Y.sessionId),te.close()}}catch{}Go.current=T?Nm(_t):M6(_t,A,Go.current)},[hl,Ca]),o.jsxs("div",{className:"app",children:[o.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),o.jsxs("header",{className:"topbar",children:[o.jsxs("div",{className:"readout",children:[o.jsxs("div",{className:"brand",children:[o.jsx("span",{className:"logo"}),o.jsx("h1",{children:hn}),Qt?(()=>{const T=BK(FK()??uo,Qt.version);return o.jsxs("button",{type:"button",className:"v ready",onClick:ga,"aria-haspopup":"dialog","aria-label":T.label,title:T.title,children:[T.text,o.jsx("span",{className:"v-dot","aria-hidden":!0})]})})():dt?o.jsxs("button",{type:"button",className:"v stale",onClick:()=>{ga(),cc()},"aria-haspopup":"dialog","aria-label":yX({...dt,open:ya}),title:dt.kind==="restart"?`Running v${dt.from}; v${dt.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${dt.from}; v${dt.to} is on npm · click for what's new`,children:["v",dt.from,o.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const T={running:uo,latest:xe==null?void 0:xe.latest,latestPending:xe==null?void 0:xe.latestPending,checkedAgo:xe!=null&&xe.checkedAt?qh(Jt-xe.checkedAt):null,checkFailedAgo:xe!=null&&xe.checkFailedAt&&xe.checkFailedAt>(xe.checkedAt??0)?qh(Jt-xe.checkFailedAt):null,checkDisabled:xe==null?void 0:xe.checkDisabled,checking:tt};return o.jsxs("button",{type:"button",className:tt?"v checking":"v",onClick:()=>{ga(),gt(!0)},"aria-busy":tt||void 0,"aria-haspopup":"dialog","aria-label":gX(T),title:mX(T),children:["v",T.running]})})()]}),o.jsxs("span",{className:"status",children:[(()=>{const T=AX({connected:$t,paused:vo,held:En.size,dropped:En.dropped});return T.resting?null:o.jsx("span",{className:`pill ${T.tone}`,title:T.title,children:o.jsxs("span",{className:"pill-box",children:[o.jsx("span",{className:"pill-widest","aria-hidden":!0,children:T.widest}),o.jsx("span",{className:"pill-label",children:T.label})]})})})(),o.jsxs("span",{ref:U,className:"month-usage",title:K?`${K.tokens.toLocaleString()} tokens · ${pR(K.cost)} spent since the 1st of this local calendar month`:z?"Monthly usage is unavailable — ccusage could not be read":"Loading usage since the 1st of this local calendar month",children:[o.jsx("span",{className:"month-usage-label",children:"this month"}),K?o.jsxs(o.Fragment,{children:[o.jsx("b",{children:Pt(K.tokens)}),o.jsx("span",{className:"month-usage-unit",children:"tokens"}),o.jsx("span",{className:"month-usage-sep","aria-hidden":!0,children:"·"}),o.jsx("b",{children:pR(K.cost)})]}):o.jsx("span",{className:"month-usage-pending",children:z?"unavailable":"…"})]})]}),o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:ss}),o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Lc}),_t.length>0&&o.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{Cr.current=_t[0].id,Qn(_t[0].id)},title:`Blocked waiting for you — click, or press W, to go to the one that has been stuck longest:
|
|
291
|
-
${_t.map(T=>` ${T.label}: ${Xl(T.waiting)} (${qh(Jt-T.waiting.since)})`).join(`
|
|
292
|
-
`)}`,"aria-label":`${_t.length} session${_t.length===1?"":"s"} waiting for you`,children:[o.jsx("span",{className:"ap-pulse","aria-hidden":!0}),o.jsx("b",{children:_t.length})," ",o.jsx("span",{className:"ws-word",children:"waiting"})]}),on&&o.jsx("span",{className:on==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:on==="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:on==="on"?"notifications on":"notifications blocked"})]}),Cn&&(()=>{const T=or(Cn),A=Math.max(0,((Cn.endedAt??Jt)-Cn.startedAt)/1e3),Y=Cn.state==="active"?_b(T.total,A):null,te=S.size-1;return o.jsxs("button",{type:"button",className:"selected-ribbon",title:`Zoom to ${Cn.label} and its session (Z)${T.total>0?`
|
|
293
|
-
${bt(T.total)} spent${Y?` · ${Y}`:""}`:""}`,onClick:()=>{try{zn(Cn.id)}catch{}},children:[o.jsx("span",{className:`state-pill state-${Cn.state}`,children:Cn.state==="active"?"live":Cn.state}),o.jsx("span",{className:"selected-label",children:Cn.label}),T.total>0&&o.jsxs("span",{className:"selected-cost",children:[bt(T.total),Y?o.jsxs("span",{className:"selected-rate",children:[" · ",Y]}):null]}),te>0&&o.jsxs("span",{className:"selected-extra",children:["+",te]}),o.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:ye=>{ye.stopPropagation(),R()},children:"×"})]})})(),o.jsxs("div",{className:"actions",children:[o.jsxs("div",{className:"action-run",children:[o.jsxs("button",{className:"btn icon-btn",onClick:go,title:`${F?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":F,"aria-controls":F?"session-list":void 0,children:[o.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:[o.jsx("path",{d:"M5.4 3.6h6.6M5.4 7h6.6M5.4 10.4h6.6"}),o.jsx("path",{d:"M2.2 3.6h.2M2.2 7h.2M2.2 10.4h.2"})]}),o.jsx("span",{className:"tb-word",children:"Session list"})]}),o.jsxs("button",{className:"btn icon-btn",onClick:()=>D(T=>!T),title:`${H?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":H,"aria-controls":H?"usage-panel":void 0,children:[o.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:[o.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"}),o.jsx("path",{d:"M7 1.6v1.5M7 10.9v1.5"})]}),o.jsx("span",{className:"tb-word",children:"Usage"})]}),o.jsxs("button",{className:"btn icon-btn",onClick:()=>kr(T=>!T),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:[o.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:[o.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),o.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),o.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]}),o.jsx("span",{className:"tb-word",children:"History"})]})]}),o.jsxs("div",{className:"action-run",children:[Kn.claude&&o.jsxs("button",{className:"btn icon-btn",onClick:Vr,title:`${Ne?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":Ne,"aria-controls":Ne?"accounts-panel":void 0,children:[o.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:[o.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),o.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]}),o.jsx("span",{className:"tb-word",children:"Accounts"})]}),o.jsxs("button",{className:"btn icon-btn",onClick:()=>le(T=>!T),title:`${ae?"Hide":"Show"} this machine — cores, memory, temperature (S)`,"aria-label":"Toggle machine detail","aria-expanded":ae,"aria-controls":ae?"system-panel":void 0,children:[o.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:[o.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),o.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"})]}),o.jsx("span",{className:"tb-word",children:"Machine"})]}),o.jsxs("button",{className:"btn icon-btn bw-btn",onClick:()=>Ws(T=>!T),title:fc?"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, ${fc?"watching":"not watching"}`+(ur>0?`, ${ur} unread`:""),"aria-haspopup":"dialog",children:[o.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:[o.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"}),fc||ur>0?o.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):o.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),o.jsx("span",{className:"tb-word",children:"Browser watch"}),ur>0&&o.jsx("span",{className:"bw-badge","aria-hidden":!0,children:ur})]})]}),o.jsxs("div",{className:"action-run action-run-utility",children:[Kn.claude&&Re!==null&&o.jsxs("div",{className:"sound-slot",children:[o.jsxs("button",{ref:Se,className:"btn icon-btn",onClick:()=>rn(T=>!T),...to(!1),title:jX(Kn,{on:Re===!0,locked:Vn==="locked",prefs:Le}),"aria-label":`Sound settings, ${Re?"on":"off"}`,"aria-haspopup":"dialog","aria-expanded":Ft,"aria-controls":Ft?"sound-menu":void 0,children:[o.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:[o.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),Re?o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),o.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M10 5.6l2.6 2.8"}),o.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]}),o.jsx("span",{className:"tb-word",children:"Sound"})]}),Ft&&o.jsx(HV,{onClose:()=>rn(!1),soundOn:Re===!0,onToggleSound:ue,prefs:Le,onLevel:(T,A)=>rt(T,{level:A}),onFigure:(T,A)=>rt(T,{figure:A}),onPreview:T=>Ve(T),customAssets:Ye,customSelections:Ce,onBuiltInSelected:ke,onCustomSelected:ut,onImportCustom:ct,onCreateVoice:yt,onRenameCustom:It,onPreviewCustom:Xt,onDeleteCustom:zt,notifyOn:Ho,onToggleNotify:Cd,notifyVetoed:Pc,notifyPermission:Pa?wn:"unsupported",onAskNotify:dl,openerRef:Se})]}),o.jsxs("div",{className:"appearance-slot",children:[o.jsx("button",{ref:_n,className:"btn icon-btn",onClick:()=>{rn(!1),kt(T=>!T)},title:"Appearance settings","aria-label":`Appearance settings, ${_a} theme, character ${ko?"shown":"hidden"}`,"aria-haspopup":"dialog","aria-expanded":vt,"aria-controls":vt?"appearance-menu":void 0,children:_a==="dark"?o.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:[o.jsx("circle",{cx:"7",cy:"7",r:"2.5"}),o.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"})]}):o.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:o.jsx("path",{d:"M11.8 8.4A5 5 0 1 1 5.6 2.2a4 4 0 0 0 6.2 6.2Z"})})}),vt&&o.jsx(dG,{theme:_a,onTheme:dd,characterEnabled:ko,onToggleCharacter:()=>hd(T=>!T),fmVolume:zi,onFmVolume:ap,fmMuted:Ui,onFmMuted:()=>op(T=>!T),fmSource:Gs,onFmSource:So,customFmStations:No,unavailableFmStations:Ks,onAddFmStation:lp,onRenameFmStation:yd,onRemoveFmStation:wd,onClose:()=>kt(!1)})]})]})]})]}),o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Rt?`${Rt.label} removed from the board.`:""}),mc?o.jsxs("div",{className:"ver-banner done",role:"status",children:[o.jsx("span",{className:"ver-dot"}),o.jsxs("strong",{children:["Restarted — now running v",mc,"."]}),o.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):gd&&!$t?o.jsxs("div",{className:"conn-banner",role:"alert",children:[o.jsx("span",{className:"conn-dot"}),Nr?xo==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${hn}…`:(()=>{const T=TX({connected:$t,paused:vo});return o.jsxs(o.Fragment,{children:[`Lost connection to the ${hn} server. Reconnecting…`,T&&o.jsx("span",{className:"conn-sub",children:T})]})})()]}):ya&&dt?o.jsxs("div",{className:`ver-banner ${dt.kind}`,role:"status",children:[o.jsx("span",{className:`ver-dot${ud==null?"":" armed"}`}),dt.kind==="restart"?o.jsxs(o.Fragment,{children:[o.jsxs("strong",{children:["v",dt.to," is installed — this deck still runs v",dt.from,"."]}),xe!=null&&xe.canRestart?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"ver-act",onClick:()=>bo(),...to(Nr),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
294
|
-
|
|
295
|
-
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:Nr?"restarting…":cd.label}),!Nr&&o.jsx("span",{className:"ver-sub",children:cd.clause}),o.jsxs("label",{className:"ver-auto",children:[o.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":qn,onClick:sp,"aria-label":"Auto-restart when idle",title:qn?"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:o.jsx("span",{className:"switch-knob"})}),o.jsx("span",{"aria-hidden":!0,children:oH(qn,ud)})]})]}):o.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."})]}):o.jsxs(o.Fragment,{children:[o.jsxs("strong",{children:[hn," v",dt.to," is out — you are on v",dt.from,"."]}),(xe==null?void 0:xe.upgradeMode)==="install"&&Dn!=="failed"&&o.jsx("button",{type:"button",className:"ver-act",onClick:rd,...to(Dn==="running",Dn==="done"),title:`Runs ${((ra=xe==null?void 0:xe.upgrade)==null?void 0:ra.command)??(xe==null?void 0:xe.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Dn==="running"?"installing…":Dn==="done"?"installed":"Update now"}),(xe==null?void 0:xe.upgradeMode)==="npx"&&(xe==null?void 0:xe.canRestart)&&o.jsx("button",{type:"button",className:"ver-act",onClick:()=>bo({upgrade:!0}),...to(Nr),title:`Runs ${xe==null?void 0:xe.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Nr?"fetching…":Dn==="failed"?"Retry update":"Update & restart"}),Dn==="failed"?o.jsxs("span",{className:"ver-sub fail",title:((Bc=xe==null?void 0:xe.upgrade)==null?void 0:Bc.error)??"",children:[(xe==null?void 0:xe.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ko=xe==null?void 0:xe.upgrade)==null?void 0:Ko.error)??"unknown error"," — run it yourself:"]}):(xe==null?void 0:xe.upgradeMode)==="npx"?o.jsx("span",{className:"ver-sub",children:xe!=null&&xe.canRestart?"npx cannot upgrade in place, so the deck re-runs:":u0.npx}):xe!=null&&xe.upgradeBlocked?o.jsx("span",{className:"ver-sub",children:Object.hasOwn(u0,xe.upgradeBlocked)?u0[xe.upgradeBlocked]:"cannot install from here"}):null,o.jsxs("button",{type:"button",className:"ver-cmd",onClick:dc,title:"Copy to clipboard",children:[o.jsx("code",{children:xe==null?void 0:xe.command}),o.jsx("span",{className:"ver-cmd-hint",children:De?"copied":"copy"})]})]}),o.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:po,children:"×"})]}):td&&ht?o.jsxs("div",{className:"ver-banner",role:"status",children:[o.jsx("span",{className:"ver-dot"}),o.jsxs("strong",{children:[ht," still works — the deck is called ",hn," now."]}),xe!=null&&xe.renameFix?o.jsx("span",{className:"ver-sub",children:xe.renameFix}):null,o.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:nd,children:"×"})]}):null,yh(Ge)&&Kn.claude&&o.jsx(JU,{leaving:Ge==="leaving",onClose:()=>Ie(!1)}),F&&o.jsx(Gq,{state:l.current,now:Jt,selectedIds:S,onSelect:La,onClose:()=>L(!1),removedIds:hr,onBringBackAll:()=>{Zn([...c]),p(null)}}),o.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${Mt?" bubbling":""}${Zr?" dragging-any":""}${el&&$o==="over"?" trash-hover":""}`,"data-lod":nl,ref:_r,onMouseDownCapture:Ao,onPointerDownCapture:Xi,onPointerUpCapture:Xi,onWheelCapture:Xi,onFocusCapture:T=>{const A=T.target;if(!a0(A)||Qr.current==null||Qr.current==="detail")return;const Y=A.getAttribute("data-id");Y&&l.current.agents.has(Y)&&A.matches(":focus-visible")&&hR(Y,A,"focus")},onBlurCapture:T=>{var Y,te;const A=(te=(Y=T.target).getAttribute)==null?void 0:te.call(Y,"data-id");A&&Za(A)},children:[Uo===0&&(!$t&&Ln?o.jsx(oZ,{}):o.jsx(iZ,{live:$t,everConnected:gd,providers:Kn,workspace:Ti,onTour:()=>V(!0)})),(es.length>1||wc.size>0)&&o.jsx("div",{ref:Ii,className:`cat-filter-bar${$i?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:es.map(T=>{const A=wc.has(T);return o.jsxs("button",{type:"button",className:`cat-filter${A?" off":""}`,onClick:()=>al(T),"aria-pressed":!A,title:`${A?"Show":"Hide"} ${mf[T]} tools`,children:[o.jsx(tZ,{cat:T}),o.jsx("span",{className:"cat-name",children:mf[T]})]},T)})}),o.jsxs(BA,{nodes:Fo,edges:sl,nodeTypes:$X,edgesFocusable:!1,edgeTypes:OX,fitView:!Bi,fitViewOptions:{padding:.25,duration:Ah({durationMs:vR,documentHidden:document.hidden})?vR:0},minZoom:T$,maxZoom:R$,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:(T,A)=>{if(A.type==="sessionGroup"){R();return}const Y=A.type==="recapNote"?A.data.parentId:A.id;C(Y,T.shiftKey,!1),!T.shiftKey&&(y&&v(!1),jd?window.setTimeout(()=>{try{zn(Y)}catch{}},80):zn(Y))},onPaneClick:()=>{Za(),R()},onNodeDoubleClick:(T,A)=>{if(A.type!=="agent"&&A.type!=="recapNote")return;const Y=A.type==="recapNote"?A.data.parentId:A.id;C(Y,!1),window.setTimeout(()=>{try{zn(Y)}catch{}},80)},onNodeMouseEnter:(T,A)=>{A.type!=="agent"&&A.type!=="recapNote"||Ra.current||Qr.current==null||Qr.current==="detail"||hR(A.id,T.currentTarget)},onNodeMouseLeave:(T,A)=>Za(A.id),onMoveStart:T=>{Za(),n0(Zi(T))&&(_o.current+=1),n0(Zi(T))&&Qs()},onMove:(T,A)=>{var te,ye;Es(),n0(Zi(T))&&Qs(),(te=_r.current)==null||te.style.setProperty("--zoom",String(A.zoom));const Y=ZY(Qr.current,A.zoom,Ic());Y!==Qr.current&&(Qr.current=Y,(ye=_r.current)==null||ye.setAttribute("data-lod",Y),Mc(Y),Y==="detail"&&Za()),Sc.current&&window.clearTimeout(Sc.current),Sc.current=window.setTimeout(()=>QX(A),250)},onNodeDragStart:(T,A)=>{var Y,te;if(Za(),up(),Ra.current=!0,xa.current=new Map,Rc(!0),A.type==="agent"&&(Oa(((Y=l.current.agents.get(A.id))==null?void 0:Y.label)??""),$a(!0)),kd("far"),Es(),Qs(),A.type==="sessionGroup"){const ye=(te=A.data)==null?void 0:te.sessionId,je=new Map;if(ye)for(const Oe of gn){const Be=Oe.data;(Be==null?void 0:Be.sessionId)===ye&&je.set(Oe.id,{x:Oe.position.x,y:Oe.position.y})}qi.current={start:{x:A.position.x,y:A.position.y},members:je};return}Gt.current.set(A.id,{x:A.position.x,y:A.position.y})},onNodeDrag:(T,A)=>{var Y;if(Es(),A.type==="agent"&&kd(Oo(T)),A.type==="sessionGroup"){const te=qi.current;if(!te)return;const ye=A.position.x-te.start.x,je=A.position.y-te.start.y;for(const[Be,lt]of te.members){const et={x:lt.x+ye,y:lt.y+je};Gt.current.set(Be,et),Kt.current.set(Be,et)}const Oe=xa.current;if(Oe){for(const[Be,lt]of te.members)Oe.set(Be,{x:lt.x+ye,y:lt.y+je});Oe.set(A.id,{x:A.position.x,y:A.position.y})}Li(Be=>Be+1);return}Gt.current.set(A.id,{x:A.position.x,y:A.position.y}),Kt.current.set(A.id,{x:A.position.x,y:A.position.y}),(Y=xa.current)==null||Y.set(A.id,{x:A.position.x,y:A.position.y}),Li(te=>te+1)},onNodeDragStop:(T,A)=>{Es();const Y=A.type==="agent"&&Oo(T)==="over";if(Ra.current=!1,xa.current=null,Rc(!1),$a(!1),ad(te=>te+1),A.type==="sessionGroup"){const te=qi.current;if(te){const ye=A.position.x-te.start.x,je=A.position.y-te.start.y;for(const[Oe,Be]of te.members){const lt={x:Be.x+ye,y:Be.y+je};Gt.current.set(Oe,lt),Kt.current.set(Oe,lt)}}qi.current=null,$h(Kt.current,Gt.current),ad(ye=>ye+1);return}if(Gt.current.set(A.id,{x:A.position.x,y:A.position.y}),Kt.current.set(A.id,{x:A.position.x,y:A.position.y}),Y){Er(A.id);return}$h(Kt.current,Gt.current)},children:[o.jsx($5,{gap:28,size:1,color:Yr["--grid-line"]}),o.jsx(Mq,{onFocusSession:zn}),o.jsx(ZF,{agents:l.current.agents,visibleAgentIds:To,positions:Kt.current,pinned:Gt.current,measured:Sr.current,spotlight:jr,hiddenCategories:wc,now:Jt,onOpenTool:E}),Ec&&o.jsxs("div",{className:"autofit-chip",children:[o.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),o.jsx("button",{type:"button",className:"autofit-resume",onClick:Ta,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]}),o.jsxs(C5,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[o.jsx(Or,{onClick:()=>e.zoomIn(),title:"Zoom in","aria-label":"Zoom in",disabled:t,children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:o.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),o.jsx(Or,{onClick:()=>e.zoomOut(),title:"Zoom out","aria-label":"Zoom out",disabled:n,children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:o.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),o.jsx(Or,{onClick:Ta,title:Ec?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":Ec?"":void 0,children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),o.jsx(Or,{"data-group-start":"",onClick:ba,title:CX({paused:vo,held:En.size,dropped:En.dropped}),"aria-label":EX,"aria-pressed":vo,children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:o.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),o.jsx(Or,{onClick:yn,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),o.jsx(Or,{"data-group-start":"","data-danger":"",onClick:()=>ns("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),o.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"}),o.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"}),o.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),o.jsx(Or,{"data-group-start":"",onClick:()=>M(T=>!T),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.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"}),o.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),o.jsx(b5,{zoomable:!0,pannable:!0,nodeColor:Ea,nodeStrokeWidth:2,maskColor:Yr["--minimap-mask"],maskStrokeColor:Yr["--line"]}),ko&&o.jsx(gK,{volume:zi,muted:Ui,source:Gs,playRequest:fd,customStation:No.find(T=>ki(T.id)===Gs),onAvailabilityChange:jo})]}),yh(Ac)&&o.jsxs("div",{ref:Nd,className:`drag-trash-zone ${$o}${Ac==="leaving"?" leaving":""}`,role:"status",children:[o.jsx("svg",{className:"drag-trash-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:o.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"})}),o.jsxs("span",{className:"drag-trash-copy",children:[o.jsx("span",{className:"drag-trash-text",children:$o==="over"?o.jsxs(o.Fragment,{children:["Release to remove ",o.jsx("strong",{className:"drag-trash-name",children:tl||"this card"})]}):"Drop here to remove from the board"}),o.jsx("span",{className:"drag-trash-hint",children:$o==="over"?"The session list (L) brings it back":"The session keeps running"})]})]}),o.jsx(iX,{agentFor:ol,recapFor:rs,labelFor:Ed,bounds:il})]}),yh(Pe)&&o.jsx(E8,{state:l.current,now:Jt,providers:Kn,liveSince:Ca,leaving:Pe==="leaving",onClose:()=>D(!1)}),yh(ze)&&o.jsx(oB,{usageOpen:H,leaving:ze==="leaving",onClose:()=>le(!1)}),y&&Cn?o.jsxs("aside",{className:"detail","aria-label":"Detail",children:[o.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>v(!1),children:"×"}),o.jsx(cZ,{agent:Cn,now:Jt,onOpenTool:E,onShowSummary:$,onExportSession:T=>JX(l.current,T),onRemove:Tt})]}):null,qo&&o.jsx(bq,{tool:qo,onClose:()=>E(null)}),Gr&&o.jsx(w.Suspense,{fallback:null,children:o.jsx(MX,{providers:Kn,onClose:()=>kr(!1)})}),wa&&o.jsx(w.Suspense,{fallback:null,children:o.jsx(IX,{onClose:()=>Ws(!1),onSeen:T=>{cl(""),np(T);try{localStorage.setItem(iR,String(T))}catch{}},onWatching:pc,palette:Yr})}),q&&(()=>{const T=l.current.agents.get(q);return T?o.jsx(nF,{agent:T,onClose:()=>B(null)}):null})(),I&&o.jsx(Hq,{state:l.current,sessionId:I,onClose:()=>$(null)}),cr&&o.jsx(HK,{entries:cr.entries,since:cr.since,firstRun:cr.firstRun,running:uo,onClose:()=>sn(null),onTour:()=>{sn(null),V(!0)},updateVersion:Qt==null?void 0:Qt.version,updateBusy:ma,updateFailure:xr&&(!Qt||Qt.version===xr.version)?UK(xr.failure,xr.version):void 0,onUpdateRestart:Qt?()=>{Ci(Qt.version)}:void 0,onRestart:!Qt&&(xe!=null&&xe.canRestart)?()=>{sn(null),bo()}:void 0}),(()=>{const{request:T,waiting:A}=RY(Mi,sd.current);return T?o.jsx(AY,{request:T,waiting:A,busy:js,now:Date.now(),onAccept:()=>void Vs("accept",T.fp),onDecline:()=>void Vs("dismiss",T.fp),onLater:()=>{js||(sd.current.add(T.fp),wo(Y=>[...Y]))}}):null})(),ee&&o.jsx(lV,{onClose:()=>M(!1),onTour:()=>{M(!1),V(!0)}}),X&&o.jsx(WM,{title:"What the deck shows you",steps:Tz,onClose:()=>{V(!1),IK(rR()),pu()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const T=G.current;G.current=null,T&&sn(T)}}),W&&o.jsx(aV,{agentCount:Uo,onConfirm:()=>ns("confirmation"),onCancel:()=>ne(!1)})]})}function oZ(){return o.jsxs("div",{className:"empty-hero",children:[o.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[o.jsx("div",{className:"core"}),o.jsxs("div",{className:"orbit r1",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r2",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r3",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]})]}),o.jsxs("h2",{children:["Too many ",hn," tabs are open"]}),o.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",o.jsx("code",{children:hn})," tabs are holding them. Close one and this tab connects on its own."]})]})}function iZ({live:e,everConnected:t,providers:n,workspace:r,onTour:s}){const l=!e;return o.jsxs("div",{className:"empty-hero",children:[o.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[o.jsx("div",{className:"core"}),o.jsxs("div",{className:"orbit r1",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r2",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r3",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]})]}),l?o.jsxs(o.Fragment,{children:[o.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),o.jsxs("p",{children:[t?"This page lost its connection to ":"This page cannot reach ",o.jsx("code",{children:hn}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):lZ(n,r),!l&&o.jsx("button",{type:"button",className:"btn empty-tour",onClick:s,children:"Take the tour"})]})}function lZ(e,t){const n=vX(t);return o.jsxs(o.Fragment,{children:[o.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?o.jsxs("p",{children:[n.lead," ",o.jsx("code",{children:n.workspace}),n.tail]}):o.jsxs("p",{children:["Run ",o.jsx("code",{children:"claude"})," or ",o.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."]}),SX(e).map(r=>o.jsx("p",{className:"hint-row",children:r.spans.map((s,l)=>s.code?o.jsx("code",{children:s.text},l):o.jsx("span",{children:s.text},l))},r.provider))]})}function cZ({agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:s,onRemove:l}){const c=`${e.synthetic?"≥ ":""}${Gl(e.startedAt,e.endedAt,t)}`,u=or(e),f=u.total>0,p=e.usage.inputTokens+e.usage.outputTokens,h=new Map;for(const b of e.tools){const _=H$(b.name);h.set(_,(h.get(_)??0)+1)}const m=e.tools.filter(b=>b.ok===!1).length,y=e.tools.filter(b=>!b.endedAt).length,v=Array.from(h.entries()).sort((b,_)=>_[1]-b[1]),S=h.has("mcp")?VF(e.tools.map(b=>b.name)):null;return o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"detail-hero",children:[o.jsxs("div",{className:"hero-line",children:[o.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),o.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),o.jsxs("div",{className:"hero-meta",children:[o.jsx("span",{className:"hero-meta-item",children:e.kind==="root"?"session":"subagent"}),o.jsx("span",{className:"hero-sep",children:"·"}),o.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:c}),e.model&&(()=>{const b=sM(e);return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"hero-sep",children:"·"}),o.jsxs("span",{className:"model-chip","data-family":Sf(e.model),title:b.length>0?`${e.model}
|
|
296
|
-
spend on this panel also covers:
|
|
297
|
-
${b.join(`
|
|
298
|
-
`)}`:e.model,children:[io(e.model),b.length>0?` +${b.length}`:""]})]})})()]}),f&&o.jsxs("div",{className:"hero-cost",children:[o.jsxs("div",{className:"hero-cost-headline",children:[o.jsx("span",{className:"hero-cost-value",children:bt(u.total)}),o.jsx("span",{className:"hero-cost-label",children:"spend"})]}),o.jsx($b,{cost:u})]}),o.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&r&&o.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&&o.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Download this session as JSON",children:"Export JSON"}),l&&o.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:l,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 b=Cf(e);if(!b)return null;const _=nf(b.at,t);return o.jsxs("section",{className:"detail-section",children:[o.jsxs("h3",{children:["Recap ",o.jsx("span",{className:"section-count",title:_.title,children:_.label})]}),o.jsx("p",{className:"detail-recap",children:b.text})]})})(),e.tools.length>0&&o.jsxs("section",{className:"detail-section",children:[o.jsx("h3",{children:"Activity"}),o.jsxs("div",{className:"activity-row",children:[o.jsxs("div",{className:"activity-counters",children:[o.jsxs("span",{className:"ac-item",children:[o.jsx("b",{children:e.toolCount})," calls"]}),y>0&&o.jsxs("span",{className:"ac-item ac-live",children:[o.jsx("b",{children:y})," live"]}),m>0&&o.jsxs("span",{className:"ac-item ac-err",children:[o.jsx("b",{children:m})," err"]})]}),o.jsx("div",{className:"cat-strip",children:v.map(([b,_])=>{const k=b==="mcp"?S:null,j=k==null?void 0:k.hue,E=`${_} ${mf[b]} call${_===1?"":"s"}`;return o.jsxs("span",{className:`cat-chip cat-${b}${j!=null?" mcp-hue":""}`,style:j!=null?{"--mcp-hue":j}:void 0,title:k?`${E}, all to ${k.label}`:E,children:[o.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:U$[b]}),o.jsx("span",{className:"cat-name",children:mf[b]}),o.jsx("span",{className:"cat-count",children:_}),k&&o.jsx("span",{className:"cat-server",children:k.label})]},b)})})]})]}),p>0&&o.jsxs("section",{className:"detail-section",children:[o.jsx("h3",{children:"Tokens"}),o.jsxs("div",{className:"tokens-grid",children:[o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"in"}),o.jsx("b",{title:e.usage.inputTokens.toLocaleString(),children:Pt(e.usage.inputTokens)})]}),o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"out"}),o.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:Pt(e.usage.outputTokens)})]}),o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"cache r"}),o.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:Pt(e.usage.cacheReadTokens)})]}),o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"cache c"}),o.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:Pt(e.usage.cacheCreateTokens)})]})]})]}),o.jsxs("section",{className:"detail-section",children:[o.jsx("h3",{children:"Identity"}),o.jsxs("div",{children:[e.cwd&&o.jsxs("div",{className:"row",children:[o.jsx("span",{className:"k",children:"cwd"}),o.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),o.jsxs("div",{className:"row",children:[o.jsx("span",{className:"k",children:"session"}),o.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&o.jsxs("div",{className:"row",children:[o.jsx("span",{className:"k",children:"parent"}),o.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&o.jsxs("section",{className:"detail-section",children:[o.jsxs("h3",{children:["Prompts ",o.jsx("span",{className:"section-count",children:GA(e.prompts).length})]}),o.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((b,_)=>{const k=nf(b.at,t),j=Sb(b.text);return j?o.jsxs("details",{className:"prompt-entry prompt-injected",children:[o.jsxs("summary",{children:[o.jsx("span",{className:"prompt-time",title:k.title,children:k.label}),o.jsx("span",{className:"prompt-injected-label",children:j.label})]}),j.detail&&o.jsx("div",{className:"prompt-injected-detail",children:j.detail})]},_):o.jsxs("div",{className:"prompt-entry",children:[o.jsx("div",{className:"prompt-time",title:k.title,children:k.label}),o.jsx("div",{className:"prompt-text",children:b.text})]},_)})})]}),o.jsxs("section",{className:"detail-section",children:[o.jsxs("h3",{children:["Tool calls ",o.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&o.jsx("div",{className:"empty",children:"No tool calls yet."}),o.jsx("div",{children:e.tools.slice().reverse().map(b=>o.jsx(dZ,{t:b,onClick:()=>n(b.id)},b.id))})]})]})}const uZ={inflight:"in-flight",done:"done",err:"error"};function dZ({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",r=oM(e,"…");return o.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[o.jsxs("span",{className:"name",children:[o.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:uZ[n]}),e.name]}),o.jsx("span",{style:{color:"var(--muted)"},children:r})]})}try{lF(window.localStorage)}catch{}const hZ=AO.createRoot(document.getElementById("root"));hZ.render(o.jsx(nZ,{}));export{iR as S,kX as a,pZ as b,$u as c,Pt as d,fZ as e,bt as f,io as g,Ps as h,yi as i,o as j,TY as k,CS as p,w as r,to as s,mn as u};
|